magic-string
Advanced tools
Comparing version 0.30.3 to 0.30.4
@@ -315,2 +315,19 @@ 'use strict'; | ||
if (content.length) { | ||
let contentLineEnd = content.indexOf('\n', 0); | ||
let previousContentLineEnd = -1; | ||
while (contentLineEnd >= 0) { | ||
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; | ||
if (nameIndex >= 0) { | ||
segment.push(nameIndex); | ||
} | ||
this.rawSegments.push(segment); | ||
this.generatedCodeLine += 1; | ||
this.raw[this.generatedCodeLine] = this.rawSegments = []; | ||
this.generatedCodeColumn = 0; | ||
previousContentLineEnd = contentLineEnd; | ||
contentLineEnd = content.indexOf('\n', contentLineEnd + 1); | ||
} | ||
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; | ||
@@ -321,7 +338,9 @@ if (nameIndex >= 0) { | ||
this.rawSegments.push(segment); | ||
this.advance(content.slice(previousContentLineEnd + 1)); | ||
} else if (this.pending) { | ||
this.rawSegments.push(this.pending); | ||
this.advance(content); | ||
} | ||
this.advance(content); | ||
this.pending = null; | ||
@@ -328,0 +347,0 @@ } |
@@ -405,2 +405,19 @@ (function (global, factory) { | ||
if (content.length) { | ||
let contentLineEnd = content.indexOf('\n', 0); | ||
let previousContentLineEnd = -1; | ||
while (contentLineEnd >= 0) { | ||
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; | ||
if (nameIndex >= 0) { | ||
segment.push(nameIndex); | ||
} | ||
this.rawSegments.push(segment); | ||
this.generatedCodeLine += 1; | ||
this.raw[this.generatedCodeLine] = this.rawSegments = []; | ||
this.generatedCodeColumn = 0; | ||
previousContentLineEnd = contentLineEnd; | ||
contentLineEnd = content.indexOf('\n', contentLineEnd + 1); | ||
} | ||
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; | ||
@@ -411,7 +428,9 @@ if (nameIndex >= 0) { | ||
this.rawSegments.push(segment); | ||
this.advance(content.slice(previousContentLineEnd + 1)); | ||
} else if (this.pending) { | ||
this.rawSegments.push(this.pending); | ||
this.advance(content); | ||
} | ||
this.advance(content); | ||
this.pending = null; | ||
@@ -418,0 +437,0 @@ } |
{ | ||
"name": "magic-string", | ||
"version": "0.30.3", | ||
"version": "0.30.4", | ||
"description": "Modify strings, generate sourcemaps", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
Sorry, the diff of this file is not supported yet
438682
3927