@babel/traverse 7.19.6 → 7.20.1
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.
Potentially problematic release.
This version of @babel/traverse might be problematic. Click here for more details.
- package/lib/cache.js +0 -3
- package/lib/cache.js.map +1 -1
- package/lib/context.js +7 -21
- package/lib/context.js.map +1 -1
- package/lib/hub.js +0 -6
- package/lib/hub.js.map +1 -1
- package/lib/index.js +3 -21
- package/lib/index.js.map +1 -1
- package/lib/path/ancestry.js +3 -23
- package/lib/path/ancestry.js.map +1 -1
- package/lib/path/comments.js +0 -4
- package/lib/path/comments.js.map +1 -1
- package/lib/path/context.js +11 -52
- package/lib/path/context.js.map +1 -1
- package/lib/path/conversion.js +16 -75
- package/lib/path/conversion.js.map +1 -1
- package/lib/path/evaluation.js +9 -85
- package/lib/path/evaluation.js.map +1 -1
- package/lib/path/family.js +6 -73
- package/lib/path/family.js.map +1 -1
- package/lib/path/index.js +2 -61
- package/lib/path/index.js.map +1 -1
- package/lib/path/inference/index.js +2 -27
- package/lib/path/inference/index.js.map +1 -1
- package/lib/path/inference/inferer-reference.js +10 -32
- package/lib/path/inference/inferer-reference.js.map +1 -1
- package/lib/path/inference/inferers.js +4 -44
- package/lib/path/inference/inferers.js.map +1 -1
- package/lib/path/inference/util.js +0 -4
- package/lib/path/inference/util.js.map +1 -1
- package/lib/path/introspection.js +17 -59
- package/lib/path/introspection.js.map +1 -1
- package/lib/path/lib/hoister.js +7 -23
- package/lib/path/lib/hoister.js.map +1 -1
- package/lib/path/lib/removal-hooks.js +7 -3
- package/lib/path/lib/removal-hooks.js.map +1 -1
- package/lib/path/lib/virtual-types-validator.js +0 -23
- package/lib/path/lib/virtual-types-validator.js.map +1 -1
- package/lib/path/lib/virtual-types.js +1 -0
- package/lib/path/lib/virtual-types.js.map +1 -1
- package/lib/path/modification.js +12 -47
- package/lib/path/modification.js.map +1 -1
- package/lib/path/removal.js +0 -16
- package/lib/path/removal.js.map +1 -1
- package/lib/path/replacement.js +8 -50
- package/lib/path/replacement.js.map +1 -1
- package/lib/scope/binding.js +2 -14
- package/lib/scope/binding.js.map +1 -1
- package/lib/scope/index.js +22 -184
- package/lib/scope/index.js.map +1 -1
- package/lib/scope/lib/renamer.js +2 -25
- package/lib/scope/lib/renamer.js.map +1 -1
- package/lib/traverse-node.js +0 -7
- package/lib/traverse-node.js.map +1 -1
- package/lib/visitors.js +13 -44
- package/lib/visitors.js.map +1 -1
- package/package.json +4 -4
- package/scripts/generators/asserts.js +0 -25
- package/scripts/generators/validators.js +0 -27
- package/scripts/package.json +0 -1
package/lib/path/context.js
CHANGED
@@ -23,53 +23,42 @@ exports.skip = skip;
|
|
23
23
|
exports.skipKey = skipKey;
|
24
24
|
exports.stop = stop;
|
25
25
|
exports.visit = visit;
|
26
|
-
|
27
26
|
var _traverseNode = require("../traverse-node");
|
28
|
-
|
29
27
|
var _index = require("./index");
|
30
28
|
|
31
29
|
function call(key) {
|
32
30
|
const opts = this.opts;
|
33
31
|
this.debug(key);
|
34
|
-
|
35
32
|
if (this.node) {
|
36
33
|
if (this._call(opts[key])) return true;
|
37
34
|
}
|
38
|
-
|
39
35
|
if (this.node) {
|
40
36
|
return this._call(opts[this.node.type] && opts[this.node.type][key]);
|
41
37
|
}
|
42
|
-
|
43
38
|
return false;
|
44
39
|
}
|
45
|
-
|
46
40
|
function _call(fns) {
|
47
41
|
if (!fns) return false;
|
48
|
-
|
49
42
|
for (const fn of fns) {
|
50
43
|
if (!fn) continue;
|
51
44
|
const node = this.node;
|
52
45
|
if (!node) return true;
|
53
46
|
const ret = fn.call(this.state, this, this.state);
|
54
|
-
|
55
47
|
if (ret && typeof ret === "object" && typeof ret.then === "function") {
|
56
48
|
throw new Error(`You appear to be using a plugin with an async traversal visitor, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
|
57
49
|
}
|
58
|
-
|
59
50
|
if (ret) {
|
60
51
|
throw new Error(`Unexpected return value from visitor method ${fn}`);
|
61
52
|
}
|
62
53
|
|
63
54
|
if (this.node !== node) return true;
|
55
|
+
|
64
56
|
if (this._traverseFlags > 0) return true;
|
65
57
|
}
|
66
|
-
|
67
58
|
return false;
|
68
59
|
}
|
69
|
-
|
70
60
|
function isDenylisted() {
|
71
61
|
var _this$opts$denylist;
|
72
|
-
|
73
62
|
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
|
74
63
|
return denylist && denylist.indexOf(this.node.type) > -1;
|
75
64
|
}
|
@@ -81,27 +70,21 @@ function restoreContext(path, context) {
|
|
81
70
|
path.opts = context.opts;
|
82
71
|
}
|
83
72
|
}
|
84
|
-
|
85
73
|
function visit() {
|
86
74
|
if (!this.node) {
|
87
75
|
return false;
|
88
76
|
}
|
89
|
-
|
90
77
|
if (this.isDenylisted()) {
|
91
78
|
return false;
|
92
79
|
}
|
93
|
-
|
94
80
|
if (this.opts.shouldSkip && this.opts.shouldSkip(this)) {
|
95
81
|
return false;
|
96
82
|
}
|
97
|
-
|
98
83
|
const currentContext = this.context;
|
99
|
-
|
100
84
|
if (this.shouldSkip || this.call("enter")) {
|
101
85
|
this.debug("Skip...");
|
102
86
|
return this.shouldStop;
|
103
87
|
}
|
104
|
-
|
105
88
|
restoreContext(this, currentContext);
|
106
89
|
this.debug("Recursing into...");
|
107
90
|
this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
|
@@ -109,23 +92,18 @@ function visit() {
|
|
109
92
|
this.call("exit");
|
110
93
|
return this.shouldStop;
|
111
94
|
}
|
112
|
-
|
113
95
|
function skip() {
|
114
96
|
this.shouldSkip = true;
|
115
97
|
}
|
116
|
-
|
117
98
|
function skipKey(key) {
|
118
99
|
if (this.skipKeys == null) {
|
119
100
|
this.skipKeys = {};
|
120
101
|
}
|
121
|
-
|
122
102
|
this.skipKeys[key] = true;
|
123
103
|
}
|
124
|
-
|
125
104
|
function stop() {
|
126
105
|
this._traverseFlags |= _index.SHOULD_SKIP | _index.SHOULD_STOP;
|
127
106
|
}
|
128
|
-
|
129
107
|
function setScope() {
|
130
108
|
if (this.opts && this.opts.noScope) return;
|
131
109
|
let path = this.parentPath;
|
@@ -133,43 +111,33 @@ function setScope() {
|
|
133
111
|
if ((this.key === "key" || this.listKey === "decorators") && path.isMethod()) {
|
134
112
|
path = path.parentPath;
|
135
113
|
}
|
136
|
-
|
137
114
|
let target;
|
138
|
-
|
139
115
|
while (path && !target) {
|
140
116
|
if (path.opts && path.opts.noScope) return;
|
141
117
|
target = path.scope;
|
142
118
|
path = path.parentPath;
|
143
119
|
}
|
144
|
-
|
145
120
|
this.scope = this.getScope(target);
|
146
121
|
if (this.scope) this.scope.init();
|
147
122
|
}
|
148
|
-
|
149
123
|
function setContext(context) {
|
150
124
|
if (this.skipKeys != null) {
|
151
125
|
this.skipKeys = {};
|
152
126
|
}
|
153
|
-
|
154
127
|
this._traverseFlags = 0;
|
155
|
-
|
156
128
|
if (context) {
|
157
129
|
this.context = context;
|
158
130
|
this.state = context.state;
|
159
131
|
this.opts = context.opts;
|
160
132
|
}
|
161
|
-
|
162
133
|
this.setScope();
|
163
134
|
return this;
|
164
135
|
}
|
165
136
|
|
166
137
|
function resync() {
|
167
138
|
if (this.removed) return;
|
168
|
-
|
169
139
|
this._resyncParent();
|
170
|
-
|
171
140
|
this._resyncList();
|
172
|
-
|
173
141
|
this._resyncKey();
|
174
142
|
}
|
175
143
|
|
@@ -178,11 +146,10 @@ function _resyncParent() {
|
|
178
146
|
this.parent = this.parentPath.node;
|
179
147
|
}
|
180
148
|
}
|
181
|
-
|
182
149
|
function _resyncKey() {
|
183
150
|
if (!this.container) return;
|
184
|
-
|
185
|
-
|
151
|
+
if (this.node ===
|
152
|
+
this.container[this.key]) {
|
186
153
|
return;
|
187
154
|
}
|
188
155
|
|
@@ -202,70 +169,62 @@ function _resyncKey() {
|
|
202
169
|
|
203
170
|
this.key = null;
|
204
171
|
}
|
205
|
-
|
206
172
|
function _resyncList() {
|
207
173
|
if (!this.parent || !this.inList) return;
|
208
|
-
const newContainer =
|
174
|
+
const newContainer =
|
175
|
+
this.parent[this.listKey];
|
209
176
|
if (this.container === newContainer) return;
|
177
|
+
|
210
178
|
this.container = newContainer || null;
|
211
179
|
}
|
212
|
-
|
213
180
|
function _resyncRemoved() {
|
214
|
-
if (this.key == null || !this.container ||
|
181
|
+
if (this.key == null || !this.container ||
|
182
|
+
this.container[this.key] !== this.node) {
|
215
183
|
this._markRemoved();
|
216
184
|
}
|
217
185
|
}
|
218
|
-
|
219
186
|
function popContext() {
|
220
187
|
this.contexts.pop();
|
221
|
-
|
222
188
|
if (this.contexts.length > 0) {
|
223
189
|
this.setContext(this.contexts[this.contexts.length - 1]);
|
224
190
|
} else {
|
225
191
|
this.setContext(undefined);
|
226
192
|
}
|
227
193
|
}
|
228
|
-
|
229
194
|
function pushContext(context) {
|
230
195
|
this.contexts.push(context);
|
231
196
|
this.setContext(context);
|
232
197
|
}
|
233
|
-
|
234
198
|
function setup(parentPath, container, listKey, key) {
|
235
199
|
this.listKey = listKey;
|
236
200
|
this.container = container;
|
237
201
|
this.parentPath = parentPath || this.parentPath;
|
238
202
|
this.setKey(key);
|
239
203
|
}
|
240
|
-
|
241
204
|
function setKey(key) {
|
242
205
|
var _this$node;
|
243
|
-
|
244
206
|
this.key = key;
|
245
|
-
this.node =
|
207
|
+
this.node =
|
208
|
+
this.container[this.key];
|
246
209
|
this.type = (_this$node = this.node) == null ? void 0 : _this$node.type;
|
247
210
|
}
|
248
|
-
|
249
211
|
function requeue(pathToQueue = this) {
|
250
212
|
if (pathToQueue.removed) return;
|
213
|
+
|
251
214
|
;
|
252
215
|
const contexts = this.contexts;
|
253
|
-
|
254
216
|
for (const context of contexts) {
|
255
217
|
context.maybeQueue(pathToQueue);
|
256
218
|
}
|
257
219
|
}
|
258
|
-
|
259
220
|
function _getQueueContexts() {
|
260
221
|
let path = this;
|
261
222
|
let contexts = this.contexts;
|
262
|
-
|
263
223
|
while (!contexts.length) {
|
264
224
|
path = path.parentPath;
|
265
225
|
if (!path) break;
|
266
226
|
contexts = path.contexts;
|
267
227
|
}
|
268
|
-
|
269
228
|
return contexts;
|
270
229
|
}
|
271
230
|
|
package/lib/path/context.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["call","key","opts","debug","node","_call","type","fns","fn","ret","state","then","Error","_traverseFlags","isDenylisted","denylist","blacklist","indexOf","restoreContext","path","context","visit","shouldSkip","currentContext","shouldStop","traverseNode","scope","skipKeys","skip","skipKey","stop","SHOULD_SKIP","SHOULD_STOP","setScope","noScope","parentPath","listKey","isMethod","target","getScope","init","setContext","resync","removed","_resyncParent","_resyncList","_resyncKey","parent","container","Array","isArray","i","length","setKey","Object","keys","inList","newContainer","_resyncRemoved","_markRemoved","popContext","contexts","pop","undefined","pushContext","push","setup","requeue","pathToQueue","maybeQueue","_getQueueContexts"],"sources":["../../src/path/context.ts"],"sourcesContent":["// This file contains methods responsible for maintaining a TraversalContext.\n\nimport { traverseNode } from \"../traverse-node\";\nimport { SHOULD_SKIP, SHOULD_STOP } from \"./index\";\nimport type TraversalContext from \"../context\";\nimport type NodePath from \"./index\";\nimport type * as t from \"@babel/types\";\n\nexport function call(this: NodePath, key: string): boolean {\n const opts = this.opts;\n\n this.debug(key);\n\n if (this.node) {\n if (this._call(opts[key])) return true;\n }\n\n if (this.node) {\n return this._call(opts[this.node.type] && opts[this.node.type][key]);\n }\n\n return false;\n}\n\nexport function _call(this: NodePath, fns?: Array<Function>): boolean {\n if (!fns) return false;\n\n for (const fn of fns) {\n if (!fn) continue;\n\n const node = this.node;\n if (!node) return true;\n\n const ret = fn.call(this.state, this, this.state);\n if (ret && typeof ret === \"object\" && typeof ret.then === \"function\") {\n throw new Error(\n `You appear to be using a plugin with an async traversal visitor, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n if (ret) {\n throw new Error(`Unexpected return value from visitor method ${fn}`);\n }\n\n // node has been replaced, it will have been requeued\n if (this.node !== node) return true;\n\n // this.shouldSkip || this.shouldStop || this.removed\n if (this._traverseFlags > 0) return true;\n }\n\n return false;\n}\n\nexport function isDenylisted(this: NodePath): boolean {\n const denylist = this.opts.denylist ?? this.opts.blacklist;\n return denylist && denylist.indexOf(this.node.type) > -1;\n}\n\n// TODO: Remove in Babel 8\nexport { isDenylisted as isBlacklisted };\n\nfunction restoreContext(path: NodePath, context: TraversalContext) {\n if (path.context !== context) {\n path.context = context;\n path.state = context.state;\n path.opts = context.opts;\n }\n}\n\nexport function visit(this: NodePath): boolean {\n if (!this.node) {\n return false;\n }\n\n if (this.isDenylisted()) {\n return false;\n }\n\n if (this.opts.shouldSkip && this.opts.shouldSkip(this)) {\n return false;\n }\n\n const currentContext = this.context;\n // Note: We need to check \"this.shouldSkip\" first because\n // another visitor can set it to true. Usually .shouldSkip is false\n // before calling the enter visitor, but it can be true in case of\n // a requeued node (e.g. by .replaceWith()) that is then marked\n // with .skip().\n if (this.shouldSkip || this.call(\"enter\")) {\n this.debug(\"Skip...\");\n return this.shouldStop;\n }\n restoreContext(this, currentContext);\n\n this.debug(\"Recursing into...\");\n this.shouldStop = traverseNode(\n this.node,\n this.opts,\n this.scope,\n this.state,\n this,\n this.skipKeys,\n );\n\n restoreContext(this, currentContext);\n\n this.call(\"exit\");\n\n return this.shouldStop;\n}\n\nexport function skip(this: NodePath) {\n this.shouldSkip = true;\n}\n\nexport function skipKey(this: NodePath, key: string) {\n if (this.skipKeys == null) {\n this.skipKeys = {};\n }\n this.skipKeys[key] = true;\n}\n\nexport function stop(this: NodePath) {\n // this.shouldSkip = true; this.shouldStop = true;\n this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP;\n}\n\nexport function setScope(this: NodePath) {\n if (this.opts && this.opts.noScope) return;\n\n let path = this.parentPath;\n\n // Skip method scope if is computed method key or decorator expression\n if (\n (this.key === \"key\" || this.listKey === \"decorators\") &&\n path.isMethod()\n ) {\n path = path.parentPath;\n }\n\n let target;\n while (path && !target) {\n if (path.opts && path.opts.noScope) return;\n\n target = path.scope;\n path = path.parentPath;\n }\n\n this.scope = this.getScope(target);\n if (this.scope) this.scope.init();\n}\n\nexport function setContext<S = unknown>(\n this: NodePath,\n context?: TraversalContext<S>,\n) {\n if (this.skipKeys != null) {\n this.skipKeys = {};\n }\n // this.shouldSkip = false; this.shouldStop = false; this.removed = false;\n this._traverseFlags = 0;\n\n if (context) {\n this.context = context;\n this.state = context.state;\n this.opts = context.opts;\n }\n\n this.setScope();\n\n return this;\n}\n\n/**\n * Here we resync the node paths `key` and `container`. If they've changed according\n * to what we have stored internally then we attempt to resync by crawling and looking\n * for the new values.\n */\n\nexport function resync(this: NodePath) {\n if (this.removed) return;\n\n this._resyncParent();\n this._resyncList();\n this._resyncKey();\n //this._resyncRemoved();\n}\n\nexport function _resyncParent(this: NodePath) {\n if (this.parentPath) {\n this.parent = this.parentPath.node;\n }\n}\n\nexport function _resyncKey(this: NodePath) {\n if (!this.container) return;\n\n if (\n this.node ===\n // @ts-expect-error this.key should present in this.container\n this.container[this.key]\n ) {\n return;\n }\n\n // grrr, path key is out of sync. this is likely due to a modification to the AST\n // not done through our path APIs\n\n if (Array.isArray(this.container)) {\n for (let i = 0; i < this.container.length; i++) {\n if (this.container[i] === this.node) {\n return this.setKey(i);\n }\n }\n } else {\n for (const key of Object.keys(this.container)) {\n // @ts-expect-error this.key should present in this.container\n if (this.container[key] === this.node) {\n return this.setKey(key);\n }\n }\n }\n\n // ¯\\_(ツ)_/¯ who knows where it's gone lol\n this.key = null;\n}\n\nexport function _resyncList(this: NodePath) {\n if (!this.parent || !this.inList) return;\n\n const newContainer =\n // @ts-expect-error this.listKey should present in this.parent\n this.parent[this.listKey];\n if (this.container === newContainer) return;\n\n // container is out of sync. this is likely the result of it being reassigned\n this.container = newContainer || null;\n}\n\nexport function _resyncRemoved(this: NodePath) {\n if (\n this.key == null ||\n !this.container ||\n // @ts-expect-error this.key should present in this.container\n this.container[this.key] !== this.node\n ) {\n this._markRemoved();\n }\n}\n\nexport function popContext(this: NodePath) {\n this.contexts.pop();\n if (this.contexts.length > 0) {\n this.setContext(this.contexts[this.contexts.length - 1]);\n } else {\n this.setContext(undefined);\n }\n}\n\nexport function pushContext(this: NodePath, context: TraversalContext) {\n this.contexts.push(context);\n this.setContext(context);\n}\n\nexport function setup(\n this: NodePath,\n parentPath: NodePath | undefined,\n container: t.Node,\n listKey: string,\n key: string | number,\n) {\n this.listKey = listKey;\n this.container = container;\n\n this.parentPath = parentPath || this.parentPath;\n this.setKey(key);\n}\n\nexport function setKey(this: NodePath, key: string | number) {\n this.key = key;\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key];\n this.type = this.node?.type;\n}\n\nexport function requeue(this: NodePath, pathToQueue = this) {\n if (pathToQueue.removed) return;\n\n // If a path is skipped, and then replaced with a\n // new one, the new one shouldn't probably be skipped.\n if (process.env.BABEL_8_BREAKING) {\n pathToQueue.shouldSkip = false;\n }\n\n // TODO(loganfsmyth): This should be switched back to queue in parent contexts\n // automatically once #2892 and #4135 have been resolved. See #4140.\n // let contexts = this._getQueueContexts();\n const contexts = this.contexts;\n\n for (const context of contexts) {\n context.maybeQueue(pathToQueue);\n }\n}\n\nexport function _getQueueContexts(this: NodePath) {\n let path = this;\n let contexts = this.contexts;\n while (!contexts.length) {\n path = path.parentPath;\n if (!path) break;\n contexts = path.contexts;\n }\n return contexts;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AAKO,SAASA,IAAT,CAA8BC,GAA9B,EAAoD;EACzD,MAAMC,IAAI,GAAG,KAAKA,IAAlB;EAEA,KAAKC,KAAL,CAAWF,GAAX;;EAEA,IAAI,KAAKG,IAAT,EAAe;IACb,IAAI,KAAKC,KAAL,CAAWH,IAAI,CAACD,GAAD,CAAf,CAAJ,EAA2B,OAAO,IAAP;EAC5B;;EAED,I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O,CAACiD,UAAR,CAAmBD,WAAnB;EACD;AACF;;AAEM,SAASE,iBAAT,GAA2C;EAChD,IAAInD,IAAI,GAAG,IAAX;EACA,IAAI0C,QAAQ,GAAG,KAAKA,QAApB;;EACA,OAAO,CAACA,QAAQ,CAACT,MAAjB,EAAyB;IACvBjC,IAAI,GAAGA,IAAI,CAACgB,UAAZ;IACA,IAAI,CAAChB,IAAL,EAAW;IACX0C,QAAQ,GAAG1C,IAAI,CAAC0C,QAAhB;EACD;;EACD,OAAOA,QAAP;AACD"}
|
1
|
+
{"version":3,"names":["call","key","opts","debug","node","_call","type","fns","fn","ret","state","then","Error","_traverseFlags","isDenylisted","denylist","blacklist","indexOf","restoreContext","path","context","visit","shouldSkip","currentContext","shouldStop","traverseNode","scope","skipKeys","skip","skipKey","stop","SHOULD_SKIP","SHOULD_STOP","setScope","noScope","parentPath","listKey","isMethod","target","getScope","init","setContext","resync","removed","_resyncParent","_resyncList","_resyncKey","parent","container","Array","isArray","i","length","setKey","Object","keys","inList","newContainer","_resyncRemoved","_markRemoved","popContext","contexts","pop","undefined","pushContext","push","setup","requeue","pathToQueue","maybeQueue","_getQueueContexts"],"sources":["../../src/path/context.ts"],"sourcesContent":["// This file contains methods responsible for maintaining a TraversalContext.\n\nimport { traverseNode } from \"../traverse-node\";\nimport { SHOULD_SKIP, SHOULD_STOP } from \"./index\";\nimport type TraversalContext from \"../context\";\nimport type NodePath from \"./index\";\nimport type * as t from \"@babel/types\";\n\nexport function call(this: NodePath, key: string): boolean {\n const opts = this.opts;\n\n this.debug(key);\n\n if (this.node) {\n if (this._call(opts[key])) return true;\n }\n\n if (this.node) {\n return this._call(opts[this.node.type] && opts[this.node.type][key]);\n }\n\n return false;\n}\n\nexport function _call(this: NodePath, fns?: Array<Function>): boolean {\n if (!fns) return false;\n\n for (const fn of fns) {\n if (!fn) continue;\n\n const node = this.node;\n if (!node) return true;\n\n const ret = fn.call(this.state, this, this.state);\n if (ret && typeof ret === \"object\" && typeof ret.then === \"function\") {\n throw new Error(\n `You appear to be using a plugin with an async traversal visitor, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n if (ret) {\n throw new Error(`Unexpected return value from visitor method ${fn}`);\n }\n\n // node has been replaced, it will have been requeued\n if (this.node !== node) return true;\n\n // this.shouldSkip || this.shouldStop || this.removed\n if (this._traverseFlags > 0) return true;\n }\n\n return false;\n}\n\nexport function isDenylisted(this: NodePath): boolean {\n const denylist = this.opts.denylist ?? this.opts.blacklist;\n return denylist && denylist.indexOf(this.node.type) > -1;\n}\n\n// TODO: Remove in Babel 8\nexport { isDenylisted as isBlacklisted };\n\nfunction restoreContext(path: NodePath, context: TraversalContext) {\n if (path.context !== context) {\n path.context = context;\n path.state = context.state;\n path.opts = context.opts;\n }\n}\n\nexport function visit(this: NodePath): boolean {\n if (!this.node) {\n return false;\n }\n\n if (this.isDenylisted()) {\n return false;\n }\n\n if (this.opts.shouldSkip && this.opts.shouldSkip(this)) {\n return false;\n }\n\n const currentContext = this.context;\n // Note: We need to check \"this.shouldSkip\" first because\n // another visitor can set it to true. Usually .shouldSkip is false\n // before calling the enter visitor, but it can be true in case of\n // a requeued node (e.g. by .replaceWith()) that is then marked\n // with .skip().\n if (this.shouldSkip || this.call(\"enter\")) {\n this.debug(\"Skip...\");\n return this.shouldStop;\n }\n restoreContext(this, currentContext);\n\n this.debug(\"Recursing into...\");\n this.shouldStop = traverseNode(\n this.node,\n this.opts,\n this.scope,\n this.state,\n this,\n this.skipKeys,\n );\n\n restoreContext(this, currentContext);\n\n this.call(\"exit\");\n\n return this.shouldStop;\n}\n\nexport function skip(this: NodePath) {\n this.shouldSkip = true;\n}\n\nexport function skipKey(this: NodePath, key: string) {\n if (this.skipKeys == null) {\n this.skipKeys = {};\n }\n this.skipKeys[key] = true;\n}\n\nexport function stop(this: NodePath) {\n // this.shouldSkip = true; this.shouldStop = true;\n this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP;\n}\n\nexport function setScope(this: NodePath) {\n if (this.opts && this.opts.noScope) return;\n\n let path = this.parentPath;\n\n // Skip method scope if is computed method key or decorator expression\n if (\n (this.key === \"key\" || this.listKey === \"decorators\") &&\n path.isMethod()\n ) {\n path = path.parentPath;\n }\n\n let target;\n while (path && !target) {\n if (path.opts && path.opts.noScope) return;\n\n target = path.scope;\n path = path.parentPath;\n }\n\n this.scope = this.getScope(target);\n if (this.scope) this.scope.init();\n}\n\nexport function setContext<S = unknown>(\n this: NodePath,\n context?: TraversalContext<S>,\n) {\n if (this.skipKeys != null) {\n this.skipKeys = {};\n }\n // this.shouldSkip = false; this.shouldStop = false; this.removed = false;\n this._traverseFlags = 0;\n\n if (context) {\n this.context = context;\n this.state = context.state;\n this.opts = context.opts;\n }\n\n this.setScope();\n\n return this;\n}\n\n/**\n * Here we resync the node paths `key` and `container`. If they've changed according\n * to what we have stored internally then we attempt to resync by crawling and looking\n * for the new values.\n */\n\nexport function resync(this: NodePath) {\n if (this.removed) return;\n\n this._resyncParent();\n this._resyncList();\n this._resyncKey();\n //this._resyncRemoved();\n}\n\nexport function _resyncParent(this: NodePath) {\n if (this.parentPath) {\n this.parent = this.parentPath.node;\n }\n}\n\nexport function _resyncKey(this: NodePath) {\n if (!this.container) return;\n\n if (\n this.node ===\n // @ts-expect-error this.key should present in this.container\n this.container[this.key]\n ) {\n return;\n }\n\n // grrr, path key is out of sync. this is likely due to a modification to the AST\n // not done through our path APIs\n\n if (Array.isArray(this.container)) {\n for (let i = 0; i < this.container.length; i++) {\n if (this.container[i] === this.node) {\n return this.setKey(i);\n }\n }\n } else {\n for (const key of Object.keys(this.container)) {\n // @ts-expect-error this.key should present in this.container\n if (this.container[key] === this.node) {\n return this.setKey(key);\n }\n }\n }\n\n // ¯\\_(ツ)_/¯ who knows where it's gone lol\n this.key = null;\n}\n\nexport function _resyncList(this: NodePath) {\n if (!this.parent || !this.inList) return;\n\n const newContainer =\n // @ts-expect-error this.listKey should present in this.parent\n this.parent[this.listKey];\n if (this.container === newContainer) return;\n\n // container is out of sync. this is likely the result of it being reassigned\n this.container = newContainer || null;\n}\n\nexport function _resyncRemoved(this: NodePath) {\n if (\n this.key == null ||\n !this.container ||\n // @ts-expect-error this.key should present in this.container\n this.container[this.key] !== this.node\n ) {\n this._markRemoved();\n }\n}\n\nexport function popContext(this: NodePath) {\n this.contexts.pop();\n if (this.contexts.length > 0) {\n this.setContext(this.contexts[this.contexts.length - 1]);\n } else {\n this.setContext(undefined);\n }\n}\n\nexport function pushContext(this: NodePath, context: TraversalContext) {\n this.contexts.push(context);\n this.setContext(context);\n}\n\nexport function setup(\n this: NodePath,\n parentPath: NodePath | undefined,\n container: t.Node,\n listKey: string,\n key: string | number,\n) {\n this.listKey = listKey;\n this.container = container;\n\n this.parentPath = parentPath || this.parentPath;\n this.setKey(key);\n}\n\nexport function setKey(this: NodePath, key: string | number) {\n this.key = key;\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key];\n this.type = this.node?.type;\n}\n\nexport function requeue(this: NodePath, pathToQueue = this) {\n if (pathToQueue.removed) return;\n\n // If a path is skipped, and then replaced with a\n // new one, the new one shouldn't probably be skipped.\n if (process.env.BABEL_8_BREAKING) {\n pathToQueue.shouldSkip = false;\n }\n\n // TODO(loganfsmyth): This should be switched back to queue in parent contexts\n // automatically once #2892 and #4135 have been resolved. See #4140.\n // let contexts = this._getQueueContexts();\n const contexts = this.contexts;\n\n for (const context of contexts) {\n context.maybeQueue(pathToQueue);\n }\n}\n\nexport function _getQueueContexts(this: NodePath) {\n let path = this;\n let contexts = this.contexts;\n while (!contexts.length) {\n path = path.parentPath;\n if (!path) break;\n contexts = path.contexts;\n }\n return contexts;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;;AAKO,SAASA,IAAI,CAAiBC,GAAW,EAAW;EACzD,MAAMC,IAAI,GAAG,IAAI,CAACA,IAAI;EAEtB,IAAI,CAACC,KAAK,CAACF,GAAG,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