source-map
Advanced tools
Comparing version 0.1.29 to 0.1.30
/* -*- Mode: js; js-indent-level: 2; -*- */ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
window.sourceMap = { | ||
this.sourceMap = { | ||
SourceMapConsumer: require('source-map/source-map-consumer').SourceMapConsumer, | ||
@@ -6,0 +6,0 @@ SourceMapGenerator: require('source-map/source-map-generator').SourceMapGenerator, |
# Change Log | ||
## 0.1.30 | ||
* Do not join source root with a source, when the source is a data URI. | ||
* Extend the test runner to allow running single specific test files at a time. | ||
* Performance improvements in `SourceNode.prototype.walk` and | ||
`SourceMapConsumer.prototype.eachMapping`. | ||
* Source map browser builds will now work inside Workers. | ||
* Better error messages when attempting to add an invalid mapping to a | ||
`SourceMapGenerator`. | ||
## 0.1.29 | ||
@@ -4,0 +18,0 @@ |
@@ -33,3 +33,3 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
var mid = Math.floor((aHigh - aLow) / 2) + aLow; | ||
var cmp = aCompare(aNeedle, aHaystack[mid]); | ||
var cmp = aCompare(aNeedle, aHaystack[mid], true); | ||
if (cmp === 0) { | ||
@@ -36,0 +36,0 @@ // Found the element we are looking for. |
@@ -104,2 +104,28 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
/** | ||
* Create a SourceMapConsumer from a SourceMapGenerator. | ||
* | ||
* @param SourceMapGenerator aSourceMap | ||
* The source map that will be consumed. | ||
* @returns SourceMapConsumer | ||
*/ | ||
SourceMapConsumer.fromSourceMap = | ||
function SourceMapConsumer_fromSourceMap(aSourceMap) { | ||
var smc = Object.create(SourceMapConsumer.prototype); | ||
smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); | ||
smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); | ||
smc.sourceRoot = aSourceMap._sourceRoot; | ||
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), | ||
smc.sourceRoot); | ||
smc.file = aSourceMap._file; | ||
smc._generatedMappings = aSourceMap._mappings.slice() | ||
.sort(util.compareByGeneratedPositions); | ||
smc._originalMappings = aSourceMap._mappings.slice() | ||
.sort(util.compareByOriginalPositions); | ||
return smc; | ||
}; | ||
/** | ||
* The version of the source mapping spec that we are consuming. | ||
@@ -199,36 +225,6 @@ */ | ||
this._originalMappings.sort(this._compareOriginalPositions); | ||
this._originalMappings.sort(util.compareByOriginalPositions); | ||
}; | ||
/** | ||
* Comparator between two mappings where the original positions are compared. | ||
*/ | ||
SourceMapConsumer.prototype._compareOriginalPositions = | ||
function SourceMapConsumer_compareOriginalPositions(mappingA, mappingB) { | ||
if (mappingA.source > mappingB.source) { | ||
return 1; | ||
} | ||
else if (mappingA.source < mappingB.source) { | ||
return -1; | ||
} | ||
else { | ||
var cmp = mappingA.originalLine - mappingB.originalLine; | ||
return cmp === 0 | ||
? mappingA.originalColumn - mappingB.originalColumn | ||
: cmp; | ||
} | ||
}; | ||
/** | ||
* Comparator between two mappings where the generated positions are compared. | ||
*/ | ||
SourceMapConsumer.prototype._compareGeneratedPositions = | ||
function SourceMapConsumer_compareGeneratedPositions(mappingA, mappingB) { | ||
var cmp = mappingA.generatedLine - mappingB.generatedLine; | ||
return cmp === 0 | ||
? mappingA.generatedColumn - mappingB.generatedColumn | ||
: cmp; | ||
}; | ||
/** | ||
* Find the mapping that best matches the hypothetical "needle" mapping that | ||
@@ -283,3 +279,3 @@ * we are searching for in the given "haystack" of mappings. | ||
"generatedColumn", | ||
this._compareGeneratedPositions); | ||
util.compareByGeneratedPositions); | ||
@@ -378,3 +374,3 @@ if (mapping) { | ||
"originalColumn", | ||
this._compareOriginalPositions); | ||
util.compareByOriginalPositions); | ||
@@ -381,0 +377,0 @@ if (mapping) { |
@@ -110,4 +110,6 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
this._mappings.push({ | ||
generated: generated, | ||
original: original, | ||
generatedLine: generated.line, | ||
generatedColumn: generated.column, | ||
originalLine: original != null && original.line, | ||
originalColumn: original != null && original.column, | ||
source: source, | ||
@@ -173,7 +175,7 @@ name: name | ||
this._mappings.forEach(function (mapping) { | ||
if (mapping.source === aSourceFile && mapping.original) { | ||
if (mapping.source === aSourceFile && mapping.originalLine) { | ||
// Check if it can be mapped by the source map, then update the mapping. | ||
var original = aSourceMapConsumer.originalPositionFor({ | ||
line: mapping.original.line, | ||
column: mapping.original.column | ||
line: mapping.originalLine, | ||
column: mapping.originalColumn | ||
}); | ||
@@ -187,4 +189,4 @@ if (original.source !== null) { | ||
} | ||
mapping.original.line = original.line; | ||
mapping.original.column = original.column; | ||
mapping.originalLine = original.line; | ||
mapping.originalColumn = original.column; | ||
if (original.name !== null && mapping.name !== null) { | ||
@@ -253,24 +255,11 @@ // Only use the identifier name if it's an identifier | ||
else { | ||
throw new Error('Invalid mapping.'); | ||
throw new Error('Invalid mapping: ' + JSON.stringify({ | ||
generated: aGenerated, | ||
source: aSource, | ||
orginal: aOriginal, | ||
name: aName | ||
})); | ||
} | ||
}; | ||
function cmpLocation(loc1, loc2) { | ||
var cmp = (loc1 && loc1.line) - (loc2 && loc2.line); | ||
return cmp ? cmp : (loc1 && loc1.column) - (loc2 && loc2.column); | ||
} | ||
function strcmp(str1, str2) { | ||
str1 = str1 || ''; | ||
str2 = str2 || ''; | ||
return (str1 > str2) - (str1 < str2); | ||
} | ||
function cmpMapping(mappingA, mappingB) { | ||
return cmpLocation(mappingA.generated, mappingB.generated) || | ||
cmpLocation(mappingA.original, mappingB.original) || | ||
strcmp(mappingA.source, mappingB.source) || | ||
strcmp(mappingA.name, mappingB.name); | ||
} | ||
/** | ||
@@ -296,3 +285,3 @@ * Serialize the accumulated mappings in to the stream of base 64 VLQs | ||
// serialize them, but the big O is the same either way. | ||
this._mappings.sort(cmpMapping); | ||
this._mappings.sort(util.compareByGeneratedPositions); | ||
@@ -302,5 +291,5 @@ for (var i = 0, len = this._mappings.length; i < len; i++) { | ||
if (mapping.generated.line !== previousGeneratedLine) { | ||
if (mapping.generatedLine !== previousGeneratedLine) { | ||
previousGeneratedColumn = 0; | ||
while (mapping.generated.line !== previousGeneratedLine) { | ||
while (mapping.generatedLine !== previousGeneratedLine) { | ||
result += ';'; | ||
@@ -312,3 +301,3 @@ previousGeneratedLine++; | ||
if (i > 0) { | ||
if (!cmpMapping(mapping, this._mappings[i - 1])) { | ||
if (!util.compareByGeneratedPositions(mapping, this._mappings[i - 1])) { | ||
continue; | ||
@@ -320,7 +309,7 @@ } | ||
result += base64VLQ.encode(mapping.generated.column | ||
result += base64VLQ.encode(mapping.generatedColumn | ||
- previousGeneratedColumn); | ||
previousGeneratedColumn = mapping.generated.column; | ||
previousGeneratedColumn = mapping.generatedColumn; | ||
if (mapping.source && mapping.original) { | ||
if (mapping.source) { | ||
result += base64VLQ.encode(this._sources.indexOf(mapping.source) | ||
@@ -331,9 +320,9 @@ - previousSource); | ||
// lines are stored 0-based in SourceMap spec version 3 | ||
result += base64VLQ.encode(mapping.original.line - 1 | ||
result += base64VLQ.encode(mapping.originalLine - 1 | ||
- previousOriginalLine); | ||
previousOriginalLine = mapping.original.line - 1; | ||
previousOriginalLine = mapping.originalLine - 1; | ||
result += base64VLQ.encode(mapping.original.column | ||
result += base64VLQ.encode(mapping.originalColumn | ||
- previousOriginalColumn); | ||
previousOriginalColumn = mapping.original.column; | ||
previousOriginalColumn = mapping.originalColumn; | ||
@@ -351,2 +340,19 @@ if (mapping.name) { | ||
SourceMapGenerator.prototype._generateSourcesContent = | ||
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { | ||
return aSources.map(function (source) { | ||
if (!this._sourcesContents) { | ||
return null; | ||
} | ||
if (aSourceRoot) { | ||
source = util.relative(aSourceRoot, source); | ||
} | ||
var key = util.toSetString(source); | ||
return Object.prototype.hasOwnProperty.call(this._sourcesContents, | ||
key) | ||
? this._sourcesContents[key] | ||
: null; | ||
}, this); | ||
}; | ||
/** | ||
@@ -368,12 +374,5 @@ * Externalize the source map. | ||
if (this._sourcesContents) { | ||
map.sourcesContent = map.sources.map(function (source) { | ||
if (map.sourceRoot) { | ||
source = util.relative(map.sourceRoot, source); | ||
} | ||
return Object.prototype.hasOwnProperty.call( | ||
this._sourcesContents, util.toSetString(source)) | ||
? this._sourcesContents[util.toSetString(source)] | ||
: null; | ||
}, this); | ||
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); | ||
} | ||
return map; | ||
@@ -380,0 +379,0 @@ }; |
@@ -196,3 +196,5 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
SourceNode.prototype.walk = function SourceNode_walk(aFn) { | ||
this.children.forEach(function (chunk) { | ||
var chunk; | ||
for (var i = 0, len = this.children.length; i < len; i++) { | ||
chunk = this.children[i]; | ||
if (chunk instanceof SourceNode) { | ||
@@ -209,3 +211,3 @@ chunk.walk(aFn); | ||
} | ||
}, this); | ||
} | ||
}; | ||
@@ -276,10 +278,12 @@ | ||
function SourceNode_walkSourceContents(aFn) { | ||
this.children.forEach(function (chunk) { | ||
if (chunk instanceof SourceNode) { | ||
chunk.walkSourceContents(aFn); | ||
for (var i = 0, len = this.children.length; i < len; i++) { | ||
if (this.children[i] instanceof SourceNode) { | ||
this.children[i].walkSourceContents(aFn); | ||
} | ||
}, this); | ||
Object.keys(this.sourceContents).forEach(function (sourceFileKey) { | ||
aFn(util.fromSetString(sourceFileKey), this.sourceContents[sourceFileKey]); | ||
}, this); | ||
} | ||
var sources = Object.keys(this.sourceContents); | ||
for (var i = 0, len = sources.length; i < len; i++) { | ||
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); | ||
} | ||
}; | ||
@@ -286,0 +290,0 @@ |
@@ -34,2 +34,3 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/; | ||
var dataUrlRegexp = /^data:.+\,.+/; | ||
@@ -72,3 +73,3 @@ function urlParse(aUrl) { | ||
if (aPath.match(urlRegexp)) { | ||
if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) { | ||
return aPath; | ||
@@ -119,2 +120,89 @@ } | ||
function strcmp(aStr1, aStr2) { | ||
var s1 = aStr1 || ""; | ||
var s2 = aStr2 || ""; | ||
return (s1 > s2) - (s1 < s2); | ||
} | ||
/** | ||
* Comparator between two mappings where the original positions are compared. | ||
* | ||
* Optionally pass in `true` as `onlyCompareGenerated` to consider two | ||
* mappings with the same original source/line/column, but different generated | ||
* line and column the same. Useful when searching for a mapping with a | ||
* stubbed out mapping. | ||
*/ | ||
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { | ||
var cmp; | ||
cmp = strcmp(mappingA.source, mappingB.source); | ||
if (cmp) { | ||
return cmp; | ||
} | ||
cmp = mappingA.originalLine - mappingB.originalLine; | ||
if (cmp) { | ||
return cmp; | ||
} | ||
cmp = mappingA.originalColumn - mappingB.originalColumn; | ||
if (cmp || onlyCompareOriginal) { | ||
return cmp; | ||
} | ||
cmp = strcmp(mappingA.name, mappingB.name); | ||
if (cmp) { | ||
return cmp; | ||
} | ||
cmp = mappingA.generatedLine - mappingB.generatedLine; | ||
if (cmp) { | ||
return cmp; | ||
} | ||
return mappingA.generatedColumn - mappingB.generatedColumn; | ||
}; | ||
exports.compareByOriginalPositions = compareByOriginalPositions; | ||
/** | ||
* Comparator between two mappings where the generated positions are | ||
* compared. | ||
* | ||
* Optionally pass in `true` as `onlyCompareGenerated` to consider two | ||
* mappings with the same generated line and column, but different | ||
* source/name/original line and column the same. Useful when searching for a | ||
* mapping with a stubbed out mapping. | ||
*/ | ||
function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) { | ||
var cmp; | ||
cmp = mappingA.generatedLine - mappingB.generatedLine; | ||
if (cmp) { | ||
return cmp; | ||
} | ||
cmp = mappingA.generatedColumn - mappingB.generatedColumn; | ||
if (cmp || onlyCompareGenerated) { | ||
return cmp; | ||
} | ||
cmp = strcmp(mappingA.source, mappingB.source); | ||
if (cmp) { | ||
return cmp; | ||
} | ||
cmp = mappingA.originalLine - mappingB.originalLine; | ||
if (cmp) { | ||
return cmp; | ||
} | ||
cmp = mappingA.originalColumn - mappingB.originalColumn; | ||
if (cmp) { | ||
return cmp; | ||
} | ||
return strcmp(mappingA.name, mappingB.name); | ||
}; | ||
exports.compareByGeneratedPositions = compareByGeneratedPositions; | ||
}); |
{ | ||
"name": "source-map", | ||
"description": "Generates and consumes source maps", | ||
"version": "0.1.29", | ||
"version": "0.1.30", | ||
"homepage": "https://github.com/mozilla/source-map", | ||
@@ -48,4 +48,5 @@ "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>", | ||
"scripts": { | ||
"test": "node test/run-tests.js" | ||
"test": "node test/run-tests.js", | ||
"build": "node Makefile.dryice.js" | ||
} | ||
} |
127
README.md
@@ -6,10 +6,8 @@ # Source Map | ||
[Learn more here][feature]. | ||
This library is written in the Asynchronous Module Definition format, and works | ||
in the following environments: | ||
This library was written in the Asynchronous Module Definition | ||
format. It should work in the following environments: | ||
* Modern Browsers supporting ECMAScript 5 (either after the build, or with an | ||
AMD loader such as RequireJS) | ||
* Modern Browsers (either after the build, or with an AMD loader such as | ||
RequireJS) | ||
* Inside Firefox (as a JSM file, after the build) | ||
@@ -19,15 +17,6 @@ | ||
## Installing with NPM (for use with NodeJS) | ||
## Node | ||
Simply | ||
$ npm install source-map | ||
Or, if you'd like to hack on this library and have it installed via npm so you | ||
can try out your changes: | ||
$ git clone https://fitzgen@github.com/mozilla/source-map.git | ||
$ cd source-map | ||
$ npm link . | ||
## Building from Source (for everywhere else) | ||
@@ -45,3 +34,3 @@ | ||
This should create the following files: | ||
This should spew a bunch of stuff to stdout, and create the following files: | ||
@@ -52,5 +41,101 @@ * `dist/source-map.js` - The unminified browser version. | ||
* `dist/SourceMap.jsm` - The JavaScript Module for inclusion in Firefox | ||
source. | ||
* `dist/SourceMap.jsm` - The JavaScript Module for inclusion in Firefox source. | ||
## Examples | ||
### Consuming a source map | ||
var rawSourceMap = { | ||
version: 3, | ||
file: 'min.js', | ||
names: ['bar', 'baz', 'n'], | ||
sources: ['one.js', 'two.js'], | ||
sourceRoot: 'http://example.com/www/js/', | ||
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' | ||
}; | ||
var smc = new SourceMapConsumer(rawSourceMap); | ||
console.log(smc.sources); | ||
// [ 'http://example.com/www/js/one.js', | ||
// 'http://example.com/www/js/two.js' ] | ||
console.log(smc.originalPositionFor({ | ||
line: 2, | ||
column: 28 | ||
})); | ||
// { source: 'http://example.com/www/js/two.js', | ||
// line: 2, | ||
// column: 10, | ||
// name: 'n' } | ||
console.log(smc.generatedPositionFor({ | ||
source: 'http://example.com/www/js/two.js', | ||
line: 2, | ||
column: 10 | ||
})); | ||
// { line: 2, column: 28 } | ||
smc.eachMapping(function (m) { | ||
// ... | ||
}); | ||
### Generating a source map | ||
In depth guide: | ||
[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) | ||
#### With SourceNode (high level API) | ||
function compile(ast) { | ||
switch (ast.type) { | ||
case 'BinaryExpression': | ||
return new SourceNode( | ||
ast.location.line, | ||
ast.location.column, | ||
ast.location.source, | ||
[compile(ast.left), " + ", compile(ast.right)] | ||
); | ||
case 'Literal': | ||
return new SourceNode( | ||
ast.location.line, | ||
ast.location.column, | ||
ast.location.source, | ||
String(ast.value) | ||
); | ||
// ... | ||
default: | ||
throw new Error("Bad AST"); | ||
} | ||
} | ||
var ast = parse("40 + 2", "add.js"); | ||
console.log(compile(ast).toStringWithSourceMap({ | ||
file: 'add.js' | ||
})); | ||
// { code: '40 + 2', | ||
// map: [object SourceMapGenerator] } | ||
#### With SourceMapGenerator (low level API) | ||
var map = new SourceMapGenerator({ | ||
file: "source-mapped.js" | ||
}); | ||
map.addMapping({ | ||
generated: { | ||
line: 10, | ||
column: 35 | ||
}, | ||
source: "foo.js", | ||
original: { | ||
line: 33, | ||
column: 2 | ||
}, | ||
name: "christopher" | ||
}); | ||
console.log(map.toString()); | ||
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' | ||
## API | ||
@@ -148,3 +233,5 @@ | ||
* `callback`: The function that is called with each mapping. | ||
* `callback`: The function that is called with each mapping. Mappings have the | ||
form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, | ||
name }` | ||
@@ -151,0 +238,0 @@ * `context`: Optional. If specified, this object will be the value of `this` |
@@ -25,10 +25,6 @@ #!/usr/bin/env node | ||
passed++; | ||
process.stdout.write('.'); | ||
} | ||
catch (e) { | ||
failures.push({ | ||
name: tests[i].name + ': ' + k, | ||
error: e | ||
}); | ||
process.stdout.write('E'); | ||
console.log('FAILED ' + tests[i].name + ': ' + k + '!'); | ||
console.log(e.stack); | ||
} | ||
@@ -39,10 +35,7 @@ } | ||
process.stdout.write('\n'); | ||
console.log(""); | ||
console.log(passed + ' / ' + total + ' tests passed.'); | ||
console.log(""); | ||
failures.forEach(function (f) { | ||
console.log('================================================================================'); | ||
console.log(f.name); | ||
console.log('--------------------------------------------------------------------------------'); | ||
console.log(f.error.stack); | ||
}); | ||
@@ -60,3 +53,6 @@ | ||
function isTestFile(f) { | ||
return /^test\-.*?\.js/.test(f); | ||
var testToRun = process.argv[2]; | ||
return testToRun | ||
? path.basename(testToRun) === f | ||
: /^test\-.*?\.js/.test(f); | ||
} | ||
@@ -68,3 +64,5 @@ | ||
var requires = fs.readdirSync(path.join(__dirname, 'source-map')).filter(isTestFile).map(toModule); | ||
var requires = fs.readdirSync(path.join(__dirname, 'source-map')) | ||
.filter(isTestFile) | ||
.map(toModule); | ||
@@ -71,0 +69,0 @@ code = run(requires.map(require).map(function (mod, i) { |
@@ -391,2 +391,62 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
exports['test SourceMapConsumer.fromSourceMap'] = function (assert, util) { | ||
var smg = new SourceMapGenerator({ | ||
sourceRoot: 'http://example.com/', | ||
file: 'foo.js' | ||
}); | ||
smg.addMapping({ | ||
original: { line: 1, column: 1 }, | ||
generated: { line: 2, column: 2 }, | ||
source: 'bar.js' | ||
}); | ||
smg.addMapping({ | ||
original: { line: 2, column: 2 }, | ||
generated: { line: 4, column: 4 }, | ||
source: 'baz.js', | ||
name: 'dirtMcGirt' | ||
}); | ||
smg.setSourceContent('baz.js', 'baz.js content'); | ||
var smc = SourceMapConsumer.fromSourceMap(smg); | ||
assert.equal(smc.file, 'foo.js'); | ||
assert.equal(smc.sourceRoot, 'http://example.com/'); | ||
assert.equal(smc.sources.length, 2); | ||
assert.equal(smc.sources[0], 'http://example.com/bar.js'); | ||
assert.equal(smc.sources[1], 'http://example.com/baz.js'); | ||
assert.equal(smc.sourceContentFor('baz.js'), 'baz.js content'); | ||
var pos = smc.originalPositionFor({ | ||
line: 2, | ||
column: 2 | ||
}); | ||
assert.equal(pos.line, 1); | ||
assert.equal(pos.column, 1); | ||
assert.equal(pos.source, 'http://example.com/bar.js'); | ||
assert.equal(pos.name, null); | ||
pos = smc.generatedPositionFor({ | ||
line: 1, | ||
column: 1, | ||
source: 'http://example.com/bar.js' | ||
}); | ||
assert.equal(pos.line, 2); | ||
assert.equal(pos.column, 2); | ||
pos = smc.originalPositionFor({ | ||
line: 4, | ||
column: 4 | ||
}); | ||
assert.equal(pos.line, 2); | ||
assert.equal(pos.column, 2); | ||
assert.equal(pos.source, 'http://example.com/baz.js'); | ||
assert.equal(pos.name, 'dirtMcGirt'); | ||
pos = smc.generatedPositionFor({ | ||
line: 2, | ||
column: 2, | ||
source: 'http://example.com/baz.js' | ||
}); | ||
assert.equal(pos.line, 4); | ||
assert.equal(pos.column, 4); | ||
}; | ||
}); |
@@ -260,7 +260,13 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
var input = new SourceNode(null, null, null, [ | ||
new SourceNode(1, 0, "a.js", "(function"), new SourceNode(1, 0, "a.js", "() {\n"), | ||
" ", new SourceNode(1, 0, "a.js", "var Test = "), new SourceNode(1, 0, "b.js", "{};\n"), | ||
new SourceNode(2, 0, "b.js", "Test"), new SourceNode(2, 0, "b.js", ".A", "A"), new SourceNode(2, 20, "b.js", " = { value: 1234 };\n", "A"), | ||
"}());\n", | ||
"/* Generated Source */"]); | ||
new SourceNode(1, 0, "a.js", "(function"), | ||
new SourceNode(1, 0, "a.js", "() {\n"), | ||
" ", | ||
new SourceNode(1, 0, "a.js", "var Test = "), | ||
new SourceNode(1, 0, "b.js", "{};\n"), | ||
new SourceNode(2, 0, "b.js", "Test"), | ||
new SourceNode(2, 0, "b.js", ".A", "A"), | ||
new SourceNode(2, 20, "b.js", " = { value: 1234 };\n", "A"), | ||
"}());\n", | ||
"/* Generated Source */" | ||
]); | ||
input = input.toStringWithSourceMap({ | ||
@@ -267,0 +273,0 @@ file: 'foo.js' |
@@ -146,3 +146,4 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
actualMap.sourceRoot + " != " + expectedMap.sourceRoot); | ||
assert.equal(actualMap.mappings, expectedMap.mappings, "mappings mismatch"); | ||
assert.equal(actualMap.mappings, expectedMap.mappings, | ||
"mappings mismatch:\nActual: " + actualMap.mappings + "\nExpected: " + expectedMap.mappings); | ||
if (actualMap.sourcesContent) { | ||
@@ -149,0 +150,0 @@ assert.equal(actualMap.sourcesContent.length, |
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
147801
3497
435