vite 5.4.2 → 5.4.4

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-BzOvws4Y.js';
1
+ import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-BEhTnQAI.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -18326,8 +18326,8 @@ function pattern2regex(resolvedPattern, allowJs) {
18326
18326
  function replaceTokens(tsconfig, configDir) {
18327
18327
  return JSON.parse(
18328
18328
  JSON.stringify(tsconfig)
18329
- // replace ${configDir}, accounting for rebaseRelative emitted ../${configDir}
18330
- .replaceAll(/"(?:\.\.\/)*\${configDir}/g, `"${native2posix(configDir)}`)
18329
+ // replace ${configDir}
18330
+ .replaceAll(/"\${configDir}/g, `"${native2posix(configDir)}`)
18331
18331
  );
18332
18332
  }
18333
18333
 
@@ -18921,7 +18921,7 @@ function rebaseRelative(key, value, prependPath) {
18921
18921
  * @returns {string}
18922
18922
  */
18923
18923
  function rebasePath(value, prependPath) {
18924
- if (path$n.isAbsolute(value)) {
18924
+ if (path$n.isAbsolute(value) || value.startsWith('${configDir}')) {
18925
18925
  return value;
18926
18926
  } else {
18927
18927
  // relative paths use posix syntax in tsconfig
@@ -20306,7 +20306,8 @@ function assetPlugin(config) {
20306
20306
  code: `export default ${JSON.stringify(encodeURIPath(url))}`,
20307
20307
  // Force rollup to keep this module from being shared between other entry points if it's an entrypoint.
20308
20308
  // If the resulting chunk is empty, it will be removed in generateBundle.
20309
- moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false
20309
+ moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false,
20310
+ meta: config.command === "build" ? { "vite:asset": true } : void 0
20310
20311
  };
20311
20312
  },
20312
20313
  renderChunk(code, chunk, opts) {
@@ -20323,7 +20324,7 @@ function assetPlugin(config) {
20323
20324
  generateBundle(_, bundle) {
20324
20325
  for (const file in bundle) {
20325
20326
  const chunk = bundle[file];
20326
- if (chunk.type === "chunk" && chunk.isEntry && chunk.moduleIds.length === 1 && config.assetsInclude(chunk.moduleIds[0])) {
20327
+ if (chunk.type === "chunk" && chunk.isEntry && chunk.moduleIds.length === 1 && config.assetsInclude(chunk.moduleIds[0]) && this.getModuleInfo(chunk.moduleIds[0])?.meta["vite:asset"]) {
20327
20328
  delete bundle[file];
20328
20329
  }
20329
20330
  }
@@ -22768,7 +22769,12 @@ const util = require$$0$5;
22768
22769
  const braces$1 = braces_1;
22769
22770
  const picomatch$2 = picomatch$3;
22770
22771
  const utils$b = utils$k;
22771
- const isEmptyString = val => val === '' || val === './';
22772
+
22773
+ const isEmptyString = v => v === '' || v === './';
22774
+ const hasBraces = v => {
22775
+ const index = v.indexOf('{');
22776
+ return index > -1 && v.indexOf('}', index) > -1;
22777
+ };
22772
22778
 
22773
22779
  /**
22774
22780
  * Returns an array of strings that match one or more glob patterns.
@@ -23209,7 +23215,7 @@ micromatch$1.parse = (patterns, options) => {
23209
23215
 
23210
23216
  micromatch$1.braces = (pattern, options) => {
23211
23217
  if (typeof pattern !== 'string') throw new TypeError('Expected a string');
23212
- if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
23218
+ if ((options && options.nobrace === true) || !hasBraces(pattern)) {
23213
23219
  return [pattern];
23214
23220
  }
23215
23221
  return braces$1(pattern, options);
@@ -23228,6 +23234,8 @@ micromatch$1.braceExpand = (pattern, options) => {
23228
23234
  * Expose micromatch
23229
23235
  */
23230
23236
 
23237
+ // exposed for tests
23238
+ micromatch$1.hasBraces = hasBraces;
23231
23239
  var micromatch_1 = micromatch$1;
23232
23240
 
23233
23241
  var micromatch$2 = /*@__PURE__*/getDefaultExportFromCjs(micromatch_1);
@@ -35041,6 +35049,9 @@ function nodeIsElement(node) {
35041
35049
  return node.nodeName[0] !== "#";
35042
35050
  }
35043
35051
  function traverseNodes(node, visitor) {
35052
+ if (node.nodeName === "template") {
35053
+ node = node.content;
35054
+ }
35044
35055
  visitor(node);
35045
35056
  if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") {
35046
35057
  node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
@@ -36633,14 +36644,23 @@ function createCSSResolvers(config) {
36633
36644
  }));
36634
36645
  },
36635
36646
  get sass() {
36636
- return sassResolve || (sassResolve = config.createResolver({
36637
- extensions: [".scss", ".sass", ".css"],
36638
- mainFields: ["sass", "style"],
36639
- conditions: ["sass", "style"],
36640
- tryIndex: true,
36641
- tryPrefix: "_",
36642
- preferRelative: true
36643
- }));
36647
+ if (!sassResolve) {
36648
+ const resolver = config.createResolver({
36649
+ extensions: [".scss", ".sass", ".css"],
36650
+ mainFields: ["sass", "style"],
36651
+ conditions: ["sass", "style"],
36652
+ tryIndex: true,
36653
+ tryPrefix: "_",
36654
+ preferRelative: true
36655
+ });
36656
+ sassResolve = async (...args) => {
36657
+ if (args[0].startsWith("file://")) {
36658
+ args[0] = fileURLToPath(args[0]);
36659
+ }
36660
+ return resolver(...args);
36661
+ };
36662
+ }
36663
+ return sassResolve;
36644
36664
  },
36645
36665
  get less() {
36646
36666
  return lessResolve || (lessResolve = config.createResolver({
@@ -36933,8 +36953,8 @@ function createCachedImport(imp) {
36933
36953
  return cached;
36934
36954
  };
36935
36955
  }
36936
- const importPostcssImport = createCachedImport(() => import('./dep-CHbHjMYU.js').then(function (n) { return n.i; }));
36937
- const importPostcssModules = createCachedImport(() => import('./dep-B8yndt7W.js').then(function (n) { return n.i; }));
36956
+ const importPostcssImport = createCachedImport(() => import('./dep-CapdzPRN.js').then(function (n) { return n.i; }));
36957
+ const importPostcssModules = createCachedImport(() => import('./dep-B8D18a-R.js').then(function (n) { return n.i; }));
36938
36958
  const importPostcss = createCachedImport(() => import('postcss'));
36939
36959
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
36940
36960
  let alwaysFakeWorkerWorkerControllerCache;
@@ -37281,7 +37301,7 @@ function fixScssBugImportValue(data) {
37281
37301
  }
37282
37302
  return data;
37283
37303
  }
37284
- const makeScssWorker = (resolvers, alias, maxWorkers) => {
37304
+ const makeScssWorker = (resolvers, alias, maxWorkers, packageName) => {
37285
37305
  const internalImporter = async (url, importer, filename) => {
37286
37306
  importer = cleanScssBugUrl(importer);
37287
37307
  const resolved = await resolvers.sass(url, importer);
@@ -37294,6 +37314,9 @@ const makeScssWorker = (resolvers, alias, maxWorkers) => {
37294
37314
  "$",
37295
37315
  resolvers.sass
37296
37316
  );
37317
+ if (packageName === "sass-embedded") {
37318
+ return data;
37319
+ }
37297
37320
  return fixScssBugImportValue(data);
37298
37321
  } catch (data) {
37299
37322
  return data;
@@ -37490,7 +37513,12 @@ const scssProcessor = (maxWorkers) => {
37490
37513
  if (!workerMap.has(options.alias)) {
37491
37514
  workerMap.set(
37492
37515
  options.alias,
37493
- api === "modern-compiler" ? makeModernCompilerScssWorker(resolvers, options.alias) : api === "modern" ? makeModernScssWorker(resolvers, options.alias, maxWorkers) : makeScssWorker(resolvers, options.alias, maxWorkers)
37516
+ api === "modern-compiler" ? makeModernCompilerScssWorker(resolvers, options.alias) : api === "modern" ? makeModernScssWorker(resolvers, options.alias, maxWorkers) : makeScssWorker(
37517
+ resolvers,
37518
+ options.alias,
37519
+ maxWorkers,
37520
+ sassPackage.name
37521
+ )
37494
37522
  );
37495
37523
  }
37496
37524
  const worker = workerMap.get(options.alias);
@@ -37512,6 +37540,11 @@ const scssProcessor = (maxWorkers) => {
37512
37540
  );
37513
37541
  const deps = result.stats.includedFiles.map((f) => cleanScssBugUrl(f));
37514
37542
  const map2 = result.map ? JSON.parse(result.map.toString()) : void 0;
37543
+ if (map2) {
37544
+ map2.sources = map2.sources.map(
37545
+ (url) => url.startsWith("file://") ? normalizePath$3(fileURLToPath(url)) : url
37546
+ );
37547
+ }
37515
37548
  return {
37516
37549
  code: result.css.toString(),
37517
37550
  map: map2,
@@ -49519,7 +49552,8 @@ const commentRE = /<!--.*?-->/gs;
49519
49552
  const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
49520
49553
  const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
49521
49554
  const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
49522
- const contextRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
49555
+ const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
49556
+ const svelteModuleRE = /\smodule\b/i;
49523
49557
  function esbuildScanPlugin(config, container, depImports, missing, entries) {
49524
49558
  const seen = /* @__PURE__ */ new Map();
49525
49559
  const resolve = async (id, importer, options) => {
@@ -49650,12 +49684,21 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
49650
49684
  };
49651
49685
  }
49652
49686
  const virtualModulePath = JSON.stringify(virtualModulePrefix + key);
49653
- const contextMatch = contextRE.exec(openTag);
49654
- const context = contextMatch && (contextMatch[1] || contextMatch[2] || contextMatch[3]);
49655
- if (p.endsWith(".svelte") && context !== "module") {
49656
- js += `import ${virtualModulePath}
49687
+ let addedImport = false;
49688
+ if (p.endsWith(".svelte")) {
49689
+ let isModule = svelteModuleRE.test(openTag);
49690
+ if (!isModule) {
49691
+ const contextMatch = svelteScriptModuleRE.exec(openTag);
49692
+ const context = contextMatch && (contextMatch[1] || contextMatch[2] || contextMatch[3]);
49693
+ isModule = context === "module";
49694
+ }
49695
+ if (!isModule) {
49696
+ addedImport = true;
49697
+ js += `import ${virtualModulePath}
49657
49698
  `;
49658
- } else {
49699
+ }
49700
+ }
49701
+ if (!addedImport) {
49659
49702
  js += `export * from ${virtualModulePath}
49660
49703
  `;
49661
49704
  }
@@ -51531,7 +51574,8 @@ function servePublicMiddleware(server, publicFiles) {
51531
51574
  return normalizePath$3(filePath);
51532
51575
  };
51533
51576
  return function viteServePublicMiddleware(req, res, next) {
51534
- if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url)) {
51577
+ if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed
51578
+ urlRE.test(req.url)) {
51535
51579
  return next();
51536
51580
  }
51537
51581
  serve(req, res, next);
@@ -54268,14 +54312,14 @@ Use --emptyOutDir to override.
54268
54312
  }
54269
54313
  return true;
54270
54314
  }
54271
- function resolveChokidarOptions(config, options, resolvedOutDirs, emptyOutDir) {
54315
+ function resolveChokidarOptions(options, resolvedOutDirs, emptyOutDir, cacheDir) {
54272
54316
  const { ignored: ignoredList, ...otherOptions } = options ?? {};
54273
54317
  const ignored = [
54274
54318
  "**/.git/**",
54275
54319
  "**/node_modules/**",
54276
54320
  "**/test-results/**",
54277
54321
  // Playwright
54278
- glob.escapePath(config.cacheDir) + "/**",
54322
+ glob.escapePath(cacheDir) + "/**",
54279
54323
  ...arraify(ignoredList || [])
54280
54324
  ];
54281
54325
  if (emptyOutDir) {
@@ -61681,7 +61725,7 @@ function cachedTransformMiddleware(server) {
61681
61725
  const ifNoneMatch = req.headers["if-none-match"];
61682
61726
  if (ifNoneMatch) {
61683
61727
  const moduleByEtag = server.moduleGraph.getModuleByEtag(ifNoneMatch);
61684
- if (moduleByEtag?.transformResult?.etag === ifNoneMatch) {
61728
+ if (moduleByEtag?.transformResult?.etag === ifNoneMatch && moduleByEtag?.url === req.url) {
61685
61729
  const maybeMixedEtag = isCSSRequest(req.url);
61686
61730
  if (!maybeMixedEtag) {
61687
61731
  debugCache?.(`[304] ${prettifyUrl(req.url, server.config.root)}`);
@@ -62666,13 +62710,13 @@ async function _createServer(inlineConfig = {}, options) {
62666
62710
  resolvedOutDirs
62667
62711
  );
62668
62712
  const resolvedWatchOptions = resolveChokidarOptions(
62669
- config,
62670
62713
  {
62671
62714
  disableGlobbing: true,
62672
62715
  ...serverConfig.watch
62673
62716
  },
62674
62717
  resolvedOutDirs,
62675
- emptyOutDir
62718
+ emptyOutDir,
62719
+ config.cacheDir
62676
62720
  );
62677
62721
  const middlewares = connect$1();
62678
62722
  const httpServer = middlewareMode ? null : await resolveHttpServer(serverConfig, middlewares, httpsOptions);
@@ -63246,14 +63290,14 @@ function setupOnCrawlEnd(onCrawlEnd) {
63246
63290
  if (ignoredId) {
63247
63291
  seenIds.add(ignoredId);
63248
63292
  markIdAsDone(ignoredId);
63293
+ } else {
63294
+ checkIfCrawlEndAfterTimeout();
63249
63295
  }
63250
63296
  return onCrawlEndPromiseWithResolvers.promise;
63251
63297
  }
63252
63298
  function markIdAsDone(id) {
63253
- if (registeredIds.has(id)) {
63254
- registeredIds.delete(id);
63255
- checkIfCrawlEndAfterTimeout();
63256
- }
63299
+ registeredIds.delete(id);
63300
+ checkIfCrawlEndAfterTimeout();
63257
63301
  }
63258
63302
  function checkIfCrawlEndAfterTimeout() {
63259
63303
  if (cancelled || registeredIds.size > 0) return;
@@ -64435,7 +64479,7 @@ function preload(baseModule, deps, importerUrl) {
64435
64479
  "meta[property=csp-nonce]"
64436
64480
  );
64437
64481
  const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
64438
- promise = Promise.all(
64482
+ promise = Promise.allSettled(
64439
64483
  deps.map((dep) => {
64440
64484
  dep = assetsURL(dep, importerUrl);
64441
64485
  if (dep in seen) return;
@@ -64457,8 +64501,8 @@ function preload(baseModule, deps, importerUrl) {
64457
64501
  link.rel = isCss ? "stylesheet" : scriptRel;
64458
64502
  if (!isCss) {
64459
64503
  link.as = "script";
64460
- link.crossOrigin = "";
64461
64504
  }
64505
+ link.crossOrigin = "";
64462
64506
  link.href = dep;
64463
64507
  if (cspNonce) {
64464
64508
  link.setAttribute("nonce", cspNonce);
@@ -64476,15 +64520,19 @@ function preload(baseModule, deps, importerUrl) {
64476
64520
  })
64477
64521
  );
64478
64522
  }
64479
- return promise.then(() => baseModule()).catch((err) => {
64480
- const e = new Event("vite:preloadError", {
64481
- cancelable: true
64482
- });
64483
- e.payload = err;
64484
- window.dispatchEvent(e);
64485
- if (!e.defaultPrevented) {
64486
- throw err;
64523
+ return promise.then((res) => {
64524
+ for (const item of res || []) {
64525
+ if (item.status !== "rejected") continue;
64526
+ const e = new Event("vite:preloadError", {
64527
+ cancelable: true
64528
+ });
64529
+ e.payload = item.reason;
64530
+ window.dispatchEvent(e);
64531
+ if (!e.defaultPrevented) {
64532
+ throw item.reason;
64533
+ }
64487
64534
  }
64535
+ return baseModule();
64488
64536
  });
64489
64537
  }
64490
64538
  function buildImportAnalysisPlugin(config) {
@@ -65129,7 +65177,7 @@ async function build(inlineConfig = {}) {
65129
65177
  "production"
65130
65178
  );
65131
65179
  const options = config.build;
65132
- const { logger } = config;
65180
+ const { root, logger, packageCache } = config;
65133
65181
  const ssr = !!options.ssr;
65134
65182
  const libOptions = options.lib;
65135
65183
  logger.info(
@@ -65139,7 +65187,7 @@ async function build(inlineConfig = {}) {
65139
65187
  )}`
65140
65188
  )
65141
65189
  );
65142
- const resolve = (p) => path$n.resolve(config.root, p);
65190
+ const resolve = (p) => path$n.resolve(root, p);
65143
65191
  const input = libOptions ? options.rollupOptions?.input || (typeof libOptions.entry === "string" ? resolve(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve) : Object.fromEntries(
65144
65192
  Object.entries(libOptions.entry).map(([alias, file]) => [
65145
65193
  alias,
@@ -65240,7 +65288,7 @@ ${stackOnly}`;
65240
65288
  const format = output.format || "es";
65241
65289
  const jsExt = ssrNodeBuild || libOptions ? resolveOutputJsExtension(
65242
65290
  format,
65243
- findNearestPackageData(config.root, config.packageCache)?.data.type
65291
+ findNearestPackageData(root, packageCache)?.data.type
65244
65292
  ) : "js";
65245
65293
  return {
65246
65294
  dir: outDir,
@@ -65258,9 +65306,9 @@ ${stackOnly}`;
65258
65306
  libOptions,
65259
65307
  format,
65260
65308
  name,
65261
- config.root,
65309
+ root,
65262
65310
  jsExt,
65263
- config.packageCache
65311
+ packageCache
65264
65312
  ) : path$n.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
65265
65313
  chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$n.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
65266
65314
  assetFileNames: libOptions ? `[name].[ext]` : path$n.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
@@ -65282,13 +65330,13 @@ ${stackOnly}`;
65282
65330
  normalizedOutputs.push(buildOutputOptions(outputs));
65283
65331
  }
65284
65332
  const resolvedOutDirs = getResolvedOutDirs(
65285
- config.root,
65333
+ root,
65286
65334
  options.outDir,
65287
65335
  options.rollupOptions?.output
65288
65336
  );
65289
65337
  const emptyOutDir = resolveEmptyOutDir(
65290
65338
  options.emptyOutDir,
65291
- config.root,
65339
+ root,
65292
65340
  resolvedOutDirs,
65293
65341
  logger
65294
65342
  );
@@ -65296,10 +65344,10 @@ ${stackOnly}`;
65296
65344
  logger.info(colors$1.cyan(`
65297
65345
  watching for file changes...`));
65298
65346
  const resolvedChokidarOptions = resolveChokidarOptions(
65299
- config,
65300
65347
  config.build.watch.chokidar,
65301
65348
  resolvedOutDirs,
65302
- emptyOutDir
65349
+ emptyOutDir,
65350
+ config.cacheDir
65303
65351
  );
65304
65352
  const { watch } = await import('rollup');
65305
65353
  const watcher = watch({
@@ -1,4 +1,4 @@
1
- import { B as getDefaultExportFromCjs } from './dep-BzOvws4Y.js';
1
+ import { B as getDefaultExportFromCjs } from './dep-BEhTnQAI.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-IQS-Za7F.js';
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-BzOvws4Y.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-BEhTnQAI.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -730,7 +730,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
730
730
  `[boolean] force the optimizer to ignore the cache and re-bundle`
731
731
  ).action(async (root, options) => {
732
732
  filterDuplicateOptions(options);
733
- const { createServer } = await import('./chunks/dep-BzOvws4Y.js').then(function (n) { return n.E; });
733
+ const { createServer } = await import('./chunks/dep-BEhTnQAI.js').then(function (n) { return n.E; });
734
734
  try {
735
735
  const server = await createServer({
736
736
  root,
@@ -822,7 +822,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
822
822
  `[boolean] force empty outDir when it's outside of root`
823
823
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
824
824
  filterDuplicateOptions(options);
825
- const { build } = await import('./chunks/dep-BzOvws4Y.js').then(function (n) { return n.F; });
825
+ const { build } = await import('./chunks/dep-BEhTnQAI.js').then(function (n) { return n.F; });
826
826
  const buildOptions = cleanOptions(options);
827
827
  try {
828
828
  await build({
@@ -851,7 +851,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
851
851
  ).action(
852
852
  async (root, options) => {
853
853
  filterDuplicateOptions(options);
854
- const { optimizeDeps } = await import('./chunks/dep-BzOvws4Y.js').then(function (n) { return n.D; });
854
+ const { optimizeDeps } = await import('./chunks/dep-BEhTnQAI.js').then(function (n) { return n.D; });
855
855
  try {
856
856
  const config = await resolveConfig(
857
857
  {
@@ -877,7 +877,7 @@ ${e.stack}`),
877
877
  cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
878
878
  async (root, options) => {
879
879
  filterDuplicateOptions(options);
880
- const { preview } = await import('./chunks/dep-BzOvws4Y.js').then(function (n) { return n.G; });
880
+ const { preview } = await import('./chunks/dep-BEhTnQAI.js').then(function (n) { return n.G; });
881
881
  try {
882
882
  const server = await preview({
883
883
  root,
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-BzOvws4Y.js';
3
- export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-BzOvws4Y.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-BEhTnQAI.js';
3
+ export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-BEhTnQAI.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import { existsSync, readFileSync } from 'node:fs';
package/index.cjs CHANGED
@@ -25,11 +25,36 @@ asyncFunctions.forEach((name) => {
25
25
 
26
26
  function warnCjsUsage() {
27
27
  if (process.env.VITE_CJS_IGNORE_WARNING) return
28
+ const logLevelIndex = process.argv.findIndex((arg) =>
29
+ /^(?:-l|--logLevel)/.test(arg),
30
+ )
31
+ if (logLevelIndex > 0) {
32
+ const logLevelValue = process.argv[logLevelIndex + 1]
33
+ if (logLevelValue === 'silent' || logLevelValue === 'error') {
34
+ return
35
+ }
36
+ if (/silent|error/.test(process.argv[logLevelIndex])) {
37
+ return
38
+ }
39
+ }
28
40
  const yellow = (str) => `\u001b[33m${str}\u001b[39m`
29
- const log = process.env.VITE_CJS_TRACE ? console.trace : console.warn
30
- log(
41
+ console.warn(
31
42
  yellow(
32
43
  `The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
33
44
  ),
34
45
  )
46
+ if (process.env.VITE_CJS_TRACE) {
47
+ const e = {}
48
+ const stackTraceLimit = Error.stackTraceLimit
49
+ Error.stackTraceLimit = 100
50
+ Error.captureStackTrace(e)
51
+ Error.stackTraceLimit = stackTraceLimit
52
+ console.log(
53
+ e.stack
54
+ .split('\n')
55
+ .slice(1)
56
+ .filter((line) => !line.includes('(node:'))
57
+ .join('\n'),
58
+ )
59
+ }
35
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.4.2",
3
+ "version": "5.4.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -73,7 +73,7 @@
73
73
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
74
74
  "dependencies": {
75
75
  "esbuild": "^0.21.3",
76
- "postcss": "^8.4.41",
76
+ "postcss": "^8.4.43",
77
77
  "rollup": "^4.20.0"
78
78
  },
79
79
  "optionalDependencies": {
@@ -81,7 +81,7 @@
81
81
  },
82
82
  "devDependencies": {
83
83
  "@ampproject/remapping": "^2.3.0",
84
- "@babel/parser": "^7.25.3",
84
+ "@babel/parser": "^7.25.6",
85
85
  "@jridgewell/trace-mapping": "^0.3.25",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
87
  "@rollup/plugin-alias": "^5.1.0",
@@ -112,7 +112,7 @@
112
112
  "launch-editor-middleware": "^2.8.1",
113
113
  "lightningcss": "^1.26.0",
114
114
  "magic-string": "^0.30.11",
115
- "micromatch": "^4.0.7",
115
+ "micromatch": "^4.0.8",
116
116
  "mlly": "^1.7.1",
117
117
  "mrmime": "^2.0.0",
118
118
  "open": "^8.4.2",
@@ -134,8 +134,8 @@
134
134
  "source-map-support": "^0.5.21",
135
135
  "strip-ansi": "^7.1.0",
136
136
  "strip-literal": "^2.1.0",
137
- "tsconfck": "^3.1.1",
138
- "tslib": "^2.6.3",
137
+ "tsconfck": "^3.1.3",
138
+ "tslib": "^2.7.0",
139
139
  "types": "link:./types",
140
140
  "ufo": "^1.5.4",
141
141
  "ws": "^8.18.0"