Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acorn-6to5

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn-6to5 - npm Package Compare versions

Comparing version 0.9.1-14 to 0.9.1-15

74

acorn_loose.js

@@ -48,3 +48,2 @@ // Acorn: Loose parser

input = String(inpt);
if (/^#!.*/.test(input)) input = "//" + input.slice(2);
fetchToken = acorn.tokenize(input, opts);

@@ -104,2 +103,6 @@ options = fetchToken.options;

replace = {start: e.pos, end: pos, type: tt.regexp, value: re};
} else if (/template/.test(msg)) {
replace = {start: e.pos, end: pos,
type: input.charAt(e.pos) == "`" ? tt.template : tt.templateContinued,
value: input.slice(e.pos + 1, pos)};
} else {

@@ -255,2 +258,10 @@ replace = false;

function finishNodeAt(node, type, pos) {
if (options.locations) { node.loc.end = pos[1]; pos = pos[0]; }
node.type = type;
node.end = pos;
if (options.ranges) node.range[1] = pos;
return node;
}
function dummyIdent() {

@@ -687,2 +698,7 @@ var dummy = startNode();

base = finishNode(node, "CallExpression");
} else if (token.type == tt.template) {
var node = startNodeAt(start);
node.tag = base;
node.quasi = parseTemplate();
base = finishNode(node, "TaggedTemplateExpression");
} else {

@@ -776,2 +792,5 @@ return base;

case tt.template:
return parseTemplate();
default:

@@ -796,2 +815,36 @@ return dummyIdent();

function parseTemplateElement() {
var elem = startNodeAt(options.locations ? [token.start + 1, token.startLoc.offset(1)] : token.start + 1);
elem.value = token.value;
elem.tail = input.charCodeAt(token.end - 1) !== 123; // '{'
var endOff = elem.tail ? 1 : 2;
var endPos = options.locations ? [token.end - endOff, token.endLoc.offset(-endOff)] : token.end - endOff;
next();
return finishNodeAt(elem, "TemplateElement", endPos);
}
function parseTemplate() {
var node = startNode();
node.expressions = [];
var curElt = parseTemplateElement();
node.quasis = [curElt];
while (!curElt.tail) {
var next = parseExpression();
if (isDummy(next)) {
node.quasis[node.quasis.length - 1].tail = true;
break;
}
node.expressions.push(next);
if (token.type === tt.templateContinued) {
node.quasis.push(curElt = parseTemplateElement());
} else {
curElt = startNode();
curElt.value = {cooked: "", raw: ""};
curElt.tail = true;
node.quasis.push(curElt);
}
}
return finishNode(node, "TemplateLiteral");
}
function parseObj(isClass, isStatement) {

@@ -860,3 +913,8 @@ var node = startNode();

popCx();
eat(tt.braceR);
if (!eat(tt.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
lastEnd = token.start;
if (options.locations) lastEndLoc = token.startLoc;
}
if (isClass) {

@@ -1092,6 +1150,5 @@ semicolon();

function parseExprList(close, allowEmpty) {
var indent = curIndent, line = curLineStart, elts = [], continuedLine = nextLineStart;
var indent = curIndent, line = curLineStart, elts = [];
next(); // Opening bracket
if (curLineStart > continuedLine) continuedLine = curLineStart;
while (!closes(close, indent + (curLineStart <= continuedLine ? 1 : 0), line)) {
while (!closes(close, indent + 1, line)) {
if (eat(tt.comma)) {

@@ -1111,5 +1168,10 @@ elts.push(allowEmpty ? null : dummyIdent());

popCx();
eat(close);
if (!eat(close)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
lastEnd = token.start;
if (options.locations) lastEndLoc = token.startLoc;
}
return elts;
}
});

2

package.json

@@ -5,3 +5,3 @@ {

"main": "acorn.js",
"version": "0.9.1-14",
"version": "0.9.1-15",
"maintainers": [

@@ -8,0 +8,0 @@ {

@@ -61,3 +61,2 @@ (function() {

filter: function (test) {
if (/`/.test(test.code)) return false; // FIXME remove this when the loose parse supports template strings
var opts = test.options || {};

@@ -64,0 +63,0 @@ if (opts.loose === false) return false;

@@ -485,4 +485,2 @@ if (typeof exports != "undefined") {

testFail("async function* foo(promise) { await promise; }", "Unexpected token (1:14)", {ecmaVersion: 7});
test('async function foo(promise) { await promise; }', {

@@ -1905,2 +1903,41 @@ type: "Program",

test('export async function foo(){}', {
"type": "Program",
"start": 0,
"end": 29,
"body": [{
"type": "ExportDeclaration",
"start": 0,
"end": 29,
"declaration": {
"type": "FunctionDeclaration",
"start": 7,
"end": 29,
"id": {
"type": "Identifier",
"start": 22,
"end": 25,
"name": "foo"
},
"params": [],
"defaults": [],
"rest": null,
"generator": false,
"async": true,
"body": {
"type": "BlockStatement",
"start": 27,
"end": 29,
"body": []
},
"expression": false
},
"default": false,
"specifiers": null,
"source": null
}]
}, {
ecmaVersion: 7
});
// ES7: Abstract references

@@ -1907,0 +1944,0 @@

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc