vite 5.0.11 → 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
@@ -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, (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)
@@ -38550,13 +37606,13 @@ function expand (config) {
38550
37606
 
38551
37607
  var expand_1 = expand;
38552
37608
 
38553
- function getEnvFilesForMode(mode) {
37609
+ function getEnvFilesForMode(mode, envDir) {
38554
37610
  return [
38555
37611
  /** default file */ `.env`,
38556
37612
  /** local file */ `.env.local`,
38557
37613
  /** mode file */ `.env.${mode}`,
38558
37614
  /** mode local file */ `.env.${mode}.local`,
38559
- ];
37615
+ ].map((file) => path$o.join(envDir, file));
38560
37616
  }
38561
37617
  function loadEnv(mode, envDir, prefixes = 'VITE_') {
38562
37618
  if (mode === 'local') {
@@ -38565,9 +37621,8 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
38565
37621
  }
38566
37622
  prefixes = arraify(prefixes);
38567
37623
  const env = {};
38568
- const envFiles = getEnvFilesForMode(mode);
38569
- const parsed = Object.fromEntries(envFiles.flatMap((file) => {
38570
- const filePath = path$o.join(envDir, file);
37624
+ const envFiles = getEnvFilesForMode(mode, envDir);
37625
+ const parsed = Object.fromEntries(envFiles.flatMap((filePath) => {
38571
37626
  if (!tryStatSync(filePath)?.isFile())
38572
37627
  return [];
38573
37628
  return Object.entries(parse_1$1(fs$l.readFileSync(filePath)));
@@ -38870,7 +37925,8 @@ function buildHtmlPlugin(config) {
38870
37925
  name: 'vite:build-html',
38871
37926
  async transform(html, id) {
38872
37927
  if (id.endsWith('.html')) {
38873
- 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);
38874
37930
  const publicPath = `/${relativeUrlPath}`;
38875
37931
  const publicBase = getBaseInHTML(relativeUrlPath, config);
38876
37932
  const publicToRelative = (filename, importer) => publicBase + filename;
@@ -39635,7 +38691,8 @@ const commonjsProxyRE = /\?commonjs-proxy/;
39635
38691
  const inlineRE = /[?&]inline\b/;
39636
38692
  const inlineCSSRE = /[?&]inline-css\b/;
39637
38693
  const styleAttrRE = /[?&]style-attr\b/;
39638
- const varRE = /^var\(/i;
38694
+ const functionCallRE = /^[A-Z_][\w-]*\(/i;
38695
+ const transformOnlyRE = /[?&]transform-only\b/;
39639
38696
  const nonEscapedDoubleQuoteRe = /(?<!\\)(")/g;
39640
38697
  const cssBundleName = 'style.css';
39641
38698
  const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
@@ -39648,10 +38705,12 @@ const postcssConfigCache = new WeakMap();
39648
38705
  function encodePublicUrlsInCSS(config) {
39649
38706
  return config.command === 'build';
39650
38707
  }
38708
+ const cssUrlAssetRE = /__VITE_CSS_URL__([\da-f]+)__/g;
39651
38709
  /**
39652
38710
  * Plugin applied before user plugins
39653
38711
  */
39654
38712
  function cssPlugin(config) {
38713
+ const isBuild = config.command === 'build';
39655
38714
  let server;
39656
38715
  let moduleCache;
39657
38716
  const resolveUrl = config.createResolver({
@@ -39674,6 +38733,22 @@ function cssPlugin(config) {
39674
38733
  cssModulesCache.set(config, moduleCache);
39675
38734
  removedPureCssFilesCache.set(config, new Map());
39676
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
+ },
39677
38752
  async transform(raw, id, options) {
39678
38753
  if (!isCSSRequest(id) ||
39679
38754
  commonjsProxyRE.test(id) ||
@@ -39761,8 +38836,9 @@ function cssPlugin(config) {
39761
38836
  function cssPostPlugin(config) {
39762
38837
  // styles initialization in buildStart causes a styling loss in watch
39763
38838
  const styles = new Map();
39764
- // list of css emit tasks to guarantee the files are emitted in a deterministic order
39765
- 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();
39766
38842
  let pureCssChunks;
39767
38843
  // when there are multiple rollup outputs and extracting CSS, only emit once,
39768
38844
  // since output formats have no effect on the generated CSS.
@@ -39795,7 +38871,7 @@ function cssPostPlugin(config) {
39795
38871
  pureCssChunks = new Set();
39796
38872
  hasEmitted = false;
39797
38873
  chunkCSSMap = new Map();
39798
- emitTasks = [];
38874
+ codeSplitEmitQueue = createSerialPromiseQueue();
39799
38875
  },
39800
38876
  async transform(css, id, options) {
39801
38877
  if (!isCSSRequest(id) ||
@@ -39892,10 +38968,13 @@ function cssPostPlugin(config) {
39892
38968
  const ids = Object.keys(chunk.modules);
39893
38969
  for (const id of ids) {
39894
38970
  if (styles.has(id)) {
39895
- chunkCSS += styles.get(id);
39896
- // a css module contains JS, so it makes this not a pure css chunk
39897
- if (cssModuleRE.test(id)) {
39898
- 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
+ }
39899
38978
  }
39900
38979
  }
39901
38980
  else {
@@ -39905,9 +38984,6 @@ function cssPostPlugin(config) {
39905
38984
  isPureCssChunk = false;
39906
38985
  }
39907
38986
  }
39908
- if (!chunkCSS) {
39909
- return null;
39910
- }
39911
38987
  const publicAssetUrlMap = publicAssetUrlCache.get(config);
39912
38988
  // resolve asset URL placeholders to their built file URLs
39913
38989
  const resolveAssetUrlsInCss = (chunkCSS, cssAssetName) => {
@@ -39940,6 +39016,57 @@ function cssPostPlugin(config) {
39940
39016
  function ensureFileExt(name, ext) {
39941
39017
  return normalizePath$3(path$o.format({ ...path$o.parse(name), base: undefined, ext }));
39942
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
+ }
39943
39070
  if (config.build.cssCodeSplit) {
39944
39071
  if (opts.format === 'es' || opts.format === 'cjs') {
39945
39072
  if (isPureCssChunk) {
@@ -39957,19 +39084,10 @@ function cssPostPlugin(config) {
39957
39084
  : cssFullAssetName;
39958
39085
  const originalFilename = getChunkOriginalFileName(chunk, config.root, opts.format);
39959
39086
  chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName);
39960
- const previousTask = emitTasks[emitTasks.length - 1];
39961
- // finalizeCss is async which makes `emitFile` non-deterministic, so
39962
- // we use a `.then` to wait for previous tasks before finishing this
39963
- const thisTask = finalizeCss(chunkCSS, true, config).then((css) => {
39964
- chunkCSS = css;
39965
- // make sure the previous task is also finished, this works recursively
39966
- return previousTask;
39087
+ // wait for previous tasks as well
39088
+ chunkCSS = await codeSplitEmitQueue.run(async () => {
39089
+ return finalizeCss(chunkCSS, true, config);
39967
39090
  });
39968
- // push this task so the next task can wait for this one
39969
- emitTasks.push(thisTask);
39970
- const emitTasksLength = emitTasks.length;
39971
- // wait for this and previous tasks to finish
39972
- await thisTask;
39973
39091
  // emit corresponding css file
39974
39092
  const referenceId = this.emitFile({
39975
39093
  name: cssAssetName,
@@ -39980,10 +39098,6 @@ function cssPostPlugin(config) {
39980
39098
  .get(config)
39981
39099
  .set(referenceId, { originalName: originalFilename, isEntry });
39982
39100
  chunk.viteMetadata.importedCss.add(this.getFileName(referenceId));
39983
- if (emitTasksLength === emitTasks.length) {
39984
- // this is the last task, clear `emitTasks` to free up memory
39985
- emitTasks = [];
39986
- }
39987
39101
  }
39988
39102
  else if (!config.build.ssr) {
39989
39103
  // legacy build and inline css
@@ -40010,25 +39124,27 @@ function cssPostPlugin(config) {
40010
39124
  const insertMark = "'use strict';";
40011
39125
  injectionPoint = code.indexOf(insertMark) + insertMark.length;
40012
39126
  }
40013
- const s = new MagicString(code);
39127
+ s ||= new MagicString(code);
40014
39128
  s.appendRight(injectionPoint, injectCode);
40015
- if (config.build.sourcemap) {
40016
- // resolve public URL from CSS paths, we need to use absolute paths
40017
- return {
40018
- code: s.toString(),
40019
- map: s.generateMap({ hires: 'boundary' }),
40020
- };
40021
- }
40022
- else {
40023
- return { code: s.toString() };
40024
- }
40025
39129
  }
40026
39130
  }
40027
39131
  else {
39132
+ // resolve public URL from CSS paths, we need to use absolute paths
40028
39133
  chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssBundleName);
40029
39134
  // finalizeCss is called for the aggregated chunk in generateBundle
40030
39135
  chunkCSSMap.set(chunk.fileName, chunkCSS);
40031
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
+ }
40032
39148
  return null;
40033
39149
  },
40034
39150
  augmentChunkHash(chunk) {
@@ -40433,8 +39549,8 @@ function createCachedImport(imp) {
40433
39549
  return cached;
40434
39550
  };
40435
39551
  }
40436
- const importPostcssImport = createCachedImport(() => import('./dep-ggdMrszO.js').then(function (n) { return n.i; }));
40437
- const importPostcssModules = createCachedImport(() => import('./dep-oIJQVJc7.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; }));
40438
39554
  const importPostcss = createCachedImport(() => import('postcss'));
40439
39555
  /**
40440
39556
  * @experimental
@@ -40607,7 +39723,7 @@ function skipUrlReplacer(rawUrl) {
40607
39723
  return (isExternalUrl(rawUrl) ||
40608
39724
  isDataUrl(rawUrl) ||
40609
39725
  rawUrl[0] === '#' ||
40610
- varRE.test(rawUrl));
39726
+ functionCallRE.test(rawUrl));
40611
39727
  }
40612
39728
  async function doUrlReplace(rawUrl, matched, replacer, funcName = 'url') {
40613
39729
  let wrap = '';
@@ -40804,7 +39920,7 @@ const scss = async (source, root, options, resolvers) => {
40804
39920
  importer = cleanScssBugUrl(importer);
40805
39921
  resolvers.sass(url, importer).then((resolved) => {
40806
39922
  if (resolved) {
40807
- rebaseUrls(resolved, options.filename, options.alias, '$')
39923
+ rebaseUrls(resolved, options.filename, options.alias, '$', resolvers.sass)
40808
39924
  .then((data) => done?.(fixScssBugImportValue(data)))
40809
39925
  .catch((data) => done?.(data));
40810
39926
  }
@@ -40872,7 +39988,7 @@ const sass = (source, root, options, aliasResolver) => scss(source, root, {
40872
39988
  * relative url() inside \@imported sass and less files must be rebased to use
40873
39989
  * root file as base.
40874
39990
  */
40875
- async function rebaseUrls(file, rootFile, alias, variablePrefix) {
39991
+ async function rebaseUrls(file, rootFile, alias, variablePrefix, resolver) {
40876
39992
  file = path$o.resolve(file); // ensure os-specific flashes
40877
39993
  // in the same dir, no need to rebase
40878
39994
  const fileDir = path$o.dirname(file);
@@ -40891,7 +40007,7 @@ async function rebaseUrls(file, rootFile, alias, variablePrefix) {
40891
40007
  return { file };
40892
40008
  }
40893
40009
  let rebased;
40894
- const rebaseFn = (url) => {
40010
+ const rebaseFn = async (url) => {
40895
40011
  if (url[0] === '/')
40896
40012
  return url;
40897
40013
  // ignore url's starting with variable
@@ -40904,7 +40020,7 @@ async function rebaseUrls(file, rootFile, alias, variablePrefix) {
40904
40020
  return url;
40905
40021
  }
40906
40022
  }
40907
- const absolute = path$o.resolve(fileDir, url);
40023
+ const absolute = (await resolver(url, file)) || path$o.resolve(fileDir, url);
40908
40024
  const relative = path$o.relative(rootDir, absolute);
40909
40025
  return normalizePath$3(relative);
40910
40026
  };
@@ -40990,7 +40106,7 @@ function createViteLessPlugin(less, rootFile, alias, resolvers) {
40990
40106
  async loadFile(filename, dir, opts, env) {
40991
40107
  const resolved = await this.resolvers.less(filename, path$o.join(dir, '*'));
40992
40108
  if (resolved) {
40993
- const result = await rebaseUrls(resolved, this.rootFile, this.alias, '@');
40109
+ const result = await rebaseUrls(resolved, this.rootFile, this.alias, '@', this.resolvers.less);
40994
40110
  let contents;
40995
40111
  if (result && 'contents' in result) {
40996
40112
  contents = result.contents;
@@ -41576,32 +40692,33 @@ function createIsConfiguredAsSsrExternal(config) {
41576
40692
  // Returns true if it is configured as external, false if it is filtered
41577
40693
  // by noExternal and undefined if it isn't affected by the explicit config
41578
40694
  return (id, importer) => {
41579
- const { ssr } = config;
41580
- if (ssr) {
41581
- if (
41582
- // If this id is defined as external, force it as external
41583
- // 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 &&
41584
40699
  ssr.external?.includes(id)) {
41585
- return true;
41586
- }
41587
- const pkgName = getNpmPackageName(id);
41588
- if (!pkgName) {
41589
- return isExternalizable(id, importer);
41590
- }
41591
- if (
41592
- // A package name in ssr.external externalizes every
41593
- // 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 &&
41594
40710
  ssr.external?.includes(pkgName)) {
41595
- return isExternalizable(id, importer, true);
41596
- }
41597
- if (typeof noExternal === 'boolean') {
41598
- return !noExternal;
41599
- }
41600
- if (noExternalFilter && !noExternalFilter(pkgName)) {
41601
- return false;
41602
- }
40711
+ return isExternalizable(id, importer, true);
40712
+ }
40713
+ if (typeof noExternal === 'boolean') {
40714
+ return !noExternal;
40715
+ }
40716
+ if (noExternalFilter && !noExternalFilter(pkgName)) {
40717
+ return false;
41603
40718
  }
41604
- return isExternalizable(id, importer);
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);
41605
40722
  };
41606
40723
  }
41607
40724
  function createIsSsrExternal(config) {
@@ -42150,7 +41267,7 @@ function importGlobPlugin(config) {
42150
41267
  async transform(code, id) {
42151
41268
  if (!code.includes('import.meta.glob'))
42152
41269
  return;
42153
- 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);
42154
41271
  if (result) {
42155
41272
  if (server) {
42156
41273
  const allGlobs = result.matches.map((i) => i.globsResolved);
@@ -42182,7 +41299,7 @@ function err$1(e, pos) {
42182
41299
  error.pos = pos;
42183
41300
  return error;
42184
41301
  }
42185
- function parseGlobOptions(rawOpts, optsStartIndex) {
41302
+ function parseGlobOptions(rawOpts, optsStartIndex, logger) {
42186
41303
  let opts = {};
42187
41304
  try {
42188
41305
  opts = evalValue(rawOpts);
@@ -42210,7 +41327,16 @@ function parseGlobOptions(rawOpts, optsStartIndex) {
42210
41327
  throw err$1(`Expected glob option "query.${key}" to be of type string, number, or boolean, but got ${typeof value}`, optsStartIndex);
42211
41328
  }
42212
41329
  }
41330
+ // normalize query as string so it's easier to handle later
41331
+ opts.query = stringifyQuery(opts.query);
42213
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
42214
41340
  if (opts.as && forceDefaultAs.includes(opts.as)) {
42215
41341
  if (opts.import && opts.import !== 'default' && opts.import !== '*')
42216
41342
  throw err$1(`Option "import" can only be "default" or "*" when "as" is "${opts.as}", but got "${opts.import}"`, optsStartIndex);
@@ -42220,9 +41346,11 @@ function parseGlobOptions(rawOpts, optsStartIndex) {
42220
41346
  throw err$1('Options "as" and "query" cannot be used together', optsStartIndex);
42221
41347
  if (opts.as)
42222
41348
  opts.query = opts.as;
41349
+ if (opts.query && opts.query[0] !== '?')
41350
+ opts.query = `?${opts.query}`;
42223
41351
  return opts;
42224
41352
  }
42225
- async function parseImportGlob(code, importer, root, resolveId) {
41353
+ async function parseImportGlob(code, importer, root, resolveId, logger) {
42226
41354
  let cleanCode;
42227
41355
  try {
42228
41356
  cleanCode = stripLiteral(code);
@@ -42312,7 +41440,7 @@ async function parseImportGlob(code, importer, root, resolveId) {
42312
41440
  if (arg2) {
42313
41441
  if (arg2.type !== 'ObjectExpression')
42314
41442
  throw err(`Expected the second argument to be an object literal, but got "${arg2.type}"`);
42315
- 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);
42316
41444
  }
42317
41445
  const end = ast.range[1];
42318
41446
  const globsResolved = await Promise.all(globs.map((glob) => toAbsoluteGlob(glob, root, importer, resolveId)));
@@ -42334,12 +41462,12 @@ const { basename, dirname, relative, join } = posix$1;
42334
41462
  /**
42335
41463
  * @param optimizeExport for dynamicImportVar plugin don't need to optimize export.
42336
41464
  */
42337
- async function transformGlobImport(code, id, root, resolveId, restoreQueryExtension = false) {
41465
+ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtension = false, logger) {
42338
41466
  id = slash$1(id);
42339
41467
  root = slash$1(root);
42340
41468
  const isVirtual = isVirtualModule(id);
42341
41469
  const dir = isVirtual ? undefined : dirname(id);
42342
- const matches = await parseImportGlob(code, isVirtual ? undefined : id, root, resolveId);
41470
+ const matches = await parseImportGlob(code, isVirtual ? undefined : id, root, resolveId, logger);
42343
41471
  const matchedFiles = new Set();
42344
41472
  if (!matches.length)
42345
41473
  return null;
@@ -42358,13 +41486,6 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
42358
41486
  .sort();
42359
41487
  const objectProps = [];
42360
41488
  const staticImports = [];
42361
- let query = !options.query
42362
- ? ''
42363
- : typeof options.query === 'string'
42364
- ? options.query
42365
- : stringifyQuery(options.query);
42366
- if (query && query[0] !== '?')
42367
- query = `?${query}`;
42368
41489
  const resolvePaths = (file) => {
42369
41490
  if (!dir) {
42370
41491
  if (isRelative)
@@ -42390,7 +41511,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
42390
41511
  const paths = resolvePaths(file);
42391
41512
  const filePath = paths.filePath;
42392
41513
  let importPath = paths.importPath;
42393
- let importQuery = query;
41514
+ let importQuery = options.query ?? '';
42394
41515
  if (importQuery && importQuery !== '?raw') {
42395
41516
  const fileExtension = basename(file).split('.').slice(-1)[0];
42396
41517
  if (fileExtension && restoreQueryExtension)
@@ -49382,7 +48503,7 @@ const sirvOptions = ({ getHeaders, }) => {
49382
48503
  // these files to be TypeScript files, and for Vite to serve them with
49383
48504
  // this Content-Type.
49384
48505
  if (knownJavascriptExtensionRE.test(pathname)) {
49385
- res.setHeader('Content-Type', 'application/javascript');
48506
+ res.setHeader('Content-Type', 'text/javascript');
49386
48507
  }
49387
48508
  const headers = getHeaders();
49388
48509
  if (headers) {
@@ -49628,6 +48749,9 @@ async function doTransform(url, server, options, timestamp) {
49628
48749
  const { config, pluginContainer } = server;
49629
48750
  const prettyUrl = debugCache$1 ? prettifyUrl(url, config.root) : '';
49630
48751
  const ssr = !!options.ssr;
48752
+ if (ssr && isDepsOptimizerEnabled(config, true)) {
48753
+ await initDevSsrDepsOptimizer(config, server);
48754
+ }
49631
48755
  const module = await server.moduleGraph.getModuleByUrl(url, ssr);
49632
48756
  // tries to handle soft invalidation of the module if available,
49633
48757
  // returns a boolean true is successful, or false if no handling is needed
@@ -52261,7 +51385,8 @@ function resolveChokidarOptions(config, options) {
52261
51385
  '**/node_modules/**',
52262
51386
  '**/test-results/**',
52263
51387
  glob.escapePath(config.cacheDir) + '/**',
52264
- ...(Array.isArray(ignored) ? ignored : [ignored]),
51388
+ glob.escapePath(path$o.resolve(config.root, config.build.outDir)) + '/**',
51389
+ ...arraify(ignored),
52265
51390
  ],
52266
51391
  ignoreInitial: true,
52267
51392
  ignorePermissionErrors: true,
@@ -53164,7 +52289,7 @@ const GET_PAYLOAD_LENGTH_64 = 2;
53164
52289
  const GET_MASK = 3;
53165
52290
  const GET_DATA = 4;
53166
52291
  const INFLATING = 5;
53167
- const WAIT_MICROTASK = 6;
52292
+ const DEFER_EVENT = 6;
53168
52293
 
53169
52294
  /**
53170
52295
  * HyBi Receiver implementation.
@@ -53176,9 +52301,9 @@ let Receiver$1 = class Receiver extends Writable$1 {
53176
52301
  * Creates a Receiver instance.
53177
52302
  *
53178
52303
  * @param {Object} [options] Options object
53179
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
53180
- * whether or not to process more than one of the `'message'`, `'ping'`,
53181
- * 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
53182
52307
  * @param {String} [options.binaryType=nodebuffer] The type for binary data
53183
52308
  * @param {Object} [options.extensions] An object containing the negotiated
53184
52309
  * extensions
@@ -53191,8 +52316,7 @@ let Receiver$1 = class Receiver extends Writable$1 {
53191
52316
  constructor(options = {}) {
53192
52317
  super();
53193
52318
 
53194
- this._allowMultipleEventsPerMicrotask =
53195
- !!options.allowMultipleEventsPerMicrotask;
52319
+ this._allowSynchronousEvents = !!options.allowSynchronousEvents;
53196
52320
  this._binaryType = options.binaryType || BINARY_TYPES$1[0];
53197
52321
  this._extensions = options.extensions || {};
53198
52322
  this._isServer = !!options.isServer;
@@ -53215,8 +52339,9 @@ let Receiver$1 = class Receiver extends Writable$1 {
53215
52339
  this._messageLength = 0;
53216
52340
  this._fragments = [];
53217
52341
 
53218
- this._state = GET_INFO;
52342
+ this._errored = false;
53219
52343
  this._loop = false;
52344
+ this._state = GET_INFO;
53220
52345
  }
53221
52346
 
53222
52347
  /**
@@ -53288,53 +52413,42 @@ let Receiver$1 = class Receiver extends Writable$1 {
53288
52413
  * @private
53289
52414
  */
53290
52415
  startLoop(cb) {
53291
- let err;
53292
52416
  this._loop = true;
53293
52417
 
53294
52418
  do {
53295
52419
  switch (this._state) {
53296
52420
  case GET_INFO:
53297
- err = this.getInfo();
52421
+ this.getInfo(cb);
53298
52422
  break;
53299
52423
  case GET_PAYLOAD_LENGTH_16:
53300
- err = this.getPayloadLength16();
52424
+ this.getPayloadLength16(cb);
53301
52425
  break;
53302
52426
  case GET_PAYLOAD_LENGTH_64:
53303
- err = this.getPayloadLength64();
52427
+ this.getPayloadLength64(cb);
53304
52428
  break;
53305
52429
  case GET_MASK:
53306
52430
  this.getMask();
53307
52431
  break;
53308
52432
  case GET_DATA:
53309
- err = this.getData(cb);
52433
+ this.getData(cb);
53310
52434
  break;
53311
52435
  case INFLATING:
52436
+ case DEFER_EVENT:
53312
52437
  this._loop = false;
53313
52438
  return;
53314
- default:
53315
- //
53316
- // `WAIT_MICROTASK`.
53317
- //
53318
- this._loop = false;
53319
-
53320
- queueTask(() => {
53321
- this._state = GET_INFO;
53322
- this.startLoop(cb);
53323
- });
53324
- return;
53325
52439
  }
53326
52440
  } while (this._loop);
53327
52441
 
53328
- cb(err);
52442
+ if (!this._errored) cb();
53329
52443
  }
53330
52444
 
53331
52445
  /**
53332
52446
  * Reads the first two bytes of a frame.
53333
52447
  *
53334
- * @return {(RangeError|undefined)} A possible error
52448
+ * @param {Function} cb Callback
53335
52449
  * @private
53336
52450
  */
53337
- getInfo() {
52451
+ getInfo(cb) {
53338
52452
  if (this._bufferedBytes < 2) {
53339
52453
  this._loop = false;
53340
52454
  return;
@@ -53343,27 +52457,31 @@ let Receiver$1 = class Receiver extends Writable$1 {
53343
52457
  const buf = this.consume(2);
53344
52458
 
53345
52459
  if ((buf[0] & 0x30) !== 0x00) {
53346
- this._loop = false;
53347
- return error$1(
52460
+ const error = this.createError(
53348
52461
  RangeError,
53349
52462
  'RSV2 and RSV3 must be clear',
53350
52463
  true,
53351
52464
  1002,
53352
52465
  'WS_ERR_UNEXPECTED_RSV_2_3'
53353
52466
  );
52467
+
52468
+ cb(error);
52469
+ return;
53354
52470
  }
53355
52471
 
53356
52472
  const compressed = (buf[0] & 0x40) === 0x40;
53357
52473
 
53358
52474
  if (compressed && !this._extensions[PerMessageDeflate$3.extensionName]) {
53359
- this._loop = false;
53360
- return error$1(
52475
+ const error = this.createError(
53361
52476
  RangeError,
53362
52477
  'RSV1 must be clear',
53363
52478
  true,
53364
52479
  1002,
53365
52480
  'WS_ERR_UNEXPECTED_RSV_1'
53366
52481
  );
52482
+
52483
+ cb(error);
52484
+ return;
53367
52485
  }
53368
52486
 
53369
52487
  this._fin = (buf[0] & 0x80) === 0x80;
@@ -53372,86 +52490,100 @@ let Receiver$1 = class Receiver extends Writable$1 {
53372
52490
 
53373
52491
  if (this._opcode === 0x00) {
53374
52492
  if (compressed) {
53375
- this._loop = false;
53376
- return error$1(
52493
+ const error = this.createError(
53377
52494
  RangeError,
53378
52495
  'RSV1 must be clear',
53379
52496
  true,
53380
52497
  1002,
53381
52498
  'WS_ERR_UNEXPECTED_RSV_1'
53382
52499
  );
52500
+
52501
+ cb(error);
52502
+ return;
53383
52503
  }
53384
52504
 
53385
52505
  if (!this._fragmented) {
53386
- this._loop = false;
53387
- return error$1(
52506
+ const error = this.createError(
53388
52507
  RangeError,
53389
52508
  'invalid opcode 0',
53390
52509
  true,
53391
52510
  1002,
53392
52511
  'WS_ERR_INVALID_OPCODE'
53393
52512
  );
52513
+
52514
+ cb(error);
52515
+ return;
53394
52516
  }
53395
52517
 
53396
52518
  this._opcode = this._fragmented;
53397
52519
  } else if (this._opcode === 0x01 || this._opcode === 0x02) {
53398
52520
  if (this._fragmented) {
53399
- this._loop = false;
53400
- return error$1(
52521
+ const error = this.createError(
53401
52522
  RangeError,
53402
52523
  `invalid opcode ${this._opcode}`,
53403
52524
  true,
53404
52525
  1002,
53405
52526
  'WS_ERR_INVALID_OPCODE'
53406
52527
  );
52528
+
52529
+ cb(error);
52530
+ return;
53407
52531
  }
53408
52532
 
53409
52533
  this._compressed = compressed;
53410
52534
  } else if (this._opcode > 0x07 && this._opcode < 0x0b) {
53411
52535
  if (!this._fin) {
53412
- this._loop = false;
53413
- return error$1(
52536
+ const error = this.createError(
53414
52537
  RangeError,
53415
52538
  'FIN must be set',
53416
52539
  true,
53417
52540
  1002,
53418
52541
  'WS_ERR_EXPECTED_FIN'
53419
52542
  );
52543
+
52544
+ cb(error);
52545
+ return;
53420
52546
  }
53421
52547
 
53422
52548
  if (compressed) {
53423
- this._loop = false;
53424
- return error$1(
52549
+ const error = this.createError(
53425
52550
  RangeError,
53426
52551
  'RSV1 must be clear',
53427
52552
  true,
53428
52553
  1002,
53429
52554
  'WS_ERR_UNEXPECTED_RSV_1'
53430
52555
  );
52556
+
52557
+ cb(error);
52558
+ return;
53431
52559
  }
53432
52560
 
53433
52561
  if (
53434
52562
  this._payloadLength > 0x7d ||
53435
52563
  (this._opcode === 0x08 && this._payloadLength === 1)
53436
52564
  ) {
53437
- this._loop = false;
53438
- return error$1(
52565
+ const error = this.createError(
53439
52566
  RangeError,
53440
52567
  `invalid payload length ${this._payloadLength}`,
53441
52568
  true,
53442
52569
  1002,
53443
52570
  'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
53444
52571
  );
52572
+
52573
+ cb(error);
52574
+ return;
53445
52575
  }
53446
52576
  } else {
53447
- this._loop = false;
53448
- return error$1(
52577
+ const error = this.createError(
53449
52578
  RangeError,
53450
52579
  `invalid opcode ${this._opcode}`,
53451
52580
  true,
53452
52581
  1002,
53453
52582
  'WS_ERR_INVALID_OPCODE'
53454
52583
  );
52584
+
52585
+ cb(error);
52586
+ return;
53455
52587
  }
53456
52588
 
53457
52589
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
@@ -53459,54 +52591,58 @@ let Receiver$1 = class Receiver extends Writable$1 {
53459
52591
 
53460
52592
  if (this._isServer) {
53461
52593
  if (!this._masked) {
53462
- this._loop = false;
53463
- return error$1(
52594
+ const error = this.createError(
53464
52595
  RangeError,
53465
52596
  'MASK must be set',
53466
52597
  true,
53467
52598
  1002,
53468
52599
  'WS_ERR_EXPECTED_MASK'
53469
52600
  );
52601
+
52602
+ cb(error);
52603
+ return;
53470
52604
  }
53471
52605
  } else if (this._masked) {
53472
- this._loop = false;
53473
- return error$1(
52606
+ const error = this.createError(
53474
52607
  RangeError,
53475
52608
  'MASK must be clear',
53476
52609
  true,
53477
52610
  1002,
53478
52611
  'WS_ERR_UNEXPECTED_MASK'
53479
52612
  );
52613
+
52614
+ cb(error);
52615
+ return;
53480
52616
  }
53481
52617
 
53482
52618
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
53483
52619
  else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
53484
- else return this.haveLength();
52620
+ else this.haveLength(cb);
53485
52621
  }
53486
52622
 
53487
52623
  /**
53488
52624
  * Gets extended payload length (7+16).
53489
52625
  *
53490
- * @return {(RangeError|undefined)} A possible error
52626
+ * @param {Function} cb Callback
53491
52627
  * @private
53492
52628
  */
53493
- getPayloadLength16() {
52629
+ getPayloadLength16(cb) {
53494
52630
  if (this._bufferedBytes < 2) {
53495
52631
  this._loop = false;
53496
52632
  return;
53497
52633
  }
53498
52634
 
53499
52635
  this._payloadLength = this.consume(2).readUInt16BE(0);
53500
- return this.haveLength();
52636
+ this.haveLength(cb);
53501
52637
  }
53502
52638
 
53503
52639
  /**
53504
52640
  * Gets extended payload length (7+64).
53505
52641
  *
53506
- * @return {(RangeError|undefined)} A possible error
52642
+ * @param {Function} cb Callback
53507
52643
  * @private
53508
52644
  */
53509
- getPayloadLength64() {
52645
+ getPayloadLength64(cb) {
53510
52646
  if (this._bufferedBytes < 8) {
53511
52647
  this._loop = false;
53512
52648
  return;
@@ -53520,38 +52656,42 @@ let Receiver$1 = class Receiver extends Writable$1 {
53520
52656
  // if payload length is greater than this number.
53521
52657
  //
53522
52658
  if (num > Math.pow(2, 53 - 32) - 1) {
53523
- this._loop = false;
53524
- return error$1(
52659
+ const error = this.createError(
53525
52660
  RangeError,
53526
52661
  'Unsupported WebSocket frame: payload length > 2^53 - 1',
53527
52662
  false,
53528
52663
  1009,
53529
52664
  'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'
53530
52665
  );
52666
+
52667
+ cb(error);
52668
+ return;
53531
52669
  }
53532
52670
 
53533
52671
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
53534
- return this.haveLength();
52672
+ this.haveLength(cb);
53535
52673
  }
53536
52674
 
53537
52675
  /**
53538
52676
  * Payload length has been read.
53539
52677
  *
53540
- * @return {(RangeError|undefined)} A possible error
52678
+ * @param {Function} cb Callback
53541
52679
  * @private
53542
52680
  */
53543
- haveLength() {
52681
+ haveLength(cb) {
53544
52682
  if (this._payloadLength && this._opcode < 0x08) {
53545
52683
  this._totalPayloadLength += this._payloadLength;
53546
52684
  if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
53547
- this._loop = false;
53548
- return error$1(
52685
+ const error = this.createError(
53549
52686
  RangeError,
53550
52687
  'Max payload size exceeded',
53551
52688
  false,
53552
52689
  1009,
53553
52690
  'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
53554
52691
  );
52692
+
52693
+ cb(error);
52694
+ return;
53555
52695
  }
53556
52696
  }
53557
52697
 
@@ -53578,7 +52718,6 @@ let Receiver$1 = class Receiver extends Writable$1 {
53578
52718
  * Reads data bytes.
53579
52719
  *
53580
52720
  * @param {Function} cb Callback
53581
- * @return {(Error|RangeError|undefined)} A possible error
53582
52721
  * @private
53583
52722
  */
53584
52723
  getData(cb) {
@@ -53600,7 +52739,10 @@ let Receiver$1 = class Receiver extends Writable$1 {
53600
52739
  }
53601
52740
  }
53602
52741
 
53603
- if (this._opcode > 0x07) return this.controlMessage(data);
52742
+ if (this._opcode > 0x07) {
52743
+ this.controlMessage(data, cb);
52744
+ return;
52745
+ }
53604
52746
 
53605
52747
  if (this._compressed) {
53606
52748
  this._state = INFLATING;
@@ -53617,7 +52759,7 @@ let Receiver$1 = class Receiver extends Writable$1 {
53617
52759
  this._fragments.push(data);
53618
52760
  }
53619
52761
 
53620
- return this.dataMessage();
52762
+ this.dataMessage(cb);
53621
52763
  }
53622
52764
 
53623
52765
  /**
@@ -53636,76 +52778,101 @@ let Receiver$1 = class Receiver extends Writable$1 {
53636
52778
  if (buf.length) {
53637
52779
  this._messageLength += buf.length;
53638
52780
  if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
53639
- return cb(
53640
- error$1(
53641
- RangeError,
53642
- 'Max payload size exceeded',
53643
- false,
53644
- 1009,
53645
- 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
53646
- )
52781
+ const error = this.createError(
52782
+ RangeError,
52783
+ 'Max payload size exceeded',
52784
+ false,
52785
+ 1009,
52786
+ 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
53647
52787
  );
52788
+
52789
+ cb(error);
52790
+ return;
53648
52791
  }
53649
52792
 
53650
52793
  this._fragments.push(buf);
53651
52794
  }
53652
52795
 
53653
- const er = this.dataMessage();
53654
- if (er) return cb(er);
53655
-
53656
- this.startLoop(cb);
52796
+ this.dataMessage(cb);
52797
+ if (this._state === GET_INFO) this.startLoop(cb);
53657
52798
  });
53658
52799
  }
53659
52800
 
53660
52801
  /**
53661
52802
  * Handles a data message.
53662
52803
  *
53663
- * @return {(Error|undefined)} A possible error
52804
+ * @param {Function} cb Callback
53664
52805
  * @private
53665
52806
  */
53666
- dataMessage() {
53667
- if (this._fin) {
53668
- const messageLength = this._messageLength;
53669
- const fragments = this._fragments;
53670
-
53671
- this._totalPayloadLength = 0;
53672
- this._messageLength = 0;
53673
- this._fragmented = 0;
53674
- this._fragments = [];
53675
-
53676
- if (this._opcode === 2) {
53677
- let data;
53678
-
53679
- if (this._binaryType === 'nodebuffer') {
53680
- data = concat(fragments, messageLength);
53681
- } else if (this._binaryType === 'arraybuffer') {
53682
- data = toArrayBuffer(concat(fragments, messageLength));
53683
- } else {
53684
- data = fragments;
53685
- }
52807
+ dataMessage(cb) {
52808
+ if (!this._fin) {
52809
+ this._state = GET_INFO;
52810
+ return;
52811
+ }
52812
+
52813
+ const messageLength = this._messageLength;
52814
+ const fragments = this._fragments;
53686
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) {
53687
52838
  this.emit('message', data, true);
52839
+ this._state = GET_INFO;
53688
52840
  } else {
53689
- 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);
53690
52850
 
53691
- if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
53692
- this._loop = false;
53693
- return error$1(
53694
- Error,
53695
- 'invalid UTF-8 sequence',
53696
- true,
53697
- 1007,
53698
- 'WS_ERR_INVALID_UTF8'
53699
- );
53700
- }
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
+ );
52859
+
52860
+ cb(error);
52861
+ return;
52862
+ }
53701
52863
 
52864
+ if (this._state === INFLATING || this._allowSynchronousEvents) {
53702
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
+ });
53703
52874
  }
53704
52875
  }
53705
-
53706
- this._state = this._allowMultipleEventsPerMicrotask
53707
- ? GET_INFO
53708
- : WAIT_MICROTASK;
53709
52876
  }
53710
52877
 
53711
52878
  /**
@@ -53715,24 +52882,26 @@ let Receiver$1 = class Receiver extends Writable$1 {
53715
52882
  * @return {(Error|RangeError|undefined)} A possible error
53716
52883
  * @private
53717
52884
  */
53718
- controlMessage(data) {
52885
+ controlMessage(data, cb) {
53719
52886
  if (this._opcode === 0x08) {
53720
- this._loop = false;
53721
-
53722
52887
  if (data.length === 0) {
52888
+ this._loop = false;
53723
52889
  this.emit('conclude', 1005, EMPTY_BUFFER$2);
53724
52890
  this.end();
53725
52891
  } else {
53726
52892
  const code = data.readUInt16BE(0);
53727
52893
 
53728
52894
  if (!isValidStatusCode$1(code)) {
53729
- return error$1(
52895
+ const error = this.createError(
53730
52896
  RangeError,
53731
52897
  `invalid status code ${code}`,
53732
52898
  true,
53733
52899
  1002,
53734
52900
  'WS_ERR_INVALID_CLOSE_CODE'
53735
52901
  );
52902
+
52903
+ cb(error);
52904
+ return;
53736
52905
  }
53737
52906
 
53738
52907
  const buf = new FastBuffer(
@@ -53742,15 +52911,19 @@ let Receiver$1 = class Receiver extends Writable$1 {
53742
52911
  );
53743
52912
 
53744
52913
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
53745
- return error$1(
52914
+ const error = this.createError(
53746
52915
  Error,
53747
52916
  'invalid UTF-8 sequence',
53748
52917
  true,
53749
52918
  1007,
53750
52919
  'WS_ERR_INVALID_UTF8'
53751
52920
  );
52921
+
52922
+ cb(error);
52923
+ return;
53752
52924
  }
53753
52925
 
52926
+ this._loop = false;
53754
52927
  this.emit('conclude', code, buf);
53755
52928
  this.end();
53756
52929
  }
@@ -53759,37 +52932,47 @@ let Receiver$1 = class Receiver extends Writable$1 {
53759
52932
  return;
53760
52933
  }
53761
52934
 
53762
- this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
53763
- this._state = this._allowMultipleEventsPerMicrotask
53764
- ? GET_INFO
53765
- : 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
+ }
53766
52946
  }
53767
- };
53768
52947
 
53769
- 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;
53770
52963
 
53771
- /**
53772
- * Builds an error object.
53773
- *
53774
- * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
53775
- * @param {String} message The error message
53776
- * @param {Boolean} prefix Specifies whether or not to add a default prefix to
53777
- * `message`
53778
- * @param {Number} statusCode The status code
53779
- * @param {String} errorCode The exposed error code
53780
- * @return {(Error|RangeError)} The error
53781
- * @private
53782
- */
53783
- function error$1(ErrorCtor, message, prefix, statusCode, errorCode) {
53784
- const err = new ErrorCtor(
53785
- prefix ? `Invalid WebSocket frame: ${message}` : message
53786
- );
52964
+ const err = new ErrorCtor(
52965
+ prefix ? `Invalid WebSocket frame: ${message}` : message
52966
+ );
53787
52967
 
53788
- Error.captureStackTrace(err, error$1);
53789
- err.code = errorCode;
53790
- err[kStatusCode$1] = statusCode;
53791
- return err;
53792
- }
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;
53793
52976
 
53794
52977
  /**
53795
52978
  * A shim for `queueMicrotask()`.
@@ -54870,6 +54053,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54870
54053
 
54871
54054
  initAsClient(this, address, protocols, options);
54872
54055
  } else {
54056
+ this._autoPong = options.autoPong;
54873
54057
  this._isServer = true;
54874
54058
  }
54875
54059
  }
@@ -54978,9 +54162,9 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54978
54162
  * @param {Duplex} socket The network socket between the server and client
54979
54163
  * @param {Buffer} head The first packet of the upgraded stream
54980
54164
  * @param {Object} options Options object
54981
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
54982
- * whether or not to process more than one of the `'message'`, `'ping'`,
54983
- * 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
54984
54168
  * @param {Function} [options.generateMask] The function used to generate the
54985
54169
  * masking key
54986
54170
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
@@ -54990,7 +54174,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54990
54174
  */
54991
54175
  setSocket(socket, head, options) {
54992
54176
  const receiver = new Receiver({
54993
- allowMultipleEventsPerMicrotask: options.allowMultipleEventsPerMicrotask,
54177
+ allowSynchronousEvents: options.allowSynchronousEvents,
54994
54178
  binaryType: this.binaryType,
54995
54179
  extensions: this._extensions,
54996
54180
  isServer: this._isServer,
@@ -55408,9 +54592,11 @@ var websocket = WebSocket$1;
55408
54592
  * @param {(String|URL)} address The URL to which to connect
55409
54593
  * @param {Array} protocols The subprotocols
55410
54594
  * @param {Object} [options] Connection options
55411
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
55412
- * whether or not to process more than one of the `'message'`, `'ping'`,
55413
- * 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
55414
54600
  * @param {Function} [options.finishRequest] A function which can be used to
55415
54601
  * customize the headers of each http request before it is sent
55416
54602
  * @param {Boolean} [options.followRedirects=false] Whether or not to follow
@@ -55435,7 +54621,8 @@ var websocket = WebSocket$1;
55435
54621
  */
55436
54622
  function initAsClient(websocket, address, protocols, options) {
55437
54623
  const opts = {
55438
- allowMultipleEventsPerMicrotask: false,
54624
+ allowSynchronousEvents: false,
54625
+ autoPong: true,
55439
54626
  protocolVersion: protocolVersions[1],
55440
54627
  maxPayload: 100 * 1024 * 1024,
55441
54628
  skipUTF8Validation: false,
@@ -55454,6 +54641,8 @@ function initAsClient(websocket, address, protocols, options) {
55454
54641
  port: undefined
55455
54642
  };
55456
54643
 
54644
+ websocket._autoPong = opts.autoPong;
54645
+
55457
54646
  if (!protocolVersions.includes(opts.protocolVersion)) {
55458
54647
  throw new RangeError(
55459
54648
  `Unsupported protocol version: ${opts.protocolVersion} ` +
@@ -55787,7 +54976,7 @@ function initAsClient(websocket, address, protocols, options) {
55787
54976
  }
55788
54977
 
55789
54978
  websocket.setSocket(socket, head, {
55790
- allowMultipleEventsPerMicrotask: opts.allowMultipleEventsPerMicrotask,
54979
+ allowSynchronousEvents: opts.allowSynchronousEvents,
55791
54980
  generateMask: opts.generateMask,
55792
54981
  maxPayload: opts.maxPayload,
55793
54982
  skipUTF8Validation: opts.skipUTF8Validation
@@ -55998,7 +55187,7 @@ function receiverOnMessage(data, isBinary) {
55998
55187
  function receiverOnPing(data) {
55999
55188
  const websocket = this[kWebSocket$1];
56000
55189
 
56001
- websocket.pong(data, !websocket._isServer, NOOP);
55190
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
56002
55191
  websocket.emit('ping', data);
56003
55192
  }
56004
55193
 
@@ -56204,9 +55393,11 @@ class WebSocketServer extends EventEmitter {
56204
55393
  * Create a `WebSocketServer` instance.
56205
55394
  *
56206
55395
  * @param {Object} options Configuration options
56207
- * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
56208
- * whether or not to process more than one of the `'message'`, `'ping'`,
56209
- * 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
56210
55401
  * @param {Number} [options.backlog=511] The maximum length of the queue of
56211
55402
  * pending connections
56212
55403
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
@@ -56233,7 +55424,8 @@ class WebSocketServer extends EventEmitter {
56233
55424
  super();
56234
55425
 
56235
55426
  options = {
56236
- allowMultipleEventsPerMicrotask: false,
55427
+ allowSynchronousEvents: false,
55428
+ autoPong: true,
56237
55429
  maxPayload: 100 * 1024 * 1024,
56238
55430
  skipUTF8Validation: false,
56239
55431
  perMessageDeflate: false,
@@ -56554,7 +55746,7 @@ class WebSocketServer extends EventEmitter {
56554
55746
  `Sec-WebSocket-Accept: ${digest}`
56555
55747
  ];
56556
55748
 
56557
- const ws = new this.options.WebSocket(null);
55749
+ const ws = new this.options.WebSocket(null, undefined, this.options);
56558
55750
 
56559
55751
  if (protocols.size) {
56560
55752
  //
@@ -56588,8 +55780,7 @@ class WebSocketServer extends EventEmitter {
56588
55780
  socket.removeListener('error', socketOnError);
56589
55781
 
56590
55782
  ws.setSocket(socket, head, {
56591
- allowMultipleEventsPerMicrotask:
56592
- this.options.allowMultipleEventsPerMicrotask,
55783
+ allowSynchronousEvents: this.options.allowSynchronousEvents,
56593
55784
  maxPayload: this.options.maxPayload,
56594
55785
  skipUTF8Validation: this.options.skipUTF8Validation
56595
55786
  });
@@ -59188,7 +58379,7 @@ const debug$5 = createDebugger('vite:send', {
59188
58379
  onlyWhenFocused: true,
59189
58380
  });
59190
58381
  const alias = {
59191
- js: 'application/javascript',
58382
+ js: 'text/javascript',
59192
58383
  css: 'text/css',
59193
58384
  html: 'text/html',
59194
58385
  json: 'application/json',
@@ -59245,8 +58436,7 @@ const knownIgnoreList = new Set(['/', '/favicon.ico']);
59245
58436
  function transformMiddleware(server) {
59246
58437
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
59247
58438
  // check if public dir is inside root dir
59248
- const { root } = server.config;
59249
- const publicDir = normalizePath$3(server.config.publicDir);
58439
+ const { root, publicDir } = server.config;
59250
58440
  const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
59251
58441
  const publicPath = `${publicDir.slice(root.length)}/`;
59252
58442
  return async function viteTransformMiddleware(req, res, next) {
@@ -60346,7 +59536,11 @@ async function _createServer(inlineConfig = {}, options) {
60346
59536
  const watcher = watchEnabled
60347
59537
  ? chokidar.watch(
60348
59538
  // config file dependencies and env file might be outside of root
60349
- [...new Set([root, ...config.configFileDependencies, config.envDir])], resolvedWatchOptions)
59539
+ [
59540
+ root,
59541
+ ...config.configFileDependencies,
59542
+ ...getEnvFilesForMode(config.mode, config.envDir),
59543
+ ], resolvedWatchOptions)
60350
59544
  : createNoopWatcher(resolvedWatchOptions);
60351
59545
  const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
60352
59546
  const container = await createPluginContainer(config, moduleGraph, watcher);
@@ -60386,9 +59580,6 @@ async function _createServer(inlineConfig = {}, options) {
60386
59580
  return devHtmlTransformFn(server, url, html, originalUrl);
60387
59581
  },
60388
59582
  async ssrLoadModule(url, opts) {
60389
- if (isDepsOptimizerEnabled(config, true)) {
60390
- await initDevSsrDepsOptimizer(config, server);
60391
- }
60392
59583
  return ssrLoadModule(url, server, undefined, undefined, opts?.fixStacktrace);
60393
59584
  },
60394
59585
  ssrFixStacktrace(e) {
@@ -60510,6 +59701,16 @@ async function _createServer(inlineConfig = {}, options) {
60510
59701
  _fsDenyGlob: picomatch$4(config.server.fs.deny, { matchBase: true }),
60511
59702
  _shortcutsOptions: undefined,
60512
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
+ });
60513
59714
  if (!middlewareMode) {
60514
59715
  exitProcess = async () => {
60515
59716
  try {
@@ -60538,13 +59739,13 @@ async function _createServer(inlineConfig = {}, options) {
60538
59739
  }
60539
59740
  }
60540
59741
  };
60541
- const normalizedPublicDir = normalizePath$3(config.publicDir);
59742
+ const { publicDir } = config;
60542
59743
  const onFileAddUnlink = async (file, isUnlink) => {
60543
59744
  file = normalizePath$3(file);
60544
59745
  await container.watchChange(file, { event: isUnlink ? 'delete' : 'create' });
60545
- if (config.publicDir && publicFiles) {
60546
- if (file.startsWith(normalizedPublicDir)) {
60547
- 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));
60548
59749
  }
60549
59750
  }
60550
59751
  await handleFileAddUnlink(file, server, isUnlink);
@@ -60583,7 +59784,7 @@ async function _createServer(inlineConfig = {}, options) {
60583
59784
  // apply server configuration hooks from plugins
60584
59785
  const postHooks = [];
60585
59786
  for (const hook of config.getSortedPluginHooks('configureServer')) {
60586
- postHooks.push(await hook(server));
59787
+ postHooks.push(await hook(reflexServer));
60587
59788
  }
60588
59789
  // Internal middlewares ------------------------------------------------------
60589
59790
  // request timer
@@ -60622,7 +59823,7 @@ async function _createServer(inlineConfig = {}, options) {
60622
59823
  // serve static files under /public
60623
59824
  // this applies before the transform middleware so that these files are served
60624
59825
  // as-is without transforms.
60625
- if (config.publicDir) {
59826
+ if (publicDir) {
60626
59827
  middlewares.use(servePublicMiddleware(server, publicFiles));
60627
59828
  }
60628
59829
  // main transform middleware
@@ -60876,11 +60077,10 @@ function getShortName(file, root) {
60876
60077
  async function handleHMRUpdate(file, server, configOnly) {
60877
60078
  const { ws, config, moduleGraph } = server;
60878
60079
  const shortFile = getShortName(file, config.root);
60879
- const fileName = path$o.basename(file);
60880
60080
  const isConfig = file === config.configFile;
60881
60081
  const isConfigDependency = config.configFileDependencies.some((name) => file === name);
60882
60082
  const isEnv = config.inlineConfig.envFile !== false &&
60883
- getEnvFilesForMode(config.mode).includes(fileName);
60083
+ getEnvFilesForMode(config.mode, config.envDir).includes(file);
60884
60084
  if (isConfig || isConfigDependency || isEnv) {
60885
60085
  // auto restart server
60886
60086
  debugHmr?.(`[config change] ${colors$1.dim(shortFile)}`);
@@ -60959,14 +60159,15 @@ function updateModules(file, modules, timestamp, { config, ws, moduleGraph }, af
60959
60159
  needFullReload = hasDeadEnd;
60960
60160
  continue;
60961
60161
  }
60962
- updates.push(...boundaries.map(({ boundary, acceptedVia }) => ({
60162
+ updates.push(...boundaries.map(({ boundary, acceptedVia, isWithinCircularImport }) => ({
60963
60163
  type: `${boundary.type}-update`,
60964
60164
  timestamp,
60965
60165
  path: normalizeHmrUrl(boundary.url),
60166
+ acceptedPath: normalizeHmrUrl(acceptedVia.url),
60966
60167
  explicitImportRequired: boundary.type === 'js'
60967
60168
  ? isExplicitImportRequired(acceptedVia.url)
60968
- : undefined,
60969
- acceptedPath: normalizeHmrUrl(acceptedVia.url),
60169
+ : false,
60170
+ isWithinCircularImport,
60970
60171
  })));
60971
60172
  }
60972
60173
  if (needFullReload) {
@@ -61025,10 +60226,11 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
61025
60226
  return false;
61026
60227
  }
61027
60228
  if (node.isSelfAccepting) {
61028
- boundaries.push({ boundary: node, acceptedVia: node });
61029
- const result = isNodeWithinCircularImports(node, currentChain);
61030
- if (result)
61031
- return result;
60229
+ boundaries.push({
60230
+ boundary: node,
60231
+ acceptedVia: node,
60232
+ isWithinCircularImport: isNodeWithinCircularImports(node, currentChain),
60233
+ });
61032
60234
  // additionally check for CSS importers, since a PostCSS plugin like
61033
60235
  // Tailwind JIT may register any file as a dependency to a CSS file.
61034
60236
  for (const importer of node.importers) {
@@ -61044,10 +60246,11 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
61044
60246
  // Also, the imported module (this one) must be updated before the importers,
61045
60247
  // so that they do get the fresh imported module when/if they are reloaded.
61046
60248
  if (node.acceptedHmrExports) {
61047
- boundaries.push({ boundary: node, acceptedVia: node });
61048
- const result = isNodeWithinCircularImports(node, currentChain);
61049
- if (result)
61050
- return result;
60249
+ boundaries.push({
60250
+ boundary: node,
60251
+ acceptedVia: node,
60252
+ isWithinCircularImport: isNodeWithinCircularImports(node, currentChain),
60253
+ });
61051
60254
  }
61052
60255
  else {
61053
60256
  if (!node.importers.size) {
@@ -61064,10 +60267,11 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
61064
60267
  for (const importer of node.importers) {
61065
60268
  const subChain = currentChain.concat(importer);
61066
60269
  if (importer.acceptedHmrDeps.has(node)) {
61067
- boundaries.push({ boundary: importer, acceptedVia: node });
61068
- const result = isNodeWithinCircularImports(importer, subChain);
61069
- if (result)
61070
- return result;
60270
+ boundaries.push({
60271
+ boundary: importer,
60272
+ acceptedVia: node,
60273
+ isWithinCircularImport: isNodeWithinCircularImports(importer, subChain),
60274
+ });
61071
60275
  continue;
61072
60276
  }
61073
60277
  if (node.id && node.acceptedHmrExports && importer.importedBindings) {
@@ -61141,7 +60345,7 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node], tra
61141
60345
  debugHmr(colors$1.yellow(`circular imports detected: `) +
61142
60346
  importChain.map((m) => colors$1.dim(m.url)).join(' -> '));
61143
60347
  }
61144
- return 'circular imports';
60348
+ return true;
61145
60349
  }
61146
60350
  // Continue recursively
61147
60351
  if (!currentChain.includes(importer)) {
@@ -61312,20 +60516,13 @@ async function readModifiedFile(file) {
61312
60516
  const content = await fsp.readFile(file, 'utf-8');
61313
60517
  if (!content) {
61314
60518
  const mtime = (await fsp.stat(file)).mtimeMs;
61315
- await new Promise((r) => {
61316
- let n = 0;
61317
- const poll = async () => {
61318
- n++;
61319
- const newMtime = (await fsp.stat(file)).mtimeMs;
61320
- if (newMtime !== mtime || n > 10) {
61321
- r(0);
61322
- }
61323
- else {
61324
- setTimeout(poll, 10);
61325
- }
61326
- };
61327
- setTimeout(poll, 10);
61328
- });
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
+ }
61329
60526
  return await fsp.readFile(file, 'utf-8');
61330
60527
  }
61331
60528
  else {
@@ -61737,7 +60934,7 @@ function webWorkerPlugin(config) {
61737
60934
  return worker;
61738
60935
  } catch(e) {
61739
60936
  return new ${workerConstructor}(
61740
- "data:application/javascript;base64," + encodedJs,
60937
+ "data:text/javascript;base64," + encodedJs,
61741
60938
  ${workerTypeOption}
61742
60939
  );
61743
60940
  }${
@@ -61752,7 +60949,7 @@ function webWorkerPlugin(config) {
61752
60949
  : `${encodedJs}
61753
60950
  export default function WorkerWrapper(options) {
61754
60951
  return new ${workerConstructor}(
61755
- "data:application/javascript;base64," + encodedJs,
60952
+ "data:text/javascript;base64," + encodedJs,
61756
60953
  ${workerTypeOption}
61757
60954
  );
61758
60955
  }
@@ -62934,7 +62131,7 @@ function workerImportMetaUrlPlugin(config) {
62934
62131
  * ```
62935
62132
  */
62936
62133
  function assetImportMetaUrlPlugin(config) {
62937
- const normalizedPublicDir = normalizePath$3(config.publicDir);
62134
+ const { publicDir } = config;
62938
62135
  let assetResolver;
62939
62136
  const fsResolveOptions = {
62940
62137
  ...config.resolve,
@@ -63007,7 +62204,7 @@ function assetImportMetaUrlPlugin(config) {
63007
62204
  file = await assetResolver(url, id);
63008
62205
  file ??=
63009
62206
  url[0] === '/'
63010
- ? slash$1(path$o.join(config.publicDir, url))
62207
+ ? slash$1(path$o.join(publicDir, url))
63011
62208
  : slash$1(path$o.resolve(path$o.dirname(id), url));
63012
62209
  }
63013
62210
  // Get final asset URL. If the file does not exist,
@@ -63015,8 +62212,8 @@ function assetImportMetaUrlPlugin(config) {
63015
62212
  let builtUrl;
63016
62213
  if (file) {
63017
62214
  try {
63018
- if (isParentDirectory(normalizedPublicDir, file)) {
63019
- const publicPath = '/' + path$o.posix.relative(normalizedPublicDir, file);
62215
+ if (isParentDirectory(publicDir, file)) {
62216
+ const publicPath = '/' + path$o.posix.relative(publicDir, file);
63020
62217
  builtUrl = await fileToUrl$1(publicPath, config, this);
63021
62218
  }
63022
62219
  else {
@@ -63274,10 +62471,10 @@ function parseDynamicImportPattern(strings) {
63274
62471
  // ? is escaped on posix OS
63275
62472
  requestQueryMaybeEscapedSplitRE, 2);
63276
62473
  const [rawPattern] = filename.split(requestQuerySplitRE, 2);
63277
- const as = ['worker', 'url', 'raw'].find((key) => rawQuery && key in rawQuery);
63278
- if (as) {
62474
+ const globQuery = ['worker', 'url', 'raw'].find((key) => rawQuery && key in rawQuery);
62475
+ if (globQuery) {
63279
62476
  globParams = {
63280
- as,
62477
+ query: globQuery,
63281
62478
  import: '*',
63282
62479
  };
63283
62480
  }
@@ -63907,7 +63104,21 @@ async function createPluginContainer(config, moduleGraph, watcher) {
63907
63104
  break;
63908
63105
  }
63909
63106
  if (!combinedMap) {
63910
- 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
+ }
63911
63122
  }
63912
63123
  else {
63913
63124
  combinedMap = combineSourcemaps(cleanUrl(this.filename), [
@@ -65462,7 +64673,7 @@ async function loadCachedDepOptimizationMetadata(config, ssr, force = config.opt
65462
64673
  if (!force) {
65463
64674
  let cachedMetadata;
65464
64675
  try {
65465
- const cachedMetadataPath = path$o.join(depsCacheDir, '_metadata.json');
64676
+ const cachedMetadataPath = path$o.join(depsCacheDir, METADATA_FILENAME);
65466
64677
  cachedMetadata = parseDepsOptimizerMetadata(await fsp.readFile(cachedMetadataPath, 'utf-8'), depsCacheDir);
65467
64678
  }
65468
64679
  catch (e) { }
@@ -65580,8 +64791,8 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
65580
64791
  committed = true;
65581
64792
  // Write metadata file, then commit the processing folder to the global deps cache
65582
64793
  // Rewire the file paths from the temporary processing dir to the final deps cache dir
65583
- const dataPath = path$o.join(processingCacheDir, '_metadata.json');
65584
- 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}`));
65585
64796
  fs$l.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
65586
64797
  // In order to minimize the time where the deps folder isn't in a consistent state,
65587
64798
  // we first rename the old depsCacheDir to a temporary path, then we rename the
@@ -66089,10 +65300,10 @@ function getConfigHash(config, ssr) {
66089
65300
  plugins: config.plugins.map((p) => p.name),
66090
65301
  optimizeDeps: {
66091
65302
  include: optimizeDeps?.include
66092
- ? Array.from(new Set(optimizeDeps.include)).sort()
65303
+ ? unique(optimizeDeps.include).sort()
66093
65304
  : undefined,
66094
65305
  exclude: optimizeDeps?.exclude
66095
- ? Array.from(new Set(optimizeDeps.exclude)).sort()
65306
+ ? unique(optimizeDeps.exclude).sort()
66096
65307
  : undefined,
66097
65308
  esbuildOptions: {
66098
65309
  ...optimizeDeps?.esbuildOptions,
@@ -66828,7 +66039,7 @@ function ssrManifestPlugin(config) {
66828
66039
  ? config.build.ssrManifest
66829
66040
  : '.vite/ssr-manifest.json',
66830
66041
  type: 'asset',
66831
- source: jsonStableStringify$1(ssrManifest, { space: 2 }),
66042
+ source: JSON.stringify(sortObjectKeys(ssrManifest), undefined, 2),
66832
66043
  });
66833
66044
  },
66834
66045
  };
@@ -66894,7 +66105,7 @@ function resolveBuildOptions(raw, logger, root) {
66894
66105
  const defaultBuildOptions = {
66895
66106
  outDir: 'dist',
66896
66107
  assetsDir: 'assets',
66897
- assetsInlineLimit: 4096,
66108
+ assetsInlineLimit: DEFAULT_ASSETS_INLINE_LIMIT,
66898
66109
  cssCodeSplit: !raw?.lib,
66899
66110
  sourcemap: false,
66900
66111
  rollupOptions: {},
@@ -66982,9 +66193,7 @@ async function resolveBuildPlugins(config) {
66982
66193
  completeSystemWrapPlugin(),
66983
66194
  ...(usePluginCommonjs ? [commonjs(options.commonjsOptions)] : []),
66984
66195
  dataURIPlugin(),
66985
- ...(await asyncFlatten(Array.isArray(rollupOptionsPlugins)
66986
- ? rollupOptionsPlugins
66987
- : [rollupOptionsPlugins])).filter(Boolean),
66196
+ ...(await asyncFlatten(arraify(rollupOptionsPlugins))).filter(Boolean),
66988
66197
  ...(config.isWorker ? [webWorkerPostPlugin()] : []),
66989
66198
  ],
66990
66199
  post: [
@@ -67830,7 +67039,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
67830
67039
  const configEnv = {
67831
67040
  mode,
67832
67041
  command,
67833
- isSsrBuild: !!config.build?.ssr,
67042
+ isSsrBuild: command === 'build' && !!config.build?.ssr,
67834
67043
  isPreview,
67835
67044
  };
67836
67045
  let { configFile } = config;
@@ -68005,7 +67214,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
68005
67214
  };
68006
67215
  const { publicDir } = config;
68007
67216
  const resolvedPublicDir = publicDir !== false && publicDir !== ''
68008
- ? path$o.resolve(resolvedRoot, typeof publicDir === 'string' ? publicDir : 'public')
67217
+ ? normalizePath$3(path$o.resolve(resolvedRoot, typeof publicDir === 'string' ? publicDir : 'public'))
68009
67218
  : '';
68010
67219
  const server = resolveServerOptions(resolvedRoot, config.server, logger);
68011
67220
  const ssr = resolveSSROptions(config.ssr, resolveOptions.preserveSymlinks);
@@ -68042,9 +67251,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
68042
67251
  };
68043
67252
  const resolvedWorkerPlugins = await resolvePlugins(workerResolved, workerPrePlugins, workerNormalPlugins, workerPostPlugins);
68044
67253
  // run configResolved hooks
68045
- createPluginHookUtils(resolvedWorkerPlugins)
67254
+ await Promise.all(createPluginHookUtils(resolvedWorkerPlugins)
68046
67255
  .getSortedPluginHooks('configResolved')
68047
- .map((hook) => hook(workerResolved));
67256
+ .map((hook) => hook(workerResolved)));
68048
67257
  return resolvedWorkerPlugins;
68049
67258
  };
68050
67259
  const resolvedWorkerOptions = {
@@ -68433,4 +67642,4 @@ function isDepsOptimizerEnabled(config, ssr) {
68433
67642
  (command === 'serve' && disabled === 'dev'));
68434
67643
  }
68435
67644
 
68436
- 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 };