ast-types 0.13.3 → 0.14.2
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/dependabot.yml +9 -0
- package/.github/workflows/main.yml +29 -0
- package/README.md +1 -1
- package/def/babel-core.js +5 -61
- package/def/babel.js +3 -5
- package/def/core-operators.d.ts +3 -0
- package/def/core-operators.js +20 -0
- package/def/core.js +8 -11
- package/def/es-proposals.js +28 -23
- package/def/{es7.d.ts → es2016.d.ts} +0 -0
- package/def/es2016.js +20 -0
- package/def/{esNext.d.ts → es2017.d.ts} +0 -0
- package/def/es2017.js +20 -0
- package/def/es2018.d.ts +2 -0
- package/def/es2018.js +34 -0
- package/def/es2019.d.ts +2 -0
- package/def/es2019.js +17 -0
- package/def/es2020.js +38 -6
- package/def/es6.js +49 -25
- package/def/esprima.js +5 -7
- package/def/flow.js +75 -20
- package/def/jsx.js +28 -25
- package/def/type-annotations.js +3 -5
- package/def/typescript.js +16 -11
- package/fork.d.ts +1 -1
- package/fork.js +6 -8
- package/gen/builders.d.ts +360 -226
- package/gen/kinds.d.ts +48 -33
- package/gen/namedTypes.d.ts +257 -152
- package/gen/namedTypes.js +1 -0
- package/gen/visitor.d.ts +36 -21
- package/lib/equiv.js +2 -4
- package/lib/node-path.js +4 -6
- package/lib/path-visitor.js +3 -5
- package/lib/path.js +2 -4
- package/lib/scope.js +8 -5
- package/lib/shared.d.ts +7 -7
- package/lib/shared.js +2 -4
- package/lib/types.d.ts +1 -1
- package/lib/types.js +31 -32
- package/main.js +21 -16
- package/package.json +15 -13
- package/tsconfig.json +1 -0
- package/.travis.yml +0 -11
- package/def/es7.js +0 -36
- package/def/esNext.js +0 -57
- package/gen/nodes.d.ts +0 -1265
- package/gen/nodes.js +0 -2
package/gen/namedTypes.js
CHANGED
package/gen/visitor.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface Visitor<M = {}> {
|
|
|
47
47
|
visitUnaryExpression?(this: Context & M, path: NodePath<namedTypes.UnaryExpression>): any;
|
|
48
48
|
visitBinaryExpression?(this: Context & M, path: NodePath<namedTypes.BinaryExpression>): any;
|
|
49
49
|
visitAssignmentExpression?(this: Context & M, path: NodePath<namedTypes.AssignmentExpression>): any;
|
|
50
|
+
visitChainElement?(this: Context & M, path: NodePath<namedTypes.ChainElement>): any;
|
|
50
51
|
visitMemberExpression?(this: Context & M, path: NodePath<namedTypes.MemberExpression>): any;
|
|
51
52
|
visitUpdateExpression?(this: Context & M, path: NodePath<namedTypes.UpdateExpression>): any;
|
|
52
53
|
visitLogicalExpression?(this: Context & M, path: NodePath<namedTypes.LogicalExpression>): any;
|
|
@@ -67,42 +68,54 @@ export interface Visitor<M = {}> {
|
|
|
67
68
|
visitPropertyPattern?(this: Context & M, path: NodePath<namedTypes.PropertyPattern>): any;
|
|
68
69
|
visitObjectPattern?(this: Context & M, path: NodePath<namedTypes.ObjectPattern>): any;
|
|
69
70
|
visitArrayPattern?(this: Context & M, path: NodePath<namedTypes.ArrayPattern>): any;
|
|
70
|
-
visitMethodDefinition?(this: Context & M, path: NodePath<namedTypes.MethodDefinition>): any;
|
|
71
71
|
visitSpreadElement?(this: Context & M, path: NodePath<namedTypes.SpreadElement>): any;
|
|
72
72
|
visitAssignmentPattern?(this: Context & M, path: NodePath<namedTypes.AssignmentPattern>): any;
|
|
73
|
+
visitMethodDefinition?(this: Context & M, path: NodePath<namedTypes.MethodDefinition>): any;
|
|
73
74
|
visitClassPropertyDefinition?(this: Context & M, path: NodePath<namedTypes.ClassPropertyDefinition>): any;
|
|
74
75
|
visitClassProperty?(this: Context & M, path: NodePath<namedTypes.ClassProperty>): any;
|
|
75
76
|
visitClassBody?(this: Context & M, path: NodePath<namedTypes.ClassBody>): any;
|
|
76
77
|
visitClassDeclaration?(this: Context & M, path: NodePath<namedTypes.ClassDeclaration>): any;
|
|
77
78
|
visitClassExpression?(this: Context & M, path: NodePath<namedTypes.ClassExpression>): any;
|
|
79
|
+
visitSuper?(this: Context & M, path: NodePath<namedTypes.Super>): any;
|
|
78
80
|
visitSpecifier?(this: Context & M, path: NodePath<namedTypes.Specifier>): any;
|
|
79
81
|
visitModuleSpecifier?(this: Context & M, path: NodePath<namedTypes.ModuleSpecifier>): any;
|
|
80
82
|
visitImportSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportSpecifier>): any;
|
|
81
|
-
visitImportNamespaceSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportNamespaceSpecifier>): any;
|
|
82
83
|
visitImportDefaultSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportDefaultSpecifier>): any;
|
|
84
|
+
visitImportNamespaceSpecifier?(this: Context & M, path: NodePath<namedTypes.ImportNamespaceSpecifier>): any;
|
|
83
85
|
visitImportDeclaration?(this: Context & M, path: NodePath<namedTypes.ImportDeclaration>): any;
|
|
86
|
+
visitExportNamedDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportNamedDeclaration>): any;
|
|
87
|
+
visitExportSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportSpecifier>): any;
|
|
88
|
+
visitExportDefaultDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportDefaultDeclaration>): any;
|
|
89
|
+
visitExportAllDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportAllDeclaration>): any;
|
|
84
90
|
visitTaggedTemplateExpression?(this: Context & M, path: NodePath<namedTypes.TaggedTemplateExpression>): any;
|
|
85
91
|
visitTemplateLiteral?(this: Context & M, path: NodePath<namedTypes.TemplateLiteral>): any;
|
|
86
92
|
visitTemplateElement?(this: Context & M, path: NodePath<namedTypes.TemplateElement>): any;
|
|
93
|
+
visitMetaProperty?(this: Context & M, path: NodePath<namedTypes.MetaProperty>): any;
|
|
94
|
+
visitAwaitExpression?(this: Context & M, path: NodePath<namedTypes.AwaitExpression>): any;
|
|
87
95
|
visitSpreadProperty?(this: Context & M, path: NodePath<namedTypes.SpreadProperty>): any;
|
|
88
96
|
visitSpreadPropertyPattern?(this: Context & M, path: NodePath<namedTypes.SpreadPropertyPattern>): any;
|
|
89
|
-
visitAwaitExpression?(this: Context & M, path: NodePath<namedTypes.AwaitExpression>): any;
|
|
90
97
|
visitImportExpression?(this: Context & M, path: NodePath<namedTypes.ImportExpression>): any;
|
|
98
|
+
visitChainExpression?(this: Context & M, path: NodePath<namedTypes.ChainExpression>): any;
|
|
99
|
+
visitOptionalCallExpression?(this: Context & M, path: NodePath<namedTypes.OptionalCallExpression>): any;
|
|
100
|
+
visitOptionalMemberExpression?(this: Context & M, path: NodePath<namedTypes.OptionalMemberExpression>): any;
|
|
91
101
|
visitJSXAttribute?(this: Context & M, path: NodePath<namedTypes.JSXAttribute>): any;
|
|
92
102
|
visitJSXIdentifier?(this: Context & M, path: NodePath<namedTypes.JSXIdentifier>): any;
|
|
93
103
|
visitJSXNamespacedName?(this: Context & M, path: NodePath<namedTypes.JSXNamespacedName>): any;
|
|
94
104
|
visitJSXExpressionContainer?(this: Context & M, path: NodePath<namedTypes.JSXExpressionContainer>): any;
|
|
105
|
+
visitJSXElement?(this: Context & M, path: NodePath<namedTypes.JSXElement>): any;
|
|
106
|
+
visitJSXFragment?(this: Context & M, path: NodePath<namedTypes.JSXFragment>): any;
|
|
95
107
|
visitJSXMemberExpression?(this: Context & M, path: NodePath<namedTypes.JSXMemberExpression>): any;
|
|
96
108
|
visitJSXSpreadAttribute?(this: Context & M, path: NodePath<namedTypes.JSXSpreadAttribute>): any;
|
|
97
|
-
|
|
109
|
+
visitJSXEmptyExpression?(this: Context & M, path: NodePath<namedTypes.JSXEmptyExpression>): any;
|
|
110
|
+
visitJSXText?(this: Context & M, path: NodePath<namedTypes.JSXText>): any;
|
|
111
|
+
visitJSXSpreadChild?(this: Context & M, path: NodePath<namedTypes.JSXSpreadChild>): any;
|
|
98
112
|
visitJSXOpeningElement?(this: Context & M, path: NodePath<namedTypes.JSXOpeningElement>): any;
|
|
99
113
|
visitJSXClosingElement?(this: Context & M, path: NodePath<namedTypes.JSXClosingElement>): any;
|
|
100
|
-
visitJSXFragment?(this: Context & M, path: NodePath<namedTypes.JSXFragment>): any;
|
|
101
|
-
visitJSXText?(this: Context & M, path: NodePath<namedTypes.JSXText>): any;
|
|
102
114
|
visitJSXOpeningFragment?(this: Context & M, path: NodePath<namedTypes.JSXOpeningFragment>): any;
|
|
103
115
|
visitJSXClosingFragment?(this: Context & M, path: NodePath<namedTypes.JSXClosingFragment>): any;
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
visitDecorator?(this: Context & M, path: NodePath<namedTypes.Decorator>): any;
|
|
117
|
+
visitPrivateName?(this: Context & M, path: NodePath<namedTypes.PrivateName>): any;
|
|
118
|
+
visitClassPrivateProperty?(this: Context & M, path: NodePath<namedTypes.ClassPrivateProperty>): any;
|
|
106
119
|
visitTypeParameterDeclaration?(this: Context & M, path: NodePath<namedTypes.TypeParameterDeclaration>): any;
|
|
107
120
|
visitTSTypeParameterDeclaration?(this: Context & M, path: NodePath<namedTypes.TSTypeParameterDeclaration>): any;
|
|
108
121
|
visitTypeParameterInstantiation?(this: Context & M, path: NodePath<namedTypes.TypeParameterInstantiation>): any;
|
|
@@ -117,9 +130,12 @@ export interface Visitor<M = {}> {
|
|
|
117
130
|
visitEmptyTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.EmptyTypeAnnotation>): any;
|
|
118
131
|
visitMixedTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.MixedTypeAnnotation>): any;
|
|
119
132
|
visitVoidTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.VoidTypeAnnotation>): any;
|
|
133
|
+
visitSymbolTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.SymbolTypeAnnotation>): any;
|
|
120
134
|
visitNumberTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NumberTypeAnnotation>): any;
|
|
135
|
+
visitBigIntTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BigIntTypeAnnotation>): any;
|
|
121
136
|
visitNumberLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NumberLiteralTypeAnnotation>): any;
|
|
122
137
|
visitNumericLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.NumericLiteralTypeAnnotation>): any;
|
|
138
|
+
visitBigIntLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BigIntLiteralTypeAnnotation>): any;
|
|
123
139
|
visitStringTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.StringTypeAnnotation>): any;
|
|
124
140
|
visitStringLiteralTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.StringLiteralTypeAnnotation>): any;
|
|
125
141
|
visitBooleanTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.BooleanTypeAnnotation>): any;
|
|
@@ -152,38 +168,40 @@ export interface Visitor<M = {}> {
|
|
|
152
168
|
visitInterfaceDeclaration?(this: Context & M, path: NodePath<namedTypes.InterfaceDeclaration>): any;
|
|
153
169
|
visitDeclareInterface?(this: Context & M, path: NodePath<namedTypes.DeclareInterface>): any;
|
|
154
170
|
visitTypeAlias?(this: Context & M, path: NodePath<namedTypes.TypeAlias>): any;
|
|
155
|
-
visitOpaqueType?(this: Context & M, path: NodePath<namedTypes.OpaqueType>): any;
|
|
156
171
|
visitDeclareTypeAlias?(this: Context & M, path: NodePath<namedTypes.DeclareTypeAlias>): any;
|
|
172
|
+
visitOpaqueType?(this: Context & M, path: NodePath<namedTypes.OpaqueType>): any;
|
|
157
173
|
visitDeclareOpaqueType?(this: Context & M, path: NodePath<namedTypes.DeclareOpaqueType>): any;
|
|
158
174
|
visitTypeCastExpression?(this: Context & M, path: NodePath<namedTypes.TypeCastExpression>): any;
|
|
159
175
|
visitTupleTypeAnnotation?(this: Context & M, path: NodePath<namedTypes.TupleTypeAnnotation>): any;
|
|
160
176
|
visitDeclareVariable?(this: Context & M, path: NodePath<namedTypes.DeclareVariable>): any;
|
|
161
177
|
visitDeclareFunction?(this: Context & M, path: NodePath<namedTypes.DeclareFunction>): any;
|
|
178
|
+
visitFlowPredicate?(this: Context & M, path: NodePath<namedTypes.FlowPredicate>): any;
|
|
162
179
|
visitDeclareClass?(this: Context & M, path: NodePath<namedTypes.DeclareClass>): any;
|
|
163
180
|
visitDeclareModule?(this: Context & M, path: NodePath<namedTypes.DeclareModule>): any;
|
|
164
181
|
visitDeclareModuleExports?(this: Context & M, path: NodePath<namedTypes.DeclareModuleExports>): any;
|
|
165
182
|
visitDeclareExportDeclaration?(this: Context & M, path: NodePath<namedTypes.DeclareExportDeclaration>): any;
|
|
166
|
-
visitExportSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportSpecifier>): any;
|
|
167
183
|
visitExportBatchSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportBatchSpecifier>): any;
|
|
168
184
|
visitDeclareExportAllDeclaration?(this: Context & M, path: NodePath<namedTypes.DeclareExportAllDeclaration>): any;
|
|
169
|
-
visitFlowPredicate?(this: Context & M, path: NodePath<namedTypes.FlowPredicate>): any;
|
|
170
185
|
visitInferredPredicate?(this: Context & M, path: NodePath<namedTypes.InferredPredicate>): any;
|
|
171
186
|
visitDeclaredPredicate?(this: Context & M, path: NodePath<namedTypes.DeclaredPredicate>): any;
|
|
187
|
+
visitEnumDeclaration?(this: Context & M, path: NodePath<namedTypes.EnumDeclaration>): any;
|
|
188
|
+
visitEnumBooleanBody?(this: Context & M, path: NodePath<namedTypes.EnumBooleanBody>): any;
|
|
189
|
+
visitEnumNumberBody?(this: Context & M, path: NodePath<namedTypes.EnumNumberBody>): any;
|
|
190
|
+
visitEnumStringBody?(this: Context & M, path: NodePath<namedTypes.EnumStringBody>): any;
|
|
191
|
+
visitEnumSymbolBody?(this: Context & M, path: NodePath<namedTypes.EnumSymbolBody>): any;
|
|
192
|
+
visitEnumBooleanMember?(this: Context & M, path: NodePath<namedTypes.EnumBooleanMember>): any;
|
|
193
|
+
visitEnumNumberMember?(this: Context & M, path: NodePath<namedTypes.EnumNumberMember>): any;
|
|
194
|
+
visitEnumStringMember?(this: Context & M, path: NodePath<namedTypes.EnumStringMember>): any;
|
|
195
|
+
visitEnumDefaultedMember?(this: Context & M, path: NodePath<namedTypes.EnumDefaultedMember>): any;
|
|
172
196
|
visitExportDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportDeclaration>): any;
|
|
173
197
|
visitBlock?(this: Context & M, path: NodePath<namedTypes.Block>): any;
|
|
174
198
|
visitLine?(this: Context & M, path: NodePath<namedTypes.Line>): any;
|
|
175
199
|
visitNoop?(this: Context & M, path: NodePath<namedTypes.Noop>): any;
|
|
176
200
|
visitDoExpression?(this: Context & M, path: NodePath<namedTypes.DoExpression>): any;
|
|
177
|
-
visitSuper?(this: Context & M, path: NodePath<namedTypes.Super>): any;
|
|
178
201
|
visitBindExpression?(this: Context & M, path: NodePath<namedTypes.BindExpression>): any;
|
|
179
|
-
visitDecorator?(this: Context & M, path: NodePath<namedTypes.Decorator>): any;
|
|
180
|
-
visitMetaProperty?(this: Context & M, path: NodePath<namedTypes.MetaProperty>): any;
|
|
181
202
|
visitParenthesizedExpression?(this: Context & M, path: NodePath<namedTypes.ParenthesizedExpression>): any;
|
|
182
|
-
visitExportDefaultDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportDefaultDeclaration>): any;
|
|
183
|
-
visitExportNamedDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportNamedDeclaration>): any;
|
|
184
203
|
visitExportNamespaceSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportNamespaceSpecifier>): any;
|
|
185
204
|
visitExportDefaultSpecifier?(this: Context & M, path: NodePath<namedTypes.ExportDefaultSpecifier>): any;
|
|
186
|
-
visitExportAllDeclaration?(this: Context & M, path: NodePath<namedTypes.ExportAllDeclaration>): any;
|
|
187
205
|
visitCommentBlock?(this: Context & M, path: NodePath<namedTypes.CommentBlock>): any;
|
|
188
206
|
visitCommentLine?(this: Context & M, path: NodePath<namedTypes.CommentLine>): any;
|
|
189
207
|
visitDirective?(this: Context & M, path: NodePath<namedTypes.Directive>): any;
|
|
@@ -196,10 +214,8 @@ export interface Visitor<M = {}> {
|
|
|
196
214
|
visitBooleanLiteral?(this: Context & M, path: NodePath<namedTypes.BooleanLiteral>): any;
|
|
197
215
|
visitRegExpLiteral?(this: Context & M, path: NodePath<namedTypes.RegExpLiteral>): any;
|
|
198
216
|
visitObjectMethod?(this: Context & M, path: NodePath<namedTypes.ObjectMethod>): any;
|
|
199
|
-
visitClassPrivateProperty?(this: Context & M, path: NodePath<namedTypes.ClassPrivateProperty>): any;
|
|
200
217
|
visitClassMethod?(this: Context & M, path: NodePath<namedTypes.ClassMethod>): any;
|
|
201
218
|
visitClassPrivateMethod?(this: Context & M, path: NodePath<namedTypes.ClassPrivateMethod>): any;
|
|
202
|
-
visitPrivateName?(this: Context & M, path: NodePath<namedTypes.PrivateName>): any;
|
|
203
219
|
visitRestProperty?(this: Context & M, path: NodePath<namedTypes.RestProperty>): any;
|
|
204
220
|
visitForAwaitStatement?(this: Context & M, path: NodePath<namedTypes.ForAwaitStatement>): any;
|
|
205
221
|
visitImport?(this: Context & M, path: NodePath<namedTypes.Import>): any;
|
|
@@ -236,6 +252,7 @@ export interface Visitor<M = {}> {
|
|
|
236
252
|
visitTSDeclareMethod?(this: Context & M, path: NodePath<namedTypes.TSDeclareMethod>): any;
|
|
237
253
|
visitTSMappedType?(this: Context & M, path: NodePath<namedTypes.TSMappedType>): any;
|
|
238
254
|
visitTSTupleType?(this: Context & M, path: NodePath<namedTypes.TSTupleType>): any;
|
|
255
|
+
visitTSNamedTupleMember?(this: Context & M, path: NodePath<namedTypes.TSNamedTupleMember>): any;
|
|
239
256
|
visitTSRestType?(this: Context & M, path: NodePath<namedTypes.TSRestType>): any;
|
|
240
257
|
visitTSOptionalType?(this: Context & M, path: NodePath<namedTypes.TSOptionalType>): any;
|
|
241
258
|
visitTSIndexedAccessType?(this: Context & M, path: NodePath<namedTypes.TSIndexedAccessType>): any;
|
|
@@ -262,6 +279,4 @@ export interface Visitor<M = {}> {
|
|
|
262
279
|
visitTSInterfaceBody?(this: Context & M, path: NodePath<namedTypes.TSInterfaceBody>): any;
|
|
263
280
|
visitTSInterfaceDeclaration?(this: Context & M, path: NodePath<namedTypes.TSInterfaceDeclaration>): any;
|
|
264
281
|
visitTSParameterProperty?(this: Context & M, path: NodePath<namedTypes.TSParameterProperty>): any;
|
|
265
|
-
visitOptionalMemberExpression?(this: Context & M, path: NodePath<namedTypes.OptionalMemberExpression>): any;
|
|
266
|
-
visitOptionalCallExpression?(this: Context & M, path: NodePath<namedTypes.OptionalCallExpression>): any;
|
|
267
282
|
}
|
package/lib/equiv.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var types_1 = tslib_1.__importDefault(require("./types"));
|
|
7
5
|
function default_1(fork) {
|
|
8
6
|
var types = fork.use(types_1.default);
|
|
9
7
|
var getFieldNames = types.getFieldNames;
|
package/lib/node-path.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var types_1 = tslib_1.__importDefault(require("./types"));
|
|
5
|
+
var path_1 = tslib_1.__importDefault(require("./path"));
|
|
6
|
+
var scope_1 = tslib_1.__importDefault(require("./scope"));
|
|
9
7
|
function nodePathPlugin(fork) {
|
|
10
8
|
var types = fork.use(types_1.default);
|
|
11
9
|
var n = types.namedTypes;
|
package/lib/path-visitor.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var types_1 = tslib_1.__importDefault(require("./types"));
|
|
5
|
+
var node_path_1 = tslib_1.__importDefault(require("./node-path"));
|
|
8
6
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
9
7
|
function pathVisitorPlugin(fork) {
|
|
10
8
|
var types = fork.use(types_1.default);
|
package/lib/path.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var types_1 = tslib_1.__importDefault(require("./types"));
|
|
7
5
|
var Op = Object.prototype;
|
|
8
6
|
var hasOwn = Op.hasOwnProperty;
|
|
9
7
|
function pathPlugin(fork) {
|
package/lib/scope.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var types_1 = tslib_1.__importDefault(require("./types"));
|
|
7
5
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
8
6
|
function scopePlugin(fork) {
|
|
9
7
|
var types = fork.use(types_1.default);
|
|
@@ -118,7 +116,10 @@ function scopePlugin(fork) {
|
|
|
118
116
|
// A catch clause establishes a new scope but the only variable
|
|
119
117
|
// bound in that scope is the catch parameter. Any other
|
|
120
118
|
// declarations create bindings in the outer scope.
|
|
121
|
-
|
|
119
|
+
var param = path.get("param");
|
|
120
|
+
if (param.value) {
|
|
121
|
+
addPattern(param, bindings);
|
|
122
|
+
}
|
|
122
123
|
}
|
|
123
124
|
else {
|
|
124
125
|
recursiveScanScope(path, bindings, scopeTypes);
|
|
@@ -276,6 +277,8 @@ function scopePlugin(fork) {
|
|
|
276
277
|
}
|
|
277
278
|
else if ((namedTypes.SpreadElementPattern &&
|
|
278
279
|
namedTypes.SpreadElementPattern.check(pattern)) ||
|
|
280
|
+
(namedTypes.RestElement &&
|
|
281
|
+
namedTypes.RestElement.check(pattern)) ||
|
|
279
282
|
(namedTypes.SpreadPropertyPattern &&
|
|
280
283
|
namedTypes.SpreadPropertyPattern.check(pattern))) {
|
|
281
284
|
addPattern(patternPath.get('argument'), bindings);
|
package/lib/shared.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Fork } from "../types";
|
|
2
2
|
export default function (fork: Fork): {
|
|
3
|
-
geq: (than: any) => import("./types").Type<
|
|
3
|
+
geq: (than: any) => import("./types").Type<unknown>;
|
|
4
4
|
defaults: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
null: () => null;
|
|
6
|
+
emptyArray: () => never[];
|
|
7
|
+
false: () => boolean;
|
|
8
|
+
true: () => boolean;
|
|
9
|
+
undefined: () => void;
|
|
10
10
|
"use strict": () => string;
|
|
11
11
|
};
|
|
12
|
-
isPrimitive: import("./types").Type<
|
|
12
|
+
isPrimitive: import("./types").Type<unknown>;
|
|
13
13
|
};
|
package/lib/shared.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var types_1 = tslib_1.__importDefault(require("./types"));
|
|
7
5
|
function default_1(fork) {
|
|
8
6
|
var types = fork.use(types_1.default);
|
|
9
7
|
var Type = types.Type;
|
package/lib/types.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export default function typesPlugin(_fork: Fork): {
|
|
|
102
102
|
Type: {
|
|
103
103
|
or(...types: any[]): Type<any>;
|
|
104
104
|
from<T>(value: any, name?: string | undefined): Type<T>;
|
|
105
|
-
def(typeName: string): Def
|
|
105
|
+
def(typeName: string): Def;
|
|
106
106
|
hasDef(typeName: string): boolean;
|
|
107
107
|
};
|
|
108
108
|
builtInTypes: {
|
package/lib/types.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Def = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
16
5
|
var Op = Object.prototype;
|
|
17
6
|
var objToStr = Op.toString;
|
|
18
7
|
var hasOwn = Op.hasOwnProperty;
|
|
@@ -33,7 +22,7 @@ var BaseType = /** @class */ (function () {
|
|
|
33
22
|
return BaseType;
|
|
34
23
|
}());
|
|
35
24
|
var ArrayType = /** @class */ (function (_super) {
|
|
36
|
-
__extends(ArrayType, _super);
|
|
25
|
+
tslib_1.__extends(ArrayType, _super);
|
|
37
26
|
function ArrayType(elemType) {
|
|
38
27
|
var _this = _super.call(this) || this;
|
|
39
28
|
_this.elemType = elemType;
|
|
@@ -50,7 +39,7 @@ var ArrayType = /** @class */ (function (_super) {
|
|
|
50
39
|
return ArrayType;
|
|
51
40
|
}(BaseType));
|
|
52
41
|
var IdentityType = /** @class */ (function (_super) {
|
|
53
|
-
__extends(IdentityType, _super);
|
|
42
|
+
tslib_1.__extends(IdentityType, _super);
|
|
54
43
|
function IdentityType(value) {
|
|
55
44
|
var _this = _super.call(this) || this;
|
|
56
45
|
_this.value = value;
|
|
@@ -70,7 +59,7 @@ var IdentityType = /** @class */ (function (_super) {
|
|
|
70
59
|
return IdentityType;
|
|
71
60
|
}(BaseType));
|
|
72
61
|
var ObjectType = /** @class */ (function (_super) {
|
|
73
|
-
__extends(ObjectType, _super);
|
|
62
|
+
tslib_1.__extends(ObjectType, _super);
|
|
74
63
|
function ObjectType(fields) {
|
|
75
64
|
var _this = _super.call(this) || this;
|
|
76
65
|
_this.fields = fields;
|
|
@@ -89,7 +78,7 @@ var ObjectType = /** @class */ (function (_super) {
|
|
|
89
78
|
return ObjectType;
|
|
90
79
|
}(BaseType));
|
|
91
80
|
var OrType = /** @class */ (function (_super) {
|
|
92
|
-
__extends(OrType, _super);
|
|
81
|
+
tslib_1.__extends(OrType, _super);
|
|
93
82
|
function OrType(types) {
|
|
94
83
|
var _this = _super.call(this) || this;
|
|
95
84
|
_this.types = types;
|
|
@@ -107,7 +96,7 @@ var OrType = /** @class */ (function (_super) {
|
|
|
107
96
|
return OrType;
|
|
108
97
|
}(BaseType));
|
|
109
98
|
var PredicateType = /** @class */ (function (_super) {
|
|
110
|
-
__extends(PredicateType, _super);
|
|
99
|
+
tslib_1.__extends(PredicateType, _super);
|
|
111
100
|
function PredicateType(name, predicate) {
|
|
112
101
|
var _this = _super.call(this) || this;
|
|
113
102
|
_this.name = name;
|
|
@@ -304,11 +293,9 @@ function typesPlugin(_fork) {
|
|
|
304
293
|
};
|
|
305
294
|
var builtInCtorFns = [];
|
|
306
295
|
var builtInCtorTypes = [];
|
|
307
|
-
|
|
308
|
-
function defBuiltInType(example, name) {
|
|
296
|
+
function defBuiltInType(name, example) {
|
|
309
297
|
var objStr = objToStr.call(example);
|
|
310
298
|
var type = new PredicateType(name, function (value) { return objToStr.call(value) === objStr; });
|
|
311
|
-
builtInTypes[name] = type;
|
|
312
299
|
if (example && typeof example.constructor === "function") {
|
|
313
300
|
builtInCtorFns.push(example.constructor);
|
|
314
301
|
builtInCtorTypes.push(type);
|
|
@@ -319,16 +306,28 @@ function typesPlugin(_fork) {
|
|
|
319
306
|
// value, rather than using the problematic typeof operator. Note however
|
|
320
307
|
// that no subtyping is considered; so, for instance, isObject.check
|
|
321
308
|
// returns false for [], /./, new Date, and null.
|
|
322
|
-
var isString = defBuiltInType("
|
|
323
|
-
var isFunction = defBuiltInType(function () { }
|
|
324
|
-
var isArray = defBuiltInType(
|
|
325
|
-
var isObject = defBuiltInType(
|
|
326
|
-
var isRegExp = defBuiltInType(
|
|
327
|
-
var isDate = defBuiltInType(
|
|
328
|
-
var isNumber = defBuiltInType(
|
|
329
|
-
var isBoolean = defBuiltInType(
|
|
330
|
-
var isNull = defBuiltInType(null,
|
|
331
|
-
var isUndefined = defBuiltInType(
|
|
309
|
+
var isString = defBuiltInType("string", "truthy");
|
|
310
|
+
var isFunction = defBuiltInType("function", function () { });
|
|
311
|
+
var isArray = defBuiltInType("array", []);
|
|
312
|
+
var isObject = defBuiltInType("object", {});
|
|
313
|
+
var isRegExp = defBuiltInType("RegExp", /./);
|
|
314
|
+
var isDate = defBuiltInType("Date", new Date());
|
|
315
|
+
var isNumber = defBuiltInType("number", 3);
|
|
316
|
+
var isBoolean = defBuiltInType("boolean", true);
|
|
317
|
+
var isNull = defBuiltInType("null", null);
|
|
318
|
+
var isUndefined = defBuiltInType("undefined", undefined);
|
|
319
|
+
var builtInTypes = {
|
|
320
|
+
string: isString,
|
|
321
|
+
function: isFunction,
|
|
322
|
+
array: isArray,
|
|
323
|
+
object: isObject,
|
|
324
|
+
RegExp: isRegExp,
|
|
325
|
+
Date: isDate,
|
|
326
|
+
number: isNumber,
|
|
327
|
+
boolean: isBoolean,
|
|
328
|
+
null: isNull,
|
|
329
|
+
undefined: isUndefined,
|
|
330
|
+
};
|
|
332
331
|
// In order to return the same Def instance every time Type.def is called
|
|
333
332
|
// with a particular name, those instances need to be stored in a cache.
|
|
334
333
|
var defCache = Object.create(null);
|
|
@@ -346,7 +345,7 @@ function typesPlugin(_fork) {
|
|
|
346
345
|
return null;
|
|
347
346
|
}
|
|
348
347
|
var DefImpl = /** @class */ (function (_super) {
|
|
349
|
-
__extends(DefImpl, _super);
|
|
348
|
+
tslib_1.__extends(DefImpl, _super);
|
|
350
349
|
function DefImpl(typeName) {
|
|
351
350
|
var _this = _super.call(this, new PredicateType(typeName, function (value, deep) { return _this.check(value, deep); }), typeName) || this;
|
|
352
351
|
return _this;
|
package/main.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
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
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var fork_1 = tslib_1.__importDefault(require("./fork"));
|
|
6
|
+
var core_1 = tslib_1.__importDefault(require("./def/core"));
|
|
7
|
+
var es6_1 = tslib_1.__importDefault(require("./def/es6"));
|
|
8
|
+
var es2016_1 = tslib_1.__importDefault(require("./def/es2016"));
|
|
9
|
+
var es2017_1 = tslib_1.__importDefault(require("./def/es2017"));
|
|
10
|
+
var es2018_1 = tslib_1.__importDefault(require("./def/es2018"));
|
|
11
|
+
var es2019_1 = tslib_1.__importDefault(require("./def/es2019"));
|
|
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"));
|
|
17
19
|
var namedTypes_1 = require("./gen/namedTypes");
|
|
18
|
-
exports
|
|
20
|
+
Object.defineProperty(exports, "namedTypes", { enumerable: true, get: function () { return namedTypes_1.namedTypes; } });
|
|
19
21
|
var _a = fork_1.default([
|
|
20
22
|
// This core module of AST types captures ES5 as it is parsed today by
|
|
21
23
|
// git://github.com/ariya/esprima.git#master.
|
|
@@ -23,7 +25,10 @@ var _a = fork_1.default([
|
|
|
23
25
|
// Feel free to add to or remove from this list of extension modules to
|
|
24
26
|
// configure the precise type hierarchy that you need.
|
|
25
27
|
es6_1.default,
|
|
26
|
-
|
|
28
|
+
es2016_1.default,
|
|
29
|
+
es2017_1.default,
|
|
30
|
+
es2018_1.default,
|
|
31
|
+
es2019_1.default,
|
|
27
32
|
es2020_1.default,
|
|
28
33
|
jsx_1.default,
|
|
29
34
|
flow_1.default,
|
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.14.2",
|
|
5
5
|
"description": "Esprima-compatible implementation of the Mozilla JS Parser API",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"ast",
|
|
@@ -36,26 +36,28 @@
|
|
|
36
36
|
"prepack": "npm run clean && npm run gen && npm run build",
|
|
37
37
|
"postpack": "npm run clean"
|
|
38
38
|
},
|
|
39
|
-
"dependencies": {
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"tslib": "^2.0.1"
|
|
41
|
+
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@babel/parser": "7.
|
|
43
|
+
"@babel/parser": "7.11.4",
|
|
42
44
|
"@babel/types": "7.4.4",
|
|
43
45
|
"@types/esprima": "4.0.2",
|
|
44
|
-
"@types/glob": "7.1.
|
|
45
|
-
"@types/mocha": "
|
|
46
|
+
"@types/glob": "7.1.3",
|
|
47
|
+
"@types/mocha": "8.0.3",
|
|
46
48
|
"@types/node": "12.0.0",
|
|
47
|
-
"espree": "
|
|
49
|
+
"espree": "7.3.0",
|
|
48
50
|
"esprima": "4.0.1",
|
|
49
51
|
"esprima-fb": "15001.1001.0-dev-harmony-fb",
|
|
50
|
-
"flow-parser": "0.
|
|
51
|
-
"glob": "7.1.
|
|
52
|
-
"mocha": "
|
|
53
|
-
"recast": "0.
|
|
54
|
-
"reify": "0.20.
|
|
52
|
+
"flow-parser": "0.132.0",
|
|
53
|
+
"glob": "7.1.6",
|
|
54
|
+
"mocha": "^8.1.1",
|
|
55
|
+
"recast": "0.20.3",
|
|
56
|
+
"reify": "0.20.12",
|
|
55
57
|
"ts-add-module-exports": "1.0.0",
|
|
56
58
|
"ts-emit-clean": "1.0.0",
|
|
57
|
-
"ts-node": "
|
|
58
|
-
"typescript": "3.
|
|
59
|
+
"ts-node": "9.0.0",
|
|
60
|
+
"typescript": "3.9.7"
|
|
59
61
|
},
|
|
60
62
|
"engines": {
|
|
61
63
|
"node": ">=4"
|
package/tsconfig.json
CHANGED
package/.travis.yml
DELETED
package/def/es7.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var es6_1 = __importDefault(require("./es6"));
|
|
7
|
-
var types_1 = __importDefault(require("../lib/types"));
|
|
8
|
-
var shared_1 = __importDefault(require("../lib/shared"));
|
|
9
|
-
function default_1(fork) {
|
|
10
|
-
fork.use(es6_1.default);
|
|
11
|
-
var types = fork.use(types_1.default);
|
|
12
|
-
var def = types.Type.def;
|
|
13
|
-
var or = types.Type.or;
|
|
14
|
-
var defaults = fork.use(shared_1.default).defaults;
|
|
15
|
-
def("Function")
|
|
16
|
-
.field("async", Boolean, defaults["false"]);
|
|
17
|
-
def("SpreadProperty")
|
|
18
|
-
.bases("Node")
|
|
19
|
-
.build("argument")
|
|
20
|
-
.field("argument", def("Expression"));
|
|
21
|
-
def("ObjectExpression")
|
|
22
|
-
.field("properties", [or(def("Property"), def("SpreadProperty"), def("SpreadElement"))]);
|
|
23
|
-
def("SpreadPropertyPattern")
|
|
24
|
-
.bases("Pattern")
|
|
25
|
-
.build("argument")
|
|
26
|
-
.field("argument", def("Pattern"));
|
|
27
|
-
def("ObjectPattern")
|
|
28
|
-
.field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"))]);
|
|
29
|
-
def("AwaitExpression")
|
|
30
|
-
.bases("Expression")
|
|
31
|
-
.build("argument", "all")
|
|
32
|
-
.field("argument", or(def("Expression"), null))
|
|
33
|
-
.field("all", Boolean, defaults["false"]);
|
|
34
|
-
}
|
|
35
|
-
exports.default = default_1;
|
|
36
|
-
module.exports = exports["default"];
|