ast-types 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +1 -1
- package/README.md +1 -1
- package/def/babel-core.js +19 -4
- package/def/babel.js +15 -2
- package/def/core.js +7 -6
- package/def/es-proposals.js +26 -4
- package/def/es2016.js +6 -12
- package/def/es2017.js +3 -3
- package/def/es2018.js +3 -3
- package/def/es2019.js +3 -3
- package/def/es2020.js +7 -8
- package/def/es2021.d.ts +2 -0
- package/def/es2021.js +13 -0
- package/def/es2022.d.ts +2 -0
- package/def/es2022.js +16 -0
- package/def/es6.js +3 -3
- package/def/esprima.js +4 -4
- package/def/flow.js +15 -4
- package/def/jsx.js +4 -4
- package/def/operators/core.d.ts +5 -0
- package/def/operators/core.js +25 -0
- package/def/operators/es2016.d.ts +5 -0
- package/def/operators/es2016.js +19 -0
- package/def/operators/es2020.d.ts +5 -0
- package/def/operators/es2020.js +15 -0
- package/def/operators/es2021.d.ts +5 -0
- package/def/operators/es2021.js +18 -0
- package/def/type-annotations.js +2 -2
- package/def/typescript.js +11 -4
- package/fork.js +5 -5
- package/gen/builders.d.ts +170 -61
- package/gen/kinds.d.ts +23 -12
- package/gen/namedTypes.d.ts +108 -36
- package/gen/visitor.d.ts +15 -4
- package/lib/equiv.js +1 -1
- package/lib/node-path.js +3 -3
- package/lib/path-visitor.js +2 -2
- package/lib/path.d.ts +3 -3
- package/lib/path.js +1 -1
- package/lib/scope.d.ts +3 -2
- package/lib/scope.js +61 -26
- package/lib/shared.js +1 -1
- package/lib/types.js +6 -6
- package/main.js +9 -25
- package/package.json +15 -15
- package/def/core-operators.d.ts +0 -3
- package/def/core-operators.js +0 -20
package/lib/types.js
CHANGED
|
@@ -22,7 +22,7 @@ var BaseType = /** @class */ (function () {
|
|
|
22
22
|
return BaseType;
|
|
23
23
|
}());
|
|
24
24
|
var ArrayType = /** @class */ (function (_super) {
|
|
25
|
-
tslib_1.__extends(ArrayType, _super);
|
|
25
|
+
(0, tslib_1.__extends)(ArrayType, _super);
|
|
26
26
|
function ArrayType(elemType) {
|
|
27
27
|
var _this = _super.call(this) || this;
|
|
28
28
|
_this.elemType = elemType;
|
|
@@ -39,7 +39,7 @@ var ArrayType = /** @class */ (function (_super) {
|
|
|
39
39
|
return ArrayType;
|
|
40
40
|
}(BaseType));
|
|
41
41
|
var IdentityType = /** @class */ (function (_super) {
|
|
42
|
-
tslib_1.__extends(IdentityType, _super);
|
|
42
|
+
(0, tslib_1.__extends)(IdentityType, _super);
|
|
43
43
|
function IdentityType(value) {
|
|
44
44
|
var _this = _super.call(this) || this;
|
|
45
45
|
_this.value = value;
|
|
@@ -59,7 +59,7 @@ var IdentityType = /** @class */ (function (_super) {
|
|
|
59
59
|
return IdentityType;
|
|
60
60
|
}(BaseType));
|
|
61
61
|
var ObjectType = /** @class */ (function (_super) {
|
|
62
|
-
tslib_1.__extends(ObjectType, _super);
|
|
62
|
+
(0, tslib_1.__extends)(ObjectType, _super);
|
|
63
63
|
function ObjectType(fields) {
|
|
64
64
|
var _this = _super.call(this) || this;
|
|
65
65
|
_this.fields = fields;
|
|
@@ -78,7 +78,7 @@ var ObjectType = /** @class */ (function (_super) {
|
|
|
78
78
|
return ObjectType;
|
|
79
79
|
}(BaseType));
|
|
80
80
|
var OrType = /** @class */ (function (_super) {
|
|
81
|
-
tslib_1.__extends(OrType, _super);
|
|
81
|
+
(0, tslib_1.__extends)(OrType, _super);
|
|
82
82
|
function OrType(types) {
|
|
83
83
|
var _this = _super.call(this) || this;
|
|
84
84
|
_this.types = types;
|
|
@@ -96,7 +96,7 @@ var OrType = /** @class */ (function (_super) {
|
|
|
96
96
|
return OrType;
|
|
97
97
|
}(BaseType));
|
|
98
98
|
var PredicateType = /** @class */ (function (_super) {
|
|
99
|
-
tslib_1.__extends(PredicateType, _super);
|
|
99
|
+
(0, tslib_1.__extends)(PredicateType, _super);
|
|
100
100
|
function PredicateType(name, predicate) {
|
|
101
101
|
var _this = _super.call(this) || this;
|
|
102
102
|
_this.name = name;
|
|
@@ -345,7 +345,7 @@ function typesPlugin(_fork) {
|
|
|
345
345
|
return null;
|
|
346
346
|
}
|
|
347
347
|
var DefImpl = /** @class */ (function (_super) {
|
|
348
|
-
tslib_1.__extends(DefImpl, _super);
|
|
348
|
+
(0, tslib_1.__extends)(DefImpl, _super);
|
|
349
349
|
function DefImpl(typeName) {
|
|
350
350
|
var _this = _super.call(this, new PredicateType(typeName, function (value, deep) { return _this.check(value, deep); }), typeName) || this;
|
|
351
351
|
return _this;
|
package/main.js
CHANGED
|
@@ -2,40 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.visit = exports.use = exports.Type = exports.someField = exports.PathVisitor = exports.Path = exports.NodePath = exports.namedTypes = exports.getSupertypeNames = exports.getFieldValue = exports.getFieldNames = exports.getBuilderName = exports.finalize = exports.eachField = exports.defineMethod = exports.builtInTypes = exports.builders = exports.astNodesAreEquivalent = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var fork_1 = tslib_1.__importDefault(require("./fork"));
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var es2020_1 = tslib_1.__importDefault(require("./def/es2020"));
|
|
13
|
-
var jsx_1 = tslib_1.__importDefault(require("./def/jsx"));
|
|
14
|
-
var flow_1 = tslib_1.__importDefault(require("./def/flow"));
|
|
15
|
-
var esprima_1 = tslib_1.__importDefault(require("./def/esprima"));
|
|
16
|
-
var babel_1 = tslib_1.__importDefault(require("./def/babel"));
|
|
17
|
-
var typescript_1 = tslib_1.__importDefault(require("./def/typescript"));
|
|
18
|
-
var es_proposals_1 = tslib_1.__importDefault(require("./def/es-proposals"));
|
|
5
|
+
var fork_1 = (0, tslib_1.__importDefault)(require("./fork"));
|
|
6
|
+
var es_proposals_1 = (0, tslib_1.__importDefault)(require("./def/es-proposals"));
|
|
7
|
+
var jsx_1 = (0, tslib_1.__importDefault)(require("./def/jsx"));
|
|
8
|
+
var flow_1 = (0, tslib_1.__importDefault)(require("./def/flow"));
|
|
9
|
+
var esprima_1 = (0, tslib_1.__importDefault)(require("./def/esprima"));
|
|
10
|
+
var babel_1 = (0, tslib_1.__importDefault)(require("./def/babel"));
|
|
11
|
+
var typescript_1 = (0, tslib_1.__importDefault)(require("./def/typescript"));
|
|
19
12
|
var namedTypes_1 = require("./gen/namedTypes");
|
|
20
13
|
Object.defineProperty(exports, "namedTypes", { enumerable: true, get: function () { return namedTypes_1.namedTypes; } });
|
|
21
|
-
var _a = fork_1.default([
|
|
22
|
-
// This core module of AST types captures ES5 as it is parsed today by
|
|
23
|
-
// git://github.com/ariya/esprima.git#master.
|
|
24
|
-
core_1.default,
|
|
14
|
+
var _a = (0, fork_1.default)([
|
|
25
15
|
// Feel free to add to or remove from this list of extension modules to
|
|
26
16
|
// configure the precise type hierarchy that you need.
|
|
27
|
-
|
|
28
|
-
es2016_1.default,
|
|
29
|
-
es2017_1.default,
|
|
30
|
-
es2018_1.default,
|
|
31
|
-
es2019_1.default,
|
|
32
|
-
es2020_1.default,
|
|
17
|
+
es_proposals_1.default,
|
|
33
18
|
jsx_1.default,
|
|
34
19
|
flow_1.default,
|
|
35
20
|
esprima_1.default,
|
|
36
21
|
babel_1.default,
|
|
37
22
|
typescript_1.default,
|
|
38
|
-
es_proposals_1.default,
|
|
39
23
|
]), astNodesAreEquivalent = _a.astNodesAreEquivalent, builders = _a.builders, builtInTypes = _a.builtInTypes, defineMethod = _a.defineMethod, eachField = _a.eachField, finalize = _a.finalize, getBuilderName = _a.getBuilderName, getFieldNames = _a.getFieldNames, getFieldValue = _a.getFieldValue, getSupertypeNames = _a.getSupertypeNames, n = _a.namedTypes, NodePath = _a.NodePath, Path = _a.Path, PathVisitor = _a.PathVisitor, someField = _a.someField, Type = _a.Type, use = _a.use, visit = _a.visit;
|
|
40
24
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
41
25
|
exports.builders = builders;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Ben Newman <bn@cs.stanford.edu>",
|
|
3
3
|
"name": "ast-types",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"description": "Esprima-compatible implementation of the Mozilla JS Parser API",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"ast",
|
|
@@ -33,31 +33,31 @@
|
|
|
33
33
|
"test": "npm run gen && npm run build && npm run mocha",
|
|
34
34
|
"clean": "ts-emit-clean",
|
|
35
35
|
"build": "tsc && ts-add-module-exports",
|
|
36
|
-
"
|
|
36
|
+
"prepare": "npm run clean && npm run gen && npm run build",
|
|
37
37
|
"postpack": "npm run clean"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"tslib": "^2.0.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@babel/parser": "7.
|
|
44
|
-
"@babel/types": "7.
|
|
45
|
-
"@types/esprima": "4.0.
|
|
46
|
-
"@types/glob": "7.
|
|
47
|
-
"@types/mocha": "
|
|
48
|
-
"@types/node": "
|
|
49
|
-
"espree": "
|
|
43
|
+
"@babel/parser": "7.16.4",
|
|
44
|
+
"@babel/types": "7.16.0",
|
|
45
|
+
"@types/esprima": "4.0.3",
|
|
46
|
+
"@types/glob": "7.2.0",
|
|
47
|
+
"@types/mocha": "9.0.0",
|
|
48
|
+
"@types/node": "16.11.10",
|
|
49
|
+
"espree": "9.1.0",
|
|
50
50
|
"esprima": "4.0.1",
|
|
51
51
|
"esprima-fb": "15001.1001.0-dev-harmony-fb",
|
|
52
|
-
"flow-parser": "0.
|
|
53
|
-
"glob": "7.
|
|
54
|
-
"mocha": "^
|
|
55
|
-
"recast": "0.20.
|
|
52
|
+
"flow-parser": "0.165.1",
|
|
53
|
+
"glob": "7.2.0",
|
|
54
|
+
"mocha": "^9.1.3",
|
|
55
|
+
"recast": "0.20.5",
|
|
56
56
|
"reify": "0.20.12",
|
|
57
57
|
"ts-add-module-exports": "1.0.0",
|
|
58
58
|
"ts-emit-clean": "1.0.0",
|
|
59
|
-
"ts-node": "
|
|
60
|
-
"typescript": "
|
|
59
|
+
"ts-node": "10.4.0",
|
|
60
|
+
"typescript": "4.5.2"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=4"
|
package/def/core-operators.d.ts
DELETED
package/def/core-operators.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogicalOperators = exports.AssignmentOperators = exports.BinaryOperators = void 0;
|
|
4
|
-
exports.BinaryOperators = [
|
|
5
|
-
"==", "!=", "===", "!==",
|
|
6
|
-
"<", "<=", ">", ">=",
|
|
7
|
-
"<<", ">>", ">>>",
|
|
8
|
-
"+", "-", "*", "/", "%",
|
|
9
|
-
"&",
|
|
10
|
-
"|", "^", "in",
|
|
11
|
-
"instanceof",
|
|
12
|
-
];
|
|
13
|
-
exports.AssignmentOperators = [
|
|
14
|
-
"=", "+=", "-=", "*=", "/=", "%=",
|
|
15
|
-
"<<=", ">>=", ">>>=",
|
|
16
|
-
"|=", "^=", "&=",
|
|
17
|
-
];
|
|
18
|
-
exports.LogicalOperators = [
|
|
19
|
-
"||", "&&",
|
|
20
|
-
];
|