vite 5.0.10 → 5.1.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.
@@ -25,7 +25,7 @@ import os$4 from 'node:os';
25
25
  import { exec } from 'node:child_process';
26
26
  import { createHash as createHash$2 } from 'node:crypto';
27
27
  import { promises } from 'node:dns';
28
- import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, FS_PREFIX, wildcardHosts, loopbackHosts, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, JS_TYPES_RE, VERSION as VERSION$1, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
28
+ import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, FS_PREFIX, wildcardHosts, loopbackHosts, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, JS_TYPES_RE, METADATA_FILENAME, VERSION as VERSION$1, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
29
29
  import require$$0$a from 'crypto';
30
30
  import require$$0$8, { createRequire as createRequire$2 } from 'module';
31
31
  import assert$1 from 'node:assert';
@@ -2638,11 +2638,11 @@ const attachScopes = function attachScopes(ast, propertyName = 'scope') {
2638
2638
  };
2639
2639
 
2640
2640
  // Helper since Typescript can't detect readonly arrays with Array.isArray
2641
- function isArray$2(arg) {
2641
+ function isArray$1(arg) {
2642
2642
  return Array.isArray(arg);
2643
2643
  }
2644
2644
  function ensureArray(thing) {
2645
- if (isArray$2(thing))
2645
+ if (isArray$1(thing))
2646
2646
  return thing;
2647
2647
  if (thing == null)
2648
2648
  return [];
@@ -5335,7 +5335,7 @@ function makeres (key) {
5335
5335
  return once(function RES () {
5336
5336
  var cbs = reqs[key];
5337
5337
  var len = cbs.length;
5338
- var args = slice$3(arguments);
5338
+ var args = slice$1(arguments);
5339
5339
 
5340
5340
  // XXX It's somewhat ambiguous whether a new callback added in this
5341
5341
  // pass should be queued for later execution if something in the
@@ -5362,7 +5362,7 @@ function makeres (key) {
5362
5362
  })
5363
5363
  }
5364
5364
 
5365
- function slice$3 (args) {
5365
+ function slice$1 (args) {
5366
5366
  var length = args.length;
5367
5367
  var array = [];
5368
5368
 
@@ -6593,10 +6593,10 @@ function getRelativePath(from, to) {
6593
6593
  return fromParts.concat(toParts).join('/');
6594
6594
  }
6595
6595
 
6596
- const toString$3 = Object.prototype.toString;
6596
+ const toString$2 = Object.prototype.toString;
6597
6597
 
6598
6598
  function isObject$2(thing) {
6599
- return toString$3.call(thing) === '[object Object]';
6599
+ return toString$2.call(thing) === '[object Object]';
6600
6600
  }
6601
6601
 
6602
6602
  function getLocator(source) {
@@ -10694,7 +10694,7 @@ function remapping(input, loader, options) {
10694
10694
  return new SourceMap(traceMappings(tree), opts);
10695
10695
  }
10696
10696
 
10697
- var src$3 = {exports: {}};
10697
+ var src$2 = {exports: {}};
10698
10698
 
10699
10699
  var node$1 = {exports: {}};
10700
10700
 
@@ -11711,12 +11711,12 @@ function requireBrowser$1 () {
11711
11711
  */
11712
11712
 
11713
11713
  if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
11714
- src$3.exports = requireBrowser$1();
11714
+ src$2.exports = requireBrowser$1();
11715
11715
  } else {
11716
- src$3.exports = requireNode$1();
11716
+ src$2.exports = requireNode$1();
11717
11717
  }
11718
11718
 
11719
- var srcExports$1 = src$3.exports;
11719
+ var srcExports$1 = src$2.exports;
11720
11720
  var debug$i = /*@__PURE__*/getDefaultExportFromCjs(srcExports$1);
11721
11721
 
11722
11722
  let pnp;
@@ -12176,6 +12176,11 @@ function removeImportQuery(url) {
12176
12176
  function removeDirectQuery(url) {
12177
12177
  return url.replace(directRequestRE$1, '$1').replace(trailingSeparatorRE, '');
12178
12178
  }
12179
+ const urlRE = /(\?|&)url(?:&|$)/;
12180
+ const rawRE = /(\?|&)raw(?:&|$)/;
12181
+ function removeUrlQuery(url) {
12182
+ return url.replace(urlRE, '$1').replace(trailingSeparatorRE, '');
12183
+ }
12179
12184
  const replacePercentageRE = /%/g;
12180
12185
  function injectQuery(url, queryToInject) {
12181
12186
  // encode percents for consistent behavior with pathToFileURL
@@ -12552,10 +12557,10 @@ function processSrcSetSync(srcs, replacer) {
12552
12557
  descriptor,
12553
12558
  })));
12554
12559
  }
12555
- const cleanSrcSetRE = /(?:url|image|gradient|cross-fade)\([^)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'/g;
12560
+ const cleanSrcSetRE = /(?:url|image|gradient|cross-fade)\([^)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|data:\w+\/[\w.+\-]+;base64,[\w+/=]+/g;
12556
12561
  function splitSrcSet(srcs) {
12557
12562
  const parts = [];
12558
- // There could be a ',' inside of url(data:...), linear-gradient(...) or "data:..."
12563
+ // There could be a ',' inside of url(data:...), linear-gradient(...), "data:..." or data:...
12559
12564
  const cleanedSrcs = srcs.replace(cleanSrcSetRE, blankReplacer);
12560
12565
  let startIndex = 0;
12561
12566
  let splitIndex;
@@ -12742,8 +12747,8 @@ function arraify(target) {
12742
12747
  return Array.isArray(target) ? target : [target];
12743
12748
  }
12744
12749
  // Taken from https://stackoverflow.com/a/36328890
12745
- const multilineCommentsRE$1 = /\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g;
12746
- const singlelineCommentsRE$1 = /\/\/.*/g;
12750
+ const multilineCommentsRE = /\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g;
12751
+ const singlelineCommentsRE = /\/\/.*/g;
12747
12752
  const requestQuerySplitRE = /\?(?!.*[/|}])/;
12748
12753
  const requestQueryMaybeEscapedSplitRE = /\\?\?(?!.*[/|}])/;
12749
12754
  function parseRequest(id) {
@@ -12776,7 +12781,7 @@ const requireResolveFromRootWithFallback = (root, id) => {
12776
12781
  return _require$2.resolve(id, { paths: [root, _dirname] });
12777
12782
  };
12778
12783
  function emptyCssComments(raw) {
12779
- return raw.replace(multilineCommentsRE$1, (s) => ' '.repeat(s.length));
12784
+ return raw.replace(multilineCommentsRE, blankReplacer);
12780
12785
  }
12781
12786
  function backwardCompatibleWorkerPlugins(plugins) {
12782
12787
  if (Array.isArray(plugins)) {
@@ -13019,6 +13024,31 @@ function promiseWithResolvers() {
13019
13024
  });
13020
13025
  return { promise, resolve, reject };
13021
13026
  }
13027
+ function createSerialPromiseQueue() {
13028
+ let previousTask;
13029
+ return {
13030
+ async run(f) {
13031
+ const thisTask = f();
13032
+ // wait for both the previous task and this task
13033
+ // so that this function resolves in the order this function is called
13034
+ const depTasks = Promise.all([previousTask, thisTask]);
13035
+ previousTask = depTasks;
13036
+ const [, result] = await depTasks;
13037
+ // this task was the last one, clear `previousTask` to free up memory
13038
+ if (previousTask === depTasks) {
13039
+ previousTask = undefined;
13040
+ }
13041
+ return result;
13042
+ },
13043
+ };
13044
+ }
13045
+ function sortObjectKeys(obj) {
13046
+ const sorted = {};
13047
+ for (const key of Object.keys(obj).sort()) {
13048
+ sorted[key] = obj[key];
13049
+ }
13050
+ return sorted;
13051
+ }
13022
13052
 
13023
13053
  /* eslint no-console: 0 */
13024
13054
  const LogLevels = {
@@ -13037,36 +13067,42 @@ function clearScreen() {
13037
13067
  readline.cursorTo(process.stdout, 0, 0);
13038
13068
  readline.clearScreenDown(process.stdout);
13039
13069
  }
13040
- function createLogger(level = 'info', options = {}) {
13041
- if (options.customLogger) {
13042
- return options.customLogger;
13043
- }
13044
- const timeFormatter = new Intl.DateTimeFormat(undefined, {
13070
+ // Only initialize the timeFormatter when the timestamp option is used, and
13071
+ // reuse it across all loggers
13072
+ let timeFormatter;
13073
+ function getTimeFormatter() {
13074
+ timeFormatter ??= new Intl.DateTimeFormat(undefined, {
13045
13075
  hour: 'numeric',
13046
13076
  minute: 'numeric',
13047
13077
  second: 'numeric',
13048
13078
  });
13079
+ return timeFormatter;
13080
+ }
13081
+ function createLogger(level = 'info', options = {}) {
13082
+ if (options.customLogger) {
13083
+ return options.customLogger;
13084
+ }
13049
13085
  const loggedErrors = new WeakSet();
13050
13086
  const { prefix = '[vite]', allowClearScreen = true } = options;
13051
13087
  const thresh = LogLevels[level];
13052
13088
  const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
13053
13089
  const clear = canClearScreen ? clearScreen : () => { };
13090
+ function format(type, msg, options = {}) {
13091
+ if (options.timestamp) {
13092
+ const tag = type === 'info'
13093
+ ? colors$1.cyan(colors$1.bold(prefix))
13094
+ : type === 'warn'
13095
+ ? colors$1.yellow(colors$1.bold(prefix))
13096
+ : colors$1.red(colors$1.bold(prefix));
13097
+ return `${colors$1.dim(getTimeFormatter().format(new Date()))} ${tag} ${msg}`;
13098
+ }
13099
+ else {
13100
+ return msg;
13101
+ }
13102
+ }
13054
13103
  function output(type, msg, options = {}) {
13055
13104
  if (thresh >= LogLevels[type]) {
13056
13105
  const method = type === 'info' ? 'log' : type;
13057
- const format = () => {
13058
- if (options.timestamp) {
13059
- const tag = type === 'info'
13060
- ? colors$1.cyan(colors$1.bold(prefix))
13061
- : type === 'warn'
13062
- ? colors$1.yellow(colors$1.bold(prefix))
13063
- : colors$1.red(colors$1.bold(prefix));
13064
- return `${colors$1.dim(timeFormatter.format(new Date()))} ${tag} ${msg}`;
13065
- }
13066
- else {
13067
- return msg;
13068
- }
13069
- };
13070
13106
  if (options.error) {
13071
13107
  loggedErrors.add(options.error);
13072
13108
  }
@@ -13074,7 +13110,7 @@ function createLogger(level = 'info', options = {}) {
13074
13110
  if (type === lastType && msg === lastMsg) {
13075
13111
  sameCount++;
13076
13112
  clear();
13077
- console[method](format(), colors$1.yellow(`(x${sameCount + 1})`));
13113
+ console[method](format(type, msg, options), colors$1.yellow(`(x${sameCount + 1})`));
13078
13114
  }
13079
13115
  else {
13080
13116
  sameCount = 0;
@@ -13083,11 +13119,11 @@ function createLogger(level = 'info', options = {}) {
13083
13119
  if (options.clear) {
13084
13120
  clear();
13085
13121
  }
13086
- console[method](format());
13122
+ console[method](format(type, msg, options));
13087
13123
  }
13088
13124
  }
13089
13125
  else {
13090
- console[method](format());
13126
+ console[method](format(type, msg, options));
13091
13127
  }
13092
13128
  }
13093
13129
  }
@@ -13941,7 +13977,19 @@ async function parse$f(filename, options) {
13941
13977
  /** @type {import('./cache.js').TSConfckCache} */
13942
13978
  const cache = options?.cache;
13943
13979
  if (cache?.hasParseResult(filename)) {
13944
- return cache.getParseResult(filename);
13980
+ const result = await cache.getParseResult(filename);
13981
+ if (
13982
+ (result.tsconfig.extends && !result.extended) ||
13983
+ (result.tsconfig.references && !result.referenced)
13984
+ ) {
13985
+ const promise = Promise.all([
13986
+ parseExtends(result, cache),
13987
+ parseReferences(result, options)
13988
+ ]).then(() => result);
13989
+ cache.setParseResult(filename, promise);
13990
+ await promise;
13991
+ }
13992
+ return result;
13945
13993
  }
13946
13994
  const {
13947
13995
  resolve,
@@ -13965,11 +14013,10 @@ async function parse$f(filename, options) {
13965
14013
  await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
13966
14014
  }
13967
14015
  resolve(resolveSolutionTSConfig(filename, result));
13968
- return promise;
13969
14016
  } catch (e) {
13970
14017
  reject(e);
13971
- return promise;
13972
14018
  }
14019
+ return promise;
13973
14020
  }
13974
14021
 
13975
14022
  /**
@@ -14119,18 +14166,20 @@ async function parseExtends(result, cache) {
14119
14166
  * @returns {string}
14120
14167
  */
14121
14168
  function resolveExtends(extended, from) {
14169
+ if (extended === '..') {
14170
+ // see #149
14171
+ extended = '../tsconfig.json';
14172
+ }
14173
+ const req = createRequire$2(from);
14122
14174
  let error;
14123
-
14124
14175
  try {
14125
- return createRequire$2(from).resolve(extended);
14176
+ return req.resolve(extended);
14126
14177
  } catch (e) {
14127
14178
  error = e;
14128
14179
  }
14129
-
14130
- if (!path$o.isAbsolute(extended) && !extended.startsWith('./') && !extended.startsWith('../')) {
14180
+ if (extended[0] !== '.' && !path$o.isAbsolute(extended)) {
14131
14181
  try {
14132
- const fallbackExtended = path$o.join(extended, 'tsconfig.json');
14133
- return createRequire$2(from).resolve(fallbackExtended);
14182
+ return req.resolve(`${extended}/tsconfig.json`);
14134
14183
  } catch (e) {
14135
14184
  error = e;
14136
14185
  }
@@ -14774,15 +14823,7 @@ function prettifyMessage(m, code) {
14774
14823
  let tsconfckCache;
14775
14824
  async function loadTsconfigJsonForFile(filename) {
14776
14825
  try {
14777
- if (tsconfckCache) {
14778
- // shortcut, the cache stores resolved TSConfckParseResult
14779
- // so getting it from the cache directly we bypass async fn call wrapping it in a promise again
14780
- if (tsconfckCache.hasParseResult(filename)) {
14781
- const result = await tsconfckCache.getParseResult(filename);
14782
- return result.tsconfig;
14783
- }
14784
- }
14785
- else {
14826
+ if (!tsconfckCache) {
14786
14827
  tsconfckCache = new TSConfckCache();
14787
14828
  }
14788
14829
  const result = await parse$f(filename, {
@@ -14993,1038 +15034,41 @@ function terserPlugin(config) {
14993
15034
  };
14994
15035
  }
14995
15036
 
14996
- var toString$2 = {}.toString;
14997
-
14998
- var isarray = Array.isArray || function (arr) {
14999
- return toString$2.call(arr) == '[object Array]';
15000
- };
15001
-
15002
- var toStr$2 = Object.prototype.toString;
15003
-
15004
- var isArguments = function isArguments(value) {
15005
- var str = toStr$2.call(value);
15006
- var isArgs = str === '[object Arguments]';
15007
- if (!isArgs) {
15008
- isArgs = str !== '[object Array]' &&
15009
- value !== null &&
15010
- typeof value === 'object' &&
15011
- typeof value.length === 'number' &&
15012
- value.length >= 0 &&
15013
- toStr$2.call(value.callee) === '[object Function]';
15014
- }
15015
- return isArgs;
15016
- };
15017
-
15018
- var implementation$4;
15019
- var hasRequiredImplementation;
15020
-
15021
- function requireImplementation () {
15022
- if (hasRequiredImplementation) return implementation$4;
15023
- hasRequiredImplementation = 1;
15024
-
15025
- var keysShim;
15026
- if (!Object.keys) {
15027
- // modified from https://github.com/es-shims/es5-shim
15028
- var has = Object.prototype.hasOwnProperty;
15029
- var toStr = Object.prototype.toString;
15030
- var isArgs = isArguments; // eslint-disable-line global-require
15031
- var isEnumerable = Object.prototype.propertyIsEnumerable;
15032
- var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
15033
- var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
15034
- var dontEnums = [
15035
- 'toString',
15036
- 'toLocaleString',
15037
- 'valueOf',
15038
- 'hasOwnProperty',
15039
- 'isPrototypeOf',
15040
- 'propertyIsEnumerable',
15041
- 'constructor'
15042
- ];
15043
- var equalsConstructorPrototype = function (o) {
15044
- var ctor = o.constructor;
15045
- return ctor && ctor.prototype === o;
15046
- };
15047
- var excludedKeys = {
15048
- $applicationCache: true,
15049
- $console: true,
15050
- $external: true,
15051
- $frame: true,
15052
- $frameElement: true,
15053
- $frames: true,
15054
- $innerHeight: true,
15055
- $innerWidth: true,
15056
- $onmozfullscreenchange: true,
15057
- $onmozfullscreenerror: true,
15058
- $outerHeight: true,
15059
- $outerWidth: true,
15060
- $pageXOffset: true,
15061
- $pageYOffset: true,
15062
- $parent: true,
15063
- $scrollLeft: true,
15064
- $scrollTop: true,
15065
- $scrollX: true,
15066
- $scrollY: true,
15067
- $self: true,
15068
- $webkitIndexedDB: true,
15069
- $webkitStorageInfo: true,
15070
- $window: true
15071
- };
15072
- var hasAutomationEqualityBug = (function () {
15073
- /* global window */
15074
- if (typeof window === 'undefined') { return false; }
15075
- for (var k in window) {
15076
- try {
15077
- if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
15078
- try {
15079
- equalsConstructorPrototype(window[k]);
15080
- } catch (e) {
15081
- return true;
15082
- }
15083
- }
15084
- } catch (e) {
15085
- return true;
15086
- }
15087
- }
15088
- return false;
15089
- }());
15090
- var equalsConstructorPrototypeIfNotBuggy = function (o) {
15091
- /* global window */
15092
- if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
15093
- return equalsConstructorPrototype(o);
15094
- }
15095
- try {
15096
- return equalsConstructorPrototype(o);
15097
- } catch (e) {
15098
- return false;
15099
- }
15100
- };
15101
-
15102
- keysShim = function keys(object) {
15103
- var isObject = object !== null && typeof object === 'object';
15104
- var isFunction = toStr.call(object) === '[object Function]';
15105
- var isArguments = isArgs(object);
15106
- var isString = isObject && toStr.call(object) === '[object String]';
15107
- var theKeys = [];
15108
-
15109
- if (!isObject && !isFunction && !isArguments) {
15110
- throw new TypeError('Object.keys called on a non-object');
15111
- }
15112
-
15113
- var skipProto = hasProtoEnumBug && isFunction;
15114
- if (isString && object.length > 0 && !has.call(object, 0)) {
15115
- for (var i = 0; i < object.length; ++i) {
15116
- theKeys.push(String(i));
15117
- }
15118
- }
15119
-
15120
- if (isArguments && object.length > 0) {
15121
- for (var j = 0; j < object.length; ++j) {
15122
- theKeys.push(String(j));
15123
- }
15124
- } else {
15125
- for (var name in object) {
15126
- if (!(skipProto && name === 'prototype') && has.call(object, name)) {
15127
- theKeys.push(String(name));
15128
- }
15129
- }
15130
- }
15131
-
15132
- if (hasDontEnumBug) {
15133
- var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
15134
-
15135
- for (var k = 0; k < dontEnums.length; ++k) {
15136
- if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
15137
- theKeys.push(dontEnums[k]);
15138
- }
15139
- }
15140
- }
15141
- return theKeys;
15142
- };
15143
- }
15144
- implementation$4 = keysShim;
15145
- return implementation$4;
15146
- }
15147
-
15148
- var slice$2 = Array.prototype.slice;
15149
- var isArgs = isArguments;
15150
-
15151
- var origKeys = Object.keys;
15152
- var keysShim = origKeys ? function keys(o) { return origKeys(o); } : requireImplementation();
15153
-
15154
- var originalKeys = Object.keys;
15155
-
15156
- keysShim.shim = function shimObjectKeys() {
15157
- if (Object.keys) {
15158
- var keysWorksWithArguments = (function () {
15159
- // Safari 5.0 bug
15160
- var args = Object.keys(arguments);
15161
- return args && args.length === arguments.length;
15162
- }(1, 2));
15163
- if (!keysWorksWithArguments) {
15164
- Object.keys = function keys(object) { // eslint-disable-line func-name-matching
15165
- if (isArgs(object)) {
15166
- return originalKeys(slice$2.call(object));
15167
- }
15168
- return originalKeys(object);
15169
- };
15170
- }
15171
- } else {
15172
- Object.keys = keysShim;
15173
- }
15174
- return Object.keys || keysShim;
15175
- };
15176
-
15177
- var objectKeys$1 = keysShim;
15178
-
15179
- var callBind$1 = {exports: {}};
15180
-
15181
- /* eslint no-invalid-this: 1 */
15182
-
15183
- var ERROR_MESSAGE$1 = 'Function.prototype.bind called on incompatible ';
15184
- var toStr$1 = Object.prototype.toString;
15185
- var max = Math.max;
15186
- var funcType$1 = '[object Function]';
15187
-
15188
- var concatty = function concatty(a, b) {
15189
- var arr = [];
15190
-
15191
- for (var i = 0; i < a.length; i += 1) {
15192
- arr[i] = a[i];
15193
- }
15194
- for (var j = 0; j < b.length; j += 1) {
15195
- arr[j + a.length] = b[j];
15196
- }
15197
-
15198
- return arr;
15199
- };
15200
-
15201
- var slicy = function slicy(arrLike, offset) {
15202
- var arr = [];
15203
- for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
15204
- arr[j] = arrLike[i];
15205
- }
15206
- return arr;
15207
- };
15208
-
15209
- var joiny = function (arr, joiner) {
15210
- var str = '';
15211
- for (var i = 0; i < arr.length; i += 1) {
15212
- str += arr[i];
15213
- if (i + 1 < arr.length) {
15214
- str += joiner;
15215
- }
15216
- }
15217
- return str;
15218
- };
15219
-
15220
- var implementation$3 = function bind(that) {
15221
- var target = this;
15222
- if (typeof target !== 'function' || toStr$1.apply(target) !== funcType$1) {
15223
- throw new TypeError(ERROR_MESSAGE$1 + target);
15224
- }
15225
- var args = slicy(arguments, 1);
15226
-
15227
- var bound;
15228
- var binder = function () {
15229
- if (this instanceof bound) {
15230
- var result = target.apply(
15231
- this,
15232
- concatty(args, arguments)
15233
- );
15234
- if (Object(result) === result) {
15235
- return result;
15236
- }
15237
- return this;
15238
- }
15239
- return target.apply(
15240
- that,
15241
- concatty(args, arguments)
15242
- );
15243
-
15244
- };
15245
-
15246
- var boundLength = max(0, target.length - args.length);
15247
- var boundArgs = [];
15248
- for (var i = 0; i < boundLength; i++) {
15249
- boundArgs[i] = '$' + i;
15250
- }
15251
-
15252
- bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
15253
-
15254
- if (target.prototype) {
15255
- var Empty = function Empty() {};
15256
- Empty.prototype = target.prototype;
15257
- bound.prototype = new Empty();
15258
- Empty.prototype = null;
15259
- }
15260
-
15261
- return bound;
15262
- };
15263
-
15264
- var implementation$2 = implementation$3;
15265
-
15266
- var functionBind$1 = Function.prototype.bind || implementation$2;
15267
-
15268
- /* eslint complexity: [2, 18], max-statements: [2, 33] */
15269
- var shams = function hasSymbols() {
15270
- if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
15271
- if (typeof Symbol.iterator === 'symbol') { return true; }
15272
-
15273
- var obj = {};
15274
- var sym = Symbol('test');
15275
- var symObj = Object(sym);
15276
- if (typeof sym === 'string') { return false; }
15277
-
15278
- if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
15279
- if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
15280
-
15281
- // temp disabled per https://github.com/ljharb/object.assign/issues/17
15282
- // if (sym instanceof Symbol) { return false; }
15283
- // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
15284
- // if (!(symObj instanceof Symbol)) { return false; }
15285
-
15286
- // if (typeof Symbol.prototype.toString !== 'function') { return false; }
15287
- // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
15288
-
15289
- var symVal = 42;
15290
- obj[sym] = symVal;
15291
- for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
15292
- if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
15293
-
15294
- if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
15295
-
15296
- var syms = Object.getOwnPropertySymbols(obj);
15297
- if (syms.length !== 1 || syms[0] !== sym) { return false; }
15298
-
15299
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
15300
-
15301
- if (typeof Object.getOwnPropertyDescriptor === 'function') {
15302
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
15303
- if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
15304
- }
15305
-
15306
- return true;
15307
- };
15308
-
15309
- var origSymbol = typeof Symbol !== 'undefined' && Symbol;
15310
- var hasSymbolSham = shams;
15311
-
15312
- var hasSymbols$1 = function hasNativeSymbols() {
15313
- if (typeof origSymbol !== 'function') { return false; }
15314
- if (typeof Symbol !== 'function') { return false; }
15315
- if (typeof origSymbol('foo') !== 'symbol') { return false; }
15316
- if (typeof Symbol('bar') !== 'symbol') { return false; }
15317
-
15318
- return hasSymbolSham();
15319
- };
15320
-
15321
- var test = {
15322
- foo: {}
15323
- };
15324
-
15325
- var $Object = Object;
15326
-
15327
- var hasProto$1 = function hasProto() {
15328
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
15329
- };
15330
-
15331
- /* eslint no-invalid-this: 1 */
15332
-
15333
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
15334
- var slice$1 = Array.prototype.slice;
15335
- var toStr = Object.prototype.toString;
15336
- var funcType = '[object Function]';
15337
-
15338
- var implementation$1 = function bind(that) {
15339
- var target = this;
15340
- if (typeof target !== 'function' || toStr.call(target) !== funcType) {
15341
- throw new TypeError(ERROR_MESSAGE + target);
15342
- }
15343
- var args = slice$1.call(arguments, 1);
15344
-
15345
- var bound;
15346
- var binder = function () {
15347
- if (this instanceof bound) {
15348
- var result = target.apply(
15349
- this,
15350
- args.concat(slice$1.call(arguments))
15351
- );
15352
- if (Object(result) === result) {
15353
- return result;
15354
- }
15355
- return this;
15356
- } else {
15357
- return target.apply(
15358
- that,
15359
- args.concat(slice$1.call(arguments))
15360
- );
15361
- }
15362
- };
15363
-
15364
- var boundLength = Math.max(0, target.length - args.length);
15365
- var boundArgs = [];
15366
- for (var i = 0; i < boundLength; i++) {
15367
- boundArgs.push('$' + i);
15368
- }
15369
-
15370
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
15371
-
15372
- if (target.prototype) {
15373
- var Empty = function Empty() {};
15374
- Empty.prototype = target.prototype;
15375
- bound.prototype = new Empty();
15376
- Empty.prototype = null;
15377
- }
15378
-
15379
- return bound;
15380
- };
15381
-
15382
- var implementation = implementation$1;
15383
-
15384
- var functionBind = Function.prototype.bind || implementation;
15385
-
15386
- var bind$1 = functionBind;
15387
-
15388
- var src$2 = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
15389
-
15390
- var undefined$1;
15391
-
15392
- var $SyntaxError$1 = SyntaxError;
15393
- var $Function = Function;
15394
- var $TypeError$2 = TypeError;
15395
-
15396
- // eslint-disable-next-line consistent-return
15397
- var getEvalledConstructor = function (expressionSyntax) {
15398
- try {
15399
- return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
15400
- } catch (e) {}
15401
- };
15402
-
15403
- var $gOPD$1 = Object.getOwnPropertyDescriptor;
15404
-
15405
- var throwTypeError = function () {
15406
- throw new $TypeError$2();
15407
- };
15408
- var ThrowTypeError = $gOPD$1
15409
- ? (function () {
15410
- try {
15411
- return throwTypeError;
15412
- } catch (calleeThrows) {
15413
- try {
15414
- // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
15415
- return $gOPD$1(arguments, 'callee').get;
15416
- } catch (gOPDthrows) {
15417
- return throwTypeError;
15418
- }
15419
- }
15420
- }())
15421
- : throwTypeError;
15422
-
15423
- var hasSymbols = hasSymbols$1();
15424
- var hasProto = hasProto$1();
15425
-
15426
- var getProto = Object.getPrototypeOf || (
15427
- hasProto
15428
- ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
15429
- : null
15430
- );
15431
-
15432
- var needsEval = {};
15433
-
15434
- var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
15435
-
15436
- var INTRINSICS = {
15437
- '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
15438
- '%Array%': Array,
15439
- '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
15440
- '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
15441
- '%AsyncFromSyncIteratorPrototype%': undefined$1,
15442
- '%AsyncFunction%': needsEval,
15443
- '%AsyncGenerator%': needsEval,
15444
- '%AsyncGeneratorFunction%': needsEval,
15445
- '%AsyncIteratorPrototype%': needsEval,
15446
- '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
15447
- '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
15448
- '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
15449
- '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
15450
- '%Boolean%': Boolean,
15451
- '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
15452
- '%Date%': Date,
15453
- '%decodeURI%': decodeURI,
15454
- '%decodeURIComponent%': decodeURIComponent,
15455
- '%encodeURI%': encodeURI,
15456
- '%encodeURIComponent%': encodeURIComponent,
15457
- '%Error%': Error,
15458
- '%eval%': eval, // eslint-disable-line no-eval
15459
- '%EvalError%': EvalError,
15460
- '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
15461
- '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
15462
- '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
15463
- '%Function%': $Function,
15464
- '%GeneratorFunction%': needsEval,
15465
- '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
15466
- '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
15467
- '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
15468
- '%isFinite%': isFinite,
15469
- '%isNaN%': isNaN,
15470
- '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
15471
- '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
15472
- '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
15473
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
15474
- '%Math%': Math,
15475
- '%Number%': Number,
15476
- '%Object%': Object,
15477
- '%parseFloat%': parseFloat,
15478
- '%parseInt%': parseInt,
15479
- '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
15480
- '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
15481
- '%RangeError%': RangeError,
15482
- '%ReferenceError%': ReferenceError,
15483
- '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
15484
- '%RegExp%': RegExp,
15485
- '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
15486
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
15487
- '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
15488
- '%String%': String,
15489
- '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
15490
- '%Symbol%': hasSymbols ? Symbol : undefined$1,
15491
- '%SyntaxError%': $SyntaxError$1,
15492
- '%ThrowTypeError%': ThrowTypeError,
15493
- '%TypedArray%': TypedArray,
15494
- '%TypeError%': $TypeError$2,
15495
- '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
15496
- '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
15497
- '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
15498
- '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
15499
- '%URIError%': URIError,
15500
- '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
15501
- '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
15502
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
15503
- };
15504
-
15505
- var doEval = function doEval(name) {
15506
- var value;
15507
- if (name === '%AsyncFunction%') {
15508
- value = getEvalledConstructor('async function () {}');
15509
- } else if (name === '%GeneratorFunction%') {
15510
- value = getEvalledConstructor('function* () {}');
15511
- } else if (name === '%AsyncGeneratorFunction%') {
15512
- value = getEvalledConstructor('async function* () {}');
15513
- } else if (name === '%AsyncGenerator%') {
15514
- var fn = doEval('%AsyncGeneratorFunction%');
15515
- if (fn) {
15516
- value = fn.prototype;
15517
- }
15518
- } else if (name === '%AsyncIteratorPrototype%') {
15519
- var gen = doEval('%AsyncGenerator%');
15520
- if (gen && getProto) {
15521
- value = getProto(gen.prototype);
15522
- }
15523
- }
15524
-
15525
- INTRINSICS[name] = value;
15526
-
15527
- return value;
15528
- };
15529
-
15530
- var LEGACY_ALIASES = {
15531
- '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
15532
- '%ArrayPrototype%': ['Array', 'prototype'],
15533
- '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
15534
- '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
15535
- '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
15536
- '%ArrayProto_values%': ['Array', 'prototype', 'values'],
15537
- '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
15538
- '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
15539
- '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
15540
- '%BooleanPrototype%': ['Boolean', 'prototype'],
15541
- '%DataViewPrototype%': ['DataView', 'prototype'],
15542
- '%DatePrototype%': ['Date', 'prototype'],
15543
- '%ErrorPrototype%': ['Error', 'prototype'],
15544
- '%EvalErrorPrototype%': ['EvalError', 'prototype'],
15545
- '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
15546
- '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
15547
- '%FunctionPrototype%': ['Function', 'prototype'],
15548
- '%Generator%': ['GeneratorFunction', 'prototype'],
15549
- '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
15550
- '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
15551
- '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
15552
- '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
15553
- '%JSONParse%': ['JSON', 'parse'],
15554
- '%JSONStringify%': ['JSON', 'stringify'],
15555
- '%MapPrototype%': ['Map', 'prototype'],
15556
- '%NumberPrototype%': ['Number', 'prototype'],
15557
- '%ObjectPrototype%': ['Object', 'prototype'],
15558
- '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
15559
- '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
15560
- '%PromisePrototype%': ['Promise', 'prototype'],
15561
- '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
15562
- '%Promise_all%': ['Promise', 'all'],
15563
- '%Promise_reject%': ['Promise', 'reject'],
15564
- '%Promise_resolve%': ['Promise', 'resolve'],
15565
- '%RangeErrorPrototype%': ['RangeError', 'prototype'],
15566
- '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
15567
- '%RegExpPrototype%': ['RegExp', 'prototype'],
15568
- '%SetPrototype%': ['Set', 'prototype'],
15569
- '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
15570
- '%StringPrototype%': ['String', 'prototype'],
15571
- '%SymbolPrototype%': ['Symbol', 'prototype'],
15572
- '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
15573
- '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
15574
- '%TypeErrorPrototype%': ['TypeError', 'prototype'],
15575
- '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
15576
- '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
15577
- '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
15578
- '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
15579
- '%URIErrorPrototype%': ['URIError', 'prototype'],
15580
- '%WeakMapPrototype%': ['WeakMap', 'prototype'],
15581
- '%WeakSetPrototype%': ['WeakSet', 'prototype']
15582
- };
15583
-
15584
- var bind = functionBind$1;
15585
- var hasOwn$1 = src$2;
15586
- var $concat = bind.call(Function.call, Array.prototype.concat);
15587
- var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
15588
- var $replace = bind.call(Function.call, String.prototype.replace);
15589
- var $strSlice = bind.call(Function.call, String.prototype.slice);
15590
- var $exec = bind.call(Function.call, RegExp.prototype.exec);
15591
-
15592
- /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
15593
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
15594
- var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
15595
- var stringToPath = function stringToPath(string) {
15596
- var first = $strSlice(string, 0, 1);
15597
- var last = $strSlice(string, -1);
15598
- if (first === '%' && last !== '%') {
15599
- throw new $SyntaxError$1('invalid intrinsic syntax, expected closing `%`');
15600
- } else if (last === '%' && first !== '%') {
15601
- throw new $SyntaxError$1('invalid intrinsic syntax, expected opening `%`');
15602
- }
15603
- var result = [];
15604
- $replace(string, rePropName, function (match, number, quote, subString) {
15605
- result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
15606
- });
15607
- return result;
15608
- };
15609
- /* end adaptation */
15610
-
15611
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
15612
- var intrinsicName = name;
15613
- var alias;
15614
- if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
15615
- alias = LEGACY_ALIASES[intrinsicName];
15616
- intrinsicName = '%' + alias[0] + '%';
15617
- }
15618
-
15619
- if (hasOwn$1(INTRINSICS, intrinsicName)) {
15620
- var value = INTRINSICS[intrinsicName];
15621
- if (value === needsEval) {
15622
- value = doEval(intrinsicName);
15623
- }
15624
- if (typeof value === 'undefined' && !allowMissing) {
15625
- throw new $TypeError$2('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
15626
- }
15627
-
15628
- return {
15629
- alias: alias,
15630
- name: intrinsicName,
15631
- value: value
15632
- };
15633
- }
15634
-
15635
- throw new $SyntaxError$1('intrinsic ' + name + ' does not exist!');
15636
- };
15637
-
15638
- var getIntrinsic = function GetIntrinsic(name, allowMissing) {
15639
- if (typeof name !== 'string' || name.length === 0) {
15640
- throw new $TypeError$2('intrinsic name must be a non-empty string');
15641
- }
15642
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
15643
- throw new $TypeError$2('"allowMissing" argument must be a boolean');
15644
- }
15645
-
15646
- if ($exec(/^%?[^%]*%?$/, name) === null) {
15647
- throw new $SyntaxError$1('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
15648
- }
15649
- var parts = stringToPath(name);
15650
- var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
15651
-
15652
- var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
15653
- var intrinsicRealName = intrinsic.name;
15654
- var value = intrinsic.value;
15655
- var skipFurtherCaching = false;
15656
-
15657
- var alias = intrinsic.alias;
15658
- if (alias) {
15659
- intrinsicBaseName = alias[0];
15660
- $spliceApply(parts, $concat([0, 1], alias));
15661
- }
15662
-
15663
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
15664
- var part = parts[i];
15665
- var first = $strSlice(part, 0, 1);
15666
- var last = $strSlice(part, -1);
15667
- if (
15668
- (
15669
- (first === '"' || first === "'" || first === '`')
15670
- || (last === '"' || last === "'" || last === '`')
15671
- )
15672
- && first !== last
15673
- ) {
15674
- throw new $SyntaxError$1('property names with quotes must have matching quotes');
15675
- }
15676
- if (part === 'constructor' || !isOwn) {
15677
- skipFurtherCaching = true;
15678
- }
15679
-
15680
- intrinsicBaseName += '.' + part;
15681
- intrinsicRealName = '%' + intrinsicBaseName + '%';
15682
-
15683
- if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
15684
- value = INTRINSICS[intrinsicRealName];
15685
- } else if (value != null) {
15686
- if (!(part in value)) {
15687
- if (!allowMissing) {
15688
- throw new $TypeError$2('base intrinsic for ' + name + ' exists, but the property is not available.');
15689
- }
15690
- return void undefined$1;
15691
- }
15692
- if ($gOPD$1 && (i + 1) >= parts.length) {
15693
- var desc = $gOPD$1(value, part);
15694
- isOwn = !!desc;
15695
-
15696
- // By convention, when a data property is converted to an accessor
15697
- // property to emulate a data property that does not suffer from
15698
- // the override mistake, that accessor's getter is marked with
15699
- // an `originalValue` property. Here, when we detect this, we
15700
- // uphold the illusion by pretending to see that original data
15701
- // property, i.e., returning the value rather than the getter
15702
- // itself.
15703
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
15704
- value = desc.get;
15705
- } else {
15706
- value = value[part];
15707
- }
15708
- } else {
15709
- isOwn = hasOwn$1(value, part);
15710
- value = value[part];
15711
- }
15712
-
15713
- if (isOwn && !skipFurtherCaching) {
15714
- INTRINSICS[intrinsicRealName] = value;
15715
- }
15716
- }
15717
- }
15718
- return value;
15719
- };
15720
-
15721
- var GetIntrinsic$3 = getIntrinsic;
15722
-
15723
- var $defineProperty$1 = GetIntrinsic$3('%Object.defineProperty%', true);
15724
-
15725
- var hasPropertyDescriptors$1 = function hasPropertyDescriptors() {
15726
- if ($defineProperty$1) {
15727
- try {
15728
- $defineProperty$1({}, 'a', { value: 1 });
15729
- return true;
15730
- } catch (e) {
15731
- // IE 8 has a broken defineProperty
15732
- return false;
15733
- }
15734
- }
15735
- return false;
15736
- };
15737
-
15738
- hasPropertyDescriptors$1.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
15739
- // node v0.6 has a bug where array lengths can be Set but not Defined
15740
- if (!hasPropertyDescriptors$1()) {
15741
- return null;
15742
- }
15743
- try {
15744
- return $defineProperty$1([], 'length', { value: 1 }).length !== 1;
15745
- } catch (e) {
15746
- // In Firefox 4-22, defining length on an array throws an exception.
15747
- return true;
15748
- }
15749
- };
15750
-
15751
- var hasPropertyDescriptors_1 = hasPropertyDescriptors$1;
15752
-
15753
- var GetIntrinsic$2 = getIntrinsic;
15754
-
15755
- var $gOPD = GetIntrinsic$2('%Object.getOwnPropertyDescriptor%', true);
15756
-
15757
- if ($gOPD) {
15758
- try {
15759
- $gOPD([], 'length');
15760
- } catch (e) {
15761
- // IE 8 has a broken gOPD
15762
- $gOPD = null;
15763
- }
15764
- }
15765
-
15766
- var gopd$1 = $gOPD;
15767
-
15768
- var hasPropertyDescriptors = hasPropertyDescriptors_1();
15769
-
15770
- var GetIntrinsic$1 = getIntrinsic;
15771
-
15772
- var $defineProperty = hasPropertyDescriptors && GetIntrinsic$1('%Object.defineProperty%', true);
15773
- if ($defineProperty) {
15774
- try {
15775
- $defineProperty({}, 'a', { value: 1 });
15776
- } catch (e) {
15777
- // IE 8 has a broken defineProperty
15778
- $defineProperty = false;
15779
- }
15780
- }
15781
-
15782
- var $SyntaxError = GetIntrinsic$1('%SyntaxError%');
15783
- var $TypeError$1 = GetIntrinsic$1('%TypeError%');
15784
-
15785
- var gopd = gopd$1;
15786
-
15787
- /** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
15788
- var defineDataProperty = function defineDataProperty(
15789
- obj,
15790
- property,
15791
- value
15792
- ) {
15793
- if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
15794
- throw new $TypeError$1('`obj` must be an object or a function`');
15795
- }
15796
- if (typeof property !== 'string' && typeof property !== 'symbol') {
15797
- throw new $TypeError$1('`property` must be a string or a symbol`');
15798
- }
15799
- if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
15800
- throw new $TypeError$1('`nonEnumerable`, if provided, must be a boolean or null');
15801
- }
15802
- if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
15803
- throw new $TypeError$1('`nonWritable`, if provided, must be a boolean or null');
15804
- }
15805
- if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
15806
- throw new $TypeError$1('`nonConfigurable`, if provided, must be a boolean or null');
15807
- }
15808
- if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
15809
- throw new $TypeError$1('`loose`, if provided, must be a boolean');
15810
- }
15811
-
15812
- var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
15813
- var nonWritable = arguments.length > 4 ? arguments[4] : null;
15814
- var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
15815
- var loose = arguments.length > 6 ? arguments[6] : false;
15816
-
15817
- /* @type {false | TypedPropertyDescriptor<unknown>} */
15818
- var desc = !!gopd && gopd(obj, property);
15819
-
15820
- if ($defineProperty) {
15821
- $defineProperty(obj, property, {
15822
- configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
15823
- enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
15824
- value: value,
15825
- writable: nonWritable === null && desc ? desc.writable : !nonWritable
15826
- });
15827
- } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
15828
- // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
15829
- obj[property] = value; // eslint-disable-line no-param-reassign
15830
- } else {
15831
- throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
15832
- }
15833
- };
15834
-
15835
- var GetIntrinsic = getIntrinsic;
15836
- var define = defineDataProperty;
15837
- var hasDescriptors = hasPropertyDescriptors_1();
15838
- var gOPD = gopd$1;
15839
-
15840
- var $TypeError = GetIntrinsic('%TypeError%');
15841
- var $floor = GetIntrinsic('%Math.floor%');
15842
-
15843
- var setFunctionLength = function setFunctionLength(fn, length) {
15844
- if (typeof fn !== 'function') {
15845
- throw new $TypeError('`fn` is not a function');
15846
- }
15847
- if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
15848
- throw new $TypeError('`length` must be a positive 32-bit integer');
15849
- }
15850
-
15851
- var loose = arguments.length > 2 && !!arguments[2];
15852
-
15853
- var functionLengthIsConfigurable = true;
15854
- var functionLengthIsWritable = true;
15855
- if ('length' in fn && gOPD) {
15856
- var desc = gOPD(fn, 'length');
15857
- if (desc && !desc.configurable) {
15858
- functionLengthIsConfigurable = false;
15859
- }
15860
- if (desc && !desc.writable) {
15861
- functionLengthIsWritable = false;
15862
- }
15863
- }
15864
-
15865
- if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
15866
- if (hasDescriptors) {
15867
- define(fn, 'length', length, true, true);
15868
- } else {
15869
- define(fn, 'length', length);
15870
- }
15871
- }
15872
- return fn;
15873
- };
15874
-
15875
- (function (module) {
15876
-
15877
- var bind = functionBind$1;
15878
- var GetIntrinsic = getIntrinsic;
15879
- var setFunctionLength$1 = setFunctionLength;
15880
-
15881
- var $TypeError = GetIntrinsic('%TypeError%');
15882
- var $apply = GetIntrinsic('%Function.prototype.apply%');
15883
- var $call = GetIntrinsic('%Function.prototype.call%');
15884
- var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
15885
-
15886
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
15887
- var $max = GetIntrinsic('%Math.max%');
15888
-
15889
- if ($defineProperty) {
15890
- try {
15891
- $defineProperty({}, 'a', { value: 1 });
15892
- } catch (e) {
15893
- // IE 8 has a broken defineProperty
15894
- $defineProperty = null;
15895
- }
15896
- }
15897
-
15898
- module.exports = function callBind(originalFunction) {
15899
- if (typeof originalFunction !== 'function') {
15900
- throw new $TypeError('a function is required');
15901
- }
15902
- var func = $reflectApply(bind, $call, arguments);
15903
- return setFunctionLength$1(
15904
- func,
15905
- 1 + $max(0, originalFunction.length - (arguments.length - 1)),
15906
- true
15907
- );
15908
- };
15909
-
15910
- var applyBind = function applyBind() {
15911
- return $reflectApply(bind, $apply, arguments);
15912
- };
15913
-
15914
- if ($defineProperty) {
15915
- $defineProperty(module.exports, 'apply', { value: applyBind });
15916
- } else {
15917
- module.exports.apply = applyBind;
15918
- }
15919
- } (callBind$1));
15920
-
15921
- var callBindExports = callBind$1.exports;
15922
-
15923
- var jsonStringify = (typeof JSON !== 'undefined' ? JSON : JSON).stringify;
15924
-
15925
- var isArray$1 = isarray;
15926
- var objectKeys = objectKeys$1;
15927
- var callBind = callBindExports;
15928
-
15929
- var strRepeat = function repeat(n, char) {
15930
- var str = '';
15931
- for (var i = 0; i < n; i += 1) {
15932
- str += char;
15933
- }
15934
- return str;
15935
- };
15936
-
15937
- var defaultReplacer = function (parent, key, value) { return value; };
15938
-
15939
- var jsonStableStringify = function stableStringify(obj) {
15940
- var opts = arguments.length > 1 ? arguments[1] : void undefined;
15941
- var space = (opts && opts.space) || '';
15942
- if (typeof space === 'number') { space = strRepeat(space, ' '); }
15943
- var cycles = !!opts && typeof opts.cycles === 'boolean' && opts.cycles;
15944
- var replacer = opts && opts.replacer ? callBind(opts.replacer) : defaultReplacer;
15945
-
15946
- var cmpOpt = typeof opts === 'function' ? opts : opts && opts.cmp;
15947
- var cmp = cmpOpt && function (node) {
15948
- var get = cmpOpt.length > 2 && function get(k) { return node[k]; };
15949
- return function (a, b) {
15950
- return cmpOpt(
15951
- { key: a, value: node[a] },
15952
- { key: b, value: node[b] },
15953
- get ? { __proto__: null, get: get } : void undefined
15954
- );
15955
- };
15956
- };
15957
-
15958
- var seen = [];
15959
- return (function stringify(parent, key, node, level) {
15960
- var indent = space ? '\n' + strRepeat(level, space) : '';
15961
- var colonSeparator = space ? ': ' : ':';
15962
-
15963
- if (node && node.toJSON && typeof node.toJSON === 'function') {
15964
- node = node.toJSON();
15965
- }
15966
-
15967
- node = replacer(parent, key, node);
15968
-
15969
- if (node === undefined) {
15970
- return;
15971
- }
15972
- if (typeof node !== 'object' || node === null) {
15973
- return jsonStringify(node);
15974
- }
15975
- if (isArray$1(node)) {
15976
- var out = '';
15977
- for (var i = 0; i < node.length; i++) {
15978
- var item = stringify(node, i, node[i], level + 1) || jsonStringify(null);
15979
- out += indent + space + item;
15980
- if ((i + 1) < node.length) {
15981
- out += ',';
15982
- }
15983
- }
15984
- return '[' + out + indent + ']';
15985
- }
15986
-
15987
- if (seen.indexOf(node) !== -1) {
15988
- if (cycles) { return jsonStringify('__cycle__'); }
15989
- throw new TypeError('Converting circular structure to JSON');
15990
- } else { seen.push(node); }
15991
-
15992
- var keys = objectKeys(node).sort(cmp && cmp(node));
15993
- var out = '';
15994
- var needsComma = false;
15995
- for (var i = 0; i < keys.length; i++) {
15996
- var key = keys[i];
15997
- var value = stringify(node, key, node[key], level + 1);
15998
-
15999
- if (!value) { continue; }
16000
-
16001
- var keyValue = jsonStringify(key)
16002
- + colonSeparator
16003
- + value;
16004
-
16005
- out += (needsComma ? ',' : '') + indent + space + keyValue;
16006
- needsComma = true;
16007
- }
16008
- seen.splice(seen.indexOf(node), 1);
16009
- return '{' + out + indent + '}';
16010
-
16011
- }({ '': obj }, '', obj, 0));
16012
- };
16013
-
16014
- var jsonStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStableStringify);
16015
-
16016
15037
  const mimes$1 = {
16017
- "ez": "application/andrew-inset",
16018
- "aw": "application/applixware",
15038
+ "3g2": "video/3gpp2",
15039
+ "3gp": "video/3gpp",
15040
+ "3gpp": "video/3gpp",
15041
+ "3mf": "model/3mf",
15042
+ "aac": "audio/aac",
15043
+ "ac": "application/pkix-attr-cert",
15044
+ "adp": "audio/adpcm",
15045
+ "adts": "audio/aac",
15046
+ "ai": "application/postscript",
15047
+ "aml": "application/automationml-aml+xml",
15048
+ "amlx": "application/automationml-amlx+zip",
15049
+ "amr": "audio/amr",
15050
+ "apng": "image/apng",
15051
+ "appcache": "text/cache-manifest",
15052
+ "appinstaller": "application/appinstaller",
15053
+ "appx": "application/appx",
15054
+ "appxbundle": "application/appxbundle",
15055
+ "asc": "application/pgp-keys",
16019
15056
  "atom": "application/atom+xml",
16020
15057
  "atomcat": "application/atomcat+xml",
16021
15058
  "atomdeleted": "application/atomdeleted+xml",
16022
15059
  "atomsvc": "application/atomsvc+xml",
16023
- "dwd": "application/atsc-dwd+xml",
16024
- "held": "application/atsc-held+xml",
16025
- "rsat": "application/atsc-rsat+xml",
15060
+ "au": "audio/basic",
15061
+ "avci": "image/avci",
15062
+ "avcs": "image/avcs",
15063
+ "avif": "image/avif",
15064
+ "aw": "application/applixware",
16026
15065
  "bdoc": "application/bdoc",
16027
- "xcs": "application/calendar+xml",
15066
+ "bin": "application/octet-stream",
15067
+ "bmp": "image/bmp",
15068
+ "bpk": "application/octet-stream",
15069
+ "btf": "image/prs.btif",
15070
+ "btif": "image/prs.btif",
15071
+ "buffer": "application/octet-stream",
16028
15072
  "ccxml": "application/ccxml+xml",
16029
15073
  "cdfx": "application/cdfx+xml",
16030
15074
  "cdmia": "application/cdmi-capability",
@@ -16032,394 +15076,399 @@ const mimes$1 = {
16032
15076
  "cdmid": "application/cdmi-domain",
16033
15077
  "cdmio": "application/cdmi-object",
16034
15078
  "cdmiq": "application/cdmi-queue",
15079
+ "cer": "application/pkix-cert",
15080
+ "cgm": "image/cgm",
15081
+ "cjs": "application/node",
15082
+ "class": "application/java-vm",
15083
+ "coffee": "text/coffeescript",
15084
+ "conf": "text/plain",
15085
+ "cpl": "application/cpl+xml",
15086
+ "cpt": "application/mac-compactpro",
15087
+ "crl": "application/pkix-crl",
15088
+ "css": "text/css",
15089
+ "csv": "text/csv",
16035
15090
  "cu": "application/cu-seeme",
16036
- "mpd": "application/dash+xml",
15091
+ "cwl": "application/cwl",
15092
+ "cww": "application/prs.cww",
16037
15093
  "davmount": "application/davmount+xml",
16038
15094
  "dbk": "application/docbook+xml",
15095
+ "deb": "application/octet-stream",
15096
+ "def": "text/plain",
15097
+ "deploy": "application/octet-stream",
15098
+ "dib": "image/bmp",
15099
+ "disposition-notification": "message/disposition-notification",
15100
+ "dist": "application/octet-stream",
15101
+ "distz": "application/octet-stream",
15102
+ "dll": "application/octet-stream",
15103
+ "dmg": "application/octet-stream",
15104
+ "dms": "application/octet-stream",
15105
+ "doc": "application/msword",
15106
+ "dot": "application/msword",
15107
+ "dpx": "image/dpx",
15108
+ "drle": "image/dicom-rle",
15109
+ "dsc": "text/prs.lines.tag",
16039
15110
  "dssc": "application/dssc+der",
16040
- "xdssc": "application/dssc+xml",
16041
- "es": "application/ecmascript",
15111
+ "dtd": "application/xml-dtd",
15112
+ "dump": "application/octet-stream",
15113
+ "dwd": "application/atsc-dwd+xml",
15114
+ "ear": "application/java-archive",
16042
15115
  "ecma": "application/ecmascript",
15116
+ "elc": "application/octet-stream",
15117
+ "emf": "image/emf",
15118
+ "eml": "message/rfc822",
16043
15119
  "emma": "application/emma+xml",
16044
15120
  "emotionml": "application/emotionml+xml",
15121
+ "eps": "application/postscript",
16045
15122
  "epub": "application/epub+zip",
15123
+ "exe": "application/octet-stream",
16046
15124
  "exi": "application/exi",
15125
+ "exp": "application/express",
15126
+ "exr": "image/aces",
15127
+ "ez": "application/andrew-inset",
15128
+ "fdf": "application/fdf",
16047
15129
  "fdt": "application/fdt+xml",
16048
- "pfr": "application/font-tdpfr",
15130
+ "fits": "image/fits",
15131
+ "g3": "image/g3fax",
15132
+ "gbr": "application/rpki-ghostbusters",
16049
15133
  "geojson": "application/geo+json",
15134
+ "gif": "image/gif",
15135
+ "glb": "model/gltf-binary",
15136
+ "gltf": "model/gltf+json",
16050
15137
  "gml": "application/gml+xml",
16051
15138
  "gpx": "application/gpx+xml",
15139
+ "gram": "application/srgs",
15140
+ "grxml": "application/srgs+xml",
16052
15141
  "gxf": "application/gxf",
16053
15142
  "gz": "application/gzip",
15143
+ "h261": "video/h261",
15144
+ "h263": "video/h263",
15145
+ "h264": "video/h264",
15146
+ "heic": "image/heic",
15147
+ "heics": "image/heic-sequence",
15148
+ "heif": "image/heif",
15149
+ "heifs": "image/heif-sequence",
15150
+ "hej2": "image/hej2k",
15151
+ "held": "application/atsc-held+xml",
16054
15152
  "hjson": "application/hjson",
16055
- "stk": "application/hyperstudio",
15153
+ "hlp": "application/winhlp",
15154
+ "hqx": "application/mac-binhex40",
15155
+ "hsj2": "image/hsj2",
15156
+ "htm": "text/html",
15157
+ "html": "text/html",
15158
+ "ics": "text/calendar",
15159
+ "ief": "image/ief",
15160
+ "ifb": "text/calendar",
15161
+ "iges": "model/iges",
15162
+ "igs": "model/iges",
15163
+ "img": "application/octet-stream",
15164
+ "in": "text/plain",
15165
+ "ini": "text/plain",
16056
15166
  "ink": "application/inkml+xml",
16057
15167
  "inkml": "application/inkml+xml",
16058
15168
  "ipfix": "application/ipfix",
15169
+ "iso": "application/octet-stream",
16059
15170
  "its": "application/its+xml",
15171
+ "jade": "text/jade",
16060
15172
  "jar": "application/java-archive",
16061
- "war": "application/java-archive",
16062
- "ear": "application/java-archive",
16063
- "ser": "application/java-serialized-object",
16064
- "class": "application/java-vm",
16065
- "js": "application/javascript",
16066
- "mjs": "application/javascript",
15173
+ "jhc": "image/jphc",
15174
+ "jls": "image/jls",
15175
+ "jp2": "image/jp2",
15176
+ "jpe": "image/jpeg",
15177
+ "jpeg": "image/jpeg",
15178
+ "jpf": "image/jpx",
15179
+ "jpg": "image/jpeg",
15180
+ "jpg2": "image/jp2",
15181
+ "jpgm": "image/jpm",
15182
+ "jpgv": "video/jpeg",
15183
+ "jph": "image/jph",
15184
+ "jpm": "image/jpm",
15185
+ "jpx": "image/jpx",
15186
+ "js": "text/javascript",
16067
15187
  "json": "application/json",
16068
- "map": "application/json",
16069
15188
  "json5": "application/json5",
16070
- "jsonml": "application/jsonml+json",
16071
15189
  "jsonld": "application/ld+json",
15190
+ "jsonml": "application/jsonml+json",
15191
+ "jsx": "text/jsx",
15192
+ "jt": "model/jt",
15193
+ "jxr": "image/jxr",
15194
+ "jxra": "image/jxra",
15195
+ "jxrs": "image/jxrs",
15196
+ "jxs": "image/jxs",
15197
+ "jxsc": "image/jxsc",
15198
+ "jxsi": "image/jxsi",
15199
+ "jxss": "image/jxss",
15200
+ "kar": "audio/midi",
15201
+ "ktx": "image/ktx",
15202
+ "ktx2": "image/ktx2",
15203
+ "less": "text/less",
16072
15204
  "lgr": "application/lgr+xml",
15205
+ "list": "text/plain",
15206
+ "litcoffee": "text/coffeescript",
15207
+ "log": "text/plain",
16073
15208
  "lostxml": "application/lost+xml",
16074
- "hqx": "application/mac-binhex40",
16075
- "cpt": "application/mac-compactpro",
16076
- "mads": "application/mads+xml",
16077
- "webmanifest": "application/manifest+json",
16078
- "mrc": "application/marc",
16079
- "mrcx": "application/marcxml+xml",
15209
+ "lrf": "application/octet-stream",
15210
+ "m1v": "video/mpeg",
15211
+ "m21": "application/mp21",
15212
+ "m2a": "audio/mpeg",
15213
+ "m2v": "video/mpeg",
15214
+ "m3a": "audio/mpeg",
15215
+ "m4a": "audio/mp4",
15216
+ "m4p": "application/mp4",
15217
+ "m4s": "video/iso.segment",
16080
15218
  "ma": "application/mathematica",
16081
- "nb": "application/mathematica",
16082
- "mb": "application/mathematica",
15219
+ "mads": "application/mads+xml",
15220
+ "maei": "application/mmt-aei+xml",
15221
+ "man": "text/troff",
15222
+ "manifest": "text/cache-manifest",
15223
+ "map": "application/json",
15224
+ "mar": "application/octet-stream",
15225
+ "markdown": "text/markdown",
16083
15226
  "mathml": "application/mathml+xml",
15227
+ "mb": "application/mathematica",
16084
15228
  "mbox": "application/mbox",
16085
- "mscml": "application/mediaservercontrol+xml",
16086
- "metalink": "application/metalink+xml",
15229
+ "md": "text/markdown",
15230
+ "mdx": "text/mdx",
15231
+ "me": "text/troff",
15232
+ "mesh": "model/mesh",
16087
15233
  "meta4": "application/metalink4+xml",
15234
+ "metalink": "application/metalink+xml",
16088
15235
  "mets": "application/mets+xml",
16089
- "maei": "application/mmt-aei+xml",
16090
- "musd": "application/mmt-usd+xml",
15236
+ "mft": "application/rpki-manifest",
15237
+ "mid": "audio/midi",
15238
+ "midi": "audio/midi",
15239
+ "mime": "message/rfc822",
15240
+ "mj2": "video/mj2",
15241
+ "mjp2": "video/mj2",
15242
+ "mjs": "text/javascript",
15243
+ "mml": "text/mathml",
16091
15244
  "mods": "application/mods+xml",
16092
- "m21": "application/mp21",
15245
+ "mov": "video/quicktime",
15246
+ "mp2": "audio/mpeg",
16093
15247
  "mp21": "application/mp21",
15248
+ "mp2a": "audio/mpeg",
15249
+ "mp3": "audio/mpeg",
15250
+ "mp4": "video/mp4",
15251
+ "mp4a": "audio/mp4",
16094
15252
  "mp4s": "application/mp4",
16095
- "m4p": "application/mp4",
16096
- "doc": "application/msword",
16097
- "dot": "application/msword",
15253
+ "mp4v": "video/mp4",
15254
+ "mpd": "application/dash+xml",
15255
+ "mpe": "video/mpeg",
15256
+ "mpeg": "video/mpeg",
15257
+ "mpf": "application/media-policy-dataset+xml",
15258
+ "mpg": "video/mpeg",
15259
+ "mpg4": "video/mp4",
15260
+ "mpga": "audio/mpeg",
15261
+ "mpp": "application/dash-patch+xml",
15262
+ "mrc": "application/marc",
15263
+ "mrcx": "application/marcxml+xml",
15264
+ "ms": "text/troff",
15265
+ "mscml": "application/mediaservercontrol+xml",
15266
+ "msh": "model/mesh",
15267
+ "msi": "application/octet-stream",
15268
+ "msix": "application/msix",
15269
+ "msixbundle": "application/msixbundle",
15270
+ "msm": "application/octet-stream",
15271
+ "msp": "application/octet-stream",
15272
+ "mtl": "model/mtl",
15273
+ "musd": "application/mmt-usd+xml",
16098
15274
  "mxf": "application/mxf",
15275
+ "mxmf": "audio/mobile-xmf",
15276
+ "mxml": "application/xv+xml",
15277
+ "n3": "text/n3",
15278
+ "nb": "application/mathematica",
16099
15279
  "nq": "application/n-quads",
16100
15280
  "nt": "application/n-triples",
16101
- "cjs": "application/node",
16102
- "bin": "application/octet-stream",
16103
- "dms": "application/octet-stream",
16104
- "lrf": "application/octet-stream",
16105
- "mar": "application/octet-stream",
16106
- "so": "application/octet-stream",
16107
- "dist": "application/octet-stream",
16108
- "distz": "application/octet-stream",
16109
- "pkg": "application/octet-stream",
16110
- "bpk": "application/octet-stream",
16111
- "dump": "application/octet-stream",
16112
- "elc": "application/octet-stream",
16113
- "deploy": "application/octet-stream",
16114
- "exe": "application/octet-stream",
16115
- "dll": "application/octet-stream",
16116
- "deb": "application/octet-stream",
16117
- "dmg": "application/octet-stream",
16118
- "iso": "application/octet-stream",
16119
- "img": "application/octet-stream",
16120
- "msi": "application/octet-stream",
16121
- "msp": "application/octet-stream",
16122
- "msm": "application/octet-stream",
16123
- "buffer": "application/octet-stream",
15281
+ "obj": "model/obj",
16124
15282
  "oda": "application/oda",
16125
- "opf": "application/oebps-package+xml",
15283
+ "oga": "audio/ogg",
15284
+ "ogg": "audio/ogg",
15285
+ "ogv": "video/ogg",
16126
15286
  "ogx": "application/ogg",
16127
15287
  "omdoc": "application/omdoc+xml",
15288
+ "onepkg": "application/onenote",
15289
+ "onetmp": "application/onenote",
16128
15290
  "onetoc": "application/onenote",
16129
15291
  "onetoc2": "application/onenote",
16130
- "onetmp": "application/onenote",
16131
- "onepkg": "application/onenote",
15292
+ "opf": "application/oebps-package+xml",
15293
+ "opus": "audio/ogg",
15294
+ "otf": "font/otf",
15295
+ "owl": "application/rdf+xml",
16132
15296
  "oxps": "application/oxps",
16133
- "relo": "application/p2p-overlay+xml",
16134
- "xer": "application/patch-ops-error+xml",
16135
- "pdf": "application/pdf",
16136
- "pgp": "application/pgp-encrypted",
16137
- "asc": "application/pgp-signature",
16138
- "sig": "application/pgp-signature",
16139
- "prf": "application/pics-rules",
16140
15297
  "p10": "application/pkcs10",
16141
- "p7m": "application/pkcs7-mime",
16142
15298
  "p7c": "application/pkcs7-mime",
15299
+ "p7m": "application/pkcs7-mime",
16143
15300
  "p7s": "application/pkcs7-signature",
16144
15301
  "p8": "application/pkcs8",
16145
- "ac": "application/pkix-attr-cert",
16146
- "cer": "application/pkix-cert",
16147
- "crl": "application/pkix-crl",
16148
- "pkipath": "application/pkix-pkipath",
15302
+ "pdf": "application/pdf",
15303
+ "pfr": "application/font-tdpfr",
15304
+ "pgp": "application/pgp-encrypted",
15305
+ "pkg": "application/octet-stream",
16149
15306
  "pki": "application/pkixcmp",
15307
+ "pkipath": "application/pkix-pkipath",
16150
15308
  "pls": "application/pls+xml",
16151
- "ai": "application/postscript",
16152
- "eps": "application/postscript",
16153
- "ps": "application/postscript",
15309
+ "png": "image/png",
15310
+ "prc": "model/prc",
15311
+ "prf": "application/pics-rules",
16154
15312
  "provx": "application/provenance+xml",
16155
- "cww": "application/prs.cww",
15313
+ "ps": "application/postscript",
16156
15314
  "pskcxml": "application/pskc+xml",
15315
+ "pti": "image/prs.pti",
15316
+ "qt": "video/quicktime",
16157
15317
  "raml": "application/raml+yaml",
15318
+ "rapd": "application/route-apd+xml",
16158
15319
  "rdf": "application/rdf+xml",
16159
- "owl": "application/rdf+xml",
15320
+ "relo": "application/p2p-overlay+xml",
16160
15321
  "rif": "application/reginfo+xml",
16161
- "rnc": "application/relax-ng-compact-syntax",
16162
15322
  "rl": "application/resource-lists+xml",
16163
15323
  "rld": "application/resource-lists-diff+xml",
16164
- "rs": "application/rls-services+xml",
16165
- "rapd": "application/route-apd+xml",
16166
- "sls": "application/route-s-tsid+xml",
16167
- "rusd": "application/route-usd+xml",
16168
- "gbr": "application/rpki-ghostbusters",
16169
- "mft": "application/rpki-manifest",
15324
+ "rmi": "audio/midi",
15325
+ "rnc": "application/relax-ng-compact-syntax",
15326
+ "rng": "application/xml",
16170
15327
  "roa": "application/rpki-roa",
15328
+ "roff": "text/troff",
15329
+ "rq": "application/sparql-query",
15330
+ "rs": "application/rls-services+xml",
15331
+ "rsat": "application/atsc-rsat+xml",
16171
15332
  "rsd": "application/rsd+xml",
15333
+ "rsheet": "application/urc-ressheet+xml",
16172
15334
  "rss": "application/rss+xml",
16173
- "rtf": "application/rtf",
15335
+ "rtf": "text/rtf",
15336
+ "rtx": "text/richtext",
15337
+ "rusd": "application/route-usd+xml",
15338
+ "s3m": "audio/s3m",
16174
15339
  "sbml": "application/sbml+xml",
16175
15340
  "scq": "application/scvp-cv-request",
16176
15341
  "scs": "application/scvp-cv-response",
16177
- "spq": "application/scvp-vp-request",
16178
- "spp": "application/scvp-vp-response",
16179
15342
  "sdp": "application/sdp",
16180
15343
  "senmlx": "application/senml+xml",
16181
15344
  "sensmlx": "application/sensml+xml",
15345
+ "ser": "application/java-serialized-object",
16182
15346
  "setpay": "application/set-payment-initiation",
16183
15347
  "setreg": "application/set-registration-initiation",
15348
+ "sgi": "image/sgi",
15349
+ "sgm": "text/sgml",
15350
+ "sgml": "text/sgml",
15351
+ "shex": "text/shex",
16184
15352
  "shf": "application/shf+xml",
16185
- "siv": "application/sieve",
15353
+ "shtml": "text/html",
16186
15354
  "sieve": "application/sieve",
15355
+ "sig": "application/pgp-signature",
15356
+ "sil": "audio/silk",
15357
+ "silo": "model/mesh",
15358
+ "siv": "application/sieve",
15359
+ "slim": "text/slim",
15360
+ "slm": "text/slim",
15361
+ "sls": "application/route-s-tsid+xml",
16187
15362
  "smi": "application/smil+xml",
16188
15363
  "smil": "application/smil+xml",
16189
- "rq": "application/sparql-query",
16190
- "srx": "application/sparql-results+xml",
16191
- "gram": "application/srgs",
16192
- "grxml": "application/srgs+xml",
15364
+ "snd": "audio/basic",
15365
+ "so": "application/octet-stream",
15366
+ "spdx": "text/spdx",
15367
+ "spp": "application/scvp-vp-response",
15368
+ "spq": "application/scvp-vp-request",
15369
+ "spx": "audio/ogg",
15370
+ "sql": "application/sql",
16193
15371
  "sru": "application/sru+xml",
15372
+ "srx": "application/sparql-results+xml",
16194
15373
  "ssdl": "application/ssdl+xml",
16195
15374
  "ssml": "application/ssml+xml",
15375
+ "stk": "application/hyperstudio",
15376
+ "stl": "model/stl",
15377
+ "stpx": "model/step+xml",
15378
+ "stpxz": "model/step-xml+zip",
15379
+ "stpz": "model/step+zip",
15380
+ "styl": "text/stylus",
15381
+ "stylus": "text/stylus",
15382
+ "svg": "image/svg+xml",
15383
+ "svgz": "image/svg+xml",
16196
15384
  "swidtag": "application/swid+xml",
15385
+ "t": "text/troff",
15386
+ "t38": "image/t38",
15387
+ "td": "application/urc-targetdesc+xml",
16197
15388
  "tei": "application/tei+xml",
16198
15389
  "teicorpus": "application/tei+xml",
15390
+ "text": "text/plain",
16199
15391
  "tfi": "application/thraud+xml",
16200
- "tsd": "application/timestamped-data",
15392
+ "tfx": "image/tiff-fx",
15393
+ "tif": "image/tiff",
15394
+ "tiff": "image/tiff",
16201
15395
  "toml": "application/toml",
15396
+ "tr": "text/troff",
16202
15397
  "trig": "application/trig",
15398
+ "ts": "video/mp2t",
15399
+ "tsd": "application/timestamped-data",
15400
+ "tsv": "text/tab-separated-values",
15401
+ "ttc": "font/collection",
15402
+ "ttf": "font/ttf",
15403
+ "ttl": "text/turtle",
16203
15404
  "ttml": "application/ttml+xml",
15405
+ "txt": "text/plain",
15406
+ "u3d": "model/u3d",
15407
+ "u8dsn": "message/global-delivery-status",
15408
+ "u8hdr": "message/global-headers",
15409
+ "u8mdn": "message/global-disposition-notification",
15410
+ "u8msg": "message/global",
16204
15411
  "ubj": "application/ubjson",
16205
- "rsheet": "application/urc-ressheet+xml",
16206
- "td": "application/urc-targetdesc+xml",
15412
+ "uri": "text/uri-list",
15413
+ "uris": "text/uri-list",
15414
+ "urls": "text/uri-list",
15415
+ "vcard": "text/vcard",
15416
+ "vrml": "model/vrml",
15417
+ "vtt": "text/vtt",
16207
15418
  "vxml": "application/voicexml+xml",
15419
+ "war": "application/java-archive",
16208
15420
  "wasm": "application/wasm",
15421
+ "wav": "audio/wav",
15422
+ "weba": "audio/webm",
15423
+ "webm": "video/webm",
15424
+ "webmanifest": "application/manifest+json",
15425
+ "webp": "image/webp",
15426
+ "wgsl": "text/wgsl",
16209
15427
  "wgt": "application/widget",
16210
- "hlp": "application/winhlp",
15428
+ "wif": "application/watcherinfo+xml",
15429
+ "wmf": "image/wmf",
15430
+ "woff": "font/woff",
15431
+ "woff2": "font/woff2",
15432
+ "wrl": "model/vrml",
16211
15433
  "wsdl": "application/wsdl+xml",
16212
15434
  "wspolicy": "application/wspolicy+xml",
15435
+ "x3d": "model/x3d+xml",
15436
+ "x3db": "model/x3d+fastinfoset",
15437
+ "x3dbz": "model/x3d+binary",
15438
+ "x3dv": "model/x3d-vrml",
15439
+ "x3dvz": "model/x3d+vrml",
15440
+ "x3dz": "model/x3d+xml",
16213
15441
  "xaml": "application/xaml+xml",
16214
15442
  "xav": "application/xcap-att+xml",
16215
15443
  "xca": "application/xcap-caps+xml",
15444
+ "xcs": "application/calendar+xml",
16216
15445
  "xdf": "application/xcap-diff+xml",
15446
+ "xdssc": "application/dssc+xml",
16217
15447
  "xel": "application/xcap-el+xml",
16218
- "xns": "application/xcap-ns+xml",
16219
15448
  "xenc": "application/xenc+xml",
16220
- "xhtml": "application/xhtml+xml",
15449
+ "xer": "application/patch-ops-error+xml",
15450
+ "xfdf": "application/xfdf",
16221
15451
  "xht": "application/xhtml+xml",
15452
+ "xhtml": "application/xhtml+xml",
15453
+ "xhvml": "application/xv+xml",
16222
15454
  "xlf": "application/xliff+xml",
16223
- "xml": "application/xml",
16224
- "xsl": "application/xml",
16225
- "xsd": "application/xml",
16226
- "rng": "application/xml",
16227
- "dtd": "application/xml-dtd",
15455
+ "xm": "audio/xm",
15456
+ "xml": "text/xml",
15457
+ "xns": "application/xcap-ns+xml",
16228
15458
  "xop": "application/xop+xml",
16229
15459
  "xpl": "application/xproc+xml",
15460
+ "xsd": "application/xml",
15461
+ "xsf": "application/prs.xsf+xml",
15462
+ "xsl": "application/xml",
16230
15463
  "xslt": "application/xml",
16231
15464
  "xspf": "application/xspf+xml",
16232
- "mxml": "application/xv+xml",
16233
- "xhvml": "application/xv+xml",
16234
- "xvml": "application/xv+xml",
16235
15465
  "xvm": "application/xv+xml",
15466
+ "xvml": "application/xv+xml",
15467
+ "yaml": "text/yaml",
16236
15468
  "yang": "application/yang",
16237
15469
  "yin": "application/yin+xml",
16238
- "zip": "application/zip",
16239
- "3gpp": "video/3gpp",
16240
- "adp": "audio/adpcm",
16241
- "amr": "audio/amr",
16242
- "au": "audio/basic",
16243
- "snd": "audio/basic",
16244
- "mid": "audio/midi",
16245
- "midi": "audio/midi",
16246
- "kar": "audio/midi",
16247
- "rmi": "audio/midi",
16248
- "mxmf": "audio/mobile-xmf",
16249
- "mp3": "audio/mpeg",
16250
- "m4a": "audio/mp4",
16251
- "mp4a": "audio/mp4",
16252
- "mpga": "audio/mpeg",
16253
- "mp2": "audio/mpeg",
16254
- "mp2a": "audio/mpeg",
16255
- "m2a": "audio/mpeg",
16256
- "m3a": "audio/mpeg",
16257
- "oga": "audio/ogg",
16258
- "ogg": "audio/ogg",
16259
- "spx": "audio/ogg",
16260
- "opus": "audio/ogg",
16261
- "s3m": "audio/s3m",
16262
- "sil": "audio/silk",
16263
- "wav": "audio/wav",
16264
- "weba": "audio/webm",
16265
- "xm": "audio/xm",
16266
- "ttc": "font/collection",
16267
- "otf": "font/otf",
16268
- "ttf": "font/ttf",
16269
- "woff": "font/woff",
16270
- "woff2": "font/woff2",
16271
- "exr": "image/aces",
16272
- "apng": "image/apng",
16273
- "avif": "image/avif",
16274
- "bmp": "image/bmp",
16275
- "cgm": "image/cgm",
16276
- "drle": "image/dicom-rle",
16277
- "emf": "image/emf",
16278
- "fits": "image/fits",
16279
- "g3": "image/g3fax",
16280
- "gif": "image/gif",
16281
- "heic": "image/heic",
16282
- "heics": "image/heic-sequence",
16283
- "heif": "image/heif",
16284
- "heifs": "image/heif-sequence",
16285
- "hej2": "image/hej2k",
16286
- "hsj2": "image/hsj2",
16287
- "ief": "image/ief",
16288
- "jls": "image/jls",
16289
- "jp2": "image/jp2",
16290
- "jpg2": "image/jp2",
16291
- "jpeg": "image/jpeg",
16292
- "jpg": "image/jpeg",
16293
- "jpe": "image/jpeg",
16294
- "jph": "image/jph",
16295
- "jhc": "image/jphc",
16296
- "jpm": "image/jpm",
16297
- "jpx": "image/jpx",
16298
- "jpf": "image/jpx",
16299
- "jxr": "image/jxr",
16300
- "jxra": "image/jxra",
16301
- "jxrs": "image/jxrs",
16302
- "jxs": "image/jxs",
16303
- "jxsc": "image/jxsc",
16304
- "jxsi": "image/jxsi",
16305
- "jxss": "image/jxss",
16306
- "ktx": "image/ktx",
16307
- "ktx2": "image/ktx2",
16308
- "png": "image/png",
16309
- "btif": "image/prs.btif",
16310
- "pti": "image/prs.pti",
16311
- "sgi": "image/sgi",
16312
- "svg": "image/svg+xml",
16313
- "svgz": "image/svg+xml",
16314
- "t38": "image/t38",
16315
- "tif": "image/tiff",
16316
- "tiff": "image/tiff",
16317
- "tfx": "image/tiff-fx",
16318
- "webp": "image/webp",
16319
- "wmf": "image/wmf",
16320
- "disposition-notification": "message/disposition-notification",
16321
- "u8msg": "message/global",
16322
- "u8dsn": "message/global-delivery-status",
16323
- "u8mdn": "message/global-disposition-notification",
16324
- "u8hdr": "message/global-headers",
16325
- "eml": "message/rfc822",
16326
- "mime": "message/rfc822",
16327
- "3mf": "model/3mf",
16328
- "gltf": "model/gltf+json",
16329
- "glb": "model/gltf-binary",
16330
- "igs": "model/iges",
16331
- "iges": "model/iges",
16332
- "msh": "model/mesh",
16333
- "mesh": "model/mesh",
16334
- "silo": "model/mesh",
16335
- "mtl": "model/mtl",
16336
- "obj": "model/obj",
16337
- "stpz": "model/step+zip",
16338
- "stpxz": "model/step-xml+zip",
16339
- "stl": "model/stl",
16340
- "wrl": "model/vrml",
16341
- "vrml": "model/vrml",
16342
- "x3db": "model/x3d+fastinfoset",
16343
- "x3dbz": "model/x3d+binary",
16344
- "x3dv": "model/x3d-vrml",
16345
- "x3dvz": "model/x3d+vrml",
16346
- "x3d": "model/x3d+xml",
16347
- "x3dz": "model/x3d+xml",
16348
- "appcache": "text/cache-manifest",
16349
- "manifest": "text/cache-manifest",
16350
- "ics": "text/calendar",
16351
- "ifb": "text/calendar",
16352
- "coffee": "text/coffeescript",
16353
- "litcoffee": "text/coffeescript",
16354
- "css": "text/css",
16355
- "csv": "text/csv",
16356
- "html": "text/html",
16357
- "htm": "text/html",
16358
- "shtml": "text/html",
16359
- "jade": "text/jade",
16360
- "jsx": "text/jsx",
16361
- "less": "text/less",
16362
- "markdown": "text/markdown",
16363
- "md": "text/markdown",
16364
- "mml": "text/mathml",
16365
- "mdx": "text/mdx",
16366
- "n3": "text/n3",
16367
- "txt": "text/plain",
16368
- "text": "text/plain",
16369
- "conf": "text/plain",
16370
- "def": "text/plain",
16371
- "list": "text/plain",
16372
- "log": "text/plain",
16373
- "in": "text/plain",
16374
- "ini": "text/plain",
16375
- "dsc": "text/prs.lines.tag",
16376
- "rtx": "text/richtext",
16377
- "sgml": "text/sgml",
16378
- "sgm": "text/sgml",
16379
- "shex": "text/shex",
16380
- "slim": "text/slim",
16381
- "slm": "text/slim",
16382
- "spdx": "text/spdx",
16383
- "stylus": "text/stylus",
16384
- "styl": "text/stylus",
16385
- "tsv": "text/tab-separated-values",
16386
- "t": "text/troff",
16387
- "tr": "text/troff",
16388
- "roff": "text/troff",
16389
- "man": "text/troff",
16390
- "me": "text/troff",
16391
- "ms": "text/troff",
16392
- "ttl": "text/turtle",
16393
- "uri": "text/uri-list",
16394
- "uris": "text/uri-list",
16395
- "urls": "text/uri-list",
16396
- "vcard": "text/vcard",
16397
- "vtt": "text/vtt",
16398
- "yaml": "text/yaml",
16399
15470
  "yml": "text/yaml",
16400
- "3gp": "video/3gpp",
16401
- "3g2": "video/3gpp2",
16402
- "h261": "video/h261",
16403
- "h263": "video/h263",
16404
- "h264": "video/h264",
16405
- "m4s": "video/iso.segment",
16406
- "jpgv": "video/jpeg",
16407
- "jpgm": "image/jpm",
16408
- "mj2": "video/mj2",
16409
- "mjp2": "video/mj2",
16410
- "ts": "video/mp2t",
16411
- "mp4": "video/mp4",
16412
- "mp4v": "video/mp4",
16413
- "mpg4": "video/mp4",
16414
- "mpeg": "video/mpeg",
16415
- "mpg": "video/mpeg",
16416
- "mpe": "video/mpeg",
16417
- "m1v": "video/mpeg",
16418
- "m2v": "video/mpeg",
16419
- "ogv": "video/ogg",
16420
- "qt": "video/quicktime",
16421
- "mov": "video/quicktime",
16422
- "webm": "video/webm"
15471
+ "zip": "application/zip"
16423
15472
  };
16424
15473
 
16425
15474
  function lookup(extn) {
@@ -16463,7 +15512,7 @@ function checkPublicFile(url, config) {
16463
15512
  : undefined;
16464
15513
  }
16465
15514
  const publicFile = normalizePath$3(path$o.join(publicDir, fileName));
16466
- if (!publicFile.startsWith(withTrailingSlash(normalizePath$3(publicDir)))) {
15515
+ if (!publicFile.startsWith(withTrailingSlash(publicDir))) {
16467
15516
  // can happen if URL starts with '../'
16468
15517
  return;
16469
15518
  }
@@ -16472,10 +15521,7 @@ function checkPublicFile(url, config) {
16472
15521
 
16473
15522
  // referenceId is base64url but replaces - with $
16474
15523
  const assetUrlRE = /__VITE_ASSET__([\w$]+)__(?:\$_(.*?)__)?/g;
16475
- const rawRE = /(?:\?|&)raw(?:&|$)/;
16476
- const urlRE = /(\?|&)url(?:&|$)/;
16477
15524
  const jsSourceMapRE = /\.[cm]?js\.map$/;
16478
- const unnededFinalQueryCharRE = /[?&]$/;
16479
15525
  const assetCache = new WeakMap();
16480
15526
  const generatedAssets = new WeakMap();
16481
15527
  // add own dictionary entry by directly assigning mrmime
@@ -16484,10 +15530,6 @@ function registerCustomMime() {
16484
15530
  mimes$1['ico'] = 'image/x-icon';
16485
15531
  // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac
16486
15532
  mimes$1['flac'] = 'audio/flac';
16487
- // mrmime and mime-db is not released yet: https://github.com/jshttp/mime-db/commit/c9242a9b7d4bb25d7a0c9244adec74aeef08d8a1
16488
- mimes$1['aac'] = 'audio/aac';
16489
- // https://wiki.xiph.org/MIME_Types_and_File_Extensions#.opus_-_audio/ogg
16490
- mimes$1['opus'] = 'audio/ogg';
16491
15533
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
16492
15534
  mimes$1['eot'] = 'application/vnd.ms-fontobject';
16493
15535
  }
@@ -16575,10 +15617,10 @@ function assetPlugin(config) {
16575
15617
  // raw query, read file and return as string
16576
15618
  return `export default ${JSON.stringify(await fsp.readFile(file, 'utf-8'))}`;
16577
15619
  }
16578
- if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
15620
+ if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) {
16579
15621
  return;
16580
15622
  }
16581
- id = id.replace(urlRE, '$1').replace(unnededFinalQueryCharRE, '');
15623
+ id = removeUrlQuery(id);
16582
15624
  let url = await fileToUrl$1(id, config, this);
16583
15625
  // Inherit HMR timestamp if this asset was invalidated
16584
15626
  if (moduleGraph) {
@@ -16677,7 +15719,7 @@ function isGitLfsPlaceholder(content) {
16677
15719
  * Register an asset to be emitted as part of the bundle (if necessary)
16678
15720
  * and returns the resolved public URL
16679
15721
  */
16680
- async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, shouldInline) {
15722
+ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, forceInline) {
16681
15723
  if (!skipPublicCheck && checkPublicFile(id, config)) {
16682
15724
  return publicFileToBuiltUrl(id, config);
16683
15725
  }
@@ -16688,17 +15730,8 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
16688
15730
  }
16689
15731
  const file = cleanUrl(id);
16690
15732
  const content = await fsp.readFile(file);
16691
- if (shouldInline == null) {
16692
- shouldInline =
16693
- !!config.build.lib ||
16694
- // Don't inline SVG with fragments, as they are meant to be reused
16695
- (!(file.endsWith('.svg') && id.includes('#')) &&
16696
- !file.endsWith('.html') &&
16697
- content.length < Number(config.build.assetsInlineLimit) &&
16698
- !isGitLfsPlaceholder(content));
16699
- }
16700
15733
  let url;
16701
- if (shouldInline) {
15734
+ if (shouldInline(config, file, id, content, forceInline)) {
16702
15735
  if (config.build.lib && isGitLfsPlaceholder(content)) {
16703
15736
  config.logger.warn(colors$1.yellow(`Inlined file ${id} was not downloaded via Git LFS`));
16704
15737
  }
@@ -16728,7 +15761,7 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
16728
15761
  cache.set(id, url);
16729
15762
  return url;
16730
15763
  }
16731
- async function urlToBuiltUrl(url, importer, config, pluginContext, shouldInline) {
15764
+ async function urlToBuiltUrl(url, importer, config, pluginContext, forceInline) {
16732
15765
  if (checkPublicFile(url, config)) {
16733
15766
  return publicFileToBuiltUrl(url, config);
16734
15767
  }
@@ -16737,8 +15770,30 @@ async function urlToBuiltUrl(url, importer, config, pluginContext, shouldInline)
16737
15770
  : path$o.join(path$o.dirname(importer), url);
16738
15771
  return fileToBuiltUrl(file, config, pluginContext,
16739
15772
  // skip public check since we just did it above
16740
- true, shouldInline);
15773
+ true, forceInline);
16741
15774
  }
15775
+ const shouldInline = (config, file, id, content, forceInline) => {
15776
+ if (config.build.lib)
15777
+ return true;
15778
+ if (forceInline !== undefined)
15779
+ return forceInline;
15780
+ let limit;
15781
+ if (typeof config.build.assetsInlineLimit === 'function') {
15782
+ const userShouldInline = config.build.assetsInlineLimit(file, content);
15783
+ if (userShouldInline != null)
15784
+ return userShouldInline;
15785
+ limit = DEFAULT_ASSETS_INLINE_LIMIT;
15786
+ }
15787
+ else {
15788
+ limit = Number(config.build.assetsInlineLimit);
15789
+ }
15790
+ if (file.endsWith('.html'))
15791
+ return false;
15792
+ // Don't inline SVG with fragments, as they are meant to be reused
15793
+ if (file.endsWith('.svg') && id.includes('#'))
15794
+ return false;
15795
+ return content.length < limit && !isGitLfsPlaceholder(content);
15796
+ };
16742
15797
  const nestedQuotesRE = /"[^"']*'[^"]*"|'[^'"]*"[^']*'/;
16743
15798
  // Inspired by https://github.com/iconify/iconify/blob/main/packages/utils/src/svg/url.ts
16744
15799
  function svgToDataURL(content) {
@@ -16882,7 +15937,7 @@ function manifestPlugin(config) {
16882
15937
  ? config.build.manifest
16883
15938
  : '.vite/manifest.json',
16884
15939
  type: 'asset',
16885
- source: jsonStableStringify$1(manifest, { space: 2 }),
15940
+ source: JSON.stringify(sortObjectKeys(manifest), undefined, 2),
16886
15941
  });
16887
15942
  }
16888
15943
  },
@@ -21527,9 +20582,9 @@ class EntryFilter {
21527
20582
  }
21528
20583
  entry$1.default = EntryFilter;
21529
20584
 
21530
- var error$2 = {};
20585
+ var error$1 = {};
21531
20586
 
21532
- Object.defineProperty(error$2, "__esModule", { value: true });
20587
+ Object.defineProperty(error$1, "__esModule", { value: true });
21533
20588
  const utils$2 = utils$g;
21534
20589
  class ErrorFilter {
21535
20590
  constructor(_settings) {
@@ -21542,7 +20597,7 @@ class ErrorFilter {
21542
20597
  return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
21543
20598
  }
21544
20599
  }
21545
- error$2.default = ErrorFilter;
20600
+ error$1.default = ErrorFilter;
21546
20601
 
21547
20602
  var entry = {};
21548
20603
 
@@ -21576,7 +20631,7 @@ Object.defineProperty(provider, "__esModule", { value: true });
21576
20631
  const path$a = require$$0$4;
21577
20632
  const deep_1 = deep;
21578
20633
  const entry_1 = entry$1;
21579
- const error_1 = error$2;
20634
+ const error_1 = error$1;
21580
20635
  const entry_2 = entry;
21581
20636
  class Provider {
21582
20637
  constructor(_settings) {
@@ -24851,12 +23906,14 @@ pp$5.parseExprImport = function(forNew) {
24851
23906
  // Consume `import` as an identifier for `import.meta`.
24852
23907
  // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
24853
23908
  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
24854
- var meta = this.parseIdent(true);
23909
+ this.next();
24855
23910
 
24856
23911
  if (this.type === types$1.parenL && !forNew) {
24857
23912
  return this.parseDynamicImport(node)
24858
23913
  } else if (this.type === types$1.dot) {
24859
- node.meta = meta;
23914
+ var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
23915
+ meta.name = "import";
23916
+ node.meta = this.finishNode(meta, "Identifier");
24860
23917
  return this.parseImportMeta(node)
24861
23918
  } else {
24862
23919
  this.unexpected();
@@ -25006,7 +24063,7 @@ pp$5.parseNew = function() {
25006
24063
  var node = this.startNode();
25007
24064
  this.next();
25008
24065
  if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
25009
- var meta = this.startNodeAt(node.start, node.startLoc);
24066
+ var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
25010
24067
  meta.name = "new";
25011
24068
  node.meta = this.finishNode(meta, "Identifier");
25012
24069
  this.next();
@@ -27834,7 +26891,7 @@ pp.readWord = function() {
27834
26891
  // [walk]: util/walk.js
27835
26892
 
27836
26893
 
27837
- var version$2 = "8.11.2";
26894
+ var version$2 = "8.11.3";
27838
26895
 
27839
26896
  Parser$1.acorn = {
27840
26897
  Parser: Parser$1,
@@ -27859,11 +26916,10 @@ Parser$1.acorn = {
27859
26916
  };
27860
26917
 
27861
26918
  // The main exported interface (under `self.acorn` when in the
27862
- // browser) is a `parse` function that takes a code string and
27863
- // returns an abstract syntax tree as specified by [Mozilla parser
27864
- // API][api].
26919
+ // browser) is a `parse` function that takes a code string and returns
26920
+ // an abstract syntax tree as specified by the [ESTree spec][estree].
27865
26921
  //
27866
- // [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
26922
+ // [estree]: https://github.com/estree/estree
27867
26923
 
27868
26924
  function parse$b(input, options) {
27869
26925
  return Parser$1.parse(input, options)
@@ -27877,13 +26933,6 @@ function parseExpressionAt(input, pos, options) {
27877
26933
  return Parser$1.parseExpressionAt(input, pos, options)
27878
26934
  }
27879
26935
 
27880
- // Acorn is organized as a tokenizer and a recursive-descent parser.
27881
- // The `tokenizer` export provides an interface to the tokenizer.
27882
-
27883
- function tokenizer(input, options) {
27884
- return Parser$1.tokenizer(input, options)
27885
- }
27886
-
27887
26936
  const HASH_RE = /#/g;
27888
26937
  const AMPERSAND_RE = /&/g;
27889
26938
  const EQUAL_RE = /=/g;
@@ -37617,112 +36666,468 @@ var src$1 = rc;
37617
36666
 
37618
36667
  var postcssrc = /*@__PURE__*/getDefaultExportFromCjs(src$1);
37619
36668
 
37620
- function _stripLiteralAcorn(code, options) {
36669
+ // Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
36670
+ // License: MIT.
36671
+ var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
36672
+ RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
36673
+ Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
36674
+ Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;
36675
+ StringLiteral = /(['"])(?:(?!\1)[^\\\n\r]|\\(?:\r\n|[^]))*(\1)?/y;
36676
+ NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
36677
+ Template = /[`}](?:[^`\\$]|\\[^]|\$(?!\{))*(`|\$\{)?/y;
36678
+ WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu;
36679
+ LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
36680
+ MultiLineComment = /\/\*(?:[^*]|\*(?!\/))*(\*\/)?/y;
36681
+ SingleLineComment = /\/\/.*/y;
36682
+ JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
36683
+ JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;
36684
+ JSXString = /(['"])(?:(?!\1)[^])*(\1)?/y;
36685
+ JSXText = /[^<>{}]+/y;
36686
+ TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
36687
+ TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
36688
+ KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
36689
+ KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
36690
+ Newline = RegExp(LineTerminatorSequence.source);
36691
+ var jsTokens_1 = function*(input, {jsx = false} = {}) {
36692
+ var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
36693
+ ({length} = input);
36694
+ lastIndex = 0;
36695
+ lastSignificantToken = "";
36696
+ stack = [
36697
+ {tag: "JS"}
36698
+ ];
36699
+ braces = [];
36700
+ parenNesting = 0;
36701
+ postfixIncDec = false;
36702
+ while (lastIndex < length) {
36703
+ mode = stack[stack.length - 1];
36704
+ switch (mode.tag) {
36705
+ case "JS":
36706
+ case "JSNonExpressionParen":
36707
+ case "InterpolationInTemplate":
36708
+ case "InterpolationInJSX":
36709
+ if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
36710
+ RegularExpressionLiteral.lastIndex = lastIndex;
36711
+ if (match = RegularExpressionLiteral.exec(input)) {
36712
+ lastIndex = RegularExpressionLiteral.lastIndex;
36713
+ lastSignificantToken = match[0];
36714
+ postfixIncDec = true;
36715
+ yield ({
36716
+ type: "RegularExpressionLiteral",
36717
+ value: match[0],
36718
+ closed: match[1] !== void 0 && match[1] !== "\\"
36719
+ });
36720
+ continue;
36721
+ }
36722
+ }
36723
+ Punctuator.lastIndex = lastIndex;
36724
+ if (match = Punctuator.exec(input)) {
36725
+ punctuator = match[0];
36726
+ nextLastIndex = Punctuator.lastIndex;
36727
+ nextLastSignificantToken = punctuator;
36728
+ switch (punctuator) {
36729
+ case "(":
36730
+ if (lastSignificantToken === "?NonExpressionParenKeyword") {
36731
+ stack.push({
36732
+ tag: "JSNonExpressionParen",
36733
+ nesting: parenNesting
36734
+ });
36735
+ }
36736
+ parenNesting++;
36737
+ postfixIncDec = false;
36738
+ break;
36739
+ case ")":
36740
+ parenNesting--;
36741
+ postfixIncDec = true;
36742
+ if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
36743
+ stack.pop();
36744
+ nextLastSignificantToken = "?NonExpressionParenEnd";
36745
+ postfixIncDec = false;
36746
+ }
36747
+ break;
36748
+ case "{":
36749
+ Punctuator.lastIndex = 0;
36750
+ isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
36751
+ braces.push(isExpression);
36752
+ postfixIncDec = false;
36753
+ break;
36754
+ case "}":
36755
+ switch (mode.tag) {
36756
+ case "InterpolationInTemplate":
36757
+ if (braces.length === mode.nesting) {
36758
+ Template.lastIndex = lastIndex;
36759
+ match = Template.exec(input);
36760
+ lastIndex = Template.lastIndex;
36761
+ lastSignificantToken = match[0];
36762
+ if (match[1] === "${") {
36763
+ lastSignificantToken = "?InterpolationInTemplate";
36764
+ postfixIncDec = false;
36765
+ yield ({
36766
+ type: "TemplateMiddle",
36767
+ value: match[0]
36768
+ });
36769
+ } else {
36770
+ stack.pop();
36771
+ postfixIncDec = true;
36772
+ yield ({
36773
+ type: "TemplateTail",
36774
+ value: match[0],
36775
+ closed: match[1] === "`"
36776
+ });
36777
+ }
36778
+ continue;
36779
+ }
36780
+ break;
36781
+ case "InterpolationInJSX":
36782
+ if (braces.length === mode.nesting) {
36783
+ stack.pop();
36784
+ lastIndex += 1;
36785
+ lastSignificantToken = "}";
36786
+ yield ({
36787
+ type: "JSXPunctuator",
36788
+ value: "}"
36789
+ });
36790
+ continue;
36791
+ }
36792
+ }
36793
+ postfixIncDec = braces.pop();
36794
+ nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
36795
+ break;
36796
+ case "]":
36797
+ postfixIncDec = true;
36798
+ break;
36799
+ case "++":
36800
+ case "--":
36801
+ nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
36802
+ break;
36803
+ case "<":
36804
+ if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
36805
+ stack.push({tag: "JSXTag"});
36806
+ lastIndex += 1;
36807
+ lastSignificantToken = "<";
36808
+ yield ({
36809
+ type: "JSXPunctuator",
36810
+ value: punctuator
36811
+ });
36812
+ continue;
36813
+ }
36814
+ postfixIncDec = false;
36815
+ break;
36816
+ default:
36817
+ postfixIncDec = false;
36818
+ }
36819
+ lastIndex = nextLastIndex;
36820
+ lastSignificantToken = nextLastSignificantToken;
36821
+ yield ({
36822
+ type: "Punctuator",
36823
+ value: punctuator
36824
+ });
36825
+ continue;
36826
+ }
36827
+ Identifier.lastIndex = lastIndex;
36828
+ if (match = Identifier.exec(input)) {
36829
+ lastIndex = Identifier.lastIndex;
36830
+ nextLastSignificantToken = match[0];
36831
+ switch (match[0]) {
36832
+ case "for":
36833
+ case "if":
36834
+ case "while":
36835
+ case "with":
36836
+ if (lastSignificantToken !== "." && lastSignificantToken !== "?.") {
36837
+ nextLastSignificantToken = "?NonExpressionParenKeyword";
36838
+ }
36839
+ }
36840
+ lastSignificantToken = nextLastSignificantToken;
36841
+ postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
36842
+ yield ({
36843
+ type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
36844
+ value: match[0]
36845
+ });
36846
+ continue;
36847
+ }
36848
+ StringLiteral.lastIndex = lastIndex;
36849
+ if (match = StringLiteral.exec(input)) {
36850
+ lastIndex = StringLiteral.lastIndex;
36851
+ lastSignificantToken = match[0];
36852
+ postfixIncDec = true;
36853
+ yield ({
36854
+ type: "StringLiteral",
36855
+ value: match[0],
36856
+ closed: match[2] !== void 0
36857
+ });
36858
+ continue;
36859
+ }
36860
+ NumericLiteral.lastIndex = lastIndex;
36861
+ if (match = NumericLiteral.exec(input)) {
36862
+ lastIndex = NumericLiteral.lastIndex;
36863
+ lastSignificantToken = match[0];
36864
+ postfixIncDec = true;
36865
+ yield ({
36866
+ type: "NumericLiteral",
36867
+ value: match[0]
36868
+ });
36869
+ continue;
36870
+ }
36871
+ Template.lastIndex = lastIndex;
36872
+ if (match = Template.exec(input)) {
36873
+ lastIndex = Template.lastIndex;
36874
+ lastSignificantToken = match[0];
36875
+ if (match[1] === "${") {
36876
+ lastSignificantToken = "?InterpolationInTemplate";
36877
+ stack.push({
36878
+ tag: "InterpolationInTemplate",
36879
+ nesting: braces.length
36880
+ });
36881
+ postfixIncDec = false;
36882
+ yield ({
36883
+ type: "TemplateHead",
36884
+ value: match[0]
36885
+ });
36886
+ } else {
36887
+ postfixIncDec = true;
36888
+ yield ({
36889
+ type: "NoSubstitutionTemplate",
36890
+ value: match[0],
36891
+ closed: match[1] === "`"
36892
+ });
36893
+ }
36894
+ continue;
36895
+ }
36896
+ break;
36897
+ case "JSXTag":
36898
+ case "JSXTagEnd":
36899
+ JSXPunctuator.lastIndex = lastIndex;
36900
+ if (match = JSXPunctuator.exec(input)) {
36901
+ lastIndex = JSXPunctuator.lastIndex;
36902
+ nextLastSignificantToken = match[0];
36903
+ switch (match[0]) {
36904
+ case "<":
36905
+ stack.push({tag: "JSXTag"});
36906
+ break;
36907
+ case ">":
36908
+ stack.pop();
36909
+ if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
36910
+ nextLastSignificantToken = "?JSX";
36911
+ postfixIncDec = true;
36912
+ } else {
36913
+ stack.push({tag: "JSXChildren"});
36914
+ }
36915
+ break;
36916
+ case "{":
36917
+ stack.push({
36918
+ tag: "InterpolationInJSX",
36919
+ nesting: braces.length
36920
+ });
36921
+ nextLastSignificantToken = "?InterpolationInJSX";
36922
+ postfixIncDec = false;
36923
+ break;
36924
+ case "/":
36925
+ if (lastSignificantToken === "<") {
36926
+ stack.pop();
36927
+ if (stack[stack.length - 1].tag === "JSXChildren") {
36928
+ stack.pop();
36929
+ }
36930
+ stack.push({tag: "JSXTagEnd"});
36931
+ }
36932
+ }
36933
+ lastSignificantToken = nextLastSignificantToken;
36934
+ yield ({
36935
+ type: "JSXPunctuator",
36936
+ value: match[0]
36937
+ });
36938
+ continue;
36939
+ }
36940
+ JSXIdentifier.lastIndex = lastIndex;
36941
+ if (match = JSXIdentifier.exec(input)) {
36942
+ lastIndex = JSXIdentifier.lastIndex;
36943
+ lastSignificantToken = match[0];
36944
+ yield ({
36945
+ type: "JSXIdentifier",
36946
+ value: match[0]
36947
+ });
36948
+ continue;
36949
+ }
36950
+ JSXString.lastIndex = lastIndex;
36951
+ if (match = JSXString.exec(input)) {
36952
+ lastIndex = JSXString.lastIndex;
36953
+ lastSignificantToken = match[0];
36954
+ yield ({
36955
+ type: "JSXString",
36956
+ value: match[0],
36957
+ closed: match[2] !== void 0
36958
+ });
36959
+ continue;
36960
+ }
36961
+ break;
36962
+ case "JSXChildren":
36963
+ JSXText.lastIndex = lastIndex;
36964
+ if (match = JSXText.exec(input)) {
36965
+ lastIndex = JSXText.lastIndex;
36966
+ lastSignificantToken = match[0];
36967
+ yield ({
36968
+ type: "JSXText",
36969
+ value: match[0]
36970
+ });
36971
+ continue;
36972
+ }
36973
+ switch (input[lastIndex]) {
36974
+ case "<":
36975
+ stack.push({tag: "JSXTag"});
36976
+ lastIndex++;
36977
+ lastSignificantToken = "<";
36978
+ yield ({
36979
+ type: "JSXPunctuator",
36980
+ value: "<"
36981
+ });
36982
+ continue;
36983
+ case "{":
36984
+ stack.push({
36985
+ tag: "InterpolationInJSX",
36986
+ nesting: braces.length
36987
+ });
36988
+ lastIndex++;
36989
+ lastSignificantToken = "?InterpolationInJSX";
36990
+ postfixIncDec = false;
36991
+ yield ({
36992
+ type: "JSXPunctuator",
36993
+ value: "{"
36994
+ });
36995
+ continue;
36996
+ }
36997
+ }
36998
+ WhiteSpace.lastIndex = lastIndex;
36999
+ if (match = WhiteSpace.exec(input)) {
37000
+ lastIndex = WhiteSpace.lastIndex;
37001
+ yield ({
37002
+ type: "WhiteSpace",
37003
+ value: match[0]
37004
+ });
37005
+ continue;
37006
+ }
37007
+ LineTerminatorSequence.lastIndex = lastIndex;
37008
+ if (match = LineTerminatorSequence.exec(input)) {
37009
+ lastIndex = LineTerminatorSequence.lastIndex;
37010
+ postfixIncDec = false;
37011
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
37012
+ lastSignificantToken = "?NoLineTerminatorHere";
37013
+ }
37014
+ yield ({
37015
+ type: "LineTerminatorSequence",
37016
+ value: match[0]
37017
+ });
37018
+ continue;
37019
+ }
37020
+ MultiLineComment.lastIndex = lastIndex;
37021
+ if (match = MultiLineComment.exec(input)) {
37022
+ lastIndex = MultiLineComment.lastIndex;
37023
+ if (Newline.test(match[0])) {
37024
+ postfixIncDec = false;
37025
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
37026
+ lastSignificantToken = "?NoLineTerminatorHere";
37027
+ }
37028
+ }
37029
+ yield ({
37030
+ type: "MultiLineComment",
37031
+ value: match[0],
37032
+ closed: match[1] !== void 0
37033
+ });
37034
+ continue;
37035
+ }
37036
+ SingleLineComment.lastIndex = lastIndex;
37037
+ if (match = SingleLineComment.exec(input)) {
37038
+ lastIndex = SingleLineComment.lastIndex;
37039
+ postfixIncDec = false;
37040
+ yield ({
37041
+ type: "SingleLineComment",
37042
+ value: match[0]
37043
+ });
37044
+ continue;
37045
+ }
37046
+ firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
37047
+ lastIndex += firstCodePoint.length;
37048
+ lastSignificantToken = firstCodePoint;
37049
+ postfixIncDec = false;
37050
+ yield ({
37051
+ type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
37052
+ value: firstCodePoint
37053
+ });
37054
+ }
37055
+ return void 0;
37056
+ };
37057
+
37058
+ var jsTokens = /*@__PURE__*/getDefaultExportFromCjs(jsTokens_1);
37059
+
37060
+ function stripLiteralJsTokens(code, options) {
37621
37061
  const FILL = options?.fillChar ?? " ";
37622
37062
  const FILL_COMMENT = " ";
37623
37063
  let result = "";
37624
37064
  const filter = options?.filter ?? (() => true);
37625
- function fillupTo(index) {
37626
- if (index > result.length)
37627
- result += code.slice(result.length, index).replace(/[^\n]/g, FILL_COMMENT);
37628
- }
37629
37065
  const tokens = [];
37630
- const pasers = tokenizer(code, {
37631
- ecmaVersion: "latest",
37632
- sourceType: "module",
37633
- allowHashBang: true,
37634
- allowAwaitOutsideFunction: true,
37635
- allowImportExportEverywhere: true
37636
- });
37637
- const iter = pasers[Symbol.iterator]();
37638
- let error;
37639
- try {
37640
- while (true) {
37641
- const { done, value: token } = iter.next();
37642
- if (done)
37643
- break;
37644
- tokens.push(token);
37645
- fillupTo(token.start);
37646
- if (token.type.label === "string") {
37647
- const body = code.slice(token.start + 1, token.end - 1);
37648
- if (filter(body)) {
37649
- result += code[token.start] + FILL.repeat(token.end - token.start - 2) + code[token.end - 1];
37650
- continue;
37651
- }
37652
- } else if (token.type.label === "template") {
37653
- const body = code.slice(token.start, token.end);
37654
- if (filter(body)) {
37655
- result += FILL.repeat(token.end - token.start);
37656
- continue;
37657
- }
37658
- } else if (token.type.label === "regexp") {
37659
- const body = code.slice(token.start, token.end);
37660
- if (filter(body)) {
37661
- result += body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${FILL.repeat($1.length)}/${$2}`);
37662
- continue;
37663
- }
37066
+ for (const token of jsTokens(code, { jsx: false })) {
37067
+ tokens.push(token);
37068
+ if (token.type === "SingleLineComment") {
37069
+ result += FILL_COMMENT.repeat(token.value.length);
37070
+ continue;
37071
+ }
37072
+ if (token.type === "MultiLineComment") {
37073
+ result += token.value.replace(/[^\n]/g, FILL_COMMENT);
37074
+ continue;
37075
+ }
37076
+ if (token.type === "StringLiteral") {
37077
+ const body = token.value.slice(1, -1);
37078
+ if (filter(body)) {
37079
+ result += token.value[0] + FILL.repeat(body.length) + token.value[token.value.length - 1];
37080
+ continue;
37664
37081
  }
37665
- result += code.slice(token.start, token.end);
37666
37082
  }
37667
- fillupTo(code.length);
37668
- } catch (e) {
37669
- error = e;
37083
+ if (token.type === "NoSubstitutionTemplate") {
37084
+ const body = token.value.slice(1, -1);
37085
+ if (filter(body)) {
37086
+ result += `\`${body.replace(/[^\n]/g, FILL)}\``;
37087
+ continue;
37088
+ }
37089
+ }
37090
+ if (token.type === "RegularExpressionLiteral") {
37091
+ const body = token.value;
37092
+ if (filter(body)) {
37093
+ result += body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${FILL.repeat($1.length)}/${$2}`);
37094
+ continue;
37095
+ }
37096
+ }
37097
+ if (token.type === "TemplateHead") {
37098
+ const body = token.value.slice(1, -2);
37099
+ if (filter(body)) {
37100
+ result += `\`${body.replace(/[^\n]/g, FILL)}\${`;
37101
+ continue;
37102
+ }
37103
+ }
37104
+ if (token.type === "TemplateTail") {
37105
+ const body = token.value.slice(0, -2);
37106
+ if (filter(body)) {
37107
+ result += `}${body.replace(/[^\n]/g, FILL)}\``;
37108
+ continue;
37109
+ }
37110
+ }
37111
+ if (token.type === "TemplateMiddle") {
37112
+ const body = token.value.slice(1, -2);
37113
+ if (filter(body)) {
37114
+ result += `}${body.replace(/[^\n]/g, FILL)}\${`;
37115
+ continue;
37116
+ }
37117
+ }
37118
+ result += token.value;
37670
37119
  }
37671
37120
  return {
37672
- error,
37673
37121
  result,
37674
37122
  tokens
37675
37123
  };
37676
37124
  }
37677
37125
 
37678
- const multilineCommentsRE = /\/\*([^*\/])*?\*\//gms;
37679
- const singlelineCommentsRE = /(?:^|\n|\r)\s*\/\/.*(?:\r|\n|$)/gm;
37680
- const templateLiteralRE$1 = /\$\{(\s*(?:|{.*}|(?!\$\{).|\n|\r)*?\s*)\}/g;
37681
- const quotesRE = [
37682
- /(["'`])((?:\\\1|(?!\1)|.|\r)*?)\1/gm,
37683
- /([`])((?:\\\1|(?!\1)|.|\n|\r)*?)\1/gm
37684
- // multi-line strings (i.e. template literals only)
37685
- ];
37686
- function stripLiteralRegex(code, options) {
37687
- const FILL_COMMENT = " ";
37688
- const FILL = options?.fillChar ?? " ";
37689
- const filter = options?.filter ?? (() => true);
37690
- code = code.replace(multilineCommentsRE, (s) => filter(s) ? FILL_COMMENT.repeat(s.length) : s).replace(singlelineCommentsRE, (s) => filter(s) ? FILL_COMMENT.repeat(s.length) : s);
37691
- let expanded = code;
37692
- for (let i = 0; i < 16; i++) {
37693
- const before = expanded;
37694
- expanded = expanded.replace(templateLiteralRE$1, "` $1`");
37695
- if (expanded === before)
37696
- break;
37697
- }
37698
- quotesRE.forEach((re) => {
37699
- expanded = expanded.replace(re, (s, quote, body, index) => {
37700
- if (!filter(s.slice(1, -1)))
37701
- return s;
37702
- code = code.slice(0, index + 1) + FILL.repeat(s.length - 2) + code.slice(index + s.length - 1);
37703
- return quote + FILL.repeat(s.length - 2) + quote;
37704
- });
37705
- });
37706
- return code;
37707
- }
37708
-
37709
37126
  function stripLiteral(code, options) {
37710
37127
  return stripLiteralDetailed(code, options).result;
37711
37128
  }
37712
37129
  function stripLiteralDetailed(code, options) {
37713
- const acorn = _stripLiteralAcorn(code, options);
37714
- if (!acorn.error) {
37715
- return {
37716
- mode: "acorn",
37717
- result: acorn.result,
37718
- acorn
37719
- };
37720
- }
37721
- return {
37722
- mode: "regex",
37723
- result: stripLiteralRegex(acorn.result + code.slice(acorn.result.length), options),
37724
- acorn
37725
- };
37130
+ return stripLiteralJsTokens(code, options);
37726
37131
  }
37727
37132
 
37728
37133
  var main$1 = {exports: {}};
@@ -38201,13 +37606,13 @@ function expand (config) {
38201
37606
 
38202
37607
  var expand_1 = expand;
38203
37608
 
38204
- function getEnvFilesForMode(mode) {
37609
+ function getEnvFilesForMode(mode, envDir) {
38205
37610
  return [
38206
37611
  /** default file */ `.env`,
38207
37612
  /** local file */ `.env.local`,
38208
37613
  /** mode file */ `.env.${mode}`,
38209
37614
  /** mode local file */ `.env.${mode}.local`,
38210
- ];
37615
+ ].map((file) => path$o.join(envDir, file));
38211
37616
  }
38212
37617
  function loadEnv(mode, envDir, prefixes = 'VITE_') {
38213
37618
  if (mode === 'local') {
@@ -38216,9 +37621,8 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
38216
37621
  }
38217
37622
  prefixes = arraify(prefixes);
38218
37623
  const env = {};
38219
- const envFiles = getEnvFilesForMode(mode);
38220
- const parsed = Object.fromEntries(envFiles.flatMap((file) => {
38221
- const filePath = path$o.join(envDir, file);
37624
+ const envFiles = getEnvFilesForMode(mode, envDir);
37625
+ const parsed = Object.fromEntries(envFiles.flatMap((filePath) => {
38222
37626
  if (!tryStatSync(filePath)?.isFile())
38223
37627
  return [];
38224
37628
  return Object.entries(parse_1$1(fs$l.readFileSync(filePath)));
@@ -38521,7 +37925,8 @@ function buildHtmlPlugin(config) {
38521
37925
  name: 'vite:build-html',
38522
37926
  async transform(html, id) {
38523
37927
  if (id.endsWith('.html')) {
38524
- const relativeUrlPath = path$o.posix.relative(config.root, normalizePath$3(id));
37928
+ id = normalizePath$3(id);
37929
+ const relativeUrlPath = path$o.posix.relative(config.root, id);
38525
37930
  const publicPath = `/${relativeUrlPath}`;
38526
37931
  const publicBase = getBaseInHTML(relativeUrlPath, config);
38527
37932
  const publicToRelative = (filename, importer) => publicBase + filename;
@@ -38529,13 +37934,12 @@ function buildHtmlPlugin(config) {
38529
37934
  // Determines true start position for the node, either the < character
38530
37935
  // position, or the newline at the end of the previous line's node.
38531
37936
  const nodeStartWithLeadingWhitespace = (node) => {
38532
- if (node.sourceCodeLocation.startOffset === 0)
38533
- return node.sourceCodeLocation.startOffset;
37937
+ const startOffset = node.sourceCodeLocation.startOffset;
37938
+ if (startOffset === 0)
37939
+ return 0;
38534
37940
  // Gets the offset for the start of the line including the
38535
37941
  // newline trailing the previous node
38536
- const lineStartOffset = node.sourceCodeLocation.startOffset -
38537
- node.sourceCodeLocation.startCol;
38538
- const line = s.slice(Math.max(0, lineStartOffset), node.sourceCodeLocation.startOffset);
37942
+ const lineStartOffset = startOffset - node.sourceCodeLocation.startCol;
38539
37943
  // <previous-line-node></previous-line-node>
38540
37944
  // <target-node></target-node>
38541
37945
  //
@@ -38547,9 +37951,16 @@ function buildHtmlPlugin(config) {
38547
37951
  //
38548
37952
  // However, if there is content between our target node start and the
38549
37953
  // previous newline, we cannot strip it out without risking content deletion.
38550
- return line.trim()
38551
- ? node.sourceCodeLocation.startOffset
38552
- : lineStartOffset;
37954
+ let isLineEmpty = false;
37955
+ try {
37956
+ const line = s.slice(Math.max(0, lineStartOffset), startOffset);
37957
+ isLineEmpty = !line.trim();
37958
+ }
37959
+ catch {
37960
+ // magic-string may throw if there's some content removed in the sliced string,
37961
+ // which we ignore and assume the line is not empty
37962
+ }
37963
+ return isLineEmpty ? lineStartOffset : startOffset;
38553
37964
  };
38554
37965
  // pre-transform
38555
37966
  html = await applyHtmlTransforms(html, preHooks, {
@@ -39280,7 +38691,8 @@ const commonjsProxyRE = /\?commonjs-proxy/;
39280
38691
  const inlineRE = /[?&]inline\b/;
39281
38692
  const inlineCSSRE = /[?&]inline-css\b/;
39282
38693
  const styleAttrRE = /[?&]style-attr\b/;
39283
- const varRE = /^var\(/i;
38694
+ const functionCallRE = /^[A-Z_][\w-]*\(/i;
38695
+ const transformOnlyRE = /[?&]transform-only\b/;
39284
38696
  const nonEscapedDoubleQuoteRe = /(?<!\\)(")/g;
39285
38697
  const cssBundleName = 'style.css';
39286
38698
  const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
@@ -39293,10 +38705,12 @@ const postcssConfigCache = new WeakMap();
39293
38705
  function encodePublicUrlsInCSS(config) {
39294
38706
  return config.command === 'build';
39295
38707
  }
38708
+ const cssUrlAssetRE = /__VITE_CSS_URL__([\da-f]+)__/g;
39296
38709
  /**
39297
38710
  * Plugin applied before user plugins
39298
38711
  */
39299
38712
  function cssPlugin(config) {
38713
+ const isBuild = config.command === 'build';
39300
38714
  let server;
39301
38715
  let moduleCache;
39302
38716
  const resolveUrl = config.createResolver({
@@ -39319,6 +38733,22 @@ function cssPlugin(config) {
39319
38733
  cssModulesCache.set(config, moduleCache);
39320
38734
  removedPureCssFilesCache.set(config, new Map());
39321
38735
  },
38736
+ async load(id) {
38737
+ if (!isCSSRequest(id))
38738
+ return;
38739
+ if (urlRE.test(id)) {
38740
+ if (isModuleCSSRequest(id)) {
38741
+ throw new Error(`?url is not supported with CSS modules. (tried to import ${JSON.stringify(id)})`);
38742
+ }
38743
+ // *.css?url
38744
+ // in dev, it's handled by assets plugin.
38745
+ if (isBuild) {
38746
+ id = injectQuery(removeUrlQuery(id), 'transform-only');
38747
+ return (`import ${JSON.stringify(id)};` +
38748
+ `export default "__VITE_CSS_URL__${Buffer.from(id).toString('hex')}__"`);
38749
+ }
38750
+ }
38751
+ },
39322
38752
  async transform(raw, id, options) {
39323
38753
  if (!isCSSRequest(id) ||
39324
38754
  commonjsProxyRE.test(id) ||
@@ -39406,8 +38836,9 @@ function cssPlugin(config) {
39406
38836
  function cssPostPlugin(config) {
39407
38837
  // styles initialization in buildStart causes a styling loss in watch
39408
38838
  const styles = new Map();
39409
- // list of css emit tasks to guarantee the files are emitted in a deterministic order
39410
- let emitTasks = [];
38839
+ // queue to emit css serially to guarantee the files are emitted in a deterministic order
38840
+ let codeSplitEmitQueue = createSerialPromiseQueue();
38841
+ const urlEmitQueue = createSerialPromiseQueue();
39411
38842
  let pureCssChunks;
39412
38843
  // when there are multiple rollup outputs and extracting CSS, only emit once,
39413
38844
  // since output formats have no effect on the generated CSS.
@@ -39440,7 +38871,7 @@ function cssPostPlugin(config) {
39440
38871
  pureCssChunks = new Set();
39441
38872
  hasEmitted = false;
39442
38873
  chunkCSSMap = new Map();
39443
- emitTasks = [];
38874
+ codeSplitEmitQueue = createSerialPromiseQueue();
39444
38875
  },
39445
38876
  async transform(css, id, options) {
39446
38877
  if (!isCSSRequest(id) ||
@@ -39537,10 +38968,13 @@ function cssPostPlugin(config) {
39537
38968
  const ids = Object.keys(chunk.modules);
39538
38969
  for (const id of ids) {
39539
38970
  if (styles.has(id)) {
39540
- chunkCSS += styles.get(id);
39541
- // a css module contains JS, so it makes this not a pure css chunk
39542
- if (cssModuleRE.test(id)) {
39543
- isPureCssChunk = false;
38971
+ // ?transform-only is used for ?url and shouldn't be included in normal CSS chunks
38972
+ if (!transformOnlyRE.test(id)) {
38973
+ chunkCSS += styles.get(id);
38974
+ // a css module contains JS, so it makes this not a pure css chunk
38975
+ if (cssModuleRE.test(id)) {
38976
+ isPureCssChunk = false;
38977
+ }
39544
38978
  }
39545
38979
  }
39546
38980
  else {
@@ -39550,9 +38984,6 @@ function cssPostPlugin(config) {
39550
38984
  isPureCssChunk = false;
39551
38985
  }
39552
38986
  }
39553
- if (!chunkCSS) {
39554
- return null;
39555
- }
39556
38987
  const publicAssetUrlMap = publicAssetUrlCache.get(config);
39557
38988
  // resolve asset URL placeholders to their built file URLs
39558
38989
  const resolveAssetUrlsInCss = (chunkCSS, cssAssetName) => {
@@ -39585,6 +39016,57 @@ function cssPostPlugin(config) {
39585
39016
  function ensureFileExt(name, ext) {
39586
39017
  return normalizePath$3(path$o.format({ ...path$o.parse(name), base: undefined, ext }));
39587
39018
  }
39019
+ let s;
39020
+ const urlEmitTasks = [];
39021
+ if (code.includes('__VITE_CSS_URL__')) {
39022
+ let match;
39023
+ cssUrlAssetRE.lastIndex = 0;
39024
+ while ((match = cssUrlAssetRE.exec(code))) {
39025
+ const [full, idHex] = match;
39026
+ const id = Buffer.from(idHex, 'hex').toString();
39027
+ const originalFilename = cleanUrl(id);
39028
+ const cssAssetName = ensureFileExt(path$o.basename(originalFilename), '.css');
39029
+ if (!styles.has(id)) {
39030
+ throw new Error(`css content for ${JSON.stringify(id)} was not found`);
39031
+ }
39032
+ let cssContent = styles.get(id);
39033
+ cssContent = resolveAssetUrlsInCss(cssContent, cssAssetName);
39034
+ urlEmitTasks.push({
39035
+ cssAssetName,
39036
+ originalFilename,
39037
+ content: cssContent,
39038
+ start: match.index,
39039
+ end: match.index + full.length,
39040
+ });
39041
+ }
39042
+ }
39043
+ // should await even if this chunk does not include __VITE_CSS_URL__
39044
+ // so that code after this line runs in the same order
39045
+ await urlEmitQueue.run(async () => Promise.all(urlEmitTasks.map(async (info) => {
39046
+ info.content = await finalizeCss(info.content, true, config);
39047
+ })));
39048
+ if (urlEmitTasks.length > 0) {
39049
+ const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format, config.isWorker);
39050
+ s ||= new MagicString(code);
39051
+ for (const { cssAssetName, originalFilename, content, start, end, } of urlEmitTasks) {
39052
+ const referenceId = this.emitFile({
39053
+ name: cssAssetName,
39054
+ type: 'asset',
39055
+ source: content,
39056
+ });
39057
+ generatedAssets
39058
+ .get(config)
39059
+ .set(referenceId, { originalName: originalFilename });
39060
+ const replacement = toOutputFilePathInJS(this.getFileName(referenceId), 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
39061
+ const replacementString = typeof replacement === 'string'
39062
+ ? JSON.stringify(replacement).slice(1, -1)
39063
+ : `"+${replacement.runtime}+"`;
39064
+ s.update(start, end, replacementString);
39065
+ }
39066
+ }
39067
+ if (!chunkCSS && !s) {
39068
+ return null;
39069
+ }
39588
39070
  if (config.build.cssCodeSplit) {
39589
39071
  if (opts.format === 'es' || opts.format === 'cjs') {
39590
39072
  if (isPureCssChunk) {
@@ -39602,19 +39084,10 @@ function cssPostPlugin(config) {
39602
39084
  : cssFullAssetName;
39603
39085
  const originalFilename = getChunkOriginalFileName(chunk, config.root, opts.format);
39604
39086
  chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName);
39605
- const previousTask = emitTasks[emitTasks.length - 1];
39606
- // finalizeCss is async which makes `emitFile` non-deterministic, so
39607
- // we use a `.then` to wait for previous tasks before finishing this
39608
- const thisTask = finalizeCss(chunkCSS, true, config).then((css) => {
39609
- chunkCSS = css;
39610
- // make sure the previous task is also finished, this works recursively
39611
- return previousTask;
39087
+ // wait for previous tasks as well
39088
+ chunkCSS = await codeSplitEmitQueue.run(async () => {
39089
+ return finalizeCss(chunkCSS, true, config);
39612
39090
  });
39613
- // push this task so the next task can wait for this one
39614
- emitTasks.push(thisTask);
39615
- const emitTasksLength = emitTasks.length;
39616
- // wait for this and previous tasks to finish
39617
- await thisTask;
39618
39091
  // emit corresponding css file
39619
39092
  const referenceId = this.emitFile({
39620
39093
  name: cssAssetName,
@@ -39625,10 +39098,6 @@ function cssPostPlugin(config) {
39625
39098
  .get(config)
39626
39099
  .set(referenceId, { originalName: originalFilename, isEntry });
39627
39100
  chunk.viteMetadata.importedCss.add(this.getFileName(referenceId));
39628
- if (emitTasksLength === emitTasks.length) {
39629
- // this is the last task, clear `emitTasks` to free up memory
39630
- emitTasks = [];
39631
- }
39632
39101
  }
39633
39102
  else if (!config.build.ssr) {
39634
39103
  // legacy build and inline css
@@ -39655,25 +39124,27 @@ function cssPostPlugin(config) {
39655
39124
  const insertMark = "'use strict';";
39656
39125
  injectionPoint = code.indexOf(insertMark) + insertMark.length;
39657
39126
  }
39658
- const s = new MagicString(code);
39127
+ s ||= new MagicString(code);
39659
39128
  s.appendRight(injectionPoint, injectCode);
39660
- if (config.build.sourcemap) {
39661
- // resolve public URL from CSS paths, we need to use absolute paths
39662
- return {
39663
- code: s.toString(),
39664
- map: s.generateMap({ hires: 'boundary' }),
39665
- };
39666
- }
39667
- else {
39668
- return { code: s.toString() };
39669
- }
39670
39129
  }
39671
39130
  }
39672
39131
  else {
39132
+ // resolve public URL from CSS paths, we need to use absolute paths
39673
39133
  chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssBundleName);
39674
39134
  // finalizeCss is called for the aggregated chunk in generateBundle
39675
39135
  chunkCSSMap.set(chunk.fileName, chunkCSS);
39676
39136
  }
39137
+ if (s) {
39138
+ if (config.build.sourcemap) {
39139
+ return {
39140
+ code: s.toString(),
39141
+ map: s.generateMap({ hires: 'boundary' }),
39142
+ };
39143
+ }
39144
+ else {
39145
+ return { code: s.toString() };
39146
+ }
39147
+ }
39677
39148
  return null;
39678
39149
  },
39679
39150
  augmentChunkHash(chunk) {
@@ -40078,8 +39549,8 @@ function createCachedImport(imp) {
40078
39549
  return cached;
40079
39550
  };
40080
39551
  }
40081
- const importPostcssImport = createCachedImport(() => import('./dep-TyoTMUQy.js').then(function (n) { return n.i; }));
40082
- const importPostcssModules = createCachedImport(() => import('./dep-mc9zj7Ue.js').then(function (n) { return n.i; }));
39552
+ const importPostcssImport = createCachedImport(() => import('./dep-oXyoRRWa.js').then(function (n) { return n.i; }));
39553
+ const importPostcssModules = createCachedImport(() => import('./dep-VtWyYv-v.js').then(function (n) { return n.i; }));
40083
39554
  const importPostcss = createCachedImport(() => import('postcss'));
40084
39555
  /**
40085
39556
  * @experimental
@@ -40252,7 +39723,7 @@ function skipUrlReplacer(rawUrl) {
40252
39723
  return (isExternalUrl(rawUrl) ||
40253
39724
  isDataUrl(rawUrl) ||
40254
39725
  rawUrl[0] === '#' ||
40255
- varRE.test(rawUrl));
39726
+ functionCallRE.test(rawUrl));
40256
39727
  }
40257
39728
  async function doUrlReplace(rawUrl, matched, replacer, funcName = 'url') {
40258
39729
  let wrap = '';
@@ -40449,7 +39920,7 @@ const scss = async (source, root, options, resolvers) => {
40449
39920
  importer = cleanScssBugUrl(importer);
40450
39921
  resolvers.sass(url, importer).then((resolved) => {
40451
39922
  if (resolved) {
40452
- rebaseUrls(resolved, options.filename, options.alias, '$')
39923
+ rebaseUrls(resolved, options.filename, options.alias, '$', resolvers.sass)
40453
39924
  .then((data) => done?.(fixScssBugImportValue(data)))
40454
39925
  .catch((data) => done?.(data));
40455
39926
  }
@@ -40517,7 +39988,7 @@ const sass = (source, root, options, aliasResolver) => scss(source, root, {
40517
39988
  * relative url() inside \@imported sass and less files must be rebased to use
40518
39989
  * root file as base.
40519
39990
  */
40520
- async function rebaseUrls(file, rootFile, alias, variablePrefix) {
39991
+ async function rebaseUrls(file, rootFile, alias, variablePrefix, resolver) {
40521
39992
  file = path$o.resolve(file); // ensure os-specific flashes
40522
39993
  // in the same dir, no need to rebase
40523
39994
  const fileDir = path$o.dirname(file);
@@ -40536,7 +40007,7 @@ async function rebaseUrls(file, rootFile, alias, variablePrefix) {
40536
40007
  return { file };
40537
40008
  }
40538
40009
  let rebased;
40539
- const rebaseFn = (url) => {
40010
+ const rebaseFn = async (url) => {
40540
40011
  if (url[0] === '/')
40541
40012
  return url;
40542
40013
  // ignore url's starting with variable
@@ -40549,7 +40020,7 @@ async function rebaseUrls(file, rootFile, alias, variablePrefix) {
40549
40020
  return url;
40550
40021
  }
40551
40022
  }
40552
- const absolute = path$o.resolve(fileDir, url);
40023
+ const absolute = (await resolver(url, file)) || path$o.resolve(fileDir, url);
40553
40024
  const relative = path$o.relative(rootDir, absolute);
40554
40025
  return normalizePath$3(relative);
40555
40026
  };
@@ -40635,7 +40106,7 @@ function createViteLessPlugin(less, rootFile, alias, resolvers) {
40635
40106
  async loadFile(filename, dir, opts, env) {
40636
40107
  const resolved = await this.resolvers.less(filename, path$o.join(dir, '*'));
40637
40108
  if (resolved) {
40638
- const result = await rebaseUrls(resolved, this.rootFile, this.alias, '@');
40109
+ const result = await rebaseUrls(resolved, this.rootFile, this.alias, '@', this.resolvers.less);
40639
40110
  let contents;
40640
40111
  if (result && 'contents' in result) {
40641
40112
  contents = result.contents;
@@ -41221,32 +40692,33 @@ function createIsConfiguredAsSsrExternal(config) {
41221
40692
  // Returns true if it is configured as external, false if it is filtered
41222
40693
  // by noExternal and undefined if it isn't affected by the explicit config
41223
40694
  return (id, importer) => {
41224
- const { ssr } = config;
41225
- if (ssr) {
41226
- if (
41227
- // If this id is defined as external, force it as external
41228
- // Note that individual package entries are allowed in ssr.external
40695
+ if (
40696
+ // If this id is defined as external, force it as external
40697
+ // Note that individual package entries are allowed in ssr.external
40698
+ ssr.external !== true &&
41229
40699
  ssr.external?.includes(id)) {
41230
- return true;
41231
- }
41232
- const pkgName = getNpmPackageName(id);
41233
- if (!pkgName) {
41234
- return isExternalizable(id, importer);
41235
- }
41236
- if (
41237
- // A package name in ssr.external externalizes every
41238
- // externalizable package entry
40700
+ return true;
40701
+ }
40702
+ const pkgName = getNpmPackageName(id);
40703
+ if (!pkgName) {
40704
+ return isExternalizable(id, importer);
40705
+ }
40706
+ if (
40707
+ // A package name in ssr.external externalizes every
40708
+ // externalizable package entry
40709
+ ssr.external !== true &&
41239
40710
  ssr.external?.includes(pkgName)) {
41240
- return isExternalizable(id, importer, true);
41241
- }
41242
- if (typeof noExternal === 'boolean') {
41243
- return !noExternal;
41244
- }
41245
- if (noExternalFilter && !noExternalFilter(pkgName)) {
41246
- return false;
41247
- }
40711
+ return isExternalizable(id, importer, true);
40712
+ }
40713
+ if (typeof noExternal === 'boolean') {
40714
+ return !noExternal;
41248
40715
  }
41249
- return isExternalizable(id, importer);
40716
+ if (noExternalFilter && !noExternalFilter(pkgName)) {
40717
+ return false;
40718
+ }
40719
+ // If `ssr.external: true`, all will be externalized by default, regardless if
40720
+ // it's a linked package
40721
+ return isExternalizable(id, importer, ssr.external === true);
41250
40722
  };
41251
40723
  }
41252
40724
  function createIsSsrExternal(config) {
@@ -41795,7 +41267,7 @@ function importGlobPlugin(config) {
41795
41267
  async transform(code, id) {
41796
41268
  if (!code.includes('import.meta.glob'))
41797
41269
  return;
41798
- const result = await transformGlobImport(code, id, config.root, (im, _, options) => this.resolve(im, id, options).then((i) => i?.id || im), config.experimental.importGlobRestoreExtension);
41270
+ const result = await transformGlobImport(code, id, config.root, (im, _, options) => this.resolve(im, id, options).then((i) => i?.id || im), config.experimental.importGlobRestoreExtension, config.logger);
41799
41271
  if (result) {
41800
41272
  if (server) {
41801
41273
  const allGlobs = result.matches.map((i) => i.globsResolved);
@@ -41827,7 +41299,7 @@ function err$1(e, pos) {
41827
41299
  error.pos = pos;
41828
41300
  return error;
41829
41301
  }
41830
- function parseGlobOptions(rawOpts, optsStartIndex) {
41302
+ function parseGlobOptions(rawOpts, optsStartIndex, logger) {
41831
41303
  let opts = {};
41832
41304
  try {
41833
41305
  opts = evalValue(rawOpts);
@@ -41855,7 +41327,16 @@ function parseGlobOptions(rawOpts, optsStartIndex) {
41855
41327
  throw err$1(`Expected glob option "query.${key}" to be of type string, number, or boolean, but got ${typeof value}`, optsStartIndex);
41856
41328
  }
41857
41329
  }
41330
+ // normalize query as string so it's easier to handle later
41331
+ opts.query = stringifyQuery(opts.query);
41858
41332
  }
41333
+ if (opts.as && logger) {
41334
+ const importSuggestion = forceDefaultAs.includes(opts.as)
41335
+ ? `, import: 'default'`
41336
+ : '';
41337
+ logger.warn(colors$1.yellow(`The glob option "as" has been deprecated in favour of "query". Please update \`as: '${opts.as}'\` to \`query: '?${opts.as}'${importSuggestion}\`.`));
41338
+ }
41339
+ // validate `import` option based on `as` option
41859
41340
  if (opts.as && forceDefaultAs.includes(opts.as)) {
41860
41341
  if (opts.import && opts.import !== 'default' && opts.import !== '*')
41861
41342
  throw err$1(`Option "import" can only be "default" or "*" when "as" is "${opts.as}", but got "${opts.import}"`, optsStartIndex);
@@ -41865,9 +41346,11 @@ function parseGlobOptions(rawOpts, optsStartIndex) {
41865
41346
  throw err$1('Options "as" and "query" cannot be used together', optsStartIndex);
41866
41347
  if (opts.as)
41867
41348
  opts.query = opts.as;
41349
+ if (opts.query && opts.query[0] !== '?')
41350
+ opts.query = `?${opts.query}`;
41868
41351
  return opts;
41869
41352
  }
41870
- async function parseImportGlob(code, importer, root, resolveId) {
41353
+ async function parseImportGlob(code, importer, root, resolveId, logger) {
41871
41354
  let cleanCode;
41872
41355
  try {
41873
41356
  cleanCode = stripLiteral(code);
@@ -41957,7 +41440,7 @@ async function parseImportGlob(code, importer, root, resolveId) {
41957
41440
  if (arg2) {
41958
41441
  if (arg2.type !== 'ObjectExpression')
41959
41442
  throw err(`Expected the second argument to be an object literal, but got "${arg2.type}"`);
41960
- options = parseGlobOptions(code.slice(arg2.range[0], arg2.range[1]), arg2.range[0]);
41443
+ options = parseGlobOptions(code.slice(arg2.range[0], arg2.range[1]), arg2.range[0], logger);
41961
41444
  }
41962
41445
  const end = ast.range[1];
41963
41446
  const globsResolved = await Promise.all(globs.map((glob) => toAbsoluteGlob(glob, root, importer, resolveId)));
@@ -41979,12 +41462,12 @@ const { basename, dirname, relative, join } = posix$1;
41979
41462
  /**
41980
41463
  * @param optimizeExport for dynamicImportVar plugin don't need to optimize export.
41981
41464
  */
41982
- async function transformGlobImport(code, id, root, resolveId, restoreQueryExtension = false) {
41465
+ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtension = false, logger) {
41983
41466
  id = slash$1(id);
41984
41467
  root = slash$1(root);
41985
41468
  const isVirtual = isVirtualModule(id);
41986
41469
  const dir = isVirtual ? undefined : dirname(id);
41987
- const matches = await parseImportGlob(code, isVirtual ? undefined : id, root, resolveId);
41470
+ const matches = await parseImportGlob(code, isVirtual ? undefined : id, root, resolveId, logger);
41988
41471
  const matchedFiles = new Set();
41989
41472
  if (!matches.length)
41990
41473
  return null;
@@ -42003,13 +41486,6 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
42003
41486
  .sort();
42004
41487
  const objectProps = [];
42005
41488
  const staticImports = [];
42006
- let query = !options.query
42007
- ? ''
42008
- : typeof options.query === 'string'
42009
- ? options.query
42010
- : stringifyQuery(options.query);
42011
- if (query && query[0] !== '?')
42012
- query = `?${query}`;
42013
41489
  const resolvePaths = (file) => {
42014
41490
  if (!dir) {
42015
41491
  if (isRelative)
@@ -42035,7 +41511,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
42035
41511
  const paths = resolvePaths(file);
42036
41512
  const filePath = paths.filePath;
42037
41513
  let importPath = paths.importPath;
42038
- let importQuery = query;
41514
+ let importQuery = options.query ?? '';
42039
41515
  if (importQuery && importQuery !== '?raw') {
42040
41516
  const fileExtension = basename(file).split('.').slice(-1)[0];
42041
41517
  if (fileExtension && restoreQueryExtension)
@@ -49027,7 +48503,7 @@ const sirvOptions = ({ getHeaders, }) => {
49027
48503
  // these files to be TypeScript files, and for Vite to serve them with
49028
48504
  // this Content-Type.
49029
48505
  if (knownJavascriptExtensionRE.test(pathname)) {
49030
- res.setHeader('Content-Type', 'application/javascript');
48506
+ res.setHeader('Content-Type', 'text/javascript');
49031
48507
  }
49032
48508
  const headers = getHeaders();
49033
48509
  if (headers) {
@@ -49273,6 +48749,9 @@ async function doTransform(url, server, options, timestamp) {
49273
48749
  const { config, pluginContainer } = server;
49274
48750
  const prettyUrl = debugCache$1 ? prettifyUrl(url, config.root) : '';
49275
48751
  const ssr = !!options.ssr;
48752
+ if (ssr && isDepsOptimizerEnabled(config, true)) {
48753
+ await initDevSsrDepsOptimizer(config, server);
48754
+ }
49276
48755
  const module = await server.moduleGraph.getModuleByUrl(url, ssr);
49277
48756
  // tries to handle soft invalidation of the module if available,
49278
48757
  // returns a boolean true is successful, or false if no handling is needed
@@ -51906,7 +51385,8 @@ function resolveChokidarOptions(config, options) {
51906
51385
  '**/node_modules/**',
51907
51386
  '**/test-results/**',
51908
51387
  glob.escapePath(config.cacheDir) + '/**',
51909
- ...(Array.isArray(ignored) ? ignored : [ignored]),
51388
+ glob.escapePath(path$o.resolve(config.root, config.build.outDir)) + '/**',
51389
+ ...arraify(ignored),
51910
51390
  ],
51911
51391
  ignoreInitial: true,
51912
51392
  ignorePermissionErrors: true,
@@ -52809,7 +52289,7 @@ const GET_PAYLOAD_LENGTH_64 = 2;
52809
52289
  const GET_MASK = 3;
52810
52290
  const GET_DATA = 4;
52811
52291
  const INFLATING = 5;
52812
- const WAIT_MICROTASK = 6;
52292
+ const DEFER_EVENT = 6;
52813
52293
 
52814
52294
  /**
52815
52295
  * HyBi Receiver implementation.
@@ -52821,9 +52301,9 @@ let Receiver$1 = class Receiver extends Writable$1 {
52821
52301
  * Creates a Receiver instance.
52822
52302
  *
52823
52303
  * @param {Object} [options] Options object
52824
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
52825
- * whether or not to process more than one of the `'message'`, `'ping'`,
52826
- * and `'pong'` events per microtask
52304
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
52305
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
52306
+ * multiple times in the same tick
52827
52307
  * @param {String} [options.binaryType=nodebuffer] The type for binary data
52828
52308
  * @param {Object} [options.extensions] An object containing the negotiated
52829
52309
  * extensions
@@ -52836,8 +52316,7 @@ let Receiver$1 = class Receiver extends Writable$1 {
52836
52316
  constructor(options = {}) {
52837
52317
  super();
52838
52318
 
52839
- this._allowMultipleEventsPerMicrotask =
52840
- !!options.allowMultipleEventsPerMicrotask;
52319
+ this._allowSynchronousEvents = !!options.allowSynchronousEvents;
52841
52320
  this._binaryType = options.binaryType || BINARY_TYPES$1[0];
52842
52321
  this._extensions = options.extensions || {};
52843
52322
  this._isServer = !!options.isServer;
@@ -52860,8 +52339,9 @@ let Receiver$1 = class Receiver extends Writable$1 {
52860
52339
  this._messageLength = 0;
52861
52340
  this._fragments = [];
52862
52341
 
52863
- this._state = GET_INFO;
52342
+ this._errored = false;
52864
52343
  this._loop = false;
52344
+ this._state = GET_INFO;
52865
52345
  }
52866
52346
 
52867
52347
  /**
@@ -52933,53 +52413,42 @@ let Receiver$1 = class Receiver extends Writable$1 {
52933
52413
  * @private
52934
52414
  */
52935
52415
  startLoop(cb) {
52936
- let err;
52937
52416
  this._loop = true;
52938
52417
 
52939
52418
  do {
52940
52419
  switch (this._state) {
52941
52420
  case GET_INFO:
52942
- err = this.getInfo();
52421
+ this.getInfo(cb);
52943
52422
  break;
52944
52423
  case GET_PAYLOAD_LENGTH_16:
52945
- err = this.getPayloadLength16();
52424
+ this.getPayloadLength16(cb);
52946
52425
  break;
52947
52426
  case GET_PAYLOAD_LENGTH_64:
52948
- err = this.getPayloadLength64();
52427
+ this.getPayloadLength64(cb);
52949
52428
  break;
52950
52429
  case GET_MASK:
52951
52430
  this.getMask();
52952
52431
  break;
52953
52432
  case GET_DATA:
52954
- err = this.getData(cb);
52433
+ this.getData(cb);
52955
52434
  break;
52956
52435
  case INFLATING:
52436
+ case DEFER_EVENT:
52957
52437
  this._loop = false;
52958
52438
  return;
52959
- default:
52960
- //
52961
- // `WAIT_MICROTASK`.
52962
- //
52963
- this._loop = false;
52964
-
52965
- queueTask(() => {
52966
- this._state = GET_INFO;
52967
- this.startLoop(cb);
52968
- });
52969
- return;
52970
52439
  }
52971
52440
  } while (this._loop);
52972
52441
 
52973
- cb(err);
52442
+ if (!this._errored) cb();
52974
52443
  }
52975
52444
 
52976
52445
  /**
52977
52446
  * Reads the first two bytes of a frame.
52978
52447
  *
52979
- * @return {(RangeError|undefined)} A possible error
52448
+ * @param {Function} cb Callback
52980
52449
  * @private
52981
52450
  */
52982
- getInfo() {
52451
+ getInfo(cb) {
52983
52452
  if (this._bufferedBytes < 2) {
52984
52453
  this._loop = false;
52985
52454
  return;
@@ -52988,27 +52457,31 @@ let Receiver$1 = class Receiver extends Writable$1 {
52988
52457
  const buf = this.consume(2);
52989
52458
 
52990
52459
  if ((buf[0] & 0x30) !== 0x00) {
52991
- this._loop = false;
52992
- return error$1(
52460
+ const error = this.createError(
52993
52461
  RangeError,
52994
52462
  'RSV2 and RSV3 must be clear',
52995
52463
  true,
52996
52464
  1002,
52997
52465
  'WS_ERR_UNEXPECTED_RSV_2_3'
52998
52466
  );
52467
+
52468
+ cb(error);
52469
+ return;
52999
52470
  }
53000
52471
 
53001
52472
  const compressed = (buf[0] & 0x40) === 0x40;
53002
52473
 
53003
52474
  if (compressed && !this._extensions[PerMessageDeflate$3.extensionName]) {
53004
- this._loop = false;
53005
- return error$1(
52475
+ const error = this.createError(
53006
52476
  RangeError,
53007
52477
  'RSV1 must be clear',
53008
52478
  true,
53009
52479
  1002,
53010
52480
  'WS_ERR_UNEXPECTED_RSV_1'
53011
52481
  );
52482
+
52483
+ cb(error);
52484
+ return;
53012
52485
  }
53013
52486
 
53014
52487
  this._fin = (buf[0] & 0x80) === 0x80;
@@ -53017,86 +52490,100 @@ let Receiver$1 = class Receiver extends Writable$1 {
53017
52490
 
53018
52491
  if (this._opcode === 0x00) {
53019
52492
  if (compressed) {
53020
- this._loop = false;
53021
- return error$1(
52493
+ const error = this.createError(
53022
52494
  RangeError,
53023
52495
  'RSV1 must be clear',
53024
52496
  true,
53025
52497
  1002,
53026
52498
  'WS_ERR_UNEXPECTED_RSV_1'
53027
52499
  );
52500
+
52501
+ cb(error);
52502
+ return;
53028
52503
  }
53029
52504
 
53030
52505
  if (!this._fragmented) {
53031
- this._loop = false;
53032
- return error$1(
52506
+ const error = this.createError(
53033
52507
  RangeError,
53034
52508
  'invalid opcode 0',
53035
52509
  true,
53036
52510
  1002,
53037
52511
  'WS_ERR_INVALID_OPCODE'
53038
52512
  );
52513
+
52514
+ cb(error);
52515
+ return;
53039
52516
  }
53040
52517
 
53041
52518
  this._opcode = this._fragmented;
53042
52519
  } else if (this._opcode === 0x01 || this._opcode === 0x02) {
53043
52520
  if (this._fragmented) {
53044
- this._loop = false;
53045
- return error$1(
52521
+ const error = this.createError(
53046
52522
  RangeError,
53047
52523
  `invalid opcode ${this._opcode}`,
53048
52524
  true,
53049
52525
  1002,
53050
52526
  'WS_ERR_INVALID_OPCODE'
53051
52527
  );
52528
+
52529
+ cb(error);
52530
+ return;
53052
52531
  }
53053
52532
 
53054
52533
  this._compressed = compressed;
53055
52534
  } else if (this._opcode > 0x07 && this._opcode < 0x0b) {
53056
52535
  if (!this._fin) {
53057
- this._loop = false;
53058
- return error$1(
52536
+ const error = this.createError(
53059
52537
  RangeError,
53060
52538
  'FIN must be set',
53061
52539
  true,
53062
52540
  1002,
53063
52541
  'WS_ERR_EXPECTED_FIN'
53064
52542
  );
52543
+
52544
+ cb(error);
52545
+ return;
53065
52546
  }
53066
52547
 
53067
52548
  if (compressed) {
53068
- this._loop = false;
53069
- return error$1(
52549
+ const error = this.createError(
53070
52550
  RangeError,
53071
52551
  'RSV1 must be clear',
53072
52552
  true,
53073
52553
  1002,
53074
52554
  'WS_ERR_UNEXPECTED_RSV_1'
53075
52555
  );
52556
+
52557
+ cb(error);
52558
+ return;
53076
52559
  }
53077
52560
 
53078
52561
  if (
53079
52562
  this._payloadLength > 0x7d ||
53080
52563
  (this._opcode === 0x08 && this._payloadLength === 1)
53081
52564
  ) {
53082
- this._loop = false;
53083
- return error$1(
52565
+ const error = this.createError(
53084
52566
  RangeError,
53085
52567
  `invalid payload length ${this._payloadLength}`,
53086
52568
  true,
53087
52569
  1002,
53088
52570
  'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
53089
52571
  );
52572
+
52573
+ cb(error);
52574
+ return;
53090
52575
  }
53091
52576
  } else {
53092
- this._loop = false;
53093
- return error$1(
52577
+ const error = this.createError(
53094
52578
  RangeError,
53095
52579
  `invalid opcode ${this._opcode}`,
53096
52580
  true,
53097
52581
  1002,
53098
52582
  'WS_ERR_INVALID_OPCODE'
53099
52583
  );
52584
+
52585
+ cb(error);
52586
+ return;
53100
52587
  }
53101
52588
 
53102
52589
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
@@ -53104,54 +52591,58 @@ let Receiver$1 = class Receiver extends Writable$1 {
53104
52591
 
53105
52592
  if (this._isServer) {
53106
52593
  if (!this._masked) {
53107
- this._loop = false;
53108
- return error$1(
52594
+ const error = this.createError(
53109
52595
  RangeError,
53110
52596
  'MASK must be set',
53111
52597
  true,
53112
52598
  1002,
53113
52599
  'WS_ERR_EXPECTED_MASK'
53114
52600
  );
52601
+
52602
+ cb(error);
52603
+ return;
53115
52604
  }
53116
52605
  } else if (this._masked) {
53117
- this._loop = false;
53118
- return error$1(
52606
+ const error = this.createError(
53119
52607
  RangeError,
53120
52608
  'MASK must be clear',
53121
52609
  true,
53122
52610
  1002,
53123
52611
  'WS_ERR_UNEXPECTED_MASK'
53124
52612
  );
52613
+
52614
+ cb(error);
52615
+ return;
53125
52616
  }
53126
52617
 
53127
52618
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
53128
52619
  else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
53129
- else return this.haveLength();
52620
+ else this.haveLength(cb);
53130
52621
  }
53131
52622
 
53132
52623
  /**
53133
52624
  * Gets extended payload length (7+16).
53134
52625
  *
53135
- * @return {(RangeError|undefined)} A possible error
52626
+ * @param {Function} cb Callback
53136
52627
  * @private
53137
52628
  */
53138
- getPayloadLength16() {
52629
+ getPayloadLength16(cb) {
53139
52630
  if (this._bufferedBytes < 2) {
53140
52631
  this._loop = false;
53141
52632
  return;
53142
52633
  }
53143
52634
 
53144
52635
  this._payloadLength = this.consume(2).readUInt16BE(0);
53145
- return this.haveLength();
52636
+ this.haveLength(cb);
53146
52637
  }
53147
52638
 
53148
52639
  /**
53149
52640
  * Gets extended payload length (7+64).
53150
52641
  *
53151
- * @return {(RangeError|undefined)} A possible error
52642
+ * @param {Function} cb Callback
53152
52643
  * @private
53153
52644
  */
53154
- getPayloadLength64() {
52645
+ getPayloadLength64(cb) {
53155
52646
  if (this._bufferedBytes < 8) {
53156
52647
  this._loop = false;
53157
52648
  return;
@@ -53165,38 +52656,42 @@ let Receiver$1 = class Receiver extends Writable$1 {
53165
52656
  // if payload length is greater than this number.
53166
52657
  //
53167
52658
  if (num > Math.pow(2, 53 - 32) - 1) {
53168
- this._loop = false;
53169
- return error$1(
52659
+ const error = this.createError(
53170
52660
  RangeError,
53171
52661
  'Unsupported WebSocket frame: payload length > 2^53 - 1',
53172
52662
  false,
53173
52663
  1009,
53174
52664
  'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'
53175
52665
  );
52666
+
52667
+ cb(error);
52668
+ return;
53176
52669
  }
53177
52670
 
53178
52671
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
53179
- return this.haveLength();
52672
+ this.haveLength(cb);
53180
52673
  }
53181
52674
 
53182
52675
  /**
53183
52676
  * Payload length has been read.
53184
52677
  *
53185
- * @return {(RangeError|undefined)} A possible error
52678
+ * @param {Function} cb Callback
53186
52679
  * @private
53187
52680
  */
53188
- haveLength() {
52681
+ haveLength(cb) {
53189
52682
  if (this._payloadLength && this._opcode < 0x08) {
53190
52683
  this._totalPayloadLength += this._payloadLength;
53191
52684
  if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
53192
- this._loop = false;
53193
- return error$1(
52685
+ const error = this.createError(
53194
52686
  RangeError,
53195
52687
  'Max payload size exceeded',
53196
52688
  false,
53197
52689
  1009,
53198
52690
  'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
53199
52691
  );
52692
+
52693
+ cb(error);
52694
+ return;
53200
52695
  }
53201
52696
  }
53202
52697
 
@@ -53223,7 +52718,6 @@ let Receiver$1 = class Receiver extends Writable$1 {
53223
52718
  * Reads data bytes.
53224
52719
  *
53225
52720
  * @param {Function} cb Callback
53226
- * @return {(Error|RangeError|undefined)} A possible error
53227
52721
  * @private
53228
52722
  */
53229
52723
  getData(cb) {
@@ -53245,7 +52739,10 @@ let Receiver$1 = class Receiver extends Writable$1 {
53245
52739
  }
53246
52740
  }
53247
52741
 
53248
- if (this._opcode > 0x07) return this.controlMessage(data);
52742
+ if (this._opcode > 0x07) {
52743
+ this.controlMessage(data, cb);
52744
+ return;
52745
+ }
53249
52746
 
53250
52747
  if (this._compressed) {
53251
52748
  this._state = INFLATING;
@@ -53262,7 +52759,7 @@ let Receiver$1 = class Receiver extends Writable$1 {
53262
52759
  this._fragments.push(data);
53263
52760
  }
53264
52761
 
53265
- return this.dataMessage();
52762
+ this.dataMessage(cb);
53266
52763
  }
53267
52764
 
53268
52765
  /**
@@ -53281,76 +52778,101 @@ let Receiver$1 = class Receiver extends Writable$1 {
53281
52778
  if (buf.length) {
53282
52779
  this._messageLength += buf.length;
53283
52780
  if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
53284
- return cb(
53285
- error$1(
53286
- RangeError,
53287
- 'Max payload size exceeded',
53288
- false,
53289
- 1009,
53290
- 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
53291
- )
52781
+ const error = this.createError(
52782
+ RangeError,
52783
+ 'Max payload size exceeded',
52784
+ false,
52785
+ 1009,
52786
+ 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
53292
52787
  );
52788
+
52789
+ cb(error);
52790
+ return;
53293
52791
  }
53294
52792
 
53295
52793
  this._fragments.push(buf);
53296
52794
  }
53297
52795
 
53298
- const er = this.dataMessage();
53299
- if (er) return cb(er);
53300
-
53301
- this.startLoop(cb);
52796
+ this.dataMessage(cb);
52797
+ if (this._state === GET_INFO) this.startLoop(cb);
53302
52798
  });
53303
52799
  }
53304
52800
 
53305
52801
  /**
53306
52802
  * Handles a data message.
53307
52803
  *
53308
- * @return {(Error|undefined)} A possible error
52804
+ * @param {Function} cb Callback
53309
52805
  * @private
53310
52806
  */
53311
- dataMessage() {
53312
- if (this._fin) {
53313
- const messageLength = this._messageLength;
53314
- const fragments = this._fragments;
53315
-
53316
- this._totalPayloadLength = 0;
53317
- this._messageLength = 0;
53318
- this._fragmented = 0;
53319
- this._fragments = [];
53320
-
53321
- if (this._opcode === 2) {
53322
- let data;
53323
-
53324
- if (this._binaryType === 'nodebuffer') {
53325
- data = concat(fragments, messageLength);
53326
- } else if (this._binaryType === 'arraybuffer') {
53327
- data = toArrayBuffer(concat(fragments, messageLength));
53328
- } else {
53329
- data = fragments;
53330
- }
52807
+ dataMessage(cb) {
52808
+ if (!this._fin) {
52809
+ this._state = GET_INFO;
52810
+ return;
52811
+ }
53331
52812
 
52813
+ const messageLength = this._messageLength;
52814
+ const fragments = this._fragments;
52815
+
52816
+ this._totalPayloadLength = 0;
52817
+ this._messageLength = 0;
52818
+ this._fragmented = 0;
52819
+ this._fragments = [];
52820
+
52821
+ if (this._opcode === 2) {
52822
+ let data;
52823
+
52824
+ if (this._binaryType === 'nodebuffer') {
52825
+ data = concat(fragments, messageLength);
52826
+ } else if (this._binaryType === 'arraybuffer') {
52827
+ data = toArrayBuffer(concat(fragments, messageLength));
52828
+ } else {
52829
+ data = fragments;
52830
+ }
52831
+
52832
+ //
52833
+ // If the state is `INFLATING`, it means that the frame data was
52834
+ // decompressed asynchronously, so there is no need to defer the event
52835
+ // as it will be emitted asynchronously anyway.
52836
+ //
52837
+ if (this._state === INFLATING || this._allowSynchronousEvents) {
53332
52838
  this.emit('message', data, true);
52839
+ this._state = GET_INFO;
53333
52840
  } else {
53334
- const buf = concat(fragments, messageLength);
52841
+ this._state = DEFER_EVENT;
52842
+ queueTask(() => {
52843
+ this.emit('message', data, true);
52844
+ this._state = GET_INFO;
52845
+ this.startLoop(cb);
52846
+ });
52847
+ }
52848
+ } else {
52849
+ const buf = concat(fragments, messageLength);
53335
52850
 
53336
- if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
53337
- this._loop = false;
53338
- return error$1(
53339
- Error,
53340
- 'invalid UTF-8 sequence',
53341
- true,
53342
- 1007,
53343
- 'WS_ERR_INVALID_UTF8'
53344
- );
53345
- }
52851
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
52852
+ const error = this.createError(
52853
+ Error,
52854
+ 'invalid UTF-8 sequence',
52855
+ true,
52856
+ 1007,
52857
+ 'WS_ERR_INVALID_UTF8'
52858
+ );
53346
52859
 
52860
+ cb(error);
52861
+ return;
52862
+ }
52863
+
52864
+ if (this._state === INFLATING || this._allowSynchronousEvents) {
53347
52865
  this.emit('message', buf, false);
52866
+ this._state = GET_INFO;
52867
+ } else {
52868
+ this._state = DEFER_EVENT;
52869
+ queueTask(() => {
52870
+ this.emit('message', buf, false);
52871
+ this._state = GET_INFO;
52872
+ this.startLoop(cb);
52873
+ });
53348
52874
  }
53349
52875
  }
53350
-
53351
- this._state = this._allowMultipleEventsPerMicrotask
53352
- ? GET_INFO
53353
- : WAIT_MICROTASK;
53354
52876
  }
53355
52877
 
53356
52878
  /**
@@ -53360,24 +52882,26 @@ let Receiver$1 = class Receiver extends Writable$1 {
53360
52882
  * @return {(Error|RangeError|undefined)} A possible error
53361
52883
  * @private
53362
52884
  */
53363
- controlMessage(data) {
52885
+ controlMessage(data, cb) {
53364
52886
  if (this._opcode === 0x08) {
53365
- this._loop = false;
53366
-
53367
52887
  if (data.length === 0) {
52888
+ this._loop = false;
53368
52889
  this.emit('conclude', 1005, EMPTY_BUFFER$2);
53369
52890
  this.end();
53370
52891
  } else {
53371
52892
  const code = data.readUInt16BE(0);
53372
52893
 
53373
52894
  if (!isValidStatusCode$1(code)) {
53374
- return error$1(
52895
+ const error = this.createError(
53375
52896
  RangeError,
53376
52897
  `invalid status code ${code}`,
53377
52898
  true,
53378
52899
  1002,
53379
52900
  'WS_ERR_INVALID_CLOSE_CODE'
53380
52901
  );
52902
+
52903
+ cb(error);
52904
+ return;
53381
52905
  }
53382
52906
 
53383
52907
  const buf = new FastBuffer(
@@ -53387,15 +52911,19 @@ let Receiver$1 = class Receiver extends Writable$1 {
53387
52911
  );
53388
52912
 
53389
52913
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
53390
- return error$1(
52914
+ const error = this.createError(
53391
52915
  Error,
53392
52916
  'invalid UTF-8 sequence',
53393
52917
  true,
53394
52918
  1007,
53395
52919
  'WS_ERR_INVALID_UTF8'
53396
52920
  );
52921
+
52922
+ cb(error);
52923
+ return;
53397
52924
  }
53398
52925
 
52926
+ this._loop = false;
53399
52927
  this.emit('conclude', code, buf);
53400
52928
  this.end();
53401
52929
  }
@@ -53404,37 +52932,47 @@ let Receiver$1 = class Receiver extends Writable$1 {
53404
52932
  return;
53405
52933
  }
53406
52934
 
53407
- this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
53408
- this._state = this._allowMultipleEventsPerMicrotask
53409
- ? GET_INFO
53410
- : WAIT_MICROTASK;
52935
+ if (this._allowSynchronousEvents) {
52936
+ this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
52937
+ this._state = GET_INFO;
52938
+ } else {
52939
+ this._state = DEFER_EVENT;
52940
+ queueTask(() => {
52941
+ this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
52942
+ this._state = GET_INFO;
52943
+ this.startLoop(cb);
52944
+ });
52945
+ }
53411
52946
  }
53412
- };
53413
52947
 
53414
- var receiver = Receiver$1;
52948
+ /**
52949
+ * Builds an error object.
52950
+ *
52951
+ * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
52952
+ * @param {String} message The error message
52953
+ * @param {Boolean} prefix Specifies whether or not to add a default prefix to
52954
+ * `message`
52955
+ * @param {Number} statusCode The status code
52956
+ * @param {String} errorCode The exposed error code
52957
+ * @return {(Error|RangeError)} The error
52958
+ * @private
52959
+ */
52960
+ createError(ErrorCtor, message, prefix, statusCode, errorCode) {
52961
+ this._loop = false;
52962
+ this._errored = true;
53415
52963
 
53416
- /**
53417
- * Builds an error object.
53418
- *
53419
- * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
53420
- * @param {String} message The error message
53421
- * @param {Boolean} prefix Specifies whether or not to add a default prefix to
53422
- * `message`
53423
- * @param {Number} statusCode The status code
53424
- * @param {String} errorCode The exposed error code
53425
- * @return {(Error|RangeError)} The error
53426
- * @private
53427
- */
53428
- function error$1(ErrorCtor, message, prefix, statusCode, errorCode) {
53429
- const err = new ErrorCtor(
53430
- prefix ? `Invalid WebSocket frame: ${message}` : message
53431
- );
52964
+ const err = new ErrorCtor(
52965
+ prefix ? `Invalid WebSocket frame: ${message}` : message
52966
+ );
53432
52967
 
53433
- Error.captureStackTrace(err, error$1);
53434
- err.code = errorCode;
53435
- err[kStatusCode$1] = statusCode;
53436
- return err;
53437
- }
52968
+ Error.captureStackTrace(err, this.createError);
52969
+ err.code = errorCode;
52970
+ err[kStatusCode$1] = statusCode;
52971
+ return err;
52972
+ }
52973
+ };
52974
+
52975
+ var receiver = Receiver$1;
53438
52976
 
53439
52977
  /**
53440
52978
  * A shim for `queueMicrotask()`.
@@ -54515,6 +54053,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54515
54053
 
54516
54054
  initAsClient(this, address, protocols, options);
54517
54055
  } else {
54056
+ this._autoPong = options.autoPong;
54518
54057
  this._isServer = true;
54519
54058
  }
54520
54059
  }
@@ -54623,9 +54162,9 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54623
54162
  * @param {Duplex} socket The network socket between the server and client
54624
54163
  * @param {Buffer} head The first packet of the upgraded stream
54625
54164
  * @param {Object} options Options object
54626
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
54627
- * whether or not to process more than one of the `'message'`, `'ping'`,
54628
- * and `'pong'` events per microtask
54165
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
54166
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
54167
+ * multiple times in the same tick
54629
54168
  * @param {Function} [options.generateMask] The function used to generate the
54630
54169
  * masking key
54631
54170
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
@@ -54635,7 +54174,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54635
54174
  */
54636
54175
  setSocket(socket, head, options) {
54637
54176
  const receiver = new Receiver({
54638
- allowMultipleEventsPerMicrotask: options.allowMultipleEventsPerMicrotask,
54177
+ allowSynchronousEvents: options.allowSynchronousEvents,
54639
54178
  binaryType: this.binaryType,
54640
54179
  extensions: this._extensions,
54641
54180
  isServer: this._isServer,
@@ -55053,9 +54592,11 @@ var websocket = WebSocket$1;
55053
54592
  * @param {(String|URL)} address The URL to which to connect
55054
54593
  * @param {Array} protocols The subprotocols
55055
54594
  * @param {Object} [options] Connection options
55056
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
55057
- * whether or not to process more than one of the `'message'`, `'ping'`,
55058
- * and `'pong'` events per microtask
54595
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether any
54596
+ * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple
54597
+ * times in the same tick
54598
+ * @param {Boolean} [options.autoPong=true] Specifies whether or not to
54599
+ * automatically send a pong in response to a ping
55059
54600
  * @param {Function} [options.finishRequest] A function which can be used to
55060
54601
  * customize the headers of each http request before it is sent
55061
54602
  * @param {Boolean} [options.followRedirects=false] Whether or not to follow
@@ -55080,7 +54621,8 @@ var websocket = WebSocket$1;
55080
54621
  */
55081
54622
  function initAsClient(websocket, address, protocols, options) {
55082
54623
  const opts = {
55083
- allowMultipleEventsPerMicrotask: false,
54624
+ allowSynchronousEvents: false,
54625
+ autoPong: true,
55084
54626
  protocolVersion: protocolVersions[1],
55085
54627
  maxPayload: 100 * 1024 * 1024,
55086
54628
  skipUTF8Validation: false,
@@ -55099,6 +54641,8 @@ function initAsClient(websocket, address, protocols, options) {
55099
54641
  port: undefined
55100
54642
  };
55101
54643
 
54644
+ websocket._autoPong = opts.autoPong;
54645
+
55102
54646
  if (!protocolVersions.includes(opts.protocolVersion)) {
55103
54647
  throw new RangeError(
55104
54648
  `Unsupported protocol version: ${opts.protocolVersion} ` +
@@ -55432,7 +54976,7 @@ function initAsClient(websocket, address, protocols, options) {
55432
54976
  }
55433
54977
 
55434
54978
  websocket.setSocket(socket, head, {
55435
- allowMultipleEventsPerMicrotask: opts.allowMultipleEventsPerMicrotask,
54979
+ allowSynchronousEvents: opts.allowSynchronousEvents,
55436
54980
  generateMask: opts.generateMask,
55437
54981
  maxPayload: opts.maxPayload,
55438
54982
  skipUTF8Validation: opts.skipUTF8Validation
@@ -55643,7 +55187,7 @@ function receiverOnMessage(data, isBinary) {
55643
55187
  function receiverOnPing(data) {
55644
55188
  const websocket = this[kWebSocket$1];
55645
55189
 
55646
- websocket.pong(data, !websocket._isServer, NOOP);
55190
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
55647
55191
  websocket.emit('ping', data);
55648
55192
  }
55649
55193
 
@@ -55849,9 +55393,11 @@ class WebSocketServer extends EventEmitter {
55849
55393
  * Create a `WebSocketServer` instance.
55850
55394
  *
55851
55395
  * @param {Object} options Configuration options
55852
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
55853
- * whether or not to process more than one of the `'message'`, `'ping'`,
55854
- * and `'pong'` events per microtask
55396
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
55397
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
55398
+ * multiple times in the same tick
55399
+ * @param {Boolean} [options.autoPong=true] Specifies whether or not to
55400
+ * automatically send a pong in response to a ping
55855
55401
  * @param {Number} [options.backlog=511] The maximum length of the queue of
55856
55402
  * pending connections
55857
55403
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
@@ -55878,7 +55424,8 @@ class WebSocketServer extends EventEmitter {
55878
55424
  super();
55879
55425
 
55880
55426
  options = {
55881
- allowMultipleEventsPerMicrotask: false,
55427
+ allowSynchronousEvents: false,
55428
+ autoPong: true,
55882
55429
  maxPayload: 100 * 1024 * 1024,
55883
55430
  skipUTF8Validation: false,
55884
55431
  perMessageDeflate: false,
@@ -56199,7 +55746,7 @@ class WebSocketServer extends EventEmitter {
56199
55746
  `Sec-WebSocket-Accept: ${digest}`
56200
55747
  ];
56201
55748
 
56202
- const ws = new this.options.WebSocket(null);
55749
+ const ws = new this.options.WebSocket(null, undefined, this.options);
56203
55750
 
56204
55751
  if (protocols.size) {
56205
55752
  //
@@ -56233,8 +55780,7 @@ class WebSocketServer extends EventEmitter {
56233
55780
  socket.removeListener('error', socketOnError);
56234
55781
 
56235
55782
  ws.setSocket(socket, head, {
56236
- allowMultipleEventsPerMicrotask:
56237
- this.options.allowMultipleEventsPerMicrotask,
55783
+ allowSynchronousEvents: this.options.allowSynchronousEvents,
56238
55784
  maxPayload: this.options.maxPayload,
56239
55785
  skipUTF8Validation: this.options.skipUTF8Validation
56240
55786
  });
@@ -58833,7 +58379,7 @@ const debug$5 = createDebugger('vite:send', {
58833
58379
  onlyWhenFocused: true,
58834
58380
  });
58835
58381
  const alias = {
58836
- js: 'application/javascript',
58382
+ js: 'text/javascript',
58837
58383
  css: 'text/css',
58838
58384
  html: 'text/html',
58839
58385
  json: 'application/json',
@@ -58890,8 +58436,7 @@ const knownIgnoreList = new Set(['/', '/favicon.ico']);
58890
58436
  function transformMiddleware(server) {
58891
58437
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
58892
58438
  // check if public dir is inside root dir
58893
- const { root } = server.config;
58894
- const publicDir = normalizePath$3(server.config.publicDir);
58439
+ const { root, publicDir } = server.config;
58895
58440
  const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
58896
58441
  const publicPath = `${publicDir.slice(root.length)}/`;
58897
58442
  return async function viteTransformMiddleware(req, res, next) {
@@ -59111,7 +58656,7 @@ function isBareRelative(url) {
59111
58656
  return wordCharRE.test(url[0]) && !url.includes(':');
59112
58657
  }
59113
58658
  const isSrcSet = (attr) => attr.name === 'srcset' && attr.prefix === undefined;
59114
- const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server) => {
58659
+ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
59115
58660
  // prefix with base (dev only, base is never relative)
59116
58661
  const replacer = (url) => {
59117
58662
  if (server?.moduleGraph) {
@@ -59135,7 +58680,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
59135
58680
  htmlPath === '/index.html')) {
59136
58681
  url = path$o.posix.join(config.base, url);
59137
58682
  }
59138
- if (server && shouldPreTransform(url, config)) {
58683
+ if (server && !isClassicScriptLink && shouldPreTransform(url, config)) {
59139
58684
  let preTransformUrl;
59140
58685
  if (url[0] === '/' && url[1] !== '/') {
59141
58686
  preTransformUrl = url;
@@ -59213,7 +58758,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
59213
58758
  if (node.nodeName === 'script') {
59214
58759
  const { src, sourceCodeLocation, isModule } = getScriptInfo(node);
59215
58760
  if (src) {
59216
- const processedUrl = processNodeUrl(src.value, isSrcSet(src), config, htmlPath, originalUrl, server);
58761
+ const processedUrl = processNodeUrl(src.value, isSrcSet(src), config, htmlPath, originalUrl, server, !isModule);
59217
58762
  if (processedUrl !== src.value) {
59218
58763
  overwriteAttrValue(s, sourceCodeLocation, processedUrl);
59219
58764
  }
@@ -59991,7 +59536,11 @@ async function _createServer(inlineConfig = {}, options) {
59991
59536
  const watcher = watchEnabled
59992
59537
  ? chokidar.watch(
59993
59538
  // config file dependencies and env file might be outside of root
59994
- [...new Set([root, ...config.configFileDependencies, config.envDir])], resolvedWatchOptions)
59539
+ [
59540
+ root,
59541
+ ...config.configFileDependencies,
59542
+ ...getEnvFilesForMode(config.mode, config.envDir),
59543
+ ], resolvedWatchOptions)
59995
59544
  : createNoopWatcher(resolvedWatchOptions);
59996
59545
  const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
59997
59546
  const container = await createPluginContainer(config, moduleGraph, watcher);
@@ -60031,9 +59580,6 @@ async function _createServer(inlineConfig = {}, options) {
60031
59580
  return devHtmlTransformFn(server, url, html, originalUrl);
60032
59581
  },
60033
59582
  async ssrLoadModule(url, opts) {
60034
- if (isDepsOptimizerEnabled(config, true)) {
60035
- await initDevSsrDepsOptimizer(config, server);
60036
- }
60037
59583
  return ssrLoadModule(url, server, undefined, undefined, opts?.fixStacktrace);
60038
59584
  },
60039
59585
  ssrFixStacktrace(e) {
@@ -60155,6 +59701,16 @@ async function _createServer(inlineConfig = {}, options) {
60155
59701
  _fsDenyGlob: picomatch$4(config.server.fs.deny, { matchBase: true }),
60156
59702
  _shortcutsOptions: undefined,
60157
59703
  };
59704
+ // maintain consistency with the server instance after restarting.
59705
+ const reflexServer = new Proxy(server, {
59706
+ get: (_, property) => {
59707
+ return server[property];
59708
+ },
59709
+ set: (_, property, value) => {
59710
+ server[property] = value;
59711
+ return true;
59712
+ },
59713
+ });
60158
59714
  if (!middlewareMode) {
60159
59715
  exitProcess = async () => {
60160
59716
  try {
@@ -60183,13 +59739,13 @@ async function _createServer(inlineConfig = {}, options) {
60183
59739
  }
60184
59740
  }
60185
59741
  };
60186
- const normalizedPublicDir = normalizePath$3(config.publicDir);
59742
+ const { publicDir } = config;
60187
59743
  const onFileAddUnlink = async (file, isUnlink) => {
60188
59744
  file = normalizePath$3(file);
60189
59745
  await container.watchChange(file, { event: isUnlink ? 'delete' : 'create' });
60190
- if (config.publicDir && publicFiles) {
60191
- if (file.startsWith(normalizedPublicDir)) {
60192
- publicFiles[isUnlink ? 'delete' : 'add'](file.slice(normalizedPublicDir.length));
59746
+ if (publicDir && publicFiles) {
59747
+ if (file.startsWith(publicDir)) {
59748
+ publicFiles[isUnlink ? 'delete' : 'add'](file.slice(publicDir.length));
60193
59749
  }
60194
59750
  }
60195
59751
  await handleFileAddUnlink(file, server, isUnlink);
@@ -60228,7 +59784,7 @@ async function _createServer(inlineConfig = {}, options) {
60228
59784
  // apply server configuration hooks from plugins
60229
59785
  const postHooks = [];
60230
59786
  for (const hook of config.getSortedPluginHooks('configureServer')) {
60231
- postHooks.push(await hook(server));
59787
+ postHooks.push(await hook(reflexServer));
60232
59788
  }
60233
59789
  // Internal middlewares ------------------------------------------------------
60234
59790
  // request timer
@@ -60267,7 +59823,7 @@ async function _createServer(inlineConfig = {}, options) {
60267
59823
  // serve static files under /public
60268
59824
  // this applies before the transform middleware so that these files are served
60269
59825
  // as-is without transforms.
60270
- if (config.publicDir) {
59826
+ if (publicDir) {
60271
59827
  middlewares.use(servePublicMiddleware(server, publicFiles));
60272
59828
  }
60273
59829
  // main transform middleware
@@ -60521,11 +60077,10 @@ function getShortName(file, root) {
60521
60077
  async function handleHMRUpdate(file, server, configOnly) {
60522
60078
  const { ws, config, moduleGraph } = server;
60523
60079
  const shortFile = getShortName(file, config.root);
60524
- const fileName = path$o.basename(file);
60525
60080
  const isConfig = file === config.configFile;
60526
60081
  const isConfigDependency = config.configFileDependencies.some((name) => file === name);
60527
60082
  const isEnv = config.inlineConfig.envFile !== false &&
60528
- getEnvFilesForMode(config.mode).includes(fileName);
60083
+ getEnvFilesForMode(config.mode, config.envDir).includes(file);
60529
60084
  if (isConfig || isConfigDependency || isEnv) {
60530
60085
  // auto restart server
60531
60086
  debugHmr?.(`[config change] ${colors$1.dim(shortFile)}`);
@@ -60604,14 +60159,15 @@ function updateModules(file, modules, timestamp, { config, ws, moduleGraph }, af
60604
60159
  needFullReload = hasDeadEnd;
60605
60160
  continue;
60606
60161
  }
60607
- updates.push(...boundaries.map(({ boundary, acceptedVia }) => ({
60162
+ updates.push(...boundaries.map(({ boundary, acceptedVia, isWithinCircularImport }) => ({
60608
60163
  type: `${boundary.type}-update`,
60609
60164
  timestamp,
60610
60165
  path: normalizeHmrUrl(boundary.url),
60166
+ acceptedPath: normalizeHmrUrl(acceptedVia.url),
60611
60167
  explicitImportRequired: boundary.type === 'js'
60612
60168
  ? isExplicitImportRequired(acceptedVia.url)
60613
- : undefined,
60614
- acceptedPath: normalizeHmrUrl(acceptedVia.url),
60169
+ : false,
60170
+ isWithinCircularImport,
60615
60171
  })));
60616
60172
  }
60617
60173
  if (needFullReload) {
@@ -60670,10 +60226,11 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
60670
60226
  return false;
60671
60227
  }
60672
60228
  if (node.isSelfAccepting) {
60673
- boundaries.push({ boundary: node, acceptedVia: node });
60674
- const result = isNodeWithinCircularImports(node, currentChain);
60675
- if (result)
60676
- return result;
60229
+ boundaries.push({
60230
+ boundary: node,
60231
+ acceptedVia: node,
60232
+ isWithinCircularImport: isNodeWithinCircularImports(node, currentChain),
60233
+ });
60677
60234
  // additionally check for CSS importers, since a PostCSS plugin like
60678
60235
  // Tailwind JIT may register any file as a dependency to a CSS file.
60679
60236
  for (const importer of node.importers) {
@@ -60689,10 +60246,11 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
60689
60246
  // Also, the imported module (this one) must be updated before the importers,
60690
60247
  // so that they do get the fresh imported module when/if they are reloaded.
60691
60248
  if (node.acceptedHmrExports) {
60692
- boundaries.push({ boundary: node, acceptedVia: node });
60693
- const result = isNodeWithinCircularImports(node, currentChain);
60694
- if (result)
60695
- return result;
60249
+ boundaries.push({
60250
+ boundary: node,
60251
+ acceptedVia: node,
60252
+ isWithinCircularImport: isNodeWithinCircularImports(node, currentChain),
60253
+ });
60696
60254
  }
60697
60255
  else {
60698
60256
  if (!node.importers.size) {
@@ -60709,10 +60267,11 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
60709
60267
  for (const importer of node.importers) {
60710
60268
  const subChain = currentChain.concat(importer);
60711
60269
  if (importer.acceptedHmrDeps.has(node)) {
60712
- boundaries.push({ boundary: importer, acceptedVia: node });
60713
- const result = isNodeWithinCircularImports(importer, subChain);
60714
- if (result)
60715
- return result;
60270
+ boundaries.push({
60271
+ boundary: importer,
60272
+ acceptedVia: node,
60273
+ isWithinCircularImport: isNodeWithinCircularImports(importer, subChain),
60274
+ });
60716
60275
  continue;
60717
60276
  }
60718
60277
  if (node.id && node.acceptedHmrExports && importer.importedBindings) {
@@ -60786,7 +60345,7 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node], tra
60786
60345
  debugHmr(colors$1.yellow(`circular imports detected: `) +
60787
60346
  importChain.map((m) => colors$1.dim(m.url)).join(' -> '));
60788
60347
  }
60789
- return 'circular imports';
60348
+ return true;
60790
60349
  }
60791
60350
  // Continue recursively
60792
60351
  if (!currentChain.includes(importer)) {
@@ -60957,20 +60516,13 @@ async function readModifiedFile(file) {
60957
60516
  const content = await fsp.readFile(file, 'utf-8');
60958
60517
  if (!content) {
60959
60518
  const mtime = (await fsp.stat(file)).mtimeMs;
60960
- await new Promise((r) => {
60961
- let n = 0;
60962
- const poll = async () => {
60963
- n++;
60964
- const newMtime = (await fsp.stat(file)).mtimeMs;
60965
- if (newMtime !== mtime || n > 10) {
60966
- r(0);
60967
- }
60968
- else {
60969
- setTimeout(poll, 10);
60970
- }
60971
- };
60972
- setTimeout(poll, 10);
60973
- });
60519
+ for (let n = 0; n < 10; n++) {
60520
+ await new Promise((r) => setTimeout(r, 10));
60521
+ const newMtime = (await fsp.stat(file)).mtimeMs;
60522
+ if (newMtime !== mtime) {
60523
+ break;
60524
+ }
60525
+ }
60974
60526
  return await fsp.readFile(file, 'utf-8');
60975
60527
  }
60976
60528
  else {
@@ -61382,7 +60934,7 @@ function webWorkerPlugin(config) {
61382
60934
  return worker;
61383
60935
  } catch(e) {
61384
60936
  return new ${workerConstructor}(
61385
- "data:application/javascript;base64," + encodedJs,
60937
+ "data:text/javascript;base64," + encodedJs,
61386
60938
  ${workerTypeOption}
61387
60939
  );
61388
60940
  }${
@@ -61397,7 +60949,7 @@ function webWorkerPlugin(config) {
61397
60949
  : `${encodedJs}
61398
60950
  export default function WorkerWrapper(options) {
61399
60951
  return new ${workerConstructor}(
61400
- "data:application/javascript;base64," + encodedJs,
60952
+ "data:text/javascript;base64," + encodedJs,
61401
60953
  ${workerTypeOption}
61402
60954
  );
61403
60955
  }
@@ -62579,7 +62131,7 @@ function workerImportMetaUrlPlugin(config) {
62579
62131
  * ```
62580
62132
  */
62581
62133
  function assetImportMetaUrlPlugin(config) {
62582
- const normalizedPublicDir = normalizePath$3(config.publicDir);
62134
+ const { publicDir } = config;
62583
62135
  let assetResolver;
62584
62136
  const fsResolveOptions = {
62585
62137
  ...config.resolve,
@@ -62652,7 +62204,7 @@ function assetImportMetaUrlPlugin(config) {
62652
62204
  file = await assetResolver(url, id);
62653
62205
  file ??=
62654
62206
  url[0] === '/'
62655
- ? slash$1(path$o.join(config.publicDir, url))
62207
+ ? slash$1(path$o.join(publicDir, url))
62656
62208
  : slash$1(path$o.resolve(path$o.dirname(id), url));
62657
62209
  }
62658
62210
  // Get final asset URL. If the file does not exist,
@@ -62660,8 +62212,8 @@ function assetImportMetaUrlPlugin(config) {
62660
62212
  let builtUrl;
62661
62213
  if (file) {
62662
62214
  try {
62663
- if (isParentDirectory(normalizedPublicDir, file)) {
62664
- const publicPath = '/' + path$o.posix.relative(normalizedPublicDir, file);
62215
+ if (isParentDirectory(publicDir, file)) {
62216
+ const publicPath = '/' + path$o.posix.relative(publicDir, file);
62665
62217
  builtUrl = await fileToUrl$1(publicPath, config, this);
62666
62218
  }
62667
62219
  else {
@@ -62919,10 +62471,10 @@ function parseDynamicImportPattern(strings) {
62919
62471
  // ? is escaped on posix OS
62920
62472
  requestQueryMaybeEscapedSplitRE, 2);
62921
62473
  const [rawPattern] = filename.split(requestQuerySplitRE, 2);
62922
- const as = ['worker', 'url', 'raw'].find((key) => rawQuery && key in rawQuery);
62923
- if (as) {
62474
+ const globQuery = ['worker', 'url', 'raw'].find((key) => rawQuery && key in rawQuery);
62475
+ if (globQuery) {
62924
62476
  globParams = {
62925
- as,
62477
+ query: globQuery,
62926
62478
  import: '*',
62927
62479
  };
62928
62480
  }
@@ -63552,7 +63104,21 @@ async function createPluginContainer(config, moduleGraph, watcher) {
63552
63104
  break;
63553
63105
  }
63554
63106
  if (!combinedMap) {
63555
- combinedMap = m;
63107
+ const sm = m;
63108
+ // sourcemap should not include `sources: [null]` (because `sources` should be string) nor
63109
+ // `sources: ['']` (because `''` means the path of sourcemap)
63110
+ // but MagicString generates this when `filename` option is not set.
63111
+ // Rollup supports these and therefore we support this as well
63112
+ if (sm.sources.length === 1 && !sm.sources[0]) {
63113
+ combinedMap = {
63114
+ ...sm,
63115
+ sources: [this.filename],
63116
+ sourcesContent: [this.originalCode],
63117
+ };
63118
+ }
63119
+ else {
63120
+ combinedMap = sm;
63121
+ }
63556
63122
  }
63557
63123
  else {
63558
63124
  combinedMap = combineSourcemaps(cleanUrl(this.filename), [
@@ -64244,8 +63810,8 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
64244
63810
  function extractImportPaths(code) {
64245
63811
  // empty singleline & multiline comments to avoid matching comments
64246
63812
  code = code
64247
- .replace(multilineCommentsRE$1, '/* */')
64248
- .replace(singlelineCommentsRE$1, '');
63813
+ .replace(multilineCommentsRE, '/* */')
63814
+ .replace(singlelineCommentsRE, '');
64249
63815
  let js = '';
64250
63816
  let m;
64251
63817
  importsRE.lastIndex = 0;
@@ -65107,7 +64673,7 @@ async function loadCachedDepOptimizationMetadata(config, ssr, force = config.opt
65107
64673
  if (!force) {
65108
64674
  let cachedMetadata;
65109
64675
  try {
65110
- const cachedMetadataPath = path$o.join(depsCacheDir, '_metadata.json');
64676
+ const cachedMetadataPath = path$o.join(depsCacheDir, METADATA_FILENAME);
65111
64677
  cachedMetadata = parseDepsOptimizerMetadata(await fsp.readFile(cachedMetadataPath, 'utf-8'), depsCacheDir);
65112
64678
  }
65113
64679
  catch (e) { }
@@ -65225,8 +64791,8 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
65225
64791
  committed = true;
65226
64792
  // Write metadata file, then commit the processing folder to the global deps cache
65227
64793
  // Rewire the file paths from the temporary processing dir to the final deps cache dir
65228
- const dataPath = path$o.join(processingCacheDir, '_metadata.json');
65229
- debug$1?.(colors$1.green(`creating _metadata.json in ${processingCacheDir}`));
64794
+ const dataPath = path$o.join(processingCacheDir, METADATA_FILENAME);
64795
+ debug$1?.(colors$1.green(`creating ${METADATA_FILENAME} in ${processingCacheDir}`));
65230
64796
  fs$l.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
65231
64797
  // In order to minimize the time where the deps folder isn't in a consistent state,
65232
64798
  // we first rename the old depsCacheDir to a temporary path, then we rename the
@@ -65734,10 +65300,10 @@ function getConfigHash(config, ssr) {
65734
65300
  plugins: config.plugins.map((p) => p.name),
65735
65301
  optimizeDeps: {
65736
65302
  include: optimizeDeps?.include
65737
- ? Array.from(new Set(optimizeDeps.include)).sort()
65303
+ ? unique(optimizeDeps.include).sort()
65738
65304
  : undefined,
65739
65305
  exclude: optimizeDeps?.exclude
65740
- ? Array.from(new Set(optimizeDeps.exclude)).sort()
65306
+ ? unique(optimizeDeps.exclude).sort()
65741
65307
  : undefined,
65742
65308
  esbuildOptions: {
65743
65309
  ...optimizeDeps?.esbuildOptions,
@@ -66337,13 +65903,21 @@ function buildImportAnalysisPlugin(config) {
66337
65903
  const fileDepsCode = `[${fileDeps
66338
65904
  .map((fileDep) => fileDep.runtime ? fileDep.url : JSON.stringify(fileDep.url))
66339
65905
  .join(',')}]`;
66340
- s.append(`\
65906
+ const mapDepsCode = `\
66341
65907
  function __vite__mapDeps(indexes) {
66342
65908
  if (!__vite__mapDeps.viteFileDeps) {
66343
65909
  __vite__mapDeps.viteFileDeps = ${fileDepsCode}
66344
65910
  }
66345
65911
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
66346
- }`);
65912
+ }\n`;
65913
+ // inject extra code before sourcemap comment
65914
+ const mapFileCommentMatch = convertSourceMap.mapFileCommentRegex.exec(code);
65915
+ if (mapFileCommentMatch) {
65916
+ s.appendRight(mapFileCommentMatch.index, mapDepsCode);
65917
+ }
65918
+ else {
65919
+ s.append(mapDepsCode);
65920
+ }
66347
65921
  // there may still be markers due to inlined dynamic imports, remove
66348
65922
  // all the markers regardless
66349
65923
  let markerStartPos = indexOfMatchInSlice(code, preloadMarkerWithQuote);
@@ -66465,7 +66039,7 @@ function ssrManifestPlugin(config) {
66465
66039
  ? config.build.ssrManifest
66466
66040
  : '.vite/ssr-manifest.json',
66467
66041
  type: 'asset',
66468
- source: jsonStableStringify$1(ssrManifest, { space: 2 }),
66042
+ source: JSON.stringify(sortObjectKeys(ssrManifest), undefined, 2),
66469
66043
  });
66470
66044
  },
66471
66045
  };
@@ -66531,7 +66105,7 @@ function resolveBuildOptions(raw, logger, root) {
66531
66105
  const defaultBuildOptions = {
66532
66106
  outDir: 'dist',
66533
66107
  assetsDir: 'assets',
66534
- assetsInlineLimit: 4096,
66108
+ assetsInlineLimit: DEFAULT_ASSETS_INLINE_LIMIT,
66535
66109
  cssCodeSplit: !raw?.lib,
66536
66110
  sourcemap: false,
66537
66111
  rollupOptions: {},
@@ -66619,9 +66193,7 @@ async function resolveBuildPlugins(config) {
66619
66193
  completeSystemWrapPlugin(),
66620
66194
  ...(usePluginCommonjs ? [commonjs(options.commonjsOptions)] : []),
66621
66195
  dataURIPlugin(),
66622
- ...(await asyncFlatten(Array.isArray(rollupOptionsPlugins)
66623
- ? rollupOptionsPlugins
66624
- : [rollupOptionsPlugins])).filter(Boolean),
66196
+ ...(await asyncFlatten(arraify(rollupOptionsPlugins))).filter(Boolean),
66625
66197
  ...(config.isWorker ? [webWorkerPostPlugin()] : []),
66626
66198
  ],
66627
66199
  post: [
@@ -67467,7 +67039,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
67467
67039
  const configEnv = {
67468
67040
  mode,
67469
67041
  command,
67470
- isSsrBuild: !!config.build?.ssr,
67042
+ isSsrBuild: command === 'build' && !!config.build?.ssr,
67471
67043
  isPreview,
67472
67044
  };
67473
67045
  let { configFile } = config;
@@ -67642,7 +67214,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
67642
67214
  };
67643
67215
  const { publicDir } = config;
67644
67216
  const resolvedPublicDir = publicDir !== false && publicDir !== ''
67645
- ? path$o.resolve(resolvedRoot, typeof publicDir === 'string' ? publicDir : 'public')
67217
+ ? normalizePath$3(path$o.resolve(resolvedRoot, typeof publicDir === 'string' ? publicDir : 'public'))
67646
67218
  : '';
67647
67219
  const server = resolveServerOptions(resolvedRoot, config.server, logger);
67648
67220
  const ssr = resolveSSROptions(config.ssr, resolveOptions.preserveSymlinks);
@@ -67679,9 +67251,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
67679
67251
  };
67680
67252
  const resolvedWorkerPlugins = await resolvePlugins(workerResolved, workerPrePlugins, workerNormalPlugins, workerPostPlugins);
67681
67253
  // run configResolved hooks
67682
- createPluginHookUtils(resolvedWorkerPlugins)
67254
+ await Promise.all(createPluginHookUtils(resolvedWorkerPlugins)
67683
67255
  .getSortedPluginHooks('configResolved')
67684
- .map((hook) => hook(workerResolved));
67256
+ .map((hook) => hook(workerResolved)));
67685
67257
  return resolvedWorkerPlugins;
67686
67258
  };
67687
67259
  const resolvedWorkerOptions = {
@@ -68070,4 +67642,4 @@ function isDepsOptimizerEnabled(config, ssr) {
68070
67642
  (command === 'serve' && disabled === 'dev'));
68071
67643
  }
68072
67644
 
68073
- export { index$1 as A, index as B, build$1 as C, preview$1 as D, preprocessCSS as a, build as b, createServer as c, defineConfig as d, buildErrorMessage as e, formatPostcssSourceMap as f, mergeAlias as g, createFilter as h, isInNodeModules$1 as i, send as j, createLogger as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, searchForWorkspaceRoot as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, isFileServingAllowed as u, loadEnv as v, resolveEnvPrefix as w, colors$1 as x, getDefaultExportFromCjs as y, commonjsGlobal as z };
67645
+ export { commonjsGlobal as A, index$1 as B, index as C, build$1 as D, preview$1 as E, arraify as a, build as b, createServer as c, defineConfig as d, preprocessCSS as e, formatPostcssSourceMap as f, buildErrorMessage as g, mergeAlias as h, isInNodeModules$1 as i, createFilter as j, send as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, createLogger as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, searchForWorkspaceRoot as u, isFileServingAllowed as v, loadEnv as w, resolveEnvPrefix as x, colors$1 as y, getDefaultExportFromCjs as z };