vite 3.2.4 → 3.2.6

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.
@@ -13373,9 +13373,10 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13373
13373
  ]);
13374
13374
  }
13375
13375
  else {
13376
- map = resolvedOptions.sourcemap
13377
- ? JSON.parse(result.map)
13378
- : { mappings: '' };
13376
+ map =
13377
+ resolvedOptions.sourcemap && resolvedOptions.sourcemap !== 'inline'
13378
+ ? JSON.parse(result.map)
13379
+ : { mappings: '' };
13379
13380
  }
13380
13381
  if (Array.isArray(map.sources)) {
13381
13382
  map.sources = map.sources.map((it) => toUpperCaseDriveLetter(it));
@@ -32302,6 +32303,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
32302
32303
  // Urls added in CSS that is imported in JS end up like
32303
32304
  // var inlined = ".inlined{color:green;background:url(__VITE_ASSET__5aa0ddc0__)}\n";
32304
32305
  // In both cases, the wrapping should already be fine
32306
+ assetUrlRE.lastIndex = 0;
32305
32307
  while ((match = assetUrlRE.exec(code))) {
32306
32308
  s || (s = new MagicString(code));
32307
32309
  const [full, hash, postfix = ''] = match;
@@ -32318,6 +32320,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
32318
32320
  }
32319
32321
  // Replace __VITE_PUBLIC_ASSET__5aa0ddc0__ with absolute paths
32320
32322
  const publicAssetUrlMap = publicAssetUrlCache.get(config);
32323
+ publicAssetUrlRE.lastIndex = 0;
32321
32324
  while ((match = publicAssetUrlRE.exec(code))) {
32322
32325
  s || (s = new MagicString(code));
32323
32326
  const [full, hash] = match;
@@ -33391,6 +33394,7 @@ function webWorkerPlugin(config) {
33391
33394
  const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(outputOptions.format);
33392
33395
  let match;
33393
33396
  s = new MagicString(code);
33397
+ workerAssetUrlRE.lastIndex = 0;
33394
33398
  // Replace "__VITE_WORKER_ASSET__5aa0ddc0__" using relative paths
33395
33399
  const workerMap = workerCache.get(config.mainConfig || config);
33396
33400
  const { fileNameHash } = workerMap;
@@ -33903,18 +33907,21 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
33903
33907
  ? isOptimizable(resolved, depsOptimizer.options)
33904
33908
  : OPTIMIZABLE_ENTRY_RE.test(resolved);
33905
33909
  let exclude = depsOptimizer?.options.exclude;
33906
- let include = depsOptimizer?.options.exclude;
33910
+ let include = depsOptimizer?.options.include;
33907
33911
  if (options.ssrOptimizeCheck) {
33908
33912
  // we don't have the depsOptimizer
33909
33913
  exclude = options.ssrConfig?.optimizeDeps?.exclude;
33910
- include = options.ssrConfig?.optimizeDeps?.exclude;
33914
+ include = options.ssrConfig?.optimizeDeps?.include;
33911
33915
  }
33912
33916
  const skipOptimization = !isJsType ||
33913
33917
  importer?.includes('node_modules') ||
33914
33918
  exclude?.includes(pkgId) ||
33915
33919
  exclude?.includes(nestedPath) ||
33916
33920
  SPECIAL_QUERY_RE.test(resolved) ||
33917
- (!isBuild && ssr) ||
33921
+ // During dev SSR, we don't have a way to reload the module graph if
33922
+ // a non-optimized dep is found. So we need to skip optimization here.
33923
+ // The only optimized deps are the ones explicitly listed in the config.
33924
+ (!options.ssrOptimizeCheck && !isBuild && ssr) ||
33918
33925
  // Only optimize non-external CJS deps during SSR by default
33919
33926
  (ssr &&
33920
33927
  !isCJS &&
@@ -34950,6 +34957,305 @@ function throwOutdatedRequest(id) {
34950
34957
  throw err;
34951
34958
  }
34952
34959
 
34960
+ // AST walker module for Mozilla Parser API compatible trees
34961
+
34962
+ function makeTest(test) {
34963
+ if (typeof test === "string")
34964
+ { return function (type) { return type === test; } }
34965
+ else if (!test)
34966
+ { return function () { return true; } }
34967
+ else
34968
+ { return test }
34969
+ }
34970
+
34971
+ var Found = function Found(node, state) { this.node = node; this.state = state; };
34972
+
34973
+ // Find a node with a given start, end, and type (all are optional,
34974
+ // null can be used as wildcard). Returns a {node, state} object, or
34975
+ // undefined when it doesn't find a matching node.
34976
+ function findNodeAt(node, start, end, test, baseVisitor, state) {
34977
+ if (!baseVisitor) { baseVisitor = base; }
34978
+ test = makeTest(test);
34979
+ try {
34980
+ (function c(node, st, override) {
34981
+ var type = override || node.type;
34982
+ if ((start == null || node.start <= start) &&
34983
+ (end == null || node.end >= end))
34984
+ { baseVisitor[type](node, st, c); }
34985
+ if ((start == null || node.start === start) &&
34986
+ (end == null || node.end === end) &&
34987
+ test(type, node))
34988
+ { throw new Found(node, st) }
34989
+ })(node, state);
34990
+ } catch (e) {
34991
+ if (e instanceof Found) { return e }
34992
+ throw e
34993
+ }
34994
+ }
34995
+
34996
+ function skipThrough(node, st, c) { c(node, st); }
34997
+ function ignore(_node, _st, _c) {}
34998
+
34999
+ // Node walkers.
35000
+
35001
+ var base = {};
35002
+
35003
+ base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
35004
+ for (var i = 0, list = node.body; i < list.length; i += 1)
35005
+ {
35006
+ var stmt = list[i];
35007
+
35008
+ c(stmt, st, "Statement");
35009
+ }
35010
+ };
35011
+ base.Statement = skipThrough;
35012
+ base.EmptyStatement = ignore;
35013
+ base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
35014
+ function (node, st, c) { return c(node.expression, st, "Expression"); };
35015
+ base.IfStatement = function (node, st, c) {
35016
+ c(node.test, st, "Expression");
35017
+ c(node.consequent, st, "Statement");
35018
+ if (node.alternate) { c(node.alternate, st, "Statement"); }
35019
+ };
35020
+ base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
35021
+ base.BreakStatement = base.ContinueStatement = ignore;
35022
+ base.WithStatement = function (node, st, c) {
35023
+ c(node.object, st, "Expression");
35024
+ c(node.body, st, "Statement");
35025
+ };
35026
+ base.SwitchStatement = function (node, st, c) {
35027
+ c(node.discriminant, st, "Expression");
35028
+ for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
35029
+ var cs = list$1[i$1];
35030
+
35031
+ if (cs.test) { c(cs.test, st, "Expression"); }
35032
+ for (var i = 0, list = cs.consequent; i < list.length; i += 1)
35033
+ {
35034
+ var cons = list[i];
35035
+
35036
+ c(cons, st, "Statement");
35037
+ }
35038
+ }
35039
+ };
35040
+ base.SwitchCase = function (node, st, c) {
35041
+ if (node.test) { c(node.test, st, "Expression"); }
35042
+ for (var i = 0, list = node.consequent; i < list.length; i += 1)
35043
+ {
35044
+ var cons = list[i];
35045
+
35046
+ c(cons, st, "Statement");
35047
+ }
35048
+ };
35049
+ base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
35050
+ if (node.argument) { c(node.argument, st, "Expression"); }
35051
+ };
35052
+ base.ThrowStatement = base.SpreadElement =
35053
+ function (node, st, c) { return c(node.argument, st, "Expression"); };
35054
+ base.TryStatement = function (node, st, c) {
35055
+ c(node.block, st, "Statement");
35056
+ if (node.handler) { c(node.handler, st); }
35057
+ if (node.finalizer) { c(node.finalizer, st, "Statement"); }
35058
+ };
35059
+ base.CatchClause = function (node, st, c) {
35060
+ if (node.param) { c(node.param, st, "Pattern"); }
35061
+ c(node.body, st, "Statement");
35062
+ };
35063
+ base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
35064
+ c(node.test, st, "Expression");
35065
+ c(node.body, st, "Statement");
35066
+ };
35067
+ base.ForStatement = function (node, st, c) {
35068
+ if (node.init) { c(node.init, st, "ForInit"); }
35069
+ if (node.test) { c(node.test, st, "Expression"); }
35070
+ if (node.update) { c(node.update, st, "Expression"); }
35071
+ c(node.body, st, "Statement");
35072
+ };
35073
+ base.ForInStatement = base.ForOfStatement = function (node, st, c) {
35074
+ c(node.left, st, "ForInit");
35075
+ c(node.right, st, "Expression");
35076
+ c(node.body, st, "Statement");
35077
+ };
35078
+ base.ForInit = function (node, st, c) {
35079
+ if (node.type === "VariableDeclaration") { c(node, st); }
35080
+ else { c(node, st, "Expression"); }
35081
+ };
35082
+ base.DebuggerStatement = ignore;
35083
+
35084
+ base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
35085
+ base.VariableDeclaration = function (node, st, c) {
35086
+ for (var i = 0, list = node.declarations; i < list.length; i += 1)
35087
+ {
35088
+ var decl = list[i];
35089
+
35090
+ c(decl, st);
35091
+ }
35092
+ };
35093
+ base.VariableDeclarator = function (node, st, c) {
35094
+ c(node.id, st, "Pattern");
35095
+ if (node.init) { c(node.init, st, "Expression"); }
35096
+ };
35097
+
35098
+ base.Function = function (node, st, c) {
35099
+ if (node.id) { c(node.id, st, "Pattern"); }
35100
+ for (var i = 0, list = node.params; i < list.length; i += 1)
35101
+ {
35102
+ var param = list[i];
35103
+
35104
+ c(param, st, "Pattern");
35105
+ }
35106
+ c(node.body, st, node.expression ? "Expression" : "Statement");
35107
+ };
35108
+
35109
+ base.Pattern = function (node, st, c) {
35110
+ if (node.type === "Identifier")
35111
+ { c(node, st, "VariablePattern"); }
35112
+ else if (node.type === "MemberExpression")
35113
+ { c(node, st, "MemberPattern"); }
35114
+ else
35115
+ { c(node, st); }
35116
+ };
35117
+ base.VariablePattern = ignore;
35118
+ base.MemberPattern = skipThrough;
35119
+ base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
35120
+ base.ArrayPattern = function (node, st, c) {
35121
+ for (var i = 0, list = node.elements; i < list.length; i += 1) {
35122
+ var elt = list[i];
35123
+
35124
+ if (elt) { c(elt, st, "Pattern"); }
35125
+ }
35126
+ };
35127
+ base.ObjectPattern = function (node, st, c) {
35128
+ for (var i = 0, list = node.properties; i < list.length; i += 1) {
35129
+ var prop = list[i];
35130
+
35131
+ if (prop.type === "Property") {
35132
+ if (prop.computed) { c(prop.key, st, "Expression"); }
35133
+ c(prop.value, st, "Pattern");
35134
+ } else if (prop.type === "RestElement") {
35135
+ c(prop.argument, st, "Pattern");
35136
+ }
35137
+ }
35138
+ };
35139
+
35140
+ base.Expression = skipThrough;
35141
+ base.ThisExpression = base.Super = base.MetaProperty = ignore;
35142
+ base.ArrayExpression = function (node, st, c) {
35143
+ for (var i = 0, list = node.elements; i < list.length; i += 1) {
35144
+ var elt = list[i];
35145
+
35146
+ if (elt) { c(elt, st, "Expression"); }
35147
+ }
35148
+ };
35149
+ base.ObjectExpression = function (node, st, c) {
35150
+ for (var i = 0, list = node.properties; i < list.length; i += 1)
35151
+ {
35152
+ var prop = list[i];
35153
+
35154
+ c(prop, st);
35155
+ }
35156
+ };
35157
+ base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
35158
+ base.SequenceExpression = function (node, st, c) {
35159
+ for (var i = 0, list = node.expressions; i < list.length; i += 1)
35160
+ {
35161
+ var expr = list[i];
35162
+
35163
+ c(expr, st, "Expression");
35164
+ }
35165
+ };
35166
+ base.TemplateLiteral = function (node, st, c) {
35167
+ for (var i = 0, list = node.quasis; i < list.length; i += 1)
35168
+ {
35169
+ var quasi = list[i];
35170
+
35171
+ c(quasi, st);
35172
+ }
35173
+
35174
+ for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
35175
+ {
35176
+ var expr = list$1[i$1];
35177
+
35178
+ c(expr, st, "Expression");
35179
+ }
35180
+ };
35181
+ base.TemplateElement = ignore;
35182
+ base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
35183
+ c(node.argument, st, "Expression");
35184
+ };
35185
+ base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
35186
+ c(node.left, st, "Expression");
35187
+ c(node.right, st, "Expression");
35188
+ };
35189
+ base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
35190
+ c(node.left, st, "Pattern");
35191
+ c(node.right, st, "Expression");
35192
+ };
35193
+ base.ConditionalExpression = function (node, st, c) {
35194
+ c(node.test, st, "Expression");
35195
+ c(node.consequent, st, "Expression");
35196
+ c(node.alternate, st, "Expression");
35197
+ };
35198
+ base.NewExpression = base.CallExpression = function (node, st, c) {
35199
+ c(node.callee, st, "Expression");
35200
+ if (node.arguments)
35201
+ { for (var i = 0, list = node.arguments; i < list.length; i += 1)
35202
+ {
35203
+ var arg = list[i];
35204
+
35205
+ c(arg, st, "Expression");
35206
+ } }
35207
+ };
35208
+ base.MemberExpression = function (node, st, c) {
35209
+ c(node.object, st, "Expression");
35210
+ if (node.computed) { c(node.property, st, "Expression"); }
35211
+ };
35212
+ base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
35213
+ if (node.declaration)
35214
+ { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
35215
+ if (node.source) { c(node.source, st, "Expression"); }
35216
+ };
35217
+ base.ExportAllDeclaration = function (node, st, c) {
35218
+ if (node.exported)
35219
+ { c(node.exported, st); }
35220
+ c(node.source, st, "Expression");
35221
+ };
35222
+ base.ImportDeclaration = function (node, st, c) {
35223
+ for (var i = 0, list = node.specifiers; i < list.length; i += 1)
35224
+ {
35225
+ var spec = list[i];
35226
+
35227
+ c(spec, st);
35228
+ }
35229
+ c(node.source, st, "Expression");
35230
+ };
35231
+ base.ImportExpression = function (node, st, c) {
35232
+ c(node.source, st, "Expression");
35233
+ };
35234
+ base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
35235
+
35236
+ base.TaggedTemplateExpression = function (node, st, c) {
35237
+ c(node.tag, st, "Expression");
35238
+ c(node.quasi, st, "Expression");
35239
+ };
35240
+ base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
35241
+ base.Class = function (node, st, c) {
35242
+ if (node.id) { c(node.id, st, "Pattern"); }
35243
+ if (node.superClass) { c(node.superClass, st, "Expression"); }
35244
+ c(node.body, st);
35245
+ };
35246
+ base.ClassBody = function (node, st, c) {
35247
+ for (var i = 0, list = node.body; i < list.length; i += 1)
35248
+ {
35249
+ var elt = list[i];
35250
+
35251
+ c(elt, st);
35252
+ }
35253
+ };
35254
+ base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
35255
+ if (node.computed) { c(node.key, st, "Expression"); }
35256
+ if (node.value) { c(node.value, st, "Expression"); }
35257
+ };
35258
+
34953
35259
  const { isMatch: isMatch$1, scan } = micromatch_1;
