Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

magic-string

Package Overview
Dependencies
Maintainers
3
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-string - npm Package Compare versions

Comparing version 0.25.4 to 0.25.5

4

CHANGELOG.md
# magic-string changelog
## 0.25.5
* Use a bitset to reduce memory consumption ([#167](https://github.com/Rich-Harris/magic-string/issues/167))
## 0.25.4

@@ -4,0 +8,0 @@

113

dist/magic-string.cjs.js

@@ -5,2 +5,16 @@ 'use strict';

var BitSet = function BitSet(arg) {
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
};
BitSet.prototype.add = function add (n) {
this.bits[Math.floor(n / BITS)] |= 1 << n % BITS;
};
BitSet.prototype.has = function has (n) {
return !!(this.bits[Math.floor(n / BITS)] & (1 << n % BITS));
};
var BITS = 32;
var Chunk = function Chunk(start, end, content) {

@@ -289,4 +303,2 @@ this.start = start;

Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
var this$1 = this;
var originalCharIndex = chunk.start;

@@ -296,4 +308,4 @@ var first = true;

while (originalCharIndex < chunk.end) {
if (this$1.hires || first || sourcemapLocations[originalCharIndex]) {
this$1.rawSegments.push([this$1.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
}

@@ -304,20 +316,21 @@

loc.column = 0;
this$1.generatedCodeLine += 1;
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
this$1.generatedCodeColumn = 0;
this.generatedCodeLine += 1;
this.raw[this.generatedCodeLine] = this.rawSegments = [];
this.generatedCodeColumn = 0;
first = true;
} else {
loc.column += 1;
this$1.generatedCodeColumn += 1;
this.generatedCodeColumn += 1;
first = false;
}
originalCharIndex += 1;
first = false;
}
this.pending = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
this.pending = sourceIndex > 0
? [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]
: null;
};
Mappings.prototype.advance = function advance (str) {
var this$1 = this;
if (!str) { return; }

@@ -329,4 +342,4 @@

for (var i = 0; i < lines.length - 1; i++) {
this$1.generatedCodeLine++;
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
this.generatedCodeLine++;
this.raw[this.generatedCodeLine] = this.rawSegments = [];
}

@@ -363,3 +376,3 @@ this.generatedCodeColumn = 0;

indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
sourcemapLocations: { writable: true, value: {} },
sourcemapLocations: { writable: true, value: new BitSet() },
storedNames: { writable: true, value: {} },

@@ -374,3 +387,3 @@ indentStr: { writable: true, value: guessIndent(string) }

MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
this.sourcemapLocations[char] = true;
this.sourcemapLocations.add(char);
};

@@ -444,5 +457,3 @@

Object.keys(this.sourcemapLocations).forEach(function (loc) {
cloned.sourcemapLocations[loc] = true;
});
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);

@@ -507,4 +518,2 @@ cloned.intro = this.intro;

MagicString.prototype.indent = function indent (indentStr, options) {
var this$1 = this;
var pattern = /^[^\r\n]/gm;

@@ -564,3 +573,3 @@

if (!isExcluded[charIndex]) {
var char = this$1.original[charIndex];
var char = this.original[charIndex];

@@ -575,3 +584,3 @@ if (char === '\n') {

} else {
this$1._splitChunk(chunk, charIndex);
this._splitChunk(chunk, charIndex);
chunk = chunk.next;

@@ -656,8 +665,6 @@ chunk.prependRight(indentStr);

MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
var this$1 = this;
if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }

@@ -755,7 +762,5 @@ if (end > this.original.length) { throw new Error('end is out of bounds'); }

MagicString.prototype.remove = function remove (start, end) {
var this$1 = this;
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
if (start === end) { return this; }

@@ -776,3 +781,3 @@

chunk = end > chunk.end ? this$1.byStart[chunk.end] : null;
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
}

@@ -834,8 +839,7 @@ return this;

MagicString.prototype.slice = function slice (start, end) {
var this$1 = this;
if ( start === void 0 ) start = 0;
if ( end === void 0 ) end = this.original.length;
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }

@@ -897,4 +901,2 @@ var result = '';

MagicString.prototype._split = function _split (index) {
var this$1 = this;
if (this.byStart[index] || this.byEnd[index]) { return; }

@@ -906,5 +908,5 @@

while (chunk) {
if (chunk.contains(index)) { return this$1._splitChunk(chunk, index); }
if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
chunk = searchForward ? this$1.byStart[chunk.end] : this$1.byEnd[chunk.start];
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
}

@@ -975,4 +977,2 @@ };

MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
var this$1 = this;
var rx = new RegExp((charType || '\\s') + '+$');

@@ -991,9 +991,9 @@

if (chunk.end !== end) {
if (this$1.lastChunk === chunk) {
this$1.lastChunk = chunk.next;
if (this.lastChunk === chunk) {
this.lastChunk = chunk.next;
}
this$1.byEnd[chunk.end] = chunk;
this$1.byStart[chunk.next.start] = chunk.next;
this$1.byEnd[chunk.next.end] = chunk.next;
this.byEnd[chunk.end] = chunk;
this.byStart[chunk.next.start] = chunk.next;
this.byEnd[chunk.next.end] = chunk.next;
}

@@ -1013,4 +1013,2 @@

MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
var this$1 = this;
var rx = new RegExp('^' + (charType || '\\s') + '+');

@@ -1029,7 +1027,7 @@

// special case...
if (chunk === this$1.lastChunk) { this$1.lastChunk = chunk.next; }
if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
this$1.byEnd[chunk.end] = chunk;
this$1.byStart[chunk.next.start] = chunk.next;
this$1.byEnd[chunk.next.end] = chunk.next;
this.byEnd[chunk.end] = chunk;
this.byStart[chunk.next.start] = chunk.next;
this.byEnd[chunk.next.end] = chunk.next;
}

@@ -1300,4 +1298,2 @@

Bundle.prototype.trimStart = function trimStart (charType) {
var this$1 = this;
var rx = new RegExp('^' + (charType || '\\s') + '+');

@@ -1311,3 +1307,3 @@ this.intro = this.intro.replace(rx, '');

do {
source = this$1.sources[i++];
source = this.sources[i++];
if (!source) {

@@ -1323,4 +1319,2 @@ break;

Bundle.prototype.trimEnd = function trimEnd (charType) {
var this$1 = this;
var rx = new RegExp((charType || '\\s') + '+$');

@@ -1332,5 +1326,5 @@

do {
source = this$1.sources[i--];
source = this.sources[i--];
if (!source) {
this$1.intro = this$1.intro.replace(rx, '');
this.intro = this.intro.replace(rx, '');
break;

@@ -1344,2 +1338,3 @@ }

MagicString.Bundle = Bundle;
MagicString.SourceMap = SourceMap;
MagicString.default = MagicString; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121

@@ -1346,0 +1341,0 @@

import { encode } from 'sourcemap-codec';
var BitSet = function BitSet(arg) {
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
};
BitSet.prototype.add = function add (n) {
this.bits[Math.floor(n / BITS)] |= 1 << n % BITS;
};
BitSet.prototype.has = function has (n) {
return !!(this.bits[Math.floor(n / BITS)] & (1 << n % BITS));
};
var BITS = 32;
var Chunk = function Chunk(start, end, content) {

@@ -286,4 +300,2 @@ this.start = start;

Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
var this$1 = this;
var originalCharIndex = chunk.start;

@@ -293,4 +305,4 @@ var first = true;

while (originalCharIndex < chunk.end) {
if (this$1.hires || first || sourcemapLocations[originalCharIndex]) {
this$1.rawSegments.push([this$1.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
}

@@ -301,20 +313,21 @@

loc.column = 0;
this$1.generatedCodeLine += 1;
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
this$1.generatedCodeColumn = 0;
this.generatedCodeLine += 1;
this.raw[this.generatedCodeLine] = this.rawSegments = [];
this.generatedCodeColumn = 0;
first = true;
} else {
loc.column += 1;
this$1.generatedCodeColumn += 1;
this.generatedCodeColumn += 1;
first = false;
}
originalCharIndex += 1;
first = false;
}
this.pending = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
this.pending = sourceIndex > 0
? [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]
: null;
};
Mappings.prototype.advance = function advance (str) {
var this$1 = this;
if (!str) { return; }

@@ -326,4 +339,4 @@

for (var i = 0; i < lines.length - 1; i++) {
this$1.generatedCodeLine++;
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
this.generatedCodeLine++;
this.raw[this.generatedCodeLine] = this.rawSegments = [];
}

@@ -360,3 +373,3 @@ this.generatedCodeColumn = 0;

indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
sourcemapLocations: { writable: true, value: {} },
sourcemapLocations: { writable: true, value: new BitSet() },
storedNames: { writable: true, value: {} },

@@ -371,3 +384,3 @@ indentStr: { writable: true, value: guessIndent(string) }

MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
this.sourcemapLocations[char] = true;
this.sourcemapLocations.add(char);
};

@@ -441,5 +454,3 @@

Object.keys(this.sourcemapLocations).forEach(function (loc) {
cloned.sourcemapLocations[loc] = true;
});
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);

@@ -504,4 +515,2 @@ cloned.intro = this.intro;

MagicString.prototype.indent = function indent (indentStr, options) {
var this$1 = this;
var pattern = /^[^\r\n]/gm;

@@ -561,3 +570,3 @@

if (!isExcluded[charIndex]) {
var char = this$1.original[charIndex];
var char = this.original[charIndex];

@@ -572,3 +581,3 @@ if (char === '\n') {

} else {
this$1._splitChunk(chunk, charIndex);
this._splitChunk(chunk, charIndex);
chunk = chunk.next;

@@ -653,8 +662,6 @@ chunk.prependRight(indentStr);

MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
var this$1 = this;
if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }

@@ -752,7 +759,5 @@ if (end > this.original.length) { throw new Error('end is out of bounds'); }

MagicString.prototype.remove = function remove (start, end) {
var this$1 = this;
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
if (start === end) { return this; }

@@ -773,3 +778,3 @@

chunk = end > chunk.end ? this$1.byStart[chunk.end] : null;
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
}

@@ -831,8 +836,7 @@ return this;

MagicString.prototype.slice = function slice (start, end) {
var this$1 = this;
if ( start === void 0 ) start = 0;
if ( end === void 0 ) end = this.original.length;
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }

@@ -894,4 +898,2 @@ var result = '';

MagicString.prototype._split = function _split (index) {
var this$1 = this;
if (this.byStart[index] || this.byEnd[index]) { return; }

@@ -903,5 +905,5 @@

while (chunk) {
if (chunk.contains(index)) { return this$1._splitChunk(chunk, index); }
if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
chunk = searchForward ? this$1.byStart[chunk.end] : this$1.byEnd[chunk.start];
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
}

@@ -972,4 +974,2 @@ };

MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
var this$1 = this;
var rx = new RegExp((charType || '\\s') + '+$');

@@ -988,9 +988,9 @@

if (chunk.end !== end) {
if (this$1.lastChunk === chunk) {
this$1.lastChunk = chunk.next;
if (this.lastChunk === chunk) {
this.lastChunk = chunk.next;
}
this$1.byEnd[chunk.end] = chunk;
this$1.byStart[chunk.next.start] = chunk.next;
this$1.byEnd[chunk.next.end] = chunk.next;
this.byEnd[chunk.end] = chunk;
this.byStart[chunk.next.start] = chunk.next;
this.byEnd[chunk.next.end] = chunk.next;
}

@@ -1010,4 +1010,2 @@

MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
var this$1 = this;
var rx = new RegExp('^' + (charType || '\\s') + '+');

@@ -1026,7 +1024,7 @@

// special case...
if (chunk === this$1.lastChunk) { this$1.lastChunk = chunk.next; }
if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
this$1.byEnd[chunk.end] = chunk;
this$1.byStart[chunk.next.start] = chunk.next;
this$1.byEnd[chunk.next.end] = chunk.next;
this.byEnd[chunk.end] = chunk;
this.byStart[chunk.next.start] = chunk.next;
this.byEnd[chunk.next.end] = chunk.next;
}

@@ -1297,4 +1295,2 @@

Bundle.prototype.trimStart = function trimStart (charType) {
var this$1 = this;
var rx = new RegExp('^' + (charType || '\\s') + '+');

@@ -1308,3 +1304,3 @@ this.intro = this.intro.replace(rx, '');

do {
source = this$1.sources[i++];
source = this.sources[i++];
if (!source) {

@@ -1320,4 +1316,2 @@ break;

Bundle.prototype.trimEnd = function trimEnd (charType) {
var this$1 = this;
var rx = new RegExp((charType || '\\s') + '+$');

@@ -1329,5 +1323,5 @@

do {
source = this$1.sources[i--];
source = this.sources[i--];
if (!source) {
this$1.intro = this$1.intro.replace(rx, '');
this.intro = this.intro.replace(rx, '');
break;

@@ -1334,0 +1328,0 @@ }

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.MagicString = factory());
}(this, (function () { 'use strict';
(global = global || self, global.MagicString = factory());
}(this, function () { 'use strict';
var BitSet = function BitSet(arg) {
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
};
BitSet.prototype.add = function add (n) {
this.bits[Math.floor(n / BITS)] |= 1 << n % BITS;
};
BitSet.prototype.has = function has (n) {
return !!(this.bits[Math.floor(n / BITS)] & (1 << n % BITS));
};
var BITS = 32;
var Chunk = function Chunk(start, end, content) {

@@ -162,7 +176,3 @@ this.start = start;

var charToInteger = {};
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
for (var i = 0; i < chars.length; i++) {
charToInteger[chars.charCodeAt(i)] = i;
}
function encode(decoded) {

@@ -347,4 +357,2 @@ var sourceFileIndex = 0; // second field

Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
var this$1 = this;
var originalCharIndex = chunk.start;

@@ -354,4 +362,4 @@ var first = true;

while (originalCharIndex < chunk.end) {
if (this$1.hires || first || sourcemapLocations[originalCharIndex]) {
this$1.rawSegments.push([this$1.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
}

@@ -362,20 +370,21 @@

loc.column = 0;
this$1.generatedCodeLine += 1;
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
this$1.generatedCodeColumn = 0;
this.generatedCodeLine += 1;
this.raw[this.generatedCodeLine] = this.rawSegments = [];
this.generatedCodeColumn = 0;
first = true;
} else {
loc.column += 1;
this$1.generatedCodeColumn += 1;
this.generatedCodeColumn += 1;
first = false;
}
originalCharIndex += 1;
first = false;
}
this.pending = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
this.pending = sourceIndex > 0
? [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]
: null;
};
Mappings.prototype.advance = function advance (str) {
var this$1 = this;
if (!str) { return; }

@@ -387,4 +396,4 @@

for (var i = 0; i < lines.length - 1; i++) {
this$1.generatedCodeLine++;
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
this.generatedCodeLine++;
this.raw[this.generatedCodeLine] = this.rawSegments = [];
}

@@ -421,3 +430,3 @@ this.generatedCodeColumn = 0;

indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
sourcemapLocations: { writable: true, value: {} },
sourcemapLocations: { writable: true, value: new BitSet() },
storedNames: { writable: true, value: {} },

@@ -432,3 +441,3 @@ indentStr: { writable: true, value: guessIndent(string) }

MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
this.sourcemapLocations[char] = true;
this.sourcemapLocations.add(char);
};

@@ -502,5 +511,3 @@

Object.keys(this.sourcemapLocations).forEach(function (loc) {
cloned.sourcemapLocations[loc] = true;
});
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);

@@ -565,4 +572,2 @@ cloned.intro = this.intro;

MagicString.prototype.indent = function indent (indentStr, options) {
var this$1 = this;
var pattern = /^[^\r\n]/gm;

@@ -622,3 +627,3 @@

if (!isExcluded[charIndex]) {
var char = this$1.original[charIndex];
var char = this.original[charIndex];

@@ -633,3 +638,3 @@ if (char === '\n') {

} else {
this$1._splitChunk(chunk, charIndex);
this._splitChunk(chunk, charIndex);
chunk = chunk.next;

@@ -714,8 +719,6 @@ chunk.prependRight(indentStr);

MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
var this$1 = this;
if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }

@@ -813,7 +816,5 @@ if (end > this.original.length) { throw new Error('end is out of bounds'); }

MagicString.prototype.remove = function remove (start, end) {
var this$1 = this;
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
if (start === end) { return this; }

@@ -834,3 +835,3 @@

chunk = end > chunk.end ? this$1.byStart[chunk.end] : null;
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
}

@@ -892,8 +893,7 @@ return this;

MagicString.prototype.slice = function slice (start, end) {
var this$1 = this;
if ( start === void 0 ) start = 0;
if ( end === void 0 ) end = this.original.length;
while (start < 0) { start += this$1.original.length; }
while (end < 0) { end += this$1.original.length; }
while (start < 0) { start += this.original.length; }
while (end < 0) { end += this.original.length; }

@@ -955,4 +955,2 @@ var result = '';

MagicString.prototype._split = function _split (index) {
var this$1 = this;
if (this.byStart[index] || this.byEnd[index]) { return; }

@@ -964,5 +962,5 @@

while (chunk) {
if (chunk.contains(index)) { return this$1._splitChunk(chunk, index); }
if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
chunk = searchForward ? this$1.byStart[chunk.end] : this$1.byEnd[chunk.start];
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
}

@@ -1033,4 +1031,2 @@ };

MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
var this$1 = this;
var rx = new RegExp((charType || '\\s') + '+$');

@@ -1049,9 +1045,9 @@

if (chunk.end !== end) {
if (this$1.lastChunk === chunk) {
this$1.lastChunk = chunk.next;
if (this.lastChunk === chunk) {
this.lastChunk = chunk.next;
}
this$1.byEnd[chunk.end] = chunk;
this$1.byStart[chunk.next.start] = chunk.next;
this$1.byEnd[chunk.next.end] = chunk.next;
this.byEnd[chunk.end] = chunk;
this.byStart[chunk.next.start] = chunk.next;
this.byEnd[chunk.next.end] = chunk.next;
}

@@ -1071,4 +1067,2 @@

MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
var this$1 = this;
var rx = new RegExp('^' + (charType || '\\s') + '+');

@@ -1087,7 +1081,7 @@

// special case...
if (chunk === this$1.lastChunk) { this$1.lastChunk = chunk.next; }
if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
this$1.byEnd[chunk.end] = chunk;
this$1.byStart[chunk.next.start] = chunk.next;
this$1.byEnd[chunk.next.end] = chunk.next;
this.byEnd[chunk.end] = chunk;
this.byStart[chunk.next.start] = chunk.next;
this.byEnd[chunk.next.end] = chunk.next;
}

@@ -1358,4 +1352,2 @@

Bundle.prototype.trimStart = function trimStart (charType) {
var this$1 = this;
var rx = new RegExp('^' + (charType || '\\s') + '+');

@@ -1369,3 +1361,3 @@ this.intro = this.intro.replace(rx, '');

do {
source = this$1.sources[i++];
source = this.sources[i++];
if (!source) {

@@ -1381,4 +1373,2 @@ break;

Bundle.prototype.trimEnd = function trimEnd (charType) {
var this$1 = this;
var rx = new RegExp((charType || '\\s') + '+$');

@@ -1390,5 +1380,5 @@

do {
source = this$1.sources[i--];
source = this.sources[i--];
if (!source) {
this$1.intro = this$1.intro.replace(rx, '');
this.intro = this.intro.replace(rx, '');
break;

@@ -1402,2 +1392,3 @@ }

MagicString.Bundle = Bundle;
MagicString.SourceMap = SourceMap;
MagicString.default = MagicString; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121

@@ -1407,3 +1398,3 @@

})));
}));
//# sourceMappingURL=magic-string.umd.js.map

@@ -13,2 +13,7 @@ export interface BundleOptions {

export type SourceMapSegment =
| [number]
| [number, number, number, number]
| [number, number, number, number, number];
export interface DecodedSourceMap {

@@ -19,3 +24,3 @@ file: string;

names: string[];
mappings: number[][][];
mappings: SourceMapSegment[][];
}

@@ -22,0 +27,0 @@

@@ -5,3 +5,3 @@ {

"author": "Rich Harris",
"version": "0.25.4",
"version": "0.25.5",
"repository": "https://github.com/rich-harris/magic-string",

@@ -8,0 +8,0 @@ "main": "dist/magic-string.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc