@depup/babel__eslint-parser 7.28.6-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.
- package/LICENSE +22 -0
- package/README.md +32 -0
- package/changes.json +14 -0
- package/lib/analyze-scope.cjs +325 -0
- package/lib/analyze-scope.cjs.map +1 -0
- package/lib/client.cjs +104 -0
- package/lib/client.cjs.map +1 -0
- package/lib/configuration.cjs +23 -0
- package/lib/configuration.cjs.map +1 -0
- package/lib/convert/convertAST.cjs +134 -0
- package/lib/convert/convertAST.cjs.map +1 -0
- package/lib/convert/convertComments.cjs +10 -0
- package/lib/convert/convertComments.cjs.map +1 -0
- package/lib/convert/convertTokens.cjs +158 -0
- package/lib/convert/convertTokens.cjs.map +1 -0
- package/lib/convert/index.cjs +25 -0
- package/lib/convert/index.cjs.map +1 -0
- package/lib/experimental-worker.cjs +32 -0
- package/lib/experimental-worker.cjs.map +1 -0
- package/lib/index.cjs +32 -0
- package/lib/index.cjs.map +1 -0
- package/lib/parse.cjs +37 -0
- package/lib/parse.cjs.map +1 -0
- package/lib/utils/eslint-version.cjs +5 -0
- package/lib/utils/eslint-version.cjs.map +1 -0
- package/lib/worker/ast-info.cjs +38 -0
- package/lib/worker/ast-info.cjs.map +1 -0
- package/lib/worker/babel-core.cjs +19 -0
- package/lib/worker/babel-core.cjs.map +1 -0
- package/lib/worker/configuration.cjs +99 -0
- package/lib/worker/configuration.cjs.map +1 -0
- package/lib/worker/extract-parser-options-plugin.cjs +11 -0
- package/lib/worker/extract-parser-options-plugin.cjs.map +1 -0
- package/lib/worker/handle-message.cjs +31 -0
- package/lib/worker/handle-message.cjs.map +1 -0
- package/lib/worker/index.cjs +39 -0
- package/lib/worker/index.cjs.map +1 -0
- package/lib/worker/maybeParse.cjs +56 -0
- package/lib/worker/maybeParse.cjs.map +1 -0
- package/lib/worker/maybeParseSync.cjs +48 -0
- package/lib/worker/maybeParseSync.cjs.map +1 -0
- package/package.json +75 -0
- package/types.d.cts +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @depup/babel__eslint-parser
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/babel__eslint-parser
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) @ 7.28.6 |
|
|
17
|
+
| Processed | 2026-03-17 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 2 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| eslint-visitor-keys | ^2.1.0 | ^5.0.1 |
|
|
26
|
+
| semver | ^6.3.1 | ^7.7.4 |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@babel/eslint-parser
|
|
31
|
+
|
|
32
|
+
License inherited from the original package.
|
package/changes.json
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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
|
+
const {
|
|
9
|
+
Definition,
|
|
10
|
+
PatternVisitor: OriginalPatternVisitor,
|
|
11
|
+
Referencer: OriginalReferencer,
|
|
12
|
+
Scope,
|
|
13
|
+
ScopeManager
|
|
14
|
+
} = require("@nicolo-ribaudo/eslint-scope-5-internals");
|
|
15
|
+
const {
|
|
16
|
+
getKeys: fallback
|
|
17
|
+
} = require("eslint-visitor-keys");
|
|
18
|
+
let visitorKeysMap;
|
|
19
|
+
function getVisitorValues(nodeType, client) {
|
|
20
|
+
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]) => {
|
|
27
|
+
if (!flowFlippedAliasKeys.has(value)) {
|
|
28
|
+
acc[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return acc;
|
|
31
|
+
}, {});
|
|
32
|
+
return visitorKeysMap[nodeType];
|
|
33
|
+
}
|
|
34
|
+
const propertyTypes = {
|
|
35
|
+
callProperties: {
|
|
36
|
+
type: "loop",
|
|
37
|
+
values: ["value"]
|
|
38
|
+
},
|
|
39
|
+
indexers: {
|
|
40
|
+
type: "loop",
|
|
41
|
+
values: ["key", "value"]
|
|
42
|
+
},
|
|
43
|
+
properties: {
|
|
44
|
+
type: "loop",
|
|
45
|
+
values: ["argument", "value"]
|
|
46
|
+
},
|
|
47
|
+
types: {
|
|
48
|
+
type: "loop"
|
|
49
|
+
},
|
|
50
|
+
params: {
|
|
51
|
+
type: "loop"
|
|
52
|
+
},
|
|
53
|
+
argument: {
|
|
54
|
+
type: "single"
|
|
55
|
+
},
|
|
56
|
+
elementType: {
|
|
57
|
+
type: "single"
|
|
58
|
+
},
|
|
59
|
+
qualification: {
|
|
60
|
+
type: "single"
|
|
61
|
+
},
|
|
62
|
+
rest: {
|
|
63
|
+
type: "single"
|
|
64
|
+
},
|
|
65
|
+
returnType: {
|
|
66
|
+
type: "single"
|
|
67
|
+
},
|
|
68
|
+
typeAnnotation: {
|
|
69
|
+
type: "typeAnnotation"
|
|
70
|
+
},
|
|
71
|
+
typeParameters: {
|
|
72
|
+
type: "typeParameters"
|
|
73
|
+
},
|
|
74
|
+
id: {
|
|
75
|
+
type: "id"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
class PatternVisitor extends OriginalPatternVisitor {
|
|
79
|
+
ArrayPattern(node) {
|
|
80
|
+
node.elements.forEach(this.visit, this);
|
|
81
|
+
}
|
|
82
|
+
ObjectPattern(node) {
|
|
83
|
+
node.properties.forEach(this.visit, this);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
var _client = new WeakMap();
|
|
87
|
+
class Referencer extends OriginalReferencer {
|
|
88
|
+
constructor(options, scopeManager, client) {
|
|
89
|
+
super(options, scopeManager);
|
|
90
|
+
_classPrivateFieldInitSpec(this, _client, void 0);
|
|
91
|
+
_classPrivateFieldSet(_client, this, client);
|
|
92
|
+
}
|
|
93
|
+
visitPattern(node, options, callback) {
|
|
94
|
+
if (!node) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this._checkIdentifierOrVisit(node.typeAnnotation);
|
|
98
|
+
if (node.type === "AssignmentPattern") {
|
|
99
|
+
this._checkIdentifierOrVisit(node.left.typeAnnotation);
|
|
100
|
+
}
|
|
101
|
+
if (typeof options === "function") {
|
|
102
|
+
callback = options;
|
|
103
|
+
options = {
|
|
104
|
+
processRightHandNodes: false
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const visitor = new PatternVisitor(this.options, node, callback);
|
|
108
|
+
visitor.visit(node);
|
|
109
|
+
if (options.processRightHandNodes) {
|
|
110
|
+
visitor.rightHandNodes.forEach(this.visit, this);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
visitClass(node) {
|
|
114
|
+
var _ref;
|
|
115
|
+
this._visitArray(node.decorators);
|
|
116
|
+
const typeParamScope = this._nestTypeParamScope(node);
|
|
117
|
+
this._visitTypeAnnotation(node.implements);
|
|
118
|
+
this._visitTypeAnnotation((_ref = node.superTypeParameters) == null ? void 0 : _ref.params);
|
|
119
|
+
super.visitClass(node);
|
|
120
|
+
if (typeParamScope) {
|
|
121
|
+
this.close(node);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
visitFunction(node) {
|
|
125
|
+
const typeParamScope = this._nestTypeParamScope(node);
|
|
126
|
+
this._checkIdentifierOrVisit(node.returnType);
|
|
127
|
+
super.visitFunction(node);
|
|
128
|
+
if (typeParamScope) {
|
|
129
|
+
this.close(node);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
visitProperty(node) {
|
|
133
|
+
var _node$value;
|
|
134
|
+
if (((_node$value = node.value) == null ? void 0 : _node$value.type) === "TypeCastExpression") {
|
|
135
|
+
this._visitTypeAnnotation(node.value);
|
|
136
|
+
}
|
|
137
|
+
this._visitArray(node.decorators);
|
|
138
|
+
super.visitProperty(node);
|
|
139
|
+
}
|
|
140
|
+
InterfaceDeclaration(node) {
|
|
141
|
+
this._createScopeVariable(node, node.id);
|
|
142
|
+
const typeParamScope = this._nestTypeParamScope(node);
|
|
143
|
+
this._visitArray(node.extends);
|
|
144
|
+
this.visit(node.body);
|
|
145
|
+
if (typeParamScope) {
|
|
146
|
+
this.close(node);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
TypeAlias(node) {
|
|
150
|
+
this._createScopeVariable(node, node.id);
|
|
151
|
+
const typeParamScope = this._nestTypeParamScope(node);
|
|
152
|
+
this.visit(node.right);
|
|
153
|
+
if (typeParamScope) {
|
|
154
|
+
this.close(node);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
ClassProperty(node) {
|
|
158
|
+
this._visitClassProperty(node);
|
|
159
|
+
}
|
|
160
|
+
ClassPrivateProperty(node) {
|
|
161
|
+
this._visitClassProperty(node);
|
|
162
|
+
}
|
|
163
|
+
AccessorProperty(node) {
|
|
164
|
+
this._visitClassProperty(node);
|
|
165
|
+
}
|
|
166
|
+
ClassAccessorProperty(node) {
|
|
167
|
+
this._visitClassProperty(node);
|
|
168
|
+
}
|
|
169
|
+
PropertyDefinition(node) {
|
|
170
|
+
this._visitClassProperty(node);
|
|
171
|
+
}
|
|
172
|
+
ClassPrivateMethod(node) {
|
|
173
|
+
super.MethodDefinition(node);
|
|
174
|
+
}
|
|
175
|
+
DeclareModule(node) {
|
|
176
|
+
this._visitDeclareX(node);
|
|
177
|
+
}
|
|
178
|
+
DeclareFunction(node) {
|
|
179
|
+
this._visitDeclareX(node);
|
|
180
|
+
}
|
|
181
|
+
DeclareVariable(node) {
|
|
182
|
+
this._visitDeclareX(node);
|
|
183
|
+
}
|
|
184
|
+
DeclareClass(node) {
|
|
185
|
+
this._visitDeclareX(node);
|
|
186
|
+
}
|
|
187
|
+
OptionalMemberExpression(node) {
|
|
188
|
+
super.MemberExpression(node);
|
|
189
|
+
}
|
|
190
|
+
_visitClassProperty(node) {
|
|
191
|
+
const {
|
|
192
|
+
computed,
|
|
193
|
+
key,
|
|
194
|
+
typeAnnotation,
|
|
195
|
+
decorators,
|
|
196
|
+
value
|
|
197
|
+
} = node;
|
|
198
|
+
this._visitArray(decorators);
|
|
199
|
+
if (computed) this.visit(key);
|
|
200
|
+
this._visitTypeAnnotation(typeAnnotation);
|
|
201
|
+
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
|
+
}
|
|
207
|
+
this.visit(value);
|
|
208
|
+
this.close(value);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
_visitDeclareX(node) {
|
|
212
|
+
if (node.id) {
|
|
213
|
+
this._createScopeVariable(node, node.id);
|
|
214
|
+
}
|
|
215
|
+
const typeParamScope = this._nestTypeParamScope(node);
|
|
216
|
+
if (typeParamScope) {
|
|
217
|
+
this.close(node);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
_createScopeVariable(node, name) {
|
|
221
|
+
this.currentScope().variableScope.__define(name, new Definition("Variable", name, node, null, null, null));
|
|
222
|
+
}
|
|
223
|
+
_nestTypeParamScope(node) {
|
|
224
|
+
if (!node.typeParameters) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
const parentScope = this.scopeManager.__currentScope;
|
|
228
|
+
const scope = new Scope(this.scopeManager, "type-parameters", parentScope, node, false);
|
|
229
|
+
this.scopeManager.__nestScope(scope);
|
|
230
|
+
for (let j = 0; j < node.typeParameters.params.length; j++) {
|
|
231
|
+
const name = node.typeParameters.params[j];
|
|
232
|
+
scope.__define(name, new Definition("TypeParameter", name, name));
|
|
233
|
+
if (name.typeAnnotation) {
|
|
234
|
+
this._checkIdentifierOrVisit(name);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
scope.__define = parentScope.__define.bind(parentScope);
|
|
238
|
+
return scope;
|
|
239
|
+
}
|
|
240
|
+
_visitTypeAnnotation(node) {
|
|
241
|
+
if (!node) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (Array.isArray(node)) {
|
|
245
|
+
node.forEach(this._visitTypeAnnotation, this);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const visitorValues = getVisitorValues(node.type, _classPrivateFieldGet(_client, this));
|
|
249
|
+
if (!visitorValues) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
for (let i = 0; i < visitorValues.length; i++) {
|
|
253
|
+
const visitorValue = visitorValues[i];
|
|
254
|
+
const propertyType = propertyTypes[visitorValue];
|
|
255
|
+
const nodeProperty = node[visitorValue];
|
|
256
|
+
if (propertyType == null || nodeProperty == null) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (propertyType.type === "loop") {
|
|
260
|
+
for (let j = 0; j < nodeProperty.length; j++) {
|
|
261
|
+
if (Array.isArray(propertyType.values)) {
|
|
262
|
+
for (let k = 0; k < propertyType.values.length; k++) {
|
|
263
|
+
const loopPropertyNode = nodeProperty[j][propertyType.values[k]];
|
|
264
|
+
if (loopPropertyNode) {
|
|
265
|
+
this._checkIdentifierOrVisit(loopPropertyNode);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
this._checkIdentifierOrVisit(nodeProperty[j]);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
} else if (propertyType.type === "single") {
|
|
273
|
+
this._checkIdentifierOrVisit(nodeProperty);
|
|
274
|
+
} else if (propertyType.type === "typeAnnotation") {
|
|
275
|
+
this._visitTypeAnnotation(node.typeAnnotation);
|
|
276
|
+
} else if (propertyType.type === "typeParameters") {
|
|
277
|
+
for (let l = 0; l < node.typeParameters.params.length; l++) {
|
|
278
|
+
this._checkIdentifierOrVisit(node.typeParameters.params[l]);
|
|
279
|
+
}
|
|
280
|
+
} else if (propertyType.type === "id") {
|
|
281
|
+
if (node.id.type === "Identifier") {
|
|
282
|
+
this._checkIdentifierOrVisit(node.id);
|
|
283
|
+
} else {
|
|
284
|
+
this._visitTypeAnnotation(node.id);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
_checkIdentifierOrVisit(node) {
|
|
290
|
+
if (node != null && node.typeAnnotation) {
|
|
291
|
+
this._visitTypeAnnotation(node.typeAnnotation);
|
|
292
|
+
} else if ((node == null ? void 0 : node.type) === "Identifier") {
|
|
293
|
+
this.visit(node);
|
|
294
|
+
} else {
|
|
295
|
+
this._visitTypeAnnotation(node);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
_visitArray(nodeList) {
|
|
299
|
+
if (nodeList) {
|
|
300
|
+
for (const node of nodeList) {
|
|
301
|
+
this.visit(node);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
module.exports = function analyzeScope(ast, parserOptions, client) {
|
|
307
|
+
var _parserOptions$ecmaFe;
|
|
308
|
+
const options = {
|
|
309
|
+
ignoreEval: true,
|
|
310
|
+
optimistic: false,
|
|
311
|
+
directive: false,
|
|
312
|
+
nodejsScope: ast.sourceType === "script" && ((_parserOptions$ecmaFe = parserOptions.ecmaFeatures) == null ? void 0 : _parserOptions$ecmaFe.globalReturn) === true,
|
|
313
|
+
impliedStrict: false,
|
|
314
|
+
sourceType: ast.sourceType,
|
|
315
|
+
ecmaVersion: parserOptions.ecmaVersion,
|
|
316
|
+
fallback,
|
|
317
|
+
childVisitorKeys: client.getVisitorKeys()
|
|
318
|
+
};
|
|
319
|
+
const scopeManager = new ScopeManager(options);
|
|
320
|
+
const referencer = new Referencer(options, scopeManager, client);
|
|
321
|
+
referencer.visit(ast);
|
|
322
|
+
return scopeManager;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
//# sourceMappingURL=analyze-scope.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,U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K,QAAQ,IAC3B,EAAAL,qBAAA,GAAAD,aAAa,CAACO,YAAY,qBAA1BN,qBAAA,CAA4BO,YAAY,MAAK,IAAI;IACnDC,aAAa,EAAE,KAAK;IACpBH,UAAU,EAAEP,GAAG,CAACO,UAAU;IAC1BI,WAAW,EAAEV,aAAa,CAACU,WAAW;IACtClI,QAAQ;IACRmI,gBAAgB,EAAE/H,MAAM,CAACgI,cAAc,CAAC;EAC1C,CAAC;EAED,MAAMpF,YAAY,GAAG,IAAInD,YAAY,CAACkD,OAAO,CAAC;EAC9C,MAAMsF,UAAU,GAAG,IAAI3I,UAAU,CAACqD,OAAO,EAAEC,YAAY,EAAE5C,MAAM,CAAC;EAEhEiI,UAAU,CAAC3F,KAAK,CAAC6E,GAAG,CAAC;EAErB,OAAOvE,YAAY;AACrB,CAAC","ignoreList":[]}
|
package/lib/client.cjs
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WorkerClient = exports.Client = exports.ACTIONS = void 0;
|
|
7
|
+
var _LocalClient, _handleMessage;
|
|
8
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
9
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
10
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
11
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
12
|
+
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"); }
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const ACTIONS = exports.ACTIONS = {
|
|
15
|
+
GET_VERSION: "GET_VERSION",
|
|
16
|
+
GET_TYPES_INFO: "GET_TYPES_INFO",
|
|
17
|
+
GET_VISITOR_KEYS: "GET_VISITOR_KEYS",
|
|
18
|
+
GET_TOKEN_LABELS: "GET_TOKEN_LABELS",
|
|
19
|
+
MAYBE_PARSE: "MAYBE_PARSE",
|
|
20
|
+
MAYBE_PARSE_SYNC: "MAYBE_PARSE_SYNC"
|
|
21
|
+
};
|
|
22
|
+
var _send = new WeakMap();
|
|
23
|
+
var _vCache = new WeakMap();
|
|
24
|
+
var _tiCache = new WeakMap();
|
|
25
|
+
var _vkCache = new WeakMap();
|
|
26
|
+
var _tlCache = new WeakMap();
|
|
27
|
+
class Client {
|
|
28
|
+
constructor(send) {
|
|
29
|
+
_classPrivateFieldInitSpec(this, _send, void 0);
|
|
30
|
+
_classPrivateFieldInitSpec(this, _vCache, void 0);
|
|
31
|
+
_classPrivateFieldInitSpec(this, _tiCache, void 0);
|
|
32
|
+
_classPrivateFieldInitSpec(this, _vkCache, void 0);
|
|
33
|
+
_classPrivateFieldInitSpec(this, _tlCache, void 0);
|
|
34
|
+
_classPrivateFieldSet(_send, this, send);
|
|
35
|
+
}
|
|
36
|
+
getVersion() {
|
|
37
|
+
var _classPrivateFieldGet2;
|
|
38
|
+
return (_classPrivateFieldGet2 = _classPrivateFieldGet(_vCache, this)) != null ? _classPrivateFieldGet2 : _classPrivateFieldSet(_vCache, this, _classPrivateFieldGet(_send, this).call(this, ACTIONS.GET_VERSION, undefined));
|
|
39
|
+
}
|
|
40
|
+
getTypesInfo() {
|
|
41
|
+
var _classPrivateFieldGet3;
|
|
42
|
+
return (_classPrivateFieldGet3 = _classPrivateFieldGet(_tiCache, this)) != null ? _classPrivateFieldGet3 : _classPrivateFieldSet(_tiCache, this, _classPrivateFieldGet(_send, this).call(this, ACTIONS.GET_TYPES_INFO, undefined));
|
|
43
|
+
}
|
|
44
|
+
getVisitorKeys() {
|
|
45
|
+
var _classPrivateFieldGet4;
|
|
46
|
+
return (_classPrivateFieldGet4 = _classPrivateFieldGet(_vkCache, this)) != null ? _classPrivateFieldGet4 : _classPrivateFieldSet(_vkCache, this, _classPrivateFieldGet(_send, this).call(this, ACTIONS.GET_VISITOR_KEYS, undefined));
|
|
47
|
+
}
|
|
48
|
+
getTokLabels() {
|
|
49
|
+
var _classPrivateFieldGet5;
|
|
50
|
+
return (_classPrivateFieldGet5 = _classPrivateFieldGet(_tlCache, this)) != null ? _classPrivateFieldGet5 : _classPrivateFieldSet(_tlCache, this, _classPrivateFieldGet(_send, this).call(this, ACTIONS.GET_TOKEN_LABELS, undefined));
|
|
51
|
+
}
|
|
52
|
+
maybeParse(code, options) {
|
|
53
|
+
return _classPrivateFieldGet(_send, this).call(this, ACTIONS.MAYBE_PARSE, {
|
|
54
|
+
code,
|
|
55
|
+
options
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.Client = Client;
|
|
60
|
+
var _worker = new WeakMap();
|
|
61
|
+
class WorkerClient extends Client {
|
|
62
|
+
constructor() {
|
|
63
|
+
super((action, payload) => {
|
|
64
|
+
const signal = new Int32Array(new SharedArrayBuffer(8));
|
|
65
|
+
const subChannel = new (_get_worker_threads(WorkerClient).MessageChannel)();
|
|
66
|
+
_classPrivateFieldGet(_worker, this).postMessage({
|
|
67
|
+
signal,
|
|
68
|
+
port: subChannel.port1,
|
|
69
|
+
action,
|
|
70
|
+
payload
|
|
71
|
+
}, [subChannel.port1]);
|
|
72
|
+
Atomics.wait(signal, 0, 0);
|
|
73
|
+
const {
|
|
74
|
+
message
|
|
75
|
+
} = _get_worker_threads(WorkerClient).receiveMessageOnPort(subChannel.port2);
|
|
76
|
+
if (message.error) throw Object.assign(message.error, message.errorData);else return message.result;
|
|
77
|
+
});
|
|
78
|
+
_classPrivateFieldInitSpec(this, _worker, new (_get_worker_threads(WorkerClient).Worker)(path.resolve(__dirname, "../lib/worker/index.cjs"), {
|
|
79
|
+
env: _get_worker_threads(WorkerClient).SHARE_ENV
|
|
80
|
+
}));
|
|
81
|
+
_classPrivateFieldGet(_worker, this).unref();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.WorkerClient = WorkerClient;
|
|
85
|
+
function _get_worker_threads(_this) {
|
|
86
|
+
var _worker_threads_cache2;
|
|
87
|
+
return (_worker_threads_cache2 = _worker_threads_cache._) != null ? _worker_threads_cache2 : _worker_threads_cache._ = require("worker_threads");
|
|
88
|
+
}
|
|
89
|
+
var _worker_threads_cache = {
|
|
90
|
+
_: void 0
|
|
91
|
+
};
|
|
92
|
+
exports.LocalClient = (_LocalClient = class LocalClient extends Client {
|
|
93
|
+
constructor() {
|
|
94
|
+
var _assertClassBrand$_;
|
|
95
|
+
(_assertClassBrand$_ = _assertClassBrand(_LocalClient, LocalClient, _handleMessage)._) != null ? _assertClassBrand$_ : _handleMessage._ = _assertClassBrand(_LocalClient, LocalClient, require("./worker/handle-message.cjs"));
|
|
96
|
+
super((action, payload) => {
|
|
97
|
+
return _assertClassBrand(_LocalClient, LocalClient, _handleMessage)._.call(LocalClient, action === ACTIONS.MAYBE_PARSE ? ACTIONS.MAYBE_PARSE_SYNC : action, payload);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, _handleMessage = {
|
|
101
|
+
_: void 0
|
|
102
|
+
}, _LocalClient);
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=client.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["path","require","ACTIONS","exports","GET_VERSION","GET_TYPES_INFO","GET_VISITOR_KEYS","GET_TOKEN_LABELS","MAYBE_PARSE","MAYBE_PARSE_SYNC","_send","WeakMap","_vCache","_tiCache","_vkCache","_tlCache","Client","constructor","send","_classPrivateFieldInitSpec","_classPrivateFieldSet","getVersion","_classPrivateFieldGet2","_classPrivateFieldGet","call","undefined","getTypesInfo","_classPrivateFieldGet3","getVisitorKeys","_classPrivateFieldGet4","getTokLabels","_classPrivateFieldGet5","maybeParse","code","options","_worker","WorkerClient","action","payload","signal","Int32Array","SharedArrayBuffer","subChannel","_get_worker_threads","MessageChannel","postMessage","port","port1","Atomics","wait","message","receiveMessageOnPort","port2","error","Object","assign","errorData","result","Worker","resolve","__dirname","env","SHARE_ENV","unref","_this","_worker_threads_cache2","_worker_threads_cache","_","LocalClient","_LocalClient","_assertClassBrand$_","_assertClassBrand","_handleMessage"],"sources":["../src/client.cts"],"sourcesContent":["import type { Options } from \"./types.cts\";\n\nimport path = require(\"path\");\n\nexport const enum ACTIONS {\n GET_VERSION = \"GET_VERSION\",\n GET_TYPES_INFO = \"GET_TYPES_INFO\",\n GET_VISITOR_KEYS = \"GET_VISITOR_KEYS\",\n GET_TOKEN_LABELS = \"GET_TOKEN_LABELS\",\n MAYBE_PARSE = \"MAYBE_PARSE\",\n MAYBE_PARSE_SYNC = \"MAYBE_PARSE_SYNC\",\n}\n\nexport class Client {\n #send;\n\n constructor(send: Function) {\n this.#send = send;\n }\n\n #vCache: string;\n getVersion() {\n return (this.#vCache ??= this.#send(ACTIONS.GET_VERSION, undefined));\n }\n\n #tiCache: any;\n getTypesInfo() {\n return (this.#tiCache ??= this.#send(ACTIONS.GET_TYPES_INFO, undefined));\n }\n\n #vkCache: any;\n getVisitorKeys() {\n return (this.#vkCache ??= this.#send(ACTIONS.GET_VISITOR_KEYS, undefined));\n }\n\n #tlCache: any;\n getTokLabels() {\n return (this.#tlCache ??= this.#send(ACTIONS.GET_TOKEN_LABELS, undefined));\n }\n\n maybeParse(code: string, options: Options) {\n return this.#send(ACTIONS.MAYBE_PARSE, { code, options });\n }\n}\n\n// We need to run Babel in a worker for two reasons:\n// 1. ESLint workers must be CJS files, and this is a problem\n// since Babel 8+ uses native ESM\n// 2. ESLint parsers must run synchronously, but many steps\n// of Babel's config loading (which is done for each file)\n// can be asynchronous\n// If ESLint starts supporting async parsers, we can move\n// everything back to the main thread.\nexport class WorkerClient extends Client {\n static #worker_threads_cache: typeof import(\"worker_threads\");\n static get #worker_threads() {\n return (WorkerClient.#worker_threads_cache ??= require(\"node:worker_threads\"));\n }\n\n #worker = new WorkerClient.#worker_threads.Worker(\n path.resolve(__dirname, \"../lib/worker/index.cjs\"),\n { env: WorkerClient.#worker_threads.SHARE_ENV },\n );\n\n constructor() {\n super((action: ACTIONS, payload: any) => {\n // We create a new SharedArrayBuffer every time rather than reusing\n // the same one, otherwise sometimes its contents get corrupted and\n // Atomics.wait wakes up too early.\n // https://github.com/babel/babel/pull/14541\n const signal = new Int32Array(new SharedArrayBuffer(8));\n\n const subChannel = new WorkerClient.#worker_threads.MessageChannel();\n\n this.#worker.postMessage(\n { signal, port: subChannel.port1, action, payload },\n [subChannel.port1],\n );\n\n Atomics.wait(signal, 0, 0);\n const { message } = WorkerClient.#worker_threads.receiveMessageOnPort(\n subChannel.port2,\n );\n\n if (message.error) throw Object.assign(message.error, message.errorData);\n else return message.result;\n });\n\n // The worker will never exit by itself. Prevent it from keeping\n // the main process alive.\n this.#worker.unref();\n }\n}\n\nif (!USE_ESM) {\n exports.LocalClient = class LocalClient extends Client {\n static #handleMessage: Function;\n\n constructor() {\n LocalClient.#handleMessage ??= require(\"./worker/handle-message.cjs\");\n\n super((action: ACTIONS, payload: any) => {\n return LocalClient.#handleMessage(\n action === ACTIONS.MAYBE_PARSE ? ACTIONS.MAYBE_PARSE_SYNC : action,\n payload,\n );\n });\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;MAEOA,IAAI,GAAAC,OAAA,CAAW,MAAM;AAAA,MAEVC,OAAO,GAAAC,OAAA,CAAAD,OAAA;EAAAE,WAAA;EAAAC,cAAA;EAAAC,gBAAA;EAAAC,gBAAA;EAAAC,WAAA;EAAAC,gBAAA;AAAA;AAAA,IAAAC,KAAA,OAAAC,OAAA;AAAA,IAAAC,OAAA,OAAAD,OAAA;AAAA,IAAAE,QAAA,OAAAF,OAAA;AAAA,IAAAG,QAAA,OAAAH,OAAA;AAAA,IAAAI,QAAA,OAAAJ,OAAA;AASlB,MAAMK,MAAM,CAAC;EAGlBC,WAAWA,CAAC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AAO,CAACO,gBAAgB,GAAG4B,MAAM,EAClEC,OAAO;IAEX,CAAC,CAAC;EACJ;AACF,CAAC,EAAAkC,cAAA;EAAAL,CAAA;AAAA,GAAAE,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const _excluded = ["babelOptions", "ecmaVersion", "sourceType", "requireConfigFile"];
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
module.exports = function normalizeESLintConfig(options) {
|
|
6
|
+
const {
|
|
7
|
+
babelOptions = {},
|
|
8
|
+
ecmaVersion = "latest",
|
|
9
|
+
sourceType = "module",
|
|
10
|
+
requireConfigFile = true
|
|
11
|
+
} = options,
|
|
12
|
+
otherOptions = _objectWithoutPropertiesLoose(options, _excluded);
|
|
13
|
+
return Object.assign({
|
|
14
|
+
babelOptions: Object.assign({
|
|
15
|
+
cwd: process.cwd()
|
|
16
|
+
}, babelOptions),
|
|
17
|
+
ecmaVersion: ecmaVersion === "latest" ? 1e8 : ecmaVersion,
|
|
18
|
+
sourceType,
|
|
19
|
+
requireConfigFile
|
|
20
|
+
}, otherOptions);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=configuration.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["normalizeESLintConfig","options","babelOptions","ecmaVersion","sourceType","requireConfigFile","otherOptions","_objectWithoutPropertiesLoose","_excluded","Object","assign","cwd","process"],"sources":["../src/configuration.cts"],"sourcesContent":["import type { Options } from \"./types.cts\";\n\nexport = 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: { cwd: process.cwd(), ...babelOptions },\n ecmaVersion: ecmaVersion === \"latest\" ? 1e8 : ecmaVersion,\n sourceType,\n requireConfigFile,\n ...otherOptions,\n } as Options;\n};\n"],"mappings":";;;;iBAES,SAASA,qBAAqBA,CAACC,OAAY,EAAE;EACpD,MAAM;MACJC,YAAY,GAAG,CAAC,CAAC;MAEjBC,WAAW,GAAG,QAAQ;MACtBC,UAAU,GAAG,QAAQ;MACrBC,iBAAiB,GAAG;IAEtB,CAAC,GAAGJ,OAAO;IADNK,YAAY,GAAAC,6BAAA,CACbN,OAAO,EAAAO,SAAA;EAEX,OAAAC,MAAA,CAAAC,MAAA;IACER,YAAY,EAAAO,MAAA,CAAAC,MAAA;MAAIC,GAAG,EAAEC,OAAO,CAACD,GAAG,CAAC;IAAC,GAAKT,YAAY,CAAE;IACrDC,WAAW,EAAEA,WAAW,KAAK,QAAQ,GAAG,GAAG,GAAGA,WAAW;IACzDC,UAAU;IACVC;EAAiB,GACdC,YAAY;AAEnB,CAAC","ignoreList":[]}
|