@babel/traverse 7.1.0 → 7.23.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.
Files changed (61) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/lib/cache.js +27 -7
  4. package/lib/cache.js.map +1 -0
  5. package/lib/context.js +22 -59
  6. package/lib/context.js.map +1 -0
  7. package/lib/hub.js +2 -6
  8. package/lib/hub.js.map +1 -0
  9. package/lib/index.js +42 -77
  10. package/lib/index.js.map +1 -0
  11. package/lib/path/ancestry.js +15 -62
  12. package/lib/path/ancestry.js.map +1 -0
  13. package/lib/path/comments.js +31 -24
  14. package/lib/path/comments.js.map +1 -0
  15. package/lib/path/context.js +68 -91
  16. package/lib/path/context.js.map +1 -0
  17. package/lib/path/conversion.js +275 -273
  18. package/lib/path/conversion.js.map +1 -0
  19. package/lib/path/evaluation.js +84 -149
  20. package/lib/path/evaluation.js.map +1 -0
  21. package/lib/path/family.js +189 -94
  22. package/lib/path/family.js.map +1 -0
  23. package/lib/path/index.js +106 -132
  24. package/lib/path/index.js.map +1 -0
  25. package/lib/path/inference/index.js +81 -64
  26. package/lib/path/inference/index.js.map +1 -0
  27. package/lib/path/inference/inferer-reference.js +22 -52
  28. package/lib/path/inference/inferer-reference.js.map +1 -0
  29. package/lib/path/inference/inferers.js +110 -125
  30. package/lib/path/inference/inferers.js.map +1 -0
  31. package/lib/path/inference/util.js +30 -0
  32. package/lib/path/inference/util.js.map +1 -0
  33. package/lib/path/introspection.js +182 -168
  34. package/lib/path/introspection.js.map +1 -0
  35. package/lib/path/lib/hoister.js +37 -54
  36. package/lib/path/lib/hoister.js.map +1 -0
  37. package/lib/path/lib/removal-hooks.js +4 -4
  38. package/lib/path/lib/removal-hooks.js.map +1 -0
  39. package/lib/path/lib/virtual-types-validator.js +161 -0
  40. package/lib/path/lib/virtual-types-validator.js.map +1 -0
  41. package/lib/path/lib/virtual-types.js +21 -189
  42. package/lib/path/lib/virtual-types.js.map +1 -0
  43. package/lib/path/modification.js +103 -98
  44. package/lib/path/modification.js.map +1 -0
  45. package/lib/path/removal.js +18 -23
  46. package/lib/path/removal.js.map +1 -0
  47. package/lib/path/replacement.js +91 -144
  48. package/lib/path/replacement.js.map +1 -0
  49. package/lib/scope/binding.js +28 -16
  50. package/lib/scope/binding.js.map +1 -0
  51. package/lib/scope/index.js +407 -414
  52. package/lib/scope/index.js.map +1 -0
  53. package/lib/scope/lib/renamer.js +45 -70
  54. package/lib/scope/lib/renamer.js.map +1 -0
  55. package/lib/traverse-node.js +29 -0
  56. package/lib/traverse-node.js.map +1 -0
  57. package/lib/types.js +3 -0
  58. package/lib/types.js.map +1 -0
  59. package/lib/visitors.js +77 -113
  60. package/lib/visitors.js.map +1 -0
  61. package/package.json +28 -17
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2018 Sebastian McKenzie and other contributors
3
+ Copyright (c) 2014-present Sebastian McKenzie and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes
4
4
 
