acorn-loose
Advanced tools
Comparing version 8.2.1 to 8.3.0
@@ -0,1 +1,13 @@ | ||
## 8.3.0 (2021-12-27) | ||
### New features | ||
Support quoted export names. | ||
Support class private fields with the `in` operator. | ||
### Bug fixes | ||
Fix a bug that caused semicolons after `export *` statements to be parsed as empty statements. | ||
## 8.2.1 (2021-09-06) | ||
@@ -2,0 +14,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('acorn')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'acorn'], factory) : | ||
(global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.loose = {}), global.acorn)); | ||
}(this, (function (exports, acorn) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.acorn = global.acorn || {}, global.acorn.loose = {}), global.acorn)); | ||
})(this, (function (exports, acorn) { 'use strict'; | ||
@@ -184,3 +184,3 @@ var dummyValue = "✖"; | ||
var lp = LooseParser.prototype; | ||
var lp$2 = LooseParser.prototype; | ||
@@ -191,3 +191,3 @@ function isSpace(ch) { | ||
lp.next = function() { | ||
lp$2.next = function() { | ||
this.last = this.tok; | ||
@@ -208,3 +208,3 @@ if (this.ahead.length) | ||
lp.readToken = function() { | ||
lp$2.readToken = function() { | ||
for (;;) { | ||
@@ -231,3 +231,3 @@ try { | ||
var re = this.input.slice(e.pos, pos); | ||
try { re = new RegExp(re); } catch (e) { /* ignore compilation error due to new syntax */ } | ||
try { re = new RegExp(re); } catch (e$1) { /* ignore compilation error due to new syntax */ } | ||
replace = {start: e.pos, end: pos, type: acorn.tokTypes.regexp, value: re}; | ||
@@ -273,3 +273,3 @@ } else if (/template/.test(msg)) { | ||
lp.resetTo = function(pos) { | ||
lp$2.resetTo = function(pos) { | ||
this.toks.pos = pos; | ||
@@ -292,3 +292,3 @@ var ch = this.input.charAt(pos - 1); | ||
lp.lookAhead = function(n) { | ||
lp$2.lookAhead = function(n) { | ||
while (n > this.ahead.length) | ||
@@ -760,2 +760,3 @@ { this.ahead.push(this.readToken()); } | ||
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString(); | ||
this.semicolon(); | ||
return this.finishNode(node, "ExportAllDeclaration") | ||
@@ -829,9 +830,9 @@ } | ||
if (this.eat(acorn.tokTypes.star)) { | ||
elt$1.local = this.eatContextual("as") ? this.parseIdent() : this.dummyIdent(); | ||
elt$1.local = this.eatContextual("as") ? this.parseModuleExportName() : this.dummyIdent(); | ||
this.finishNode(elt$1, "ImportNamespaceSpecifier"); | ||
} else { | ||
if (this.isContextual("from")) { break } | ||
elt$1.imported = this.parseIdent(); | ||
elt$1.imported = this.parseModuleExportName(); | ||
if (isDummy(elt$1.imported)) { break } | ||
elt$1.local = this.eatContextual("as") ? this.parseIdent() : elt$1.imported; | ||
elt$1.local = this.eatContextual("as") ? this.parseModuleExportName() : elt$1.imported; | ||
this.finishNode(elt$1, "ImportSpecifier"); | ||
@@ -857,5 +858,5 @@ } | ||
var elt = this.startNode(); | ||
elt.local = this.parseIdent(); | ||
elt.local = this.parseModuleExportName(); | ||
if (isDummy(elt.local)) { break } | ||
elt.exported = this.eatContextual("as") ? this.parseIdent() : elt.local; | ||
elt.exported = this.eatContextual("as") ? this.parseModuleExportName() : elt.local; | ||
this.finishNode(elt, "ExportSpecifier"); | ||
@@ -870,5 +871,11 @@ elts.push(elt); | ||
var lp$2 = LooseParser.prototype; | ||
lp$1.parseModuleExportName = function() { | ||
return this.options.ecmaVersion >= 13 && this.tok.type === acorn.tokTypes.string | ||
? this.parseExprAtom() | ||
: this.parseIdent() | ||
}; | ||
lp$2.checkLVal = function(expr) { | ||
var lp = LooseParser.prototype; | ||
lp.checkLVal = function(expr) { | ||
if (!expr) { return expr } | ||
@@ -889,3 +896,3 @@ switch (expr.type) { | ||
lp$2.parseExpression = function(noIn) { | ||
lp.parseExpression = function(noIn) { | ||
var start = this.storeCurrentPos(); | ||
@@ -902,3 +909,3 @@ var expr = this.parseMaybeAssign(noIn); | ||
lp$2.parseParenExpression = function() { | ||
lp.parseParenExpression = function() { | ||
this.pushCx(); | ||
@@ -912,3 +919,3 @@ this.expect(acorn.tokTypes.parenL); | ||
lp$2.parseMaybeAssign = function(noIn) { | ||
lp.parseMaybeAssign = function(noIn) { | ||
// `yield` should be an identifier reference if it's not in generator functions. | ||
@@ -941,3 +948,3 @@ if (this.inGenerator && this.toks.isContextual("yield")) { | ||
lp$2.parseMaybeConditional = function(noIn) { | ||
lp.parseMaybeConditional = function(noIn) { | ||
var start = this.storeCurrentPos(); | ||
@@ -955,3 +962,3 @@ var expr = this.parseExprOps(noIn); | ||
lp$2.parseExprOps = function(noIn) { | ||
lp.parseExprOps = function(noIn) { | ||
var start = this.storeCurrentPos(); | ||
@@ -962,3 +969,3 @@ var indent = this.curIndent, line = this.curLineStart; | ||
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) { | ||
lp.parseExprOp = function(left, start, minPrec, noIn, indent, line) { | ||
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left } | ||
@@ -985,3 +992,3 @@ var prec = this.tok.type.binop; | ||
lp$2.parseMaybeUnary = function(sawUnary) { | ||
lp.parseMaybeUnary = function(sawUnary) { | ||
var start = this.storeCurrentPos(), expr; | ||
@@ -1007,2 +1014,4 @@ if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") && | ||
expr = this.finishNode(node$1, "SpreadElement"); | ||
} else if (!sawUnary && this.tok.type === acorn.tokTypes.privateId) { | ||
expr = this.parsePrivateIdent(); | ||
} else { | ||
@@ -1031,3 +1040,3 @@ expr = this.parseExprSubscripts(); | ||
lp$2.parseExprSubscripts = function() { | ||
lp.parseExprSubscripts = function() { | ||
var start = this.storeCurrentPos(); | ||
@@ -1037,3 +1046,3 @@ return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart) | ||
lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) { | ||
lp.parseSubscripts = function(base, start, noCalls, startIndent, line) { | ||
var optionalSupported = this.options.ecmaVersion >= 11; | ||
@@ -1109,3 +1118,3 @@ var optionalChained = false; | ||
lp$2.parseExprAtom = function() { | ||
lp.parseExprAtom = function() { | ||
var node; | ||
@@ -1214,3 +1223,3 @@ switch (this.tok.type) { | ||
lp$2.parseExprImport = function() { | ||
lp.parseExprImport = function() { | ||
var node = this.startNode(); | ||
@@ -1230,3 +1239,3 @@ var meta = this.parseIdent(true); | ||
lp$2.parseDynamicImport = function(node) { | ||
lp.parseDynamicImport = function(node) { | ||
node.source = this.parseExprList(acorn.tokTypes.parenR)[0] || this.dummyString(); | ||
@@ -1236,3 +1245,3 @@ return this.finishNode(node, "ImportExpression") | ||
lp$2.parseImportMeta = function(node) { | ||
lp.parseImportMeta = function(node) { | ||
this.next(); // skip '.' | ||
@@ -1243,3 +1252,3 @@ node.property = this.parseIdent(true); | ||
lp$2.parseNew = function() { | ||
lp.parseNew = function() { | ||
var node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart; | ||
@@ -1262,3 +1271,3 @@ var meta = this.parseIdent(true); | ||
lp$2.parseTemplateElement = function() { | ||
lp.parseTemplateElement = function() { | ||
var elem = this.startNode(); | ||
@@ -1283,3 +1292,3 @@ | ||
lp$2.parseTemplate = function() { | ||
lp.parseTemplate = function() { | ||
var node = this.startNode(); | ||
@@ -1307,3 +1316,3 @@ this.next(); | ||
lp$2.parseObj = function() { | ||
lp.parseObj = function() { | ||
var node = this.startNode(); | ||
@@ -1381,3 +1390,3 @@ node.properties = []; | ||
lp$2.parsePropertyName = function(prop) { | ||
lp.parsePropertyName = function(prop) { | ||
if (this.options.ecmaVersion >= 6) { | ||
@@ -1397,3 +1406,3 @@ if (this.eat(acorn.tokTypes.bracketL)) { | ||
lp$2.parsePropertyAccessor = function() { | ||
lp.parsePropertyAccessor = function() { | ||
if (this.tok.type === acorn.tokTypes.name || this.tok.type.keyword) { return this.parseIdent() } | ||
@@ -1403,3 +1412,3 @@ if (this.tok.type === acorn.tokTypes.privateId) { return this.parsePrivateIdent() } | ||
lp$2.parseIdent = function() { | ||
lp.parseIdent = function() { | ||
var name = this.tok.type === acorn.tokTypes.name ? this.tok.value : this.tok.type.keyword; | ||
@@ -1413,3 +1422,3 @@ if (!name) { return this.dummyIdent() } | ||
lp$2.parsePrivateIdent = function() { | ||
lp.parsePrivateIdent = function() { | ||
var node = this.startNode(); | ||
@@ -1421,3 +1430,3 @@ node.name = this.tok.value; | ||
lp$2.initFunction = function(node) { | ||
lp.initFunction = function(node) { | ||
node.id = null; | ||
@@ -1436,3 +1445,3 @@ node.params = []; | ||
lp$2.toAssignable = function(node, binding) { | ||
lp.toAssignable = function(node, binding) { | ||
if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) ; else if (node.type === "ParenthesizedExpression") { | ||
@@ -1467,3 +1476,3 @@ this.toAssignable(node.expression, binding); | ||
lp$2.toAssignableList = function(exprList, binding) { | ||
lp.toAssignableList = function(exprList, binding) { | ||
for (var i = 0, list = exprList; i < list.length; i += 1) | ||
@@ -1478,3 +1487,3 @@ { | ||
lp$2.parseFunctionParams = function(params) { | ||
lp.parseFunctionParams = function(params) { | ||
params = this.parseExprList(acorn.tokTypes.parenR); | ||
@@ -1484,3 +1493,3 @@ return this.toAssignableList(params, true) | ||
lp$2.parseMethod = function(isGenerator, isAsync) { | ||
lp.parseMethod = function(isGenerator, isAsync) { | ||
var node = this.startNode(), oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction; | ||
@@ -1504,3 +1513,3 @@ this.initFunction(node); | ||
lp$2.parseArrowExpression = function(node, params, isAsync) { | ||
lp.parseArrowExpression = function(node, params, isAsync) { | ||
var oldInAsync = this.inAsync, oldInGenerator = this.inGenerator, oldInFunction = this.inFunction; | ||
@@ -1527,3 +1536,3 @@ this.initFunction(node); | ||
lp$2.parseExprList = function(close, allowEmpty) { | ||
lp.parseExprList = function(close, allowEmpty) { | ||
this.pushCx(); | ||
@@ -1556,3 +1565,3 @@ var indent = this.curIndent, line = this.curLineStart, elts = []; | ||
lp$2.parseAwait = function() { | ||
lp.parseAwait = function() { | ||
var node = this.startNode(); | ||
@@ -1578,2 +1587,2 @@ this.next(); | ||
}))); | ||
})); |
@@ -18,3 +18,3 @@ { | ||
}, | ||
"version": "8.2.1", | ||
"version": "8.3.0", | ||
"engines": {"node": ">=0.4.0"}, | ||
@@ -21,0 +21,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
113845
2788