import { MagicString } from "https://deno.land/x/aleph@1.0.0-beta.1/server/deps.ts";
Methods
Adds the specified character index (with respect to the original string) to sourcemap mappings, if hires
is false.
Appends the specified content at the index in the original string.
If a range ending with index is subsequently moved, the insert will be moved with it.
See also s.prependLeft(...)
.
Appends the specified content at the index in the original string.
If a range starting with index is subsequently moved, the insert will be moved with it.
See also s.prependRight(...)
.
Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.
Useful if you need to manipulate the sourcemap further, but most of the time you will use generateMap
instead.
Prefixes each line of the string with prefix. If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
Prefixes each line of the string with prefix. If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
The options argument can have an exclude property, which is an array of [start, end] character ranges. These ranges will be excluded from the indentation - useful for (e.g.) multiline strings.
Moves the characters from start and
endto
index`.
Replaces the characters from start
to end
with content
. The same restrictions as s.remove()
apply.
The fourth argument is optional. It can have a storeName property — if true, the original name will be stored for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only the content is overwritten, or anything that was appended/prepended to the range as well.
Same as s.appendLeft(...)
, except that the inserted content will go before any previous appends or prepends at index
Same as s.appendRight(...)
, except that the inserted content will go before any previous appends or prepends at index
Removes the characters from start
to end
(of the original string, not the generated string).
Removing the same content twice, or making removals that partially overlap, will cause an error.
String replacement with RegExp or string.
Returns the content of the generated string that corresponds to the slice between start
and end
of the original string.
Throws error if the indices are for characters that were already removed.
Returns a clone of s
, with all content before the start
and end
characters of the original string removed.
Trims content matching charType
(defaults to \s
, i.e. whitespace) from the start and end.
Trims content matching charType
(defaults to \s
, i.e. whitespace) from the end.
Trims content matching charType
(defaults to \s
, i.e. whitespace) from the start.