34954
35260
  function getAffectedGlobModules(file, server) {
34955
35261
  const modules = [];
@@ -35044,14 +35350,10 @@ async function parseImportGlob(code, importer, root, resolveId) {
35044
35350
  throw _e;
35045
35351
  }
35046
35352
  }
35047
- if (ast.type === 'SequenceExpression')
35048
- ast = ast.expressions[0];
35049
- // immediate property access, call expression is nested
35050
- // import.meta.glob(...)['prop']
35051
- if (ast.type === 'MemberExpression')
35052
- ast = ast.object;
35053
- if (ast.type !== 'CallExpression')
35353
+ const found = findNodeAt(ast, start, undefined, 'CallExpression');
35354
+ if (!found)
35054
35355
  throw err(`Expect CallExpression, got ${ast.type}`);
35356
+ ast = found.node;
35055
35357
  if (ast.arguments.length < 1 || ast.arguments.length > 2)
35056
35358
  throw err(`Expected 1-2 arguments, but got ${ast.arguments.length}`);
35057
35359
  const arg1 = ast.arguments[0];
@@ -35254,7 +35556,11 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
35254
35556
  }
35255
35557
  });
35256
35558
  files.forEach((i) => matchedFiles.add(i));
35257
- const replacement = `/* #__PURE__ */ Object.assign({${objectProps.join(',')}})`;
35559
+ const originalLineBreakCount = code.slice(start, end).match(/\n/g)?.length ?? 0;
35560
+ const lineBreaks = originalLineBreakCount > 0
35561
+ ? '\n'.repeat(originalLineBreakCount)
35562
+ : '';
35563
+ const replacement = `/* #__PURE__ */ Object.assign({${objectProps.join(',')}${lineBreaks}})`;
35258
35564
  s.overwrite(start, end, replacement);
