Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Rich-Harris/magic-string
/ functions
Functions
330 in github.com/Rich-Harris/magic-string
⨍
Functions
330
◇
Types & classes
66
↓ 33 callers
Method
toString
()
tests/fuzz/edit-model.ts:121
↓ 23 callers
Method
forEach
(fn: (n: number) => void)
src/BitSet.ts:16
↓ 19 callers
Method
appendLeft
(index: number, content: string)
tests/fuzz/edit-model.ts:50
↓ 19 callers
Method
overwrite
(start: number, end: number, content: string)
tests/fuzz/edit-model.ts:103
↓ 17 callers
Method
remove
(start: number, end: number)
tests/fuzz/edit-model.ts:70
↓ 16 callers
Method
prepend
(content: string)
tests/fuzz/edit-model.ts:46
↓ 15 callers
Method
addSource
* Adds the specified source to the bundle, which can either be a `MagicString` object directly, * or an options object that holds a magic string `c
src/Bundle.ts:91
↓ 14 callers
Method
append
(content: string)
tests/fuzz/edit-model.ts:42
↓ 13 callers
Method
move
(t, e, n)
benchmark/data-min.js:388
↓ 13 callers
Method
replace
(t, e)
benchmark/data-min.js:649
↓ 12 callers
Method
prependRight
(index: number, content: string)
tests/fuzz/edit-model.ts:65
↓ 12 callers
Method
slice
* Returns the content of the generated string that corresponds to the slice * between `start` and `end` of the original string, walking the generat
src/MagicString.ts:1032
↓ 11 callers
Method
update
(start: number, end: number, content: string, options?: { overwrite?: boolean })
tests/fuzz/edit-model.ts:83
↓ 10 callers
Method
appendRight
(index: number, content: string)
tests/fuzz/edit-model.ts:60
↓ 9 callers
Method
_resolveIndex
* Applies `offset`, resolves a negative index from the end of `original` as * `update`/`remove` always have, and rejects anything that is not an in
src/MagicString.ts:1118
↓ 9 callers
Method
replace
(searchValue, replacement)
benchmark/data.js:787
↓ 9 callers
Method
slice
(start: number, end: number)
tests/fuzz/edit-model.ts:138
↓ 9 callers
Method
split
(index)
benchmark/data.js:76
↓ 9 callers
Method
split
(t)
benchmark/data-min.js:71
↓ 9 callers
Method
split
(index: number)
tests/fuzz/edit-model.ts:34
↓ 8 callers
Method
_split
@internal
src/MagicString.ts:1150
↓ 8 callers
Method
add
(n: number)
src/BitSet.ts:8
↓ 8 callers
Method
replace
* String replacement with RegExp or string.
src/MagicString.ts:1544
↓ 7 callers
Method
_split
(index)
benchmark/data.js:677
↓ 7 callers
Method
_split
(t)
benchmark/data-min.js:543
↓ 7 callers
Method
generateMap
* Generates a version 3 sourcemap covering every source that has a `filename`. * Options are as per `MagicString#generateMap`, except that `include
src/Bundle.ts:291
↓ 7 callers
Method
split
(index: number)
src/Chunk.ts:116
↓ 7 callers
Method
trim
* Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end.
src/Bundle.ts:475
↓ 6 callers
Method
clone
()
src/Chunk.ts:45
↓ 6 callers
Method
generateDecodedMap
* Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. * Takes the same options as `generateMap`.
src/Bundle.ts:276
↓ 6 callers
Method
reset
(start: number, end: number)
tests/fuzz/edit-model.ts:107
↓ 6 callers
Method
slice
(start = 0, end = this.original.length)
benchmark/data.js:635
↓ 6 callers
Method
slice
(t = 0, e = this.original.length)
benchmark/data-min.js:514
↓ 5 callers
Method
edit
(content, storeName, contentOnly)
benchmark/data.js:60
↓ 5 callers
Method
edit
(t, e, n)
benchmark/data-min.js:56
↓ 5 callers
Method
edit
(content: string, storeName?: boolean, contentOnly?: boolean)
src/Chunk.ts:83
↓ 5 callers
Method
has
(n: number)
src/BitSet.ts:12
↓ 5 callers
Method
prependLeft
(index: number, content: string)
tests/fuzz/edit-model.ts:55
↓ 4 callers
Method
addSourcemapLocation
(t)
benchmark/data-min.js:249
↓ 4 callers
Method
advance
(str: string)
src/utils/Mappings.ts:234
↓ 4 callers
Method
appendRight
* Appends the specified content at the index in the original string. * If a range *starting* with index is subsequently moved, the insert will be m
src/MagicString.ts:249
↓ 4 callers
Method
finish
(segments: FullSegment[])
src/utils/MappingsEncoder.ts:79
↓ 4 callers
Method
indent
* Prefixes each line of every source and of the intro with `indentStr`, guessed with `getIndentString()` * when not supplied. Each source's `indent
src/Bundle.ts:385
↓ 4 callers
Method
toString
()
benchmark/data.js:97
↓ 3 callers
Function
C
(l)
benchmark/data-min.js:161
↓ 3 callers
Method
_ensureindentStr
@internal
src/MagicString.ts:379
↓ 3 callers
Method
_hasRemovedContent
* Whether the original range [start, end) has had any of its characters * removed. `replace`/`replaceAll` search `original`, so a match can land on
src/MagicString.ts:1399
↓ 3 callers
Method
addSource
(t)
benchmark/data-min.js:687
↓ 3 callers
Method
advance
(str)
benchmark/data.js:258
↓ 3 callers
Method
advance
(t)
benchmark/data-min.js:213
↓ 3 callers
Method
assertOrdered
(start: number, end: number)
tests/fuzz/edit-model.ts:160
↓ 3 callers
Method
between
(start: number, end: number)
tests/fuzz/edit-model.ts:144
↓ 3 callers
Method
checkIntegrity
()
tests/__utils/IntegrityCheckingMagicString.ts:6
↓ 3 callers
Method
drain
(trailing: FullSegment[] | null)
src/utils/MappingsEncoder.ts:85
↓ 3 callers
Function
expandReplacement
* Expands the `$` substitution patterns that `String.prototype.replace` accepts * in a string replacement. * https://developer.mozilla.org/en-US/doc
src/MagicString.ts:59
↓ 3 callers
Method
getIndentString
* Returns the most common indent string among the sources, falling back to a tab.
src/Bundle.ts:366
↓ 3 callers
Function
getLocator
(source)
benchmark/data.js:190
↓ 3 callers
Function
getLocator
(source: string)
src/utils/getLocator.ts:6
↓ 3 callers
Function
getRelativePath
(from: string, to: string)
src/utils/getRelativePath.ts:1
↓ 3 callers
Method
hasChanged
()
tests/fuzz/edit-model.ts:130
↓ 3 callers
Function
int
(max: number)
tests/fuzz/random-edits.test.ts:46
↓ 3 callers
Method
isEmpty
()
tests/fuzz/edit-model.ts:134
↓ 3 callers
Function
isObject
(thing: unknown)
src/utils/isObject.ts:3
↓ 3 callers
Method
length
Like MagicString, leaves out the string intro and outro
tests/fuzz/edit-model.ts:126
↓ 3 callers
Method
nextLine
()
src/utils/Mappings.ts:40
↓ 3 callers
Method
overwrite
(t, e, n, i)
benchmark/data-min.js:412
↓ 3 callers
Method
overwrite
* Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in * that range. The same restrictions as
src/MagicString.ts:725
↓ 3 callers
Method
replaceAll
* Same as `s.replace`, but replace all matched strings instead of just one.
src/MagicString.ts:1601
↓ 3 callers
Method
toString
()
benchmark/data-min.js:89
↓ 3 callers
Method
trim
(charType)
benchmark/data.js:1025
↓ 3 callers
Method
trim
(t)
benchmark/data-min.js:597
↓ 3 callers
Method
trimEnd
(rx)
benchmark/data.js:100
↓ 3 callers
Method
trimEnd
(t)
benchmark/data-min.js:92
↓ 3 callers
Method
trimEnd
(rx: RegExp)
src/Chunk.ts:155
↓ 3 callers
Method
trimStart
(rx: RegExp)
src/Chunk.ts:184
↓ 2 callers
Function
E
(l, t)
benchmark/data-min.js:147
↓ 2 callers
Method
_chunkAt
* The chunk whose original range holds `index` (`chunk.start <= index < chunk.end`), * or `undefined` when `index` is at or past the end. Searches
src/MagicString.ts:1136
↓ 2 callers
Method
_generateMappings
@internal
src/Bundle.ts:309
↓ 2 callers
Method
_generateMappings
@internal
src/MagicString.ts:359
↓ 2 callers
Method
_mapProperties
@internal
src/Bundle.ts:341
↓ 2 callers
Method
_mapProperties
@internal
src/MagicString.ts:366
↓ 2 callers
Method
_replaceRegexp
@internal
src/MagicString.ts:1431
↓ 2 callers
Method
_splitChunk
(chunk, index)
benchmark/data.js:686
↓ 2 callers
Method
_splitChunk
(t, e)
benchmark/data-min.js:552
↓ 2 callers
Method
_splitChunk
@internal
src/MagicString.ts:1173
↓ 2 callers
Method
addEdit
(sourceIndex, content, loc, nameIndex)
benchmark/data.js:222
↓ 2 callers
Method
addEdit
(t, e, n, i)
benchmark/data-min.js:187
↓ 2 callers
Method
addEdit
(sourceIndex: number, content: string, loc: SourceLocation, nameIndex: number)
src/utils/Mappings.ts:92
↓ 2 callers
Method
addMagicString
* Emits the mappings for one MagicString: its intro, every chunk (with the * chunk's own intro/outro) and its outro. `sourceIndex === -1` means the
src/utils/Mappings.ts:62
↓ 2 callers
Method
addSource
(source)
benchmark/data.js:840
↓ 2 callers
Method
addUneditedChunk
(sourceIndex, chunk, original, loc, sourcemapLocations)
benchmark/data.js:235
↓ 2 callers
Method
addUneditedChunk
(t, e, n, i, r)
benchmark/data-min.js:194
↓ 2 callers
Method
addUneditedChunk
( sourceIndex: number, chunk: Chunk, original: string, loc: SourceLocation, sourcemapLocat
src/utils/Mappings.ts:132
↓ 2 callers
Method
appendLeft
(content)
benchmark/data.js:28
↓ 2 callers
Method
appendLeft
(index, content)
benchmark/data.js:306
↓ 2 callers
Method
clearEdgeInserts
(start: number, end: number)
tests/fuzz/edit-model.ts:173
↓ 2 callers
Method
clone
()
benchmark/data.js:34
↓ 2 callers
Method
clone
()
benchmark/data.js:328
↓ 2 callers
Method
clone
()
benchmark/data-min.js:34
↓ 2 callers
Method
contains
(index: number)
src/Chunk.ts:59
next →
1–100 of 330, ranked by callers