vite 3.2.4 → 3.2.5

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();
@@ -37563,7 +37869,7 @@ function definePlugin(config) {
37563
37869
  .join('|') +
37564
37870
  // Mustn't be followed by a char that can be part of an identifier
37565
37871
  // or an assignment (but allow equality operators)
37566
- ')(?![\\p{L}\\p{N}_$]|\\s*?=[^=])', 'gu')
37872
+ ')(?:(?<=\\.)|(?![\\p{L}\\p{N}_$]|\\s*?=[^=]))', 'gu')
37567
37873
  : null;
37568
37874
  return [replacements, pattern];
37569
37875
  }
@@ -40667,11 +40973,8 @@ function extractImportPaths(code) {
40667
40973
  .replace(singlelineCommentsRE$1, '');
40668
40974
  let js = '';
40669
40975
  let m;
40976
+ importsRE.lastIndex = 0;
40670
40977
  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
40978
  js += `\nimport ${m[1]}`;
40676
40979
  }
40677
40980
  return js;
@@ -41595,7 +41898,8 @@ async function addManuallyIncludedOptimizeDeps(deps, config, ssr, extra = [], fi
41595
41898
  const resolve = config.createResolver({
41596
41899
  asSrc: false,
41597
41900
  scan: true,
41598
- ssrOptimizeCheck: ssr
41901
+ ssrOptimizeCheck: ssr,
41902
+ ssrConfig: config.ssr
41599
41903
  });
41600
41904
  for (const id of [...optimizeDepsInclude, ...extra]) {
41601
41905
  // normalize 'foo >bar` as 'foo > bar' to prevent same id being added
@@ -42706,6 +43010,7 @@ function buildHtmlPlugin(config) {
42706
43010
  const scriptNode = node.childNodes.pop();
42707
43011
  const cleanCode = stripLiteral(scriptNode.value);
42708
43012
  let match;
43013
+ inlineImportRE.lastIndex = 0;
42709
43014
  while ((match = inlineImportRE.exec(cleanCode))) {
42710
43015
  const { 1: url, index } = match;
42711
43016
  const startUrl = cleanCode.indexOf(url, index);
@@ -42989,6 +43294,7 @@ function buildHtmlPlugin(config) {
42989
43294
  // no use assets plugin because it will emit file
42990
43295
  let match;
42991
43296
  let s;
43297
+ inlineCSSRE$1.lastIndex = 0;
42992
43298
  while ((match = inlineCSSRE$1.exec(result))) {
42993
43299
  s || (s = new MagicString(result));
42994
43300
  const { 0: full, 1: scopedName } = match;
@@ -43786,7 +44092,7 @@ async function compileCSS(id, code, config, urlReplacer) {
43786
44092
  }));
43787
44093
  }
43788
44094
  if (isModule) {
43789
- postcssPlugins.unshift((await import('./dep-2e4b3d45.js').then(function (n) { return n.i; })).default({
44095
+ postcssPlugins.unshift((await import('./dep-4d50f047.js').then(function (n) { return n.i; })).default({
43790
44096
  ...modulesOptions,
43791
44097
  // TODO: convert null to undefined (`null` should be removed from `CSSModulesOptions.localsConvention`)
43792
44098
  localsConvention: modulesOptions?.localsConvention ?? undefined,
@@ -43796,9 +44102,9 @@ async function compileCSS(id, code, config, urlReplacer) {
43796
44102
  modulesOptions.getJSON(cssFileName, _modules, outputFileName);
43797
44103
  }
43798
44104
  },
43799
- async resolve(id) {
44105
+ async resolve(id, importer) {
43800
44106
  for (const key of getCssResolversKeys(atImportResolvers)) {
43801
- const resolved = await atImportResolvers[key](id);
44107
+ const resolved = await atImportResolvers[key](id, importer);
43802
44108
  if (resolved) {
43803
44109
  return path$o.resolve(resolved);
43804
44110
  }
@@ -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.
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-67e7f8ab.js';
3
+ import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-5605cfa4.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -702,7 +702,7 @@ cli
702
702
  filterDuplicateOptions(options);
703
703
  // output structure is preserved even after bundling so require()
704
704
  // is ok here
705
- const { createServer } = await import('./chunks/dep-67e7f8ab.js').then(function (n) { return n.D; });
705
+ const { createServer } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.D; });
706
706
  try {
707
707
  const server = await createServer({
708
708
  root,
@@ -750,7 +750,7 @@ cli
750
750
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
751
751
  .action(async (root, options) => {
752
752
  filterDuplicateOptions(options);
753
- const { build } = await import('./chunks/dep-67e7f8ab.js').then(function (n) { return n.C; });
753
+ const { build } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.C; });
754
754
  const buildOptions = cleanOptions(options);
755
755
  try {
756
756
  await build({
@@ -775,7 +775,7 @@ cli
775
775
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
776
776
  .action(async (root, options) => {
777
777
  filterDuplicateOptions(options);
778
- const { optimizeDeps } = await import('./chunks/dep-67e7f8ab.js').then(function (n) { return n.B; });
778
+ const { optimizeDeps } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.B; });
779
779
  try {
780
780
  const config = await resolveConfig({
781
781
  root,
@@ -800,7 +800,7 @@ cli
800
800
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
801
801
  .action(async (root, options) => {
802
802
  filterDuplicateOptions(options);
803
- const { preview } = await import('./chunks/dep-67e7f8ab.js').then(function (n) { return n.E; });
803
+ const { preview } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.E; });
804
804
  try {
805
805
  const server = await preview({
806
806
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
- var version = "3.2.4";
4
+ var version = "3.2.5";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -1,4 +1,4 @@
1
- export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-67e7f8ab.js';
1
+ export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5605cfa4.js';
2
2
  export { VERSION as version } from './constants.js';
3
3
  export { version as esbuildVersion } from 'esbuild';
4
4
  export { VERSION as rollupVersion } from 'rollup';
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
31
  var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
32
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
33
 
34
- var version = "3.2.4";
34
+ var version = "3.2.5";
35
35
 
36
36
  const VERSION = version;
37
37
  const VITE_PACKAGE_DIR = path$3.resolve(
package/index.cjs CHANGED
@@ -15,7 +15,8 @@ const asyncFunctions = [
15
15
  'resolveConfig',
16
16
  'optimizeDeps',
17
17
  'formatPostcssSourceMap',
18
- 'loadConfigFromFile'
18
+ 'loadConfigFromFile',
19
+ 'preprocessCSS'
19
20
  ]
20
21
  asyncFunctions.forEach((name) => {
21
22
  module.exports[name] = (...args) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -79,6 +79,7 @@
79
79
  "@rollup/plugin-typescript": "^8.5.0",
80
80
  "@rollup/pluginutils": "^4.2.1",
81
81
  "acorn": "^8.8.1",
82
+ "acorn-walk": "^8.2.0",
82
83
  "cac": "^6.7.14",
83
84
  "chokidar": "^3.5.3",
84
85
  "connect": "^3.7.0",
@@ -109,7 +110,7 @@
109
110
  "picomatch": "^2.3.1",
110
111
  "postcss-import": "^15.0.0",
111
112
  "postcss-load-config": "^4.0.1",
112
- "postcss-modules": "^5.0.0",
113
+ "postcss-modules": "^6.0.0",
113
114
  "resolve.exports": "^1.1.0",
114
115
  "sirv": "^2.0.2",
115
116
  "source-map-js": "^1.0.2",