35259
35565
  return staticImports;
35260
35566
  }))).flat();
@@ -36293,6 +36599,83 @@ function sirv (dir, opts={}) {
36293
36599
  };
36294
36600
  }
36295
36601
 
36602
+ /*!
36603
+ * escape-html
36604
+ * Copyright(c) 2012-2013 TJ Holowaychuk
36605
+ * Copyright(c) 2015 Andreas Lubbe
36606
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
36607
+ * MIT Licensed
36608
+ */
36609
+
36610
+ /**
36611
+ * Module variables.
36612
+ * @private
36613
+ */
36614
+
36615
+ var matchHtmlRegExp = /["'&<>]/;
36616
+
36617
+ /**
36618
+ * Module exports.
36619
+ * @public
36620
+ */
36621
+
36622
+ var escapeHtml_1 = escapeHtml$1;
36623
+
36624
+ /**
36625
+ * Escape special characters in the given string of html.
36626
+ *
36627
+ * @param {string} string The string to escape for inserting into HTML
36628
+ * @return {string}
36629
+ * @public
36630
+ */
36631
+
36632
+ function escapeHtml$1(string) {
36633
+ var str = '' + string;
36634
+ var match = matchHtmlRegExp.exec(str);
36635
+
36636
+ if (!match) {
36637
+ return str;
36638
+ }
36639
+
36640
+ var escape;
36641
+ var html = '';
36642
+ var index = 0;
36643
+ var lastIndex = 0;
36644
+
36645
+ for (index = match.index; index < str.length; index++) {
36646
+ switch (str.charCodeAt(index)) {
36647
+ case 34: // "
36648
+ escape = '&quot;';
36649
+ break;
36650
+ case 38: // &
36651
+ escape = '&amp;';
36652
+ break;
36653
+ case 39: // '
36654
+ escape = '&#39;';
36655
+ break;
36656
+ case 60: // <
36657
+ escape = '&lt;';
36658
+ break;
36659
+ case 62: // >
36660
+ escape = '&gt;';
36661
+ break;
36662
+ default:
36663
+ continue;
36664
+ }
36665
+
36666
+ if (lastIndex !== index) {
36667
+ html += str.substring(lastIndex, index);
36668
+ }
36669
+
36670
+ lastIndex = index + 1;
36671
+ html += escape;
36672
+ }
36673
+
36674
+ return lastIndex !== index
36675
+ ? html + str.substring(lastIndex, index)
36676
+ : html;
36677
+ }
36678
+
36296
36679
  const sirvOptions = (headers) => {
36297
36680
  return {
36298
36681
  dev: true,
@@ -36442,7 +36825,7 @@ function renderRestrictedErrorHTML(msg) {
36442
36825
  return html `
36443
36826
  <body>
36444
36827
  <h1>403 Restricted</h1>
36445
- <p>${msg.replace(/\n/g, '<br/>')}</p>
36828
+ <p>${escapeHtml_1(msg).replace(/\n/g, '<br/>')}</p>
36446
36829
  <style>
36447
36830
  body {
36448
36831
  padding: 1em 2em;
@@ -37563,7 +37946,7 @@ function definePlugin(config) {
37563
37946
  .join('|') +
37564
37947
  // Mustn't be followed by a char that can be part of an identifier
37565
37948
  // or an assignment (but allow equality operators)
37566
- ')(?![\\p{L}\\p{N}_$]|\\s*?=[^=])', 'gu')
37949
+ ')(?:(?<=\\.)|(?![\\p{L}\\p{N}_$]|\\s*?=[^=]))', 'gu')
37567
37950
  : null;
37568
37951
  return [replacements, pattern];
37569
37952
  }
@@ -40667,11 +41050,8 @@ function extractImportPaths(code) {
40667
41050
  .replace(singlelineCommentsRE$1, '');
40668
41051
  let js = '';
40669
41052
  let m;
41053
+ importsRE.lastIndex = 0;
40670
41054
  while ((m = importsRE.exec(code)) != null) {
40671
- // This is necessary to avoid infinite loops with zero-width matches
40672
- if (m.index === importsRE.lastIndex) {
40673
- importsRE.lastIndex++;
40674
- }
40675
41055
  js += `\nimport ${m[1]}`;
40676
41056
  }
40677
41057
  return js;
@@ -41595,7 +41975,8 @@ async function addManuallyIncludedOptimizeDeps(deps, config, ssr, extra = [], fi
41595
41975
  const resolve = config.createResolver({
41596
41976
  asSrc: false,
41597
41977
  scan: true,
41598
- ssrOptimizeCheck: ssr
41978
+ ssrOptimizeCheck: ssr,
41979
+ ssrConfig: config.ssr
41599
41980
  });
41600
41981
  for (const id of [...optimizeDepsInclude, ...extra]) {
41601
41982
  // normalize 'foo >bar` as 'foo > bar' to prevent same id being added
@@ -42706,6 +43087,7 @@ function buildHtmlPlugin(config) {
42706
43087
  const scriptNode = node.childNodes.pop();
42707
43088
  const cleanCode = stripLiteral(scriptNode.value);
42708
43089
  let match;
43090
+ inlineImportRE.lastIndex = 0;
42709
43091
  while ((match = inlineImportRE.exec(cleanCode))) {
42710
43092
  const { 1: url, index } = match;
42711
43093
  const startUrl = cleanCode.indexOf(url, index);
@@ -42989,6 +43371,7 @@ function buildHtmlPlugin(config) {
42989
43371
  // no use assets plugin because it will emit file
42990
43372
  let match;
42991
43373
  let s;
43374
+ inlineCSSRE$1.lastIndex = 0;
42992
43375
  while ((match = inlineCSSRE$1.exec(result))) {
42993
43376
  s || (s = new MagicString(result));
42994
43377
  const { 0: full, 1: scopedName } = match;
@@ -43786,7 +44169,7 @@ async function compileCSS(id, code, config, urlReplacer) {
43786
44169
  }));
43787
44170
  }
43788
44171
  if (isModule) {
43789
- postcssPlugins.unshift((await import('./dep-2e4b3d45.js').then(function (n) { return n.i; })).default({
44172
+ postcssPlugins.unshift((await import('./dep-ba8d9a4e.js').then(function (n) { return n.i; })).default({
43790
44173
  ...modulesOptions,
43791
44174
  // TODO: convert null to undefined (`null` should be removed from `CSSModulesOptions.localsConvention`)
43792
44175
  localsConvention: modulesOptions?.localsConvention ?? undefined,
@@ -43796,9 +44179,9 @@ async function compileCSS(id, code, config, urlReplacer) {
43796
44179
  modulesOptions.getJSON(cssFileName, _modules, outputFileName);
43797
44180
  }
43798
44181
  },
43799
- async resolve(id) {
44182
+ async resolve(id, importer) {
43800
44183
  for (const key of getCssResolversKeys(atImportResolvers)) {
43801
- const resolved = await atImportResolvers[key](id);
44184
+ const resolved = await atImportResolvers[key](id, importer);
43802
44185
  if (resolved) {
43803
44186
  return path$o.resolve(resolved);
43804
44187
  }
@@ -46665,83 +47048,6 @@ function encodeUrl$1 (url) {
46665
47048
  .replace(ENCODE_CHARS_REGEXP, encodeURI)
46666
47049
  }
46667
47050
 
46668
- /*!
46669
- * escape-html
46670
- * Copyright(c) 2012-2013 TJ Holowaychuk
46671
- * Copyright(c) 2015 Andreas Lubbe
46672
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
46673
- * MIT Licensed
46674
- */
46675
-
46676
- /**
46677
- * Module variables.
46678
- * @private
46679
- */
46680
-
46681
- var matchHtmlRegExp = /["'&<>]/;
46682
-
46683
- /**
46684
- * Module exports.
46685
- * @public
46686
- */
46687
-
46688
- var escapeHtml_1 = escapeHtml$1;
46689
-
46690
- /**
46691
- * Escape special characters in the given string of html.
46692
- *
46693
- * @param {string} string The string to escape for inserting into HTML
46694
- * @return {string}
46695
- * @public
46696
- */
46697
-
46698
- function escapeHtml$1(string) {
46699
- var str = '' + string;
46700
- var match = matchHtmlRegExp.exec(str);
46701
-
46702
- if (!match) {
46703
- return str;
46704
- }
46705
-
46706
- var escape;
46707
- var html = '';
46708
- var index = 0;
46709
- var lastIndex = 0;
46710
-
46711
- for (index = match.index; index < str.length; index++) {
46712
- switch (str.charCodeAt(index)) {
46713
- case 34: // "
46714
- escape = '&quot;';
46715
- break;
46716
- case 38: // &
46717
- escape = '&amp;';
46718
- break;
46719
- case 39: // '
46720
- escape = '&#39;';
46721
- break;
46722
- case 60: // <
46723
- escape = '&lt;';
46724
- break;
46725
- case 62: // >
46726
- escape = '&gt;';
46727
- break;
46728
- default:
46729
- continue;
46730
- }
46731
-
46732
- if (lastIndex !== index) {
46733
- html += str.substring(lastIndex, index);
46734
- }
46735
-
46736
- lastIndex = index + 1;
46737
- html += escape;
46738
- }
46739
-
46740
- return lastIndex !== index
46741
- ? html + str.substring(lastIndex, index)
46742
- : html;
46743
- }
46744
-
46745
47051
  var onFinished$2 = {exports: {}};
46746
47052
 
46747
47053
  /*!
@@ -59946,16 +60252,12 @@ function htmlFallbackMiddleware(root, spaFallback) {
59946
60252
  rewrites: [
59947
60253
  {
59948
60254
  from: /\/$/,
59949
- to({ parsedUrl }) {
60255
+ to({ parsedUrl, request }) {
59950
60256
  const rewritten = decodeURIComponent(parsedUrl.pathname) + 'index.html';
59951
60257
  if (fs$l.existsSync(path$o.join(root, rewritten))) {
59952
60258
  return rewritten;
59953
60259
  }
59954
- else {
59955
- if (spaFallback) {
59956
- return `/index.html`;
59957
- }
59958
- }
60260
+ return spaFallback ? `/index.html` : request.url;
59959
60261
  }
59960
60262
  }
59961
60263
  ]
@@ -62345,11 +62647,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62345
62647
  configFileDependencies = loadResult.dependencies;
62346
62648
  }
62347
62649
  }
62348
- // Define logger
62349
- const logger = createLogger(config.logLevel, {
62350
- allowClearScreen: config.clearScreen,
62351
- customLogger: config.customLogger
62352
- });
62353
62650
  // user config may provide an alternative mode. But --mode has a higher priority
62354
62651
  mode = inlineConfig.mode || config.mode || mode;
62355
62652
  configEnv.mode = mode;
@@ -62385,6 +62682,11 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62385
62682
  config.build ?? (config.build = {});
62386
62683
  config.build.commonjsOptions = { include: [] };
62387
62684
  }
62685
+ // Define logger
62686
+ const logger = createLogger(config.logLevel, {
62687
+ allowClearScreen: config.clearScreen,
62688
+ customLogger: config.customLogger
62689
+ });
62388
62690
  // resolve root
62389
62691
  const resolvedRoot = normalizePath$3(config.root ? path$o.resolve(config.root) : process.cwd());
62390
62692
  const clientAlias = [
@@ -62439,7 +62741,8 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62439
62741
  : pkgPath
62440
62742
  ? path$o.join(path$o.dirname(pkgPath), `node_modules/.vite`)
62441
62743
  : path$o.join(resolvedRoot, `.vite`);
62442
- const assetsFilter = config.assetsInclude
62744
+ const assetsFilter = config.assetsInclude &&
62745
+ (!(config.assetsInclude instanceof Array) || config.assetsInclude.length)
62443
62746
  ? createFilter(config.assetsInclude)
62444
62747
  : () => false;
62445
62748
  // create an internal resolver to be used in special scenarios, e.g.