@depup/babel__eslint-parser 7.28.6-depup.0 → 8.0.5-depup.0

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 (48) hide show
  1. package/README.md +6 -5
  2. package/changes.json +10 -6
  3. package/lib/configuration-shared.js +363 -0
  4. package/lib/configuration-shared.js.map +1 -0
  5. package/lib/index.d.ts +15 -0
  6. package/lib/{analyze-scope.cjs → index.js} +115 -56
  7. package/lib/index.js.map +1 -0
  8. package/lib/worker/index.js +88 -0
  9. package/lib/worker/index.js.map +1 -0
  10. package/package.json +30 -31
  11. package/lib/analyze-scope.cjs.map +0 -1
  12. package/lib/client.cjs +0 -104
  13. package/lib/client.cjs.map +0 -1
  14. package/lib/configuration.cjs +0 -23
  15. package/lib/configuration.cjs.map +0 -1
  16. package/lib/convert/convertAST.cjs +0 -134
  17. package/lib/convert/convertAST.cjs.map +0 -1
  18. package/lib/convert/convertComments.cjs +0 -10
  19. package/lib/convert/convertComments.cjs.map +0 -1
  20. package/lib/convert/convertTokens.cjs +0 -158
  21. package/lib/convert/convertTokens.cjs.map +0 -1
  22. package/lib/convert/index.cjs +0 -25
  23. package/lib/convert/index.cjs.map +0 -1
  24. package/lib/experimental-worker.cjs +0 -32
  25. package/lib/experimental-worker.cjs.map +0 -1
  26. package/lib/index.cjs +0 -32
  27. package/lib/index.cjs.map +0 -1
  28. package/lib/parse.cjs +0 -37
  29. package/lib/parse.cjs.map +0 -1
  30. package/lib/utils/eslint-version.cjs +0 -5
  31. package/lib/utils/eslint-version.cjs.map +0 -1
  32. package/lib/worker/ast-info.cjs +0 -38
  33. package/lib/worker/ast-info.cjs.map +0 -1
  34. package/lib/worker/babel-core.cjs +0 -19
  35. package/lib/worker/babel-core.cjs.map +0 -1
  36. package/lib/worker/configuration.cjs +0 -99
  37. package/lib/worker/configuration.cjs.map +0 -1
  38. package/lib/worker/extract-parser-options-plugin.cjs +0 -11
  39. package/lib/worker/extract-parser-options-plugin.cjs.map +0 -1
  40. package/lib/worker/handle-message.cjs +0 -31
  41. package/lib/worker/handle-message.cjs.map +0 -1
  42. package/lib/worker/index.cjs +0 -39
  43. package/lib/worker/index.cjs.map +0 -1
  44. package/lib/worker/maybeParse.cjs +0 -56
  45. package/lib/worker/maybeParse.cjs.map +0 -1
  46. package/lib/worker/maybeParseSync.cjs +0 -48
  47. package/lib/worker/maybeParseSync.cjs.map +0 -1
  48. package/types.d.cts +0 -9
@@ -1,29 +1,43 @@
1
- "use strict";
1
+ import { types, version } from '@babel/core';
2
+ import * as eslintScope from 'eslint-scope';
3
+ import { getKeys } from 'eslint-visitor-keys';
4
+ import { satisfies } from 'verkit';
5
+ import { getParserPlugins, convertFile, getTokLabels, getVisitorKeys, convertError, WorkerClient } from './configuration-shared.js';
6
+ import { createRequire } from 'node:module';
7
+
8
+ function normalizeESLintConfig(options) {
9
+ const {
10
+ babelOptions = {},
11
+ ecmaVersion = "latest",
12
+ sourceType = "module",
13
+ requireConfigFile = true,
14
+ ...otherOptions
15
+ } = options;
16
+ return {
17
+ babelOptions: {
18
+ cwd: process.cwd(),
19
+ ...babelOptions,
20
+ browserslistConfigFile: false
21
+ },
22
+ ecmaVersion: ecmaVersion === "latest" ? 1e8 : ecmaVersion,
23
+ sourceType,
24
+ requireConfigFile,
25
+ ...otherOptions
26
+ };
27
+ }
2
28
 
3
- function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
4
- function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
5
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
6
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
7
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
8
29
  const {
9
30
  Definition,
10
31
  PatternVisitor: OriginalPatternVisitor,
11
32
  Referencer: OriginalReferencer,
12
33
  Scope,
13
34
  ScopeManager
14
- } = require("@nicolo-ribaudo/eslint-scope-5-internals");
15
- const {
16
- getKeys: fallback
17
- } = require("eslint-visitor-keys");
35
+ } = eslintScope;
18
36
  let visitorKeysMap;
