vite 5.1.6 → 5.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ import * as require$$0$2 from 'fs';
13
13
  import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, readdirSync } from 'fs';
14
14
  import require$$0$5 from 'events';
15
15
  import require$$5 from 'assert';
16
+ import { exec, execSync } from 'node:child_process';
16
17
  import { createServer as createServer$3, STATUS_CODES, get as get$2 } from 'node:http';
17
18
  import { createServer as createServer$2, get as get$1 } from 'node:https';
18
19
  import require$$0$6 from 'util';
@@ -23,10 +24,9 @@ import require$$0$7 from 'stream';
23
24
  import require$$2 from 'os';
24
25
  import require$$2$1 from 'child_process';
25
26
  import os$4 from 'node:os';
26
- import { exec } from 'node:child_process';
27
27
  import { createHash as createHash$2 } from 'node:crypto';
28
28
  import { promises } from 'node:dns';
29
- import require$$0$a from 'crypto';
29
+ import require$$3$1 from 'crypto';
30
30
  import require$$0$8, { createRequire as createRequire$2 } from 'module';
31
31
  import assert$1 from 'node:assert';
32
32
  import v8 from 'node:v8';
@@ -36,11 +36,11 @@ import { EventEmitter as EventEmitter$4 } from 'node:events';
36
36
  import { parseAst, parseAstAsync } from 'rollup/parseAst';
37
37
  import * as qs from 'querystring';
38
38
  import readline from 'node:readline';
39
- import require$$0$b from 'zlib';
40
- import require$$0$c from 'buffer';
39
+ import zlib$1 from 'zlib';
40
+ import require$$0$a from 'buffer';
41
41
  import require$$1$1 from 'https';
42
42
  import require$$4$2 from 'tls';
43
- import zlib$1, { gzip } from 'node:zlib';
43
+ import { gzip } from 'node:zlib';
44
44
 
45
45
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
46
46
  import { dirname as __cjs_dirname } from 'node:path';
@@ -10827,7 +10827,7 @@ function remapping(input, loader, options) {
10827
10827
 
10828
10828
  var src$2 = {exports: {}};
10829
10829
 
10830
- var node$1 = {exports: {}};
10830
+ var browser$3 = {exports: {}};
10831
10831
 
10832
10832
  /**
10833
10833
  * Helpers.
@@ -11282,281 +11282,6 @@ function requireCommon () {
11282
11282
  return common$b;
11283
11283
  }
11284
11284
 
11285
- /**
11286
- * Module dependencies.
11287
- */
11288
-
11289
- var hasRequiredNode$1;
11290
-
11291
- function requireNode$1 () {
11292
- if (hasRequiredNode$1) return node$1.exports;
11293
- hasRequiredNode$1 = 1;
11294
- (function (module, exports) {
11295
- const tty = require$$0$3;
11296
- const util = require$$0$6;
11297
-
11298
- /**
11299
- * This is the Node.js implementation of `debug()`.
11300
- */
11301
-
11302
- exports.init = init;
11303
- exports.log = log;
11304
- exports.formatArgs = formatArgs;
11305
- exports.save = save;
11306
- exports.load = load;
11307
- exports.useColors = useColors;
11308
- exports.destroy = util.deprecate(
11309
- () => {},
11310
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
11311
- );
11312
-
11313
- /**
11314
- * Colors.
11315
- */
11316
-
11317
- exports.colors = [6, 2, 3, 4, 5, 1];
11318
-
11319
- try {
11320
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
11321
- // eslint-disable-next-line import/no-extraneous-dependencies
11322
- const supportsColor = require('supports-color');
11323
-
11324
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
11325
- exports.colors = [
11326
- 20,
11327
- 21,
11328
- 26,
11329
- 27,
11330
- 32,
11331
- 33,
11332
- 38,
11333
- 39,
11334
- 40,
11335
- 41,
11336
- 42,
11337
- 43,
11338
- 44,
11339
- 45,
11340
- 56,
11341
- 57,
11342
- 62,
11343
- 63,
11344
- 68,
11345
- 69,
11346
- 74,
11347
- 75,
11348
- 76,
11349
- 77,
11350
- 78,
11351
- 79,
11352
- 80,
11353
- 81,
11354
- 92,
11355
- 93,
11356
- 98,
11357
- 99,
11358
- 112,
11359
- 113,
11360
- 128,
11361
- 129,
11362
- 134,
11363
- 135,
11364
- 148,
11365
- 149,
11366
- 160,
11367
- 161,
11368
- 162,
11369
- 163,
11370
- 164,
11371
- 165,
11372
- 166,
11373
- 167,
11374
- 168,
11375
- 169,
11376
- 170,
11377
- 171,
11378
- 172,
11379
- 173,
11380
- 178,
11381
- 179,
11382
- 184,
11383
- 185,
11384
- 196,
11385
- 197,
11386
- 198,
11387
- 199,
11388
- 200,
11389
- 201,
11390
- 202,
11391
- 203,
11392
- 204,
11393
- 205,
11394
- 206,
11395
- 207,
11396
- 208,
11397
- 209,
11398
- 214,
11399
- 215,
11400
- 220,
11401
- 221
11402
- ];
11403
- }
11404
- } catch (error) {
11405
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
11406
- }
11407
-
11408
- /**
11409
- * Build up the default `inspectOpts` object from the environment variables.
11410
- *
11411
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
11412
- */
11413
-
11414
- exports.inspectOpts = Object.keys(process.env).filter(key => {
11415
- return /^debug_/i.test(key);
11416
- }).reduce((obj, key) => {
11417
- // Camel-case
11418
- const prop = key
11419
- .substring(6)
11420
- .toLowerCase()
11421
- .replace(/_([a-z])/g, (_, k) => {
11422
- return k.toUpperCase();
11423
- });
11424
-
11425
- // Coerce string value into JS value
11426
- let val = process.env[key];
11427
- if (/^(yes|on|true|enabled)$/i.test(val)) {
11428
- val = true;
11429
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
11430
- val = false;
11431
- } else if (val === 'null') {
11432
- val = null;
11433
- } else {
11434
- val = Number(val);
11435
- }
11436
-
11437
- obj[prop] = val;
11438
- return obj;
11439
- }, {});
11440
-
11441
- /**
11442
- * Is stdout a TTY? Colored output is enabled when `true`.
11443
- */
11444
-
11445
- function useColors() {
11446
- return 'colors' in exports.inspectOpts ?
11447
- Boolean(exports.inspectOpts.colors) :
11448
- tty.isatty(process.stderr.fd);
11449
- }
11450
-
11451
- /**
11452
- * Adds ANSI color escape codes if enabled.
11453
- *
11454
- * @api public
11455
- */
11456
-
11457
- function formatArgs(args) {
11458
- const {namespace: name, useColors} = this;
11459
-
11460
- if (useColors) {
11461
- const c = this.color;
11462
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
11463
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
11464
-
11465
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
11466
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
11467
- } else {
11468
- args[0] = getDate() + name + ' ' + args[0];
11469
- }
11470
- }
11471
-
11472
- function getDate() {
11473
- if (exports.inspectOpts.hideDate) {
11474
- return '';
11475
- }
11476
- return new Date().toISOString() + ' ';
11477
- }
11478
-
11479
- /**
11480
- * Invokes `util.format()` with the specified arguments and writes to stderr.
11481
- */
11482
-
11483
- function log(...args) {
11484
- return process.stderr.write(util.format(...args) + '\n');
11485
- }
11486
-
11487
- /**
11488
- * Save `namespaces`.
11489
- *
11490
- * @param {String} namespaces
11491
- * @api private
11492
- */
11493
- function save(namespaces) {
11494
- if (namespaces) {
11495
- process.env.DEBUG = namespaces;
11496
- } else {
11497
- // If you set a process.env field to null or undefined, it gets cast to the
11498
- // string 'null' or 'undefined'. Just delete instead.
11499
- delete process.env.DEBUG;
11500
- }
11501
- }
11502
-
11503
- /**
11504
- * Load `namespaces`.
11505
- *
11506
- * @return {String} returns the previously persisted debug modes
11507
- * @api private
11508
- */
11509
-
11510
- function load() {
11511
- return process.env.DEBUG;
11512
- }
11513
-
11514
- /**
11515
- * Init logic for `debug` instances.
11516
- *
11517
- * Create a new `inspectOpts` object in case `useColors` is set
11518
- * differently for a particular `debug` instance.
11519
- */
11520
-
11521
- function init(debug) {
11522
- debug.inspectOpts = {};
11523
-
11524
- const keys = Object.keys(exports.inspectOpts);
11525
- for (let i = 0; i < keys.length; i++) {
11526
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
11527
- }
11528
- }
11529
-
11530
- module.exports = requireCommon()(exports);
11531
-
11532
- const {formatters} = module.exports;
11533
-
11534
- /**
11535
- * Map %o to `util.inspect()`, all on a single line.
11536
- */
11537
-
11538
- formatters.o = function (v) {
11539
- this.inspectOpts.colors = this.useColors;
11540
- return util.inspect(v, this.inspectOpts)
11541
- .split('\n')
11542
- .map(str => str.trim())
11543
- .join(' ');
11544
- };
11545
-
11546
- /**
11547
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
11548
- */
11549
-
11550
- formatters.O = function (v) {
11551
- this.inspectOpts.colors = this.useColors;
11552
- return util.inspect(v, this.inspectOpts);
11553
- };
11554
- } (node$1, node$1.exports));
11555
- return node$1.exports;
11556
- }
11557
-
11558
- var browser$3 = {exports: {}};
11559
-
11560
11285
  /* eslint-env browser */
11561
11286
 
11562
11287
  var hasRequiredBrowser$1;
@@ -11836,6 +11561,281 @@ function requireBrowser$1 () {
11836
11561
  return browser$3.exports;
11837
11562
  }
11838
11563
 
