deps: add acorn stage-3 plugins
This adds bigint, class-fields, numeric-separators, static-class features, private class methods and fields as dependency. That way it's possible to use these in combination with acorn to parse these language features. This also removes a couple of files that were not necessary for Node.js to reduce the code base. PR-URL: https://github.com/nodejs/node/pull/27400 Refs: https://github.com/nodejs/node/issues/27391 Refs: https://github.com/nodejs/node/issues/25835 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
98e9de7db9
commit
72c6ea2683
23
LICENSE
23
LICENSE
@ -74,6 +74,29 @@ The externally maintained libraries used by Node.js are:
|
||||
THE SOFTWARE.
|
||||
"""
|
||||
|
||||
- Acorn plugins, located at deps/acorn-plugins, is licensed as follows:
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
- c-ares, located at deps/cares, is licensed as follows:
|
||||
"""
|
||||
Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS
|
||||
|
21
deps/acorn-plugins/acorn-bigint/CHANGELOG.md
vendored
Normal file
21
deps/acorn-plugins/acorn-bigint/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
## 0.4.0 (2019-04-04)
|
||||
|
||||
* Make compatible with acorn-numeric-separator
|
||||
|
||||
## 0.3.1 (2018-10-06)
|
||||
|
||||
* Fix creation of BigInt values everywhere (Thanks, Gus Caplan!)
|
||||
|
||||
## 0.3.0 (2018-09-14)
|
||||
|
||||
* Update to new acorn 6 interface
|
||||
* Actually support creating BigInt values in AST in Chrome
|
||||
* Change license to MIT
|
||||
|
||||
## 0.2.0 (2017-12-20)
|
||||
|
||||
* Emit BigInt values in AST if supported by runtime engine
|
||||
|
||||
## 0.1.0 (2017-12-19)
|
||||
|
||||
Initial release
|
19
deps/acorn-plugins/acorn-bigint/LICENSE
vendored
Normal file
19
deps/acorn-plugins/acorn-bigint/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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.
|
21
deps/acorn-plugins/acorn-bigint/README.md
vendored
Normal file
21
deps/acorn-plugins/acorn-bigint/README.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# BigInt support for Acorn
|
||||
|
||||
[](https://www.npmjs.org/package/acorn-bigint)
|
||||
|
||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It implements support for arbitrary precision integers as defined in the stage 3 proposal [BigInt: Arbitrary precision integers in JavaScript](https://github.com/tc39/proposal-bigint). The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/blob/132be9b9ec376adbc082dd5f6ba78aefd7a1a864/experimental/bigint.md).
|
||||
|
||||
## Usage
|
||||
|
||||
This module provides a plugin that can be used to extend the Acorn `Parser` class:
|
||||
|
||||
```javascript
|
||||
const {Parser} = require('acorn');
|
||||
const bigInt = require('acorn-bigint');
|
||||
Parser.extend(bigInt).parse('100n');
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under an [MIT License](./LICENSE).
|
59
deps/acorn-plugins/acorn-bigint/index.js
vendored
Normal file
59
deps/acorn-plugins/acorn-bigint/index.js
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict"
|
||||
|
||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn')
|
||||
const tt = acorn.tokTypes
|
||||
const isIdentifierStart = acorn.isIdentifierStart
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return class extends Parser {
|
||||
parseLiteral(value) {
|
||||
const node = super.parseLiteral(value)
|
||||
if (node.raw.charCodeAt(node.raw.length - 1) == 110) node.bigint = this.getNumberInput(node.start, node.end)
|
||||
return node
|
||||
}
|
||||
|
||||
readRadixNumber(radix) {
|
||||
let start = this.pos
|
||||
this.pos += 2 // 0x
|
||||
let val = this.readInt(radix)
|
||||
if (val === null) this.raise(this.start + 2, `Expected number in radix ${radix}`)
|
||||
if (this.input.charCodeAt(this.pos) == 110) {
|
||||
let 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)
|
||||
}
|
||||
|
||||
readNumber(startsWithDot) {
|
||||
let start = this.pos
|
||||
|
||||
// Not an int
|
||||
if (startsWithDot) return super.readNumber(startsWithDot)
|
||||
|
||||
// Legacy octal
|
||||
if (this.input.charCodeAt(start) === 48 && this.input.charCodeAt(start + 1) !== 110) {
|
||||
return super.readNumber(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 super.readNumber(startsWithDot)
|
||||
}
|
||||
|
||||
let str = this.getNumberInput(start, this.pos)
|
||||
let val = typeof BigInt !== "undefined" ? BigInt(str) : null
|
||||
++this.pos
|
||||
return this.finishToken(tt.num, val)
|
||||
}
|
||||
|
||||
// This is basically a hook for acorn-numeric-separator
|
||||
getNumberInput(start, end) {
|
||||
if (super.getNumberInput) return super.getNumberInput(start, end)
|
||||
return this.input.slice(start, end)
|
||||
}
|
||||
}
|
||||
}
|
65
deps/acorn-plugins/acorn-bigint/package.json
vendored
Normal file
65
deps/acorn-plugins/acorn-bigint/package.json
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "acorn-bigint",
|
||||
"_id": "acorn-bigint@0.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-W9iaqWzqFo7ZBLmI9dMjHYGrN0Nm/ZgToqhvd3RELJux7RsX6k1/80h+bD9TtTpeKky/kYNbr3+vHWqI3hdyfA==",
|
||||
"_location": "/acorn-bigint",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "acorn-bigint",
|
||||
"name": "acorn-bigint",
|
||||
"escapedName": "acorn-bigint",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn-bigint/-/acorn-bigint-0.4.0.tgz",
|
||||
"_shasum": "af3245ed8a7c3747387fca4680ae1960f617c4cd",
|
||||
"_spec": "acorn-bigint",
|
||||
"_where": "/home/ruben/repos/node/node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn-bigint/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"email": "mail@adrianheine.de"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Support for BigInt in acorn",
|
||||
"devDependencies": {
|
||||
"acorn": "^6.1.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-node": "^8.0.1",
|
||||
"mocha": "^6.0.2",
|
||||
"test262": "git+https://github.com/tc39/test262.git#611919174ffe060503691a0c7e3eb2a65b646124",
|
||||
"test262-parser-runner": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8.2"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn-bigint",
|
||||
"license": "MIT",
|
||||
"name": "acorn-bigint",
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn-bigint.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint -c .eslintrc.json .",
|
||||
"test": "mocha",
|
||||
"test:test262": "node run_test262.js"
|
||||
},
|
||||
"version": "0.4.0"
|
||||
}
|
28
deps/acorn-plugins/acorn-class-fields/CHANGELOG.md
vendored
Normal file
28
deps/acorn-plugins/acorn-class-fields/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
## 0.3.1 (2019-02-09)
|
||||
|
||||
* Restore compatibility with acorn-private-methods
|
||||
|
||||
## 0.3.0 (2019-02-09)
|
||||
|
||||
* Require acorn >= 6.1.0
|
||||
|
||||
## 0.2.1 (2018-11-06)
|
||||
|
||||
* Adapt to changes in acorn 6.0.3
|
||||
|
||||
## 0.2.0 (2018-09-14)
|
||||
|
||||
* Update to new acorn 6 interface
|
||||
* Change license to MIT
|
||||
|
||||
## 0.1.2 (2018-01-26)
|
||||
|
||||
* Don't accept whitespace between hash and private name
|
||||
|
||||
## 0.1.1 (2018-01-17)
|
||||
|
||||
* Correctly parse all fields named `async`
|
||||
|
||||
## 0.1.0 (2018-01-13)
|
||||
|
||||
Initial release
|
19
deps/acorn-plugins/acorn-class-fields/LICENSE
vendored
Normal file
19
deps/acorn-plugins/acorn-class-fields/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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.
|
21
deps/acorn-plugins/acorn-class-fields/README.md
vendored
Normal file
21
deps/acorn-plugins/acorn-class-fields/README.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Class fields support for Acorn
|
||||
|
||||
[](https://www.npmjs.org/package/acorn-class-fields)
|
||||
|
||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It implements support for class fields as defined in the stage 3 proposal [Class field declarations for JavaScript](https://github.com/tc39/proposal-class-fields). The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/pull/180).
|
||||
|
||||
## Usage
|
||||
|
||||
This module provides a plugin that can be used to extend the Acorn `Parser` class:
|
||||
|
||||
```javascript
|
||||
const {Parser} = require('acorn');
|
||||
const classFields = require('acorn-class-fields');
|
||||
Parser.extend(classFields).parse('class X { x = 0 }');
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under an [MIT License](./LICENSE).
|
59
deps/acorn-plugins/acorn-class-fields/index.js
vendored
Normal file
59
deps/acorn-plugins/acorn-class-fields/index.js
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict"
|
||||
|
||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn')
|
||||
const tt = acorn.tokTypes
|
||||
const privateClassElements = require('internal/deps/acorn-plugins/acorn-private-class-elements/index')
|
||||
|
||||
function maybeParseFieldValue(field) {
|
||||
if (this.eat(tt.eq)) {
|
||||
const 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 class extends Parser {
|
||||
// Parse fields
|
||||
parseClassElement(_constructorAllowsSuper) {
|
||||
if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type == this.privateNameToken || this.type == tt.bracketL || this.type == tt.string)) {
|
||||
const branch = this._branch()
|
||||
if (branch.type == tt.bracketL) {
|
||||
let 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) {
|
||||
const 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 super.parseClassElement.apply(this, arguments)
|
||||
}
|
||||
|
||||
// Prohibit arguments in class field initializers
|
||||
parseIdent(liberal, isBinding) {
|
||||
const ident = super.parseIdent(liberal, isBinding)
|
||||
if (this._inFieldValue && ident.name == "arguments") this.raise(ident.start, "A class field initializer may not contain arguments")
|
||||
return ident
|
||||
}
|
||||
}
|
||||
}
|
68
deps/acorn-plugins/acorn-class-fields/package.json
vendored
Normal file
68
deps/acorn-plugins/acorn-class-fields/package.json
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "acorn-class-fields",
|
||||
"_id": "acorn-class-fields@0.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-X/8hSJuregAnrvfV1Y80VJNfeJx1uhw7yskOwvL631ygYeCGVLPumCnnPDHYZ8acV3ytHhg53K171H3tAemgiw==",
|
||||
"_location": "/acorn-class-fields",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "acorn-class-fields",
|
||||
"name": "acorn-class-fields",
|
||||
"escapedName": "acorn-class-fields",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn-class-fields/-/acorn-class-fields-0.3.1.tgz",
|
||||
"_shasum": "032ce47a9688a71d4713ee366fadcb7fefaea9e0",
|
||||
"_spec": "acorn-class-fields",
|
||||
"_where": "/home/ruben/repos/node/node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn-class-fields/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"email": "mail@adrianheine.de"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"acorn-private-class-elements": "^0.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Support for class fields in acorn",
|
||||
"devDependencies": {
|
||||
"acorn": "^6.1.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-plugin-node": "^8.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d",
|
||||
"test262-parser-runner": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8.2"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn-class-fields",
|
||||
"license": "MIT",
|
||||
"name": "acorn-class-fields",
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn-class-fields.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint -c .eslintrc.json .",
|
||||
"test": "mocha",
|
||||
"test:test262": "node run_test262.js"
|
||||
},
|
||||
"version": "0.3.1"
|
||||
}
|
16
deps/acorn-plugins/acorn-numeric-separator/CHANGELOG.md
vendored
Normal file
16
deps/acorn-plugins/acorn-numeric-separator/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
## 0.3.0 (2019-04-04)
|
||||
|
||||
* Make compatible with acorn-bigint
|
||||
|
||||
## 0.2.0 (2018-09-14)
|
||||
|
||||
* Update to new acorn 6 interface
|
||||
* Change license to MIT
|
||||
|
||||
## 0.1.1 (2018-01-16)
|
||||
|
||||
* Don't bail on empty integers as in `1.`
|
||||
|
||||
## 0.1.0 (2017-12-19)
|
||||
|
||||
Initial release
|
19
deps/acorn-plugins/acorn-numeric-separator/LICENSE
vendored
Normal file
19
deps/acorn-plugins/acorn-numeric-separator/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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.
|
21
deps/acorn-plugins/acorn-numeric-separator/README.md
vendored
Normal file
21
deps/acorn-plugins/acorn-numeric-separator/README.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Numeric separator support for Acorn
|
||||
|
||||
[](https://www.npmjs.org/package/acorn-numeric-separator)
|
||||
|
||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It implements support for numeric separators as defined in the stage 3 proposal [Numeric Separators](https://github.com/tc39/proposal-numeric-separator).
|
||||
|
||||
## Usage
|
||||
|
||||
This module provides a plugin that can be used to extend the Acorn `Parser` class to parse numeric separators:
|
||||
|
||||
```javascript
|
||||
var acorn = require('acorn');
|
||||
var numericSeparator = require('acorn-numeric-separator');
|
||||
acorn.Parser.extend(numericSeparator).parse('100_000');
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under an [MIT License](./LICENSE).
|
49
deps/acorn-plugins/acorn-numeric-separator/index.js
vendored
Normal file
49
deps/acorn-plugins/acorn-numeric-separator/index.js
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
"use strict"
|
||||
|
||||
module.exports = function(Parser) {
|
||||
return class extends Parser {
|
||||
readInt(radix, len) {
|
||||
// Hack: len is only != null for unicode escape sequences,
|
||||
// where numeric separators are not allowed
|
||||
if (len != null) return super.readInt(radix, len)
|
||||
|
||||
let start = this.pos, total = 0, acceptUnderscore = false
|
||||
for (;;) {
|
||||
let code = this.input.charCodeAt(this.pos), val
|
||||
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
|
||||
}
|
||||
|
||||
readNumber(startsWithDot) {
|
||||
const token = super.readNumber(startsWithDot)
|
||||
let octal = this.end - this.start >= 2 && this.input.charCodeAt(this.start) === 48
|
||||
const 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
|
||||
getNumberInput(start, end) {
|
||||
return this.input.slice(start, end).replace(/_/g, "")
|
||||
}
|
||||
}
|
||||
}
|
65
deps/acorn-plugins/acorn-numeric-separator/package.json
vendored
Normal file
65
deps/acorn-plugins/acorn-numeric-separator/package.json
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "acorn-numeric-separator",
|
||||
"_id": "acorn-numeric-separator@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-g9FikQZHwG/P1Xs+dDzecqagmGBbU4b8OF4UbDQK8Wr8apwuFGG1c7KiaFxC4ClYU8D7zNl60vzqOCUuhKM3kA==",
|
||||
"_location": "/acorn-numeric-separator",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "acorn-numeric-separator",
|
||||
"name": "acorn-numeric-separator",
|
||||
"escapedName": "acorn-numeric-separator",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn-numeric-separator/-/acorn-numeric-separator-0.3.0.tgz",
|
||||
"_shasum": "15e2f9a698bbec83a339a70a7026ab1d9d257de2",
|
||||
"_spec": "acorn-numeric-separator",
|
||||
"_where": "/home/ruben/repos/node/node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn-numeric-separator/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"email": "mail@adrianheine.de"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Support for numeric separators in acorn",
|
||||
"devDependencies": {
|
||||
"acorn": "^6.0.0",
|
||||
"eslint": "^5.5.0",
|
||||
"eslint-plugin-node": "^8.0.1",
|
||||
"mocha": "^6.0.2",
|
||||
"test262": "git+https://github.com/tc39/test262.git#de567d3aa5de4eaa11e00131d26b9fe77997dfb0",
|
||||
"test262-parser-runner": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8.2"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn-numeric-separator",
|
||||
"license": "MIT",
|
||||
"name": "acorn-numeric-separator",
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn-numeric-separator.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint -c .eslintrc.json .",
|
||||
"test": "mocha",
|
||||
"test:test262": "node run_test262.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
7
deps/acorn-plugins/acorn-private-class-elements/CHANGELOG.md
vendored
Normal file
7
deps/acorn-plugins/acorn-private-class-elements/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
## 0.1.1 (2019-02-09)
|
||||
|
||||
* Add \_branch() method
|
||||
|
||||
## 0.1.0 (2019-02-09)
|
||||
|
||||
Initial release
|
19
deps/acorn-plugins/acorn-private-class-elements/LICENSE
vendored
Normal file
19
deps/acorn-plugins/acorn-private-class-elements/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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.
|
11
deps/acorn-plugins/acorn-private-class-elements/README.md
vendored
Normal file
11
deps/acorn-plugins/acorn-private-class-elements/README.md
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Helpers for supporting private class methods and fields for Acorn
|
||||
|
||||
[](https://www.npmjs.org/package/acorn-private-class-elements)
|
||||
|
||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It provides helpers for implementing support for private class elements. The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/pull/180).
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under an [MIT License](./LICENSE).
|
123
deps/acorn-plugins/acorn-private-class-elements/index.js
vendored
Normal file
123
deps/acorn-plugins/acorn-private-class-elements/index.js
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
"use strict"
|
||||
|
||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn')
|
||||
if (acorn.version.indexOf("6.") != 0 || acorn.version.indexOf("6.0.") == 0) {
|
||||
throw new Error(`acorn-private-class-elements requires acorn@^6.1.0, not ${acorn.version}`)
|
||||
}
|
||||
const tt = acorn.tokTypes
|
||||
const 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.
|
||||
let 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 = class extends Parser {
|
||||
_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
|
||||
}
|
||||
|
||||
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")
|
||||
const accept = {get: "set", set: "get"}[element.kind]
|
||||
const 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
|
||||
}
|
||||
|
||||
parsePrivateName() {
|
||||
const 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
|
||||
getTokenFromCode(code) {
|
||||
if (code === 35) {
|
||||
++this.pos
|
||||
const word = this.readWord1()
|
||||
return this.finishToken(this.privateNameToken, word)
|
||||
}
|
||||
return super.getTokenFromCode(code)
|
||||
}
|
||||
|
||||
// Manage stacks and check for undeclared private names
|
||||
parseClass(node, isStatement) {
|
||||
this._privateBoundNamesStack = this._privateBoundNamesStack || []
|
||||
const privateBoundNames = Object.create(this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1] || null)
|
||||
this._privateBoundNamesStack.push(privateBoundNames)
|
||||
this._unresolvedPrivateNamesStack = this._unresolvedPrivateNamesStack || []
|
||||
const unresolvedPrivateNames = Object.create(null)
|
||||
this._unresolvedPrivateNamesStack.push(unresolvedPrivateNames)
|
||||
const _return = super.parseClass(node, isStatement)
|
||||
this._privateBoundNamesStack.pop()
|
||||
this._unresolvedPrivateNamesStack.pop()
|
||||
if (!this._unresolvedPrivateNamesStack.length) {
|
||||
const names = Object.keys(unresolvedPrivateNames)
|
||||
if (names.length) {
|
||||
names.sort((n1, n2) => 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
|
||||
parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
|
||||
if (!this.eat(tt.dot)) {
|
||||
return super.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow)
|
||||
}
|
||||
let 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
|
||||
parseMaybeUnary(refDestructuringErrors, sawUnary) {
|
||||
const _return = super.parseMaybeUnary(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
|
||||
}
|
||||
}
|
||||
Parser.prototype.privateNameToken = new TokenType("privateName")
|
||||
return Parser
|
||||
}
|
63
deps/acorn-plugins/acorn-private-class-elements/package.json
vendored
Normal file
63
deps/acorn-plugins/acorn-private-class-elements/package.json
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "acorn-private-class-elements@^0.1.1",
|
||||
"_id": "acorn-private-class-elements@0.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-bZpmSnaOsK3jkF7J8xaLJ05f008vapPX+XliIv8+jjkclvDR+M4OnTHLhFnCCSeJ0fMwRKjbY+BXsglSNpVZtw==",
|
||||
"_location": "/acorn-private-class-elements",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "acorn-private-class-elements@^0.1.1",
|
||||
"name": "acorn-private-class-elements",
|
||||
"escapedName": "acorn-private-class-elements",
|
||||
"rawSpec": "^0.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/acorn-class-fields"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn-private-class-elements/-/acorn-private-class-elements-0.1.1.tgz",
|
||||
"_shasum": "85209cb5791ab84fde2362cb208fa51e7679bcdc",
|
||||
"_spec": "acorn-private-class-elements@^0.1.1",
|
||||
"_where": "/home/ruben/repos/node/node/node_modules/acorn-class-fields",
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn-private-class-elements/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"email": "mail@adrianheine.de"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mocha": "^5.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helpers for supporting private class methods and fields in acorn",
|
||||
"devDependencies": {
|
||||
"acorn": "^6.1.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-plugin-node": "^8.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8.2"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn-private-class-elements",
|
||||
"license": "MIT",
|
||||
"name": "acorn-private-class-elements",
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn-private-class-elements.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint -c .eslintrc.json .",
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.1.1"
|
||||
}
|
29
deps/acorn-plugins/acorn-private-methods/CHANGELOG.md
vendored
Normal file
29
deps/acorn-plugins/acorn-private-methods/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
## 0.3.0 (2019-02-09)
|
||||
|
||||
* Require acorn >= 6.1.0
|
||||
|
||||
## 0.2.3 (2019-02-09)
|
||||
|
||||
* Forbid binding await in async arrow function's parameter list
|
||||
|
||||
## 0.2.2 (2019-01-30)
|
||||
|
||||
* Fix parsing of chained subscripts
|
||||
|
||||
## 0.2.1 (2018-11-06)
|
||||
|
||||
* Adapt to changes in acorn 6.0.3
|
||||
|
||||
## 0.2.0 (2018-09-14)
|
||||
|
||||
* Update to new acorn 6 interface
|
||||
* Change license to MIT
|
||||
* Don't allow direct super() calls in private methods
|
||||
|
||||
## 0.1.1 (2018-02-09)
|
||||
|
||||
* Don't accept whitespace between hash and private name
|
||||
|
||||
## 0.1.0 (2018-01-13)
|
||||
|
||||
Initial release
|
19
deps/acorn-plugins/acorn-private-methods/LICENSE
vendored
Normal file
19
deps/acorn-plugins/acorn-private-methods/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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.
|
21
deps/acorn-plugins/acorn-private-methods/README.md
vendored
Normal file
21
deps/acorn-plugins/acorn-private-methods/README.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Private methods and getter/setters support for Acorn
|
||||
|
||||
[](https://www.npmjs.org/package/acorn-private-methods)
|
||||
|
||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It implements support for private methods, getters and setters as defined in the stage 3 proposal [Private methods and getter/setters for JavaScript classes](https://github.com/tc39/proposal-private-methods). The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/pull/180).
|
||||
|
||||
## Usage
|
||||
|
||||
This module provides a plugin that can be used to extend the Acorn `Parser` class:
|
||||
|
||||
```javascript
|
||||
const {Parser} = require('acorn');
|
||||
const privateMethods = require('acorn-private-methods');
|
||||
Parser.extend(privateMethods).parse('class X { #a() {} }');
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under an [MIT License](./LICENSE).
|
25
deps/acorn-plugins/acorn-private-methods/index.js
vendored
Normal file
25
deps/acorn-plugins/acorn-private-methods/index.js
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict"
|
||||
|
||||
const privateClassElements = require('internal/deps/acorn-plugins/acorn-private-class-elements/index')
|
||||
|
||||
module.exports = function(Parser) {
|
||||
const ExtendedParser = privateClassElements(Parser)
|
||||
|
||||
return class extends ExtendedParser {
|
||||
// Parse private methods
|
||||
parseClassElement(_constructorAllowsSuper) {
|
||||
const oldInClassMemberName = this._inClassMemberName
|
||||
this._inClassMemberName = true
|
||||
const result = super.parseClassElement.apply(this, arguments)
|
||||
this._inClassMemberName = oldInClassMemberName
|
||||
return result
|
||||
}
|
||||
|
||||
parsePropertyName(prop) {
|
||||
const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateNameToken
|
||||
this._inClassMemberName = false
|
||||
if (!isPrivate) return super.parsePropertyName(prop)
|
||||
return this.parsePrivateClassElementName(prop)
|
||||
}
|
||||
}
|
||||
}
|
68
deps/acorn-plugins/acorn-private-methods/package.json
vendored
Normal file
68
deps/acorn-plugins/acorn-private-methods/package.json
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "acorn-private-methods",
|
||||
"_id": "acorn-private-methods@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-+gWTjSA+13lsv1mwCPosSrLzEyghYtWgrr/1Ck7i7Pu5iK7Ke0hOgw3IW1RUxhc4qS2QTQBQx2+qHYqsa4Qlqw==",
|
||||
"_location": "/acorn-private-methods",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "acorn-private-methods",
|
||||
"name": "acorn-private-methods",
|
||||
"escapedName": "acorn-private-methods",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn-private-methods/-/acorn-private-methods-0.3.0.tgz",
|
||||
"_shasum": "a5a9f8cd83d175bc138fa22592fababd0afda35d",
|
||||
"_spec": "acorn-private-methods",
|
||||
"_where": "/home/ruben/repos/node/node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn-private-methods/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"email": "mail@adrianheine.de"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"acorn-private-class-elements": "^0.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Support for private methods in acorn",
|
||||
"devDependencies": {
|
||||
"acorn": "^6.1.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-plugin-node": "^8.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d",
|
||||
"test262-parser-runner": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8.2"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn-private-methods",
|
||||
"license": "MIT",
|
||||
"name": "acorn-private-methods",
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn-private-methods.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint -c .eslintrc.json .",
|
||||
"test": "mocha",
|
||||
"test:test262": "node run_test262.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
11
deps/acorn-plugins/acorn-static-class-features/CHANGELOG.md
vendored
Normal file
11
deps/acorn-plugins/acorn-static-class-features/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
## 0.2.0 (2019-02-09)
|
||||
|
||||
* Require acorn >= 6.1.0
|
||||
|
||||
## 0.1.1 (2018-11-06)
|
||||
|
||||
* Adapt to changes in acorn 6.0.3
|
||||
|
||||
## 0.1.0 (2018-09-14)
|
||||
|
||||
Initial release
|
19
deps/acorn-plugins/acorn-static-class-features/LICENSE
vendored
Normal file
19
deps/acorn-plugins/acorn-static-class-features/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
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.
|
21
deps/acorn-plugins/acorn-static-class-features/README.md
vendored
Normal file
21
deps/acorn-plugins/acorn-static-class-features/README.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Static class features support for Acorn
|
||||
|
||||
[](https://www.npmjs.org/package/acorn-static-class-features)
|
||||
|
||||
This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It implements support for static class features as defined in the stage 3 proposal [Static class features](https://github.com/tc39/proposal-static-class-features). The emitted AST follows [an ESTree proposal](https://github.com/estree/estree/pull/180).
|
||||
|
||||
## Usage
|
||||
|
||||
This module provides a plugin that can be used to extend the Acorn `Parser` class:
|
||||
|
||||
```javascript
|
||||
const {Parser} = require('acorn');
|
||||
const staticClassFeatures = require('acorn-static-class-features');
|
||||
Parser.extend(staticClassFeatures).parse('class X { static x = 0 }');
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under an [MIT License](./LICENSE).
|
126
deps/acorn-plugins/acorn-static-class-features/index.js
vendored
Normal file
126
deps/acorn-plugins/acorn-static-class-features/index.js
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
"use strict"
|
||||
|
||||
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
|
||||
|
||||
const acorn = require('internal/deps/acorn/acorn/dist/acorn')
|
||||
const tt = acorn.tokTypes
|
||||
|
||||
function maybeParseFieldValue(field) {
|
||||
if (this.eat(tt.eq)) {
|
||||
const oldInFieldValue = this._inStaticFieldValue
|
||||
this._inStaticFieldValue = true
|
||||
field.value = this.parseExpression()
|
||||
this._inStaticFieldValue = oldInFieldValue
|
||||
} else field.value = null
|
||||
}
|
||||
|
||||
const privateClassElements = require("internal/deps/acorn-plugins/acorn-private-class-elements/index")
|
||||
|
||||
module.exports = function(Parser) {
|
||||
const ExtendedParser = privateClassElements(Parser)
|
||||
|
||||
return class extends ExtendedParser {
|
||||
// Parse private fields
|
||||
parseClassElement(_constructorAllowsSuper) {
|
||||
if (this.eat(tt.semi)) return null
|
||||
|
||||
const node = this.startNode()
|
||||
|
||||
const tryContextual = (k, noLineBreak) => {
|
||||
if (typeof noLineBreak == "undefined") noLineBreak = false
|
||||
const start = this.start, startLoc = this.startLoc
|
||||
if (!this.eatContextual(k)) return false
|
||||
if (this.type !== tt.parenL && (!noLineBreak || !this.canInsertSemicolon())) return true
|
||||
if (node.key) this.unexpected()
|
||||
node.computed = false
|
||||
node.key = this.startNodeAt(start, startLoc)
|
||||
node.key.name = k
|
||||
this.finishNode(node.key, "Identifier")
|
||||
return false
|
||||
}
|
||||
|
||||
node.static = tryContextual("static")
|
||||
if (!node.static) return super.parseClassElement.apply(this, arguments)
|
||||
|
||||
let isGenerator = this.eat(tt.star)
|
||||
let 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
|
||||
let skip = skipWhiteSpace.exec(this.input)
|
||||
let 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
|
||||
parseClassMethod(method, isGenerator, isAsync, _allowsDirectSuper) {
|
||||
if (isGenerator || isAsync || method.kind != "method" || !method.static || this.options.ecmaVersion < 8 || this.type == tt.parenL) {
|
||||
return super.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
|
||||
parseIdent(liberal, isBinding) {
|
||||
const ident = super.parseIdent(liberal, isBinding)
|
||||
if (this._inStaticFieldValue && ident.name == "arguments") this.raise(ident.start, "A static class field initializer may not contain arguments")
|
||||
return ident
|
||||
}
|
||||
}
|
||||
}
|
68
deps/acorn-plugins/acorn-static-class-features/package.json
vendored
Normal file
68
deps/acorn-plugins/acorn-static-class-features/package.json
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "acorn-static-class-features",
|
||||
"_id": "acorn-static-class-features@0.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-46IooHSRsvgSi+t36Wx9iPfF9BKFKVDcAWELXVqvKHmZogSCk11iUCi2FiZmLeTaM0hlJ3EYDyYiVmHRUGPzWA==",
|
||||
"_location": "/acorn-static-class-features",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "acorn-static-class-features",
|
||||
"name": "acorn-static-class-features",
|
||||
"escapedName": "acorn-static-class-features",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn-static-class-features/-/acorn-static-class-features-0.2.0.tgz",
|
||||
"_shasum": "8a12b0b280b2e067e268fdbb14116a5b02affd71",
|
||||
"_spec": "acorn-static-class-features",
|
||||
"_where": "/home/ruben/repos/node/node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn-static-class-features/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"email": "mail@adrianheine.de"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"acorn-private-class-elements": "^0.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Support for static class features in acorn",
|
||||
"devDependencies": {
|
||||
"acorn": "^6.1.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-plugin-node": "^8.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d",
|
||||
"test262-parser-runner": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8.2"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn-static-class-features",
|
||||
"license": "MIT",
|
||||
"name": "acorn-static-class-features",
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn-static-class-features.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint -c .eslintrc.json .",
|
||||
"test": "mocha",
|
||||
"test:test262": "node run_test262.js"
|
||||
},
|
||||
"version": "0.2.0"
|
||||
}
|
1
deps/acorn/acorn-walk/dist/walk.js.map
vendored
1
deps/acorn/acorn-walk/dist/walk.js.map
vendored
File diff suppressed because one or more lines are too long
436
deps/acorn/acorn-walk/dist/walk.mjs
vendored
436
deps/acorn/acorn-walk/dist/walk.mjs
vendored
@ -1,436 +0,0 @@
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression and
|
||||
// Statement, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
|
||||
function simple(node, visitors, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An ancestor walk keeps an array of ancestor nodes (including the
|
||||
// current node) and passes them to the callback as third parameter
|
||||
// (and also as state parameter when no other state is present).
|
||||
function ancestor(node, visitors, baseVisitor, state) {
|
||||
var ancestors = [];
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st || ancestors, ancestors); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
function recursive(node, state, funcs, baseVisitor, override) {
|
||||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
|
||||
visitor[override || node.type](node, st, c);
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
function makeTest(test) {
|
||||
if (typeof test === "string")
|
||||
{ return function (type) { return type === test; } }
|
||||
else if (!test)
|
||||
{ return function () { return true; } }
|
||||
else
|
||||
{ return test }
|
||||
}
|
||||
|
||||
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
||||
|
||||
// A full walk triggers the callback on each node
|
||||
function full(node, callback, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
baseVisitor[type](node, st, c);
|
||||
if (!override) { callback(node, st, type); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An fullAncestor walk is like an ancestor walk, but triggers
|
||||
// the callback on each node
|
||||
function fullAncestor(node, callback, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var ancestors = [];(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
// Find a node with a given start, end, and type (all are optional,
|
||||
// null can be used as wildcard). Returns a {node, state} object, or
|
||||
// undefined when it doesn't find a matching node.
|
||||
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
test = makeTest(test);
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if ((start == null || node.start <= start) &&
|
||||
(end == null || node.end >= end))
|
||||
{ baseVisitor[type](node, st, c); }
|
||||
if ((start == null || node.start === start) &&
|
||||
(end == null || node.end === end) &&
|
||||
test(type, node))
|
||||
{ throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the innermost node of a given type that contains the given
|
||||
// position. Interface similar to findNodeAt.
|
||||
function findNodeAround(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if (node.start > pos || node.end < pos) { return }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (test(type, node)) { throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node after a given position.
|
||||
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
if (node.end < pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node before a given position.
|
||||
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var max;(function c(node, st, override) {
|
||||
if (node.start > pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
||||
{ max = new Found(node, st); }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
return max
|
||||
}
|
||||
|
||||
// Fallback to an Object.create polyfill for older environments.
|
||||
var create = Object.create || function(proto) {
|
||||
function Ctor() {}
|
||||
Ctor.prototype = proto;
|
||||
return new Ctor
|
||||
};
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
function make(funcs, baseVisitor) {
|
||||
var visitor = create(baseVisitor || base);
|
||||
for (var type in funcs) { visitor[type] = funcs[type]; }
|
||||
return visitor
|
||||
}
|
||||
|
||||
function skipThrough(node, st, c) { c(node, st); }
|
||||
function ignore(_node, _st, _c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
var base = {};
|
||||
|
||||
base.Program = base.BlockStatement = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var stmt = list[i];
|
||||
|
||||
c(stmt, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.Statement = skipThrough;
|
||||
base.EmptyStatement = ignore;
|
||||
base.ExpressionStatement = base.ParenthesizedExpression =
|
||||
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
||||
base.IfStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Statement");
|
||||
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
||||
};
|
||||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
||||
base.BreakStatement = base.ContinueStatement = ignore;
|
||||
base.WithStatement = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.SwitchStatement = function (node, st, c) {
|
||||
c(node.discriminant, st, "Expression");
|
||||
for (var i = 0, list = node.cases; i < list.length; i += 1) {
|
||||
var cs = list[i];
|
||||
|
||||
if (cs.test) { c(cs.test, st, "Expression"); }
|
||||
for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)
|
||||
{
|
||||
var cons = list$1[i$1];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
}
|
||||
};
|
||||
base.SwitchCase = function (node, st, c) {
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
||||
if (node.argument) { c(node.argument, st, "Expression"); }
|
||||
};
|
||||
base.ThrowStatement = base.SpreadElement =
|
||||
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
||||
base.TryStatement = function (node, st, c) {
|
||||
c(node.block, st, "Statement");
|
||||
if (node.handler) { c(node.handler, st); }
|
||||
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
||||
};
|
||||
base.CatchClause = function (node, st, c) {
|
||||
if (node.param) { c(node.param, st, "Pattern"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForStatement = function (node, st, c) {
|
||||
if (node.init) { c(node.init, st, "ForInit"); }
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
if (node.update) { c(node.update, st, "Expression"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
||||
c(node.left, st, "ForInit");
|
||||
c(node.right, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInit = function (node, st, c) {
|
||||
if (node.type === "VariableDeclaration") { c(node, st); }
|
||||
else { c(node, st, "Expression"); }
|
||||
};
|
||||
base.DebuggerStatement = ignore;
|
||||
|
||||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
||||
base.VariableDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
||||
{
|
||||
var decl = list[i];
|
||||
|
||||
c(decl, st);
|
||||
}
|
||||
};
|
||||
base.VariableDeclarator = function (node, st, c) {
|
||||
c(node.id, st, "Pattern");
|
||||
if (node.init) { c(node.init, st, "Expression"); }
|
||||
};
|
||||
|
||||
base.Function = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
for (var i = 0, list = node.params; i < list.length; i += 1)
|
||||
{
|
||||
var param = list[i];
|
||||
|
||||
c(param, st, "Pattern");
|
||||
}
|
||||
c(node.body, st, node.expression ? "Expression" : "Statement");
|
||||
};
|
||||
|
||||
base.Pattern = function (node, st, c) {
|
||||
if (node.type === "Identifier")
|
||||
{ c(node, st, "VariablePattern"); }
|
||||
else if (node.type === "MemberExpression")
|
||||
{ c(node, st, "MemberPattern"); }
|
||||
else
|
||||
{ c(node, st); }
|
||||
};
|
||||
base.VariablePattern = ignore;
|
||||
base.MemberPattern = skipThrough;
|
||||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
||||
base.ArrayPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Pattern"); }
|
||||
}
|
||||
};
|
||||
base.ObjectPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
||||
var prop = list[i];
|
||||
|
||||
if (prop.type === "Property") {
|
||||
if (prop.computed) { c(prop.key, st, "Expression"); }
|
||||
c(prop.value, st, "Pattern");
|
||||
} else if (prop.type === "RestElement") {
|
||||
c(prop.argument, st, "Pattern");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
base.Expression = skipThrough;
|
||||
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
||||
base.ArrayExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Expression"); }
|
||||
}
|
||||
};
|
||||
base.ObjectExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
||||
{
|
||||
var prop = list[i];
|
||||
|
||||
c(prop, st);
|
||||
}
|
||||
};
|
||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
||||
base.SequenceExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
||||
{
|
||||
var expr = list[i];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateLiteral = function (node, st, c) {
|
||||
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
||||
{
|
||||
var quasi = list[i];
|
||||
|
||||
c(quasi, st);
|
||||
}
|
||||
|
||||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
||||
{
|
||||
var expr = list$1[i$1];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateElement = ignore;
|
||||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
||||
c(node.left, st, "Expression");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
||||
c(node.left, st, "Pattern");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.ConditionalExpression = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Expression");
|
||||
c(node.alternate, st, "Expression");
|
||||
};
|
||||
base.NewExpression = base.CallExpression = function (node, st, c) {
|
||||
c(node.callee, st, "Expression");
|
||||
if (node.arguments)
|
||||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
||||
{
|
||||
var arg = list[i];
|
||||
|
||||
c(arg, st, "Expression");
|
||||
} }
|
||||
};
|
||||
base.MemberExpression = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
if (node.computed) { c(node.property, st, "Expression"); }
|
||||
};
|
||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
||||
if (node.declaration)
|
||||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
||||
if (node.source) { c(node.source, st, "Expression"); }
|
||||
};
|
||||
base.ExportAllDeclaration = function (node, st, c) {
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
||||
{
|
||||
var spec = list[i];
|
||||
|
||||
c(spec, st);
|
||||
}
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
||||
|
||||
base.TaggedTemplateExpression = function (node, st, c) {
|
||||
c(node.tag, st, "Expression");
|
||||
c(node.quasi, st, "Expression");
|
||||
};
|
||||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
||||
base.Class = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
||||
c(node.body, st);
|
||||
};
|
||||
base.ClassBody = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var elt = list[i];
|
||||
|
||||
c(elt, st);
|
||||
}
|
||||
};
|
||||
base.MethodDefinition = base.Property = function (node, st, c) {
|
||||
if (node.computed) { c(node.key, st, "Expression"); }
|
||||
c(node.value, st, "Expression");
|
||||
};
|
||||
|
||||
export { simple, ancestor, recursive, full, fullAncestor, findNodeAt, findNodeAround, findNodeAfter, findNodeBefore, make, base };
|
||||
//# sourceMappingURL=walk.mjs.map
|
1
deps/acorn/acorn-walk/dist/walk.mjs.map
vendored
1
deps/acorn/acorn-walk/dist/walk.mjs.map
vendored
File diff suppressed because one or more lines are too long
4
deps/acorn/acorn/bin/acorn
vendored
4
deps/acorn/acorn/bin/acorn
vendored
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
require('../dist/bin.js');
|
209
deps/acorn/acorn/dist/acorn.d.ts
vendored
209
deps/acorn/acorn/dist/acorn.d.ts
vendored
@ -1,209 +0,0 @@
|
||||
export as namespace acorn
|
||||
export = acorn
|
||||
|
||||
declare namespace acorn {
|
||||
function parse(input: string, options?: Options): Node
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): Node
|
||||
|
||||
function tokenizer(input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019
|
||||
sourceType?: 'script' | 'module'
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
allowReserved?: boolean
|
||||
allowReturnOutsideFunction?: boolean
|
||||
allowImportExportEverywhere?: boolean
|
||||
allowAwaitOutsideFunction?: boolean
|
||||
allowHashBang?: boolean
|
||||
locations?: boolean
|
||||
onToken?: ((token: Token) => any) | Token[]
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||
endLoc?: Position
|
||||
) => void) | Comment[]
|
||||
ranges?: boolean
|
||||
program?: Node
|
||||
sourceFile?: string
|
||||
directSourceFile?: string
|
||||
preserveParens?: boolean
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(options: Options, input: string, startPos?: number)
|
||||
parse(): Node
|
||||
static parse(input: string, options?: Options): Node
|
||||
static parseExpressionAt(input: string, pos: number, options?: Options): Node
|
||||
static tokenizer(input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||
}
|
||||
|
||||
interface Position { line: number; column: number; offset: number }
|
||||
|
||||
const defaultOptions: Options
|
||||
|
||||
function getLineInfo(input: string, offset: number): Position
|
||||
|
||||
class SourceLocation {
|
||||
start: Position
|
||||
end: Position
|
||||
source?: string | null
|
||||
constructor(p: Parser, start: Position, end: Position)
|
||||
}
|
||||
|
||||
class Node {
|
||||
type: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
sourceFile?: string
|
||||
range?: [number, number]
|
||||
constructor(parser: Parser, pos: number, loc?: SourceLocation)
|
||||
}
|
||||
|
||||
class TokenType {
|
||||
label: string
|
||||
keyword: string
|
||||
beforeExpr: boolean
|
||||
startsExpr: boolean
|
||||
isLoop: boolean
|
||||
isAssign: boolean
|
||||
prefix: boolean
|
||||
postfix: boolean
|
||||
binop: number
|
||||
updateContext?: (prevType: TokenType) => void
|
||||
constructor(label: string, conf?: any)
|
||||
}
|
||||
|
||||
const tokTypes: {
|
||||
num: TokenType
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
eof: TokenType
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
braceL: TokenType
|
||||
braceR: TokenType
|
||||
parenL: TokenType
|
||||
parenR: TokenType
|
||||
comma: TokenType
|
||||
semi: TokenType
|
||||
colon: TokenType
|
||||
dot: TokenType
|
||||
question: TokenType
|
||||
arrow: TokenType
|
||||
template: TokenType
|
||||
ellipsis: TokenType
|
||||
backQuote: TokenType
|
||||
dollarBraceL: TokenType
|
||||
eq: TokenType
|
||||
assign: TokenType
|
||||
incDec: TokenType
|
||||
prefix: TokenType
|
||||
logicalOR: TokenType
|
||||
logicalAND: TokenType
|
||||
bitwiseOR: TokenType
|
||||
bitwiseXOR: TokenType
|
||||
bitwiseAND: TokenType
|
||||
equality: TokenType
|
||||
relational: TokenType
|
||||
bitShift: TokenType
|
||||
plusMin: TokenType
|
||||
modulo: TokenType
|
||||
star: TokenType
|
||||
slash: TokenType
|
||||
starstar: TokenType
|
||||
_break: TokenType
|
||||
_case: TokenType
|
||||
_catch: TokenType
|
||||
_continue: TokenType
|
||||
_debugger: TokenType
|
||||
_default: TokenType
|
||||
_do: TokenType
|
||||
_else: TokenType
|
||||
_finally: TokenType
|
||||
_for: TokenType
|
||||
_function: TokenType
|
||||
_if: TokenType
|
||||
_return: TokenType
|
||||
_switch: TokenType
|
||||
_throw: TokenType
|
||||
_try: TokenType
|
||||
_var: TokenType
|
||||
_const: TokenType
|
||||
_while: TokenType
|
||||
_with: TokenType
|
||||
_new: TokenType
|
||||
_this: TokenType
|
||||
_super: TokenType
|
||||
_class: TokenType
|
||||
_extends: TokenType
|
||||
_export: TokenType
|
||||
_import: TokenType
|
||||
_null: TokenType
|
||||
_true: TokenType
|
||||
_false: TokenType
|
||||
_in: TokenType
|
||||
_instanceof: TokenType
|
||||
_typeof: TokenType
|
||||
_void: TokenType
|
||||
_delete: TokenType
|
||||
}
|
||||
|
||||
class TokContext {
|
||||
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
|
||||
}
|
||||
|
||||
const tokContexts: {
|
||||
b_stat: TokContext
|
||||
b_expr: TokContext
|
||||
b_tmpl: TokContext
|
||||
p_stat: TokContext
|
||||
p_expr: TokContext
|
||||
q_tmpl: TokContext
|
||||
f_expr: TokContext
|
||||
}
|
||||
|
||||
function isIdentifierStart(code: number, astral?: boolean): boolean
|
||||
|
||||
function isIdentifierChar(code: number, astral?: boolean): boolean
|
||||
|
||||
interface AbstractToken {
|
||||
}
|
||||
|
||||
interface Comment extends AbstractToken {
|
||||
type: string
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
class Token {
|
||||
type: TokenType
|
||||
value: any
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
constructor(p: Parser)
|
||||
}
|
||||
|
||||
function isNewLine(code: number): boolean
|
||||
|
||||
const lineBreak: RegExp
|
||||
|
||||
const lineBreakG: RegExp
|
||||
|
||||
const version: string
|
||||
}
|
1
deps/acorn/acorn/dist/acorn.js.map
vendored
1
deps/acorn/acorn/dist/acorn.js.map
vendored
File diff suppressed because one or more lines are too long
4987
deps/acorn/acorn/dist/acorn.mjs
vendored
4987
deps/acorn/acorn/dist/acorn.mjs
vendored
File diff suppressed because it is too large
Load Diff
1
deps/acorn/acorn/dist/acorn.mjs.map
vendored
1
deps/acorn/acorn/dist/acorn.mjs.map
vendored
File diff suppressed because one or more lines are too long
68
deps/acorn/acorn/dist/bin.js
vendored
68
deps/acorn/acorn/dist/bin.js
vendored
@ -1,68 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
var infile;
|
||||
var forceFile;
|
||||
var silent = false;
|
||||
var compact = false;
|
||||
var tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
|
||||
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
||||
else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(code) {
|
||||
var result;
|
||||
try {
|
||||
if (!tokenize) {
|
||||
result = acorn.parse(code, options);
|
||||
} else {
|
||||
result = [];
|
||||
var tokenizer$$1 = acorn.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer$$1.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn.tokTypes.eof)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (forceFile || infile && infile !== "-") {
|
||||
run(fs.readFileSync(infile, "utf8"));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run(code); });
|
||||
}
|
6
node.gyp
6
node.gyp
@ -224,6 +224,12 @@
|
||||
'deps/node-inspect/lib/internal/inspect_repl.js',
|
||||
'deps/acorn/acorn/dist/acorn.js',
|
||||
'deps/acorn/acorn-walk/dist/walk.js',
|
||||
'deps/acorn-plugins/acorn-bigint/index.js',
|
||||
'deps/acorn-plugins/acorn-class-fields/index.js',
|
||||
'deps/acorn-plugins/acorn-numeric-separator/index.js',
|
||||
'deps/acorn-plugins/acorn-private-class-elements/index.js',
|
||||
'deps/acorn-plugins/acorn-private-methods/index.js',
|
||||
'deps/acorn-plugins/acorn-static-class-features/index.js',
|
||||
],
|
||||
'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)',
|
||||
'mkcodecache_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mkcodecache<(EXECUTABLE_SUFFIX)',
|
||||
|
@ -30,6 +30,7 @@ fi
|
||||
|
||||
# Dependencies bundled in distributions
|
||||
addlicense "Acorn" "deps/acorn" "$(cat ${rootdir}/deps/acorn/acorn/LICENSE)"
|
||||
addlicense "Acorn plugins" "deps/acorn-plugins" "$(cat ${rootdir}/deps/acorn-plugins/acorn-bigint/LICENSE)"
|
||||
addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)"
|
||||
addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)"
|
||||
if [ -f "${rootdir}/deps/icu/LICENSE" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user