vite 3.2.0-beta.1 → 3.2.0-beta.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.
@@ -1,16 +1,19 @@
1
- import fs$l, { promises as promises$2 } from 'node:fs';
2
- import path$n, { posix as posix$2, isAbsolute as isAbsolute$3, resolve as resolve$6, join as join$2, relative as relative$2, dirname as dirname$2, basename as basename$2, extname as extname$1 } from 'node:path';
3
- import { URL as URL$3, pathToFileURL, URLSearchParams, parse as parse$k } from 'node:url';
1
+ import fs$l, { realpathSync as realpathSync$1, statSync as statSync$1, Stats as Stats$1, promises as promises$2 } from 'node:fs';
2
+ import path$n, { posix as posix$2, isAbsolute as isAbsolute$2, resolve as resolve$7, join as join$2, relative as relative$2, dirname as dirname$2, basename as basename$2, extname as extname$1 } from 'node:path';
3
+ import { fileURLToPath, URL as URL$3, pathToFileURL, URLSearchParams, parse as parse$k } from 'node:url';
4
4
  import { performance } from 'node:perf_hooks';
5
- import { createRequire as createRequire$1, builtinModules } from 'node:module';
5
+ import { builtinModules, createRequire as createRequire$1 } from 'node:module';
6
6
  import require$$0$3 from 'tty';
7
7
  import { transform as transform$2, build as build$3, formatMessages } from 'esbuild';
8
- import require$$0$4, { sep, resolve as resolve$4, posix as posix$1, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, win32 as win32$1, isAbsolute as isAbsolute$2, normalize } from 'path';
8
+ import assert$1 from 'node:assert';
9
+ import process$1 from 'node:process';
10
+ import { format as format$2, inspect, promisify as promisify$4 } from 'node:util';
11
+ import require$$0$4, { sep, resolve as resolve$5, posix as posix$1, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, win32 as win32$1, isAbsolute as isAbsolute$1, normalize } from 'path';
9
12
  import * as require$$0$2 from 'fs';
10
- import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, promises as promises$1, readdirSync } from 'fs';
13
+ import require$$0__default, { existsSync, readFileSync, statSync as statSync$2, promises as promises$1, readdirSync } from 'fs';
11
14
  import require$$0$5 from 'events';
12
- import assert$1 from 'assert';
13
- import require$$0$6, { format as format$2, inspect } from 'util';
15
+ import assert$2 from 'assert';
16
+ import require$$0$6, { format as format$3, inspect as inspect$1 } from 'util';
14
17
  import require$$3$1 from 'net';
15
18
  import require$$0$9, { pathToFileURL as pathToFileURL$1 } from 'url';
16
19
  import require$$1$2 from 'http';
@@ -19,16 +22,14 @@ import require$$1 from 'os';
19
22
  import require$$2 from 'child_process';
20
23
  import os$3 from 'node:os';
21
24
  import { createHash as createHash$2 } from 'node:crypto';
22
- import { promisify as promisify$4 } from 'node:util';
23
25
  import { promises } from 'node:dns';
24
- import resolve$5 from 'resolve';
25
- import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
26
+ import resolve$6 from 'resolve';
27
+ import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
26
28
  import require$$5 from 'crypto';
27
- import require$$0$a from 'buffer';
28
29
  import { Buffer as Buffer$1 } from 'node:buffer';
29
30
  import require$$0$8, { createRequire as createRequire$2 } from 'module';
30
31
  import require$$1$1 from 'worker_threads';
31
- import require$$0$b from 'zlib';
32
+ import require$$0$a from 'zlib';
32
33
  import require$$1$3 from 'https';
33
34
  import require$$4 from 'tls';
34
35
  import { STATUS_CODES } from 'node:http';
@@ -214,6 +215,1761 @@ function alias$1(options = {}) {
214
215
  };
215
216
  }
216
217
 
