vite 7.1.6 → 7.1.7

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.
@@ -171,10 +171,10 @@ var HMRClient = class {
171
171
  const disposer = this.disposeMap.get(path);
172
172
  if (disposer) return disposer(this.dataMap.get(path));
173
173
  }));
174
- paths.forEach((path) => {
174
+ await Promise.all(paths.map((path) => {
175
175
  const fn = this.pruneMap.get(path);
176
- if (fn) fn(this.dataMap.get(path));
177
- });
176
+ if (fn) return fn(this.dataMap.get(path));
177
+ }));
178
178
  }
179
179
  warnFailedUpdate(err, path) {
180
180
  if (!(err instanceof Error) || !err.message.includes("fetch")) this.logger.error(err);
@@ -489,9 +489,10 @@ var Queue = class {
489
489
  //#region src/client/overlay.ts
490
490
  const hmrConfigName = __HMR_CONFIG_NAME__;
491
491
  const base$1 = __BASE__ || "/";
492
+ const cspNonce = "document" in globalThis ? document.querySelector("meta[property=csp-nonce]")?.nonce : void 0;
492
493
  function h(e, attrs = {}, ...children) {
493
494
  const elem = document.createElement(e);
494
- for (const [k, v] of Object.entries(attrs)) elem.setAttribute(k, v);
495
+ for (const [k, v] of Object.entries(attrs)) if (v !== void 0) elem.setAttribute(k, v);
495
496
  elem.append(...children);
496
497
  return elem;
497
498
  }
@@ -663,7 +664,7 @@ const createTemplate = () => h("div", {
663
664
  }), h("div", {
664
665
  class: "tip",
665
666
  part: "tip"
666
- }, "Click outside, press ", h("kbd", {}, "Esc"), " key, or fix the code to dismiss.", h("br"), "You can also disable this overlay by setting ", h("code", { part: "config-option-name" }, "server.hmr.overlay"), " to ", h("code", { part: "config-option-value" }, "false"), " in ", h("code", { part: "config-file-name" }, hmrConfigName), ".")), h("style", {}, templateStyle));
667
+ }, "Click outside, press ", h("kbd", {}, "Esc"), " key, or fix the code to dismiss.", h("br"), "You can also disable this overlay by setting ", h("code", { part: "config-option-name" }, "server.hmr.overlay"), " to ", h("code", { part: "config-option-value" }, "false"), " in ", h("code", { part: "config-file-name" }, hmrConfigName), ".")), h("style", { nonce: cspNonce }, templateStyle));
667
668
  const fileRE = /(?:file:\/\/)?(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
668
669
  const codeframeRE = /^(?:>?\s*\d+\s+\|.*|\s+\|\s*\^.*)\r?\n/gm;
669
670
  const { HTMLElement = class {} } = globalThis;
@@ -1049,7 +1050,6 @@ const sheetsMap = /* @__PURE__ */ new Map();
1049
1050
  if ("document" in globalThis) document.querySelectorAll("style[data-vite-dev-id]").forEach((el) => {
1050
1051
  sheetsMap.set(el.getAttribute("data-vite-dev-id"), el);
1051
1052
  });
1052
- const cspNonce = "document" in globalThis ? document.querySelector("meta[property=csp-nonce]")?.nonce : void 0;
1053
1053
  let lastInsertedStyle;
1054
1054
  function updateStyle(id, content) {
1055
1055
  let style = sheetsMap.get(id);
@@ -0,0 +1,4 @@
1
+ import "./dep-SmwnYDP9.js";
2
+ import { preview, resolvePreviewOptions } from "./dep-Bm2ujbhY.js";
3
+
4
+ export { preview };
@@ -1,4 +1,4 @@
1
1
  import "./dep-SmwnYDP9.js";
2
- import { addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depsFromOptimizedDepInfo, depsLogString, discoverProjectDependencies, extractExportsData, getDepsCacheDir, getOptimizedDepPath, initDepsOptimizerMetadata, isDepOptimizationDisabled, loadCachedDepOptimizationMetadata, optimizeDeps, optimizeExplicitEnvironmentDeps, optimizedDepInfoFromFile, optimizedDepInfoFromId, optimizedDepNeedsInterop, runOptimizeDeps, toDiscoveredDependencies } from "./dep-D5b0Zz6C.js";
2
+ import { addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depsFromOptimizedDepInfo, depsLogString, discoverProjectDependencies, extractExportsData, getDepsCacheDir, getOptimizedDepPath, initDepsOptimizerMetadata, isDepOptimizationDisabled, loadCachedDepOptimizationMetadata, optimizeDeps, optimizeExplicitEnvironmentDeps, optimizedDepInfoFromFile, optimizedDepInfoFromId, optimizedDepNeedsInterop, runOptimizeDeps, toDiscoveredDependencies } from "./dep-Bm2ujbhY.js";
3
3
 
4
4
  export { optimizeDeps };
@@ -1,4 +1,4 @@
1
1
  import "./dep-SmwnYDP9.js";
2
- import { configDefaults, defineConfig, getDefaultEnvironmentOptions, isResolvedConfig, loadConfigFromFile, resolveBaseUrl, resolveConfig, resolveDevEnvironmentOptions, sortUserPlugins } from "./dep-D5b0Zz6C.js";
2
+ import { configDefaults, defineConfig, getDefaultEnvironmentOptions, isResolvedConfig, loadConfigFromFile, resolveBaseUrl, resolveConfig, resolveDevEnvironmentOptions, sortUserPlugins } from "./dep-Bm2ujbhY.js";
3
3
 
4
4
  export { resolveConfig };
@@ -7965,7 +7965,7 @@ var require_convert_source_map = /* @__PURE__ */ __commonJS({ "../../node_module
7965
7965
  }) });
