magic-string
Advanced tools
Comparing version 0.30.2 to 0.30.3
@@ -114,2 +114,9 @@ 'use strict'; | ||
if (this.edited) { | ||
// after split we should save the edit content record into the correct chunk | ||
// to make sure sourcemap correct | ||
// For example: | ||
// ' test'.trim() | ||
// split -> ' ' + 'test' | ||
// ✔️ edit -> '' + 'test' | ||
// ✖️ edit -> 'test' + '' | ||
// TODO is this block necessary?... | ||
@@ -143,2 +150,6 @@ newChunk.edit('', false); | ||
this.split(this.start + trimmed.length).edit('', undefined, true); | ||
if (this.edited) { | ||
// save the change, if it has been edited | ||
this.edit(trimmed, this.storeName, true); | ||
} | ||
} | ||
@@ -162,3 +173,7 @@ return true; | ||
if (trimmed !== this.content) { | ||
this.split(this.end - trimmed.length); | ||
const newChunk = this.split(this.end - trimmed.length); | ||
if (this.edited) { | ||
// save the change, if it has been edited | ||
newChunk.edit(trimmed, this.storeName, true); | ||
} | ||
this.edit('', undefined, true); | ||
@@ -165,0 +180,0 @@ } |
@@ -116,2 +116,9 @@ (function (global, factory) { | ||
if (this.edited) { | ||
// after split we should save the edit content record into the correct chunk | ||
// to make sure sourcemap correct | ||
// For example: | ||
// ' test'.trim() | ||
// split -> ' ' + 'test' | ||
// ✔️ edit -> '' + 'test' | ||
// ✖️ edit -> 'test' + '' | ||
// TODO is this block necessary?... | ||
@@ -145,2 +152,6 @@ newChunk.edit('', false); | ||
this.split(this.start + trimmed.length).edit('', undefined, true); | ||
if (this.edited) { | ||
// save the change, if it has been edited | ||
this.edit(trimmed, this.storeName, true); | ||
} | ||
} | ||
@@ -164,3 +175,7 @@ return true; | ||
if (trimmed !== this.content) { | ||
this.split(this.end - trimmed.length); | ||
const newChunk = this.split(this.end - trimmed.length); | ||
if (this.edited) { | ||
// save the change, if it has been edited | ||
newChunk.edit(trimmed, this.storeName, true); | ||
} | ||
this.edit('', undefined, true); | ||
@@ -167,0 +182,0 @@ } |
{ | ||
"name": "magic-string", | ||
"version": "0.30.2", | ||
"version": "0.30.3", | ||
"description": "Modify strings, generate sourcemaps", | ||
@@ -45,12 +45,12 @@ "keywords": [ | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^15.2.0", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"benchmark": "^2.1.4", | ||
"bumpp": "^9.1.1", | ||
"bumpp": "^9.2.0", | ||
"conventional-changelog-cli": "^3.0.0", | ||
"eslint": "^8.45.0", | ||
"eslint": "^8.47.0", | ||
"mocha": "^10.2.0", | ||
"prettier": "^3.0.0", | ||
"publint": "^0.2.0", | ||
"rollup": "^3.26.3", | ||
"prettier": "^3.0.2", | ||
"publint": "^0.2.1", | ||
"rollup": "^3.28.0", | ||
"source-map-js": "^1.0.2", | ||
@@ -57,0 +57,0 @@ "source-map-support": "^0.5.21" |
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
432379
3882