vite 6.2.1 → 6.2.3

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 { P as getDefaultExportFromCjs } from './dep-glQox-ep.js';
1
+ import { P as getDefaultExportFromCjs } from './dep-DDxXL6bt.js';
2
2
  import require$$0 from 'path';
3
3
  import { l as lib } from './dep-3RmXg9uo.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-glQox-ep.js';
1
+ import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-DDxXL6bt.js';
2
2
  import require$$0$2 from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -5066,7 +5066,7 @@ function isReference(node, parent) {
5066
5066
  return false;
5067
5067
  }
5068
5068
 
5069
- var version$2 = "28.0.2";
5069
+ var version$2 = "28.0.3";
5070
5070
  var peerDependencies = {
5071
5071
  rollup: "^2.68.0||^3.0.0||^4.0.0"
5072
5072
  };
@@ -5431,7 +5431,7 @@ export function getDefaultExportFromNamespaceIfNotNamed (n) {
5431
5431
  }
5432
5432
 
5433
5433
  export function getAugmentedNamespace(n) {
5434
- if (n.__esModule) return n;
5434
+ if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
5435
5435
  var f = n.default;
5436
5436
  if (typeof f == "function") {
5437
5437
  var a = function a () {
@@ -30731,7 +30731,7 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
30731
30731
  if (!pos.source) {
30732
30732
  return input;
30733
30733
  }
30734
- const trimmedVarName = varName.trim();
30734
+ const trimmedVarName = varName?.trim();
30735
30735
  const sourceFile = path$d.resolve(path$d.dirname(id), pos.source);
30736
30736
  const source = `${sourceFile}:${pos.line}:${pos.column + 1}`;
30737
30737
  if (!trimmedVarName || trimmedVarName === "eval") {
@@ -42678,6 +42678,7 @@ function decodeURIIfPossible(input) {
42678
42678
 
42679
42679
  const debugCache = createDebugger("vite:cache");
42680
42680
  const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
42681
+ const trailingQuerySeparatorsRE = /[?&]+$/;
42681
42682
  function cachedTransformMiddleware(server) {
42682
42683
  return function viteCachedTransformMiddleware(req, res, next) {
42683
42684
  const environment = server.environments.client;
@@ -42763,7 +42764,16 @@ function transformMiddleware(server) {
42763
42764
  if (publicDirInRoot && url.startsWith(publicPath)) {
42764
42765
  warnAboutExplicitPublicPathInUrl(url);
42765
42766
  }
42766
- if ((rawRE.test(url) || urlRE.test(url)) && !ensureServingAccess(url, server, res, next)) {
42767
+ const urlWithoutTrailingQuerySeparators = url.replace(
42768
+ trailingQuerySeparatorsRE,
42769
+ ""
42770
+ );
42771
+ if ((rawRE.test(urlWithoutTrailingQuerySeparators) || urlRE.test(urlWithoutTrailingQuerySeparators)) && !ensureServingAccess(
42772
+ urlWithoutTrailingQuerySeparators,
42773
+ server,
42774
+ res,
42775
+ next
42776
+ )) {
42767
42777
  return;
42768
42778
  }
42769
42779
  if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
@@ -42908,12 +42918,6 @@ function isBareRelative(url) {
42908
42918
  }
42909
42919
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
42910
42920
  const replacer = (url2) => {
42911
- if (server) {
42912
- const mod = server.environments.client.moduleGraph.urlToModuleMap.get(url2);
42913
- if (mod && mod.lastHMRTimestamp > 0) {
42914
- url2 = injectQuery(url2, `t=${mod.lastHMRTimestamp}`);
42915
- }
42916
- }
42917
42921
  if (url2[0] === "/" && url2[1] !== "/" || // #3230 if some request url (localhost:3000/a/b) return to fallback html, the relative assets
42918
42922
  // path will add `/a/` prefix, it will caused 404.
42919
42923
  //
@@ -42925,8 +42929,8 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
42925
42929
  (url2[0] === "." || isBareRelative(url2)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") {
42926
42930
  url2 = path$d.posix.join(config.base, url2);
42927
42931
  }
42928
- if (server && !isClassicScriptLink && shouldPreTransform(url2, config)) {
42929
- let preTransformUrl;
42932
+ let preTransformUrl;
42933
+ if (!isClassicScriptLink && shouldPreTransform(url2, config)) {
42930
42934
  if (url2[0] === "/" && url2[1] !== "/") {
42931
42935
  preTransformUrl = url2;
42932
42936
  } else if (url2[0] === "." || isBareRelative(url2)) {
@@ -42936,14 +42940,22 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
42936
42940
  url2
42937
42941
  );
42938
42942
  }
42939
- if (preTransformUrl) {
42940
- try {
42941
- preTransformUrl = decodeURI(preTransformUrl);
42942
- } catch {
42943
- return url2;
42944
- }
42945
- preTransformRequest(server, preTransformUrl, config.decodedBase);
42943
+ }
42944
+ if (server) {
42945
+ const mod = server.environments.client.moduleGraph.urlToModuleMap.get(
42946
+ preTransformUrl || url2
42947
+ );
42948
+ if (mod && mod.lastHMRTimestamp > 0) {
42949
+ url2 = injectQuery(url2, `t=${mod.lastHMRTimestamp}`);
42950
+ }
42951
+ }
42952
+ if (server && preTransformUrl) {
42953
+ try {
42954
+ preTransformUrl = decodeURI(preTransformUrl);
42955
+ } catch {
42956
+ return url2;
42946
42957
  }
42958
+ preTransformRequest(server, preTransformUrl, config.decodedBase);
42947
42959
  }
42948
42960
  return url2;
42949
42961
  };
@@ -45381,6 +45393,17 @@ const WORKER_FILE_ID = "worker_file";
45381
45393
  const workerCache = /* @__PURE__ */ new WeakMap();
45382
45394
  function saveEmitWorkerAsset(config, asset) {
45383
45395
  const workerMap = workerCache.get(config.mainConfig || config);
45396
+ const duplicateAsset = workerMap.assets.get(asset.fileName);
45397
+ if (duplicateAsset) {
45398
+ if (!isSameContent(duplicateAsset.source, asset.source)) {
45399
+ config.logger.warn(
45400
+ `
45401
+ ` + colors$1.yellow(
45402
+ `The emitted file ${JSON.stringify(asset.fileName)} overwrites a previously emitted file of the same name.`
45403
+ )
45404
+ );
45405
+ }
45406
+ }
45384
45407
  workerMap.assets.set(asset.fileName, asset);
45385
45408
  }
45386
45409
  async function bundleWorkerEntry(config, id) {
@@ -48082,15 +48105,10 @@ class PluginContainer {
48082
48105
  // For backward compatibility, buildStart and watchChange are called only for the client environment
48083
48106
  // buildStart is called per environment for a plugin with the perEnvironmentStartEndDuring dev flag
48084
48107
  async buildStart(_options) {
48085
- this.environments.client.pluginContainer.buildStart(
48086
- _options
48087
- );
48108
+ return this.environments.client.pluginContainer.buildStart(_options);
48088
48109
  }
48089
48110
  async watchChange(id, change) {
48090
- this.environments.client.pluginContainer.watchChange(
48091
- id,
48092
- change
48093
- );
48111
+ return this.environments.client.pluginContainer.watchChange(id, change);
48094
48112
  }
48095
48113
  async resolveId(rawId, importer, options) {
48096
48114
  return this._getPluginContainer(options).resolveId(rawId, importer, options);
@@ -48687,12 +48705,17 @@ function cssPostPlugin(config) {
48687
48705
  const injectCode = `var ${style} = document.createElement('style');${style}.textContent = ${cssString};document.head.appendChild(${style});`;
48688
48706
  let injectionPoint;
48689
48707
  const wrapIdx = code.indexOf("System.register");
48708
+ const singleQuoteUseStrict = `'use strict';`;
48709
+ const doubleQuoteUseStrict = `"use strict";`;
48690
48710
  if (wrapIdx >= 0) {
48691
48711
  const executeFnStart = code.indexOf("execute:", wrapIdx);
48692
48712
  injectionPoint = code.indexOf("{", executeFnStart) + 1;
48713
+ } else if (code.includes(singleQuoteUseStrict)) {
48714
+ injectionPoint = code.indexOf(singleQuoteUseStrict) + singleQuoteUseStrict.length;
48715
+ } else if (code.includes(doubleQuoteUseStrict)) {
48716
+ injectionPoint = code.indexOf(doubleQuoteUseStrict) + doubleQuoteUseStrict.length;
48693
48717
  } else {
48694
- const insertMark = "'use strict';";
48695
- injectionPoint = code.indexOf(insertMark) + insertMark.length;
48718
+ throw new Error("Injection point for inlined CSS not found");
48696
48719
  }
48697
48720
  s ||= new MagicString(code);
48698
48721
  s.appendRight(injectionPoint, injectCode);
@@ -49217,8 +49240,8 @@ function createCachedImport(imp) {
49217
49240
  return cached;
49218
49241
  };
49219
49242
  }
49220
- const importPostcssImport = createCachedImport(() => import('./dep-CmNzPT96.js').then(function (n) { return n.i; }));
49221
- const importPostcssModules = createCachedImport(() => import('./dep-Ccxds025.js').then(function (n) { return n.i; }));
49243
+ const importPostcssImport = createCachedImport(() => import('./dep-B7sDzLoK.js').then(function (n) { return n.i; }));
49244
+ const importPostcssModules = createCachedImport(() => import('./dep-C594T9mk.js').then(function (n) { return n.i; }));
49222
49245
  const importPostcss = createCachedImport(() => import('postcss'));
49223
49246
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
49224
49247
  let alwaysFakeWorkerWorkerControllerCache;
@@ -53450,7 +53473,7 @@ async function preview(inlineConfig = {}) {
53450
53473
  `The directory "${clientOutDir}" does not exist. Did you build your project?`
53451
53474
  );
53452
53475
  }
53453
- const httpsOptions = await resolveHttpsConfig(config.server.https);
53476
+ const httpsOptions = await resolveHttpsConfig(config.preview.https);
53454
53477
  const app = connect$1();
53455
53478
  const httpServer = await resolveHttpServer(config.preview, app, httpsOptions);
53456
53479
  setClientErrorHandler(httpServer, config.logger);
@@ -54183,7 +54206,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
54183
54206
  inlineConfig,
54184
54207
  root: resolvedRoot,
54185
54208
  base,
54186
- decodedBase: decodeURI(base),
54209
+ decodedBase: decodeBase(base),
54187
54210
  rawBase: resolvedBase,
54188
54211
  publicDir: resolvedPublicDir,
54189
54212
  cacheDir,
@@ -54382,6 +54405,15 @@ function resolveBaseUrl(base = configDefaults.base, isBuild, logger) {
54382
54405
  }
54383
54406
  return base;
54384
54407
  }
54408
+ function decodeBase(base) {
54409
+ try {
54410
+ return decodeURI(base);
54411
+ } catch {
54412
+ throw new Error(
54413
+ 'The value passed to "base" option was malformed. It should be a valid URL.'
54414
+ );
54415
+ }
54416
+ }
54385
54417
  function sortUserPlugins(plugins) {
54386
54418
  const prePlugins = [];
54387
54419
  const postPlugins = [];
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 { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-glQox-ep.js';
5
+ import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-DDxXL6bt.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -745,7 +745,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
745
745
  `[boolean] force the optimizer to ignore the cache and re-bundle`
746
746
  ).action(async (root, options) => {
747
747
  filterDuplicateOptions(options);
748
- const { createServer } = await import('./chunks/dep-glQox-ep.js').then(function (n) { return n.S; });
748
+ const { createServer } = await import('./chunks/dep-DDxXL6bt.js').then(function (n) { return n.S; });
749
749
  try {
750
750
  const server = await createServer({
751
751
  root,
@@ -840,7 +840,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
840
840
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
841
841
  async (root, options) => {
842
842
  filterDuplicateOptions(options);
843
- const { createBuilder } = await import('./chunks/dep-glQox-ep.js').then(function (n) { return n.T; });
843
+ const { createBuilder } = await import('./chunks/dep-DDxXL6bt.js').then(function (n) { return n.T; });
844
844
  const buildOptions = cleanGlobalCLIOptions(
845
845
  cleanBuilderCLIOptions(options)
846
846
  );
@@ -879,7 +879,7 @@ cli.command(
879
879
  ).action(
880
880
  async (root, options) => {
881
881
  filterDuplicateOptions(options);
882
- const { optimizeDeps } = await import('./chunks/dep-glQox-ep.js').then(function (n) { return n.R; });
882
+ const { optimizeDeps } = await import('./chunks/dep-DDxXL6bt.js').then(function (n) { return n.R; });
883
883
  try {
884
884
  const config = await resolveConfig(
885
885
  {
@@ -906,7 +906,7 @@ ${e.stack}`),
906
906
  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(
907
907
  async (root, options) => {
908
908
  filterDuplicateOptions(options);
909
- const { preview } = await import('./chunks/dep-glQox-ep.js').then(function (n) { return n.U; });
909
+ const { preview } = await import('./chunks/dep-DDxXL6bt.js').then(function (n) { return n.U; });
910
910
  try {
911
911
  const server = await preview({
912
912
  root,
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { a as arraify, i as isInNodeModules } from './chunks/dep-glQox-ep.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-glQox-ep.js';
2
+ import { a as arraify, i as isInNodeModules } from './chunks/dep-DDxXL6bt.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DDxXL6bt.js';
4
4
  export { defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.2.1",
3
+ "version": "6.2.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -85,7 +85,7 @@
85
85
  "@jridgewell/trace-mapping": "^0.3.25",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
87
  "@rollup/plugin-alias": "^5.1.1",
88
- "@rollup/plugin-commonjs": "^28.0.2",
88
+ "@rollup/plugin-commonjs": "^28.0.3",
89
89
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
90
90
  "@rollup/plugin-json": "^6.1.0",
91
91
  "@rollup/plugin-node-resolve": "16.0.0",
@@ -109,11 +109,11 @@
109
109
  "etag": "^1.8.1",
110
110
  "http-proxy": "^1.18.1",
111
111
  "launch-editor-middleware": "^2.10.0",
112
- "lightningcss": "^1.29.1",
112
+ "lightningcss": "^1.29.2",
113
113
  "magic-string": "^0.30.17",
114
114
  "mlly": "^1.7.4",
115
115
  "mrmime": "^2.0.1",
116
- "nanoid": "^5.1.2",
116
+ "nanoid": "^5.1.3",
117
117
  "open": "^10.1.0",
118
118
  "parse5": "^7.2.1",
119
119
  "pathe": "^2.0.3",