Generates 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 | nullReturns the guessed indentation string, or \t if none is found.
Optionalindentor: 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.
Optionaloptions: BindingOverwriteOptions | nullAccepts a string or RegExp pattern. RegExp supports $&, $$, and $N substitutions.
Accepts a string or RegExp pattern. RegExp must have the global (g) flag.
Returns the UTF-16 offset past the last match, or -1 if no match was found.
The JS wrapper uses this to update lastIndex on the caller's RegExp.
Global/sticky behavior is derived from the regex's own flags.
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 | nullOptionaloptions: BindingUpdateOptions | null
Returns a clone of the MagicString instance.