11564
+ var node$1 = {exports: {}};
11565
+
11566
+ /**
11567
+ * Module dependencies.
11568
+ */
11569
+
11570
+ var hasRequiredNode$1;
11571
+
11572
+ function requireNode$1 () {
11573
+ if (hasRequiredNode$1) return node$1.exports;
11574
+ hasRequiredNode$1 = 1;
11575
+ (function (module, exports) {
11576
+ const tty = require$$0$3;
11577
+ const util = require$$0$6;
11578
+
11579
+ /**
11580
+ * This is the Node.js implementation of `debug()`.
11581
+ */
11582
+
11583
+ exports.init = init;
11584
+ exports.log = log;
11585
+ exports.formatArgs = formatArgs;
11586
+ exports.save = save;
11587
+ exports.load = load;
11588
+ exports.useColors = useColors;
11589
+ exports.destroy = util.deprecate(
11590
+ () => {},
11591
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
11592
+ );
11593
+
11594
+ /**
11595
+ * Colors.
11596
+ */
11597
+
11598
+ exports.colors = [6, 2, 3, 4, 5, 1];
11599
+
11600
+ try {
11601
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
11602
+ // eslint-disable-next-line import/no-extraneous-dependencies
11603
+ const supportsColor = require('supports-color');
11604
+
11605
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
11606
+ exports.colors = [
11607
+ 20,
11608
+ 21,
11609
+ 26,
11610
+ 27,
11611
+ 32,
11612
+ 33,
11613
+ 38,
11614
+ 39,
11615
+ 40,
11616
+ 41,
11617
+ 42,
11618
+ 43,
11619
+ 44,
11620
+ 45,
11621
+ 56,
11622
+ 57,
11623
+ 62,
11624
+ 63,
11625
+ 68,
11626
+ 69,
11627
+ 74,
11628
+ 75,
11629
+ 76,
11630
+ 77,
11631
+ 78,
11632
+ 79,
11633
+ 80,
11634
+ 81,
11635
+ 92,
11636
+ 93,
11637
+ 98,
11638
+ 99,
11639
+ 112,
11640
+ 113,
11641
+ 128,
11642
+ 129,
11643
+ 134,
11644
+ 135,
11645
+ 148,
11646
+ 149,
11647
+ 160,
11648
+ 161,
11649
+ 162,
11650
+ 163,
11651
+ 164,
11652
+ 165,
11653
+ 166,
11654
+ 167,
11655
+ 168,
11656
+ 169,
11657
+ 170,
11658
+ 171,
11659
+ 172,
11660
+ 173,
11661
+ 178,
11662
+ 179,
11663
+ 184,
11664
+ 185,
11665
+ 196,
11666
+ 197,
11667
+ 198,
11668
+ 199,
11669
+ 200,
11670
+ 201,
11671
+ 202,
11672
+ 203,
11673
+ 204,
11674
+ 205,
11675
+ 206,
11676
+ 207,
11677
+ 208,
11678
+ 209,
11679
+ 214,
11680
+ 215,
11681
+ 220,
11682
+ 221
11683
+ ];
11684
+ }
11685
+ } catch (error) {
11686
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
11687
+ }
11688
+
11689
+ /**
11690
+ * Build up the default `inspectOpts` object from the environment variables.
11691
+ *
11692
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
11693
+ */
11694
+
11695
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
11696
+ return /^debug_/i.test(key);
11697
+ }).reduce((obj, key) => {
11698
+ // Camel-case
11699
+ const prop = key
11700
+ .substring(6)
11701
+ .toLowerCase()
11702
+ .replace(/_([a-z])/g, (_, k) => {
11703
+ return k.toUpperCase();
11704
+ });
11705
+
11706
+ // Coerce string value into JS value
11707
+ let val = process.env[key];
11708
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
11709
+ val = true;
11710
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
11711
+ val = false;
11712
+ } else if (val === 'null') {
11713
+ val = null;
11714
+ } else {
11715
+ val = Number(val);
11716
+ }
11717
+
11718
+ obj[prop] = val;
11719
+ return obj;
11720
+ }, {});
11721
+
11722
+ /**
11723
+ * Is stdout a TTY? Colored output is enabled when `true`.
11724
+ */
11725
+
11726
+ function useColors() {
11727
+ return 'colors' in exports.inspectOpts ?
11728
+ Boolean(exports.inspectOpts.colors) :
11729
+ tty.isatty(process.stderr.fd);
11730
+ }
11731
+
11732
+ /**
11733
+ * Adds ANSI color escape codes if enabled.
11734
+ *
11735
+ * @api public
11736
+ */
11737
+
11738
+ function formatArgs(args) {
11739
+ const {namespace: name, useColors} = this;
11740
+
11741
+ if (useColors) {
11742
+ const c = this.color;
11743
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
11744
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
11745
+
11746
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
11747
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
11748
+ } else {
11749
+ args[0] = getDate() + name + ' ' + args[0];
11750
+ }
11751
+ }
11752
+
11753
+ function getDate() {
11754
+ if (exports.inspectOpts.hideDate) {
11755
+ return '';
11756
+ }
11757
+ return new Date().toISOString() + ' ';
11758
+ }
11759
+
11760
+ /**
11761
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
11762
+ */
11763
+
11764
+ function log(...args) {
11765
+ return process.stderr.write(util.format(...args) + '\n');
11766
+ }
11767
+
11768
+ /**
11769
+ * Save `namespaces`.
11770
+ *
11771
+ * @param {String} namespaces
11772
+ * @api private
11773
+ */
11774
+ function save(namespaces) {
11775
+ if (namespaces) {
11776
+ process.env.DEBUG = namespaces;
11777
+ } else {
11778
+ // If you set a process.env field to null or undefined, it gets cast to the
11779
+ // string 'null' or 'undefined'. Just delete instead.
11780
+ delete process.env.DEBUG;
11781
+ }
11782
+ }
11783
+
11784
+ /**
11785
+ * Load `namespaces`.
11786
+ *
11787
+ * @return {String} returns the previously persisted debug modes
11788
+ * @api private
11789
+ */
11790
+
11791
+ function load() {
11792
+ return process.env.DEBUG;
11793
+ }
11794
+
11795
+ /**
11796
+ * Init logic for `debug` instances.
11797
+ *
11798
+ * Create a new `inspectOpts` object in case `useColors` is set
11799
+ * differently for a particular `debug` instance.
11800
+ */
11801
+
11802
+ function init(debug) {
11803
+ debug.inspectOpts = {};
11804
+
11805
+ const keys = Object.keys(exports.inspectOpts);
11806
+ for (let i = 0; i < keys.length; i++) {
11807
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
11808
+ }
11809
+ }
11810
+
11811
+ module.exports = requireCommon()(exports);
11812
+
11813
+ const {formatters} = module.exports;
11814
+
11815
+ /**
11816
+ * Map %o to `util.inspect()`, all on a single line.
11817
+ */
11818
+
11819
+ formatters.o = function (v) {
11820
+ this.inspectOpts.colors = this.useColors;
11821
+ return util.inspect(v, this.inspectOpts)
11822
+ .split('\n')
11823
+ .map(str => str.trim())
11824
+ .join(' ');
11825
+ };
11826
+
11827
+ /**
11828
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
11829
+ */
11830
+
11831
+ formatters.O = function (v) {
11832
+ this.inspectOpts.colors = this.useColors;
11833
+ return util.inspect(v, this.inspectOpts);
11834
+ };
11835
+ } (node$1, node$1.exports));
11836
+ return node$1.exports;
11837
+ }
11838
+
11839
11839
  /**
11840
11840
  * Detect Electron renderer / nwjs process, which is node, but we should
11841
11841
  * treat as a browser.
@@ -11858,7 +11858,7 @@ if (process.versions.pnp) {
11858
11858
  catch { }
11859
11859
  }
11860
11860
  function invalidatePackageData(packageCache, pkgPath) {
11861
- const pkgDir = path$o.dirname(pkgPath);
11861
+ const pkgDir = normalizePath$3(path$o.dirname(pkgPath));
11862
11862
  packageCache.forEach((pkg, cacheKey) => {
11863
11863
  if (pkg.dir === pkgDir) {
11864
11864
  packageCache.delete(cacheKey);
@@ -11946,7 +11946,7 @@ function findNearestMainPackageData(basedir, packageCache) {
11946
11946
  }
11947
11947
  function loadPackageData(pkgPath) {
11948
11948
  const data = JSON.parse(fs$l.readFileSync(pkgPath, 'utf-8'));
11949
- const pkgDir = path$o.dirname(pkgPath);
11949
+ const pkgDir = normalizePath$3(path$o.dirname(pkgPath));
11950
11950
  const { sideEffects } = data;
11951
11951
  let hasSideEffects;
11952
11952
  if (typeof sideEffects === 'boolean') {
@@ -12638,6 +12638,8 @@ function joinSrcset(ret) {
12638
12638
  .map(({ url, descriptor }) => url + (descriptor ? ` ${descriptor}` : ''))
12639
12639
  .join(', ');
12640
12640
  }
12641
+ // NOTE: The returned `url` should perhaps be decoded so all handled URLs within Vite are consistently decoded.
12642
+ // However, this may also require a refactor for `cssReplacer` to accept decoded URLs instead.
12641
12643
  function splitSrcSetDescriptor(srcs) {
12642
12644
  return splitSrcSet(srcs)
12643
12645
  .map((s) => {
@@ -13162,6 +13164,13 @@ function displayTime(time) {
13162
13164
  // display: {X}m {Y}s
13163
13165
  return `${mins}m${seconds < 1 ? '' : ` ${seconds.toFixed(0)}s`}`;
13164
13166
  }
13167
+ /**
13168
+ * Like `encodeURI`, but only replacing `%` as `%25`. This is useful for environments
13169
+ * that can handle un-encoded URIs, where `%` is the only ambiguous character.
13170
+ */
13171
+ function partialEncodeURI(uri) {
13172
+ return uri.replaceAll('%', '%25');
13173
+ }
13165
13174
 
13166
13175
  /* eslint no-console: 0 */
13167
13176
  const LogLevels = {
@@ -15281,7 +15290,7 @@ function terserPlugin(config) {
15281
15290
  };
15282
15291
  }
15283
15292
 
