This commit is contained in:
sasha-astiadi
2024-05-03 06:39:20 +02:00
parent 6bf49421d6
commit 324d5960af
1737 changed files with 254531 additions and 0 deletions

BIN
node_modules/acorn-node/.DS_Store generated vendored Normal file

Binary file not shown.

22
node_modules/acorn-node/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,22 @@
language: node_js
node_js:
- '12'
- '11'
- '10'
- '9'
- '8'
- '6'
- '4'
- '0.12'
- '0.10'
- '0.8'
- '0.6'
before_install:
- 'nvm install-latest-npm'
install:
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
sudo: false
matrix:
fast_finish: true
allow_failures:
- node_js: "0.6"

94
node_modules/acorn-node/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,94 @@
# acorn-node change log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 1.8.2
* Revert a breaking change in import.meta parsing.
## 1.8.1
* Fix crash in compiled private-class-elements code.
## 1.8.0
* Upgrade acorn to v7.
For backwards compatibility, `acorn-node` still uses the `Import` node type for dynamic imports, _NOT_ `ImportExpression` like acorn v7 and estree.
* Add numeric separator support:
```js
var a = 10_000_000_000_000_000_000_000_000n;
```
## 1.7.0
* Add class instance fields support:
```js
class X {
pub = 1;
#priv = 2;
}
```
* Add class static fields support:
```js
class X {
static pub = 1;
static #priv = 2;
}
```
* Add `export * as ns` support when `sourceType` is 'module':
```js
export * as ns from './ns.mjs';
```
## 1.6.2
* Allow dynamic `import()` in scripts.
* Update minimum dependency versions, fixing a peerDependency warning.
* Add Node 10 and 11 to CI.
## 1.6.1
* Update acorn-dynamic-import to v4.
## 1.6.0
* Upgrade acorn to v6.
* Add bigint support.
## 1.5.2
* Upgrade acorn to support optional catch binding in the AST walker.
## 1.5.1
* Fix tests on Node <= 0.12.
## 1.5.0
* Add tests for async iteration, optional catch binding, import.meta,
dynamic import, bigint (currently unsupported).
* Add import.meta support. (`sourceType: 'module'` only)
* Add dynamic import support. (`sourceType: 'module'` only)
* Fix optional catch binding support in the walker.
## 1.4.0
* Upgrade acorn to 5.6, which supports optional catch bindings and other
new syntax features.
* Set ecmaVersion to 2019 to opt in to optional catch bindings etc.
## 1.3.0
* Upgrade acorn to 5.4, which supports object spread and async iteration.
* Remove acorn5-object-spread plugin.
## 1.2.0
* Expose `acorn/dist/walk` as `acorn-node/walk`.
## 1.1.0
* Enable `allowHashBang` and `allowReturnOutsideFunction` by default.
## 1.0.0
* Initial release.

95
node_modules/acorn-node/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,95 @@
# [Apache License 2.0](https://spdx.org/licenses/Apache-2.0)
Copyright 2018 Renée Kooi <renee@kooi.me>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
> http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
## acorn-bigint
The code in the `lib/bigint` folder is compiled from code licensed as MIT:
> Copyright (C) 2017-2018 by Adrian Heine
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
Find the source code at https://github.com/acornjs/acorn-bigint.
## acorn-import-meta
The code in the `lib/import-meta` folder is compiled from code licensed as MIT:
> Copyright (C) 2017-2018 by Adrian Heine
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
Find the source code at https://github.com/acornjs/acorn-import-meta.
## acorn-dynamic-import
The code in the `lib/dynamic-import` folder is licensed as MIT:
> MIT License
>
> Copyright (c) 2016 Jordan Gensler
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
Find the source code at https://github.com/kesne/acorn-dynamic-import.

65
node_modules/acorn-node/README.md generated vendored Normal file
View File