5
- See our website [@babel/traverse](https://babeljs.io/docs/en/next/babel-traverse.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22+is%3Aopen) associated with this package.
5
+ See our website [@babel/traverse](https://babeljs.io/docs/babel-traverse) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20traverse%22+is%3Aopen) associated with this package.
6
6
 
7
7
  ## Install
8
8
 
package/lib/cache.js CHANGED
@@ -6,21 +6,41 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.clear = clear;
7
7
  exports.clearPath = clearPath;
8
8
  exports.clearScope = clearScope;
9
+ exports.getCachedPaths = getCachedPaths;
10
+ exports.getOrCreateCachedPaths = getOrCreateCachedPaths;
9
11
  exports.scope = exports.path = void 0;
10
- let path = new WeakMap();
11
- exports.path = path;
12
+ let pathsCache = new WeakMap();
13
+ exports.path = pathsCache;
12
14
  let scope = new WeakMap();
13
15
  exports.scope = scope;
14
-
15
16
  function clear() {
16
17
  clearPath();
17
18
  clearScope();
18
19
  }
19
-
20
20
  function clearPath() {
21
- exports.path = path = new WeakMap();
21
+ exports.path = pathsCache = new WeakMap();
22
22
  }
23
-
24
23
  function clearScope() {
25
24
  exports.scope = scope = new WeakMap();
26
- }
25
+ }
26
+ const nullHub = Object.freeze({});
27
+ function getCachedPaths(hub, parent) {
28
+ var _pathsCache$get, _hub;
29
+ {
30
+ hub = null;
31
+ }
32
+ return (_pathsCache$get = pathsCache.get((_hub = hub) != null ? _hub : nullHub)) == null ? void 0 : _pathsCache$get.get(parent);
33
+ }
34
+ function getOrCreateCachedPaths(hub, parent) {
35
+ var _hub2, _hub3;
36
+ {
37
+ hub = null;
38
+ }
39
+ let parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub);
40
+ if (!parents) pathsCache.set((_hub3 = hub) != null ? _hub3 : nullHub, parents = new WeakMap());
41
+ let paths = parents.get(parent);
42
+ if (!paths) parents.set(parent, paths = new Map());
43
+ return paths;
44
+ }
45
+
46
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pathsCache","WeakMap","exports","path","scope","clear","clearPath","clearScope","nullHub","Object","freeze","getCachedPaths","hub","parent","_pathsCache$get","_hub","get","getOrCreateCachedPaths","_hub2","_hub3","parents","set","paths","Map"],"sources":["../src/cache.ts"],"sourcesContent":["import type { Node } from \"@babel/types\";\nimport type NodePath from \"./path/index.ts\";\nimport type Scope from \"./scope/index.ts\";\nimport type { HubInterface } from \"./hub.ts\";\n\nlet pathsCache: WeakMap<\n HubInterface | typeof nullHub,\n WeakMap<Node, Map<Node, NodePath>>\n> = new WeakMap();\nexport { pathsCache as path };\nexport let scope: WeakMap<Node, Scope> = new WeakMap();\n\nexport function clear() {\n clearPath();\n clearScope();\n}\n\nexport function clearPath() {\n pathsCache = new WeakMap();\n}\n\nexport function clearScope() {\n scope = new WeakMap();\n}\n\n// NodePath#hub can be null, but it's not a valid weakmap key because it\n// cannot be collected by GC. Use an object, knowing tht it will not be\n// collected anyway. It's not a memory leak because pathsCache.get(nullHub)\n// is itself a weakmap, so its entries can still be collected.\nconst nullHub = Object.freeze({} as const);\n\nexport function getCachedPaths(hub: HubInterface | null, parent: Node) {\n if (!process.env.BABEL_8_BREAKING) {\n // Only use Hub as part of the cache key in Babel 8, because it is a\n // breaking change (it causes incompatibilities with older `@babel/core`\n // versions: see https://github.com/babel/babel/pull/15759)\n hub = null;\n }\n return pathsCache.get(hub ?? nullHub)?.get(parent);\n}\n\nexport function getOrCreateCachedPaths(hub: HubInterface | null, parent: Node) {\n if (!process.env.BABEL_8_BREAKING) {\n hub = null;\n }\n\n let parents = pathsCache.get(hub ?? nullHub);\n if (!parents) pathsCache.set(hub ?? nullHub, (parents = new WeakMap()));\n\n let paths = parents.get(parent);\n if (!paths) parents.set(parent, (paths = new Map()));\n\n return paths;\n}\n"],"mappings":";;;;;;;;;;;AAKA,IAAIA,UAGH,GAAG,IAAIC,OAAO,CAAC,CAAC;AAACC,OAAA,CAAAC,IAAA,GAAAH,UAAA;AAEX,IAAII,KAA2B,GAAG,IAAIH,OAAO,CAAC,CAAC;AAACC,OAAA,CAAAE,KAAA,GAAAA,KAAA;AAEhD,SAASC,KAAKA,CAAA,EAAG;EACtBC,SAAS,CAAC,CAAC;EACXC,UAAU,CAAC,CAAC;AACd;AAEO,SAASD,SAASA,CAAA,EAAG;EAC1BJ,OAAA,CAAAC,IAAA,GAAAH,UAAU,GAAG,IAAIC,OAAO,CAAC,CAAC;AAC5B;AAEO,SAASM,UAAUA,CAAA,EAAG;EAC3BL,OAAA,CAAAE,KAAA,GAAAA,KAAK,GAAG,IAAIH,OAAO,CAAC,CAAC;AACvB;AAMA,MAAMO,OAAO,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAU,CAAC;AAEnC,SAASC,cAAcA,CAACC,GAAwB,EAAEC,MAAY,EAAE;EAAA,IAAAC,eAAA,EAAAC,IAAA;EAClC;IAIjCH,GAAG,GAAG,IAAI;EACZ;EACA,QAAAE,eAAA,GAAOd,UAAU,CAACgB,GAAG,EAAAD,IAAA,GAACH,GAAG,YAAAG,IAAA,GAAIP,OAAO,CAAC,qBAA9BM,eAAA,CAAgCE,GAAG,CAACH,MAAM,CAAC;AACpD;AAEO,SAASI,sBAAsBA,CAACL,GAAwB,EAAEC,MAAY,EAAE;EAAA,IAAAK,KAAA,EAAAC,KAAA;EAC1C;IACjCP,GAAG,GAAG,IAAI;EACZ;EAEA,IAAIQ,OAAO,GAAGpB,UAAU,CAACgB,GAAG,EAAAE,KAAA,GAACN,GAAG,YAAAM,KAAA,GAAIV,OAAO,CAAC;EAC5C,IAAI,CAACY,OAAO,EAAEpB,UAAU,CAACqB,GAAG,EAAAF,KAAA,GAACP,GAAG,YAAAO,KAAA,GAAIX,OAAO,EAAGY,OAAO,GAAG,IAAInB,OAAO,CAAC,CAAE,CAAC;EAEvE,IAAIqB,KAAK,GAAGF,OAAO,CAACJ,GAAG,CAACH,MAAM,CAAC;EAC/B,IAAI,CAACS,KAAK,EAAEF,OAAO,CAACC,GAAG,CAACR,MAAM,EAAGS,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAE,CAAC;EAEpD,OAAOD,KAAK;AACd"}
package/lib/context.js CHANGED
@@ -4,63 +4,43 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- var _path = _interopRequireDefault(require("./path"));
9
-
10
- function t() {
11
- const data = _interopRequireWildcard(require("@babel/types"));
12
-
13
- t = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- const testing = process.env.NODE_ENV === "test";
25
-
7
+ var _index = require("./path/index.js");
8
+ var _t = require("@babel/types");
9
+ const {
10
+ VISITOR_KEYS
11
+ } = _t;
26
12
  class TraversalContext {
27
13
  constructor(scope, opts, state, parentPath) {
28
14
  this.queue = null;
15
+ this.priorityQueue = null;
29
16
  this.parentPath = parentPath;
30
17
  this.scope = scope;
31
18
  this.state = state;
32
19
  this.opts = opts;
33
20
  }
34
-
35
21
  shouldVisit(node) {
36
22
  const opts = this.opts;
37
23
  if (opts.enter || opts.exit) return true;
38
24
  if (opts[node.type]) return true;
39
- const keys = t().VISITOR_KEYS[node.type];
40
- if (!keys || !keys.length) return false;
41
-
25
+ const keys = VISITOR_KEYS[node.type];
26
+ if (!(keys != null && keys.length)) return false;
42
27
  for (const key of keys) {
43
- if (node[key]) return true;
28
+ if (node[key]) {
29
+ return true;
30
+ }
44
31
  }
45
-
46
32
  return false;
47
33
  }
48
-
49
- create(node, obj, key, listKey) {
50
- return _path.default.get({
34
+ create(node, container, key, listKey) {
35
+ return _index.default.get({
51
36
  parentPath: this.parentPath,
52
37
  parent: node,
53
- container: obj,
38
+ container,
54
39
  key: key,
55
40
  listKey
56
41
  });
57
42
  }
58
-
59
43
  maybeQueue(path, notPriority) {
60
- if (this.trap) {
61
- throw new Error("Infinite cycle detected");
62
- }
63
-
64
44
  if (this.queue) {
65
45
  if (notPriority) {
66
46
  this.queue.push(path);
@@ -69,22 +49,17 @@ class TraversalContext {
69
49
  }
70
50
  }
71
51
  }
72
-
73
52
  visitMultiple(container, parent, listKey) {
74
53
  if (container.length === 0) return false;
75
54
  const queue = [];
76
-
77
55
  for (let key = 0; key < container.length; key++) {
78
56
  const node = container[key];
79
-
80
57
  if (node && this.shouldVisit(node)) {
81
58
  queue.push(this.create(parent, container, key, listKey));
82
59
  }
83
60
  }
84
-
85
61
  return this.visitQueue(queue);
86
62
  }
87
-
88
63
  visitSingle(node, key) {
89
64
  if (this.shouldVisit(node[key])) {
90
65
  return this.visitQueue([this.create(node, node, key)]);
@@ -92,34 +67,26 @@ class TraversalContext {
92
67
  return false;
93
68
  }
94
69
  }
95
-
96
70
  visitQueue(queue) {
97
71
  this.queue = queue;
98
72
  this.priorityQueue = [];
99
- const visited = [];
73
+ const visited = new WeakSet();
100
74
  let stop = false;
101
-
102
75
  for (const path of queue) {
103
76
  path.resync();
104
-
105
77
  if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
106
78
  path.pushContext(this);
107
79
  }
108
-
109
80
  if (path.key === null) continue;
110
-
111
- if (testing && queue.length >= 10000) {
112
- this.trap = true;
113
- }
114
-
115
- if (visited.indexOf(path.node) >= 0) continue;
116
- visited.push(path.node);
117
-
81
+ const {
82
+ node
83
+ } = path;
84
+ if (visited.has(node)) continue;
85
+ if (node) visited.add(node);
118
86
  if (path.visit()) {
119
87
  stop = true;
120
88
  break;
121
89
  }
122
-
123
90
  if (this.priorityQueue.length) {
124
91
  stop = this.visitQueue(this.priorityQueue);
125
92
  this.priorityQueue = [];
@@ -127,26 +94,22 @@ class TraversalContext {
127
94
  if (stop) break;
128
95
  }
129
96
  }
130
-
131
97
  for (const path of queue) {
132
98
  path.popContext();
133
99
  }
134
-
135
100
  this.queue = null;
136
101
  return stop;
137
102
  }
138
-
139
103
  visit(node, key) {
140
104
  const nodes = node[key];
141
105
  if (!nodes) return false;
142
-
143
106
  if (Array.isArray(nodes)) {
144
107
  return this.visitMultiple(nodes, node, key);
145
108
  } else {
146
109
  return this.visitSingle(node, key);
147
110
  }
148
111
  }
149
-
150
112
  }
113
+ exports.default = TraversalContext;
151
114
 
152
- exports.default = TraversalContext;
115
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_index","require","_t","VISITOR_KEYS","TraversalContext","constructor","scope","opts","state","parentPath","queue","priorityQueue","shouldVisit","node","enter","exit","type","keys","length","key","create","container","listKey","NodePath","get","parent","maybeQueue","path","notPriority","push","visitMultiple","visitQueue","visitSingle","visited","WeakSet","stop","resync","contexts","pushContext","has","add","visit","popContext","nodes","Array","isArray","exports","default"],"sources":["../src/context.ts"],"sourcesContent":["import NodePath from \"./path/index.ts\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type Scope from \"./scope/index.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Visitor } from \"./types.ts\";\n\nexport default class TraversalContext<S = unknown> {\n constructor(\n scope: Scope,\n opts: ExplodedTraverseOptions<S>,\n state: S,\n parentPath: NodePath,\n ) {\n this.parentPath = parentPath;\n this.scope = scope;\n this.state = state;\n this.opts = opts;\n }\n\n declare parentPath: NodePath;\n declare scope: Scope;\n declare state: S;\n declare opts: ExplodedTraverseOptions<S>;\n queue: Array<NodePath> | null = null;\n priorityQueue: Array<NodePath> | null = null;\n\n /**\n * This method does a simple check to determine whether or not we really need to attempt\n * visit a node. This will prevent us from constructing a NodePath.\n */\n\n shouldVisit(node: t.Node): boolean {\n const opts = this.opts as Visitor;\n if (opts.enter || opts.exit) return true;\n\n // check if we have a visitor for this node\n if (opts[node.type]) return true;\n\n // check if we're going to traverse into this node\n const keys: Array<string> | undefined = VISITOR_KEYS[node.type];\n if (!keys?.length) return false;\n\n // we need to traverse into this node so ensure that it has children to traverse into!\n for (const key of keys) {\n if (\n // @ts-expect-error key is from visitor keys\n node[key]\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n create(\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey?: string,\n ): NodePath {\n // We don't need to `.setContext()` here, since `.visitQueue()` already\n // calls `.pushContext`.\n return NodePath.get({\n parentPath: this.parentPath,\n parent: node,\n container,\n key: key,\n listKey,\n });\n }\n\n maybeQueue(path: NodePath, notPriority?: boolean) {\n if (this.queue) {\n if (notPriority) {\n this.queue.push(path);\n } else {\n this.priorityQueue.push(path);\n }\n }\n }\n\n visitMultiple(container: t.Node[], parent: t.Node, listKey: string) {\n // nothing to traverse!\n if (container.length === 0) return false;\n\n const queue = [];\n\n // build up initial queue\n for (let key = 0; key < container.length; key++) {\n const node = container[key];\n if (node && this.shouldVisit(node)) {\n queue.push(this.create(parent, container, key, listKey));\n }\n }\n\n return this.visitQueue(queue);\n }\n\n visitSingle(node: t.Node, key: string): boolean {\n if (\n this.shouldVisit(\n // @ts-expect-error key may not index node\n node[key],\n )\n ) {\n return this.visitQueue([this.create(node, node, key)]);\n } else {\n return false;\n }\n }\n\n visitQueue(queue: Array<NodePath>): boolean {\n // set queue\n this.queue = queue;\n this.priorityQueue = [];\n\n const visited = new WeakSet();\n let stop = false;\n\n // visit the queue\n for (const path of queue) {\n path.resync();\n\n if (\n path.contexts.length === 0 ||\n path.contexts[path.contexts.length - 1] !== this\n ) {\n // The context might already have been pushed when this path was inserted and queued.\n // If we always re-pushed here, we could get duplicates and risk leaving contexts\n // on the stack after the traversal has completed, which could break things.\n path.pushContext(this);\n }\n\n // this path no longer belongs to the tree\n if (path.key === null) continue;\n\n // ensure we don't visit the same node twice\n const { node } = path;\n if (visited.has(node)) continue;\n if (node) visited.add(node);\n\n if (path.visit()) {\n stop = true;\n break;\n }\n\n if (this.priorityQueue.length) {\n stop = this.visitQueue(this.priorityQueue);\n this.priorityQueue = [];\n this.queue = queue;\n if (stop) break;\n }\n }\n\n // clear queue\n for (const path of queue) {\n path.popContext();\n }\n\n // clear queue\n this.queue = null;\n\n return stop;\n }\n\n visit(node: t.Node, key: string) {\n // @ts-expect-error key may not index node\n const nodes = node[key] as t.Node | t.Node[] | null;\n if (!nodes) return false;\n\n if (Array.isArray(nodes)) {\n return this.visitMultiple(nodes, node, key);\n } else {\n return this.visitSingle(node, key);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAA4C;EAAnCE;AAAY,IAAAD,EAAA;AAMN,MAAME,gBAAgB,CAAc;EACjDC,WAAWA,CACTC,KAAY,EACZC,IAAgC,EAChCC,KAAQ,EACRC,UAAoB,EACpB;IAAA,KAWFC,KAAK,GAA2B,IAAI;IAAA,KACpCC,aAAa,GAA2B,IAAI;IAX1C,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACH,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAcAK,WAAWA,CAACC,IAAY,EAAW;IACjC,MAAMN,IAAI,GAAG,IAAI,CAACA,IAAe;IACjC,IAAIA,IAAI,CAACO,KAAK,IAAIP,IAAI,CAACQ,IAAI,EAAE,OAAO,IAAI;IAGxC,IAAIR,IAAI,CAACM,IAAI,CAACG,IAAI,CAAC,EAAE,OAAO,IAAI;IAGhC,MAAMC,IAA+B,GAAGd,YAAY,CAACU,IAAI,CAACG,IAAI,CAAC;IAC/D,IAAI,EAACC,IAAI,YAAJA,IAAI,CAAEC,MAAM,GAAE,OAAO,KAAK;IAG/B,KAAK,MAAMC,GAAG,IAAIF,IAAI,EAAE;MACtB,IAEEJ,IAAI,CAACM,GAAG,CAAC,EACT;QACA,OAAO,IAAI;MACb;IACF;IAEA,OAAO,KAAK;EACd;EAEAC,MAAMA,CACJP,IAAY,EACZQ,SAA4B,EAC5BF,GAAoB,EACpBG,OAAgB,EACN;IAGV,OAAOC,cAAQ,CAACC,GAAG,CAAC;MAClBf,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BgB,MAAM,EAAEZ,IAAI;MACZQ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EAAE,OAAO,KAAK;IAExB,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACxB,OAAO,IAAI,CAACb,aAAa,CAACa,KAAK,EAAE9B,IAAI,EAAEM,GAAG,CAAC;IAC7C,CAAC,MAAM;MACL,OAAO,IAAI,CAACa,WAAW,CAACnB,IAAI,EAAEM,GAAG,CAAC;IACpC;EACF;AACF;AAAC2B,OAAA,CAAAC,OAAA,GAAA3C,gBAAA"}
package/lib/hub.js CHANGED
@@ -4,20 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  class Hub {
9
8
  getCode() {}
10
-
11
9
  getScope() {}
12
-
13
10
  addHelper() {
14
11
  throw new Error("Helpers are not supported by the default hub.");
15
12
  }
16
-
17
13
  buildError(node, msg, Error = TypeError) {
18
14
  return new Error(msg);
19
15
  }
20
-
21
16
  }
17
+ exports.default = Hub;
22
18
 
23
- exports.default = Hub;
19
+ //# sourceMappingURL=hub.js.map
package/lib/hub.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Hub","getCode","getScope","addHelper","Error","buildError","node","msg","TypeError","exports","default"],"sources":["../src/hub.ts"],"sourcesContent":["import type Scope from \"./scope/index.ts\";\nimport type { Node } from \"@babel/types\";\n\nexport interface HubInterface {\n getCode(): string | void;\n getScope(): Scope | void;\n addHelper(name: string): any;\n buildError(node: Node, msg: string, Error: new () => Error): Error;\n}\n\nexport default class Hub implements HubInterface {\n getCode() {}\n\n getScope() {}\n\n addHelper() {\n throw new Error(\"Helpers are not supported by the default hub.\");\n }\n\n buildError(node: Node, msg: string, Error = TypeError): Error {\n return new Error(msg);\n }\n}\n"],"mappings":";;;;;;AAUe,MAAMA,GAAG,CAAyB;EAC/CC,OAAOA,CAAA,EAAG,CAAC;EAEXC,QAAQA,CAAA,EAAG,CAAC;EAEZC,SAASA,CAAA,EAAG;IACV,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC;EAClE;EAEAC,UAAUA,CAACC,IAAU,EAAEC,GAAW,EAAEH,KAAK,GAAGI,SAAS,EAAS;IAC5D,OAAO,IAAIJ,KAAK,CAACG,GAAG,CAAC;EACvB;AACF;AAACE,OAAA,CAAAC,OAAA,GAAAV,GAAA"}
package/lib/index.js CHANGED
@@ -3,117 +3,81 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = traverse;
7
- Object.defineProperty(exports, "NodePath", {
6
+ Object.defineProperty(exports, "Hub", {
8
7
  enumerable: true,
9
8
  get: function () {
10
- return _path.default;
9
+ return _hub.default;
11
10
  }
12
11
  });
13
- Object.defineProperty(exports, "Scope", {
12
+ Object.defineProperty(exports, "NodePath", {
14
13
  enumerable: true,
15
14
  get: function () {
16
- return _scope.default;
15
+ return _index.default;
17
16
  }
18
17
  });
19
- Object.defineProperty(exports, "Hub", {
18
+ Object.defineProperty(exports, "Scope", {
20
19
  enumerable: true,
21
20
  get: function () {
22
- return _hub.default;
21
+ return _index2.default;
23
22
  }
24
23
  });
25
- exports.visitors = void 0;
26
-
27
- var _context = _interopRequireDefault(require("./context"));
28
-
29
- var visitors = _interopRequireWildcard(require("./visitors"));
30
-
24
+ exports.visitors = exports.default = void 0;
25
+ var visitors = require("./visitors.js");
31
26
  exports.visitors = visitors;
32
-
33
- function _includes() {
34
- const data = _interopRequireDefault(require("lodash/includes"));
35
-
36
- _includes = function () {
37
- return data;
38
- };
39
-
40
- return data;
41
- }
42
-
43
- function t() {
44
- const data = _interopRequireWildcard(require("@babel/types"));
45
-
46
- t = function () {
47
- return data;
48
- };
49
-
50
- return data;
51
- }
52
-
53
- var cache = _interopRequireWildcard(require("./cache"));
54
-
55
- var _path = _interopRequireDefault(require("./path"));
56
-
57
- var _scope = _interopRequireDefault(require("./scope"));
58
-
59
- var _hub = _interopRequireDefault(require("./hub"));
60
-
61
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
62
-
63
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
64
-
65
- function traverse(parent, opts, scope, state, parentPath) {
27
+ var _t = require("@babel/types");
28
+ var cache = require("./cache.js");
29
+ var _traverseNode = require("./traverse-node.js");
30
+ var _index = require("./path/index.js");
31
+ var _index2 = require("./scope/index.js");
32
+ var _hub = require("./hub.js");
33
+ const {
34
+ VISITOR_KEYS,
35
+ removeProperties,
36
+ traverseFast
37
+ } = _t;
38
+ function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) {
66
39
  if (!parent) return;
67
- if (!opts) opts = {};
68
-
69
40
  if (!opts.noScope && !scope) {
70
41
  if (parent.type !== "Program" && parent.type !== "File") {
71
42
  throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");
72
43
  }
73
44
  }
74
-
45
+ if (!parentPath && visitSelf) {
46
+ throw new Error("visitSelf can only be used when providing a NodePath.");
47
+ }
48
+ if (!VISITOR_KEYS[parent.type]) {
49
+ return;
50
+ }
75
51
  visitors.explode(opts);
76
- traverse.node(parent, opts, scope, state, parentPath);
52
+ (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, null, visitSelf);
77
53
  }
78
-
54
+ var _default = traverse;
55
+ exports.default = _default;
79
56
  traverse.visitors = visitors;
80
57
  traverse.verify = visitors.verify;
81
58
  traverse.explode = visitors.explode;
82
-
83
59
  traverse.cheap = function (node, enter) {
84
- return t().traverseFast(node, enter);
60
+ traverseFast(node, enter);
61
+ return;
85
62
  };
86
-
87
- traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
88
- const keys = t().VISITOR_KEYS[node.type];
89
- if (!keys) return;
90
- const context = new _context.default(scope, opts, state, parentPath);
91
-
92
- for (const key of keys) {
93
- if (skipKeys && skipKeys[key]) continue;
94
- if (context.visit(node, key)) return;
95
- }
63
+ traverse.node = function (node, opts, scope, state, path, skipKeys) {
64
+ (0, _traverseNode.traverseNode)(node, opts, scope, state, path, skipKeys);
96
65
  };
97
-
98
66
  traverse.clearNode = function (node, opts) {
99
- t().removeProperties(node, opts);
100
- cache.path.delete(node);
67
+ removeProperties(node, opts);
101
68
  };
102
-
103
69
  traverse.removeProperties = function (tree, opts) {
104
- t().traverseFast(tree, traverse.clearNode, opts);
70
+ traverseFast(tree, traverse.clearNode, opts);
105
71
  return tree;
106
72
  };
107
-
108
- function hasBlacklistedType(path, state) {
73
+ function hasDenylistedType(path, state) {
109
74
  if (path.node.type === state.type) {
110
75
  state.has = true;
111
76
  path.stop();
112
77
  }
113
78
  }
114
-
115
- traverse.hasType = function (tree, type, blacklistTypes) {
116
- if ((0, _includes().default)(blacklistTypes, tree.type)) return false;
79
+ traverse.hasType = function (tree, type, denylistTypes) {
80
+ if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
117
81
  if (tree.type === type) return true;
118
82
  const state = {
119
83
  has: false,
@@ -121,10 +85,11 @@ traverse.hasType = function (tree, type, blacklistTypes) {
121
85
  };
122
86
  traverse(tree, {
123
87
  noScope: true,
124
- blacklist: blacklistTypes,
125
- enter: hasBlacklistedType
88
+ denylist: denylistTypes,
89
+ enter: hasDenylistedType
126
90
  }, null, state);
127
91
  return state.has;
128
92
  };
93
+ traverse.cache = cache;
129
94
 
130
- traverse.cache = cache;
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["visitors","require","exports","_t","cache","_traverseNode","_index","_index2","_hub","VISITOR_KEYS","removeProperties","traverseFast","traverse","parent","opts","scope","state","parentPath","visitSelf","noScope","type","Error","explode","traverseNode","_default","default","verify","cheap","node","enter","path","skipKeys","clearNode","tree","hasDenylistedType","has","stop","hasType","denylistTypes","includes","denylist"],"sources":["../src/index.ts"],"sourcesContent":["import * as visitors from \"./visitors.ts\";\nimport {\n VISITOR_KEYS,\n removeProperties,\n type RemovePropertiesOptions,\n traverseFast,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as cache from \"./cache.ts\";\nimport type NodePath from \"./path/index.ts\";\nimport type { default as Scope, Binding } from \"./scope/index.ts\";\nimport type { ExplodedVisitor, Visitor } from \"./types.ts\";\nimport { traverseNode } from \"./traverse-node.ts\";\n\nexport type { ExplodedVisitor, Visitor, Binding };\nexport { default as NodePath } from \"./path/index.ts\";\nexport { default as Scope } from \"./scope/index.ts\";\nexport { default as Hub } from \"./hub.ts\";\nexport type { HubInterface } from \"./hub.ts\";\n\nexport { visitors };\n\nexport type TraverseOptions<S = t.Node> = {\n scope?: Scope;\n noScope?: boolean;\n denylist?: string[];\n shouldSkip?: (node: NodePath) => boolean;\n} & Visitor<S>;\n\nexport type ExplodedTraverseOptions<S = t.Node> = TraverseOptions<S> &\n ExplodedVisitor<S>;\n\nfunction traverse<S>(\n parent: t.Node,\n opts: TraverseOptions<S>,\n scope: Scope | undefined,\n state: S,\n parentPath?: NodePath,\n visitSelf?: boolean,\n): void;\n\nfunction traverse(\n parent: t.Node,\n opts: TraverseOptions,\n scope?: Scope,\n state?: any,\n parentPath?: NodePath,\n visitSelf?: boolean,\n): void;\n\nfunction traverse<Options extends TraverseOptions>(\n parent: t.Node,\n // @ts-expect-error provide {} as default value for Options\n opts: Options = {},\n scope?: Scope,\n state?: any,\n parentPath?: NodePath,\n visitSelf?: boolean,\n) {\n if (!parent) return;\n\n if (!opts.noScope && !scope) {\n if (parent.type !== \"Program\" && parent.type !== \"File\") {\n throw new Error(\n \"You must pass a scope and parentPath unless traversing a Program/File. \" +\n `Instead of that you tried to traverse a ${parent.type} node without ` +\n \"passing scope and parentPath.\",\n );\n }\n }\n\n if (!parentPath && visitSelf) {\n throw new Error(\"visitSelf can only be used when providing a NodePath.\");\n }\n\n if (!VISITOR_KEYS[parent.type]) {\n return;\n }\n\n visitors.explode(opts as Visitor);\n\n traverseNode(\n parent,\n opts as ExplodedVisitor,\n scope,\n state,\n parentPath,\n /* skipKeys */ null,\n visitSelf,\n );\n}\n\nexport default traverse;\n\ntraverse.visitors = visitors;\ntraverse.verify = visitors.verify;\ntraverse.explode = visitors.explode;\n\ntraverse.cheap = function (node: t.Node, enter: (node: t.Node) => void) {\n traverseFast(node, enter);\n return;\n};\n\ntraverse.node = function (\n node: t.Node,\n opts: ExplodedTraverseOptions,\n scope?: Scope,\n state?: any,\n path?: NodePath,\n skipKeys?: Record<string, boolean>,\n) {\n traverseNode(node, opts, scope, state, path, skipKeys);\n // traverse.node always returns undefined\n};\n\ntraverse.clearNode = function (node: t.Node, opts?: RemovePropertiesOptions) {\n removeProperties(node, opts);\n};\n\ntraverse.removeProperties = function (\n tree: t.Node,\n opts?: RemovePropertiesOptions,\n) {\n traverseFast(tree, traverse.clearNode, opts);\n return tree;\n};\n\ntype HasDenylistedTypeState = {\n has: boolean;\n type: t.Node[\"type\"];\n};\nfunction hasDenylistedType(path: NodePath, state: HasDenylistedTypeState) {\n if (path.node.type === state.type) {\n state.has = true;\n path.stop();\n }\n}\n\ntraverse.hasType = function (\n tree: t.Node,\n type: t.Node[\"type\"],\n denylistTypes?: Array<string>,\n): boolean {\n // the node we're searching in is denylisted\n if (denylistTypes?.includes(tree.type)) return false;\n\n // the type we're looking for is the same as the passed node\n if (tree.type === type) return true;\n\n const state: HasDenylistedTypeState = {\n has: false,\n type: type,\n };\n\n traverse(\n tree,\n {\n noScope: true,\n denylist: denylistTypes,\n enter: hasDenylistedType,\n },\n null,\n state,\n );\n\n return state.has;\n};\n\ntraverse.cache = cache;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAA0CC,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAC1C,IAAAG,EAA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