7966
7966
 
7967
7967
  //#endregion
7968
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.37/node_modules/@rolldown/pluginutils/dist/index.mjs
7968
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.38/node_modules/@rolldown/pluginutils/dist/index.mjs
7969
7969
  /**
7970
7970
  * Constructs a RegExp that matches the exact string specified.
7971
7971
  *
@@ -10239,23 +10239,23 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
10239
10239
  if (!options$1.base && isRelative$1) throw new Error("In virtual modules, all globs must start with '/'");
10240
10240
  const importPath$1 = `/${relative$2(root, file)}`;
10241
10241
  let filePath$1 = options$1.base ? `${relative$2(posix.join(root, options$1.base), file)}` : importPath$1;
10242
- if (options$1.base && filePath$1[0] !== ".") filePath$1 = `./${filePath$1}`;
10242
+ if (options$1.base && !filePath$1.startsWith("./") && !filePath$1.startsWith("../")) filePath$1 = `./${filePath$1}`;
10243
10243
  return {
10244
10244
  filePath: filePath$1,
10245
10245
  importPath: importPath$1
10246
10246
  };
10247
10247
  }
10248
10248
  let importPath = relative$2(dir, file);
10249
- if (importPath[0] !== ".") importPath = `./${importPath}`;
10249
+ if (!importPath.startsWith("./") && !importPath.startsWith("../")) importPath = `./${importPath}`;
10250
10250
  let filePath;
10251
10251
  if (options$1.base) {
10252
10252
  filePath = relative$2(posix.join(options$1.base[0] === "/" ? root : dir, options$1.base), file);
10253
- if (filePath[0] !== ".") filePath = `./${filePath}`;
10253
+ if (!filePath.startsWith("./") && !filePath.startsWith("../")) filePath = `./${filePath}`;
10254
10254
  if (options$1.base[0] === "/") importPath = `/${relative$2(root, file)}`;
10255
10255
  } else if (isRelative$1) filePath = importPath;
10256
10256
  else {
10257
10257
  filePath = relative$2(root, file);
10258
- if (filePath[0] !== ".") filePath = `/${filePath}`;
10258
+ if (!filePath.startsWith("./") && !filePath.startsWith("../")) filePath = `/${filePath}`;
10259
10259
  }
10260
10260
  return {
10261
10261
  filePath,
@@ -29810,7 +29810,7 @@ function importAnalysisPlugin(config$2) {
29810
29810
  if (ssr && importerModule.isSelfAccepting) isSelfAccepting = true;
29811
29811
  if (!isSelfAccepting && isPartiallySelfAccepting && acceptedExports.size >= exports$1.length && exports$1.every((e$1) => acceptedExports.has(e$1.n))) isSelfAccepting = true;
29812
29812
  const prunedImports = await moduleGraph.updateModuleInfo(importerModule, importedUrls, importedBindings, normalizedAcceptedUrls, isPartiallySelfAccepting ? acceptedExports : null, isSelfAccepting, staticImportedUrls);
29813
- if (hasHMR && prunedImports) handlePrunedModules(prunedImports, environment);
29813
+ if (prunedImports) handlePrunedModules(prunedImports, environment);
29814
29814
  }
29815
29815
  debug$2?.(`${timeFrom(msAtStart)} ${import_picocolors$8.default.dim(`[${importedUrls.size} imports rewritten] ${prettifyUrl(importer, root)}`)}`);
29816
29816
  if (s$2) return transformStableResult(s$2, importer, config$2);
@@ -30599,7 +30599,7 @@ function createFilterForTransform(idFilter, codeFilter, cwd) {
30599
30599
  async function resolvePlugins(config$2, prePlugins, normalPlugins, postPlugins) {
30600
30600
  const isBuild = config$2.command === "build";
30601
30601
  const isWorker = config$2.isWorker;
30602
- const buildPlugins = isBuild ? await (await import("./dep-BthugQ6r.js")).resolveBuildPlugins(config$2) : {
30602
+ const buildPlugins = isBuild ? await (await import("./dep-CAc8-XM0.js")).resolveBuildPlugins(config$2) : {
30603
30603
  pre: [],
30604
30604
  post: []
30605
30605
  };
@@ -35995,7 +35995,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35995
35995
  for (const name of Object.keys(resolved.environments)) resolved.environments[name].plugins = await resolveEnvironmentPlugins(new PartialEnvironment(name, resolved));
35996
35996
  optimizeDepsDisabledBackwardCompatibility(resolved, resolved.optimizeDeps);
35997
35997
  optimizeDepsDisabledBackwardCompatibility(resolved, resolved.ssr.optimizeDeps, "ssr.");
35998
- if (resolved.environments.ssr) resolved.environments.ssr.build.emitAssets = resolved.build.ssrEmitAssets || resolved.build.emitAssets;
35998
+ if (!resolved.builder?.sharedConfigBuild && resolved.environments.ssr) resolved.environments.ssr.build.emitAssets = resolved.build.ssrEmitAssets || resolved.build.emitAssets;
35999
35999
  debug?.(`using resolved config: %O`, {
36000
36000
  ...resolved,
36001
36001
  plugins: resolved.plugins.map((p) => p.name),
@@ -1,4 +1,4 @@
1
1
  import "./dep-SmwnYDP9.js";
2
- import { BuildEnvironment, build, buildEnvironmentOptionsDefaults, builderOptionsDefaults, createBuilder, createToImportMetaURLBasedRelativeRuntime, injectEnvironmentToHooks, onRollupLog, resolveBuildEnvironmentOptions, resolveBuildOutputs, resolveBuildPlugins, resolveBuilderOptions, resolveLibFilename, resolveUserExternal, toOutputFilePathInCss, toOutputFilePathInHtml, toOutputFilePathInJS, toOutputFilePathWithoutRuntime } from "./dep-D5b0Zz6C.js";
2
+ import { BuildEnvironment, build, buildEnvironmentOptionsDefaults, builderOptionsDefaults, createBuilder, createToImportMetaURLBasedRelativeRuntime, injectEnvironmentToHooks, onRollupLog, resolveBuildEnvironmentOptions, resolveBuildOutputs, resolveBuildPlugins, resolveBuilderOptions, resolveLibFilename, resolveUserExternal, toOutputFilePathInCss, toOutputFilePathInHtml, toOutputFilePathInJS, toOutputFilePathWithoutRuntime } from "./dep-Bm2ujbhY.js";
3
3
 
4
4
  export { createBuilder, resolveBuildPlugins };
@@ -1,4 +1,4 @@
1
1
  import "./dep-SmwnYDP9.js";
2
- import { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults } from "./dep-D5b0Zz6C.js";
2
+ import { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults } from "./dep-Bm2ujbhY.js";
3
3
 
4
4
  export { createServer };
package/dist/node/cli.js CHANGED
@@ -568,7 +568,7 @@ const convertBase = (v) => {
568
568
  cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with esbuild, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
569
569
  cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
570
570
  filterDuplicateOptions(options);
571
- const { createServer } = await import("./chunks/dep-BTc4Fpfo.js");
571
+ const { createServer } = await import("./chunks/dep-H0AnFej7.js");
572
572
  try {
573
573
  const server = await createServer({
574
574
  root,
@@ -624,7 +624,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
624
624
  });
625
625
  cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'baseline-widely-available')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("--assetsDir <dir>", `[string] directory under outDir to place assets in (default: assets)`).option("--assetsInlineLimit <number>", `[number] static asset base64 inline threshold in bytes (default: 4096)`).option("--ssr [entry]", `[string] build specified entry for server-side rendering`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: esbuild)").option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(async (root, options) => {
626
626
  filterDuplicateOptions(options);
627
- const { createBuilder } = await import("./chunks/dep-BthugQ6r.js");
627
+ const { createBuilder } = await import("./chunks/dep-CAc8-XM0.js");
628
628
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
629
629
  try {
630
630
  const inlineConfig = {
@@ -648,8 +648,8 @@ cli.command("build [root]", "build for production").option("--target <target>",
648
648
  });
649
649
  cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
650
650
  filterDuplicateOptions(options);
651
- const { resolveConfig } = await import("./chunks/dep-4S5XG83Z.js");
652
- const { optimizeDeps } = await import("./chunks/dep-BLFux7-m.js");
651
+ const { resolveConfig } = await import("./chunks/dep-BbmkDZt5.js");
652
+ const { optimizeDeps } = await import("./chunks/dep-BRWmquJk.js");
653
653
  try {
654
654
  const config = await resolveConfig({
655
655
  root,
@@ -667,7 +667,7 @@ cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bun
667
667
  });
668
668
  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(async (root, options) => {
669
669
  filterDuplicateOptions(options);
670
- const { preview } = await import("./chunks/dep-C7LYi1xl.js");
670
+ const { preview } = await import("./chunks/dep-BFcSm8xQ.js");
671
671
  try {
672
672
  const server = await preview({
673
673
  root,
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, createLogger, defaultAllowedOrigins } from "./chunks/dep-SmwnYDP9.js";
2
- import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-D5b0Zz6C.js";
2
+ import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-Bm2ujbhY.js";
3
3
  import { parseAst, parseAstAsync } from "rollup/parseAst";
4
4
  import { version as esbuildVersion } from "esbuild";
5
5
 
@@ -407,10 +407,10 @@ var HMRContext = class {
407
407
  await Promise.all(paths.map((path) => {
408
408
  let disposer = this.disposeMap.get(path);
409
409
  if (disposer) return disposer(this.dataMap.get(path));
410
- })), paths.forEach((path) => {
410
+ })), await Promise.all(paths.map((path) => {
411
411
  let fn = this.pruneMap.get(path);
412
- fn && fn(this.dataMap.get(path));
413
- });
412
+ if (fn) return fn(this.dataMap.get(path));
413
+ }));
414
414
  }
415
415
  warnFailedUpdate(err, path) {
416
416
  (!(err instanceof Error) || !err.message.includes("fetch")) && this.logger.error(err), this.logger.error(`Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "7.1.6",
3
+ "version": "7.1.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -84,7 +84,7 @@
84
84
  "@jridgewell/trace-mapping": "^0.3.31",
85
85
  "@oxc-project/types": "0.87.0",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
- "@rolldown/pluginutils": "^1.0.0-beta.37",
87
+ "@rolldown/pluginutils": "^1.0.0-beta.38",
88
88
  "@rollup/plugin-alias": "^5.1.1",
89
89
  "@rollup/plugin-commonjs": "^28.0.6",
90
90
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
@@ -92,7 +92,7 @@
92
92
  "@types/escape-html": "^1.0.4",
93
93
  "@types/pnpapi": "^0.0.5",
94
94
  "artichokie": "^0.4.0",
95
- "baseline-browser-mapping": "^2.8.3",
95
+ "baseline-browser-mapping": "^2.8.6",
96
96
  "cac": "^6.7.14",
97
97
  "chokidar": "^3.6.0",
98
98
  "connect": "^3.7.0",
@@ -128,8 +128,8 @@
128
128
  "rolldown": "^1.0.0-beta.37",
129
129
  "rolldown-plugin-dts": "^0.16.5",
130
130
  "rollup-plugin-license": "^3.6.0",
131
- "sass": "^1.92.1",
132
- "sass-embedded": "^1.92.1",
131
+ "sass": "^1.93.0",
132
+ "sass-embedded": "^1.93.0",
133
133
  "sirv": "^3.0.2",
134
134
  "strip-literal": "^3.0.0",
135
135
  "terser": "^5.44.0",
@@ -1,4 +0,0 @@
1
- import "./dep-SmwnYDP9.js";
2
- import { preview, resolvePreviewOptions } from "./dep-D5b0Zz6C.js";
3
-
4
- export { preview };