19
- function getVisitorValues(nodeType, client) {
37
+ function getVisitorValues(nodeType) {
20
38
  if (visitorKeysMap) return visitorKeysMap[nodeType];
21
- const {
22
- FLOW_FLIPPED_ALIAS_KEYS,
23
- VISITOR_KEYS
24
- } = client.getTypesInfo();
25
- const flowFlippedAliasKeys = new Set(FLOW_FLIPPED_ALIAS_KEYS.concat(["ArrayPattern", "ClassDeclaration", "ClassExpression", "FunctionDeclaration", "FunctionExpression", "Identifier", "ObjectPattern", "RestElement"]));
26
- visitorKeysMap = (Object.entries || (o => Object.keys(o).map(k => [k, o[k]])))(VISITOR_KEYS).reduce((acc, [key, value]) => {
39
+ const flowFlippedAliasKeys = new Set(types.FLIPPED_ALIAS_KEYS.Flow.concat(["ArrayPattern", "ClassDeclaration", "ClassExpression", "FunctionDeclaration", "FunctionExpression", "Identifier", "ObjectPattern", "RestElement"]));
40
+ visitorKeysMap = Object.entries(types.VISITOR_KEYS).reduce((acc, [key, value]) => {
27
41
  if (!flowFlippedAliasKeys.has(value)) {
28
42
  acc[key] = value;
29
43
  }
@@ -83,12 +97,9 @@ class PatternVisitor extends OriginalPatternVisitor {
83
97
  node.properties.forEach(this.visit, this);
84
98
  }
85
99
  }
86
- var _client = new WeakMap();
87
100
  class Referencer extends OriginalReferencer {
88
- constructor(options, scopeManager, client) {
101
+ constructor(options, scopeManager) {
89
102
  super(options, scopeManager);
90
- _classPrivateFieldInitSpec(this, _client, void 0);
91
- _classPrivateFieldSet(_client, this, client);
92
103
  }
93
104
  visitPattern(node, options, callback) {
94
105
  if (!node) {
@@ -111,11 +122,10 @@ class Referencer extends OriginalReferencer {
111
122
  }
112
123
  }
113
124
  visitClass(node) {
114
- var _ref;
115
125
  this._visitArray(node.decorators);
116
126
  const typeParamScope = this._nestTypeParamScope(node);
117
127
  this._visitTypeAnnotation(node.implements);
118
- this._visitTypeAnnotation((_ref = node.superTypeParameters) == null ? void 0 : _ref.params);
128
+ this._visitTypeAnnotation(node.superTypeArguments?.params);
119
129
  super.visitClass(node);
120
130
  if (typeParamScope) {
121
131
  this.close(node);
@@ -130,8 +140,7 @@ class Referencer extends OriginalReferencer {
130
140
  }
131
141
  }
132
142
  visitProperty(node) {
133
- var _node$value;
134
- if (((_node$value = node.value) == null ? void 0 : _node$value.type) === "TypeCastExpression") {
143
+ if (node.value?.type === "TypeCastExpression") {
135
144
  this._visitTypeAnnotation(node.value);
136
145
  }
137
146
  this._visitArray(node.decorators);
@@ -154,24 +163,12 @@ class Referencer extends OriginalReferencer {
154
163
  this.close(node);
155
164
  }
156
165
  }
157
- ClassProperty(node) {
158
- this._visitClassProperty(node);
159
- }
160
- ClassPrivateProperty(node) {
161
- this._visitClassProperty(node);
162
- }
163
166
  AccessorProperty(node) {
164
167
  this._visitClassProperty(node);
165
168
  }
166
- ClassAccessorProperty(node) {
167
- this._visitClassProperty(node);
168
- }
169
169
  PropertyDefinition(node) {
170
170
  this._visitClassProperty(node);
171
171
  }
172
- ClassPrivateMethod(node) {
173
- super.MethodDefinition(node);
174
- }
175
172
  DeclareModule(node) {
176
173
  this._visitDeclareX(node);
177
174
  }
@@ -184,9 +181,6 @@ class Referencer extends OriginalReferencer {
184
181
  DeclareClass(node) {
185
182
  this._visitDeclareX(node);
186
183
  }
187
- OptionalMemberExpression(node) {
188
- super.MemberExpression(node);
189
- }
190
184
  _visitClassProperty(node) {
191
185
  const {
192
186
  computed,
@@ -199,11 +193,7 @@ class Referencer extends OriginalReferencer {
199
193
  if (computed) this.visit(key);
200
194
  this._visitTypeAnnotation(typeAnnotation);
201
195
  if (value) {
202
- if (this.scopeManager.__nestClassFieldInitializerScope) {
203
- this.scopeManager.__nestClassFieldInitializerScope(value);
204
- } else {
205
- this.scopeManager.__nestScope(new Scope(this.scopeManager, "function", this.scopeManager.__currentScope, value, true));
206
- }
196
+ this.scopeManager.__nestClassFieldInitializerScope(value);
207
197
  this.visit(value);
208
198
  this.close(value);
209
199
  }
@@ -218,7 +208,7 @@ class Referencer extends OriginalReferencer {
218
208
  }
219
209
  }
220
210
  _createScopeVariable(node, name) {
221
- this.currentScope().variableScope.__define(name, new Definition("Variable", name, node, null, null, null));
211
+ this.currentScope().variableScope.__define(name, new Definition("Variable", name, node));
222
212
  }
223
213
  _nestTypeParamScope(node) {
224
214
  if (!node.typeParameters) {
@@ -245,7 +235,7 @@ class Referencer extends OriginalReferencer {
245
235
  node.forEach(this._visitTypeAnnotation, this);
246
236
  return;
247
237
  }
248
- const visitorValues = getVisitorValues(node.type, _classPrivateFieldGet(_client, this));
238
+ const visitorValues = getVisitorValues(node.type);
249
239
  if (!visitorValues) {
250
240
  return;
251
241
  }
@@ -287,9 +277,9 @@ class Referencer extends OriginalReferencer {
287
277
  }
288
278
  }
289
279
  _checkIdentifierOrVisit(node) {
290
- if (node != null && node.typeAnnotation) {
280
+ if (node?.typeAnnotation) {
291
281
  this._visitTypeAnnotation(node.typeAnnotation);
292
- } else if ((node == null ? void 0 : node.type) === "Identifier") {
282
+ } else if (node?.type === "Identifier") {
293
283
  this.visit(node);
294
284
  } else {
295
285
  this._visitTypeAnnotation(node);
@@ -303,23 +293,92 @@ class Referencer extends OriginalReferencer {
303
293
  }
304
294
  }
305
295
  }
306
- module.exports = function analyzeScope(ast, parserOptions, client) {
307
- var _parserOptions$ecmaFe;
296
+ function analyzeScope(ast, parserOptions) {
308
297
  const options = {
309
298
  ignoreEval: true,
310
299
  optimistic: false,
311
300
  directive: false,
312
- nodejsScope: ast.sourceType === "script" && ((_parserOptions$ecmaFe = parserOptions.ecmaFeatures) == null ? void 0 : _parserOptions$ecmaFe.globalReturn) === true,
301
+ nodejsScope: ast.sourceType === "script" && parserOptions.ecmaFeatures?.globalReturn === true,
313
302
  impliedStrict: false,
314
303
  sourceType: ast.sourceType,
315
304
  ecmaVersion: parserOptions.ecmaVersion,
316
- fallback,
317
- childVisitorKeys: client.getVisitorKeys()
305
+ fallback: getKeys,
306
+ childVisitorKeys: types.VISITOR_KEYS
318
307
  };
319
308
  const scopeManager = new ScopeManager(options);
320
- const referencer = new Referencer(options, scopeManager, client);
309
+ const referencer = new Referencer(options, scopeManager);
321
310
  referencer.visit(ast);
322
311
  return scopeManager;
312
+ }
313
+
314
+ const require$1 = createRequire(import.meta.url);
315
+ const babelParser = require$1(require$1.resolve("@babel/parser", {
316
+ paths: [require$1.resolve("@babel/core/package.json")]
317
+ }));
318
+ let isRunningMinSupportedCoreVersion = null;
319
+ let client;
320
+ function parse$1(code, options) {
321
+ const minSupportedCoreVersion = "^7.2.0 || ^8.0.0";
322
+ if (typeof isRunningMinSupportedCoreVersion !== "boolean") {
323
+ isRunningMinSupportedCoreVersion = satisfies(version, minSupportedCoreVersion);
324
+ }
325
+ if (!isRunningMinSupportedCoreVersion) {
326
+ throw new Error(`@babel/eslint-parser@${"8.0.5"} does not support @babel/core@${version}. Please upgrade to @babel/core@${minSupportedCoreVersion}.`);
327
+ }
328
+ if (options.babelOptions.babelrc === false && options.babelOptions.configFile === false) {
329
+ const parserOpts = {
330
+ sourceType: options.sourceType,
331
+ sourceFilename: options.filePath,
332
+ ...(options.sourceType !== "commonjs" ? {
333
+ allowReturnOutsideFunction: options.ecmaFeatures?.globalReturn ?? false
334
+ } : {}),
335
+ ...options.babelOptions.parserOpts,
336
+ plugins: getParserPlugins(options.babelOptions),
337
+ attachComment: false,
338
+ ranges: true,
339
+ tokens: true
340
+ };
341
+ try {
342
+ return convertFile(babelParser.parse(code, parserOpts), code, getTokLabels(), getVisitorKeys());
343
+ } catch (err) {
344
+ throw convertError(err);
345
+ }
346
+ }
347
+ client ??= new WorkerClient();
348
+ const {
349
+ ast,
350
+ parserOptions
351
+ } = client.maybeParse(code, options);
352
+ if (ast) return ast;
353
+ try {
354
+ return convertFile(babelParser.parse(code, parserOptions), code, getTokLabels(), getVisitorKeys());
355
+ } catch (err) {
356
+ throw convertError(err);
357
+ }
358
+ }
359
+
360
+ const meta = {
361
+ name: "@babel/eslint-parser",
362
+ version: "8.0.5"
363
+ };
364
+ function parse(code, options = {}) {
365
+ return parse$1(code, normalizeESLintConfig(options));
366
+ }
367
+ function parseForESLint(code, options = {}) {
368
+ const normalizedOptions = normalizeESLintConfig(options);
369
+ const ast = parse$1(code, normalizedOptions);
370
+ const scopeManager = analyzeScope(ast, normalizedOptions);
371
+ return {
372
+ ast,
373
+ scopeManager,
374
+ visitorKeys: getVisitorKeys()
375
+ };
376
+ }
377
+ const index = {
378
+ meta,
379
+ parse,
380
+ parseForESLint
323
381
  };
324
382
 
325
- //# sourceMappingURL=analyze-scope.cjs.map
383
+ export { index as default, meta, parse, parseForESLint };
384
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/configuration.ts","../src/analyze-scope.ts","../src/parse.ts","../src/index.ts"],"sourcesContent":["import type { Options } from \"./types\";\n\nexport default function normalizeESLintConfig(options: any) {\n const {\n babelOptions = {},\n // ESLint sets ecmaVersion: undefined when ecmaVersion is not set in the config.\n ecmaVersion = \"latest\",\n sourceType = \"module\",\n requireConfigFile = true,\n ...otherOptions\n } = options;\n\n return {\n babelOptions: {\n cwd: process.cwd(),\n ...babelOptions,\n browserslistConfigFile: false,\n },\n ecmaVersion: ecmaVersion === \"latest\" ? 1e8 : ecmaVersion,\n sourceType,\n requireConfigFile,\n ...otherOptions,\n } as Options;\n}\n","import { types as t } from \"@babel/core\";\nimport * as eslintScope from \"eslint-scope\";\n\nconst {\n Definition,\n PatternVisitor: OriginalPatternVisitor,\n Referencer: OriginalReferencer,\n Scope,\n ScopeManager,\n} = eslintScope as unknown as import(\"./types\").Scope;\n\nimport { getKeys as fallback } from \"eslint-visitor-keys\";\n\nlet visitorKeysMap: Record<string, string[]>;\nfunction getVisitorValues(nodeType: string) {\n if (visitorKeysMap) return visitorKeysMap[nodeType];\n\n const flowFlippedAliasKeys = new Set(\n t.FLIPPED_ALIAS_KEYS.Flow.concat([\n \"ArrayPattern\",\n \"ClassDeclaration\",\n \"ClassExpression\",\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"Identifier\",\n \"ObjectPattern\",\n \"RestElement\",\n ]),\n );\n\n visitorKeysMap = Object.entries(t.VISITOR_KEYS).reduce(\n (acc, [key, value]) => {\n // @ts-expect-error FIXME: value is not assignable to type string[]\n if (!flowFlippedAliasKeys.has(value)) {\n // @ts-expect-error FIXME: value is not assignable to type string[]\n acc[key] = value;\n }\n return acc;\n },\n {},\n );\n\n return visitorKeysMap[nodeType];\n}\n\nconst propertyTypes = {\n // loops\n callProperties: { type: \"loop\", values: [\"value\"] },\n indexers: { type: \"loop\", values: [\"key\", \"value\"] },\n properties: { type: \"loop\", values: [\"argument\", \"value\"] },\n types: { type: \"loop\" },\n params: { type: \"loop\" },\n // single property\n argument: { type: \"single\" },\n elementType: { type: \"single\" },\n qualification: { type: \"single\" },\n rest: { type: \"single\" },\n returnType: { type: \"single\" },\n // others\n typeAnnotation: { type: \"typeAnnotation\" },\n typeParameters: { type: \"typeParameters\" },\n id: { type: \"id\" },\n};\n\nclass PatternVisitor extends OriginalPatternVisitor {\n ArrayPattern(node: any) {\n node.elements.forEach(this.visit, this);\n }\n\n ObjectPattern(node: any) {\n node.properties.forEach(this.visit, this);\n }\n}\n\nclass Referencer extends OriginalReferencer {\n constructor(options: any, scopeManager: any) {\n super(options, scopeManager);\n }\n\n // inherits.\n visitPattern(node: any, options: any, callback: any) {\n if (!node) {\n return;\n }\n\n // Visit type annotations.\n this._checkIdentifierOrVisit(node.typeAnnotation);\n if (node.type === \"AssignmentPattern\") {\n this._checkIdentifierOrVisit(node.left.typeAnnotation);\n }\n\n // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`.\n if (typeof options === \"function\") {\n callback = options;\n options = { processRightHandNodes: false };\n }\n\n const visitor = new PatternVisitor(this.options, node, callback);\n visitor.visit(node);\n\n // Process the right hand nodes recursively.\n if (options.processRightHandNodes) {\n visitor.rightHandNodes.forEach(this.visit, this);\n }\n }\n\n // inherits.\n visitClass(node: any) {\n // Decorators.\n this._visitArray(node.decorators);\n\n // Flow type parameters.\n const typeParamScope = this._nestTypeParamScope(node);\n\n // Flow super types.\n this._visitTypeAnnotation(node.implements);\n this._visitTypeAnnotation(node.superTypeArguments?.params);\n\n // Basic.\n super.visitClass(node);\n\n // Close the type parameter scope.\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n // inherits.\n visitFunction(node: any) {\n const typeParamScope = this._nestTypeParamScope(node);\n\n // Flow return types.\n this._checkIdentifierOrVisit(node.returnType);\n\n // Basic.\n super.visitFunction(node);\n\n // Close the type parameter scope.\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n // inherits.\n visitProperty(node: any) {\n if (node.value?.type === \"TypeCastExpression\") {\n this._visitTypeAnnotation(node.value);\n }\n this._visitArray(node.decorators);\n super.visitProperty(node);\n }\n\n InterfaceDeclaration(node: any) {\n this._createScopeVariable(node, node.id);\n\n const typeParamScope = this._nestTypeParamScope(node);\n\n // TODO: Handle mixins\n this._visitArray(node.extends);\n this.visit(node.body);\n\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n TypeAlias(node: any) {\n this._createScopeVariable(node, node.id);\n\n const typeParamScope = this._nestTypeParamScope(node);\n\n this.visit(node.right);\n\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n AccessorProperty(node: any) {\n this._visitClassProperty(node);\n }\n\n PropertyDefinition(node: any) {\n this._visitClassProperty(node);\n }\n\n DeclareModule(node: any) {\n this._visitDeclareX(node);\n }\n\n DeclareFunction(node: any) {\n this._visitDeclareX(node);\n }\n\n DeclareVariable(node: any) {\n this._visitDeclareX(node);\n }\n\n DeclareClass(node: any) {\n this._visitDeclareX(node);\n }\n\n _visitClassProperty(node: any) {\n const { computed, key, typeAnnotation, decorators, value } = node;\n\n this._visitArray(decorators);\n if (computed) this.visit(key);\n this._visitTypeAnnotation(typeAnnotation);\n\n if (value) {\n this.scopeManager.__nestClassFieldInitializerScope(value);\n this.visit(value);\n this.close(value);\n }\n }\n\n _visitDeclareX(node: any) {\n if (node.id) {\n this._createScopeVariable(node, node.id);\n }\n\n const typeParamScope = this._nestTypeParamScope(node);\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n _createScopeVariable(node: any, name: any) {\n this.currentScope().variableScope.__define(\n name,\n new Definition(\"Variable\", name, node),\n );\n }\n\n _nestTypeParamScope(node: any) {\n if (!node.typeParameters) {\n return null;\n }\n\n const parentScope = this.scopeManager.__currentScope;\n const scope = new Scope(\n this.scopeManager,\n \"type-parameters\",\n parentScope,\n node,\n false,\n );\n\n this.scopeManager.__nestScope(scope);\n for (let j = 0; j < node.typeParameters.params.length; j++) {\n const name = node.typeParameters.params[j];\n scope.__define(name, new Definition(\"TypeParameter\", name, name));\n if (name.typeAnnotation) {\n this._checkIdentifierOrVisit(name);\n }\n }\n scope.__define = parentScope.__define.bind(parentScope);\n\n return scope;\n }\n\n _visitTypeAnnotation(node: any) {\n if (!node) {\n return;\n }\n if (Array.isArray(node)) {\n node.forEach(this._visitTypeAnnotation, this);\n return;\n }\n\n // get property to check (params, id, etc...)\n const visitorValues = getVisitorValues(node.type);\n if (!visitorValues) {\n return;\n }\n\n // can have multiple properties\n for (let i = 0; i < visitorValues.length; i++) {\n const visitorValue = visitorValues[i];\n const propertyType = (propertyTypes as Record<string, any>)[visitorValue];\n const nodeProperty = node[visitorValue];\n // check if property or type is defined\n if (propertyType == null || nodeProperty == null) {\n continue;\n }\n if (propertyType.type === \"loop\") {\n for (let j = 0; j < nodeProperty.length; j++) {\n if (Array.isArray(propertyType.values)) {\n for (let k = 0; k < propertyType.values.length; k++) {\n const loopPropertyNode = nodeProperty[j][propertyType.values[k]];\n if (loopPropertyNode) {\n this._checkIdentifierOrVisit(loopPropertyNode);\n }\n }\n } else {\n this._checkIdentifierOrVisit(nodeProperty[j]);\n }\n }\n } else if (propertyType.type === \"single\") {\n this._checkIdentifierOrVisit(nodeProperty);\n } else if (propertyType.type === \"typeAnnotation\") {\n this._visitTypeAnnotation(node.typeAnnotation);\n } else if (propertyType.type === \"typeParameters\") {\n for (let l = 0; l < node.typeParameters.params.length; l++) {\n this._checkIdentifierOrVisit(node.typeParameters.params[l]);\n }\n } else if (propertyType.type === \"id\") {\n if (node.id.type === \"Identifier\") {\n this._checkIdentifierOrVisit(node.id);\n } else {\n this._visitTypeAnnotation(node.id);\n }\n }\n }\n }\n\n _checkIdentifierOrVisit(node: any) {\n if (node?.typeAnnotation) {\n this._visitTypeAnnotation(node.typeAnnotation);\n } else if (node?.type === \"Identifier\") {\n this.visit(node);\n } else {\n this._visitTypeAnnotation(node);\n }\n }\n\n _visitArray(nodeList: any[]) {\n if (nodeList) {\n for (const node of nodeList) {\n this.visit(node);\n }\n }\n }\n}\n\nexport default function analyzeScope(ast: any, parserOptions: any) {\n const options = {\n ignoreEval: true,\n optimistic: false,\n directive: false,\n nodejsScope:\n ast.sourceType === \"script\" &&\n parserOptions.ecmaFeatures?.globalReturn === true,\n impliedStrict: false,\n sourceType: ast.sourceType,\n ecmaVersion: parserOptions.ecmaVersion,\n fallback,\n childVisitorKeys: t.VISITOR_KEYS,\n };\n\n // @ts-expect-error upstream typing issue in the `fallback` property: (node: estree.Node) => readonly string[] is not assignable to type (node: estree.Node) => string[]\n const scopeManager = new ScopeManager(options);\n const referencer = new Referencer(options, scopeManager);\n\n referencer.visit(ast);\n\n return scopeManager as any;\n}\n","import { satisfies } from \"verkit\";\nimport type { Options } from \"./types\";\nimport { version } from \"@babel/core\";\nimport { WorkerClient, type Client } from \"./client.ts\";\nimport { convertError, convertFile } from \"./convert/index.ts\";\nimport { createRequire } from \"node:module\";\nimport { getTokLabels, getVisitorKeys } from \"./ast-info.ts\";\nimport { getParserPlugins } from \"./worker/configuration.ts\";\n\nconst require = createRequire(import.meta.url);\n\nconst babelParser = require(\n require.resolve(\"@babel/parser\", {\n paths: [require.resolve(\"@babel/core/package.json\")],\n }),\n);\n\nlet isRunningMinSupportedCoreVersion: boolean | null = null;\n\nlet client: Client;\n\nexport default function parse(code: string, options: Options) {\n // Ensure we're using a version of `@babel/core` that includes `parse()` and `tokTypes`.\n const minSupportedCoreVersion = REQUIRED_VERSION(\"^7.2.0 || ^8.0.0\");\n\n if (typeof isRunningMinSupportedCoreVersion !== \"boolean\") {\n isRunningMinSupportedCoreVersion = satisfies(\n version,\n minSupportedCoreVersion,\n );\n }\n\n if (!isRunningMinSupportedCoreVersion) {\n throw new Error(\n `@babel/eslint-parser@${\n PACKAGE_JSON.version\n } does not support @babel/core@${version}. Please upgrade to @babel/core@${minSupportedCoreVersion}.`,\n );\n }\n\n if (\n options.babelOptions.babelrc === false &&\n options.babelOptions.configFile === false\n ) {\n const parserOpts = {\n sourceType: options.sourceType,\n sourceFilename: options.filePath,\n ...(options.sourceType !== \"commonjs\"\n ? {\n allowReturnOutsideFunction:\n options.ecmaFeatures?.globalReturn ?? false,\n }\n : {}),\n ...options.babelOptions.parserOpts,\n plugins: getParserPlugins(options.babelOptions),\n // skip comment attaching for parsing performance\n attachComment: false,\n ranges: true,\n tokens: true,\n };\n try {\n return convertFile(\n babelParser.parse(code, parserOpts),\n code,\n getTokLabels(),\n getVisitorKeys(),\n );\n } catch (err) {\n throw convertError(err);\n }\n }\n\n client ??= new WorkerClient();\n const { ast, parserOptions } = client.maybeParse(code, options);\n if (ast) return ast;\n\n try {\n return convertFile(\n babelParser.parse(code, parserOptions),\n code,\n getTokLabels(),\n getVisitorKeys(),\n );\n } catch (err) {\n throw convertError(err);\n }\n}\n","import type { ESLint, Linter, AST } from \"eslint\";\nimport normalizeESLintConfig from \"./configuration.ts\";\nimport analyzeScope from \"./analyze-scope.ts\";\nimport baseParse from \"./parse.ts\";\n\nimport { getVisitorKeys } from \"./ast-info.ts\";\n\nexport const meta: ESLint.ObjectMetaProperties[\"meta\"] = {\n name: PACKAGE_JSON.name,\n version: PACKAGE_JSON.version,\n};\n\nexport function parse(\n code: string,\n options: Linter.ParserOptions = {},\n): AST.Program {\n return baseParse(code, normalizeESLintConfig(options));\n}\n\nexport function parseForESLint(\n code: string,\n options: Linter.ParserOptions = {},\n): Linter.ESLintParseResult {\n const normalizedOptions = normalizeESLintConfig(options);\n const ast = baseParse(code, normalizedOptions);\n const scopeManager = analyzeScope(ast, normalizedOptions);\n\n return { ast, scopeManager, visitorKeys: getVisitorKeys() };\n}\n\nexport default {\n meta,\n parse,\n parseForESLint,\n};\n"],"names":["t","fallback","require","parse","baseParse"],"mappings":";;;;;;;AAEe,SAAS,qBAAqB,CAAC,OAAY,EAAE;EAC1D,MAAM;IACJ,YAAY,GAAG,EAAE;AAEjB,IAAA,WAAW,GAAG,QAAQ;AACtB,IAAA,UAAU,GAAG,QAAQ;AACrB,IAAA,iBAAiB,GAAG,IAAI;IACxB,GAAG;AACL,GAAC,GAAG,OAAO;EAEX,OAAO;AACL,IAAA,YAAY,EAAE;AACZ,MAAA,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;AAClB,MAAA,GAAG,YAAY;AACf,MAAA,sBAAsB,EAAE;KACzB;AACD,IAAA,WAAW,EAAE,WAAW,KAAK,QAAQ,GAAG,GAAG,GAAG,WAAW;IACzD,UAAU;IACV,iBAAiB;IACjB,GAAG;GACJ;AACH;;ACpBA,MAAM;EACJ,UAAU;AACV,EAAA,cAAc,EAAE,sBAAsB;AACtC,EAAA,UAAU,EAAE,kBAAkB;EAC9B,KAAK;AACL,EAAA;AACF,CAAC,GAAG,WAAiD;AAIrD,IAAI,cAAwC;AAC5C,SAAS,gBAAgB,CAAC,QAAgB,EAAE;AAC1C,EAAA,IAAI,cAAc,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC;AAEnD,EAAA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAClCA,KAAC,CAAC,kBAAkB,CAAC,IA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,OAAO,CAAC,CAAC;AACxD;AAEO,SAAS,cAAc,CAC5B,IAAY,EACZ,OAA6B,GAAG,EAAE,EACR;AAC1B,EAAA,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,CAAC;AACxD,EAAA,MAAM,GAAG,GAAGA,OAAS,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC9C,EAAA,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,EAAE,iBAAiB,CAAC;EAEzD,OAAO;IAAE,GAAG;IAAE,YAAY;IAAE,WAAW,EAAE,cAAc;GAAI;AAC7D;AAEA,cAAe;EACb,IAAI;EACJ,KAAK;AACL,EAAA;AACF,CAAC;;;;"}
@@ -0,0 +1,88 @@
1
+ import { parentPort } from 'node:worker_threads';
2
+ import { createConfigItemAsync, parseAsync } from '@babel/core';
3
+ import { convertError, convertFile, getVisitorKeys, getTokLabels, ACTIONS, normalizeBabelParseConfig } from '../configuration-shared.js';
4
+
5
+ function extractParserOptionsPlugin() {
6
+ return {
7
+ parserOverride(code, opts) {
8
+ return opts;
9
+ }
10
+ };
11
+ }
12
+
13
+ const ref = {};
14
+ let extractParserOptionsConfigItem;
15
+ const MULTIPLE_OVERRIDES = /More than one plugin attempted to override parsing/;
16
+ async function maybeParse(code, options) {
17
+ if (!extractParserOptionsConfigItem) {
18
+ extractParserOptionsConfigItem = await createConfigItemAsync([extractParserOptionsPlugin, ref], {
19
+ dirname: import.meta.dirname,
20
+ type: "plugin"
21
+ });
22
+ }
23
+ const {
24
+ plugins
25
+ } = options;
26
+ options.plugins = plugins.concat(extractParserOptionsConfigItem);
27
+ let ast;
28
+ try {
29
+ return {
30
+ parserOptions: await parseAsync(code, options),
31
+ ast: null
32
+ };
33
+ } catch (err) {
34
+ if (!MULTIPLE_OVERRIDES.test(err.message)) {
35
+ throw err;
36
+ }
37
+ }
38
+ options.plugins = plugins;
39
+ try {
40
+ ast = await parseAsync(code, options);
41
+ } catch (err) {
42
+ throw convertError(err);
43
+ }
44
+ return {
45
+ ast: convertFile(ast, code, getTokLabels(), getVisitorKeys()),
46
+ parserOptions: null
47
+ };
48
+ }
49
+
50
+ async function handleMessage(action, payload) {
51
+ switch (action) {
52
+ case ACTIONS.MAYBE_PARSE:
53
+ return await maybeParse(payload.code, await normalizeBabelParseConfig(payload.options));
54
+ }
55
+ }
56
+
57
+ parentPort.addListener("message", async ({
58
+ signal,
59
+ port,
60
+ action,
61
+ payload
62
+ }) => {
63
+ let response;
64
+ try {
65
+ response = {
66
+ result: await handleMessage(action, payload)
67
+ };
68
+ } catch (error) {
69
+ response = {
70
+ error,
71
+ errorData: {
72
+ ...error
73
+ }
74
+ };
75
+ }
76
+ try {
77
+ port.postMessage(response);
78
+ } catch {
79
+ port.postMessage({
80
+ error: new Error("Cannot serialize worker response")
81
+ });
82
+ } finally {
83
+ port.close();
84
+ Atomics.store(signal, 0, 1);
85
+ Atomics.notify(signal, 0);
86
+ }
87
+ });
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/worker/extract-parser-options-plugin.ts","../../src/worker/maybeParse.ts","../../src/worker/handle-message.ts","../../src/worker/index.ts"],"sourcesContent":["export default function extractParserOptionsPlugin() {\n return {\n parserOverride(code: string, opts: any) {\n return opts;\n },\n };\n}\n","import { createConfigItemAsync, parseAsync } from \"@babel/core\";\nimport { convertError, convertFile } from \"../convert/index.ts\";\nimport { getTokLabels, getVisitorKeys } from \"../ast-info.ts\";\nimport extractParserOptionsPlugin from \"./extract-parser-options-plugin.ts\";\n\nimport type { InputOptions, ConfigItem } from \"@babel/core\";\nimport type { AST, ParseResult } from \"../types\";\n\nconst ref = {};\nlet extractParserOptionsConfigItem: ConfigItem<any>;\n\nconst MULTIPLE_OVERRIDES = /More than one plugin attempted to override parsing/;\n\nexport default async function maybeParse(\n code: string,\n options: InputOptions,\n): Promise<{\n ast: AST.Program | null;\n parserOptions: ParseResult | null;\n}> {\n if (!extractParserOptionsConfigItem) {\n extractParserOptionsConfigItem = await createConfigItemAsync(\n [extractParserOptionsPlugin, ref],\n { dirname: import.meta.dirname, type: \"plugin\" },\n );\n }\n const { plugins } = options;\n options.plugins = plugins!.concat(extractParserOptionsConfigItem);\n\n let ast;\n\n try {\n return {\n parserOptions: await parseAsync(code, options),\n ast: null,\n };\n } catch (err) {\n if (!MULTIPLE_OVERRIDES.test(err.message)) {\n throw err;\n }\n }\n\n // There was already a parserOverride, so remove our plugin.\n options.plugins = plugins;\n\n try {\n ast = await parseAsync(code, options);\n } catch (err) {\n throw convertError(err);\n }\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n ast: convertFile(ast!, code, getTokLabels(), getVisitorKeys()),\n parserOptions: null,\n };\n}\n","import maybeParse from \"./maybeParse.ts\";\nimport { normalizeBabelParseConfig } from \"./configuration.ts\";\nimport { ACTIONS } from \"../client.ts\";\n\nexport default async function handleMessage(action: ACTIONS, payload: any) {\n switch (action) {\n case ACTIONS.MAYBE_PARSE:\n return await maybeParse(\n payload.code,\n await normalizeBabelParseConfig(payload.options),\n );\n }\n}\n","import { parentPort } from \"node:worker_threads\";\n\nimport handleMessage from \"./handle-message.ts\";\n\nparentPort!.addListener(\n \"message\",\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async ({ signal, port, action, payload }) => {\n let response;\n\n try {\n response = { result: await handleMessage(action, payload) };\n } catch (error) {\n response = { error, errorData: { ...error } };\n }\n\n try {\n port.postMessage(response);\n } catch {\n port.postMessage({\n error: new Error(\"Cannot serialize worker response\"),\n });\n } finally {\n port.close();\n Atomics.store(signal, 0, 1);\n Atomics.notify(signal, 0);\n }\n },\n);\n"],"names":[],"mappings":";;;;AAAe,SAAS,0BAA0B,GAAG;EACnD,OAAO;AACL,IAAA,cAAc,CAAC,IAAY,EAAE,IAAS,EAAE;AACtC,MAAA,OAAO,IAAI;AACb,IAAA;GACD;AACH;;ACEA,MAAM,GAAG,GAAG,EAAE;AACd,IAAI,8BAA+C;AAEnD,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BAAyB,CAAC,OAAO,CAAC,OAAO,CACjD,CAAC;AACL;AACF;;ACRA,UAAU,CAAE,WAAW,CACrB,SAAS,EAET,OAAO;EAAE,MAAM;EAAE,IAAI;EAAE,MAAM;AAAE,EAAA;AAAQ,CAAC,KAAK;AAC3C,EAAA,IAAI,QAAQ;EAEZ,IAAI;AACF,IAAA,QAAQ,GAAG;AAAE,MAAA,MAAM,EAAE,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO;KAAG;EAC7D,CAAC,CAAC,OAAO,KAAK,EAAE;AACd,IAAA,QAAQ,GAAG;MAAE,KAAK;AAAE,MAAA,SAAS,EAAE;QAAE,GAAG;AAAM;KAAG;AAC/C,EAAA;EAEA,IAAI;AACF,IAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC5B,EAAA,CAAC,CAAC,MAAM;IACN,IAAI,CAAC,WAAW,CAAC;AACf,MAAA,KAAK,EAAE,IAAI,KAAK,CAAC,kCAAkC;AACrD,KAAC,CAAC;AACJ,EAAA,CAAC,SAAS;IACR,IAAI,CAAC,KAAK,EAAE;IACZ,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3B,IAAA,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3B,EAAA;AACF,CACF,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depup/babel__eslint-parser",
3
- "version": "7.28.6-depup.0",
4
- "description": "[DepUp] ESLint parser that allows for linting of experimental syntax transformed by Babel",
3
+ "version": "8.0.5-depup.0",
4
+ "description": "ESLint parser that allows for linting of experimental syntax transformed by Babel (with updated dependencies)",
5
5
  "author": "The Babel Team (https://babel.dev/team)",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -14,62 +14,61 @@
14
14
  },
15
15
  "homepage": "https://babel.dev/",
16
16
  "engines": {
17
- "node": "^10.13.0 || ^12.13.0 || >=14.0.0"
17
+ "node": "^22.18.0 || >=24.11.0"
18
18
  },
19
- "main": "./lib/index.cjs",
19
+ "main": "./lib/index.js",
20
20
  "type": "module",
21
- "types": "./types.d.cts",
22
21
  "exports": {
23
22
  ".": {
24
- "default": "./lib/index.cjs",
25
- "types": "./types.d.cts"
26
- },
27
- "./experimental-worker": {
28
- "default": "./lib/experimental-worker.cjs",
29
- "types": "./types.d.cts"
23
+ "types": "./lib/index.d.ts",
24
+ "default": "./lib/index.js"
30
25
  },
31
26
  "./package.json": "./package.json"
32
27
  },
33
28
  "peerDependencies": {
34
- "@babel/core": "^7.11.0",
35
- "eslint": "^7.5.0 || ^8.0.0 || ^9.0.0"
29
+ "@babel/core": "^8.0.0",
30
+ "eslint": "^9.0.0 || ^10.0.0"
36
31
  },
37
32
  "dependencies": {
38
- "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1",
33
+ "eslint-scope": "^9.1.2",
39
34
  "eslint-visitor-keys": "^5.0.1",
40
- "semver": "^7.7.4"
35
+ "verkit": "^0.4.0"
41
36
  },
42
37
  "devDependencies": {
43
- "@babel/core": "^7.28.6",
44
- "@babel/helper-fixtures": "^7.28.6",
45
- "@types/eslint": "^8.56.2",
38
+ "@babel/core": "^8.0.5",
39
+ "@babel/helper-fixtures": "^8.0.5",
46
40
  "@types/estree": "^1.0.5",
47
- "@typescript-eslint/scope-manager": "^6.19.0",
48
41
  "dedent": "^1.5.3",
49
- "eslint": "^9.21.0",
50
- "typescript-eslint": "^8.48.0"
42
+ "eslint": "^10.0.0",
43
+ "typescript-eslint": "8.60.0"
51
44
  },
52
45
  "keywords": [
46
+ "@babel/eslint-parser",
53
47
  "depup",
54
- "dependency-bumped",
55
- "updated-deps",
56
- "@babel/eslint-parser"
48
+ "updated-dependencies",
49
+ "security",
50
+ "latest",
51
+ "patched"
57
52
  ],
58
53
  "depup": {
59
54
  "changes": {
55
+ "eslint-scope": {
56
+ "from": "^9.1.0",
57
+ "to": "^9.1.2"
58
+ },
60
59
  "eslint-visitor-keys": {
61
- "from": "^2.1.0",
60
+ "from": "^5.0.0",
62
61
  "to": "^5.0.1"
63
62
  },
64
- "semver": {
65
- "from": "^6.3.1",
66
- "to": "^7.7.4"
63
+ "verkit": {
64
+ "from": "^0.3.2",
65
+ "to": "^0.4.0"
67
66
  }
68
67
  },
69
- "depsUpdated": 2,
68
+ "depsUpdated": 3,
70
69
  "originalPackage": "@babel/eslint-parser",
71
- "originalVersion": "7.28.6",
72
- "processedAt": "2026-03-17T16:30:32.593Z",
70
+ "originalVersion": "8.0.5",
71
+ "processedAt": "2026-09-11T00:32:27.630Z",
73
72
  "smokeTest": "passed"
74
73
  }
75
74
  }
@@ -1 +0,0 @@
1
- {"version":3,"names":["Definition","PatternVisitor","OriginalPatternVisitor","Referencer","OriginalReferencer","Scope","ScopeManager","require","getKeys","fallback","visitorKeysMap","getVisitorValues","nodeType","client","FLOW_FLIPPED_ALIAS_KEYS","VISITOR_KEYS","getTypesInfo","flowFlippedAliasKeys","Set","concat","Object","entries","o","keys","map","k","reduce","acc","key","value","has","propertyTypes","callProperties","type","values","indexers","properties","types","params","argument","elementType","qualification","rest","returnType","typeAnnotation","typeParameters","id","ArrayPattern","node","elements","forEach","visit","ObjectPattern","_client","WeakMap","constructor","options","scopeManager","_classPrivateFieldInitSpec","_classPrivateFieldSet","visitPattern","callback","_checkIdentifierOrVisit","left","processRightHandNodes","visitor","rightHandNodes","visitClass","_ref","_visitArray","decorators","typeParamScope","_nestTypeParamScope","_visitTypeAnnotation","implements","superTypeParameters","close","visitFunction","visitProperty","_node$value","InterfaceDeclaration","_createScopeVariable","extends","body","TypeAlias","right","ClassProperty","_visitClassProperty","ClassPrivateProperty","AccessorProperty","ClassAccessorProperty","PropertyDefinition","ClassPrivateMethod","MethodDefinition","DeclareModule","_visitDeclareX","DeclareFunction","DeclareVariable","DeclareClass","OptionalMemberExpression","MemberExpression","computed","__nestClassFieldInitializerScope","__nestScope","__currentScope","name","currentScope","variableScope","__define","parentScope","scope","j","length","bind","Array","isArray","visitorValues","_classPrivateFieldGet","i","visitorValue","propertyType","nodeProperty","loopPropertyNode","l","nodeList","module","exports","analyzeScope","ast","parserOptions","_parserOptions$ecmaFe","ignoreEval","optimistic","directive","nodejsScope","sourceType","ecmaFeatures","globalReturn","impliedStrict","ecmaVersion","childVisitorKeys","getVisitorKeys","referencer"],"sources":["../src/analyze-scope.cts"],"sourcesContent":["import type { Client } from \"./client.cts\";\n\nconst {\n Definition,\n PatternVisitor: OriginalPatternVisitor,\n Referencer: OriginalReferencer,\n Scope,\n ScopeManager,\n} = (\n process.env.BABEL_8_BREAKING\n ? require(\"eslint-scope\")\n : require(\"@nicolo-ribaudo/eslint-scope-5-internals\")\n) as import(\"./types.cts\").Scope;\nconst { getKeys: fallback } = require(\"eslint-visitor-keys\");\n\nlet visitorKeysMap: Record<string, string[]>;\nfunction getVisitorValues(nodeType: string, client: Client) {\n if (visitorKeysMap) return visitorKeysMap[nodeType];\n\n const { FLOW_FLIPPED_ALIAS_KEYS, VISITOR_KEYS } = client.getTypesInfo();\n\n const flowFlippedAliasKeys = new Set(\n FLOW_FLIPPED_ALIAS_KEYS.concat([\n \"ArrayPattern\",\n \"ClassDeclaration\",\n \"ClassExpression\",\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"Identifier\",\n \"ObjectPattern\",\n \"RestElement\",\n ]),\n );\n\n visitorKeysMap = Object.entries(VISITOR_KEYS).reduce((acc, [key, value]) => {\n if (!flowFlippedAliasKeys.has(value)) {\n // @ts-expect-error FIXME: value is not assignable to type string[]\n acc[key] = value;\n }\n return acc;\n }, {});\n\n return visitorKeysMap[nodeType];\n}\n\nconst propertyTypes = {\n // loops\n callProperties: { type: \"loop\", values: [\"value\"] },\n indexers: { type: \"loop\", values: [\"key\", \"value\"] },\n properties: { type: \"loop\", values: [\"argument\", \"value\"] },\n types: { type: \"loop\" },\n params: { type: \"loop\" },\n // single property\n argument: { type: \"single\" },\n elementType: { type: \"single\" },\n qualification: { type: \"single\" },\n rest: { type: \"single\" },\n returnType: { type: \"single\" },\n // others\n typeAnnotation: { type: \"typeAnnotation\" },\n typeParameters: { type: \"typeParameters\" },\n id: { type: \"id\" },\n};\n\nclass PatternVisitor extends OriginalPatternVisitor {\n ArrayPattern(node: any) {\n node.elements.forEach(this.visit, this);\n }\n\n ObjectPattern(node: any) {\n node.properties.forEach(this.visit, this);\n }\n}\n\nclass Referencer extends OriginalReferencer {\n #client;\n\n constructor(options: any, scopeManager: any, client: Client) {\n super(options, scopeManager);\n this.#client = client;\n }\n\n // inherits.\n visitPattern(node: any, options: any, callback: any) {\n if (!node) {\n return;\n }\n\n // Visit type annotations.\n this._checkIdentifierOrVisit(node.typeAnnotation);\n if (node.type === \"AssignmentPattern\") {\n this._checkIdentifierOrVisit(node.left.typeAnnotation);\n }\n\n // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`.\n if (typeof options === \"function\") {\n callback = options;\n options = { processRightHandNodes: false };\n }\n\n const visitor = new PatternVisitor(this.options, node, callback);\n visitor.visit(node);\n\n // Process the right hand nodes recursively.\n if (options.processRightHandNodes) {\n visitor.rightHandNodes.forEach(this.visit, this);\n }\n }\n\n // inherits.\n visitClass(node: any) {\n // Decorators.\n this._visitArray(node.decorators);\n\n // Flow type parameters.\n const typeParamScope = this._nestTypeParamScope(node);\n\n // Flow super types.\n this._visitTypeAnnotation(node.implements);\n this._visitTypeAnnotation(\n (process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Renamed\n node.superTypeArguments\n : // @ts-ignore(Babel 7 vs Babel 8) Renamed\n node.superTypeParameters\n )?.params,\n );\n\n // Basic.\n super.visitClass(node);\n\n // Close the type parameter scope.\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n // inherits.\n visitFunction(node: any) {\n const typeParamScope = this._nestTypeParamScope(node);\n\n // Flow return types.\n this._checkIdentifierOrVisit(node.returnType);\n\n // Basic.\n super.visitFunction(node);\n\n // Close the type parameter scope.\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n // inherits.\n visitProperty(node: any) {\n if (node.value?.type === \"TypeCastExpression\") {\n this._visitTypeAnnotation(node.value);\n }\n this._visitArray(node.decorators);\n super.visitProperty(node);\n }\n\n InterfaceDeclaration(node: any) {\n this._createScopeVariable(node, node.id);\n\n const typeParamScope = this._nestTypeParamScope(node);\n\n // TODO: Handle mixins\n this._visitArray(node.extends);\n this.visit(node.body);\n\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n TypeAlias(node: any) {\n this._createScopeVariable(node, node.id);\n\n const typeParamScope = this._nestTypeParamScope(node);\n\n this.visit(node.right);\n\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n ClassProperty(node: any) {\n this._visitClassProperty(node);\n }\n\n ClassPrivateProperty(node: any) {\n this._visitClassProperty(node);\n }\n\n AccessorProperty(node: any) {\n this._visitClassProperty(node);\n }\n\n ClassAccessorProperty(node: any) {\n this._visitClassProperty(node);\n }\n\n PropertyDefinition(node: any) {\n this._visitClassProperty(node);\n }\n\n // TODO: Update to visit type annotations when TypeScript/Flow support this syntax.\n ClassPrivateMethod(node: any) {\n super.MethodDefinition(node);\n }\n\n DeclareModule(node: any) {\n this._visitDeclareX(node);\n }\n\n DeclareFunction(node: any) {\n this._visitDeclareX(node);\n }\n\n DeclareVariable(node: any) {\n this._visitDeclareX(node);\n }\n\n DeclareClass(node: any) {\n this._visitDeclareX(node);\n }\n\n // visit OptionalMemberExpression as a MemberExpression.\n OptionalMemberExpression(node: any) {\n super.MemberExpression(node);\n }\n\n _visitClassProperty(node: any) {\n const { computed, key, typeAnnotation, decorators, value } = node;\n\n this._visitArray(decorators);\n if (computed) this.visit(key);\n this._visitTypeAnnotation(typeAnnotation);\n\n if (value) {\n if (this.scopeManager.__nestClassFieldInitializerScope) {\n this.scopeManager.__nestClassFieldInitializerScope(value);\n } else {\n // Given that ESLint 7 didn't have a \"class field initializer\" scope,\n // we create a plain method scope. Semantics are the same.\n this.scopeManager.__nestScope(\n new Scope(\n this.scopeManager,\n \"function\",\n this.scopeManager.__currentScope,\n value,\n true,\n ),\n );\n }\n this.visit(value);\n this.close(value);\n }\n }\n\n _visitDeclareX(node: any) {\n if (node.id) {\n this._createScopeVariable(node, node.id);\n }\n\n const typeParamScope = this._nestTypeParamScope(node);\n if (typeParamScope) {\n this.close(node);\n }\n }\n\n _createScopeVariable(node: any, name: any) {\n this.currentScope().variableScope.__define(\n name,\n new Definition(\"Variable\", name, node, null, null, null),\n );\n }\n\n _nestTypeParamScope(node: any) {\n if (!node.typeParameters) {\n return null;\n }\n\n const parentScope = this.scopeManager.__currentScope;\n const scope = new Scope(\n this.scopeManager,\n \"type-parameters\",\n parentScope,\n node,\n false,\n );\n\n this.scopeManager.__nestScope(scope);\n for (let j = 0; j < node.typeParameters.params.length; j++) {\n const name = node.typeParameters.params[j];\n scope.__define(name, new Definition(\"TypeParameter\", name, name));\n if (name.typeAnnotation) {\n this._checkIdentifierOrVisit(name);\n }\n }\n scope.__define = parentScope.__define.bind(parentScope);\n\n return scope;\n }\n\n _visitTypeAnnotation(node: any) {\n if (!node) {\n return;\n }\n if (Array.isArray(node)) {\n node.forEach(this._visitTypeAnnotation, this);\n return;\n }\n\n // get property to check (params, id, etc...)\n const visitorValues = getVisitorValues(node.type, this.#client);\n if (!visitorValues) {\n return;\n }\n\n // can have multiple properties\n for (let i = 0; i < visitorValues.length; i++) {\n const visitorValue = visitorValues[i];\n const propertyType = (propertyTypes as Record<string, any>)[visitorValue];\n const nodeProperty = node[visitorValue];\n // check if property or type is defined\n if (propertyType == null || nodeProperty == null) {\n continue;\n }\n if (propertyType.type === \"loop\") {\n for (let j = 0; j < nodeProperty.length; j++) {\n if (Array.isArray(propertyType.values)) {\n for (let k = 0; k < propertyType.values.length; k++) {\n const loopPropertyNode = nodeProperty[j][propertyType.values[k]];\n if (loopPropertyNode) {\n this._checkIdentifierOrVisit(loopPropertyNode);\n }\n }\n } else {\n this._checkIdentifierOrVisit(nodeProperty[j]);\n }\n }\n } else if (propertyType.type === \"single\") {\n this._checkIdentifierOrVisit(nodeProperty);\n } else if (propertyType.type === \"typeAnnotation\") {\n this._visitTypeAnnotation(node.typeAnnotation);\n } else if (propertyType.type === \"typeParameters\") {\n for (let l = 0; l < node.typeParameters.params.length; l++) {\n this._checkIdentifierOrVisit(node.typeParameters.params[l]);\n }\n } else if (propertyType.type === \"id\") {\n if (node.id.type === \"Identifier\") {\n this._checkIdentifierOrVisit(node.id);\n } else {\n this._visitTypeAnnotation(node.id);\n }\n }\n }\n }\n\n _checkIdentifierOrVisit(node: any) {\n if (node?.typeAnnotation) {\n this._visitTypeAnnotation(node.typeAnnotation);\n } else if (node?.type === \"Identifier\") {\n this.visit(node);\n } else {\n this._visitTypeAnnotation(node);\n }\n }\n\n _visitArray(nodeList: any[]) {\n if (nodeList) {\n for (const node of nodeList) {\n this.visit(node);\n }\n }\n }\n}\n\nexport = function analyzeScope(ast: any, parserOptions: any, client: Client) {\n const options = {\n ignoreEval: true,\n optimistic: false,\n directive: false,\n nodejsScope:\n ast.sourceType === \"script\" &&\n parserOptions.ecmaFeatures?.globalReturn === true,\n impliedStrict: false,\n sourceType: ast.sourceType,\n ecmaVersion: parserOptions.ecmaVersion,\n fallback,\n childVisitorKeys: client.getVisitorKeys(),\n };\n\n const scopeManager = new ScopeManager(options);\n const referencer = new Referencer(options, scopeManager, client);\n\n referencer.visit(ast);\n\n return scopeManager as any;\n};\n"],"mappings":";;;;;;;AAEA,MAAM;EACJA,UAAU;EACVC,cAAc,EAAEC,sBAAsB;EACtCC,UAAU,EAAEC,kBAAkB;EAC9BC,KAAK;EACLC;AACF,CAAC,GAGKC,OAAO,CAAC,0CAA0C,CACxB;AAChC,MAAM;EAAEC,OAAO,EAAEC;AAAS,CAAC,GAAGF,OAAO,CAAC,qBAAqB,CAAC;AAE5D,IAAIG,cAAwC;AAC5C,SAASC,gBAAgBA,CAACC,QAAgB,EAAEC,MAAc,EAAE;EAC1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