vite 5.0.0-beta.13 → 5.0.0-beta.15

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.
@@ -32,7 +32,7 @@ import assert$1 from 'node:assert';
32
32
  import process$1 from 'node:process';
33
33
  import v8 from 'node:v8';
34
34
  import { VERSION } from 'rollup';
35
- import { parseAst } from 'rollup/parseAst';
35
+ import { parseAstAsync, parseAst } from 'rollup/parseAst';
36
36
  import * as qs from 'querystring';
37
37
  import readline from 'node:readline';
38
38
  import { EventEmitter as EventEmitter$4 } from 'node:events';
@@ -10218,7 +10218,7 @@ class TraceMap {
10218
10218
  const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
10219
10219
  this.version = version;
10220
10220
  this.file = file;
10221
- this.names = names;
10221
+ this.names = names || [];
10222
10222
  this.sourceRoot = sourceRoot;
10223
10223
  this.sources = sources;
10224
10224
  this.sourcesContent = sourcesContent;
@@ -11680,7 +11680,7 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
11680
11680
  }
11681
11681
 
11682
11682
  var srcExports$1 = src$2.exports;
11683
- var debug$h = /*@__PURE__*/getDefaultExportFromCjs(srcExports$1);
11683
+ var debug$i = /*@__PURE__*/getDefaultExportFromCjs(srcExports$1);
11684
11684
 
11685
11685
  let pnp;
