| 135 | } |
| 136 | |
| 137 | export class MagicString { |
| 138 | declare public readonly original: string |
| 139 | declare public offset: number |
| 140 | |
| 141 | /** @internal */ |
| 142 | declare outro: string |
| 143 | /** @internal */ |
| 144 | declare intro: string |
| 145 | /** @internal */ |
| 146 | declare filename: string | undefined |
| 147 | /** @internal */ |
| 148 | declare ignoreList: boolean | undefined |
| 149 | /** @internal */ |
| 150 | declare firstChunk: Chunk |
| 151 | /** @internal */ |
| 152 | declare lastChunk: Chunk |
| 153 | /** @internal */ |
| 154 | declare lastSearchedChunk: Chunk |
| 155 | /** @internal */ |
| 156 | declare byStart: Map<number, Chunk> |
| 157 | /** @internal */ |
| 158 | declare byEnd: Map<number, Chunk> |
| 159 | /** @internal */ |
| 160 | declare sourcemapLocations: BitSet |
| 161 | /** @internal */ |
| 162 | declare storedNames: Set<string> |
| 163 | /** @internal */ |
| 164 | declare indentStr: string | null | undefined |
| 165 | /** @internal */ |
| 166 | declare hasMovedChunks: boolean |
| 167 | /** @internal */ |
| 168 | declare indentExclusionRanges: MagicStringOptions['indentExclusionRanges'] |
| 169 | |
| 170 | /** |
| 171 | * Wraps `string` for editing; every index passed to the editing methods refers to this original string. |
| 172 | */ |
| 173 | constructor(string: string, options: MagicStringOptions = {}) { |
| 174 | const chunk = new Chunk(0, string.length, string) |
| 175 | |
| 176 | Object.defineProperties(this, { |
| 177 | original: { writable: true, value: string }, |
| 178 | outro: { writable: true, value: '' }, |
| 179 | intro: { writable: true, value: '' }, |
| 180 | firstChunk: { writable: true, value: chunk }, |
| 181 | lastChunk: { writable: true, value: chunk }, |
| 182 | lastSearchedChunk: { writable: true, value: chunk }, |
| 183 | byStart: { writable: true, value: new Map<number, Chunk>([[0, chunk]]) }, |
| 184 | byEnd: { writable: true, value: new Map<number, Chunk>([[string.length, chunk]]) }, |
| 185 | filename: { writable: true, value: options.filename }, |
| 186 | indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, |
| 187 | sourcemapLocations: { writable: true, value: new BitSet() }, |
| 188 | storedNames: { writable: true, value: new Set<string>() }, |
| 189 | indentStr: { writable: true, value: undefined }, |
| 190 | ignoreList: { writable: true, value: options.ignoreList }, |
| 191 | offset: { writable: true, value: options.offset || 0 }, |
| 192 | hasMovedChunks: { writable: true, value: false }, |
| 193 | }) |
| 194 | } |
nothing calls this directly
no outgoing calls
no test coverage detected