@@ -0,0 +1,65 @@
# acorn-node
[Acorn](https://github.com/acornjs/acorn) preloaded with plugins for syntax parity with recent Node versions.
It also includes versions of the plugins compiled with [Bublé](https://github.com/rich-harris/buble), so they can be run on old Node versions (0.6 and up).
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]
[npm-image]: https://img.shields.io/npm/v/acorn-node.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/acorn-node
[travis-image]: https://img.shields.io/travis/browserify/acorn-node/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/browserify/acorn-node
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard
## Install
```
npm install acorn-node
```
## Usage
```js
var acorn = require('acorn-node')
```
The API is the same as [acorn](https://github.com/acornjs/acorn), but the following syntax features are enabled by default:
- Bigint syntax `10n`
- Numeric separators syntax `10_000`
- Public and private class instance fields
- Public and private class static fields
- Dynamic `import()`
- The `import.meta` property
- `export * as ns from` syntax
And the following options have different defaults from acorn, to match Node modules:
- `ecmaVersion: 2019`
- `allowHashBang: true`
- `allowReturnOutsideFunction: true`
```js
var walk = require('acorn-node/walk')
```
The Acorn syntax tree walker. Comes preconfigured for the syntax plugins if necessary.
See the [acorn documentation](https://github.com/acornjs/acorn#distwalkjs) for details.
## License
The files in the repo root and the ./test folder are licensed as [Apache-2.0](LICENSE.md).
The files in lib/ are generated from other packages:
- lib/bigint: [acorn-bigint](https://github.com/acornjs/acorn-bigint]), MIT
- lib/class-private-elements: [acorn-class-private-elements](https://github.com/acornjs/acorn-class-private-elements), MIT
- lib/dynamic-import: [acorn-dynamic-import](https://github.com/acornjs/acorn-dynamic-import), MIT
- lib/export-ns-from: [acorn-export-ns-from](https://github.com/acornjs/acorn-export-ns-from), MIT
- lib/import-meta: [acorn-import-meta](https://github.com/acornjs/acorn-import-meta), MIT
- lib/numeric-separator: [acorn-numeric-separator](https://github.com/acornjs/acorn-numeric-separator]), MIT
- lib/static-class-features: [acorn-static-class-features](https://github.com/acornjs/acorn-static-class-features), MIT

36
node_modules/acorn-node/build.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
var fs = require('fs')
var path = require('path')
var mkdirp = require('mkdirp')
var buble = require('buble')
var HEADER = '/* Generated by `npm run build`, do not edit! */\n\n'
function compile (name, output, fix) {
console.log(name, '→', output)
mkdirp.sync(path.dirname(path.join(__dirname, output)))
var source = fs.readFileSync(require.resolve(name), 'utf8')
if (fix) source = fix(source)
var result = buble.transform(source, {
transforms: {
dangerousForOf: true
}
})
fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
}
function privateClassElements (str) {
return str.replace('acorn-private-class-elements', '../private-class-elements')
}
compile('acorn-bigint', './lib/bigint/index.js')
compile('acorn-numeric-separator', './lib/numeric-separator/index.js')
compile('acorn-dynamic-import', './lib/dynamic-import/index.js')
compile('acorn-import-meta', './lib/import-meta/index.js')
compile('acorn-export-ns-from', './lib/export-ns-from/index.js')
compile('acorn-class-fields', './lib/class-fields/index.js', privateClassElements)
compile('acorn-static-class-features', './lib/static-class-features/index.js', privateClassElements)
compile('acorn-private-class-elements', './lib/private-class-elements/index.js', function (str) {
return str.replace('class extends Parser', 'class Parser_ extends Parser')
// it also works with v7
.replace('if (acorn.version.indexOf("6.") != 0 || acorn.version.indexOf("6.0.") == 0) {', 'if (false) {')
})

38
node_modules/acorn-node/index.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
var acorn = require('acorn')
var xtend = require('xtend')
var CJSParser = acorn.Parser
.extend(require('./lib/bigint'))
.extend(require('./lib/class-fields'))
.extend(require('./lib/static-class-features'))
.extend(require('./lib/numeric-separator'))
.extend(require('./lib/dynamic-import').default)
var ESModulesParser = CJSParser
.extend(require('./lib/export-ns-from'))
.extend(require('./lib/import-meta'))
function mapOptions (opts) {
if (!opts) opts = {}
return xtend({
ecmaVersion: 2020,
allowHashBang: true,
allowReturnOutsideFunction: true
}, opts)
}
function getParser (opts) {
if (!opts) opts = {}
return opts.sourceType === 'module' ? ESModulesParser : CJSParser
}
module.exports = exports = xtend(acorn, {
parse: function parse (src, opts) {
return getParser(opts).parse(src, mapOptions(opts))
},
parseExpressionAt: function parseExpressionAt (src, offset, opts) {
return getParser(opts).parseExpressionAt(src, offset, mapOptions(opts))
},
tokenizer: function tokenizer (src, opts) {
return getParser(opts).tokenizer(src, mapOptions(opts))
}
})

71
node_modules/acorn-node/lib/bigint/index.js generated vendored Normal file
View 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
View 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
View 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
View 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
View 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
View 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))
}

View 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
}

View 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))
}

51
node_modules/acorn-node/package.json generated vendored Normal file
View File

@@ -0,0 +1,51 @@
{
"name": "acorn-node",
"description": "the acorn javascript parser, preloaded with plugins for syntax parity with recent node versions",
"version": "1.8.2",
"author": "Renée Kooi <renee@kooi.me>",
"bugs": {
"url": "https://github.com/browserify/acorn-node/issues"
},
"dependencies": {
"acorn": "^7.0.0",
"acorn-walk": "^7.0.0",
"xtend": "^4.0.2"
},
"devDependencies": {
"acorn-bigint": "^0.4.0",
"acorn-class-fields": "^0.3.1",
"acorn-dynamic-import": "^4.0.0",
"acorn-export-ns-from": "^0.1.0",
"acorn-import-meta": "^0.3.0",
"acorn-numeric-separator": "^0.3.0",
"acorn-private-class-elements": "^0.1.1",
"acorn-static-class-features": "^0.2.0",
"buble": "^0.19.8",
"mkdirp": "^0.5.1",
"standard": "^13.1.0",
"tape": "^4.11.0"
},
"homepage": "https://github.com/browserify/acorn-node",
"keywords": [
"acorn",
"browserify",
"javascript",
"parser"
],
"license": "Apache-2.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/browserify/acorn-node.git"
},
"scripts": {
"test": "standard && node test/index.js",
"prepublishOnly": "npm run build",
"build": "node build.js"
},
"standard": {
"ignore": [
"lib/*/*.js"
]
}
}

154
node_modules/acorn-node/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
var test = require('tape')
var acorn = require('../')
var walk = require('../walk')
var baseAcorn = require('acorn')
test('parses object spread syntax', function (t) {
var ast = acorn.parse('var a = { ...b }')
t.equal(ast.body[0].declarations[0].init.type, 'ObjectExpression')
t.equal(ast.body[0].declarations[0].init.properties[0].type, 'SpreadElement')
ast = acorn.parse('function a ({ ...b }) {}')
t.equal(ast.body[0].params[0].type, 'ObjectPattern')
t.equal(ast.body[0].params[0].properties[0].type, 'RestElement')
t.end()
})
test('does not change main acorn module', function (t) {
t.throws(function () {
baseAcorn.parse('var a = 10n')
})
t.end()
})
test('tokenizes object spread syntax', function (t) {
var tokenizer = acorn.tokenizer('var a = { ...b }')
t.doesNotThrow(function (t) {
while (tokenizer.getToken().type !== acorn.tokTypes.eof) {}
})
t.end()
})
test('allows hashbangs by default', function (t) {
t.doesNotThrow(function () {
acorn.parse('#!/usr/bin/env node\nconsole.log("ok")')
})
t.end()
})
test('allows top level return by default', function (t) {
t.doesNotThrow(function () {
acorn.parse('console.log("ok"); return; console.log("not ok")')
})
t.end()
})
test('supports async generators', function (t) {
t.doesNotThrow(function () {
acorn.parse('async function* a () { await x; yield 1 }')
})
t.end()
})
test('supports async iteration', function (t) {
t.doesNotThrow(function () {
acorn.parse('async function l (y) { for await (const x of y) {} }')
})
t.end()
})
test('supports optional catch', function (t) {
t.doesNotThrow(function () {
acorn.parse('try { throw null } catch {}')
})
t.end()
})
test('supports bigint', function (t) {
t.doesNotThrow(function () {
acorn.parse('50n ** 50n')
})
t.end()
})
test('supports numeric separators', function (t) {
t.doesNotThrow(function () {
acorn.parse('50_000_000n ** 1n')
})
t.end()
})
test('supports import.meta with sourceType: module', function (t) {
t.doesNotThrow(function () {
acorn.parse('console.log(import.meta.url)', { sourceType: 'module' })
})
t.end()
})
test('supports dynamic import() with sourceType: module', function (t) {
t.doesNotThrow(function () {
acorn.parse('import("./whatever.mjs")', { sourceType: 'module' })
})
t.end()
})
test('supports dynamic import() with sourceType: script', function (t) {
t.doesNotThrow(function () {
acorn.parse('import("./whatever.mjs")', { sourceType: 'script' })
})
t.end()
})
test('supports class instance properties', function (t) {
t.doesNotThrow(function () {
acorn.parse('class X { x = y }', { sourceType: 'script' })
})
t.end()
})
test('supports private class instance properties', function (t) {
t.doesNotThrow(function () {
acorn.parse('class X { #x = y }', { sourceType: 'script' })
})
t.end()
})
test('supports class static properties', function (t) {
t.doesNotThrow(function () {
acorn.parse('class X { static x = y }', { sourceType: 'script' })
})
t.end()
})
test('supports private class static properties', function (t) {
t.doesNotThrow(function () {
acorn.parse('class X { static #x = y }', { sourceType: 'script' })
})
t.end()
})
test('supports namespace export syntax with sourceType: module', function (t) {
t.doesNotThrow(function () {
acorn.parse('export * as x from "./x.mjs";', { sourceType: 'module' })
})
t.end()
})
test('walk supports plugin syntax', function (t) {
var ast = acorn.parse(
'async function* a() { try { await import(xyz); } catch { for await (x of null) {} } yield import.meta.url }',
{ sourceType: 'module' }
)
t.plan(2)
walk.simple(ast, {
Import: function () {
t.pass('import()')
},
MetaProperty: function () {
t.pass('import.meta')
}
})
t.end()
})

57
node_modules/acorn-node/walk.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
var xtend = require('xtend')
var walk = require('acorn-walk')
var base = xtend(walk.base)
base.Import = function () {}
function simple (node, visitors, baseVisitor, state, override) {
return walk.simple(node, visitors, baseVisitor || base, state, override)
}
function ancestor (node, visitors, baseVisitor, state) {
return walk.ancestor(node, visitors, baseVisitor || base, state)
}
function recursive (node, state, funcs, baseVisitor, override) {
return walk.recursive(node, state, funcs, baseVisitor || base, override)
}
function full (node, callback, baseVisitor, state, override) {
return walk.full(node, callback, baseVisitor || base, state, override)
}
function fullAncestor (node, callback, baseVisitor, state) {
return walk.fullAncestor(node, callback, baseVisitor || base, state)
}
function findNodeAt (node, start, end, test, baseVisitor, state) {
return walk.findNodeAt(node, start, end, test, baseVisitor || base, state)
}
function findNodeAround (node, pos, test, baseVisitor, state) {
return walk.findNodeAround(node, pos, test, baseVisitor || base, state)
}
function findNodeAfter (node, pos, test, baseVisitor, state) {
return walk.findNodeAfter(node, pos, test, baseVisitor || base, state)
}
function findNodeBefore (node, pos, test, baseVisitor, state) {
return walk.findNodeBefore(node, pos, test, baseVisitor || base, state)
}
function make (funcs, baseVisitor) {
return walk.make(funcs, baseVisitor || base)
}
exports.simple = simple
exports.ancestor = ancestor
exports.recursive = recursive
exports.full = full
exports.fullAncestor = fullAncestor
exports.findNodeAt = findNodeAt
exports.findNodeAround = findNodeAround
exports.findNodeAfter = findNodeAfter
exports.findNodeBefore = findNodeBefore
exports.make = make
exports.base = base