218
+ // Manually “tree shaken” from:
219
+
220
+ const reader$2 = {read: read$5};
221
+ var packageJsonReader = reader$2;
222
+
223
+ /**
224
+ * @param {string} jsonPath
225
+ * @returns {{string: string|undefined}}
226
+ */
227
+ function read$5(jsonPath) {
228
+ try {
229
+ const string = fs$l.readFileSync(
230
+ path$n.toNamespacedPath(path$n.join(path$n.dirname(jsonPath), 'package.json')),
231
+ 'utf8'
232
+ );
233
+ return {string}
234
+ } catch (error) {
235
+ const exception = /** @type {ErrnoException} */ (error);
236
+
237
+ if (exception.code === 'ENOENT') {
238
+ return {string: undefined}
239
+ // Throw all other errors.
240
+ /* c8 ignore next 4 */
241
+ }
242
+
243
+ throw exception
244
+ }
245
+ }
246
+
247
+ /**
248
+ * @typedef ErrnoExceptionFields
249
+ * @property {number|undefined} [errnode]
250
+ * @property {string|undefined} [code]
251
+ * @property {string|undefined} [path]
252
+ * @property {string|undefined} [syscall]
253
+ * @property {string|undefined} [url]
254
+ *
255
+ * @typedef {Error & ErrnoExceptionFields} ErrnoException
256
+ */
257
+
258
+ const isWindows$6 = process$1.platform === 'win32';
259
+
260
+ const own$2 = {}.hasOwnProperty;
261
+
262
+ const codes$1 = {};
263
+
264
+ /** @type {Map<string, MessageFunction|string>} */
265
+ const messages$1 = new Map();
266
+ const nodeInternalPrefix$1 = '__node_internal_';
267
+ /** @type {number} */
268
+ let userStackTraceLimit$1;
269
+
270
+ codes$1.ERR_INVALID_MODULE_SPECIFIER = createError$1(
271
+ 'ERR_INVALID_MODULE_SPECIFIER',
272
+ /**
273
+ * @param {string} request
274
+ * @param {string} reason
275
+ * @param {string} [base]
276
+ */
277
+ (request, reason, base = undefined) => {
278
+ return `Invalid module "${request}" ${reason}${
279
+ base ? ` imported from ${base}` : ''
280
+ }`
281
+ },
282
+ TypeError
283
+ );
284
+
285
+ codes$1.ERR_INVALID_PACKAGE_CONFIG = createError$1(
286
+ 'ERR_INVALID_PACKAGE_CONFIG',
287
+ /**
288
+ * @param {string} path
289
+ * @param {string} [base]
290
+ * @param {string} [message]
291
+ */
292
+ (path, base, message) => {
293
+ return `Invalid package config ${path}${
294
+ base ? ` while importing ${base}` : ''
295
+ }${message ? `. ${message}` : ''}`
296
+ },
297
+ Error
298
+ );
299
+
300
+ codes$1.ERR_INVALID_PACKAGE_TARGET = createError$1(
301
+ 'ERR_INVALID_PACKAGE_TARGET',
302
+ /**
303
+ * @param {string} pkgPath
304
+ * @param {string} key
305
+ * @param {unknown} target
306
+ * @param {boolean} [isImport=false]
307
+ * @param {string} [base]
308
+ */
309
+ (pkgPath, key, target, isImport = false, base = undefined) => {
310
+ const relError =
311
+ typeof target === 'string' &&
312
+ !isImport &&
313
+ target.length > 0 &&
314
+ !target.startsWith('./');
315
+ if (key === '.') {
316
+ assert$1(isImport === false);
317
+ return (
318
+ `Invalid "exports" main target ${JSON.stringify(target)} defined ` +
319
+ `in the package config ${pkgPath}package.json${
320
+ base ? ` imported from ${base}` : ''
321
+ }${relError ? '; targets must start with "./"' : ''}`
322
+ )
323
+ }
324
+
325
+ return `Invalid "${
326
+ isImport ? 'imports' : 'exports'
327
+ }" target ${JSON.stringify(
328
+ target
329
+ )} defined for '${key}' in the package config ${pkgPath}package.json${
330
+ base ? ` imported from ${base}` : ''
331
+ }${relError ? '; targets must start with "./"' : ''}`
332
+ },
333
+ Error
334
+ );
335
+
336
+ codes$1.ERR_MODULE_NOT_FOUND = createError$1(
337
+ 'ERR_MODULE_NOT_FOUND',
338
+ /**
339
+ * @param {string} path
340
+ * @param {string} base
341
+ * @param {string} [type]
342
+ */
343
+ (path, base, type = 'package') => {
344
+ return `Cannot find ${type} '${path}' imported from ${base}`
345
+ },
346
+ Error
347
+ );
348
+
349
+ codes$1.ERR_NETWORK_IMPORT_DISALLOWED = createError$1(
350
+ 'ERR_NETWORK_IMPORT_DISALLOWED',
351
+ "import of '%s' by %s is not supported: %s",
352
+ Error
353
+ );
354
+
355
+ codes$1.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError$1(
356
+ 'ERR_PACKAGE_IMPORT_NOT_DEFINED',
357
+ /**
358
+ * @param {string} specifier
359
+ * @param {string} packagePath
360
+ * @param {string} base
361
+ */
362
+ (specifier, packagePath, base) => {
363
+ return `Package import specifier "${specifier}" is not defined${
364
+ packagePath ? ` in package ${packagePath}package.json` : ''
365
+ } imported from ${base}`
366
+ },
367
+ TypeError
368
+ );
369
+
370
+ codes$1.ERR_PACKAGE_PATH_NOT_EXPORTED = createError$1(
371
+ 'ERR_PACKAGE_PATH_NOT_EXPORTED',
372
+ /**
373
+ * @param {string} pkgPath
374
+ * @param {string} subpath
375
+ * @param {string} [base]
376
+ */
377
+ (pkgPath, subpath, base = undefined) => {
378
+ if (subpath === '.')
379
+ return `No "exports" main defined in ${pkgPath}package.json${
380
+ base ? ` imported from ${base}` : ''
381
+ }`
382
+ return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${
383
+ base ? ` imported from ${base}` : ''
384
+ }`
385
+ },
386
+ Error
387
+ );
388
+
389
+ codes$1.ERR_UNSUPPORTED_DIR_IMPORT = createError$1(
390
+ 'ERR_UNSUPPORTED_DIR_IMPORT',
391
+ "Directory import '%s' is not supported " +
392
+ 'resolving ES modules imported from %s',
393
+ Error
394
+ );
395
+
396
+ codes$1.ERR_UNKNOWN_FILE_EXTENSION = createError$1(
397
+ 'ERR_UNKNOWN_FILE_EXTENSION',
398
+ /**
399
+ * @param {string} ext
400
+ * @param {string} path
401
+ */
402
+ (ext, path) => {
403
+ return `Unknown file extension "${ext}" for ${path}`
404
+ },
405
+ TypeError
406
+ );
407
+
408
+ codes$1.ERR_INVALID_ARG_VALUE = createError$1(
409
+ 'ERR_INVALID_ARG_VALUE',
410
+ /**
411
+ * @param {string} name
412
+ * @param {unknown} value
413
+ * @param {string} [reason='is invalid']
414
+ */
415
+ (name, value, reason = 'is invalid') => {
416
+ let inspected = inspect(value);
417
+
418
+ if (inspected.length > 128) {
419
+ inspected = `${inspected.slice(0, 128)}...`;
420
+ }
421
+
422
+ const type = name.includes('.') ? 'property' : 'argument';
423
+
424
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`
425
+ },
426
+ TypeError
427
+ // Note: extra classes have been shaken out.
428
+ // , RangeError
429
+ );
430
+
431
+ codes$1.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError$1(
432
+ 'ERR_UNSUPPORTED_ESM_URL_SCHEME',
433
+ /**
434
+ * @param {URL} url
435
+ * @param {Array<string>} supported
436
+ */
437
+ (url, supported) => {
438
+ let message = `Only URLs with a scheme in: ${supported.join(
439
+ ', '
440
+ )} are supported by the default ESM loader`;
441
+ // Let message =
442
+ // 'Only file and data URLs are supported by the default ESM loader'
443
+
444
+ if (isWindows$6 && url.protocol.length === 2) {
445
+ message += '. On Windows, absolute paths must be valid file:// URLs';
446
+ }
447
+
448
+ message += `. Received protocol '${url.protocol}'`;
449
+ return message
450
+ },
451
+ Error
452
+ );
453
+
454
+ /**
455
+ * Utility function for registering the error codes. Only used here. Exported
456
+ * *only* to allow for testing.
457
+ * @param {string} sym
458
+ * @param {MessageFunction|string} value
459
+ * @param {ErrorConstructor} def
460
+ * @returns {new (...args: Array<any>) => Error}
461
+ */
462
+ function createError$1(sym, value, def) {
463
+ // Special case for SystemError that formats the error message differently
464
+ // The SystemErrors only have SystemError as their base classes.
465
+ messages$1.set(sym, value);
466
+
467
+ return makeNodeErrorWithCode$1(def, sym)
468
+ }
469
+
470
+ /**
471
+ * @param {ErrorConstructor} Base
472
+ * @param {string} key
473
+ * @returns {ErrorConstructor}
474
+ */
475
+ function makeNodeErrorWithCode$1(Base, key) {
476
+ // @ts-expect-error It’s a Node error.
477
+ return NodeError
478
+ /**
479
+ * @param {Array<unknown>} args
480
+ */
481
+ function NodeError(...args) {
482
+ const limit = Error.stackTraceLimit;
483
+ if (isErrorStackTraceLimitWritable$1()) Error.stackTraceLimit = 0;
484
+ const error = new Base();
485
+ // Reset the limit and setting the name property.
486
+ if (isErrorStackTraceLimitWritable$1()) Error.stackTraceLimit = limit;
487
+ const message = getMessage$1(key, args, error);
488
+ Object.defineProperties(error, {
489
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
490
+ // probably.
491
+ message: {
492
+ value: message,
493
+ enumerable: false,
494
+ writable: true,
495
+ configurable: true
496
+ },
497
+ toString: {
498
+ /** @this {Error} */
499
+ value() {
500
+ return `${this.name} [${key}]: ${this.message}`
501
+ },
502
+ enumerable: false,
503
+ writable: true,
504
+ configurable: true
505
+ }
506
+ });
507
+
508
+ captureLargerStackTrace$1(error);
509
+ // @ts-expect-error It’s a Node error.
510
+ error.code = key;
511
+ return error
512
+ }
513
+ }
514
+
515
+ /**
516
+ * @returns {boolean}
517
+ */
518
+ function isErrorStackTraceLimitWritable$1() {
519
+ const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');
520
+ if (desc === undefined) {
521
+ return Object.isExtensible(Error)
522
+ }
523
+
524
+ return own$2.call(desc, 'writable') && desc.writable !== undefined
525
+ ? desc.writable
526
+ : desc.set !== undefined
527
+ }
528
+
529
+ /**
530
+ * This function removes unnecessary frames from Node.js core errors.
531
+ * @template {(...args: Array<any>) => unknown} T
532
+ * @type {(fn: T) => T}
533
+ */
534
+ function hideStackFrames$1(fn) {
535
+ // We rename the functions that will be hidden to cut off the stacktrace
536
+ // at the outermost one
537
+ const hidden = nodeInternalPrefix$1 + fn.name;
538
+ Object.defineProperty(fn, 'name', {value: hidden});
539
+ return fn
540
+ }
541
+
542
+ const captureLargerStackTrace$1 = hideStackFrames$1(
543
+ /**
544
+ * @param {Error} error
545
+ * @returns {Error}
546
+ */
547
+ function (error) {
548
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable$1();
549
+ if (stackTraceLimitIsWritable) {
550
+ userStackTraceLimit$1 = Error.stackTraceLimit;
551
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
552
+ }
553
+
554
+ Error.captureStackTrace(error);
555
+
556
+ // Reset the limit
557
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit$1;
558
+
559
+ return error
560
+ }
561
+ );
562
+
563
+ /**
564
+ * @param {string} key
565
+ * @param {Array<unknown>} args
566
+ * @param {Error} self
567
+ * @returns {string}
568
+ */
569
+ function getMessage$1(key, args, self) {
570
+ const message = messages$1.get(key);
571
+ assert$1(typeof message !== 'undefined', 'expected `message` to be found');
572
+
573
+ if (typeof message === 'function') {
574
+ assert$1(
575
+ message.length <= args.length, // Default options do not count.
576
+ `Code: ${key}; The provided arguments length (${args.length}) does not ` +
577
+ `match the required ones (${message.length}).`
578
+ );
579
+ return Reflect.apply(message, self, args)
580
+ }
581
+
582
+ const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
583
+ assert$1(
584
+ expectedLength === args.length,
585
+ `Code: ${key}; The provided arguments length (${args.length}) does not ` +
586
+ `match the required ones (${expectedLength}).`
587
+ );
588
+ if (args.length === 0) return message
589
+
590
+ args.unshift(message);
591
+ return Reflect.apply(format$2, null, args)
592
+ }
593
+
594
+ // Manually “tree shaken” from:
595
+
596
+ const {ERR_UNKNOWN_FILE_EXTENSION} = codes$1;
597
+
598
+ const hasOwnProperty$2 = {}.hasOwnProperty;
599
+
600
+ /** @type {Record<string, string>} */
601
+ const extensionFormatMap = {
602
+ // @ts-expect-error: hush.
603
+ __proto__: null,
604
+ '.cjs': 'commonjs',
605
+ '.js': 'module',
606
+ '.json': 'json',
607
+ '.mjs': 'module'
608
+ };
609
+
610
+ /**
611
+ * @param {string|null} mime
612
+ * @returns {string | null}
613
+ */
614
+ function mimeToFormat(mime) {
615
+ if (
616
+ mime &&
617
+ /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime)
618
+ )
619
+ return 'module'
620
+ if (mime === 'application/json') return 'json'
621
+ return null
622
+ }
623
+
624
+ /**
625
+ * @callback ProtocolHandler
626
+ * @param {URL} parsed
627
+ * @param {{parentURL: string}} context
628
+ * @param {boolean} ignoreErrors
629
+ * @returns {string|null}
630
+ */
631
+
632
+ /**
633
+ * @type {Record<string, ProtocolHandler>}
634
+ */
635
+ const protocolHandlers = Object.assign(Object.create(null), {
636
+ 'data:': getDataProtocolModuleFormat,
637
+ 'file:': getFileProtocolModuleFormat,
638
+ 'http:': getHttpProtocolModuleFormat,
639
+ 'https:': getHttpProtocolModuleFormat,
640
+ 'node:'() {
641
+ return 'builtin'
642
+ }
643
+ });
644
+
645
+ /**
646
+ * @param {URL} parsed
647
+ */
648
+ function getDataProtocolModuleFormat(parsed) {
649
+ const {1: mime} = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(
650
+ parsed.pathname
651
+ ) || [null, null, null];
652
+ return mimeToFormat(mime)
653
+ }
654
+
655
+ /**
656
+ * @type {ProtocolHandler}
657
+ */
658
+ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
659
+ const filepath = fileURLToPath(url);
660
+ const ext = path$n.extname(filepath);
661
+ if (ext === '.js') {
662
+ return getPackageType(url) === 'module' ? 'module' : 'commonjs'
663
+ }
664
+
665
+ const format = extensionFormatMap[ext];
666
+ if (format) return format
667
+ if (ignoreErrors) return null
668
+
669
+ throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath)
670
+ }
671
+
672
+ function getHttpProtocolModuleFormat() {
673
+ // To do: HTTPS imports.
674
+ }
675
+
676
+ /**
677
+ * @param {URL} url
678
+ * @param {{parentURL: string}} context
679
+ * @returns {string|null}
680
+ */
681
+ function defaultGetFormatWithoutErrors(url, context) {
682
+ if (!hasOwnProperty$2.call(protocolHandlers, url.protocol)) {
683
+ return null
684
+ }
685
+
686
+ return protocolHandlers[url.protocol](url, context, true)
687
+ }
688
+
689
+ // Manually “tree shaken” from:
690
+
691
+ const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
692
+
693
+ // To do: potentially enable?
694
+ const experimentalNetworkImports = false;
695
+
696
+ const {
697
+ ERR_NETWORK_IMPORT_DISALLOWED,
698
+ ERR_INVALID_MODULE_SPECIFIER,
699
+ ERR_INVALID_PACKAGE_CONFIG,
700
+ ERR_INVALID_PACKAGE_TARGET,
701
+ ERR_MODULE_NOT_FOUND,
702
+ ERR_PACKAGE_IMPORT_NOT_DEFINED,
703
+ ERR_PACKAGE_PATH_NOT_EXPORTED,
704
+ ERR_UNSUPPORTED_DIR_IMPORT,
705
+ ERR_UNSUPPORTED_ESM_URL_SCHEME,
706
+ ERR_INVALID_ARG_VALUE
707
+ } = codes$1;
708
+
709
+ const own = {}.hasOwnProperty;
710
+
711
+ const DEFAULT_CONDITIONS = Object.freeze(['node', 'import']);
712
+ const DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);
713
+
714
+ const invalidSegmentRegEx =
715
+ /(^|\\|\/)((\.|%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;
716
+ const invalidPackageNameRegEx = /^\.|%|\\/;
717
+ const patternRegEx = /\*/g;
718
+ const encodedSepRegEx = /%2f|%5c/i;
719
+ /** @type {Set<string>} */
720
+ const emittedPackageWarnings = new Set();
721
+ /** @type {Map<string, PackageConfig>} */
722
+ const packageJsonCache = new Map();
723
+
724
+ /**
725
+ * @param {URL} url
726
+ * @param {URL} packageJsonUrl
727
+ * @param {URL} base
728
+ * @param {unknown} [main]
729
+ * @returns {void}
730
+ */
731
+ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
732
+ const format = defaultGetFormatWithoutErrors(url, {parentURL: base.href});
733
+ if (format !== 'module') return
734
+ const path = fileURLToPath(url.href);
735
+ const pkgPath = fileURLToPath(new URL$3('.', packageJsonUrl));
736
+ const basePath = fileURLToPath(base);
737
+ if (main)
738
+ process$1.emitWarning(
739
+ `Package ${pkgPath} has a "main" field set to ${JSON.stringify(main)}, ` +
740
+ `excluding the full filename and extension to the resolved file at "${path.slice(
741
+ pkgPath.length
742
+ )}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is` +
743
+ 'deprecated for ES modules.',
744
+ 'DeprecationWarning',
745
+ 'DEP0151'
746
+ );
747
+ else
748
+ process$1.emitWarning(
749
+ `No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${path.slice(
750
+ pkgPath.length
751
+ )}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`,
752
+ 'DeprecationWarning',
753
+ 'DEP0151'
754
+ );
755
+ }
756
+
757
+ /**
758
+ * @param {Array<string>} [conditions]
759
+ * @returns {Set<string>}
760
+ */
761
+ function getConditionsSet(conditions) {
762
+ if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) {
763
+ if (!Array.isArray(conditions)) {
764
+ throw new ERR_INVALID_ARG_VALUE(
765
+ 'conditions',
766
+ conditions,
767
+ 'expected an array'
768
+ )
769
+ }
770
+
771
+ return new Set(conditions)
772
+ }
773
+
774
+ return DEFAULT_CONDITIONS_SET
775
+ }
776
+
777
+ /**
778
+ * @param {string} path
779
+ * @returns {Stats}
780
+ */
781
+ function tryStatSync(path) {
782
+ // Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead.
783
+ try {
784
+ return statSync$1(path)
785
+ } catch {
786
+ return new Stats$1()
787
+ }
788
+ }
789
+
790
+ /**
791
+ * @param {string} path
792
+ * @param {string|URL} specifier Note: `specifier` is actually optional, not base.
793
+ * @param {URL} [base]
794
+ * @returns {PackageConfig}
795
+ */
796
+ function getPackageConfig(path, specifier, base) {
797
+ const existing = packageJsonCache.get(path);
798
+ if (existing !== undefined) {
799
+ return existing
800
+ }
801
+
802
+ const source = packageJsonReader.read(path).string;
803
+
804
+ if (source === undefined) {
805
+ /** @type {PackageConfig} */
806
+ const packageConfig = {
807
+ pjsonPath: path,
808
+ exists: false,
809
+ main: undefined,
810
+ name: undefined,
811
+ type: 'none',
812
+ exports: undefined,
813
+ imports: undefined
814
+ };
815
+ packageJsonCache.set(path, packageConfig);
816
+ return packageConfig
817
+ }
818
+
819
+ /** @type {Record<string, unknown>} */
820
+ let packageJson;
821
+ try {
822
+ packageJson = JSON.parse(source);
823
+ } catch (error) {
824
+ const exception = /** @type {ErrnoException} */ (error);
825
+
826
+ throw new ERR_INVALID_PACKAGE_CONFIG(
827
+ path,
828
+ (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier),
829
+ exception.message
830
+ )
831
+ }
832
+
833
+ const {exports, imports, main, name, type} = packageJson;
834
+
835
+ /** @type {PackageConfig} */
836
+ const packageConfig = {
837
+ pjsonPath: path,
838
+ exists: true,
839
+ main: typeof main === 'string' ? main : undefined,
840
+ name: typeof name === 'string' ? name : undefined,
841
+ type: type === 'module' || type === 'commonjs' ? type : 'none',
842
+ // @ts-expect-error Assume `Record<string, unknown>`.
843
+ exports,
844
+ // @ts-expect-error Assume `Record<string, unknown>`.
845
+ imports: imports && typeof imports === 'object' ? imports : undefined
846
+ };
847
+ packageJsonCache.set(path, packageConfig);
848
+ return packageConfig
849
+ }
850
+
851
+ /**
852
+ * @param {URL} resolved
853
+ * @returns {PackageConfig}
854
+ */
855
+ function getPackageScopeConfig(resolved) {
856
+ let packageJsonUrl = new URL$3('package.json', resolved);
857
+
858
+ while (true) {
859
+ const packageJsonPath = packageJsonUrl.pathname;
860
+
861
+ if (packageJsonPath.endsWith('node_modules/package.json')) break
862
+
863
+ const packageConfig = getPackageConfig(
864
+ fileURLToPath(packageJsonUrl),
865
+ resolved
866
+ );
867
+ if (packageConfig.exists) return packageConfig
868
+
869
+ const lastPackageJsonUrl = packageJsonUrl;
870
+ packageJsonUrl = new URL$3('../package.json', packageJsonUrl);
871
+
872
+ // Terminates at root where ../package.json equals ../../package.json
873
+ // (can't just check "/package.json" for Windows support).
874
+ if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break
875
+ }
876
+
877
+ const packageJsonPath = fileURLToPath(packageJsonUrl);
878
+ /** @type {PackageConfig} */
879
+ const packageConfig = {
880
+ pjsonPath: packageJsonPath,
881
+ exists: false,
882
+ main: undefined,
883
+ name: undefined,
884
+ type: 'none',
885
+ exports: undefined,
886
+ imports: undefined
887
+ };
888
+ packageJsonCache.set(packageJsonPath, packageConfig);
889
+ return packageConfig
890
+ }
891
+
892
+ /**
893
+ * Legacy CommonJS main resolution:
894
+ * 1. let M = pkg_url + (json main field)
895
+ * 2. TRY(M, M.js, M.json, M.node)
896
+ * 3. TRY(M/index.js, M/index.json, M/index.node)
897
+ * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)
898
+ * 5. NOT_FOUND
899
+ *
900
+ * @param {URL} url
901
+ * @returns {boolean}
902
+ */
903
+ function fileExists(url) {
904
+ const stats = statSync$1(url, {throwIfNoEntry: false});
905
+ const isFile = stats ? stats.isFile() : undefined;
906
+ return isFile === null || isFile === undefined ? false : isFile
907
+ }
908
+
909
+ /**
910
+ * @param {URL} packageJsonUrl
911
+ * @param {PackageConfig} packageConfig
912
+ * @param {URL} base
913
+ * @returns {URL}
914
+ */
915
+ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
916
+ /** @type {URL|undefined} */
917
+ let guess;
918
+ if (packageConfig.main !== undefined) {
919
+ guess = new URL$3(packageConfig.main, packageJsonUrl);
920
+ // Note: fs check redundances will be handled by Descriptor cache here.
921
+ if (fileExists(guess)) return guess
922
+
923
+ const tries = [
924
+ `./${packageConfig.main}.js`,
925
+ `./${packageConfig.main}.json`,
926
+ `./${packageConfig.main}.node`,
927
+ `./${packageConfig.main}/index.js`,
928
+ `./${packageConfig.main}/index.json`,
929
+ `./${packageConfig.main}/index.node`
930
+ ];
931
+ let i = -1;
932
+
933
+ while (++i < tries.length) {
934
+ guess = new URL$3(tries[i], packageJsonUrl);
935
+ if (fileExists(guess)) break
936
+ guess = undefined;
937
+ }
938
+
939
+ if (guess) {
940
+ emitLegacyIndexDeprecation(
941
+ guess,
942
+ packageJsonUrl,
943
+ base,
944
+ packageConfig.main
945
+ );
946
+ return guess
947
+ }
948
+ // Fallthrough.
949
+ }
950
+
951
+ const tries = ['./index.js', './index.json', './index.node'];
952
+ let i = -1;
953
+
954
+ while (++i < tries.length) {
955
+ guess = new URL$3(tries[i], packageJsonUrl);
956
+ if (fileExists(guess)) break
957
+ guess = undefined;
958
+ }
959
+
960
+ if (guess) {
961
+ emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
962
+ return guess
963
+ }
964
+
965
+ // Not found.
966
+ throw new ERR_MODULE_NOT_FOUND(
967
+ fileURLToPath(new URL$3('.', packageJsonUrl)),
968
+ fileURLToPath(base)
969
+ )
970
+ }
971
+
972
+ /**
973
+ * @param {URL} resolved
974
+ * @param {URL} base
975
+ * @param {boolean} [preserveSymlinks]
976
+ * @returns {URL}
977
+ */
978
+ function finalizeResolution(resolved, base, preserveSymlinks) {
979
+ if (encodedSepRegEx.test(resolved.pathname))
980
+ throw new ERR_INVALID_MODULE_SPECIFIER(
981
+ resolved.pathname,
982
+ 'must not include encoded "/" or "\\" characters',
983
+ fileURLToPath(base)
984
+ )
985
+
986
+ const filePath = fileURLToPath(resolved);
987
+
988
+ const stats = tryStatSync(
989
+ filePath.endsWith('/') ? filePath.slice(-1) : filePath
990
+ );
991
+
992
+ if (stats.isDirectory()) {
993
+ const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));
994
+ // @ts-expect-error Add this for `import.meta.resolve`.
995
+ error.url = String(resolved);
996
+ throw error
997
+ }
998
+
999
+ if (!stats.isFile()) {
1000
+ throw new ERR_MODULE_NOT_FOUND(
1001
+ filePath || resolved.pathname,
1002
+ base && fileURLToPath(base),
1003
+ 'module'
1004
+ )
1005
+ }
1006
+
1007
+ if (!preserveSymlinks) {
1008
+ const real = realpathSync$1(filePath);
1009
+ const {search, hash} = resolved;
1010
+ resolved = pathToFileURL(real + (filePath.endsWith(path$n.sep) ? '/' : ''));
1011
+ resolved.search = search;
1012
+ resolved.hash = hash;
1013
+ }
1014
+
1015
+ return resolved
1016
+ }
1017
+
1018
+ /**
1019
+ * @param {string} specifier
1020
+ * @param {URL|undefined} packageJsonUrl
1021
+ * @param {URL} base
1022
+ * @returns {never}
1023
+ */
1024
+ function throwImportNotDefined(specifier, packageJsonUrl, base) {
1025
+ throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(
1026
+ specifier,
1027
+ packageJsonUrl && fileURLToPath(new URL$3('.', packageJsonUrl)),
1028
+ fileURLToPath(base)
1029
+ )
1030
+ }
1031
+
1032
+ /**
1033
+ * @param {string} subpath
1034
+ * @param {URL} packageJsonUrl
1035
+ * @param {URL} base
1036
+ * @returns {never}
1037
+ */
1038
+ function throwExportsNotFound(subpath, packageJsonUrl, base) {
1039
+ throw new ERR_PACKAGE_PATH_NOT_EXPORTED(
1040
+ fileURLToPath(new URL$3('.', packageJsonUrl)),
1041
+ subpath,
1042
+ base && fileURLToPath(base)
1043
+ )
1044
+ }
1045
+
1046
+ /**
1047
+ * @param {string} subpath
1048
+ * @param {URL} packageJsonUrl
1049
+ * @param {boolean} internal
1050
+ * @param {URL} [base]
1051
+ * @returns {never}
1052
+ */
1053
+ function throwInvalidSubpath(subpath, packageJsonUrl, internal, base) {
1054
+ const reason = `request is not a valid subpath for the "${
1055
+ internal ? 'imports' : 'exports'
1056
+ }" resolution of ${fileURLToPath(packageJsonUrl)}`;
1057
+
1058
+ throw new ERR_INVALID_MODULE_SPECIFIER(
1059
+ subpath,
1060
+ reason,
1061
+ base && fileURLToPath(base)
1062
+ )
1063
+ }
1064
+
1065
+ /**
1066
+ * @param {string} subpath
1067
+ * @param {unknown} target
1068
+ * @param {URL} packageJsonUrl
1069
+ * @param {boolean} internal
1070
+ * @param {URL} [base]
1071
+ * @returns {never}
1072
+ */
1073
+ function throwInvalidPackageTarget(
1074
+ subpath,
1075
+ target,
1076
+ packageJsonUrl,
1077
+ internal,
1078
+ base
1079
+ ) {
1080
+ target =
1081
+ typeof target === 'object' && target !== null
1082
+ ? JSON.stringify(target, null, '')
1083
+ : `${target}`;
1084
+
1085
+ throw new ERR_INVALID_PACKAGE_TARGET(
1086
+ fileURLToPath(new URL$3('.', packageJsonUrl)),
1087
+ subpath,
1088
+ target,
1089
+ internal,
1090
+ base && fileURLToPath(base)
1091
+ )
1092
+ }
1093
+
1094
+ /**
1095
+ * @param {string} target
1096
+ * @param {string} subpath
1097
+ * @param {string} match
1098
+ * @param {URL} packageJsonUrl
1099
+ * @param {URL} base
1100
+ * @param {boolean} pattern
1101
+ * @param {boolean} internal
1102
+ * @param {Set<string>|undefined} conditions
1103
+ * @returns {URL}
1104
+ */
1105
+ function resolvePackageTargetString(
1106
+ target,
1107
+ subpath,
1108
+ match,
1109
+ packageJsonUrl,
1110
+ base,
1111
+ pattern,
1112
+ internal,
1113
+ conditions
1114
+ ) {
1115
+ if (subpath !== '' && !pattern && target[target.length - 1] !== '/')
1116
+ throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
1117
+
1118
+ if (!target.startsWith('./')) {
1119
+ if (internal && !target.startsWith('../') && !target.startsWith('/')) {
1120
+ let isURL = false;
1121
+
1122
+ try {
1123
+ new URL$3(target);
1124
+ isURL = true;
1125
+ } catch {
1126
+ // Continue regardless of error.
1127
+ }
1128
+
1129
+ if (!isURL) {
1130
+ const exportTarget = pattern
1131
+ ? RegExpPrototypeSymbolReplace.call(
1132
+ patternRegEx,
1133
+ target,
1134
+ () => subpath
1135
+ )
1136
+ : target + subpath;
1137
+
1138
+ return packageResolve(exportTarget, packageJsonUrl, conditions)
1139
+ }
1140
+ }
1141
+
1142
+ throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
1143
+ }
1144
+
1145
+ if (invalidSegmentRegEx.test(target.slice(2)))
1146
+ throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
1147
+
1148
+ const resolved = new URL$3(target, packageJsonUrl);
1149
+ const resolvedPath = resolved.pathname;
1150
+ const packagePath = new URL$3('.', packageJsonUrl).pathname;
1151
+
1152
+ if (!resolvedPath.startsWith(packagePath))
1153
+ throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
1154
+
1155
+ if (subpath === '') return resolved
1156
+
1157
+ if (invalidSegmentRegEx.test(subpath)) {
1158
+ const request = pattern
1159
+ ? match.replace('*', () => subpath)
1160
+ : match + subpath;
1161
+ throwInvalidSubpath(request, packageJsonUrl, internal, base);
1162
+ }
1163
+
1164
+ if (pattern) {
1165
+ return new URL$3(
1166
+ RegExpPrototypeSymbolReplace.call(
1167
+ patternRegEx,
1168
+ resolved.href,
1169
+ () => subpath
1170
+ )
1171
+ )
1172
+ }
1173
+
1174
+ return new URL$3(subpath, resolved)
1175
+ }
1176
+
1177
+ /**
1178
+ * @param {string} key
1179
+ * @returns {boolean}
1180
+ */
1181
+ function isArrayIndex(key) {
1182
+ const keyNumber = Number(key);
1183
+ if (`${keyNumber}` !== key) return false
1184
+ return keyNumber >= 0 && keyNumber < 0xff_ff_ff_ff
1185
+ }
1186
+
1187
+ /**
1188
+ * @param {URL} packageJsonUrl
1189
+ * @param {unknown} target
1190
+ * @param {string} subpath
1191
+ * @param {string} packageSubpath
1192
+ * @param {URL} base
1193
+ * @param {boolean} pattern
1194
+ * @param {boolean} internal
1195
+ * @param {Set<string>|undefined} conditions
1196
+ * @returns {URL|null}
1197
+ */
1198
+ function resolvePackageTarget(
1199
+ packageJsonUrl,
1200
+ target,
1201
+ subpath,
1202
+ packageSubpath,
1203
+ base,
1204
+ pattern,
1205
+ internal,
1206
+ conditions
1207
+ ) {
1208
+ if (typeof target === 'string') {
1209
+ return resolvePackageTargetString(
1210
+ target,
1211
+ subpath,
1212
+ packageSubpath,
1213
+ packageJsonUrl,
1214
+ base,
1215
+ pattern,
1216
+ internal,
1217
+ conditions
1218
+ )
1219
+ }
1220
+
1221
+ if (Array.isArray(target)) {
1222
+ /** @type {Array<unknown>} */
1223
+ const targetList = target;
1224
+ if (targetList.length === 0) return null
1225
+
1226
+ /** @type {ErrnoException|null|undefined} */
1227
+ let lastException;
1228
+ let i = -1;
1229
+
1230
+ while (++i < targetList.length) {
1231
+ const targetItem = targetList[i];
1232
+ /** @type {URL|null} */
1233
+ let resolveResult;
1234
+ try {
1235
+ resolveResult = resolvePackageTarget(
1236
+ packageJsonUrl,
1237
+ targetItem,
1238
+ subpath,
1239
+ packageSubpath,
1240
+ base,
1241
+ pattern,
1242
+ internal,
1243
+ conditions
1244
+ );
1245
+ } catch (error) {
1246
+ const exception = /** @type {ErrnoException} */ (error);
1247
+ lastException = exception;
1248
+ if (exception.code === 'ERR_INVALID_PACKAGE_TARGET') continue
1249
+ throw error
1250
+ }
1251
+
1252
+ if (resolveResult === undefined) continue
1253
+
1254
+ if (resolveResult === null) {
1255
+ lastException = null;
1256
+ continue
1257
+ }
1258
+
1259
+ return resolveResult
1260
+ }
1261
+
1262
+ if (lastException === undefined || lastException === null) {
1263
+ return null
1264
+ }
1265
+
1266
+ throw lastException
1267
+ }
1268
+
1269
+ if (typeof target === 'object' && target !== null) {
1270
+ const keys = Object.getOwnPropertyNames(target);
1271
+ let i = -1;
1272
+
1273
+ while (++i < keys.length) {
1274
+ const key = keys[i];
1275
+ if (isArrayIndex(key)) {
1276
+ throw new ERR_INVALID_PACKAGE_CONFIG(
1277
+ fileURLToPath(packageJsonUrl),
1278
+ base,
1279
+ '"exports" cannot contain numeric property keys.'
1280
+ )
1281
+ }
1282
+ }
1283
+
1284
+ i = -1;
1285
+
1286
+ while (++i < keys.length) {
1287
+ const key = keys[i];
1288
+ if (key === 'default' || (conditions && conditions.has(key))) {
1289
+ // @ts-expect-error: indexable.
1290
+ const conditionalTarget = /** @type {unknown} */ (target[key]);
1291
+ const resolveResult = resolvePackageTarget(
1292
+ packageJsonUrl,
1293
+ conditionalTarget,
1294
+ subpath,
1295
+ packageSubpath,
1296
+ base,
1297
+ pattern,
1298
+ internal,
1299
+ conditions
1300
+ );
1301
+ if (resolveResult === undefined) continue
1302
+ return resolveResult
1303
+ }
1304
+ }
1305
+
1306
+ return null
1307
+ }
1308
+
1309
+ if (target === null) {
1310
+ return null
1311
+ }
1312
+
1313
+ throwInvalidPackageTarget(
1314
+ packageSubpath,
1315
+ target,
1316
+ packageJsonUrl,
1317
+ internal,
1318
+ base
1319
+ );
1320
+ }
1321
+
1322
+ /**
1323
+ * @param {unknown} exports
1324
+ * @param {URL} packageJsonUrl
1325
+ * @param {URL} base
1326
+ * @returns {boolean}
1327
+ */
1328
+ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
1329
+ if (typeof exports === 'string' || Array.isArray(exports)) return true
1330
+ if (typeof exports !== 'object' || exports === null) return false
1331
+
1332
+ const keys = Object.getOwnPropertyNames(exports);
1333
+ let isConditionalSugar = false;
1334
+ let i = 0;
1335
+ let j = -1;
1336
+ while (++j < keys.length) {
1337
+ const key = keys[j];
1338
+ const curIsConditionalSugar = key === '' || key[0] !== '.';
1339
+ if (i++ === 0) {
1340
+ isConditionalSugar = curIsConditionalSugar;
1341
+ } else if (isConditionalSugar !== curIsConditionalSugar) {
1342
+ throw new ERR_INVALID_PACKAGE_CONFIG(
1343
+ fileURLToPath(packageJsonUrl),
1344
+ base,
1345
+ '"exports" cannot contain some keys starting with \'.\' and some not.' +
1346
+ ' The exports object must either be an object of package subpath keys' +
1347
+ ' or an object of main entry condition name keys only.'
1348
+ )
1349
+ }
1350
+ }
1351
+
1352
+ return isConditionalSugar
1353
+ }
1354
+
1355
+ /**
1356
+ * @param {string} match
1357
+ * @param {URL} pjsonUrl
1358
+ * @param {URL} base
1359
+ */
1360
+ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
1361
+ const pjsonPath = fileURLToPath(pjsonUrl);
1362
+ if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return
1363
+ emittedPackageWarnings.add(pjsonPath + '|' + match);
1364
+ process$1.emitWarning(
1365
+ `Use of deprecated trailing slash pattern mapping "${match}" in the ` +
1366
+ `"exports" field module resolution of the package at ${pjsonPath}${
1367
+ base ? ` imported from ${fileURLToPath(base)}` : ''
1368
+ }. Mapping specifiers ending in "/" is no longer supported.`,
1369
+ 'DeprecationWarning',
1370
+ 'DEP0155'
1371
+ );
1372
+ }
1373
+
1374
+ /**
1375
+ * @param {URL} packageJsonUrl
1376
+ * @param {string} packageSubpath
1377
+ * @param {Record<string, unknown>} packageConfig
1378
+ * @param {URL} base
1379
+ * @param {Set<string>|undefined} conditions
1380
+ * @returns {URL}
1381
+ */
1382
+ function packageExportsResolve(
1383
+ packageJsonUrl,
1384
+ packageSubpath,
1385
+ packageConfig,
1386
+ base,
1387
+ conditions
1388
+ ) {
1389
+ let exports = packageConfig.exports;
1390
+
1391
+ if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) {
1392
+ exports = {'.': exports};
1393
+ }
1394
+
1395
+ if (
1396
+ own.call(exports, packageSubpath) &&
1397
+ !packageSubpath.includes('*') &&
1398
+ !packageSubpath.endsWith('/')
1399
+ ) {
1400
+ // @ts-expect-error: indexable.
1401
+ const target = exports[packageSubpath];
1402
+ const resolveResult = resolvePackageTarget(
1403
+ packageJsonUrl,
1404
+ target,
1405
+ '',
1406
+ packageSubpath,
1407
+ base,
1408
+ false,
1409
+ false,
1410
+ conditions
1411
+ );
1412
+ if (resolveResult === null || resolveResult === undefined) {
1413
+ throwExportsNotFound(packageSubpath, packageJsonUrl, base);
1414
+ }
1415
+
1416
+ return resolveResult
1417
+ }
1418
+
1419
+ let bestMatch = '';
1420
+ let bestMatchSubpath = '';
1421
+ const keys = Object.getOwnPropertyNames(exports);
1422
+ let i = -1;
1423
+
1424
+ while (++i < keys.length) {
1425
+ const key = keys[i];
1426
+ const patternIndex = key.indexOf('*');
1427
+
1428
+ if (
1429
+ patternIndex !== -1 &&
1430
+ packageSubpath.startsWith(key.slice(0, patternIndex))
1431
+ ) {
1432
+ // When this reaches EOL, this can throw at the top of the whole function:
1433
+ //
1434
+ // if (StringPrototypeEndsWith(packageSubpath, '/'))
1435
+ // throwInvalidSubpath(packageSubpath)
1436
+ //
1437
+ // To match "imports" and the spec.
1438
+ if (packageSubpath.endsWith('/')) {
1439
+ emitTrailingSlashPatternDeprecation(
1440
+ packageSubpath,
1441
+ packageJsonUrl,
1442
+ base
1443
+ );
1444
+ }
1445
+
1446
+ const patternTrailer = key.slice(patternIndex + 1);
1447
+
1448
+ if (
1449
+ packageSubpath.length >= key.length &&
1450
+ packageSubpath.endsWith(patternTrailer) &&
1451
+ patternKeyCompare(bestMatch, key) === 1 &&
1452
+ key.lastIndexOf('*') === patternIndex
1453
+ ) {
1454
+ bestMatch = key;
1455
+ bestMatchSubpath = packageSubpath.slice(
1456
+ patternIndex,
1457
+ packageSubpath.length - patternTrailer.length
1458
+ );
1459
+ }
1460
+ }
1461
+ }
1462
+
1463
+ if (bestMatch) {
1464
+ // @ts-expect-error: indexable.
1465
+ const target = /** @type {unknown} */ (exports[bestMatch]);
1466
+ const resolveResult = resolvePackageTarget(
1467
+ packageJsonUrl,
1468
+ target,
1469
+ bestMatchSubpath,
1470
+ bestMatch,
1471
+ base,
1472
+ true,
1473
+ false,
1474
+ conditions
1475
+ );
1476
+
1477
+ if (resolveResult === null || resolveResult === undefined) {
1478
+ throwExportsNotFound(packageSubpath, packageJsonUrl, base);
1479
+ }
1480
+
1481
+ return resolveResult
1482
+ }
1483
+
1484
+ throwExportsNotFound(packageSubpath, packageJsonUrl, base);
1485
+ }
1486
+
1487
+ /**
1488
+ * @param {string} a
1489
+ * @param {string} b
1490
+ */
1491
+ function patternKeyCompare(a, b) {
1492
+ const aPatternIndex = a.indexOf('*');
1493
+ const bPatternIndex = b.indexOf('*');
1494
+ const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
1495
+ const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
1496
+ if (baseLengthA > baseLengthB) return -1
1497
+ if (baseLengthB > baseLengthA) return 1
1498
+ if (aPatternIndex === -1) return 1
1499
+ if (bPatternIndex === -1) return -1
1500
+ if (a.length > b.length) return -1
1501
+ if (b.length > a.length) return 1
1502
+ return 0
1503
+ }
1504
+
1505
+ /**
1506
+ * @param {string} name
1507
+ * @param {URL} base
1508
+ * @param {Set<string>} [conditions]
1509
+ * @returns {URL}
1510
+ */
1511
+ function packageImportsResolve(name, base, conditions) {
1512
+ if (name === '#' || name.startsWith('#/') || name.endsWith('/')) {
1513
+ const reason = 'is not a valid internal imports specifier name';
1514
+ throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base))
1515
+ }
1516
+
1517
+ /** @type {URL|undefined} */
1518
+ let packageJsonUrl;
1519
+
1520
+ const packageConfig = getPackageScopeConfig(base);
1521
+
1522
+ if (packageConfig.exists) {
1523
+ packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
1524
+ const imports = packageConfig.imports;
1525
+ if (imports) {
1526
+ if (own.call(imports, name) && !name.includes('*')) {
1527
+ const resolveResult = resolvePackageTarget(
1528
+ packageJsonUrl,
1529
+ imports[name],
1530
+ '',
1531
+ name,
1532
+ base,
1533
+ false,
1534
+ true,
1535
+ conditions
1536
+ );
1537
+ if (resolveResult !== null && resolveResult !== undefined) {
1538
+ return resolveResult
1539
+ }
1540
+ } else {
1541
+ let bestMatch = '';
1542
+ let bestMatchSubpath = '';
1543
+ const keys = Object.getOwnPropertyNames(imports);
1544
+ let i = -1;
1545
+
1546
+ while (++i < keys.length) {
1547
+ const key = keys[i];
1548
+ const patternIndex = key.indexOf('*');
1549
+
1550
+ if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
1551
+ const patternTrailer = key.slice(patternIndex + 1);
1552
+ if (
1553
+ name.length >= key.length &&
1554
+ name.endsWith(patternTrailer) &&
1555
+ patternKeyCompare(bestMatch, key) === 1 &&
1556
+ key.lastIndexOf('*') === patternIndex
1557
+ ) {
1558
+ bestMatch = key;
1559
+ bestMatchSubpath = name.slice(
1560
+ patternIndex,
1561
+ name.length - patternTrailer.length
1562
+ );
1563
+ }
1564
+ }
1565
+ }
1566
+
1567
+ if (bestMatch) {
1568
+ const target = imports[bestMatch];
1569
+ const resolveResult = resolvePackageTarget(
1570
+ packageJsonUrl,
1571
+ target,
1572
+ bestMatchSubpath,
1573
+ bestMatch,
1574
+ base,
1575
+ true,
1576
+ true,
1577
+ conditions
1578
+ );
1579
+
1580
+ if (resolveResult !== null && resolveResult !== undefined) {
1581
+ return resolveResult
1582
+ }
1583
+ }
1584
+ }
1585
+ }
1586
+ }
1587
+
1588
+ throwImportNotDefined(name, packageJsonUrl, base);
1589
+ }
1590
+
1591
+ /**
1592
+ * @param {URL} url
1593
+ * @returns {PackageType}
1594
+ */
1595
+ function getPackageType(url) {
1596
+ const packageConfig = getPackageScopeConfig(url);
1597
+ return packageConfig.type
1598
+ }
1599
+
1600
+ /**
1601
+ * @param {string} specifier
1602
+ * @param {URL} base
1603
+ */
1604
+ function parsePackageName(specifier, base) {
1605
+ let separatorIndex = specifier.indexOf('/');
1606
+ let validPackageName = true;
1607
+ let isScoped = false;
1608
+ if (specifier[0] === '@') {
1609
+ isScoped = true;
1610
+ if (separatorIndex === -1 || specifier.length === 0) {
1611
+ validPackageName = false;
1612
+ } else {
1613
+ separatorIndex = specifier.indexOf('/', separatorIndex + 1);
1614
+ }
1615
+ }
1616
+
1617
+ const packageName =
1618
+ separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
1619
+
1620
+ // Package name cannot have leading . and cannot have percent-encoding or
1621
+ // \\ separators.
1622
+ if (invalidPackageNameRegEx.exec(packageName) !== null) {
1623
+ validPackageName = false;
1624
+ }
1625
+
1626
+ if (!validPackageName) {
1627
+ throw new ERR_INVALID_MODULE_SPECIFIER(
1628
+ specifier,
1629
+ 'is not a valid package name',
1630
+ fileURLToPath(base)
1631
+ )
1632
+ }
1633
+
1634
+ const packageSubpath =
1635
+ '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex));
1636
+
1637
+ return {packageName, packageSubpath, isScoped}
1638
+ }
1639
+
1640
+ /**
1641
+ * @param {string} specifier
1642
+ * @param {URL} base
1643
+ * @param {Set<string>|undefined} conditions
1644
+ * @returns {URL}
1645
+ */
1646
+ function packageResolve(specifier, base, conditions) {
1647
+ if (builtinModules.includes(specifier)) {
1648
+ return new URL$3('node:' + specifier)
1649
+ }
1650
+
1651
+ const {packageName, packageSubpath, isScoped} = parsePackageName(
1652
+ specifier,
1653
+ base
1654
+ );
1655
+
1656
+ // ResolveSelf
1657
+ const packageConfig = getPackageScopeConfig(base);
1658
+
1659
+ // Can’t test.
1660
+ /* c8 ignore next 16 */
1661
+ if (packageConfig.exists) {
1662
+ const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
1663
+ if (
1664
+ packageConfig.name === packageName &&
1665
+ packageConfig.exports !== undefined &&
1666
+ packageConfig.exports !== null
1667
+ ) {
1668
+ return packageExportsResolve(
1669
+ packageJsonUrl,
1670
+ packageSubpath,
1671
+ packageConfig,
1672
+ base,
1673
+ conditions
1674
+ )
1675
+ }
1676
+ }
1677
+
1678
+ let packageJsonUrl = new URL$3(
1679
+ './node_modules/' + packageName + '/package.json',
1680
+ base
1681
+ );
1682
+ let packageJsonPath = fileURLToPath(packageJsonUrl);
1683
+ /** @type {string} */
1684
+ let lastPath;
1685
+ do {
1686
+ const stat = tryStatSync(packageJsonPath.slice(0, -13));
1687
+ if (!stat.isDirectory()) {
1688
+ lastPath = packageJsonPath;
1689
+ packageJsonUrl = new URL$3(
1690
+ (isScoped ? '../../../../node_modules/' : '../../../node_modules/') +
1691
+ packageName +
1692
+ '/package.json',
1693
+ packageJsonUrl
1694
+ );
1695
+ packageJsonPath = fileURLToPath(packageJsonUrl);
1696
+ continue
1697
+ }
1698
+
1699
+ // Package match.
1700
+ const packageConfig = getPackageConfig(packageJsonPath, specifier, base);
1701
+ if (packageConfig.exports !== undefined && packageConfig.exports !== null) {
1702
+ return packageExportsResolve(
1703
+ packageJsonUrl,
1704
+ packageSubpath,
1705
+ packageConfig,
1706
+ base,
1707
+ conditions
1708
+ )
1709
+ }
1710
+
1711
+ if (packageSubpath === '.') {
1712
+ return legacyMainResolve(packageJsonUrl, packageConfig, base)
1713
+ }
1714
+
1715
+ return new URL$3(packageSubpath, packageJsonUrl)
1716
+ // Cross-platform root check.
1717
+ } while (packageJsonPath.length !== lastPath.length)
1718
+
1719
+ throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base))
1720
+ }
1721
+
1722
+ /**
1723
+ * @param {string} specifier
1724
+ * @returns {boolean}
1725
+ */
1726
+ function isRelativeSpecifier(specifier) {
1727
+ if (specifier[0] === '.') {
1728
+ if (specifier.length === 1 || specifier[1] === '/') return true
1729
+ if (
1730
+ specifier[1] === '.' &&
1731
+ (specifier.length === 2 || specifier[2] === '/')
1732
+ ) {
1733
+ return true
1734
+ }
1735
+ }
1736
+
1737
+ return false
1738
+ }
1739
+
1740
+ /**
1741
+ * @param {string} specifier
1742
+ * @returns {boolean}
1743
+ */
1744
+ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
1745
+ if (specifier === '') return false
1746
+ if (specifier[0] === '/') return true
1747
+ return isRelativeSpecifier(specifier)
1748
+ }
1749
+
1750
+ /**
1751
+ * The “Resolver Algorithm Specification” as detailed in the Node docs (which is
1752
+ * sync and slightly lower-level than `resolve`).
1753
+ *
1754
+ * @param {string} specifier
1755
+ * @param {URL} base
1756
+ * @param {Set<string>} [conditions]
1757
+ * @param {boolean} [preserveSymlinks]
1758
+ * @returns {URL}
1759
+ */
1760
+ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
1761
+ const isRemote = base.protocol === 'http:' || base.protocol === 'https:';
1762
+ // Order swapped from spec for minor perf gain.
1763
+ // Ok since relative URLs cannot parse as URLs.
1764
+ /** @type {URL|undefined} */
1765
+ let resolved;
1766
+
1767
+ if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1768
+ resolved = new URL$3(specifier, base);
1769
+ } else if (!isRemote && specifier[0] === '#') {
1770
+ resolved = packageImportsResolve(specifier, base, conditions);
1771
+ } else {
1772
+ try {
1773
+ resolved = new URL$3(specifier);
1774
+ } catch {
1775
+ if (!isRemote) {
1776
+ resolved = packageResolve(specifier, base, conditions);
1777
+ }
1778
+ }
1779
+ }
1780
+
1781
+ assert$1(typeof resolved !== 'undefined', 'expected to be defined');
1782
+
1783
+ if (resolved.protocol !== 'file:') {
1784
+ return resolved
1785
+ }
1786
+
1787
+ return finalizeResolution(resolved, base, preserveSymlinks)
1788
+ }
1789
+
1790
+ /**
1791
+ * @param {string} specifier
1792
+ * @param {URL|undefined} parsed
1793
+ * @param {URL|undefined} parsedParentURL
1794
+ */
1795
+ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
1796
+ if (
1797
+ parsed &&
1798
+ parsedParentURL &&
1799
+ (parsedParentURL.protocol === 'http:' ||
1800
+ parsedParentURL.protocol === 'https:')
1801
+ ) {
1802
+ if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1803
+ // Data: and blob: disallowed due to allowing file: access via
1804
+ // indirection
1805
+ if (
1806
+ parsed &&
1807
+ parsed.protocol !== 'https:' &&
1808
+ parsed.protocol !== 'http:'
1809
+ ) {
1810
+ throw new ERR_NETWORK_IMPORT_DISALLOWED(
1811
+ specifier,
1812
+ parsedParentURL,
1813
+ 'remote imports cannot import from a local location.'
1814
+ )
1815
+ }
1816
+
1817
+ return {url: parsed.href}
1818
+ }
1819
+
1820
+ if (builtinModules.includes(specifier)) {
1821
+ throw new ERR_NETWORK_IMPORT_DISALLOWED(
1822
+ specifier,
1823
+ parsedParentURL,
1824
+ 'remote imports cannot import from a local location.'
1825
+ )
1826
+ }
1827
+
1828
+ throw new ERR_NETWORK_IMPORT_DISALLOWED(
1829
+ specifier,
1830
+ parsedParentURL,
1831
+ 'only relative and absolute specifiers are supported.'
1832
+ )
1833
+ }
1834
+ }
1835
+
1836
+ /**
1837
+ * @param {URL} url
1838
+ */
1839
+ function throwIfUnsupportedURLProtocol(url) {
1840
+ if (
1841
+ url.protocol !== 'file:' &&
1842
+ url.protocol !== 'data:' &&
1843
+ url.protocol !== 'node:'
1844
+ ) {
1845
+ throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url)
1846
+ }
1847
+ }
1848
+
1849
+ /**
1850
+ * @param {URL|undefined} parsed
1851
+ * @param {boolean} experimentalNetworkImports
1852
+ */
1853
+ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
1854
+ if (
1855
+ parsed &&
1856
+ parsed.protocol !== 'file:' &&
1857
+ parsed.protocol !== 'data:' &&
1858
+ (!experimentalNetworkImports ||
1859
+ (parsed.protocol !== 'https:' && parsed.protocol !== 'http:'))
1860
+ ) {
1861
+ throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(
1862
+ parsed,
1863
+ ['file', 'data'].concat(
1864
+ experimentalNetworkImports ? ['https', 'http'] : []
1865
+ )
1866
+ )
1867
+ }
1868
+ }
1869
+
1870
+ /**
1871
+ * @param {string} specifier
1872
+ * @param {{parentURL?: string, conditions?: Array<string>}} context
1873
+ * @returns {{url: string, format?: string|null}}
1874
+ */
1875
+ function defaultResolve(specifier, context = {}) {
1876
+ const {parentURL} = context;
1877
+ assert$1(typeof parentURL !== 'undefined', 'expected `parentURL` to be defined');
1878
+
1879
+ /** @type {URL|undefined} */
1880
+ let parsedParentURL;
1881
+ if (parentURL) {
1882
+ try {
1883
+ parsedParentURL = new URL$3(parentURL);
1884
+ } catch {
1885
+ // Ignore exception
1886
+ }
1887
+ }
1888
+
1889
+ /** @type {URL|undefined} */
1890
+ let parsed;
1891
+ try {
1892
+ parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier)
1893
+ ? new URL$3(specifier, parsedParentURL)
1894
+ : new URL$3(specifier);
1895
+
1896
+ if (
1897
+ parsed.protocol === 'data:' ||
1898
+ (experimentalNetworkImports )
1899
+ ) {
1900
+ return {url: parsed.href, format: null}
1901
+ }
1902
+ } catch {
1903
+ // Ignore exception
1904
+ }
1905
+
1906
+ // There are multiple deep branches that can either throw or return; instead
1907
+ // of duplicating that deeply nested logic for the possible returns, DRY and
1908
+ // check for a return. This seems the least gnarly.
1909
+ const maybeReturn = checkIfDisallowedImport(
1910
+ specifier,
1911
+ parsed,
1912
+ parsedParentURL
1913
+ );
1914
+
1915
+ if (maybeReturn) return maybeReturn
1916
+
1917
+ // This must come after checkIfDisallowedImport
1918
+ if (parsed && parsed.protocol === 'node:') return {url: specifier}
1919
+
1920
+ throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports);
1921
+
1922
+ const conditions = getConditionsSet(context.conditions);
1923
+
1924
+ const url = moduleResolve(specifier, new URL$3(parentURL), conditions, false);
1925
+
1926
+ throwIfUnsupportedURLProtocol(url);
1927
+
1928
+ return {
1929
+ // Do NOT cast `url` to a string: that will work even when there are real
1930
+ // problems, silencing them
1931
+ url: url.href,
1932
+ format: defaultGetFormatWithoutErrors(url, {parentURL})
1933
+ }
1934
+ }
1935
+
1936
+ /**
1937
+ * @typedef {import('./lib/errors.js').ErrnoException} ErrnoException
1938
+ */
1939
+
1940
+ /**
1941
+ * Provides a module-relative resolution function scoped to each module,
1942
+ * returning the URL string.
1943
+ * `import.meta.resolve` also accepts a second argument which is the parent
1944
+ * module from which to resolve from.
1945
+ *
1946
+ * This function is asynchronous because the ES module resolver in Node.js is
1947
+ * allowed to be asynchronous.
1948
+ *
1949
+ * @param {string} specifier The module specifier to resolve relative to parent.
1950
+ * @param {string} parent The absolute parent module URL to resolve from.
1951
+ * You should pass `import.meta.url` or something else
1952
+ * @returns {Promise<string>}
1953
+ */
1954
+ async function resolve$4(specifier, parent) {
1955
+ if (!parent) {
1956
+ throw new Error(
1957
+ 'Please pass `parent`: `import-meta-resolve` cannot ponyfill that'
1958
+ )
1959
+ }
1960
+
1961
+ try {
1962
+ return defaultResolve(specifier, {parentURL: parent}).url
1963
+ } catch (error) {
1964
+ const exception = /** @type {ErrnoException} */ (error);
1965
+
1966
+ return exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' &&
1967
+ typeof exception.url === 'string'
1968
+ ? exception.url
1969
+ : Promise.reject(error)
1970
+ }
1971
+ }
1972
+
217
1973
  var picomatch$5 = {exports: {}};
