magic-string
Advanced tools
Comparing version
# magic-string changelog | ||
## 0.16.0 | ||
* Include inserts in range for `overwrite` and `remove` operations ([#89](https://github.com/Rich-Harris/magic-string/pull/89)) | ||
* Make options optional for `bundle.generateMap(...)` ([#73](https://github.com/Rich-Harris/magic-string/pull/73)) | ||
## 0.15.2 | ||
@@ -4,0 +9,0 @@ |
@@ -63,2 +63,4 @@ 'use strict'; | ||
this.content = content; | ||
this.intro = ''; | ||
this.outro = ''; | ||
this.storeName = storeName; | ||
@@ -211,2 +213,6 @@ | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} | ||
function getLocator ( source ) { | ||
@@ -356,5 +362,3 @@ var originalLines = source.split( '\n' ); | ||
var outroSemis = outro.split( '\n' ).map( function () { return ''; } ).join( ';' ); | ||
var encoded = rawLines.map( function (segments) { | ||
return rawLines.map( function (segments) { | ||
var generatedCodeColumn = 0; | ||
@@ -382,5 +386,3 @@ | ||
}).join( ',' ); | ||
}).join( ';' ) + outroSemis; | ||
return encoded; | ||
}).join( ';' ) + getSemis(outro); | ||
} | ||
@@ -718,8 +720,5 @@ | ||
if ( first !== last ) { | ||
first.outro = ''; | ||
var chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk.intro = chunk.outro = ''; | ||
chunk = chunk.next; | ||
@@ -729,3 +728,2 @@ } | ||
chunk.edit( '', false ); | ||
chunk.intro = ''; | ||
} | ||
@@ -1027,2 +1025,4 @@ } | ||
options = options || {}; | ||
var offsets = {}; | ||
@@ -1193,6 +1193,2 @@ | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} | ||
MagicString.Bundle = Bundle; | ||
@@ -1199,0 +1195,0 @@ |
@@ -61,2 +61,4 @@ import { encode } from 'vlq'; | ||
this.content = content; | ||
this.intro = ''; | ||
this.outro = ''; | ||
this.storeName = storeName; | ||
@@ -209,2 +211,6 @@ | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} | ||
function getLocator ( source ) { | ||
@@ -354,5 +360,3 @@ var originalLines = source.split( '\n' ); | ||
var outroSemis = outro.split( '\n' ).map( function () { return ''; } ).join( ';' ); | ||
var encoded = rawLines.map( function (segments) { | ||
return rawLines.map( function (segments) { | ||
var generatedCodeColumn = 0; | ||
@@ -380,5 +384,3 @@ | ||
}).join( ',' ); | ||
}).join( ';' ) + outroSemis; | ||
return encoded; | ||
}).join( ';' ) + getSemis(outro); | ||
} | ||
@@ -716,8 +718,5 @@ | ||
if ( first !== last ) { | ||
first.outro = ''; | ||
var chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk.intro = chunk.outro = ''; | ||
chunk = chunk.next; | ||
@@ -727,3 +726,2 @@ } | ||
chunk.edit( '', false ); | ||
chunk.intro = ''; | ||
} | ||
@@ -1025,2 +1023,4 @@ } | ||
options = options || {}; | ||
var offsets = {}; | ||
@@ -1191,7 +1191,3 @@ | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} | ||
export { Bundle };export default MagicString; | ||
//# sourceMappingURL=magic-string.es6.js.map |
@@ -65,2 +65,4 @@ (function (global, factory) { | ||
this.content = content; | ||
this.intro = ''; | ||
this.outro = ''; | ||
this.storeName = storeName; | ||
@@ -259,2 +261,6 @@ | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} | ||
function getLocator ( source ) { | ||
@@ -404,5 +410,3 @@ var originalLines = source.split( '\n' ); | ||
var outroSemis = outro.split( '\n' ).map( function () { return ''; } ).join( ';' ); | ||
var encoded = rawLines.map( function (segments) { | ||
return rawLines.map( function (segments) { | ||
var generatedCodeColumn = 0; | ||
@@ -430,5 +434,3 @@ | ||
}).join( ',' ); | ||
}).join( ';' ) + outroSemis; | ||
return encoded; | ||
}).join( ';' ) + getSemis(outro); | ||
} | ||
@@ -766,8 +768,5 @@ | ||
if ( first !== last ) { | ||
first.outro = ''; | ||
var chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk.intro = chunk.outro = ''; | ||
chunk = chunk.next; | ||
@@ -777,3 +776,2 @@ } | ||
chunk.edit( '', false ); | ||
chunk.intro = ''; | ||
} | ||
@@ -1075,2 +1073,4 @@ } | ||
options = options || {}; | ||
var offsets = {}; | ||
@@ -1241,6 +1241,2 @@ | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} | ||
MagicString.Bundle = Bundle; | ||
@@ -1247,0 +1243,0 @@ |
@@ -5,5 +5,6 @@ { | ||
"author": "Rich Harris", | ||
"version": "0.15.2", | ||
"version": "0.16.0", | ||
"repository": "https://github.com/rich-harris/magic-string", | ||
"main": "dist/magic-string.cjs.js", | ||
"module": "dist/magic-string.es6.js", | ||
"jsnext:main": "dist/magic-string.es6.js", | ||
@@ -19,8 +20,8 @@ "license": "MIT", | ||
"istanbul": "^0.4.3", | ||
"mocha": "^2.5.3", | ||
"mocha": "^3.0.1", | ||
"remap-istanbul": "^0.6.4", | ||
"resolve": "^1.1.7", | ||
"rollup": "^0.31.0", | ||
"rollup-plugin-buble": "^0.10.0", | ||
"rollup-plugin-node-resolve": "^1.7.0", | ||
"rollup": "^0.34.5", | ||
"rollup-plugin-buble": "^0.12.1", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"rollup-plugin-replace": "^1.1.0", | ||
@@ -27,0 +28,0 @@ "source-map": "^0.5.6", |
import MagicString from './MagicString.js'; | ||
import SourceMap from './utils/SourceMap.js'; | ||
import getSemis from './utils/getSemis.js'; | ||
import getRelativePath from './utils/getRelativePath.js'; | ||
@@ -82,2 +83,4 @@ import hasOwnProp from './utils/hasOwnProp.js'; | ||
generateMap ( options ) { | ||
options = options || {}; | ||
let offsets = {}; | ||
@@ -239,5 +242,1 @@ | ||
}; | ||
function getSemis ( str ) { | ||
return new Array( str.split( '\n' ).length ).join( ';' ); | ||
} |
@@ -59,2 +59,4 @@ export default function Chunk ( start, end, content ) { | ||
this.content = content; | ||
this.intro = ''; | ||
this.outro = ''; | ||
this.storeName = storeName; | ||
@@ -61,0 +63,0 @@ |
@@ -311,8 +311,5 @@ import Chunk from './Chunk.js'; | ||
if ( first !== last ) { | ||
first.outro = ''; | ||
let chunk = first.next; | ||
while ( chunk !== last ) { | ||
chunk.edit( '', false ); | ||
chunk.intro = chunk.outro = ''; | ||
chunk = chunk.next; | ||
@@ -322,3 +319,2 @@ } | ||
chunk.edit( '', false ); | ||
chunk.intro = ''; | ||
} | ||
@@ -325,0 +321,0 @@ } |
import { encode } from 'vlq'; | ||
import getSemis from './getSemis.js'; | ||
import getLocator from './getLocator.js'; | ||
@@ -112,5 +113,3 @@ | ||
const outroSemis = outro.split( '\n' ).map( () => '' ).join( ';' ); | ||
const encoded = rawLines.map( segments => { | ||
return rawLines.map( segments => { | ||
let generatedCodeColumn = 0; | ||
@@ -138,5 +137,3 @@ | ||
}).join( ',' ); | ||
}).join( ';' ) + outroSemis; | ||
return encoded; | ||
}).join( ';' ) + getSemis(outro); | ||
} |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
334125
-2.66%3610
-0.17%1
Infinity%0
-100%