forked from hero/www_hero
hero_web
This commit is contained in:
71
node_modules/acorn-node/lib/bigint/index.js
generated
vendored
Normal file
71
node_modules/acorn-node/lib/bigint/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var acorn = require("acorn")
|
||||
var tt = acorn.tokTypes
|
||||
var isIdentifierStart = acorn.isIdentifierStart
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseLiteral = function parseLiteral (value) {
|
||||
var node = Parser.prototype.parseLiteral.call(this, value)
|
||||
if (node.raw.charCodeAt(node.raw.length - 1) == 110) { node.bigint = this.getNumberInput(node.start, node.end) }
|
||||
return node
|
||||
};
|
||||
|
||||
anonymous.prototype.readRadixNumber = function readRadixNumber (radix) {
|
||||
var start = this.pos
|
||||
this.pos += 2 // 0x
|
||||
var val = this.readInt(radix)
|
||||
if (val === null) { this.raise(this.start + 2, ("Expected number in radix " + radix)) }
|
||||
if (this.input.charCodeAt(this.pos) == 110) {
|
||||
var str = this.getNumberInput(start, this.pos)
|
||||
val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
||||
++this.pos
|
||||
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number") }
|
||||
return this.finishToken(tt.num, val)
|
||||
};
|
||||
|
||||
anonymous.prototype.readNumber = function readNumber (startsWithDot) {
|
||||
var start = this.pos
|
||||
|
||||
// Not an int
|
||||
if (startsWithDot) { return Parser.prototype.readNumber.call(this, startsWithDot) }
|
||||
|
||||
// Legacy octal
|
||||
if (this.input.charCodeAt(start) === 48 && this.input.charCodeAt(start + 1) !== 110) {
|
||||
return Parser.prototype.readNumber.call(this, startsWithDot)
|
||||
}
|
||||
|
||||
if (this.readInt(10) === null) { this.raise(start, "Invalid number") }
|
||||
|
||||
// Not a BigInt, reset and parse again
|
||||
if (this.input.charCodeAt(this.pos) != 110) {
|
||||
this.pos = start
|
||||
return Parser.prototype.readNumber.call(this, startsWithDot)
|
||||
}
|
||||
|
||||
var str = this.getNumberInput(start, this.pos)
|
||||
var val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
||||
++this.pos
|
||||
return this.finishToken(tt.num, val)
|
||||
};
|
||||
|
||||
// This is basically a hook for acorn-numeric-separator
|
||||
anonymous.prototype.getNumberInput = function getNumberInput (start, end) {
|
||||
if (Parser.prototype.getNumberInput) { return Parser.prototype.getNumberInput.call(this, start, end) }
|
||||
return this.input.slice(start, end)
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
70
node_modules/acorn-node/lib/class-fields/index.js
generated
vendored
Normal file
70
node_modules/acorn-node/lib/class-fields/index.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var acorn = require("acorn")
|
||||
var tt = acorn.tokTypes
|
||||
var privateClassElements = require("../private-class-elements")
|
||||
|
||||
function maybeParseFieldValue(field) {
|
||||
if (this.eat(tt.eq)) {
|
||||
var oldInFieldValue = this._inFieldValue
|
||||
this._inFieldValue = true
|
||||
field.value = this.parseExpression()
|
||||
this._inFieldValue = oldInFieldValue
|
||||
} else { field.value = null }
|
||||
}
|
||||
|
||||
module.exports = function(Parser) {
|
||||
Parser = privateClassElements(Parser)
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseClassElement = function parseClassElement (_constructorAllowsSuper) {
|
||||
if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type == this.privateNameToken || this.type == tt.bracketL || this.type == tt.string)) {
|
||||
var branch = this._branch()
|
||||
if (branch.type == tt.bracketL) {
|
||||
var count = 0
|
||||
do {
|
||||
if (branch.eat(tt.bracketL)) { ++count }
|
||||
else if (branch.eat(tt.bracketR)) { --count }
|
||||
else { branch.next() }
|
||||
} while (count > 0)
|
||||
} else { branch.next() }
|
||||
if (branch.type == tt.eq || branch.canInsertSemicolon() || branch.type == tt.semi) {
|
||||
var node = this.startNode()
|
||||
if (this.type == this.privateNameToken) {
|
||||
this.parsePrivateClassElementName(node)
|
||||
} else {
|
||||
this.parsePropertyName(node)
|
||||
}
|
||||
if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
|
||||
(node.key.type === "Literal" && node.key.value === "constructor")) {
|
||||
this.raise(node.key.start, "Classes may not have a field called constructor")
|
||||
}
|
||||
maybeParseFieldValue.call(this, node)
|
||||
this.finishNode(node, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return node
|
||||
}
|
||||
}
|
||||
|
||||
return Parser.prototype.parseClassElement.apply(this, arguments)
|
||||
};
|
||||
|
||||
// Prohibit arguments in class field initializers
|
||||
anonymous.prototype.parseIdent = function parseIdent (liberal, isBinding) {
|
||||
var ident = Parser.prototype.parseIdent.call(this, liberal, isBinding)
|
||||
if (this._inFieldValue && ident.name == "arguments") { this.raise(ident.start, "A class field initializer may not contain arguments") }
|
||||
return ident
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
86
node_modules/acorn-node/lib/dynamic-import/index.js
generated
vendored
Normal file
86
node_modules/acorn-node/lib/dynamic-import/index.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DynamicImportKey = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }();
|
||||
|
||||
var _get = function () {
|
||||
function get(object, property, receiver) { if (object === null) { object = Function.prototype; } var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }
|
||||
|
||||
return get;
|
||||
}();
|
||||
|
||||
exports['default'] = dynamicImport;
|
||||
|
||||
var _acorn = require('acorn');
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) { Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } } /* eslint-disable no-underscore-dangle */
|
||||
|
||||
|
||||
var DynamicImportKey = exports.DynamicImportKey = 'Import';
|
||||
|
||||
// NOTE: This allows `yield import()` to parse correctly.
|
||||
_acorn.tokTypes._import.startsExpr = true;
|
||||
|
||||
function parseDynamicImport() {
|
||||
var node = this.startNode();
|
||||
this.next();
|
||||
if (this.type !== _acorn.tokTypes.parenL) {
|
||||
this.unexpected();
|
||||
}
|
||||
return this.finishNode(node, DynamicImportKey);
|
||||
}
|
||||
|
||||
function parenAfter() {
|
||||
return (/^(\s|\/\/.*|\/\*[^]*?\*\/)*\(/.test(this.input.slice(this.pos))
|
||||
);
|
||||
}
|
||||
|
||||
function dynamicImport(Parser) {
|
||||
return function (_Parser) {
|
||||
_inherits(_class, _Parser);
|
||||
|
||||
function _class() {
|
||||
_classCallCheck(this, _class);
|
||||
|
||||
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(_class, [{
|
||||
key: 'parseStatement',
|
||||
value: function () {
|
||||
function parseStatement(context, topLevel, exports) {
|
||||
if (this.type === _acorn.tokTypes._import && parenAfter.call(this)) {
|
||||
return this.parseExpressionStatement(this.startNode(), this.parseExpression());
|
||||
}
|
||||
return _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'parseStatement', this).call(this, context, topLevel, exports);
|
||||
}
|
||||
|
||||
return parseStatement;
|
||||
}()
|
||||
}, {
|
||||
key: 'parseExprAtom',
|
||||
value: function () {
|
||||
function parseExprAtom(refDestructuringErrors) {
|
||||
if (this.type === _acorn.tokTypes._import) {
|
||||
return parseDynamicImport.call(this);
|
||||
}
|
||||
return _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'parseExprAtom', this).call(this, refDestructuringErrors);
|
||||
}
|
||||
|
||||
return parseExprAtom;
|
||||
}()
|
||||
}]);
|
||||
|
||||
return _class;
|
||||
}(Parser);
|
||||
}
|
43
node_modules/acorn-node/lib/export-ns-from/index.js
generated
vendored
Normal file
43
node_modules/acorn-node/lib/export-ns-from/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
var tt = require("acorn").tokTypes
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseExport = function parseExport (node, exports) {
|
||||
skipWhiteSpace.lastIndex = this.pos
|
||||
var skip = skipWhiteSpace.exec(this.input)
|
||||
var next = this.input.charAt(this.pos + skip[0].length)
|
||||
if (next !== "*") { return Parser.prototype.parseExport.call(this, node, exports) }
|
||||
|
||||
this.next()
|
||||
var specifier = this.startNode()
|
||||
this.expect(tt.star)
|
||||
if (this.eatContextual("as")) {
|
||||
node.declaration = null
|
||||
specifier.exported = this.parseIdent(true)
|
||||
this.checkExport(exports, specifier.exported.name, this.lastTokStart)
|
||||
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]
|
||||
}
|
||||
this.expectContextual("from")
|
||||
if (this.type !== tt.string) { this.unexpected() }
|
||||
node.source = this.parseExprAtom()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration")
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
55
node_modules/acorn-node/lib/import-meta/index.js
generated
vendored
Normal file
55
node_modules/acorn-node/lib/import-meta/index.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var tt = require("acorn").tokTypes
|
||||
|
||||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
var nextTokenIsDot = function (parser) {
|
||||
skipWhiteSpace.lastIndex = parser.pos
|
||||
var skip = skipWhiteSpace.exec(parser.input)
|
||||
var next = parser.pos + skip[0].length
|
||||
return parser.input.slice(next, next + 1) === "."
|
||||
}
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseExprAtom = function parseExprAtom (refDestructuringErrors) {
|
||||
if (this.type !== tt._import || !nextTokenIsDot(this)) { return Parser.prototype.parseExprAtom.call(this, refDestructuringErrors) }
|
||||
|
||||
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
||||
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")
|
||||
}
|
||||
|
||||
var node = this.startNode()
|
||||
node.meta = this.parseIdent(true)
|
||||
this.expect(tt.dot)
|
||||
node.property = this.parseIdent(true)
|
||||
if (node.property.name !== "meta") {
|
||||
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta")
|
||||
}
|
||||
return this.finishNode(node, "MetaProperty")
|
||||
};
|
||||
|
||||
anonymous.prototype.parseStatement = function parseStatement (context, topLevel, exports) {
|
||||
if (this.type !== tt._import || !nextTokenIsDot(this)) {
|
||||
return Parser.prototype.parseStatement.call(this, context, topLevel, exports)
|
||||
}
|
||||
|
||||
var node = this.startNode()
|
||||
var expr = this.parseExpression()
|
||||
return this.parseExpressionStatement(node, expr)
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
61
node_modules/acorn-node/lib/numeric-separator/index.js
generated
vendored
Normal file
61
node_modules/acorn-node/lib/numeric-separator/index.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return /*@__PURE__*/(function (Parser) {
|
||||
function anonymous () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) anonymous.__proto__ = Parser;
|
||||
anonymous.prototype = Object.create( Parser && Parser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.readInt = function readInt (radix, len) {
|
||||
// Hack: len is only != null for unicode escape sequences,
|
||||
// where numeric separators are not allowed
|
||||
if (len != null) { return Parser.prototype.readInt.call(this, radix, len) }
|
||||
|
||||
var start = this.pos, total = 0, acceptUnderscore = false
|
||||
for (;;) {
|
||||
var code = this.input.charCodeAt(this.pos), val = (void 0)
|
||||
if (code >= 97) { val = code - 97 + 10 } // a
|
||||
else if (code == 95) {
|
||||
if (!acceptUnderscore) { this.raise(this.pos, "Invalid numeric separator") }
|
||||
++this.pos
|
||||
acceptUnderscore = false
|
||||
continue
|
||||
} else if (code >= 65) { val = code - 65 + 10 } // A
|
||||
else if (code >= 48 && code <= 57) { val = code - 48 } // 0-9
|
||||
else { val = Infinity }
|
||||
if (val >= radix) { break }
|
||||
++this.pos
|
||||
total = total * radix + val
|
||||
acceptUnderscore = true
|
||||
}
|
||||
if (this.pos === start) { return null }
|
||||
if (!acceptUnderscore) { this.raise(this.pos - 1, "Invalid numeric separator") }
|
||||
|
||||
return total
|
||||
};
|
||||
|
||||
anonymous.prototype.readNumber = function readNumber (startsWithDot) {
|
||||
var token = Parser.prototype.readNumber.call(this, startsWithDot)
|
||||
var octal = this.end - this.start >= 2 && this.input.charCodeAt(this.start) === 48
|
||||
var stripped = this.getNumberInput(this.start, this.end)
|
||||
if (stripped.length < this.end - this.start) {
|
||||
if (octal) { this.raise(this.start, "Invalid number") }
|
||||
this.value = parseFloat(stripped)
|
||||
}
|
||||
return token
|
||||
};
|
||||
|
||||
// This is used by acorn-bigint
|
||||
anonymous.prototype.getNumberInput = function getNumberInput (start, end) {
|
||||
return this.input.slice(start, end).replace(/_/g, "")
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(Parser))
|
||||
}
|
135
node_modules/acorn-node/lib/private-class-elements/index.js
generated
vendored
Normal file
135
node_modules/acorn-node/lib/private-class-elements/index.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var acorn = require("acorn")
|
||||
if (false) {
|
||||
throw new Error(("acorn-private-class-elements requires acorn@^6.1.0, not " + (acorn.version)))
|
||||
}
|
||||
var tt = acorn.tokTypes
|
||||
var TokenType = acorn.TokenType
|
||||
|
||||
module.exports = function(Parser) {
|
||||
// Only load this plugin once.
|
||||
if (Parser.prototype.parsePrivateName) {
|
||||
return Parser
|
||||
}
|
||||
|
||||
// Make sure `Parser` comes from the same acorn as our `tt`,
|
||||
// otherwise the comparisons fail.
|
||||
var cur = Parser
|
||||
while (cur && cur !== acorn.Parser) {
|
||||
cur = cur.__proto__
|
||||
}
|
||||
if (cur !== acorn.Parser) {
|
||||
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
|
||||
}
|
||||
|
||||
Parser = /*@__PURE__*/(function (Parser) {
|
||||
function Parser_ () {
|
||||
Parser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( Parser ) Parser_.__proto__ = Parser;
|
||||
Parser_.prototype = Object.create( Parser && Parser.prototype );
|
||||
Parser_.prototype.constructor = Parser_;
|
||||
|
||||
Parser_.prototype._branch = function _branch () {
|
||||
this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input)
|
||||
this.__branch.end = this.end
|
||||
this.__branch.pos = this.pos
|
||||
this.__branch.type = this.type
|
||||
this.__branch.value = this.value
|
||||
this.__branch.containsEsc = this.containsEsc
|
||||
return this.__branch
|
||||
};
|
||||
|
||||
Parser_.prototype.parsePrivateClassElementName = function parsePrivateClassElementName (element) {
|
||||
element.computed = false
|
||||
element.key = this.parsePrivateName()
|
||||
if (element.key.name == "constructor") { this.raise(element.key.start, "Classes may not have a private element named constructor") }
|
||||
var accept = {get: "set", set: "get"}[element.kind]
|
||||
var privateBoundNames = this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1]
|
||||
if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
|
||||
this.raise(element.start, "Duplicate private element")
|
||||
}
|
||||
privateBoundNames[element.key.name] = element.kind || true
|
||||
delete this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][element.key.name]
|
||||
return element.key
|
||||
};
|
||||
|
||||
Parser_.prototype.parsePrivateName = function parsePrivateName () {
|
||||
var node = this.startNode()
|
||||
node.name = this.value
|
||||
this.next()
|
||||
this.finishNode(node, "PrivateName")
|
||||
if (this.options.allowReserved == "never") { this.checkUnreserved(node) }
|
||||
return node
|
||||
};
|
||||
|
||||
// Parse # token
|
||||
Parser_.prototype.getTokenFromCode = function getTokenFromCode (code) {
|
||||
if (code === 35) {
|
||||
++this.pos
|
||||
var word = this.readWord1()
|
||||
return this.finishToken(this.privateNameToken, word)
|
||||
}
|
||||
return Parser.prototype.getTokenFromCode.call(this, code)
|
||||
};
|
||||
|
||||
// Manage stacks and check for undeclared private names
|
||||
Parser_.prototype.parseClass = function parseClass (node, isStatement) {
|
||||
this._privateBoundNamesStack = this._privateBoundNamesStack || []
|
||||
var privateBoundNames = Object.create(this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1] || null)
|
||||
this._privateBoundNamesStack.push(privateBoundNames)
|
||||
this._unresolvedPrivateNamesStack = this._unresolvedPrivateNamesStack || []
|
||||
var unresolvedPrivateNames = Object.create(null)
|
||||
this._unresolvedPrivateNamesStack.push(unresolvedPrivateNames)
|
||||
var _return = Parser.prototype.parseClass.call(this, node, isStatement)
|
||||
this._privateBoundNamesStack.pop()
|
||||
this._unresolvedPrivateNamesStack.pop()
|
||||
if (!this._unresolvedPrivateNamesStack.length) {
|
||||
var names = Object.keys(unresolvedPrivateNames)
|
||||
if (names.length) {
|
||||
names.sort(function (n1, n2) { return unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]; })
|
||||
this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name")
|
||||
}
|
||||
} else { Object.assign(this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1], unresolvedPrivateNames) }
|
||||
return _return
|
||||
};
|
||||
|
||||
// Parse private element access
|
||||
Parser_.prototype.parseSubscript = function parseSubscript (base, startPos, startLoc, noCalls, maybeAsyncArrow) {
|
||||
if (!this.eat(tt.dot)) {
|
||||
return Parser.prototype.parseSubscript.call(this, base, startPos, startLoc, noCalls, maybeAsyncArrow)
|
||||
}
|
||||
var node = this.startNodeAt(startPos, startLoc)
|
||||
node.object = base
|
||||
node.computed = false
|
||||
if (this.type == this.privateNameToken) {
|
||||
node.property = this.parsePrivateName()
|
||||
if (!this._privateBoundNamesStack.length || !this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1][node.property.name]) {
|
||||
this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][node.property.name] = node.property.start
|
||||
}
|
||||
} else {
|
||||
node.property = this.parseIdent(true)
|
||||
}
|
||||
return this.finishNode(node, "MemberExpression")
|
||||
};
|
||||
|
||||
// Prohibit delete of private class elements
|
||||
Parser_.prototype.parseMaybeUnary = function parseMaybeUnary (refDestructuringErrors, sawUnary) {
|
||||
var _return = Parser.prototype.parseMaybeUnary.call(this, refDestructuringErrors, sawUnary)
|
||||
if (_return.operator == "delete") {
|
||||
if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateName") {
|
||||
this.raise(_return.start, "Private elements may not be deleted")
|
||||
}
|
||||
}
|
||||
return _return
|
||||
};
|
||||
|
||||
return Parser_;
|
||||
}(Parser))
|
||||
Parser.prototype.privateNameToken = new TokenType("privateName")
|
||||
return Parser
|
||||
}
|
139
node_modules/acorn-node/lib/static-class-features/index.js
generated
vendored
Normal file
139
node_modules/acorn-node/lib/static-class-features/index.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
/* Generated by `npm run build`, do not edit! */
|
||||
|
||||
"use strict"
|
||||
|
||||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
var acorn = require("acorn")
|
||||
var tt = acorn.tokTypes
|
||||
|
||||
function maybeParseFieldValue(field) {
|
||||
if (this.eat(tt.eq)) {
|
||||
var oldInFieldValue = this._inStaticFieldValue
|
||||
this._inStaticFieldValue = true
|
||||
field.value = this.parseExpression()
|
||||
this._inStaticFieldValue = oldInFieldValue
|
||||
} else { field.value = null }
|
||||
}
|
||||
|
||||
var privateClassElements = require("../private-class-elements")
|
||||
|
||||
module.exports = function(Parser) {
|
||||
var ExtendedParser = privateClassElements(Parser)
|
||||
|
||||
return /*@__PURE__*/(function (ExtendedParser) {
|
||||
function anonymous () {
|
||||
ExtendedParser.apply(this, arguments);
|
||||
}
|
||||
|
||||
if ( ExtendedParser ) anonymous.__proto__ = ExtendedParser;
|
||||
anonymous.prototype = Object.create( ExtendedParser && ExtendedParser.prototype );
|
||||
anonymous.prototype.constructor = anonymous;
|
||||
|
||||
anonymous.prototype.parseClassElement = function parseClassElement (_constructorAllowsSuper) {
|
||||
var this$1 = this;
|
||||
|
||||
if (this.eat(tt.semi)) { return null }
|
||||
|
||||
var node = this.startNode()
|
||||
|
||||
var tryContextual = function (k, noLineBreak) {
|
||||
if (typeof noLineBreak == "undefined") { noLineBreak = false }
|
||||
var start = this$1.start, startLoc = this$1.startLoc
|
||||
if (!this$1.eatContextual(k)) { return false }
|
||||
if (this$1.type !== tt.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
|
||||
if (node.key) { this$1.unexpected() }
|
||||
node.computed = false
|
||||
node.key = this$1.startNodeAt(start, startLoc)
|
||||
node.key.name = k
|
||||
this$1.finishNode(node.key, "Identifier")
|
||||
return false
|
||||
}
|
||||
|
||||
node.static = tryContextual("static")
|
||||
if (!node.static) { return ExtendedParser.prototype.parseClassElement.apply(this, arguments) }
|
||||
|
||||
var isGenerator = this.eat(tt.star)
|
||||
var isAsync = false
|
||||
if (!isGenerator) {
|
||||
// Special-case for `async`, since `parseClassMember` currently looks
|
||||
// for `(` to determine whether `async` is a method name
|
||||
if (this.options.ecmaVersion >= 8 && this.isContextual("async")) {
|
||||
skipWhiteSpace.lastIndex = this.pos
|
||||
var skip = skipWhiteSpace.exec(this.input)
|
||||
var next = this.input.charAt(this.pos + skip[0].length)
|
||||
if (next === ";" || next === "=") {
|
||||
node.key = this.parseIdent(true)
|
||||
node.computed = false
|
||||
maybeParseFieldValue.call(this, node)
|
||||
this.finishNode(node, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return node
|
||||
} else if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
|
||||
isAsync = true
|
||||
isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)
|
||||
}
|
||||
} else if (tryContextual("get")) {
|
||||
node.kind = "get"
|
||||
} else if (tryContextual("set")) {
|
||||
node.kind = "set"
|
||||
}
|
||||
}
|
||||
if (this.type === this.privateNameToken) {
|
||||
this.parsePrivateClassElementName(node)
|
||||
if (this.type !== tt.parenL) {
|
||||
if (node.key.name === "prototype") {
|
||||
this.raise(node.key.start, "Classes may not have a private static property named prototype")
|
||||
}
|
||||
maybeParseFieldValue.call(this, node)
|
||||
this.finishNode(node, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return node
|
||||
}
|
||||
} else if (!node.key) {
|
||||
this.parsePropertyName(node)
|
||||
if ((node.key.name || node.key.value) === "prototype" && !node.computed) {
|
||||
this.raise(node.key.start, "Classes may not have a static property named prototype")
|
||||
}
|
||||
}
|
||||
if (!node.kind) { node.kind = "method" }
|
||||
this.parseClassMethod(node, isGenerator, isAsync)
|
||||
if (!node.kind && (node.key.name || node.key.value) === "constructor" && !node.computed) {
|
||||
this.raise(node.key.start, "Classes may not have a static field named constructor")
|
||||
}
|
||||
if (node.kind === "get" && node.value.params.length !== 0) {
|
||||
this.raiseRecoverable(node.value.start, "getter should have no params")
|
||||
}
|
||||
if (node.kind === "set" && node.value.params.length !== 1) {
|
||||
this.raiseRecoverable(node.value.start, "setter should have exactly one param")
|
||||
}
|
||||
if (node.kind === "set" && node.value.params[0].type === "RestElement") {
|
||||
this.raiseRecoverable(node.value.params[0].start, "Setter cannot use rest params")
|
||||
}
|
||||
|
||||
return node
|
||||
|
||||
};
|
||||
|
||||
// Parse public static fields
|
||||
anonymous.prototype.parseClassMethod = function parseClassMethod (method, isGenerator, isAsync, _allowsDirectSuper) {
|
||||
if (isGenerator || isAsync || method.kind != "method" || !method.static || this.options.ecmaVersion < 8 || this.type == tt.parenL) {
|
||||
return ExtendedParser.prototype.parseClassMethod.apply(this, arguments)
|
||||
}
|
||||
maybeParseFieldValue.call(this, method)
|
||||
delete method.kind
|
||||
method = this.finishNode(method, "FieldDefinition")
|
||||
this.semicolon()
|
||||
return method
|
||||
};
|
||||
|
||||
// Prohibit arguments in class field initializers
|
||||
anonymous.prototype.parseIdent = function parseIdent (liberal, isBinding) {
|
||||
var ident = ExtendedParser.prototype.parseIdent.call(this, liberal, isBinding)
|
||||
if (this._inStaticFieldValue && ident.name == "arguments") { this.raise(ident.start, "A static class field initializer may not contain arguments") }
|
||||
return ident
|
||||
};
|
||||
|
||||
return anonymous;
|
||||
}(ExtendedParser))
|
||||
}
|
Reference in New Issue
Block a user