Debian Codegraph @

packages/babel-traverse/src/path/lib/virtual-types.ts

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 import type * as t from "@babel/types";
2
3 export interface VirtualTypeAliases {
4 BindingIdentifier: t.Identifier;
5 BlockScoped: t.Node;
6 ExistentialTypeParam: t.ExistsTypeAnnotation;
7 Expression: t.Expression;
8 Flow: t.Flow | t.ImportDeclaration | t.ExportDeclaration | t.ImportSpecifier;
9 ForAwaitStatement: t.ForOfStatement;
10 Generated: t.Node;
11 NumericLiteralTypeAnnotation: t.NumberLiteralTypeAnnotation;
12 Pure: t.Node;
13 Referenced: t.Node;
14 ReferencedIdentifier: t.Identifier | t.JSXIdentifier;
15 ReferencedMemberExpression: t.MemberExpression;
16 RestProperty: t.RestElement;
17 Scope: t.Scopable | t.Pattern;
18 SpreadProperty: t.RestElement;
19 Statement: t.Statement;
20 User: t.Node;
21 Var: t.VariableDeclaration;
22 }
23
24 type VirtualTypeMapping = readonly (t.Node["type"] | keyof t.Aliases)[] | null;
25
26 export const ReferencedIdentifier: VirtualTypeMapping = [
27 "Identifier",
28 "JSXIdentifier",
29 ] as const;
30
31 export const ReferencedMemberExpression: VirtualTypeMapping = [
32 "MemberExpression",
33 ] as const;
34
35 export const BindingIdentifier: VirtualTypeMapping = ["Identifier"] as const;
36
37 export const Statement: VirtualTypeMapping = ["Statement"] as const;
38
39 export const Expression: VirtualTypeMapping = ["Expression"] as const;
40
41 export const Scope: VirtualTypeMapping = ["Scopable", "Pattern"] as const;
42
•43 export const Referenced: VirtualTypeMapping = null;
44
•45 export const BlockScoped: VirtualTypeMapping = null;
46
47 export const Var: VirtualTypeMapping = ["VariableDeclaration"];
48
•49 export const User: VirtualTypeMapping = null;
50
•51 export const Generated: VirtualTypeMapping = null;
52
•53 export const Pure: VirtualTypeMapping = null;
54
55 export const Flow: VirtualTypeMapping = [
56 "Flow",
57 "ImportDeclaration",
58 "ExportDeclaration",
59 "ImportSpecifier",
60 ] as const;
61
62 // TODO: 7.0 Backwards Compat
63 export const RestProperty: VirtualTypeMapping = ["RestElement"] as const;
64
65 export const SpreadProperty: VirtualTypeMapping = ["RestElement"] as const;
66
67 export const ExistentialTypeParam: VirtualTypeMapping = [
68 "ExistsTypeAnnotation",
69 ] as const;
70
71 export const NumericLiteralTypeAnnotation: VirtualTypeMapping = [
72 "NumberLiteralTypeAnnotation",
73 ] as const;
74
75 export const ForAwaitStatement: VirtualTypeMapping = [
76 "ForOfStatement",
77 ] as const;