@d3lm/lint-preset 1.2.0 → 1.2.2

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/dist/oxlint.cjs CHANGED
@@ -1,14 +1,1398 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
4
 
5
5
 
6
- var _chunkJQHWID46cjs = require('./chunk-JQHWID46.cjs');
6
+ var _chunk6UJLV5NCcjs = require('./chunk-6UJLV5NC.cjs');
7
+
8
+
9
+ var _chunk56WU3HSDcjs = require('./chunk-56WU3HSD.cjs');
10
+
11
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/resolve.js
12
+ var _assert = require('assert'); var _assert2 = _interopRequireDefault(_assert);
13
+ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
14
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
15
+ var _url = require('url');
16
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
17
+ var _module = require('module');
18
+
19
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/get-format.js
20
+
21
+
22
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/package-json-reader.js
23
+
24
+
25
+
26
+
27
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/errors.js
28
+ var _v8 = require('v8'); var _v82 = _interopRequireDefault(_v8);
29
+
30
+ var _util = require('util');
31
+ var own = {}.hasOwnProperty;
32
+ var classRegExp = /^([A-Z][a-z\d]*)+$/;
33
+ var kTypes = /* @__PURE__ */ new Set([
34
+ "string",
35
+ "function",
36
+ "number",
37
+ "object",
38
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
39
+ "Function",
40
+ "Object",
41
+ "boolean",
42
+ "bigint",
43
+ "symbol"
44
+ ]);
45
+ var codes = {};
46
+ function formatList(array, type = "and") {
47
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array[array.length - 1]}`;
48
+ }
49
+ var messages = /* @__PURE__ */ new Map();
50
+ var nodeInternalPrefix = "__node_internal_";
51
+ var userStackTraceLimit;
52
+ codes.ERR_INVALID_ARG_TYPE = createError(
53
+ "ERR_INVALID_ARG_TYPE",
54
+ /**
55
+ * @param {string} name
56
+ * @param {Array<string> | string} expected
57
+ * @param {unknown} actual
58
+ */
59
+ (name, expected, actual) => {
60
+ _assert2.default.ok(typeof name === "string", "'name' must be a string");
61
+ if (!Array.isArray(expected)) {
62
+ expected = [expected];
63
+ }
64
+ let message = "The ";
65
+ if (name.endsWith(" argument")) {
66
+ message += `${name} `;
67
+ } else {
68
+ const type = name.includes(".") ? "property" : "argument";
69
+ message += `"${name}" ${type} `;
70
+ }
71
+ message += "must be ";
72
+ const types = [];
73
+ const instances = [];
74
+ const other = [];
75
+ for (const value of expected) {
76
+ _assert2.default.ok(
77
+ typeof value === "string",
78
+ "All expected entries have to be of type string"
79
+ );
80
+ if (kTypes.has(value)) {
81
+ types.push(value.toLowerCase());
82
+ } else if (classRegExp.exec(value) === null) {
83
+ _assert2.default.ok(
84
+ value !== "object",
85
+ 'The value "object" should be written as "Object"'
86
+ );
87
+ other.push(value);
88
+ } else {
89
+ instances.push(value);
90
+ }
91
+ }
92
+ if (instances.length > 0) {
93
+ const pos = types.indexOf("object");
94
+ if (pos !== -1) {
95
+ types.slice(pos, 1);
96
+ instances.push("Object");
97
+ }
98
+ }
99
+ if (types.length > 0) {
100
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
101
+ types,
102
+ "or"
103
+ )}`;
104
+ if (instances.length > 0 || other.length > 0) message += " or ";
105
+ }
106
+ if (instances.length > 0) {
107
+ message += `an instance of ${formatList(instances, "or")}`;
108
+ if (other.length > 0) message += " or ";
109
+ }
110
+ if (other.length > 0) {
111
+ if (other.length > 1) {
112
+ message += `one of ${formatList(other, "or")}`;
113
+ } else {
114
+ if (other[0].toLowerCase() !== other[0]) message += "an ";
115
+ message += `${other[0]}`;
116
+ }
117
+ }
118
+ message += `. Received ${determineSpecificType(actual)}`;
119
+ return message;
120
+ },
121
+ TypeError
122
+ );
123
+ codes.ERR_INVALID_MODULE_SPECIFIER = createError(
124
+ "ERR_INVALID_MODULE_SPECIFIER",
125
+ /**
126
+ * @param {string} request
127
+ * @param {string} reason
128
+ * @param {string} [base]
129
+ */
130
+ (request, reason, base = void 0) => {
131
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
132
+ },
133
+ TypeError
134
+ );
135
+ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
136
+ "ERR_INVALID_PACKAGE_CONFIG",
137
+ /**
138
+ * @param {string} path
139
+ * @param {string} [base]
140
+ * @param {string} [message]
141
+ */
142
+ (path3, base, message) => {
143
+ return `Invalid package config ${path3}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
144
+ },
145
+ Error
146
+ );
147
+ codes.ERR_INVALID_PACKAGE_TARGET = createError(
148
+ "ERR_INVALID_PACKAGE_TARGET",
149
+ /**
150
+ * @param {string} packagePath
151
+ * @param {string} key
152
+ * @param {unknown} target
153
+ * @param {boolean} [isImport=false]
154
+ * @param {string} [base]
155
+ */
156
+ (packagePath, key, target, isImport = false, base = void 0) => {
157
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
158
+ if (key === ".") {
159
+ _assert2.default.ok(isImport === false);
160
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
161
+ }
162
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
163
+ target
164
+ )} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
165
+ },
166
+ Error
167
+ );
168
+ codes.ERR_MODULE_NOT_FOUND = createError(
169
+ "ERR_MODULE_NOT_FOUND",
170
+ /**
171
+ * @param {string} path
172
+ * @param {string} base
173
+ * @param {boolean} [exactUrl]
174
+ */
175
+ (path3, base, exactUrl = false) => {
176
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path3}' imported from ${base}`;
177
+ },
178
+ Error
179
+ );
180
+ codes.ERR_NETWORK_IMPORT_DISALLOWED = createError(
181
+ "ERR_NETWORK_IMPORT_DISALLOWED",
182
+ "import of '%s' by %s is not supported: %s",
183
+ Error
184
+ );
185
+ codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
186
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
187
+ /**
188
+ * @param {string} specifier
189
+ * @param {string} packagePath
190
+ * @param {string} base
191
+ */
192
+ (specifier, packagePath, base) => {
193
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
194
+ },
195
+ TypeError
196
+ );
197
+ codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
198
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
199
+ /**
200
+ * @param {string} packagePath
201
+ * @param {string} subpath
202
+ * @param {string} [base]
203
+ */
204
+ (packagePath, subpath, base = void 0) => {
205
+ if (subpath === ".")
206
+ return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
207
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
208
+ },
209
+ Error
210
+ );
211
+ codes.ERR_UNSUPPORTED_DIR_IMPORT = createError(
212
+ "ERR_UNSUPPORTED_DIR_IMPORT",
213
+ "Directory import '%s' is not supported resolving ES modules imported from %s",
214
+ Error
215
+ );
216
+ codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
217
+ "ERR_UNSUPPORTED_RESOLVE_REQUEST",
218
+ 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
219
+ TypeError
220
+ );
221
+ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
222
+ "ERR_UNKNOWN_FILE_EXTENSION",
223
+ /**
224
+ * @param {string} extension
225
+ * @param {string} path
226
+ */
227
+ (extension, path3) => {
228
+ return `Unknown file extension "${extension}" for ${path3}`;
229
+ },
230
+ TypeError
231
+ );
232
+ codes.ERR_INVALID_ARG_VALUE = createError(
233
+ "ERR_INVALID_ARG_VALUE",
234
+ /**
235
+ * @param {string} name
236
+ * @param {unknown} value
237
+ * @param {string} [reason='is invalid']
238
+ */
239
+ (name, value, reason = "is invalid") => {
240
+ let inspected = _util.inspect.call(void 0, value);
241
+ if (inspected.length > 128) {
242
+ inspected = `${inspected.slice(0, 128)}...`;
243
+ }
244
+ const type = name.includes(".") ? "property" : "argument";
245
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
246
+ },
247
+ TypeError
248
+ // Note: extra classes have been shaken out.
249
+ // , RangeError
250
+ );
251
+ function createError(sym, value, constructor) {
252
+ messages.set(sym, value);
253
+ return makeNodeErrorWithCode(constructor, sym);
254
+ }
255
+ function makeNodeErrorWithCode(Base, key) {
256
+ return NodeError;
257
+ function NodeError(...parameters) {
258
+ const limit = Error.stackTraceLimit;
259
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
260
+ const error = new Base();
261
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
262
+ const message = getMessage(key, parameters, error);
263
+ Object.defineProperties(error, {
264
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
265
+ // probably.
266
+ message: {
267
+ value: message,
268
+ enumerable: false,
269
+ writable: true,
270
+ configurable: true
271
+ },
272
+ toString: {
273
+ /** @this {Error} */
274
+ value() {
275
+ return `${this.name} [${key}]: ${this.message}`;
276
+ },
277
+ enumerable: false,
278
+ writable: true,
279
+ configurable: true
280
+ }
281
+ });
282
+ captureLargerStackTrace(error);
283
+ error.code = key;
284
+ return error;
285
+ }
286
+ }
287
+ function isErrorStackTraceLimitWritable() {
288
+ try {
289
+ if (_v82.default.startupSnapshot.isBuildingSnapshot()) {
290
+ return false;
291
+ }
292
+ } catch (e) {
293
+ }
294
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
295
+ if (desc === void 0) {
296
+ return Object.isExtensible(Error);
297
+ }
298
+ return own.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
299
+ }
300
+ function hideStackFrames(wrappedFunction) {
301
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
302
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
303
+ return wrappedFunction;
304
+ }
305
+ var captureLargerStackTrace = hideStackFrames(
306
+ /**
307
+ * @param {Error} error
308
+ * @returns {Error}
309
+ */
310
+ // @ts-expect-error: fine
311
+ function(error) {
312
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
313
+ if (stackTraceLimitIsWritable) {
314
+ userStackTraceLimit = Error.stackTraceLimit;
315
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
316
+ }
317
+ Error.captureStackTrace(error);
318
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
319
+ return error;
320
+ }
321
+ );
322
+ function getMessage(key, parameters, self) {
323
+ const message = messages.get(key);
324
+ _assert2.default.ok(message !== void 0, "expected `message` to be found");
325
+ if (typeof message === "function") {
326
+ _assert2.default.ok(
327
+ message.length <= parameters.length,
328
+ // Default options do not count.
329
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
330
+ );
331
+ return Reflect.apply(message, self, parameters);
332
+ }
333
+ const regex = /%[dfijoOs]/g;
334
+ let expectedLength = 0;
335
+ while (regex.exec(message) !== null) expectedLength++;
336
+ _assert2.default.ok(
337
+ expectedLength === parameters.length,
338
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
339
+ );
340
+ if (parameters.length === 0) return message;
341
+ parameters.unshift(message);
342
+ return Reflect.apply(_util.format, null, parameters);
343
+ }
344
+ function determineSpecificType(value) {
345
+ if (value === null || value === void 0) {
346
+ return String(value);
347
+ }
348
+ if (typeof value === "function" && value.name) {
349
+ return `function ${value.name}`;
350
+ }
351
+ if (typeof value === "object") {
352
+ if (value.constructor && value.constructor.name) {
353
+ return `an instance of ${value.constructor.name}`;
354
+ }
355
+ return `${_util.inspect.call(void 0, value, { depth: -1 })}`;
356
+ }
357
+ let inspected = _util.inspect.call(void 0, value, { colors: false });
358
+ if (inspected.length > 28) {
359
+ inspected = `${inspected.slice(0, 25)}...`;
360
+ }
361
+ return `type ${typeof value} (${inspected})`;
362
+ }
363
+
364
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/package-json-reader.js
365
+ var hasOwnProperty = {}.hasOwnProperty;
366
+ var { ERR_INVALID_PACKAGE_CONFIG } = codes;
367
+ var cache = /* @__PURE__ */ new Map();
368
+ function read(jsonPath, { base, specifier }) {
369
+ const existing = cache.get(jsonPath);
370
+ if (existing) {
371
+ return existing;
372
+ }
373
+ let string;
374
+ try {
375
+ string = _fs2.default.readFileSync(_path2.default.toNamespacedPath(jsonPath), "utf8");
376
+ } catch (error) {
377
+ const exception = (
378
+ /** @type {ErrnoException} */
379
+ error
380
+ );
381
+ if (exception.code !== "ENOENT") {
382
+ throw exception;
383
+ }
384
+ }
385
+ const result = {
386
+ exists: false,
387
+ pjsonPath: jsonPath,
388
+ main: void 0,
389
+ name: void 0,
390
+ type: "none",
391
+ // Ignore unknown types for forwards compatibility
392
+ exports: void 0,
393
+ imports: void 0
394
+ };
395
+ if (string !== void 0) {
396
+ let parsed;
397
+ try {
398
+ parsed = JSON.parse(string);
399
+ } catch (error_) {
400
+ const cause = (
401
+ /** @type {ErrnoException} */
402
+ error_
403
+ );
404
+ const error = new ERR_INVALID_PACKAGE_CONFIG(
405
+ jsonPath,
406
+ (base ? `"${specifier}" from ` : "") + _url.fileURLToPath.call(void 0, base || specifier),
407
+ cause.message
408
+ );
409
+ error.cause = cause;
410
+ throw error;
411
+ }
412
+ result.exists = true;
413
+ if (hasOwnProperty.call(parsed, "name") && typeof parsed.name === "string") {
414
+ result.name = parsed.name;
415
+ }
416
+ if (hasOwnProperty.call(parsed, "main") && typeof parsed.main === "string") {
417
+ result.main = parsed.main;
418
+ }
419
+ if (hasOwnProperty.call(parsed, "exports")) {
420
+ result.exports = parsed.exports;
421
+ }
422
+ if (hasOwnProperty.call(parsed, "imports")) {
423
+ result.imports = parsed.imports;
424
+ }
425
+ if (hasOwnProperty.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) {
426
+ result.type = parsed.type;
427
+ }
428
+ }
429
+ cache.set(jsonPath, result);
430
+ return result;
431
+ }
432
+ function getPackageScopeConfig(resolved) {
433
+ let packageJSONUrl = new URL("package.json", resolved);
434
+ while (true) {
435
+ const packageJSONPath2 = packageJSONUrl.pathname;
436
+ if (packageJSONPath2.endsWith("node_modules/package.json")) {
437
+ break;
438
+ }
439
+ const packageConfig = read(_url.fileURLToPath.call(void 0, packageJSONUrl), {
440
+ specifier: resolved
441
+ });
442
+ if (packageConfig.exists) {
443
+ return packageConfig;
444
+ }
445
+ const lastPackageJSONUrl = packageJSONUrl;
446
+ packageJSONUrl = new URL("../package.json", packageJSONUrl);
447
+ if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {
448
+ break;
449
+ }
450
+ }
451
+ const packageJSONPath = _url.fileURLToPath.call(void 0, packageJSONUrl);
452
+ return {
453
+ pjsonPath: packageJSONPath,
454
+ exists: false,
455
+ type: "none"
456
+ };
457
+ }
458
+ function getPackageType(url) {
459
+ return getPackageScopeConfig(url).type;
460
+ }
461
+
462
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/get-format.js
463
+ var { ERR_UNKNOWN_FILE_EXTENSION } = codes;
464
+ var hasOwnProperty2 = {}.hasOwnProperty;
465
+ var extensionFormatMap = {
466
+ // @ts-expect-error: hush.
467
+ __proto__: null,
468
+ ".cjs": "commonjs",
469
+ ".js": "module",
470
+ ".json": "json",
471
+ ".mjs": "module"
472
+ };
473
+ function mimeToFormat(mime) {
474
+ if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime))
475
+ return "module";
476
+ if (mime === "application/json") return "json";
477
+ return null;
478
+ }
479
+ var protocolHandlers = {
480
+ // @ts-expect-error: hush.
481
+ __proto__: null,
482
+ "data:": getDataProtocolModuleFormat,
483
+ "file:": getFileProtocolModuleFormat,
484
+ "http:": getHttpProtocolModuleFormat,
485
+ "https:": getHttpProtocolModuleFormat,
486
+ "node:"() {
487
+ return "builtin";
488
+ }
489
+ };
490
+ function getDataProtocolModuleFormat(parsed) {
491
+ const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(
492
+ parsed.pathname
493
+ ) || [null, null, null];
494
+ return mimeToFormat(mime);
495
+ }
496
+ function extname(url) {
497
+ const pathname = url.pathname;
498
+ let index = pathname.length;
499
+ while (index--) {
500
+ const code = pathname.codePointAt(index);
501
+ if (code === 47) {
502
+ return "";
503
+ }
504
+ if (code === 46) {
505
+ return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
506
+ }
507
+ }
508
+ return "";
509
+ }
510
+ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
511
+ const value = extname(url);
512
+ if (value === ".js") {
513
+ const packageType = getPackageType(url);
514
+ if (packageType !== "none") {
515
+ return packageType;
516
+ }
517
+ return "commonjs";
518
+ }
519
+ if (value === "") {
520
+ const packageType = getPackageType(url);
521
+ if (packageType === "none" || packageType === "commonjs") {
522
+ return "commonjs";
523
+ }
524
+ return "module";
525
+ }
526
+ const format2 = extensionFormatMap[value];
527
+ if (format2) return format2;
528
+ if (ignoreErrors) {
529
+ return void 0;
530
+ }
531
+ const filepath = _url.fileURLToPath.call(void 0, url);
532
+ throw new ERR_UNKNOWN_FILE_EXTENSION(value, filepath);
533
+ }
534
+ function getHttpProtocolModuleFormat() {
535
+ }
536
+ function defaultGetFormatWithoutErrors(url, context) {
537
+ const protocol = url.protocol;
538
+ if (!hasOwnProperty2.call(protocolHandlers, protocol)) {
539
+ return null;
540
+ }
541
+ return protocolHandlers[protocol](url, context, true) || null;
542
+ }
543
+
544
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/utils.js
545
+ var { ERR_INVALID_ARG_VALUE } = codes;
546
+ var DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
547
+ var DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);
548
+ function getDefaultConditions() {
549
+ return DEFAULT_CONDITIONS;
550
+ }
551
+ function getDefaultConditionsSet() {
552
+ return DEFAULT_CONDITIONS_SET;
553
+ }
554
+ function getConditionsSet(conditions) {
555
+ if (conditions !== void 0 && conditions !== getDefaultConditions()) {
556
+ if (!Array.isArray(conditions)) {
557
+ throw new ERR_INVALID_ARG_VALUE(
558
+ "conditions",
559
+ conditions,
560
+ "expected an array"
561
+ );
562
+ }
563
+ return new Set(conditions);
564
+ }
565
+ return getDefaultConditionsSet();
566
+ }
567
+
568
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/resolve.js
569
+ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
570
+ var {
571
+ ERR_NETWORK_IMPORT_DISALLOWED,
572
+ ERR_INVALID_MODULE_SPECIFIER,
573
+ ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG2,
574
+ ERR_INVALID_PACKAGE_TARGET,
575
+ ERR_MODULE_NOT_FOUND,
576
+ ERR_PACKAGE_IMPORT_NOT_DEFINED,
577
+ ERR_PACKAGE_PATH_NOT_EXPORTED,
578
+ ERR_UNSUPPORTED_DIR_IMPORT,
579
+ ERR_UNSUPPORTED_RESOLVE_REQUEST
580
+ } = codes;
581
+ var own2 = {}.hasOwnProperty;
582
+ 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;
583
+ var deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%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;
584
+ var invalidPackageNameRegEx = /^\.|%|\\/;
585
+ var patternRegEx = /\*/g;
586
+ var encodedSeparatorRegEx = /%2f|%5c/i;
587
+ var emittedPackageWarnings = /* @__PURE__ */ new Set();
588
+ var doubleSlashRegEx = /[/\\]{2}/;
589
+ function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {
590
+ if (_process2.default.noDeprecation) {
591
+ return;
592
+ }
593
+ const pjsonPath = _url.fileURLToPath.call(void 0, packageJsonUrl);
594
+ const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
595
+ _process2.default.emitWarning(
596
+ `Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${_url.fileURLToPath.call(void 0, base)}` : ""}.`,
597
+ "DeprecationWarning",
598
+ "DEP0166"
599
+ );
600
+ }
601
+ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
602
+ if (_process2.default.noDeprecation) {
603
+ return;
604
+ }
605
+ const format2 = defaultGetFormatWithoutErrors(url, { parentURL: base.href });
606
+ if (format2 !== "module") return;
607
+ const urlPath = _url.fileURLToPath.call(void 0, url.href);
608
+ const packagePath = _url.fileURLToPath.call(void 0, new URL(".", packageJsonUrl));
609
+ const basePath = _url.fileURLToPath.call(void 0, base);
610
+ if (!main) {
611
+ _process2.default.emitWarning(
612
+ `No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(
613
+ packagePath.length
614
+ )}", imported from ${basePath}.
615
+ Default "index" lookups for the main are deprecated for ES modules.`,
616
+ "DeprecationWarning",
617
+ "DEP0151"
618
+ );
619
+ } else if (_path2.default.resolve(packagePath, main) !== urlPath) {
620
+ _process2.default.emitWarning(
621
+ `Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
622
+ packagePath.length
623
+ )}", imported from ${basePath}.
624
+ Automatic extension resolution of the "main" field is deprecated for ES modules.`,
625
+ "DeprecationWarning",
626
+ "DEP0151"
627
+ );
628
+ }
629
+ }
630
+ function tryStatSync(path3) {
631
+ try {
632
+ return _fs.statSync.call(void 0, path3);
633
+ } catch (e2) {
634
+ }
635
+ }
636
+ function fileExists(url) {
637
+ const stats = _fs.statSync.call(void 0, url, { throwIfNoEntry: false });
638
+ const isFile = stats ? stats.isFile() : void 0;
639
+ return isFile === null || isFile === void 0 ? false : isFile;
640
+ }
641
+ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
642
+ let guess;
643
+ if (packageConfig.main !== void 0) {
644
+ guess = new URL(packageConfig.main, packageJsonUrl);
645
+ if (fileExists(guess)) return guess;
646
+ const tries2 = [
647
+ `./${packageConfig.main}.js`,
648
+ `./${packageConfig.main}.json`,
649
+ `./${packageConfig.main}.node`,
650
+ `./${packageConfig.main}/index.js`,
651
+ `./${packageConfig.main}/index.json`,
652
+ `./${packageConfig.main}/index.node`
653
+ ];
654
+ let i2 = -1;
655
+ while (++i2 < tries2.length) {
656
+ guess = new URL(tries2[i2], packageJsonUrl);
657
+ if (fileExists(guess)) break;
658
+ guess = void 0;
659
+ }
660
+ if (guess) {
661
+ emitLegacyIndexDeprecation(
662
+ guess,
663
+ packageJsonUrl,
664
+ base,
665
+ packageConfig.main
666
+ );
667
+ return guess;
668
+ }
669
+ }
670
+ const tries = ["./index.js", "./index.json", "./index.node"];
671
+ let i = -1;
672
+ while (++i < tries.length) {
673
+ guess = new URL(tries[i], packageJsonUrl);
674
+ if (fileExists(guess)) break;
675
+ guess = void 0;
676
+ }
677
+ if (guess) {
678
+ emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
679
+ return guess;
680
+ }
681
+ throw new ERR_MODULE_NOT_FOUND(
682
+ _url.fileURLToPath.call(void 0, new URL(".", packageJsonUrl)),
683
+ _url.fileURLToPath.call(void 0, base)
684
+ );
685
+ }
686
+ function finalizeResolution(resolved, base, preserveSymlinks) {
687
+ if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) {
688
+ throw new ERR_INVALID_MODULE_SPECIFIER(
689
+ resolved.pathname,
690
+ 'must not include encoded "/" or "\\" characters',
691
+ _url.fileURLToPath.call(void 0, base)
692
+ );
693
+ }
694
+ let filePath;
695
+ try {
696
+ filePath = _url.fileURLToPath.call(void 0, resolved);
697
+ } catch (error) {
698
+ const cause = (
699
+ /** @type {ErrnoException} */
700
+ error
701
+ );
702
+ Object.defineProperty(cause, "input", { value: String(resolved) });
703
+ Object.defineProperty(cause, "module", { value: String(base) });
704
+ throw cause;
705
+ }
706
+ const stats = tryStatSync(
707
+ filePath.endsWith("/") ? filePath.slice(-1) : filePath
708
+ );
709
+ if (stats && stats.isDirectory()) {
710
+ const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, _url.fileURLToPath.call(void 0, base));
711
+ error.url = String(resolved);
712
+ throw error;
713
+ }
714
+ if (!stats || !stats.isFile()) {
715
+ const error = new ERR_MODULE_NOT_FOUND(
716
+ filePath || resolved.pathname,
717
+ base && _url.fileURLToPath.call(void 0, base),
718
+ true
719
+ );
720
+ error.url = String(resolved);
721
+ throw error;
722
+ }
723
+ if (!preserveSymlinks) {
724
+ const real = _fs.realpathSync.call(void 0, filePath);
725
+ const { search, hash } = resolved;
726
+ resolved = _url.pathToFileURL.call(void 0, real + (filePath.endsWith(_path2.default.sep) ? "/" : ""));
727
+ resolved.search = search;
728
+ resolved.hash = hash;
729
+ }
730
+ return resolved;
731
+ }
732
+ function importNotDefined(specifier, packageJsonUrl, base) {
733
+ return new ERR_PACKAGE_IMPORT_NOT_DEFINED(
734
+ specifier,
735
+ packageJsonUrl && _url.fileURLToPath.call(void 0, new URL(".", packageJsonUrl)),
736
+ _url.fileURLToPath.call(void 0, base)
737
+ );
738
+ }
739
+ function exportsNotFound(subpath, packageJsonUrl, base) {
740
+ return new ERR_PACKAGE_PATH_NOT_EXPORTED(
741
+ _url.fileURLToPath.call(void 0, new URL(".", packageJsonUrl)),
742
+ subpath,
743
+ base && _url.fileURLToPath.call(void 0, base)
744
+ );
745
+ }
746
+ function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
747
+ const reason = `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${_url.fileURLToPath.call(void 0, packageJsonUrl)}`;
748
+ throw new ERR_INVALID_MODULE_SPECIFIER(
749
+ request,
750
+ reason,
751
+ base && _url.fileURLToPath.call(void 0, base)
752
+ );
753
+ }
754
+ function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
755
+ target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
756
+ return new ERR_INVALID_PACKAGE_TARGET(
757
+ _url.fileURLToPath.call(void 0, new URL(".", packageJsonUrl)),
758
+ subpath,
759
+ target,
760
+ internal,
761
+ base && _url.fileURLToPath.call(void 0, base)
762
+ );
763
+ }
764
+ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) {
765
+ if (subpath !== "" && !pattern && target[target.length - 1] !== "/")
766
+ throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
767
+ if (!target.startsWith("./")) {
768
+ if (internal && !target.startsWith("../") && !target.startsWith("/")) {
769
+ let isURL2 = false;
770
+ try {
771
+ new URL(target);
772
+ isURL2 = true;
773
+ } catch (e3) {
774
+ }
775
+ if (!isURL2) {
776
+ const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(
777
+ patternRegEx,
778
+ target,
779
+ () => subpath
780
+ ) : target + subpath;
781
+ return packageResolve(exportTarget, packageJsonUrl, conditions);
782
+ }
783
+ }
784
+ throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
785
+ }
786
+ if (invalidSegmentRegEx.exec(target.slice(2)) !== null) {
787
+ if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
788
+ if (!isPathMap) {
789
+ const request = pattern ? match.replace("*", () => subpath) : match + subpath;
790
+ const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(
791
+ patternRegEx,
792
+ target,
793
+ () => subpath
794
+ ) : target;
795
+ emitInvalidSegmentDeprecation(
796
+ resolvedTarget,
797
+ request,
798
+ match,
799
+ packageJsonUrl,
800
+ internal,
801
+ base,
802
+ true
803
+ );
804
+ }
805
+ } else {
806
+ throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
807
+ }
808
+ }
809
+ const resolved = new URL(target, packageJsonUrl);
810
+ const resolvedPath = resolved.pathname;
811
+ const packagePath = new URL(".", packageJsonUrl).pathname;
812
+ if (!resolvedPath.startsWith(packagePath))
813
+ throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
814
+ if (subpath === "") return resolved;
815
+ if (invalidSegmentRegEx.exec(subpath) !== null) {
816
+ const request = pattern ? match.replace("*", () => subpath) : match + subpath;
817
+ if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {
818
+ if (!isPathMap) {
819
+ const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(
820
+ patternRegEx,
821
+ target,
822
+ () => subpath
823
+ ) : target;
824
+ emitInvalidSegmentDeprecation(
825
+ resolvedTarget,
826
+ request,
827
+ match,
828
+ packageJsonUrl,
829
+ internal,
830
+ base,
831
+ false
832
+ );
833
+ }
834
+ } else {
835
+ throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
836
+ }
837
+ }
838
+ if (pattern) {
839
+ return new URL(
840
+ RegExpPrototypeSymbolReplace.call(
841
+ patternRegEx,
842
+ resolved.href,
843
+ () => subpath
844
+ )
845
+ );
846
+ }
847
+ return new URL(subpath, resolved);
848
+ }
849
+ function isArrayIndex(key) {
850
+ const keyNumber = Number(key);
851
+ if (`${keyNumber}` !== key) return false;
852
+ return keyNumber >= 0 && keyNumber < 4294967295;
853
+ }
854
+ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) {
855
+ if (typeof target === "string") {
856
+ return resolvePackageTargetString(
857
+ target,
858
+ subpath,
859
+ packageSubpath,
860
+ packageJsonUrl,
861
+ base,
862
+ pattern,
863
+ internal,
864
+ isPathMap,
865
+ conditions
866
+ );
867
+ }
868
+ if (Array.isArray(target)) {
869
+ const targetList = target;
870
+ if (targetList.length === 0) return null;
871
+ let lastException;
872
+ let i = -1;
873
+ while (++i < targetList.length) {
874
+ const targetItem = targetList[i];
875
+ let resolveResult;
876
+ try {
877
+ resolveResult = resolvePackageTarget(
878
+ packageJsonUrl,
879
+ targetItem,
880
+ subpath,
881
+ packageSubpath,
882
+ base,
883
+ pattern,
884
+ internal,
885
+ isPathMap,
886
+ conditions
887
+ );
888
+ } catch (error) {
889
+ const exception = (
890
+ /** @type {ErrnoException} */
891
+ error
892
+ );
893
+ lastException = exception;
894
+ if (exception.code === "ERR_INVALID_PACKAGE_TARGET") continue;
895
+ throw error;
896
+ }
897
+ if (resolveResult === void 0) continue;
898
+ if (resolveResult === null) {
899
+ lastException = null;
900
+ continue;
901
+ }
902
+ return resolveResult;
903
+ }
904
+ if (lastException === void 0 || lastException === null) {
905
+ return null;
906
+ }
907
+ throw lastException;
908
+ }
909
+ if (typeof target === "object" && target !== null) {
910
+ const keys = Object.getOwnPropertyNames(target);
911
+ let i = -1;
912
+ while (++i < keys.length) {
913
+ const key = keys[i];
914
+ if (isArrayIndex(key)) {
915
+ throw new ERR_INVALID_PACKAGE_CONFIG2(
916
+ _url.fileURLToPath.call(void 0, packageJsonUrl),
917
+ base,
918
+ '"exports" cannot contain numeric property keys.'
919
+ );
920
+ }
921
+ }
922
+ i = -1;
923
+ while (++i < keys.length) {
924
+ const key = keys[i];
925
+ if (key === "default" || conditions && conditions.has(key)) {
926
+ const conditionalTarget = (
927
+ /** @type {unknown} */
928
+ target[key]
929
+ );
930
+ const resolveResult = resolvePackageTarget(
931
+ packageJsonUrl,
932
+ conditionalTarget,
933
+ subpath,
934
+ packageSubpath,
935
+ base,
936
+ pattern,
937
+ internal,
938
+ isPathMap,
939
+ conditions
940
+ );
941
+ if (resolveResult === void 0) continue;
942
+ return resolveResult;
943
+ }
944
+ }
945
+ return null;
946
+ }
947
+ if (target === null) {
948
+ return null;
949
+ }
950
+ throw invalidPackageTarget(
951
+ packageSubpath,
952
+ target,
953
+ packageJsonUrl,
954
+ internal,
955
+ base
956
+ );
957
+ }
958
+ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
959
+ if (typeof exports === "string" || Array.isArray(exports)) return true;
960
+ if (typeof exports !== "object" || exports === null) return false;
961
+ const keys = Object.getOwnPropertyNames(exports);
962
+ let isConditionalSugar = false;
963
+ let i = 0;
964
+ let keyIndex = -1;
965
+ while (++keyIndex < keys.length) {
966
+ const key = keys[keyIndex];
967
+ const currentIsConditionalSugar = key === "" || key[0] !== ".";
968
+ if (i++ === 0) {
969
+ isConditionalSugar = currentIsConditionalSugar;
970
+ } else if (isConditionalSugar !== currentIsConditionalSugar) {
971
+ throw new ERR_INVALID_PACKAGE_CONFIG2(
972
+ _url.fileURLToPath.call(void 0, packageJsonUrl),
973
+ base,
974
+ `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`
975
+ );
976
+ }
977
+ }
978
+ return isConditionalSugar;
979
+ }
980
+ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
981
+ if (_process2.default.noDeprecation) {
982
+ return;
983
+ }
984
+ const pjsonPath = _url.fileURLToPath.call(void 0, pjsonUrl);
985
+ if (emittedPackageWarnings.has(pjsonPath + "|" + match)) return;
986
+ emittedPackageWarnings.add(pjsonPath + "|" + match);
987
+ _process2.default.emitWarning(
988
+ `Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${_url.fileURLToPath.call(void 0, base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`,
989
+ "DeprecationWarning",
990
+ "DEP0155"
991
+ );
992
+ }
993
+ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
994
+ let exports = packageConfig.exports;
995
+ if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) {
996
+ exports = { ".": exports };
997
+ }
998
+ if (own2.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
999
+ const target = exports[packageSubpath];
1000
+ const resolveResult = resolvePackageTarget(
1001
+ packageJsonUrl,
1002
+ target,
1003
+ "",
1004
+ packageSubpath,
1005
+ base,
1006
+ false,
1007
+ false,
1008
+ false,
1009
+ conditions
1010
+ );
1011
+ if (resolveResult === null || resolveResult === void 0) {
1012
+ throw exportsNotFound(packageSubpath, packageJsonUrl, base);
1013
+ }
1014
+ return resolveResult;
1015
+ }
1016
+ let bestMatch = "";
1017
+ let bestMatchSubpath = "";
1018
+ const keys = Object.getOwnPropertyNames(exports);
1019
+ let i = -1;
1020
+ while (++i < keys.length) {
1021
+ const key = keys[i];
1022
+ const patternIndex = key.indexOf("*");
1023
+ if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
1024
+ if (packageSubpath.endsWith("/")) {
1025
+ emitTrailingSlashPatternDeprecation(
1026
+ packageSubpath,
1027
+ packageJsonUrl,
1028
+ base
1029
+ );
1030
+ }
1031
+ const patternTrailer = key.slice(patternIndex + 1);
1032
+ if (packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
1033
+ bestMatch = key;
1034
+ bestMatchSubpath = packageSubpath.slice(
1035
+ patternIndex,
1036
+ packageSubpath.length - patternTrailer.length
1037
+ );
1038
+ }
1039
+ }
1040
+ }
1041
+ if (bestMatch) {
1042
+ const target = (
1043
+ /** @type {unknown} */
1044
+ exports[bestMatch]
1045
+ );
1046
+ const resolveResult = resolvePackageTarget(
1047
+ packageJsonUrl,
1048
+ target,
1049
+ bestMatchSubpath,
1050
+ bestMatch,
1051
+ base,
1052
+ true,
1053
+ false,
1054
+ packageSubpath.endsWith("/"),
1055
+ conditions
1056
+ );
1057
+ if (resolveResult === null || resolveResult === void 0) {
1058
+ throw exportsNotFound(packageSubpath, packageJsonUrl, base);
1059
+ }
1060
+ return resolveResult;
1061
+ }
1062
+ throw exportsNotFound(packageSubpath, packageJsonUrl, base);
1063
+ }
1064
+ function patternKeyCompare(a, b) {
1065
+ const aPatternIndex = a.indexOf("*");
1066
+ const bPatternIndex = b.indexOf("*");
1067
+ const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
1068
+ const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
1069
+ if (baseLengthA > baseLengthB) return -1;
1070
+ if (baseLengthB > baseLengthA) return 1;
1071
+ if (aPatternIndex === -1) return 1;
1072
+ if (bPatternIndex === -1) return -1;
1073
+ if (a.length > b.length) return -1;
1074
+ if (b.length > a.length) return 1;
1075
+ return 0;
1076
+ }
1077
+ function packageImportsResolve(name, base, conditions) {
1078
+ if (name === "#" || name.startsWith("#/") || name.endsWith("/")) {
1079
+ const reason = "is not a valid internal imports specifier name";
1080
+ throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, _url.fileURLToPath.call(void 0, base));
1081
+ }
1082
+ let packageJsonUrl;
1083
+ const packageConfig = getPackageScopeConfig(base);
1084
+ if (packageConfig.exists) {
1085
+ packageJsonUrl = _url.pathToFileURL.call(void 0, packageConfig.pjsonPath);
1086
+ const imports = packageConfig.imports;
1087
+ if (imports) {
1088
+ if (own2.call(imports, name) && !name.includes("*")) {
1089
+ const resolveResult = resolvePackageTarget(
1090
+ packageJsonUrl,
1091
+ imports[name],
1092
+ "",
1093
+ name,
1094
+ base,
1095
+ false,
1096
+ true,
1097
+ false,
1098
+ conditions
1099
+ );
1100
+ if (resolveResult !== null && resolveResult !== void 0) {
1101
+ return resolveResult;
1102
+ }
1103
+ } else {
1104
+ let bestMatch = "";
1105
+ let bestMatchSubpath = "";
1106
+ const keys = Object.getOwnPropertyNames(imports);
1107
+ let i = -1;
1108
+ while (++i < keys.length) {
1109
+ const key = keys[i];
1110
+ const patternIndex = key.indexOf("*");
1111
+ if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
1112
+ const patternTrailer = key.slice(patternIndex + 1);
1113
+ if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
1114
+ bestMatch = key;
1115
+ bestMatchSubpath = name.slice(
1116
+ patternIndex,
1117
+ name.length - patternTrailer.length
1118
+ );
1119
+ }
1120
+ }
1121
+ }
1122
+ if (bestMatch) {
1123
+ const target = imports[bestMatch];
1124
+ const resolveResult = resolvePackageTarget(
1125
+ packageJsonUrl,
1126
+ target,
1127
+ bestMatchSubpath,
1128
+ bestMatch,
1129
+ base,
1130
+ true,
1131
+ true,
1132
+ false,
1133
+ conditions
1134
+ );
1135
+ if (resolveResult !== null && resolveResult !== void 0) {
1136
+ return resolveResult;
1137
+ }
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ throw importNotDefined(name, packageJsonUrl, base);
1143
+ }
1144
+ function parsePackageName(specifier, base) {
1145
+ let separatorIndex = specifier.indexOf("/");
1146
+ let validPackageName = true;
1147
+ let isScoped = false;
1148
+ if (specifier[0] === "@") {
1149
+ isScoped = true;
1150
+ if (separatorIndex === -1 || specifier.length === 0) {
1151
+ validPackageName = false;
1152
+ } else {
1153
+ separatorIndex = specifier.indexOf("/", separatorIndex + 1);
1154
+ }
1155
+ }
1156
+ const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
1157
+ if (invalidPackageNameRegEx.exec(packageName) !== null) {
1158
+ validPackageName = false;
1159
+ }
1160
+ if (!validPackageName) {
1161
+ throw new ERR_INVALID_MODULE_SPECIFIER(
1162
+ specifier,
1163
+ "is not a valid package name",
1164
+ _url.fileURLToPath.call(void 0, base)
1165
+ );
1166
+ }
1167
+ const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex));
1168
+ return { packageName, packageSubpath, isScoped };
1169
+ }
1170
+ function packageResolve(specifier, base, conditions) {
1171
+ if (_module.builtinModules.includes(specifier)) {
1172
+ return new URL("node:" + specifier);
1173
+ }
1174
+ const { packageName, packageSubpath, isScoped } = parsePackageName(
1175
+ specifier,
1176
+ base
1177
+ );
1178
+ const packageConfig = getPackageScopeConfig(base);
1179
+ if (packageConfig.exists) {
1180
+ const packageJsonUrl2 = _url.pathToFileURL.call(void 0, packageConfig.pjsonPath);
1181
+ if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) {
1182
+ return packageExportsResolve(
1183
+ packageJsonUrl2,
1184
+ packageSubpath,
1185
+ packageConfig,
1186
+ base,
1187
+ conditions
1188
+ );
1189
+ }
1190
+ }
1191
+ let packageJsonUrl = new URL(
1192
+ "./node_modules/" + packageName + "/package.json",
1193
+ base
1194
+ );
1195
+ let packageJsonPath = _url.fileURLToPath.call(void 0, packageJsonUrl);
1196
+ let lastPath;
1197
+ do {
1198
+ const stat = tryStatSync(packageJsonPath.slice(0, -13));
1199
+ if (!stat || !stat.isDirectory()) {
1200
+ lastPath = packageJsonPath;
1201
+ packageJsonUrl = new URL(
1202
+ (isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json",
1203
+ packageJsonUrl
1204
+ );
1205
+ packageJsonPath = _url.fileURLToPath.call(void 0, packageJsonUrl);
1206
+ continue;
1207
+ }
1208
+ const packageConfig2 = read(packageJsonPath, { base, specifier });
1209
+ if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) {
1210
+ return packageExportsResolve(
1211
+ packageJsonUrl,
1212
+ packageSubpath,
1213
+ packageConfig2,
1214
+ base,
1215
+ conditions
1216
+ );
1217
+ }
1218
+ if (packageSubpath === ".") {
1219
+ return legacyMainResolve(packageJsonUrl, packageConfig2, base);
1220
+ }
1221
+ return new URL(packageSubpath, packageJsonUrl);
1222
+ } while (packageJsonPath.length !== lastPath.length);
1223
+ throw new ERR_MODULE_NOT_FOUND(packageName, _url.fileURLToPath.call(void 0, base), false);
1224
+ }
1225
+ function isRelativeSpecifier(specifier) {
1226
+ if (specifier[0] === ".") {
1227
+ if (specifier.length === 1 || specifier[1] === "/") return true;
1228
+ if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) {
1229
+ return true;
1230
+ }
1231
+ }
1232
+ return false;
1233
+ }
1234
+ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
1235
+ if (specifier === "") return false;
1236
+ if (specifier[0] === "/") return true;
1237
+ return isRelativeSpecifier(specifier);
1238
+ }
1239
+ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
1240
+ if (conditions === void 0) {
1241
+ conditions = getConditionsSet();
1242
+ }
1243
+ const protocol = base.protocol;
1244
+ const isData = protocol === "data:";
1245
+ const isRemote = isData || protocol === "http:" || protocol === "https:";
1246
+ let resolved;
1247
+ if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1248
+ try {
1249
+ resolved = new URL(specifier, base);
1250
+ } catch (error_) {
1251
+ const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
1252
+ error.cause = error_;
1253
+ throw error;
1254
+ }
1255
+ } else if (protocol === "file:" && specifier[0] === "#") {
1256
+ resolved = packageImportsResolve(specifier, base, conditions);
1257
+ } else {
1258
+ try {
1259
+ resolved = new URL(specifier);
1260
+ } catch (error_) {
1261
+ if (isRemote && !_module.builtinModules.includes(specifier)) {
1262
+ const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
1263
+ error.cause = error_;
1264
+ throw error;
1265
+ }
1266
+ resolved = packageResolve(specifier, base, conditions);
1267
+ }
1268
+ }
1269
+ _assert2.default.ok(resolved !== void 0, "expected to be defined");
1270
+ if (resolved.protocol !== "file:") {
1271
+ return resolved;
1272
+ }
1273
+ return finalizeResolution(resolved, base, preserveSymlinks);
1274
+ }
1275
+ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
1276
+ if (parsedParentURL) {
1277
+ const parentProtocol = parsedParentURL.protocol;
1278
+ if (parentProtocol === "http:" || parentProtocol === "https:") {
1279
+ if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1280
+ const parsedProtocol = _optionalChain([parsed, 'optionalAccess', _ => _.protocol]);
1281
+ if (parsedProtocol && parsedProtocol !== "https:" && parsedProtocol !== "http:") {
1282
+ throw new ERR_NETWORK_IMPORT_DISALLOWED(
1283
+ specifier,
1284
+ parsedParentURL,
1285
+ "remote imports cannot import from a local location."
1286
+ );
1287
+ }
1288
+ return { url: _optionalChain([parsed, 'optionalAccess', _2 => _2.href]) || "" };
1289
+ }
1290
+ if (_module.builtinModules.includes(specifier)) {
1291
+ throw new ERR_NETWORK_IMPORT_DISALLOWED(
1292
+ specifier,
1293
+ parsedParentURL,
1294
+ "remote imports cannot import from a local location."
1295
+ );
1296
+ }
1297
+ throw new ERR_NETWORK_IMPORT_DISALLOWED(
1298
+ specifier,
1299
+ parsedParentURL,
1300
+ "only relative and absolute specifiers are supported."
1301
+ );
1302
+ }
1303
+ }
1304
+ }
1305
+ function isURL(self) {
1306
+ return Boolean(
1307
+ self && typeof self === "object" && "href" in self && typeof self.href === "string" && "protocol" in self && typeof self.protocol === "string" && self.href && self.protocol
1308
+ );
1309
+ }
1310
+ function throwIfInvalidParentURL(parentURL) {
1311
+ if (parentURL === void 0) {
1312
+ return;
1313
+ }
1314
+ if (typeof parentURL !== "string" && !isURL(parentURL)) {
1315
+ throw new codes.ERR_INVALID_ARG_TYPE(
1316
+ "parentURL",
1317
+ ["string", "URL"],
1318
+ parentURL
1319
+ );
1320
+ }
1321
+ }
1322
+ function defaultResolve(specifier, context = {}) {
1323
+ const { parentURL } = context;
1324
+ _assert2.default.ok(parentURL !== void 0, "expected `parentURL` to be defined");
1325
+ throwIfInvalidParentURL(parentURL);
1326
+ let parsedParentURL;
1327
+ if (parentURL) {
1328
+ try {
1329
+ parsedParentURL = new URL(parentURL);
1330
+ } catch (e4) {
1331
+ }
1332
+ }
1333
+ let parsed;
1334
+ let protocol;
1335
+ try {
1336
+ parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) ? new URL(specifier, parsedParentURL) : new URL(specifier);
1337
+ protocol = parsed.protocol;
1338
+ if (protocol === "data:") {
1339
+ return { url: parsed.href, format: null };
1340
+ }
1341
+ } catch (e5) {
1342
+ }
1343
+ const maybeReturn = checkIfDisallowedImport(
1344
+ specifier,
1345
+ parsed,
1346
+ parsedParentURL
1347
+ );
1348
+ if (maybeReturn) return maybeReturn;
1349
+ if (protocol === void 0 && parsed) {
1350
+ protocol = parsed.protocol;
1351
+ }
1352
+ if (protocol === "node:") {
1353
+ return { url: specifier };
1354
+ }
1355
+ if (parsed && parsed.protocol === "node:") return { url: specifier };
1356
+ const conditions = getConditionsSet(context.conditions);
1357
+ const url = moduleResolve(specifier, new URL(parentURL), conditions, false);
1358
+ return {
1359
+ // Do NOT cast `url` to a string: that will work even when there are real
1360
+ // problems, silencing them
1361
+ url: url.href,
1362
+ format: defaultGetFormatWithoutErrors(url, { parentURL })
1363
+ };
1364
+ }
1365
+
1366
+ // node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/index.js
1367
+ function resolve(specifier, parent) {
1368
+ if (!parent) {
1369
+ throw new Error(
1370
+ "Please pass `parent`: `import-meta-resolve` cannot ponyfill that"
1371
+ );
1372
+ }
1373
+ try {
1374
+ return defaultResolve(specifier, { parentURL: parent }).url;
1375
+ } catch (error) {
1376
+ const exception = (
1377
+ /** @type {ErrnoException} */
1378
+ error
1379
+ );
1380
+ if ((exception.code === "ERR_UNSUPPORTED_DIR_IMPORT" || exception.code === "ERR_MODULE_NOT_FOUND") && typeof exception.url === "string") {
1381
+ return exception.url;
1382
+ }
1383
+ throw error;
1384
+ }
1385
+ }
7
1386
 
8
1387
  // src/oxlint.ts
1388
+
9
1389
  var _oxlint = require('oxlint');
1390
+ var resolvePlugin = (specifier) => {
1391
+ return _url.fileURLToPath.call(void 0, resolve(specifier, _chunk56WU3HSDcjs.importMetaUrl));
1392
+ };
1393
+ var ownRulesPath = _url.fileURLToPath.call(void 0, new URL("rules.js", _chunk56WU3HSDcjs.importMetaUrl));
10
1394
  var createOxlintConfig = (options) => {
11
- const reactOptions = _chunkJQHWID46cjs.resolveReactRuleOptions.call(void 0, _optionalChain([options, 'optionalAccess', _ => _.react]));
1395
+ const reactOptions = _chunk6UJLV5NCcjs.resolveReactRuleOptions.call(void 0, _optionalChain([options, 'optionalAccess', _3 => _3.react]));
12
1396
  const reactPlugins = [
13
1397
  "eslint",
14
1398
  "typescript",
@@ -18,20 +1402,29 @@ var createOxlintConfig = (options) => {
18
1402
  ...reactOptions.performance ? ["react-perf"] : []
19
1403
  ];
20
1404
  return _oxlint.defineConfig.call(void 0, {
21
- ..._optionalChain([options, 'optionalAccess', _2 => _2.react]) && {
1405
+ ..._optionalChain([options, 'optionalAccess', _4 => _4.react]) && {
22
1406
  plugins: reactPlugins
23
1407
  },
1408
+ /**
1409
+ * Oxlint resolves `jsPlugins` specifiers from the directory of the
1410
+ * consumer's config file, where these packages don't exist when
1411
+ * node_modules is isolated: they are peer deps of this preset, so pnpm
1412
+ * links them only into this package's own node_modules (pnpm 10 dropped
1413
+ * the default `*eslint*`/`*prettier*` public-hoist-pattern that used to
1414
+ * mask this). Resolve them from inside this package — the same way
1415
+ * `src/eslint.ts` imports its plugins — and hand oxlint absolute paths.
1416
+ */
24
1417
  jsPlugins: [
25
- { name: "@d3lm", specifier: "@d3lm/lint-preset/rules" },
26
- { name: "@stylistic", specifier: "@stylistic/eslint-plugin" },
27
- { name: "prettier", specifier: "eslint-plugin-prettier" },
28
- { name: "unicornx", specifier: "eslint-plugin-unicorn" },
29
- { name: "jsdocx", specifier: "eslint-plugin-jsdoc" }
1418
+ { name: "@d3lm", specifier: ownRulesPath },
1419
+ { name: "@stylistic", specifier: resolvePlugin("@stylistic/eslint-plugin") },
1420
+ { name: "prettier", specifier: resolvePlugin("eslint-plugin-prettier") },
1421
+ { name: "unicornx", specifier: resolvePlugin("eslint-plugin-unicorn") },
1422
+ { name: "jsdocx", specifier: resolvePlugin("eslint-plugin-jsdoc") }
30
1423
  ],
31
1424
  options: { typeAware: true },
32
1425
  ignorePatterns: ["dist", "node_modules", "coverage"],
33
1426
  rules: {
34
- ..._chunkJQHWID46cjs.jsRulesOxlint.call(void 0, _optionalChain([options, 'optionalAccess', _3 => _3.jsRulesOxlint])),
1427
+ ..._chunk6UJLV5NCcjs.jsRulesOxlint.call(void 0, _optionalChain([options, 'optionalAccess', _5 => _5.jsRulesOxlint])),
35
1428
  "@d3lm/newline-around-multiline": "error",
36
1429
  "@d3lm/block-scoped-case": "error",
37
1430
  "@d3lm/comment-syntax": "error",
@@ -41,12 +1434,12 @@ var createOxlintConfig = (options) => {
41
1434
  ],
42
1435
  "@d3lm/no-implicit-object-return": "error",
43
1436
  "prettier/prettier": ["error", {}],
44
- ..._optionalChain([options, 'optionalAccess', _4 => _4.react]) && _chunkJQHWID46cjs.reactRulesOxlint.call(void 0, options.react)
1437
+ ..._optionalChain([options, 'optionalAccess', _6 => _6.react]) && _chunk6UJLV5NCcjs.reactRulesOxlint.call(void 0, options.react)
45
1438
  },
46
1439
  overrides: [
47
1440
  {
48
1441
  files: ["**/*.{ts,tsx,mts,cts}"],
49
- rules: _chunkJQHWID46cjs.tsRulesOxlint.call(void 0, _optionalChain([options, 'optionalAccess', _5 => _5.tsRulesOxlint]))
1442
+ rules: _chunk6UJLV5NCcjs.tsRulesOxlint.call(void 0, _optionalChain([options, 'optionalAccess', _7 => _7.tsRulesOxlint]))
50
1443
  }
51
1444
  ]
52
1445
  });