11686
11686
  if (process.versions.pnp) {
@@ -12016,7 +12016,7 @@ const _require$2 = createRequire$1(import.meta.url);
12016
12016
  const filter = process.env.VITE_DEBUG_FILTER;
12017
12017
  const DEBUG = process.env.DEBUG;
12018
12018
  function createDebugger(namespace, options = {}) {
12019
- const log = debug$h(namespace);
12019
+ const log = debug$i(namespace);
12020
12020
  const { onlyWhenFocused } = options;
12021
12021
  let enabled = log.enabled;
12022
12022
  if (enabled && onlyWhenFocused) {
@@ -12944,6 +12944,9 @@ function getPackageManagerCommand(type = 'install') {
12944
12944
  throw new TypeError(`Unknown command type: ${type}`);
12945
12945
  }
12946
12946
  }
12947
+ function isDevServer(server) {
12948
+ return 'pluginContainer' in server;
12949
+ }
12947
12950
 
12948
12951
  /* eslint no-console: 0 */
12949
12952
  const LogLevels = {
@@ -14362,7 +14365,7 @@ class TSConfckCache {
14362
14365
  #parsed = new Map();
14363
14366
  }
14364
14367
 
14365
- const debug$g = createDebugger('vite:esbuild');
14368
+ const debug$h = createDebugger('vite:esbuild');
14366
14369
  // IIFE content looks like `var MyLib = function() {`.
14367
14370
  // Spaces are removed and parameters are mangled when minified
14368
14371
  const IIFE_BEGIN_RE = /(const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/;
@@ -14388,7 +14391,6 @@ async function transformWithEsbuild(code, filename, options, inMap) {
14388
14391
  }
14389
14392
  }
14390
14393
  let tsconfigRaw = options?.tsconfigRaw;
14391
- const fallbackSupported = {};
14392
14394
  // if options provide tsconfigRaw in string, it takes highest precedence
14393
14395
  if (typeof tsconfigRaw !== 'string') {
14394
14396
  // these fields would affect the compilation result
@@ -14428,21 +14430,6 @@ async function transformWithEsbuild(code, filename, options, inMap) {
14428
14430
  compilerOptions.target === undefined) {
14429
14431
  compilerOptions.useDefineForClassFields = false;
14430
14432
  }
14431
- // esbuild v0.18 only transforms decorators when `experimentalDecorators` is set to `true`.
14432
- // To preserve compat with the esbuild breaking change, we set `experimentalDecorators` to
14433
- // `true` by default if it's unset.
14434
- // TODO: Remove this in Vite 5
14435
- if (compilerOptions.experimentalDecorators === undefined) {
14436
- compilerOptions.experimentalDecorators = true;
14437
- }
14438
- // Compat with esbuild 0.17 where static properties are transpiled to
14439
- // static blocks when `useDefineForClassFields` is false. Its support
14440
- // is not great yet, so temporarily disable it for now.
14441
- // TODO: Remove this in Vite 5, don't pass hardcoded `esnext` target
14442
- // to `transformWithEsbuild` in the esbuild plugin.
14443
- if (compilerOptions.useDefineForClassFields !== true) {
14444
- fallbackSupported['class-static-blocks'] = false;
14445
- }
14446
14433
  // esbuild uses tsconfig fields when both the normal options and tsconfig was set
14447
14434
  // but we want to prioritize the normal options
14448
14435
  if (options) {
@@ -14463,10 +14450,6 @@ async function transformWithEsbuild(code, filename, options, inMap) {
14463
14450
  ...options,
14464
14451
  loader,
14465
14452
  tsconfigRaw,
14466
- supported: {
14467
- ...fallbackSupported,
14468
- ...options?.supported,
14469
- },
14470
14453
  };
14471
14454
  // Some projects in the ecosystem are calling this function with an ESBuildOptions
14472
14455
  // object and esbuild throws an error for extra fields
@@ -14499,14 +14482,16 @@ async function transformWithEsbuild(code, filename, options, inMap) {
14499
14482
  };
14500
14483
  }
14501
14484
  catch (e) {
14502
- debug$g?.(`esbuild error with options used: `, resolvedOptions);
14485
+ debug$h?.(`esbuild error with options used: `, resolvedOptions);
14503
14486
  // patch error information
14504
14487
  if (e.errors) {
14505
14488
  e.frame = '';
14506
14489
  e.errors.forEach((m) => {
14507
- if (m.text === 'Experimental decorators are not currently enabled') {
14490
+ if (m.text === 'Experimental decorators are not currently enabled' ||
14491
+ m.text ===
14492
+ 'Parameter decorators only work when experimental decorators are enabled') {
14508
14493
  m.text +=
14509
- '. Vite 4.4+ now uses esbuild 0.18 and you need to enable them by adding "experimentalDecorators": true in your "tsconfig.json" file.';
14494
+ '. Vite 5 now uses esbuild 0.18 and you need to enable them by adding "experimentalDecorators": true in your "tsconfig.json" file.';
14510
14495
  }
14511
14496
  e.frame += `\n` + prettifyMessage(m, code);
14512
14497
  });
@@ -16160,7 +16145,7 @@ var convertSourceMap$1 = {};
16160
16145
 
16161
16146
  var convertSourceMap = /*@__PURE__*/getDefaultExportFromCjs(convertSourceMap$1);
16162
16147
 
16163
- const debug$f = createDebugger('vite:sourcemap', {
16148
+ const debug$g = createDebugger('vite:sourcemap', {
16164
16149
  onlyWhenFocused: true,
16165
16150
  });
16166
16151
  // Virtual modules should be prefixed with a null byte to avoid a
@@ -16199,7 +16184,7 @@ async function injectSourcesContent(map, file, logger) {
16199
16184
  // …to log the missing sources.
16200
16185
  if (missingSources.length) {
16201
16186
  logger.warnOnce(`Sourcemap for "${file}" points to missing source files`);
16202
- debug$f?.(`Missing sources:\n ` + missingSources.join(`\n `));
16187
+ debug$g?.(`Missing sources:\n ` + missingSources.join(`\n `));
16203
16188
  }
16204
16189
  }
16205
16190
  function genSourceMapUrl(map) {
@@ -16209,7 +16194,7 @@ function genSourceMapUrl(map) {
16209
16194
  return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
16210
16195
  }
16211
16196
  function getCodeWithSourcemap(type, code, map) {
16212
- if (debug$f) {
16197
+ if (debug$g) {
16213
16198
  code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
16214
16199
  }
16215
16200
  if (type === 'js') {
@@ -20873,10 +20858,10 @@ function e(e,n,r){throw new Error(r?`No known conditions for "${n}" specifier in
20873
20858
  var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
20874
20859
 
20875
20860
  // This file was generated. Do not modify manually!
20876
- var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
20861
+ var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
20877
20862
 
20878
20863
  // This file was generated. Do not modify manually!
20879
- var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
20864
+ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
20880
20865
 
20881
20866
  // This file was generated. Do not modify manually!
20882
20867
  var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
@@ -21144,8 +21129,10 @@ var isArray = Array.isArray || (function (obj) { return (
21144
21129
  toString$1.call(obj) === "[object Array]"
21145
21130
  ); });
21146
21131
 
21132
+ var regexpCache = Object.create(null);
21133
+
21147
21134
  function wordsRegexp(words) {
21148
- return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
21135
+ return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"))
21149
21136
  }
21150
21137
 
21151
21138
  function codePointToString(code) {
@@ -21205,11 +21192,11 @@ var defaultOptions = {
21205
21192
  // Can be either `"script"` or `"module"`. This influences global
21206
21193
  // strict mode and parsing of `import` and `export` declarations.
21207
21194
  sourceType: "script",
21208
- // `onInsertedSemicolon` can be a callback that will be called
21209
- // when a semicolon is automatically inserted. It will be passed
21210
- // the position of the comma as an offset, and if `locations` is
21211
- // enabled, it is given the location as a `{line, column}` object
21212
- // as second argument.
21195
+ // `onInsertedSemicolon` can be a callback that will be called when
21196
+ // a semicolon is automatically inserted. It will be passed the
21197
+ // position of the inserted semicolon as an offset, and if
21198
+ // `locations` is enabled, it is given the location as a `{line,
21199
+ // column}` object as second argument.
21213
21200
  onInsertedSemicolon: null,
21214
21201
  // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
21215
21202
  // trailing commas.
@@ -21262,6 +21249,8 @@ var defaultOptions = {
21262
21249
  // passed, the full `{line, column}` locations of the start and
21263
21250
  // end of the comments. Note that you are not allowed to call the
21264
21251
  // parser from the callback—that will corrupt its internal state.
21252
+ // When this option has an array as value, objects representing the
21253
+ // comments are pushed to it.
21265
21254
  onComment: null,
21266
21255
  // Nodes have their start and end characters offsets recorded in
21267
21256
  // `start` and `end` properties (directly on the node, rather than
@@ -22637,8 +22626,6 @@ pp$8.checkPatternExport = function(exports, pat) {
22637
22626
  { this.checkPatternExport(exports, pat.left); }
22638
22627
  else if (type === "RestElement")
22639
22628
  { this.checkPatternExport(exports, pat.argument); }
22640
- else if (type === "ParenthesizedExpression")
22641
- { this.checkPatternExport(exports, pat.expression); }
22642
22629
  };
22643
22630
 
22644
22631
  pp$8.checkVariableExport = function(exports, decls) {
@@ -23202,7 +23189,7 @@ pp$6.updateContext = function(prevType) {
23202
23189
  { this.exprAllowed = type.beforeExpr; }
23203
23190
  };
23204
23191
 
23205
- // Used to handle egde cases when token context could not be inferred correctly during tokenization phase
23192
+ // Used to handle edge cases when token context could not be inferred correctly during tokenization phase
23206
23193
 
23207
23194
  pp$6.overrideContext = function(tokenCtx) {
23208
23195
  if (this.curContext() !== tokenCtx) {
@@ -23255,6 +23242,11 @@ types$1._function.updateContext = types$1._class.updateContext = function(prevTy
23255
23242
  this.exprAllowed = false;
23256
23243
  };
23257
23244
 
23245
+ types$1.colon.updateContext = function() {
23246
+ if (this.curContext().token === "function") { this.context.pop(); }
23247
+ this.exprAllowed = true;
23248
+ };
23249
+
23258
23250
  types$1.backQuote.updateContext = function() {
23259
23251
  if (this.curContext() === types$2.q_tmpl)
23260
23252
  { this.context.pop(); }
@@ -23953,9 +23945,12 @@ var empty = [];
23953
23945
  pp$5.parseNew = function() {
23954
23946
  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
23955
23947
  var node = this.startNode();
23956
- var meta = this.parseIdent(true);
23957
- if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
23958
- node.meta = meta;
23948
+ this.next();
23949
+ if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
23950
+ var meta = this.startNodeAt(node.start, node.startLoc);
23951
+ meta.name = "new";
23952
+ node.meta = this.finishNode(meta, "Identifier");
23953
+ this.next();
23959
23954
  var containsEsc = this.containsEsc;
23960
23955
  node.property = this.parseIdent(true);
23961
23956
  if (node.property.name !== "target")
@@ -24357,6 +24352,7 @@ pp$5.parseIdentNode = function() {
24357
24352
  (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
24358
24353
  this.context.pop();
24359
24354
  }
24355
+ this.type = types$1.name;
24360
24356
  } else {
24361
24357
  this.unexpected();
24362
24358
  }
@@ -26779,7 +26775,7 @@ pp.readWord = function() {
26779
26775
  // [walk]: util/walk.js
26780
26776
 
26781
26777
 
26782
- var version$2 = "8.10.0";
26778
+ var version$2 = "8.11.2";
26783
26779
 
26784
26780
  Parser$1.acorn = {
26785
26781
  Parser: Parser$1,
@@ -27437,7 +27433,7 @@ const browserExternalId = '__vite-browser-external';
27437
27433
  const optionalPeerDepId = '__vite-optional-peer-dep';
27438
27434
  const subpathImportsPrefix = '#';
27439
27435
  const startsWithWordCharRE = /^\w/;
27440
- const debug$e = createDebugger('vite:resolve-details', {
27436
+ const debug$f = createDebugger('vite:resolve-details', {
27441
27437
  onlyWhenFocused: true,
27442
27438
  });
27443
27439
  function resolvePlugin(resolveOptions) {
@@ -27511,7 +27507,7 @@ function resolvePlugin(resolveOptions) {
27511
27507
  // We don't need to resolve these paths since they are already resolved
27512
27508
  // always return here even if res doesn't exist since /@fs/ is explicit
27513
27509
  // if the file doesn't exist it should be a 404.
27514
- debug$e?.(`[@fs] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27510
+ debug$f?.(`[@fs] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27515
27511
  return ensureVersionQuery(res, id, options, depsOptimizer);
27516
27512
  }
27517
27513
  // URL
@@ -27521,7 +27517,7 @@ function resolvePlugin(resolveOptions) {
27521
27517
  (rootInRoot || !id.startsWith(withTrailingSlash(root)))) {
27522
27518
  const fsPath = path$o.resolve(root, id.slice(1));
27523
27519
  if ((res = tryFsResolve(fsPath, options))) {
27524
- debug$e?.(`[url] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27520
+ debug$f?.(`[url] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27525
27521
  return ensureVersionQuery(res, id, options, depsOptimizer);
27526
27522
  }
27527
27523
  }
@@ -27552,7 +27548,7 @@ function resolvePlugin(resolveOptions) {
27552
27548
  }
27553
27549
  if ((res = tryFsResolve(fsPath, options))) {
27554
27550
  res = ensureVersionQuery(res, id, options, depsOptimizer);
27555
- debug$e?.(`[relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27551
+ debug$f?.(`[relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27556
27552
  // If this isn't a script imported from a .html file, include side effects
27557
27553
  // hints so the non-used code is properly tree-shaken during build time.
27558
27554
  if (!options.idOnly &&
@@ -27575,14 +27571,14 @@ function resolvePlugin(resolveOptions) {
27575
27571
  const basedir = importer ? path$o.dirname(importer) : process.cwd();
27576
27572
  const fsPath = path$o.resolve(basedir, id);
27577
27573
  if ((res = tryFsResolve(fsPath, options))) {
27578
- debug$e?.(`[drive-relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27574
+ debug$f?.(`[drive-relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27579
27575
  return ensureVersionQuery(res, id, options, depsOptimizer);
27580
27576
  }
27581
27577
  }
27582
27578
  // absolute fs paths
27583
27579
  if (isNonDriveRelativeAbsolutePath(id) &&
27584
27580
  (res = tryFsResolve(id, options))) {
27585
- debug$e?.(`[fs] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27581
+ debug$f?.(`[fs] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
27586
27582
  return ensureVersionQuery(res, id, options, depsOptimizer);
27587
27583
  }
27588
27584
  // external
@@ -27628,7 +27624,7 @@ function resolvePlugin(resolveOptions) {
27628
27624
  }
27629
27625
  else {
27630
27626
  if (!asSrc) {
27631
- debug$e?.(`externalized node built-in "${id}" to empty module. ` +
27627
+ debug$f?.(`externalized node built-in "${id}" to empty module. ` +
27632
27628
  `(imported by: ${colors$1.white(colors$1.dim(importer))})`);
27633
27629
  }
27634
27630
  else if (isProduction) {
@@ -27641,7 +27637,7 @@ function resolvePlugin(resolveOptions) {
27641
27637
  }
27642
27638
  }
27643
27639
  }
27644
- debug$e?.(`[fallthrough] ${colors$1.dim(id)}`);
27640
+ debug$f?.(`[fallthrough] ${colors$1.dim(id)}`);
27645
27641
  },
27646
27642
  load(id) {
27647
27643
  if (id.startsWith(browserExternalId)) {
@@ -27894,7 +27890,7 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
27894
27890
  const index = resolved.id.indexOf(id);
27895
27891
  if (index > -1) {
27896
27892
  resolvedId = resolved.id.slice(index);
27897
- debug$e?.(`[processResult] ${colors$1.cyan(id)} -> ${colors$1.dim(resolvedId)}`);
27893
+ debug$f?.(`[processResult] ${colors$1.cyan(id)} -> ${colors$1.dim(resolvedId)}`);
27898
27894
  }
27899
27895
  }
27900
27896
  return { ...resolved, id: resolvedId, external: true };
@@ -28105,7 +28101,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
28105
28101
  const entryPointPath = path$o.join(dir, entry);
28106
28102
  const resolvedEntryPoint = tryFsResolve(entryPointPath, options, true, true, skipPackageJson);
28107
28103
  if (resolvedEntryPoint) {
28108
- debug$e?.(`[package entry] ${colors$1.cyan(idWithoutPostfix)} -> ${colors$1.dim(resolvedEntryPoint)}${postfix !== '' ? ` (postfix: ${postfix})` : ''}`);
28104
+ debug$f?.(`[package entry] ${colors$1.cyan(idWithoutPostfix)} -> ${colors$1.dim(resolvedEntryPoint)}${postfix !== '' ? ` (postfix: ${postfix})` : ''}`);
28109
28105
  setResolvedCache('.', resolvedEntryPoint, targetWeb);
28110
28106
  return resolvedEntryPoint + postfix;
28111
28107
  }
@@ -28193,7 +28189,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
28193
28189
  const resolved = tryFsResolve(path$o.join(dir, relativeId), options, !exportsField, // try index only if no exports field
28194
28190
  targetWeb);
28195
28191
  if (resolved) {
28196
- debug$e?.(`[node/deep-import] ${colors$1.cyan(id)} -> ${colors$1.dim(resolved)}`);
28192
+ debug$f?.(`[node/deep-import] ${colors$1.cyan(id)} -> ${colors$1.dim(resolved)}`);
28197
28193
  setResolvedCache(id, resolved, targetWeb);
28198
28194
  return resolved;
28199
28195
  }
@@ -28210,7 +28206,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
28210
28206
  if ((res = bareImportRE.test(browserMappedPath)
28211
28207
  ? tryNodeResolve(browserMappedPath, importer, options, true)?.id
28212
28208
  : tryFsResolve(path$o.join(pkg.dir, browserMappedPath), options))) {
28213
- debug$e?.(`[browser mapped] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
28209
+ debug$f?.(`[browser mapped] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
28214
28210
  let result = { id: res };
28215
28211
  if (options.idOnly) {
28216
28212
  return result;
@@ -36950,7 +36946,7 @@ function handleParseError(parserError, html, filePath) {
36950
36946
  * Compiles index.html into an entry js module
36951
36947
  */
36952
36948
  function buildHtmlPlugin(config) {
36953
- const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config.plugins);
36949
+ const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config.plugins, config.logger);
36954
36950
  preHooks.unshift(preImportMapHook(config));
36955
36951
  preHooks.push(htmlEnvHook(config));
36956
36952
  postHooks.push(postImportMapHook());
@@ -37475,7 +37471,7 @@ function htmlEnvHook(config) {
37475
37471
  });
37476
37472
  };
37477
37473
  }
37478
- function resolveHtmlTransforms(plugins) {
37474
+ function resolveHtmlTransforms(plugins, logger) {
37479
37475
  const preHooks = [];
37480
37476
  const normalHooks = [];
37481
37477
  const postHooks = [];
@@ -37487,6 +37483,12 @@ function resolveHtmlTransforms(plugins) {
37487
37483
  normalHooks.push(hook);
37488
37484
  }
37489
37485
  else {
37486
+ if (!('order' in hook) && 'enforce' in hook) {
37487
+ logger.warnOnce(colors$1.yellow(`plugin '${plugin.name}' uses deprecated 'enforce' option. Use 'order' option instead.`));
37488
+ }
37489
+ if (!('handler' in hook) && 'transform' in hook) {
37490
+ logger.warnOnce(colors$1.yellow(`plugin '${plugin.name}' uses deprecated 'transform' option. Use 'handler' option instead.`));
37491
+ }
37490
37492
  // `enforce` had only two possible values for the `transformIndexHtml` hook
37491
37493
  // `'pre'` and `'post'` (the default). `order` now works with three values
37492
37494
  // to align with other hooks (`'pre'`, normal, and `'post'`). We map
@@ -38477,8 +38479,8 @@ function createCachedImport(imp) {
38477
38479
  return cached;
38478
38480
  };
38479
38481
  }
38480
- const importPostcssImport = createCachedImport(() => import('./dep-gEG0N6Wc.js').then(function (n) { return n.i; }));
38481
- const importPostcssModules = createCachedImport(() => import('./dep-65DCjPft.js').then(function (n) { return n.i; }));
38482
+ const importPostcssImport = createCachedImport(() => import('./dep-01ZZG1lv.js').then(function (n) { return n.i; }));
38483
+ const importPostcssModules = createCachedImport(() => import('./dep-dhvB1mwU.js').then(function (n) { return n.i; }));
38482
38484
  const importPostcss = createCachedImport(() => import('postcss'));
38483
38485
  /**
38484
38486
  * @experimental
@@ -39567,7 +39569,7 @@ function esbuildCjsExternalPlugin(externals, platform) {
39567
39569
  };
39568
39570
  }
39569
39571
 
39570
- const debug$d = createDebugger('vite:ssr-external');
39572
+ const debug$e = createDebugger('vite:ssr-external');
39571
39573
  const isSsrExternalCache = new WeakMap();
39572
39574
  function shouldExternalizeForSSR(id, importer, config) {
39573
39575
  let isSsrExternal = isSsrExternalCache.get(config);
@@ -39608,7 +39610,7 @@ function createIsConfiguredAsSsrExternal(config) {
39608
39610
  !!configuredAsExternal)?.external;
39609
39611
  }
39610
39612
  catch (e) {
39611
- debug$d?.(`Failed to node resolve "${id}". Skipping externalizing it by default.`);
39613
+ debug$e?.(`Failed to node resolve "${id}". Skipping externalizing it by default.`);
39612
39614
  // may be an invalid import that's resolved by a plugin
39613
39615
  return false;
39614
39616
  }
@@ -39718,7 +39720,7 @@ function jsonPlugin(options = {}, isBuild) {
39718
39720
 
39719
39721
  const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = 'ERR_OPTIMIZE_DEPS_PROCESSING_ERROR';
39720
39722
  const ERR_OUTDATED_OPTIMIZED_DEP = 'ERR_OUTDATED_OPTIMIZED_DEP';
39721
- const debug$c = createDebugger('vite:optimize-deps');
39723
+ const debug$d = createDebugger('vite:optimize-deps');
39722
39724
  function optimizedDepsPlugin(config) {
39723
39725
  return {
39724
39726
  name: 'vite:optimized-deps',
@@ -39765,7 +39767,7 @@ function optimizedDepsPlugin(config) {
39765
39767
  }
39766
39768
  }
39767
39769
  }
39768
- debug$c?.(`load ${colors$1.cyan(file)}`);
39770
+ debug$d?.(`load ${colors$1.cyan(file)}`);
39769
39771
  // Load the file from the cache instead of waiting for other plugin
39770
39772
  // load hooks to avoid race conditions, once processing is resolved,
39771
39773
  // we are sure that the file has been properly save to disk
@@ -39825,7 +39827,7 @@ function optimizedDepsBuildPlugin(config) {
39825
39827
  const info = optimizedDepInfoFromFile(depsOptimizer.metadata, file);
39826
39828
  if (info) {
39827
39829
  await info.processing;
39828
- debug$c?.(`load ${colors$1.cyan(file)}`);
39830
+ debug$d?.(`load ${colors$1.cyan(file)}`);
39829
39831
  }
39830
39832
  else {
39831
39833
  throw new Error(`Something unexpected happened while optimizing "${id}".`);
@@ -40550,7 +40552,7 @@ var src = {exports: {}};
40550
40552
 
40551
40553
  var node = {exports: {}};
40552
40554
 
40553
- var debug$b = {exports: {}};
40555
+ var debug$c = {exports: {}};
40554
40556
 
40555
40557
  /**
40556
40558
  * Helpers.
@@ -40716,7 +40718,7 @@ function requireMs () {
40716
40718
  var hasRequiredDebug;
40717
40719
 
40718
40720
  function requireDebug () {
40719
- if (hasRequiredDebug) return debug$b.exports;
40721
+ if (hasRequiredDebug) return debug$c.exports;
40720
40722
  hasRequiredDebug = 1;
40721
40723
  (function (module, exports) {
40722
40724
  /**
@@ -40920,8 +40922,8 @@ function requireDebug () {
40920
40922
  if (val instanceof Error) return val.stack || val.message;
40921
40923
  return val;
40922
40924
  }
40923
- } (debug$b, debug$b.exports));
40924
- return debug$b.exports;
40925
+ } (debug$c, debug$c.exports));
40926
+ return debug$c.exports;
40925
40927
  }
40926
40928
 
40927
40929
  /**
@@ -42240,7 +42242,7 @@ function unpipe$1(stream) {
42240
42242
  * @private
42241
42243
  */
42242
42244
 
42243
- var debug$a = srcExports('finalhandler');
42245
+ var debug$b = srcExports('finalhandler');
42244
42246
  var encodeUrl = encodeurl;
42245
42247
  var escapeHtml = escapeHtml_1;
42246
42248
  var onFinished = onFinishedExports;
@@ -42319,7 +42321,7 @@ function finalhandler$1 (req, res, options) {
42319
42321
 
42320
42322
  // ignore 404 on in-flight response
42321
42323
  if (!err && headersSent(res)) {
42322
- debug$a('cannot 404 after headers sent');
42324
+ debug$b('cannot 404 after headers sent');
42323
42325
  return
42324
42326
  }
42325
42327
 
@@ -42344,7 +42346,7 @@ function finalhandler$1 (req, res, options) {
42344
42346
  msg = 'Cannot ' + req.method + ' ' + encodeUrl(getResourceName(req));
42345
42347
  }
42346
42348
 
42347
- debug$a('default %s', status);
42349
+ debug$b('default %s', status);
42348
42350
 
42349
42351
  // schedule onerror callback
42350
42352
  if (err && onerror) {
@@ -42353,7 +42355,7 @@ function finalhandler$1 (req, res, options) {
42353
42355
 
42354
42356
  // cannot actually respond
42355
42357
  if (headersSent(res)) {
42356
- debug$a('cannot %d after headers sent', status);
42358
+ debug$b('cannot %d after headers sent', status);
42357
42359
  req.socket.destroy();
42358
42360
  return
42359
42361
  }
@@ -42602,7 +42604,7 @@ var utilsMergeExports = utilsMerge.exports;
42602
42604
  * @private
42603
42605
  */
42604
42606
 
42605
- var debug$9 = srcExports('connect:dispatcher');
42607
+ var debug$a = srcExports('connect:dispatcher');
42606
42608
  var EventEmitter$3 = require$$0$5.EventEmitter;
42607
42609
  var finalhandler = finalhandler_1;
42608
42610
  var http$4 = require$$1$1;
@@ -42692,7 +42694,7 @@ proto.use = function use(route, fn) {
42692
42694
  }
42693
42695
 
42694
42696
  // add the middleware
42695
- debug$9('use %s %s', path || '/', handle.name || 'anonymous');
42697
+ debug$a('use %s %s', path || '/', handle.name || 'anonymous');
42696
42698
  this.stack.push({ route: path, handle: handle });
42697
42699
 
42698
42700
  return this;
@@ -42816,7 +42818,7 @@ function call(handle, route, err, req, res, next) {
42816
42818
  var error = err;
42817
42819
  var hasError = Boolean(err);
42818
42820
 
42819
- debug$9('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
42821
+ debug$a('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
42820
42822
 
42821
42823
  try {
42822
42824
  if (hasError && arity === 4) {
@@ -42869,7 +42871,7 @@ function getProtohost(url) {
42869
42871
 
42870
42872
  var connect$1 = /*@__PURE__*/getDefaultExportFromCjs(connect);
42871
42873
 
42872
- var lib$1 = {exports: {}};
42874
+ var lib = {exports: {}};
42873
42875
 
42874
42876
  /*
42875
42877
  object-assign
@@ -43345,12 +43347,12 @@ var varyExports = vary$1.exports;
43345
43347
  }
43346
43348
 
43347
43349
  // can pass either an options hash, an options delegate, or nothing
43348
- lib$1.exports = middlewareWrapper;
43350
+ lib.exports = middlewareWrapper;
43349
43351
 
43350
43352
  }());
43351
43353
 
43352
- var libExports$1 = lib$1.exports;
43353
- var corsMiddleware = /*@__PURE__*/getDefaultExportFromCjs(libExports$1);
43354
+ var libExports = lib.exports;
43355
+ var corsMiddleware = /*@__PURE__*/getDefaultExportFromCjs(libExports);
43354
43356
 
43355
43357
  var chokidar = {};
43356
43358
 
@@ -47648,7 +47650,7 @@ async function doTransform(url, server, options, timestamp) {
47648
47650
  // tries to handle soft invalidation of the module if available,
47649
47651
  // returns a boolean true is successful, or false if no handling is needed
47650
47652
  const softInvalidatedTransformResult = module &&
47651
- (await handleModuleSoftInvalidation(module, ssr, timestamp, server.config.base));
47653
+ (await handleModuleSoftInvalidation(module, ssr, timestamp, server));
47652
47654
  if (softInvalidatedTransformResult) {
47653
47655
  debugCache$1?.(`[memory-hmr] ${prettyUrl}`);
47654
47656
  return softInvalidatedTransformResult;
@@ -47825,7 +47827,7 @@ function createConvertSourceMapReadMap(originalFileName) {
47825
47827
  * - Client: We need to transform the import specifiers with new timestamps
47826
47828
  * - SSR: We don't need to change anything as `ssrLoadModule` controls it
47827
47829
  */
47828
- async function handleModuleSoftInvalidation(mod, ssr, timestamp, base) {
47830
+ async function handleModuleSoftInvalidation(mod, ssr, timestamp, server) {
47829
47831
  const transformResult = ssr ? mod.ssrInvalidationState : mod.invalidationState;
47830
47832
  // Reset invalidation state
47831
47833
  if (ssr)
@@ -47836,7 +47838,7 @@ async function handleModuleSoftInvalidation(mod, ssr, timestamp, base) {
47836
47838
  if (!transformResult || transformResult === 'HARD_INVALIDATED')
47837
47839
  return;
47838
47840
  if (ssr ? mod.ssrTransformResult : mod.transformResult) {
47839
- throw new Error(`Internal server error: Soft-invalidated module "${mod.url}" should not have existing tranform result`);
47841
+ throw new Error(`Internal server error: Soft-invalidated module "${mod.url}" should not have existing transform result`);
47840
47842
  }
47841
47843
  let result;
47842
47844
  // For SSR soft-invalidation, no transformation is needed
@@ -47859,7 +47861,7 @@ async function handleModuleSoftInvalidation(mod, ssr, timestamp, base) {
47859
47861
  }
47860
47862
  const urlWithoutTimestamp = removeTimestampQuery(rawUrl);
47861
47863
  // hmrUrl must be derived the same way as importAnalysis
47862
- const hmrUrl = unwrapId(stripBase(removeImportQuery(urlWithoutTimestamp), base));
47864
+ const hmrUrl = unwrapId(stripBase(removeImportQuery(urlWithoutTimestamp), server.config.base));
47863
47865
  for (const importedMod of mod.clientImportedModules) {
47864
47866
  if (importedMod.url !== hmrUrl)
47865
47867
  continue;
@@ -47869,6 +47871,10 @@ async function handleModuleSoftInvalidation(mod, ssr, timestamp, base) {
47869
47871
  const end = hasQuotes ? imp.e - 1 : imp.e;
47870
47872
  s.overwrite(start, end, replacedUrl);
47871
47873
  }
47874
+ if (imp.d === -1 && server.config.server.preTransformRequests) {
47875
+ // pre-transform known direct imports
47876
+ server.warmupRequest(hmrUrl, { ssr });
47877
+ }
47872
47878
  break;
47873
47879
  }
47874
47880
  }
@@ -48205,7 +48211,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
48205
48211
  const s = new MagicString(code);
48206
48212
  let ast;
48207
48213
  try {
48208
- ast = parseAst(code);
48214
+ ast = await parseAstAsync(code);
48209
48215
  }
48210
48216
  catch (err) {
48211
48217
  if (!err.loc || !err.loc.line)
@@ -50152,9 +50158,9 @@ function bindCLIShortcuts(server, opts) {
50152
50158
  colors$1.bold('h + enter') +
50153
50159
  colors$1.dim(' to show help'));
50154
50160
  }
50155
- const shortcuts = (opts?.customShortcuts ?? [])
50156
- // @ts-expect-error passing the right types, but typescript can't detect it
50157
- .concat(isDev ? BASE_DEV_SHORTCUTS : BASE_PREVIEW_SHORTCUTS);
50161
+ const shortcuts = (opts?.customShortcuts ?? []).concat((isDev
50162
+ ? BASE_DEV_SHORTCUTS
50163
+ : BASE_PREVIEW_SHORTCUTS));
50158
50164
  let actionRunning = false;
50159
50165
  const onInput = async (input) => {
50160
50166
  if (actionRunning)
@@ -50183,9 +50189,6 @@ function bindCLIShortcuts(server, opts) {
50183
50189
  rl.on('line', onInput);
50184
50190
  server.httpServer.on('close', () => rl.close());
50185
50191
  }
50186
- function isDevServer(server) {
50187
- return 'pluginContainer' in server;
50188
- }
50189
50192
  const BASE_DEV_SHORTCUTS = [
50190
50193
  {
50191
50194
  key: 'r',
@@ -55741,20 +55744,20 @@ var webOutgoing = { // <--
55741
55744
 
55742
55745
  var followRedirects$1 = {exports: {}};
55743
55746
 
55744
- var debug$8;
55747
+ var debug$9;
55745
55748
 
55746
55749
  var debug_1 = function () {
55747
- if (!debug$8) {
55750
+ if (!debug$9) {
55748
55751
  try {
55749
55752
  /* eslint global-require: off */
55750
- debug$8 = srcExports$1("follow-redirects");
55753
+ debug$9 = srcExports$1("follow-redirects");
55751
55754
  }
55752
55755
  catch (error) { /* */ }
55753
- if (typeof debug$8 !== "function") {
55754
- debug$8 = function () { /* */ };
55756
+ if (typeof debug$9 !== "function") {
55757
+ debug$9 = function () { /* */ };
55755
55758
  }
55756
55759
  }
55757
- debug$8.apply(null, arguments);
55760
+ debug$9.apply(null, arguments);
55758
55761
  };
55759
55762
 
55760
55763
  var url = require$$0$9;
@@ -55763,7 +55766,7 @@ var http$1 = require$$1$1;
55763
55766
  var https$1 = require$$1$2;
55764
55767
  var Writable = require$$0$7.Writable;
55765
55768
  var assert = require$$5;
55766
- var debug$7 = debug_1;
55769
+ var debug$8 = debug_1;
55767
55770
 
55768
55771
  // Create handlers that pass events from native requests
55769
55772
  var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
@@ -56168,7 +56171,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
56168
56171
  }
56169
56172
 
56170
56173
  // Create the redirected request
56171
- debug$7("redirecting to", redirectUrl);
56174
+ debug$8("redirecting to", redirectUrl);
56172
56175
  this._isRedirect = true;
56173
56176
  var redirectUrlParts = url.parse(redirectUrl);
56174
56177
  Object.assign(this._options, redirectUrlParts);
@@ -56261,7 +56264,7 @@ function wrap(protocols) {
56261
56264
  options.nativeProtocols = nativeProtocols;
56262
56265
 
56263
56266
  assert.equal(options.protocol, protocol, "protocol mismatch");
56264
- debug$7("options", options);
56267
+ debug$8("options", options);
56265
56268
  return new RedirectableRequest(options, callback);
56266
56269
  }
56267
56270
 
@@ -56982,7 +56985,7 @@ var httpProxy = httpProxy$2;
56982
56985
 
56983
56986
  var httpProxy$1 = /*@__PURE__*/getDefaultExportFromCjs(httpProxy);
56984
56987
 
56985
- const debug$6 = createDebugger('vite:proxy');
56988
+ const debug$7 = createDebugger('vite:proxy');
56986
56989
  function proxyMiddleware(httpServer, options, config) {
56987
56990
  // lazy require only when proxy is used
56988
56991
  const proxies = {};
@@ -57042,7 +57045,7 @@ function proxyMiddleware(httpServer, options, config) {
57042
57045
  proxy.on('proxyRes', (proxyRes, req, res) => {
57043
57046
  res.on('close', () => {
57044
57047
  if (!res.writableEnded) {
57045
- debug$6?.('destroying proxyRes in proxyRes close event');
57048
+ debug$7?.('destroying proxyRes in proxyRes close event');
57046
57049
  proxyRes.destroy();
57047
57050
  }
57048
57051
  });
@@ -57062,7 +57065,7 @@ function proxyMiddleware(httpServer, options, config) {
57062
57065
  if (opts.rewrite) {
57063
57066
  req.url = opts.rewrite(url);
57064
57067
  }
57065
- debug$6?.(`${req.url} -> ws ${opts.target}`);
57068
+ debug$7?.(`${req.url} -> ws ${opts.target}`);
57066
57069
  proxy.ws(req, socket, head);
57067
57070
  return;
57068
57071
  }
@@ -57081,16 +57084,16 @@ function proxyMiddleware(httpServer, options, config) {
57081
57084
  const bypassResult = opts.bypass(req, res, opts);
57082
57085
  if (typeof bypassResult === 'string') {
57083
57086
  req.url = bypassResult;
57084
- debug$6?.(`bypass: ${req.url} -> ${bypassResult}`);
57087
+ debug$7?.(`bypass: ${req.url} -> ${bypassResult}`);
57085
57088
  return next();
57086
57089
  }
57087
57090
  else if (bypassResult === false) {
57088
- debug$6?.(`bypass: ${req.url} -> 404`);
57091
+ debug$7?.(`bypass: ${req.url} -> 404`);
57089
57092
  res.statusCode = 404;
57090
57093
  return res.end();
57091
57094
  }
57092
57095
  }
57093
- debug$6?.(`${req.url} -> ${opts.target || opts.forward}`);
57096
+ debug$7?.(`${req.url} -> ${opts.target || opts.forward}`);
57094
57097
  if (opts.rewrite) {
57095
57098
  req.url = opts.rewrite(req.url);
57096
57099
  }
@@ -57106,167 +57109,72 @@ function doesProxyContextMatchUrl(context, url) {
57106
57109
  url.startsWith(context));
57107
57110
  }
57108
57111
 
57109
- var lib = {exports: {}};
57110
-
57111
- (function (module, exports) {
57112
-
57113
- var url = require$$0$9;
57114
-
57115
- module.exports = function historyApiFallback(options) {
57116
- options = options || {};
57117
- var logger = getLogger(options);
57118
-
57119
- return function(req, res, next) {
57120
- var headers = req.headers;
57121
- if (req.method !== 'GET' && req.method !== 'HEAD') {
57122
- logger(
57123
- 'Not rewriting',
57124
- req.method,
57125
- req.url,
57126
- 'because the method is not GET or HEAD.'
57127
- );
57128
- return next();
57129
- } else if (!headers || typeof headers.accept !== 'string') {
57130
- logger(
57131
- 'Not rewriting',
57132
- req.method,
57133
- req.url,
57134
- 'because the client did not send an HTTP accept header.'
57135
- );
57136
- return next();
57137
- } else if (headers.accept.indexOf('application/json') === 0) {
57138
- logger(
57139
- 'Not rewriting',
57140
- req.method,
57141
- req.url,
57142
- 'because the client prefers JSON.'
57143
- );
57144
- return next();
57145
- } else if (!acceptsHtml(headers.accept, options)) {
57146
- logger(
57147
- 'Not rewriting',
57148
- req.method,
57149
- req.url,
57150
- 'because the client does not accept HTML.'
57151
- );
57152
- return next();
57153
- }
57154
-
57155
- var parsedUrl = url.parse(req.url);
57156
- var rewriteTarget;
57157
- options.rewrites = options.rewrites || [];
57158
- for (var i = 0; i < options.rewrites.length; i++) {
57159
- var rewrite = options.rewrites[i];
57160
- var match = parsedUrl.pathname.match(rewrite.from);
57161
- if (match !== null) {
57162
- rewriteTarget = evaluateRewriteRule(parsedUrl, match, rewrite.to, req);
57163
-
57164
- if(rewriteTarget.charAt(0) !== '/') {
57165
- logger(
57166
- 'We recommend using an absolute path for the rewrite target.',
57167
- 'Received a non-absolute rewrite target',
57168
- rewriteTarget,
57169
- 'for URL',
57170
- req.url
57171
- );
57172
- }
57173
-
57174
- logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
57175
- req.url = rewriteTarget;
57176
- return next();
57177
- }
57178
- }
57179
-
57180
- var pathname = parsedUrl.pathname;
57181
- if (pathname.lastIndexOf('.') > pathname.lastIndexOf('/') &&
57182
- options.disableDotRule !== true) {
57183
- logger(
57184
- 'Not rewriting',
57185
- req.method,
57186
- req.url,
57187
- 'because the path includes a dot (.) character.'
57188
- );
57189
- return next();
57190
- }
57191
-
57192
- rewriteTarget = options.index || '/index.html';
57193
- logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
57194
- req.url = rewriteTarget;
57195
- next();
57196
- };
57197
- };
57198
-
57199
- function evaluateRewriteRule(parsedUrl, match, rule, req) {
57200
- if (typeof rule === 'string') {
57201
- return rule;
57202
- } else if (typeof rule !== 'function') {
57203
- throw new Error('Rewrite rule can only be of type string or function.');
57204
- }
57205
-
57206
- return rule({
57207
- parsedUrl: parsedUrl,
57208
- match: match,
57209
- request: req
57210
- });
57211
- }
57212
-
57213
- function acceptsHtml(header, options) {
57214
- options.htmlAcceptHeaders = options.htmlAcceptHeaders || ['text/html', '*/*'];
57215
- for (var i = 0; i < options.htmlAcceptHeaders.length; i++) {
57216
- if (header.indexOf(options.htmlAcceptHeaders[i]) !== -1) {
57217
- return true;
57218
- }
57219
- }
57220
- return false;
57221
- }
57222
-
57223
- function getLogger(options) {
57224
- if (options && options.logger) {
57225
- return options.logger;
57226
- } else if (options && options.verbose) {
57227
- // eslint-disable-next-line no-console
57228
- return console.log.bind(console);
57229
- }
57230
- return function(){};
57231
- }
57232
- } (lib));
57233
-
57234
- var libExports = lib.exports;
57235
- var history = /*@__PURE__*/getDefaultExportFromCjs(libExports);
57236
-
57237
- function htmlFallbackMiddleware(root, spaFallback) {
57238
- const historyHtmlFallbackMiddleware = history({
57239
- disableDotRule: true,
57240
- logger: createDebugger('vite:html-fallback'),
57241
- rewrites: [
57242
- // support /dir/ without explicit index.html
57243
- {
57244
- from: /\/$/,
57245
- to({ parsedUrl, request }) {
57246
- const rewritten = decodeURIComponent(parsedUrl.pathname) + 'index.html';
57247
- if (fs$l.existsSync(path$o.join(root, rewritten))) {
57248
- return rewritten;
57249
- }
57250
- return spaFallback ? `/index.html` : request.url;
57251
- },
57252
- },
57253
- {
57254
- from: /\.html$/,
57255
- to({ parsedUrl, request }) {
57256
- // .html files are not handled by serveStaticMiddleware
57257
- // so we need to check if the file exists
57258
- const pathname = decodeURIComponent(parsedUrl.pathname);
57259
- if (fs$l.existsSync(path$o.join(root, pathname))) {
57260
- return request.url;
57261
- }
57262
- return spaFallback ? `/index.html` : request.url;
57263
- },
57264
- },
57265
- ],
57266
- });
57112
+ const debug$6 = createDebugger('vite:html-fallback');
57113
+ function htmlFallbackMiddleware(root, spaFallback, mounted = false) {
57114
+ // When this middleware is mounted on a route, we need to re-assign `req.url` with a
57115
+ // leading `.` to signal a relative rewrite. Returning with a leading `/` returns a
57116
+ // buggy `req.url`. e.g.:
57117
+ //
57118
+ // mount /foo/bar:
57119
+ // req.url = /index.html
57120
+ // final = /foo/barindex.html
57121
+ //
57122
+ // mount /foo/bar:
57123
+ // req.url = ./index.html
57124
+ // final = /foo/bar/index.html
57125
+ const prepend = mounted ? '.' : '';
57267
57126
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
57268
57127
  return function viteHtmlFallbackMiddleware(req, res, next) {
57269
- return historyHtmlFallbackMiddleware(req, res, next);
57128
+ if (
57129
+ // Only accept GET or HEAD
57130
+ (req.method !== 'GET' && req.method !== 'HEAD') ||
57131
+ // Require Accept header
57132
+ !req.headers ||
57133
+ typeof req.headers.accept !== 'string' ||
57134
+ // Ignore JSON requests
57135
+ req.headers.accept.includes('application/json') ||
57136
+ // Require Accept: text/html or */*
57137
+ !(req.headers.accept.includes('text/html') ||
57138
+ req.headers.accept.includes('*/*'))) {
57139
+ return next();
57140
+ }
57141
+ const url = cleanUrl(req.url);
57142
+ const pathname = decodeURIComponent(url);
57143
+ // .html files are not handled by serveStaticMiddleware
57144
+ // so we need to check if the file exists
57145
+ if (pathname.endsWith('.html')) {
57146
+ const filePath = path$o.join(root, pathname);
57147
+ if (fs$l.existsSync(filePath)) {
57148
+ debug$6?.(`Rewriting ${req.method} ${req.url} to ${url}`);
57149
+ req.url = prepend + url;
57150
+ return next();
57151
+ }
57152
+ }
57153
+ // trailing slash should check for fallback index.html
57154
+ else if (pathname[pathname.length - 1] === '/') {
57155
+ const filePath = path$o.join(root, pathname, 'index.html');
57156
+ if (fs$l.existsSync(filePath)) {
57157
+ const newUrl = url + 'index.html';
57158
+ debug$6?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
57159
+ req.url = prepend + newUrl;
57160
+ return next();
57161
+ }
57162
+ }
57163
+ // non-trailing slash should check for fallback .html
57164
+ else {
57165
+ const filePath = path$o.join(root, pathname + '.html');
57166
+ if (fs$l.existsSync(filePath)) {
57167
+ const newUrl = url + '.html';
57168
+ debug$6?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
57169
+ req.url = prepend + newUrl;
57170
+ return next();
57171
+ }
57172
+ }
57173
+ if (spaFallback) {
57174
+ debug$6?.(`Rewriting ${req.method} ${req.url} to /index.html`);
57175
+ req.url = prepend + '/index.html';
57176
+ }
57177
+ next();
57270
57178
  };
57271
57179
  }
57272
57180
 
@@ -57519,7 +57427,7 @@ function transformMiddleware(server) {
57519
57427
  }
57520
57428
 
57521
57429
  function createDevHtmlTransformFn(server) {
57522
- const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(server.config.plugins);
57430
+ const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(server.config.plugins, server.config.logger);
57523
57431
  return (url, html, originalUrl) => {
57524
57432
  return applyHtmlTransforms(html, [
57525
57433
  preImportMapHook(server.config),
@@ -57739,7 +57647,11 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
57739
57647
  ],
57740
57648
  };
57741
57649
  };
57742
- function indexHtmlMiddleware(server) {
57650
+ function indexHtmlMiddleware(root, server) {
57651
+ const isDev = isDevServer(server);
57652
+ const headers = isDev
57653
+ ? server.config.server.headers
57654
+ : server.config.preview.headers;
57743
57655
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
57744
57656
  return async function viteIndexHtmlMiddleware(req, res, next) {
57745
57657
  if (res.writableEnded) {
@@ -57748,14 +57660,20 @@ function indexHtmlMiddleware(server) {
57748
57660
  const url = req.url && cleanUrl(req.url);
57749
57661
  // htmlFallbackMiddleware appends '.html' to URLs
57750
57662
  if (url?.endsWith('.html') && req.headers['sec-fetch-dest'] !== 'script') {
57751
- const filename = getHtmlFilename(url, server);
57752
- if (fs$l.existsSync(filename)) {
57663
+ let filePath;
57664
+ if (isDev && url.startsWith(FS_PREFIX)) {
57665
+ filePath = decodeURIComponent(fsPathFromId(url));
57666
+ }
57667
+ else {
57668
+ filePath = path$o.join(root, decodeURIComponent(url));
57669
+ }
57670
+ if (fs$l.existsSync(filePath)) {
57753
57671
  try {
57754
- let html = await fsp.readFile(filename, 'utf-8');
57755
- html = await server.transformIndexHtml(url, html, req.originalUrl);
57756
- return send(req, res, html, 'html', {
57757
- headers: server.config.server.headers,
57758
- });
57672
+ let html = await fsp.readFile(filePath, 'utf-8');
57673
+ if (isDev) {
57674
+ html = await server.transformIndexHtml(url, html, req.originalUrl);
57675
+ }
57676
+ return send(req, res, html, 'html', { headers });
57759
57677
  }
57760
57678
  catch (e) {
57761
57679
  return next(e);
@@ -57768,20 +57686,9 @@ function indexHtmlMiddleware(server) {
57768
57686
  function preTransformRequest(server, url, base) {
57769
57687
  if (!server.config.server.preTransformRequests)
57770
57688
  return;
57771
- url = unwrapId(stripBase(url, base));
57772
57689
  // transform all url as non-ssr as html includes client-side assets only
57773
- server.transformRequest(url).catch((e) => {
57774
- if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP ||
57775
- e?.code === ERR_CLOSED_SERVER) {
57776
- // these are expected errors
57777
- return;
57778
- }
57779
- // Unexpected error, log the issue but avoid an unhandled exception
57780
- server.config.logger.error(`Pre-transform error: ${e.message}`, {
57781
- error: e,
57782
- timestamp: true,
57783
- });
57784
- });
57690
+ url = unwrapId(stripBase(url, base));
57691
+ server.warmupRequest(url);
57785
57692
  }
57786
57693
 
57787
57694
  const logTime = createDebugger('vite:time');
@@ -58159,6 +58066,14 @@ class ModuleGraph {
58159
58066
  }
58160
58067
  }
58161
58068
 
58069
+ function notFoundMiddleware() {
58070
+ // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
58071
+ return function vite404Middleware(_, res) {
58072
+ res.statusCode = 404;
58073
+ res.end();
58074
+ };
58075
+ }
58076
+
58162
58077
  function ansiRegex({onlyFirst = false} = {}) {
58163
58078
  const pattern = [
58164
58079
  '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
@@ -58336,26 +58251,29 @@ function warmupFiles(server) {
58336
58251
  }
58337
58252
  }
58338
58253
  async function warmupFile(server, file, ssr) {
58339
- try {
58340
- // transform html with the `transformIndexHtml` hook as Vite internals would
58341
- // pre-transform the imported JS modules linked. this may cause `transformIndexHtml`
58342
- // plugins to be executed twice, but that's probably fine.
58343
- if (file.endsWith('.html')) {
58344
- const url = htmlFileToUrl(file, server.config.root);
58345
- if (url) {
58254
+ // transform html with the `transformIndexHtml` hook as Vite internals would
58255
+ // pre-transform the imported JS modules linked. this may cause `transformIndexHtml`
58256
+ // plugins to be executed twice, but that's probably fine.
58257
+ if (file.endsWith('.html')) {
58258
+ const url = htmlFileToUrl(file, server.config.root);
58259
+ if (url) {
58260
+ try {
58346
58261
  const html = await fsp.readFile(file, 'utf-8');
58347
58262
  await server.transformIndexHtml(url, html);
58348
58263
  }
58349
- }
58350
- // for other files, pass it through `transformRequest`. this is what Vite uses
58351
- // for it's `server.preTransformRequests` option.
58352
- else {
58353
- const url = fileToUrl(file, server.config.root);
58354
- await server.transformRequest(url, { ssr });
58264
+ catch (e) {
58265
+ // Unexpected error, log the issue but avoid an unhandled exception
58266
+ server.config.logger.error(`Pre-transform error (${colors$1.cyan(file)}): ${e.message}`, {
58267
+ error: e,
58268
+ timestamp: true,
58269
+ });
58270
+ }
58355
58271
  }
58356
58272
  }
58357
- catch (e) {
58358
- server.config.logger.error(colors$1.red(`Failed to warm up ${colors$1.cyan(file)}:\n`) + e.message);
58273
+ // for other files, pass it through `transformRequest` with warmup
58274
+ else {
58275
+ const url = fileToUrl(file, server.config.root);
58276
+ await server.warmupRequest(url, { ssr });
58359
58277
  }
58360
58278
  }
58361
58279
  function htmlFileToUrl(file, root) {
@@ -58428,6 +58346,20 @@ async function _createServer(inlineConfig = {}, options) {
58428
58346
  transformRequest(url, options) {
58429
58347
  return transformRequest(url, server, options);
58430
58348
  },
58349
+ async warmupRequest(url, options) {
58350
+ await transformRequest(url, server, options).catch((e) => {
58351
+ if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP ||
58352
+ e?.code === ERR_CLOSED_SERVER) {
58353
+ // these are expected errors
58354
+ return;
58355
+ }
58356
+ // Unexpected error, log the issue but avoid an unhandled exception
58357
+ server.config.logger.error(`Pre-transform error: ${e.message}`, {
58358
+ error: e,
58359
+ timestamp: true,
58360
+ });
58361
+ });
58362
+ },
58431
58363
  transformIndexHtml: null,
58432
58364
  async ssrLoadModule(url, opts) {
58433
58365
  if (isDepsOptimizerEnabled(config, true)) {
@@ -58578,11 +58510,13 @@ async function _createServer(inlineConfig = {}, options) {
58578
58510
  };
58579
58511
  const onFileAddUnlink = async (file, isUnlink) => {
58580
58512
  file = normalizePath$3(file);
58513
+ await container.watchChange(file, { event: isUnlink ? 'delete' : 'create' });
58581
58514
  await handleFileAddUnlink(file, server, isUnlink);
58582
58515
  await onHMRUpdate(file, true);
58583
58516
  };
58584
58517
  watcher.on('change', async (file) => {
58585
58518
  file = normalizePath$3(file);
58519
+ await container.watchChange(file, { event: 'update' });
58586
58520
  // invalidate module graph cache on file change
58587
58521
  moduleGraph.onFileChange(file);
58588
58522
  await onHMRUpdate(file, false);
@@ -58662,13 +58596,9 @@ async function _createServer(inlineConfig = {}, options) {
58662
58596
  postHooks.forEach((fn) => fn && fn());
58663
58597
  if (config.appType === 'spa' || config.appType === 'mpa') {
58664
58598
  // transform index.html
58665
- middlewares.use(indexHtmlMiddleware(server));
58599
+ middlewares.use(indexHtmlMiddleware(root, server));
58666
58600
  // handle 404s
58667
- // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
58668
- middlewares.use(function vite404Middleware(_, res) {
58669
- res.statusCode = 404;
58670
- res.end();
58671
- });
58601
+ middlewares.use(notFoundMiddleware());
58672
58602
  }
58673
58603
  // error handler
58674
58604
  middlewares.use(errorMiddleware(server, middlewareMode));
@@ -59279,7 +59209,6 @@ function definePlugin(config) {
59279
59209
  'process.env.NODE_ENV': JSON.stringify(nodeEnv),
59280
59210
  'global.process.env.NODE_ENV': JSON.stringify(nodeEnv),
59281
59211
  'globalThis.process.env.NODE_ENV': JSON.stringify(nodeEnv),
59282
- __vite_process_env_NODE_ENV: JSON.stringify(nodeEnv),
59283
59212
  });
59284
59213
  }
59285
59214
  // during dev, import.meta properties are handled by importAnalysis plugin.
@@ -59300,15 +59229,6 @@ function definePlugin(config) {
59300
59229
  const userDefine = {};
59301
59230
  const userDefineEnv = {};
59302
59231
  for (const key in config.define) {
59303
- // user can define keys with the same values to declare that some keys
59304
- // should not be replaced. in this case, we delete references of the key
59305
- // so they aren't replaced in the first place.
59306
- const val = config.define[key];
59307
- if (key === val) {
59308
- delete processNodeEnv[key];
59309
- delete importMetaKeys[key];
59310
- continue;
59311
- }
59312
59232
  userDefine[key] = handleDefineValue(config.define[key]);
59313
59233
  // make sure `import.meta.env` object has user define properties
59314
59234
  if (isBuild && key.startsWith('import.meta.env.')) {
@@ -59325,9 +59245,6 @@ function definePlugin(config) {
59325
59245
  ...(replaceProcessEnv ? processEnv : {}),
59326
59246
  };
59327
59247
  // Additional define fixes based on `ssr` value
59328
- if (isBuild && !replaceProcessEnv) {
59329
- define['__vite_process_env_NODE_ENV'] = 'process.env.NODE_ENV';
59330
- }
59331
59248
  if ('import.meta.env.SSR' in define) {
59332
59249
  define['import.meta.env.SSR'] = ssr + '';
59333
59250
  }
@@ -59338,16 +59255,16 @@ function definePlugin(config) {
59338
59255
  ...userDefineEnv,
59339
59256
  });
59340
59257
  }
59341
- const defineKeys = Object.keys(define);
59342
- const pattern = defineKeys.length
59343
- ? new RegExp(
59344
- // Mustn't be preceded by a char that can be part of an identifier
59345
- // or a '.' that isn't part of a spread operator
59346
- '(?<![\\p{L}\\p{N}_$]|(?<!\\.\\.)\\.)(' +
59347
- defineKeys.map(escapeRegex).join('|') +
59348
- // Mustn't be followed by a char that can be part of an identifier
59349
- // or an assignment (but allow equality operators)
59350
- ')(?:(?<=\\.)|(?![\\p{L}\\p{N}_$]|\\s*?=[^=]))', 'gu')
59258
+ // Create regex pattern as a fast check before running esbuild
59259
+ const patternKeys = Object.keys(userDefine);
59260
+ if (replaceProcessEnv && Object.keys(processEnv).length) {
59261
+ patternKeys.push('process.env');
59262
+ }
59263
+ if (Object.keys(importMetaKeys).length) {
59264
+ patternKeys.push('import.meta.env', 'import.meta.hot');
59265
+ }
59266
+ const pattern = patternKeys.length
59267
+ ? new RegExp(patternKeys.map(escapeRegex).join('|'))
59351
59268
  : null;
59352
59269
  return [define, pattern];
59353
59270
  }
@@ -59857,18 +59774,7 @@ function importAnalysisPlugin(config) {
59857
59774
  // These requests will also be registered in transformRequest to be awaited
59858
59775
  // by the deps optimizer
59859
59776
  const url = removeImportQuery(hmrUrl);
59860
- server.transformRequest(url, { ssr }).catch((e) => {
59861
- if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP ||
59862
- e?.code === ERR_CLOSED_SERVER) {
59863
- // these are expected errors
59864
- return;
59865
- }
59866
- // Unexpected error, log the issue but avoid an unhandled exception
59867
- config.logger.error(`Pre-transform error: ${e.message}`, {
59868
- error: e,
59869
- timestamp: true,
59870
- });
59871
- });
59777
+ server.warmupRequest(url, { ssr });
59872
59778
  }
59873
59779
  }
59874
59780
  else if (!importer.startsWith(withTrailingSlash(clientDir))) {
@@ -60439,7 +60345,7 @@ function webWorkerPlugin(config) {
60439
60345
  }
60440
60346
  },
60441
60347
  shouldTransformCachedModule({ id }) {
60442
- if (isBuild && isWorkerQueryId(id) && config.build.watch) {
60348
+ if (isBuild && config.build.watch && isWorkerQueryId(id)) {
60443
60349
  return true;
60444
60350
  }
60445
60351
  },
@@ -60757,6 +60663,14 @@ function getWorkerType(raw, clean, i) {
60757
60663
  }
60758
60664
  return 'classic';
60759
60665
  }
60666
+ function isIncludeWorkerImportMetaUrl(code) {
60667
+ if ((code.includes('new Worker') || code.includes('new SharedWorker')) &&
60668
+ code.includes('new URL') &&
60669
+ code.includes(`import.meta.url`)) {
60670
+ return true;
60671
+ }
60672
+ return false;
60673
+ }
60760
60674
  function workerImportMetaUrlPlugin(config) {
60761
60675
  const isBuild = config.command === 'build';
60762
60676
  let workerResolver;
@@ -60771,12 +60685,14 @@ function workerImportMetaUrlPlugin(config) {
60771
60685
  };
60772
60686
  return {
60773
60687
  name: 'vite:worker-import-meta-url',
60688
+ shouldTransformCachedModule({ code }) {
60689
+ if (isBuild && config.build.watch && isIncludeWorkerImportMetaUrl(code)) {
60690
+ return true;
60691
+ }
60692
+ },
60774
60693
  async transform(code, id, options) {
60775
60694
  const ssr = options?.ssr === true;
60776
- if (!options?.ssr &&
60777
- (code.includes('new Worker') || code.includes('new SharedWorker')) &&
60778
- code.includes('new URL') &&
60779
- code.includes(`import.meta.url`)) {
60695
+ if (!options?.ssr && isIncludeWorkerImportMetaUrl(code)) {
60780
60696
  const query = parseRequest(id);
60781
60697
  let s;
60782
60698
  const cleanString = stripLiteral(code);
@@ -61974,6 +61890,10 @@ async function createPluginContainer(config, moduleGraph, watcher) {
61974
61890
  map: ctx._getCombinedSourcemap(),
61975
61891
  };
61976
61892
  },
61893
+ async watchChange(id, change) {
61894
+ const ctx = new Context();
61895
+ await hookParallel('watchChange', () => ctx, () => [id, change]);
61896
+ },
61977
61897
  async close() {
61978
61898
  if (closed)
61979
61899
  return;
@@ -62123,7 +62043,7 @@ async function prepareEsbuildScanner(config, entries, deps, missing, scanContext
62123
62043
  if (scanContext?.cancelled)
62124
62044
  return;
62125
62045
  const plugin = esbuildScanPlugin(config, container, deps, missing, entries);
62126
- const { plugins = [], tsconfig, tsconfigRaw, ...esbuildOptions } = config.optimizeDeps?.esbuildOptions ?? {};
62046
+ const { plugins = [], ...esbuildOptions } = config.optimizeDeps?.esbuildOptions ?? {};
62127
62047
  return await esbuild.context({
62128
62048
  absWorkingDir: process.cwd(),
62129
62049
  write: false,
@@ -62135,8 +62055,6 @@ async function prepareEsbuildScanner(config, entries, deps, missing, scanContext
62135
62055
  format: 'esm',
62136
62056
  logLevel: 'silent',
62137
62057
  plugins: [...plugins, plugin],
62138
- tsconfig,
62139
- tsconfigRaw: resolveTsconfigRaw(tsconfig, tsconfigRaw),
62140
62058
  ...esbuildOptions,
62141
62059
  });
62142
62060
  }
@@ -62498,21 +62416,6 @@ function isScannable(id, extensions) {
62498
62416
  extensions?.includes(path$o.extname(id)) ||
62499
62417
  false);
62500
62418
  }
62501
- // esbuild v0.18 only transforms decorators when `experimentalDecorators` is set to `true`.
62502
- // To preserve compat with the esbuild breaking change, we set `experimentalDecorators` to
62503
- // `true` by default if it's unset.
62504
- // TODO: Remove this in Vite 5 and check https://github.com/vitejs/vite/pull/13805#issuecomment-1633612320
62505
- function resolveTsconfigRaw(tsconfig, tsconfigRaw) {
62506
- return tsconfig || typeof tsconfigRaw === 'string'
62507
- ? tsconfigRaw
62508
- : {
62509
- ...tsconfigRaw,
62510
- compilerOptions: {
62511
- experimentalDecorators: true,
62512
- ...tsconfigRaw?.compilerOptions,
62513
- },
62514
- };
62515
- }
62516
62419
 
62517
62420
  function createOptimizeDepsIncludeResolver(config, ssr) {
62518
62421
  const resolve = config.createResolver({
@@ -63603,7 +63506,7 @@ async function prepareEsbuildOptimizerRun(resolvedConfig, depsInfo, ssr, process
63603
63506
  const flatIdDeps = {};
63604
63507
  const idToExports = {};
63605
63508
  const optimizeDeps = getDepOptimizationConfig(config, ssr);
63606
- const { plugins: pluginsFromConfig = [], tsconfig, tsconfigRaw, ...esbuildOptions } = optimizeDeps?.esbuildOptions ?? {};
63509
+ const { plugins: pluginsFromConfig = [], ...esbuildOptions } = optimizeDeps?.esbuildOptions ?? {};
63607
63510
  await Promise.all(Object.keys(depsInfo).map(async (id) => {
63608
63511
  const src = depsInfo[id].src;
63609
63512
  const exportsData = await (depsInfo[id].exportsData ??
@@ -63623,12 +63526,10 @@ async function prepareEsbuildOptimizerRun(resolvedConfig, depsInfo, ssr, process
63623
63526
  if (optimizerContext.cancelled)
63624
63527
  return { context: undefined, idToExports };
63625
63528
  // esbuild automatically replaces process.env.NODE_ENV for platform 'browser'
63626
- // In lib mode, we need to keep process.env.NODE_ENV untouched, so to at build
63627
- // time we replace it by __vite_process_env_NODE_ENV. This placeholder will be
63628
- // later replaced by the define plugin
63529
+ // But in lib mode, we need to keep process.env.NODE_ENV untouched
63629
63530
  const define = {
63630
- 'process.env.NODE_ENV': isBuild
63631
- ? '__vite_process_env_NODE_ENV'
63531
+ 'process.env.NODE_ENV': isBuild && config.build.lib
63532
+ ? 'process.env.NODE_ENV'
63632
63533
  : JSON.stringify(process.env.NODE_ENV || config.mode),
63633
63534
  };
63634
63535
  const platform = ssr && config.ssr?.target !== 'webworker' ? 'node' : 'browser';
@@ -63679,8 +63580,6 @@ async function prepareEsbuildOptimizerRun(resolvedConfig, depsInfo, ssr, process
63679
63580
  metafile: true,
63680
63581
  plugins,
63681
63582
  charset: 'utf8',
63682
- tsconfig,
63683
- tsconfigRaw: resolveTsconfigRaw(tsconfig, tsconfigRaw),
63684
63583
  ...esbuildOptions,
63685
63584
  supported: {
63686
63585
  'dynamic-import': true,
@@ -65592,7 +65491,7 @@ async function preview(inlineConfig = {}) {
65592
65491
  const viteAssetMiddleware = (...args) => sirv(distDir, {
65593
65492
  etag: true,
65594
65493
  dev: true,
65595
- single: config.appType === 'spa',
65494
+ extensions: [],
65596
65495
  ignores: false,
65597
65496
  setHeaders(res) {
65598
65497
  if (headers) {
@@ -65606,8 +65505,18 @@ async function preview(inlineConfig = {}) {
65606
65505
  },
65607
65506
  })(...args);
65608
65507
  app.use(previewBase, viteAssetMiddleware);
65508
+ // html fallback
65509
+ if (config.appType === 'spa' || config.appType === 'mpa') {
65510
+ app.use(previewBase, htmlFallbackMiddleware(distDir, config.appType === 'spa', previewBase !== '/'));
65511
+ }
65609
65512
  // apply post server hooks from plugins
65610
65513
  postHooks.forEach((fn) => fn && fn());
65514
+ if (config.appType === 'spa' || config.appType === 'mpa') {
65515
+ // transform index.html
65516
+ app.use(previewBase, indexHtmlMiddleware(distDir, server));
65517
+ // handle 404s
65518
+ app.use(previewBase, notFoundMiddleware());
65519
+ }
65611
65520
  const hostname = await resolveHostname(options.host);
65612
65521
  const port = options.port ?? DEFAULT_PREVIEW_PORT;
65613
65522
  const protocol = options.https ? 'https' : 'http';
@@ -65720,10 +65629,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
65720
65629
  allowClearScreen: config.clearScreen,
65721
65630
  customLogger: config.customLogger,
65722
65631
  });
65723
- let foundDiscouragedVariableName;
65724
- if ((foundDiscouragedVariableName = Object.keys(config.define ?? {}).find((k) => ['process', 'global'].includes(k)))) {
65725
- logger.warn(colors$1.yellow(`Replacing ${colors$1.bold(foundDiscouragedVariableName)} using the define option is discouraged. See https://vitejs.dev/config/shared-options.html#define for more details.`));
65726
- }
65727
65632
  // resolve root
65728
65633
  const resolvedRoot = normalizePath$3(config.root ? path$o.resolve(config.root) : process.cwd());
65729
65634
  if (resolvedRoot.includes('#')) {
@@ -65851,7 +65756,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
65851
65756
  : '';
65852
65757
  const server = resolveServerOptions(resolvedRoot, config.server, logger);
65853
65758
  const ssr = resolveSSROptions(config.ssr, resolveOptions.preserveSymlinks);
65854
- const middlewareMode = config?.server?.middlewareMode;
65855
65759
  const optimizeDeps = config.optimizeDeps || {};
65856
65760
  const BASE_URL = resolvedBase;
65857
65761
  let resolved;
@@ -65945,7 +65849,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
65945
65849
  },
65946
65850
  },
65947
65851
  worker: resolvedWorkerOptions,
65948
- appType: config.appType ?? (middlewareMode === 'ssr' ? 'custom' : 'spa'),
65852
+ appType: config.appType ?? 'spa',
65949
65853
  experimental: {
65950
65854
  importGlobRestoreExtension: false,
65951
65855
  hmrPartialAccept: false,
@@ -65964,13 +65868,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
65964
65868
  await Promise.all(resolved
65965
65869
  .getSortedPluginHooks('configResolved')
65966
65870
  .map((hook) => hook(resolved)));
65967
- // validate config
65968
- if (middlewareMode === 'ssr') {
65969
- logger.warn(colors$1.yellow(`Setting server.middlewareMode to 'ssr' is deprecated, set server.middlewareMode to \`true\`${config.appType === 'custom' ? '' : ` and appType to 'custom'`} instead`));
65970
- }
65971
- else if (middlewareMode === 'html') {
65972
- logger.warn(colors$1.yellow(`Setting server.middlewareMode to 'html' is deprecated, set server.middlewareMode to \`true\` instead`));
65973
- }
65974
65871
  debug?.(`using resolved config: %O`, {
65975
65872
  ...resolved,
65976
65873
  plugins: resolved.plugins.map((p) => p.name),
@@ -65979,6 +65876,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
65979
65876
  plugins: `() => plugins`,
65980
65877
  },
65981
65878
  });
65879
+ // validate config
65982
65880
  if (config.build?.terserOptions && config.build.minify !== 'terser') {
65983
65881
  logger.warn(colors$1.yellow(`build.terserOptions is specified but build.minify is not set to use Terser. ` +
65984
65882
  `Note Vite now defaults to use esbuild for minification. If you still ` +