MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / constructor

Method constructor

benchmark/data.js:278–297  ·  view source on GitHub ↗
(string, options = {})

Source from the content-addressed store, hash-verified

276};
277class MagicString {
278 constructor(string, options = {}) {
279 const chunk = new Chunk(0, string.length, string);
280 Object.defineProperties(this, {
281 original: { writable: true, value: string },
282 outro: { writable: true, value: '' },
283 intro: { writable: true, value: '' },
284 firstChunk: { writable: true, value: chunk },
285 lastChunk: { writable: true, value: chunk },
286 lastSearchedChunk: { writable: true, value: chunk },
287 byStart: { writable: true, value: {} },
288 byEnd: { writable: true, value: {} },
289 filename: { writable: true, value: options.filename },
290 indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
291 sourcemapLocations: { writable: true, value: new BitSet() },
292 storedNames: { writable: true, value: {} },
293 indentStr: { writable: true, value: guessIndent(string) },
294 });
295 this.byStart[0] = chunk;
296 this.byEnd[string.length] = chunk;
297 }
298 addSourcemapLocation(char) {
299 this.sourcemapLocations.add(char);
300 }

Callers

nothing calls this directly

Calls 1

guessIndentFunction · 0.70

Tested by

no test coverage detected