magic-string
Source: lib/magic-string.js
A bundled copy of Rich Harris's magic-string with its sourcemap-codec: edit a string by index (overwrite, appendLeft, remove, move, ...) and generate a source map of the result.
import MagicString from 'magic-string';
const s = new MagicString('problems = 99');
s.overwrite(0, 8, 'answer');
s.toString(); // 'answer = 99'
s.generateMap({ hires: true });Export list
Generated by utilities/doc-api.js from the magic-string dump of utilities/api-surface.sh: 129 members. Edit the text above this block, not the block.
BitSet
class, constructible
- methods:
add(),has() - properties:
[Symbol.toStringTag]
Bundle
class, constructible
- methods:
addSource(),append(),clone(),generateDecodedMap(),generateMap(),getIndentString(),indent(),isEmpty(),length(),prepend(),toMagicString(),toString(),trim(),trimEnd(),trimLines(),trimStart() - properties:
[Symbol.toStringTag]
Chunk
class, constructible
- methods:
appendLeft(),appendRight(),clone(),contains(),eachNext(),eachPrevious(),edit(),prependLeft(),prependRight(),reset(),split(),toString(),trimEnd(),trimStart() - properties:
[Symbol.toStringTag]
MagicString
class, constructible
- methods:
addSourcemapLocation(),append(),appendLeft(),appendRight(),clone(),generateDecodedMap(),generateMap(),getIndentString(),getRawIndentString(),hasChanged(),indent(),insert(),insertLeft(),insertRight(),isEmpty(),lastChar(),lastLine(),length(),move(),overwrite(),prepend(),prependLeft(),prependRight(),remove(),replace(),replaceAll(),reset(),slice(),snip(),toString(),trim(),trimEnd(),trimEndAborted(),trimLines(),trimStart(),trimStartAborted(),update() - properties:
[Symbol.toStringTag]
MagicStringError
class, constructible
- properties:
[Symbol.toStringTag]
SourceMap
class, constructible
- methods:
toString(),toUrl() - properties:
[Symbol.toStringTag]
default
class, constructible
- methods:
addSourcemapLocation(),append(),appendLeft(),appendRight(),clone(),generateDecodedMap(),generateMap(),getIndentString(),getRawIndentString(),hasChanged(),indent(),insert(),insertLeft(),insertRight(),isEmpty(),lastChar(),lastLine(),length(),move(),overwrite(),prepend(),prependLeft(),prependRight(),remove(),replace(),replaceAll(),reset(),slice(),snip(),toString(),trim(),trimEnd(),trimEndAborted(),trimLines(),trimStart(),trimStartAborted(),update() - properties:
[Symbol.toStringTag]