Optionaloptions: BindingMagicStringOptions | nullGenerates a decoded source map for the transformations applied to this MagicString. Returns a BindingDecodedMap object with mappings as an array of arrays.
Optionaloptions: BindingSourceMapOptions | nullGenerates a source map for the transformations applied to this MagicString. Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings.
Optionaloptions: BindingSourceMapOptions | nullOptionalindentor: string | nullOptionaloptions: BindingIndentOptions | nullDeprecated method that throws an error directing users to use prependRight or appendLeft. This matches the original magic-string API which deprecated this method.
Returns the last character of the generated string, or an empty string if empty.
Returns the content after the last newline in the generated string.
Alias for relocate to match the original magic-string API.
Moves the characters from start to end to index.
Returns this for method chaining.
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).
Returns the content between the specified UTF-16 code unit positions (JS string indices). Supports negative indices (counting from the end).
When an index falls in the middle of a surrogate pair, the lone surrogate is
included in the result (matching the original magic-string / JS behavior).
This is done by returning a UTF-16 encoded JS string via napi_create_string_utf16.
Optionalstart: number | nullOptionalend: number | nullReturns a clone with content outside the specified range removed.
Trims whitespace or specified characters from the start and end.
OptionalcharType: string | nullTrims whitespace or specified characters from the end.
OptionalcharType: string | nullTrims newlines from the start and end.
Trims whitespace or specified characters from the start.
OptionalcharType: string | null
Returns a clone of the MagicString instance.