15284
- const mimes$1 = {
15293
+ const mimes = {
15285
15294
  "3g2": "video/3gpp2",
15286
15295
  "3gp": "video/3gpp",
15287
15296
  "3gpp": "video/3gpp",
@@ -15721,7 +15730,7 @@ const mimes$1 = {
15721
15730
  function lookup(extn) {
15722
15731
  let tmp = ('' + extn).trim().toLowerCase();
15723
15732
  let idx = tmp.lastIndexOf('.');
15724
- return mimes$1[!~idx ? tmp : tmp.substring(++idx)];
15733
+ return mimes[!~idx ? tmp : tmp.substring(++idx)];
15725
15734
  }
15726
15735
 
15727
15736
  const publicFilesMap = new WeakMap();
@@ -15774,11 +15783,11 @@ const generatedAssets = new WeakMap();
15774
15783
  // add own dictionary entry by directly assigning mrmime
15775
15784
  function registerCustomMime() {
15776
15785
  // https://github.com/lukeed/mrmime/issues/3
15777
- mimes$1['ico'] = 'image/x-icon';
15786
+ mimes['ico'] = 'image/x-icon';
15778
15787
  // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac
15779
- mimes$1['flac'] = 'audio/flac';
15788
+ mimes['flac'] = 'audio/flac';
15780
15789
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
15781
- mimes$1['eot'] = 'application/vnd.ms-fontobject';
15790
+ mimes['eot'] = 'application/vnd.ms-fontobject';
15782
15791
  }
15783
15792
  function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
15784
15793
  const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format, config.isWorker);
@@ -15798,7 +15807,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
15798
15807
  const filename = file + postfix;
15799
15808
  const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
15800
15809
  const replacementString = typeof replacement === 'string'
15801
- ? JSON.stringify(replacement).slice(1, -1)
15810
+ ? JSON.stringify(encodeURI(replacement)).slice(1, -1)
15802
15811
  : `"+${replacement.runtime}+"`;
15803
15812
  s.update(match.index, match.index + full.length, replacementString);
15804
15813
  }
@@ -15811,7 +15820,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
15811
15820
  const publicUrl = publicAssetUrlMap.get(hash).slice(1);
15812
15821
  const replacement = toOutputFilePathInJS(publicUrl, 'public', chunk.fileName, 'js', config, toRelativeRuntime);
15813
15822
  const replacementString = typeof replacement === 'string'
15814
- ? JSON.stringify(replacement).slice(1, -1)
15823
+ ? JSON.stringify(encodeURI(replacement)).slice(1, -1)
15815
15824
  : `"+${replacement.runtime}+"`;
15816
15825
  s.update(match.index, match.index + full.length, replacementString);
15817
15826
  }
@@ -15876,7 +15885,14 @@ function assetPlugin(config) {
15876
15885
  url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
15877
15886
  }
15878
15887
  }
15879
- return `export default ${JSON.stringify(url)}`;
15888
+ return {
15889
+ code: `export default ${JSON.stringify(url.startsWith('data:') ? url : encodeURI(url))}`,
15890
+ // Force rollup to keep this module from being shared between other entry points if it's an entrypoint.
15891
+ // If the resulting chunk is empty, it will be removed in generateBundle.
15892
+ moduleSideEffects: config.command === 'build' && this.getModuleInfo(id)?.isEntry
15893
+ ? 'no-treeshake'
15894
+ : false,
15895
+ };
15880
15896
  },
15881
15897
  renderChunk(code, chunk, opts) {
15882
15898
  const s = renderAssetUrlInJS(this, config, chunk, opts, code);
@@ -15893,6 +15909,16 @@ function assetPlugin(config) {
15893
15909
  }
15894
15910
  },
