Class: BindingMagicString
Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1273
Constructors
Constructor
new BindingMagicString(source, options?): BindingMagicString;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1274
Parameters
source
string
options?
BindingMagicStringOptions | null
Returns
BindingMagicString
Accessors
filename
Get Signature
get filename(): string | null;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1275
Returns
string | null
Methods
append()
append(content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1279
Parameters
content
string
Returns
this
appendLeft()
appendLeft(index, content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1282
Parameters
index
number
content
string
Returns
this
appendRight()
appendRight(index, content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1283
Parameters
index
number
content
string
Returns
this
clone()
clone(): BindingMagicString;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1313
Returns a clone of the MagicString instance.
Returns
BindingMagicString
generateDecodedMap()
generateDecodedMap(options?): BindingDecodedMap;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1340
Generates a decoded source map for the transformations applied to this MagicString. Returns a BindingDecodedMap object with mappings as an array of arrays.
Parameters
options?
BindingSourceMapOptions | null
Returns
BindingDecodedMap
generateMap()
generateMap(options?): BindingSourceMap;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1335
Generates a source map for the transformations applied to this MagicString. Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings.
Parameters
options?
BindingSourceMapOptions | null
Returns
BindingSourceMap
hasChanged()
hasChanged(): boolean;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1286
Returns
boolean
indent()
indent(indentor?): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1298
Parameters
indentor?
string | null
Returns
this
insert()
insert(index, content): void;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1311
Deprecated method that throws an error directing users to use prependRight or appendLeft. This matches the original magic-string API which deprecated this method.
Parameters
index
number
content
string
Returns
void
isEmpty()
isEmpty(): boolean;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1288
Returns
boolean
lastChar()
lastChar(): string;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1315
Returns the last character of the generated string, or an empty string if empty.
Returns
string
lastLine()
lastLine(): string;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1317
Returns the content after the last newline in the generated string.
Returns
string
length()
length(): number;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1287
Returns
number
move()
move(
start,
end,
index): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1297
Alias for relocate to match the original magic-string API. Moves the characters from start to end to index. Returns this for method chaining.
Parameters
start
number
end
number
index
number
Returns
this
overwrite()
overwrite(
start,
end,
content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1284
Parameters
start
number
end
number
content
string
Returns
this
prepend()
prepend(content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1278
Parameters
content
string
Returns
this
prependLeft()
prependLeft(index, content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1280
Parameters
index
number
content
string
Returns
this
prependRight()
prependRight(index, content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1281
Parameters
index
number
content
string
Returns
this
relocate()
relocate(
start,
end,
to): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1291
Parameters
start
number
end
number
to
number
Returns
this
remove()
remove(start, end): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1289
Parameters
start
number
end
number
Returns
this
replace()
replace(from, to): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1276
Parameters
from
string
to
string
Returns
this
replaceAll()
replaceAll(from, to): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1277
Parameters
from
string
to
string
Returns
this
reset()
reset(start, end): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1325
Resets the portion of the string from start to end to its original content. This undoes any modifications made to that range. Supports negative indices (counting from the end).
Parameters
start
number
end
number
Returns
this
slice()
slice(start?, end?): string;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1330
Returns the content between the specified original character positions. Supports negative indices (counting from the end).
Parameters
start?
number | null
end?
number | null
Returns
string
snip()
snip(start, end): BindingMagicString;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1319
Returns a clone with content outside the specified range removed.
Parameters
start
number
end
number
Returns
BindingMagicString
toString()
toString(): string;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1285
Returns
string
trim()
trim(charType?): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1300
Trims whitespace or specified characters from the start and end.
Parameters
charType?
string | null
Returns
this
trimEnd()
trimEnd(charType?): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1304
Trims whitespace or specified characters from the end.
Parameters
charType?
string | null
Returns
this
trimLines()
trimLines(): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1306
Trims newlines from the start and end.
Returns
this
trimStart()
trimStart(charType?): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1302
Trims whitespace or specified characters from the start.
Parameters
charType?
string | null
Returns
this
update()
update(
start,
end,
content): this;Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/binding-B92Lq__Q.d.mts:1290
Parameters
start
number
end
number
content
string
Returns
this