magic-string
Advanced tools
Comparing version 0.21.3 to 0.22.0
# magic-string changelog | ||
## 0.22.0 | ||
* Prevent `overwrite` state corruption ([#115](https://github.com/Rich-Harris/magic-string/issues/115)) | ||
* Various bugfixes ([#126](https://github.com/Rich-Harris/magic-string/pull/126)) | ||
## 0.21.3 | ||
@@ -4,0 +9,0 @@ |
@@ -637,9 +637,5 @@ 'use strict'; | ||
} else { | ||
var rhs = chunk.split( charIndex ); | ||
rhs.prependRight( indentStr ); | ||
this$1.byStart[ charIndex ] = rhs; | ||
this$1.byEnd[ charIndex ] = chunk; | ||
chunk = rhs; | ||
this$1._splitChunk( chunk, charIndex ); | ||
chunk = chunk.next; | ||
chunk.prependRight( indentStr ); | ||
} | ||
@@ -714,3 +710,3 @@ } | ||
first.previous = newLeft; | ||
last.next = newRight; | ||
last.next = newRight || null; | ||
@@ -763,11 +759,11 @@ if ( !newLeft ) { this.firstChunk = first; } | ||
if ( last ) { | ||
first.next = last.next; | ||
} else { | ||
first.next = null; | ||
this.lastChunk = first; | ||
if ( first !== last ) { | ||
var chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit( '', false ); | ||
} | ||
first.original = this.original.slice( start, end ); | ||
first.end = end; | ||
} | ||
@@ -985,6 +981,9 @@ | ||
if ( chunk.end !== end ) { | ||
this$1.lastChunk = chunk.next; | ||
if ( this$1.lastChunk === chunk ) { | ||
this$1.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; | ||
} | ||
@@ -1019,2 +1018,3 @@ | ||
this$1.byStart[ chunk.next.start ] = chunk.next; | ||
this$1.byEnd[ chunk.next.end ] = chunk.next; | ||
} | ||
@@ -1021,0 +1021,0 @@ |
@@ -635,9 +635,5 @@ import { encode } from 'vlq'; | ||
} else { | ||
var rhs = chunk.split( charIndex ); | ||
rhs.prependRight( indentStr ); | ||
this$1.byStart[ charIndex ] = rhs; | ||
this$1.byEnd[ charIndex ] = chunk; | ||
chunk = rhs; | ||
this$1._splitChunk( chunk, charIndex ); | ||
chunk = chunk.next; | ||
chunk.prependRight( indentStr ); | ||
} | ||
@@ -712,3 +708,3 @@ } | ||
first.previous = newLeft; | ||
last.next = newRight; | ||
last.next = newRight || null; | ||
@@ -761,11 +757,11 @@ if ( !newLeft ) { this.firstChunk = first; } | ||
if ( last ) { | ||
first.next = last.next; | ||
} else { | ||
first.next = null; | ||
this.lastChunk = first; | ||
if ( first !== last ) { | ||
var chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit( '', false ); | ||
} | ||
first.original = this.original.slice( start, end ); | ||
first.end = end; | ||
} | ||
@@ -983,6 +979,9 @@ | ||
if ( chunk.end !== end ) { | ||
this$1.lastChunk = chunk.next; | ||
if ( this$1.lastChunk === chunk ) { | ||
this$1.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; | ||
} | ||
@@ -1017,2 +1016,3 @@ | ||
this$1.byStart[ chunk.next.start ] = chunk.next; | ||
this$1.byEnd[ chunk.next.end ] = chunk.next; | ||
} | ||
@@ -1019,0 +1019,0 @@ |
@@ -687,9 +687,5 @@ (function (global, factory) { | ||
} else { | ||
var rhs = chunk.split( charIndex ); | ||
rhs.prependRight( indentStr ); | ||
this$1.byStart[ charIndex ] = rhs; | ||
this$1.byEnd[ charIndex ] = chunk; | ||
chunk = rhs; | ||
this$1._splitChunk( chunk, charIndex ); | ||
chunk = chunk.next; | ||
chunk.prependRight( indentStr ); | ||
} | ||
@@ -764,3 +760,3 @@ } | ||
first.previous = newLeft; | ||
last.next = newRight; | ||
last.next = newRight || null; | ||
@@ -813,11 +809,11 @@ if ( !newLeft ) { this.firstChunk = first; } | ||
if ( last ) { | ||
first.next = last.next; | ||
} else { | ||
first.next = null; | ||
this.lastChunk = first; | ||
if ( first !== last ) { | ||
var chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit( '', false ); | ||
} | ||
first.original = this.original.slice( start, end ); | ||
first.end = end; | ||
} | ||
@@ -1035,6 +1031,9 @@ | ||
if ( chunk.end !== end ) { | ||
this$1.lastChunk = chunk.next; | ||
if ( this$1.lastChunk === chunk ) { | ||
this$1.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; | ||
} | ||
@@ -1069,2 +1068,3 @@ | ||
this$1.byStart[ chunk.next.start ] = chunk.next; | ||
this$1.byEnd[ chunk.next.end ] = chunk.next; | ||
} | ||
@@ -1071,0 +1071,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"author": "Rich Harris", | ||
"version": "0.21.3", | ||
"version": "0.22.0", | ||
"repository": "https://github.com/rich-harris/magic-string", | ||
@@ -8,0 +8,0 @@ "main": "dist/magic-string.cjs.js", |
@@ -238,9 +238,5 @@ import Chunk from './Chunk.js'; | ||
} else { | ||
const rhs = chunk.split( charIndex ); | ||
rhs.prependRight( indentStr ); | ||
this.byStart[ charIndex ] = rhs; | ||
this.byEnd[ charIndex ] = chunk; | ||
chunk = rhs; | ||
this._splitChunk( chunk, charIndex ); | ||
chunk = chunk.next; | ||
chunk.prependRight( indentStr ); | ||
} | ||
@@ -317,3 +313,3 @@ } | ||
first.previous = newLeft; | ||
last.next = newRight; | ||
last.next = newRight || null; | ||
@@ -367,11 +363,11 @@ if ( !newLeft ) this.firstChunk = first; | ||
if ( last ) { | ||
first.next = last.next; | ||
} else { | ||
first.next = null; | ||
this.lastChunk = first; | ||
if ( first !== last ) { | ||
let chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit( '', false ); | ||
} | ||
first.original = this.original.slice( start, end ); | ||
first.end = end; | ||
} | ||
@@ -592,6 +588,9 @@ | ||
if ( chunk.end !== end ) { | ||
this.lastChunk = chunk.next; | ||
if ( this.lastChunk === chunk ) { | ||
this.lastChunk = chunk.next; | ||
} | ||
this.byEnd[ chunk.end ] = chunk; | ||
this.byStart[ chunk.next.start ] = chunk.next; | ||
this.byEnd[ chunk.next.end ] = chunk.next; | ||
} | ||
@@ -624,2 +623,3 @@ | ||
this.byStart[ chunk.next.start ] = chunk.next; | ||
this.byEnd[ chunk.next.end ] = chunk.next; | ||
} | ||
@@ -626,0 +626,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
381177
4036