15895
15911
  generateBundle(_, bundle) {
15912
+ // Remove empty entry point file
15913
+ for (const file in bundle) {
15914
+ const chunk = bundle[file];
15915
+ if (chunk.type === 'chunk' &&
15916
+ chunk.isEntry &&
15917
+ chunk.moduleIds.length === 1 &&
15918
+ config.assetsInclude(chunk.moduleIds[0])) {
15919
+ delete bundle[file];
15920
+ }
15921
+ }
15896
15922
  // do not emit assets for SSR build
15897
15923
  if (config.command === 'build' &&
15898
15924
  config.build.ssr &&
@@ -15978,7 +16004,7 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
15978
16004
  const file = cleanUrl(id);
15979
16005
  const content = await fsp.readFile(file);
15980
16006
  let url;
15981
- if (shouldInline(config, file, id, content, forceInline)) {
16007
+ if (shouldInline(config, file, id, content, pluginContext, forceInline)) {
15982
16008
  if (config.build.lib && isGitLfsPlaceholder(content)) {
15983
16009
  config.logger.warn(colors$1.yellow(`Inlined file ${id} was not downloaded via Git LFS`));
15984
16010
  }
@@ -16019,9 +16045,11 @@ async function urlToBuiltUrl(url, importer, config, pluginContext, forceInline)
16019
16045
  // skip public check since we just did it above
16020
16046
  true, forceInline);
16021
16047
  }
16022
- const shouldInline = (config, file, id, content, forceInline) => {
16048
+ const shouldInline = (config, file, id, content, pluginContext, forceInline) => {
16023
16049
  if (config.build.lib)
16024
16050
  return true;
16051
+ if (pluginContext.getModuleInfo(id)?.isEntry)
16052
+ return false;
16025
16053
  if (forceInline !== undefined)
16026
16054
  return forceInline;
16027
16055
  let limit;
@@ -16095,6 +16123,7 @@ function manifestPlugin(config) {
16095
16123
  function createChunk(chunk) {
16096
16124
  const manifestChunk = {
16097
16125
  file: chunk.fileName,
16126
+ name: chunk.name,
16098
16127
  };
16099
16128
  if (chunk.facadeModuleId) {
16100
16129
  manifestChunk.src = getChunkName(chunk);
@@ -19877,8 +19906,8 @@ function fastqueue (context, worker, concurrency) {
19877
19906
 
19878
19907
  var self = {
19879
19908
  push: push,
19880
- drain: noop$4,
19881
- saturated: noop$4,
19909
+ drain: noop$3,
19910
+ saturated: noop$3,
19882
19911
  pause: pause,
19883
19912
  paused: false,
19884
19913
  concurrency: concurrency,
@@ -19888,7 +19917,7 @@ function fastqueue (context, worker, concurrency) {
19888
19917
  length: length,
19889
19918
  getQueue: getQueue,
19890
19919
  unshift: unshift,
19891
- empty: noop$4,
19920
+ empty: noop$3,
19892
19921
  kill: kill,
19893
19922
  killAndDrain: killAndDrain,
19894
19923
  error: error
@@ -19947,7 +19976,7 @@ function fastqueue (context, worker, concurrency) {
19947
19976
  current.context = context;
19948
19977
  current.release = release;
19949
19978
  current.value = value;
19950
- current.callback = done || noop$4;
19979
+ current.callback = done || noop$3;
19951
19980
  current.errorHandler = errorHandler;
19952
19981
 
19953
19982
  if (_running === self.concurrency || self.paused) {
@@ -19971,7 +20000,7 @@ function fastqueue (context, worker, concurrency) {
19971
20000
  current.context = context;
19972
20001
  current.release = release;
19973
20002
  current.value = value;
19974
- current.callback = done || noop$4;
20003
+ current.callback = done || noop$3;
19975
20004
 
19976
20005
  if (_running === self.concurrency || self.paused) {
19977
20006
  if (queueHead) {
@@ -20015,14 +20044,14 @@ function fastqueue (context, worker, concurrency) {
20015
20044
  function kill () {
20016
20045
  queueHead = null;
20017
20046
  queueTail = null;
20018
- self.drain = noop$4;
20047
+ self.drain = noop$3;
20019
20048
  }
20020
20049
 
20021
20050
  function killAndDrain () {
20022
20051
  queueHead = null;
20023
20052
  queueTail = null;
20024
20053
  self.drain();
20025
- self.drain = noop$4;
20054
+ self.drain = noop$3;
20026
20055
  }
20027
20056
 
20028
20057
  function error (handler) {
@@ -20030,13 +20059,13 @@ function fastqueue (context, worker, concurrency) {
20030
20059
  }
20031
20060
  }
20032
20061
 
20033
- function noop$4 () {}
20062
+ function noop$3 () {}
20034
20063
 
20035
20064
  function Task () {
20036
20065
  this.value = null;
20037
- this.callback = noop$4;
20066
+ this.callback = noop$3;
20038
20067
  this.next = null;
20039
- this.release = noop$4;
20068
+ this.release = noop$3;
20040
20069
  this.context = null;
20041
20070
  this.errorHandler = null;
20042
20071
 
@@ -20047,7 +20076,7 @@ function Task () {
20047
20076
  var errorHandler = self.errorHandler;
20048
20077
  var val = self.value;
20049
20078
  self.value = null;
20050
- self.callback = noop$4;
20079
+ self.callback = noop$3;
20051
20080
  if (self.errorHandler) {
20052
20081
  errorHandler(err, val);
20053
20082
  }
@@ -20095,7 +20124,7 @@ function queueAsPromised (context, worker, concurrency) {
20095
20124
  // Let's fork the promise chain to
20096
20125
  // make the error bubble up to the user but
20097
20126
  // not lead to a unhandledRejection
20098
- p.catch(noop$4);
20127
+ p.catch(noop$3);
20099
20128
 
20100
20129
  return p
20101
20130
  }
@@ -20114,7 +20143,7 @@ function queueAsPromised (context, worker, concurrency) {
20114
20143
  // Let's fork the promise chain to
20115
20144
  // make the error bubble up to the user but
20116
20145
  // not lead to a unhandledRejection
20117
- p.catch(noop$4);
20146
+ p.catch(noop$3);
20118
20147
 
20119
20148
  return p
20120
20149
  }
@@ -29760,7 +29789,7 @@ var require$$4 = {
29760
29789
  const fs$9 = require$$0__default;
29761
29790
  const path$9 = require$$0$4;
29762
29791
  const os$2 = require$$2;
29763
- const crypto$1 = require$$0$a;
29792
+ const crypto$1 = require$$3$1;
29764
29793
  const packageJson = require$$4;
29765
29794
 
29766
29795
  const version$1 = packageJson.version;
@@ -30428,7 +30457,7 @@ function traverseNodes(node, visitor) {
30428
30457
  }
30429
30458
  async function traverseHtml(html, filePath, visitor) {
30430
30459
  // lazy load compiler
30431
- const { parse } = await import('./dep-kjUoH5nk.js');
30460
+ const { parse } = await import('./dep-CrWVpuYf.js');
30432
30461
  const ast = parse(html, {
30433
30462
  scriptingEnabled: false,
30434
30463
  sourceCodeLocationInfo: true,
@@ -30610,7 +30639,7 @@ function buildHtmlPlugin(config) {
30610
30639
  const isPublicFile = !!(url && checkPublicFile(url, config));
30611
30640
  if (isPublicFile) {
30612
30641
  // referencing public dir url, prefix with base
30613
- overwriteAttrValue(s, sourceCodeLocation, toOutputPublicFilePath(url));
30642
+ overwriteAttrValue(s, sourceCodeLocation, partialEncodeURI(toOutputPublicFilePath(url)));
30614
30643
  }
30615
30644
  if (isModule) {
30616
30645
  inlineModuleIndex++;
@@ -30654,23 +30683,25 @@ function buildHtmlPlugin(config) {
30654
30683
  if (p.value && assetAttrs.includes(attrKey)) {
30655
30684
  if (attrKey === 'srcset') {
30656
30685
  assetUrlsPromises.push((async () => {
30657
- const processedUrl = await processSrcSet(p.value, async ({ url }) => {
30686
+ const processedEncodedUrl = await processSrcSet(p.value, async ({ url }) => {
30658
30687
  const decodedUrl = decodeURI(url);
30659
30688
  if (!isExcludedUrl(decodedUrl)) {
30660
30689
  const result = await processAssetUrl(url);
30661
- return result !== decodedUrl ? result : url;
30690
+ return result !== decodedUrl
30691
+ ? encodeURI(result)
30692
+ : url;
30662
30693
  }
30663
30694
  return url;
30664
30695
  });
30665
- if (processedUrl !== p.value) {
30666
- overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), processedUrl);
30696
+ if (processedEncodedUrl !== p.value) {
30697
+ overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), processedEncodedUrl);
30667
30698
  }
30668
30699
  })());
30669
30700
  }
30670
30701
  else {
30671
30702
  const url = decodeURI(p.value);
30672
30703
  if (checkPublicFile(url, config)) {
30673
- overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), toOutputPublicFilePath(url));
30704
+ overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), partialEncodeURI(toOutputPublicFilePath(url)));
30674
30705
  }
30675
30706
  else if (!isExcludedUrl(url)) {
30676
30707
  if (node.nodeName === 'link' &&
@@ -30699,7 +30730,7 @@ function buildHtmlPlugin(config) {
30699
30730
  assetUrlsPromises.push((async () => {
30700
30731
  const processedUrl = await processAssetUrl(url, shouldInline);
30701
30732
  if (processedUrl !== url) {
30702
- overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), processedUrl);
30733
+ overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), partialEncodeURI(processedUrl));
30703
30734
  }
30704
30735
  })());
30705
30736
  }
@@ -30749,10 +30780,10 @@ function buildHtmlPlugin(config) {
30749
30780
  // emit <script>import("./aaa")</script> asset
30750
30781
  for (const { start, end, url } of scriptUrls) {
30751
30782
  if (checkPublicFile(url, config)) {
30752
- s.update(start, end, toOutputPublicFilePath(url));
30783
+ s.update(start, end, partialEncodeURI(toOutputPublicFilePath(url)));
30753
30784
  }
30754
30785
  else if (!isExcludedUrl(url)) {
30755
- s.update(start, end, await urlToBuiltUrl(url, id, config, this));
30786
+ s.update(start, end, partialEncodeURI(await urlToBuiltUrl(url, id, config, this)));
30756
30787
  }
30757
30788
  }
30758
30789
  // ignore <link rel="stylesheet"> if its url can't be resolved
@@ -30943,13 +30974,13 @@ function buildHtmlPlugin(config) {
30943
30974
  if (chunk) {
30944
30975
  chunk.viteMetadata.importedAssets.add(cleanUrl(file));
30945
30976
  }
30946
- return toOutputAssetFilePath(file) + postfix;
30977
+ return encodeURI(toOutputAssetFilePath(file)) + postfix;
30947
30978
  });
30948
30979
  result = result.replace(publicAssetUrlRE, (_, fileHash) => {
30949
30980
  const publicAssetPath = toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config));
30950
- return urlCanParse(publicAssetPath)
30981
+ return encodeURI(urlCanParse(publicAssetPath)
30951
30982
  ? publicAssetPath
30952
- : normalizePath$3(publicAssetPath);
30983
+ : normalizePath$3(publicAssetPath));
30953
30984
  });
30954
30985
  if (chunk && canInlineEntry) {
30955
30986
  inlineEntryChunk.add(chunk.fileName);
@@ -31539,7 +31570,7 @@ function cssPostPlugin(config) {
31539
31570
  map: { mappings: '' },
31540
31571
  // avoid the css module from being tree-shaken so that we can retrieve
31541
31572
  // it in renderChunk()
31542
- moduleSideEffects: inlined ? false : 'no-treeshake',
31573
+ moduleSideEffects: modulesCode || inlined ? false : 'no-treeshake',
31543
31574
  };
31544
31575
  },
31545
31576
  async renderChunk(code, chunk, opts) {
@@ -31581,14 +31612,14 @@ function cssPostPlugin(config) {
31581
31612
  chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash, postfix = '') => {
31582
31613
  const filename = this.getFileName(fileHash) + postfix;
31583
31614
  chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
31584
- return toOutputFilePathInCss(filename, 'asset', cssAssetName, 'css', config, toRelative);
31615
+ return encodeURI(toOutputFilePathInCss(filename, 'asset', cssAssetName, 'css', config, toRelative));
31585
31616
  });
31586
31617
  // resolve public URL from CSS paths
31587
31618
  if (encodedPublicUrls) {
31588
31619
  const relativePathToPublicFromCSS = path$o.posix.relative(cssAssetDirname, '');
31589
31620
  chunkCSS = chunkCSS.replace(publicAssetUrlRE, (_, hash) => {
31590
31621
  const publicUrl = publicAssetUrlMap.get(hash).slice(1);
31591
- return toOutputFilePathInCss(publicUrl, 'public', cssAssetName, 'css', config, () => `${relativePathToPublicFromCSS}/${publicUrl}`);
31622
+ return encodeURI(toOutputFilePathInCss(publicUrl, 'public', cssAssetName, 'css', config, () => `${relativePathToPublicFromCSS}/${publicUrl}`));
31592
31623
  });
31593
31624
  }
31594
31625
  return chunkCSS;
@@ -31639,7 +31670,7 @@ function cssPostPlugin(config) {
31639
31670
  .set(referenceId, { originalName: originalFilename });
31640
31671
  const replacement = toOutputFilePathInJS(this.getFileName(referenceId), 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
31641
31672
  const replacementString = typeof replacement === 'string'
31642
- ? JSON.stringify(replacement).slice(1, -1)
31673
+ ? JSON.stringify(encodeURI(replacement)).slice(1, -1)
31643
31674
  : `"+${replacement.runtime}+"`;
31644
31675
  s.update(start, end, replacementString);
31645
31676
  }
@@ -32173,8 +32204,8 @@ function createCachedImport(imp) {
32173
32204
  return cached;
32174
32205
  };
32175
32206
  }
32176
- const importPostcssImport = createCachedImport(() => import('./dep-sFlFG1c_.js').then(function (n) { return n.i; }));
32177
- const importPostcssModules = createCachedImport(() => import('./dep-pxQDj-UY.js').then(function (n) { return n.i; }));
32207
+ const importPostcssImport = createCachedImport(() => import('./dep-DeEXZBZL.js').then(function (n) { return n.i; }));
32208
+ const importPostcssModules = createCachedImport(() => import('./dep-6MdzGidO.js').then(function (n) { return n.i; }));
32178
32209
  const importPostcss = createCachedImport(() => import('postcss'));
32179
32210
  const preprocessorWorkerControllerCache = new WeakMap();
32180
32211
  let alwaysFakeWorkerWorkerControllerCache;
@@ -40470,7 +40501,7 @@ function isVirtualModule(id) {
40470
40501
 
40471
40502
  var src = {exports: {}};
40472
40503
 
40473
- var node = {exports: {}};
40504
+ var browser = {exports: {}};
40474
40505
 
40475
40506
  var debug$f = {exports: {}};
40476
40507
 
@@ -40846,266 +40877,6 @@ function requireDebug () {
40846
40877
  return debug$f.exports;
40847
40878
  }
40848
40879
 
40849
- /**
40850
- * Module dependencies.
40851
- */
40852
-
40853
- var hasRequiredNode;
40854
-
40855
- function requireNode () {
40856
- if (hasRequiredNode) return node.exports;
40857
- hasRequiredNode = 1;
40858
- (function (module, exports) {
40859
- var tty = require$$0$3;
40860
- var util = require$$0$6;
40861
-
40862
- /**
40863
- * This is the Node.js implementation of `debug()`.
40864
- *
40865
- * Expose `debug()` as the module.
40866
- */
40867
-
40868
- exports = module.exports = requireDebug();
40869
- exports.init = init;
40870
- exports.log = log;
40871
- exports.formatArgs = formatArgs;
40872
- exports.save = save;
40873
- exports.load = load;
40874
- exports.useColors = useColors;
40875
-
40876
- /**
40877
- * Colors.
40878
- */
40879
-
40880
- exports.colors = [6, 2, 3, 4, 5, 1];
40881
-
40882
- /**
40883
- * Build up the default `inspectOpts` object from the environment variables.
40884
- *
40885
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
40886
- */
40887
-
40888
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
40889
- return /^debug_/i.test(key);
40890
- }).reduce(function (obj, key) {
40891
- // camel-case
40892
- var prop = key
40893
- .substring(6)
40894
- .toLowerCase()
40895
- .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
40896
-
40897
- // coerce string value into JS value
40898
- var val = process.env[key];
40899
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
40900
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
40901
- else if (val === 'null') val = null;
40902
- else val = Number(val);
40903
-
40904
- obj[prop] = val;
40905
- return obj;
40906
- }, {});
40907
-
40908
- /**
40909
- * The file descriptor to write the `debug()` calls to.
40910
- * Set the `DEBUG_FD` env variable to override with another value. i.e.:
40911
- *
40912
- * $ DEBUG_FD=3 node script.js 3>debug.log
40913
- */
40914
-
40915
- var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
40916
-
40917
- if (1 !== fd && 2 !== fd) {
40918
- util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')();
40919
- }
40920
-
40921
- var stream = 1 === fd ? process.stdout :
40922
- 2 === fd ? process.stderr :
40923
- createWritableStdioStream(fd);
40924
-
40925
- /**
40926
- * Is stdout a TTY? Colored output is enabled when `true`.
40927
- */
40928
-
40929
- function useColors() {
40930
- return 'colors' in exports.inspectOpts
40931
- ? Boolean(exports.inspectOpts.colors)
40932
- : tty.isatty(fd);
40933
- }
40934
-
40935
- /**
40936
- * Map %o to `util.inspect()`, all on a single line.
40937
- */
40938
-
40939
- exports.formatters.o = function(v) {
40940
- this.inspectOpts.colors = this.useColors;
40941
- return util.inspect(v, this.inspectOpts)
40942
- .split('\n').map(function(str) {
40943
- return str.trim()
40944
- }).join(' ');
40945
- };
40946
-
40947
- /**
40948
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
40949
- */
40950
-
40951
- exports.formatters.O = function(v) {
40952
- this.inspectOpts.colors = this.useColors;
40953
- return util.inspect(v, this.inspectOpts);
40954
- };
40955
-
40956
- /**
40957
- * Adds ANSI color escape codes if enabled.
40958
- *
40959
- * @api public
40960
- */
40961
-
40962
- function formatArgs(args) {
40963
- var name = this.namespace;
40964
- var useColors = this.useColors;
40965
-
40966
- if (useColors) {
40967
- var c = this.color;
40968
- var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
40969
-
40970
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
40971
- args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
40972
- } else {
40973
- args[0] = new Date().toUTCString()
40974
- + ' ' + name + ' ' + args[0];
40975
- }
40976
- }
40977
-
40978
- /**
40979
- * Invokes `util.format()` with the specified arguments and writes to `stream`.
40980
- */
40981
-
40982
- function log() {
40983
- return stream.write(util.format.apply(util, arguments) + '\n');
40984
- }
40985
-
40986
- /**
40987
- * Save `namespaces`.
40988
- *
40989
- * @param {String} namespaces
40990
- * @api private
40991
- */
40992
-
40993
- function save(namespaces) {
40994
- if (null == namespaces) {
40995
- // If you set a process.env field to null or undefined, it gets cast to the
40996
- // string 'null' or 'undefined'. Just delete instead.
40997
- delete process.env.DEBUG;
40998
- } else {
40999
- process.env.DEBUG = namespaces;
41000
- }
41001
- }
41002
-
41003
- /**
41004
- * Load `namespaces`.
41005
- *
41006
- * @return {String} returns the previously persisted debug modes
41007
- * @api private
41008
- */
41009
-
41010
- function load() {
41011
- return process.env.DEBUG;
41012
- }
41013
-
41014
- /**
41015
- * Copied from `node/src/node.js`.
41016
- *
41017
- * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
41018
- * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
41019
- */
41020
-
41021
- function createWritableStdioStream (fd) {
41022
- var stream;
41023
- var tty_wrap = process.binding('tty_wrap');
41024
-
41025
- // Note stream._type is used for test-module-load-list.js
41026
-
41027
- switch (tty_wrap.guessHandleType(fd)) {
41028
- case 'TTY':
41029
- stream = new tty.WriteStream(fd);
41030
- stream._type = 'tty';
41031
-
41032
- // Hack to have stream not keep the event loop alive.
41033
- // See https://github.com/joyent/node/issues/1726
41034
- if (stream._handle && stream._handle.unref) {
41035
- stream._handle.unref();
41036
- }
41037
- break;
41038
-
41039
- case 'FILE':
41040
- var fs = require$$0__default;
41041
- stream = new fs.SyncWriteStream(fd, { autoClose: false });
41042
- stream._type = 'fs';
41043
- break;
41044
-
41045
- case 'PIPE':
41046
- case 'TCP':
41047
- var net = require$$4$1;
41048
- stream = new net.Socket({
41049
- fd: fd,
41050
- readable: false,
41051
- writable: true
41052
- });
41053
-
41054
- // FIXME Should probably have an option in net.Socket to create a
41055
- // stream from an existing fd which is writable only. But for now
41056
- // we'll just add this hack and set the `readable` member to false.
41057
- // Test: ./node test/fixtures/echo.js < /etc/passwd
41058
- stream.readable = false;
41059
- stream.read = null;
41060
- stream._type = 'pipe';
41061
-
41062
- // FIXME Hack to have stream not keep the event loop alive.
41063
- // See https://github.com/joyent/node/issues/1726
41064
- if (stream._handle && stream._handle.unref) {
41065
- stream._handle.unref();
41066
- }
41067
- break;
41068
-
41069
- default:
41070
- // Probably an error on in uv_guess_handle()
41071
- throw new Error('Implement me. Unknown stream file type!');
41072
- }
41073
-
41074
- // For supporting legacy API we put the FD here.
41075
- stream.fd = fd;
41076
-
41077
- stream._isStdio = true;
41078
-
41079
- return stream;
41080
- }
41081
-
41082
- /**
41083
- * Init logic for `debug` instances.
41084
- *
41085
- * Create a new `inspectOpts` object in case `useColors` is set
41086
- * differently for a particular `debug` instance.
41087
- */
41088
-
41089
- function init (debug) {
41090
- debug.inspectOpts = {};
41091
-
41092
- var keys = Object.keys(exports.inspectOpts);
41093
- for (var i = 0; i < keys.length; i++) {
41094
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
41095
- }
41096
- }
41097
-
41098
- /**
41099
- * Enable namespaces listed in `process.env.DEBUG` initially.
41100
- */
41101
-
41102
- exports.enable(load());
41103
- } (node, node.exports));
41104
- return node.exports;
41105
- }
41106
-
41107
- var browser = {exports: {}};
41108
-
41109
40880
  /**
41110
40881
  * This is the web browser implementation of `debug()`.
41111
40882
  *
@@ -41301,6 +41072,266 @@ function requireBrowser () {
41301
41072
  return browser.exports;
41302
41073
  }
41303
41074
 
41075
+ var node = {exports: {}};
41076
+
41077
+ /**
41078
+ * Module dependencies.
41079
+ */
41080
+
41081
+ var hasRequiredNode;
41082
+
41083
+ function requireNode () {
41084
+ if (hasRequiredNode) return node.exports;
41085
+ hasRequiredNode = 1;
41086
+ (function (module, exports) {
41087
+ var tty = require$$0$3;
41088
+ var util = require$$0$6;
41089
+
41090
+ /**
41091
+ * This is the Node.js implementation of `debug()`.
41092
+ *
41093
+ * Expose `debug()` as the module.
41094
+ */
41095
+
41096
+ exports = module.exports = requireDebug();
41097
+ exports.init = init;
41098
+ exports.log = log;
41099
+ exports.formatArgs = formatArgs;
41100
+ exports.save = save;
41101
+ exports.load = load;
41102
+ exports.useColors = useColors;
41103
+
41104
+ /**
41105
+ * Colors.
41106
+ */
41107
+
41108
+ exports.colors = [6, 2, 3, 4, 5, 1];
41109
+
41110
+ /**
41111
+ * Build up the default `inspectOpts` object from the environment variables.
41112
+ *
41113
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
41114
+ */
41115
+
41116
+ exports.inspectOpts = Object.keys(process.env).filter(function (key) {
41117
+ return /^debug_/i.test(key);
41118
+ }).reduce(function (obj, key) {
41119
+ // camel-case
41120
+ var prop = key
41121
+ .substring(6)
41122
+ .toLowerCase()
41123
+ .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
41124
+
41125
+ // coerce string value into JS value
41126
+ var val = process.env[key];
41127
+ if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
41128
+ else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
41129
+ else if (val === 'null') val = null;
41130
+ else val = Number(val);
41131
+
41132
+ obj[prop] = val;
41133
+ return obj;
41134
+ }, {});
41135
+
41136
+ /**
41137
+ * The file descriptor to write the `debug()` calls to.
41138
+ * Set the `DEBUG_FD` env variable to override with another value. i.e.:
41139
+ *
41140
+ * $ DEBUG_FD=3 node script.js 3>debug.log
41141
+ */
41142
+
41143
+ var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
41144
+
41145
+ if (1 !== fd && 2 !== fd) {
41146
+ util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')();
41147
+ }
41148
+
41149
+ var stream = 1 === fd ? process.stdout :
41150
+ 2 === fd ? process.stderr :
41151
+ createWritableStdioStream(fd);
41152
+
41153
+ /**
41154
+ * Is stdout a TTY? Colored output is enabled when `true`.
41155
+ */
41156
+
41157
+ function useColors() {
41158
+ return 'colors' in exports.inspectOpts
41159
+ ? Boolean(exports.inspectOpts.colors)
41160
+ : tty.isatty(fd);
41161
+ }
41162
+
41163
+ /**
41164
+ * Map %o to `util.inspect()`, all on a single line.
41165
+ */
41166
+
41167
+ exports.formatters.o = function(v) {
41168
+ this.inspectOpts.colors = this.useColors;
41169
+ return util.inspect(v, this.inspectOpts)
41170
+ .split('\n').map(function(str) {
41171
+ return str.trim()
41172
+ }).join(' ');
41173
+ };
41174
+
41175
+ /**
41176
+ * Map %o to `util.inspect()`, allowing multiple lines if needed.
41177
+ */
41178
+
41179
+ exports.formatters.O = function(v) {
41180
+ this.inspectOpts.colors = this.useColors;
41181
+ return util.inspect(v, this.inspectOpts);
41182
+ };
41183
+
41184
+ /**
41185
+ * Adds ANSI color escape codes if enabled.
41186
+ *
41187
+ * @api public
41188
+ */
41189
+
41190
+ function formatArgs(args) {
41191
+ var name = this.namespace;
41192
+ var useColors = this.useColors;
41193
+
41194
+ if (useColors) {
41195
+ var c = this.color;
41196
+ var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
41197
+
41198
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
41199
+ args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
41200
+ } else {
41201
+ args[0] = new Date().toUTCString()
41202
+ + ' ' + name + ' ' + args[0];
41203
+ }
41204
+ }
41205
+
41206
+ /**
41207
+ * Invokes `util.format()` with the specified arguments and writes to `stream`.
41208
+ */
41209
+
41210
+ function log() {
41211
+ return stream.write(util.format.apply(util, arguments) + '\n');
41212
+ }
41213
+
41214
+ /**
41215
+ * Save `namespaces`.
41216
+ *
41217
+ * @param {String} namespaces
41218
+ * @api private
41219
+ */
41220
+
41221
+ function save(namespaces) {
41222
+ if (null == namespaces) {
41223
+ // If you set a process.env field to null or undefined, it gets cast to the
41224
+ // string 'null' or 'undefined'. Just delete instead.
41225
+ delete process.env.DEBUG;
41226
+ } else {
41227
+ process.env.DEBUG = namespaces;
41228
+ }
41229
+ }
41230
+
41231
+ /**
41232
+ * Load `namespaces`.
41233
+ *
41234
+ * @return {String} returns the previously persisted debug modes
41235
+ * @api private
41236
+ */
41237
+
41238
+ function load() {
41239
+ return process.env.DEBUG;
41240
+ }
41241
+
41242
+ /**
41243
+ * Copied from `node/src/node.js`.
41244
+ *
41245
+ * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
41246
+ * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
41247
+ */
41248
+
41249
+ function createWritableStdioStream (fd) {
41250
+ var stream;
41251
+ var tty_wrap = process.binding('tty_wrap');
41252
+
41253
+ // Note stream._type is used for test-module-load-list.js
41254
+
41255
+ switch (tty_wrap.guessHandleType(fd)) {
41256
+ case 'TTY':
41257
+ stream = new tty.WriteStream(fd);
41258
+ stream._type = 'tty';
41259
+
41260
+ // Hack to have stream not keep the event loop alive.
41261
+ // See https://github.com/joyent/node/issues/1726
41262
+ if (stream._handle && stream._handle.unref) {
41263
+ stream._handle.unref();
41264
+ }
41265
+ break;
41266
+
41267
+ case 'FILE':
41268
+ var fs = require$$0__default;
41269
+ stream = new fs.SyncWriteStream(fd, { autoClose: false });
41270
+ stream._type = 'fs';
41271
+ break;
41272
+
41273
+ case 'PIPE':
41274
+ case 'TCP':
41275
+ var net = require$$4$1;
41276
+ stream = new net.Socket({
41277
+ fd: fd,
41278
+ readable: false,
41279
+ writable: true
41280
+ });
41281
+
41282
+ // FIXME Should probably have an option in net.Socket to create a
41283
+ // stream from an existing fd which is writable only. But for now
41284
+ // we'll just add this hack and set the `readable` member to false.
41285
+ // Test: ./node test/fixtures/echo.js < /etc/passwd
41286
+ stream.readable = false;
41287
+ stream.read = null;
41288
+ stream._type = 'pipe';
41289
+
41290
+ // FIXME Hack to have stream not keep the event loop alive.
41291
+ // See https://github.com/joyent/node/issues/1726
41292
+ if (stream._handle && stream._handle.unref) {
41293
+ stream._handle.unref();
41294
+ }
41295
+ break;
41296
+
41297
+ default:
41298
+ // Probably an error on in uv_guess_handle()
41299
+ throw new Error('Implement me. Unknown stream file type!');
41300
+ }
41301
+
41302
+ // For supporting legacy API we put the FD here.
41303
+ stream.fd = fd;
41304
+
41305
+ stream._isStdio = true;
41306
+
41307
+ return stream;
41308
+ }
41309
+
41310
+ /**
41311
+ * Init logic for `debug` instances.
41312
+ *
41313
+ * Create a new `inspectOpts` object in case `useColors` is set
41314
+ * differently for a particular `debug` instance.
41315
+ */
41316
+
41317
+ function init (debug) {
41318
+ debug.inspectOpts = {};
41319
+
41320
+ var keys = Object.keys(exports.inspectOpts);
41321
+ for (var i = 0; i < keys.length; i++) {
41322
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
41323
+ }
41324
+ }
41325
+
41326
+ /**
41327
+ * Enable namespaces listed in `process.env.DEBUG` initially.
41328
+ */
41329
+
41330
+ exports.enable(load());
41331
+ } (node, node.exports));
41332
+ return node.exports;
41333
+ }
41334
+
41304
41335
  /**
41305
41336
  * Detect Electron renderer process, which is node, but we should
41306
41337
  * treat as a browser.
@@ -47348,7 +47379,7 @@ var etag_1 = etag;
47348
47379
  * @private
47349
47380
  */
47350
47381
 
47351
- var crypto = require$$0$a;
47382
+ var crypto = require$$3$1;
47352
47383
  var Stats = require$$0__default.Stats;
47353
47384
 
47354
47385
  /**
@@ -47653,7 +47684,8 @@ function resolvePlugin(resolveOptions) {
47653
47684
  // externalize if building for SSR, otherwise redirect to empty module
47654
47685
  if (isBuiltin(id)) {
47655
47686
  if (ssr) {
47656
- if (ssrNoExternal === true &&
47687
+ if (targetWeb &&
47688
+ ssrNoExternal === true &&
47657
47689
  // if both noExternal and external are true, noExternal will take the higher priority and bundle it.
47658
47690
  // only if the id is explicitly listed in external, we will externalize it and skip this error.
47659
47691
  (ssrExternal === true || !ssrExternal?.includes(id))) {
@@ -47859,7 +47891,17 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
47859
47891
  else {
47860
47892
  basedir = root;
47861
47893
  }
47862
- const pkg = resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache);
47894
+ let selfPkg = null;
47895
+ if (!isBuiltin(id) && !id.includes('\0') && bareImportRE.test(id)) {
47896
+ // check if it's a self reference dep.
47897
+ const selfPackageData = findNearestPackageData(basedir, packageCache);
47898
+ selfPkg =
47899
+ selfPackageData?.data.exports && selfPackageData?.data.name === pkgId
47900
+ ? selfPackageData
47901
+ : null;
47902
+ }
47903
+ const pkg = selfPkg ||
47904
+ resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache);
47863
47905
  if (!pkg) {
47864
47906
  // if import can't be found, check if it's an optional peer dep.
47865
47907
  // if so, we can resolve to a special id that errors only when imported.
@@ -49444,7 +49486,7 @@ function webWorkerPlugin(config) {
49444
49486
  const filename = fileNameHash.get(hash);
49445
49487
  const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
49446
49488
  const replacementString = typeof replacement === 'string'
49447
- ? JSON.stringify(replacement).slice(1, -1)
49489
+ ? JSON.stringify(encodeURI(replacement)).slice(1, -1)
49448
49490
  : `"+${replacement.runtime}+"`;
49449
49491
  s.update(match.index, match.index + full.length, replacementString);
49450
49492
  }
@@ -49577,6 +49619,10 @@ function getAliasPatterns(entries) {
49577
49619
  }
49578
49620
  return Object.entries(entries).map(([find]) => find);
49579
49621
  }
49622
+ function getAliasPatternMatcher(entries) {
49623
+ const patterns = getAliasPatterns(entries);
49624
+ return (importee) => patterns.some((pattern) => matches(pattern, importee));
49625
+ }
49580
49626
 
49581
49627
  function err(e, pos) {
49582
49628
  const error = new Error(e);
@@ -50441,7 +50487,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
50441
50487
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
50442
50488
  SOFTWARE.
50443
50489
  */
50444
- const noop$3 = () => { };
50490
+ const noop$2 = () => { };
50445
50491
  const ERR_CLOSED_SERVER = 'ERR_CLOSED_SERVER';
50446
50492
  function throwClosedServerError() {
50447
50493
  const err = new Error('The server is being restarted or closed. Request is outdated');
@@ -50474,11 +50520,11 @@ async function createPluginContainer(config, moduleGraph, watcher) {
50474
50520
  rollupVersion,
50475
50521
  watchMode: true,
50476
50522
  },
50477
- debug: noop$3,
50478
- info: noop$3,
50479
- warn: noop$3,
50523
+ debug: noop$2,
50524
+ info: noop$2,
50525
+ warn: noop$2,
50480
50526
  // @ts-expect-error noop
50481
- error: noop$3,
50527
+ error: noop$2,
50482
50528
  };
50483
50529
  function warnIncompatibleMethod(method, plugin) {
50484
50530
  logger.warn(colors$1.cyan(`[plugin:${plugin}] `) +
@@ -50640,8 +50686,8 @@ async function createPluginContainer(config, moduleGraph, watcher) {
50640
50686
  // the the error middleware.
50641
50687
  throw formatError(e, position, this);
50642
50688
  }
50643
- debug = noop$3;
50644
- info = noop$3;
50689
+ debug = noop$2;
50690
+ info = noop$2;
50645
50691
  }
50646
50692
  function formatError(e, position, ctx) {
50647
50693
  const err = (typeof e === 'string' ? new Error(e) : e);
@@ -53164,7 +53210,7 @@ function parse$5(req) {
53164
53210
  return req._parsedUrl = { pathname, search, query, raw };
53165
53211
  }
53166
53212
 
53167
- const noop$2 = () => {};
53213
+ const noop$1 = () => {};
53168
53214
 
53169
53215
  function isMatch(uri, arr) {
53170
53216
  for (let i=0; i < arr.length; i++) {
@@ -53280,7 +53326,7 @@ function sirv (dir, opts={}) {
53280
53326
  dir = resolve$3(dir || '.');
53281
53327
 
53282
53328
  let isNotFound = opts.onNoMatch || is404;
53283
- let setHeaders = opts.setHeaders || noop$2;
53329
+ let setHeaders = opts.setHeaders || noop$1;
53284
53330
 
53285
53331
  let extensions = opts.extensions || ['html', 'htm'];
53286
53332
  let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz');
@@ -54806,7 +54852,11 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
54806
54852
  // Tolerate circular imports by ensuring the module can be
54807
54853
  // referenced before it's been instantiated.
54808
54854
  mod.ssrModule = ssrModule;
54855
+ // replace '/' with '\\' on Windows to match Node.js
54856
+ const osNormalizedFilename = isWindows$5 ? path$o.resolve(mod.file) : mod.file;
54809
54857
  const ssrImportMeta = {
54858
+ dirname: path$o.dirname(osNormalizedFilename),
54859
+ filename: osNormalizedFilename,
54810
54860
  // The filesystem URL, matching native Node.js modules
54811
54861
  url: pathToFileURL(mod.file).toString(),
54812
54862
  };
@@ -55392,56 +55442,6 @@ var open$1 = /*@__PURE__*/getDefaultExportFromCjs(open_1);
55392
55442
 
55393
55443
  var crossSpawn = {exports: {}};
55394
55444
 
55395
- var mode;
55396
- var hasRequiredMode;
55397
-
55398
- function requireMode () {
55399
- if (hasRequiredMode) return mode;
55400
- hasRequiredMode = 1;
55401
- mode = isexe;
55402
- isexe.sync = sync;
55403
-
55404
- var fs = require$$0__default;
55405
-
55406
- function isexe (path, options, cb) {
55407
- fs.stat(path, function (er, stat) {
55408
- cb(er, er ? false : checkStat(stat, options));
55409
- });
55410
- }
55411
-
55412
- function sync (path, options) {
55413
- return checkStat(fs.statSync(path), options)
55414
- }
55415
-
55416
- function checkStat (stat, options) {
55417
- return stat.isFile() && checkMode(stat, options)
55418
- }
55419
-
55420
- function checkMode (stat, options) {
55421
- var mod = stat.mode;
55422
- var uid = stat.uid;
55423
- var gid = stat.gid;
55424
-
55425
- var myUid = options.uid !== undefined ?
55426
- options.uid : process.getuid && process.getuid();
55427
- var myGid = options.gid !== undefined ?
55428
- options.gid : process.getgid && process.getgid();
55429
-
55430
- var u = parseInt('100', 8);
55431
- var g = parseInt('010', 8);
55432
- var o = parseInt('001', 8);
55433
- var ug = u | g;
55434
-
55435
- var ret = (mod & o) ||
55436
- (mod & g) && gid === myGid ||
55437
- (mod & u) && uid === myUid ||
55438
- (mod & ug) && myUid === 0;
55439
-
55440
- return ret
55441
- }
55442
- return mode;
55443
- }
55444
-
55445
55445
  var windows;
55446
55446
  var hasRequiredWindows;
55447
55447
 
@@ -55493,6 +55493,56 @@ function requireWindows () {
55493
55493
  return windows;
55494
55494
  }
55495
55495
 
55496
+ var mode;
55497
+ var hasRequiredMode;
55498
+
55499
+ function requireMode () {
55500
+ if (hasRequiredMode) return mode;
55501
+ hasRequiredMode = 1;
55502
+ mode = isexe;
55503
+ isexe.sync = sync;
55504
+
55505
+ var fs = require$$0__default;
55506
+
55507
+ function isexe (path, options, cb) {
55508
+ fs.stat(path, function (er, stat) {
55509
+ cb(er, er ? false : checkStat(stat, options));
55510
+ });
55511
+ }
55512
+
55513
+ function sync (path, options) {
55514
+ return checkStat(fs.statSync(path), options)
55515
+ }
55516
+
55517
+ function checkStat (stat, options) {
55518
+ return stat.isFile() && checkMode(stat, options)
55519
+ }
55520
+
55521
+ function checkMode (stat, options) {
55522
+ var mod = stat.mode;
55523
+ var uid = stat.uid;
55524
+ var gid = stat.gid;
55525
+
55526
+ var myUid = options.uid !== undefined ?
55527
+ options.uid : process.getuid && process.getuid();
55528
+ var myGid = options.gid !== undefined ?
55529
+ options.gid : process.getgid && process.getgid();
55530
+
55531
+ var u = parseInt('100', 8);
55532
+ var g = parseInt('010', 8);
55533
+ var o = parseInt('001', 8);
55534
+ var ug = u | g;
55535
+
55536
+ var ret = (mod & o) ||
55537
+ (mod & g) && gid === myGid ||
55538
+ (mod & u) && uid === myUid ||
55539
+ (mod & ug) && myUid === 0;
55540
+
55541
+ return ret
55542
+ }
55543
+ return mode;
55544
+ }
55545
+
55496
55546
  var core;
55497
55547
  if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
55498
55548
  core = requireWindows();
@@ -56578,7 +56628,7 @@ let Limiter$1 = class Limiter {
56578
56628
 
56579
56629
  var limiter = Limiter$1;
56580
56630
 
56581
- const zlib = require$$0$b;
56631
+ const zlib = zlib$1;
56582
56632
 
56583
56633
  const bufferUtil = bufferUtilExports;
56584
56634
  const Limiter = limiter;
@@ -57093,7 +57143,7 @@ function inflateOnError(err) {
57093
57143
 
57094
57144
  var validation = {exports: {}};
57095
57145
 
57096
- const { isUtf8 } = require$$0$c;
57146
+ const { isUtf8 } = require$$0$a;
57097
57147
 
57098
57148
  //
57099
57149
  // Allowed token characters:
@@ -57966,7 +58016,7 @@ function throwErrorNextTick(err) {
57966
58016
  }
57967
58017
 
57968
58018
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
57969
- const { randomFillSync } = require$$0$a;
58019
+ const { randomFillSync } = require$$3$1;
57970
58020
 
57971
58021
  const PerMessageDeflate$2 = permessageDeflate;
57972
58022
  const { EMPTY_BUFFER: EMPTY_BUFFER$1 } = constants;
@@ -58939,7 +58989,7 @@ const https$2 = require$$1$1;
58939
58989
  const http$3 = require$$1;
58940
58990
  const net = require$$4$1;
58941
58991
  const tls = require$$4$2;
58942
- const { randomBytes, createHash: createHash$1 } = require$$0$a;
58992
+ const { randomBytes, createHash: createHash$1 } = require$$3$1;
58943
58993
  const { URL: URL$2 } = require$$0$9;
58944
58994
 
58945
58995
  const PerMessageDeflate$1 = permessageDeflate;
@@ -58953,7 +59003,7 @@ const {
58953
59003
  kListener,
58954
59004
  kStatusCode,
58955
59005
  kWebSocket: kWebSocket$1,
58956
- NOOP
59006
+ NOOP: NOOP$1
58957
59007
  } = constants;
58958
59008
  const {
58959
59009
  EventTarget: { addEventListener, removeEventListener }
@@ -60149,7 +60199,7 @@ function receiverOnMessage(data, isBinary) {
60149
60199
  function receiverOnPing(data) {
60150
60200
  const websocket = this[kWebSocket$1];
60151
60201
 
60152
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
60202
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP$1);
60153
60203
  websocket.emit('ping', data);
60154
60204
  }
60155
60205
 
@@ -60258,7 +60308,7 @@ function socketOnError$1() {
60258
60308
  const websocket = this[kWebSocket$1];
60259
60309
 
60260
60310
  this.removeListener('error', socketOnError$1);
60261
- this.on('error', NOOP);
60311
+ this.on('error', NOOP$1);
60262
60312
 
60263
60313
  if (websocket) {
60264
60314
  websocket._readyState = WebSocket$1.CLOSING;
@@ -60331,7 +60381,7 @@ var subprotocol$1 = { parse };
60331
60381
 
60332
60382
  const EventEmitter = require$$0$5;
60333
60383
  const http$2 = require$$1;
60334
- const { createHash } = require$$0$a;
60384
+ const { createHash } = require$$3$1;
60335
60385
 
60336
60386
  const extension = extension$1;
60337
60387
  const PerMessageDeflate = permessageDeflate;
@@ -62458,7 +62508,7 @@ function wrap(protocols) {
62458
62508
  }
62459
62509
 
62460
62510
  /* istanbul ignore next */
62461
- function noop$1() { /* empty */ }
62511
+ function noop() { /* empty */ }
62462
62512
 
62463
62513
  // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
62464
62514
  function urlToOptions(urlObject) {
@@ -62514,7 +62564,7 @@ function abortRequest(request) {
62514
62564
  for (var e = 0; e < events.length; e++) {
62515
62565
  request.removeListener(events[e], eventHandlers[events[e]]);
62516
62566
  }
62517
- request.on("error", noop$1);
62567
+ request.on("error", noop);
62518
62568
  request.abort();
62519
62569
  }
62520
62570
 
@@ -64840,6 +64890,22 @@ function resolveServerOptions(root, raw, logger) {
64840
64890
  if (!allowDirs) {
64841
64891
  allowDirs = [searchForWorkspaceRoot(root)];
64842
64892
  }
64893
+ if (process.versions.pnp) {
64894
+ try {
64895
+ const enableGlobalCache = execSync('yarn config get enableGlobalCache', { cwd: root })
64896
+ .toString()
64897
+ .trim() === 'true';
64898
+ const yarnCacheDir = execSync(`yarn config get ${enableGlobalCache ? 'globalFolder' : 'cacheFolder'}`, { cwd: root })
64899
+ .toString()
64900
+ .trim();
64901
+ allowDirs.push(yarnCacheDir);
64902
+ }
64903
+ catch (e) {
64904
+ logger.warn(`Get yarn cache dir error: ${e.message}`, {
64905
+ timestamp: true,
64906
+ });
64907
+ }
64908
+ }
64843
64909
  allowDirs = allowDirs.map((i) => resolvedAllowDir(root, i));
64844
64910
  // only push client dir when vite itself is outside-of-root
64845
64911
  const resolvedClientDir = resolvedAllowDir(root, CLIENT_DIR);
@@ -65591,6 +65657,7 @@ function importAnalysisPlugin(config) {
65591
65657
  const fsUtils = getFsUtils(config);
65592
65658
  const clientPublicPath = path$o.posix.join(base, CLIENT_PUBLIC_PATH);
65593
65659
  const enablePartialAccept = config.experimental?.hmrPartialAccept;
65660
+ const matchAlias = getAliasPatternMatcher(config.resolve.alias);
65594
65661
  let server;
65595
65662
  let _env;
65596
65663
  let _ssrEnv;
@@ -65834,7 +65901,7 @@ function importAnalysisPlugin(config) {
65834
65901
  return;
65835
65902
  }
65836
65903
  // skip ssr external
65837
- if (ssr) {
65904
+ if (ssr && !matchAlias(specifier)) {
65838
65905
  if (shouldExternalizeForSSR(specifier, importer, config)) {
65839
65906
  return;
65840
65907
  }
@@ -65895,7 +65962,7 @@ function importAnalysisPlugin(config) {
65895
65962
  rewriteDone = true;
65896
65963
  }
65897
65964
  if (!rewriteDone) {
65898
- const rewrittenUrl = JSON.stringify(url);
65965
+ const rewrittenUrl = JSON.stringify(partialEncodeURI(url));
65899
65966
  const s = isDynamicImport ? start : start - 1;
65900
65967
  const e = isDynamicImport ? end : end + 1;
65901
65968
  str().overwrite(s, e, rewrittenUrl, {
@@ -67322,7 +67389,7 @@ function escapeId(id) {
67322
67389
  return id.replace(backSlashRegEx, '\\\\').replace(quoteNewlineRegEx, '\\$1');
67323
67390
  }
67324
67391
  const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
67325
- const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${escapeId(relativePath)}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
67392
+ const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
67326
67393
  const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
67327
67394
  const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${escapeId(path)}'`);
67328
67395
  const relativeUrlMechanisms = {
@@ -67332,16 +67399,16 @@ const relativeUrlMechanisms = {
67332
67399
  return getResolveUrl(`require.toUrl('${escapeId(relativePath)}'), document.baseURI`);
67333
67400
  },
67334
67401
  cjs: (relativePath) => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
67335
- es: (relativePath) => getResolveUrl(`'${escapeId(relativePath)}', import.meta.url`),
67402
+ es: (relativePath) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', import.meta.url`),
67336
67403
  iife: (relativePath) => getRelativeUrlFromDocument(relativePath),
67337
67404
  // NOTE: make sure rollup generate `module` params
67338
- system: (relativePath) => getResolveUrl(`'${escapeId(relativePath)}', module.meta.url`),
67405
+ system: (relativePath) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', module.meta.url`),
67339
67406
  umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`,
67340
67407
  };
67341
67408
  /* end of copy */
67342
67409
  const customRelativeUrlMechanisms = {
67343
67410
  ...relativeUrlMechanisms,
67344
- 'worker-iife': (relativePath) => getResolveUrl(`'${escapeId(relativePath)}', self.location.href`),
67411
+ 'worker-iife': (relativePath) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', self.location.href`),
67345
67412
  };
67346
67413
  function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelative) {
67347
67414
  const { renderBuiltUrl } = config.experimental;
@@ -67432,111 +67499,119 @@ var build$1 = {
67432
67499
  toOutputFilePathWithoutRuntime: toOutputFilePathWithoutRuntime
67433
67500
  };
67434
67501
 
67435
- /* eslint-disable */
67436
- //@ts-nocheck
67437
- //TODO: replace this code with https://github.com/lukeed/polka/pull/148 once it's released
67438
- // This is based on https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/polkompress.js
67439
- // MIT Licensed https://github.com/preactjs/wmr/blob/main/LICENSE
67440
- /* global Buffer */
67441
- const noop = () => { };
67442
- const mimes = /text|javascript|\/json|xml/i;
67443
- const threshold = 1024;
67444
- const level = -1;
67445
- let brotli = false;
67446
- const getChunkSize = (chunk, enc) => (chunk ? Buffer.byteLength(chunk, enc) : 0);
67447
- function compression() {
67448
- const brotliOpts = (typeof brotli === 'object' && brotli) || {};
67449
- const gzipOpts = {};
67450
- // disable Brotli on Node<12.7 where it is unsupported:
67451
- if (!zlib$1.createBrotliCompress)
67452
- brotli = false;
67453
- return function viteCompressionMiddleware(req, res, next = noop) {
67454
- const accept = req.headers['accept-encoding'] + '';
67455
- const encoding = ((brotli && accept.match(/\bbr\b/)) ||
67456
- (accept.match(/\bgzip\b/)) ||
67457
- [])[0];
67458
- // skip if no response body or no supported encoding:
67459
- if (req.method === 'HEAD' || !encoding)
67460
- return next();
67461
- /** @type {zlib.Gzip | zlib.BrotliCompress} */
67462
- let compress;
67463
- let pendingStatus;
67464
- /** @type {[string, function][]?} */
67465
- let pendingListeners = [];
67466
- let started = false;
67467
- let size = 0;
67468
- function start() {
67469
- started = true;
67470
- size = res.getHeader('Content-Length') | 0 || size;
67471
- const compressible = mimes.test(String(res.getHeader('Content-Type') || 'text/plain'));
67472
- const cleartext = !res.getHeader('Content-Encoding');
67473
- const listeners = pendingListeners || [];
67474
- if (compressible && cleartext && size >= threshold) {
67475
- res.setHeader('Content-Encoding', encoding);
67476
- res.removeHeader('Content-Length');
67477
- if (encoding === 'br') {
67478
- const params = {
67479
- [zlib$1.constants.BROTLI_PARAM_QUALITY]: level,
67480
- [zlib$1.constants.BROTLI_PARAM_SIZE_HINT]: size,
67481
- };
67482
- compress = zlib$1.createBrotliCompress({
67483
- params: Object.assign(params, brotliOpts),
67484
- });
67485
- }
67486
- else {
67487
- compress = zlib$1.createGzip(Object.assign({ level }, gzipOpts));
67488
- }
67489
- // backpressure
67490
- compress.on('data', (chunk) => write.call(res, chunk) === false && compress.pause());
67491
- on.call(res, 'drain', () => compress.resume());
67492
- compress.on('end', () => end.call(res));
67493
- listeners.forEach((p) => compress.on.apply(compress, p));
67494
- }
67495
- else {
67496
- pendingListeners = null;
67497
- listeners.forEach((p) => on.apply(res, p));
67498
- }
67499
- writeHead.call(res, pendingStatus || res.statusCode);
67500
- }
67501
- const { end, write, on, writeHead } = res;
67502
- res.writeHead = function (status, reason, headers) {
67503
- if (typeof reason !== 'string')
67504
- [headers, reason] = [reason, headers];
67505
- if (headers)
67506
- for (let i in headers)
67507
- res.setHeader(i, headers[i]);
67508
- pendingStatus = status;
67509
- return this;
67510
- };
67511
- res.write = function (chunk, enc, cb) {
67512
- size += getChunkSize(chunk, enc);
67513
- if (!started)
67514
- start();
67515
- if (!compress)
67516
- return write.apply(this, arguments);
67517
- return compress.write.apply(compress, arguments);
67518
- };
67519
- res.end = function (chunk, enc, cb) {
67520
- if (arguments.length > 0 && typeof chunk !== 'function') {
67521
- size += getChunkSize(chunk, enc);
67522
- }
67523
- if (!started)
67524
- start();
67525
- if (!compress)
67526
- return end.apply(this, arguments);
67527
- return compress.end.apply(compress, arguments);
67528
- };
67529
- res.on = function (type, listener) {
67530
- if (!pendingListeners || type !== 'drain')
67531
- on.call(this, type, listener);
67532
- else if (compress)
67533
- compress.on(type, listener);
67534
- else
67535
- pendingListeners.push([type, listener]);
67536
- return this;
67537
- };
67538
- next();
67539
- };
67502
+ // NOTE: supports Node 6.x
67503
+
67504
+
67505
+ const NOOP = () => {};
67506
+ const MIMES = /text|javascript|\/json|xml/i;
67507
+
67508
+ /**
67509
+ * @param {any} chunk
67510
+ * @param {BufferEncoding} enc
67511
+ * @returns {number}
67512
+ */
67513
+ function getChunkSize(chunk, enc) {
67514
+ return chunk ? Buffer.byteLength(chunk, enc) : 0;
67515
+ }
67516
+
67517
+ /**
67518
+ * @param {import('./index.d.mts').Options} [options]
67519
+ * @returns {import('./index.d.mts').Middleware}
67520
+ */
67521
+ function compression ({ threshold = 1024, level = -1, brotli = false, gzip = true, mimes = MIMES } = {}) {
67522
+ const brotliOpts = (typeof brotli === 'object' && brotli) || {};
67523
+ const gzipOpts = (typeof gzip === 'object' && gzip) || {};
67524
+
67525
+ // disable Brotli on Node<12.7 where it is unsupported:
67526
+ if (!zlib$1.createBrotliCompress) brotli = false;
67527
+
67528
+ return (req, res, next = NOOP) => {
67529
+ const accept = req.headers['accept-encoding'] + '';
67530
+ const encoding = ((brotli && accept.match(/\bbr\b/)) || (gzip && accept.match(/\bgzip\b/)) || [])[0];
67531
+
67532
+ // skip if no response body or no supported encoding:
67533
+ if (req.method === 'HEAD' || !encoding) return next();
67534
+
67535
+ /** @type {zlib.Gzip | zlib.BrotliCompress} */
67536
+ let compress;
67537
+ /** @type {Array<[string, function]>?} */
67538
+ let pendingListeners = [];
67539
+ let pendingStatus = 0;
67540
+ let started = false;
67541
+ let size = 0;
67542
+
67543
+ function start() {
67544
+ started = true;
67545
+ // @ts-ignore
67546
+ size = res.getHeader('Content-Length') | 0 || size;
67547
+ const compressible = mimes.test(
67548
+ String(res.getHeader('Content-Type') || 'text/plain')
67549
+ );
67550
+ const cleartext = !res.getHeader('Content-Encoding');
67551
+ const listeners = pendingListeners || [];
67552
+
67553
+ if (compressible && cleartext && size >= threshold) {
67554
+ res.setHeader('Content-Encoding', encoding);
67555
+ res.removeHeader('Content-Length');
67556
+ if (encoding === 'br') {
67557
+ compress = zlib$1.createBrotliCompress({
67558
+ params: Object.assign({
67559
+ [zlib$1.constants.BROTLI_PARAM_QUALITY]: level,
67560
+ [zlib$1.constants.BROTLI_PARAM_SIZE_HINT]: size,
67561
+ }, brotliOpts)
67562
+ });
67563
+ } else {
67564
+ compress = zlib$1.createGzip(
67565
+ Object.assign({ level }, gzipOpts)
67566
+ );
67567
+ }
67568
+ // backpressure
67569
+ compress.on('data', chunk => write.call(res, chunk) || compress.pause());
67570
+ on.call(res, 'drain', () => compress.resume());
67571
+ compress.on('end', () => end.call(res));
67572
+ listeners.forEach(p => compress.on.apply(compress, p));
67573
+ } else {
67574
+ pendingListeners = null;
67575
+ listeners.forEach(p => on.apply(res, p));
67576
+ }
67577
+
67578
+ writeHead.call(res, pendingStatus || res.statusCode);
67579
+ }
67580
+
67581
+ const { end, write, on, writeHead } = res;
67582
+
67583
+ res.writeHead = function (status, reason, headers) {
67584
+ if (typeof reason !== 'string') [headers, reason] = [reason, headers];
67585
+ if (headers) for (let k in headers) res.setHeader(k, headers[k]);
67586
+ pendingStatus = status;
67587
+ return this;
67588
+ };
67589
+
67590
+ res.write = function (chunk, enc) {
67591
+ size += getChunkSize(chunk, enc);
67592
+ if (!started) start();
67593
+ if (!compress) return write.apply(this, arguments);
67594
+ return compress.write.apply(compress, arguments);
67595
+ };
67596
+
67597
+ res.end = function (chunk, enc) {
67598
+ if (arguments.length > 0 && typeof chunk !== 'function') {
67599
+ size += getChunkSize(chunk, enc);
67600
+ }
67601
+ if (!started) start();
67602
+ if (!compress) return end.apply(this, arguments);
67603
+ return compress.end.apply(compress, arguments);
67604
+ };
67605
+
67606
+ res.on = function (type, listener) {
67607
+ if (!pendingListeners) on.call(this, type, listener);
67608
+ else if (compress) compress.on(type, listener);
67609
+ else pendingListeners.push([type, listener]);
67610
+ return this;
67611
+ };
67612
+
67613
+ next();
67614
+ };
67540
67615
  }
67541
67616
 
67542
67617
  function resolvePreviewOptions(preview, server) {
@@ -68158,6 +68233,8 @@ async function bundleConfigFile(fileName, isESM) {
68158
68233
  __dirname: dirnameVarName,
68159
68234
  __filename: filenameVarName,
68160
68235
  'import.meta.url': importMetaUrlVarName,
68236
+ 'import.meta.dirname': dirnameVarName,
68237
+ 'import.meta.filename': filenameVarName,
68161
68238
  },
68162
68239
  plugins: [
68163
68240
  {