@pobammer-ts/eslint-cease-nonsense-rules 1.7.0 → 1.9.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/README.md +227 -0
- package/dist/build-metadata.json +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3197 -505
- package/dist/index.js.map +31 -17
- package/dist/oxfmt-sync.d.ts +2 -1
- package/dist/oxfmt-sync.d.ts.map +1 -1
- package/dist/oxfmt-worker.d.ts +1 -0
- package/dist/oxfmt-worker.d.ts.map +1 -1
- package/dist/oxfmt-worker.js +17 -172730
- package/dist/oxfmt-worker.js.map +4 -21
- package/dist/recognizers/code-recognizer.d.ts +0 -18
- package/dist/recognizers/code-recognizer.d.ts.map +1 -1
- package/dist/resolver.linux-x64-gnu-hcjn12y1.node +0 -0
- package/dist/resolver.linux-x64-musl-gnkc267h.node +0 -0
- package/dist/rules/ban-instances.d.ts.map +1 -1
- package/dist/rules/ban-react-fc.d.ts.map +1 -1
- package/dist/rules/enforce-ianitor-check-type.d.ts.map +1 -1
- package/dist/rules/no-god-components.d.ts.map +1 -1
- package/dist/rules/no-identity-map.d.ts.map +1 -1
- package/dist/rules/prefer-class-properties.d.ts +6 -0
- package/dist/rules/prefer-class-properties.d.ts.map +1 -0
- package/dist/rules/prefer-early-return.d.ts +8 -0
- package/dist/rules/prefer-early-return.d.ts.map +1 -0
- package/dist/rules/prefer-module-scope-constants.d.ts +5 -0
- package/dist/rules/prefer-module-scope-constants.d.ts.map +1 -0
- package/dist/rules/prefer-pascal-case-enums.d.ts +5 -0
- package/dist/rules/prefer-pascal-case-enums.d.ts.map +1 -0
- package/dist/rules/prefer-singular-enums.d.ts +5 -0
- package/dist/rules/prefer-singular-enums.d.ts.map +1 -0
- package/dist/rules/prefer-udim2-shorthand.d.ts.map +1 -1
- package/dist/rules/react-hooks-strict-return.d.ts +5 -0
- package/dist/rules/react-hooks-strict-return.d.ts.map +1 -0
- package/dist/rules/require-paired-calls.d.ts +0 -1
- package/dist/rules/require-paired-calls.d.ts.map +1 -1
- package/dist/rules/strict-component-boundaries.d.ts +9 -0
- package/dist/rules/strict-component-boundaries.d.ts.map +1 -0
- package/dist/rules/use-exhaustive-dependencies.d.ts +1 -42
- package/dist/rules/use-exhaustive-dependencies.d.ts.map +1 -1
- package/dist/rules/use-hook-at-top-level.d.ts.map +1 -1
- package/dist/utilities/casing-utilities.d.ts +2 -0
- package/dist/utilities/casing-utilities.d.ts.map +1 -0
- package/dist/utilities/format-utilities.d.ts +2 -3
- package/dist/utilities/format-utilities.d.ts.map +1 -1
- package/dist/utilities/resolve-import.d.ts +16 -0
- package/dist/utilities/resolve-import.d.ts.map +1 -0
- package/package.json +15 -2
- package/dist/types/oxfmt.d.ts +0 -88
- package/dist/types/oxfmt.d.ts.map +0 -1
- package/dist/utilities/error-utilities.d.ts +0 -25
- package/dist/utilities/error-utilities.d.ts.map +0 -1
- package/dist/utilities/typebox-utilities.d.ts +0 -4
- package/dist/utilities/typebox-utilities.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -28,6 +28,730 @@ var __export = (target, all) => {
|
|
|
28
28
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
30
|
|
|
31
|
+
// node_modules/fast-diff/diff.js
|
|
32
|
+
var require_diff = __commonJS((exports, module3) => {
|
|
33
|
+
var DIFF_DELETE = -1;
|
|
34
|
+
var DIFF_INSERT = 1;
|
|
35
|
+
var DIFF_EQUAL = 0;
|
|
36
|
+
function diff_main(text1, text2, cursor_pos, cleanup, _fix_unicode) {
|
|
37
|
+
if (text1 === text2) {
|
|
38
|
+
if (text1) {
|
|
39
|
+
return [[DIFF_EQUAL, text1]];
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
if (cursor_pos != null) {
|
|
44
|
+
var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
|
|
45
|
+
if (editdiff) {
|
|
46
|
+
return editdiff;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var commonlength = diff_commonPrefix(text1, text2);
|
|
50
|
+
var commonprefix = text1.substring(0, commonlength);
|
|
51
|
+
text1 = text1.substring(commonlength);
|
|
52
|
+
text2 = text2.substring(commonlength);
|
|
53
|
+
commonlength = diff_commonSuffix(text1, text2);
|
|
54
|
+
var commonsuffix = text1.substring(text1.length - commonlength);
|
|
55
|
+
text1 = text1.substring(0, text1.length - commonlength);
|
|
56
|
+
text2 = text2.substring(0, text2.length - commonlength);
|
|
57
|
+
var diffs = diff_compute_(text1, text2);
|
|
58
|
+
if (commonprefix) {
|
|
59
|
+
diffs.unshift([DIFF_EQUAL, commonprefix]);
|
|
60
|
+
}
|
|
61
|
+
if (commonsuffix) {
|
|
62
|
+
diffs.push([DIFF_EQUAL, commonsuffix]);
|
|
63
|
+
}
|
|
64
|
+
diff_cleanupMerge(diffs, _fix_unicode);
|
|
65
|
+
if (cleanup) {
|
|
66
|
+
diff_cleanupSemantic(diffs);
|
|
67
|
+
}
|
|
68
|
+
return diffs;
|
|
69
|
+
}
|
|
70
|
+
function diff_compute_(text1, text2) {
|
|
71
|
+
var diffs;
|
|
72
|
+
if (!text1) {
|
|
73
|
+
return [[DIFF_INSERT, text2]];
|
|
74
|
+
}
|
|
75
|
+
if (!text2) {
|
|
76
|
+
return [[DIFF_DELETE, text1]];
|
|
77
|
+
}
|
|
78
|
+
var longtext = text1.length > text2.length ? text1 : text2;
|
|
79
|
+
var shorttext = text1.length > text2.length ? text2 : text1;
|
|
80
|
+
var i = longtext.indexOf(shorttext);
|
|
81
|
+
if (i !== -1) {
|
|
82
|
+
diffs = [
|
|
83
|
+
[DIFF_INSERT, longtext.substring(0, i)],
|
|
84
|
+
[DIFF_EQUAL, shorttext],
|
|
85
|
+
[DIFF_INSERT, longtext.substring(i + shorttext.length)]
|
|
86
|
+
];
|
|
87
|
+
if (text1.length > text2.length) {
|
|
88
|
+
diffs[0][0] = diffs[2][0] = DIFF_DELETE;
|
|
89
|
+
}
|
|
90
|
+
return diffs;
|
|
91
|
+
}
|
|
92
|
+
if (shorttext.length === 1) {
|
|
93
|
+
return [
|
|
94
|
+
[DIFF_DELETE, text1],
|
|
95
|
+
[DIFF_INSERT, text2]
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
var hm = diff_halfMatch_(text1, text2);
|
|
99
|
+
if (hm) {
|
|
100
|
+
var text1_a = hm[0];
|
|
101
|
+
var text1_b = hm[1];
|
|
102
|
+
var text2_a = hm[2];
|
|
103
|
+
var text2_b = hm[3];
|
|
104
|
+
var mid_common = hm[4];
|
|
105
|
+
var diffs_a = diff_main(text1_a, text2_a);
|
|
106
|
+
var diffs_b = diff_main(text1_b, text2_b);
|
|
107
|
+
return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
|
|
108
|
+
}
|
|
109
|
+
return diff_bisect_(text1, text2);
|
|
110
|
+
}
|
|
111
|
+
function diff_bisect_(text1, text2) {
|
|
112
|
+
var text1_length = text1.length;
|
|
113
|
+
var text2_length = text2.length;
|
|
114
|
+
var max_d = Math.ceil((text1_length + text2_length) / 2);
|
|
115
|
+
var v_offset = max_d;
|
|
116
|
+
var v_length = 2 * max_d;
|
|
117
|
+
var v1 = new Array(v_length);
|
|
118
|
+
var v2 = new Array(v_length);
|
|
119
|
+
for (var x3 = 0;x3 < v_length; x3++) {
|
|
120
|
+
v1[x3] = -1;
|
|
121
|
+
v2[x3] = -1;
|
|
122
|
+
}
|
|
123
|
+
v1[v_offset + 1] = 0;
|
|
124
|
+
v2[v_offset + 1] = 0;
|
|
125
|
+
var delta2 = text1_length - text2_length;
|
|
126
|
+
var front = delta2 % 2 !== 0;
|
|
127
|
+
var k1start = 0;
|
|
128
|
+
var k1end = 0;
|
|
129
|
+
var k2start = 0;
|
|
130
|
+
var k2end = 0;
|
|
131
|
+
for (var d2 = 0;d2 < max_d; d2++) {
|
|
132
|
+
for (var k1 = -d2 + k1start;k1 <= d2 - k1end; k1 += 2) {
|
|
133
|
+
var k1_offset = v_offset + k1;
|
|
134
|
+
var x1;
|
|
135
|
+
if (k1 === -d2 || k1 !== d2 && v1[k1_offset - 1] < v1[k1_offset + 1]) {
|
|
136
|
+
x1 = v1[k1_offset + 1];
|
|
137
|
+
} else {
|
|
138
|
+
x1 = v1[k1_offset - 1] + 1;
|
|
139
|
+
}
|
|
140
|
+
var y1 = x1 - k1;
|
|
141
|
+
while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
|
|
142
|
+
x1++;
|
|
143
|
+
y1++;
|
|
144
|
+
}
|
|
145
|
+
v1[k1_offset] = x1;
|
|
146
|
+
if (x1 > text1_length) {
|
|
147
|
+
k1end += 2;
|
|
148
|
+
} else if (y1 > text2_length) {
|
|
149
|
+
k1start += 2;
|
|
150
|
+
} else if (front) {
|
|
151
|
+
var k2_offset = v_offset + delta2 - k1;
|
|
152
|
+
if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
|
|
153
|
+
var x22 = text1_length - v2[k2_offset];
|
|
154
|
+
if (x1 >= x22) {
|
|
155
|
+
return diff_bisectSplit_(text1, text2, x1, y1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
for (var k2 = -d2 + k2start;k2 <= d2 - k2end; k2 += 2) {
|
|
161
|
+
var k2_offset = v_offset + k2;
|
|
162
|
+
var x22;
|
|
163
|
+
if (k2 === -d2 || k2 !== d2 && v2[k2_offset - 1] < v2[k2_offset + 1]) {
|
|
164
|
+
x22 = v2[k2_offset + 1];
|
|
165
|
+
} else {
|
|
166
|
+
x22 = v2[k2_offset - 1] + 1;
|
|
167
|
+
}
|
|
168
|
+
var y2 = x22 - k2;
|
|
169
|
+
while (x22 < text1_length && y2 < text2_length && text1.charAt(text1_length - x22 - 1) === text2.charAt(text2_length - y2 - 1)) {
|
|
170
|
+
x22++;
|
|
171
|
+
y2++;
|
|
172
|
+
}
|
|
173
|
+
v2[k2_offset] = x22;
|
|
174
|
+
if (x22 > text1_length) {
|
|
175
|
+
k2end += 2;
|
|
176
|
+
} else if (y2 > text2_length) {
|
|
177
|
+
k2start += 2;
|
|
178
|
+
} else if (!front) {
|
|
179
|
+
var k1_offset = v_offset + delta2 - k2;
|
|
180
|
+
if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {
|
|
181
|
+
var x1 = v1[k1_offset];
|
|
182
|
+
var y1 = v_offset + x1 - k1_offset;
|
|
183
|
+
x22 = text1_length - x22;
|
|
184
|
+
if (x1 >= x22) {
|
|
185
|
+
return diff_bisectSplit_(text1, text2, x1, y1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return [
|
|
192
|
+
[DIFF_DELETE, text1],
|
|
193
|
+
[DIFF_INSERT, text2]
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
function diff_bisectSplit_(text1, text2, x3, y) {
|
|
197
|
+
var text1a = text1.substring(0, x3);
|
|
198
|
+
var text2a = text2.substring(0, y);
|
|
199
|
+
var text1b = text1.substring(x3);
|
|
200
|
+
var text2b = text2.substring(y);
|
|
201
|
+
var diffs = diff_main(text1a, text2a);
|
|
202
|
+
var diffsb = diff_main(text1b, text2b);
|
|
203
|
+
return diffs.concat(diffsb);
|
|
204
|
+
}
|
|
205
|
+
function diff_commonPrefix(text1, text2) {
|
|
206
|
+
if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
var pointermin = 0;
|
|
210
|
+
var pointermax = Math.min(text1.length, text2.length);
|
|
211
|
+
var pointermid = pointermax;
|
|
212
|
+
var pointerstart = 0;
|
|
213
|
+
while (pointermin < pointermid) {
|
|
214
|
+
if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
|
|
215
|
+
pointermin = pointermid;
|
|
216
|
+
pointerstart = pointermin;
|
|
217
|
+
} else {
|
|
218
|
+
pointermax = pointermid;
|
|
219
|
+
}
|
|
220
|
+
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
|
|
221
|
+
}
|
|
222
|
+
if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
|
|
223
|
+
pointermid--;
|
|
224
|
+
}
|
|
225
|
+
return pointermid;
|
|
226
|
+
}
|
|
227
|
+
function diff_commonOverlap_(text1, text2) {
|
|
228
|
+
var text1_length = text1.length;
|
|
229
|
+
var text2_length = text2.length;
|
|
230
|
+
if (text1_length == 0 || text2_length == 0) {
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
if (text1_length > text2_length) {
|
|
234
|
+
text1 = text1.substring(text1_length - text2_length);
|
|
235
|
+
} else if (text1_length < text2_length) {
|
|
236
|
+
text2 = text2.substring(0, text1_length);
|
|
237
|
+
}
|
|
238
|
+
var text_length = Math.min(text1_length, text2_length);
|
|
239
|
+
if (text1 == text2) {
|
|
240
|
+
return text_length;
|
|
241
|
+
}
|
|
242
|
+
var best = 0;
|
|
243
|
+
var length = 1;
|
|
244
|
+
while (true) {
|
|
245
|
+
var pattern4 = text1.substring(text_length - length);
|
|
246
|
+
var found = text2.indexOf(pattern4);
|
|
247
|
+
if (found == -1) {
|
|
248
|
+
return best;
|
|
249
|
+
}
|
|
250
|
+
length += found;
|
|
251
|
+
if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) {
|
|
252
|
+
best = length;
|
|
253
|
+
length++;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function diff_commonSuffix(text1, text2) {
|
|
258
|
+
if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
|
|
259
|
+
return 0;
|
|
260
|
+
}
|
|
261
|
+
var pointermin = 0;
|
|
262
|
+
var pointermax = Math.min(text1.length, text2.length);
|
|
263
|
+
var pointermid = pointermax;
|
|
264
|
+
var pointerend = 0;
|
|
265
|
+
while (pointermin < pointermid) {
|
|
266
|
+
if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
|
|
267
|
+
pointermin = pointermid;
|
|
268
|
+
pointerend = pointermin;
|
|
269
|
+
} else {
|
|
270
|
+
pointermax = pointermid;
|
|
271
|
+
}
|
|
272
|
+
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
|
|
273
|
+
}
|
|
274
|
+
if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
|
|
275
|
+
pointermid--;
|
|
276
|
+
}
|
|
277
|
+
return pointermid;
|
|
278
|
+
}
|
|
279
|
+
function diff_halfMatch_(text1, text2) {
|
|
280
|
+
var longtext = text1.length > text2.length ? text1 : text2;
|
|
281
|
+
var shorttext = text1.length > text2.length ? text2 : text1;
|
|
282
|
+
if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
function diff_halfMatchI_(longtext2, shorttext2, i) {
|
|
286
|
+
var seed = longtext2.substring(i, i + Math.floor(longtext2.length / 4));
|
|
287
|
+
var j = -1;
|
|
288
|
+
var best_common = "";
|
|
289
|
+
var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
|
|
290
|
+
while ((j = shorttext2.indexOf(seed, j + 1)) !== -1) {
|
|
291
|
+
var prefixLength = diff_commonPrefix(longtext2.substring(i), shorttext2.substring(j));
|
|
292
|
+
var suffixLength = diff_commonSuffix(longtext2.substring(0, i), shorttext2.substring(0, j));
|
|
293
|
+
if (best_common.length < suffixLength + prefixLength) {
|
|
294
|
+
best_common = shorttext2.substring(j - suffixLength, j) + shorttext2.substring(j, j + prefixLength);
|
|
295
|
+
best_longtext_a = longtext2.substring(0, i - suffixLength);
|
|
296
|
+
best_longtext_b = longtext2.substring(i + prefixLength);
|
|
297
|
+
best_shorttext_a = shorttext2.substring(0, j - suffixLength);
|
|
298
|
+
best_shorttext_b = shorttext2.substring(j + prefixLength);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (best_common.length * 2 >= longtext2.length) {
|
|
302
|
+
return [
|
|
303
|
+
best_longtext_a,
|
|
304
|
+
best_longtext_b,
|
|
305
|
+
best_shorttext_a,
|
|
306
|
+
best_shorttext_b,
|
|
307
|
+
best_common
|
|
308
|
+
];
|
|
309
|
+
} else {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));
|
|
314
|
+
var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));
|
|
315
|
+
var hm;
|
|
316
|
+
if (!hm1 && !hm2) {
|
|
317
|
+
return null;
|
|
318
|
+
} else if (!hm2) {
|
|
319
|
+
hm = hm1;
|
|
320
|
+
} else if (!hm1) {
|
|
321
|
+
hm = hm2;
|
|
322
|
+
} else {
|
|
323
|
+
hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
|
|
324
|
+
}
|
|
325
|
+
var text1_a, text1_b, text2_a, text2_b;
|
|
326
|
+
if (text1.length > text2.length) {
|
|
327
|
+
text1_a = hm[0];
|
|
328
|
+
text1_b = hm[1];
|
|
329
|
+
text2_a = hm[2];
|
|
330
|
+
text2_b = hm[3];
|
|
331
|
+
} else {
|
|
332
|
+
text2_a = hm[0];
|
|
333
|
+
text2_b = hm[1];
|
|
334
|
+
text1_a = hm[2];
|
|
335
|
+
text1_b = hm[3];
|
|
336
|
+
}
|
|
337
|
+
var mid_common = hm[4];
|
|
338
|
+
return [text1_a, text1_b, text2_a, text2_b, mid_common];
|
|
339
|
+
}
|
|
340
|
+
function diff_cleanupSemantic(diffs) {
|
|
341
|
+
var changes = false;
|
|
342
|
+
var equalities = [];
|
|
343
|
+
var equalitiesLength = 0;
|
|
344
|
+
var lastequality = null;
|
|
345
|
+
var pointer4 = 0;
|
|
346
|
+
var length_insertions1 = 0;
|
|
347
|
+
var length_deletions1 = 0;
|
|
348
|
+
var length_insertions2 = 0;
|
|
349
|
+
var length_deletions2 = 0;
|
|
350
|
+
while (pointer4 < diffs.length) {
|
|
351
|
+
if (diffs[pointer4][0] == DIFF_EQUAL) {
|
|
352
|
+
equalities[equalitiesLength++] = pointer4;
|
|
353
|
+
length_insertions1 = length_insertions2;
|
|
354
|
+
length_deletions1 = length_deletions2;
|
|
355
|
+
length_insertions2 = 0;
|
|
356
|
+
length_deletions2 = 0;
|
|
357
|
+
lastequality = diffs[pointer4][1];
|
|
358
|
+
} else {
|
|
359
|
+
if (diffs[pointer4][0] == DIFF_INSERT) {
|
|
360
|
+
length_insertions2 += diffs[pointer4][1].length;
|
|
361
|
+
} else {
|
|
362
|
+
length_deletions2 += diffs[pointer4][1].length;
|
|
363
|
+
}
|
|
364
|
+
if (lastequality && lastequality.length <= Math.max(length_insertions1, length_deletions1) && lastequality.length <= Math.max(length_insertions2, length_deletions2)) {
|
|
365
|
+
diffs.splice(equalities[equalitiesLength - 1], 0, [
|
|
366
|
+
DIFF_DELETE,
|
|
367
|
+
lastequality
|
|
368
|
+
]);
|
|
369
|
+
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
|
|
370
|
+
equalitiesLength--;
|
|
371
|
+
equalitiesLength--;
|
|
372
|
+
pointer4 = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
|
|
373
|
+
length_insertions1 = 0;
|
|
374
|
+
length_deletions1 = 0;
|
|
375
|
+
length_insertions2 = 0;
|
|
376
|
+
length_deletions2 = 0;
|
|
377
|
+
lastequality = null;
|
|
378
|
+
changes = true;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
pointer4++;
|
|
382
|
+
}
|
|
383
|
+
if (changes) {
|
|
384
|
+
diff_cleanupMerge(diffs);
|
|
385
|
+
}
|
|
386
|
+
diff_cleanupSemanticLossless(diffs);
|
|
387
|
+
pointer4 = 1;
|
|
388
|
+
while (pointer4 < diffs.length) {
|
|
389
|
+
if (diffs[pointer4 - 1][0] == DIFF_DELETE && diffs[pointer4][0] == DIFF_INSERT) {
|
|
390
|
+
var deletion = diffs[pointer4 - 1][1];
|
|
391
|
+
var insertion = diffs[pointer4][1];
|
|
392
|
+
var overlap_length1 = diff_commonOverlap_(deletion, insertion);
|
|
393
|
+
var overlap_length2 = diff_commonOverlap_(insertion, deletion);
|
|
394
|
+
if (overlap_length1 >= overlap_length2) {
|
|
395
|
+
if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
|
|
396
|
+
diffs.splice(pointer4, 0, [
|
|
397
|
+
DIFF_EQUAL,
|
|
398
|
+
insertion.substring(0, overlap_length1)
|
|
399
|
+
]);
|
|
400
|
+
diffs[pointer4 - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
|
|
401
|
+
diffs[pointer4 + 1][1] = insertion.substring(overlap_length1);
|
|
402
|
+
pointer4++;
|
|
403
|
+
}
|
|
404
|
+
} else {
|
|
405
|
+
if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
|
|
406
|
+
diffs.splice(pointer4, 0, [
|
|
407
|
+
DIFF_EQUAL,
|
|
408
|
+
deletion.substring(0, overlap_length2)
|
|
409
|
+
]);
|
|
410
|
+
diffs[pointer4 - 1][0] = DIFF_INSERT;
|
|
411
|
+
diffs[pointer4 - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
|
|
412
|
+
diffs[pointer4 + 1][0] = DIFF_DELETE;
|
|
413
|
+
diffs[pointer4 + 1][1] = deletion.substring(overlap_length2);
|
|
414
|
+
pointer4++;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
pointer4++;
|
|
418
|
+
}
|
|
419
|
+
pointer4++;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
|
|
423
|
+
var whitespaceRegex_ = /\s/;
|
|
424
|
+
var linebreakRegex_ = /[\r\n]/;
|
|
425
|
+
var blanklineEndRegex_ = /\n\r?\n$/;
|
|
426
|
+
var blanklineStartRegex_ = /^\r?\n\r?\n/;
|
|
427
|
+
function diff_cleanupSemanticLossless(diffs) {
|
|
428
|
+
function diff_cleanupSemanticScore_(one, two) {
|
|
429
|
+
if (!one || !two) {
|
|
430
|
+
return 6;
|
|
431
|
+
}
|
|
432
|
+
var char1 = one.charAt(one.length - 1);
|
|
433
|
+
var char2 = two.charAt(0);
|
|
434
|
+
var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
|
|
435
|
+
var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
|
|
436
|
+
var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
|
|
437
|
+
var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
|
|
438
|
+
var lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
|
|
439
|
+
var lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
|
|
440
|
+
var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
|
|
441
|
+
var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
|
|
442
|
+
if (blankLine1 || blankLine2) {
|
|
443
|
+
return 5;
|
|
444
|
+
} else if (lineBreak1 || lineBreak2) {
|
|
445
|
+
return 4;
|
|
446
|
+
} else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
|
|
447
|
+
return 3;
|
|
448
|
+
} else if (whitespace1 || whitespace2) {
|
|
449
|
+
return 2;
|
|
450
|
+
} else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
|
|
451
|
+
return 1;
|
|
452
|
+
}
|
|
453
|
+
return 0;
|
|
454
|
+
}
|
|
455
|
+
var pointer4 = 1;
|
|
456
|
+
while (pointer4 < diffs.length - 1) {
|
|
457
|
+
if (diffs[pointer4 - 1][0] == DIFF_EQUAL && diffs[pointer4 + 1][0] == DIFF_EQUAL) {
|
|
458
|
+
var equality1 = diffs[pointer4 - 1][1];
|
|
459
|
+
var edit2 = diffs[pointer4][1];
|
|
460
|
+
var equality2 = diffs[pointer4 + 1][1];
|
|
461
|
+
var commonOffset = diff_commonSuffix(equality1, edit2);
|
|
462
|
+
if (commonOffset) {
|
|
463
|
+
var commonString = edit2.substring(edit2.length - commonOffset);
|
|
464
|
+
equality1 = equality1.substring(0, equality1.length - commonOffset);
|
|
465
|
+
edit2 = commonString + edit2.substring(0, edit2.length - commonOffset);
|
|
466
|
+
equality2 = commonString + equality2;
|
|
467
|
+
}
|
|
468
|
+
var bestEquality1 = equality1;
|
|
469
|
+
var bestEdit = edit2;
|
|
470
|
+
var bestEquality2 = equality2;
|
|
471
|
+
var bestScore = diff_cleanupSemanticScore_(equality1, edit2) + diff_cleanupSemanticScore_(edit2, equality2);
|
|
472
|
+
while (edit2.charAt(0) === equality2.charAt(0)) {
|
|
473
|
+
equality1 += edit2.charAt(0);
|
|
474
|
+
edit2 = edit2.substring(1) + equality2.charAt(0);
|
|
475
|
+
equality2 = equality2.substring(1);
|
|
476
|
+
var score = diff_cleanupSemanticScore_(equality1, edit2) + diff_cleanupSemanticScore_(edit2, equality2);
|
|
477
|
+
if (score >= bestScore) {
|
|
478
|
+
bestScore = score;
|
|
479
|
+
bestEquality1 = equality1;
|
|
480
|
+
bestEdit = edit2;
|
|
481
|
+
bestEquality2 = equality2;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (diffs[pointer4 - 1][1] != bestEquality1) {
|
|
485
|
+
if (bestEquality1) {
|
|
486
|
+
diffs[pointer4 - 1][1] = bestEquality1;
|
|
487
|
+
} else {
|
|
488
|
+
diffs.splice(pointer4 - 1, 1);
|
|
489
|
+
pointer4--;
|
|
490
|
+
}
|
|
491
|
+
diffs[pointer4][1] = bestEdit;
|
|
492
|
+
if (bestEquality2) {
|
|
493
|
+
diffs[pointer4 + 1][1] = bestEquality2;
|
|
494
|
+
} else {
|
|
495
|
+
diffs.splice(pointer4 + 1, 1);
|
|
496
|
+
pointer4--;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
pointer4++;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function diff_cleanupMerge(diffs, fix_unicode) {
|
|
504
|
+
diffs.push([DIFF_EQUAL, ""]);
|
|
505
|
+
var pointer4 = 0;
|
|
506
|
+
var count_delete = 0;
|
|
507
|
+
var count_insert = 0;
|
|
508
|
+
var text_delete = "";
|
|
509
|
+
var text_insert = "";
|
|
510
|
+
var commonlength;
|
|
511
|
+
while (pointer4 < diffs.length) {
|
|
512
|
+
if (pointer4 < diffs.length - 1 && !diffs[pointer4][1]) {
|
|
513
|
+
diffs.splice(pointer4, 1);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
switch (diffs[pointer4][0]) {
|
|
517
|
+
case DIFF_INSERT:
|
|
518
|
+
count_insert++;
|
|
519
|
+
text_insert += diffs[pointer4][1];
|
|
520
|
+
pointer4++;
|
|
521
|
+
break;
|
|
522
|
+
case DIFF_DELETE:
|
|
523
|
+
count_delete++;
|
|
524
|
+
text_delete += diffs[pointer4][1];
|
|
525
|
+
pointer4++;
|
|
526
|
+
break;
|
|
527
|
+
case DIFF_EQUAL:
|
|
528
|
+
var previous_equality = pointer4 - count_insert - count_delete - 1;
|
|
529
|
+
if (fix_unicode) {
|
|
530
|
+
if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
|
|
531
|
+
var stray = diffs[previous_equality][1].slice(-1);
|
|
532
|
+
diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);
|
|
533
|
+
text_delete = stray + text_delete;
|
|
534
|
+
text_insert = stray + text_insert;
|
|
535
|
+
if (!diffs[previous_equality][1]) {
|
|
536
|
+
diffs.splice(previous_equality, 1);
|
|
537
|
+
pointer4--;
|
|
538
|
+
var k2 = previous_equality - 1;
|
|
539
|
+
if (diffs[k2] && diffs[k2][0] === DIFF_INSERT) {
|
|
540
|
+
count_insert++;
|
|
541
|
+
text_insert = diffs[k2][1] + text_insert;
|
|
542
|
+
k2--;
|
|
543
|
+
}
|
|
544
|
+
if (diffs[k2] && diffs[k2][0] === DIFF_DELETE) {
|
|
545
|
+
count_delete++;
|
|
546
|
+
text_delete = diffs[k2][1] + text_delete;
|
|
547
|
+
k2--;
|
|
548
|
+
}
|
|
549
|
+
previous_equality = k2;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (starts_with_pair_end(diffs[pointer4][1])) {
|
|
553
|
+
var stray = diffs[pointer4][1].charAt(0);
|
|
554
|
+
diffs[pointer4][1] = diffs[pointer4][1].slice(1);
|
|
555
|
+
text_delete += stray;
|
|
556
|
+
text_insert += stray;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (pointer4 < diffs.length - 1 && !diffs[pointer4][1]) {
|
|
560
|
+
diffs.splice(pointer4, 1);
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
if (text_delete.length > 0 || text_insert.length > 0) {
|
|
564
|
+
if (text_delete.length > 0 && text_insert.length > 0) {
|
|
565
|
+
commonlength = diff_commonPrefix(text_insert, text_delete);
|
|
566
|
+
if (commonlength !== 0) {
|
|
567
|
+
if (previous_equality >= 0) {
|
|
568
|
+
diffs[previous_equality][1] += text_insert.substring(0, commonlength);
|
|
569
|
+
} else {
|
|
570
|
+
diffs.splice(0, 0, [
|
|
571
|
+
DIFF_EQUAL,
|
|
572
|
+
text_insert.substring(0, commonlength)
|
|
573
|
+
]);
|
|
574
|
+
pointer4++;
|
|
575
|
+
}
|
|
576
|
+
text_insert = text_insert.substring(commonlength);
|
|
577
|
+
text_delete = text_delete.substring(commonlength);
|
|
578
|
+
}
|
|
579
|
+
commonlength = diff_commonSuffix(text_insert, text_delete);
|
|
580
|
+
if (commonlength !== 0) {
|
|
581
|
+
diffs[pointer4][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer4][1];
|
|
582
|
+
text_insert = text_insert.substring(0, text_insert.length - commonlength);
|
|
583
|
+
text_delete = text_delete.substring(0, text_delete.length - commonlength);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
var n = count_insert + count_delete;
|
|
587
|
+
if (text_delete.length === 0 && text_insert.length === 0) {
|
|
588
|
+
diffs.splice(pointer4 - n, n);
|
|
589
|
+
pointer4 = pointer4 - n;
|
|
590
|
+
} else if (text_delete.length === 0) {
|
|
591
|
+
diffs.splice(pointer4 - n, n, [DIFF_INSERT, text_insert]);
|
|
592
|
+
pointer4 = pointer4 - n + 1;
|
|
593
|
+
} else if (text_insert.length === 0) {
|
|
594
|
+
diffs.splice(pointer4 - n, n, [DIFF_DELETE, text_delete]);
|
|
595
|
+
pointer4 = pointer4 - n + 1;
|
|
596
|
+
} else {
|
|
597
|
+
diffs.splice(pointer4 - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);
|
|
598
|
+
pointer4 = pointer4 - n + 2;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (pointer4 !== 0 && diffs[pointer4 - 1][0] === DIFF_EQUAL) {
|
|
602
|
+
diffs[pointer4 - 1][1] += diffs[pointer4][1];
|
|
603
|
+
diffs.splice(pointer4, 1);
|
|
604
|
+
} else {
|
|
605
|
+
pointer4++;
|
|
606
|
+
}
|
|
607
|
+
count_insert = 0;
|
|
608
|
+
count_delete = 0;
|
|
609
|
+
text_delete = "";
|
|
610
|
+
text_insert = "";
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (diffs[diffs.length - 1][1] === "") {
|
|
615
|
+
diffs.pop();
|
|
616
|
+
}
|
|
617
|
+
var changes = false;
|
|
618
|
+
pointer4 = 1;
|
|
619
|
+
while (pointer4 < diffs.length - 1) {
|
|
620
|
+
if (diffs[pointer4 - 1][0] === DIFF_EQUAL && diffs[pointer4 + 1][0] === DIFF_EQUAL) {
|
|
621
|
+
if (diffs[pointer4][1].substring(diffs[pointer4][1].length - diffs[pointer4 - 1][1].length) === diffs[pointer4 - 1][1]) {
|
|
622
|
+
diffs[pointer4][1] = diffs[pointer4 - 1][1] + diffs[pointer4][1].substring(0, diffs[pointer4][1].length - diffs[pointer4 - 1][1].length);
|
|
623
|
+
diffs[pointer4 + 1][1] = diffs[pointer4 - 1][1] + diffs[pointer4 + 1][1];
|
|
624
|
+
diffs.splice(pointer4 - 1, 1);
|
|
625
|
+
changes = true;
|
|
626
|
+
} else if (diffs[pointer4][1].substring(0, diffs[pointer4 + 1][1].length) == diffs[pointer4 + 1][1]) {
|
|
627
|
+
diffs[pointer4 - 1][1] += diffs[pointer4 + 1][1];
|
|
628
|
+
diffs[pointer4][1] = diffs[pointer4][1].substring(diffs[pointer4 + 1][1].length) + diffs[pointer4 + 1][1];
|
|
629
|
+
diffs.splice(pointer4 + 1, 1);
|
|
630
|
+
changes = true;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
pointer4++;
|
|
634
|
+
}
|
|
635
|
+
if (changes) {
|
|
636
|
+
diff_cleanupMerge(diffs, fix_unicode);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function is_surrogate_pair_start(charCode) {
|
|
640
|
+
return charCode >= 55296 && charCode <= 56319;
|
|
641
|
+
}
|
|
642
|
+
function is_surrogate_pair_end(charCode) {
|
|
643
|
+
return charCode >= 56320 && charCode <= 57343;
|
|
644
|
+
}
|
|
645
|
+
function starts_with_pair_end(str) {
|
|
646
|
+
return is_surrogate_pair_end(str.charCodeAt(0));
|
|
647
|
+
}
|
|
648
|
+
function ends_with_pair_start(str) {
|
|
649
|
+
return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
|
|
650
|
+
}
|
|
651
|
+
function remove_empty_tuples(tuples) {
|
|
652
|
+
var ret = [];
|
|
653
|
+
for (var i = 0;i < tuples.length; i++) {
|
|
654
|
+
if (tuples[i][1].length > 0) {
|
|
655
|
+
ret.push(tuples[i]);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return ret;
|
|
659
|
+
}
|
|
660
|
+
function make_edit_splice(before, oldMiddle, newMiddle, after) {
|
|
661
|
+
if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
return remove_empty_tuples([
|
|
665
|
+
[DIFF_EQUAL, before],
|
|
666
|
+
[DIFF_DELETE, oldMiddle],
|
|
667
|
+
[DIFF_INSERT, newMiddle],
|
|
668
|
+
[DIFF_EQUAL, after]
|
|
669
|
+
]);
|
|
670
|
+
}
|
|
671
|
+
function find_cursor_edit_diff(oldText, newText, cursor_pos) {
|
|
672
|
+
var oldRange = typeof cursor_pos === "number" ? { index: cursor_pos, length: 0 } : cursor_pos.oldRange;
|
|
673
|
+
var newRange = typeof cursor_pos === "number" ? null : cursor_pos.newRange;
|
|
674
|
+
var oldLength = oldText.length;
|
|
675
|
+
var newLength = newText.length;
|
|
676
|
+
if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
|
|
677
|
+
var oldCursor = oldRange.index;
|
|
678
|
+
var oldBefore = oldText.slice(0, oldCursor);
|
|
679
|
+
var oldAfter = oldText.slice(oldCursor);
|
|
680
|
+
var maybeNewCursor = newRange ? newRange.index : null;
|
|
681
|
+
editBefore: {
|
|
682
|
+
var newCursor = oldCursor + newLength - oldLength;
|
|
683
|
+
if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
|
|
684
|
+
break editBefore;
|
|
685
|
+
}
|
|
686
|
+
if (newCursor < 0 || newCursor > newLength) {
|
|
687
|
+
break editBefore;
|
|
688
|
+
}
|
|
689
|
+
var newBefore = newText.slice(0, newCursor);
|
|
690
|
+
var newAfter = newText.slice(newCursor);
|
|
691
|
+
if (newAfter !== oldAfter) {
|
|
692
|
+
break editBefore;
|
|
693
|
+
}
|
|
694
|
+
var prefixLength = Math.min(oldCursor, newCursor);
|
|
695
|
+
var oldPrefix = oldBefore.slice(0, prefixLength);
|
|
696
|
+
var newPrefix = newBefore.slice(0, prefixLength);
|
|
697
|
+
if (oldPrefix !== newPrefix) {
|
|
698
|
+
break editBefore;
|
|
699
|
+
}
|
|
700
|
+
var oldMiddle = oldBefore.slice(prefixLength);
|
|
701
|
+
var newMiddle = newBefore.slice(prefixLength);
|
|
702
|
+
return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
|
|
703
|
+
}
|
|
704
|
+
editAfter: {
|
|
705
|
+
if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
|
|
706
|
+
break editAfter;
|
|
707
|
+
}
|
|
708
|
+
var cursor = oldCursor;
|
|
709
|
+
var newBefore = newText.slice(0, cursor);
|
|
710
|
+
var newAfter = newText.slice(cursor);
|
|
711
|
+
if (newBefore !== oldBefore) {
|
|
712
|
+
break editAfter;
|
|
713
|
+
}
|
|
714
|
+
var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
|
|
715
|
+
var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
|
|
716
|
+
var newSuffix = newAfter.slice(newAfter.length - suffixLength);
|
|
717
|
+
if (oldSuffix !== newSuffix) {
|
|
718
|
+
break editAfter;
|
|
719
|
+
}
|
|
720
|
+
var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
|
|
721
|
+
var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);
|
|
722
|
+
return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (oldRange.length > 0 && newRange && newRange.length === 0) {
|
|
726
|
+
replaceRange: {
|
|
727
|
+
var oldPrefix = oldText.slice(0, oldRange.index);
|
|
728
|
+
var oldSuffix = oldText.slice(oldRange.index + oldRange.length);
|
|
729
|
+
var prefixLength = oldPrefix.length;
|
|
730
|
+
var suffixLength = oldSuffix.length;
|
|
731
|
+
if (newLength < prefixLength + suffixLength) {
|
|
732
|
+
break replaceRange;
|
|
733
|
+
}
|
|
734
|
+
var newPrefix = newText.slice(0, prefixLength);
|
|
735
|
+
var newSuffix = newText.slice(newLength - suffixLength);
|
|
736
|
+
if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {
|
|
737
|
+
break replaceRange;
|
|
738
|
+
}
|
|
739
|
+
var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);
|
|
740
|
+
var newMiddle = newText.slice(prefixLength, newLength - suffixLength);
|
|
741
|
+
return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
function diff2(text1, text2, cursor_pos, cleanup) {
|
|
747
|
+
return diff_main(text1, text2, cursor_pos, cleanup, true);
|
|
748
|
+
}
|
|
749
|
+
diff2.INSERT = DIFF_INSERT;
|
|
750
|
+
diff2.DELETE = DIFF_DELETE;
|
|
751
|
+
diff2.EQUAL = DIFF_EQUAL;
|
|
752
|
+
module3.exports = diff2;
|
|
753
|
+
});
|
|
754
|
+
|
|
31
755
|
// node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
|
|
32
756
|
var require_eslint_visitor_keys = __commonJS((exports) => {
|
|
33
757
|
var KEYS = {
|
|
@@ -381,33 +1105,33 @@ var require_get_keys = __commonJS((exports) => {
|
|
|
381
1105
|
|
|
382
1106
|
// node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js
|
|
383
1107
|
var require_visitor_keys = __commonJS((exports) => {
|
|
384
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
388
|
-
if (!desc || ("get" in desc ? !
|
|
1108
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
|
|
1109
|
+
if (k22 === undefined)
|
|
1110
|
+
k22 = k2;
|
|
1111
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
1112
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
389
1113
|
desc = { enumerable: true, get: function() {
|
|
390
|
-
return
|
|
1114
|
+
return m2[k2];
|
|
391
1115
|
} };
|
|
392
1116
|
}
|
|
393
|
-
Object.defineProperty(o,
|
|
394
|
-
} : function(o,
|
|
395
|
-
if (
|
|
396
|
-
|
|
397
|
-
o[
|
|
1117
|
+
Object.defineProperty(o, k22, desc);
|
|
1118
|
+
} : function(o, m2, k2, k22) {
|
|
1119
|
+
if (k22 === undefined)
|
|
1120
|
+
k22 = k2;
|
|
1121
|
+
o[k22] = m2[k2];
|
|
398
1122
|
});
|
|
399
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
400
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
401
|
-
} : function(o,
|
|
402
|
-
o["default"] =
|
|
1123
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v2) {
|
|
1124
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v2 });
|
|
1125
|
+
} : function(o, v2) {
|
|
1126
|
+
o["default"] = v2;
|
|
403
1127
|
});
|
|
404
1128
|
var __importStar = exports && exports.__importStar || function() {
|
|
405
1129
|
var ownKeys = function(o) {
|
|
406
1130
|
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
407
1131
|
var ar = [];
|
|
408
|
-
for (var
|
|
409
|
-
if (Object.prototype.hasOwnProperty.call(o2,
|
|
410
|
-
ar[ar.length] =
|
|
1132
|
+
for (var k2 in o2)
|
|
1133
|
+
if (Object.prototype.hasOwnProperty.call(o2, k2))
|
|
1134
|
+
ar[ar.length] = k2;
|
|
411
1135
|
return ar;
|
|
412
1136
|
};
|
|
413
1137
|
return ownKeys(o);
|
|
@@ -417,9 +1141,9 @@ var require_visitor_keys = __commonJS((exports) => {
|
|
|
417
1141
|
return mod;
|
|
418
1142
|
var result = {};
|
|
419
1143
|
if (mod != null) {
|
|
420
|
-
for (var
|
|
421
|
-
if (
|
|
422
|
-
__createBinding(result, mod,
|
|
1144
|
+
for (var k2 = ownKeys(mod), i = 0;i < k2.length; i++)
|
|
1145
|
+
if (k2[i] !== "default")
|
|
1146
|
+
__createBinding(result, mod, k2[i]);
|
|
423
1147
|
}
|
|
424
1148
|
__setModuleDefault(result, mod);
|
|
425
1149
|
return result;
|
|
@@ -851,25 +1575,25 @@ var require_VariableDefinition = __commonJS((exports) => {
|
|
|
851
1575
|
|
|
852
1576
|
// node_modules/@typescript-eslint/scope-manager/dist/definition/index.js
|
|
853
1577
|
var require_definition = __commonJS((exports) => {
|
|
854
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
855
|
-
if (
|
|
856
|
-
|
|
857
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
858
|
-
if (!desc || ("get" in desc ? !
|
|
1578
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
|
|
1579
|
+
if (k22 === undefined)
|
|
1580
|
+
k22 = k2;
|
|
1581
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
1582
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
859
1583
|
desc = { enumerable: true, get: function() {
|
|
860
|
-
return
|
|
1584
|
+
return m2[k2];
|
|
861
1585
|
} };
|
|
862
1586
|
}
|
|
863
|
-
Object.defineProperty(o,
|
|
864
|
-
} : function(o,
|
|
865
|
-
if (
|
|
866
|
-
|
|
867
|
-
o[
|
|
1587
|
+
Object.defineProperty(o, k22, desc);
|
|
1588
|
+
} : function(o, m2, k2, k22) {
|
|
1589
|
+
if (k22 === undefined)
|
|
1590
|
+
k22 = k2;
|
|
1591
|
+
o[k22] = m2[k2];
|
|
868
1592
|
});
|
|
869
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
870
|
-
for (var p in
|
|
1593
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
1594
|
+
for (var p in m2)
|
|
871
1595
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
872
|
-
__createBinding(exports2,
|
|
1596
|
+
__createBinding(exports2, m2, p);
|
|
873
1597
|
};
|
|
874
1598
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
875
1599
|
__exportStar(require_CatchClauseDefinition(), exports);
|
|
@@ -5929,7 +6653,7 @@ var require_FunctionScope = __commonJS((exports) => {
|
|
|
5929
6653
|
return true;
|
|
5930
6654
|
}
|
|
5931
6655
|
const bodyStart = this.block.body?.range[0] ?? -1;
|
|
5932
|
-
return !(variable.scope === this && ref6.identifier.range[0] < bodyStart && variable.defs.every((
|
|
6656
|
+
return !(variable.scope === this && ref6.identifier.range[0] < bodyStart && variable.defs.every((d2) => d2.name.range[0] >= bodyStart));
|
|
5933
6657
|
}
|
|
5934
6658
|
}
|
|
5935
6659
|
exports.FunctionScope = FunctionScope;
|
|
@@ -6114,25 +6838,25 @@ var require_WithScope = __commonJS((exports) => {
|
|
|
6114
6838
|
|
|
6115
6839
|
// node_modules/@typescript-eslint/scope-manager/dist/scope/index.js
|
|
6116
6840
|
var require_scope = __commonJS((exports) => {
|
|
6117
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
6118
|
-
if (
|
|
6119
|
-
|
|
6120
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
6121
|
-
if (!desc || ("get" in desc ? !
|
|
6841
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
|
|
6842
|
+
if (k22 === undefined)
|
|
6843
|
+
k22 = k2;
|
|
6844
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
6845
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
6122
6846
|
desc = { enumerable: true, get: function() {
|
|
6123
|
-
return
|
|
6847
|
+
return m2[k2];
|
|
6124
6848
|
} };
|
|
6125
6849
|
}
|
|
6126
|
-
Object.defineProperty(o,
|
|
6127
|
-
} : function(o,
|
|
6128
|
-
if (
|
|
6129
|
-
|
|
6130
|
-
o[
|
|
6850
|
+
Object.defineProperty(o, k22, desc);
|
|
6851
|
+
} : function(o, m2, k2, k22) {
|
|
6852
|
+
if (k22 === undefined)
|
|
6853
|
+
k22 = k2;
|
|
6854
|
+
o[k22] = m2[k2];
|
|
6131
6855
|
});
|
|
6132
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
6133
|
-
for (var p in
|
|
6856
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
6857
|
+
for (var p in m2)
|
|
6134
6858
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
6135
|
-
__createBinding(exports2,
|
|
6859
|
+
__createBinding(exports2, m2, p);
|
|
6136
6860
|
};
|
|
6137
6861
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6138
6862
|
__exportStar(require_BlockScope(), exports);
|
|
@@ -6538,7 +7262,7 @@ var require_ClassVisitor = __commonJS((exports) => {
|
|
|
6538
7262
|
if (node.type === types_1.AST_NODE_TYPES.ClassDeclaration && node.id) {
|
|
6539
7263
|
this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.ClassNameDefinition(node.id, node));
|
|
6540
7264
|
}
|
|
6541
|
-
node.decorators.forEach((
|
|
7265
|
+
node.decorators.forEach((d2) => this.#referencer.visit(d2));
|
|
6542
7266
|
this.#referencer.scopeManager.nestClassScope(node);
|
|
6543
7267
|
if (node.id) {
|
|
6544
7268
|
this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.ClassNameDefinition(node.id, node));
|
|
@@ -6571,14 +7295,14 @@ var require_ClassVisitor = __commonJS((exports) => {
|
|
|
6571
7295
|
} else {
|
|
6572
7296
|
this.#referencer.visit(node.value);
|
|
6573
7297
|
}
|
|
6574
|
-
node.decorators.forEach((
|
|
7298
|
+
node.decorators.forEach((d2) => this.#referencer.visit(d2));
|
|
6575
7299
|
}
|
|
6576
7300
|
visitMethodFunction(node) {
|
|
6577
7301
|
if (node.id) {
|
|
6578
7302
|
this.#referencer.scopeManager.nestFunctionExpressionNameScope(node);
|
|
6579
7303
|
}
|
|
6580
7304
|
node.params.forEach((param) => {
|
|
6581
|
-
param.decorators.forEach((
|
|
7305
|
+
param.decorators.forEach((d2) => this.visit(d2));
|
|
6582
7306
|
});
|
|
6583
7307
|
this.#referencer.scopeManager.nestFunctionScope(node, true);
|
|
6584
7308
|
for (const param of node.params) {
|
|
@@ -6606,7 +7330,7 @@ var require_ClassVisitor = __commonJS((exports) => {
|
|
|
6606
7330
|
this.#referencer.close(node.value);
|
|
6607
7331
|
}
|
|
6608
7332
|
}
|
|
6609
|
-
node.decorators.forEach((
|
|
7333
|
+
node.decorators.forEach((d2) => this.#referencer.visit(d2));
|
|
6610
7334
|
}
|
|
6611
7335
|
visitPropertyDefinition(node) {
|
|
6612
7336
|
this.visitPropertyBase(node);
|
|
@@ -6878,7 +7602,7 @@ var require_Referencer = __commonJS((exports) => {
|
|
|
6878
7602
|
this.referencingDefaultValue(pattern4, info.assignments, null, true);
|
|
6879
7603
|
}, { processRightHandNodes: true });
|
|
6880
7604
|
this.visitFunctionParameterTypeAnnotation(param);
|
|
6881
|
-
param.decorators.forEach((
|
|
7605
|
+
param.decorators.forEach((d2) => this.visit(d2));
|
|
6882
7606
|
}
|
|
6883
7607
|
this.visitType(node.returnType);
|
|
6884
7608
|
this.visitType(node.typeParameters);
|
|
@@ -7276,7 +8000,7 @@ var require_ScopeManager = __commonJS((exports) => {
|
|
|
7276
8000
|
get variables() {
|
|
7277
8001
|
const variables = new Set;
|
|
7278
8002
|
function recurse(scope) {
|
|
7279
|
-
scope.variables.forEach((
|
|
8003
|
+
scope.variables.forEach((v2) => variables.add(v2));
|
|
7280
8004
|
scope.childScopes.forEach(recurse);
|
|
7281
8005
|
}
|
|
7282
8006
|
this.scopes.forEach(recurse);
|
|
@@ -7431,25 +8155,25 @@ var require_analyze = __commonJS((exports) => {
|
|
|
7431
8155
|
|
|
7432
8156
|
// node_modules/@typescript-eslint/scope-manager/dist/index.js
|
|
7433
8157
|
var require_dist2 = __commonJS((exports) => {
|
|
7434
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
7435
|
-
if (
|
|
7436
|
-
|
|
7437
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
7438
|
-
if (!desc || ("get" in desc ? !
|
|
8158
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k2, k22) {
|
|
8159
|
+
if (k22 === undefined)
|
|
8160
|
+
k22 = k2;
|
|
8161
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
8162
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
7439
8163
|
desc = { enumerable: true, get: function() {
|
|
7440
|
-
return
|
|
8164
|
+
return m2[k2];
|
|
7441
8165
|
} };
|
|
7442
8166
|
}
|
|
7443
|
-
Object.defineProperty(o,
|
|
7444
|
-
} : function(o,
|
|
7445
|
-
if (
|
|
7446
|
-
|
|
7447
|
-
o[
|
|
8167
|
+
Object.defineProperty(o, k22, desc);
|
|
8168
|
+
} : function(o, m2, k2, k22) {
|
|
8169
|
+
if (k22 === undefined)
|
|
8170
|
+
k22 = k2;
|
|
8171
|
+
o[k22] = m2[k2];
|
|
7448
8172
|
});
|
|
7449
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
7450
|
-
for (var p in
|
|
8173
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
8174
|
+
for (var p in m2)
|
|
7451
8175
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
7452
|
-
__createBinding(exports2,
|
|
8176
|
+
__createBinding(exports2, m2, p);
|
|
7453
8177
|
};
|
|
7454
8178
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7455
8179
|
exports.ScopeManager = exports.Visitor = exports.Reference = exports.PatternVisitor = exports.analyze = undefined;
|
|
@@ -7478,124 +8202,919 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
7478
8202
|
__exportStar(require_variable(), exports);
|
|
7479
8203
|
});
|
|
7480
8204
|
|
|
7481
|
-
//
|
|
7482
|
-
|
|
8205
|
+
// node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node
|
|
8206
|
+
var require_resolver_linux_x64_musl = __commonJS((exports, module3) => {
|
|
8207
|
+
module3.exports = __require("./resolver.linux-x64-musl-gnkc267h.node");
|
|
8208
|
+
});
|
|
7483
8209
|
|
|
7484
|
-
// node_modules/
|
|
7485
|
-
var
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
8210
|
+
// node_modules/@oxc-resolver/binding-linux-x64-musl/package.json
|
|
8211
|
+
var require_package = __commonJS((exports, module3) => {
|
|
8212
|
+
module3.exports = {
|
|
8213
|
+
name: "@oxc-resolver/binding-linux-x64-musl",
|
|
8214
|
+
version: "11.16.0",
|
|
8215
|
+
cpu: [
|
|
8216
|
+
"x64"
|
|
8217
|
+
],
|
|
8218
|
+
main: "resolver.linux-x64-musl.node",
|
|
8219
|
+
files: [
|
|
8220
|
+
"resolver.linux-x64-musl.node"
|
|
8221
|
+
],
|
|
8222
|
+
description: "Oxc Resolver Node API",
|
|
8223
|
+
homepage: "https://oxc.rs",
|
|
8224
|
+
license: "MIT",
|
|
8225
|
+
repository: {
|
|
8226
|
+
type: "git",
|
|
8227
|
+
url: "git+https://github.com/oxc-project/oxc-resolver.git"
|
|
8228
|
+
},
|
|
8229
|
+
publishConfig: {
|
|
8230
|
+
registry: "https://registry.npmjs.org/",
|
|
8231
|
+
access: "public"
|
|
8232
|
+
},
|
|
8233
|
+
os: [
|
|
8234
|
+
"linux"
|
|
8235
|
+
],
|
|
8236
|
+
libc: [
|
|
8237
|
+
"musl"
|
|
8238
|
+
]
|
|
8239
|
+
};
|
|
7493
8240
|
});
|
|
7494
8241
|
|
|
7495
|
-
// node_modules/
|
|
7496
|
-
var
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
clone: 0,
|
|
7500
|
-
discard: 0,
|
|
7501
|
-
update: 0
|
|
7502
|
-
};
|
|
8242
|
+
// node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node
|
|
8243
|
+
var require_resolver_linux_x64_gnu = __commonJS((exports, module3) => {
|
|
8244
|
+
module3.exports = __require("./resolver.linux-x64-gnu-hcjn12y1.node");
|
|
8245
|
+
});
|
|
7503
8246
|
|
|
7504
|
-
// node_modules/
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
IsIterator: () => IsIterator2,
|
|
7535
|
-
IsInteger: () => IsInteger2,
|
|
7536
|
-
IsGreaterThan: () => IsGreaterThan2,
|
|
7537
|
-
IsGreaterEqualThan: () => IsGreaterEqualThan2,
|
|
7538
|
-
IsFunction: () => IsFunction2,
|
|
7539
|
-
IsEqual: () => IsEqual2,
|
|
7540
|
-
IsDeepEqual: () => IsDeepEqual2,
|
|
7541
|
-
IsConstructor: () => IsConstructor2,
|
|
7542
|
-
IsBoolean: () => IsBoolean2,
|
|
7543
|
-
IsBigInt: () => IsBigInt2,
|
|
7544
|
-
IsAsyncIterator: () => IsAsyncIterator2,
|
|
7545
|
-
IsArray: () => IsArray2,
|
|
7546
|
-
If: () => If,
|
|
7547
|
-
HasPropertyKey: () => HasPropertyKey2,
|
|
7548
|
-
Every: () => Every2,
|
|
7549
|
-
Entries: () => Entries2,
|
|
7550
|
-
Constant: () => Constant,
|
|
7551
|
-
ConstDeclaration: () => ConstDeclaration,
|
|
7552
|
-
Call: () => Call,
|
|
7553
|
-
ArrowFunction: () => ArrowFunction,
|
|
7554
|
-
ArrayLiteral: () => ArrayLiteral,
|
|
7555
|
-
And: () => And
|
|
8247
|
+
// node_modules/@oxc-resolver/binding-linux-x64-gnu/package.json
|
|
8248
|
+
var require_package2 = __commonJS((exports, module3) => {
|
|
8249
|
+
module3.exports = {
|
|
8250
|
+
name: "@oxc-resolver/binding-linux-x64-gnu",
|
|
8251
|
+
version: "11.16.0",
|
|
8252
|
+
cpu: [
|
|
8253
|
+
"x64"
|
|
8254
|
+
],
|
|
8255
|
+
main: "resolver.linux-x64-gnu.node",
|
|
8256
|
+
files: [
|
|
8257
|
+
"resolver.linux-x64-gnu.node"
|
|
8258
|
+
],
|
|
8259
|
+
description: "Oxc Resolver Node API",
|
|
8260
|
+
homepage: "https://oxc.rs",
|
|
8261
|
+
license: "MIT",
|
|
8262
|
+
repository: {
|
|
8263
|
+
type: "git",
|
|
8264
|
+
url: "git+https://github.com/oxc-project/oxc-resolver.git"
|
|
8265
|
+
},
|
|
8266
|
+
publishConfig: {
|
|
8267
|
+
registry: "https://registry.npmjs.org/",
|
|
8268
|
+
access: "public"
|
|
8269
|
+
},
|
|
8270
|
+
os: [
|
|
8271
|
+
"linux"
|
|
8272
|
+
],
|
|
8273
|
+
libc: [
|
|
8274
|
+
"glibc"
|
|
8275
|
+
]
|
|
8276
|
+
};
|
|
7556
8277
|
});
|
|
7557
8278
|
|
|
7558
|
-
// node_modules/
|
|
7559
|
-
var
|
|
7560
|
-
__export(
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
IsGreaterThan: () => IsGreaterThan,
|
|
7579
|
-
IsGreaterEqualThan: () => IsGreaterEqualThan,
|
|
7580
|
-
IsFunction: () => IsFunction,
|
|
7581
|
-
IsEqual: () => IsEqual,
|
|
7582
|
-
IsDeepEqual: () => IsDeepEqual,
|
|
7583
|
-
IsConstructor: () => IsConstructor,
|
|
7584
|
-
IsClassInstance: () => IsClassInstance,
|
|
7585
|
-
IsBoolean: () => IsBoolean,
|
|
7586
|
-
IsBigInt: () => IsBigInt,
|
|
7587
|
-
IsAsyncIterator: () => IsAsyncIterator,
|
|
7588
|
-
IsArray: () => IsArray,
|
|
7589
|
-
HasPropertyKey: () => HasPropertyKey,
|
|
7590
|
-
EveryAll: () => EveryAll,
|
|
7591
|
-
Every: () => Every,
|
|
7592
|
-
EntriesRegExp: () => EntriesRegExp,
|
|
7593
|
-
Entries: () => Entries
|
|
8279
|
+
// node_modules/oxc-resolver/package.json
|
|
8280
|
+
var exports_package = {};
|
|
8281
|
+
__export(exports_package, {
|
|
8282
|
+
version: () => version,
|
|
8283
|
+
scripts: () => scripts,
|
|
8284
|
+
repository: () => repository,
|
|
8285
|
+
publishConfig: () => publishConfig,
|
|
8286
|
+
packageManager: () => packageManager,
|
|
8287
|
+
optionalDependencies: () => optionalDependencies,
|
|
8288
|
+
napi: () => napi,
|
|
8289
|
+
name: () => name,
|
|
8290
|
+
main: () => main,
|
|
8291
|
+
license: () => license,
|
|
8292
|
+
homepage: () => homepage,
|
|
8293
|
+
funding: () => funding,
|
|
8294
|
+
files: () => files,
|
|
8295
|
+
devDependencies: () => devDependencies,
|
|
8296
|
+
description: () => description,
|
|
8297
|
+
default: () => package_default,
|
|
8298
|
+
browser: () => browser
|
|
7594
8299
|
});
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
8300
|
+
var name = "oxc-resolver", version = "11.16.0", description = "Oxc Resolver Node API", homepage = "https://oxc.rs", repository, funding, license = "MIT", main = "index.js", browser = "browser.js", files, scripts, devDependencies, napi, packageManager = "pnpm@10.25.0", publishConfig, optionalDependencies, package_default;
|
|
8301
|
+
var init_package = __esm(() => {
|
|
8302
|
+
repository = {
|
|
8303
|
+
type: "git",
|
|
8304
|
+
url: "git+https://github.com/oxc-project/oxc-resolver.git"
|
|
8305
|
+
};
|
|
8306
|
+
funding = {
|
|
8307
|
+
url: "https://github.com/sponsors/Boshen"
|
|
8308
|
+
};
|
|
8309
|
+
files = [
|
|
8310
|
+
"browser.js",
|
|
8311
|
+
"index.d.ts",
|
|
8312
|
+
"index.js",
|
|
8313
|
+
"webcontainer-fallback.js"
|
|
8314
|
+
];
|
|
8315
|
+
scripts = {
|
|
8316
|
+
test: "vitest run -r ./napi",
|
|
8317
|
+
"build:debug": "napi build --platform --manifest-path napi/Cargo.toml",
|
|
8318
|
+
build: "pnpm run build:debug --features allocator --release",
|
|
8319
|
+
"postbuild:debug": "node napi/patch.mjs",
|
|
8320
|
+
fmt: "oxfmt"
|
|
8321
|
+
};
|
|
8322
|
+
devDependencies = {
|
|
8323
|
+
"@napi-rs/cli": "^3.3.1",
|
|
8324
|
+
"@napi-rs/wasm-runtime": "^1.0.7",
|
|
8325
|
+
"@types/node": "^25.0.0",
|
|
8326
|
+
emnapi: "^1.6.0",
|
|
8327
|
+
oxfmt: "^0.18.0",
|
|
8328
|
+
typescript: "^5.9.3",
|
|
8329
|
+
vitest: "^4.0.0"
|
|
8330
|
+
};
|
|
8331
|
+
napi = {
|
|
8332
|
+
binaryName: "resolver",
|
|
8333
|
+
packageName: "@oxc-resolver/binding",
|
|
8334
|
+
targets: [
|
|
8335
|
+
"aarch64-apple-darwin",
|
|
8336
|
+
"aarch64-linux-android",
|
|
8337
|
+
"aarch64-pc-windows-msvc",
|
|
8338
|
+
"aarch64-unknown-linux-gnu",
|
|
8339
|
+
"aarch64-unknown-linux-musl",
|
|
8340
|
+
"aarch64-unknown-linux-ohos",
|
|
8341
|
+
"armv7-linux-androideabi",
|
|
8342
|
+
"armv7-unknown-linux-gnueabihf",
|
|
8343
|
+
"armv7-unknown-linux-musleabihf",
|
|
8344
|
+
"i686-pc-windows-msvc",
|
|
8345
|
+
"powerpc64le-unknown-linux-gnu",
|
|
8346
|
+
"riscv64gc-unknown-linux-gnu",
|
|
8347
|
+
"riscv64gc-unknown-linux-musl",
|
|
8348
|
+
"s390x-unknown-linux-gnu",
|
|
8349
|
+
"wasm32-wasip1-threads",
|
|
8350
|
+
"x86_64-apple-darwin",
|
|
8351
|
+
"x86_64-pc-windows-msvc",
|
|
8352
|
+
"x86_64-unknown-freebsd",
|
|
8353
|
+
"x86_64-unknown-linux-gnu",
|
|
8354
|
+
"x86_64-unknown-linux-musl"
|
|
8355
|
+
],
|
|
8356
|
+
wasm: {
|
|
8357
|
+
browser: {
|
|
8358
|
+
fs: true
|
|
8359
|
+
}
|
|
8360
|
+
}
|
|
8361
|
+
};
|
|
8362
|
+
publishConfig = {
|
|
8363
|
+
access: "public",
|
|
8364
|
+
registry: "https://registry.npmjs.org/"
|
|
8365
|
+
};
|
|
8366
|
+
optionalDependencies = {
|
|
8367
|
+
"@oxc-resolver/binding-darwin-arm64": "11.16.0",
|
|
8368
|
+
"@oxc-resolver/binding-android-arm64": "11.16.0",
|
|
8369
|
+
"@oxc-resolver/binding-win32-arm64-msvc": "11.16.0",
|
|
8370
|
+
"@oxc-resolver/binding-linux-arm64-gnu": "11.16.0",
|
|
8371
|
+
"@oxc-resolver/binding-linux-arm64-musl": "11.16.0",
|
|
8372
|
+
"@oxc-resolver/binding-openharmony-arm64": "11.16.0",
|
|
8373
|
+
"@oxc-resolver/binding-android-arm-eabi": "11.16.0",
|
|
8374
|
+
"@oxc-resolver/binding-linux-arm-gnueabihf": "11.16.0",
|
|
8375
|
+
"@oxc-resolver/binding-linux-arm-musleabihf": "11.16.0",
|
|
8376
|
+
"@oxc-resolver/binding-win32-ia32-msvc": "11.16.0",
|
|
8377
|
+
"@oxc-resolver/binding-linux-ppc64-gnu": "11.16.0",
|
|
8378
|
+
"@oxc-resolver/binding-linux-riscv64-gnu": "11.16.0",
|
|
8379
|
+
"@oxc-resolver/binding-linux-riscv64-musl": "11.16.0",
|
|
8380
|
+
"@oxc-resolver/binding-linux-s390x-gnu": "11.16.0",
|
|
8381
|
+
"@oxc-resolver/binding-wasm32-wasi": "11.16.0",
|
|
8382
|
+
"@oxc-resolver/binding-darwin-x64": "11.16.0",
|
|
8383
|
+
"@oxc-resolver/binding-win32-x64-msvc": "11.16.0",
|
|
8384
|
+
"@oxc-resolver/binding-freebsd-x64": "11.16.0",
|
|
8385
|
+
"@oxc-resolver/binding-linux-x64-gnu": "11.16.0",
|
|
8386
|
+
"@oxc-resolver/binding-linux-x64-musl": "11.16.0"
|
|
8387
|
+
};
|
|
8388
|
+
package_default = {
|
|
8389
|
+
name,
|
|
8390
|
+
version,
|
|
8391
|
+
description,
|
|
8392
|
+
homepage,
|
|
8393
|
+
repository,
|
|
8394
|
+
funding,
|
|
8395
|
+
license,
|
|
8396
|
+
main,
|
|
8397
|
+
browser,
|
|
8398
|
+
files,
|
|
8399
|
+
scripts,
|
|
8400
|
+
devDependencies,
|
|
8401
|
+
napi,
|
|
8402
|
+
packageManager,
|
|
8403
|
+
publishConfig,
|
|
8404
|
+
optionalDependencies
|
|
8405
|
+
};
|
|
8406
|
+
});
|
|
8407
|
+
|
|
8408
|
+
// node_modules/oxc-resolver/webcontainer-fallback.js
|
|
8409
|
+
var require_webcontainer_fallback = __commonJS((exports, module3) => {
|
|
8410
|
+
var fs = __require("node:fs");
|
|
8411
|
+
var childProcess = __require("node:child_process");
|
|
8412
|
+
var pkg = JSON.parse(fs.readFileSync(__require.resolve("/home/runner/work/eslint-cease-nonsense-rules/eslint-cease-nonsense-rules/node_modules/oxc-resolver/package.json"), "utf-8"));
|
|
8413
|
+
var version2 = pkg.version;
|
|
8414
|
+
var baseDir = `/tmp/oxc-resolver-${version2}`;
|
|
8415
|
+
var bindingEntry = `${baseDir}/node_modules/@oxc-resolver/binding-wasm32-wasi/resolver.wasi.cjs`;
|
|
8416
|
+
if (!fs.existsSync(bindingEntry)) {
|
|
8417
|
+
fs.rmSync(baseDir, { recursive: true, force: true });
|
|
8418
|
+
fs.mkdirSync(baseDir, { recursive: true });
|
|
8419
|
+
const bindingPkg = `@oxc-resolver/binding-wasm32-wasi@${version2}`;
|
|
8420
|
+
console.log(`[oxc-resolver] Downloading ${bindingPkg} on WebContainer...`);
|
|
8421
|
+
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
|
|
8422
|
+
cwd: baseDir,
|
|
8423
|
+
stdio: "inherit"
|
|
8424
|
+
});
|
|
8425
|
+
}
|
|
8426
|
+
module3.exports = __require(bindingEntry);
|
|
8427
|
+
});
|
|
8428
|
+
|
|
8429
|
+
// node_modules/oxc-resolver/index.js
|
|
8430
|
+
var require_oxc_resolver = __commonJS((exports, module3) => {
|
|
8431
|
+
var { readFileSync: readFileSync3 } = __require("node:fs");
|
|
8432
|
+
var nativeBinding2 = null;
|
|
8433
|
+
var loadErrors2 = [];
|
|
8434
|
+
var isMusl2 = () => {
|
|
8435
|
+
let musl = false;
|
|
8436
|
+
if (process.platform === "linux") {
|
|
8437
|
+
musl = isMuslFromFilesystem2();
|
|
8438
|
+
if (musl === null) {
|
|
8439
|
+
musl = isMuslFromReport2();
|
|
8440
|
+
}
|
|
8441
|
+
if (musl === null) {
|
|
8442
|
+
musl = isMuslFromChildProcess2();
|
|
8443
|
+
}
|
|
8444
|
+
}
|
|
8445
|
+
return musl;
|
|
8446
|
+
};
|
|
8447
|
+
var isFileMusl2 = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
8448
|
+
var isMuslFromFilesystem2 = () => {
|
|
8449
|
+
try {
|
|
8450
|
+
return readFileSync3("/usr/bin/ldd", "utf-8").includes("musl");
|
|
8451
|
+
} catch {
|
|
8452
|
+
return null;
|
|
8453
|
+
}
|
|
8454
|
+
};
|
|
8455
|
+
var isMuslFromReport2 = () => {
|
|
8456
|
+
let report = null;
|
|
8457
|
+
if (typeof process.report?.getReport === "function") {
|
|
8458
|
+
process.report.excludeNetwork = true;
|
|
8459
|
+
report = process.report.getReport();
|
|
8460
|
+
}
|
|
8461
|
+
if (!report) {
|
|
8462
|
+
return null;
|
|
8463
|
+
}
|
|
8464
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
8465
|
+
return false;
|
|
8466
|
+
}
|
|
8467
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
8468
|
+
if (report.sharedObjects.some(isFileMusl2)) {
|
|
8469
|
+
return true;
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
return false;
|
|
8473
|
+
};
|
|
8474
|
+
var isMuslFromChildProcess2 = () => {
|
|
8475
|
+
try {
|
|
8476
|
+
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
|
8477
|
+
} catch (e) {
|
|
8478
|
+
return false;
|
|
8479
|
+
}
|
|
8480
|
+
};
|
|
8481
|
+
function requireNative2() {
|
|
8482
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
8483
|
+
try {
|
|
8484
|
+
return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
8485
|
+
} catch (err) {
|
|
8486
|
+
loadErrors2.push(err);
|
|
8487
|
+
}
|
|
8488
|
+
} else if (process.platform === "android") {
|
|
8489
|
+
if (process.arch === "arm64") {
|
|
8490
|
+
try {
|
|
8491
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.android-arm64.node");})();
|
|
8492
|
+
} catch (e) {
|
|
8493
|
+
loadErrors2.push(e);
|
|
8494
|
+
}
|
|
8495
|
+
try {
|
|
8496
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm64");})();
|
|
8497
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm64/package.json");})().version;
|
|
8498
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8499
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8500
|
+
}
|
|
8501
|
+
return binding;
|
|
8502
|
+
} catch (e) {
|
|
8503
|
+
loadErrors2.push(e);
|
|
8504
|
+
}
|
|
8505
|
+
} else if (process.arch === "arm") {
|
|
8506
|
+
try {
|
|
8507
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.android-arm-eabi.node");})();
|
|
8508
|
+
} catch (e) {
|
|
8509
|
+
loadErrors2.push(e);
|
|
8510
|
+
}
|
|
8511
|
+
try {
|
|
8512
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm-eabi");})();
|
|
8513
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm-eabi/package.json");})().version;
|
|
8514
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8515
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8516
|
+
}
|
|
8517
|
+
return binding;
|
|
8518
|
+
} catch (e) {
|
|
8519
|
+
loadErrors2.push(e);
|
|
8520
|
+
}
|
|
8521
|
+
} else {
|
|
8522
|
+
loadErrors2.push(new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
8523
|
+
}
|
|
8524
|
+
} else if (process.platform === "win32") {
|
|
8525
|
+
if (process.arch === "x64") {
|
|
8526
|
+
if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
|
|
8527
|
+
try {
|
|
8528
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-x64-gnu.node");})();
|
|
8529
|
+
} catch (e) {
|
|
8530
|
+
loadErrors2.push(e);
|
|
8531
|
+
}
|
|
8532
|
+
try {
|
|
8533
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-gnu");})();
|
|
8534
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-gnu/package.json");})().version;
|
|
8535
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8536
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8537
|
+
}
|
|
8538
|
+
return binding;
|
|
8539
|
+
} catch (e) {
|
|
8540
|
+
loadErrors2.push(e);
|
|
8541
|
+
}
|
|
8542
|
+
} else {
|
|
8543
|
+
try {
|
|
8544
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-x64-msvc.node");})();
|
|
8545
|
+
} catch (e) {
|
|
8546
|
+
loadErrors2.push(e);
|
|
8547
|
+
}
|
|
8548
|
+
try {
|
|
8549
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-msvc");})();
|
|
8550
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-msvc/package.json");})().version;
|
|
8551
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8552
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8553
|
+
}
|
|
8554
|
+
return binding;
|
|
8555
|
+
} catch (e) {
|
|
8556
|
+
loadErrors2.push(e);
|
|
8557
|
+
}
|
|
8558
|
+
}
|
|
8559
|
+
} else if (process.arch === "ia32") {
|
|
8560
|
+
try {
|
|
8561
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-ia32-msvc.node");})();
|
|
8562
|
+
} catch (e) {
|
|
8563
|
+
loadErrors2.push(e);
|
|
8564
|
+
}
|
|
8565
|
+
try {
|
|
8566
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-ia32-msvc");})();
|
|
8567
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-ia32-msvc/package.json");})().version;
|
|
8568
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8569
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8570
|
+
}
|
|
8571
|
+
return binding;
|
|
8572
|
+
} catch (e) {
|
|
8573
|
+
loadErrors2.push(e);
|
|
8574
|
+
}
|
|
8575
|
+
} else if (process.arch === "arm64") {
|
|
8576
|
+
try {
|
|
8577
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-arm64-msvc.node");})();
|
|
8578
|
+
} catch (e) {
|
|
8579
|
+
loadErrors2.push(e);
|
|
8580
|
+
}
|
|
8581
|
+
try {
|
|
8582
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-arm64-msvc");})();
|
|
8583
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-arm64-msvc/package.json");})().version;
|
|
8584
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8585
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8586
|
+
}
|
|
8587
|
+
return binding;
|
|
8588
|
+
} catch (e) {
|
|
8589
|
+
loadErrors2.push(e);
|
|
8590
|
+
}
|
|
8591
|
+
} else {
|
|
8592
|
+
loadErrors2.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
8593
|
+
}
|
|
8594
|
+
} else if (process.platform === "darwin") {
|
|
8595
|
+
try {
|
|
8596
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.darwin-universal.node");})();
|
|
8597
|
+
} catch (e) {
|
|
8598
|
+
loadErrors2.push(e);
|
|
8599
|
+
}
|
|
8600
|
+
try {
|
|
8601
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-universal");})();
|
|
8602
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-universal/package.json");})().version;
|
|
8603
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8604
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8605
|
+
}
|
|
8606
|
+
return binding;
|
|
8607
|
+
} catch (e) {
|
|
8608
|
+
loadErrors2.push(e);
|
|
8609
|
+
}
|
|
8610
|
+
if (process.arch === "x64") {
|
|
8611
|
+
try {
|
|
8612
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.darwin-x64.node");})();
|
|
8613
|
+
} catch (e) {
|
|
8614
|
+
loadErrors2.push(e);
|
|
8615
|
+
}
|
|
8616
|
+
try {
|
|
8617
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-x64");})();
|
|
8618
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-x64/package.json");})().version;
|
|
8619
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8620
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8621
|
+
}
|
|
8622
|
+
return binding;
|
|
8623
|
+
} catch (e) {
|
|
8624
|
+
loadErrors2.push(e);
|
|
8625
|
+
}
|
|
8626
|
+
} else if (process.arch === "arm64") {
|
|
8627
|
+
try {
|
|
8628
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.darwin-arm64.node");})();
|
|
8629
|
+
} catch (e) {
|
|
8630
|
+
loadErrors2.push(e);
|
|
8631
|
+
}
|
|
8632
|
+
try {
|
|
8633
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-arm64");})();
|
|
8634
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-arm64/package.json");})().version;
|
|
8635
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8636
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8637
|
+
}
|
|
8638
|
+
return binding;
|
|
8639
|
+
} catch (e) {
|
|
8640
|
+
loadErrors2.push(e);
|
|
8641
|
+
}
|
|
8642
|
+
} else {
|
|
8643
|
+
loadErrors2.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
8644
|
+
}
|
|
8645
|
+
} else if (process.platform === "freebsd") {
|
|
8646
|
+
if (process.arch === "x64") {
|
|
8647
|
+
try {
|
|
8648
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.freebsd-x64.node");})();
|
|
8649
|
+
} catch (e) {
|
|
8650
|
+
loadErrors2.push(e);
|
|
8651
|
+
}
|
|
8652
|
+
try {
|
|
8653
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-x64");})();
|
|
8654
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-x64/package.json");})().version;
|
|
8655
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8656
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8657
|
+
}
|
|
8658
|
+
return binding;
|
|
8659
|
+
} catch (e) {
|
|
8660
|
+
loadErrors2.push(e);
|
|
8661
|
+
}
|
|
8662
|
+
} else if (process.arch === "arm64") {
|
|
8663
|
+
try {
|
|
8664
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.freebsd-arm64.node");})();
|
|
8665
|
+
} catch (e) {
|
|
8666
|
+
loadErrors2.push(e);
|
|
8667
|
+
}
|
|
8668
|
+
try {
|
|
8669
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-arm64");})();
|
|
8670
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-arm64/package.json");})().version;
|
|
8671
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8672
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8673
|
+
}
|
|
8674
|
+
return binding;
|
|
8675
|
+
} catch (e) {
|
|
8676
|
+
loadErrors2.push(e);
|
|
8677
|
+
}
|
|
8678
|
+
} else {
|
|
8679
|
+
loadErrors2.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
8680
|
+
}
|
|
8681
|
+
} else if (process.platform === "linux") {
|
|
8682
|
+
if (process.arch === "x64") {
|
|
8683
|
+
if (isMusl2()) {
|
|
8684
|
+
try {
|
|
8685
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-x64-musl.node");})();
|
|
8686
|
+
} catch (e) {
|
|
8687
|
+
loadErrors2.push(e);
|
|
8688
|
+
}
|
|
8689
|
+
try {
|
|
8690
|
+
const binding = require_resolver_linux_x64_musl();
|
|
8691
|
+
const bindingPackageVersion = require_package().version;
|
|
8692
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8693
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8694
|
+
}
|
|
8695
|
+
return binding;
|
|
8696
|
+
} catch (e) {
|
|
8697
|
+
loadErrors2.push(e);
|
|
8698
|
+
}
|
|
8699
|
+
} else {
|
|
8700
|
+
try {
|
|
8701
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-x64-gnu.node");})();
|
|
8702
|
+
} catch (e) {
|
|
8703
|
+
loadErrors2.push(e);
|
|
8704
|
+
}
|
|
8705
|
+
try {
|
|
8706
|
+
const binding = require_resolver_linux_x64_gnu();
|
|
8707
|
+
const bindingPackageVersion = require_package2().version;
|
|
8708
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8709
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8710
|
+
}
|
|
8711
|
+
return binding;
|
|
8712
|
+
} catch (e) {
|
|
8713
|
+
loadErrors2.push(e);
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
} else if (process.arch === "arm64") {
|
|
8717
|
+
if (isMusl2()) {
|
|
8718
|
+
try {
|
|
8719
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm64-musl.node");})();
|
|
8720
|
+
} catch (e) {
|
|
8721
|
+
loadErrors2.push(e);
|
|
8722
|
+
}
|
|
8723
|
+
try {
|
|
8724
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-musl");})();
|
|
8725
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-musl/package.json");})().version;
|
|
8726
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8727
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8728
|
+
}
|
|
8729
|
+
return binding;
|
|
8730
|
+
} catch (e) {
|
|
8731
|
+
loadErrors2.push(e);
|
|
8732
|
+
}
|
|
8733
|
+
} else {
|
|
8734
|
+
try {
|
|
8735
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm64-gnu.node");})();
|
|
8736
|
+
} catch (e) {
|
|
8737
|
+
loadErrors2.push(e);
|
|
8738
|
+
}
|
|
8739
|
+
try {
|
|
8740
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-gnu");})();
|
|
8741
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-gnu/package.json");})().version;
|
|
8742
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8743
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8744
|
+
}
|
|
8745
|
+
return binding;
|
|
8746
|
+
} catch (e) {
|
|
8747
|
+
loadErrors2.push(e);
|
|
8748
|
+
}
|
|
8749
|
+
}
|
|
8750
|
+
} else if (process.arch === "arm") {
|
|
8751
|
+
if (isMusl2()) {
|
|
8752
|
+
try {
|
|
8753
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm-musleabihf.node");})();
|
|
8754
|
+
} catch (e) {
|
|
8755
|
+
loadErrors2.push(e);
|
|
8756
|
+
}
|
|
8757
|
+
try {
|
|
8758
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-musleabihf");})();
|
|
8759
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-musleabihf/package.json");})().version;
|
|
8760
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8761
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8762
|
+
}
|
|
8763
|
+
return binding;
|
|
8764
|
+
} catch (e) {
|
|
8765
|
+
loadErrors2.push(e);
|
|
8766
|
+
}
|
|
8767
|
+
} else {
|
|
8768
|
+
try {
|
|
8769
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm-gnueabihf.node");})();
|
|
8770
|
+
} catch (e) {
|
|
8771
|
+
loadErrors2.push(e);
|
|
8772
|
+
}
|
|
8773
|
+
try {
|
|
8774
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-gnueabihf");})();
|
|
8775
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-gnueabihf/package.json");})().version;
|
|
8776
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8777
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8778
|
+
}
|
|
8779
|
+
return binding;
|
|
8780
|
+
} catch (e) {
|
|
8781
|
+
loadErrors2.push(e);
|
|
8782
|
+
}
|
|
8783
|
+
}
|
|
8784
|
+
} else if (process.arch === "loong64") {
|
|
8785
|
+
if (isMusl2()) {
|
|
8786
|
+
try {
|
|
8787
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-loong64-musl.node");})();
|
|
8788
|
+
} catch (e) {
|
|
8789
|
+
loadErrors2.push(e);
|
|
8790
|
+
}
|
|
8791
|
+
try {
|
|
8792
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-musl");})();
|
|
8793
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-musl/package.json");})().version;
|
|
8794
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8795
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8796
|
+
}
|
|
8797
|
+
return binding;
|
|
8798
|
+
} catch (e) {
|
|
8799
|
+
loadErrors2.push(e);
|
|
8800
|
+
}
|
|
8801
|
+
} else {
|
|
8802
|
+
try {
|
|
8803
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-loong64-gnu.node");})();
|
|
8804
|
+
} catch (e) {
|
|
8805
|
+
loadErrors2.push(e);
|
|
8806
|
+
}
|
|
8807
|
+
try {
|
|
8808
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-gnu");})();
|
|
8809
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-gnu/package.json");})().version;
|
|
8810
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8811
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8812
|
+
}
|
|
8813
|
+
return binding;
|
|
8814
|
+
} catch (e) {
|
|
8815
|
+
loadErrors2.push(e);
|
|
8816
|
+
}
|
|
8817
|
+
}
|
|
8818
|
+
} else if (process.arch === "riscv64") {
|
|
8819
|
+
if (isMusl2()) {
|
|
8820
|
+
try {
|
|
8821
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-riscv64-musl.node");})();
|
|
8822
|
+
} catch (e) {
|
|
8823
|
+
loadErrors2.push(e);
|
|
8824
|
+
}
|
|
8825
|
+
try {
|
|
8826
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-musl");})();
|
|
8827
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-musl/package.json");})().version;
|
|
8828
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8829
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8830
|
+
}
|
|
8831
|
+
return binding;
|
|
8832
|
+
} catch (e) {
|
|
8833
|
+
loadErrors2.push(e);
|
|
8834
|
+
}
|
|
8835
|
+
} else {
|
|
8836
|
+
try {
|
|
8837
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-riscv64-gnu.node");})();
|
|
8838
|
+
} catch (e) {
|
|
8839
|
+
loadErrors2.push(e);
|
|
8840
|
+
}
|
|
8841
|
+
try {
|
|
8842
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-gnu");})();
|
|
8843
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-gnu/package.json");})().version;
|
|
8844
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8845
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8846
|
+
}
|
|
8847
|
+
return binding;
|
|
8848
|
+
} catch (e) {
|
|
8849
|
+
loadErrors2.push(e);
|
|
8850
|
+
}
|
|
8851
|
+
}
|
|
8852
|
+
} else if (process.arch === "ppc64") {
|
|
8853
|
+
try {
|
|
8854
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-ppc64-gnu.node");})();
|
|
8855
|
+
} catch (e) {
|
|
8856
|
+
loadErrors2.push(e);
|
|
8857
|
+
}
|
|
8858
|
+
try {
|
|
8859
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-ppc64-gnu");})();
|
|
8860
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-ppc64-gnu/package.json");})().version;
|
|
8861
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8862
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8863
|
+
}
|
|
8864
|
+
return binding;
|
|
8865
|
+
} catch (e) {
|
|
8866
|
+
loadErrors2.push(e);
|
|
8867
|
+
}
|
|
8868
|
+
} else if (process.arch === "s390x") {
|
|
8869
|
+
try {
|
|
8870
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-s390x-gnu.node");})();
|
|
8871
|
+
} catch (e) {
|
|
8872
|
+
loadErrors2.push(e);
|
|
8873
|
+
}
|
|
8874
|
+
try {
|
|
8875
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-s390x-gnu");})();
|
|
8876
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-s390x-gnu/package.json");})().version;
|
|
8877
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8878
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8879
|
+
}
|
|
8880
|
+
return binding;
|
|
8881
|
+
} catch (e) {
|
|
8882
|
+
loadErrors2.push(e);
|
|
8883
|
+
}
|
|
8884
|
+
} else {
|
|
8885
|
+
loadErrors2.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
8886
|
+
}
|
|
8887
|
+
} else if (process.platform === "openharmony") {
|
|
8888
|
+
if (process.arch === "arm64") {
|
|
8889
|
+
try {
|
|
8890
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.openharmony-arm64.node");})();
|
|
8891
|
+
} catch (e) {
|
|
8892
|
+
loadErrors2.push(e);
|
|
8893
|
+
}
|
|
8894
|
+
try {
|
|
8895
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm64");})();
|
|
8896
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm64/package.json");})().version;
|
|
8897
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8898
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8899
|
+
}
|
|
8900
|
+
return binding;
|
|
8901
|
+
} catch (e) {
|
|
8902
|
+
loadErrors2.push(e);
|
|
8903
|
+
}
|
|
8904
|
+
} else if (process.arch === "x64") {
|
|
8905
|
+
try {
|
|
8906
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.openharmony-x64.node");})();
|
|
8907
|
+
} catch (e) {
|
|
8908
|
+
loadErrors2.push(e);
|
|
8909
|
+
}
|
|
8910
|
+
try {
|
|
8911
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-x64");})();
|
|
8912
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-x64/package.json");})().version;
|
|
8913
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8914
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8915
|
+
}
|
|
8916
|
+
return binding;
|
|
8917
|
+
} catch (e) {
|
|
8918
|
+
loadErrors2.push(e);
|
|
8919
|
+
}
|
|
8920
|
+
} else if (process.arch === "arm") {
|
|
8921
|
+
try {
|
|
8922
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.openharmony-arm.node");})();
|
|
8923
|
+
} catch (e) {
|
|
8924
|
+
loadErrors2.push(e);
|
|
8925
|
+
}
|
|
8926
|
+
try {
|
|
8927
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm");})();
|
|
8928
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm/package.json");})().version;
|
|
8929
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8930
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8931
|
+
}
|
|
8932
|
+
return binding;
|
|
8933
|
+
} catch (e) {
|
|
8934
|
+
loadErrors2.push(e);
|
|
8935
|
+
}
|
|
8936
|
+
} else {
|
|
8937
|
+
loadErrors2.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
8938
|
+
}
|
|
8939
|
+
} else {
|
|
8940
|
+
loadErrors2.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
8941
|
+
}
|
|
8942
|
+
}
|
|
8943
|
+
nativeBinding2 = requireNative2();
|
|
8944
|
+
if (!nativeBinding2 || process.env.NAPI_RS_FORCE_WASI) {
|
|
8945
|
+
let wasiBinding = null;
|
|
8946
|
+
let wasiBindingError = null;
|
|
8947
|
+
try {
|
|
8948
|
+
wasiBinding = (()=>{throw new Error("Cannot require module "+"./resolver.wasi.cjs");})();
|
|
8949
|
+
nativeBinding2 = wasiBinding;
|
|
8950
|
+
} catch (err) {
|
|
8951
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
8952
|
+
wasiBindingError = err;
|
|
8953
|
+
}
|
|
8954
|
+
}
|
|
8955
|
+
if (!nativeBinding2) {
|
|
8956
|
+
try {
|
|
8957
|
+
wasiBinding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-wasm32-wasi");})();
|
|
8958
|
+
nativeBinding2 = wasiBinding;
|
|
8959
|
+
} catch (err) {
|
|
8960
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
8961
|
+
wasiBindingError.cause = err;
|
|
8962
|
+
loadErrors2.push(err);
|
|
8963
|
+
}
|
|
8964
|
+
}
|
|
8965
|
+
}
|
|
8966
|
+
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
|
|
8967
|
+
const error2 = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
|
8968
|
+
error2.cause = wasiBindingError;
|
|
8969
|
+
throw error2;
|
|
8970
|
+
}
|
|
8971
|
+
}
|
|
8972
|
+
if (!nativeBinding2 && globalThis.process?.versions?.["webcontainer"]) {
|
|
8973
|
+
try {
|
|
8974
|
+
nativeBinding2 = require_webcontainer_fallback();
|
|
8975
|
+
} catch (err) {
|
|
8976
|
+
loadErrors2.push(err);
|
|
8977
|
+
}
|
|
8978
|
+
}
|
|
8979
|
+
if (!nativeBinding2) {
|
|
8980
|
+
if (loadErrors2.length > 0) {
|
|
8981
|
+
throw new Error(`Cannot find native binding. ` + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + "Please try `npm i` again after removing both package-lock.json and node_modules directory.", {
|
|
8982
|
+
cause: loadErrors2.reduce((err, cur) => {
|
|
8983
|
+
cur.cause = err;
|
|
8984
|
+
return cur;
|
|
8985
|
+
})
|
|
8986
|
+
});
|
|
8987
|
+
}
|
|
8988
|
+
throw new Error(`Failed to load native binding`);
|
|
8989
|
+
}
|
|
8990
|
+
module3.exports = nativeBinding2;
|
|
8991
|
+
module3.exports.ResolverFactory = nativeBinding2.ResolverFactory;
|
|
8992
|
+
module3.exports.EnforceExtension = nativeBinding2.EnforceExtension;
|
|
8993
|
+
module3.exports.ModuleType = nativeBinding2.ModuleType;
|
|
8994
|
+
module3.exports.sync = nativeBinding2.sync;
|
|
8995
|
+
if (process.versions.pnp) {
|
|
8996
|
+
process.env.OXC_RESOLVER_YARN_PNP = "1";
|
|
8997
|
+
}
|
|
8998
|
+
});
|
|
8999
|
+
|
|
9000
|
+
// src/rules/ban-instances.ts
|
|
9001
|
+
import { TSESTree } from "@typescript-eslint/types";
|
|
9002
|
+
|
|
9003
|
+
// node_modules/typebox/build/system/memory/memory.mjs
|
|
9004
|
+
var exports_memory = {};
|
|
9005
|
+
__export(exports_memory, {
|
|
9006
|
+
Update: () => Update,
|
|
9007
|
+
Metrics: () => Metrics,
|
|
9008
|
+
Discard: () => Discard,
|
|
9009
|
+
Create: () => Create,
|
|
9010
|
+
Clone: () => Clone,
|
|
9011
|
+
Assign: () => Assign
|
|
9012
|
+
});
|
|
9013
|
+
|
|
9014
|
+
// node_modules/typebox/build/system/memory/metrics.mjs
|
|
9015
|
+
var Metrics = {
|
|
9016
|
+
assign: 0,
|
|
9017
|
+
create: 0,
|
|
9018
|
+
clone: 0,
|
|
9019
|
+
discard: 0,
|
|
9020
|
+
update: 0
|
|
9021
|
+
};
|
|
9022
|
+
|
|
9023
|
+
// node_modules/typebox/build/system/memory/assign.mjs
|
|
9024
|
+
function Assign(left, right) {
|
|
9025
|
+
Metrics.assign += 1;
|
|
9026
|
+
return { ...left, ...right };
|
|
9027
|
+
}
|
|
9028
|
+
// node_modules/typebox/build/guard/emit.mjs
|
|
9029
|
+
var exports_emit = {};
|
|
9030
|
+
__export(exports_emit, {
|
|
9031
|
+
Ternary: () => Ternary,
|
|
9032
|
+
StringGraphemeCount: () => StringGraphemeCount2,
|
|
9033
|
+
Statements: () => Statements,
|
|
9034
|
+
Return: () => Return,
|
|
9035
|
+
ReduceOr: () => ReduceOr,
|
|
9036
|
+
ReduceAnd: () => ReduceAnd,
|
|
9037
|
+
PrefixIncrement: () => PrefixIncrement,
|
|
9038
|
+
Or: () => Or,
|
|
9039
|
+
Not: () => Not,
|
|
9040
|
+
New: () => New,
|
|
9041
|
+
MultipleOf: () => MultipleOf,
|
|
9042
|
+
Member: () => Member,
|
|
9043
|
+
Keys: () => Keys2,
|
|
9044
|
+
IsUndefined: () => IsUndefined2,
|
|
9045
|
+
IsSymbol: () => IsSymbol2,
|
|
9046
|
+
IsString: () => IsString2,
|
|
9047
|
+
IsObjectNotArray: () => IsObjectNotArray2,
|
|
9048
|
+
IsObject: () => IsObject2,
|
|
9049
|
+
IsNumber: () => IsNumber2,
|
|
9050
|
+
IsNull: () => IsNull2,
|
|
9051
|
+
IsLessThan: () => IsLessThan2,
|
|
9052
|
+
IsLessEqualThan: () => IsLessEqualThan2,
|
|
9053
|
+
IsIterator: () => IsIterator2,
|
|
9054
|
+
IsInteger: () => IsInteger2,
|
|
9055
|
+
IsGreaterThan: () => IsGreaterThan2,
|
|
9056
|
+
IsGreaterEqualThan: () => IsGreaterEqualThan2,
|
|
9057
|
+
IsFunction: () => IsFunction2,
|
|
9058
|
+
IsEqual: () => IsEqual2,
|
|
9059
|
+
IsDeepEqual: () => IsDeepEqual2,
|
|
9060
|
+
IsConstructor: () => IsConstructor2,
|
|
9061
|
+
IsBoolean: () => IsBoolean2,
|
|
9062
|
+
IsBigInt: () => IsBigInt2,
|
|
9063
|
+
IsAsyncIterator: () => IsAsyncIterator2,
|
|
9064
|
+
IsArray: () => IsArray2,
|
|
9065
|
+
If: () => If,
|
|
9066
|
+
HasPropertyKey: () => HasPropertyKey2,
|
|
9067
|
+
Every: () => Every2,
|
|
9068
|
+
Entries: () => Entries2,
|
|
9069
|
+
Constant: () => Constant,
|
|
9070
|
+
ConstDeclaration: () => ConstDeclaration,
|
|
9071
|
+
Call: () => Call,
|
|
9072
|
+
ArrowFunction: () => ArrowFunction,
|
|
9073
|
+
ArrayLiteral: () => ArrayLiteral,
|
|
9074
|
+
And: () => And
|
|
9075
|
+
});
|
|
9076
|
+
|
|
9077
|
+
// node_modules/typebox/build/guard/guard.mjs
|
|
9078
|
+
var exports_guard = {};
|
|
9079
|
+
__export(exports_guard, {
|
|
9080
|
+
Values: () => Values,
|
|
9081
|
+
Symbols: () => Symbols,
|
|
9082
|
+
StringGraphemeCount: () => StringGraphemeCount,
|
|
9083
|
+
Keys: () => Keys,
|
|
9084
|
+
IsValueLike: () => IsValueLike,
|
|
9085
|
+
IsUndefined: () => IsUndefined,
|
|
9086
|
+
IsSymbol: () => IsSymbol,
|
|
9087
|
+
IsString: () => IsString,
|
|
9088
|
+
IsObjectNotArray: () => IsObjectNotArray,
|
|
9089
|
+
IsObject: () => IsObject,
|
|
9090
|
+
IsNumber: () => IsNumber,
|
|
9091
|
+
IsNull: () => IsNull,
|
|
9092
|
+
IsMultipleOf: () => IsMultipleOf,
|
|
9093
|
+
IsLessThan: () => IsLessThan,
|
|
9094
|
+
IsLessEqualThan: () => IsLessEqualThan,
|
|
9095
|
+
IsIterator: () => IsIterator,
|
|
9096
|
+
IsInteger: () => IsInteger,
|
|
9097
|
+
IsGreaterThan: () => IsGreaterThan,
|
|
9098
|
+
IsGreaterEqualThan: () => IsGreaterEqualThan,
|
|
9099
|
+
IsFunction: () => IsFunction,
|
|
9100
|
+
IsEqual: () => IsEqual,
|
|
9101
|
+
IsDeepEqual: () => IsDeepEqual,
|
|
9102
|
+
IsConstructor: () => IsConstructor,
|
|
9103
|
+
IsClassInstance: () => IsClassInstance,
|
|
9104
|
+
IsBoolean: () => IsBoolean,
|
|
9105
|
+
IsBigInt: () => IsBigInt,
|
|
9106
|
+
IsAsyncIterator: () => IsAsyncIterator,
|
|
9107
|
+
IsArray: () => IsArray,
|
|
9108
|
+
HasPropertyKey: () => HasPropertyKey,
|
|
9109
|
+
EveryAll: () => EveryAll,
|
|
9110
|
+
Every: () => Every,
|
|
9111
|
+
EntriesRegExp: () => EntriesRegExp,
|
|
9112
|
+
Entries: () => Entries
|
|
9113
|
+
});
|
|
9114
|
+
function IsArray(value) {
|
|
9115
|
+
return Array.isArray(value);
|
|
9116
|
+
}
|
|
9117
|
+
function IsAsyncIterator(value) {
|
|
7599
9118
|
return IsObject(value) && Symbol.asyncIterator in value;
|
|
7600
9119
|
}
|
|
7601
9120
|
function IsBigInt(value) {
|
|
@@ -15435,19 +16954,17 @@ function normalizeConfig(options3) {
|
|
|
15435
16954
|
if (!isOptionsObject.Check(options3))
|
|
15436
16955
|
return { bannedClasses: new Map };
|
|
15437
16956
|
const { bannedInstances } = options3;
|
|
16957
|
+
const bannedClasses = new Map;
|
|
15438
16958
|
if (isArrayConfig.Check(bannedInstances)) {
|
|
15439
|
-
const
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
for (const [className, message] of Object.entries(bannedInstances))
|
|
15447
|
-
map.set(className.toLowerCase(), { message, originalName: className });
|
|
15448
|
-
return { bannedClasses: map };
|
|
16959
|
+
for (const className of bannedInstances) {
|
|
16960
|
+
bannedClasses.set(className.toLowerCase(), { message: undefined, originalName: className });
|
|
16961
|
+
}
|
|
16962
|
+
} else if (isObjectConfig.Check(bannedInstances)) {
|
|
16963
|
+
for (const [className, message] of Object.entries(bannedInstances)) {
|
|
16964
|
+
bannedClasses.set(className.toLowerCase(), { message, originalName: className });
|
|
16965
|
+
}
|
|
15449
16966
|
}
|
|
15450
|
-
return { bannedClasses
|
|
16967
|
+
return { bannedClasses };
|
|
15451
16968
|
}
|
|
15452
16969
|
var docs = {
|
|
15453
16970
|
description: "Ban specified Roblox Instance classes in new Instance() calls and JSX elements.",
|
|
@@ -15554,10 +17071,11 @@ var banReactFC = {
|
|
|
15554
17071
|
return;
|
|
15555
17072
|
const { typeName } = inner;
|
|
15556
17073
|
let isBannedFc = false;
|
|
15557
|
-
if (typeName.type === TSESTree2.AST_NODE_TYPES.Identifier)
|
|
17074
|
+
if (typeName.type === TSESTree2.AST_NODE_TYPES.Identifier) {
|
|
15558
17075
|
isBannedFc = BANNED_FC_NAMES.has(typeName.name);
|
|
15559
|
-
else if (typeName.type === TSESTree2.AST_NODE_TYPES.TSQualifiedName)
|
|
17076
|
+
} else if (typeName.type === TSESTree2.AST_NODE_TYPES.TSQualifiedName) {
|
|
15560
17077
|
isBannedFc = BANNED_FC_NAMES.has(typeName.right.name);
|
|
17078
|
+
}
|
|
15561
17079
|
if (!isBannedFc || node.init?.type !== TSESTree2.AST_NODE_TYPES.ArrowFunctionExpression)
|
|
15562
17080
|
return;
|
|
15563
17081
|
context.report({
|
|
@@ -15592,22 +17110,15 @@ var DEFAULT_CONFIGURATION = {
|
|
|
15592
17110
|
performanceMode: true,
|
|
15593
17111
|
warnThreshold: 15
|
|
15594
17112
|
};
|
|
15595
|
-
var SHOULD_NOT_NOT_RETURN_TYPE = new Set([
|
|
15596
|
-
TSESTree3.AST_NODE_TYPES.FunctionDeclaration,
|
|
15597
|
-
TSESTree3.AST_NODE_TYPES.FunctionExpression
|
|
15598
|
-
]);
|
|
15599
17113
|
function hasTypeAnnotationProperty(node) {
|
|
15600
17114
|
return "typeAnnotation" in node;
|
|
15601
17115
|
}
|
|
15602
17116
|
function hasTypeAnnotation(node) {
|
|
15603
|
-
if (node.type
|
|
15604
|
-
return
|
|
15605
|
-
if (
|
|
15606
|
-
return
|
|
15607
|
-
return
|
|
15608
|
-
}
|
|
15609
|
-
function getTypeName(node) {
|
|
15610
|
-
return node.type === TSESTree3.AST_NODE_TYPES.TSInterfaceDeclaration || node.type === TSESTree3.AST_NODE_TYPES.TSTypeAliasDeclaration ? node.id.name : undefined;
|
|
17117
|
+
if (node.id.type !== TSESTree3.AST_NODE_TYPES.Identifier)
|
|
17118
|
+
return false;
|
|
17119
|
+
if (typeof node.id !== "object" || !hasTypeAnnotationProperty(node.id))
|
|
17120
|
+
return false;
|
|
17121
|
+
return Boolean(node.id.typeAnnotation);
|
|
15611
17122
|
}
|
|
15612
17123
|
function isIanitorValidator(node) {
|
|
15613
17124
|
return node.type === TSESTree3.AST_NODE_TYPES.CallExpression && node.callee?.type === TSESTree3.AST_NODE_TYPES.MemberExpression && node.callee.object?.type === TSESTree3.AST_NODE_TYPES.Identifier && node.callee.object.name === "Ianitor";
|
|
@@ -15620,9 +17131,10 @@ function extractIanitorStaticVariable(typeAnnotation) {
|
|
|
15620
17131
|
if (currentType.type !== TSESTree3.AST_NODE_TYPES.TSTypeReference)
|
|
15621
17132
|
return;
|
|
15622
17133
|
const { typeName, typeArguments } = currentType;
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
17134
|
+
if (typeName.type === TSESTree3.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.left.name === "Ianitor" && typeName.right.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.right.name === "Static") {
|
|
17135
|
+
const first = typeArguments?.params[0];
|
|
17136
|
+
const name = first?.type === TSESTree3.AST_NODE_TYPES.TSTypeQuery && first.exprName.type === TSESTree3.AST_NODE_TYPES.Identifier ? first.exprName.name : undefined;
|
|
17137
|
+
return name;
|
|
15626
17138
|
}
|
|
15627
17139
|
return;
|
|
15628
17140
|
}
|
|
@@ -15728,8 +17240,9 @@ var enforceIanitorCheckType = createRule({
|
|
|
15728
17240
|
score = addScore(score, body.length * 2);
|
|
15729
17241
|
for (const member of body) {
|
|
15730
17242
|
const typeAnnotation = "typeAnnotation" in member ? member.typeAnnotation : undefined;
|
|
15731
|
-
if (typeAnnotation)
|
|
17243
|
+
if (typeAnnotation !== undefined) {
|
|
15732
17244
|
score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
|
|
17245
|
+
}
|
|
15733
17246
|
}
|
|
15734
17247
|
break;
|
|
15735
17248
|
}
|
|
@@ -15738,8 +17251,9 @@ var enforceIanitorCheckType = createRule({
|
|
|
15738
17251
|
score = 2 + members.length * 0.5;
|
|
15739
17252
|
for (const member of members) {
|
|
15740
17253
|
const typeAnnotation = "typeAnnotation" in member ? member.typeAnnotation : undefined;
|
|
15741
|
-
if (typeAnnotation)
|
|
17254
|
+
if (typeAnnotation !== undefined) {
|
|
15742
17255
|
score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
|
|
17256
|
+
}
|
|
15743
17257
|
}
|
|
15744
17258
|
break;
|
|
15745
17259
|
}
|
|
@@ -15764,9 +17278,10 @@ var enforceIanitorCheckType = createRule({
|
|
|
15764
17278
|
const { elementTypes } = node;
|
|
15765
17279
|
score = 1;
|
|
15766
17280
|
for (const element of elementTypes) {
|
|
15767
|
-
const
|
|
15768
|
-
if (
|
|
17281
|
+
const { type: type3 } = element;
|
|
17282
|
+
if (type3 !== "TSRestType" && type3 !== "TSOptionalType") {
|
|
15769
17283
|
score = addScore(score, calculateStructuralComplexity(element, nextDepth));
|
|
17284
|
+
}
|
|
15770
17285
|
}
|
|
15771
17286
|
score = addScore(score, 1.5 * elementTypes.length);
|
|
15772
17287
|
break;
|
|
@@ -15774,9 +17289,10 @@ var enforceIanitorCheckType = createRule({
|
|
|
15774
17289
|
case TSESTree3.AST_NODE_TYPES.TSTypeReference: {
|
|
15775
17290
|
score = 2;
|
|
15776
17291
|
const { typeArguments } = node;
|
|
15777
|
-
if (typeArguments) {
|
|
15778
|
-
for (const
|
|
15779
|
-
score = addScore(score, calculateStructuralComplexity(
|
|
17292
|
+
if (typeArguments !== undefined) {
|
|
17293
|
+
for (const parameter2 of typeArguments.params) {
|
|
17294
|
+
score = addScore(score, calculateStructuralComplexity(parameter2, nextDepth) + 2);
|
|
17295
|
+
}
|
|
15780
17296
|
}
|
|
15781
17297
|
break;
|
|
15782
17298
|
}
|
|
@@ -15790,22 +17306,26 @@ var enforceIanitorCheckType = createRule({
|
|
|
15790
17306
|
}
|
|
15791
17307
|
case TSESTree3.AST_NODE_TYPES.TSMappedType: {
|
|
15792
17308
|
score = 5;
|
|
15793
|
-
if (node
|
|
17309
|
+
if ("constraint" in node) {
|
|
15794
17310
|
score = addScore(score, calculateStructuralComplexity(node.constraint, nextDepth));
|
|
15795
|
-
|
|
17311
|
+
}
|
|
17312
|
+
if (node.typeAnnotation !== undefined) {
|
|
15796
17313
|
score = addScore(score, calculateStructuralComplexity(node.typeAnnotation, nextDepth));
|
|
17314
|
+
}
|
|
15797
17315
|
break;
|
|
15798
17316
|
}
|
|
15799
17317
|
case TSESTree3.AST_NODE_TYPES.TSFunctionType:
|
|
15800
17318
|
case TSESTree3.AST_NODE_TYPES.TSMethodSignature: {
|
|
15801
17319
|
score = 2;
|
|
15802
|
-
for (const
|
|
15803
|
-
const typeAnnotation = "typeAnnotation" in
|
|
15804
|
-
if (typeAnnotation)
|
|
17320
|
+
for (const parameter2 of node.params) {
|
|
17321
|
+
const typeAnnotation = "typeAnnotation" in parameter2 ? parameter2.typeAnnotation : undefined;
|
|
17322
|
+
if (typeAnnotation !== undefined) {
|
|
15805
17323
|
score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
|
|
17324
|
+
}
|
|
15806
17325
|
}
|
|
15807
|
-
if (node.returnType)
|
|
17326
|
+
if (node.returnType !== undefined) {
|
|
15808
17327
|
score = addScore(score, calculateStructuralComplexity(node.returnType.typeAnnotation, nextDepth));
|
|
17328
|
+
}
|
|
15809
17329
|
break;
|
|
15810
17330
|
}
|
|
15811
17331
|
default:
|
|
@@ -15820,8 +17340,9 @@ var enforceIanitorCheckType = createRule({
|
|
|
15820
17340
|
return {
|
|
15821
17341
|
"Program:exit"() {
|
|
15822
17342
|
for (const [node, data] of variableDeclaratorsToCheck.entries()) {
|
|
15823
|
-
if (node.id.type === TSESTree3.AST_NODE_TYPES.Identifier && ianitorStaticVariables.has(node.id.name))
|
|
17343
|
+
if (node.id.type === TSESTree3.AST_NODE_TYPES.Identifier && ianitorStaticVariables.has(node.id.name)) {
|
|
15824
17344
|
continue;
|
|
17345
|
+
}
|
|
15825
17346
|
context.report({
|
|
15826
17347
|
data: { score: data.complexity.toFixed(1) },
|
|
15827
17348
|
messageId: "missingIanitorCheckType",
|
|
@@ -15831,10 +17352,10 @@ var enforceIanitorCheckType = createRule({
|
|
|
15831
17352
|
},
|
|
15832
17353
|
TSInterfaceDeclaration(node) {
|
|
15833
17354
|
const complexity = calculateStructuralComplexity(node);
|
|
15834
|
-
const name =
|
|
17355
|
+
const { name } = node.id;
|
|
15835
17356
|
if (complexity >= config.interfacePenalty) {
|
|
15836
17357
|
context.report({
|
|
15837
|
-
data: { name
|
|
17358
|
+
data: { name },
|
|
15838
17359
|
messageId: "complexInterfaceNeedsCheck",
|
|
15839
17360
|
node
|
|
15840
17361
|
});
|
|
@@ -15842,7 +17363,7 @@ var enforceIanitorCheckType = createRule({
|
|
|
15842
17363
|
},
|
|
15843
17364
|
TSTypeAliasDeclaration(node) {
|
|
15844
17365
|
const variableName = extractIanitorStaticVariable(node.typeAnnotation);
|
|
15845
|
-
if (variableName)
|
|
17366
|
+
if (variableName !== undefined)
|
|
15846
17367
|
ianitorStaticVariables.add(variableName);
|
|
15847
17368
|
if (hasIanitorStaticType(node.typeAnnotation))
|
|
15848
17369
|
return;
|
|
@@ -15867,60 +17388,498 @@ var enforceIanitorCheckType = createRule({
|
|
|
15867
17388
|
return;
|
|
15868
17389
|
variableDeclaratorsToCheck.set(node, { complexity });
|
|
15869
17390
|
}
|
|
15870
|
-
};
|
|
15871
|
-
},
|
|
15872
|
-
defaultOptions: [DEFAULT_CONFIGURATION],
|
|
15873
|
-
meta: {
|
|
15874
|
-
docs: {
|
|
15875
|
-
description: "Enforce Ianitor.Check<T> type annotations on complex TypeScript types"
|
|
15876
|
-
},
|
|
15877
|
-
messages: {
|
|
15878
|
-
complexInterfaceNeedsCheck: "Interface '{{name}}' requires Ianitor.Check<T> annotation (interfaces always need explicit checking)",
|
|
15879
|
-
missingIanitorCheckType: "Complex type (score: {{score}}) requires Ianitor.Check<T> annotation for type safety"
|
|
15880
|
-
},
|
|
15881
|
-
schema: [
|
|
15882
|
-
{
|
|
15883
|
-
additionalProperties: false,
|
|
15884
|
-
properties: {
|
|
15885
|
-
baseThreshold: { minimum: 1, type: "number" },
|
|
15886
|
-
errorThreshold: { minimum: 1, type: "number" },
|
|
15887
|
-
interfacePenalty: { minimum: 1, type: "number" },
|
|
15888
|
-
performanceMode: { type: "boolean" },
|
|
15889
|
-
warnThreshold: { minimum: 1, type: "number" }
|
|
15890
|
-
},
|
|
15891
|
-
type: "object"
|
|
17391
|
+
};
|
|
17392
|
+
},
|
|
17393
|
+
defaultOptions: [DEFAULT_CONFIGURATION],
|
|
17394
|
+
meta: {
|
|
17395
|
+
docs: {
|
|
17396
|
+
description: "Enforce Ianitor.Check<T> type annotations on complex TypeScript types"
|
|
17397
|
+
},
|
|
17398
|
+
messages: {
|
|
17399
|
+
complexInterfaceNeedsCheck: "Interface '{{name}}' requires Ianitor.Check<T> annotation (interfaces always need explicit checking)",
|
|
17400
|
+
missingIanitorCheckType: "Complex type (score: {{score}}) requires Ianitor.Check<T> annotation for type safety"
|
|
17401
|
+
},
|
|
17402
|
+
schema: [
|
|
17403
|
+
{
|
|
17404
|
+
additionalProperties: false,
|
|
17405
|
+
properties: {
|
|
17406
|
+
baseThreshold: { minimum: 1, type: "number" },
|
|
17407
|
+
errorThreshold: { minimum: 1, type: "number" },
|
|
17408
|
+
interfacePenalty: { minimum: 1, type: "number" },
|
|
17409
|
+
performanceMode: { type: "boolean" },
|
|
17410
|
+
warnThreshold: { minimum: 1, type: "number" }
|
|
17411
|
+
},
|
|
17412
|
+
type: "object"
|
|
17413
|
+
}
|
|
17414
|
+
],
|
|
17415
|
+
type: "problem"
|
|
17416
|
+
},
|
|
17417
|
+
name: "enforce-ianitor-check-type"
|
|
17418
|
+
});
|
|
17419
|
+
var enforce_ianitor_check_type_default = enforceIanitorCheckType;
|
|
17420
|
+
|
|
17421
|
+
// src/utilities/format-utilities.ts
|
|
17422
|
+
import { readFileSync } from "node:fs";
|
|
17423
|
+
import { resolve as resolve2 } from "node:path";
|
|
17424
|
+
|
|
17425
|
+
// node_modules/arkregex/out/regex.js
|
|
17426
|
+
var regex2 = (src, flags) => new RegExp(src, flags);
|
|
17427
|
+
Object.assign(regex2, { as: regex2 });
|
|
17428
|
+
// node_modules/confbox/dist/shared/confbox.DA7CpUDY.mjs
|
|
17429
|
+
var m = Symbol.for("__confbox_fmt__");
|
|
17430
|
+
var k = /^(\s+)/;
|
|
17431
|
+
var v = /(\s+)$/;
|
|
17432
|
+
function x(e, t = {}) {
|
|
17433
|
+
const n = t.indent === undefined && t.preserveIndentation !== false && e.slice(0, t?.sampleSize || 1024), s = t.preserveWhitespace === false ? undefined : { start: k.exec(e)?.[0] || "", end: v.exec(e)?.[0] || "" };
|
|
17434
|
+
return { sample: n, whiteSpace: s };
|
|
17435
|
+
}
|
|
17436
|
+
function N(e, t, n) {
|
|
17437
|
+
!t || typeof t != "object" || Object.defineProperty(t, m, { enumerable: false, configurable: true, writable: true, value: x(e, n) });
|
|
17438
|
+
}
|
|
17439
|
+
|
|
17440
|
+
// node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs
|
|
17441
|
+
function $(n, l = false) {
|
|
17442
|
+
const g = n.length;
|
|
17443
|
+
let e = 0, u = "", p = 0, k2 = 16, A = 0, o = 0, O = 0, B = 0, b = 0;
|
|
17444
|
+
function I(i, T) {
|
|
17445
|
+
let s = 0, c = 0;
|
|
17446
|
+
for (;s < i; ) {
|
|
17447
|
+
let t = n.charCodeAt(e);
|
|
17448
|
+
if (t >= 48 && t <= 57)
|
|
17449
|
+
c = c * 16 + t - 48;
|
|
17450
|
+
else if (t >= 65 && t <= 70)
|
|
17451
|
+
c = c * 16 + t - 65 + 10;
|
|
17452
|
+
else if (t >= 97 && t <= 102)
|
|
17453
|
+
c = c * 16 + t - 97 + 10;
|
|
17454
|
+
else
|
|
17455
|
+
break;
|
|
17456
|
+
e++, s++;
|
|
17457
|
+
}
|
|
17458
|
+
return s < i && (c = -1), c;
|
|
17459
|
+
}
|
|
17460
|
+
function V(i) {
|
|
17461
|
+
e = i, u = "", p = 0, k2 = 16, b = 0;
|
|
17462
|
+
}
|
|
17463
|
+
function F() {
|
|
17464
|
+
let i = e;
|
|
17465
|
+
if (n.charCodeAt(e) === 48)
|
|
17466
|
+
e++;
|
|
17467
|
+
else
|
|
17468
|
+
for (e++;e < n.length && L(n.charCodeAt(e)); )
|
|
17469
|
+
e++;
|
|
17470
|
+
if (e < n.length && n.charCodeAt(e) === 46)
|
|
17471
|
+
if (e++, e < n.length && L(n.charCodeAt(e)))
|
|
17472
|
+
for (e++;e < n.length && L(n.charCodeAt(e)); )
|
|
17473
|
+
e++;
|
|
17474
|
+
else
|
|
17475
|
+
return b = 3, n.substring(i, e);
|
|
17476
|
+
let T = e;
|
|
17477
|
+
if (e < n.length && (n.charCodeAt(e) === 69 || n.charCodeAt(e) === 101))
|
|
17478
|
+
if (e++, (e < n.length && n.charCodeAt(e) === 43 || n.charCodeAt(e) === 45) && e++, e < n.length && L(n.charCodeAt(e))) {
|
|
17479
|
+
for (e++;e < n.length && L(n.charCodeAt(e)); )
|
|
17480
|
+
e++;
|
|
17481
|
+
T = e;
|
|
17482
|
+
} else
|
|
17483
|
+
b = 3;
|
|
17484
|
+
return n.substring(i, T);
|
|
17485
|
+
}
|
|
17486
|
+
function a() {
|
|
17487
|
+
let i = "", T = e;
|
|
17488
|
+
for (;; ) {
|
|
17489
|
+
if (e >= g) {
|
|
17490
|
+
i += n.substring(T, e), b = 2;
|
|
17491
|
+
break;
|
|
17492
|
+
}
|
|
17493
|
+
const s = n.charCodeAt(e);
|
|
17494
|
+
if (s === 34) {
|
|
17495
|
+
i += n.substring(T, e), e++;
|
|
17496
|
+
break;
|
|
17497
|
+
}
|
|
17498
|
+
if (s === 92) {
|
|
17499
|
+
if (i += n.substring(T, e), e++, e >= g) {
|
|
17500
|
+
b = 2;
|
|
17501
|
+
break;
|
|
17502
|
+
}
|
|
17503
|
+
switch (n.charCodeAt(e++)) {
|
|
17504
|
+
case 34:
|
|
17505
|
+
i += '"';
|
|
17506
|
+
break;
|
|
17507
|
+
case 92:
|
|
17508
|
+
i += "\\";
|
|
17509
|
+
break;
|
|
17510
|
+
case 47:
|
|
17511
|
+
i += "/";
|
|
17512
|
+
break;
|
|
17513
|
+
case 98:
|
|
17514
|
+
i += "\b";
|
|
17515
|
+
break;
|
|
17516
|
+
case 102:
|
|
17517
|
+
i += "\f";
|
|
17518
|
+
break;
|
|
17519
|
+
case 110:
|
|
17520
|
+
i += `
|
|
17521
|
+
`;
|
|
17522
|
+
break;
|
|
17523
|
+
case 114:
|
|
17524
|
+
i += "\r";
|
|
17525
|
+
break;
|
|
17526
|
+
case 116:
|
|
17527
|
+
i += "\t";
|
|
17528
|
+
break;
|
|
17529
|
+
case 117:
|
|
17530
|
+
const t = I(4);
|
|
17531
|
+
t >= 0 ? i += String.fromCharCode(t) : b = 4;
|
|
17532
|
+
break;
|
|
17533
|
+
default:
|
|
17534
|
+
b = 5;
|
|
17535
|
+
}
|
|
17536
|
+
T = e;
|
|
17537
|
+
continue;
|
|
17538
|
+
}
|
|
17539
|
+
if (s >= 0 && s <= 31)
|
|
17540
|
+
if (r(s)) {
|
|
17541
|
+
i += n.substring(T, e), b = 2;
|
|
17542
|
+
break;
|
|
17543
|
+
} else
|
|
17544
|
+
b = 6;
|
|
17545
|
+
e++;
|
|
17546
|
+
}
|
|
17547
|
+
return i;
|
|
17548
|
+
}
|
|
17549
|
+
function w() {
|
|
17550
|
+
if (u = "", b = 0, p = e, o = A, B = O, e >= g)
|
|
17551
|
+
return p = g, k2 = 17;
|
|
17552
|
+
let i = n.charCodeAt(e);
|
|
17553
|
+
if (J(i)) {
|
|
17554
|
+
do
|
|
17555
|
+
e++, u += String.fromCharCode(i), i = n.charCodeAt(e);
|
|
17556
|
+
while (J(i));
|
|
17557
|
+
return k2 = 15;
|
|
17558
|
+
}
|
|
17559
|
+
if (r(i))
|
|
17560
|
+
return e++, u += String.fromCharCode(i), i === 13 && n.charCodeAt(e) === 10 && (e++, u += `
|
|
17561
|
+
`), A++, O = e, k2 = 14;
|
|
17562
|
+
switch (i) {
|
|
17563
|
+
case 123:
|
|
17564
|
+
return e++, k2 = 1;
|
|
17565
|
+
case 125:
|
|
17566
|
+
return e++, k2 = 2;
|
|
17567
|
+
case 91:
|
|
17568
|
+
return e++, k2 = 3;
|
|
17569
|
+
case 93:
|
|
17570
|
+
return e++, k2 = 4;
|
|
17571
|
+
case 58:
|
|
17572
|
+
return e++, k2 = 6;
|
|
17573
|
+
case 44:
|
|
17574
|
+
return e++, k2 = 5;
|
|
17575
|
+
case 34:
|
|
17576
|
+
return e++, u = a(), k2 = 10;
|
|
17577
|
+
case 47:
|
|
17578
|
+
const T = e - 1;
|
|
17579
|
+
if (n.charCodeAt(e + 1) === 47) {
|
|
17580
|
+
for (e += 2;e < g && !r(n.charCodeAt(e)); )
|
|
17581
|
+
e++;
|
|
17582
|
+
return u = n.substring(T, e), k2 = 12;
|
|
17583
|
+
}
|
|
17584
|
+
if (n.charCodeAt(e + 1) === 42) {
|
|
17585
|
+
e += 2;
|
|
17586
|
+
const s = g - 1;
|
|
17587
|
+
let c = false;
|
|
17588
|
+
for (;e < s; ) {
|
|
17589
|
+
const t = n.charCodeAt(e);
|
|
17590
|
+
if (t === 42 && n.charCodeAt(e + 1) === 47) {
|
|
17591
|
+
e += 2, c = true;
|
|
17592
|
+
break;
|
|
17593
|
+
}
|
|
17594
|
+
e++, r(t) && (t === 13 && n.charCodeAt(e) === 10 && e++, A++, O = e);
|
|
17595
|
+
}
|
|
17596
|
+
return c || (e++, b = 1), u = n.substring(T, e), k2 = 13;
|
|
17597
|
+
}
|
|
17598
|
+
return u += String.fromCharCode(i), e++, k2 = 16;
|
|
17599
|
+
case 45:
|
|
17600
|
+
if (u += String.fromCharCode(i), e++, e === g || !L(n.charCodeAt(e)))
|
|
17601
|
+
return k2 = 16;
|
|
17602
|
+
case 48:
|
|
17603
|
+
case 49:
|
|
17604
|
+
case 50:
|
|
17605
|
+
case 51:
|
|
17606
|
+
case 52:
|
|
17607
|
+
case 53:
|
|
17608
|
+
case 54:
|
|
17609
|
+
case 55:
|
|
17610
|
+
case 56:
|
|
17611
|
+
case 57:
|
|
17612
|
+
return u += F(), k2 = 11;
|
|
17613
|
+
default:
|
|
17614
|
+
for (;e < g && v2(i); )
|
|
17615
|
+
e++, i = n.charCodeAt(e);
|
|
17616
|
+
if (p !== e) {
|
|
17617
|
+
switch (u = n.substring(p, e), u) {
|
|
17618
|
+
case "true":
|
|
17619
|
+
return k2 = 8;
|
|
17620
|
+
case "false":
|
|
17621
|
+
return k2 = 9;
|
|
17622
|
+
case "null":
|
|
17623
|
+
return k2 = 7;
|
|
17624
|
+
}
|
|
17625
|
+
return k2 = 16;
|
|
17626
|
+
}
|
|
17627
|
+
return u += String.fromCharCode(i), e++, k2 = 16;
|
|
17628
|
+
}
|
|
17629
|
+
}
|
|
17630
|
+
function v2(i) {
|
|
17631
|
+
if (J(i) || r(i))
|
|
17632
|
+
return false;
|
|
17633
|
+
switch (i) {
|
|
17634
|
+
case 125:
|
|
17635
|
+
case 93:
|
|
17636
|
+
case 123:
|
|
17637
|
+
case 91:
|
|
17638
|
+
case 34:
|
|
17639
|
+
case 58:
|
|
17640
|
+
case 44:
|
|
17641
|
+
case 47:
|
|
17642
|
+
return false;
|
|
17643
|
+
}
|
|
17644
|
+
return true;
|
|
17645
|
+
}
|
|
17646
|
+
function j() {
|
|
17647
|
+
let i;
|
|
17648
|
+
do
|
|
17649
|
+
i = w();
|
|
17650
|
+
while (i >= 12 && i <= 15);
|
|
17651
|
+
return i;
|
|
17652
|
+
}
|
|
17653
|
+
return { setPosition: V, getPosition: () => e, scan: l ? j : w, getToken: () => k2, getTokenValue: () => u, getTokenOffset: () => p, getTokenLength: () => e - p, getTokenStartLine: () => o, getTokenStartCharacter: () => p - B, getTokenError: () => b };
|
|
17654
|
+
}
|
|
17655
|
+
function J(n) {
|
|
17656
|
+
return n === 32 || n === 9;
|
|
17657
|
+
}
|
|
17658
|
+
function r(n) {
|
|
17659
|
+
return n === 10 || n === 13;
|
|
17660
|
+
}
|
|
17661
|
+
function L(n) {
|
|
17662
|
+
return n >= 48 && n <= 57;
|
|
17663
|
+
}
|
|
17664
|
+
var Q;
|
|
17665
|
+
(function(n) {
|
|
17666
|
+
n[n.lineFeed = 10] = "lineFeed", n[n.carriageReturn = 13] = "carriageReturn", n[n.space = 32] = "space", n[n._0 = 48] = "_0", n[n._1 = 49] = "_1", n[n._2 = 50] = "_2", n[n._3 = 51] = "_3", n[n._4 = 52] = "_4", n[n._5 = 53] = "_5", n[n._6 = 54] = "_6", n[n._7 = 55] = "_7", n[n._8 = 56] = "_8", n[n._9 = 57] = "_9", n[n.a = 97] = "a", n[n.b = 98] = "b", n[n.c = 99] = "c", n[n.d = 100] = "d", n[n.e = 101] = "e", n[n.f = 102] = "f", n[n.g = 103] = "g", n[n.h = 104] = "h", n[n.i = 105] = "i", n[n.j = 106] = "j", n[n.k = 107] = "k", n[n.l = 108] = "l", n[n.m = 109] = "m", n[n.n = 110] = "n", n[n.o = 111] = "o", n[n.p = 112] = "p", n[n.q = 113] = "q", n[n.r = 114] = "r", n[n.s = 115] = "s", n[n.t = 116] = "t", n[n.u = 117] = "u", n[n.v = 118] = "v", n[n.w = 119] = "w", n[n.x = 120] = "x", n[n.y = 121] = "y", n[n.z = 122] = "z", n[n.A = 65] = "A", n[n.B = 66] = "B", n[n.C = 67] = "C", n[n.D = 68] = "D", n[n.E = 69] = "E", n[n.F = 70] = "F", n[n.G = 71] = "G", n[n.H = 72] = "H", n[n.I = 73] = "I", n[n.J = 74] = "J", n[n.K = 75] = "K", n[n.L = 76] = "L", n[n.M = 77] = "M", n[n.N = 78] = "N", n[n.O = 79] = "O", n[n.P = 80] = "P", n[n.Q = 81] = "Q", n[n.R = 82] = "R", n[n.S = 83] = "S", n[n.T = 84] = "T", n[n.U = 85] = "U", n[n.V = 86] = "V", n[n.W = 87] = "W", n[n.X = 88] = "X", n[n.Y = 89] = "Y", n[n.Z = 90] = "Z", n[n.asterisk = 42] = "asterisk", n[n.backslash = 92] = "backslash", n[n.closeBrace = 125] = "closeBrace", n[n.closeBracket = 93] = "closeBracket", n[n.colon = 58] = "colon", n[n.comma = 44] = "comma", n[n.dot = 46] = "dot", n[n.doubleQuote = 34] = "doubleQuote", n[n.minus = 45] = "minus", n[n.openBrace = 123] = "openBrace", n[n.openBracket = 91] = "openBracket", n[n.plus = 43] = "plus", n[n.slash = 47] = "slash", n[n.formFeed = 12] = "formFeed", n[n.tab = 9] = "tab";
|
|
17667
|
+
})(Q || (Q = {})), new Array(20).fill(0).map((n, l) => " ".repeat(l));
|
|
17668
|
+
var N2 = 200;
|
|
17669
|
+
new Array(N2).fill(0).map((n, l) => `
|
|
17670
|
+
` + " ".repeat(l)), new Array(N2).fill(0).map((n, l) => "\r" + " ".repeat(l)), new Array(N2).fill(0).map((n, l) => `\r
|
|
17671
|
+
` + " ".repeat(l)), new Array(N2).fill(0).map((n, l) => `
|
|
17672
|
+
` + "\t".repeat(l)), new Array(N2).fill(0).map((n, l) => "\r" + "\t".repeat(l)), new Array(N2).fill(0).map((n, l) => `\r
|
|
17673
|
+
` + "\t".repeat(l));
|
|
17674
|
+
var U;
|
|
17675
|
+
(function(n) {
|
|
17676
|
+
n.DEFAULT = { allowTrailingComma: false };
|
|
17677
|
+
})(U || (U = {}));
|
|
17678
|
+
function S(n, l = [], g = U.DEFAULT) {
|
|
17679
|
+
let e = null, u = [];
|
|
17680
|
+
const p = [];
|
|
17681
|
+
function k2(o) {
|
|
17682
|
+
Array.isArray(u) ? u.push(o) : e !== null && (u[e] = o);
|
|
17683
|
+
}
|
|
17684
|
+
return P(n, { onObjectBegin: () => {
|
|
17685
|
+
const o = {};
|
|
17686
|
+
k2(o), p.push(u), u = o, e = null;
|
|
17687
|
+
}, onObjectProperty: (o) => {
|
|
17688
|
+
e = o;
|
|
17689
|
+
}, onObjectEnd: () => {
|
|
17690
|
+
u = p.pop();
|
|
17691
|
+
}, onArrayBegin: () => {
|
|
17692
|
+
const o = [];
|
|
17693
|
+
k2(o), p.push(u), u = o, e = null;
|
|
17694
|
+
}, onArrayEnd: () => {
|
|
17695
|
+
u = p.pop();
|
|
17696
|
+
}, onLiteralValue: k2, onError: (o, O, B) => {
|
|
17697
|
+
l.push({ error: o, offset: O, length: B });
|
|
17698
|
+
} }, g), u[0];
|
|
17699
|
+
}
|
|
17700
|
+
function P(n, l, g = U.DEFAULT) {
|
|
17701
|
+
const e = $(n, false), u = [];
|
|
17702
|
+
let p = 0;
|
|
17703
|
+
function k2(f) {
|
|
17704
|
+
return f ? () => p === 0 && f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter()) : () => true;
|
|
17705
|
+
}
|
|
17706
|
+
function A(f) {
|
|
17707
|
+
return f ? (m2) => p === 0 && f(m2, e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter()) : () => true;
|
|
17708
|
+
}
|
|
17709
|
+
function o(f) {
|
|
17710
|
+
return f ? (m2) => p === 0 && f(m2, e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter(), () => u.slice()) : () => true;
|
|
17711
|
+
}
|
|
17712
|
+
function O(f) {
|
|
17713
|
+
return f ? () => {
|
|
17714
|
+
p > 0 ? p++ : f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter(), () => u.slice()) === false && (p = 1);
|
|
17715
|
+
} : () => true;
|
|
17716
|
+
}
|
|
17717
|
+
function B(f) {
|
|
17718
|
+
return f ? () => {
|
|
17719
|
+
p > 0 && p--, p === 0 && f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter());
|
|
17720
|
+
} : () => true;
|
|
17721
|
+
}
|
|
17722
|
+
const b = O(l.onObjectBegin), I = o(l.onObjectProperty), V = B(l.onObjectEnd), F = O(l.onArrayBegin), a = B(l.onArrayEnd), w = o(l.onLiteralValue), v2 = A(l.onSeparator), j = k2(l.onComment), i = A(l.onError), T = g && g.disallowComments, s = g && g.allowTrailingComma;
|
|
17723
|
+
function c() {
|
|
17724
|
+
for (;; ) {
|
|
17725
|
+
const f = e.scan();
|
|
17726
|
+
switch (e.getTokenError()) {
|
|
17727
|
+
case 4:
|
|
17728
|
+
t(14);
|
|
17729
|
+
break;
|
|
17730
|
+
case 5:
|
|
17731
|
+
t(15);
|
|
17732
|
+
break;
|
|
17733
|
+
case 3:
|
|
17734
|
+
t(13);
|
|
17735
|
+
break;
|
|
17736
|
+
case 1:
|
|
17737
|
+
T || t(11);
|
|
17738
|
+
break;
|
|
17739
|
+
case 2:
|
|
17740
|
+
t(12);
|
|
17741
|
+
break;
|
|
17742
|
+
case 6:
|
|
17743
|
+
t(16);
|
|
17744
|
+
break;
|
|
17745
|
+
}
|
|
17746
|
+
switch (f) {
|
|
17747
|
+
case 12:
|
|
17748
|
+
case 13:
|
|
17749
|
+
T ? t(10) : j();
|
|
17750
|
+
break;
|
|
17751
|
+
case 16:
|
|
17752
|
+
t(1);
|
|
17753
|
+
break;
|
|
17754
|
+
case 15:
|
|
17755
|
+
case 14:
|
|
17756
|
+
break;
|
|
17757
|
+
default:
|
|
17758
|
+
return f;
|
|
15892
17759
|
}
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
17760
|
+
}
|
|
17761
|
+
}
|
|
17762
|
+
function t(f, m2 = [], y = []) {
|
|
17763
|
+
if (i(f), m2.length + y.length > 0) {
|
|
17764
|
+
let _ = e.getToken();
|
|
17765
|
+
for (;_ !== 17; ) {
|
|
17766
|
+
if (m2.indexOf(_) !== -1) {
|
|
17767
|
+
c();
|
|
17768
|
+
break;
|
|
17769
|
+
} else if (y.indexOf(_) !== -1)
|
|
17770
|
+
break;
|
|
17771
|
+
_ = c();
|
|
17772
|
+
}
|
|
17773
|
+
}
|
|
17774
|
+
}
|
|
17775
|
+
function D(f) {
|
|
17776
|
+
const m2 = e.getTokenValue();
|
|
17777
|
+
return f ? w(m2) : (I(m2), u.push(m2)), c(), true;
|
|
17778
|
+
}
|
|
17779
|
+
function G() {
|
|
17780
|
+
switch (e.getToken()) {
|
|
17781
|
+
case 11:
|
|
17782
|
+
const f = e.getTokenValue();
|
|
17783
|
+
let m2 = Number(f);
|
|
17784
|
+
isNaN(m2) && (t(2), m2 = 0), w(m2);
|
|
17785
|
+
break;
|
|
17786
|
+
case 7:
|
|
17787
|
+
w(null);
|
|
17788
|
+
break;
|
|
17789
|
+
case 8:
|
|
17790
|
+
w(true);
|
|
17791
|
+
break;
|
|
17792
|
+
case 9:
|
|
17793
|
+
w(false);
|
|
17794
|
+
break;
|
|
17795
|
+
default:
|
|
17796
|
+
return false;
|
|
17797
|
+
}
|
|
17798
|
+
return c(), true;
|
|
17799
|
+
}
|
|
17800
|
+
function M() {
|
|
17801
|
+
return e.getToken() !== 10 ? (t(3, [], [2, 5]), false) : (D(false), e.getToken() === 6 ? (v2(":"), c(), E() || t(4, [], [2, 5])) : t(5, [], [2, 5]), u.pop(), true);
|
|
17802
|
+
}
|
|
17803
|
+
function X() {
|
|
17804
|
+
b(), c();
|
|
17805
|
+
let f = false;
|
|
17806
|
+
for (;e.getToken() !== 2 && e.getToken() !== 17; ) {
|
|
17807
|
+
if (e.getToken() === 5) {
|
|
17808
|
+
if (f || t(4, [], []), v2(","), c(), e.getToken() === 2 && s)
|
|
17809
|
+
break;
|
|
17810
|
+
} else
|
|
17811
|
+
f && t(6, [], []);
|
|
17812
|
+
M() || t(4, [], [2, 5]), f = true;
|
|
17813
|
+
}
|
|
17814
|
+
return V(), e.getToken() !== 2 ? t(7, [2], []) : c(), true;
|
|
17815
|
+
}
|
|
17816
|
+
function Y() {
|
|
17817
|
+
F(), c();
|
|
17818
|
+
let f = true, m2 = false;
|
|
17819
|
+
for (;e.getToken() !== 4 && e.getToken() !== 17; ) {
|
|
17820
|
+
if (e.getToken() === 5) {
|
|
17821
|
+
if (m2 || t(4, [], []), v2(","), c(), e.getToken() === 4 && s)
|
|
17822
|
+
break;
|
|
17823
|
+
} else
|
|
17824
|
+
m2 && t(6, [], []);
|
|
17825
|
+
f ? (u.push(0), f = false) : u[u.length - 1]++, E() || t(4, [], [4, 5]), m2 = true;
|
|
17826
|
+
}
|
|
17827
|
+
return a(), f || u.pop(), e.getToken() !== 4 ? t(8, [4], []) : c(), true;
|
|
17828
|
+
}
|
|
17829
|
+
function E() {
|
|
17830
|
+
switch (e.getToken()) {
|
|
17831
|
+
case 3:
|
|
17832
|
+
return Y();
|
|
17833
|
+
case 1:
|
|
17834
|
+
return X();
|
|
17835
|
+
case 10:
|
|
17836
|
+
return D(true);
|
|
17837
|
+
default:
|
|
17838
|
+
return G();
|
|
17839
|
+
}
|
|
17840
|
+
}
|
|
17841
|
+
return c(), e.getToken() === 17 ? g.allowEmptyContent ? true : (t(4, [], []), false) : E() ? (e.getToken() !== 17 && t(9, [], []), true) : (t(4, [], []), false);
|
|
17842
|
+
}
|
|
17843
|
+
var W;
|
|
17844
|
+
(function(n) {
|
|
17845
|
+
n[n.None = 0] = "None", n[n.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", n[n.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", n[n.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", n[n.InvalidUnicode = 4] = "InvalidUnicode", n[n.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", n[n.InvalidCharacter = 6] = "InvalidCharacter";
|
|
17846
|
+
})(W || (W = {}));
|
|
17847
|
+
var H;
|
|
17848
|
+
(function(n) {
|
|
17849
|
+
n[n.OpenBraceToken = 1] = "OpenBraceToken", n[n.CloseBraceToken = 2] = "CloseBraceToken", n[n.OpenBracketToken = 3] = "OpenBracketToken", n[n.CloseBracketToken = 4] = "CloseBracketToken", n[n.CommaToken = 5] = "CommaToken", n[n.ColonToken = 6] = "ColonToken", n[n.NullKeyword = 7] = "NullKeyword", n[n.TrueKeyword = 8] = "TrueKeyword", n[n.FalseKeyword = 9] = "FalseKeyword", n[n.StringLiteral = 10] = "StringLiteral", n[n.NumericLiteral = 11] = "NumericLiteral", n[n.LineCommentTrivia = 12] = "LineCommentTrivia", n[n.BlockCommentTrivia = 13] = "BlockCommentTrivia", n[n.LineBreakTrivia = 14] = "LineBreakTrivia", n[n.Trivia = 15] = "Trivia", n[n.Unknown = 16] = "Unknown", n[n.EOF = 17] = "EOF";
|
|
17850
|
+
})(H || (H = {}));
|
|
17851
|
+
var K = S;
|
|
17852
|
+
var q;
|
|
17853
|
+
(function(n) {
|
|
17854
|
+
n[n.InvalidSymbol = 1] = "InvalidSymbol", n[n.InvalidNumberFormat = 2] = "InvalidNumberFormat", n[n.PropertyNameExpected = 3] = "PropertyNameExpected", n[n.ValueExpected = 4] = "ValueExpected", n[n.ColonExpected = 5] = "ColonExpected", n[n.CommaExpected = 6] = "CommaExpected", n[n.CloseBraceExpected = 7] = "CloseBraceExpected", n[n.CloseBracketExpected = 8] = "CloseBracketExpected", n[n.EndOfFileExpected = 9] = "EndOfFileExpected", n[n.InvalidCommentToken = 10] = "InvalidCommentToken", n[n.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", n[n.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", n[n.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", n[n.InvalidUnicode = 14] = "InvalidUnicode", n[n.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", n[n.InvalidCharacter = 16] = "InvalidCharacter";
|
|
17855
|
+
})(q || (q = {}));
|
|
17856
|
+
function h(n, l) {
|
|
17857
|
+
const g = K(n, l?.errors, l);
|
|
17858
|
+
return N(n, g, l), g;
|
|
17859
|
+
}
|
|
15900
17860
|
// src/utilities/format-utilities.ts
|
|
15901
|
-
|
|
15902
|
-
import { resolve as resolve2 } from "node:path";
|
|
17861
|
+
var import_fast_diff = __toESM(require_diff(), 1);
|
|
15903
17862
|
|
|
15904
|
-
// node_modules/arkregex/out/regex.js
|
|
15905
|
-
var regex2 = (src, flags) => new RegExp(src, flags);
|
|
15906
|
-
Object.assign(regex2, { as: regex2 });
|
|
15907
17863
|
// src/oxfmt-sync.ts
|
|
15908
17864
|
import { existsSync } from "node:fs";
|
|
15909
17865
|
import { fileURLToPath } from "node:url";
|
|
15910
17866
|
import { MessageChannel, receiveMessageOnPort, Worker } from "node:worker_threads";
|
|
15911
17867
|
var FORMAT_TIMEOUT = 30000;
|
|
15912
17868
|
var workerState;
|
|
15913
|
-
function
|
|
15914
|
-
const jsPath = new URL("./oxfmt-worker.js",
|
|
17869
|
+
function __testingResolveWorkerPath(baseUrl, exists) {
|
|
17870
|
+
const jsPath = new URL("./oxfmt-worker.js", baseUrl);
|
|
15915
17871
|
const jsFilePath = fileURLToPath(jsPath);
|
|
15916
|
-
if (
|
|
17872
|
+
if (exists(jsFilePath))
|
|
15917
17873
|
return jsPath;
|
|
15918
|
-
const tsPath = new URL("./oxfmt-worker.ts",
|
|
17874
|
+
const tsPath = new URL("./oxfmt-worker.ts", baseUrl);
|
|
15919
17875
|
const tsFilePath = fileURLToPath(tsPath);
|
|
15920
|
-
if (
|
|
17876
|
+
if (exists(tsFilePath))
|
|
15921
17877
|
return tsPath;
|
|
15922
17878
|
throw new Error(`Oxfmt worker not found at ${jsFilePath} or ${tsFilePath}. Did you run 'bun run build'?`);
|
|
15923
17879
|
}
|
|
17880
|
+
function resolveWorkerPath() {
|
|
17881
|
+
return __testingResolveWorkerPath(import.meta.url, existsSync);
|
|
17882
|
+
}
|
|
15924
17883
|
function getWorker() {
|
|
15925
17884
|
if (workerState !== undefined)
|
|
15926
17885
|
return workerState;
|
|
@@ -15970,7 +17929,7 @@ function loadOxfmtConfig() {
|
|
|
15970
17929
|
try {
|
|
15971
17930
|
const configPath = resolve2(process.cwd(), ".oxfmtrc.json");
|
|
15972
17931
|
const configText = readFileSync(configPath, "utf8");
|
|
15973
|
-
const parsed =
|
|
17932
|
+
const parsed = h(configText);
|
|
15974
17933
|
if (typeof parsed !== "object" || parsed === null) {
|
|
15975
17934
|
cachedConfig = {};
|
|
15976
17935
|
return cachedConfig;
|
|
@@ -15985,22 +17944,38 @@ function loadOxfmtConfig() {
|
|
|
15985
17944
|
}
|
|
15986
17945
|
}
|
|
15987
17946
|
function getExtension(filePath) {
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
17947
|
+
const { length } = filePath;
|
|
17948
|
+
if (length >= 3 && filePath.codePointAt(length - 3) === 46 /* Period */) {
|
|
17949
|
+
const character1 = filePath.codePointAt(length - 2);
|
|
17950
|
+
const character2 = filePath.codePointAt(length - 1);
|
|
17951
|
+
if (character1 === 116 /* LowerT */ && character2 === 115 /* LowerS */)
|
|
17952
|
+
return ".ts";
|
|
17953
|
+
if (character1 === 106 /* LowerJ */ && character2 === 115 /* LowerS */)
|
|
17954
|
+
return ".js";
|
|
17955
|
+
}
|
|
17956
|
+
if (length >= 4 && filePath.codePointAt(length - 4) === 46 /* Period */) {
|
|
17957
|
+
const character1 = filePath.codePointAt(length - 3);
|
|
17958
|
+
const character2 = filePath.codePointAt(length - 2);
|
|
17959
|
+
const character3 = filePath.codePointAt(length - 1);
|
|
17960
|
+
if (character3 === 120 /* LowerX */) {
|
|
17961
|
+
if (character1 === 116 /* LowerT */ && character2 === 115 /* LowerS */)
|
|
17962
|
+
return ".tsx";
|
|
17963
|
+
if (character1 === 106 /* LowerJ */ && character2 === 115 /* LowerS */)
|
|
17964
|
+
return ".jsx";
|
|
17965
|
+
} else if (character3 === 115 /* LowerS */) {
|
|
17966
|
+
if (character2 === 116 /* LowerT */) {
|
|
17967
|
+
if (character1 === 109 /* LowerM */)
|
|
17968
|
+
return ".mts";
|
|
17969
|
+
if (character1 === 99 /* LowerC */)
|
|
17970
|
+
return ".cts";
|
|
17971
|
+
} else if (character2 === 106 /* LowerJ */) {
|
|
17972
|
+
if (character1 === 109 /* LowerM */)
|
|
17973
|
+
return ".mjs";
|
|
17974
|
+
if (character1 === 99 /* LowerC */)
|
|
17975
|
+
return ".cjs";
|
|
17976
|
+
}
|
|
17977
|
+
}
|
|
17978
|
+
}
|
|
16004
17979
|
return;
|
|
16005
17980
|
}
|
|
16006
17981
|
function formatWithOxfmtSync(source, filePath) {
|
|
@@ -16013,14 +17988,51 @@ function formatWithOxfmtSync(source, filePath) {
|
|
|
16013
17988
|
function generateDifferences(original, formatted) {
|
|
16014
17989
|
if (original === formatted)
|
|
16015
17990
|
return [];
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
17991
|
+
const diffs = import_fast_diff.default(original, formatted);
|
|
17992
|
+
const differences = new Array;
|
|
17993
|
+
let size = 0;
|
|
17994
|
+
let offset = 0;
|
|
17995
|
+
let index2 = 0;
|
|
17996
|
+
while (index2 < diffs.length) {
|
|
17997
|
+
const diff2 = diffs[index2];
|
|
17998
|
+
if (diff2 === undefined)
|
|
17999
|
+
break;
|
|
18000
|
+
const [type3, text] = diff2;
|
|
18001
|
+
if (type3 === 0) {
|
|
18002
|
+
offset += text.length;
|
|
18003
|
+
index2 += 1;
|
|
18004
|
+
} else if (type3 === -1) {
|
|
18005
|
+
let adjustedOffset = offset;
|
|
18006
|
+
const previous = diffs[index2 - 1];
|
|
18007
|
+
if (previous !== undefined && previous[0] === 0) {
|
|
18008
|
+
const [, prevText] = previous;
|
|
18009
|
+
let shiftCount = 0;
|
|
18010
|
+
while (shiftCount < prevText.length && shiftCount < text.length && prevText[prevText.length - 1 - shiftCount] === text[shiftCount]) {
|
|
18011
|
+
shiftCount += 1;
|
|
18012
|
+
}
|
|
18013
|
+
adjustedOffset -= shiftCount;
|
|
18014
|
+
}
|
|
18015
|
+
const next = diffs[index2 + 1];
|
|
18016
|
+
if (next !== undefined && next[0] === 1) {
|
|
18017
|
+
const [, nextText] = next;
|
|
18018
|
+
differences[size++] = {
|
|
18019
|
+
deleteText: text,
|
|
18020
|
+
insertText: nextText,
|
|
18021
|
+
offset: adjustedOffset,
|
|
18022
|
+
operation: "REPLACE"
|
|
18023
|
+
};
|
|
18024
|
+
index2 += 2;
|
|
18025
|
+
} else {
|
|
18026
|
+
differences[size++] = { deleteText: text, offset: adjustedOffset, operation: "DELETE" };
|
|
18027
|
+
index2 += 1;
|
|
18028
|
+
}
|
|
18029
|
+
offset += text.length;
|
|
18030
|
+
} else {
|
|
18031
|
+
differences[size++] = { insertText: text, offset, operation: "INSERT" };
|
|
18032
|
+
index2 += 1;
|
|
16022
18033
|
}
|
|
16023
|
-
|
|
18034
|
+
}
|
|
18035
|
+
return differences;
|
|
16024
18036
|
}
|
|
16025
18037
|
var MAX_LENGTH = 60;
|
|
16026
18038
|
var SYMBOLS = {
|
|
@@ -17680,15 +19692,11 @@ function tryParse(value, filename) {
|
|
|
17680
19692
|
function containsCode(value, filename) {
|
|
17681
19693
|
if (!couldBeJsCode(value))
|
|
17682
19694
|
return false;
|
|
17683
|
-
|
|
17684
|
-
|
|
17685
|
-
if (!result)
|
|
17686
|
-
return false;
|
|
17687
|
-
const statements = toParsedStatements(result.program.body);
|
|
17688
|
-
return !isExclusion(statements, value);
|
|
17689
|
-
} catch {
|
|
19695
|
+
const result = tryParse(value, filename);
|
|
19696
|
+
if (!result)
|
|
17690
19697
|
return false;
|
|
17691
|
-
|
|
19698
|
+
const statements = toParsedStatements(result.program.body);
|
|
19699
|
+
return !isExclusion(statements, value);
|
|
17692
19700
|
}
|
|
17693
19701
|
var noCommentedCode = {
|
|
17694
19702
|
create(context) {
|
|
@@ -17749,24 +19757,17 @@ var FUNCTION_BOUNDARIES = new Set([
|
|
|
17749
19757
|
TSESTree5.AST_NODE_TYPES.FunctionExpression,
|
|
17750
19758
|
TSESTree5.AST_NODE_TYPES.ArrowFunctionExpression
|
|
17751
19759
|
]);
|
|
17752
|
-
var RUNTIME_TS_WRAPPERS = new Set([
|
|
17753
|
-
"ParenthesizedExpression",
|
|
17754
|
-
"TSAsExpression",
|
|
17755
|
-
"TSSatisfiesExpression",
|
|
17756
|
-
"TSTypeAssertion",
|
|
17757
|
-
"TSNonNullExpression",
|
|
17758
|
-
"TSInstantiationExpression",
|
|
17759
|
-
"ChainExpression"
|
|
17760
|
-
]);
|
|
17761
19760
|
function isComponentName(name) {
|
|
17762
19761
|
return COMPONENT_NAME_PATTERN.test(name);
|
|
17763
19762
|
}
|
|
17764
19763
|
function isReactComponentHOC(callExpr) {
|
|
17765
19764
|
const { callee } = callExpr;
|
|
17766
|
-
if (callee.type === TSESTree5.AST_NODE_TYPES.Identifier)
|
|
19765
|
+
if (callee.type === TSESTree5.AST_NODE_TYPES.Identifier) {
|
|
17767
19766
|
return callee.name === "forwardRef" || callee.name === "memo";
|
|
17768
|
-
|
|
19767
|
+
}
|
|
19768
|
+
if (callee.type === TSESTree5.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree5.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === TSESTree5.AST_NODE_TYPES.Identifier) {
|
|
17769
19769
|
return callee.property.name === "forwardRef" || callee.property.name === "memo";
|
|
19770
|
+
}
|
|
17770
19771
|
return false;
|
|
17771
19772
|
}
|
|
17772
19773
|
function getComponentNameFromFunction(node) {
|
|
@@ -17799,13 +19800,14 @@ function getComponentNameFromCallParent(callExpr) {
|
|
|
17799
19800
|
if (parent.type === TSESTree5.AST_NODE_TYPES.AssignmentExpression && parent.left.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.left.name)) {
|
|
17800
19801
|
return parent.left.name;
|
|
17801
19802
|
}
|
|
19803
|
+
let nameFromExportDefault;
|
|
17802
19804
|
if (parent.type === TSESTree5.AST_NODE_TYPES.ExportDefaultDeclaration && callExpr.arguments.length > 0) {
|
|
17803
19805
|
const [firstArg] = callExpr.arguments;
|
|
17804
19806
|
if (firstArg && firstArg.type === TSESTree5.AST_NODE_TYPES.FunctionExpression && firstArg.id && isComponentName(firstArg.id.name)) {
|
|
17805
|
-
|
|
19807
|
+
nameFromExportDefault = firstArg.id.name;
|
|
17806
19808
|
}
|
|
17807
19809
|
}
|
|
17808
|
-
return;
|
|
19810
|
+
return nameFromExportDefault;
|
|
17809
19811
|
}
|
|
17810
19812
|
function getHookName(callExpression) {
|
|
17811
19813
|
const { callee } = callExpression;
|
|
@@ -17838,11 +19840,7 @@ function isTypeOnlyNullLiteral(node) {
|
|
|
17838
19840
|
const { parent } = node;
|
|
17839
19841
|
if (parent === null || parent === undefined)
|
|
17840
19842
|
return false;
|
|
17841
|
-
|
|
17842
|
-
return true;
|
|
17843
|
-
if (parent.type === TSESTree5.AST_NODE_TYPES.TSLiteralType)
|
|
17844
|
-
return true;
|
|
17845
|
-
return false;
|
|
19843
|
+
return parent.type === TSESTree5.AST_NODE_TYPES.TSLiteralType;
|
|
17846
19844
|
}
|
|
17847
19845
|
function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
|
|
17848
19846
|
let maxJsxDepth = 0;
|
|
@@ -17868,14 +19866,10 @@ function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
|
|
|
17868
19866
|
nullLiterals.push(literalNode);
|
|
17869
19867
|
}
|
|
17870
19868
|
function getVisitorKeysForNodeType(nodeType) {
|
|
17871
|
-
const visitorKeysUnknown = sourceCode.visitorKeys;
|
|
17872
|
-
if (visitorKeysUnknown === null || visitorKeysUnknown === undefined || typeof visitorKeysUnknown !== "object")
|
|
17873
|
-
return [];
|
|
17874
|
-
const visitorKeysRecord = visitorKeysUnknown;
|
|
17875
|
-
const keysUnknown = visitorKeysRecord[nodeType];
|
|
17876
|
-
if (!Array.isArray(keysUnknown))
|
|
17877
|
-
return [];
|
|
17878
19869
|
const keys3 = new Array;
|
|
19870
|
+
const keysUnknown = sourceCode.visitorKeys[nodeType];
|
|
19871
|
+
if (!Array.isArray(keysUnknown))
|
|
19872
|
+
return keys3;
|
|
17879
19873
|
for (const key of keysUnknown)
|
|
17880
19874
|
if (typeof key === "string")
|
|
17881
19875
|
keys3.push(key);
|
|
@@ -17887,9 +19881,10 @@ function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
|
|
|
17887
19881
|
const value = currentRecord[key];
|
|
17888
19882
|
if (Array.isArray(value)) {
|
|
17889
19883
|
for (const item of value) {
|
|
17890
|
-
if (typeof item
|
|
19884
|
+
if (typeof item !== "object" || item === null)
|
|
19885
|
+
continue;
|
|
19886
|
+
if ("type" in item)
|
|
17891
19887
|
visit(item, nextDepth);
|
|
17892
|
-
}
|
|
17893
19888
|
}
|
|
17894
19889
|
continue;
|
|
17895
19890
|
}
|
|
@@ -18116,41 +20111,35 @@ function isBlockReturningIdentity(body, paramName) {
|
|
|
18116
20111
|
return statement.argument.name === paramName;
|
|
18117
20112
|
}
|
|
18118
20113
|
function isIdentityCallback(callback) {
|
|
18119
|
-
|
|
18120
|
-
|
|
18121
|
-
|
|
18122
|
-
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18127
|
-
|
|
18128
|
-
|
|
18129
|
-
|
|
18130
|
-
|
|
18131
|
-
if (callback.body.type === AST_NODE_TYPES2.BlockStatement) {
|
|
18132
|
-
return isBlockReturningIdentity(callback.body, paramName);
|
|
20114
|
+
let isIdentity = false;
|
|
20115
|
+
if (callback.type === AST_NODE_TYPES2.ArrowFunctionExpression && callback.params.length === 1) {
|
|
20116
|
+
const [parameter2] = callback.params;
|
|
20117
|
+
if (parameter2 !== undefined) {
|
|
20118
|
+
const name = getParameterName(parameter2);
|
|
20119
|
+
if (name !== undefined) {
|
|
20120
|
+
const { body } = callback;
|
|
20121
|
+
if (body.type === AST_NODE_TYPES2.Identifier)
|
|
20122
|
+
isIdentity = body.name === name;
|
|
20123
|
+
if (body.type === AST_NODE_TYPES2.BlockStatement)
|
|
20124
|
+
isIdentity = isBlockReturningIdentity(body, name);
|
|
20125
|
+
}
|
|
18133
20126
|
}
|
|
18134
|
-
return false;
|
|
18135
20127
|
}
|
|
18136
|
-
if (callback.type === AST_NODE_TYPES2.FunctionExpression) {
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
if (paramName === undefined || paramName === "")
|
|
18144
|
-
return false;
|
|
18145
|
-
return isBlockReturningIdentity(callback.body, paramName);
|
|
20128
|
+
if (callback.type === AST_NODE_TYPES2.FunctionExpression && callback.params.length === 1) {
|
|
20129
|
+
const [parameter2] = callback.params;
|
|
20130
|
+
if (parameter2 !== undefined) {
|
|
20131
|
+
const name = getParameterName(parameter2);
|
|
20132
|
+
if (name !== undefined)
|
|
20133
|
+
isIdentity = isBlockReturningIdentity(callback.body, name);
|
|
20134
|
+
}
|
|
18146
20135
|
}
|
|
18147
|
-
return
|
|
20136
|
+
return isIdentity;
|
|
18148
20137
|
}
|
|
18149
20138
|
function findVariable(context, identifier3) {
|
|
18150
20139
|
let scope = context.sourceCode.getScope(identifier3);
|
|
18151
20140
|
while (scope) {
|
|
18152
20141
|
const variable = scope.set.get(identifier3.name);
|
|
18153
|
-
if (variable)
|
|
20142
|
+
if (variable !== undefined)
|
|
18154
20143
|
return variable;
|
|
18155
20144
|
scope = scope.upper ?? undefined;
|
|
18156
20145
|
}
|
|
@@ -18158,9 +20147,8 @@ function findVariable(context, identifier3) {
|
|
|
18158
20147
|
}
|
|
18159
20148
|
function getHookName2(node) {
|
|
18160
20149
|
const { callee } = node;
|
|
18161
|
-
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
20150
|
+
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
18162
20151
|
return callee.name;
|
|
18163
|
-
}
|
|
18164
20152
|
if (callee.type === AST_NODE_TYPES2.MemberExpression && callee.property.type === AST_NODE_TYPES2.Identifier) {
|
|
18165
20153
|
return callee.property.name;
|
|
18166
20154
|
}
|
|
@@ -18168,9 +20156,8 @@ function getHookName2(node) {
|
|
|
18168
20156
|
}
|
|
18169
20157
|
function isJoinBindingsCall(node) {
|
|
18170
20158
|
const { callee } = node;
|
|
18171
|
-
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
20159
|
+
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
18172
20160
|
return callee.name === "joinBindings";
|
|
18173
|
-
}
|
|
18174
20161
|
if (callee.type === AST_NODE_TYPES2.MemberExpression && callee.property.type === AST_NODE_TYPES2.Identifier) {
|
|
18175
20162
|
return callee.property.name === "joinBindings";
|
|
18176
20163
|
}
|
|
@@ -18184,9 +20171,7 @@ function isBindingInitialization(variable) {
|
|
|
18184
20171
|
if (!init || init.type !== AST_NODE_TYPES2.CallExpression)
|
|
18185
20172
|
continue;
|
|
18186
20173
|
const hookName = getHookName2(init);
|
|
18187
|
-
if (hookName === "useBinding")
|
|
18188
|
-
return true;
|
|
18189
|
-
if (isJoinBindingsCall(init))
|
|
20174
|
+
if (hookName === "useBinding" || isJoinBindingsCall(init))
|
|
18190
20175
|
return true;
|
|
18191
20176
|
if (init.callee.type === AST_NODE_TYPES2.MemberExpression && init.callee.property.type === AST_NODE_TYPES2.Identifier && init.callee.property.name === "map") {
|
|
18192
20177
|
return true;
|
|
@@ -18198,26 +20183,21 @@ function isLikelyBinding(context, callee, patterns2) {
|
|
|
18198
20183
|
const { object: object3 } = callee;
|
|
18199
20184
|
if (object3.type === AST_NODE_TYPES2.Identifier) {
|
|
18200
20185
|
const lowerName = object3.name.toLowerCase();
|
|
18201
|
-
for (const pattern4 of patterns2)
|
|
20186
|
+
for (const pattern4 of patterns2)
|
|
18202
20187
|
if (lowerName.includes(pattern4.toLowerCase()))
|
|
18203
20188
|
return true;
|
|
18204
|
-
}
|
|
18205
20189
|
const variable = findVariable(context, object3);
|
|
18206
|
-
if (variable && isBindingInitialization(variable))
|
|
20190
|
+
if (variable !== undefined && isBindingInitialization(variable))
|
|
18207
20191
|
return true;
|
|
18208
20192
|
}
|
|
18209
20193
|
if (object3.type === AST_NODE_TYPES2.CallExpression && object3.callee.type === AST_NODE_TYPES2.MemberExpression && object3.callee.property.type === AST_NODE_TYPES2.Identifier && object3.callee.property.name === "map") {
|
|
18210
20194
|
return true;
|
|
18211
20195
|
}
|
|
18212
|
-
|
|
18213
|
-
return true;
|
|
18214
|
-
}
|
|
18215
|
-
return false;
|
|
20196
|
+
return object3.type === AST_NODE_TYPES2.CallExpression && isJoinBindingsCall(object3);
|
|
18216
20197
|
}
|
|
18217
20198
|
var noIdentityMap = {
|
|
18218
20199
|
create(context) {
|
|
18219
|
-
const [
|
|
18220
|
-
const patterns2 = rawOptions?.bindingPatterns ?? DEFAULT_BINDING_PATTERNS;
|
|
20200
|
+
const [{ bindingPatterns = DEFAULT_BINDING_PATTERNS } = {}] = context.options;
|
|
18221
20201
|
return {
|
|
18222
20202
|
CallExpression(node) {
|
|
18223
20203
|
const { callee } = node;
|
|
@@ -18236,7 +20216,7 @@ var noIdentityMap = {
|
|
|
18236
20216
|
return;
|
|
18237
20217
|
if (!isIdentityCallback(callback))
|
|
18238
20218
|
return;
|
|
18239
|
-
const isBinding = isLikelyBinding(context, callee,
|
|
20219
|
+
const isBinding = isLikelyBinding(context, callee, bindingPatterns);
|
|
18240
20220
|
context.report({
|
|
18241
20221
|
fix(fixer) {
|
|
18242
20222
|
const objectText = context.sourceCode.getText(callee.object);
|
|
@@ -18964,31 +20944,226 @@ var noUselessUseSpring = {
|
|
|
18964
20944
|
defaultOptions: [DEFAULT_OPTION_VALUES],
|
|
18965
20945
|
meta: {
|
|
18966
20946
|
docs: {
|
|
18967
|
-
description: "Disallow useSpring hooks whose config and dependencies are entirely static"
|
|
20947
|
+
description: "Disallow useSpring hooks whose config and dependencies are entirely static"
|
|
20948
|
+
},
|
|
20949
|
+
messages: {
|
|
20950
|
+
uselessSpring: "useSpring call has only static inputs and non-updating dependencies; replace it with a constant or remove the hook."
|
|
20951
|
+
},
|
|
20952
|
+
schema: [
|
|
20953
|
+
{
|
|
20954
|
+
additionalProperties: false,
|
|
20955
|
+
properties: {
|
|
20956
|
+
springHooks: {
|
|
20957
|
+
description: "Hook identifiers that should be treated as spring hooks",
|
|
20958
|
+
items: { type: "string" },
|
|
20959
|
+
type: "array"
|
|
20960
|
+
},
|
|
20961
|
+
staticGlobalFactories: {
|
|
20962
|
+
default: [...DEFAULT_STATIC_GLOBAL_FACTORIES],
|
|
20963
|
+
description: "Global factory identifiers that are treated as static constructors",
|
|
20964
|
+
items: { type: "string" },
|
|
20965
|
+
type: "array"
|
|
20966
|
+
},
|
|
20967
|
+
treatEmptyDepsAsViolation: {
|
|
20968
|
+
default: true,
|
|
20969
|
+
description: "Treat static config with an empty dependency array as a violation",
|
|
20970
|
+
type: "boolean"
|
|
20971
|
+
}
|
|
20972
|
+
},
|
|
20973
|
+
type: "object"
|
|
20974
|
+
}
|
|
20975
|
+
],
|
|
20976
|
+
type: "suggestion"
|
|
20977
|
+
}
|
|
20978
|
+
};
|
|
20979
|
+
var no_useless_use_spring_default = noUselessUseSpring;
|
|
20980
|
+
|
|
20981
|
+
// src/rules/no-warn.ts
|
|
20982
|
+
var noWarn = {
|
|
20983
|
+
create(context) {
|
|
20984
|
+
return {
|
|
20985
|
+
'CallExpression[callee.type="Identifier"][callee.name="warn"]'(node) {
|
|
20986
|
+
context.report({
|
|
20987
|
+
messageId: "useLog",
|
|
20988
|
+
node
|
|
20989
|
+
});
|
|
20990
|
+
}
|
|
20991
|
+
};
|
|
20992
|
+
},
|
|
20993
|
+
meta: {
|
|
20994
|
+
docs: {
|
|
20995
|
+
description: "Ban warn() function calls. Use Log instead.",
|
|
20996
|
+
recommended: false
|
|
20997
|
+
},
|
|
20998
|
+
messages: {
|
|
20999
|
+
useLog: "Use Log instead of warn()"
|
|
21000
|
+
},
|
|
21001
|
+
schema: [],
|
|
21002
|
+
type: "problem"
|
|
21003
|
+
}
|
|
21004
|
+
};
|
|
21005
|
+
var no_warn_default = noWarn;
|
|
21006
|
+
|
|
21007
|
+
// src/rules/prefer-class-properties.ts
|
|
21008
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES5 } from "@typescript-eslint/utils";
|
|
21009
|
+
function isExpression(node) {
|
|
21010
|
+
return node.type !== AST_NODE_TYPES5.AssignmentPattern && node.type !== AST_NODE_TYPES5.TSEmptyBodyFunctionExpression;
|
|
21011
|
+
}
|
|
21012
|
+
function isSimpleLiteralProperty({ computed, value }) {
|
|
21013
|
+
return !computed && isExpression(value) && isSimpleLiteral(value);
|
|
21014
|
+
}
|
|
21015
|
+
function isSimpleLiteral(node) {
|
|
21016
|
+
if (!node)
|
|
21017
|
+
return false;
|
|
21018
|
+
switch (node.type) {
|
|
21019
|
+
case AST_NODE_TYPES5.Literal:
|
|
21020
|
+
return true;
|
|
21021
|
+
case AST_NODE_TYPES5.MemberExpression:
|
|
21022
|
+
return isSimpleLiteral(node.object);
|
|
21023
|
+
case AST_NODE_TYPES5.CallExpression:
|
|
21024
|
+
return node.callee.type === AST_NODE_TYPES5.MemberExpression && isSimpleLiteral(node.callee.object);
|
|
21025
|
+
case AST_NODE_TYPES5.ArrayExpression:
|
|
21026
|
+
return node.elements.every((element) => {
|
|
21027
|
+
if (element === null)
|
|
21028
|
+
return true;
|
|
21029
|
+
if (element.type === AST_NODE_TYPES5.SpreadElement)
|
|
21030
|
+
return false;
|
|
21031
|
+
return isSimpleLiteral(element);
|
|
21032
|
+
});
|
|
21033
|
+
case AST_NODE_TYPES5.ObjectExpression:
|
|
21034
|
+
return node.properties.every((property) => property.type === AST_NODE_TYPES5.SpreadElement || property.type !== AST_NODE_TYPES5.Property ? false : isSimpleLiteralProperty(property));
|
|
21035
|
+
default:
|
|
21036
|
+
return false;
|
|
21037
|
+
}
|
|
21038
|
+
}
|
|
21039
|
+
function isStaticMemberExpression(node) {
|
|
21040
|
+
let current = node;
|
|
21041
|
+
while (current.type === AST_NODE_TYPES5.MemberExpression) {
|
|
21042
|
+
if (current.computed && current.property.type !== AST_NODE_TYPES5.Literal)
|
|
21043
|
+
return false;
|
|
21044
|
+
current = current.object;
|
|
21045
|
+
}
|
|
21046
|
+
return true;
|
|
21047
|
+
}
|
|
21048
|
+
function isConstructor(node) {
|
|
21049
|
+
return node.type === AST_NODE_TYPES5.MethodDefinition && node.kind === "constructor" && node.key.type === AST_NODE_TYPES5.Identifier && node.key.name === "constructor";
|
|
21050
|
+
}
|
|
21051
|
+
var preferClassProperties = {
|
|
21052
|
+
create(context) {
|
|
21053
|
+
const option = context.options[0] ?? "always";
|
|
21054
|
+
if (option === "never") {
|
|
21055
|
+
return {
|
|
21056
|
+
PropertyDefinition(node) {
|
|
21057
|
+
if (node.static)
|
|
21058
|
+
return;
|
|
21059
|
+
context.report({
|
|
21060
|
+
messageId: "unexpectedClassProperty",
|
|
21061
|
+
node
|
|
21062
|
+
});
|
|
21063
|
+
}
|
|
21064
|
+
};
|
|
21065
|
+
}
|
|
21066
|
+
return {
|
|
21067
|
+
ClassDeclaration(node) {
|
|
21068
|
+
checkClass(node.body);
|
|
21069
|
+
},
|
|
21070
|
+
ClassExpression(node) {
|
|
21071
|
+
checkClass(node.body);
|
|
21072
|
+
}
|
|
21073
|
+
};
|
|
21074
|
+
function checkClass(body) {
|
|
21075
|
+
for (const member of body.body) {
|
|
21076
|
+
if (!isConstructor(member))
|
|
21077
|
+
continue;
|
|
21078
|
+
if (member.type !== AST_NODE_TYPES5.MethodDefinition)
|
|
21079
|
+
continue;
|
|
21080
|
+
if (!member.value || member.value.type !== AST_NODE_TYPES5.FunctionExpression)
|
|
21081
|
+
continue;
|
|
21082
|
+
for (const statement of member.value.body.body) {
|
|
21083
|
+
if (statement.type !== AST_NODE_TYPES5.ExpressionStatement)
|
|
21084
|
+
continue;
|
|
21085
|
+
const { expression } = statement;
|
|
21086
|
+
if (expression.type !== AST_NODE_TYPES5.AssignmentExpression)
|
|
21087
|
+
continue;
|
|
21088
|
+
if (expression.left.type !== AST_NODE_TYPES5.MemberExpression)
|
|
21089
|
+
continue;
|
|
21090
|
+
if (expression.left.object.type !== AST_NODE_TYPES5.ThisExpression)
|
|
21091
|
+
continue;
|
|
21092
|
+
if ((expression.left.property.type === AST_NODE_TYPES5.Identifier || expression.left.property.type === AST_NODE_TYPES5.Literal) && isSimpleLiteral(expression.right) && isStaticMemberExpression(expression.left)) {
|
|
21093
|
+
context.report({
|
|
21094
|
+
messageId: "unexpectedAssignment",
|
|
21095
|
+
node: expression
|
|
21096
|
+
});
|
|
21097
|
+
}
|
|
21098
|
+
}
|
|
21099
|
+
}
|
|
21100
|
+
}
|
|
21101
|
+
},
|
|
21102
|
+
defaultOptions: ["always"],
|
|
21103
|
+
meta: {
|
|
21104
|
+
docs: {
|
|
21105
|
+
description: "Prefer class properties to assignment of literals in constructors."
|
|
21106
|
+
},
|
|
21107
|
+
messages: {
|
|
21108
|
+
unexpectedAssignment: "Unexpected assignment of literal instance member.",
|
|
21109
|
+
unexpectedClassProperty: "Unexpected class property."
|
|
21110
|
+
},
|
|
21111
|
+
schema: [{ enum: ["always", "never"], type: "string" }],
|
|
21112
|
+
type: "suggestion"
|
|
21113
|
+
}
|
|
21114
|
+
};
|
|
21115
|
+
var prefer_class_properties_default = preferClassProperties;
|
|
21116
|
+
|
|
21117
|
+
// src/rules/prefer-early-return.ts
|
|
21118
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES6 } from "@typescript-eslint/utils";
|
|
21119
|
+
var DEFAULT_MAXIMUM_STATEMENTS = 1;
|
|
21120
|
+
function isLonelyIfStatement(statement) {
|
|
21121
|
+
return statement.alternate === null;
|
|
21122
|
+
}
|
|
21123
|
+
function isOffendingConsequent(consequent, maxStatements) {
|
|
21124
|
+
return consequent.type === AST_NODE_TYPES6.ExpressionStatement && maxStatements === 0 || consequent.type === AST_NODE_TYPES6.BlockStatement && consequent.body.length > maxStatements;
|
|
21125
|
+
}
|
|
21126
|
+
function canSimplifyConditionalBody(body, maxStatements) {
|
|
21127
|
+
if (body.body.length !== 1)
|
|
21128
|
+
return false;
|
|
21129
|
+
const [statement] = body.body;
|
|
21130
|
+
if (statement === undefined || statement.type !== AST_NODE_TYPES6.IfStatement || !isLonelyIfStatement(statement)) {
|
|
21131
|
+
return false;
|
|
21132
|
+
}
|
|
21133
|
+
return isOffendingConsequent(statement.consequent, maxStatements);
|
|
21134
|
+
}
|
|
21135
|
+
var preferEarlyReturn = {
|
|
21136
|
+
create(context) {
|
|
21137
|
+
const options3 = context.options[0] ?? {};
|
|
21138
|
+
const maxStatements = options3.maximumStatements ?? DEFAULT_MAXIMUM_STATEMENTS;
|
|
21139
|
+
function checkFunctionBody(node) {
|
|
21140
|
+
const { body } = node;
|
|
21141
|
+
if (body.type !== AST_NODE_TYPES6.BlockStatement || !canSimplifyConditionalBody(body, maxStatements))
|
|
21142
|
+
return;
|
|
21143
|
+
context.report({
|
|
21144
|
+
messageId: "preferEarlyReturn",
|
|
21145
|
+
node: body
|
|
21146
|
+
});
|
|
21147
|
+
}
|
|
21148
|
+
return {
|
|
21149
|
+
ArrowFunctionExpression: checkFunctionBody,
|
|
21150
|
+
FunctionDeclaration: checkFunctionBody,
|
|
21151
|
+
FunctionExpression: checkFunctionBody
|
|
21152
|
+
};
|
|
21153
|
+
},
|
|
21154
|
+
defaultOptions: [{}],
|
|
21155
|
+
meta: {
|
|
21156
|
+
docs: {
|
|
21157
|
+
description: "Prefer early returns over full-body conditional wrapping in function declarations."
|
|
18968
21158
|
},
|
|
18969
21159
|
messages: {
|
|
18970
|
-
|
|
21160
|
+
preferEarlyReturn: "Prefer an early return to a conditionally-wrapped function body"
|
|
18971
21161
|
},
|
|
18972
21162
|
schema: [
|
|
18973
21163
|
{
|
|
18974
21164
|
additionalProperties: false,
|
|
18975
21165
|
properties: {
|
|
18976
|
-
|
|
18977
|
-
description: "Hook identifiers that should be treated as spring hooks",
|
|
18978
|
-
items: { type: "string" },
|
|
18979
|
-
type: "array"
|
|
18980
|
-
},
|
|
18981
|
-
staticGlobalFactories: {
|
|
18982
|
-
default: [...DEFAULT_STATIC_GLOBAL_FACTORIES],
|
|
18983
|
-
description: "Global factory identifiers that are treated as static constructors",
|
|
18984
|
-
items: { type: "string" },
|
|
18985
|
-
type: "array"
|
|
18986
|
-
},
|
|
18987
|
-
treatEmptyDepsAsViolation: {
|
|
18988
|
-
default: true,
|
|
18989
|
-
description: "Treat static config with an empty dependency array as a violation",
|
|
18990
|
-
type: "boolean"
|
|
18991
|
-
}
|
|
21166
|
+
maximumStatements: { type: "integer" }
|
|
18992
21167
|
},
|
|
18993
21168
|
type: "object"
|
|
18994
21169
|
}
|
|
@@ -18996,42 +21171,162 @@ var noUselessUseSpring = {
|
|
|
18996
21171
|
type: "suggestion"
|
|
18997
21172
|
}
|
|
18998
21173
|
};
|
|
18999
|
-
var
|
|
19000
|
-
|
|
19001
|
-
// src/rules/
|
|
19002
|
-
var
|
|
21174
|
+
var prefer_early_return_default = preferEarlyReturn;
|
|
21175
|
+
|
|
21176
|
+
// src/rules/prefer-module-scope-constants.ts
|
|
21177
|
+
var import_scope_manager3 = __toESM(require_dist2(), 1);
|
|
21178
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES7 } from "@typescript-eslint/utils";
|
|
21179
|
+
var SCREAMING_SNAKE_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
21180
|
+
function isTopScope(scope) {
|
|
21181
|
+
const { type: type3 } = scope;
|
|
21182
|
+
if (type3 === import_scope_manager3.ScopeType.module || type3 === import_scope_manager3.ScopeType.global)
|
|
21183
|
+
return true;
|
|
21184
|
+
if (scope.upper?.type === import_scope_manager3.ScopeType.global) {
|
|
21185
|
+
const { block } = scope.upper;
|
|
21186
|
+
if (block.type === AST_NODE_TYPES7.Program && block.sourceType === "script")
|
|
21187
|
+
return true;
|
|
21188
|
+
}
|
|
21189
|
+
return false;
|
|
21190
|
+
}
|
|
21191
|
+
var preferModuleScopeConstants = {
|
|
19003
21192
|
create(context) {
|
|
21193
|
+
let inConstDeclaration = false;
|
|
19004
21194
|
return {
|
|
19005
|
-
|
|
21195
|
+
VariableDeclaration(node) {
|
|
21196
|
+
inConstDeclaration = node.kind === "const";
|
|
21197
|
+
},
|
|
21198
|
+
"VariableDeclaration:exit"() {
|
|
21199
|
+
inConstDeclaration = false;
|
|
21200
|
+
},
|
|
21201
|
+
VariableDeclarator(node) {
|
|
21202
|
+
const { id: id2 } = node;
|
|
21203
|
+
if (id2.type !== AST_NODE_TYPES7.Identifier || !SCREAMING_SNAKE_CASE.test(id2.name))
|
|
21204
|
+
return;
|
|
21205
|
+
if (!inConstDeclaration) {
|
|
21206
|
+
context.report({
|
|
21207
|
+
messageId: "mustUseConst",
|
|
21208
|
+
node
|
|
21209
|
+
});
|
|
21210
|
+
return;
|
|
21211
|
+
}
|
|
21212
|
+
const scope = context.sourceCode.getScope(node);
|
|
21213
|
+
if (isTopScope(scope))
|
|
21214
|
+
return;
|
|
19006
21215
|
context.report({
|
|
19007
|
-
messageId: "
|
|
21216
|
+
messageId: "mustBeModuleScope",
|
|
19008
21217
|
node
|
|
19009
21218
|
});
|
|
19010
21219
|
}
|
|
19011
21220
|
};
|
|
19012
21221
|
},
|
|
21222
|
+
defaultOptions: [],
|
|
19013
21223
|
meta: {
|
|
19014
21224
|
docs: {
|
|
19015
|
-
description: "
|
|
19016
|
-
recommended: false
|
|
21225
|
+
description: "Prefer that screaming snake case variables always be defined using `const`, and always appear at module scope."
|
|
19017
21226
|
},
|
|
19018
21227
|
messages: {
|
|
19019
|
-
|
|
21228
|
+
mustBeModuleScope: "You must place screaming snake case at module scope. If this is not meant to be a module-scoped variable, use camelcase instead.",
|
|
21229
|
+
mustUseConst: "You must use `const` when defining screaming snake case variables. If this is not a constant, use camelcase instead."
|
|
19020
21230
|
},
|
|
19021
21231
|
schema: [],
|
|
19022
|
-
type: "
|
|
21232
|
+
type: "suggestion"
|
|
19023
21233
|
}
|
|
19024
21234
|
};
|
|
19025
|
-
var
|
|
21235
|
+
var prefer_module_scope_constants_default = preferModuleScopeConstants;
|
|
21236
|
+
|
|
21237
|
+
// src/rules/prefer-pascal-case-enums.ts
|
|
21238
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES8 } from "@typescript-eslint/utils";
|
|
21239
|
+
|
|
21240
|
+
// src/utilities/casing-utilities.ts
|
|
21241
|
+
var SPLIT_LOWER_TO_UPPER = regex2("([\\p{Ll}\\d])(\\p{Lu})", "gu");
|
|
21242
|
+
var SPLIT_UPPER_TO_UPPER = regex2("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu");
|
|
21243
|
+
var SPLIT_MARKER = "\x00";
|
|
21244
|
+
var SPLIT_REPLACE_VALUE = `$1${SPLIT_MARKER}$2`;
|
|
21245
|
+
function toPascalCase(value) {
|
|
21246
|
+
const trimmed = value.trim();
|
|
21247
|
+
if (trimmed.length === 0)
|
|
21248
|
+
return "";
|
|
21249
|
+
const marked = trimmed.replace(SPLIT_LOWER_TO_UPPER, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_TO_UPPER, SPLIT_REPLACE_VALUE);
|
|
21250
|
+
let start = 0;
|
|
21251
|
+
let { length } = marked;
|
|
21252
|
+
while (marked.charCodeAt(start) === 0)
|
|
21253
|
+
start += 1;
|
|
21254
|
+
if (start === length)
|
|
21255
|
+
return "";
|
|
21256
|
+
while (marked.charCodeAt(length - 1) === 0)
|
|
21257
|
+
length -= 1;
|
|
21258
|
+
let result = "";
|
|
21259
|
+
let wordStart = start;
|
|
21260
|
+
for (let index2 = start;index2 <= length; index2 += 1) {
|
|
21261
|
+
if (index2 !== length && marked.charCodeAt(index2) !== 0)
|
|
21262
|
+
continue;
|
|
21263
|
+
if (index2 > wordStart) {
|
|
21264
|
+
const word = marked.slice(wordStart, index2);
|
|
21265
|
+
const firstByte = word.charCodeAt(0);
|
|
21266
|
+
if (result.length > 0 && firstByte >= 48 && firstByte <= 57)
|
|
21267
|
+
result += "_";
|
|
21268
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
21269
|
+
}
|
|
21270
|
+
wordStart = index2 + 1;
|
|
21271
|
+
}
|
|
21272
|
+
return result;
|
|
21273
|
+
}
|
|
21274
|
+
|
|
21275
|
+
// src/rules/prefer-pascal-case-enums.ts
|
|
21276
|
+
var STARTS_WITH_DIGIT = regex2("^\\d");
|
|
21277
|
+
function getIdentifierName(node) {
|
|
21278
|
+
if (node.type === AST_NODE_TYPES8.Identifier)
|
|
21279
|
+
return node.name;
|
|
21280
|
+
if (node.type !== AST_NODE_TYPES8.Literal || typeof node.value !== "string")
|
|
21281
|
+
return;
|
|
21282
|
+
return STARTS_WITH_DIGIT.test(node.value) ? undefined : node.value;
|
|
21283
|
+
}
|
|
21284
|
+
var preferPascalCaseEnums = {
|
|
21285
|
+
create(context) {
|
|
21286
|
+
function report(node, identifier3) {
|
|
21287
|
+
context.report({
|
|
21288
|
+
data: { identifier: identifier3 },
|
|
21289
|
+
messageId: "notPascalCase",
|
|
21290
|
+
node
|
|
21291
|
+
});
|
|
21292
|
+
}
|
|
21293
|
+
return {
|
|
21294
|
+
TSEnumDeclaration(node) {
|
|
21295
|
+
const { name } = node.id;
|
|
21296
|
+
if (toPascalCase(name) === name)
|
|
21297
|
+
return;
|
|
21298
|
+
report(node.id, name);
|
|
21299
|
+
},
|
|
21300
|
+
TSEnumMember(node) {
|
|
21301
|
+
const name = getIdentifierName(node.id);
|
|
21302
|
+
if (name === undefined || toPascalCase(name) === name)
|
|
21303
|
+
return;
|
|
21304
|
+
report(node.id, name);
|
|
21305
|
+
}
|
|
21306
|
+
};
|
|
21307
|
+
},
|
|
21308
|
+
defaultOptions: [],
|
|
21309
|
+
meta: {
|
|
21310
|
+
docs: {
|
|
21311
|
+
description: "Enforce Pascal case when naming enums."
|
|
21312
|
+
},
|
|
21313
|
+
messages: {
|
|
21314
|
+
notPascalCase: "Enum '{{ identifier }}' should use Pascal case."
|
|
21315
|
+
},
|
|
21316
|
+
schema: [],
|
|
21317
|
+
type: "suggestion"
|
|
21318
|
+
}
|
|
21319
|
+
};
|
|
21320
|
+
var prefer_pascal_case_enums_default = preferPascalCaseEnums;
|
|
19026
21321
|
|
|
19027
21322
|
// src/rules/prefer-sequence-overloads.ts
|
|
19028
|
-
import { AST_NODE_TYPES as
|
|
21323
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES9 } from "@typescript-eslint/types";
|
|
19029
21324
|
var sequenceDescriptors = [
|
|
19030
21325
|
{ keypointName: "ColorSequenceKeypoint", sequenceName: "ColorSequence" },
|
|
19031
21326
|
{ keypointName: "NumberSequenceKeypoint", sequenceName: "NumberSequence" }
|
|
19032
21327
|
];
|
|
19033
21328
|
function isSequenceIdentifier(node) {
|
|
19034
|
-
if (node.type !==
|
|
21329
|
+
if (node.type !== AST_NODE_TYPES9.Identifier)
|
|
19035
21330
|
return false;
|
|
19036
21331
|
for (const { sequenceName } of sequenceDescriptors)
|
|
19037
21332
|
if (sequenceName === node.name)
|
|
@@ -19045,16 +21340,16 @@ function findDescriptor(sequenceName) {
|
|
|
19045
21340
|
return;
|
|
19046
21341
|
}
|
|
19047
21342
|
var isNumericLiteral = Compile(build_default.Object({
|
|
19048
|
-
type: build_default.Literal(
|
|
21343
|
+
type: build_default.Literal(AST_NODE_TYPES9.Literal),
|
|
19049
21344
|
value: build_default.Number()
|
|
19050
21345
|
}));
|
|
19051
21346
|
function isExpressionArgument(argument) {
|
|
19052
|
-
return argument !== undefined && argument.type !==
|
|
21347
|
+
return argument !== undefined && argument.type !== AST_NODE_TYPES9.SpreadElement;
|
|
19053
21348
|
}
|
|
19054
21349
|
function extractKeypoint(element, descriptor) {
|
|
19055
|
-
if (element === undefined || element.type !==
|
|
21350
|
+
if (element === undefined || element.type !== AST_NODE_TYPES9.NewExpression)
|
|
19056
21351
|
return;
|
|
19057
|
-
if (element.callee.type !==
|
|
21352
|
+
if (element.callee.type !== AST_NODE_TYPES9.Identifier || element.callee.name !== descriptor.keypointName)
|
|
19058
21353
|
return;
|
|
19059
21354
|
if (element.arguments.length !== 2)
|
|
19060
21355
|
return;
|
|
@@ -19084,7 +21379,7 @@ var preferSequenceOverloads = {
|
|
|
19084
21379
|
if (descriptor === undefined || node.arguments.length !== 1)
|
|
19085
21380
|
return;
|
|
19086
21381
|
const [argument] = node.arguments;
|
|
19087
|
-
if (argument === undefined || argument.type !==
|
|
21382
|
+
if (argument === undefined || argument.type !== AST_NODE_TYPES9.ArrayExpression || argument.elements.length !== 2)
|
|
19088
21383
|
return;
|
|
19089
21384
|
const firstElement = argument.elements[0] ?? undefined;
|
|
19090
21385
|
const secondElement = argument.elements[1] ?? undefined;
|
|
@@ -19130,6 +21425,147 @@ var preferSequenceOverloads = {
|
|
|
19130
21425
|
};
|
|
19131
21426
|
var prefer_sequence_overloads_default = preferSequenceOverloads;
|
|
19132
21427
|
|
|
21428
|
+
// src/rules/prefer-singular-enums.ts
|
|
21429
|
+
var IRREGULAR_PLURALS = new Set([
|
|
21430
|
+
"children",
|
|
21431
|
+
"dice",
|
|
21432
|
+
"feet",
|
|
21433
|
+
"geese",
|
|
21434
|
+
"men",
|
|
21435
|
+
"mice",
|
|
21436
|
+
"people",
|
|
21437
|
+
"teeth",
|
|
21438
|
+
"women",
|
|
21439
|
+
"criteria",
|
|
21440
|
+
"data",
|
|
21441
|
+
"media",
|
|
21442
|
+
"phenomena",
|
|
21443
|
+
"indices",
|
|
21444
|
+
"matrices",
|
|
21445
|
+
"vertices",
|
|
21446
|
+
"axes",
|
|
21447
|
+
"alumni",
|
|
21448
|
+
"cacti",
|
|
21449
|
+
"fungi",
|
|
21450
|
+
"octopi"
|
|
21451
|
+
]);
|
|
21452
|
+
var SINGULAR_EXCEPTIONS = new Set([
|
|
21453
|
+
"news",
|
|
21454
|
+
"status",
|
|
21455
|
+
"alias",
|
|
21456
|
+
"analysis",
|
|
21457
|
+
"basis",
|
|
21458
|
+
"thesis",
|
|
21459
|
+
"crisis",
|
|
21460
|
+
"axis",
|
|
21461
|
+
"class",
|
|
21462
|
+
"glass",
|
|
21463
|
+
"series",
|
|
21464
|
+
"species",
|
|
21465
|
+
"business"
|
|
21466
|
+
]);
|
|
21467
|
+
var PROGRAMMING_PLURALS = new Set([
|
|
21468
|
+
"args",
|
|
21469
|
+
"params",
|
|
21470
|
+
"parameters",
|
|
21471
|
+
"options",
|
|
21472
|
+
"settings",
|
|
21473
|
+
"props",
|
|
21474
|
+
"components",
|
|
21475
|
+
"hooks",
|
|
21476
|
+
"types",
|
|
21477
|
+
"enums",
|
|
21478
|
+
"services",
|
|
21479
|
+
"controllers",
|
|
21480
|
+
"models",
|
|
21481
|
+
"repositories",
|
|
21482
|
+
"dto",
|
|
21483
|
+
"dtos",
|
|
21484
|
+
"vo",
|
|
21485
|
+
"vos",
|
|
21486
|
+
"keys",
|
|
21487
|
+
"values",
|
|
21488
|
+
"entries",
|
|
21489
|
+
"items",
|
|
21490
|
+
"orders",
|
|
21491
|
+
"pages"
|
|
21492
|
+
]);
|
|
21493
|
+
var SINGULAR_ENUM_REGEX = regex2("[A-Z]+(?![a-z])|[A-Z]?[a-z]+|\\d+", "g");
|
|
21494
|
+
function tokenizeIdentifier(name) {
|
|
21495
|
+
const parts = name.split("_");
|
|
21496
|
+
const tokens = new Array;
|
|
21497
|
+
for (const part of parts) {
|
|
21498
|
+
const matches = part.match(SINGULAR_ENUM_REGEX);
|
|
21499
|
+
if (matches)
|
|
21500
|
+
tokens.push(...matches);
|
|
21501
|
+
}
|
|
21502
|
+
return tokens;
|
|
21503
|
+
}
|
|
21504
|
+
var INTEGER_REGEXP = regex2("^\\d+$");
|
|
21505
|
+
function getLastAlphaToken(name) {
|
|
21506
|
+
const tokens = tokenizeIdentifier(name);
|
|
21507
|
+
let alphaToken;
|
|
21508
|
+
for (let index2 = tokens.length - 1;index2 >= 0; index2 -= 1) {
|
|
21509
|
+
const token = tokens[index2];
|
|
21510
|
+
if (token === undefined || INTEGER_REGEXP.test(token))
|
|
21511
|
+
continue;
|
|
21512
|
+
alphaToken = { lower: token.toLowerCase(), original: token };
|
|
21513
|
+
break;
|
|
21514
|
+
}
|
|
21515
|
+
return alphaToken;
|
|
21516
|
+
}
|
|
21517
|
+
var ACRONYM_REGEXP = regex2("^[A-Z]{2,}[sS]$");
|
|
21518
|
+
function isAcronymPlural(original) {
|
|
21519
|
+
return ACRONYM_REGEXP.test(original);
|
|
21520
|
+
}
|
|
21521
|
+
var ES_VOWELS_REGEXP = regex2("((ch|sh|x|z|ss|o)es|xes|zes|ches|shes|sses|oes)$");
|
|
21522
|
+
function isPluralWord(lower, original) {
|
|
21523
|
+
if (IRREGULAR_PLURALS.has(lower) || PROGRAMMING_PLURALS.has(lower))
|
|
21524
|
+
return true;
|
|
21525
|
+
if (SINGULAR_EXCEPTIONS.has(lower))
|
|
21526
|
+
return false;
|
|
21527
|
+
if (isAcronymPlural(original) || lower.endsWith("ies") || lower.endsWith("ves") || ES_VOWELS_REGEXP.test(lower) || lower.endsWith("es")) {
|
|
21528
|
+
return true;
|
|
21529
|
+
}
|
|
21530
|
+
if (lower.endsWith("s"))
|
|
21531
|
+
return !(lower.endsWith("ss") || lower.endsWith("us") || lower.endsWith("is"));
|
|
21532
|
+
return false;
|
|
21533
|
+
}
|
|
21534
|
+
function isPlural(name) {
|
|
21535
|
+
if (ACRONYM_REGEXP.test(name))
|
|
21536
|
+
return true;
|
|
21537
|
+
const last = getLastAlphaToken(name);
|
|
21538
|
+
return last ? isPluralWord(last.lower, last.original) : false;
|
|
21539
|
+
}
|
|
21540
|
+
var preferSingularEnums = {
|
|
21541
|
+
create(context) {
|
|
21542
|
+
return {
|
|
21543
|
+
TSEnumDeclaration(node) {
|
|
21544
|
+
const { name } = node.id;
|
|
21545
|
+
if (!isPlural(name))
|
|
21546
|
+
return;
|
|
21547
|
+
context.report({
|
|
21548
|
+
data: { name },
|
|
21549
|
+
messageId: "notSingular",
|
|
21550
|
+
node
|
|
21551
|
+
});
|
|
21552
|
+
}
|
|
21553
|
+
};
|
|
21554
|
+
},
|
|
21555
|
+
defaultOptions: [],
|
|
21556
|
+
meta: {
|
|
21557
|
+
docs: {
|
|
21558
|
+
description: "Prefer singular TypeScript enums."
|
|
21559
|
+
},
|
|
21560
|
+
messages: {
|
|
21561
|
+
notSingular: "Enum '{{ name }}' should be singular."
|
|
21562
|
+
},
|
|
21563
|
+
schema: [],
|
|
21564
|
+
type: "suggestion"
|
|
21565
|
+
}
|
|
21566
|
+
};
|
|
21567
|
+
var prefer_singular_enums_default = preferSingularEnums;
|
|
21568
|
+
|
|
19133
21569
|
// src/rules/prefer-udim2-shorthand.ts
|
|
19134
21570
|
import { TSESTree as TSESTree7 } from "@typescript-eslint/utils";
|
|
19135
21571
|
function isNumber(value) {
|
|
@@ -19144,83 +21580,79 @@ function hasTypeProperty(object3) {
|
|
|
19144
21580
|
var OPERATORS2 = new Set(["+", "-", "*", "/", "%"]);
|
|
19145
21581
|
function reconstructText(node) {
|
|
19146
21582
|
const nodeType = node.type;
|
|
21583
|
+
let text;
|
|
19147
21584
|
if (nodeType === TSESTree7.AST_NODE_TYPES.Literal) {
|
|
19148
21585
|
const { value } = node;
|
|
19149
|
-
|
|
21586
|
+
text = isNumber(value) ? String(value) : undefined;
|
|
19150
21587
|
}
|
|
19151
21588
|
if (nodeType === TSESTree7.AST_NODE_TYPES.Identifier) {
|
|
19152
21589
|
const { name } = node;
|
|
19153
|
-
|
|
21590
|
+
text = typeof name === "string" ? name : undefined;
|
|
19154
21591
|
}
|
|
19155
21592
|
if (nodeType === TSESTree7.AST_NODE_TYPES.UnaryExpression) {
|
|
19156
21593
|
const { operator } = node;
|
|
19157
|
-
if (typeof operator
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
21594
|
+
if (typeof operator === "string") {
|
|
21595
|
+
const { argument } = node;
|
|
21596
|
+
if (isRecord3(argument)) {
|
|
21597
|
+
const argumentText = reconstructText(argument);
|
|
21598
|
+
if (argumentText !== undefined)
|
|
21599
|
+
text = `${operator}${argumentText}`;
|
|
21600
|
+
}
|
|
21601
|
+
}
|
|
19164
21602
|
}
|
|
19165
21603
|
if (nodeType === TSESTree7.AST_NODE_TYPES.BinaryExpression) {
|
|
19166
21604
|
const { operator } = node;
|
|
19167
|
-
if (typeof operator
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
21605
|
+
if (typeof operator === "string" && OPERATORS2.has(operator)) {
|
|
21606
|
+
const { left, right } = node;
|
|
21607
|
+
if (isRecord3(left) && isRecord3(right)) {
|
|
21608
|
+
const leftText = reconstructText(left);
|
|
21609
|
+
const rightText = reconstructText(right);
|
|
21610
|
+
if (leftText !== undefined && rightText !== undefined)
|
|
21611
|
+
text = `${leftText} ${operator} ${rightText}`;
|
|
21612
|
+
}
|
|
21613
|
+
}
|
|
19175
21614
|
}
|
|
19176
|
-
return;
|
|
21615
|
+
return text;
|
|
19177
21616
|
}
|
|
19178
21617
|
function evaluateExpression(node) {
|
|
19179
21618
|
if (!isRecord3(node))
|
|
19180
21619
|
return;
|
|
19181
21620
|
const nodeType = node.type;
|
|
21621
|
+
let value;
|
|
19182
21622
|
if (nodeType === TSESTree7.AST_NODE_TYPES.Literal) {
|
|
19183
|
-
const { value } = node;
|
|
19184
|
-
|
|
21623
|
+
const { value: literalValue } = node;
|
|
21624
|
+
value = isNumber(literalValue) ? literalValue : undefined;
|
|
19185
21625
|
}
|
|
19186
21626
|
if (nodeType === TSESTree7.AST_NODE_TYPES.UnaryExpression) {
|
|
19187
21627
|
const { argument, operator } = node;
|
|
19188
|
-
if (
|
|
19189
|
-
const
|
|
19190
|
-
if (
|
|
19191
|
-
|
|
19192
|
-
if (operator === "
|
|
19193
|
-
|
|
19194
|
-
if (operator === "+")
|
|
19195
|
-
return value;
|
|
21628
|
+
if (isRecord3(argument)) {
|
|
21629
|
+
const argumentValue = evaluateExpression(argument);
|
|
21630
|
+
if (operator === "-" && argumentValue !== undefined)
|
|
21631
|
+
value = -argumentValue;
|
|
21632
|
+
if (operator === "+" && argumentValue !== undefined)
|
|
21633
|
+
value = argumentValue;
|
|
19196
21634
|
}
|
|
19197
|
-
return;
|
|
19198
21635
|
}
|
|
19199
21636
|
if (nodeType === TSESTree7.AST_NODE_TYPES.BinaryExpression) {
|
|
19200
21637
|
const { right, left, operator } = node;
|
|
19201
|
-
if (
|
|
21638
|
+
if (isRecord3(left) && isRecord3(right) && typeof operator === "string" && OPERATORS2.has(operator)) {
|
|
19202
21639
|
const leftValue = evaluateExpression(left);
|
|
19203
21640
|
const rightValue = evaluateExpression(right);
|
|
19204
|
-
if (leftValue
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
case "%":
|
|
19216
|
-
return rightValue === 0 ? undefined : leftValue % rightValue;
|
|
19217
|
-
default:
|
|
19218
|
-
return;
|
|
21641
|
+
if (leftValue !== undefined && rightValue !== undefined) {
|
|
21642
|
+
if (operator === "+")
|
|
21643
|
+
value = leftValue + rightValue;
|
|
21644
|
+
if (operator === "-")
|
|
21645
|
+
value = leftValue - rightValue;
|
|
21646
|
+
if (operator === "*")
|
|
21647
|
+
value = leftValue * rightValue;
|
|
21648
|
+
if (operator === "/")
|
|
21649
|
+
value = rightValue === 0 ? undefined : leftValue / rightValue;
|
|
21650
|
+
if (operator === "%")
|
|
21651
|
+
value = rightValue === 0 ? undefined : leftValue % rightValue;
|
|
19219
21652
|
}
|
|
19220
21653
|
}
|
|
19221
|
-
return;
|
|
19222
21654
|
}
|
|
19223
|
-
return;
|
|
21655
|
+
return value;
|
|
19224
21656
|
}
|
|
19225
21657
|
function collectArguments(_context2, parameters3) {
|
|
19226
21658
|
if (parameters3.length !== 4)
|
|
@@ -19292,6 +21724,145 @@ var preferUDim2Shorthand = {
|
|
|
19292
21724
|
};
|
|
19293
21725
|
var prefer_udim2_shorthand_default = preferUDim2Shorthand;
|
|
19294
21726
|
|
|
21727
|
+
// src/rules/react-hooks-strict-return.ts
|
|
21728
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES10 } from "@typescript-eslint/utils";
|
|
21729
|
+
var MAX_RETURN_ELEMENTS = 2;
|
|
21730
|
+
var HOOK_PATTERN = /^use[A-Z0-9].*$/;
|
|
21731
|
+
function isHookNode(node) {
|
|
21732
|
+
let name;
|
|
21733
|
+
if (node.type === AST_NODE_TYPES10.VariableDeclarator && node.id.type === AST_NODE_TYPES10.Identifier) {
|
|
21734
|
+
({ name } = node.id);
|
|
21735
|
+
} else if (node.type === AST_NODE_TYPES10.FunctionDeclaration && node.id)
|
|
21736
|
+
({ name } = node.id);
|
|
21737
|
+
else if (node.type === AST_NODE_TYPES10.FunctionExpression && node.id)
|
|
21738
|
+
({ name } = node.id);
|
|
21739
|
+
return name !== undefined && HOOK_PATTERN.test(name);
|
|
21740
|
+
}
|
|
21741
|
+
function getVariableByName(scope, name) {
|
|
21742
|
+
let current = scope;
|
|
21743
|
+
while (current) {
|
|
21744
|
+
const variable = current.set.get(name);
|
|
21745
|
+
if (variable)
|
|
21746
|
+
return variable;
|
|
21747
|
+
current = current.upper;
|
|
21748
|
+
}
|
|
21749
|
+
return;
|
|
21750
|
+
}
|
|
21751
|
+
function getArrayElementsFromVariable(scope, name) {
|
|
21752
|
+
const variable = getVariableByName(scope, name);
|
|
21753
|
+
if (!variable)
|
|
21754
|
+
return [];
|
|
21755
|
+
const elements = new Array;
|
|
21756
|
+
for (const ref6 of variable.references) {
|
|
21757
|
+
const { identifier: identifier3 } = ref6;
|
|
21758
|
+
if (!identifier3.parent)
|
|
21759
|
+
continue;
|
|
21760
|
+
const { parent } = identifier3;
|
|
21761
|
+
if (parent.type !== AST_NODE_TYPES10.VariableDeclarator)
|
|
21762
|
+
continue;
|
|
21763
|
+
if (!parent.init || parent.init.type !== AST_NODE_TYPES10.ArrayExpression)
|
|
21764
|
+
continue;
|
|
21765
|
+
elements.push(...parent.init.elements);
|
|
21766
|
+
}
|
|
21767
|
+
return elements;
|
|
21768
|
+
}
|
|
21769
|
+
function countReturnElements(argument, scope) {
|
|
21770
|
+
if (argument.type === AST_NODE_TYPES10.Identifier)
|
|
21771
|
+
return getArrayElementsFromVariable(scope, argument.name).length;
|
|
21772
|
+
if (argument.type !== AST_NODE_TYPES10.ArrayExpression)
|
|
21773
|
+
return 0;
|
|
21774
|
+
let count = 0;
|
|
21775
|
+
for (const element of argument.elements) {
|
|
21776
|
+
if (element === null)
|
|
21777
|
+
count += 1;
|
|
21778
|
+
else if (element.type === AST_NODE_TYPES10.SpreadElement) {
|
|
21779
|
+
if (element.argument.type === AST_NODE_TYPES10.Identifier) {
|
|
21780
|
+
count += getArrayElementsFromVariable(scope, element.argument.name).length;
|
|
21781
|
+
} else if (element.argument.type === AST_NODE_TYPES10.ArrayExpression) {
|
|
21782
|
+
count += element.argument.elements.length;
|
|
21783
|
+
} else
|
|
21784
|
+
count += 1;
|
|
21785
|
+
} else
|
|
21786
|
+
count += 1;
|
|
21787
|
+
}
|
|
21788
|
+
return count;
|
|
21789
|
+
}
|
|
21790
|
+
function exceedsMaxReturnProperties(node, scope) {
|
|
21791
|
+
const { argument } = node;
|
|
21792
|
+
if (argument === null)
|
|
21793
|
+
return false;
|
|
21794
|
+
if (argument.type === AST_NODE_TYPES10.ObjectExpression)
|
|
21795
|
+
return false;
|
|
21796
|
+
if (argument.type === AST_NODE_TYPES10.Identifier) {
|
|
21797
|
+
const variable = getVariableByName(scope, argument.name);
|
|
21798
|
+
if (variable) {
|
|
21799
|
+
for (const { identifier: identifier3 } of variable.references) {
|
|
21800
|
+
const { parent } = identifier3;
|
|
21801
|
+
if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.init?.type === AST_NODE_TYPES10.ObjectExpression) {
|
|
21802
|
+
return false;
|
|
21803
|
+
}
|
|
21804
|
+
}
|
|
21805
|
+
}
|
|
21806
|
+
}
|
|
21807
|
+
return countReturnElements(argument, scope) > MAX_RETURN_ELEMENTS;
|
|
21808
|
+
}
|
|
21809
|
+
var reactHooksStrictReturn = {
|
|
21810
|
+
create(context) {
|
|
21811
|
+
let hookDepth = 0;
|
|
21812
|
+
function enterHook(node) {
|
|
21813
|
+
if (isHookNode(node))
|
|
21814
|
+
hookDepth += 1;
|
|
21815
|
+
}
|
|
21816
|
+
function exitHook(node) {
|
|
21817
|
+
if (isHookNode(node))
|
|
21818
|
+
hookDepth -= 1;
|
|
21819
|
+
}
|
|
21820
|
+
return {
|
|
21821
|
+
ArrowFunctionExpression(node) {
|
|
21822
|
+
const { parent } = node;
|
|
21823
|
+
if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.id.type === AST_NODE_TYPES10.Identifier && HOOK_PATTERN.test(parent.id.name)) {
|
|
21824
|
+
hookDepth += 1;
|
|
21825
|
+
}
|
|
21826
|
+
},
|
|
21827
|
+
"ArrowFunctionExpression:exit"(node) {
|
|
21828
|
+
const { parent } = node;
|
|
21829
|
+
if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.id.type === AST_NODE_TYPES10.Identifier && HOOK_PATTERN.test(parent.id.name)) {
|
|
21830
|
+
hookDepth -= 1;
|
|
21831
|
+
}
|
|
21832
|
+
},
|
|
21833
|
+
FunctionDeclaration: enterHook,
|
|
21834
|
+
"FunctionDeclaration:exit": exitHook,
|
|
21835
|
+
FunctionExpression: enterHook,
|
|
21836
|
+
"FunctionExpression:exit": exitHook,
|
|
21837
|
+
ReturnStatement(node) {
|
|
21838
|
+
if (hookDepth === 0)
|
|
21839
|
+
return;
|
|
21840
|
+
const scope = context.sourceCode.getScope(node);
|
|
21841
|
+
if (exceedsMaxReturnProperties(node, scope)) {
|
|
21842
|
+
context.report({
|
|
21843
|
+
messageId: "hooksStrictReturn",
|
|
21844
|
+
node
|
|
21845
|
+
});
|
|
21846
|
+
}
|
|
21847
|
+
},
|
|
21848
|
+
VariableDeclarator: enterHook,
|
|
21849
|
+
"VariableDeclarator:exit": exitHook
|
|
21850
|
+
};
|
|
21851
|
+
},
|
|
21852
|
+
defaultOptions: [],
|
|
21853
|
+
meta: {
|
|
21854
|
+
docs: {
|
|
21855
|
+
description: "Restrict the number of returned items from React hooks."
|
|
21856
|
+
},
|
|
21857
|
+
messages: {
|
|
21858
|
+
hooksStrictReturn: "React hooks must return a tuple of two or fewer values or a single object."
|
|
21859
|
+
},
|
|
21860
|
+
schema: [],
|
|
21861
|
+
type: "suggestion"
|
|
21862
|
+
}
|
|
21863
|
+
};
|
|
21864
|
+
var react_hooks_strict_return_default = reactHooksStrictReturn;
|
|
21865
|
+
|
|
19295
21866
|
// src/rules/require-named-effect-functions.ts
|
|
19296
21867
|
import { TSESTree as TSESTree8 } from "@typescript-eslint/types";
|
|
19297
21868
|
var DEFAULT_HOOKS = [
|
|
@@ -19625,7 +22196,7 @@ var requireNamedEffectFunctions = {
|
|
|
19625
22196
|
var require_named_effect_functions_default = requireNamedEffectFunctions;
|
|
19626
22197
|
|
|
19627
22198
|
// src/rules/require-paired-calls.ts
|
|
19628
|
-
import { AST_NODE_TYPES as
|
|
22199
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES11 } from "@typescript-eslint/types";
|
|
19629
22200
|
var isStringArray = Compile(build_default.Readonly(build_default.Array(build_default.String())));
|
|
19630
22201
|
var isPairConfiguration = Compile(build_default.Readonly(build_default.Object({
|
|
19631
22202
|
alternatives: build_default.Optional(isStringArray),
|
|
@@ -19643,20 +22214,20 @@ var isRuleOptions3 = Compile(build_default.Partial(build_default.Readonly(build_
|
|
|
19643
22214
|
pairs: build_default.Readonly(build_default.Array(isPairConfiguration))
|
|
19644
22215
|
}))));
|
|
19645
22216
|
var LOOP_NODE_TYPES = new Set([
|
|
19646
|
-
|
|
19647
|
-
|
|
19648
|
-
|
|
19649
|
-
|
|
19650
|
-
|
|
22217
|
+
AST_NODE_TYPES11.DoWhileStatement,
|
|
22218
|
+
AST_NODE_TYPES11.ForInStatement,
|
|
22219
|
+
AST_NODE_TYPES11.ForOfStatement,
|
|
22220
|
+
AST_NODE_TYPES11.ForStatement,
|
|
22221
|
+
AST_NODE_TYPES11.WhileStatement
|
|
19651
22222
|
]);
|
|
19652
22223
|
var DEFAULT_ROBLOX_YIELDING_FUNCTIONS = ["task.wait", "wait", "*.WaitForChild", "*.*Async"];
|
|
19653
22224
|
function getCallName(node) {
|
|
19654
22225
|
const { callee } = node;
|
|
19655
|
-
if (callee.type ===
|
|
22226
|
+
if (callee.type === AST_NODE_TYPES11.Identifier)
|
|
19656
22227
|
return callee.name;
|
|
19657
|
-
if (callee.type ===
|
|
19658
|
-
const object3 = callee.object.type ===
|
|
19659
|
-
const property = callee.property.type ===
|
|
22228
|
+
if (callee.type === AST_NODE_TYPES11.MemberExpression) {
|
|
22229
|
+
const object3 = callee.object.type === AST_NODE_TYPES11.Identifier ? callee.object.name : undefined;
|
|
22230
|
+
const property = callee.property.type === AST_NODE_TYPES11.Identifier ? callee.property.name : undefined;
|
|
19660
22231
|
if (object3 !== undefined && property !== undefined)
|
|
19661
22232
|
return `${object3}.${property}`;
|
|
19662
22233
|
}
|
|
@@ -19692,12 +22263,12 @@ function isLoopLikeStatement(node) {
|
|
|
19692
22263
|
return LOOP_NODE_TYPES.has(node.type);
|
|
19693
22264
|
}
|
|
19694
22265
|
function isSwitchStatement(node) {
|
|
19695
|
-
return node?.type ===
|
|
22266
|
+
return node?.type === AST_NODE_TYPES11.SwitchStatement;
|
|
19696
22267
|
}
|
|
19697
22268
|
function findLabeledStatementBody(label, startingNode) {
|
|
19698
22269
|
let current = startingNode;
|
|
19699
22270
|
while (current) {
|
|
19700
|
-
if (current.type ===
|
|
22271
|
+
if (current.type === AST_NODE_TYPES11.LabeledStatement && current.label.name === label.name)
|
|
19701
22272
|
return current.body;
|
|
19702
22273
|
current = current.parent ?? undefined;
|
|
19703
22274
|
}
|
|
@@ -19950,7 +22521,7 @@ var rule = {
|
|
|
19950
22521
|
function onIfConsequentExit(node) {
|
|
19951
22522
|
const consequentNode = node;
|
|
19952
22523
|
const { parent } = consequentNode;
|
|
19953
|
-
if (parent?.type ===
|
|
22524
|
+
if (parent?.type === AST_NODE_TYPES11.IfStatement) {
|
|
19954
22525
|
const branches = branchStacks.get(parent) ?? [];
|
|
19955
22526
|
branches.push(cloneStack());
|
|
19956
22527
|
branchStacks.set(parent, branches);
|
|
@@ -19965,7 +22536,7 @@ var rule = {
|
|
|
19965
22536
|
function onIfAlternateExit(node) {
|
|
19966
22537
|
const alternateNode = node;
|
|
19967
22538
|
const { parent } = alternateNode;
|
|
19968
|
-
if (parent?.type ===
|
|
22539
|
+
if (parent?.type === AST_NODE_TYPES11.IfStatement) {
|
|
19969
22540
|
const branches = branchStacks.get(parent) ?? [];
|
|
19970
22541
|
branches.push(cloneStack());
|
|
19971
22542
|
branchStacks.set(parent, branches);
|
|
@@ -20014,7 +22585,7 @@ var rule = {
|
|
|
20014
22585
|
function onTryBlockExit(node) {
|
|
20015
22586
|
const blockNode = node;
|
|
20016
22587
|
const { parent } = blockNode;
|
|
20017
|
-
if (parent?.type ===
|
|
22588
|
+
if (parent?.type === AST_NODE_TYPES11.TryStatement) {
|
|
20018
22589
|
const branches = branchStacks.get(parent) ?? [];
|
|
20019
22590
|
branches.push(cloneStack());
|
|
20020
22591
|
branchStacks.set(parent, branches);
|
|
@@ -20033,7 +22604,7 @@ var rule = {
|
|
|
20033
22604
|
function onCatchClauseExit(node) {
|
|
20034
22605
|
const catchNode = node;
|
|
20035
22606
|
const { parent } = catchNode;
|
|
20036
|
-
if (parent?.type ===
|
|
22607
|
+
if (parent?.type === AST_NODE_TYPES11.TryStatement) {
|
|
20037
22608
|
const branches = branchStacks.get(parent) ?? [];
|
|
20038
22609
|
branches.push(cloneStack());
|
|
20039
22610
|
branchStacks.set(parent, branches);
|
|
@@ -20096,7 +22667,7 @@ var rule = {
|
|
|
20096
22667
|
function onSwitchCaseExit(node) {
|
|
20097
22668
|
const caseNode = node;
|
|
20098
22669
|
const { parent } = caseNode;
|
|
20099
|
-
if (parent?.type ===
|
|
22670
|
+
if (parent?.type === AST_NODE_TYPES11.SwitchStatement) {
|
|
20100
22671
|
const branches = branchStacks.get(parent) ?? [];
|
|
20101
22672
|
branches.push(cloneStack());
|
|
20102
22673
|
branchStacks.set(parent, branches);
|
|
@@ -20127,7 +22698,7 @@ var rule = {
|
|
|
20127
22698
|
for (const { opener, config, node: node2 } of openerStack) {
|
|
20128
22699
|
const validClosers = getValidClosers(config);
|
|
20129
22700
|
const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
|
|
20130
|
-
const statementType = statementNode.type ===
|
|
22701
|
+
const statementType = statementNode.type === AST_NODE_TYPES11.ReturnStatement ? "return" : "throw";
|
|
20131
22702
|
const lineNumber = statementNode.loc?.start.line ?? 0;
|
|
20132
22703
|
context.report({
|
|
20133
22704
|
data: {
|
|
@@ -20144,7 +22715,7 @@ var rule = {
|
|
|
20144
22715
|
const statementNode = node;
|
|
20145
22716
|
if (openerStack.length === 0)
|
|
20146
22717
|
return;
|
|
20147
|
-
const targetLoop = statementNode.type ===
|
|
22718
|
+
const targetLoop = statementNode.type === AST_NODE_TYPES11.ContinueStatement ? resolveContinueTargetLoop(statementNode) : resolveBreakTargetLoop(statementNode);
|
|
20148
22719
|
if (!targetLoop)
|
|
20149
22720
|
return;
|
|
20150
22721
|
for (const { node: openerNode, config, opener, loopAncestors } of openerStack) {
|
|
@@ -20152,7 +22723,7 @@ var rule = {
|
|
|
20152
22723
|
continue;
|
|
20153
22724
|
const validClosers = getValidClosers(config);
|
|
20154
22725
|
const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
|
|
20155
|
-
const statementType = statementNode.type ===
|
|
22726
|
+
const statementType = statementNode.type === AST_NODE_TYPES11.BreakStatement ? "break" : "continue";
|
|
20156
22727
|
const lineNumber = statementNode.loc?.start.line ?? 0;
|
|
20157
22728
|
context.report({
|
|
20158
22729
|
data: {
|
|
@@ -20290,7 +22861,7 @@ var rule = {
|
|
|
20290
22861
|
continue;
|
|
20291
22862
|
const validClosers = getValidClosers(config);
|
|
20292
22863
|
const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
|
|
20293
|
-
const asyncType = asyncNode.type ===
|
|
22864
|
+
const asyncType = asyncNode.type === AST_NODE_TYPES11.AwaitExpression ? "await" : "yield";
|
|
20294
22865
|
context.report({
|
|
20295
22866
|
data: { asyncType, closer, opener },
|
|
20296
22867
|
messageId: "asyncViolation",
|
|
@@ -20812,6 +23383,116 @@ var requireReactComponentKeys = {
|
|
|
20812
23383
|
};
|
|
20813
23384
|
var require_react_component_keys_default = requireReactComponentKeys;
|
|
20814
23385
|
|
|
23386
|
+
// src/rules/strict-component-boundaries.ts
|
|
23387
|
+
import { basename, extname, relative } from "node:path";
|
|
23388
|
+
|
|
23389
|
+
// src/utilities/resolve-import.ts
|
|
23390
|
+
var import_oxc_resolver = __toESM(require_oxc_resolver(), 1);
|
|
23391
|
+
import { dirname } from "node:path";
|
|
23392
|
+
var resolver = new import_oxc_resolver.ResolverFactory({
|
|
23393
|
+
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json", ".node"]
|
|
23394
|
+
});
|
|
23395
|
+
function resolveRelativeImport(importSource, sourceFile) {
|
|
23396
|
+
if (!importSource.startsWith("."))
|
|
23397
|
+
return { found: false };
|
|
23398
|
+
const { path: path2 } = resolver.sync(dirname(sourceFile), importSource);
|
|
23399
|
+
if (path2 === undefined || path2 === "")
|
|
23400
|
+
return { found: false };
|
|
23401
|
+
return { found: true, path: path2 };
|
|
23402
|
+
}
|
|
23403
|
+
|
|
23404
|
+
// src/rules/strict-component-boundaries.ts
|
|
23405
|
+
function toRegExp(pattern4) {
|
|
23406
|
+
return new RegExp(pattern4, "i");
|
|
23407
|
+
}
|
|
23408
|
+
function pathSegmentsFromSource(source) {
|
|
23409
|
+
return source.split("/").filter((part) => !part.startsWith("."));
|
|
23410
|
+
}
|
|
23411
|
+
function countParentTraversals(pathDiff) {
|
|
23412
|
+
return pathDiff.split("/").filter((part) => part === "..").length;
|
|
23413
|
+
}
|
|
23414
|
+
function hasAnotherComponentInPath(pathParts) {
|
|
23415
|
+
return pathParts.some((part) => part === toPascalCase(part) && !part.includes("."));
|
|
23416
|
+
}
|
|
23417
|
+
function hasDirectoryInPath(pathParts, directory) {
|
|
23418
|
+
return pathParts.includes(directory);
|
|
23419
|
+
}
|
|
23420
|
+
function isIndexFile(filePath) {
|
|
23421
|
+
return basename(filePath, extname(filePath)) === "index";
|
|
23422
|
+
}
|
|
23423
|
+
function isValidFixtureImport(pathParts) {
|
|
23424
|
+
if (!hasDirectoryInPath(pathParts, "fixtures"))
|
|
23425
|
+
return false;
|
|
23426
|
+
const fixtureIndex = pathParts.indexOf("fixtures");
|
|
23427
|
+
const partsBeforeFixture = pathParts.slice(0, fixtureIndex);
|
|
23428
|
+
return !hasAnotherComponentInPath(partsBeforeFixture);
|
|
23429
|
+
}
|
|
23430
|
+
var strictComponentBoundaries = {
|
|
23431
|
+
create(context) {
|
|
23432
|
+
const [{ allow = [], maxDepth = 1 } = {}] = context.options;
|
|
23433
|
+
const allowPatterns = allow.map(toRegExp);
|
|
23434
|
+
return {
|
|
23435
|
+
ImportDeclaration(node) {
|
|
23436
|
+
const importSource = node.source.value;
|
|
23437
|
+
if (typeof importSource !== "string" || !importSource.startsWith("."))
|
|
23438
|
+
return;
|
|
23439
|
+
if (allowPatterns.some((regexp) => regexp.test(importSource)))
|
|
23440
|
+
return;
|
|
23441
|
+
const filename = context.filename ?? "";
|
|
23442
|
+
if (filename === "")
|
|
23443
|
+
return;
|
|
23444
|
+
const resolved = resolveRelativeImport(importSource, filename);
|
|
23445
|
+
if (!resolved.found)
|
|
23446
|
+
return;
|
|
23447
|
+
const pathDifference = relative(filename, resolved.path);
|
|
23448
|
+
const pathParts = pathSegmentsFromSource(pathDifference);
|
|
23449
|
+
const traversals = countParentTraversals(pathDifference);
|
|
23450
|
+
const isDescendingOnly = traversals <= 1;
|
|
23451
|
+
const hasComponentsDir = hasDirectoryInPath(pathParts, "components");
|
|
23452
|
+
if ((!isDescendingOnly || hasComponentsDir) && hasAnotherComponentInPath(pathParts) && pathParts.length > maxDepth && !isIndexFile(pathDifference) && !isValidFixtureImport(pathParts)) {
|
|
23453
|
+
context.report({
|
|
23454
|
+
messageId: "noReachingIntoComponent",
|
|
23455
|
+
node
|
|
23456
|
+
});
|
|
23457
|
+
return;
|
|
23458
|
+
}
|
|
23459
|
+
if (hasDirectoryInPath(pathParts, "components") && pathParts.length > maxDepth + 1 && !isValidFixtureImport(pathParts)) {
|
|
23460
|
+
context.report({
|
|
23461
|
+
messageId: "noReachingIntoComponent",
|
|
23462
|
+
node
|
|
23463
|
+
});
|
|
23464
|
+
}
|
|
23465
|
+
}
|
|
23466
|
+
};
|
|
23467
|
+
},
|
|
23468
|
+
defaultOptions: [{}],
|
|
23469
|
+
meta: {
|
|
23470
|
+
docs: {
|
|
23471
|
+
description: "Prevent module imports between components."
|
|
23472
|
+
},
|
|
23473
|
+
messages: {
|
|
23474
|
+
noReachingIntoComponent: "Do not reach into an individual component's folder for nested modules. Import from the closest shared components folder instead."
|
|
23475
|
+
},
|
|
23476
|
+
schema: [
|
|
23477
|
+
{
|
|
23478
|
+
additionalProperties: false,
|
|
23479
|
+
properties: {
|
|
23480
|
+
allow: {
|
|
23481
|
+
items: { type: "string" },
|
|
23482
|
+
type: "array"
|
|
23483
|
+
},
|
|
23484
|
+
maxDepth: {
|
|
23485
|
+
type: "integer"
|
|
23486
|
+
}
|
|
23487
|
+
},
|
|
23488
|
+
type: "object"
|
|
23489
|
+
}
|
|
23490
|
+
],
|
|
23491
|
+
type: "problem"
|
|
23492
|
+
}
|
|
23493
|
+
};
|
|
23494
|
+
var strict_component_boundaries_default = strictComponentBoundaries;
|
|
23495
|
+
|
|
20815
23496
|
// src/rules/use-exhaustive-dependencies.ts
|
|
20816
23497
|
import { TSESTree as TSESTree10 } from "@typescript-eslint/types";
|
|
20817
23498
|
var FUNCTION_DECLARATIONS = new Set([
|
|
@@ -21137,13 +23818,13 @@ function collectCaptures(node, sourceCode) {
|
|
|
21137
23818
|
const captureSet = new Set;
|
|
21138
23819
|
function visit(current) {
|
|
21139
23820
|
if (current.type === TSESTree10.AST_NODE_TYPES.Identifier) {
|
|
21140
|
-
const { name } = current;
|
|
21141
|
-
if (captureSet.has(
|
|
23821
|
+
const { name: name2 } = current;
|
|
23822
|
+
if (captureSet.has(name2) || GLOBAL_BUILTINS.has(name2) || isInTypePosition(current))
|
|
21142
23823
|
return;
|
|
21143
23824
|
let variable;
|
|
21144
23825
|
let currentScope = sourceCode.getScope(current);
|
|
21145
23826
|
while (currentScope) {
|
|
21146
|
-
variable = currentScope.set.get(
|
|
23827
|
+
variable = currentScope.set.get(name2);
|
|
21147
23828
|
if (variable)
|
|
21148
23829
|
break;
|
|
21149
23830
|
currentScope = currentScope.upper;
|
|
@@ -21163,14 +23844,14 @@ function collectCaptures(node, sourceCode) {
|
|
|
21163
23844
|
testingMetrics.outerScopeSkip += 1;
|
|
21164
23845
|
return;
|
|
21165
23846
|
}
|
|
21166
|
-
captureSet.add(
|
|
23847
|
+
captureSet.add(name2);
|
|
21167
23848
|
const depthNode = findTopmostMemberExpression(current);
|
|
21168
23849
|
const usagePath = nodeToSafeDependencyPath(depthNode, sourceCode);
|
|
21169
23850
|
const depth = getMemberExpressionDepth(depthNode);
|
|
21170
23851
|
captures.push({
|
|
21171
23852
|
depth,
|
|
21172
23853
|
forceDependency: isComputedPropertyIdentifier(current),
|
|
21173
|
-
name,
|
|
23854
|
+
name: name2,
|
|
21174
23855
|
node: depthNode,
|
|
21175
23856
|
usagePath,
|
|
21176
23857
|
variable
|
|
@@ -21218,18 +23899,18 @@ function parseDependencies(node, sourceCode) {
|
|
|
21218
23899
|
if (!element)
|
|
21219
23900
|
continue;
|
|
21220
23901
|
const actualNode = element.type === TSESTree10.AST_NODE_TYPES.SpreadElement ? element.argument : element;
|
|
21221
|
-
const
|
|
23902
|
+
const name2 = nodeToDependencyString(actualNode, sourceCode);
|
|
21222
23903
|
const depth = getMemberExpressionDepth(actualNode);
|
|
21223
23904
|
dependencies4.push({
|
|
21224
23905
|
depth,
|
|
21225
|
-
name,
|
|
23906
|
+
name: name2,
|
|
21226
23907
|
node: actualNode
|
|
21227
23908
|
});
|
|
21228
23909
|
}
|
|
21229
23910
|
return dependencies4;
|
|
21230
23911
|
}
|
|
21231
|
-
function returnName({ name }) {
|
|
21232
|
-
return
|
|
23912
|
+
function returnName({ name: name2 }) {
|
|
23913
|
+
return name2;
|
|
21233
23914
|
}
|
|
21234
23915
|
function isUnstableValue(node) {
|
|
21235
23916
|
return node ? UNSTABLE_VALUES.has(node.type) : false;
|
|
@@ -21363,7 +24044,7 @@ var useExhaustiveDependencies = {
|
|
|
21363
24044
|
}
|
|
21364
24045
|
const maxCaptureDepth = Math.max(...matchingCaptures.map(({ depth }) => depth));
|
|
21365
24046
|
if (dependency.depth > maxCaptureDepth && options3.reportUnnecessaryDependencies) {
|
|
21366
|
-
const newDependencies = dependencies4.filter(({ name }) =>
|
|
24047
|
+
const newDependencies = dependencies4.filter(({ name: name2 }) => name2 !== dependency.name).map(returnName);
|
|
21367
24048
|
const dependencyString = `[${newDependencies.join(", ")}]`;
|
|
21368
24049
|
context.report({
|
|
21369
24050
|
data: { name: dependency.name },
|
|
@@ -21401,7 +24082,7 @@ var useExhaustiveDependencies = {
|
|
|
21401
24082
|
missingCaptures.push(capture);
|
|
21402
24083
|
}
|
|
21403
24084
|
if (missingCaptures.length > 0) {
|
|
21404
|
-
const dependencyNames = dependencies4.map(({ name }) =>
|
|
24085
|
+
const dependencyNames = dependencies4.map(({ name: name2 }) => name2);
|
|
21405
24086
|
const missingPaths = missingCaptures.map(({ usagePath }) => usagePath);
|
|
21406
24087
|
const newDependencies = [...dependencyNames, ...missingPaths].toSorted();
|
|
21407
24088
|
const newDependenciesString = `[${newDependencies.join(", ")}]`;
|
|
@@ -21543,32 +24224,32 @@ var use_exhaustive_dependencies_default = useExhaustiveDependencies;
|
|
|
21543
24224
|
import { TSESTree as TSESTree11 } from "@typescript-eslint/types";
|
|
21544
24225
|
var HOOK_NAME_PATTERN = /^use[A-Z]/;
|
|
21545
24226
|
var COMPONENT_NAME_PATTERN2 = /^[A-Z]/;
|
|
21546
|
-
function isReactHook(
|
|
21547
|
-
return HOOK_NAME_PATTERN.test(
|
|
24227
|
+
function isReactHook(name2) {
|
|
24228
|
+
return HOOK_NAME_PATTERN.test(name2);
|
|
21548
24229
|
}
|
|
21549
|
-
function isComponent(
|
|
21550
|
-
return COMPONENT_NAME_PATTERN2.test(
|
|
24230
|
+
function isComponent(name2) {
|
|
24231
|
+
return COMPONENT_NAME_PATTERN2.test(name2);
|
|
21551
24232
|
}
|
|
21552
24233
|
function isComponentOrHook(node) {
|
|
21553
24234
|
if (node.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration && node.id) {
|
|
21554
|
-
const { name } = node.id;
|
|
21555
|
-
return isComponent(
|
|
24235
|
+
const { name: name2 } = node.id;
|
|
24236
|
+
return isComponent(name2) || isReactHook(name2);
|
|
21556
24237
|
}
|
|
21557
24238
|
if (node.type === TSESTree11.AST_NODE_TYPES.FunctionExpression || node.type === TSESTree11.AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
21558
24239
|
const { parent } = node;
|
|
21559
|
-
if (
|
|
24240
|
+
if (parent === undefined)
|
|
21560
24241
|
return false;
|
|
21561
24242
|
if (parent.type === TSESTree11.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
21562
|
-
const { name } = parent.id;
|
|
21563
|
-
return isComponent(
|
|
24243
|
+
const { name: name2 } = parent.id;
|
|
24244
|
+
return isComponent(name2) || isReactHook(name2);
|
|
21564
24245
|
}
|
|
21565
24246
|
if (parent.type === TSESTree11.AST_NODE_TYPES.Property && parent.key.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
21566
|
-
const { name } = parent.key;
|
|
21567
|
-
return isComponent(
|
|
24247
|
+
const { name: name2 } = parent.key;
|
|
24248
|
+
return isComponent(name2) || isReactHook(name2);
|
|
21568
24249
|
}
|
|
21569
24250
|
if (parent.type === TSESTree11.AST_NODE_TYPES.MethodDefinition && parent.key.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
21570
|
-
const { name } = parent.key;
|
|
21571
|
-
return isComponent(
|
|
24251
|
+
const { name: name2 } = parent.key;
|
|
24252
|
+
return isComponent(name2) || isReactHook(name2);
|
|
21572
24253
|
}
|
|
21573
24254
|
}
|
|
21574
24255
|
return false;
|
|
@@ -21589,21 +24270,24 @@ var FUNCTION_BOUNDARIES2 = new Set([
|
|
|
21589
24270
|
function isInFinallyBlock(node) {
|
|
21590
24271
|
let current = node.parent;
|
|
21591
24272
|
const maxDepth = 20;
|
|
24273
|
+
let inFinallyBlock = false;
|
|
21592
24274
|
for (let depth = 0;depth < maxDepth && current; depth += 1) {
|
|
21593
24275
|
if (FUNCTION_BOUNDARIES2.has(current.type))
|
|
21594
|
-
|
|
24276
|
+
break;
|
|
21595
24277
|
if (current.type === TSESTree11.AST_NODE_TYPES.TryStatement) {
|
|
21596
24278
|
let checkNode = node;
|
|
21597
24279
|
while (checkNode && checkNode !== current) {
|
|
21598
|
-
if (checkNode === current.finalizer)
|
|
21599
|
-
|
|
24280
|
+
if (checkNode === current.finalizer) {
|
|
24281
|
+
inFinallyBlock = true;
|
|
24282
|
+
break;
|
|
24283
|
+
}
|
|
21600
24284
|
checkNode = checkNode.parent;
|
|
21601
24285
|
}
|
|
21602
|
-
|
|
24286
|
+
break;
|
|
21603
24287
|
}
|
|
21604
24288
|
current = current.parent;
|
|
21605
24289
|
}
|
|
21606
|
-
return
|
|
24290
|
+
return inFinallyBlock;
|
|
21607
24291
|
}
|
|
21608
24292
|
function isRecursiveCall(node, functionName) {
|
|
21609
24293
|
if (!functionName)
|
|
@@ -21662,8 +24346,9 @@ var useHookAtTopLevel = {
|
|
|
21662
24346
|
const current = getCurrentContext();
|
|
21663
24347
|
const depth = current ? current.functionDepth + 1 : 0;
|
|
21664
24348
|
const isComponentOrHookFlag = isComponentOrHook(functionNode);
|
|
21665
|
-
if (functionNode.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration && functionNode.id)
|
|
24349
|
+
if (functionNode.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration && functionNode.id) {
|
|
21666
24350
|
currentFunctionName = functionNode.id.name;
|
|
24351
|
+
}
|
|
21667
24352
|
if (current?.isComponentOrHook) {
|
|
21668
24353
|
pushContext({
|
|
21669
24354
|
afterEarlyReturn: false,
|
|
@@ -21916,8 +24601,8 @@ function createNoShorthandOptions(options3 = {}) {
|
|
|
21916
24601
|
function createEffectFunctionOptions(options3 = {}) {
|
|
21917
24602
|
return { environment: "standard", hooks: [], ...options3 };
|
|
21918
24603
|
}
|
|
21919
|
-
function createHookConfiguration(
|
|
21920
|
-
return { allowAsync: false, name, ...options3 };
|
|
24604
|
+
function createHookConfiguration(name2, options3 = {}) {
|
|
24605
|
+
return { allowAsync: false, name: name2, ...options3 };
|
|
21921
24606
|
}
|
|
21922
24607
|
function createRequirePairedCallsOptions(options3 = {}) {
|
|
21923
24608
|
return {
|
|
@@ -21991,11 +24676,18 @@ var rules = {
|
|
|
21991
24676
|
"no-shorthand-names": no_shorthand_names_default,
|
|
21992
24677
|
"no-useless-use-spring": no_useless_use_spring_default,
|
|
21993
24678
|
"no-warn": no_warn_default,
|
|
24679
|
+
"prefer-class-properties": prefer_class_properties_default,
|
|
24680
|
+
"prefer-early-return": prefer_early_return_default,
|
|
24681
|
+
"prefer-module-scope-constants": prefer_module_scope_constants_default,
|
|
24682
|
+
"prefer-pascal-case-enums": prefer_pascal_case_enums_default,
|
|
21994
24683
|
"prefer-sequence-overloads": prefer_sequence_overloads_default,
|
|
24684
|
+
"prefer-singular-enums": prefer_singular_enums_default,
|
|
21995
24685
|
"prefer-udim2-shorthand": prefer_udim2_shorthand_default,
|
|
24686
|
+
"react-hooks-strict-return": react_hooks_strict_return_default,
|
|
21996
24687
|
"require-named-effect-functions": require_named_effect_functions_default,
|
|
21997
24688
|
"require-paired-calls": require_paired_calls_default,
|
|
21998
24689
|
"require-react-component-keys": require_react_component_keys_default,
|
|
24690
|
+
"strict-component-boundaries": strict_component_boundaries_default,
|
|
21999
24691
|
"use-exhaustive-dependencies": use_exhaustive_dependencies_default,
|
|
22000
24692
|
"use-hook-at-top-level": use_hook_at_top_level_default
|
|
22001
24693
|
};
|
|
@@ -22046,4 +24738,4 @@ export {
|
|
|
22046
24738
|
createBanInstancesOptions
|
|
22047
24739
|
};
|
|
22048
24740
|
|
|
22049
|
-
//# debugId=
|
|
24741
|
+
//# debugId=746CFBCF1D469D6C64756E2164756E21
|