This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

9
node_modules/ast-types/.github/dependabot.yml generated vendored Normal file
View File

@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

29
node_modules/ast-types/.github/workflows/main.yml generated vendored Normal file
View File

@@ -0,0 +1,29 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['10', '12', '14']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- name: npm install, build and test
run: |
npm install
npm run build --if-present
npm test

20
node_modules/ast-types/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2013 Ben Newman <bn@cs.stanford.edu>
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.

512
node_modules/ast-types/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

2
node_modules/ast-types/def/babel-core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

202
node_modules/ast-types/def/babel-core.js generated vendored Normal file
View File

@@ -0,0 +1,202 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es_proposals_1 = tslib_1.__importDefault(require("./es-proposals"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es_proposals_1.default);
var types = fork.use(types_1.default);
var defaults = fork.use(shared_1.default).defaults;
var def = types.Type.def;
var or = types.Type.or;
def("Noop")
.bases("Statement")
.build();
def("DoExpression")
.bases("Expression")
.build("body")
.field("body", [def("Statement")]);
def("BindExpression")
.bases("Expression")
.build("object", "callee")
.field("object", or(def("Expression"), null))
.field("callee", def("Expression"));
def("ParenthesizedExpression")
.bases("Expression")
.build("expression")
.field("expression", def("Expression"));
def("ExportNamespaceSpecifier")
.bases("Specifier")
.build("exported")
.field("exported", def("Identifier"));
def("ExportDefaultSpecifier")
.bases("Specifier")
.build("exported")
.field("exported", def("Identifier"));
def("CommentBlock")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
def("CommentLine")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
def("Directive")
.bases("Node")
.build("value")
.field("value", def("DirectiveLiteral"));
def("DirectiveLiteral")
.bases("Node", "Expression")
.build("value")
.field("value", String, defaults["use strict"]);
def("InterpreterDirective")
.bases("Node")
.build("value")
.field("value", String);
def("BlockStatement")
.bases("Statement")
.build("body")
.field("body", [def("Statement")])
.field("directives", [def("Directive")], defaults.emptyArray);
def("Program")
.bases("Node")
.build("body")
.field("body", [def("Statement")])
.field("directives", [def("Directive")], defaults.emptyArray)
.field("interpreter", or(def("InterpreterDirective"), null), defaults["null"]);
// Split Literal
def("StringLiteral")
.bases("Literal")
.build("value")
.field("value", String);
def("NumericLiteral")
.bases("Literal")
.build("value")
.field("value", Number)
.field("raw", or(String, null), defaults["null"])
.field("extra", {
rawValue: Number,
raw: String
}, function getDefault() {
return {
rawValue: this.value,
raw: this.value + ""
};
});
def("BigIntLiteral")
.bases("Literal")
.build("value")
// Only String really seems appropriate here, since BigInt values
// often exceed the limits of JS numbers.
.field("value", or(String, Number))
.field("extra", {
rawValue: String,
raw: String
}, function getDefault() {
return {
rawValue: String(this.value),
raw: this.value + "n"
};
});
def("NullLiteral")
.bases("Literal")
.build()
.field("value", null, defaults["null"]);
def("BooleanLiteral")
.bases("Literal")
.build("value")
.field("value", Boolean);
def("RegExpLiteral")
.bases("Literal")
.build("pattern", "flags")
.field("pattern", String)
.field("flags", String)
.field("value", RegExp, function () {
return new RegExp(this.pattern, this.flags);
});
var ObjectExpressionProperty = or(def("Property"), def("ObjectMethod"), def("ObjectProperty"), def("SpreadProperty"), def("SpreadElement"));
// Split Property -> ObjectProperty and ObjectMethod
def("ObjectExpression")
.bases("Expression")
.build("properties")
.field("properties", [ObjectExpressionProperty]);
// ObjectMethod hoist .value properties to own properties
def("ObjectMethod")
.bases("Node", "Function")
.build("kind", "key", "params", "body", "computed")
.field("kind", or("method", "get", "set"))
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("params", [def("Pattern")])
.field("body", def("BlockStatement"))
.field("computed", Boolean, defaults["false"])
.field("generator", Boolean, defaults["false"])
.field("async", Boolean, defaults["false"])
.field("accessibility", // TypeScript
or(def("Literal"), null), defaults["null"])
.field("decorators", or([def("Decorator")], null), defaults["null"]);
def("ObjectProperty")
.bases("Node")
.build("key", "value")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("value", or(def("Expression"), def("Pattern")))
.field("accessibility", // TypeScript
or(def("Literal"), null), defaults["null"])
.field("computed", Boolean, defaults["false"]);
var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"));
// MethodDefinition -> ClassMethod
def("ClassBody")
.bases("Declaration")
.build("body")
.field("body", [ClassBodyElement]);
def("ClassMethod")
.bases("Declaration", "Function")
.build("kind", "key", "params", "body", "computed", "static")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")));
def("ClassPrivateMethod")
.bases("Declaration", "Function")
.build("key", "params", "body", "kind", "computed", "static")
.field("key", def("PrivateName"));
["ClassMethod",
"ClassPrivateMethod",
].forEach(function (typeName) {
def(typeName)
.field("kind", or("get", "set", "method", "constructor"), function () { return "method"; })
.field("body", def("BlockStatement"))
.field("computed", Boolean, defaults["false"])
.field("static", or(Boolean, null), defaults["null"])
.field("abstract", or(Boolean, null), defaults["null"])
.field("access", or("public", "private", "protected", null), defaults["null"])
.field("accessibility", or("public", "private", "protected", null), defaults["null"])
.field("decorators", or([def("Decorator")], null), defaults["null"])
.field("optional", or(Boolean, null), defaults["null"]);
});
var ObjectPatternProperty = or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty"), // Used by Esprima
def("ObjectProperty"), // Babel 6
def("RestProperty") // Babel 6
);
// Split into RestProperty and SpreadProperty
def("ObjectPattern")
.bases("Pattern")
.build("properties")
.field("properties", [ObjectPatternProperty])
.field("decorators", or([def("Decorator")], null), defaults["null"]);
def("SpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("RestProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ForAwaitStatement")
.bases("Statement")
.build("left", "right", "body")
.field("left", or(def("VariableDeclaration"), def("Expression")))
.field("right", def("Expression"))
.field("body", def("Statement"));
// The callee node of a dynamic import(...) expression.
def("Import")
.bases("Expression")
.build();
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/babel.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

11
node_modules/ast-types/def/babel.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var babel_core_1 = tslib_1.__importDefault(require("./babel-core"));
var flow_1 = tslib_1.__importDefault(require("./flow"));
function default_1(fork) {
fork.use(babel_core_1.default);
fork.use(flow_1.default);
}
exports.default = default_1;
module.exports = exports["default"];

3
node_modules/ast-types/def/core-operators.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare const BinaryOperators: string[];
export declare const AssignmentOperators: string[];
export declare const LogicalOperators: string[];

20
node_modules/ast-types/def/core-operators.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogicalOperators = exports.AssignmentOperators = exports.BinaryOperators = void 0;
exports.BinaryOperators = [
"==", "!=", "===", "!==",
"<", "<=", ">", ">=",
"<<", ">>", ">>>",
"+", "-", "*", "/", "%",
"&",
"|", "^", "in",
"instanceof",
];
exports.AssignmentOperators = [
"=", "+=", "-=", "*=", "/=", "%=",
"<<=", ">>=", ">>>=",
"|=", "^=", "&=",
];
exports.LogicalOperators = [
"||", "&&",
];

2
node_modules/ast-types/def/core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

297
node_modules/ast-types/def/core.js generated vendored Normal file
View File

@@ -0,0 +1,297 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_operators_1 = require("./core-operators");
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
var types = fork.use(types_1.default);
var Type = types.Type;
var def = Type.def;
var or = Type.or;
var shared = fork.use(shared_1.default);
var defaults = shared.defaults;
var geq = shared.geq;
// Abstract supertype of all syntactic entities that are allowed to have a
// .loc field.
def("Printable")
.field("loc", or(def("SourceLocation"), null), defaults["null"], true);
def("Node")
.bases("Printable")
.field("type", String)
.field("comments", or([def("Comment")], null), defaults["null"], true);
def("SourceLocation")
.field("start", def("Position"))
.field("end", def("Position"))
.field("source", or(String, null), defaults["null"]);
def("Position")
.field("line", geq(1))
.field("column", geq(0));
def("File")
.bases("Node")
.build("program", "name")
.field("program", def("Program"))
.field("name", or(String, null), defaults["null"]);
def("Program")
.bases("Node")
.build("body")
.field("body", [def("Statement")]);
def("Function")
.bases("Node")
.field("id", or(def("Identifier"), null), defaults["null"])
.field("params", [def("Pattern")])
.field("body", def("BlockStatement"))
.field("generator", Boolean, defaults["false"])
.field("async", Boolean, defaults["false"]);
def("Statement").bases("Node");
// The empty .build() here means that an EmptyStatement can be constructed
// (i.e. it's not abstract) but that it needs no arguments.
def("EmptyStatement").bases("Statement").build();
def("BlockStatement")
.bases("Statement")
.build("body")
.field("body", [def("Statement")]);
// TODO Figure out how to silently coerce Expressions to
// ExpressionStatements where a Statement was expected.
def("ExpressionStatement")
.bases("Statement")
.build("expression")
.field("expression", def("Expression"));
def("IfStatement")
.bases("Statement")
.build("test", "consequent", "alternate")
.field("test", def("Expression"))
.field("consequent", def("Statement"))
.field("alternate", or(def("Statement"), null), defaults["null"]);
def("LabeledStatement")
.bases("Statement")
.build("label", "body")
.field("label", def("Identifier"))
.field("body", def("Statement"));
def("BreakStatement")
.bases("Statement")
.build("label")
.field("label", or(def("Identifier"), null), defaults["null"]);
def("ContinueStatement")
.bases("Statement")
.build("label")
.field("label", or(def("Identifier"), null), defaults["null"]);
def("WithStatement")
.bases("Statement")
.build("object", "body")
.field("object", def("Expression"))
.field("body", def("Statement"));
def("SwitchStatement")
.bases("Statement")
.build("discriminant", "cases", "lexical")
.field("discriminant", def("Expression"))
.field("cases", [def("SwitchCase")])
.field("lexical", Boolean, defaults["false"]);
def("ReturnStatement")
.bases("Statement")
.build("argument")
.field("argument", or(def("Expression"), null));
def("ThrowStatement")
.bases("Statement")
.build("argument")
.field("argument", def("Expression"));
def("TryStatement")
.bases("Statement")
.build("block", "handler", "finalizer")
.field("block", def("BlockStatement"))
.field("handler", or(def("CatchClause"), null), function () {
return this.handlers && this.handlers[0] || null;
})
.field("handlers", [def("CatchClause")], function () {
return this.handler ? [this.handler] : [];
}, true) // Indicates this field is hidden from eachField iteration.
.field("guardedHandlers", [def("CatchClause")], defaults.emptyArray)
.field("finalizer", or(def("BlockStatement"), null), defaults["null"]);
def("CatchClause")
.bases("Node")
.build("param", "guard", "body")
.field("param", def("Pattern"))
.field("guard", or(def("Expression"), null), defaults["null"])
.field("body", def("BlockStatement"));
def("WhileStatement")
.bases("Statement")
.build("test", "body")
.field("test", def("Expression"))
.field("body", def("Statement"));
def("DoWhileStatement")
.bases("Statement")
.build("body", "test")
.field("body", def("Statement"))
.field("test", def("Expression"));
def("ForStatement")
.bases("Statement")
.build("init", "test", "update", "body")
.field("init", or(def("VariableDeclaration"), def("Expression"), null))
.field("test", or(def("Expression"), null))
.field("update", or(def("Expression"), null))
.field("body", def("Statement"));
def("ForInStatement")
.bases("Statement")
.build("left", "right", "body")
.field("left", or(def("VariableDeclaration"), def("Expression")))
.field("right", def("Expression"))
.field("body", def("Statement"));
def("DebuggerStatement").bases("Statement").build();
def("Declaration").bases("Statement");
def("FunctionDeclaration")
.bases("Function", "Declaration")
.build("id", "params", "body")
.field("id", def("Identifier"));
def("FunctionExpression")
.bases("Function", "Expression")
.build("id", "params", "body");
def("VariableDeclaration")
.bases("Declaration")
.build("kind", "declarations")
.field("kind", or("var", "let", "const"))
.field("declarations", [def("VariableDeclarator")]);
def("VariableDeclarator")
.bases("Node")
.build("id", "init")
.field("id", def("Pattern"))
.field("init", or(def("Expression"), null), defaults["null"]);
def("Expression").bases("Node");
def("ThisExpression").bases("Expression").build();
def("ArrayExpression")
.bases("Expression")
.build("elements")
.field("elements", [or(def("Expression"), null)]);
def("ObjectExpression")
.bases("Expression")
.build("properties")
.field("properties", [def("Property")]);
// TODO Not in the Mozilla Parser API, but used by Esprima.
def("Property")
.bases("Node") // Want to be able to visit Property Nodes.
.build("kind", "key", "value")
.field("kind", or("init", "get", "set"))
.field("key", or(def("Literal"), def("Identifier")))
.field("value", def("Expression"));
def("SequenceExpression")
.bases("Expression")
.build("expressions")
.field("expressions", [def("Expression")]);
var UnaryOperator = or("-", "+", "!", "~", "typeof", "void", "delete");
def("UnaryExpression")
.bases("Expression")
.build("operator", "argument", "prefix")
.field("operator", UnaryOperator)
.field("argument", def("Expression"))
// Esprima doesn't bother with this field, presumably because it's
// always true for unary operators.
.field("prefix", Boolean, defaults["true"]);
var BinaryOperator = or.apply(void 0, core_operators_1.BinaryOperators);
def("BinaryExpression")
.bases("Expression")
.build("operator", "left", "right")
.field("operator", BinaryOperator)
.field("left", def("Expression"))
.field("right", def("Expression"));
var AssignmentOperator = or.apply(void 0, core_operators_1.AssignmentOperators);
def("AssignmentExpression")
.bases("Expression")
.build("operator", "left", "right")
.field("operator", AssignmentOperator)
.field("left", or(def("Pattern"), def("MemberExpression")))
.field("right", def("Expression"));
var UpdateOperator = or("++", "--");
def("UpdateExpression")
.bases("Expression")
.build("operator", "argument", "prefix")
.field("operator", UpdateOperator)
.field("argument", def("Expression"))
.field("prefix", Boolean);
var LogicalOperator = or.apply(void 0, core_operators_1.LogicalOperators);
def("LogicalExpression")
.bases("Expression")
.build("operator", "left", "right")
.field("operator", LogicalOperator)
.field("left", def("Expression"))
.field("right", def("Expression"));
def("ConditionalExpression")
.bases("Expression")
.build("test", "consequent", "alternate")
.field("test", def("Expression"))
.field("consequent", def("Expression"))
.field("alternate", def("Expression"));
def("NewExpression")
.bases("Expression")
.build("callee", "arguments")
.field("callee", def("Expression"))
// The Mozilla Parser API gives this type as [or(def("Expression"),
// null)], but null values don't really make sense at the call site.
// TODO Report this nonsense.
.field("arguments", [def("Expression")]);
def("CallExpression")
.bases("Expression")
.build("callee", "arguments")
.field("callee", def("Expression"))
// See comment for NewExpression above.
.field("arguments", [def("Expression")]);
def("MemberExpression")
.bases("Expression")
.build("object", "property", "computed")
.field("object", def("Expression"))
.field("property", or(def("Identifier"), def("Expression")))
.field("computed", Boolean, function () {
var type = this.property.type;
if (type === 'Literal' ||
type === 'MemberExpression' ||
type === 'BinaryExpression') {
return true;
}
return false;
});
def("Pattern").bases("Node");
def("SwitchCase")
.bases("Node")
.build("test", "consequent")
.field("test", or(def("Expression"), null))
.field("consequent", [def("Statement")]);
def("Identifier")
.bases("Expression", "Pattern")
.build("name")
.field("name", String)
.field("optional", Boolean, defaults["false"]);
def("Literal")
.bases("Expression")
.build("value")
.field("value", or(String, Boolean, null, Number, RegExp))
.field("regex", or({
pattern: String,
flags: String
}, null), function () {
if (this.value instanceof RegExp) {
var flags = "";
if (this.value.ignoreCase)
flags += "i";
if (this.value.multiline)
flags += "m";
if (this.value.global)
flags += "g";
return {
pattern: this.value.source,
flags: flags
};
}
return null;
});
// Abstract (non-buildable) comment supertype. Not a Node.
def("Comment")
.bases("Printable")
.field("value", String)
// A .leading comment comes before the node, whereas a .trailing
// comment comes after it. These two fields should not both be true,
// but they might both be false when the comment falls inside a node
// and the node has no children for the comment to lead or trail,
// e.g. { /*dangling*/ }.
.field("leading", Boolean, defaults["true"])
.field("trailing", Boolean, defaults["false"]);
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es-proposals.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

40
node_modules/ast-types/def/es-proposals.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
var es2020_1 = tslib_1.__importDefault(require("./es2020"));
function default_1(fork) {
fork.use(es2020_1.default);
var types = fork.use(types_1.default);
var Type = types.Type;
var def = types.Type.def;
var or = Type.or;
var shared = fork.use(shared_1.default);
var defaults = shared.defaults;
def("AwaitExpression")
.build("argument", "all")
.field("argument", or(def("Expression"), null))
.field("all", Boolean, defaults["false"]);
// Decorators
def("Decorator")
.bases("Node")
.build("expression")
.field("expression", def("Expression"));
def("Property")
.field("decorators", or([def("Decorator")], null), defaults["null"]);
def("MethodDefinition")
.field("decorators", or([def("Decorator")], null), defaults["null"]);
// Private names
def("PrivateName")
.bases("Expression", "Pattern")
.build("id")
.field("id", def("Identifier"));
def("ClassPrivateProperty")
.bases("ClassProperty")
.build("key", "value")
.field("key", def("PrivateName"))
.field("value", or(def("Expression"), null), defaults["null"]);
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es2016.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

20
node_modules/ast-types/def/es2016.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_operators_1 = require("./core-operators");
var es6_1 = tslib_1.__importDefault(require("./es6"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
function default_1(fork) {
fork.use(es6_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var BinaryOperator = or.apply(void 0, tslib_1.__spreadArrays(core_operators_1.BinaryOperators, ["**"]));
def("BinaryExpression")
.field("operator", BinaryOperator);
var AssignmentOperator = or.apply(void 0, tslib_1.__spreadArrays(core_operators_1.AssignmentOperators, ["**="]));
def("AssignmentExpression")
.field("operator", AssignmentOperator);
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es2017.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

20
node_modules/ast-types/def/es2017.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es2016_1 = tslib_1.__importDefault(require("./es2016"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es2016_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var defaults = fork.use(shared_1.default).defaults;
def("Function")
.field("async", Boolean, defaults["false"]);
def("AwaitExpression")
.bases("Expression")
.build("argument")
.field("argument", def("Expression"));
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es2018.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

34
node_modules/ast-types/def/es2018.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es2017_1 = tslib_1.__importDefault(require("./es2017"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es2017_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("ForOfStatement")
.field("await", Boolean, defaults["false"]);
// Legacy
def("SpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ObjectExpression")
.field("properties", [or(def("Property"), def("SpreadProperty"), // Legacy
def("SpreadElement"))]);
def("TemplateElement")
.field("value", { "cooked": or(String, null), "raw": String });
// Legacy
def("SpreadPropertyPattern")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"));
def("ObjectPattern")
.field("properties", [or(def("PropertyPattern"), def("Property"), def("RestElement"), def("SpreadPropertyPattern"))]);
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es2019.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

17
node_modules/ast-types/def/es2019.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es2018_1 = tslib_1.__importDefault(require("./es2018"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es2018_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("CatchClause")
.field("param", or(def("Pattern"), null), defaults["null"]);
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es2020.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

50
node_modules/ast-types/def/es2020.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_operators_1 = require("./core-operators");
var es2019_1 = tslib_1.__importDefault(require("./es2019"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es2019_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var shared = fork.use(shared_1.default);
var defaults = shared.defaults;
def("ImportExpression")
.bases("Expression")
.build("source")
.field("source", def("Expression"));
def("ExportAllDeclaration")
.build("source", "exported")
.field("source", def("Literal"))
.field("exported", or(def("Identifier"), null));
// Optional chaining
def("ChainElement")
.bases("Node")
.field("optional", Boolean, defaults["false"]);
def("CallExpression")
.bases("Expression", "ChainElement");
def("MemberExpression")
.bases("Expression", "ChainElement");
def("ChainExpression")
.bases("Expression")
.build("expression")
.field("expression", def("ChainElement"));
def("OptionalCallExpression")
.bases("CallExpression")
.build("callee", "arguments", "optional")
.field("optional", Boolean, defaults["true"]);
// Deprecated optional chaining type, doesn't work with babelParser@7.11.0 or newer
def("OptionalMemberExpression")
.bases("MemberExpression")
.build("object", "property", "computed", "optional")
.field("optional", Boolean, defaults["true"]);
// Nullish coalescing
var LogicalOperator = or.apply(void 0, tslib_1.__spreadArrays(core_operators_1.LogicalOperators, ["??"]));
def("LogicalExpression")
.field("operator", LogicalOperator);
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/es6.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

236
node_modules/ast-types/def/es6.js generated vendored Normal file
View File

@@ -0,0 +1,236 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = tslib_1.__importDefault(require("./core"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(core_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("Function")
.field("generator", Boolean, defaults["false"])
.field("expression", Boolean, defaults["false"])
.field("defaults", [or(def("Expression"), null)], defaults.emptyArray)
// Legacy
.field("rest", or(def("Identifier"), null), defaults["null"]);
// The ESTree way of representing a ...rest parameter.
def("RestElement")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"))
.field("typeAnnotation", // for Babylon. Flow parser puts it on the identifier
or(def("TypeAnnotation"), def("TSTypeAnnotation"), null), defaults["null"]);
def("SpreadElementPattern")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"));
def("FunctionDeclaration")
.build("id", "params", "body", "generator", "expression")
// May be `null` in the context of `export default function () {}`
.field("id", or(def("Identifier"), null));
def("FunctionExpression")
.build("id", "params", "body", "generator", "expression");
def("ArrowFunctionExpression")
.bases("Function", "Expression")
.build("params", "body", "expression")
// The forced null value here is compatible with the overridden
// definition of the "id" field in the Function interface.
.field("id", null, defaults["null"])
// Arrow function bodies are allowed to be expressions.
.field("body", or(def("BlockStatement"), def("Expression")))
// The current spec forbids arrow generators, so I have taken the
// liberty of enforcing that. TODO Report this.
.field("generator", false, defaults["false"]);
def("ForOfStatement")
.bases("Statement")
.build("left", "right", "body")
.field("left", or(def("VariableDeclaration"), def("Pattern")))
.field("right", def("Expression"))
.field("body", def("Statement"));
def("YieldExpression")
.bases("Expression")
.build("argument", "delegate")
.field("argument", or(def("Expression"), null))
.field("delegate", Boolean, defaults["false"]);
def("GeneratorExpression")
.bases("Expression")
.build("body", "blocks", "filter")
.field("body", def("Expression"))
.field("blocks", [def("ComprehensionBlock")])
.field("filter", or(def("Expression"), null));
def("ComprehensionExpression")
.bases("Expression")
.build("body", "blocks", "filter")
.field("body", def("Expression"))
.field("blocks", [def("ComprehensionBlock")])
.field("filter", or(def("Expression"), null));
def("ComprehensionBlock")
.bases("Node")
.build("left", "right", "each")
.field("left", def("Pattern"))
.field("right", def("Expression"))
.field("each", Boolean);
def("Property")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("value", or(def("Expression"), def("Pattern")))
.field("method", Boolean, defaults["false"])
.field("shorthand", Boolean, defaults["false"])
.field("computed", Boolean, defaults["false"]);
def("ObjectProperty")
.field("shorthand", Boolean, defaults["false"]);
def("PropertyPattern")
.bases("Pattern")
.build("key", "pattern")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("pattern", def("Pattern"))
.field("computed", Boolean, defaults["false"]);
def("ObjectPattern")
.bases("Pattern")
.build("properties")
.field("properties", [or(def("PropertyPattern"), def("Property"))]);
def("ArrayPattern")
.bases("Pattern")
.build("elements")
.field("elements", [or(def("Pattern"), null)]);
def("SpreadElement")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ArrayExpression")
.field("elements", [or(def("Expression"), def("SpreadElement"), def("RestElement"), null)]);
def("NewExpression")
.field("arguments", [or(def("Expression"), def("SpreadElement"))]);
def("CallExpression")
.field("arguments", [or(def("Expression"), def("SpreadElement"))]);
// Note: this node type is *not* an AssignmentExpression with a Pattern on
// the left-hand side! The existing AssignmentExpression type already
// supports destructuring assignments. AssignmentPattern nodes may appear
// wherever a Pattern is allowed, and the right-hand side represents a
// default value to be destructured against the left-hand side, if no
// value is otherwise provided. For example: default parameter values.
def("AssignmentPattern")
.bases("Pattern")
.build("left", "right")
.field("left", def("Pattern"))
.field("right", def("Expression"));
def("MethodDefinition")
.bases("Declaration")
.build("kind", "key", "value", "static")
.field("kind", or("constructor", "method", "get", "set"))
.field("key", def("Expression"))
.field("value", def("Function"))
.field("computed", Boolean, defaults["false"])
.field("static", Boolean, defaults["false"]);
var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"));
def("ClassProperty")
.bases("Declaration")
.build("key")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("computed", Boolean, defaults["false"]);
def("ClassPropertyDefinition") // static property
.bases("Declaration")
.build("definition")
// Yes, Virginia, circular definitions are permitted.
.field("definition", ClassBodyElement);
def("ClassBody")
.bases("Declaration")
.build("body")
.field("body", [ClassBodyElement]);
def("ClassDeclaration")
.bases("Declaration")
.build("id", "body", "superClass")
.field("id", or(def("Identifier"), null))
.field("body", def("ClassBody"))
.field("superClass", or(def("Expression"), null), defaults["null"]);
def("ClassExpression")
.bases("Expression")
.build("id", "body", "superClass")
.field("id", or(def("Identifier"), null), defaults["null"])
.field("body", def("ClassBody"))
.field("superClass", or(def("Expression"), null), defaults["null"]);
def("Super")
.bases("Expression")
.build();
// Specifier and ModuleSpecifier are abstract non-standard types
// introduced for definitional convenience.
def("Specifier").bases("Node");
// This supertype is shared/abused by both def/babel.js and
// def/esprima.js. In the future, it will be possible to load only one set
// of definitions appropriate for a given parser, but until then we must
// rely on default functions to reconcile the conflicting AST formats.
def("ModuleSpecifier")
.bases("Specifier")
// This local field is used by Babel/Acorn. It should not technically
// be optional in the Babel/Acorn AST format, but it must be optional
// in the Esprima AST format.
.field("local", or(def("Identifier"), null), defaults["null"])
// The id and name fields are used by Esprima. The id field should not
// technically be optional in the Esprima AST format, but it must be
// optional in the Babel/Acorn AST format.
.field("id", or(def("Identifier"), null), defaults["null"])
.field("name", or(def("Identifier"), null), defaults["null"]);
// import {<id [as name]>} from ...;
def("ImportSpecifier")
.bases("ModuleSpecifier")
.build("imported", "local")
.field("imported", def("Identifier"));
// import <id> from ...;
def("ImportDefaultSpecifier")
.bases("ModuleSpecifier")
.build("local");
// import <* as id> from ...;
def("ImportNamespaceSpecifier")
.bases("ModuleSpecifier")
.build("local");
def("ImportDeclaration")
.bases("Declaration")
.build("specifiers", "source", "importKind")
.field("specifiers", [or(def("ImportSpecifier"), def("ImportNamespaceSpecifier"), def("ImportDefaultSpecifier"))], defaults.emptyArray)
.field("source", def("Literal"))
.field("importKind", or("value", "type"), function () {
return "value";
});
def("ExportNamedDeclaration")
.bases("Declaration")
.build("declaration", "specifiers", "source")
.field("declaration", or(def("Declaration"), null))
.field("specifiers", [def("ExportSpecifier")], defaults.emptyArray)
.field("source", or(def("Literal"), null), defaults["null"]);
def("ExportSpecifier")
.bases("ModuleSpecifier")
.build("local", "exported")
.field("exported", def("Identifier"));
def("ExportDefaultDeclaration")
.bases("Declaration")
.build("declaration")
.field("declaration", or(def("Declaration"), def("Expression")));
def("ExportAllDeclaration")
.bases("Declaration")
.build("source")
.field("source", def("Literal"));
def("TaggedTemplateExpression")
.bases("Expression")
.build("tag", "quasi")
.field("tag", def("Expression"))
.field("quasi", def("TemplateLiteral"));
def("TemplateLiteral")
.bases("Expression")
.build("quasis", "expressions")
.field("quasis", [def("TemplateElement")])
.field("expressions", [def("Expression")]);
def("TemplateElement")
.bases("Node")
.build("value", "tail")
.field("value", { "cooked": String, "raw": String })
.field("tail", Boolean);
def("MetaProperty")
.bases("Expression")
.build("meta", "property")
.field("meta", def("Identifier"))
.field("property", def("Identifier"));
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/esprima.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

49
node_modules/ast-types/def/esprima.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es2020_1 = tslib_1.__importDefault(require("./es2020"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es2020_1.default);
var types = fork.use(types_1.default);
var defaults = fork.use(shared_1.default).defaults;
var def = types.Type.def;
var or = types.Type.or;
def("VariableDeclaration")
.field("declarations", [or(def("VariableDeclarator"), def("Identifier") // Esprima deviation.
)]);
def("Property")
.field("value", or(def("Expression"), def("Pattern") // Esprima deviation.
));
def("ArrayPattern")
.field("elements", [or(def("Pattern"), def("SpreadElement"), null)]);
def("ObjectPattern")
.field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty") // Used by Esprima.
)]);
// Like ModuleSpecifier, except type:"ExportSpecifier" and buildable.
// export {<id [as name]>} [from ...];
def("ExportSpecifier")
.bases("ModuleSpecifier")
.build("id", "name");
// export <*> from ...;
def("ExportBatchSpecifier")
.bases("Specifier")
.build();
def("ExportDeclaration")
.bases("Declaration")
.build("default", "declaration", "specifiers", "source")
.field("default", Boolean)
.field("declaration", or(def("Declaration"), def("Expression"), // Implies default.
null))
.field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
.field("source", or(def("Literal"), null), defaults["null"]);
def("Block")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
def("Line")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/flow.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

349
node_modules/ast-types/def/flow.js generated vendored Normal file
View File

@@ -0,0 +1,349 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es_proposals_1 = tslib_1.__importDefault(require("./es-proposals"));
var type_annotations_1 = tslib_1.__importDefault(require("./type-annotations"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es_proposals_1.default);
fork.use(type_annotations_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
// Base types
def("Flow").bases("Node");
def("FlowType").bases("Flow");
// Type annotations
def("AnyTypeAnnotation")
.bases("FlowType")
.build();
def("EmptyTypeAnnotation")
.bases("FlowType")
.build();
def("MixedTypeAnnotation")
.bases("FlowType")
.build();
def("VoidTypeAnnotation")
.bases("FlowType")
.build();
def("SymbolTypeAnnotation")
.bases("FlowType")
.build();
def("NumberTypeAnnotation")
.bases("FlowType")
.build();
def("BigIntTypeAnnotation")
.bases("FlowType")
.build();
def("NumberLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", Number)
.field("raw", String);
// Babylon 6 differs in AST from Flow
// same as NumberLiteralTypeAnnotation
def("NumericLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", Number)
.field("raw", String);
def("BigIntLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", null)
.field("raw", String);
def("StringTypeAnnotation")
.bases("FlowType")
.build();
def("StringLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", String)
.field("raw", String);
def("BooleanTypeAnnotation")
.bases("FlowType")
.build();
def("BooleanLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", Boolean)
.field("raw", String);
def("TypeAnnotation")
.bases("Node")
.build("typeAnnotation")
.field("typeAnnotation", def("FlowType"));
def("NullableTypeAnnotation")
.bases("FlowType")
.build("typeAnnotation")
.field("typeAnnotation", def("FlowType"));
def("NullLiteralTypeAnnotation")
.bases("FlowType")
.build();
def("NullTypeAnnotation")
.bases("FlowType")
.build();
def("ThisTypeAnnotation")
.bases("FlowType")
.build();
def("ExistsTypeAnnotation")
.bases("FlowType")
.build();
def("ExistentialTypeParam")
.bases("FlowType")
.build();
def("FunctionTypeAnnotation")
.bases("FlowType")
.build("params", "returnType", "rest", "typeParameters")
.field("params", [def("FunctionTypeParam")])
.field("returnType", def("FlowType"))
.field("rest", or(def("FunctionTypeParam"), null))
.field("typeParameters", or(def("TypeParameterDeclaration"), null));
def("FunctionTypeParam")
.bases("Node")
.build("name", "typeAnnotation", "optional")
.field("name", or(def("Identifier"), null))
.field("typeAnnotation", def("FlowType"))
.field("optional", Boolean);
def("ArrayTypeAnnotation")
.bases("FlowType")
.build("elementType")
.field("elementType", def("FlowType"));
def("ObjectTypeAnnotation")
.bases("FlowType")
.build("properties", "indexers", "callProperties")
.field("properties", [
or(def("ObjectTypeProperty"), def("ObjectTypeSpreadProperty"))
])
.field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray)
.field("callProperties", [def("ObjectTypeCallProperty")], defaults.emptyArray)
.field("inexact", or(Boolean, void 0), defaults["undefined"])
.field("exact", Boolean, defaults["false"])
.field("internalSlots", [def("ObjectTypeInternalSlot")], defaults.emptyArray);
def("Variance")
.bases("Node")
.build("kind")
.field("kind", or("plus", "minus"));
var LegacyVariance = or(def("Variance"), "plus", "minus", null);
def("ObjectTypeProperty")
.bases("Node")
.build("key", "value", "optional")
.field("key", or(def("Literal"), def("Identifier")))
.field("value", def("FlowType"))
.field("optional", Boolean)
.field("variance", LegacyVariance, defaults["null"]);
def("ObjectTypeIndexer")
.bases("Node")
.build("id", "key", "value")
.field("id", def("Identifier"))
.field("key", def("FlowType"))
.field("value", def("FlowType"))
.field("variance", LegacyVariance, defaults["null"])
.field("static", Boolean, defaults["false"]);
def("ObjectTypeCallProperty")
.bases("Node")
.build("value")
.field("value", def("FunctionTypeAnnotation"))
.field("static", Boolean, defaults["false"]);
def("QualifiedTypeIdentifier")
.bases("Node")
.build("qualification", "id")
.field("qualification", or(def("Identifier"), def("QualifiedTypeIdentifier")))
.field("id", def("Identifier"));
def("GenericTypeAnnotation")
.bases("FlowType")
.build("id", "typeParameters")
.field("id", or(def("Identifier"), def("QualifiedTypeIdentifier")))
.field("typeParameters", or(def("TypeParameterInstantiation"), null));
def("MemberTypeAnnotation")
.bases("FlowType")
.build("object", "property")
.field("object", def("Identifier"))
.field("property", or(def("MemberTypeAnnotation"), def("GenericTypeAnnotation")));
def("UnionTypeAnnotation")
.bases("FlowType")
.build("types")
.field("types", [def("FlowType")]);
def("IntersectionTypeAnnotation")
.bases("FlowType")
.build("types")
.field("types", [def("FlowType")]);
def("TypeofTypeAnnotation")
.bases("FlowType")
.build("argument")
.field("argument", def("FlowType"));
def("ObjectTypeSpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("FlowType"));
def("ObjectTypeInternalSlot")
.bases("Node")
.build("id", "value", "optional", "static", "method")
.field("id", def("Identifier"))
.field("value", def("FlowType"))
.field("optional", Boolean)
.field("static", Boolean)
.field("method", Boolean);
def("TypeParameterDeclaration")
.bases("Node")
.build("params")
.field("params", [def("TypeParameter")]);
def("TypeParameterInstantiation")
.bases("Node")
.build("params")
.field("params", [def("FlowType")]);
def("TypeParameter")
.bases("FlowType")
.build("name", "variance", "bound", "default")
.field("name", String)
.field("variance", LegacyVariance, defaults["null"])
.field("bound", or(def("TypeAnnotation"), null), defaults["null"])
.field("default", or(def("FlowType"), null), defaults["null"]);
def("ClassProperty")
.field("variance", LegacyVariance, defaults["null"]);
def("ClassImplements")
.bases("Node")
.build("id")
.field("id", def("Identifier"))
.field("superClass", or(def("Expression"), null), defaults["null"])
.field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
def("InterfaceTypeAnnotation")
.bases("FlowType")
.build("body", "extends")
.field("body", def("ObjectTypeAnnotation"))
.field("extends", or([def("InterfaceExtends")], null), defaults["null"]);
def("InterfaceDeclaration")
.bases("Declaration")
.build("id", "body", "extends")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterDeclaration"), null), defaults["null"])
.field("body", def("ObjectTypeAnnotation"))
.field("extends", [def("InterfaceExtends")]);
def("DeclareInterface")
.bases("InterfaceDeclaration")
.build("id", "body", "extends");
def("InterfaceExtends")
.bases("Node")
.build("id")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
def("TypeAlias")
.bases("Declaration")
.build("id", "typeParameters", "right")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
.field("right", def("FlowType"));
def("DeclareTypeAlias")
.bases("TypeAlias")
.build("id", "typeParameters", "right");
def("OpaqueType")
.bases("Declaration")
.build("id", "typeParameters", "impltype", "supertype")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
.field("impltype", def("FlowType"))
.field("supertype", or(def("FlowType"), null));
def("DeclareOpaqueType")
.bases("OpaqueType")
.build("id", "typeParameters", "supertype")
.field("impltype", or(def("FlowType"), null));
def("TypeCastExpression")
.bases("Expression")
.build("expression", "typeAnnotation")
.field("expression", def("Expression"))
.field("typeAnnotation", def("TypeAnnotation"));
def("TupleTypeAnnotation")
.bases("FlowType")
.build("types")
.field("types", [def("FlowType")]);
def("DeclareVariable")
.bases("Statement")
.build("id")
.field("id", def("Identifier"));
def("DeclareFunction")
.bases("Statement")
.build("id")
.field("id", def("Identifier"))
.field("predicate", or(def("FlowPredicate"), null), defaults["null"]);
def("DeclareClass")
.bases("InterfaceDeclaration")
.build("id");
def("DeclareModule")
.bases("Statement")
.build("id", "body")
.field("id", or(def("Identifier"), def("Literal")))
.field("body", def("BlockStatement"));
def("DeclareModuleExports")
.bases("Statement")
.build("typeAnnotation")
.field("typeAnnotation", def("TypeAnnotation"));
def("DeclareExportDeclaration")
.bases("Declaration")
.build("default", "declaration", "specifiers", "source")
.field("default", Boolean)
.field("declaration", or(def("DeclareVariable"), def("DeclareFunction"), def("DeclareClass"), def("FlowType"), // Implies default.
def("TypeAlias"), // Implies named type
def("DeclareOpaqueType"), // Implies named opaque type
def("InterfaceDeclaration"), null))
.field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
.field("source", or(def("Literal"), null), defaults["null"]);
def("DeclareExportAllDeclaration")
.bases("Declaration")
.build("source")
.field("source", or(def("Literal"), null), defaults["null"]);
def("ImportDeclaration")
.field("importKind", or("value", "type", "typeof"), function () { return "value"; });
def("FlowPredicate").bases("Flow");
def("InferredPredicate")
.bases("FlowPredicate")
.build();
def("DeclaredPredicate")
.bases("FlowPredicate")
.build("value")
.field("value", def("Expression"));
def("Function")
.field("predicate", or(def("FlowPredicate"), null), defaults["null"]);
def("CallExpression")
.field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]);
def("NewExpression")
.field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]);
// Enums
def("EnumDeclaration")
.bases("Declaration")
.build("id", "body")
.field("id", def("Identifier"))
.field("body", or(def("EnumBooleanBody"), def("EnumNumberBody"), def("EnumStringBody"), def("EnumSymbolBody")));
def("EnumBooleanBody")
.build("members", "explicitType")
.field("members", [def("EnumBooleanMember")])
.field("explicitType", Boolean);
def("EnumNumberBody")
.build("members", "explicitType")
.field("members", [def("EnumNumberMember")])
.field("explicitType", Boolean);
def("EnumStringBody")
.build("members", "explicitType")
.field("members", or([def("EnumStringMember")], [def("EnumDefaultedMember")]))
.field("explicitType", Boolean);
def("EnumSymbolBody")
.build("members")
.field("members", [def("EnumDefaultedMember")]);
def("EnumBooleanMember")
.build("id", "init")
.field("id", def("Identifier"))
.field("init", or(def("Literal"), Boolean));
def("EnumNumberMember")
.build("id", "init")
.field("id", def("Identifier"))
.field("init", def("Literal"));
def("EnumStringMember")
.build("id", "init")
.field("id", def("Identifier"))
.field("init", def("Literal"));
def("EnumDefaultedMember")
.build("id")
.field("id", def("Identifier"));
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/jsx.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

108
node_modules/ast-types/def/jsx.js generated vendored Normal file
View File

@@ -0,0 +1,108 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var es2020_1 = tslib_1.__importDefault(require("./es2020"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
fork.use(es2020_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("JSXAttribute")
.bases("Node")
.build("name", "value")
.field("name", or(def("JSXIdentifier"), def("JSXNamespacedName")))
.field("value", or(def("Literal"), // attr="value"
def("JSXExpressionContainer"), // attr={value}
def("JSXElement"), // attr=<div />
def("JSXFragment"), // attr=<></>
null // attr= or just attr
), defaults["null"]);
def("JSXIdentifier")
.bases("Identifier")
.build("name")
.field("name", String);
def("JSXNamespacedName")
.bases("Node")
.build("namespace", "name")
.field("namespace", def("JSXIdentifier"))
.field("name", def("JSXIdentifier"));
def("JSXMemberExpression")
.bases("MemberExpression")
.build("object", "property")
.field("object", or(def("JSXIdentifier"), def("JSXMemberExpression")))
.field("property", def("JSXIdentifier"))
.field("computed", Boolean, defaults.false);
var JSXElementName = or(def("JSXIdentifier"), def("JSXNamespacedName"), def("JSXMemberExpression"));
def("JSXSpreadAttribute")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
var JSXAttributes = [or(def("JSXAttribute"), def("JSXSpreadAttribute"))];
def("JSXExpressionContainer")
.bases("Expression")
.build("expression")
.field("expression", or(def("Expression"), def("JSXEmptyExpression")));
var JSXChildren = [or(def("JSXText"), def("JSXExpressionContainer"), def("JSXSpreadChild"), def("JSXElement"), def("JSXFragment"), def("Literal") // Legacy: Esprima should return JSXText instead.
)];
def("JSXElement")
.bases("Expression")
.build("openingElement", "closingElement", "children")
.field("openingElement", def("JSXOpeningElement"))
.field("closingElement", or(def("JSXClosingElement"), null), defaults["null"])
.field("children", JSXChildren, defaults.emptyArray)
.field("name", JSXElementName, function () {
// Little-known fact: the `this` object inside a default function
// is none other than the partially-built object itself, and any
// fields initialized directly from builder function arguments
// (like openingElement, closingElement, and children) are
// guaranteed to be available.
return this.openingElement.name;
}, true) // hidden from traversal
.field("selfClosing", Boolean, function () {
return this.openingElement.selfClosing;
}, true) // hidden from traversal
.field("attributes", JSXAttributes, function () {
return this.openingElement.attributes;
}, true); // hidden from traversal
def("JSXOpeningElement")
.bases("Node")
.build("name", "attributes", "selfClosing")
.field("name", JSXElementName)
.field("attributes", JSXAttributes, defaults.emptyArray)
.field("selfClosing", Boolean, defaults["false"]);
def("JSXClosingElement")
.bases("Node")
.build("name")
.field("name", JSXElementName);
def("JSXFragment")
.bases("Expression")
.build("openingFragment", "closingFragment", "children")
.field("openingFragment", def("JSXOpeningFragment"))
.field("closingFragment", def("JSXClosingFragment"))
.field("children", JSXChildren, defaults.emptyArray);
def("JSXOpeningFragment")
.bases("Node")
.build();
def("JSXClosingFragment")
.bases("Node")
.build();
def("JSXText")
.bases("Literal")
.build("value", "raw")
.field("value", String)
.field("raw", String, function () {
return this.value;
});
def("JSXEmptyExpression")
.bases("Node")
.build();
def("JSXSpreadChild")
.bases("Node")
.build("expression")
.field("expression", def("Expression"));
}
exports.default = default_1;
module.exports = exports["default"];

7
node_modules/ast-types/def/type-annotations.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* Type annotation defs shared between Flow and TypeScript.
* These defs could not be defined in ./flow.ts or ./typescript.ts directly
* because they use the same name.
*/
import { Fork } from "../types";
export default function (fork: Fork): void;

40
node_modules/ast-types/def/type-annotations.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";;
/**
* Type annotation defs shared between Flow and TypeScript.
* These defs could not be defined in ./flow.ts or ./typescript.ts directly
* because they use the same name.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
def("Identifier")
.field("typeAnnotation", TypeAnnotation, defaults["null"]);
def("ObjectPattern")
.field("typeAnnotation", TypeAnnotation, defaults["null"]);
def("Function")
.field("returnType", TypeAnnotation, defaults["null"])
.field("typeParameters", TypeParamDecl, defaults["null"]);
def("ClassProperty")
.build("key", "value", "typeAnnotation", "static")
.field("value", or(def("Expression"), null))
.field("static", Boolean, defaults["false"])
.field("typeAnnotation", TypeAnnotation, defaults["null"]);
["ClassDeclaration",
"ClassExpression",
].forEach(function (typeName) {
def(typeName)
.field("typeParameters", TypeParamDecl, defaults["null"])
.field("superTypeParameters", or(def("TypeParameterInstantiation"), def("TSTypeParameterInstantiation"), null), defaults["null"])
.field("implements", or([def("ClassImplements")], [def("TSExpressionWithTypeArguments")]), defaults.emptyArray);
});
}
exports.default = default_1;
module.exports = exports["default"];

2
node_modules/ast-types/def/typescript.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Fork } from "../types";
export default function (fork: Fork): void;

344
node_modules/ast-types/def/typescript.js generated vendored Normal file
View File

@@ -0,0 +1,344 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var babel_core_1 = tslib_1.__importDefault(require("./babel-core"));
var type_annotations_1 = tslib_1.__importDefault(require("./type-annotations"));
var types_1 = tslib_1.__importDefault(require("../lib/types"));
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
function default_1(fork) {
// Since TypeScript is parsed by Babylon, include the core Babylon types
// but omit the Flow-related types.
fork.use(babel_core_1.default);
fork.use(type_annotations_1.default);
var types = fork.use(types_1.default);
var n = types.namedTypes;
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
var StringLiteral = types.Type.from(function (value, deep) {
if (n.StringLiteral &&
n.StringLiteral.check(value, deep)) {
return true;
}
if (n.Literal &&
n.Literal.check(value, deep) &&
typeof value.value === "string") {
return true;
}
return false;
}, "StringLiteral");
def("TSType")
.bases("Node");
var TSEntityName = or(def("Identifier"), def("TSQualifiedName"));
def("TSTypeReference")
.bases("TSType", "TSHasOptionalTypeParameterInstantiation")
.build("typeName", "typeParameters")
.field("typeName", TSEntityName);
// An abstract (non-buildable) base type that provide a commonly-needed
// optional .typeParameters field.
def("TSHasOptionalTypeParameterInstantiation")
.field("typeParameters", or(def("TSTypeParameterInstantiation"), null), defaults["null"]);
// An abstract (non-buildable) base type that provide a commonly-needed
// optional .typeParameters field.
def("TSHasOptionalTypeParameters")
.field("typeParameters", or(def("TSTypeParameterDeclaration"), null, void 0), defaults["null"]);
// An abstract (non-buildable) base type that provide a commonly-needed
// optional .typeAnnotation field.
def("TSHasOptionalTypeAnnotation")
.field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"]);
def("TSQualifiedName")
.bases("Node")
.build("left", "right")
.field("left", TSEntityName)
.field("right", TSEntityName);
def("TSAsExpression")
.bases("Expression", "Pattern")
.build("expression", "typeAnnotation")
.field("expression", def("Expression"))
.field("typeAnnotation", def("TSType"))
.field("extra", or({ parenthesized: Boolean }, null), defaults["null"]);
def("TSNonNullExpression")
.bases("Expression", "Pattern")
.build("expression")
.field("expression", def("Expression"));
[
"TSAnyKeyword",
"TSBigIntKeyword",
"TSBooleanKeyword",
"TSNeverKeyword",
"TSNullKeyword",
"TSNumberKeyword",
"TSObjectKeyword",
"TSStringKeyword",
"TSSymbolKeyword",
"TSUndefinedKeyword",
"TSUnknownKeyword",
"TSVoidKeyword",
"TSThisType",
].forEach(function (keywordType) {
def(keywordType)
.bases("TSType")
.build();
});
def("TSArrayType")
.bases("TSType")
.build("elementType")
.field("elementType", def("TSType"));
def("TSLiteralType")
.bases("TSType")
.build("literal")
.field("literal", or(def("NumericLiteral"), def("StringLiteral"), def("BooleanLiteral"), def("TemplateLiteral"), def("UnaryExpression")));
["TSUnionType",
"TSIntersectionType",
].forEach(function (typeName) {
def(typeName)
.bases("TSType")
.build("types")
.field("types", [def("TSType")]);
});
def("TSConditionalType")
.bases("TSType")
.build("checkType", "extendsType", "trueType", "falseType")
.field("checkType", def("TSType"))
.field("extendsType", def("TSType"))
.field("trueType", def("TSType"))
.field("falseType", def("TSType"));
def("TSInferType")
.bases("TSType")
.build("typeParameter")
.field("typeParameter", def("TSTypeParameter"));
def("TSParenthesizedType")
.bases("TSType")
.build("typeAnnotation")
.field("typeAnnotation", def("TSType"));
var ParametersType = [or(def("Identifier"), def("RestElement"), def("ArrayPattern"), def("ObjectPattern"))];
["TSFunctionType",
"TSConstructorType",
].forEach(function (typeName) {
def(typeName)
.bases("TSType", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
.build("parameters")
.field("parameters", ParametersType);
});
def("TSDeclareFunction")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("id", "params", "returnType")
.field("declare", Boolean, defaults["false"])
.field("async", Boolean, defaults["false"])
.field("generator", Boolean, defaults["false"])
.field("id", or(def("Identifier"), null), defaults["null"])
.field("params", [def("Pattern")])
// tSFunctionTypeAnnotationCommon
.field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used?
null), defaults["null"]);
def("TSDeclareMethod")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("key", "params", "returnType")
.field("async", Boolean, defaults["false"])
.field("generator", Boolean, defaults["false"])
.field("params", [def("Pattern")])
// classMethodOrPropertyCommon
.field("abstract", Boolean, defaults["false"])
.field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"])
.field("static", Boolean, defaults["false"])
.field("computed", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("key", or(def("Identifier"), def("StringLiteral"), def("NumericLiteral"),
// Only allowed if .computed is true.
def("Expression")))
// classMethodOrDeclareMethodCommon
.field("kind", or("get", "set", "method", "constructor"), function getDefault() { return "method"; })
.field("access", // Not "accessibility"?
or("public", "private", "protected", void 0), defaults["undefined"])
.field("decorators", or([def("Decorator")], null), defaults["null"])
// tSFunctionTypeAnnotationCommon
.field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used?
null), defaults["null"]);
def("TSMappedType")
.bases("TSType")
.build("typeParameter", "typeAnnotation")
.field("readonly", or(Boolean, "+", "-"), defaults["false"])
.field("typeParameter", def("TSTypeParameter"))
.field("optional", or(Boolean, "+", "-"), defaults["false"])
.field("typeAnnotation", or(def("TSType"), null), defaults["null"]);
def("TSTupleType")
.bases("TSType")
.build("elementTypes")
.field("elementTypes", [or(def("TSType"), def("TSNamedTupleMember"))]);
def("TSNamedTupleMember")
.bases("TSType")
.build("label", "elementType", "optional")
.field("label", def("Identifier"))
.field("optional", Boolean, defaults["false"])
.field("elementType", def("TSType"));
def("TSRestType")
.bases("TSType")
.build("typeAnnotation")
.field("typeAnnotation", def("TSType"));
def("TSOptionalType")
.bases("TSType")
.build("typeAnnotation")
.field("typeAnnotation", def("TSType"));
def("TSIndexedAccessType")
.bases("TSType")
.build("objectType", "indexType")
.field("objectType", def("TSType"))
.field("indexType", def("TSType"));
def("TSTypeOperator")
.bases("TSType")
.build("operator")
.field("operator", String)
.field("typeAnnotation", def("TSType"));
def("TSTypeAnnotation")
.bases("Node")
.build("typeAnnotation")
.field("typeAnnotation", or(def("TSType"), def("TSTypeAnnotation")));
def("TSIndexSignature")
.bases("Declaration", "TSHasOptionalTypeAnnotation")
.build("parameters", "typeAnnotation")
.field("parameters", [def("Identifier")]) // Length === 1
.field("readonly", Boolean, defaults["false"]);
def("TSPropertySignature")
.bases("Declaration", "TSHasOptionalTypeAnnotation")
.build("key", "typeAnnotation", "optional")
.field("key", def("Expression"))
.field("computed", Boolean, defaults["false"])
.field("readonly", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("initializer", or(def("Expression"), null), defaults["null"]);
def("TSMethodSignature")
.bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
.build("key", "parameters", "typeAnnotation")
.field("key", def("Expression"))
.field("computed", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("parameters", ParametersType);
def("TSTypePredicate")
.bases("TSTypeAnnotation", "TSType")
.build("parameterName", "typeAnnotation", "asserts")
.field("parameterName", or(def("Identifier"), def("TSThisType")))
.field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"])
.field("asserts", Boolean, defaults["false"]);
["TSCallSignatureDeclaration",
"TSConstructSignatureDeclaration",
].forEach(function (typeName) {
def(typeName)
.bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
.build("parameters", "typeAnnotation")
.field("parameters", ParametersType);
});
def("TSEnumMember")
.bases("Node")
.build("id", "initializer")
.field("id", or(def("Identifier"), StringLiteral))
.field("initializer", or(def("Expression"), null), defaults["null"]);
def("TSTypeQuery")
.bases("TSType")
.build("exprName")
.field("exprName", or(TSEntityName, def("TSImportType")));
// Inferred from Babylon's tsParseTypeMember method.
var TSTypeMember = or(def("TSCallSignatureDeclaration"), def("TSConstructSignatureDeclaration"), def("TSIndexSignature"), def("TSMethodSignature"), def("TSPropertySignature"));
def("TSTypeLiteral")
.bases("TSType")
.build("members")
.field("members", [TSTypeMember]);
def("TSTypeParameter")
.bases("Identifier")
.build("name", "constraint", "default")
.field("name", String)
.field("constraint", or(def("TSType"), void 0), defaults["undefined"])
.field("default", or(def("TSType"), void 0), defaults["undefined"]);
def("TSTypeAssertion")
.bases("Expression", "Pattern")
.build("typeAnnotation", "expression")
.field("typeAnnotation", def("TSType"))
.field("expression", def("Expression"))
.field("extra", or({ parenthesized: Boolean }, null), defaults["null"]);
def("TSTypeParameterDeclaration")
.bases("Declaration")
.build("params")
.field("params", [def("TSTypeParameter")]);
def("TSTypeParameterInstantiation")
.bases("Node")
.build("params")
.field("params", [def("TSType")]);
def("TSEnumDeclaration")
.bases("Declaration")
.build("id", "members")
.field("id", def("Identifier"))
.field("const", Boolean, defaults["false"])
.field("declare", Boolean, defaults["false"])
.field("members", [def("TSEnumMember")])
.field("initializer", or(def("Expression"), null), defaults["null"]);
def("TSTypeAliasDeclaration")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("id", "typeAnnotation")
.field("id", def("Identifier"))
.field("declare", Boolean, defaults["false"])
.field("typeAnnotation", def("TSType"));
def("TSModuleBlock")
.bases("Node")
.build("body")
.field("body", [def("Statement")]);
def("TSModuleDeclaration")
.bases("Declaration")
.build("id", "body")
.field("id", or(StringLiteral, TSEntityName))
.field("declare", Boolean, defaults["false"])
.field("global", Boolean, defaults["false"])
.field("body", or(def("TSModuleBlock"), def("TSModuleDeclaration"), null), defaults["null"]);
def("TSImportType")
.bases("TSType", "TSHasOptionalTypeParameterInstantiation")
.build("argument", "qualifier", "typeParameters")
.field("argument", StringLiteral)
.field("qualifier", or(TSEntityName, void 0), defaults["undefined"]);
def("TSImportEqualsDeclaration")
.bases("Declaration")
.build("id", "moduleReference")
.field("id", def("Identifier"))
.field("isExport", Boolean, defaults["false"])
.field("moduleReference", or(TSEntityName, def("TSExternalModuleReference")));
def("TSExternalModuleReference")
.bases("Declaration")
.build("expression")
.field("expression", StringLiteral);
def("TSExportAssignment")
.bases("Statement")
.build("expression")
.field("expression", def("Expression"));
def("TSNamespaceExportDeclaration")
.bases("Declaration")
.build("id")
.field("id", def("Identifier"));
def("TSInterfaceBody")
.bases("Node")
.build("body")
.field("body", [TSTypeMember]);
def("TSExpressionWithTypeArguments")
.bases("TSType", "TSHasOptionalTypeParameterInstantiation")
.build("expression", "typeParameters")
.field("expression", TSEntityName);
def("TSInterfaceDeclaration")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("id", "body")
.field("id", TSEntityName)
.field("declare", Boolean, defaults["false"])
.field("extends", or([def("TSExpressionWithTypeArguments")], null), defaults["null"])
.field("body", def("TSInterfaceBody"));
def("TSParameterProperty")
.bases("Pattern")
.build("parameter")
.field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"])
.field("readonly", Boolean, defaults["false"])
.field("parameter", or(def("Identifier"), def("AssignmentPattern")));
def("ClassProperty")
.field("access", // Not "accessibility"?
or("public", "private", "protected", void 0), defaults["undefined"]);
// Defined already in es6 and babel-core.
def("ClassBody")
.field("body", [or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"),
// Just need to add these types:
def("TSDeclareMethod"), TSTypeMember)]);
}
exports.default = default_1;
module.exports = exports["default"];

42
node_modules/ast-types/fork.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import { Def, Plugin } from "./types";
export default function (defs: Def[]): {
Type: {
or(...types: any[]): import("./lib/types").Type<any>;
from<T>(value: any, name?: string | undefined): import("./lib/types").Type<T>;
def(typeName: string): import("./lib/types").Def<any>;
hasDef(typeName: string): boolean;
};
builtInTypes: {
string: import("./lib/types").Type<string>;
function: import("./lib/types").Type<Function>;
array: import("./lib/types").Type<any[]>;
object: import("./lib/types").Type<{
[key: string]: any;
}>;
RegExp: import("./lib/types").Type<RegExp>;
Date: import("./lib/types").Type<Date>;
number: import("./lib/types").Type<number>;
boolean: import("./lib/types").Type<boolean>;
null: import("./lib/types").Type<null>;
undefined: import("./lib/types").Type<undefined>;
};
namedTypes: import("./gen/namedTypes").NamedTypes;
builders: import("./gen/builders").builders;
defineMethod: (name: any, func?: Function | undefined) => Function;
getFieldNames: (object: any) => string[];
getFieldValue: (object: any, fieldName: any) => any;
eachField: (object: any, callback: (name: any, value: any) => any, context?: any) => void;
someField: (object: any, callback: (name: any, value: any) => any, context?: any) => boolean;
getSupertypeNames: (typeName: string) => string[];
getBuilderName: (typeName: any) => any;
astNodesAreEquivalent: {
(a: any, b: any, problemPath?: any): boolean;
assert(a: any, b: any): void;
};
finalize: () => void;
Path: import("./lib/path").PathConstructor;
NodePath: import("./lib/node-path").NodePathConstructor;
PathVisitor: import("./lib/path-visitor").PathVisitorConstructor;
use: <T_1>(plugin: Plugin<T_1>) => T_1;
visit: <M = {}>(node: import("./lib/types").ASTNode, methods?: import("./main").Visitor<M> | undefined) => any;
};

52
node_modules/ast-types/fork.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = tslib_1.__importDefault(require("./lib/types"));
var path_visitor_1 = tslib_1.__importDefault(require("./lib/path-visitor"));
var equiv_1 = tslib_1.__importDefault(require("./lib/equiv"));
var path_1 = tslib_1.__importDefault(require("./lib/path"));
var node_path_1 = tslib_1.__importDefault(require("./lib/node-path"));
function default_1(defs) {
var fork = createFork();
var types = fork.use(types_1.default);
defs.forEach(fork.use);
types.finalize();
var PathVisitor = fork.use(path_visitor_1.default);
return {
Type: types.Type,
builtInTypes: types.builtInTypes,
namedTypes: types.namedTypes,
builders: types.builders,
defineMethod: types.defineMethod,
getFieldNames: types.getFieldNames,
getFieldValue: types.getFieldValue,
eachField: types.eachField,
someField: types.someField,
getSupertypeNames: types.getSupertypeNames,
getBuilderName: types.getBuilderName,
astNodesAreEquivalent: fork.use(equiv_1.default),
finalize: types.finalize,
Path: fork.use(path_1.default),
NodePath: fork.use(node_path_1.default),
PathVisitor: PathVisitor,
use: fork.use,
visit: PathVisitor.visit,
};
}
exports.default = default_1;
function createFork() {
var used = [];
var usedResult = [];
function use(plugin) {
var idx = used.indexOf(plugin);
if (idx === -1) {
idx = used.length;
used.push(plugin);
usedResult[idx] = plugin(fork);
}
return usedResult[idx];
}
var fork = { use: use };
return fork;
}
module.exports = exports["default"];

2706
node_modules/ast-types/gen/builders.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

2
node_modules/ast-types/gen/builders.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

278
node_modules/ast-types/gen/kinds.d.ts generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/ast-types/gen/kinds.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

1905
node_modules/ast-types/gen/namedTypes.d.ts generated vendored Normal file

File diff suppressed because one or more lines are too long

6
node_modules/ast-types/gen/namedTypes.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.namedTypes = void 0;
var namedTypes;
(function (namedTypes) {
})(namedTypes = exports.namedTypes || (exports.namedTypes = {}));

282
node_modules/ast-types/gen/visitor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,282 @@
import { NodePath } from "../lib/node-path";
import { Context } from "../lib/path-visitor";
import { namedTypes } from "./namedTypes";
export interface Visitor<M = {}> {
visitPrintable?(this: Context & M, path: NodePath<namedTypes.Printable>): any;
visitSourceLocation?(this: Context & M, path: NodePath<namedTypes.SourceLocation>): any;
visitNode?(this: Context & M, path: NodePath<namedTypes.Node>): any;
visitComment?(this: Context & M, path: NodePath<namedTypes.Comment>): any;
visitPosition?(this: Context & M, path: NodePath<namedTypes.Position>): any;
visitFile?(this: Context & M, path: NodePath<namedTypes.File>): any;
visitProgram?(this: Context & M, path: NodePath<namedTypes.Program>): any;
visitStatement?(this: Context & M, path: NodePath<namedTypes.Statement>): any;
visitFunction?(this: Context & M, path: NodePath<namedTypes.Function>): any;
visitExpression?(this: Context & M, path: NodePath<namedTypes.Expression>): any;
visitPattern?(this: Context & M, path: NodePath<namedTypes.Pattern>): any;
visitIdentifier?(this: Context & M, path: NodePath<namedTypes.Identifier>): any;
visitBlockStatement?(this: Context & M, path: NodePath<namedTypes.BlockStatement>): any;
visitEmptyStatement?(this: Context & M, path: NodePath<namedTypes.EmptyStatement>): any;
visitExpressionStatement?(this: Context & M, path: NodePath<namedTypes.ExpressionStatement>): any;
visitIfStatement?(this: Context & M, path: NodePath<namedTypes.IfStatement>): any;
visitLabeledStatement?(this: Context & M, path: NodePath<namedTypes.LabeledStatement>): any;
visitBreakStatement?(this: Context & M, path: NodePath<namedTypes.BreakStatement>): any;
visitContinueStatement?(this: Context & M, path: NodePath<namedTypes.ContinueStatement>): any;
visitWithStatement?(this: Context & M, path: NodePath<namedTypes.WithStatement>): any;
visitSwitchStatement?(this: Context & M, path: NodePath<namedTypes.SwitchStatement>): any;
visitSwitchCase?(this: Context & M, path: NodePath<namedTypes.SwitchCase>): any;
visitReturnStatement?(this: Context & M, path: NodePath<namedTypes.ReturnStatement>): any;
visitThrowStatement?(this: Context & M, path: NodePath<namedTypes.ThrowStatement>): any;
visitTryStatement?(this: Context & M, path: NodePath<namedTypes.TryStatement>): any;
visitCatchClause?(this: Context & M, path: NodePath<namedTypes.CatchClause>): any;
visitWhileStatement?(this: Context & M, path: NodePath<namedTypes.WhileStatement>): any;
visitDoWhileStatement?(this: Context & M, path: NodePath<namedTypes.DoWhileStatement>): any;
visitForStatement?(this: Context & M, path: NodePath<namedTypes.ForStatement>): any;
visitDeclaration?(this: Context & M, path: NodePath<namedTypes.Declaration>): any;
visitVariableDeclaration?(this: Context & M, path: NodePath<namedTypes.VariableDeclaration>): any;
visitForInStatement?(this: Context & M, path: NodePath<namedTypes.ForInStatement>): any;
visitDebuggerStatement?(this: Context & M, path: NodePath<namedTypes.DebuggerStatement>): any;
visitFunctionDeclaration?(this: Context & M, path: NodePath<namedTypes.FunctionDeclaration>): any;
visitFunctionExpression?(this: Context & M, path: NodePath<namedTypes.FunctionExpression>): any;
visitVariableDeclarator?(this: Context & M, path: NodePath<namedTypes.VariableDeclarator>): any;
visitThisExpression?(this: Context & M, path: NodePath<namedTypes.ThisExpression>): any;
visitArrayExpression?(this: Context & M, path: NodePath<namedTypes.ArrayExpression>): any;
visitObjectExpression?(this: Context & M, path: NodePath<namedTypes.ObjectExpression>): any;
visitProperty?(this: Context & M, path: NodePath<namedTypes.Property>): any;
visitLiteral?(this: Context & M, path: NodePath<namedTypes.Literal>): any;
visitSequenceExpression?(this: Context & M, path: NodePath<namedTypes.SequenceExpression>): any;
visitUnaryExpression?(this: Context & M, path: NodePath<namedTypes.UnaryExpression>): any;
visitBinaryExpression?(this: Context & M, path: NodePath<namedTypes.BinaryExpression>): any;
visitAssignmentExpression?(this: Context & M, path: NodePath<namedTypes.AssignmentExpression>): any;
visitChainElement?(this: Context & M, path: NodePath<namedTypes.ChainElement>): any;
visitMemberExpression?(this: Context & M, path: NodePath<namedTypes.MemberExpression>): any;
visitUpdateExpression?(this: Context & M, path: NodePath<namedTypes.UpdateExpression>): any;
visitLogicalExpression?(this: Context & M, path: NodePath<namedTypes.LogicalExpression>): any;
visitConditionalExpression?(this: Context & M, path: NodePath<namedTypes.ConditionalExpression>): any;
visitNewExpression?(this: Context & M, path: NodePath<namedTypes.NewExpression>): any;
visitCallExpression?(this: Context & M, path: NodePath<namedTypes.CallExpression>): any;
visitRestElement?(this: Context & M, path: NodePath<namedTypes.RestElement>): any;
visitTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.TypeAnnotation>): any;
visitTSTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.TSTypeAnnotation>): any;
visitSpreadElementPattern?(this: Context & M, path: NodePath<namedTypes.SpreadElementPattern>): any;
visitArrowFunctionExpression?(this: Context & M, path: NodePath<namedTypes.ArrowFunctionExpression>): any;
visitForOfStatement?(this: Context & M, path: NodePath<namedTypes.ForOfStatement>): any;
visitYieldExpression?(this: Context & M, path: NodePath<namedTypes.YieldExpression>): any;
visitGeneratorExpression?(this: Context & M, path: NodePath<namedTypes.GeneratorExpression>): any;
visitComprehensionBlock?(this: Context & M, path: NodePath<namedTypes.ComprehensionBlock>): any;
visitComprehensionExpression?(this: Context & M, path: NodePath<namedTypes.ComprehensionExpression>): any;
visitObjectProperty?(this: Context & M, path: NodePath<namedTypes.ObjectProperty>): any;
visitPropertyPattern?(this: Context & M, path: NodePath<namedTypes.PropertyPattern>): any;
visitObjectPattern?(this: Context & M, path: NodePath<namedTypes.ObjectPattern>): any;
visitArrayPattern?(this: Context & M, path: NodePath<namedTypes.ArrayPattern>): any;
visitSpreadElement?(this: Context & M, path: NodePath<namedTypes.SpreadElement>): any;
visitAssignmentPattern?(this: Context & M, path: NodePath<namedTypes.AssignmentPattern>): any;
visitMethodDefinition?(this: Context & M, path: NodePath<namedTypes.MethodDefinition>): any;
visitClassPropertyDefinition?(this: Context & M, path: NodePath<namedTypes.ClassPropertyDefinition>): any;
visitClassProperty?(this: Context & M, path: NodePath<namedTypes.ClassProperty>): any;
visitClassBody?(this: Context & M, path: NodePath<namedTypes.ClassBody>): any;
visitClassDeclaration?(this: Context & M, path: NodePath<namedTypes.ClassDeclaration>): any;
visitClassExpression?(this: Context & M, path: NodePath<namedTypes.ClassExpression>): any;
visitSuper?(this: Context & M, path: NodePath<namedTypes.Super>): any;
visitSpecifier?(this: Context & M, path: NodePath<namedTypes.Specifier>): any;
visitModuleSpecifier?(this: Context & M, path: NodePath<namedTypes.ModuleSpecifier>): any;
visitImportSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportSpecifier>): any;
visitImportDefaultSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportDefaultSpecifier>): any;
visitImportNamespaceSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportNamespaceSpecifier>): any;
visitImportDeclaration?(this: Context & M, path: NodePath<namedTypes.ImportDeclaration>): any;
visitExportNamedDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportNamedDeclaration>): any;
visitExportSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportSpecifier>): any;
visitExportDefaultDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportDefaultDeclaration>): any;
visitExportAllDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportAllDeclaration>): any;
visitTaggedTemplateExpression?(this: Context & M, path: NodePath<namedTypes.TaggedTemplateExpression>): any;
visitTemplateLiteral?(this: Context & M, path: NodePath<namedTypes.TemplateLiteral>): any;
visitTemplateElement?(this: Context & M, path: NodePath<namedTypes.TemplateElement>): any;
visitMetaProperty?(this: Context & M, path: NodePath<namedTypes.MetaProperty>): any;
visitAwaitExpression?(this: Context & M, path: NodePath<namedTypes.AwaitExpression>): any;
visitSpreadProperty?(this: Context & M, path: NodePath<namedTypes.SpreadProperty>): any;
visitSpreadPropertyPattern?(this: Context & M, path: NodePath<namedTypes.SpreadPropertyPattern>): any;
visitImportExpression?(this: Context & M, path: NodePath<namedTypes.ImportExpression>): any;
visitChainExpression?(this: Context & M, path: NodePath<namedTypes.ChainExpression>): any;
visitOptionalCallExpression?(this: Context & M, path: NodePath<namedTypes.OptionalCallExpression>): any;
visitOptionalMemberExpression?(this: Context & M, path: NodePath<namedTypes.OptionalMemberExpression>): any;
visitJSXAttribute?(this: Context & M, path: NodePath<namedTypes.JSXAttribute>): any;
visitJSXIdentifier?(this: Context & M, path: NodePath<namedTypes.JSXIdentifier>): any;
visitJSXNamespacedName?(this: Context & M, path: NodePath<namedTypes.JSXNamespacedName>): any;
visitJSXExpressionContainer?(this: Context & M, path: NodePath<namedTypes.JSXExpressionContainer>): any;
visitJSXElement?(this: Context & M, path: NodePath<namedTypes.JSXElement>): any;
visitJSXFragment?(this: Context & M, path: NodePath<namedTypes.JSXFragment>): any;
visitJSXMemberExpression?(this: Context & M, path: NodePath<namedTypes.JSXMemberExpression>): any;
visitJSXSpreadAttribute?(this: Context & M, path: NodePath<namedTypes.JSXSpreadAttribute>): any;
visitJSXEmptyExpression?(this: Context & M, path: NodePath<namedTypes.JSXEmptyExpression>): any;
visitJSXText?(this: Context & M, path: NodePath<namedTypes.JSXText>): any;
visitJSXSpreadChild?(this: Context & M, path: NodePath<namedTypes.JSXSpreadChild>): any;
visitJSXOpeningElement?(this: Context & M, path: NodePath<namedTypes.JSXOpeningElement>): any;
visitJSXClosingElement?(this: Context & M, path: NodePath<namedTypes.JSXClosingElement>): any;
visitJSXOpeningFragment?(this: Context & M, path: NodePath<namedTypes.JSXOpeningFragment>): any;
visitJSXClosingFragment?(this: Context & M, path: NodePath<namedTypes.JSXClosingFragment>): any;
visitDecorator?(this: Context & M, path: NodePath<namedTypes.Decorator>): any;
visitPrivateName?(this: Context & M, path: NodePath<namedTypes.PrivateName>): any;
visitClassPrivateProperty?(this: Context & M, path: NodePath<namedTypes.ClassPrivateProperty>): any;
visitTypeParameterDeclaration?(this: Context & M, path: NodePath<namedTypes.TypeParameterDeclaration>): any;
visitTSTypeParameterDeclaration?(this: Context & M, path: NodePath<namedTypes.TSTypeParameterDeclaration>): any;
visitTypeParameterInstantiation?(this: Context & M, path: NodePath<namedTypes.TypeParameterInstantiation>): any;
visitTSTypeParameterInstantiation?(this: Context & M, path: NodePath<namedTypes.TSTypeParameterInstantiation>): any;
visitClassImplements?(this: Context & M, path: NodePath<namedTypes.ClassImplements>): any;
visitTSType?(this: Context & M, path: NodePath<namedTypes.TSType>): any;
visitTSHasOptionalTypeParameterInstantiation?(this: Context & M, path: NodePath<namedTypes.TSHasOptionalTypeParameterInstantiation>): any;
visitTSExpressionWithTypeArguments?(this: Context & M, path: NodePath<namedTypes.TSExpressionWithTypeArguments>): any;
visitFlow?(this: Context & M, path: NodePath<namedTypes.Flow>): any;
visitFlowType?(this: Context & M, path: NodePath<namedTypes.FlowType>): any;
visitAnyTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.AnyTypeAnnotation>): any;
visitEmptyTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.EmptyTypeAnnotation>): any;
visitMixedTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.MixedTypeAnnotation>): any;
visitVoidTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.VoidTypeAnnotation>): any;
visitSymbolTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.SymbolTypeAnnotation>): any;
visitNumberTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NumberTypeAnnotation>): any;
visitBigIntTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BigIntTypeAnnotation>): any;
visitNumberLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NumberLiteralTypeAnnotation>): any;
visitNumericLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NumericLiteralTypeAnnotation>): any;
visitBigIntLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BigIntLiteralTypeAnnotation>): any;
visitStringTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.StringTypeAnnotation>): any;
visitStringLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.StringLiteralTypeAnnotation>): any;
visitBooleanTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BooleanTypeAnnotation>): any;
visitBooleanLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BooleanLiteralTypeAnnotation>): any;
visitNullableTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NullableTypeAnnotation>): any;
visitNullLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NullLiteralTypeAnnotation>): any;
visitNullTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NullTypeAnnotation>): any;
visitThisTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.ThisTypeAnnotation>): any;
visitExistsTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.ExistsTypeAnnotation>): any;
visitExistentialTypeParam?(this: Context & M, path: NodePath<namedTypes.ExistentialTypeParam>): any;
visitFunctionTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.FunctionTypeAnnotation>): any;
visitFunctionTypeParam?(this: Context & M, path: NodePath<namedTypes.FunctionTypeParam>): any;
visitArrayTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.ArrayTypeAnnotation>): any;
visitObjectTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.ObjectTypeAnnotation>): any;
visitObjectTypeProperty?(this: Context & M, path: NodePath<namedTypes.ObjectTypeProperty>): any;
visitObjectTypeSpreadProperty?(this: Context & M, path: NodePath<namedTypes.ObjectTypeSpreadProperty>): any;
visitObjectTypeIndexer?(this: Context & M, path: NodePath<namedTypes.ObjectTypeIndexer>): any;
visitObjectTypeCallProperty?(this: Context & M, path: NodePath<namedTypes.ObjectTypeCallProperty>): any;
visitObjectTypeInternalSlot?(this: Context & M, path: NodePath<namedTypes.ObjectTypeInternalSlot>): any;
visitVariance?(this: Context & M, path: NodePath<namedTypes.Variance>): any;
visitQualifiedTypeIdentifier?(this: Context & M, path: NodePath<namedTypes.QualifiedTypeIdentifier>): any;
visitGenericTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.GenericTypeAnnotation>): any;
visitMemberTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.MemberTypeAnnotation>): any;
visitUnionTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.UnionTypeAnnotation>): any;
visitIntersectionTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.IntersectionTypeAnnotation>): any;
visitTypeofTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.TypeofTypeAnnotation>): any;
visitTypeParameter?(this: Context & M, path: NodePath<namedTypes.TypeParameter>): any;
visitInterfaceTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.InterfaceTypeAnnotation>): any;
visitInterfaceExtends?(this: Context & M, path: NodePath<namedTypes.InterfaceExtends>): any;
visitInterfaceDeclaration?(this: Context & M, path: NodePath<namedTypes.InterfaceDeclaration>): any;
visitDeclareInterface?(this: Context & M, path: NodePath<namedTypes.DeclareInterface>): any;
visitTypeAlias?(this: Context & M, path: NodePath<namedTypes.TypeAlias>): any;
visitDeclareTypeAlias?(this: Context & M, path: NodePath<namedTypes.DeclareTypeAlias>): any;
visitOpaqueType?(this: Context & M, path: NodePath<namedTypes.OpaqueType>): any;
visitDeclareOpaqueType?(this: Context & M, path: NodePath<namedTypes.DeclareOpaqueType>): any;
visitTypeCastExpression?(this: Context & M, path: NodePath<namedTypes.TypeCastExpression>): any;
visitTupleTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.TupleTypeAnnotation>): any;
visitDeclareVariable?(this: Context & M, path: NodePath<namedTypes.DeclareVariable>): any;
visitDeclareFunction?(this: Context & M, path: NodePath<namedTypes.DeclareFunction>): any;
visitFlowPredicate?(this: Context & M, path: NodePath<namedTypes.FlowPredicate>): any;
visitDeclareClass?(this: Context & M, path: NodePath<namedTypes.DeclareClass>): any;
visitDeclareModule?(this: Context & M, path: NodePath<namedTypes.DeclareModule>): any;
visitDeclareModuleExports?(this: Context & M, path: NodePath<namedTypes.DeclareModuleExports>): any;
visitDeclareExportDeclaration?(this: Context & M, path: NodePath<namedTypes.DeclareExportDeclaration>): any;
visitExportBatchSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportBatchSpecifier>): any;
visitDeclareExportAllDeclaration?(this: Context & M, path: NodePath<namedTypes.DeclareExportAllDeclaration>): any;
visitInferredPredicate?(this: Context & M, path: NodePath<namedTypes.InferredPredicate>): any;
visitDeclaredPredicate?(this: Context & M, path: NodePath<namedTypes.DeclaredPredicate>): any;
visitEnumDeclaration?(this: Context & M, path: NodePath<namedTypes.EnumDeclaration>): any;
visitEnumBooleanBody?(this: Context & M, path: NodePath<namedTypes.EnumBooleanBody>): any;
visitEnumNumberBody?(this: Context & M, path: NodePath<namedTypes.EnumNumberBody>): any;
visitEnumStringBody?(this: Context & M, path: NodePath<namedTypes.EnumStringBody>): any;
visitEnumSymbolBody?(this: Context & M, path: NodePath<namedTypes.EnumSymbolBody>): any;
visitEnumBooleanMember?(this: Context & M, path: NodePath<namedTypes.EnumBooleanMember>): any;
visitEnumNumberMember?(this: Context & M, path: NodePath<namedTypes.EnumNumberMember>): any;
visitEnumStringMember?(this: Context & M, path: NodePath<namedTypes.EnumStringMember>): any;
visitEnumDefaultedMember?(this: Context & M, path: NodePath<namedTypes.EnumDefaultedMember>): any;
visitExportDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportDeclaration>): any;
visitBlock?(this: Context & M, path: NodePath<namedTypes.Block>): any;
visitLine?(this: Context & M, path: NodePath<namedTypes.Line>): any;
visitNoop?(this: Context & M, path: NodePath<namedTypes.Noop>): any;
visitDoExpression?(this: Context & M, path: NodePath<namedTypes.DoExpression>): any;
visitBindExpression?(this: Context & M, path: NodePath<namedTypes.BindExpression>): any;
visitParenthesizedExpression?(this: Context & M, path: NodePath<namedTypes.ParenthesizedExpression>): any;
visitExportNamespaceSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportNamespaceSpecifier>): any;
visitExportDefaultSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportDefaultSpecifier>): any;
visitCommentBlock?(this: Context & M, path: NodePath<namedTypes.CommentBlock>): any;
visitCommentLine?(this: Context & M, path: NodePath<namedTypes.CommentLine>): any;
visitDirective?(this: Context & M, path: NodePath<namedTypes.Directive>): any;
visitDirectiveLiteral?(this: Context & M, path: NodePath<namedTypes.DirectiveLiteral>): any;
visitInterpreterDirective?(this: Context & M, path: NodePath<namedTypes.InterpreterDirective>): any;
visitStringLiteral?(this: Context & M, path: NodePath<namedTypes.StringLiteral>): any;
visitNumericLiteral?(this: Context & M, path: NodePath<namedTypes.NumericLiteral>): any;
visitBigIntLiteral?(this: Context & M, path: NodePath<namedTypes.BigIntLiteral>): any;
visitNullLiteral?(this: Context & M, path: NodePath<namedTypes.NullLiteral>): any;
visitBooleanLiteral?(this: Context & M, path: NodePath<namedTypes.BooleanLiteral>): any;
visitRegExpLiteral?(this: Context & M, path: NodePath<namedTypes.RegExpLiteral>): any;
visitObjectMethod?(this: Context & M, path: NodePath<namedTypes.ObjectMethod>): any;
visitClassMethod?(this: Context & M, path: NodePath<namedTypes.ClassMethod>): any;
visitClassPrivateMethod?(this: Context & M, path: NodePath<namedTypes.ClassPrivateMethod>): any;
visitRestProperty?(this: Context & M, path: NodePath<namedTypes.RestProperty>): any;
visitForAwaitStatement?(this: Context & M, path: NodePath<namedTypes.ForAwaitStatement>): any;
visitImport?(this: Context & M, path: NodePath<namedTypes.Import>): any;
visitTSQualifiedName?(this: Context & M, path: NodePath<namedTypes.TSQualifiedName>): any;
visitTSTypeReference?(this: Context & M, path: NodePath<namedTypes.TSTypeReference>): any;
visitTSHasOptionalTypeParameters?(this: Context & M, path: NodePath<namedTypes.TSHasOptionalTypeParameters>): any;
visitTSHasOptionalTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.TSHasOptionalTypeAnnotation>): any;
visitTSAsExpression?(this: Context & M, path: NodePath<namedTypes.TSAsExpression>): any;
visitTSNonNullExpression?(this: Context & M, path: NodePath<namedTypes.TSNonNullExpression>): any;
visitTSAnyKeyword?(this: Context & M, path: NodePath<namedTypes.TSAnyKeyword>): any;
visitTSBigIntKeyword?(this: Context & M, path: NodePath<namedTypes.TSBigIntKeyword>): any;
visitTSBooleanKeyword?(this: Context & M, path: NodePath<namedTypes.TSBooleanKeyword>): any;
visitTSNeverKeyword?(this: Context & M, path: NodePath<namedTypes.TSNeverKeyword>): any;
visitTSNullKeyword?(this: Context & M, path: NodePath<namedTypes.TSNullKeyword>): any;
visitTSNumberKeyword?(this: Context & M, path: NodePath<namedTypes.TSNumberKeyword>): any;
visitTSObjectKeyword?(this: Context & M, path: NodePath<namedTypes.TSObjectKeyword>): any;
visitTSStringKeyword?(this: Context & M, path: NodePath<namedTypes.TSStringKeyword>): any;
visitTSSymbolKeyword?(this: Context & M, path: NodePath<namedTypes.TSSymbolKeyword>): any;
visitTSUndefinedKeyword?(this: Context & M, path: NodePath<namedTypes.TSUndefinedKeyword>): any;
visitTSUnknownKeyword?(this: Context & M, path: NodePath<namedTypes.TSUnknownKeyword>): any;
visitTSVoidKeyword?(this: Context & M, path: NodePath<namedTypes.TSVoidKeyword>): any;
visitTSThisType?(this: Context & M, path: NodePath<namedTypes.TSThisType>): any;
visitTSArrayType?(this: Context & M, path: NodePath<namedTypes.TSArrayType>): any;
visitTSLiteralType?(this: Context & M, path: NodePath<namedTypes.TSLiteralType>): any;
visitTSUnionType?(this: Context & M, path: NodePath<namedTypes.TSUnionType>): any;
visitTSIntersectionType?(this: Context & M, path: NodePath<namedTypes.TSIntersectionType>): any;
visitTSConditionalType?(this: Context & M, path: NodePath<namedTypes.TSConditionalType>): any;
visitTSInferType?(this: Context & M, path: NodePath<namedTypes.TSInferType>): any;
visitTSTypeParameter?(this: Context & M, path: NodePath<namedTypes.TSTypeParameter>): any;
visitTSParenthesizedType?(this: Context & M, path: NodePath<namedTypes.TSParenthesizedType>): any;
visitTSFunctionType?(this: Context & M, path: NodePath<namedTypes.TSFunctionType>): any;
visitTSConstructorType?(this: Context & M, path: NodePath<namedTypes.TSConstructorType>): any;
visitTSDeclareFunction?(this: Context & M, path: NodePath<namedTypes.TSDeclareFunction>): any;
visitTSDeclareMethod?(this: Context & M, path: NodePath<namedTypes.TSDeclareMethod>): any;
visitTSMappedType?(this: Context & M, path: NodePath<namedTypes.TSMappedType>): any;
visitTSTupleType?(this: Context & M, path: NodePath<namedTypes.TSTupleType>): any;
visitTSNamedTupleMember?(this: Context & M, path: NodePath<namedTypes.TSNamedTupleMember>): any;
visitTSRestType?(this: Context & M, path: NodePath<namedTypes.TSRestType>): any;
visitTSOptionalType?(this: Context & M, path: NodePath<namedTypes.TSOptionalType>): any;
visitTSIndexedAccessType?(this: Context & M, path: NodePath<namedTypes.TSIndexedAccessType>): any;
visitTSTypeOperator?(this: Context & M, path: NodePath<namedTypes.TSTypeOperator>): any;
visitTSIndexSignature?(this: Context & M, path: NodePath<namedTypes.TSIndexSignature>): any;
visitTSPropertySignature?(this: Context & M, path: NodePath<namedTypes.TSPropertySignature>): any;
visitTSMethodSignature?(this: Context & M, path: NodePath<namedTypes.TSMethodSignature>): any;
visitTSTypePredicate?(this: Context & M, path: NodePath<namedTypes.TSTypePredicate>): any;
visitTSCallSignatureDeclaration?(this: Context & M, path: NodePath<namedTypes.TSCallSignatureDeclaration>): any;
visitTSConstructSignatureDeclaration?(this: Context & M, path: NodePath<namedTypes.TSConstructSignatureDeclaration>): any;
visitTSEnumMember?(this: Context & M, path: NodePath<namedTypes.TSEnumMember>): any;
visitTSTypeQuery?(this: Context & M, path: NodePath<namedTypes.TSTypeQuery>): any;
visitTSImportType?(this: Context & M, path: NodePath<namedTypes.TSImportType>): any;
visitTSTypeLiteral?(this: Context & M, path: NodePath<namedTypes.TSTypeLiteral>): any;
visitTSTypeAssertion?(this: Context & M, path: NodePath<namedTypes.TSTypeAssertion>): any;
visitTSEnumDeclaration?(this: Context & M, path: NodePath<namedTypes.TSEnumDeclaration>): any;
visitTSTypeAliasDeclaration?(this: Context & M, path: NodePath<namedTypes.TSTypeAliasDeclaration>): any;
visitTSModuleBlock?(this: Context & M, path: NodePath<namedTypes.TSModuleBlock>): any;
visitTSModuleDeclaration?(this: Context & M, path: NodePath<namedTypes.TSModuleDeclaration>): any;
visitTSImportEqualsDeclaration?(this: Context & M, path: NodePath<namedTypes.TSImportEqualsDeclaration>): any;
visitTSExternalModuleReference?(this: Context & M, path: NodePath<namedTypes.TSExternalModuleReference>): any;
visitTSExportAssignment?(this: Context & M, path: NodePath<namedTypes.TSExportAssignment>): any;
visitTSNamespaceExportDeclaration?(this: Context & M, path: NodePath<namedTypes.TSNamespaceExportDeclaration>): any;
visitTSInterfaceBody?(this: Context & M, path: NodePath<namedTypes.TSInterfaceBody>): any;
visitTSInterfaceDeclaration?(this: Context & M, path: NodePath<namedTypes.TSInterfaceDeclaration>): any;
visitTSParameterProperty?(this: Context & M, path: NodePath<namedTypes.TSParameterProperty>): any;
}

2
node_modules/ast-types/gen/visitor.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

5
node_modules/ast-types/lib/equiv.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Fork } from "../types";
export default function (fork: Fork): {
(a: any, b: any, problemPath?: any): boolean;
assert(a: any, b: any): void;
};

154
node_modules/ast-types/lib/equiv.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = tslib_1.__importDefault(require("./types"));
function default_1(fork) {
var types = fork.use(types_1.default);
var getFieldNames = types.getFieldNames;
var getFieldValue = types.getFieldValue;
var isArray = types.builtInTypes.array;
var isObject = types.builtInTypes.object;
var isDate = types.builtInTypes.Date;
var isRegExp = types.builtInTypes.RegExp;
var hasOwn = Object.prototype.hasOwnProperty;
function astNodesAreEquivalent(a, b, problemPath) {
if (isArray.check(problemPath)) {
problemPath.length = 0;
}
else {
problemPath = null;
}
return areEquivalent(a, b, problemPath);
}
astNodesAreEquivalent.assert = function (a, b) {
var problemPath = [];
if (!astNodesAreEquivalent(a, b, problemPath)) {
if (problemPath.length === 0) {
if (a !== b) {
throw new Error("Nodes must be equal");
}
}
else {
throw new Error("Nodes differ in the following path: " +
problemPath.map(subscriptForProperty).join(""));
}
}
};
function subscriptForProperty(property) {
if (/[_$a-z][_$a-z0-9]*/i.test(property)) {
return "." + property;
}
return "[" + JSON.stringify(property) + "]";
}
function areEquivalent(a, b, problemPath) {
if (a === b) {
return true;
}
if (isArray.check(a)) {
return arraysAreEquivalent(a, b, problemPath);
}
if (isObject.check(a)) {
return objectsAreEquivalent(a, b, problemPath);
}
if (isDate.check(a)) {
return isDate.check(b) && (+a === +b);
}
if (isRegExp.check(a)) {
return isRegExp.check(b) && (a.source === b.source &&
a.global === b.global &&
a.multiline === b.multiline &&
a.ignoreCase === b.ignoreCase);
}
return a == b;
}
function arraysAreEquivalent(a, b, problemPath) {
isArray.assert(a);
var aLength = a.length;
if (!isArray.check(b) || b.length !== aLength) {
if (problemPath) {
problemPath.push("length");
}
return false;
}
for (var i = 0; i < aLength; ++i) {
if (problemPath) {
problemPath.push(i);
}
if (i in a !== i in b) {
return false;
}
if (!areEquivalent(a[i], b[i], problemPath)) {
return false;
}
if (problemPath) {
var problemPathTail = problemPath.pop();
if (problemPathTail !== i) {
throw new Error("" + problemPathTail);
}
}
}
return true;
}
function objectsAreEquivalent(a, b, problemPath) {
isObject.assert(a);
if (!isObject.check(b)) {
return false;
}
// Fast path for a common property of AST nodes.
if (a.type !== b.type) {
if (problemPath) {
problemPath.push("type");
}
return false;
}
var aNames = getFieldNames(a);
var aNameCount = aNames.length;
var bNames = getFieldNames(b);
var bNameCount = bNames.length;
if (aNameCount === bNameCount) {
for (var i = 0; i < aNameCount; ++i) {
var name = aNames[i];
var aChild = getFieldValue(a, name);
var bChild = getFieldValue(b, name);
if (problemPath) {
problemPath.push(name);
}
if (!areEquivalent(aChild, bChild, problemPath)) {
return false;
}
if (problemPath) {
var problemPathTail = problemPath.pop();
if (problemPathTail !== name) {
throw new Error("" + problemPathTail);
}
}
}
return true;
}
if (!problemPath) {
return false;
}
// Since aNameCount !== bNameCount, we need to find some name that's
// missing in aNames but present in bNames, or vice-versa.
var seenNames = Object.create(null);
for (i = 0; i < aNameCount; ++i) {
seenNames[aNames[i]] = true;
}
for (i = 0; i < bNameCount; ++i) {
name = bNames[i];
if (!hasOwn.call(seenNames, name)) {
problemPath.push(name);
return false;
}
delete seenNames[name];
}
for (name in seenNames) {
problemPath.push(name);
break;
}
return false;
}
return astNodesAreEquivalent;
}
exports.default = default_1;
module.exports = exports["default"];

22
node_modules/ast-types/lib/node-path.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { Fork } from "../types";
import { ASTNode } from "./types";
import { Path } from "./path";
import { Scope } from "./scope";
export interface NodePath<N = any, V = any> extends Path<V> {
node: N;
parent: any;
scope: any;
replace: Path['replace'];
prune(...args: any[]): any;
_computeNode(): any;
_computeParent(): any;
_computeScope(): Scope | null;
getValueProperty(name: any): any;
needsParens(assumeExpressionContext?: boolean): boolean;
canBeFirstInStatement(): boolean;
firstInStatement(): boolean;
}
export interface NodePathConstructor {
new <N extends ASTNode = any, V = any>(value: any, parentPath?: any, name?: any): NodePath<N, V>;
}
export default function nodePathPlugin(fork: Fork): NodePathConstructor;

411
node_modules/ast-types/lib/node-path.js generated vendored Normal file
View File

@@ -0,0 +1,411 @@
"use strict";;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = tslib_1.__importDefault(require("./types"));
var path_1 = tslib_1.__importDefault(require("./path"));
var scope_1 = tslib_1.__importDefault(require("./scope"));
function nodePathPlugin(fork) {
var types = fork.use(types_1.default);
var n = types.namedTypes;
var b = types.builders;
var isNumber = types.builtInTypes.number;
var isArray = types.builtInTypes.array;
var Path = fork.use(path_1.default);
var Scope = fork.use(scope_1.default);
var NodePath = function NodePath(value, parentPath, name) {
if (!(this instanceof NodePath)) {
throw new Error("NodePath constructor cannot be invoked without 'new'");
}
Path.call(this, value, parentPath, name);
};
var NPp = NodePath.prototype = Object.create(Path.prototype, {
constructor: {
value: NodePath,
enumerable: false,
writable: true,
configurable: true
}
});
Object.defineProperties(NPp, {
node: {
get: function () {
Object.defineProperty(this, "node", {
configurable: true,
value: this._computeNode()
});
return this.node;
}
},
parent: {
get: function () {
Object.defineProperty(this, "parent", {
configurable: true,
value: this._computeParent()
});
return this.parent;
}
},
scope: {
get: function () {
Object.defineProperty(this, "scope", {
configurable: true,
value: this._computeScope()
});
return this.scope;
}
}
});
NPp.replace = function () {
delete this.node;
delete this.parent;
delete this.scope;
return Path.prototype.replace.apply(this, arguments);
};
NPp.prune = function () {
var remainingNodePath = this.parent;
this.replace();
return cleanUpNodesAfterPrune(remainingNodePath);
};
// The value of the first ancestor Path whose value is a Node.
NPp._computeNode = function () {
var value = this.value;
if (n.Node.check(value)) {
return value;
}
var pp = this.parentPath;
return pp && pp.node || null;
};
// The first ancestor Path whose value is a Node distinct from this.node.
NPp._computeParent = function () {
var value = this.value;
var pp = this.parentPath;
if (!n.Node.check(value)) {
while (pp && !n.Node.check(pp.value)) {
pp = pp.parentPath;
}
if (pp) {
pp = pp.parentPath;
}
}
while (pp && !n.Node.check(pp.value)) {
pp = pp.parentPath;
}
return pp || null;
};
// The closest enclosing scope that governs this node.
NPp._computeScope = function () {
var value = this.value;
var pp = this.parentPath;
var scope = pp && pp.scope;
if (n.Node.check(value) &&
Scope.isEstablishedBy(value)) {
scope = new Scope(this, scope);
}
return scope || null;
};
NPp.getValueProperty = function (name) {
return types.getFieldValue(this.value, name);
};
/**
* Determine whether this.node needs to be wrapped in parentheses in order
* for a parser to reproduce the same local AST structure.
*
* For instance, in the expression `(1 + 2) * 3`, the BinaryExpression
* whose operator is "+" needs parentheses, because `1 + 2 * 3` would
* parse differently.
*
* If assumeExpressionContext === true, we don't worry about edge cases
* like an anonymous FunctionExpression appearing lexically first in its
* enclosing statement and thus needing parentheses to avoid being parsed
* as a FunctionDeclaration with a missing name.
*/
NPp.needsParens = function (assumeExpressionContext) {
var pp = this.parentPath;
if (!pp) {
return false;
}
var node = this.value;
// Only expressions need parentheses.
if (!n.Expression.check(node)) {
return false;
}
// Identifiers never need parentheses.
if (node.type === "Identifier") {
return false;
}
while (!n.Node.check(pp.value)) {
pp = pp.parentPath;
if (!pp) {
return false;
}
}
var parent = pp.value;
switch (node.type) {
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
return parent.type === "MemberExpression"
&& this.name === "object"
&& parent.object === node;
case "BinaryExpression":
case "LogicalExpression":
switch (parent.type) {
case "CallExpression":
return this.name === "callee"
&& parent.callee === node;
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
return true;
case "MemberExpression":
return this.name === "object"
&& parent.object === node;
case "BinaryExpression":
case "LogicalExpression": {
var n_1 = node;
var po = parent.operator;
var pp_1 = PRECEDENCE[po];
var no = n_1.operator;
var np = PRECEDENCE[no];
if (pp_1 > np) {
return true;
}
if (pp_1 === np && this.name === "right") {
if (parent.right !== n_1) {
throw new Error("Nodes must be equal");
}
return true;
}
}
default:
return false;
}
case "SequenceExpression":
switch (parent.type) {
case "ForStatement":
// Although parentheses wouldn't hurt around sequence
// expressions in the head of for loops, traditional style
// dictates that e.g. i++, j++ should not be wrapped with
// parentheses.
return false;
case "ExpressionStatement":
return this.name !== "expression";
default:
// Otherwise err on the side of overparenthesization, adding
// explicit exceptions above if this proves overzealous.
return true;
}
case "YieldExpression":
switch (parent.type) {
case "BinaryExpression":
case "LogicalExpression":
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
case "CallExpression":
case "MemberExpression":
case "NewExpression":
case "ConditionalExpression":
case "YieldExpression":
return true;
default:
return false;
}
case "Literal":
return parent.type === "MemberExpression"
&& isNumber.check(node.value)
&& this.name === "object"
&& parent.object === node;
case "AssignmentExpression":
case "ConditionalExpression":
switch (parent.type) {
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
case "BinaryExpression":
case "LogicalExpression":
return true;
case "CallExpression":
return this.name === "callee"
&& parent.callee === node;
case "ConditionalExpression":
return this.name === "test"
&& parent.test === node;
case "MemberExpression":
return this.name === "object"
&& parent.object === node;
default:
return false;
}
default:
if (parent.type === "NewExpression" &&
this.name === "callee" &&
parent.callee === node) {
return containsCallExpression(node);
}
}
if (assumeExpressionContext !== true &&
!this.canBeFirstInStatement() &&
this.firstInStatement())
return true;
return false;
};
function isBinary(node) {
return n.BinaryExpression.check(node)
|| n.LogicalExpression.check(node);
}
// @ts-ignore 'isUnaryLike' is declared but its value is never read. [6133]
function isUnaryLike(node) {
return n.UnaryExpression.check(node)
// I considered making SpreadElement and SpreadProperty subtypes
// of UnaryExpression, but they're not really Expression nodes.
|| (n.SpreadElement && n.SpreadElement.check(node))
|| (n.SpreadProperty && n.SpreadProperty.check(node));
}
var PRECEDENCE = {};
[["||"],
["&&"],
["|"],
["^"],
["&"],
["==", "===", "!=", "!=="],
["<", ">", "<=", ">=", "in", "instanceof"],
[">>", "<<", ">>>"],
["+", "-"],
["*", "/", "%"]
].forEach(function (tier, i) {
tier.forEach(function (op) {
PRECEDENCE[op] = i;
});
});
function containsCallExpression(node) {
if (n.CallExpression.check(node)) {
return true;
}
if (isArray.check(node)) {
return node.some(containsCallExpression);
}
if (n.Node.check(node)) {
return types.someField(node, function (_name, child) {
return containsCallExpression(child);
});
}
return false;
}
NPp.canBeFirstInStatement = function () {
var node = this.node;
return !n.FunctionExpression.check(node)
&& !n.ObjectExpression.check(node);
};
NPp.firstInStatement = function () {
return firstInStatement(this);
};
function firstInStatement(path) {
for (var node, parent; path.parent; path = path.parent) {
node = path.node;
parent = path.parent.node;
if (n.BlockStatement.check(parent) &&
path.parent.name === "body" &&
path.name === 0) {
if (parent.body[0] !== node) {
throw new Error("Nodes must be equal");
}
return true;
}
if (n.ExpressionStatement.check(parent) &&
path.name === "expression") {
if (parent.expression !== node) {
throw new Error("Nodes must be equal");
}
return true;
}
if (n.SequenceExpression.check(parent) &&
path.parent.name === "expressions" &&
path.name === 0) {
if (parent.expressions[0] !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.CallExpression.check(parent) &&
path.name === "callee") {
if (parent.callee !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.MemberExpression.check(parent) &&
path.name === "object") {
if (parent.object !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.ConditionalExpression.check(parent) &&
path.name === "test") {
if (parent.test !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (isBinary(parent) &&
path.name === "left") {
if (parent.left !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.UnaryExpression.check(parent) &&
!parent.prefix &&
path.name === "argument") {
if (parent.argument !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
return false;
}
return true;
}
/**
* Pruning certain nodes will result in empty or incomplete nodes, here we clean those nodes up.
*/
function cleanUpNodesAfterPrune(remainingNodePath) {
if (n.VariableDeclaration.check(remainingNodePath.node)) {
var declarations = remainingNodePath.get('declarations').value;
if (!declarations || declarations.length === 0) {
return remainingNodePath.prune();
}
}
else if (n.ExpressionStatement.check(remainingNodePath.node)) {
if (!remainingNodePath.get('expression').value) {
return remainingNodePath.prune();
}
}
else if (n.IfStatement.check(remainingNodePath.node)) {
cleanUpIfStatementAfterPrune(remainingNodePath);
}
return remainingNodePath;
}
function cleanUpIfStatementAfterPrune(ifStatement) {
var testExpression = ifStatement.get('test').value;
var alternate = ifStatement.get('alternate').value;
var consequent = ifStatement.get('consequent').value;
if (!consequent && !alternate) {
var testExpressionStatement = b.expressionStatement(testExpression);
ifStatement.replace(testExpressionStatement);
}
else if (!consequent && alternate) {
var negatedTestExpression = b.unaryExpression('!', testExpression, true);
if (n.UnaryExpression.check(testExpression) && testExpression.operator === '!') {
negatedTestExpression = testExpression.argument;
}
ifStatement.get("test").replace(negatedTestExpression);
ifStatement.get("consequent").replace(alternate);
ifStatement.get("alternate").replace();
}
}
return NodePath;
}
exports.default = nodePathPlugin;
module.exports = exports["default"];

Some files were not shown because too many files have changed in this diff Show More