ast-types 0.13.0 → 0.13.4

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.
@@ -251,11 +251,13 @@ export declare namespace namedTypes {
251
251
  type: "NewExpression";
252
252
  callee: K.ExpressionKind;
253
253
  arguments: (K.ExpressionKind | K.SpreadElementKind)[];
254
+ typeArguments?: null | K.TypeParameterInstantiationKind;
254
255
  }
255
256
  interface CallExpression extends Omit<Expression, "type"> {
256
257
  type: "CallExpression";
257
258
  callee: K.ExpressionKind;
258
259
  arguments: (K.ExpressionKind | K.SpreadElementKind)[];
260
+ typeArguments?: null | K.TypeParameterInstantiationKind;
259
261
  }
260
262
  interface RestElement extends Omit<Pattern, "type"> {
261
263
  type: "RestElement";
@@ -441,6 +443,10 @@ export declare namespace namedTypes {
441
443
  argument: K.ExpressionKind | null;
442
444
  all?: boolean;
443
445
  }
446
+ interface ImportExpression extends Omit<Expression, "type"> {
447
+ type: "ImportExpression";
448
+ source: K.ExpressionKind;
449
+ }
444
450
  interface JSXAttribute extends Omit<Node, "type"> {
445
451
  type: "JSXAttribute";
446
452
  name: K.JSXIdentifierKind | K.JSXNamespacedNameKind;
@@ -1117,7 +1123,13 @@ export declare namespace namedTypes {
1117
1123
  }
1118
1124
  interface TSTupleType extends Omit<TSType, "type"> {
1119
1125
  type: "TSTupleType";
1120
- elementTypes: K.TSTypeKind[];
1126
+ elementTypes: (K.TSTypeKind | K.TSNamedTupleMemberKind)[];
1127
+ }
1128
+ interface TSNamedTupleMember extends Omit<TSType, "type"> {
1129
+ type: "TSNamedTupleMember";
1130
+ label: K.IdentifierKind;
1131
+ optional?: boolean;
1132
+ elementType: K.TSTypeKind;
1121
1133
  }
1122
1134
  interface TSRestType extends Omit<TSType, "type"> {
1123
1135
  type: "TSRestType";
@@ -1157,10 +1169,11 @@ export declare namespace namedTypes {
1157
1169
  optional?: boolean;
1158
1170
  parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1159
1171
  }
1160
- interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAnnotation"> {
1172
+ interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAnnotation">, Omit<TSType, "type"> {
1161
1173
  type: "TSTypePredicate";
1162
1174
  parameterName: K.IdentifierKind | K.TSThisTypeKind;
1163
- typeAnnotation: K.TSTypeAnnotationKind;
1175
+ typeAnnotation?: K.TSTypeAnnotationKind | null;
1176
+ asserts?: boolean;
1164
1177
  }
1165
1178
  interface TSCallSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1166
1179
  type: "TSCallSignatureDeclaration";
@@ -1264,7 +1277,7 @@ export declare namespace namedTypes {
1264
1277
  type: "OptionalCallExpression";
1265
1278
  optional?: boolean;
1266
1279
  }
1267
- type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | MemberExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression | JSXAttribute | JSXIdentifier | JSXNamespacedName | JSXExpressionContainer | JSXMemberExpression | JSXSpreadAttribute | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXText | JSXOpeningFragment | JSXClosingFragment | JSXEmptyExpression | JSXSpreadChild | TypeParameterDeclaration | TSTypeParameterDeclaration | TypeParameterInstantiation | TSTypeParameterInstantiation | ClassImplements | TSExpressionWithTypeArguments | AnyTypeAnnotation | EmptyTypeAnnotation | MixedTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | NumberLiteralTypeAnnotation | NumericLiteralTypeAnnotation | StringTypeAnnotation | StringLiteralTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullableTypeAnnotation | NullLiteralTypeAnnotation | NullTypeAnnotation | ThisTypeAnnotation | ExistsTypeAnnotation | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | ArrayTypeAnnotation | ObjectTypeAnnotation | ObjectTypeProperty | ObjectTypeSpreadProperty | ObjectTypeIndexer | ObjectTypeCallProperty | ObjectTypeInternalSlot | Variance | QualifiedTypeIdentifier | GenericTypeAnnotation | MemberTypeAnnotation | UnionTypeAnnotation | IntersectionTypeAnnotation | TypeofTypeAnnotation | TypeParameter | InterfaceTypeAnnotation | InterfaceExtends | InterfaceDeclaration | DeclareInterface | TypeAlias | OpaqueType | DeclareTypeAlias | DeclareOpaqueType | TypeCastExpression | TupleTypeAnnotation | DeclareVariable | DeclareFunction | DeclareClass | DeclareModule | DeclareModuleExports | DeclareExportDeclaration | ExportSpecifier | ExportBatchSpecifier | DeclareExportAllDeclaration | InferredPredicate | DeclaredPredicate | ExportDeclaration | Block | Line | Noop | DoExpression | Super | BindExpression | Decorator | MetaProperty | ParenthesizedExpression | ExportDefaultDeclaration | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportDefaultSpecifier | ExportAllDeclaration | CommentBlock | CommentLine | Directive | DirectiveLiteral | InterpreterDirective | StringLiteral | NumericLiteral | BigIntLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ObjectMethod | ClassPrivateProperty | ClassMethod | ClassPrivateMethod | PrivateName | RestProperty | ForAwaitStatement | Import | TSQualifiedName | TSTypeReference | TSAsExpression | TSNonNullExpression | TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSArrayType | TSLiteralType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSTypeParameter | TSParenthesizedType | TSFunctionType | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSMappedType | TSTupleType | TSRestType | TSOptionalType | TSIndexedAccessType | TSTypeOperator | TSIndexSignature | TSPropertySignature | TSMethodSignature | TSTypePredicate | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSEnumMember | TSTypeQuery | TSImportType | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;
1280
+ type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | MemberExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression | ImportExpression | JSXAttribute | JSXIdentifier | JSXNamespacedName | JSXExpressionContainer | JSXMemberExpression | JSXSpreadAttribute | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXText | JSXOpeningFragment | JSXClosingFragment | JSXEmptyExpression | JSXSpreadChild | TypeParameterDeclaration | TSTypeParameterDeclaration | TypeParameterInstantiation | TSTypeParameterInstantiation | ClassImplements | TSExpressionWithTypeArguments | AnyTypeAnnotation | EmptyTypeAnnotation | MixedTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | NumberLiteralTypeAnnotation | NumericLiteralTypeAnnotation | StringTypeAnnotation | StringLiteralTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullableTypeAnnotation | NullLiteralTypeAnnotation | NullTypeAnnotation | ThisTypeAnnotation | ExistsTypeAnnotation | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | ArrayTypeAnnotation | ObjectTypeAnnotation | ObjectTypeProperty | ObjectTypeSpreadProperty | ObjectTypeIndexer | ObjectTypeCallProperty | ObjectTypeInternalSlot | Variance | QualifiedTypeIdentifier | GenericTypeAnnotation | MemberTypeAnnotation | UnionTypeAnnotation | IntersectionTypeAnnotation | TypeofTypeAnnotation | TypeParameter | InterfaceTypeAnnotation | InterfaceExtends | InterfaceDeclaration | DeclareInterface | TypeAlias | OpaqueType | DeclareTypeAlias | DeclareOpaqueType | TypeCastExpression | TupleTypeAnnotation | DeclareVariable | DeclareFunction | DeclareClass | DeclareModule | DeclareModuleExports | DeclareExportDeclaration | ExportSpecifier | ExportBatchSpecifier | DeclareExportAllDeclaration | InferredPredicate | DeclaredPredicate | ExportDeclaration | Block | Line | Noop | DoExpression | Super | BindExpression | Decorator | MetaProperty | ParenthesizedExpression | ExportDefaultDeclaration | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportDefaultSpecifier | ExportAllDeclaration | CommentBlock | CommentLine | Directive | DirectiveLiteral | InterpreterDirective | StringLiteral | NumericLiteral | BigIntLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ObjectMethod | ClassPrivateProperty | ClassMethod | ClassPrivateMethod | PrivateName | RestProperty | ForAwaitStatement | Import | TSQualifiedName | TSTypeReference | TSAsExpression | TSNonNullExpression | TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSArrayType | TSLiteralType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSTypeParameter | TSParenthesizedType | TSFunctionType | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSMappedType | TSTupleType | TSNamedTupleMember | TSRestType | TSOptionalType | TSIndexedAccessType | TSTypeOperator | TSIndexSignature | TSPropertySignature | TSMethodSignature | TSTypePredicate | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSEnumMember | TSTypeQuery | TSImportType | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;
1268
1281
  let Printable: Type<Printable>;
1269
1282
  let SourceLocation: Type<SourceLocation>;
1270
1283
  let Node: Type<Node>;
@@ -1350,6 +1363,7 @@ export declare namespace namedTypes {
1350
1363
  let SpreadProperty: Type<SpreadProperty>;
1351
1364
  let SpreadPropertyPattern: Type<SpreadPropertyPattern>;
1352
1365
  let AwaitExpression: Type<AwaitExpression>;
1366
+ let ImportExpression: Type<ImportExpression>;
1353
1367
  let JSXAttribute: Type<JSXAttribute>;
1354
1368
  let JSXIdentifier: Type<JSXIdentifier>;
1355
1369
  let JSXNamespacedName: Type<JSXNamespacedName>;
@@ -1498,6 +1512,7 @@ export declare namespace namedTypes {
1498
1512
  let TSDeclareMethod: Type<TSDeclareMethod>;
1499
1513
  let TSMappedType: Type<TSMappedType>;
1500
1514
  let TSTupleType: Type<TSTupleType>;
1515
+ let TSNamedTupleMember: Type<TSNamedTupleMember>;
1501
1516
  let TSRestType: Type<TSRestType>;
1502
1517
  let TSOptionalType: Type<TSOptionalType>;
1503
1518
  let TSIndexedAccessType: Type<TSIndexedAccessType>;
@@ -1613,6 +1628,7 @@ export interface NamedTypes {
1613
1628
  SpreadProperty: Type<namedTypes.SpreadProperty>;
1614
1629
  SpreadPropertyPattern: Type<namedTypes.SpreadPropertyPattern>;
1615
1630
  AwaitExpression: Type<namedTypes.AwaitExpression>;
1631
+ ImportExpression: Type<namedTypes.ImportExpression>;
1616
1632
  JSXAttribute: Type<namedTypes.JSXAttribute>;
1617
1633
  JSXIdentifier: Type<namedTypes.JSXIdentifier>;
1618
1634
  JSXNamespacedName: Type<namedTypes.JSXNamespacedName>;
@@ -1761,6 +1777,7 @@ export interface NamedTypes {
1761
1777
  TSDeclareMethod: Type<namedTypes.TSDeclareMethod>;
1762
1778
  TSMappedType: Type<namedTypes.TSMappedType>;
1763
1779
  TSTupleType: Type<namedTypes.TSTupleType>;
1780
+ TSNamedTupleMember: Type<namedTypes.TSNamedTupleMember>;
1764
1781
  TSRestType: Type<namedTypes.TSRestType>;
1765
1782
  TSOptionalType: Type<namedTypes.TSOptionalType>;
1766
1783
  TSIndexedAccessType: Type<namedTypes.TSIndexedAccessType>;
package/gen/namedTypes.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.namedTypes = void 0;
3
4
  var namedTypes;
4
5
  (function (namedTypes) {
5
6
  })(namedTypes = exports.namedTypes || (exports.namedTypes = {}));
package/gen/visitor.d.ts CHANGED
@@ -87,6 +87,7 @@ export interface Visitor<M = {}> {
87
87
  visitSpreadProperty?(this: Context & M, path: NodePath<namedTypes.SpreadProperty>): any;
88
88
  visitSpreadPropertyPattern?(this: Context & M, path: NodePath<namedTypes.SpreadPropertyPattern>): any;
89
89
  visitAwaitExpression?(this: Context & M, path: NodePath<namedTypes.AwaitExpression>): any;
90
+ visitImportExpression?(this: Context & M, path: NodePath<namedTypes.ImportExpression>): any;
90
91
  visitJSXAttribute?(this: Context & M, path: NodePath<namedTypes.JSXAttribute>): any;
91
92
  visitJSXIdentifier?(this: Context & M, path: NodePath<namedTypes.JSXIdentifier>): any;
92
93
  visitJSXNamespacedName?(this: Context & M, path: NodePath<namedTypes.JSXNamespacedName>): any;
@@ -235,6 +236,7 @@ export interface Visitor<M = {}> {
235
236
  visitTSDeclareMethod?(this: Context & M, path: NodePath<namedTypes.TSDeclareMethod>): any;
236
237
  visitTSMappedType?(this: Context & M, path: NodePath<namedTypes.TSMappedType>): any;
237
238
  visitTSTupleType?(this: Context & M, path: NodePath<namedTypes.TSTupleType>): any;
239
+ visitTSNamedTupleMember?(this: Context & M, path: NodePath<namedTypes.TSNamedTupleMember>): any;
238
240
  visitTSRestType?(this: Context & M, path: NodePath<namedTypes.TSRestType>): any;
239
241
  visitTSOptionalType?(this: Context & M, path: NodePath<namedTypes.TSOptionalType>): any;
240
242
  visitTSIndexedAccessType?(this: Context & M, path: NodePath<namedTypes.TSIndexedAccessType>): any;
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 types_1 = __importDefault(require("./types"));
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 types_1 = __importDefault(require("./types"));
7
- var path_1 = __importDefault(require("./path"));
8
- var scope_1 = __importDefault(require("./scope"));
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;
@@ -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 types_1 = __importDefault(require("./types"));
7
- var node_path_1 = __importDefault(require("./node-path"));
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 types_1 = __importDefault(require("./types"));
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 types_1 = __importDefault(require("./types"));
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
- addPattern(path.get("param"), bindings);
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);
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
- "null": () => null;
6
- "emptyArray": () => never[];
7
- "false": () => boolean;
8
- "true": () => boolean;
9
- "undefined": () => void;
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 types_1 = __importDefault(require("./types"));
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<any>;
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
- var builtInTypes = {};
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("truthy", "string");
323
- var isFunction = defBuiltInType(function () { }, "function");
324
- var isArray = defBuiltInType([], "array");
325
- var isObject = defBuiltInType({}, "object");
326
- var isRegExp = defBuiltInType(/./, "RegExp");
327
- var isDate = defBuiltInType(new Date, "Date");
328
- var isNumber = defBuiltInType(3, "number");
329
- var isBoolean = defBuiltInType(true, "boolean");
330
- var isNull = defBuiltInType(null, "null");
331
- var isUndefined = defBuiltInType(void 0, "undefined");
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,20 +1,20 @@
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 fork_1 = __importDefault(require("./fork"));
7
- var core_1 = __importDefault(require("./def/core"));
8
- var es6_1 = __importDefault(require("./def/es6"));
9
- var es7_1 = __importDefault(require("./def/es7"));
10
- var jsx_1 = __importDefault(require("./def/jsx"));
11
- var flow_1 = __importDefault(require("./def/flow"));
12
- var esprima_1 = __importDefault(require("./def/esprima"));
13
- var babel_1 = __importDefault(require("./def/babel"));
14
- var typescript_1 = __importDefault(require("./def/typescript"));
15
- var es_proposals_1 = __importDefault(require("./def/es-proposals"));
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 es7_1 = tslib_1.__importDefault(require("./def/es7"));
9
+ var es2020_1 = tslib_1.__importDefault(require("./def/es2020"));
10
+ var jsx_1 = tslib_1.__importDefault(require("./def/jsx"));
11
+ var flow_1 = tslib_1.__importDefault(require("./def/flow"));
12
+ var esprima_1 = tslib_1.__importDefault(require("./def/esprima"));
13
+ var babel_1 = tslib_1.__importDefault(require("./def/babel"));
14
+ var typescript_1 = tslib_1.__importDefault(require("./def/typescript"));
15
+ var es_proposals_1 = tslib_1.__importDefault(require("./def/es-proposals"));
16
16
  var namedTypes_1 = require("./gen/namedTypes");
17
- exports.namedTypes = namedTypes_1.namedTypes;
17
+ Object.defineProperty(exports, "namedTypes", { enumerable: true, get: function () { return namedTypes_1.namedTypes; } });
18
18
  var _a = fork_1.default([
19
19
  // This core module of AST types captures ES5 as it is parsed today by
20
20
  // git://github.com/ariya/esprima.git#master.
@@ -23,6 +23,7 @@ var _a = fork_1.default([
23
23
  // configure the precise type hierarchy that you need.
24
24
  es6_1.default,
25
25
  es7_1.default,
26
+ es2020_1.default,
26
27
  jsx_1.default,
27
28
  flow_1.default,
28
29
  esprima_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.13.0",
4
+ "version": "0.13.4",
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.4.4",
43
+ "@babel/parser": "7.7.7",
42
44
  "@babel/types": "7.4.4",
43
45
  "@types/esprima": "4.0.2",
44
46
  "@types/glob": "7.1.1",
45
47
  "@types/mocha": "5.2.6",
46
48
  "@types/node": "12.0.0",
47
- "espree": "5.0.1",
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.98.1",
51
- "glob": "7.1.4",
52
+ "flow-parser": "0.132.0",
53
+ "glob": "7.1.6",
52
54
  "mocha": "6.1.4",
53
- "recast": "0.17.6",
54
- "reify": "0.18.1",
55
+ "recast": "0.20.0",
56
+ "reify": "0.20.12",
55
57
  "ts-add-module-exports": "1.0.0",
56
58
  "ts-emit-clean": "1.0.0",
57
59
  "ts-node": "7.0.1",
58
- "typescript": "3.4.5"
60
+ "typescript": "3.9.7"
59
61
  },
60
62
  "engines": {
61
63
  "node": ">=4"
package/tsconfig.json CHANGED
@@ -10,6 +10,7 @@
10
10
  "noImplicitReturns": true,
11
11
  "moduleResolution": "node",
12
12
  "esModuleInterop": true,
13
+ "importHelpers": true,
13
14
  "stripInternal": true,
14
15
  "lib": ["es2015"]
15
16
  },
package/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "12"
4
- - "11"
5
- - "10"
6
- - "9"
7
- - "8"
8
- - "7"
9
- - "6"
10
-
11
- sudo: false