218
1974
 
219
1975
  var utils$k = {};
@@ -2561,7 +4317,7 @@ function getMatcherString$1(id, resolutionBase) {
2561
4317
  return id;
2562
4318
  }
2563
4319
  // resolve('') is valid and will default to process.cwd()
2564
- const basePath = resolve$4(resolutionBase || '')
4320
+ const basePath = resolve$5(resolutionBase || '')
2565
4321
  .split(sep)
2566
4322
  .join('/')
2567
4323
  // escape all possible (posix + win) path characters that might interfere with regex
@@ -4331,7 +6087,7 @@ function ownProp (obj, field) {
4331
6087
  var fs$i = require$$0__default;
4332
6088
  var path$i = require$$0$4;
4333
6089
  var minimatch = minimatch_1;
4334
- var isAbsolute$1 = pathIsAbsolute.exports;
6090
+ var isAbsolute = pathIsAbsolute.exports;
4335
6091
  var Minimatch = minimatch.Minimatch;
4336
6092
 
4337
6093
  function alphasort (a, b) {
@@ -4419,7 +6175,7 @@ function setopts (self, pattern, options) {
4419
6175
 
4420
6176
  // TODO: is an absolute `cwd` supposed to be resolved against `root`?
4421
6177
  // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
4422
- self.cwdAbs = isAbsolute$1(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
6178
+ self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
4423
6179
  if (process.platform === "win32")
4424
6180
  self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
4425
6181
  self.nomount = !!options.nomount;
@@ -4518,7 +6274,7 @@ function makeAbs (self, f) {
4518
6274
  var abs = f;
4519
6275
  if (f.charAt(0) === '/') {
4520
6276
  abs = path$i.join(self.root, f);
4521
- } else if (isAbsolute$1(f) || f === '') {
6277
+ } else if (isAbsolute(f) || f === '') {
4522
6278
  abs = f;
4523
6279
  } else if (self.changedCwd) {
4524
6280
  abs = path$i.resolve(self.cwd, f);
@@ -4566,7 +6322,7 @@ function requireSync () {
4566
6322
  var minimatch = minimatch_1;
4567
6323
  requireGlob().Glob;
4568
6324
  var path = require$$0$4;
4569
- var assert = assert$1;
6325
+ var assert = assert$2;
4570
6326
  var isAbsolute = pathIsAbsolute.exports;
4571
6327
  var common = common$c;
4572
6328
  var setopts = common.setopts;
@@ -5226,7 +6982,7 @@ function requireGlob () {
5226
6982
  var inherits$1 = inherits.exports;
5227
6983
  var EE = require$$0$5.EventEmitter;
5228
6984
  var path = require$$0$4;
5229
- var assert = assert$1;
6985
+ var assert = assert$2;
5230
6986
  var isAbsolute = pathIsAbsolute.exports;
5231
6987
  var globSync = requireSync();
5232
6988
  var common = common$c;
@@ -7409,7 +9165,7 @@ function getPackageEntryPoint(dirPath) {
7409
9165
 
7410
9166
  function isDirectory(path) {
7411
9167
  try {
7412
- if (statSync$1(path).isDirectory()) return true;
9168
+ if (statSync$2(path).isDirectory()) return true;
7413
9169
  } catch (ignored) {
7414
9170
  // Nothing to do here
7415
9171
  }
@@ -7426,11 +9182,11 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
7426
9182
  ? dynamicRequireModules.delete(targetPath)
7427
9183
  : dynamicRequireModules.set(targetPath, resolvedPath);
7428
9184
  for (const path of globExports.sync(isNegated ? pattern.substr(1) : pattern)) {
7429
- const resolvedPath = resolve$4(path);
9185
+ const resolvedPath = resolve$5(path);
7430
9186
  const requirePath = normalizePathSlashes(resolvedPath);
7431
9187
  if (isDirectory(resolvedPath)) {
7432
9188
  dirNames.add(resolvedPath);
7433
- const modulePath = resolve$4(join$1(resolvedPath, getPackageEntryPoint(path)));
9189
+ const modulePath = resolve$5(join$1(resolvedPath, getPackageEntryPoint(path)));
7434
9190
  modifyMap(requirePath, modulePath);
7435
9191
  modifyMap(normalizePathSlashes(modulePath), modulePath);
7436
9192
  } else {
@@ -7727,12 +9483,12 @@ function resolveExtensions(importee, importer, extensions) {
7727
9483
  // not our problem
7728
9484
  if (importee[0] !== '.' || !importer) return undefined;
7729
9485
 
7730
- const resolved = resolve$4(dirname$1(importer), importee);
9486
+ const resolved = resolve$5(dirname$1(importer), importee);
7731
9487
  const candidates = getCandidates(resolved, extensions);
7732
9488
 
7733
9489
  for (let i = 0; i < candidates.length; i += 1) {
7734
9490
  try {
7735
- const stats = statSync$1(candidates[i]);
9491
+ const stats = statSync$2(candidates[i]);
7736
9492
  if (stats.isFile()) return { id: candidates[i] };
7737
9493
  } catch (err) {
7738
9494
  /* noop */
@@ -9240,7 +10996,7 @@ function commonjs(options = {}) {
9240
10996
 
9241
10997
  const dynamicRequireRoot =
9242
10998
  typeof options.dynamicRequireRoot === 'string'
9243
- ? resolve$4(options.dynamicRequireRoot)
10999
+ ? resolve$5(options.dynamicRequireRoot)
9244
11000
  : process.cwd();
9245
11001
  const { commonDir, dynamicRequireModules } = getDynamicRequireModules(
9246
11002
  options.dynamicRequireTargets,
@@ -11526,11 +13282,11 @@ const normalizePath$4 = function normalizePath(filename) {
11526
13282
  };
11527
13283
 
11528
13284
  function getMatcherString(id, resolutionBase) {
11529
- if (resolutionBase === false || isAbsolute$2(id) || id.startsWith('*')) {
13285
+ if (resolutionBase === false || isAbsolute$1(id) || id.startsWith('*')) {
11530
13286
  return normalizePath$4(id);
11531
13287
  }
11532
13288
  // resolve('') is valid and will default to process.cwd()
11533
- const basePath = normalizePath$4(resolve$4(resolutionBase || ''))
13289
+ const basePath = normalizePath$4(resolve$5(resolutionBase || ''))
11534
13290
  // escape all possible (posix + win) path characters that might interfere with regex
11535
13291
  .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
11536
13292
  // Note that we use posix.join because:
@@ -11737,7 +13493,7 @@ try {
11737
13493
  catch { }
11738
13494
  const ssrExtensions = ['.js', '.cjs', '.json', '.node'];
11739
13495
  function resolveFrom(id, basedir, preserveSymlinks = false, ssr = false) {
11740
- return resolve$5.sync(id, {
13496
+ return resolve$6.sync(id, {
11741
13497
  basedir,
11742
13498
  paths: [],
11743
13499
  extensions: ssr ? ssrExtensions : DEFAULT_EXTENSIONS$1,
@@ -11853,6 +13609,7 @@ function getPotentialTsSrcPaths(filePath) {
11853
13609
  return paths;
11854
13610
  }
11855
13611
  const importQueryRE = /(\?|&)import=?(?:&|$)/;
13612
+ const directRequestRE$1 = /(\?|&)direct=?(?:&|$)/;
11856
13613
  const internalPrefixes = [
11857
13614
  FS_PREFIX,
11858
13615
  VALID_ID_PREFIX,
@@ -11866,6 +13623,9 @@ const isInternalRequest = (url) => InternalPrefixRE.test(url);
11866
13623
  function removeImportQuery(url) {
11867
13624
  return url.replace(importQueryRE, '$1').replace(trailingSeparatorRE, '');
11868
13625
  }
13626
+ function removeDirectQuery(url) {
13627
+ return url.replace(directRequestRE$1, '$1').replace(trailingSeparatorRE, '');
13628
+ }
11869
13629
  function injectQuery(url, queryToInject) {
11870
13630
  // encode percents for consistent behavior with pathToFileURL
11871
13631
  // see #2614 for details
@@ -13367,12 +15127,15 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13367
15127
  // these fields would affect the compilation result
13368
15128
  // https://esbuild.github.io/content-types/#tsconfig-json
13369
15129
  const meaningfulFields = [
13370
- 'target',
15130
+ 'alwaysStrict',
15131
+ 'importsNotUsedAsValues',
15132
+ 'jsx',
13371
15133
  'jsxFactory',
13372
15134
  'jsxFragmentFactory',
13373
- 'useDefineForClassFields',
13374
- 'importsNotUsedAsValues',
13375
- 'preserveValueImports'
15135
+ 'jsxImportSource',
15136
+ 'preserveValueImports',
15137
+ 'target',
15138
+ 'useDefineForClassFields'
13376
15139
  ];
13377
15140
  const compilerOptionsForFile = {};
13378
15141
  if (loader === 'ts' || loader === 'tsx') {
@@ -13932,10 +15695,10 @@ function makeAbsolute(cwd, filepath) {
13932
15695
  return path$g.resolve(cwd, filepath);
13933
15696
  }
13934
15697
  path$h.makeAbsolute = makeAbsolute;
13935
- function escape$2(pattern) {
15698
+ function escape$3(pattern) {
13936
15699
  return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
13937
15700
  }
13938
- path$h.escape = escape$2;
15701
+ path$h.escape = escape$3;
13939
15702
  function removeLeadingDotSegment(entry) {
13940
15703
  // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
13941
15704
  // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
@@ -33821,8 +35584,8 @@ async function urlToBuiltUrl(url, importer, config, pluginContext) {
33821
35584
  true);
33822
35585
  }
33823
35586
 
33824
- /* es-module-lexer 1.0.3 */
33825
- const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$b(E,g="@"){if(!C)return init.then((()=>parse$b(E)));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const D=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,D,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const J=[],K=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let D;C.ip()&&(D=w(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),J.push({n:D,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],D=B<0?void 0:E.slice(B,g),J=D?D[0]:"";K.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?w(I):I,ln:'"'===J||"'"===J?w(D):D});}function w(A){try{return (0, eval)(A)}catch(A){}}return [J,K,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMtLAABAQICAgICAgICAgICAgICAgAAAwMDBAQAAAADAAAAAAMDBQYAAAcABgIFBAUBcAEBAQUDAQABBg8CfwFBoPIAC38AQaDyAAsHcBMGbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJhaQAIAmlkAAkCaXAACgJlcwALAmVlAAwDZWxzAA0DZWxlAA4CcmkADwJyZQAQAWYAEQVwYXJzZQASC19faGVhcF9iYXNlAwEKsTcsaAEBf0EAIAA2AugJQQAoAsQJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgLsCUEAIAA2AvAJQQBBADYCyAlBAEEANgLYCUEAQQA2AtAJQQBBADYCzAlBAEEANgLgCUEAQQA2AtQJIAELnwEBA39BACgC2AkhBEEAQQAoAvAJIgU2AtgJQQAgBDYC3AlBACAFQSBqNgLwCSAEQRxqQcgJIAQbIAU2AgBBACgCvAkhBEEAKAK4CSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGGyAEIANGGzYCDCAFIAM2AhQgBUEANgIQIAUgAjYCBCAFQQA2AhwgBUEAKAK4CSADRjoAGAtWAQF/QQAoAuAJIgRBEGpBzAkgBBtBACgC8AkiBDYCAEEAIAQ2AuAJQQAgBEEUajYC8AkgBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAL0CQsVAEEAKALQCSgCAEEAKALECWtBAXULHgEBf0EAKALQCSgCBCIAQQAoAsQJa0EBdUF/IAAbCxUAQQAoAtAJKAIIQQAoAsQJa0EBdQseAQF/QQAoAtAJKAIMIgBBACgCxAlr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KAkBBARAmQfsARg0AQQAgATYClAoPC0EAKAKUCiICIQADQEEAIABBAmo2ApQKAkACQAJAQQEQJiIAQSJGDQAgAEEnRw0BQScQGEEAQQAoApQKQQJqNgKUCkEBECYhAAwCC0EiEBhBAEEAKAKUCkECajYClApBARAmIQAMAQsgABAoIQALAkAgAEE6Rg0AQQAgATYClAoPC0EAQQAoApQKQQJqNgKUCgJAQQEQJiIAQSJGDQAgAEEnRg0AQQAgATYClAoPCyAAEBhBAEEAKAKUCkECajYClAoCQAJAQQEQJiIAQSxGDQAgAEH9AEYNAUEAIAE2ApQKDwtBAEEAKAKUCkECajYClApBARAmQf0ARg0AQQAoApQKIQAMAQsLQQAoAtgJIgEgAjYCECABQQAoApQKQQJqNgIMC20BAn8CQAJAA0ACQCAAQf//A3EiAUF3aiICQRdLDQBBASACdEGfgIAEcQ0CCyABQaABRg0BIAAhAiABECUNAkEAIQJBAEEAKAKUCiIAQQJqNgKUCiAALwECIgANAAwCCwsgACECCyACQf//A3ELqwEBBH8CQAJAQQAoApQKIgIvAQAiA0HhAEYNACABIQQgACEFDAELQQAgAkEEajYClApBARAmIQJBACgClAohBQJAAkAgAkEiRg0AIAJBJ0YNACACECgaQQAoApQKIQQMAQsgAhAYQQBBACgClApBAmoiBDYClAoLQQEQJiEDQQAoApQKIQILAkAgAiAFRg0AIAUgBEEAIAAgACABRiICG0EAIAEgAhsQAgsgAwtyAQR/QQAoApQKIQBBACgCmAohAQJAAkADQCAAQQJqIQIgACABTw0BAkACQCACLwEAIgNBpH9qDgIBBAALIAIhACADQXZqDgQCAQECAQsgAEEEaiEADAALC0EAIAI2ApQKECJBAA8LQQAgAjYClApB3QALSQEDf0EAIQMCQCACRQ0AAkADQCAALQAAIgQgAS0AACIFRw0BIAFBAWohASAAQQFqIQAgAkF/aiICDQAMAgsLIAQgBWshAwsgAwsL1gECAEGACAu4AQAAeABwAG8AcgB0AG0AcABvAHIAdABlAHQAYQBmAHIAbwBtAHMAcwBlAHIAdAB2AG8AeQBpAGUAZABlAGwAZQBjAG8AbgB0AGkAbgBpAG4AcwB0AGEAbgB0AHkAYgByAGUAYQByAGUAdAB1AHIAZABlAGIAdQBnAGcAZQBhAHcAYQBpAHQAaAByAHcAaABpAGwAZQBmAG8AcgBpAGYAYwBhAHQAYwBmAGkAbgBhAGwAbABlAGwAcwAAQbgJCxABAAAAAgAAAAAEAAAgOQAA","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),(A=>A.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
35587
+ /* es-module-lexer 1.0.5 */
35588
+ const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$b(E,g="@"){if(!C)return init.then((()=>parse$b(E)));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const k=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let K;C.ip()&&(K=w(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),k.push({n:K,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],K=B<0?void 0:E.slice(B,g),k=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?w(I):I,ln:'"'===k||"'"===k?w(K):K});}function w(A){try{return (0, eval)(A)}catch(A){}}return [k,D,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<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AILCyAAIQILIAJB//8DcQurAQEEfwJAAkBBACgCpAoiAi8BACIDQeEARg0AIAEhBCAAIQUMAQtBACACQQRqNgKkCkEBECYhAkEAKAKkCiEFAkACQCACQSJGDQAgAkEnRg0AIAIQKBpBACgCpAohBAwBCyACEBhBAEEAKAKkCkECaiIENgKkCgtBARAmIQNBACgCpAohAgsCQCACIAVGDQAgBSAEQQAgACAAIAFGIgIbQQAgASACGxACCyADC3IBBH9BACgCpAohAEEAKAKoCiEBAkACQANAIABBAmohAiAAIAFPDQECQAJAIAIvAQAiA0Gkf2oOAgEEAAsgAiEAIANBdmoOBAIBAQIBCyAAQQRqIQAMAAsLQQAgAjYCpAoQIkEADwtBACACNgKkCkHdAAtJAQN/QQAhAwJAIAJFDQACQANAIAAtAAAiBCABLQAAIgVHDQEgAUEBaiEBIABBAWohACACQX9qIgINAAwCCwsgBCAFayEDCyADCwvkAQIAQYAIC8YBAAB4AHAAbwByAHQAbQBwAG8AcgB0AGUAdABhAGYAcgBvAG0AdQBuAGMAdABpAG8AbgBzAHMAZQByAHQAdgBvAHkAaQBlAGQAZQBsAGUAYwBvAG4AdABpAG4AaQBuAHMAdABhAG4AdAB5AGIAcgBlAGEAcgBlAHQAdQByAGQAZQBiAHUAZwBnAGUAYQB3AGEAaQB0AGgAcgB3AGgAaQBsAGUAZgBvAHIAaQBmAGMAYQB0AGMAZgBpAG4AYQBsAGwAZQBsAHMAAEHICQsQAQAAAAIAAAAABAAAMDkAAA==","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),(A=>A.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
33826
35589
 
33827
35590
  /**
33828
35591
  * @param {object} exports
@@ -34011,7 +35774,7 @@ createError(
34011
35774
  (pkgPath, key, target, isImport = false, base = void 0) => {
34012
35775
  const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
34013
35776
  if (key === ".") {
34014
- assert$1(isImport === false);
35777
+ assert$2(isImport === false);
34015
35778
  return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
34016
35779
  }
34017
35780
  return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
@@ -34057,7 +35820,7 @@ createError(
34057
35820
  createError(
34058
35821
  "ERR_INVALID_ARG_VALUE",
34059
35822
  (name, value, reason = "is invalid") => {
34060
- let inspected = inspect(value);
35823
+ let inspected = inspect$1(value);
34061
35824
  if (inspected.length > 128) {
34062
35825
  inspected = `${inspected.slice(0, 128)}...`;
34063
35826
  }
@@ -34158,14 +35921,14 @@ const captureLargerStackTrace = hideStackFrames(
34158
35921
  function getMessage(key, args, self) {
34159
35922
  const message = messages.get(key);
34160
35923
  if (typeof message === "function") {
34161
- assert$1(
35924
+ assert$2(
34162
35925
  message.length <= args.length,
34163
35926
  `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`
34164
35927
  );
34165
35928
  return Reflect.apply(message, self, args);
34166
35929
  }
34167
35930
  const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
34168
- assert$1(
35931
+ assert$2(
34169
35932
  expectedLength === args.length,
34170
35933
  `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
34171
35934
  );
@@ -34173,7 +35936,7 @@ function getMessage(key, args, self) {
34173
35936
  return message;
34174
35937
  }
34175
35938
  args.unshift(message);
34176
- return Reflect.apply(format$2, null, args);
35939
+ return Reflect.apply(format$3, null, args);
34177
35940
  }
34178
35941
  Object.freeze(["node", "import"]);
34179
35942
  pathToFileURL$1(process.cwd());
@@ -34968,12 +36731,24 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
34968
36731
  if (nestedRoot) {
34969
36732
  basedir = nestedResolveFrom(nestedRoot, basedir, preserveSymlinks);
34970
36733
  }
36734
+ // nearest package.json
36735
+ let nearestPkg;
36736
+ // nearest package.json that may have the `exports` field
34971
36737
  let pkg;
34972
- const pkgId = possiblePkgIds.reverse().find((pkgId) => {
34973
- pkg = resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache);
34974
- return pkg;
36738
+ let pkgId = possiblePkgIds.reverse().find((pkgId) => {
36739
+ nearestPkg = resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache);
36740
+ return nearestPkg;
34975
36741
  });
34976
- if (!pkg) {
36742
+ const rootPkgId = possiblePkgIds[0];
36743
+ const rootPkg = resolvePackageData(rootPkgId, basedir, preserveSymlinks, packageCache);
36744
+ if (rootPkg?.data?.exports) {
36745
+ pkg = rootPkg;
36746
+ pkgId = rootPkgId;
36747
+ }
36748
+ else {
36749
+ pkg = nearestPkg;
36750
+ }
36751
+ if (!pkg || !nearestPkg) {
34977
36752
  // if import can't be found, check if it's an optional peer dep.
34978
36753
  // if so, we can resolve to a special id that errors only when imported.
34979
36754
  if (basedir !== root && // root has no peer dep
@@ -35060,7 +36835,7 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
35060
36835
  });
35061
36836
  }
35062
36837
  const ext = path$n.extname(resolved);
35063
- const isCJS = ext === '.cjs' || (ext === '.js' && pkg.data.type !== 'module');
36838
+ const isCJS = ext === '.cjs' || (ext === '.js' && nearestPkg.data.type !== 'module');
35064
36839
  if (!options.ssrOptimizeCheck &&
35065
36840
  (!resolved.includes('node_modules') || // linked
35066
36841
  !depsOptimizer || // resolving before listening to the server
@@ -35541,8 +37316,7 @@ function esbuildDepPlugin(qualified, exportsData, external, config, ssr) {
35541
37316
  const flatId = flattenId(id);
35542
37317
  if (flatId in qualified) {
35543
37318
  return {
35544
- path: flatId,
35545
- namespace: 'dep'
37319
+ path: qualified[flatId]
35546
37320
  };
35547
37321
  }
35548
37322
  }
@@ -35571,43 +37345,6 @@ function esbuildDepPlugin(qualified, exportsData, external, config, ssr) {
35571
37345
  return resolveResult(id, resolved);
35572
37346
  }
35573
37347
  });
35574
- // For entry files, we'll read it ourselves and construct a proxy module
35575
- // to retain the entry's raw id instead of file path so that esbuild
35576
- // outputs desired output file structure.
35577
- // It is necessary to do the re-exporting to separate the virtual proxy
35578
- // module from the actual module since the actual module may get
35579
- // referenced via relative imports - if we don't separate the proxy and
35580
- // the actual module, esbuild will create duplicated copies of the same
35581
- // module!
35582
- const root = path$n.resolve(config.root);
35583
- build.onLoad({ filter: /.*/, namespace: 'dep' }, ({ path: id }) => {
35584
- const entryFile = qualified[id];
35585
- let relativePath = normalizePath$3(path$n.relative(root, entryFile));
35586
- if (!relativePath.startsWith('./') &&
35587
- !relativePath.startsWith('../') &&
35588
- relativePath !== '.') {
35589
- relativePath = `./${relativePath}`;
35590
- }
35591
- let contents = '';
35592
- const { hasImports, exports, hasReExports } = exportsData[id];
35593
- if (!hasImports && !exports.length) {
35594
- // cjs
35595
- contents += `export default require("${relativePath}");`;
35596
- }
35597
- else {
35598
- if (exports.includes('default')) {
35599
- contents += `import d from "${relativePath}";export default d;`;
35600
- }
35601
- if (hasReExports || exports.length > 1 || exports[0] !== 'default') {
35602
- contents += `\nexport * from "${relativePath}"`;
35603
- }
35604
- }
35605
- return {
35606
- loader: 'js',
35607
- contents,
35608
- resolveDir: root
35609
- };
35610
- });
35611
37348
  build.onLoad({ filter: /.*/, namespace: 'browser-external' }, ({ path }) => {
35612
37349
  if (config.isProduction) {
35613
37350
  return {
@@ -36497,7 +38234,7 @@ async function toAbsoluteGlob(glob, root, importer, resolveId) {
36497
38234
  if (glob.startsWith('**'))
36498
38235
  return pre + glob;
36499
38236
  const resolved = normalizePath$3((await resolveId(glob, importer)) || glob);
36500
- if (isAbsolute$3(resolved)) {
38237
+ if (isAbsolute$2(resolved)) {
36501
38238
  return pre + globSafeResolvedPath(resolved, glob);
36502
38239
  }
36503
38240
  throw new Error(`Invalid glob: "${glob}" (resolved: "${resolved}"). It must start with '/' or './'`);
@@ -37066,78 +38803,9 @@ function stattag (stat) {
37066
38803
 
37067
38804
  var convertSourceMap = {};
37068
38805
 
37069
- var safeBuffer = {exports: {}};
37070
-
37071
- /* eslint-disable node/no-deprecated-api */
37072
-
37073
- (function (module, exports) {
37074
- var buffer = require$$0$a;
37075
- var Buffer = buffer.Buffer;
37076
-
37077
- // alternative to using Object.keys for old browsers
37078
- function copyProps (src, dst) {
37079
- for (var key in src) {
37080
- dst[key] = src[key];
37081
- }
37082
- }
37083
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
37084
- module.exports = buffer;
37085
- } else {
37086
- // Copy properties from require('buffer')
37087
- copyProps(buffer, exports);
37088
- exports.Buffer = SafeBuffer;
37089
- }
37090
-
37091
- function SafeBuffer (arg, encodingOrOffset, length) {
37092
- return Buffer(arg, encodingOrOffset, length)
37093
- }
37094
-
37095
- // Copy static methods from Buffer
37096
- copyProps(Buffer, SafeBuffer);
37097
-
37098
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
37099
- if (typeof arg === 'number') {
37100
- throw new TypeError('Argument must not be a number')
37101
- }
37102
- return Buffer(arg, encodingOrOffset, length)
37103
- };
37104
-
37105
- SafeBuffer.alloc = function (size, fill, encoding) {
37106
- if (typeof size !== 'number') {
37107
- throw new TypeError('Argument must be a number')
37108
- }
37109
- var buf = Buffer(size);
37110
- if (fill !== undefined) {
37111
- if (typeof encoding === 'string') {
37112
- buf.fill(fill, encoding);
37113
- } else {
37114
- buf.fill(fill);
37115
- }
37116
- } else {
37117
- buf.fill(0);
37118
- }
37119
- return buf
37120
- };
37121
-
37122
- SafeBuffer.allocUnsafe = function (size) {
37123
- if (typeof size !== 'number') {
37124
- throw new TypeError('Argument must be a number')
37125
- }
37126
- return Buffer(size)
37127
- };
37128
-
37129
- SafeBuffer.allocUnsafeSlow = function (size) {
37130
- if (typeof size !== 'number') {
37131
- throw new TypeError('Argument must be a number')
37132
- }
37133
- return buffer.SlowBuffer(size)
37134
- };
37135
- } (safeBuffer, safeBuffer.exports));
37136
-
37137
38806
  (function (exports) {
37138
38807
  var fs = require$$0__default;
37139
38808
  var path = require$$0$4;
37140
- var SafeBuffer = safeBuffer.exports;
37141
38809
 
37142
38810
  Object.defineProperty(exports, 'commentRegex', {
37143
38811
  get: function getCommentRegex () {
@@ -37152,9 +38820,30 @@ var safeBuffer = {exports: {}};
37152
38820
  }
37153
38821
  });
37154
38822
 
38823
+ var decodeBase64;
38824
+ if (typeof Buffer !== 'undefined') {
38825
+ if (typeof Buffer.from === 'function') {
38826
+ decodeBase64 = decodeBase64WithBufferFrom;
38827
+ } else {
38828
+ decodeBase64 = decodeBase64WithNewBuffer;
38829
+ }
38830
+ } else {
38831
+ decodeBase64 = decodeBase64WithAtob;
38832
+ }
38833
+
38834
+ function decodeBase64WithBufferFrom(base64) {
38835
+ return Buffer.from(base64, 'base64').toString();
38836
+ }
38837
+
38838
+ function decodeBase64WithNewBuffer(base64) {
38839
+ if (typeof value === 'number') {
38840
+ throw new TypeError('The value to decode must not be of type number.');
38841
+ }
38842
+ return new Buffer(base64, 'base64').toString();
38843
+ }
37155
38844
 
37156
- function decodeBase64(base64) {
37157
- return (SafeBuffer.Buffer.from(base64, 'base64') || "").toString();
38845
+ function decodeBase64WithAtob(base64) {
38846
+ return decodeURIComponent(escape(atob(base64)));
37158
38847
  }
37159
38848
 
37160
38849
  function stripComment(sm) {
@@ -37192,10 +38881,33 @@ var safeBuffer = {exports: {}};
37192
38881
  return JSON.stringify(this.sourcemap, null, space);
37193
38882
  };
37194
38883
 
37195
- Converter.prototype.toBase64 = function () {
38884
+ if (typeof Buffer !== 'undefined') {
38885
+ if (typeof Buffer.from === 'function') {
38886
+ Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
38887
+ } else {
38888
+ Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
38889
+ }
38890
+ } else {
38891
+ Converter.prototype.toBase64 = encodeBase64WithBtoa;
38892
+ }
38893
+
38894
+ function encodeBase64WithBufferFrom() {
37196
38895
  var json = this.toJSON();
37197
- return (SafeBuffer.Buffer.from(json, 'utf8') || "").toString('base64');
37198
- };
38896
+ return Buffer.from(json, 'utf8').toString('base64');
38897
+ }
38898
+
38899
+ function encodeBase64WithNewBuffer() {
38900
+ var json = this.toJSON();
38901
+ if (typeof json === 'number') {
38902
+ throw new TypeError('The json to encode must not be of type number.');
38903
+ }
38904
+ return new Buffer(json, 'utf8').toString('base64');
38905
+ }
38906
+
38907
+ function encodeBase64WithBtoa() {
38908
+ var json = this.toJSON();
38909
+ return btoa(unescape(encodeURIComponent(json)));
38910
+ }
37199
38911
 
37200
38912
  Converter.prototype.toComment = function (options) {
37201
38913
  var base64 = this.toBase64();
@@ -37273,12 +38985,12 @@ var safeBuffer = {exports: {}};
37273
38985
  } (convertSourceMap));
37274
38986
 
37275
38987
  function totalist(dir, callback, pre='') {
37276
- dir = resolve$4('.', dir);
38988
+ dir = resolve$5('.', dir);
37277
38989
  let arr = readdirSync(dir);
37278
38990
  let i=0, abs, stats;
37279
38991
  for (; i < arr.length; i++) {
37280
38992
  abs = join$1(dir, arr[i]);
37281
- stats = statSync$1(abs);
38993
+ stats = statSync$2(abs);
37282
38994
  stats.isDirectory()
37283
38995
  ? totalist(abs, callback, join$1(pre, arr[i]))
37284
38996
  : callback(join$1(pre, arr[i]), abs, stats);
@@ -37432,7 +39144,7 @@ function toHeaders(name, stats, isEtag) {
37432
39144
  }
37433
39145
 
37434
39146
  function sirv (dir, opts={}) {
37435
- dir = resolve$4(dir || '.');
39147
+ dir = resolve$5(dir || '.');
37436
39148
 
37437
39149
  let isNotFound = opts.onNoMatch || is404;
37438
39150
  let setHeaders = opts.setHeaders || noop$2;
@@ -39484,7 +41196,7 @@ const lexStates = {
39484
41196
  switch (c) {
39485
41197
  case '\\':
39486
41198
  read();
39487
- buffer += escape$1();
41199
+ buffer += escape$2();
39488
41200
  return
39489
41201
 
39490
41202
  case '"':
@@ -39639,7 +41351,7 @@ function literal (s) {
39639
41351
  }
39640
41352
  }
39641
41353
 
39642
- function escape$1 () {
41354
+ function escape$2 () {
39643
41355
  const c = peek();
39644
41356
  switch (c) {
39645
41357
  case 'b':
@@ -40957,8 +42669,9 @@ function prepareError(err) {
40957
42669
  function buildErrorMessage(err, args = [], includeStack = true) {
40958
42670
  if (err.plugin)
40959
42671
  args.push(` Plugin: ${picocolors.exports.magenta(err.plugin)}`);
42672
+ const loc = err.loc ? `:${err.loc.line}:${err.loc.column}` : '';
40960
42673
  if (err.id)
40961
- args.push(` File: ${picocolors.exports.cyan(err.id)}`);
42674
+ args.push(` File: ${picocolors.exports.cyan(err.id)}${loc}`);
40962
42675
  if (err.frame)
40963
42676
  args.push(picocolors.exports.yellow(pad$1(err.frame)));
40964
42677
  if (includeStack && err.stack)
@@ -41042,7 +42755,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
41042
42755
  // TODO: use import()
41043
42756
  const _require = createRequire$1(import.meta.url);
41044
42757
  // get rollup version
41045
- const rollupPkgPath = resolve$6(_require.resolve('rollup'), '../../package.json');
42758
+ const rollupPkgPath = resolve$7(_require.resolve('rollup'), '../../package.json');
41046
42759
  const minimalContext = {
41047
42760
  meta: {
41048
42761
  rollupVersion: JSON.parse(fs$l.readFileSync(rollupPkgPath, 'utf-8'))
@@ -43811,6 +45524,9 @@ function handleParseError(parserError, html, filePath) {
43811
45524
  // Accept duplicate attributes #9566
43812
45525
  // The first attribute is used, browsers silently ignore duplicates
43813
45526
  return;
45527
+ case 'non-void-html-element-start-tag-with-trailing-solidus':
45528
+ // Allow self closing on non-void elements #10439
45529
+ return;
43814
45530
  }
43815
45531
  const parseError = {
43816
45532
  loc: filePath,
@@ -44753,12 +46469,11 @@ function cssPostPlugin(config) {
44753
46469
  }
44754
46470
  else if (!config.build.ssr) {
44755
46471
  // legacy build and inline css
44756
- // the legacy build should avoid inserting entry CSS modules here, they
44757
- // will be collected into `chunk.viteMetadata.importedCss` and injected
44758
- // later by the `'vite:build-html'` plugin into the `index.html`
44759
- if (chunk.isEntry && !config.build.lib) {
44760
- return null;
44761
- }
46472
+ // Entry chunk CSS will be collected into `chunk.viteMetadata.importedCss`
46473
+ // and injected later by the `'vite:build-html'` plugin into the `index.html`
46474
+ // so it will be duplicated. (https://github.com/vitejs/vite/issues/2062#issuecomment-782388010)
46475
+ // But because entry chunk can be imported by dynamic import,
46476
+ // we shouldn't remove the inlined CSS. (#10285)
44762
46477
  chunkCSS = await finalizeCss(chunkCSS, true, config);
44763
46478
  let cssString = JSON.stringify(chunkCSS);
44764
46479
  cssString =
@@ -44950,7 +46665,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
44950
46665
  }
44951
46666
  const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
44952
46667
  if (needInlineImport) {
44953
- postcssPlugins.unshift((await import('./dep-39e6741e.js').then(function (n) { return n.i; })).default({
46668
+ postcssPlugins.unshift((await import('./dep-9deb2354.js').then(function (n) { return n.i; })).default({
44954
46669
  async resolve(id, basedir) {
44955
46670
  const publicFile = checkPublicFile(id, config);
44956
46671
  if (publicFile) {
@@ -44972,7 +46687,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
44972
46687
  logger: config.logger
44973
46688
  }));
44974
46689
  if (isModule) {
44975
- postcssPlugins.unshift((await import('./dep-46ac452b.js').then(function (n) { return n.i; })).default({
46690
+ postcssPlugins.unshift((await import('./dep-ea6d21e3.js').then(function (n) { return n.i; })).default({
44976
46691
  ...modulesOptions,
44977
46692
  getJSON(cssFileName, _modules, outputFileName) {
44978
46693
  modules = _modules;
@@ -44999,13 +46714,14 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
44999
46714
  }
45000
46715
  let postcssResult;
45001
46716
  try {
46717
+ const source = removeDirectQuery(id);
45002
46718
  // postcss is an unbundled dep and should be lazy imported
45003
46719
  postcssResult = await (await import('postcss'))
45004
46720
  .default(postcssPlugins)
45005
46721
  .process(code, {
45006
46722
  ...postcssOptions,
45007
- to: id,
45008
- from: id,
46723
+ to: source,
46724
+ from: source,
45009
46725
  ...(devSourcemap
45010
46726
  ? {
45011
46727
  map: {
@@ -53825,7 +55541,7 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
53825
55541
  preserveSymlinks,
53826
55542
  isBuild: true,
53827
55543
  isProduction,
53828
- isRequire: true,
55544
+ isRequire: false,
53829
55545
  root
53830
55546
  };
53831
55547
  // Since dynamic imports can happen in parallel, we need to
@@ -53896,6 +55612,11 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
53896
55612
  }
53897
55613
  return Object.freeze(ssrModule);
53898
55614
  }
55615
+ // `nodeImport` may run in parallel on multiple `ssrLoadModule` calls.
55616
+ // We keep track of the current importing count so that the first import
55617
+ // would `hookNodeResolve`, and the last import would `unhookNodeResolve`.
55618
+ let importingCount = 0;
55619
+ let unhookNodeResolve;
53899
55620
  // In node@12+ we can use dynamic import to load CJS and ESM
53900
55621
  async function nodeImport(id, importer, resolveOptions) {
53901
55622
  // Node's module resolution is hi-jacked so Vite can ensure the
@@ -53909,30 +55630,32 @@ async function nodeImport(id, importer, resolveOptions) {
53909
55630
  }
53910
55631
  return resolved.id;
53911
55632
  };
53912
- // When an ESM module imports an ESM dependency, this hook is *not* used.
53913
- const unhookNodeResolve = hookNodeResolve((nodeResolve) => (id, parent, isMain, options) => {
53914
- // Use the Vite resolver only for bare imports while skipping
53915
- // any absolute paths, built-in modules and binary modules.
53916
- if (!bareImportRE.test(id) ||
53917
- path$n.isAbsolute(id) ||
53918
- isBuiltin(id) ||
53919
- id.endsWith('.node')) {
53920
- return nodeResolve(id, parent, isMain, options);
53921
- }
53922
- if (parent) {
53923
- let resolved = viteResolve(id, parent.id);
53924
- if (resolved) {
53925
- // hookNodeResolve must use platform-specific path.normalize
53926
- // to be compatible with dynamicImport (#6080)
53927
- resolved = path$n.normalize(resolved);
55633
+ if (importingCount === 0) {
55634
+ // When an ESM module imports an ESM dependency, this hook is *not* used.
55635
+ unhookNodeResolve = hookNodeResolve((nodeResolve) => (id, parent, isMain, options) => {
55636
+ // Use the Vite resolver only for bare imports while skipping
55637
+ // any absolute paths, built-in modules and binary modules.
55638
+ if (!bareImportRE.test(id) ||
55639
+ path$n.isAbsolute(id) ||
55640
+ isBuiltin(id) ||
55641
+ id.endsWith('.node')) {
55642
+ return nodeResolve(id, parent, isMain, options);
55643
+ }
55644
+ if (parent) {
55645
+ let resolved = viteResolve(id, parent.id);
55646
+ if (resolved) {
55647
+ // hookNodeResolve must use platform-specific path.normalize
55648
+ // to be compatible with dynamicImport (#6080)
55649
+ resolved = path$n.normalize(resolved);
55650
+ }
55651
+ return resolved;
53928
55652
  }
53929
- return resolved;
53930
- }
53931
- // Importing a CJS module from an ESM module. In this case, the import
53932
- // specifier is already an absolute path, so this is a no-op.
53933
- // Options like `resolve.dedupe` and `mode` are not respected.
53934
- return id;
53935
- });
55653
+ // Importing a CJS module from an ESM module. In this case, the import
55654
+ // specifier is already an absolute path, so this is a no-op.
55655
+ // Options like `resolve.dedupe` and `mode` are not respected.
55656
+ return id;
55657
+ });
55658
+ }
53936
55659
  let url;
53937
55660
  if (id.startsWith('node:') || isBuiltin(id)) {
53938
55661
  url = id;
@@ -53950,11 +55673,15 @@ async function nodeImport(id, importer, resolveOptions) {
53950
55673
  }
53951
55674
  }
53952
55675
  try {
55676
+ importingCount++;
53953
55677
  const mod = await dynamicImport(url);
53954
55678
  return proxyESM(mod);
53955
55679
  }
53956
55680
  finally {
53957
- unhookNodeResolve();
55681
+ importingCount--;
55682
+ if (importingCount === 0) {
55683
+ unhookNodeResolve?.();
55684
+ }
53958
55685
  }
53959
55686
  }
53960
55687
  // rollup-style default import interop for cjs
@@ -54174,7 +55901,7 @@ class Limiter$1 {
54174
55901
 
54175
55902
  var limiter = Limiter$1;
54176
55903
 
54177
- const zlib = require$$0$b;
55904
+ const zlib = require$$0$a;
54178
55905
 
54179
55906
  const bufferUtil = bufferUtil$1.exports;
54180
55907
  const Limiter = limiter;
@@ -59303,7 +61030,7 @@ var URL$1 = url.URL;
59303
61030
  var http$1 = require$$1$2;
59304
61031
  var https$1 = require$$1$3;
59305
61032
  var Writable = require$$0$7.Writable;
59306
- var assert = assert$1;
61033
+ var assert = assert$2;
59307
61034
  var debug$2 = debug_1;
59308
61035
 
59309
61036
  // Create handlers that pass events from native requests
@@ -60538,7 +62265,7 @@ function proxyMiddleware(httpServer, options, config) {
60538
62265
  // When it is ws proxy, res is net.Socket
60539
62266
  const res = originalRes;
60540
62267
  if ('req' in res) {
60541
- config.logger.error(`${picocolors.exports.red(`http proxy error:`)}\n${err.stack}`, {
62268
+ config.logger.error(`${picocolors.exports.red(`http proxy error at ${originalRes.req.url}:`)}\n${err.stack}`, {
60542
62269
  timestamp: true,
60543
62270
  error: err
60544
62271
  });
@@ -62208,7 +63935,7 @@ var readShebang_1 = readShebang$1;
62208
63935
 
62209
63936
  const path$1 = require$$0$4;
62210
63937
  const resolveCommand = resolveCommand_1;
62211
- const escape = _escape;
63938
+ const escape$1 = _escape;
62212
63939
  const readShebang = readShebang_1;
62213
63940
 
62214
63941
  const isWin$1 = process.platform === 'win32';
@@ -62255,8 +63982,8 @@ function parseNonShell(parsed) {
62255
63982
  parsed.command = path$1.normalize(parsed.command);
62256
63983
 
62257
63984
  // Escape command & arguments
62258
- parsed.command = escape.command(parsed.command);
62259
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
63985
+ parsed.command = escape$1.command(parsed.command);
63986
+ parsed.args = parsed.args.map((arg) => escape$1.argument(arg, needsDoubleEscapeMetaChars));
62260
63987
 
62261
63988
  const shellCommand = [parsed.command].concat(parsed.args).join(' ');
62262
63989
 
@@ -62438,18 +64165,31 @@ function startBrowserProcess(browser, url) {
62438
64165
  // existing tab when possible instead of creating a new one.
62439
64166
  const shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' && (browser === '' || browser === OSX_CHROME);
62440
64167
  if (shouldTryOpenChromeWithAppleScript) {
62441
- try {
62442
- // Try our best to reuse existing tab
62443
- // on OS X Google Chrome with AppleScript
62444
- execSync('ps cax | grep "Google Chrome"');
62445
- execSync('osascript openChrome.applescript "' + encodeURI(url) + '"', {
62446
- cwd: join$2(VITE_PACKAGE_DIR, 'bin'),
62447
- stdio: 'ignore'
62448
- });
62449
- return true;
62450
- }
62451
- catch (err) {
62452
- // Ignore errors
64168
+ // Will use the first open browser found from list
64169
+ const supportedChromiumBrowsers = [
64170
+ 'Google Chrome Canary',
64171
+ 'Google Chrome Dev',
64172
+ 'Google Chrome Beta',
64173
+ 'Google Chrome',
64174
+ 'Microsoft Edge',
64175
+ 'Brave Browser',
64176
+ 'Vivaldi',
64177
+ 'Chromium'
64178
+ ];
64179
+ for (const chromiumBrowser of supportedChromiumBrowsers) {
64180
+ try {
64181
+ // Try our best to reuse existing tab
64182
+ // on OS X Google Chrome with AppleScript
64183
+ execSync(`ps cax | grep "${chromiumBrowser}"`);
64184
+ execSync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
64185
+ cwd: join$2(VITE_PACKAGE_DIR, 'bin'),
64186
+ stdio: 'ignore'
64187
+ });
64188
+ return true;
64189
+ }
64190
+ catch (err) {
64191
+ // Ignore errors
64192
+ }
62453
64193
  }
62454
64194
  }
62455
64195
  // Another special case: on OS X, check if BROWSER has been set to "open".
@@ -62582,6 +64322,11 @@ async function createServer(inlineConfig = {}) {
62582
64322
  ssrRewriteStacktrace(stack) {
62583
64323
  return ssrRewriteStacktrace(stack, moduleGraph);
62584
64324
  },
64325
+ async reloadModule(module) {
64326
+ if (serverConfig.hmr !== false && module.file) {
64327
+ updateModules(module.file, [module], Date.now(), server);
64328
+ }
64329
+ },
62585
64330
  async listen(port, isRestart) {
62586
64331
  await startServer(server, port, isRestart);
62587
64332
  if (httpServer) {
@@ -63490,10 +65235,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
63490
65235
  // user config may provide an alternative mode. But --mode has a higher priority
63491
65236
  mode = inlineConfig.mode || config.mode || mode;
63492
65237
  configEnv.mode = mode;
63493
- // Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
63494
- // And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
63495
- // So we need to separate the worker plugin from the plugin that vite needs to run.
63496
- const rawWorkerUserPlugins = (await asyncFlatten(config.worker?.plugins || [])).filter((p) => {
65238
+ const filterPlugin = (p) => {
63497
65239
  if (!p) {
63498
65240
  return false;
63499
65241
  }
@@ -63506,22 +65248,13 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
63506
65248
  else {
63507
65249
  return p.apply === command;
63508
65250
  }
63509
- });
65251
+ };
65252
+ // Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
65253
+ // And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
65254
+ // So we need to separate the worker plugin from the plugin that vite needs to run.
65255
+ const rawWorkerUserPlugins = (await asyncFlatten(config.worker?.plugins || [])).filter(filterPlugin);
63510
65256
  // resolve plugins
63511
- const rawUserPlugins = (await asyncFlatten(config.plugins || [])).filter((p) => {
63512
- if (!p) {
63513
- return false;
63514
- }
63515
- else if (!p.apply) {
63516
- return true;
63517
- }
63518
- else if (typeof p.apply === 'function') {
63519
- return p.apply({ ...config, mode }, configEnv);
63520
- }
63521
- else {
63522
- return p.apply === command;
63523
- }
63524
- });
65257
+ const rawUserPlugins = (await asyncFlatten(config.plugins || [])).filter(filterPlugin);
63525
65258
  const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(rawUserPlugins);
63526
65259
  // run config hooks
63527
65260
  const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins];
@@ -63895,6 +65628,7 @@ async function bundleConfigFile(fileName, isESM) {
63895
65628
  platform: 'node',
63896
65629
  bundle: true,
63897
65630
  format: isESM ? 'esm' : 'cjs',
65631
+ mainFields: ['main'],
63898
65632
  sourcemap: 'inline',
63899
65633
  metafile: true,
63900
65634
  define: {
@@ -63906,32 +65640,27 @@ async function bundleConfigFile(fileName, isESM) {
63906
65640
  {
63907
65641
  name: 'externalize-deps',
63908
65642
  setup(build) {
63909
- const options = {
63910
- root: path$n.dirname(fileName),
63911
- isBuild: true,
63912
- isProduction: true,
63913
- isRequire: !isESM,
63914
- preferRelative: false,
63915
- tryIndex: true,
63916
- mainFields: [],
63917
- browserField: false,
63918
- conditions: [],
63919
- dedupe: [],
63920
- extensions: DEFAULT_EXTENSIONS$1,
63921
- preserveSymlinks: false
63922
- };
63923
- build.onResolve({ filter: /.*/ }, ({ path: id, importer, kind }) => {
63924
- // externalize bare imports
63925
- if (id[0] !== '.' && !isAbsolute(id)) {
63926
- let idFsPath = tryNodeResolve(id, importer, options, false)?.id;
63927
- if (idFsPath && (isESM || kind === 'dynamic-import')) {
63928
- idFsPath = pathToFileURL(idFsPath).href;
63929
- }
63930
- return {
63931
- path: idFsPath,
63932
- external: true
63933
- };
65643
+ // externalize bare imports
65644
+ build.onResolve({ filter: /^[^.].*/ }, async ({ path: id, importer, kind }) => {
65645
+ if (kind === 'entry-point' || path$n.isAbsolute(id)) {
65646
+ return;
63934
65647
  }
65648
+ // partial deno support as `npm:` does not work with esbuild
65649
+ if (id.startsWith('npm:')) {
65650
+ return { external: true };
65651
+ }
65652
+ const resolveWithRequire = kind === 'require-call' ||
65653
+ kind === 'require-resolve' ||
65654
+ (kind === 'import-statement' && !isESM);
65655
+ let resolved;
65656
+ if (resolveWithRequire) {
65657
+ const require = createRequire$1(importer);
65658
+ resolved = require.resolve(id);
65659
+ }
65660
+ else {
65661
+ resolved = await resolve$4(id, pathToFileURL(importer).href);
65662
+ }
65663
+ return { path: resolved, external: true };
63935
65664
  });
63936
65665
  }
63937
65666
  },
@@ -64025,8 +65754,5 @@ function isDepsOptimizerEnabled(config, ssr) {
64025
65754
  (command === 'build' && disabled === 'build') ||
64026
65755
  (command === 'serve' && disabled === 'dev'));
64027
65756
  }
64028
- function isAbsolute(id) {
64029
- return path$n.isAbsolute(id) || path$n.posix.isAbsolute(id);
64030
- }
64031
65757
 
64032
65758
  export { index$1 as A, build$1 as B, index as C, preview$1 as D, resolvePackageData as a, build as b, createServer as c, defineConfig as d, resolveConfig as e, formatPostcssSourceMap as f, resolveBaseUrl as g, getDepOptimizationConfig as h, isDepsOptimizerEnabled as i, mergeAlias as j, createFilter as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, send as q, resolvePackageEntry as r, sortUserPlugins as s, transformWithEsbuild as t, createLogger as u, searchForWorkspaceRoot as v, loadEnv as w, resolveEnvPrefix as x, picocolors as y, commonjsGlobal as z };