@jsse/eslint-config 0.1.0 → 0.1.3
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 +1 -1
- package/dist/cli.cjs +8 -3
- package/dist/cli.js +8 -3
- package/dist/index.cjs +940 -826
- package/dist/index.d.cts +68 -43
- package/dist/index.d.ts +68 -43
- package/dist/index.js +931 -820
- package/package.json +47 -39
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
9
|
};
|
|
@@ -24,36 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
23
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
24
|
mod
|
|
26
25
|
));
|
|
27
|
-
var __publicField = (obj, key, value) => {
|
|
28
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
29
|
-
return value;
|
|
30
|
-
};
|
|
31
|
-
var __accessCheck = (obj, member, msg) => {
|
|
32
|
-
if (!member.has(obj))
|
|
33
|
-
throw TypeError("Cannot " + msg);
|
|
34
|
-
};
|
|
35
|
-
var __privateGet = (obj, member, getter) => {
|
|
36
|
-
__accessCheck(obj, member, "read from private field");
|
|
37
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
38
|
-
};
|
|
39
|
-
var __privateAdd = (obj, member, value) => {
|
|
40
|
-
if (member.has(obj))
|
|
41
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
42
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
43
|
-
};
|
|
44
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
45
|
-
__accessCheck(obj, member, "write to private field");
|
|
46
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
47
|
-
return value;
|
|
48
|
-
};
|
|
49
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
50
|
-
set _(value) {
|
|
51
|
-
__privateSet(obj, member, value, setter);
|
|
52
|
-
},
|
|
53
|
-
get _() {
|
|
54
|
-
return __privateGet(obj, member, getter);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
26
|
|
|
58
27
|
// node_modules/.pnpm/natural-compare@1.4.0/node_modules/natural-compare/index.js
|
|
59
28
|
var require_natural_compare = __commonJS({
|
|
@@ -143,8 +112,8 @@ var require_sort_keys_fix = __commonJS({
|
|
|
143
112
|
const isValidOrder = isValidOrders[order + (insensitive ? "I" : "") + (natural ? "N" : "")];
|
|
144
113
|
const minKeys = Number(options && options.minKeys) || 2;
|
|
145
114
|
let stack = null;
|
|
146
|
-
const SpreadElement = (
|
|
147
|
-
if (
|
|
115
|
+
const SpreadElement = (node) => {
|
|
116
|
+
if (node.parent.type === "ObjectExpression") {
|
|
148
117
|
stack.prevName = null;
|
|
149
118
|
}
|
|
150
119
|
};
|
|
@@ -161,27 +130,27 @@ var require_sort_keys_fix = __commonJS({
|
|
|
161
130
|
"ObjectExpression:exit"() {
|
|
162
131
|
stack = stack.upper;
|
|
163
132
|
},
|
|
164
|
-
Property(
|
|
165
|
-
if (
|
|
133
|
+
Property(node) {
|
|
134
|
+
if (node.parent.type === "ObjectPattern") {
|
|
166
135
|
return;
|
|
167
136
|
}
|
|
168
|
-
if (
|
|
137
|
+
if (node.parent.properties.length < minKeys) {
|
|
169
138
|
return;
|
|
170
139
|
}
|
|
171
140
|
const prevName = stack.prevName;
|
|
172
141
|
const prevNode = stack.prevNode;
|
|
173
|
-
const thisName = getPropertyName(
|
|
142
|
+
const thisName = getPropertyName(node);
|
|
174
143
|
if (thisName !== null) {
|
|
175
144
|
stack.prevName = thisName;
|
|
176
|
-
stack.prevNode =
|
|
145
|
+
stack.prevNode = node || prevNode;
|
|
177
146
|
}
|
|
178
147
|
if (prevName === null || thisName === null) {
|
|
179
148
|
return;
|
|
180
149
|
}
|
|
181
150
|
if (!isValidOrder(prevName, thisName)) {
|
|
182
151
|
ctx.report({
|
|
183
|
-
node
|
|
184
|
-
loc:
|
|
152
|
+
node,
|
|
153
|
+
loc: node.key.loc,
|
|
185
154
|
messageId: "sortKeys",
|
|
186
155
|
data: {
|
|
187
156
|
thisName,
|
|
@@ -191,13 +160,13 @@ var require_sort_keys_fix = __commonJS({
|
|
|
191
160
|
natural: natural ? "natural " : ""
|
|
192
161
|
},
|
|
193
162
|
fix(fixer) {
|
|
194
|
-
if (
|
|
163
|
+
if (node.parent.__alreadySorted || node.parent.properties.__alreadySorted) {
|
|
195
164
|
return [];
|
|
196
165
|
}
|
|
197
|
-
|
|
198
|
-
|
|
166
|
+
node.parent.__alreadySorted = true;
|
|
167
|
+
node.parent.properties.__alreadySorted = true;
|
|
199
168
|
const src = ctx.getSourceCode();
|
|
200
|
-
const props =
|
|
169
|
+
const props = node.parent.properties;
|
|
201
170
|
const parts = [];
|
|
202
171
|
let part = [];
|
|
203
172
|
props.forEach((p) => {
|
|
@@ -268,21 +237,21 @@ var require_sort_keys_fix = __commonJS({
|
|
|
268
237
|
}
|
|
269
238
|
return fixes;
|
|
270
239
|
};
|
|
271
|
-
var findTokenPrevLine = (
|
|
272
|
-
let t = src.getTokenBefore(
|
|
240
|
+
var findTokenPrevLine = (node, src) => {
|
|
241
|
+
let t = src.getTokenBefore(node);
|
|
273
242
|
while (true) {
|
|
274
|
-
if (!t || t.range[0] <
|
|
243
|
+
if (!t || t.range[0] < node.parent.range[0]) {
|
|
275
244
|
return null;
|
|
276
245
|
}
|
|
277
|
-
if (t.loc.end.line <
|
|
246
|
+
if (t.loc.end.line < node.loc.start.line) {
|
|
278
247
|
return t;
|
|
279
248
|
}
|
|
280
249
|
t = src.getTokenBefore(t);
|
|
281
250
|
}
|
|
282
251
|
};
|
|
283
|
-
var findCommaSameLine = (
|
|
284
|
-
const t = src.getTokenAfter(
|
|
285
|
-
return t && t.value === "," &&
|
|
252
|
+
var findCommaSameLine = (node, src) => {
|
|
253
|
+
const t = src.getTokenAfter(node);
|
|
254
|
+
return t && t.value === "," && node.loc.end.line === t.loc.start.line ? t : null;
|
|
286
255
|
};
|
|
287
256
|
var isValidOrders = {
|
|
288
257
|
asc: (a, b) => a <= b,
|
|
@@ -294,15 +263,15 @@ var require_sort_keys_fix = __commonJS({
|
|
|
294
263
|
descN: (a, b) => isValidOrders.ascN(b, a),
|
|
295
264
|
descIN: (a, b) => isValidOrders.ascIN(b, a)
|
|
296
265
|
};
|
|
297
|
-
var getPropertyName = (
|
|
266
|
+
var getPropertyName = (node) => {
|
|
298
267
|
let prop;
|
|
299
|
-
switch (
|
|
268
|
+
switch (node && node.type) {
|
|
300
269
|
case "Property":
|
|
301
270
|
case "MethodDefinition":
|
|
302
|
-
prop =
|
|
271
|
+
prop = node.key;
|
|
303
272
|
break;
|
|
304
273
|
case "MemberExpression":
|
|
305
|
-
prop =
|
|
274
|
+
prop = node.property;
|
|
306
275
|
break;
|
|
307
276
|
}
|
|
308
277
|
switch (prop && prop.type) {
|
|
@@ -314,12 +283,12 @@ var require_sort_keys_fix = __commonJS({
|
|
|
314
283
|
}
|
|
315
284
|
break;
|
|
316
285
|
case "Identifier":
|
|
317
|
-
if (!
|
|
286
|
+
if (!node.computed) {
|
|
318
287
|
return prop.name;
|
|
319
288
|
}
|
|
320
289
|
break;
|
|
321
290
|
}
|
|
322
|
-
return
|
|
291
|
+
return node.key && node.key.name || null;
|
|
323
292
|
};
|
|
324
293
|
}
|
|
325
294
|
});
|
|
@@ -334,9 +303,9 @@ var require_eslint_plugin_sort_keys = __commonJS({
|
|
|
334
303
|
}
|
|
335
304
|
});
|
|
336
305
|
|
|
337
|
-
// node_modules/.pnpm/globals@
|
|
306
|
+
// node_modules/.pnpm/globals@14.0.0/node_modules/globals/globals.json
|
|
338
307
|
var require_globals = __commonJS({
|
|
339
|
-
"node_modules/.pnpm/globals@
|
|
308
|
+
"node_modules/.pnpm/globals@14.0.0/node_modules/globals/globals.json"(exports, module) {
|
|
340
309
|
module.exports = {
|
|
341
310
|
builtin: {
|
|
342
311
|
AggregateError: false,
|
|
@@ -2338,9 +2307,9 @@ var require_globals = __commonJS({
|
|
|
2338
2307
|
}
|
|
2339
2308
|
});
|
|
2340
2309
|
|
|
2341
|
-
// node_modules/.pnpm/globals@
|
|
2310
|
+
// node_modules/.pnpm/globals@14.0.0/node_modules/globals/index.js
|
|
2342
2311
|
var require_globals2 = __commonJS({
|
|
2343
|
-
"node_modules/.pnpm/globals@
|
|
2312
|
+
"node_modules/.pnpm/globals@14.0.0/node_modules/globals/index.js"(exports, module) {
|
|
2344
2313
|
"use strict";
|
|
2345
2314
|
module.exports = require_globals();
|
|
2346
2315
|
}
|
|
@@ -2351,41 +2320,40 @@ var pluginSortKeys = __toESM(require_eslint_plugin_sort_keys(), 1);
|
|
|
2351
2320
|
import { default as default2 } from "@stylistic/eslint-plugin";
|
|
2352
2321
|
import { default as default3 } from "@typescript-eslint/eslint-plugin";
|
|
2353
2322
|
import * as parserTs from "@typescript-eslint/parser";
|
|
2354
|
-
import { default as default4 } from "eslint-plugin-
|
|
2323
|
+
import { default as default4 } from "eslint-plugin-antfu";
|
|
2324
|
+
import { default as default5 } from "eslint-plugin-eslint-comments";
|
|
2355
2325
|
import * as pluginImport from "eslint-plugin-i";
|
|
2356
|
-
import { default as
|
|
2326
|
+
import { default as default6 } from "eslint-plugin-jsdoc";
|
|
2357
2327
|
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
2358
|
-
import { default as
|
|
2359
|
-
import { default as
|
|
2360
|
-
import { default as
|
|
2361
|
-
import { default as
|
|
2328
|
+
import { default as default7 } from "eslint-plugin-markdown";
|
|
2329
|
+
import { default as default8 } from "eslint-plugin-n";
|
|
2330
|
+
import { default as default9 } from "eslint-plugin-no-only-tests";
|
|
2331
|
+
import { default as default10 } from "eslint-plugin-perfectionist";
|
|
2332
|
+
import { default as default11 } from "eslint-plugin-react";
|
|
2333
|
+
import { default as default12 } from "eslint-plugin-react-hooks";
|
|
2362
2334
|
import * as pluginReactRefresh from "eslint-plugin-react-refresh";
|
|
2363
|
-
import { default as
|
|
2364
|
-
import { default as
|
|
2365
|
-
import { default as
|
|
2366
|
-
import { default as
|
|
2367
|
-
import { default as
|
|
2368
|
-
import { default as default15 } from "eslint-plugin-markdown";
|
|
2369
|
-
import { default as default16 } from "eslint-plugin-perfectionist";
|
|
2335
|
+
import { default as default13 } from "eslint-plugin-tailwindcss";
|
|
2336
|
+
import { default as default14 } from "eslint-plugin-unicorn";
|
|
2337
|
+
import { default as default15 } from "eslint-plugin-unused-imports";
|
|
2338
|
+
import { default as default16 } from "eslint-plugin-vitest";
|
|
2339
|
+
import { default as default17 } from "jsonc-eslint-parser";
|
|
2370
2340
|
|
|
2371
2341
|
// src/configs/comments.ts
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
"eslint-comments/no-unused-enable": "error"
|
|
2385
|
-
}
|
|
2342
|
+
var comments = async () => [
|
|
2343
|
+
{
|
|
2344
|
+
name: "jsse:eslint-comments",
|
|
2345
|
+
plugins: {
|
|
2346
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2347
|
+
"eslint-comments": default5
|
|
2348
|
+
},
|
|
2349
|
+
rules: {
|
|
2350
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
2351
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
2352
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
2353
|
+
"eslint-comments/no-unused-enable": "error"
|
|
2386
2354
|
}
|
|
2387
|
-
|
|
2388
|
-
|
|
2355
|
+
}
|
|
2356
|
+
];
|
|
2389
2357
|
|
|
2390
2358
|
// src/globs.ts
|
|
2391
2359
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -2456,17 +2424,17 @@ var GLOB_EXCLUDE = [
|
|
|
2456
2424
|
];
|
|
2457
2425
|
|
|
2458
2426
|
// src/configs/ignores.ts
|
|
2459
|
-
|
|
2427
|
+
var ignores = async () => {
|
|
2460
2428
|
return [
|
|
2461
2429
|
{
|
|
2462
2430
|
ignores: GLOB_EXCLUDE
|
|
2463
2431
|
}
|
|
2464
2432
|
];
|
|
2465
|
-
}
|
|
2433
|
+
};
|
|
2466
2434
|
|
|
2467
2435
|
// src/configs/imports.ts
|
|
2468
|
-
|
|
2469
|
-
const { stylistic: stylistic2 = true } = options;
|
|
2436
|
+
var imports = async (options) => {
|
|
2437
|
+
const { stylistic: stylistic2 = true } = options ?? {};
|
|
2470
2438
|
return [
|
|
2471
2439
|
{
|
|
2472
2440
|
name: "jsse:imports",
|
|
@@ -2491,13 +2459,17 @@ function imports(options = {}) {
|
|
|
2491
2459
|
}
|
|
2492
2460
|
}
|
|
2493
2461
|
];
|
|
2494
|
-
}
|
|
2462
|
+
};
|
|
2495
2463
|
|
|
2496
2464
|
// src/configs/javascript.ts
|
|
2497
2465
|
var import_globals = __toESM(require_globals2(), 1);
|
|
2498
2466
|
import eslintjs from "@eslint/js";
|
|
2499
|
-
|
|
2500
|
-
const {
|
|
2467
|
+
var javascript = async (options) => {
|
|
2468
|
+
const {
|
|
2469
|
+
isInEditor: isInEditor2 = false,
|
|
2470
|
+
overrides = {},
|
|
2471
|
+
reportUnusedDisableDirectives = true
|
|
2472
|
+
} = options ?? {};
|
|
2501
2473
|
return [
|
|
2502
2474
|
{
|
|
2503
2475
|
languageOptions: {
|
|
@@ -2520,12 +2492,12 @@ function javascript(options = {}) {
|
|
|
2520
2492
|
sourceType: "module"
|
|
2521
2493
|
},
|
|
2522
2494
|
linterOptions: {
|
|
2523
|
-
reportUnusedDisableDirectives
|
|
2495
|
+
reportUnusedDisableDirectives
|
|
2524
2496
|
},
|
|
2525
2497
|
name: "jsse:javascript",
|
|
2526
2498
|
plugins: {
|
|
2527
2499
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2528
|
-
"unused-imports":
|
|
2500
|
+
"unused-imports": default15
|
|
2529
2501
|
},
|
|
2530
2502
|
rules: {
|
|
2531
2503
|
...eslintjs.configs.recommended.rules,
|
|
@@ -2748,25 +2720,26 @@ function javascript(options = {}) {
|
|
|
2748
2720
|
}
|
|
2749
2721
|
}
|
|
2750
2722
|
];
|
|
2751
|
-
}
|
|
2723
|
+
};
|
|
2752
2724
|
|
|
2753
2725
|
// src/configs/jsdoc.ts
|
|
2754
|
-
|
|
2755
|
-
const { stylistic: stylistic2 = true } = options;
|
|
2726
|
+
var jsdoc = async () => {
|
|
2756
2727
|
return [
|
|
2757
2728
|
{
|
|
2758
2729
|
name: "jsse:jsdoc",
|
|
2759
2730
|
plugins: {
|
|
2760
2731
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2761
|
-
jsdoc:
|
|
2732
|
+
jsdoc: default6
|
|
2762
2733
|
},
|
|
2763
2734
|
rules: {
|
|
2764
2735
|
"jsdoc/check-access": "warn",
|
|
2736
|
+
"jsdoc/check-alignment": "warn",
|
|
2765
2737
|
"jsdoc/check-param-names": "warn",
|
|
2766
2738
|
"jsdoc/check-property-names": "warn",
|
|
2767
2739
|
"jsdoc/check-types": "warn",
|
|
2768
2740
|
"jsdoc/empty-tags": "warn",
|
|
2769
2741
|
"jsdoc/implements-on-classes": "warn",
|
|
2742
|
+
"jsdoc/multiline-blocks": "warn",
|
|
2770
2743
|
"jsdoc/no-defaults": "warn",
|
|
2771
2744
|
"jsdoc/no-multi-asterisks": "warn",
|
|
2772
2745
|
"jsdoc/require-param-name": "warn",
|
|
@@ -2775,19 +2748,15 @@ function jsdoc(options = {}) {
|
|
|
2775
2748
|
"jsdoc/require-property-name": "warn",
|
|
2776
2749
|
"jsdoc/require-returns-check": "warn",
|
|
2777
2750
|
"jsdoc/require-returns-description": "warn",
|
|
2778
|
-
"jsdoc/require-yields-check": "warn"
|
|
2779
|
-
...stylistic2 ? {
|
|
2780
|
-
"jsdoc/check-alignment": "warn",
|
|
2781
|
-
"jsdoc/multiline-blocks": "warn"
|
|
2782
|
-
} : {}
|
|
2751
|
+
"jsdoc/require-yields-check": "warn"
|
|
2783
2752
|
}
|
|
2784
2753
|
}
|
|
2785
2754
|
];
|
|
2786
|
-
}
|
|
2755
|
+
};
|
|
2787
2756
|
|
|
2788
2757
|
// src/configs/jsonc.ts
|
|
2789
|
-
|
|
2790
|
-
const { overrides = {}, stylistic: stylistic2 = true } = options;
|
|
2758
|
+
var jsonc = async (options) => {
|
|
2759
|
+
const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
|
|
2791
2760
|
const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
2792
2761
|
return [
|
|
2793
2762
|
{
|
|
@@ -2800,7 +2769,7 @@ function jsonc(options = {}) {
|
|
|
2800
2769
|
{
|
|
2801
2770
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
2802
2771
|
languageOptions: {
|
|
2803
|
-
parser:
|
|
2772
|
+
parser: default17
|
|
2804
2773
|
},
|
|
2805
2774
|
name: "jsse:jsonc:rules",
|
|
2806
2775
|
rules: {
|
|
@@ -2855,30 +2824,42 @@ function jsonc(options = {}) {
|
|
|
2855
2824
|
}
|
|
2856
2825
|
}
|
|
2857
2826
|
];
|
|
2858
|
-
}
|
|
2827
|
+
};
|
|
2859
2828
|
|
|
2860
|
-
// src/configs/
|
|
2861
|
-
|
|
2829
|
+
// src/configs/n.ts
|
|
2830
|
+
var n = async () => {
|
|
2862
2831
|
return [
|
|
2863
2832
|
{
|
|
2864
|
-
name: "jsse:
|
|
2833
|
+
name: "jsse:n",
|
|
2865
2834
|
plugins: {
|
|
2866
2835
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2867
|
-
|
|
2836
|
+
n: default8
|
|
2868
2837
|
},
|
|
2869
2838
|
rules: {
|
|
2870
|
-
"
|
|
2871
|
-
"
|
|
2872
|
-
"
|
|
2873
|
-
"
|
|
2874
|
-
"
|
|
2875
|
-
"
|
|
2876
|
-
"
|
|
2877
|
-
"
|
|
2839
|
+
"n/handle-callback-err": ["error", "^(err|error)$"],
|
|
2840
|
+
"n/no-deprecated-api": "error",
|
|
2841
|
+
"n/no-exports-assign": "error",
|
|
2842
|
+
"n/no-new-require": "error",
|
|
2843
|
+
"n/no-path-concat": "error",
|
|
2844
|
+
"n/prefer-global/buffer": ["error", "never"],
|
|
2845
|
+
"n/prefer-global/process": ["error", "never"],
|
|
2846
|
+
"n/process-exit-as-throw": "error"
|
|
2878
2847
|
}
|
|
2879
2848
|
}
|
|
2880
2849
|
];
|
|
2881
|
-
}
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
// src/configs/perfectionist.ts
|
|
2853
|
+
var perfectionist = async () => {
|
|
2854
|
+
return [
|
|
2855
|
+
{
|
|
2856
|
+
name: "jsse:perfectionist",
|
|
2857
|
+
plugins: {
|
|
2858
|
+
perfectionist: default10
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
];
|
|
2862
|
+
};
|
|
2882
2863
|
|
|
2883
2864
|
// src/configs/prettier.ts
|
|
2884
2865
|
function eslintConfigPrettierRules() {
|
|
@@ -2995,16 +2976,14 @@ function eslintConfigPrettierRules() {
|
|
|
2995
2976
|
"yield-star-spacing": "off"
|
|
2996
2977
|
};
|
|
2997
2978
|
}
|
|
2998
|
-
|
|
2979
|
+
var prettier = async () => {
|
|
2999
2980
|
return [
|
|
3000
2981
|
{
|
|
3001
2982
|
name: "jsse:prettier",
|
|
3002
|
-
rules:
|
|
3003
|
-
...eslintConfigPrettierRules()
|
|
3004
|
-
}
|
|
2983
|
+
rules: eslintConfigPrettierRules()
|
|
3005
2984
|
}
|
|
3006
2985
|
];
|
|
3007
|
-
}
|
|
2986
|
+
};
|
|
3008
2987
|
|
|
3009
2988
|
// src/configs/ts/typescript-language-options.ts
|
|
3010
2989
|
import process2 from "process";
|
|
@@ -3208,7 +3187,7 @@ function reactHooks() {
|
|
|
3208
3187
|
{
|
|
3209
3188
|
files: [GLOB_SRC],
|
|
3210
3189
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3211
|
-
plugins: { "react-hooks":
|
|
3190
|
+
plugins: { "react-hooks": default12 },
|
|
3212
3191
|
rules: {
|
|
3213
3192
|
"react-hooks/exhaustive-deps": "error",
|
|
3214
3193
|
"react-hooks/rules-of-hooks": "error"
|
|
@@ -3263,7 +3242,7 @@ function reactRecomendedRules() {
|
|
|
3263
3242
|
"react/require-render-return": 2
|
|
3264
3243
|
};
|
|
3265
3244
|
}
|
|
3266
|
-
|
|
3245
|
+
var react = async (options) => {
|
|
3267
3246
|
const {
|
|
3268
3247
|
componentExts,
|
|
3269
3248
|
parserOptions = {},
|
|
@@ -3283,9 +3262,9 @@ function react(options) {
|
|
|
3283
3262
|
name: "jsse:react:setup",
|
|
3284
3263
|
plugins: {
|
|
3285
3264
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3286
|
-
react:
|
|
3265
|
+
react: default11,
|
|
3287
3266
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3288
|
-
"react-hooks":
|
|
3267
|
+
"react-hooks": default12
|
|
3289
3268
|
}
|
|
3290
3269
|
},
|
|
3291
3270
|
{
|
|
@@ -3294,7 +3273,7 @@ function react(options) {
|
|
|
3294
3273
|
rules: {
|
|
3295
3274
|
...reactRecomendedRules(),
|
|
3296
3275
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
3297
|
-
...
|
|
3276
|
+
...default11.configs["jsx-runtime"].rules,
|
|
3298
3277
|
...reactRules()
|
|
3299
3278
|
},
|
|
3300
3279
|
settings: {
|
|
@@ -3308,10 +3287,10 @@ function react(options) {
|
|
|
3308
3287
|
config.push(...reactRefreshFlatConfigs());
|
|
3309
3288
|
}
|
|
3310
3289
|
return config;
|
|
3311
|
-
}
|
|
3290
|
+
};
|
|
3312
3291
|
|
|
3313
3292
|
// src/configs/sort.ts
|
|
3314
|
-
|
|
3293
|
+
var sortPackageJson = async () => {
|
|
3315
3294
|
return [
|
|
3316
3295
|
{
|
|
3317
3296
|
files: ["**/package.json"],
|
|
@@ -3394,8 +3373,8 @@ function sortPackageJson() {
|
|
|
3394
3373
|
}
|
|
3395
3374
|
}
|
|
3396
3375
|
];
|
|
3397
|
-
}
|
|
3398
|
-
|
|
3376
|
+
};
|
|
3377
|
+
var sortTsconfig = async () => {
|
|
3399
3378
|
return [
|
|
3400
3379
|
{
|
|
3401
3380
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
@@ -3519,7 +3498,7 @@ function sortTsconfig() {
|
|
|
3519
3498
|
}
|
|
3520
3499
|
}
|
|
3521
3500
|
];
|
|
3522
|
-
}
|
|
3501
|
+
};
|
|
3523
3502
|
|
|
3524
3503
|
// src/utils.ts
|
|
3525
3504
|
import process3 from "process";
|
|
@@ -3528,6 +3507,12 @@ function combine(...configs) {
|
|
|
3528
3507
|
(config) => Array.isArray(config) ? config : [config]
|
|
3529
3508
|
);
|
|
3530
3509
|
}
|
|
3510
|
+
async function combineAsync(...configs) {
|
|
3511
|
+
const resolved = await Promise.all(configs);
|
|
3512
|
+
return resolved.flatMap(
|
|
3513
|
+
(config) => Array.isArray(config) ? config : [config]
|
|
3514
|
+
);
|
|
3515
|
+
}
|
|
3531
3516
|
function renameRules(rules, from, to) {
|
|
3532
3517
|
if (from === to) {
|
|
3533
3518
|
return rules;
|
|
@@ -3541,6 +3526,10 @@ function renameRules(rules, from, to) {
|
|
|
3541
3526
|
})
|
|
3542
3527
|
);
|
|
3543
3528
|
}
|
|
3529
|
+
async function interopDefault(m) {
|
|
3530
|
+
const resolved = await m;
|
|
3531
|
+
return resolved.default || resolved;
|
|
3532
|
+
}
|
|
3544
3533
|
function isCI() {
|
|
3545
3534
|
return !!process3.env.CI;
|
|
3546
3535
|
}
|
|
@@ -3549,14 +3538,14 @@ function isInEditor() {
|
|
|
3549
3538
|
}
|
|
3550
3539
|
|
|
3551
3540
|
// src/configs/test.ts
|
|
3552
|
-
|
|
3541
|
+
var test = async (options = {}) => {
|
|
3553
3542
|
const { isInEditor: isInEditor2 = false, overrides = {} } = options;
|
|
3554
3543
|
return [
|
|
3555
3544
|
{
|
|
3556
3545
|
name: "jsse:test:setup",
|
|
3557
3546
|
plugins: {
|
|
3558
|
-
"no-only-tests":
|
|
3559
|
-
vitest:
|
|
3547
|
+
"no-only-tests": default9,
|
|
3548
|
+
vitest: default16
|
|
3560
3549
|
}
|
|
3561
3550
|
},
|
|
3562
3551
|
{
|
|
@@ -3576,7 +3565,7 @@ function test(options = {}) {
|
|
|
3576
3565
|
}
|
|
3577
3566
|
}
|
|
3578
3567
|
];
|
|
3579
|
-
}
|
|
3568
|
+
};
|
|
3580
3569
|
|
|
3581
3570
|
// src/configs/ts/typescript-rules.ts
|
|
3582
3571
|
function typescriptRulesTypeAware() {
|
|
@@ -4008,7 +3997,7 @@ function typescriptRules(props) {
|
|
|
4008
3997
|
}
|
|
4009
3998
|
|
|
4010
3999
|
// src/configs/ts/typescript.ts
|
|
4011
|
-
function typescript(options) {
|
|
4000
|
+
async function typescript(options) {
|
|
4012
4001
|
const {
|
|
4013
4002
|
componentExts = [],
|
|
4014
4003
|
overrides = {},
|
|
@@ -4041,6 +4030,7 @@ function typescript(options) {
|
|
|
4041
4030
|
[tsPrefixTo]: default3
|
|
4042
4031
|
}
|
|
4043
4032
|
},
|
|
4033
|
+
// ...tseslint.configs.recommended,
|
|
4044
4034
|
{
|
|
4045
4035
|
// use ts parser for js files as well!
|
|
4046
4036
|
files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
@@ -4102,13 +4092,13 @@ function unicornOff() {
|
|
|
4102
4092
|
// Super insanely annoying rule
|
|
4103
4093
|
};
|
|
4104
4094
|
}
|
|
4105
|
-
|
|
4095
|
+
var unicorn = async () => {
|
|
4106
4096
|
return [
|
|
4107
4097
|
{
|
|
4108
4098
|
name: "jsse:unicorn",
|
|
4109
4099
|
plugins: {
|
|
4110
4100
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
4111
|
-
unicorn:
|
|
4101
|
+
unicorn: default14
|
|
4112
4102
|
},
|
|
4113
4103
|
rules: {
|
|
4114
4104
|
...unicornOff(),
|
|
@@ -4183,19 +4173,7 @@ function unicorn() {
|
|
|
4183
4173
|
}
|
|
4184
4174
|
}
|
|
4185
4175
|
];
|
|
4186
|
-
}
|
|
4187
|
-
|
|
4188
|
-
// src/configs/perfectionist.ts
|
|
4189
|
-
function perfectionist() {
|
|
4190
|
-
return [
|
|
4191
|
-
{
|
|
4192
|
-
name: "jsse:perfectionist",
|
|
4193
|
-
plugins: {
|
|
4194
|
-
perfectionist: default16
|
|
4195
|
-
}
|
|
4196
|
-
}
|
|
4197
|
-
];
|
|
4198
|
-
}
|
|
4176
|
+
};
|
|
4199
4177
|
|
|
4200
4178
|
// src/factory.ts
|
|
4201
4179
|
import fs2 from "fs";
|
|
@@ -4451,8 +4429,8 @@ var Position = function Position2(line, col) {
|
|
|
4451
4429
|
this.line = line;
|
|
4452
4430
|
this.column = col;
|
|
4453
4431
|
};
|
|
4454
|
-
Position.prototype.offset = function offset(
|
|
4455
|
-
return new Position(this.line, this.column +
|
|
4432
|
+
Position.prototype.offset = function offset(n2) {
|
|
4433
|
+
return new Position(this.line, this.column + n2);
|
|
4456
4434
|
};
|
|
4457
4435
|
var SourceLocation = function SourceLocation2(p, start, end) {
|
|
4458
4436
|
this.start = start;
|
|
@@ -4688,9 +4666,9 @@ var Parser = function Parser2(options, input, startPos) {
|
|
|
4688
4666
|
};
|
|
4689
4667
|
var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
|
|
4690
4668
|
Parser.prototype.parse = function parse() {
|
|
4691
|
-
var
|
|
4669
|
+
var node = this.options.program || this.startNode();
|
|
4692
4670
|
this.nextToken();
|
|
4693
|
-
return this.parseTopLevel(
|
|
4671
|
+
return this.parseTopLevel(node);
|
|
4694
4672
|
};
|
|
4695
4673
|
prototypeAccessors.inFunction.get = function() {
|
|
4696
4674
|
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
|
|
@@ -4885,14 +4863,14 @@ pp$9.isSimpleAssignTarget = function(expr) {
|
|
|
4885
4863
|
return expr.type === "Identifier" || expr.type === "MemberExpression";
|
|
4886
4864
|
};
|
|
4887
4865
|
var pp$8 = Parser.prototype;
|
|
4888
|
-
pp$8.parseTopLevel = function(
|
|
4866
|
+
pp$8.parseTopLevel = function(node) {
|
|
4889
4867
|
var exports = /* @__PURE__ */ Object.create(null);
|
|
4890
|
-
if (!
|
|
4891
|
-
|
|
4868
|
+
if (!node.body) {
|
|
4869
|
+
node.body = [];
|
|
4892
4870
|
}
|
|
4893
4871
|
while (this.type !== types$1.eof) {
|
|
4894
4872
|
var stmt = this.parseStatement(null, true, exports);
|
|
4895
|
-
|
|
4873
|
+
node.body.push(stmt);
|
|
4896
4874
|
}
|
|
4897
4875
|
if (this.inModule) {
|
|
4898
4876
|
for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) {
|
|
@@ -4900,10 +4878,10 @@ pp$8.parseTopLevel = function(node2) {
|
|
|
4900
4878
|
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
|
|
4901
4879
|
}
|
|
4902
4880
|
}
|
|
4903
|
-
this.adaptDirectivePrologue(
|
|
4881
|
+
this.adaptDirectivePrologue(node.body);
|
|
4904
4882
|
this.next();
|
|
4905
|
-
|
|
4906
|
-
return this.finishNode(
|
|
4883
|
+
node.sourceType = this.options.sourceType;
|
|
4884
|
+
return this.finishNode(node, "Program");
|
|
4907
4885
|
};
|
|
4908
4886
|
var loopLabel = { kind: "loop" };
|
|
4909
4887
|
var switchLabel = { kind: "switch" };
|
|
@@ -4948,7 +4926,7 @@ pp$8.isAsyncFunction = function() {
|
|
|
4948
4926
|
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320));
|
|
4949
4927
|
};
|
|
4950
4928
|
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
4951
|
-
var starttype = this.type,
|
|
4929
|
+
var starttype = this.type, node = this.startNode(), kind;
|
|
4952
4930
|
if (this.isLet(context)) {
|
|
4953
4931
|
starttype = types$1._var;
|
|
4954
4932
|
kind = "let";
|
|
@@ -4956,48 +4934,48 @@ pp$8.parseStatement = function(context, topLevel, exports) {
|
|
|
4956
4934
|
switch (starttype) {
|
|
4957
4935
|
case types$1._break:
|
|
4958
4936
|
case types$1._continue:
|
|
4959
|
-
return this.parseBreakContinueStatement(
|
|
4937
|
+
return this.parseBreakContinueStatement(node, starttype.keyword);
|
|
4960
4938
|
case types$1._debugger:
|
|
4961
|
-
return this.parseDebuggerStatement(
|
|
4939
|
+
return this.parseDebuggerStatement(node);
|
|
4962
4940
|
case types$1._do:
|
|
4963
|
-
return this.parseDoStatement(
|
|
4941
|
+
return this.parseDoStatement(node);
|
|
4964
4942
|
case types$1._for:
|
|
4965
|
-
return this.parseForStatement(
|
|
4943
|
+
return this.parseForStatement(node);
|
|
4966
4944
|
case types$1._function:
|
|
4967
4945
|
if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) {
|
|
4968
4946
|
this.unexpected();
|
|
4969
4947
|
}
|
|
4970
|
-
return this.parseFunctionStatement(
|
|
4948
|
+
return this.parseFunctionStatement(node, false, !context);
|
|
4971
4949
|
case types$1._class:
|
|
4972
4950
|
if (context) {
|
|
4973
4951
|
this.unexpected();
|
|
4974
4952
|
}
|
|
4975
|
-
return this.parseClass(
|
|
4953
|
+
return this.parseClass(node, true);
|
|
4976
4954
|
case types$1._if:
|
|
4977
|
-
return this.parseIfStatement(
|
|
4955
|
+
return this.parseIfStatement(node);
|
|
4978
4956
|
case types$1._return:
|
|
4979
|
-
return this.parseReturnStatement(
|
|
4957
|
+
return this.parseReturnStatement(node);
|
|
4980
4958
|
case types$1._switch:
|
|
4981
|
-
return this.parseSwitchStatement(
|
|
4959
|
+
return this.parseSwitchStatement(node);
|
|
4982
4960
|
case types$1._throw:
|
|
4983
|
-
return this.parseThrowStatement(
|
|
4961
|
+
return this.parseThrowStatement(node);
|
|
4984
4962
|
case types$1._try:
|
|
4985
|
-
return this.parseTryStatement(
|
|
4963
|
+
return this.parseTryStatement(node);
|
|
4986
4964
|
case types$1._const:
|
|
4987
4965
|
case types$1._var:
|
|
4988
4966
|
kind = kind || this.value;
|
|
4989
4967
|
if (context && kind !== "var") {
|
|
4990
4968
|
this.unexpected();
|
|
4991
4969
|
}
|
|
4992
|
-
return this.parseVarStatement(
|
|
4970
|
+
return this.parseVarStatement(node, kind);
|
|
4993
4971
|
case types$1._while:
|
|
4994
|
-
return this.parseWhileStatement(
|
|
4972
|
+
return this.parseWhileStatement(node);
|
|
4995
4973
|
case types$1._with:
|
|
4996
|
-
return this.parseWithStatement(
|
|
4974
|
+
return this.parseWithStatement(node);
|
|
4997
4975
|
case types$1.braceL:
|
|
4998
|
-
return this.parseBlock(true,
|
|
4976
|
+
return this.parseBlock(true, node);
|
|
4999
4977
|
case types$1.semi:
|
|
5000
|
-
return this.parseEmptyStatement(
|
|
4978
|
+
return this.parseEmptyStatement(node);
|
|
5001
4979
|
case types$1._export:
|
|
5002
4980
|
case types$1._import:
|
|
5003
4981
|
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
@@ -5005,7 +4983,7 @@ pp$8.parseStatement = function(context, topLevel, exports) {
|
|
|
5005
4983
|
var skip = skipWhiteSpace.exec(this.input);
|
|
5006
4984
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
5007
4985
|
if (nextCh === 40 || nextCh === 46) {
|
|
5008
|
-
return this.parseExpressionStatement(
|
|
4986
|
+
return this.parseExpressionStatement(node, this.parseExpression());
|
|
5009
4987
|
}
|
|
5010
4988
|
}
|
|
5011
4989
|
if (!this.options.allowImportExportEverywhere) {
|
|
@@ -5016,71 +4994,71 @@ pp$8.parseStatement = function(context, topLevel, exports) {
|
|
|
5016
4994
|
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
|
|
5017
4995
|
}
|
|
5018
4996
|
}
|
|
5019
|
-
return starttype === types$1._import ? this.parseImport(
|
|
4997
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports);
|
|
5020
4998
|
default:
|
|
5021
4999
|
if (this.isAsyncFunction()) {
|
|
5022
5000
|
if (context) {
|
|
5023
5001
|
this.unexpected();
|
|
5024
5002
|
}
|
|
5025
5003
|
this.next();
|
|
5026
|
-
return this.parseFunctionStatement(
|
|
5004
|
+
return this.parseFunctionStatement(node, true, !context);
|
|
5027
5005
|
}
|
|
5028
5006
|
var maybeName = this.value, expr = this.parseExpression();
|
|
5029
5007
|
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
|
|
5030
|
-
return this.parseLabeledStatement(
|
|
5008
|
+
return this.parseLabeledStatement(node, maybeName, expr, context);
|
|
5031
5009
|
} else {
|
|
5032
|
-
return this.parseExpressionStatement(
|
|
5010
|
+
return this.parseExpressionStatement(node, expr);
|
|
5033
5011
|
}
|
|
5034
5012
|
}
|
|
5035
5013
|
};
|
|
5036
|
-
pp$8.parseBreakContinueStatement = function(
|
|
5014
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
5037
5015
|
var isBreak = keyword === "break";
|
|
5038
5016
|
this.next();
|
|
5039
5017
|
if (this.eat(types$1.semi) || this.insertSemicolon()) {
|
|
5040
|
-
|
|
5018
|
+
node.label = null;
|
|
5041
5019
|
} else if (this.type !== types$1.name) {
|
|
5042
5020
|
this.unexpected();
|
|
5043
5021
|
} else {
|
|
5044
|
-
|
|
5022
|
+
node.label = this.parseIdent();
|
|
5045
5023
|
this.semicolon();
|
|
5046
5024
|
}
|
|
5047
5025
|
var i = 0;
|
|
5048
5026
|
for (; i < this.labels.length; ++i) {
|
|
5049
5027
|
var lab = this.labels[i];
|
|
5050
|
-
if (
|
|
5028
|
+
if (node.label == null || lab.name === node.label.name) {
|
|
5051
5029
|
if (lab.kind != null && (isBreak || lab.kind === "loop")) {
|
|
5052
5030
|
break;
|
|
5053
5031
|
}
|
|
5054
|
-
if (
|
|
5032
|
+
if (node.label && isBreak) {
|
|
5055
5033
|
break;
|
|
5056
5034
|
}
|
|
5057
5035
|
}
|
|
5058
5036
|
}
|
|
5059
5037
|
if (i === this.labels.length) {
|
|
5060
|
-
this.raise(
|
|
5038
|
+
this.raise(node.start, "Unsyntactic " + keyword);
|
|
5061
5039
|
}
|
|
5062
|
-
return this.finishNode(
|
|
5040
|
+
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
|
|
5063
5041
|
};
|
|
5064
|
-
pp$8.parseDebuggerStatement = function(
|
|
5042
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
5065
5043
|
this.next();
|
|
5066
5044
|
this.semicolon();
|
|
5067
|
-
return this.finishNode(
|
|
5045
|
+
return this.finishNode(node, "DebuggerStatement");
|
|
5068
5046
|
};
|
|
5069
|
-
pp$8.parseDoStatement = function(
|
|
5047
|
+
pp$8.parseDoStatement = function(node) {
|
|
5070
5048
|
this.next();
|
|
5071
5049
|
this.labels.push(loopLabel);
|
|
5072
|
-
|
|
5050
|
+
node.body = this.parseStatement("do");
|
|
5073
5051
|
this.labels.pop();
|
|
5074
5052
|
this.expect(types$1._while);
|
|
5075
|
-
|
|
5053
|
+
node.test = this.parseParenExpression();
|
|
5076
5054
|
if (this.options.ecmaVersion >= 6) {
|
|
5077
5055
|
this.eat(types$1.semi);
|
|
5078
5056
|
} else {
|
|
5079
5057
|
this.semicolon();
|
|
5080
5058
|
}
|
|
5081
|
-
return this.finishNode(
|
|
5059
|
+
return this.finishNode(node, "DoWhileStatement");
|
|
5082
5060
|
};
|
|
5083
|
-
pp$8.parseForStatement = function(
|
|
5061
|
+
pp$8.parseForStatement = function(node) {
|
|
5084
5062
|
this.next();
|
|
5085
5063
|
var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
5086
5064
|
this.labels.push(loopLabel);
|
|
@@ -5090,7 +5068,7 @@ pp$8.parseForStatement = function(node2) {
|
|
|
5090
5068
|
if (awaitAt > -1) {
|
|
5091
5069
|
this.unexpected(awaitAt);
|
|
5092
5070
|
}
|
|
5093
|
-
return this.parseFor(
|
|
5071
|
+
return this.parseFor(node, null);
|
|
5094
5072
|
}
|
|
5095
5073
|
var isLet = this.isLet();
|
|
5096
5074
|
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
@@ -5105,15 +5083,15 @@ pp$8.parseForStatement = function(node2) {
|
|
|
5105
5083
|
this.unexpected(awaitAt);
|
|
5106
5084
|
}
|
|
5107
5085
|
} else {
|
|
5108
|
-
|
|
5086
|
+
node.await = awaitAt > -1;
|
|
5109
5087
|
}
|
|
5110
5088
|
}
|
|
5111
|
-
return this.parseForIn(
|
|
5089
|
+
return this.parseForIn(node, init$1);
|
|
5112
5090
|
}
|
|
5113
5091
|
if (awaitAt > -1) {
|
|
5114
5092
|
this.unexpected(awaitAt);
|
|
5115
5093
|
}
|
|
5116
|
-
return this.parseFor(
|
|
5094
|
+
return this.parseFor(node, init$1);
|
|
5117
5095
|
}
|
|
5118
5096
|
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
5119
5097
|
var refDestructuringErrors = new DestructuringErrors();
|
|
@@ -5125,7 +5103,7 @@ pp$8.parseForStatement = function(node2) {
|
|
|
5125
5103
|
this.unexpected(awaitAt);
|
|
5126
5104
|
}
|
|
5127
5105
|
} else {
|
|
5128
|
-
|
|
5106
|
+
node.await = awaitAt > -1;
|
|
5129
5107
|
}
|
|
5130
5108
|
}
|
|
5131
5109
|
if (startsWithLet && isForOf) {
|
|
@@ -5133,43 +5111,43 @@ pp$8.parseForStatement = function(node2) {
|
|
|
5133
5111
|
}
|
|
5134
5112
|
this.toAssignable(init, false, refDestructuringErrors);
|
|
5135
5113
|
this.checkLValPattern(init);
|
|
5136
|
-
return this.parseForIn(
|
|
5114
|
+
return this.parseForIn(node, init);
|
|
5137
5115
|
} else {
|
|
5138
5116
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
5139
5117
|
}
|
|
5140
5118
|
if (awaitAt > -1) {
|
|
5141
5119
|
this.unexpected(awaitAt);
|
|
5142
5120
|
}
|
|
5143
|
-
return this.parseFor(
|
|
5121
|
+
return this.parseFor(node, init);
|
|
5144
5122
|
};
|
|
5145
|
-
pp$8.parseFunctionStatement = function(
|
|
5123
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
5146
5124
|
this.next();
|
|
5147
|
-
return this.parseFunction(
|
|
5125
|
+
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
|
|
5148
5126
|
};
|
|
5149
|
-
pp$8.parseIfStatement = function(
|
|
5127
|
+
pp$8.parseIfStatement = function(node) {
|
|
5150
5128
|
this.next();
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
return this.finishNode(
|
|
5129
|
+
node.test = this.parseParenExpression();
|
|
5130
|
+
node.consequent = this.parseStatement("if");
|
|
5131
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
5132
|
+
return this.finishNode(node, "IfStatement");
|
|
5155
5133
|
};
|
|
5156
|
-
pp$8.parseReturnStatement = function(
|
|
5134
|
+
pp$8.parseReturnStatement = function(node) {
|
|
5157
5135
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
|
|
5158
5136
|
this.raise(this.start, "'return' outside of function");
|
|
5159
5137
|
}
|
|
5160
5138
|
this.next();
|
|
5161
5139
|
if (this.eat(types$1.semi) || this.insertSemicolon()) {
|
|
5162
|
-
|
|
5140
|
+
node.argument = null;
|
|
5163
5141
|
} else {
|
|
5164
|
-
|
|
5142
|
+
node.argument = this.parseExpression();
|
|
5165
5143
|
this.semicolon();
|
|
5166
5144
|
}
|
|
5167
|
-
return this.finishNode(
|
|
5145
|
+
return this.finishNode(node, "ReturnStatement");
|
|
5168
5146
|
};
|
|
5169
|
-
pp$8.parseSwitchStatement = function(
|
|
5147
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
5170
5148
|
this.next();
|
|
5171
|
-
|
|
5172
|
-
|
|
5149
|
+
node.discriminant = this.parseParenExpression();
|
|
5150
|
+
node.cases = [];
|
|
5173
5151
|
this.expect(types$1.braceL);
|
|
5174
5152
|
this.labels.push(switchLabel);
|
|
5175
5153
|
this.enterScope(0);
|
|
@@ -5180,7 +5158,7 @@ pp$8.parseSwitchStatement = function(node2) {
|
|
|
5180
5158
|
if (cur) {
|
|
5181
5159
|
this.finishNode(cur, "SwitchCase");
|
|
5182
5160
|
}
|
|
5183
|
-
|
|
5161
|
+
node.cases.push(cur = this.startNode());
|
|
5184
5162
|
cur.consequent = [];
|
|
5185
5163
|
this.next();
|
|
5186
5164
|
if (isCase) {
|
|
@@ -5206,16 +5184,16 @@ pp$8.parseSwitchStatement = function(node2) {
|
|
|
5206
5184
|
}
|
|
5207
5185
|
this.next();
|
|
5208
5186
|
this.labels.pop();
|
|
5209
|
-
return this.finishNode(
|
|
5187
|
+
return this.finishNode(node, "SwitchStatement");
|
|
5210
5188
|
};
|
|
5211
|
-
pp$8.parseThrowStatement = function(
|
|
5189
|
+
pp$8.parseThrowStatement = function(node) {
|
|
5212
5190
|
this.next();
|
|
5213
5191
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) {
|
|
5214
5192
|
this.raise(this.lastTokEnd, "Illegal newline after throw");
|
|
5215
5193
|
}
|
|
5216
|
-
|
|
5194
|
+
node.argument = this.parseExpression();
|
|
5217
5195
|
this.semicolon();
|
|
5218
|
-
return this.finishNode(
|
|
5196
|
+
return this.finishNode(node, "ThrowStatement");
|
|
5219
5197
|
};
|
|
5220
5198
|
var empty$1 = [];
|
|
5221
5199
|
pp$8.parseCatchClauseParam = function() {
|
|
@@ -5226,10 +5204,10 @@ pp$8.parseCatchClauseParam = function() {
|
|
|
5226
5204
|
this.expect(types$1.parenR);
|
|
5227
5205
|
return param;
|
|
5228
5206
|
};
|
|
5229
|
-
pp$8.parseTryStatement = function(
|
|
5207
|
+
pp$8.parseTryStatement = function(node) {
|
|
5230
5208
|
this.next();
|
|
5231
|
-
|
|
5232
|
-
|
|
5209
|
+
node.block = this.parseBlock();
|
|
5210
|
+
node.handler = null;
|
|
5233
5211
|
if (this.type === types$1._catch) {
|
|
5234
5212
|
var clause = this.startNode();
|
|
5235
5213
|
this.next();
|
|
@@ -5244,42 +5222,42 @@ pp$8.parseTryStatement = function(node2) {
|
|
|
5244
5222
|
}
|
|
5245
5223
|
clause.body = this.parseBlock(false);
|
|
5246
5224
|
this.exitScope();
|
|
5247
|
-
|
|
5225
|
+
node.handler = this.finishNode(clause, "CatchClause");
|
|
5248
5226
|
}
|
|
5249
|
-
|
|
5250
|
-
if (!
|
|
5251
|
-
this.raise(
|
|
5227
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
5228
|
+
if (!node.handler && !node.finalizer) {
|
|
5229
|
+
this.raise(node.start, "Missing catch or finally clause");
|
|
5252
5230
|
}
|
|
5253
|
-
return this.finishNode(
|
|
5231
|
+
return this.finishNode(node, "TryStatement");
|
|
5254
5232
|
};
|
|
5255
|
-
pp$8.parseVarStatement = function(
|
|
5233
|
+
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
|
|
5256
5234
|
this.next();
|
|
5257
|
-
this.parseVar(
|
|
5235
|
+
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
5258
5236
|
this.semicolon();
|
|
5259
|
-
return this.finishNode(
|
|
5237
|
+
return this.finishNode(node, "VariableDeclaration");
|
|
5260
5238
|
};
|
|
5261
|
-
pp$8.parseWhileStatement = function(
|
|
5239
|
+
pp$8.parseWhileStatement = function(node) {
|
|
5262
5240
|
this.next();
|
|
5263
|
-
|
|
5241
|
+
node.test = this.parseParenExpression();
|
|
5264
5242
|
this.labels.push(loopLabel);
|
|
5265
|
-
|
|
5243
|
+
node.body = this.parseStatement("while");
|
|
5266
5244
|
this.labels.pop();
|
|
5267
|
-
return this.finishNode(
|
|
5245
|
+
return this.finishNode(node, "WhileStatement");
|
|
5268
5246
|
};
|
|
5269
|
-
pp$8.parseWithStatement = function(
|
|
5247
|
+
pp$8.parseWithStatement = function(node) {
|
|
5270
5248
|
if (this.strict) {
|
|
5271
5249
|
this.raise(this.start, "'with' in strict mode");
|
|
5272
5250
|
}
|
|
5273
5251
|
this.next();
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
return this.finishNode(
|
|
5252
|
+
node.object = this.parseParenExpression();
|
|
5253
|
+
node.body = this.parseStatement("with");
|
|
5254
|
+
return this.finishNode(node, "WithStatement");
|
|
5277
5255
|
};
|
|
5278
|
-
pp$8.parseEmptyStatement = function(
|
|
5256
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
5279
5257
|
this.next();
|
|
5280
|
-
return this.finishNode(
|
|
5258
|
+
return this.finishNode(node, "EmptyStatement");
|
|
5281
5259
|
};
|
|
5282
|
-
pp$8.parseLabeledStatement = function(
|
|
5260
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
5283
5261
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) {
|
|
5284
5262
|
var label = list[i$1];
|
|
5285
5263
|
if (label.name === maybeName) {
|
|
@@ -5289,7 +5267,7 @@ pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) {
|
|
|
5289
5267
|
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
5290
5268
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
5291
5269
|
var label$1 = this.labels[i];
|
|
5292
|
-
if (label$1.statementStart ===
|
|
5270
|
+
if (label$1.statementStart === node.start) {
|
|
5293
5271
|
label$1.statementStart = this.start;
|
|
5294
5272
|
label$1.kind = kind;
|
|
5295
5273
|
} else {
|
|
@@ -5297,29 +5275,29 @@ pp$8.parseLabeledStatement = function(node2, maybeName, expr, context) {
|
|
|
5297
5275
|
}
|
|
5298
5276
|
}
|
|
5299
5277
|
this.labels.push({ name: maybeName, kind, statementStart: this.start });
|
|
5300
|
-
|
|
5278
|
+
node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
|
|
5301
5279
|
this.labels.pop();
|
|
5302
|
-
|
|
5303
|
-
return this.finishNode(
|
|
5280
|
+
node.label = expr;
|
|
5281
|
+
return this.finishNode(node, "LabeledStatement");
|
|
5304
5282
|
};
|
|
5305
|
-
pp$8.parseExpressionStatement = function(
|
|
5306
|
-
|
|
5283
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
5284
|
+
node.expression = expr;
|
|
5307
5285
|
this.semicolon();
|
|
5308
|
-
return this.finishNode(
|
|
5286
|
+
return this.finishNode(node, "ExpressionStatement");
|
|
5309
5287
|
};
|
|
5310
|
-
pp$8.parseBlock = function(createNewLexicalScope,
|
|
5288
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
5311
5289
|
if (createNewLexicalScope === void 0)
|
|
5312
5290
|
createNewLexicalScope = true;
|
|
5313
|
-
if (
|
|
5314
|
-
|
|
5315
|
-
|
|
5291
|
+
if (node === void 0)
|
|
5292
|
+
node = this.startNode();
|
|
5293
|
+
node.body = [];
|
|
5316
5294
|
this.expect(types$1.braceL);
|
|
5317
5295
|
if (createNewLexicalScope) {
|
|
5318
5296
|
this.enterScope(0);
|
|
5319
5297
|
}
|
|
5320
5298
|
while (this.type !== types$1.braceR) {
|
|
5321
5299
|
var stmt = this.parseStatement(null);
|
|
5322
|
-
|
|
5300
|
+
node.body.push(stmt);
|
|
5323
5301
|
}
|
|
5324
5302
|
if (exitStrict) {
|
|
5325
5303
|
this.strict = false;
|
|
@@ -5328,21 +5306,21 @@ pp$8.parseBlock = function(createNewLexicalScope, node2, exitStrict) {
|
|
|
5328
5306
|
if (createNewLexicalScope) {
|
|
5329
5307
|
this.exitScope();
|
|
5330
5308
|
}
|
|
5331
|
-
return this.finishNode(
|
|
5309
|
+
return this.finishNode(node, "BlockStatement");
|
|
5332
5310
|
};
|
|
5333
|
-
pp$8.parseFor = function(
|
|
5334
|
-
|
|
5311
|
+
pp$8.parseFor = function(node, init) {
|
|
5312
|
+
node.init = init;
|
|
5335
5313
|
this.expect(types$1.semi);
|
|
5336
|
-
|
|
5314
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
5337
5315
|
this.expect(types$1.semi);
|
|
5338
|
-
|
|
5316
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
5339
5317
|
this.expect(types$1.parenR);
|
|
5340
|
-
|
|
5318
|
+
node.body = this.parseStatement("for");
|
|
5341
5319
|
this.exitScope();
|
|
5342
5320
|
this.labels.pop();
|
|
5343
|
-
return this.finishNode(
|
|
5321
|
+
return this.finishNode(node, "ForStatement");
|
|
5344
5322
|
};
|
|
5345
|
-
pp$8.parseForIn = function(
|
|
5323
|
+
pp$8.parseForIn = function(node, init) {
|
|
5346
5324
|
var isForIn = this.type === types$1._in;
|
|
5347
5325
|
this.next();
|
|
5348
5326
|
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
|
|
@@ -5351,17 +5329,17 @@ pp$8.parseForIn = function(node2, init) {
|
|
|
5351
5329
|
(isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"
|
|
5352
5330
|
);
|
|
5353
5331
|
}
|
|
5354
|
-
|
|
5355
|
-
|
|
5332
|
+
node.left = init;
|
|
5333
|
+
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
5356
5334
|
this.expect(types$1.parenR);
|
|
5357
|
-
|
|
5335
|
+
node.body = this.parseStatement("for");
|
|
5358
5336
|
this.exitScope();
|
|
5359
5337
|
this.labels.pop();
|
|
5360
|
-
return this.finishNode(
|
|
5338
|
+
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
|
|
5361
5339
|
};
|
|
5362
|
-
pp$8.parseVar = function(
|
|
5363
|
-
|
|
5364
|
-
|
|
5340
|
+
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
5341
|
+
node.declarations = [];
|
|
5342
|
+
node.kind = kind;
|
|
5365
5343
|
for (; ; ) {
|
|
5366
5344
|
var decl = this.startNode();
|
|
5367
5345
|
this.parseVarId(decl, kind);
|
|
@@ -5374,12 +5352,12 @@ pp$8.parseVar = function(node2, isFor, kind, allowMissingInitializer) {
|
|
|
5374
5352
|
} else {
|
|
5375
5353
|
decl.init = null;
|
|
5376
5354
|
}
|
|
5377
|
-
|
|
5355
|
+
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
5378
5356
|
if (!this.eat(types$1.comma)) {
|
|
5379
5357
|
break;
|
|
5380
5358
|
}
|
|
5381
5359
|
}
|
|
5382
|
-
return
|
|
5360
|
+
return node;
|
|
5383
5361
|
};
|
|
5384
5362
|
pp$8.parseVarId = function(decl, kind) {
|
|
5385
5363
|
decl.id = this.parseBindingAtom();
|
|
@@ -5388,56 +5366,56 @@ pp$8.parseVarId = function(decl, kind) {
|
|
|
5388
5366
|
var FUNC_STATEMENT = 1;
|
|
5389
5367
|
var FUNC_HANGING_STATEMENT = 2;
|
|
5390
5368
|
var FUNC_NULLABLE_ID = 4;
|
|
5391
|
-
pp$8.parseFunction = function(
|
|
5392
|
-
this.initFunction(
|
|
5369
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
5370
|
+
this.initFunction(node);
|
|
5393
5371
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
5394
5372
|
if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) {
|
|
5395
5373
|
this.unexpected();
|
|
5396
5374
|
}
|
|
5397
|
-
|
|
5375
|
+
node.generator = this.eat(types$1.star);
|
|
5398
5376
|
}
|
|
5399
5377
|
if (this.options.ecmaVersion >= 8) {
|
|
5400
|
-
|
|
5378
|
+
node.async = !!isAsync;
|
|
5401
5379
|
}
|
|
5402
5380
|
if (statement & FUNC_STATEMENT) {
|
|
5403
|
-
|
|
5404
|
-
if (
|
|
5405
|
-
this.checkLValSimple(
|
|
5381
|
+
node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent();
|
|
5382
|
+
if (node.id && !(statement & FUNC_HANGING_STATEMENT)) {
|
|
5383
|
+
this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
|
|
5406
5384
|
}
|
|
5407
5385
|
}
|
|
5408
5386
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
5409
5387
|
this.yieldPos = 0;
|
|
5410
5388
|
this.awaitPos = 0;
|
|
5411
5389
|
this.awaitIdentPos = 0;
|
|
5412
|
-
this.enterScope(functionFlags(
|
|
5390
|
+
this.enterScope(functionFlags(node.async, node.generator));
|
|
5413
5391
|
if (!(statement & FUNC_STATEMENT)) {
|
|
5414
|
-
|
|
5392
|
+
node.id = this.type === types$1.name ? this.parseIdent() : null;
|
|
5415
5393
|
}
|
|
5416
|
-
this.parseFunctionParams(
|
|
5417
|
-
this.parseFunctionBody(
|
|
5394
|
+
this.parseFunctionParams(node);
|
|
5395
|
+
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
5418
5396
|
this.yieldPos = oldYieldPos;
|
|
5419
5397
|
this.awaitPos = oldAwaitPos;
|
|
5420
5398
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
5421
|
-
return this.finishNode(
|
|
5399
|
+
return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
|
|
5422
5400
|
};
|
|
5423
|
-
pp$8.parseFunctionParams = function(
|
|
5401
|
+
pp$8.parseFunctionParams = function(node) {
|
|
5424
5402
|
this.expect(types$1.parenL);
|
|
5425
|
-
|
|
5403
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
5426
5404
|
this.checkYieldAwaitInDefaultParams();
|
|
5427
5405
|
};
|
|
5428
|
-
pp$8.parseClass = function(
|
|
5406
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
5429
5407
|
this.next();
|
|
5430
5408
|
var oldStrict = this.strict;
|
|
5431
5409
|
this.strict = true;
|
|
5432
|
-
this.parseClassId(
|
|
5433
|
-
this.parseClassSuper(
|
|
5410
|
+
this.parseClassId(node, isStatement);
|
|
5411
|
+
this.parseClassSuper(node);
|
|
5434
5412
|
var privateNameMap = this.enterClassBody();
|
|
5435
5413
|
var classBody = this.startNode();
|
|
5436
5414
|
var hadConstructor = false;
|
|
5437
5415
|
classBody.body = [];
|
|
5438
5416
|
this.expect(types$1.braceL);
|
|
5439
5417
|
while (this.type !== types$1.braceR) {
|
|
5440
|
-
var element = this.parseClassElement(
|
|
5418
|
+
var element = this.parseClassElement(node.superClass !== null);
|
|
5441
5419
|
if (element) {
|
|
5442
5420
|
classBody.body.push(element);
|
|
5443
5421
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
@@ -5452,16 +5430,16 @@ pp$8.parseClass = function(node2, isStatement) {
|
|
|
5452
5430
|
}
|
|
5453
5431
|
this.strict = oldStrict;
|
|
5454
5432
|
this.next();
|
|
5455
|
-
|
|
5433
|
+
node.body = this.finishNode(classBody, "ClassBody");
|
|
5456
5434
|
this.exitClassBody();
|
|
5457
|
-
return this.finishNode(
|
|
5435
|
+
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
|
|
5458
5436
|
};
|
|
5459
5437
|
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
5460
5438
|
if (this.eat(types$1.semi)) {
|
|
5461
5439
|
return null;
|
|
5462
5440
|
}
|
|
5463
5441
|
var ecmaVersion = this.options.ecmaVersion;
|
|
5464
|
-
var
|
|
5442
|
+
var node = this.startNode();
|
|
5465
5443
|
var keyName = "";
|
|
5466
5444
|
var isGenerator = false;
|
|
5467
5445
|
var isAsync = false;
|
|
@@ -5469,8 +5447,8 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
5469
5447
|
var isStatic = false;
|
|
5470
5448
|
if (this.eatContextual("static")) {
|
|
5471
5449
|
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
5472
|
-
this.parseClassStaticBlock(
|
|
5473
|
-
return
|
|
5450
|
+
this.parseClassStaticBlock(node);
|
|
5451
|
+
return node;
|
|
5474
5452
|
}
|
|
5475
5453
|
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
5476
5454
|
isStatic = true;
|
|
@@ -5478,7 +5456,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
5478
5456
|
keyName = "static";
|
|
5479
5457
|
}
|
|
5480
5458
|
}
|
|
5481
|
-
|
|
5459
|
+
node.static = isStatic;
|
|
5482
5460
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
5483
5461
|
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
5484
5462
|
isAsync = true;
|
|
@@ -5500,25 +5478,25 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
5500
5478
|
}
|
|
5501
5479
|
}
|
|
5502
5480
|
if (keyName) {
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
this.finishNode(
|
|
5481
|
+
node.computed = false;
|
|
5482
|
+
node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
|
|
5483
|
+
node.key.name = keyName;
|
|
5484
|
+
this.finishNode(node.key, "Identifier");
|
|
5507
5485
|
} else {
|
|
5508
|
-
this.parseClassElementName(
|
|
5486
|
+
this.parseClassElementName(node);
|
|
5509
5487
|
}
|
|
5510
5488
|
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
5511
|
-
var isConstructor = !
|
|
5489
|
+
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
5512
5490
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
5513
5491
|
if (isConstructor && kind !== "method") {
|
|
5514
|
-
this.raise(
|
|
5492
|
+
this.raise(node.key.start, "Constructor can't have get/set modifier");
|
|
5515
5493
|
}
|
|
5516
|
-
|
|
5517
|
-
this.parseClassMethod(
|
|
5494
|
+
node.kind = isConstructor ? "constructor" : kind;
|
|
5495
|
+
this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
|
|
5518
5496
|
} else {
|
|
5519
|
-
this.parseClassField(
|
|
5497
|
+
this.parseClassField(node);
|
|
5520
5498
|
}
|
|
5521
|
-
return
|
|
5499
|
+
return node;
|
|
5522
5500
|
};
|
|
5523
5501
|
pp$8.isClassElementNameStart = function() {
|
|
5524
5502
|
return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword;
|
|
@@ -5576,35 +5554,35 @@ pp$8.parseClassField = function(field) {
|
|
|
5576
5554
|
this.semicolon();
|
|
5577
5555
|
return this.finishNode(field, "PropertyDefinition");
|
|
5578
5556
|
};
|
|
5579
|
-
pp$8.parseClassStaticBlock = function(
|
|
5580
|
-
|
|
5557
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
5558
|
+
node.body = [];
|
|
5581
5559
|
var oldLabels = this.labels;
|
|
5582
5560
|
this.labels = [];
|
|
5583
5561
|
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
5584
5562
|
while (this.type !== types$1.braceR) {
|
|
5585
5563
|
var stmt = this.parseStatement(null);
|
|
5586
|
-
|
|
5564
|
+
node.body.push(stmt);
|
|
5587
5565
|
}
|
|
5588
5566
|
this.next();
|
|
5589
5567
|
this.exitScope();
|
|
5590
5568
|
this.labels = oldLabels;
|
|
5591
|
-
return this.finishNode(
|
|
5569
|
+
return this.finishNode(node, "StaticBlock");
|
|
5592
5570
|
};
|
|
5593
|
-
pp$8.parseClassId = function(
|
|
5571
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
5594
5572
|
if (this.type === types$1.name) {
|
|
5595
|
-
|
|
5573
|
+
node.id = this.parseIdent();
|
|
5596
5574
|
if (isStatement) {
|
|
5597
|
-
this.checkLValSimple(
|
|
5575
|
+
this.checkLValSimple(node.id, BIND_LEXICAL, false);
|
|
5598
5576
|
}
|
|
5599
5577
|
} else {
|
|
5600
5578
|
if (isStatement === true) {
|
|
5601
5579
|
this.unexpected();
|
|
5602
5580
|
}
|
|
5603
|
-
|
|
5581
|
+
node.id = null;
|
|
5604
5582
|
}
|
|
5605
5583
|
};
|
|
5606
|
-
pp$8.parseClassSuper = function(
|
|
5607
|
-
|
|
5584
|
+
pp$8.parseClassSuper = function(node) {
|
|
5585
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
|
|
5608
5586
|
};
|
|
5609
5587
|
pp$8.enterClassBody = function() {
|
|
5610
5588
|
var element = { declared: /* @__PURE__ */ Object.create(null), used: [] };
|
|
@@ -5648,57 +5626,57 @@ function isPrivateNameConflicted(privateNameMap, element) {
|
|
|
5648
5626
|
return true;
|
|
5649
5627
|
}
|
|
5650
5628
|
}
|
|
5651
|
-
function checkKeyName(
|
|
5652
|
-
var computed =
|
|
5653
|
-
var key =
|
|
5629
|
+
function checkKeyName(node, name) {
|
|
5630
|
+
var computed = node.computed;
|
|
5631
|
+
var key = node.key;
|
|
5654
5632
|
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
|
|
5655
5633
|
}
|
|
5656
|
-
pp$8.parseExportAllDeclaration = function(
|
|
5634
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
5657
5635
|
if (this.options.ecmaVersion >= 11) {
|
|
5658
5636
|
if (this.eatContextual("as")) {
|
|
5659
|
-
|
|
5660
|
-
this.checkExport(exports,
|
|
5637
|
+
node.exported = this.parseModuleExportName();
|
|
5638
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
5661
5639
|
} else {
|
|
5662
|
-
|
|
5640
|
+
node.exported = null;
|
|
5663
5641
|
}
|
|
5664
5642
|
}
|
|
5665
5643
|
this.expectContextual("from");
|
|
5666
5644
|
if (this.type !== types$1.string) {
|
|
5667
5645
|
this.unexpected();
|
|
5668
5646
|
}
|
|
5669
|
-
|
|
5647
|
+
node.source = this.parseExprAtom();
|
|
5670
5648
|
this.semicolon();
|
|
5671
|
-
return this.finishNode(
|
|
5649
|
+
return this.finishNode(node, "ExportAllDeclaration");
|
|
5672
5650
|
};
|
|
5673
|
-
pp$8.parseExport = function(
|
|
5651
|
+
pp$8.parseExport = function(node, exports) {
|
|
5674
5652
|
this.next();
|
|
5675
5653
|
if (this.eat(types$1.star)) {
|
|
5676
|
-
return this.parseExportAllDeclaration(
|
|
5654
|
+
return this.parseExportAllDeclaration(node, exports);
|
|
5677
5655
|
}
|
|
5678
5656
|
if (this.eat(types$1._default)) {
|
|
5679
5657
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
5680
|
-
|
|
5681
|
-
return this.finishNode(
|
|
5658
|
+
node.declaration = this.parseExportDefaultDeclaration();
|
|
5659
|
+
return this.finishNode(node, "ExportDefaultDeclaration");
|
|
5682
5660
|
}
|
|
5683
5661
|
if (this.shouldParseExportStatement()) {
|
|
5684
|
-
|
|
5685
|
-
if (
|
|
5686
|
-
this.checkVariableExport(exports,
|
|
5662
|
+
node.declaration = this.parseExportDeclaration(node);
|
|
5663
|
+
if (node.declaration.type === "VariableDeclaration") {
|
|
5664
|
+
this.checkVariableExport(exports, node.declaration.declarations);
|
|
5687
5665
|
} else {
|
|
5688
|
-
this.checkExport(exports,
|
|
5666
|
+
this.checkExport(exports, node.declaration.id, node.declaration.id.start);
|
|
5689
5667
|
}
|
|
5690
|
-
|
|
5691
|
-
|
|
5668
|
+
node.specifiers = [];
|
|
5669
|
+
node.source = null;
|
|
5692
5670
|
} else {
|
|
5693
|
-
|
|
5694
|
-
|
|
5671
|
+
node.declaration = null;
|
|
5672
|
+
node.specifiers = this.parseExportSpecifiers(exports);
|
|
5695
5673
|
if (this.eatContextual("from")) {
|
|
5696
5674
|
if (this.type !== types$1.string) {
|
|
5697
5675
|
this.unexpected();
|
|
5698
5676
|
}
|
|
5699
|
-
|
|
5677
|
+
node.source = this.parseExprAtom();
|
|
5700
5678
|
} else {
|
|
5701
|
-
for (var i = 0, list =
|
|
5679
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
5702
5680
|
var spec = list[i];
|
|
5703
5681
|
this.checkUnreserved(spec.local);
|
|
5704
5682
|
this.checkLocalExport(spec.local);
|
|
@@ -5706,13 +5684,13 @@ pp$8.parseExport = function(node2, exports) {
|
|
|
5706
5684
|
this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
|
|
5707
5685
|
}
|
|
5708
5686
|
}
|
|
5709
|
-
|
|
5687
|
+
node.source = null;
|
|
5710
5688
|
}
|
|
5711
5689
|
this.semicolon();
|
|
5712
5690
|
}
|
|
5713
|
-
return this.finishNode(
|
|
5691
|
+
return this.finishNode(node, "ExportNamedDeclaration");
|
|
5714
5692
|
};
|
|
5715
|
-
pp$8.parseExportDeclaration = function(
|
|
5693
|
+
pp$8.parseExportDeclaration = function(node) {
|
|
5716
5694
|
return this.parseStatement(null);
|
|
5717
5695
|
};
|
|
5718
5696
|
pp$8.parseExportDefaultDeclaration = function() {
|
|
@@ -5782,15 +5760,15 @@ pp$8.shouldParseExportStatement = function() {
|
|
|
5782
5760
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
5783
5761
|
};
|
|
5784
5762
|
pp$8.parseExportSpecifier = function(exports) {
|
|
5785
|
-
var
|
|
5786
|
-
|
|
5787
|
-
|
|
5763
|
+
var node = this.startNode();
|
|
5764
|
+
node.local = this.parseModuleExportName();
|
|
5765
|
+
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
5788
5766
|
this.checkExport(
|
|
5789
5767
|
exports,
|
|
5790
|
-
|
|
5791
|
-
|
|
5768
|
+
node.exported,
|
|
5769
|
+
node.exported.start
|
|
5792
5770
|
);
|
|
5793
|
-
return this.finishNode(
|
|
5771
|
+
return this.finishNode(node, "ExportSpecifier");
|
|
5794
5772
|
};
|
|
5795
5773
|
pp$8.parseExportSpecifiers = function(exports) {
|
|
5796
5774
|
var nodes = [], first = true;
|
|
@@ -5808,44 +5786,44 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
5808
5786
|
}
|
|
5809
5787
|
return nodes;
|
|
5810
5788
|
};
|
|
5811
|
-
pp$8.parseImport = function(
|
|
5789
|
+
pp$8.parseImport = function(node) {
|
|
5812
5790
|
this.next();
|
|
5813
5791
|
if (this.type === types$1.string) {
|
|
5814
|
-
|
|
5815
|
-
|
|
5792
|
+
node.specifiers = empty$1;
|
|
5793
|
+
node.source = this.parseExprAtom();
|
|
5816
5794
|
} else {
|
|
5817
|
-
|
|
5795
|
+
node.specifiers = this.parseImportSpecifiers();
|
|
5818
5796
|
this.expectContextual("from");
|
|
5819
|
-
|
|
5797
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
5820
5798
|
}
|
|
5821
5799
|
this.semicolon();
|
|
5822
|
-
return this.finishNode(
|
|
5800
|
+
return this.finishNode(node, "ImportDeclaration");
|
|
5823
5801
|
};
|
|
5824
5802
|
pp$8.parseImportSpecifier = function() {
|
|
5825
|
-
var
|
|
5826
|
-
|
|
5803
|
+
var node = this.startNode();
|
|
5804
|
+
node.imported = this.parseModuleExportName();
|
|
5827
5805
|
if (this.eatContextual("as")) {
|
|
5828
|
-
|
|
5806
|
+
node.local = this.parseIdent();
|
|
5829
5807
|
} else {
|
|
5830
|
-
this.checkUnreserved(
|
|
5831
|
-
|
|
5808
|
+
this.checkUnreserved(node.imported);
|
|
5809
|
+
node.local = node.imported;
|
|
5832
5810
|
}
|
|
5833
|
-
this.checkLValSimple(
|
|
5834
|
-
return this.finishNode(
|
|
5811
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
5812
|
+
return this.finishNode(node, "ImportSpecifier");
|
|
5835
5813
|
};
|
|
5836
5814
|
pp$8.parseImportDefaultSpecifier = function() {
|
|
5837
|
-
var
|
|
5838
|
-
|
|
5839
|
-
this.checkLValSimple(
|
|
5840
|
-
return this.finishNode(
|
|
5815
|
+
var node = this.startNode();
|
|
5816
|
+
node.local = this.parseIdent();
|
|
5817
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
5818
|
+
return this.finishNode(node, "ImportDefaultSpecifier");
|
|
5841
5819
|
};
|
|
5842
5820
|
pp$8.parseImportNamespaceSpecifier = function() {
|
|
5843
|
-
var
|
|
5821
|
+
var node = this.startNode();
|
|
5844
5822
|
this.next();
|
|
5845
5823
|
this.expectContextual("as");
|
|
5846
|
-
|
|
5847
|
-
this.checkLValSimple(
|
|
5848
|
-
return this.finishNode(
|
|
5824
|
+
node.local = this.parseIdent();
|
|
5825
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
5826
|
+
return this.finishNode(node, "ImportNamespaceSpecifier");
|
|
5849
5827
|
};
|
|
5850
5828
|
pp$8.parseImportSpecifiers = function() {
|
|
5851
5829
|
var nodes = [], first = true;
|
|
@@ -5893,12 +5871,12 @@ pp$8.isDirectiveCandidate = function(statement) {
|
|
|
5893
5871
|
(this.input[statement.start] === '"' || this.input[statement.start] === "'");
|
|
5894
5872
|
};
|
|
5895
5873
|
var pp$7 = Parser.prototype;
|
|
5896
|
-
pp$7.toAssignable = function(
|
|
5897
|
-
if (this.options.ecmaVersion >= 6 &&
|
|
5898
|
-
switch (
|
|
5874
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
5875
|
+
if (this.options.ecmaVersion >= 6 && node) {
|
|
5876
|
+
switch (node.type) {
|
|
5899
5877
|
case "Identifier":
|
|
5900
|
-
if (this.inAsync &&
|
|
5901
|
-
this.raise(
|
|
5878
|
+
if (this.inAsync && node.name === "await") {
|
|
5879
|
+
this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
|
|
5902
5880
|
}
|
|
5903
5881
|
break;
|
|
5904
5882
|
case "ObjectPattern":
|
|
@@ -5907,11 +5885,11 @@ pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) {
|
|
|
5907
5885
|
case "RestElement":
|
|
5908
5886
|
break;
|
|
5909
5887
|
case "ObjectExpression":
|
|
5910
|
-
|
|
5888
|
+
node.type = "ObjectPattern";
|
|
5911
5889
|
if (refDestructuringErrors) {
|
|
5912
5890
|
this.checkPatternErrors(refDestructuringErrors, true);
|
|
5913
5891
|
}
|
|
5914
|
-
for (var i = 0, list =
|
|
5892
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
5915
5893
|
var prop = list[i];
|
|
5916
5894
|
this.toAssignable(prop, isBinding);
|
|
5917
5895
|
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) {
|
|
@@ -5920,50 +5898,50 @@ pp$7.toAssignable = function(node2, isBinding, refDestructuringErrors) {
|
|
|
5920
5898
|
}
|
|
5921
5899
|
break;
|
|
5922
5900
|
case "Property":
|
|
5923
|
-
if (
|
|
5924
|
-
this.raise(
|
|
5901
|
+
if (node.kind !== "init") {
|
|
5902
|
+
this.raise(node.key.start, "Object pattern can't contain getter or setter");
|
|
5925
5903
|
}
|
|
5926
|
-
this.toAssignable(
|
|
5904
|
+
this.toAssignable(node.value, isBinding);
|
|
5927
5905
|
break;
|
|
5928
5906
|
case "ArrayExpression":
|
|
5929
|
-
|
|
5907
|
+
node.type = "ArrayPattern";
|
|
5930
5908
|
if (refDestructuringErrors) {
|
|
5931
5909
|
this.checkPatternErrors(refDestructuringErrors, true);
|
|
5932
5910
|
}
|
|
5933
|
-
this.toAssignableList(
|
|
5911
|
+
this.toAssignableList(node.elements, isBinding);
|
|
5934
5912
|
break;
|
|
5935
5913
|
case "SpreadElement":
|
|
5936
|
-
|
|
5937
|
-
this.toAssignable(
|
|
5938
|
-
if (
|
|
5939
|
-
this.raise(
|
|
5914
|
+
node.type = "RestElement";
|
|
5915
|
+
this.toAssignable(node.argument, isBinding);
|
|
5916
|
+
if (node.argument.type === "AssignmentPattern") {
|
|
5917
|
+
this.raise(node.argument.start, "Rest elements cannot have a default value");
|
|
5940
5918
|
}
|
|
5941
5919
|
break;
|
|
5942
5920
|
case "AssignmentExpression":
|
|
5943
|
-
if (
|
|
5944
|
-
this.raise(
|
|
5921
|
+
if (node.operator !== "=") {
|
|
5922
|
+
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
|
|
5945
5923
|
}
|
|
5946
|
-
|
|
5947
|
-
delete
|
|
5948
|
-
this.toAssignable(
|
|
5924
|
+
node.type = "AssignmentPattern";
|
|
5925
|
+
delete node.operator;
|
|
5926
|
+
this.toAssignable(node.left, isBinding);
|
|
5949
5927
|
break;
|
|
5950
5928
|
case "ParenthesizedExpression":
|
|
5951
|
-
this.toAssignable(
|
|
5929
|
+
this.toAssignable(node.expression, isBinding, refDestructuringErrors);
|
|
5952
5930
|
break;
|
|
5953
5931
|
case "ChainExpression":
|
|
5954
|
-
this.raiseRecoverable(
|
|
5932
|
+
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
|
|
5955
5933
|
break;
|
|
5956
5934
|
case "MemberExpression":
|
|
5957
5935
|
if (!isBinding) {
|
|
5958
5936
|
break;
|
|
5959
5937
|
}
|
|
5960
5938
|
default:
|
|
5961
|
-
this.raise(
|
|
5939
|
+
this.raise(node.start, "Assigning to rvalue");
|
|
5962
5940
|
}
|
|
5963
5941
|
} else if (refDestructuringErrors) {
|
|
5964
5942
|
this.checkPatternErrors(refDestructuringErrors, true);
|
|
5965
5943
|
}
|
|
5966
|
-
return
|
|
5944
|
+
return node;
|
|
5967
5945
|
};
|
|
5968
5946
|
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
5969
5947
|
var end = exprList.length;
|
|
@@ -5982,28 +5960,28 @@ pp$7.toAssignableList = function(exprList, isBinding) {
|
|
|
5982
5960
|
return exprList;
|
|
5983
5961
|
};
|
|
5984
5962
|
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
5985
|
-
var
|
|
5963
|
+
var node = this.startNode();
|
|
5986
5964
|
this.next();
|
|
5987
|
-
|
|
5988
|
-
return this.finishNode(
|
|
5965
|
+
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
5966
|
+
return this.finishNode(node, "SpreadElement");
|
|
5989
5967
|
};
|
|
5990
5968
|
pp$7.parseRestBinding = function() {
|
|
5991
|
-
var
|
|
5969
|
+
var node = this.startNode();
|
|
5992
5970
|
this.next();
|
|
5993
5971
|
if (this.options.ecmaVersion === 6 && this.type !== types$1.name) {
|
|
5994
5972
|
this.unexpected();
|
|
5995
5973
|
}
|
|
5996
|
-
|
|
5997
|
-
return this.finishNode(
|
|
5974
|
+
node.argument = this.parseBindingAtom();
|
|
5975
|
+
return this.finishNode(node, "RestElement");
|
|
5998
5976
|
};
|
|
5999
5977
|
pp$7.parseBindingAtom = function() {
|
|
6000
5978
|
if (this.options.ecmaVersion >= 6) {
|
|
6001
5979
|
switch (this.type) {
|
|
6002
5980
|
case types$1.bracketL:
|
|
6003
|
-
var
|
|
5981
|
+
var node = this.startNode();
|
|
6004
5982
|
this.next();
|
|
6005
|
-
|
|
6006
|
-
return this.finishNode(
|
|
5983
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
5984
|
+
return this.finishNode(node, "ArrayPattern");
|
|
6007
5985
|
case types$1.braceL:
|
|
6008
5986
|
return this.parseObj(true);
|
|
6009
5987
|
}
|
|
@@ -6050,10 +6028,10 @@ pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
|
6050
6028
|
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) {
|
|
6051
6029
|
return left;
|
|
6052
6030
|
}
|
|
6053
|
-
var
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
return this.finishNode(
|
|
6031
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
6032
|
+
node.left = left;
|
|
6033
|
+
node.right = this.parseMaybeAssign();
|
|
6034
|
+
return this.finishNode(node, "AssignmentPattern");
|
|
6057
6035
|
};
|
|
6058
6036
|
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
6059
6037
|
if (bindingType === void 0)
|
|
@@ -6338,12 +6316,12 @@ pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
6338
6316
|
var startPos = this.start, startLoc = this.startLoc;
|
|
6339
6317
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
6340
6318
|
if (this.type === types$1.comma) {
|
|
6341
|
-
var
|
|
6342
|
-
|
|
6319
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
6320
|
+
node.expressions = [expr];
|
|
6343
6321
|
while (this.eat(types$1.comma)) {
|
|
6344
|
-
|
|
6322
|
+
node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
|
|
6345
6323
|
}
|
|
6346
|
-
return this.finishNode(
|
|
6324
|
+
return this.finishNode(node, "SequenceExpression");
|
|
6347
6325
|
}
|
|
6348
6326
|
return expr;
|
|
6349
6327
|
};
|
|
@@ -6375,8 +6353,8 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
6375
6353
|
left = afterLeftParse.call(this, left, startPos, startLoc);
|
|
6376
6354
|
}
|
|
6377
6355
|
if (this.type.isAssign) {
|
|
6378
|
-
var
|
|
6379
|
-
|
|
6356
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
6357
|
+
node.operator = this.value;
|
|
6380
6358
|
if (this.type === types$1.eq) {
|
|
6381
6359
|
left = this.toAssignable(left, false, refDestructuringErrors);
|
|
6382
6360
|
}
|
|
@@ -6391,13 +6369,13 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
|
|
|
6391
6369
|
} else {
|
|
6392
6370
|
this.checkLValSimple(left);
|
|
6393
6371
|
}
|
|
6394
|
-
|
|
6372
|
+
node.left = left;
|
|
6395
6373
|
this.next();
|
|
6396
|
-
|
|
6374
|
+
node.right = this.parseMaybeAssign(forInit);
|
|
6397
6375
|
if (oldDoubleProto > -1) {
|
|
6398
6376
|
refDestructuringErrors.doubleProto = oldDoubleProto;
|
|
6399
6377
|
}
|
|
6400
|
-
return this.finishNode(
|
|
6378
|
+
return this.finishNode(node, "AssignmentExpression");
|
|
6401
6379
|
} else {
|
|
6402
6380
|
if (ownDestructuringErrors) {
|
|
6403
6381
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
@@ -6418,12 +6396,12 @@ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
|
6418
6396
|
return expr;
|
|
6419
6397
|
}
|
|
6420
6398
|
if (this.eat(types$1.question)) {
|
|
6421
|
-
var
|
|
6422
|
-
|
|
6423
|
-
|
|
6399
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
6400
|
+
node.test = expr;
|
|
6401
|
+
node.consequent = this.parseMaybeAssign();
|
|
6424
6402
|
this.expect(types$1.colon);
|
|
6425
|
-
|
|
6426
|
-
return this.finishNode(
|
|
6403
|
+
node.alternate = this.parseMaybeAssign(forInit);
|
|
6404
|
+
return this.finishNode(node, "ConditionalExpression");
|
|
6427
6405
|
}
|
|
6428
6406
|
return expr;
|
|
6429
6407
|
};
|
|
@@ -6448,11 +6426,11 @@ pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
|
6448
6426
|
this.next();
|
|
6449
6427
|
var startPos = this.start, startLoc = this.startLoc;
|
|
6450
6428
|
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
6451
|
-
var
|
|
6429
|
+
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
6452
6430
|
if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) {
|
|
6453
6431
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
6454
6432
|
}
|
|
6455
|
-
return this.parseExprOp(
|
|
6433
|
+
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit);
|
|
6456
6434
|
}
|
|
6457
6435
|
}
|
|
6458
6436
|
return left;
|
|
@@ -6461,11 +6439,11 @@ pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
6461
6439
|
if (right.type === "PrivateIdentifier") {
|
|
6462
6440
|
this.raise(right.start, "Private identifier can only be left side of binary expression");
|
|
6463
6441
|
}
|
|
6464
|
-
var
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
return this.finishNode(
|
|
6442
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
6443
|
+
node.left = left;
|
|
6444
|
+
node.operator = op;
|
|
6445
|
+
node.right = right;
|
|
6446
|
+
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
|
|
6469
6447
|
};
|
|
6470
6448
|
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
6471
6449
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
@@ -6473,22 +6451,22 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
6473
6451
|
expr = this.parseAwait(forInit);
|
|
6474
6452
|
sawUnary = true;
|
|
6475
6453
|
} else if (this.type.prefix) {
|
|
6476
|
-
var
|
|
6477
|
-
|
|
6478
|
-
|
|
6454
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
6455
|
+
node.operator = this.value;
|
|
6456
|
+
node.prefix = true;
|
|
6479
6457
|
this.next();
|
|
6480
|
-
|
|
6458
|
+
node.argument = this.parseMaybeUnary(null, true, update, forInit);
|
|
6481
6459
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
6482
6460
|
if (update) {
|
|
6483
|
-
this.checkLValSimple(
|
|
6484
|
-
} else if (this.strict &&
|
|
6485
|
-
this.raiseRecoverable(
|
|
6486
|
-
} else if (
|
|
6487
|
-
this.raiseRecoverable(
|
|
6461
|
+
this.checkLValSimple(node.argument);
|
|
6462
|
+
} else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") {
|
|
6463
|
+
this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
|
|
6464
|
+
} else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) {
|
|
6465
|
+
this.raiseRecoverable(node.start, "Private fields can not be deleted");
|
|
6488
6466
|
} else {
|
|
6489
6467
|
sawUnary = true;
|
|
6490
6468
|
}
|
|
6491
|
-
expr = this.finishNode(
|
|
6469
|
+
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
6492
6470
|
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
6493
6471
|
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) {
|
|
6494
6472
|
this.unexpected();
|
|
@@ -6522,8 +6500,8 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
6522
6500
|
return expr;
|
|
6523
6501
|
}
|
|
6524
6502
|
};
|
|
6525
|
-
function isPrivateFieldAccess(
|
|
6526
|
-
return
|
|
6503
|
+
function isPrivateFieldAccess(node) {
|
|
6504
|
+
return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression);
|
|
6527
6505
|
}
|
|
6528
6506
|
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
6529
6507
|
var startPos = this.start, startLoc = this.startLoc;
|
|
@@ -6578,21 +6556,21 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
6578
6556
|
}
|
|
6579
6557
|
var computed = this.eat(types$1.bracketL);
|
|
6580
6558
|
if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) {
|
|
6581
|
-
var
|
|
6582
|
-
|
|
6559
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
6560
|
+
node.object = base;
|
|
6583
6561
|
if (computed) {
|
|
6584
|
-
|
|
6562
|
+
node.property = this.parseExpression();
|
|
6585
6563
|
this.expect(types$1.bracketR);
|
|
6586
6564
|
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
6587
|
-
|
|
6565
|
+
node.property = this.parsePrivateIdent();
|
|
6588
6566
|
} else {
|
|
6589
|
-
|
|
6567
|
+
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
6590
6568
|
}
|
|
6591
|
-
|
|
6569
|
+
node.computed = !!computed;
|
|
6592
6570
|
if (optionalSupported) {
|
|
6593
|
-
|
|
6571
|
+
node.optional = optional;
|
|
6594
6572
|
}
|
|
6595
|
-
base = this.finishNode(
|
|
6573
|
+
base = this.finishNode(node, "MemberExpression");
|
|
6596
6574
|
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
6597
6575
|
var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
6598
6576
|
this.yieldPos = 0;
|
|
@@ -6636,25 +6614,25 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
|
6636
6614
|
if (this.type === types$1.slash) {
|
|
6637
6615
|
this.readRegexp();
|
|
6638
6616
|
}
|
|
6639
|
-
var
|
|
6617
|
+
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
6640
6618
|
switch (this.type) {
|
|
6641
6619
|
case types$1._super:
|
|
6642
6620
|
if (!this.allowSuper) {
|
|
6643
6621
|
this.raise(this.start, "'super' keyword outside a method");
|
|
6644
6622
|
}
|
|
6645
|
-
|
|
6623
|
+
node = this.startNode();
|
|
6646
6624
|
this.next();
|
|
6647
6625
|
if (this.type === types$1.parenL && !this.allowDirectSuper) {
|
|
6648
|
-
this.raise(
|
|
6626
|
+
this.raise(node.start, "super() call outside constructor of a subclass");
|
|
6649
6627
|
}
|
|
6650
6628
|
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) {
|
|
6651
6629
|
this.unexpected();
|
|
6652
6630
|
}
|
|
6653
|
-
return this.finishNode(
|
|
6631
|
+
return this.finishNode(node, "Super");
|
|
6654
6632
|
case types$1._this:
|
|
6655
|
-
|
|
6633
|
+
node = this.startNode();
|
|
6656
6634
|
this.next();
|
|
6657
|
-
return this.finishNode(
|
|
6635
|
+
return this.finishNode(node, "ThisExpression");
|
|
6658
6636
|
case types$1.name:
|
|
6659
6637
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
6660
6638
|
var id = this.parseIdent(false);
|
|
@@ -6677,20 +6655,20 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
|
6677
6655
|
return id;
|
|
6678
6656
|
case types$1.regexp:
|
|
6679
6657
|
var value = this.value;
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
return
|
|
6658
|
+
node = this.parseLiteral(value.value);
|
|
6659
|
+
node.regex = { pattern: value.pattern, flags: value.flags };
|
|
6660
|
+
return node;
|
|
6683
6661
|
case types$1.num:
|
|
6684
6662
|
case types$1.string:
|
|
6685
6663
|
return this.parseLiteral(this.value);
|
|
6686
6664
|
case types$1._null:
|
|
6687
6665
|
case types$1._true:
|
|
6688
6666
|
case types$1._false:
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6667
|
+
node = this.startNode();
|
|
6668
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
6669
|
+
node.raw = this.type.keyword;
|
|
6692
6670
|
this.next();
|
|
6693
|
-
return this.finishNode(
|
|
6671
|
+
return this.finishNode(node, "Literal");
|
|
6694
6672
|
case types$1.parenL:
|
|
6695
6673
|
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
6696
6674
|
if (refDestructuringErrors) {
|
|
@@ -6703,17 +6681,17 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
|
6703
6681
|
}
|
|
6704
6682
|
return expr;
|
|
6705
6683
|
case types$1.bracketL:
|
|
6706
|
-
|
|
6684
|
+
node = this.startNode();
|
|
6707
6685
|
this.next();
|
|
6708
|
-
|
|
6709
|
-
return this.finishNode(
|
|
6686
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
6687
|
+
return this.finishNode(node, "ArrayExpression");
|
|
6710
6688
|
case types$1.braceL:
|
|
6711
6689
|
this.overrideContext(types.b_expr);
|
|
6712
6690
|
return this.parseObj(false, refDestructuringErrors);
|
|
6713
6691
|
case types$1._function:
|
|
6714
|
-
|
|
6692
|
+
node = this.startNode();
|
|
6715
6693
|
this.next();
|
|
6716
|
-
return this.parseFunction(
|
|
6694
|
+
return this.parseFunction(node, 0);
|
|
6717
6695
|
case types$1._class:
|
|
6718
6696
|
return this.parseClass(this.startNode(), false);
|
|
6719
6697
|
case types$1._new:
|
|
@@ -6734,25 +6712,25 @@ pp$5.parseExprAtomDefault = function() {
|
|
|
6734
6712
|
this.unexpected();
|
|
6735
6713
|
};
|
|
6736
6714
|
pp$5.parseExprImport = function(forNew) {
|
|
6737
|
-
var
|
|
6715
|
+
var node = this.startNode();
|
|
6738
6716
|
if (this.containsEsc) {
|
|
6739
6717
|
this.raiseRecoverable(this.start, "Escape sequence in keyword import");
|
|
6740
6718
|
}
|
|
6741
6719
|
this.next();
|
|
6742
6720
|
if (this.type === types$1.parenL && !forNew) {
|
|
6743
|
-
return this.parseDynamicImport(
|
|
6721
|
+
return this.parseDynamicImport(node);
|
|
6744
6722
|
} else if (this.type === types$1.dot) {
|
|
6745
|
-
var meta = this.startNodeAt(
|
|
6723
|
+
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
|
|
6746
6724
|
meta.name = "import";
|
|
6747
|
-
|
|
6748
|
-
return this.parseImportMeta(
|
|
6725
|
+
node.meta = this.finishNode(meta, "Identifier");
|
|
6726
|
+
return this.parseImportMeta(node);
|
|
6749
6727
|
} else {
|
|
6750
6728
|
this.unexpected();
|
|
6751
6729
|
}
|
|
6752
6730
|
};
|
|
6753
|
-
pp$5.parseDynamicImport = function(
|
|
6731
|
+
pp$5.parseDynamicImport = function(node) {
|
|
6754
6732
|
this.next();
|
|
6755
|
-
|
|
6733
|
+
node.source = this.parseMaybeAssign();
|
|
6756
6734
|
if (!this.eat(types$1.parenR)) {
|
|
6757
6735
|
var errorPos = this.start;
|
|
6758
6736
|
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
@@ -6761,32 +6739,32 @@ pp$5.parseDynamicImport = function(node2) {
|
|
|
6761
6739
|
this.unexpected(errorPos);
|
|
6762
6740
|
}
|
|
6763
6741
|
}
|
|
6764
|
-
return this.finishNode(
|
|
6742
|
+
return this.finishNode(node, "ImportExpression");
|
|
6765
6743
|
};
|
|
6766
|
-
pp$5.parseImportMeta = function(
|
|
6744
|
+
pp$5.parseImportMeta = function(node) {
|
|
6767
6745
|
this.next();
|
|
6768
6746
|
var containsEsc = this.containsEsc;
|
|
6769
|
-
|
|
6770
|
-
if (
|
|
6771
|
-
this.raiseRecoverable(
|
|
6747
|
+
node.property = this.parseIdent(true);
|
|
6748
|
+
if (node.property.name !== "meta") {
|
|
6749
|
+
this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
|
|
6772
6750
|
}
|
|
6773
6751
|
if (containsEsc) {
|
|
6774
|
-
this.raiseRecoverable(
|
|
6752
|
+
this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
|
|
6775
6753
|
}
|
|
6776
6754
|
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) {
|
|
6777
|
-
this.raiseRecoverable(
|
|
6755
|
+
this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module");
|
|
6778
6756
|
}
|
|
6779
|
-
return this.finishNode(
|
|
6757
|
+
return this.finishNode(node, "MetaProperty");
|
|
6780
6758
|
};
|
|
6781
6759
|
pp$5.parseLiteral = function(value) {
|
|
6782
|
-
var
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
if (
|
|
6786
|
-
|
|
6760
|
+
var node = this.startNode();
|
|
6761
|
+
node.value = value;
|
|
6762
|
+
node.raw = this.input.slice(this.start, this.end);
|
|
6763
|
+
if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
|
|
6764
|
+
node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
|
|
6787
6765
|
}
|
|
6788
6766
|
this.next();
|
|
6789
|
-
return this.finishNode(
|
|
6767
|
+
return this.finishNode(node, "Literal");
|
|
6790
6768
|
};
|
|
6791
6769
|
pp$5.parseParenExpression = function() {
|
|
6792
6770
|
this.expect(types$1.parenL);
|
|
@@ -6872,34 +6850,34 @@ pp$5.parseNew = function() {
|
|
|
6872
6850
|
if (this.containsEsc) {
|
|
6873
6851
|
this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
6874
6852
|
}
|
|
6875
|
-
var
|
|
6853
|
+
var node = this.startNode();
|
|
6876
6854
|
this.next();
|
|
6877
6855
|
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
|
|
6878
|
-
var meta = this.startNodeAt(
|
|
6856
|
+
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
|
|
6879
6857
|
meta.name = "new";
|
|
6880
|
-
|
|
6858
|
+
node.meta = this.finishNode(meta, "Identifier");
|
|
6881
6859
|
this.next();
|
|
6882
6860
|
var containsEsc = this.containsEsc;
|
|
6883
|
-
|
|
6884
|
-
if (
|
|
6885
|
-
this.raiseRecoverable(
|
|
6861
|
+
node.property = this.parseIdent(true);
|
|
6862
|
+
if (node.property.name !== "target") {
|
|
6863
|
+
this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
|
|
6886
6864
|
}
|
|
6887
6865
|
if (containsEsc) {
|
|
6888
|
-
this.raiseRecoverable(
|
|
6866
|
+
this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
|
|
6889
6867
|
}
|
|
6890
6868
|
if (!this.allowNewDotTarget) {
|
|
6891
|
-
this.raiseRecoverable(
|
|
6869
|
+
this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block");
|
|
6892
6870
|
}
|
|
6893
|
-
return this.finishNode(
|
|
6871
|
+
return this.finishNode(node, "MetaProperty");
|
|
6894
6872
|
}
|
|
6895
6873
|
var startPos = this.start, startLoc = this.startLoc;
|
|
6896
|
-
|
|
6874
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
6897
6875
|
if (this.eat(types$1.parenL)) {
|
|
6898
|
-
|
|
6876
|
+
node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
|
|
6899
6877
|
} else {
|
|
6900
|
-
|
|
6878
|
+
node.arguments = empty;
|
|
6901
6879
|
}
|
|
6902
|
-
return this.finishNode(
|
|
6880
|
+
return this.finishNode(node, "NewExpression");
|
|
6903
6881
|
};
|
|
6904
6882
|
pp$5.parseTemplateElement = function(ref2) {
|
|
6905
6883
|
var isTagged = ref2.isTagged;
|
|
@@ -6928,29 +6906,29 @@ pp$5.parseTemplate = function(ref2) {
|
|
|
6928
6906
|
var isTagged = ref2.isTagged;
|
|
6929
6907
|
if (isTagged === void 0)
|
|
6930
6908
|
isTagged = false;
|
|
6931
|
-
var
|
|
6909
|
+
var node = this.startNode();
|
|
6932
6910
|
this.next();
|
|
6933
|
-
|
|
6911
|
+
node.expressions = [];
|
|
6934
6912
|
var curElt = this.parseTemplateElement({ isTagged });
|
|
6935
|
-
|
|
6913
|
+
node.quasis = [curElt];
|
|
6936
6914
|
while (!curElt.tail) {
|
|
6937
6915
|
if (this.type === types$1.eof) {
|
|
6938
6916
|
this.raise(this.pos, "Unterminated template literal");
|
|
6939
6917
|
}
|
|
6940
6918
|
this.expect(types$1.dollarBraceL);
|
|
6941
|
-
|
|
6919
|
+
node.expressions.push(this.parseExpression());
|
|
6942
6920
|
this.expect(types$1.braceR);
|
|
6943
|
-
|
|
6921
|
+
node.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
|
|
6944
6922
|
}
|
|
6945
6923
|
this.next();
|
|
6946
|
-
return this.finishNode(
|
|
6924
|
+
return this.finishNode(node, "TemplateLiteral");
|
|
6947
6925
|
};
|
|
6948
6926
|
pp$5.isAsyncProp = function(prop) {
|
|
6949
6927
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
|
6950
6928
|
};
|
|
6951
6929
|
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
6952
|
-
var
|
|
6953
|
-
|
|
6930
|
+
var node = this.startNode(), first = true, propHash = {};
|
|
6931
|
+
node.properties = [];
|
|
6954
6932
|
this.next();
|
|
6955
6933
|
while (!this.eat(types$1.braceR)) {
|
|
6956
6934
|
if (!first) {
|
|
@@ -6965,9 +6943,9 @@ pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
6965
6943
|
if (!isPattern) {
|
|
6966
6944
|
this.checkPropClash(prop, propHash, refDestructuringErrors);
|
|
6967
6945
|
}
|
|
6968
|
-
|
|
6946
|
+
node.properties.push(prop);
|
|
6969
6947
|
}
|
|
6970
|
-
return this.finishNode(
|
|
6948
|
+
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
|
|
6971
6949
|
};
|
|
6972
6950
|
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
6973
6951
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
@@ -7082,67 +7060,67 @@ pp$5.parsePropertyName = function(prop) {
|
|
|
7082
7060
|
}
|
|
7083
7061
|
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
7084
7062
|
};
|
|
7085
|
-
pp$5.initFunction = function(
|
|
7086
|
-
|
|
7063
|
+
pp$5.initFunction = function(node) {
|
|
7064
|
+
node.id = null;
|
|
7087
7065
|
if (this.options.ecmaVersion >= 6) {
|
|
7088
|
-
|
|
7066
|
+
node.generator = node.expression = false;
|
|
7089
7067
|
}
|
|
7090
7068
|
if (this.options.ecmaVersion >= 8) {
|
|
7091
|
-
|
|
7069
|
+
node.async = false;
|
|
7092
7070
|
}
|
|
7093
7071
|
};
|
|
7094
7072
|
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
7095
|
-
var
|
|
7096
|
-
this.initFunction(
|
|
7073
|
+
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
7074
|
+
this.initFunction(node);
|
|
7097
7075
|
if (this.options.ecmaVersion >= 6) {
|
|
7098
|
-
|
|
7076
|
+
node.generator = isGenerator;
|
|
7099
7077
|
}
|
|
7100
7078
|
if (this.options.ecmaVersion >= 8) {
|
|
7101
|
-
|
|
7079
|
+
node.async = !!isAsync;
|
|
7102
7080
|
}
|
|
7103
7081
|
this.yieldPos = 0;
|
|
7104
7082
|
this.awaitPos = 0;
|
|
7105
7083
|
this.awaitIdentPos = 0;
|
|
7106
|
-
this.enterScope(functionFlags(isAsync,
|
|
7084
|
+
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
7107
7085
|
this.expect(types$1.parenL);
|
|
7108
|
-
|
|
7086
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
7109
7087
|
this.checkYieldAwaitInDefaultParams();
|
|
7110
|
-
this.parseFunctionBody(
|
|
7088
|
+
this.parseFunctionBody(node, false, true, false);
|
|
7111
7089
|
this.yieldPos = oldYieldPos;
|
|
7112
7090
|
this.awaitPos = oldAwaitPos;
|
|
7113
7091
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
7114
|
-
return this.finishNode(
|
|
7092
|
+
return this.finishNode(node, "FunctionExpression");
|
|
7115
7093
|
};
|
|
7116
|
-
pp$5.parseArrowExpression = function(
|
|
7094
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
7117
7095
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
7118
7096
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
7119
|
-
this.initFunction(
|
|
7097
|
+
this.initFunction(node);
|
|
7120
7098
|
if (this.options.ecmaVersion >= 8) {
|
|
7121
|
-
|
|
7099
|
+
node.async = !!isAsync;
|
|
7122
7100
|
}
|
|
7123
7101
|
this.yieldPos = 0;
|
|
7124
7102
|
this.awaitPos = 0;
|
|
7125
7103
|
this.awaitIdentPos = 0;
|
|
7126
|
-
|
|
7127
|
-
this.parseFunctionBody(
|
|
7104
|
+
node.params = this.toAssignableList(params, true);
|
|
7105
|
+
this.parseFunctionBody(node, true, false, forInit);
|
|
7128
7106
|
this.yieldPos = oldYieldPos;
|
|
7129
7107
|
this.awaitPos = oldAwaitPos;
|
|
7130
7108
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
7131
|
-
return this.finishNode(
|
|
7109
|
+
return this.finishNode(node, "ArrowFunctionExpression");
|
|
7132
7110
|
};
|
|
7133
|
-
pp$5.parseFunctionBody = function(
|
|
7111
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
7134
7112
|
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
7135
7113
|
var oldStrict = this.strict, useStrict = false;
|
|
7136
7114
|
if (isExpression) {
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
this.checkParams(
|
|
7115
|
+
node.body = this.parseMaybeAssign(forInit);
|
|
7116
|
+
node.expression = true;
|
|
7117
|
+
this.checkParams(node, false);
|
|
7140
7118
|
} else {
|
|
7141
|
-
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(
|
|
7119
|
+
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
|
|
7142
7120
|
if (!oldStrict || nonSimple) {
|
|
7143
7121
|
useStrict = this.strictDirective(this.end);
|
|
7144
7122
|
if (useStrict && nonSimple) {
|
|
7145
|
-
this.raiseRecoverable(
|
|
7123
|
+
this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
|
|
7146
7124
|
}
|
|
7147
7125
|
}
|
|
7148
7126
|
var oldLabels = this.labels;
|
|
@@ -7150,13 +7128,13 @@ pp$5.parseFunctionBody = function(node2, isArrowFunction, isMethod, forInit) {
|
|
|
7150
7128
|
if (useStrict) {
|
|
7151
7129
|
this.strict = true;
|
|
7152
7130
|
}
|
|
7153
|
-
this.checkParams(
|
|
7154
|
-
if (this.strict &&
|
|
7155
|
-
this.checkLValSimple(
|
|
7131
|
+
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
|
|
7132
|
+
if (this.strict && node.id) {
|
|
7133
|
+
this.checkLValSimple(node.id, BIND_OUTSIDE);
|
|
7156
7134
|
}
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
this.adaptDirectivePrologue(
|
|
7135
|
+
node.body = this.parseBlock(false, void 0, useStrict && !oldStrict);
|
|
7136
|
+
node.expression = false;
|
|
7137
|
+
this.adaptDirectivePrologue(node.body.body);
|
|
7160
7138
|
this.labels = oldLabels;
|
|
7161
7139
|
}
|
|
7162
7140
|
this.exitScope();
|
|
@@ -7170,9 +7148,9 @@ pp$5.isSimpleParamList = function(params) {
|
|
|
7170
7148
|
}
|
|
7171
7149
|
return true;
|
|
7172
7150
|
};
|
|
7173
|
-
pp$5.checkParams = function(
|
|
7151
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
7174
7152
|
var nameHash = /* @__PURE__ */ Object.create(null);
|
|
7175
|
-
for (var i = 0, list =
|
|
7153
|
+
for (var i = 0, list = node.params; i < list.length; i += 1) {
|
|
7176
7154
|
var param = list[i];
|
|
7177
7155
|
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
|
7178
7156
|
}
|
|
@@ -7234,73 +7212,73 @@ pp$5.checkUnreserved = function(ref2) {
|
|
|
7234
7212
|
}
|
|
7235
7213
|
};
|
|
7236
7214
|
pp$5.parseIdent = function(liberal) {
|
|
7237
|
-
var
|
|
7215
|
+
var node = this.parseIdentNode();
|
|
7238
7216
|
this.next(!!liberal);
|
|
7239
|
-
this.finishNode(
|
|
7217
|
+
this.finishNode(node, "Identifier");
|
|
7240
7218
|
if (!liberal) {
|
|
7241
|
-
this.checkUnreserved(
|
|
7242
|
-
if (
|
|
7243
|
-
this.awaitIdentPos =
|
|
7219
|
+
this.checkUnreserved(node);
|
|
7220
|
+
if (node.name === "await" && !this.awaitIdentPos) {
|
|
7221
|
+
this.awaitIdentPos = node.start;
|
|
7244
7222
|
}
|
|
7245
7223
|
}
|
|
7246
|
-
return
|
|
7224
|
+
return node;
|
|
7247
7225
|
};
|
|
7248
7226
|
pp$5.parseIdentNode = function() {
|
|
7249
|
-
var
|
|
7227
|
+
var node = this.startNode();
|
|
7250
7228
|
if (this.type === types$1.name) {
|
|
7251
|
-
|
|
7229
|
+
node.name = this.value;
|
|
7252
7230
|
} else if (this.type.keyword) {
|
|
7253
|
-
|
|
7254
|
-
if ((
|
|
7231
|
+
node.name = this.type.keyword;
|
|
7232
|
+
if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
7255
7233
|
this.context.pop();
|
|
7256
7234
|
}
|
|
7257
7235
|
this.type = types$1.name;
|
|
7258
7236
|
} else {
|
|
7259
7237
|
this.unexpected();
|
|
7260
7238
|
}
|
|
7261
|
-
return
|
|
7239
|
+
return node;
|
|
7262
7240
|
};
|
|
7263
7241
|
pp$5.parsePrivateIdent = function() {
|
|
7264
|
-
var
|
|
7242
|
+
var node = this.startNode();
|
|
7265
7243
|
if (this.type === types$1.privateId) {
|
|
7266
|
-
|
|
7244
|
+
node.name = this.value;
|
|
7267
7245
|
} else {
|
|
7268
7246
|
this.unexpected();
|
|
7269
7247
|
}
|
|
7270
7248
|
this.next();
|
|
7271
|
-
this.finishNode(
|
|
7249
|
+
this.finishNode(node, "PrivateIdentifier");
|
|
7272
7250
|
if (this.options.checkPrivateFields) {
|
|
7273
7251
|
if (this.privateNameStack.length === 0) {
|
|
7274
|
-
this.raise(
|
|
7252
|
+
this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
|
|
7275
7253
|
} else {
|
|
7276
|
-
this.privateNameStack[this.privateNameStack.length - 1].used.push(
|
|
7254
|
+
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
|
|
7277
7255
|
}
|
|
7278
7256
|
}
|
|
7279
|
-
return
|
|
7257
|
+
return node;
|
|
7280
7258
|
};
|
|
7281
7259
|
pp$5.parseYield = function(forInit) {
|
|
7282
7260
|
if (!this.yieldPos) {
|
|
7283
7261
|
this.yieldPos = this.start;
|
|
7284
7262
|
}
|
|
7285
|
-
var
|
|
7263
|
+
var node = this.startNode();
|
|
7286
7264
|
this.next();
|
|
7287
7265
|
if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) {
|
|
7288
|
-
|
|
7289
|
-
|
|
7266
|
+
node.delegate = false;
|
|
7267
|
+
node.argument = null;
|
|
7290
7268
|
} else {
|
|
7291
|
-
|
|
7292
|
-
|
|
7269
|
+
node.delegate = this.eat(types$1.star);
|
|
7270
|
+
node.argument = this.parseMaybeAssign(forInit);
|
|
7293
7271
|
}
|
|
7294
|
-
return this.finishNode(
|
|
7272
|
+
return this.finishNode(node, "YieldExpression");
|
|
7295
7273
|
};
|
|
7296
7274
|
pp$5.parseAwait = function(forInit) {
|
|
7297
7275
|
if (!this.awaitPos) {
|
|
7298
7276
|
this.awaitPos = this.start;
|
|
7299
7277
|
}
|
|
7300
|
-
var
|
|
7278
|
+
var node = this.startNode();
|
|
7301
7279
|
this.next();
|
|
7302
|
-
|
|
7303
|
-
return this.finishNode(
|
|
7280
|
+
node.argument = this.parseMaybeUnary(null, true, false, forInit);
|
|
7281
|
+
return this.finishNode(node, "AwaitExpression");
|
|
7304
7282
|
};
|
|
7305
7283
|
var pp$4 = Parser.prototype;
|
|
7306
7284
|
pp$4.raise = function(pos, message) {
|
|
@@ -7420,27 +7398,27 @@ pp$2.startNode = function() {
|
|
|
7420
7398
|
pp$2.startNodeAt = function(pos, loc) {
|
|
7421
7399
|
return new Node(this, pos, loc);
|
|
7422
7400
|
};
|
|
7423
|
-
function finishNodeAt(
|
|
7424
|
-
|
|
7425
|
-
|
|
7401
|
+
function finishNodeAt(node, type, pos, loc) {
|
|
7402
|
+
node.type = type;
|
|
7403
|
+
node.end = pos;
|
|
7426
7404
|
if (this.options.locations) {
|
|
7427
|
-
|
|
7405
|
+
node.loc.end = loc;
|
|
7428
7406
|
}
|
|
7429
7407
|
if (this.options.ranges) {
|
|
7430
|
-
|
|
7408
|
+
node.range[1] = pos;
|
|
7431
7409
|
}
|
|
7432
|
-
return
|
|
7410
|
+
return node;
|
|
7433
7411
|
}
|
|
7434
|
-
pp$2.finishNode = function(
|
|
7435
|
-
return finishNodeAt.call(this,
|
|
7412
|
+
pp$2.finishNode = function(node, type) {
|
|
7413
|
+
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
|
|
7436
7414
|
};
|
|
7437
|
-
pp$2.finishNodeAt = function(
|
|
7438
|
-
return finishNodeAt.call(this,
|
|
7415
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
7416
|
+
return finishNodeAt.call(this, node, type, pos, loc);
|
|
7439
7417
|
};
|
|
7440
|
-
pp$2.copyNode = function(
|
|
7441
|
-
var newNode = new Node(this,
|
|
7442
|
-
for (var prop in
|
|
7443
|
-
newNode[prop] =
|
|
7418
|
+
pp$2.copyNode = function(node) {
|
|
7419
|
+
var newNode = new Node(this, node.start, this.startLoc);
|
|
7420
|
+
for (var prop in node) {
|
|
7421
|
+
newNode[prop] = node[prop];
|
|
7444
7422
|
}
|
|
7445
7423
|
return newNode;
|
|
7446
7424
|
};
|
|
@@ -8034,14 +8012,14 @@ pp$1.regexp_eatAtomEscape = function(state) {
|
|
|
8034
8012
|
pp$1.regexp_eatBackReference = function(state) {
|
|
8035
8013
|
var start = state.pos;
|
|
8036
8014
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
8037
|
-
var
|
|
8015
|
+
var n2 = state.lastIntValue;
|
|
8038
8016
|
if (state.switchU) {
|
|
8039
|
-
if (
|
|
8040
|
-
state.maxBackReference =
|
|
8017
|
+
if (n2 > state.maxBackReference) {
|
|
8018
|
+
state.maxBackReference = n2;
|
|
8041
8019
|
}
|
|
8042
8020
|
return true;
|
|
8043
8021
|
}
|
|
8044
|
-
if (
|
|
8022
|
+
if (n2 <= state.numCapturingParens) {
|
|
8045
8023
|
return true;
|
|
8046
8024
|
}
|
|
8047
8025
|
state.pos = start;
|
|
@@ -9484,11 +9462,11 @@ pp.readEscapedChar = function(inTemplate) {
|
|
|
9484
9462
|
};
|
|
9485
9463
|
pp.readHexChar = function(len) {
|
|
9486
9464
|
var codePos = this.pos;
|
|
9487
|
-
var
|
|
9488
|
-
if (
|
|
9465
|
+
var n2 = this.readInt(16, len);
|
|
9466
|
+
if (n2 === null) {
|
|
9489
9467
|
this.invalidStringToken(codePos, "Bad character escape sequence");
|
|
9490
9468
|
}
|
|
9491
|
-
return
|
|
9469
|
+
return n2;
|
|
9492
9470
|
};
|
|
9493
9471
|
pp.readWord1 = function() {
|
|
9494
9472
|
this.containsEsc = false;
|
|
@@ -9550,14 +9528,15 @@ Parser.acorn = {
|
|
|
9550
9528
|
nonASCIIwhitespace
|
|
9551
9529
|
};
|
|
9552
9530
|
|
|
9553
|
-
// node_modules/.pnpm/mlly@1.
|
|
9531
|
+
// node_modules/.pnpm/mlly@1.5.0/node_modules/mlly/dist/index.mjs
|
|
9554
9532
|
import { builtinModules, createRequire } from "module";
|
|
9555
9533
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from "fs";
|
|
9556
9534
|
import { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL } from "url";
|
|
9557
9535
|
|
|
9558
|
-
// node_modules/.pnpm/ufo@1.
|
|
9536
|
+
// node_modules/.pnpm/ufo@1.4.0/node_modules/ufo/dist/index.mjs
|
|
9559
9537
|
var r = String.fromCharCode;
|
|
9560
9538
|
var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
|
9539
|
+
var JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
9561
9540
|
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
9562
9541
|
if (!respectQueryAndFragment) {
|
|
9563
9542
|
return input.endsWith("/");
|
|
@@ -9587,7 +9566,6 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
9587
9566
|
function isNonEmptyURL(url) {
|
|
9588
9567
|
return url && url !== "/";
|
|
9589
9568
|
}
|
|
9590
|
-
var JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
9591
9569
|
function joinURL(base, ...input) {
|
|
9592
9570
|
let url = base || "";
|
|
9593
9571
|
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
|
|
@@ -9600,6 +9578,7 @@ function joinURL(base, ...input) {
|
|
|
9600
9578
|
}
|
|
9601
9579
|
return url;
|
|
9602
9580
|
}
|
|
9581
|
+
var protocolRelative = Symbol.for("ufo:protocolRelative");
|
|
9603
9582
|
|
|
9604
9583
|
// node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
9605
9584
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
@@ -9607,7 +9586,7 @@ var isAbsolute = function(p) {
|
|
|
9607
9586
|
return _IS_ABSOLUTE_RE.test(p);
|
|
9608
9587
|
};
|
|
9609
9588
|
|
|
9610
|
-
// node_modules/.pnpm/mlly@1.
|
|
9589
|
+
// node_modules/.pnpm/mlly@1.5.0/node_modules/mlly/dist/index.mjs
|
|
9611
9590
|
import assert from "assert";
|
|
9612
9591
|
import process$1 from "process";
|
|
9613
9592
|
import path2, { dirname as dirname2 } from "path";
|
|
@@ -9617,7 +9596,6 @@ var BUILTIN_MODULES = new Set(builtinModules);
|
|
|
9617
9596
|
function normalizeSlash(string_) {
|
|
9618
9597
|
return string_.replace(/\\/g, "/");
|
|
9619
9598
|
}
|
|
9620
|
-
var isWindows = process$1.platform === "win32";
|
|
9621
9599
|
var own$1 = {}.hasOwnProperty;
|
|
9622
9600
|
var classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
9623
9601
|
var kTypes = /* @__PURE__ */ new Set([
|
|
@@ -9763,10 +9741,10 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
9763
9741
|
/**
|
|
9764
9742
|
* @param {string} path
|
|
9765
9743
|
* @param {string} base
|
|
9766
|
-
* @param {
|
|
9744
|
+
* @param {boolean} [exactUrl]
|
|
9767
9745
|
*/
|
|
9768
|
-
(path4, base,
|
|
9769
|
-
return `Cannot find ${
|
|
9746
|
+
(path4, base, exactUrl = false) => {
|
|
9747
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path4}' imported from ${base}`;
|
|
9770
9748
|
},
|
|
9771
9749
|
Error
|
|
9772
9750
|
);
|
|
@@ -9836,24 +9814,6 @@ codes.ERR_INVALID_ARG_VALUE = createError(
|
|
|
9836
9814
|
// Note: extra classes have been shaken out.
|
|
9837
9815
|
// , RangeError
|
|
9838
9816
|
);
|
|
9839
|
-
codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError(
|
|
9840
|
-
"ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
9841
|
-
/**
|
|
9842
|
-
* @param {URL} url
|
|
9843
|
-
* @param {Array<string>} supported
|
|
9844
|
-
*/
|
|
9845
|
-
(url, supported) => {
|
|
9846
|
-
let message = `Only URLs with a scheme in: ${formatList(
|
|
9847
|
-
supported
|
|
9848
|
-
)} are supported by the default ESM loader`;
|
|
9849
|
-
if (isWindows && url.protocol.length === 2) {
|
|
9850
|
-
message += ". On Windows, absolute paths must be valid file:// URLs";
|
|
9851
|
-
}
|
|
9852
|
-
message += `. Received protocol '${url.protocol}'`;
|
|
9853
|
-
return message;
|
|
9854
|
-
},
|
|
9855
|
-
Error
|
|
9856
|
-
);
|
|
9857
9817
|
function createError(sym, value, def) {
|
|
9858
9818
|
messages.set(sym, value);
|
|
9859
9819
|
return makeNodeErrorWithCode(def, sym);
|
|
@@ -9971,96 +9931,98 @@ function determineSpecificType(value) {
|
|
|
9971
9931
|
}
|
|
9972
9932
|
return `type ${typeof value} (${inspected})`;
|
|
9973
9933
|
}
|
|
9934
|
+
var hasOwnProperty$1 = {}.hasOwnProperty;
|
|
9935
|
+
var { ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1 } = codes;
|
|
9936
|
+
var cache = /* @__PURE__ */ new Map();
|
|
9974
9937
|
var reader = { read };
|
|
9975
9938
|
var packageJsonReader = reader;
|
|
9976
|
-
function read(jsonPath) {
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
path2.toNamespacedPath(path2.join(path2.dirname(jsonPath), "package.json")),
|
|
9980
|
-
"utf8"
|
|
9981
|
-
);
|
|
9982
|
-
return { string };
|
|
9983
|
-
} catch (error) {
|
|
9984
|
-
const exception = (
|
|
9985
|
-
/** @type {ErrnoException} */
|
|
9986
|
-
error
|
|
9987
|
-
);
|
|
9988
|
-
if (exception.code === "ENOENT") {
|
|
9989
|
-
return { string: void 0 };
|
|
9990
|
-
}
|
|
9991
|
-
throw exception;
|
|
9992
|
-
}
|
|
9993
|
-
}
|
|
9994
|
-
var { ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1 } = codes;
|
|
9995
|
-
var packageJsonCache = /* @__PURE__ */ new Map();
|
|
9996
|
-
function getPackageConfig(path4, specifier, base) {
|
|
9997
|
-
const existing = packageJsonCache.get(path4);
|
|
9998
|
-
if (existing !== void 0) {
|
|
9939
|
+
function read(jsonPath, { base, specifier }) {
|
|
9940
|
+
const existing = cache.get(jsonPath);
|
|
9941
|
+
if (existing) {
|
|
9999
9942
|
return existing;
|
|
10000
9943
|
}
|
|
10001
|
-
|
|
10002
|
-
if (source === void 0) {
|
|
10003
|
-
const packageConfig2 = {
|
|
10004
|
-
pjsonPath: path4,
|
|
10005
|
-
exists: false,
|
|
10006
|
-
main: void 0,
|
|
10007
|
-
name: void 0,
|
|
10008
|
-
type: "none",
|
|
10009
|
-
exports: void 0,
|
|
10010
|
-
imports: void 0
|
|
10011
|
-
};
|
|
10012
|
-
packageJsonCache.set(path4, packageConfig2);
|
|
10013
|
-
return packageConfig2;
|
|
10014
|
-
}
|
|
10015
|
-
let packageJson;
|
|
9944
|
+
let string;
|
|
10016
9945
|
try {
|
|
10017
|
-
|
|
9946
|
+
string = fs.readFileSync(path2.toNamespacedPath(jsonPath), "utf8");
|
|
10018
9947
|
} catch (error) {
|
|
10019
9948
|
const exception = (
|
|
10020
9949
|
/** @type {ErrnoException} */
|
|
10021
9950
|
error
|
|
10022
9951
|
);
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
exception.message
|
|
10027
|
-
);
|
|
9952
|
+
if (exception.code !== "ENOENT") {
|
|
9953
|
+
throw exception;
|
|
9954
|
+
}
|
|
10028
9955
|
}
|
|
10029
|
-
const
|
|
10030
|
-
|
|
10031
|
-
pjsonPath:
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
// @ts-expect-error Assume `Record<string, unknown>`.
|
|
10039
|
-
imports: imports2 && typeof imports2 === "object" ? imports2 : void 0
|
|
9956
|
+
const result = {
|
|
9957
|
+
exists: false,
|
|
9958
|
+
pjsonPath: jsonPath,
|
|
9959
|
+
main: void 0,
|
|
9960
|
+
name: void 0,
|
|
9961
|
+
type: "none",
|
|
9962
|
+
// Ignore unknown types for forwards compatibility
|
|
9963
|
+
exports: void 0,
|
|
9964
|
+
imports: void 0
|
|
10040
9965
|
};
|
|
10041
|
-
|
|
10042
|
-
|
|
9966
|
+
if (string !== void 0) {
|
|
9967
|
+
let parsed;
|
|
9968
|
+
try {
|
|
9969
|
+
parsed = JSON.parse(string);
|
|
9970
|
+
} catch (error_) {
|
|
9971
|
+
const cause = (
|
|
9972
|
+
/** @type {ErrnoException} */
|
|
9973
|
+
error_
|
|
9974
|
+
);
|
|
9975
|
+
const error = new ERR_INVALID_PACKAGE_CONFIG$1(
|
|
9976
|
+
jsonPath,
|
|
9977
|
+
(base ? `"${specifier}" from ` : "") + fileURLToPath$1(base || specifier),
|
|
9978
|
+
cause.message
|
|
9979
|
+
);
|
|
9980
|
+
error.cause = cause;
|
|
9981
|
+
throw error;
|
|
9982
|
+
}
|
|
9983
|
+
result.exists = true;
|
|
9984
|
+
if (hasOwnProperty$1.call(parsed, "name") && typeof parsed.name === "string") {
|
|
9985
|
+
result.name = parsed.name;
|
|
9986
|
+
}
|
|
9987
|
+
if (hasOwnProperty$1.call(parsed, "main") && typeof parsed.main === "string") {
|
|
9988
|
+
result.main = parsed.main;
|
|
9989
|
+
}
|
|
9990
|
+
if (hasOwnProperty$1.call(parsed, "exports")) {
|
|
9991
|
+
result.exports = parsed.exports;
|
|
9992
|
+
}
|
|
9993
|
+
if (hasOwnProperty$1.call(parsed, "imports")) {
|
|
9994
|
+
result.imports = parsed.imports;
|
|
9995
|
+
}
|
|
9996
|
+
if (hasOwnProperty$1.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) {
|
|
9997
|
+
result.type = parsed.type;
|
|
9998
|
+
}
|
|
9999
|
+
}
|
|
10000
|
+
cache.set(jsonPath, result);
|
|
10001
|
+
return result;
|
|
10043
10002
|
}
|
|
10044
10003
|
function getPackageScopeConfig(resolved) {
|
|
10045
|
-
let
|
|
10004
|
+
let packageJSONUrl = new URL$1("package.json", resolved);
|
|
10046
10005
|
while (true) {
|
|
10047
|
-
const
|
|
10048
|
-
if (
|
|
10006
|
+
const packageJSONPath2 = packageJSONUrl.pathname;
|
|
10007
|
+
if (packageJSONPath2.endsWith("node_modules/package.json")) {
|
|
10049
10008
|
break;
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10009
|
+
}
|
|
10010
|
+
const packageConfig = packageJsonReader.read(
|
|
10011
|
+
fileURLToPath$1(packageJSONUrl),
|
|
10012
|
+
{ specifier: resolved }
|
|
10053
10013
|
);
|
|
10054
|
-
if (
|
|
10055
|
-
return
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10014
|
+
if (packageConfig.exists) {
|
|
10015
|
+
return packageConfig;
|
|
10016
|
+
}
|
|
10017
|
+
const lastPackageJSONUrl = packageJSONUrl;
|
|
10018
|
+
packageJSONUrl = new URL$1("../package.json", packageJSONUrl);
|
|
10019
|
+
if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {
|
|
10059
10020
|
break;
|
|
10021
|
+
}
|
|
10060
10022
|
}
|
|
10061
|
-
const
|
|
10062
|
-
|
|
10063
|
-
pjsonPath:
|
|
10023
|
+
const packageJSONPath = fileURLToPath$1(packageJSONUrl);
|
|
10024
|
+
return {
|
|
10025
|
+
pjsonPath: packageJSONPath,
|
|
10064
10026
|
exists: false,
|
|
10065
10027
|
main: void 0,
|
|
10066
10028
|
name: void 0,
|
|
@@ -10068,8 +10030,6 @@ function getPackageScopeConfig(resolved) {
|
|
|
10068
10030
|
exports: void 0,
|
|
10069
10031
|
imports: void 0
|
|
10070
10032
|
};
|
|
10071
|
-
packageJsonCache.set(packageJsonPath, packageConfig);
|
|
10072
|
-
return packageConfig;
|
|
10073
10033
|
}
|
|
10074
10034
|
function getPackageType(url) {
|
|
10075
10035
|
const packageConfig = getPackageScopeConfig(url);
|
|
@@ -10126,7 +10086,18 @@ function extname2(url) {
|
|
|
10126
10086
|
function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
10127
10087
|
const ext = extname2(url);
|
|
10128
10088
|
if (ext === ".js") {
|
|
10129
|
-
|
|
10089
|
+
const packageType = getPackageType(url);
|
|
10090
|
+
if (packageType !== "none") {
|
|
10091
|
+
return packageType;
|
|
10092
|
+
}
|
|
10093
|
+
return "commonjs";
|
|
10094
|
+
}
|
|
10095
|
+
if (ext === "") {
|
|
10096
|
+
const packageType = getPackageType(url);
|
|
10097
|
+
if (packageType === "none" || packageType === "commonjs") {
|
|
10098
|
+
return "commonjs";
|
|
10099
|
+
}
|
|
10100
|
+
return "module";
|
|
10130
10101
|
}
|
|
10131
10102
|
const format3 = extensionFormatMap[ext];
|
|
10132
10103
|
if (format3)
|
|
@@ -10140,10 +10111,11 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
|
10140
10111
|
function getHttpProtocolModuleFormat() {
|
|
10141
10112
|
}
|
|
10142
10113
|
function defaultGetFormatWithoutErrors(url, context) {
|
|
10143
|
-
|
|
10114
|
+
const protocol = url.protocol;
|
|
10115
|
+
if (!hasOwnProperty2.call(protocolHandlers, protocol)) {
|
|
10144
10116
|
return null;
|
|
10145
10117
|
}
|
|
10146
|
-
return protocolHandlers[
|
|
10118
|
+
return protocolHandlers[protocol](url, context, true) || null;
|
|
10147
10119
|
}
|
|
10148
10120
|
var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
|
10149
10121
|
var {
|
|
@@ -10154,8 +10126,7 @@ var {
|
|
|
10154
10126
|
ERR_MODULE_NOT_FOUND,
|
|
10155
10127
|
ERR_PACKAGE_IMPORT_NOT_DEFINED,
|
|
10156
10128
|
ERR_PACKAGE_PATH_NOT_EXPORTED,
|
|
10157
|
-
ERR_UNSUPPORTED_DIR_IMPORT
|
|
10158
|
-
ERR_UNSUPPORTED_ESM_URL_SCHEME
|
|
10129
|
+
ERR_UNSUPPORTED_DIR_IMPORT
|
|
10159
10130
|
} = codes;
|
|
10160
10131
|
var own = {}.hasOwnProperty;
|
|
10161
10132
|
var invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i;
|
|
@@ -10166,6 +10137,9 @@ var encodedSepRegEx = /%2f|%5c/i;
|
|
|
10166
10137
|
var emittedPackageWarnings = /* @__PURE__ */ new Set();
|
|
10167
10138
|
var doubleSlashRegEx = /[/\\]{2}/;
|
|
10168
10139
|
function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {
|
|
10140
|
+
if (process$1.noDeprecation) {
|
|
10141
|
+
return;
|
|
10142
|
+
}
|
|
10169
10143
|
const pjsonPath = fileURLToPath$1(packageJsonUrl);
|
|
10170
10144
|
const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
|
|
10171
10145
|
process$1.emitWarning(
|
|
@@ -10175,30 +10149,34 @@ function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, i
|
|
|
10175
10149
|
);
|
|
10176
10150
|
}
|
|
10177
10151
|
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
10152
|
+
if (process$1.noDeprecation) {
|
|
10153
|
+
return;
|
|
10154
|
+
}
|
|
10178
10155
|
const format3 = defaultGetFormatWithoutErrors(url, { parentURL: base.href });
|
|
10179
10156
|
if (format3 !== "module")
|
|
10180
10157
|
return;
|
|
10181
|
-
const
|
|
10158
|
+
const urlPath = fileURLToPath$1(url.href);
|
|
10182
10159
|
const pkgPath = fileURLToPath$1(new URL$1(".", packageJsonUrl));
|
|
10183
10160
|
const basePath = fileURLToPath$1(base);
|
|
10184
|
-
if (main)
|
|
10161
|
+
if (!main) {
|
|
10185
10162
|
process$1.emitWarning(
|
|
10186
|
-
`
|
|
10163
|
+
`No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${urlPath.slice(
|
|
10187
10164
|
pkgPath.length
|
|
10188
10165
|
)}", imported from ${basePath}.
|
|
10189
|
-
|
|
10166
|
+
Default "index" lookups for the main are deprecated for ES modules.`,
|
|
10190
10167
|
"DeprecationWarning",
|
|
10191
10168
|
"DEP0151"
|
|
10192
10169
|
);
|
|
10193
|
-
else
|
|
10170
|
+
} else if (path2.resolve(pkgPath, main) !== urlPath) {
|
|
10194
10171
|
process$1.emitWarning(
|
|
10195
|
-
`
|
|
10172
|
+
`Package ${pkgPath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
|
|
10196
10173
|
pkgPath.length
|
|
10197
10174
|
)}", imported from ${basePath}.
|
|
10198
|
-
|
|
10175
|
+
Automatic extension resolution of the "main" field is deprecated for ES modules.`,
|
|
10199
10176
|
"DeprecationWarning",
|
|
10200
10177
|
"DEP0151"
|
|
10201
10178
|
);
|
|
10179
|
+
}
|
|
10202
10180
|
}
|
|
10203
10181
|
function tryStatSync(path4) {
|
|
10204
10182
|
try {
|
|
@@ -10261,13 +10239,25 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
10261
10239
|
);
|
|
10262
10240
|
}
|
|
10263
10241
|
function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
10264
|
-
if (encodedSepRegEx.exec(resolved.pathname) !== null)
|
|
10242
|
+
if (encodedSepRegEx.exec(resolved.pathname) !== null) {
|
|
10265
10243
|
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
10266
10244
|
resolved.pathname,
|
|
10267
10245
|
'must not include encoded "/" or "\\" characters',
|
|
10268
10246
|
fileURLToPath$1(base)
|
|
10269
10247
|
);
|
|
10270
|
-
|
|
10248
|
+
}
|
|
10249
|
+
let filePath;
|
|
10250
|
+
try {
|
|
10251
|
+
filePath = fileURLToPath$1(resolved);
|
|
10252
|
+
} catch (error) {
|
|
10253
|
+
const cause = (
|
|
10254
|
+
/** @type {ErrnoException} */
|
|
10255
|
+
error
|
|
10256
|
+
);
|
|
10257
|
+
Object.defineProperty(cause, "input", { value: String(resolved) });
|
|
10258
|
+
Object.defineProperty(cause, "module", { value: String(base) });
|
|
10259
|
+
throw cause;
|
|
10260
|
+
}
|
|
10271
10261
|
const stats = tryStatSync(
|
|
10272
10262
|
filePath.endsWith("/") ? filePath.slice(-1) : filePath
|
|
10273
10263
|
);
|
|
@@ -10277,11 +10267,13 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
10277
10267
|
throw error;
|
|
10278
10268
|
}
|
|
10279
10269
|
if (!stats.isFile()) {
|
|
10280
|
-
|
|
10270
|
+
const error = new ERR_MODULE_NOT_FOUND(
|
|
10281
10271
|
filePath || resolved.pathname,
|
|
10282
10272
|
base && fileURLToPath$1(base),
|
|
10283
|
-
|
|
10273
|
+
true
|
|
10284
10274
|
);
|
|
10275
|
+
error.url = String(resolved);
|
|
10276
|
+
throw error;
|
|
10285
10277
|
}
|
|
10286
10278
|
if (!preserveSymlinks) {
|
|
10287
10279
|
const real = realpathSync(filePath);
|
|
@@ -10549,6 +10541,9 @@ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
|
|
10549
10541
|
return isConditionalSugar;
|
|
10550
10542
|
}
|
|
10551
10543
|
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
10544
|
+
if (process$1.noDeprecation) {
|
|
10545
|
+
return;
|
|
10546
|
+
}
|
|
10552
10547
|
const pjsonPath = fileURLToPath$1(pjsonUrl);
|
|
10553
10548
|
if (emittedPackageWarnings.has(pjsonPath + "|" + match))
|
|
10554
10549
|
return;
|
|
@@ -10780,7 +10775,10 @@ function packageResolve(specifier, base, conditions) {
|
|
|
10780
10775
|
packageJsonPath = fileURLToPath$1(packageJsonUrl);
|
|
10781
10776
|
continue;
|
|
10782
10777
|
}
|
|
10783
|
-
const packageConfig2 =
|
|
10778
|
+
const packageConfig2 = packageJsonReader.read(packageJsonPath, {
|
|
10779
|
+
base,
|
|
10780
|
+
specifier
|
|
10781
|
+
});
|
|
10784
10782
|
if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) {
|
|
10785
10783
|
return packageExportsResolve(
|
|
10786
10784
|
packageJsonUrl,
|
|
@@ -10795,7 +10793,7 @@ function packageResolve(specifier, base, conditions) {
|
|
|
10795
10793
|
}
|
|
10796
10794
|
return new URL$1(packageSubpath, packageJsonUrl);
|
|
10797
10795
|
} while (packageJsonPath.length !== lastPath.length);
|
|
10798
|
-
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath$1(base));
|
|
10796
|
+
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath$1(base), false);
|
|
10799
10797
|
}
|
|
10800
10798
|
function isRelativeSpecifier(specifier) {
|
|
10801
10799
|
if (specifier[0] === ".") {
|
|
@@ -10944,60 +10942,6 @@ function resolvePathSync(id, options) {
|
|
|
10944
10942
|
}
|
|
10945
10943
|
|
|
10946
10944
|
// node_modules/.pnpm/local-pkg@0.5.0/node_modules/local-pkg/dist/index.mjs
|
|
10947
|
-
var Node3 = class {
|
|
10948
|
-
constructor(value) {
|
|
10949
|
-
__publicField(this, "value");
|
|
10950
|
-
__publicField(this, "next");
|
|
10951
|
-
this.value = value;
|
|
10952
|
-
}
|
|
10953
|
-
};
|
|
10954
|
-
var _head, _tail, _size;
|
|
10955
|
-
var Queue = class {
|
|
10956
|
-
constructor() {
|
|
10957
|
-
__privateAdd(this, _head, void 0);
|
|
10958
|
-
__privateAdd(this, _tail, void 0);
|
|
10959
|
-
__privateAdd(this, _size, void 0);
|
|
10960
|
-
this.clear();
|
|
10961
|
-
}
|
|
10962
|
-
enqueue(value) {
|
|
10963
|
-
const node2 = new Node3(value);
|
|
10964
|
-
if (__privateGet(this, _head)) {
|
|
10965
|
-
__privateGet(this, _tail).next = node2;
|
|
10966
|
-
__privateSet(this, _tail, node2);
|
|
10967
|
-
} else {
|
|
10968
|
-
__privateSet(this, _head, node2);
|
|
10969
|
-
__privateSet(this, _tail, node2);
|
|
10970
|
-
}
|
|
10971
|
-
__privateWrapper(this, _size)._++;
|
|
10972
|
-
}
|
|
10973
|
-
dequeue() {
|
|
10974
|
-
const current2 = __privateGet(this, _head);
|
|
10975
|
-
if (!current2) {
|
|
10976
|
-
return;
|
|
10977
|
-
}
|
|
10978
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
10979
|
-
__privateWrapper(this, _size)._--;
|
|
10980
|
-
return current2.value;
|
|
10981
|
-
}
|
|
10982
|
-
clear() {
|
|
10983
|
-
__privateSet(this, _head, void 0);
|
|
10984
|
-
__privateSet(this, _tail, void 0);
|
|
10985
|
-
__privateSet(this, _size, 0);
|
|
10986
|
-
}
|
|
10987
|
-
get size() {
|
|
10988
|
-
return __privateGet(this, _size);
|
|
10989
|
-
}
|
|
10990
|
-
*[Symbol.iterator]() {
|
|
10991
|
-
let current2 = __privateGet(this, _head);
|
|
10992
|
-
while (current2) {
|
|
10993
|
-
yield current2.value;
|
|
10994
|
-
current2 = current2.next;
|
|
10995
|
-
}
|
|
10996
|
-
}
|
|
10997
|
-
};
|
|
10998
|
-
_head = new WeakMap();
|
|
10999
|
-
_tail = new WeakMap();
|
|
11000
|
-
_size = new WeakMap();
|
|
11001
10945
|
var findUpStop = Symbol("findUpStop");
|
|
11002
10946
|
function _resolve2(path4, options = {}) {
|
|
11003
10947
|
if (options.platform === "auto" || !options.platform)
|
|
@@ -11026,23 +10970,101 @@ function resolvePackage(name, options = {}) {
|
|
|
11026
10970
|
}
|
|
11027
10971
|
}
|
|
11028
10972
|
|
|
11029
|
-
// src/configs/
|
|
11030
|
-
|
|
10973
|
+
// src/configs/antfu.ts
|
|
10974
|
+
var antfu = async () => {
|
|
11031
10975
|
return [
|
|
11032
10976
|
{
|
|
11033
|
-
name: "jsse:
|
|
10977
|
+
name: "jsse:antfu",
|
|
11034
10978
|
plugins: {
|
|
11035
10979
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11036
|
-
|
|
10980
|
+
antfu: default4
|
|
11037
10981
|
},
|
|
11038
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11039
10982
|
rules: {
|
|
11040
|
-
|
|
11041
|
-
|
|
10983
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
10984
|
+
"antfu/top-level-function": "error"
|
|
10985
|
+
}
|
|
10986
|
+
},
|
|
10987
|
+
{
|
|
10988
|
+
files: ["**/src/**/*"],
|
|
10989
|
+
name: "jsse:antfu:bin",
|
|
10990
|
+
rules: {
|
|
10991
|
+
"antfu/no-import-dist": "error"
|
|
10992
|
+
}
|
|
10993
|
+
},
|
|
10994
|
+
{
|
|
10995
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
10996
|
+
name: "jsse:antfu:bin",
|
|
10997
|
+
rules: {
|
|
10998
|
+
"antfu/no-import-dist": "off",
|
|
10999
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
11042
11000
|
}
|
|
11043
11001
|
}
|
|
11044
11002
|
];
|
|
11045
|
-
}
|
|
11003
|
+
};
|
|
11004
|
+
|
|
11005
|
+
// src/configs/md.ts
|
|
11006
|
+
var markdown = async (options) => {
|
|
11007
|
+
const { componentExts = [], overrides = {} } = options ?? {};
|
|
11008
|
+
const tsRulesOff = Object.fromEntries(
|
|
11009
|
+
// @ts-expect-error - undefined
|
|
11010
|
+
Object.keys(typescriptRulesTypeAware()).map((key) => [
|
|
11011
|
+
`@typescript-eslint/${key}`,
|
|
11012
|
+
"off"
|
|
11013
|
+
])
|
|
11014
|
+
);
|
|
11015
|
+
return [
|
|
11016
|
+
{
|
|
11017
|
+
name: "jsse:markdown:setup",
|
|
11018
|
+
plugins: {
|
|
11019
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11020
|
+
markdown: default7
|
|
11021
|
+
}
|
|
11022
|
+
},
|
|
11023
|
+
{
|
|
11024
|
+
files: [GLOB_MARKDOWN],
|
|
11025
|
+
name: "jsse:markdown:processor",
|
|
11026
|
+
processor: "markdown/markdown"
|
|
11027
|
+
},
|
|
11028
|
+
{
|
|
11029
|
+
files: [
|
|
11030
|
+
GLOB_MARKDOWN_CODE,
|
|
11031
|
+
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
11032
|
+
],
|
|
11033
|
+
languageOptions: {
|
|
11034
|
+
parserOptions: {
|
|
11035
|
+
ecmaFeatures: {
|
|
11036
|
+
impliedStrict: true
|
|
11037
|
+
}
|
|
11038
|
+
}
|
|
11039
|
+
},
|
|
11040
|
+
name: "jsse:markdown:rules",
|
|
11041
|
+
rules: {
|
|
11042
|
+
"@typescript-eslint/consistent-type-imports": "off",
|
|
11043
|
+
"@typescript-eslint/no-namespace": "off",
|
|
11044
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
11045
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
11046
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
11047
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
11048
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
11049
|
+
"no-alert": "off",
|
|
11050
|
+
"no-console": "off",
|
|
11051
|
+
"no-undef": "off",
|
|
11052
|
+
"no-unused-expressions": "off",
|
|
11053
|
+
"no-unused-vars": "off",
|
|
11054
|
+
"node/prefer-global/process": "off",
|
|
11055
|
+
// Type aware rules
|
|
11056
|
+
"object-curly-newline": "off",
|
|
11057
|
+
"style/comma-dangle": "off",
|
|
11058
|
+
"style/eol-last": "off",
|
|
11059
|
+
"unicode-bom": "off",
|
|
11060
|
+
"unused-imports/no-unused-imports": "off",
|
|
11061
|
+
"unused-imports/no-unused-vars": "off",
|
|
11062
|
+
...tsRulesOff,
|
|
11063
|
+
...overrides
|
|
11064
|
+
}
|
|
11065
|
+
}
|
|
11066
|
+
];
|
|
11067
|
+
};
|
|
11046
11068
|
|
|
11047
11069
|
// src/configs/stylistic.ts
|
|
11048
11070
|
function jsxStylistic({
|
|
@@ -11061,8 +11083,8 @@ function jsxStylistic({
|
|
|
11061
11083
|
"@stylistic/jsx-quotes": "error"
|
|
11062
11084
|
};
|
|
11063
11085
|
}
|
|
11064
|
-
|
|
11065
|
-
const { indent = 2, jsx = true, quotes = "double" } = options;
|
|
11086
|
+
var stylistic = async (options) => {
|
|
11087
|
+
const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
|
|
11066
11088
|
return [
|
|
11067
11089
|
{
|
|
11068
11090
|
name: "jsse:stylistic",
|
|
@@ -11081,7 +11103,78 @@ function stylistic(options = {}) {
|
|
|
11081
11103
|
}
|
|
11082
11104
|
}
|
|
11083
11105
|
];
|
|
11084
|
-
}
|
|
11106
|
+
};
|
|
11107
|
+
|
|
11108
|
+
// src/configs/tailwind.ts
|
|
11109
|
+
var tailwind = async () => {
|
|
11110
|
+
return [
|
|
11111
|
+
{
|
|
11112
|
+
name: "jsse:tailwind",
|
|
11113
|
+
plugins: {
|
|
11114
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11115
|
+
tailwindcss: default13
|
|
11116
|
+
},
|
|
11117
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11118
|
+
rules: {
|
|
11119
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11120
|
+
...default13.configs.recommended.rules
|
|
11121
|
+
}
|
|
11122
|
+
}
|
|
11123
|
+
];
|
|
11124
|
+
};
|
|
11125
|
+
|
|
11126
|
+
// src/configs/yml.ts
|
|
11127
|
+
var yml = async (options) => {
|
|
11128
|
+
const {
|
|
11129
|
+
files = [GLOB_YAML],
|
|
11130
|
+
overrides = {},
|
|
11131
|
+
stylistic: stylistic2 = true
|
|
11132
|
+
} = options ?? {};
|
|
11133
|
+
const { indent = 2, quotes = "single" } = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
11134
|
+
const [pluginYaml, parserYaml] = await Promise.all([
|
|
11135
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
11136
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
11137
|
+
]);
|
|
11138
|
+
return [
|
|
11139
|
+
{
|
|
11140
|
+
name: "jsse:yaml:setup",
|
|
11141
|
+
plugins: {
|
|
11142
|
+
yaml: pluginYaml
|
|
11143
|
+
}
|
|
11144
|
+
},
|
|
11145
|
+
{
|
|
11146
|
+
files,
|
|
11147
|
+
languageOptions: {
|
|
11148
|
+
parser: parserYaml
|
|
11149
|
+
},
|
|
11150
|
+
name: "antfu:yaml:rules",
|
|
11151
|
+
rules: {
|
|
11152
|
+
"style/spaced-comment": "off",
|
|
11153
|
+
"yaml/block-mapping": "error",
|
|
11154
|
+
"yaml/block-sequence": "error",
|
|
11155
|
+
"yaml/no-empty-key": "error",
|
|
11156
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
11157
|
+
"yaml/no-irregular-whitespace": "error",
|
|
11158
|
+
"yaml/plain-scalar": "error",
|
|
11159
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
11160
|
+
...stylistic2 ? {
|
|
11161
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
11162
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
11163
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
11164
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
11165
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
11166
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
11167
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
11168
|
+
"yaml/key-spacing": "error",
|
|
11169
|
+
"yaml/no-tab-indent": "error",
|
|
11170
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
|
|
11171
|
+
"yaml/spaced-comment": "error"
|
|
11172
|
+
} : {},
|
|
11173
|
+
...overrides
|
|
11174
|
+
}
|
|
11175
|
+
}
|
|
11176
|
+
];
|
|
11177
|
+
};
|
|
11085
11178
|
|
|
11086
11179
|
// src/slow.ts
|
|
11087
11180
|
var slowRules = [
|
|
@@ -11111,6 +11204,7 @@ function defaultOptions2() {
|
|
|
11111
11204
|
gitignore: true,
|
|
11112
11205
|
isInEditor: isInEditor(),
|
|
11113
11206
|
jsonc: true,
|
|
11207
|
+
markdown: false,
|
|
11114
11208
|
off: [],
|
|
11115
11209
|
overrides: {},
|
|
11116
11210
|
prettier: true,
|
|
@@ -11143,7 +11237,7 @@ function normalizeOptions(options = {}) {
|
|
|
11143
11237
|
stylistic: stylisticOptions
|
|
11144
11238
|
};
|
|
11145
11239
|
}
|
|
11146
|
-
function jsse(options = {}, ...userConfigs) {
|
|
11240
|
+
async function jsse(options = {}, ...userConfigs) {
|
|
11147
11241
|
const normalizedOptions = normalizeOptions(options);
|
|
11148
11242
|
const {
|
|
11149
11243
|
componentExts,
|
|
@@ -11177,35 +11271,41 @@ function jsse(options = {}, ...userConfigs) {
|
|
|
11177
11271
|
reportUnusedDisableDirectives
|
|
11178
11272
|
}),
|
|
11179
11273
|
comments(),
|
|
11180
|
-
|
|
11181
|
-
jsdoc(
|
|
11182
|
-
stylistic: stylisticOptions
|
|
11183
|
-
}),
|
|
11274
|
+
n(),
|
|
11275
|
+
jsdoc(),
|
|
11184
11276
|
imports({
|
|
11185
11277
|
stylistic: stylisticOptions
|
|
11186
11278
|
}),
|
|
11187
11279
|
unicorn(),
|
|
11280
|
+
antfu(),
|
|
11188
11281
|
perfectionist()
|
|
11189
11282
|
);
|
|
11190
11283
|
if (enableTypeScript) {
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11284
|
+
const tscfg = await typescript({
|
|
11285
|
+
...typeof enableTypeScript === "boolean" ? {} : enableTypeScript,
|
|
11286
|
+
componentExts,
|
|
11287
|
+
overrides: overrides.typescript,
|
|
11288
|
+
prefix: {
|
|
11289
|
+
from: "@typescript-eslint",
|
|
11290
|
+
to: tsPrefix ?? "@typescript-eslint"
|
|
11291
|
+
},
|
|
11292
|
+
react: enableReact,
|
|
11293
|
+
typeAware
|
|
11294
|
+
});
|
|
11295
|
+
configs.push(tscfg);
|
|
11296
|
+
}
|
|
11297
|
+
if (normalizedOptions.markdown) {
|
|
11298
|
+
configs.push(markdown());
|
|
11299
|
+
}
|
|
11300
|
+
if (normalizedOptions.yaml) {
|
|
11301
|
+
const ymlConfig = await yml();
|
|
11302
|
+
configs.push(ymlConfig);
|
|
11204
11303
|
}
|
|
11205
11304
|
if (normalizedOptions.react) {
|
|
11206
11305
|
configs.push(
|
|
11207
11306
|
react({
|
|
11208
|
-
|
|
11307
|
+
// use react refresh if not explicitly disabled w/ 'false'
|
|
11308
|
+
reactRefresh: normalizedOptions.reactRefresh !== false
|
|
11209
11309
|
})
|
|
11210
11310
|
);
|
|
11211
11311
|
}
|
|
@@ -11217,7 +11317,7 @@ function jsse(options = {}, ...userConfigs) {
|
|
|
11217
11317
|
}
|
|
11218
11318
|
if (normalizedOptions.test) {
|
|
11219
11319
|
configs.push(
|
|
11220
|
-
test({
|
|
11320
|
+
await test({
|
|
11221
11321
|
isInEditor: isInEditor2,
|
|
11222
11322
|
overrides: overrides.test
|
|
11223
11323
|
})
|
|
@@ -11255,7 +11355,15 @@ function jsse(options = {}, ...userConfigs) {
|
|
|
11255
11355
|
}))
|
|
11256
11356
|
);
|
|
11257
11357
|
}
|
|
11258
|
-
|
|
11358
|
+
const combinedConfigs = await combineAsync(...configs, ...userConfigs);
|
|
11359
|
+
if (normalizedOptions.preReturn) {
|
|
11360
|
+
const preReturned = normalizedOptions.preReturn(combinedConfigs);
|
|
11361
|
+
if (preReturned instanceof Promise) {
|
|
11362
|
+
return await preReturned;
|
|
11363
|
+
}
|
|
11364
|
+
return preReturned;
|
|
11365
|
+
}
|
|
11366
|
+
return combinedConfigs;
|
|
11259
11367
|
}
|
|
11260
11368
|
|
|
11261
11369
|
// src/presets.ts
|
|
@@ -11296,11 +11404,13 @@ export {
|
|
|
11296
11404
|
GLOB_TSX,
|
|
11297
11405
|
GLOB_YAML,
|
|
11298
11406
|
combine,
|
|
11407
|
+
combineAsync,
|
|
11299
11408
|
comments,
|
|
11300
11409
|
jsse as default,
|
|
11301
11410
|
eslintConfigPrettierRules,
|
|
11302
11411
|
ignores,
|
|
11303
11412
|
imports,
|
|
11413
|
+
interopDefault,
|
|
11304
11414
|
isCI,
|
|
11305
11415
|
isInEditor,
|
|
11306
11416
|
javascript,
|
|
@@ -11309,28 +11419,29 @@ export {
|
|
|
11309
11419
|
jsse,
|
|
11310
11420
|
jsseReact,
|
|
11311
11421
|
jssestd,
|
|
11312
|
-
|
|
11313
|
-
|
|
11422
|
+
n,
|
|
11423
|
+
default17 as parserJsonc,
|
|
11314
11424
|
parserTs,
|
|
11315
11425
|
perfectionist,
|
|
11316
|
-
default4 as
|
|
11426
|
+
default4 as pluginAntfu,
|
|
11427
|
+
default5 as pluginEslintComments,
|
|
11317
11428
|
pluginImport,
|
|
11318
|
-
|
|
11429
|
+
default6 as pluginJsdoc,
|
|
11319
11430
|
pluginJsonc,
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11431
|
+
default7 as pluginMarkdown,
|
|
11432
|
+
default8 as pluginN,
|
|
11433
|
+
default9 as pluginNoOnlyTests,
|
|
11434
|
+
default10 as pluginPerfectionist,
|
|
11435
|
+
default11 as pluginReact,
|
|
11436
|
+
default12 as pluginReactHooks,
|
|
11326
11437
|
pluginReactRefresh,
|
|
11327
11438
|
pluginSortKeys,
|
|
11328
11439
|
default2 as pluginStylistic,
|
|
11329
|
-
|
|
11440
|
+
default13 as pluginTailwind,
|
|
11330
11441
|
default3 as pluginTs,
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11442
|
+
default14 as pluginUnicorn,
|
|
11443
|
+
default15 as pluginUnusedImports,
|
|
11444
|
+
default16 as pluginVitest,
|
|
11334
11445
|
prettier,
|
|
11335
11446
|
react,
|
|
11336
11447
|
reactHooks,
|