Comparing version 0.16.1 to 0.16.2
@@ -268,23 +268,26 @@ var assert = require("assert"); | ||
} | ||
// node.loc is not present when using export default with a template literal | ||
if (node.loc) { | ||
// First we need to exclude the opening ` from the .loc of the first | ||
// quasi element, in case the parser accidentally decided to include it. | ||
var afterLeftBackTickPos = copyPos(node.loc.start); | ||
assert.strictEqual(lines.charAt(afterLeftBackTickPos), "`"); | ||
assert.ok(lines.nextPos(afterLeftBackTickPos)); | ||
var firstQuasi = node.quasis[0]; | ||
if (comparePos(firstQuasi.loc.start, afterLeftBackTickPos) < 0) { | ||
firstQuasi.loc.start = afterLeftBackTickPos; | ||
} | ||
// First we need to exclude the opening ` from the .loc of the first | ||
// quasi element, in case the parser accidentally decided to include it. | ||
var afterLeftBackTickPos = copyPos(node.loc.start); | ||
assert.strictEqual(lines.charAt(afterLeftBackTickPos), "`"); | ||
assert.ok(lines.nextPos(afterLeftBackTickPos)); | ||
var firstQuasi = node.quasis[0]; | ||
if (comparePos(firstQuasi.loc.start, afterLeftBackTickPos) < 0) { | ||
firstQuasi.loc.start = afterLeftBackTickPos; | ||
// Next we need to exclude the closing ` from the .loc of the last quasi | ||
// element, in case the parser accidentally decided to include it. | ||
var rightBackTickPos = copyPos(node.loc.end); | ||
assert.ok(lines.prevPos(rightBackTickPos)); | ||
assert.strictEqual(lines.charAt(rightBackTickPos), "`"); | ||
var lastQuasi = node.quasis[node.quasis.length - 1]; | ||
if (comparePos(rightBackTickPos, lastQuasi.loc.end) < 0) { | ||
lastQuasi.loc.end = rightBackTickPos; | ||
} | ||
} | ||
// Next we need to exclude the closing ` from the .loc of the last quasi | ||
// element, in case the parser accidentally decided to include it. | ||
var rightBackTickPos = copyPos(node.loc.end); | ||
assert.ok(lines.prevPos(rightBackTickPos)); | ||
assert.strictEqual(lines.charAt(rightBackTickPos), "`"); | ||
var lastQuasi = node.quasis[node.quasis.length - 1]; | ||
if (comparePos(rightBackTickPos, lastQuasi.loc.end) < 0) { | ||
lastQuasi.loc.end = rightBackTickPos; | ||
} | ||
// Now we need to exclude ${ and } characters from the .loc's of all | ||
@@ -291,0 +294,0 @@ // quasi elements, since some parsers accidentally include them. |
{ | ||
"author": "Ben Newman <bn@cs.stanford.edu>", | ||
"name": "recast", | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"description": "JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"dependencies": { | ||
"ast-types": "0.11.6", | ||
"ast-types": "0.11.7", | ||
"esprima": "~4.0.0", | ||
@@ -34,0 +34,0 @@ "private": "~0.1.5", |
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
198581
5364
+ Addedast-types@0.11.7(transitive)
- Removedast-types@0.11.6(transitive)
Updatedast-types@0.11.7