source-map
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -24,4 +24,5 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
* generated JS, or other SourceNodes. | ||
* @param aName The original identifier. | ||
*/ | ||
function SourceNode(aLine, aColumn, aSource, aChunks) { | ||
function SourceNode(aLine, aColumn, aSource, aChunks, aName) { | ||
this.children = []; | ||
@@ -31,2 +32,3 @@ this.line = aLine === undefined ? null : aLine; | ||
this.source = aSource === undefined ? null : aSource; | ||
this.name = aName === undefined ? null : aName; | ||
if (aChunks != null) this.add(aChunks); | ||
@@ -97,3 +99,6 @@ } | ||
if (chunk !== '') { | ||
aFn(chunk, { source: this.source, line: this.line, column: this.column }); | ||
aFn(chunk, { source: this.source, | ||
line: this.line, | ||
column: this.column, | ||
name: this.name }); | ||
} | ||
@@ -184,3 +189,4 @@ } | ||
column: generated.column | ||
} | ||
}, | ||
name: original.name | ||
}); | ||
@@ -187,0 +193,0 @@ } |
{ | ||
"name": "source-map", | ||
"description": "Generates and consumes source maps", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"homepage": "https://github.com/mozilla/source-map", | ||
@@ -6,0 +6,0 @@ "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>", |
@@ -204,3 +204,3 @@ # Source Map | ||
#### new SourceNode(line, column, source[, chunk]) | ||
#### new SourceNode(line, column, source[, chunk[, name]]) | ||
@@ -218,2 +218,4 @@ * `line`: The original line number associated with this source node, or null if | ||
* `name`: Optional. The original identifier. | ||
#### SourceNode.prototype.add(chunk) | ||
@@ -220,0 +222,0 @@ |
@@ -134,3 +134,6 @@ /* -*- Mode: js; js-indent-level: 2; -*- */ | ||
['(function () {\n', | ||
' ', new SourceNode(1, 0, 'a.js', ['someCall()']), ';\n', | ||
' ', | ||
new SourceNode(1, 0, 'a.js', 'someCall', 'originalCall'), | ||
new SourceNode(1, 8, 'a.js', '()'), | ||
';\n', | ||
' ', new SourceNode(2, 0, 'b.js', ['if (foo) bar()']), ';\n', | ||
@@ -154,2 +157,3 @@ '}());']); | ||
assert.equal(actual.column, 0); | ||
assert.equal(actual.name, 'originalCall'); | ||
@@ -156,0 +160,0 @@ actual = map.originalPositionFor({ |
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
99458
2369
286