vite 7.0.6 → 7.0.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.
@@ -1,5 +1,5 @@
1
1
  import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { preview, resolvePreviewOptions } from "./dep-BHkUv4Z8.js";
2
+ import { preview, resolvePreviewOptions } from "./dep-D718l5rc.js";
3
3
  import "./dep-Ctugieod.js";
4
4
 
5
5
  export { preview };
@@ -5,7 +5,7 @@ import { builtinModules, createRequire } from "node:module";
5
5
  import { parseAst, parseAstAsync } from "rollup/parseAst";
6
6
  import * as fs$1 from "node:fs";
7
7
  import fs, { existsSync, promises, readFileSync } from "node:fs";
8
- import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve } from "node:path";
8
+ import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path";
9
9
  import fsp, { constants } from "node:fs/promises";
10
10
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
11
11
  import { format, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -17,7 +17,7 @@ import os from "node:os";
17
17
  import net from "node:net";
18
18
  import childProcess, { exec, execFile, execSync } from "node:child_process";
19
19
  import { promises as promises$1 } from "node:dns";
20
- import path$1, { basename as basename$1, dirname as dirname$1, extname as extname$1, isAbsolute as isAbsolute$1, join as join$1, posix as posix$1, relative as relative$1, resolve as resolve$1, sep, win32 } from "path";
20
+ import path$1, { basename as basename$1, dirname as dirname$1, extname as extname$1, isAbsolute as isAbsolute$1, join as join$1, posix as posix$1, relative as relative$1, resolve as resolve$1, sep as sep$1, win32 } from "path";
21
21
  import { existsSync as existsSync$1, readFileSync as readFileSync$1, readdirSync, statSync } from "fs";
22
22
  import { fdir } from "fdir";
23
23
  import { gzip } from "node:zlib";
@@ -4457,7 +4457,7 @@ function getEsImportProxy(id, defaultIsModuleExports, moduleSideEffects) {
4457
4457
  };
4458
4458
  }
4459
4459
  function getCandidatesForExtension(resolved, extension$1) {
4460
- return [resolved + extension$1, `${resolved}${sep}index${extension$1}`];
4460
+ return [resolved + extension$1, `${resolved}${sep$1}index${extension$1}`];
4461
4461
  }
4462
4462
  function getCandidates(resolved, extensions$1) {
4463
4463
  return extensions$1.reduce((paths, extension$1) => paths.concat(getCandidatesForExtension(resolved, extension$1)), [resolved]);
@@ -5976,7 +5976,7 @@ function findUp(dir, { resolve: resolve$4, reject, promise }, options$1) {
5976
5976
  * @property {boolean} err - error flag
5977
5977
  * @property {string[]} configNames - config file names
5978
5978
  */
5979
- const sep$2 = path.sep;
5979
+ const sep$3 = path.sep;
5980
5980
 
5981
5981
  //#endregion
5982
5982
  //#region ../../node_modules/.pnpm/tsconfck@3.1.6_typescript@5.7.3/node_modules/tsconfck/src/to-json.js
@@ -16569,7 +16569,7 @@ var require_is_binary_path = __commonJS({ "../../node_modules/.pnpm/is-binary-pa
16569
16569
  //#endregion
16570
16570
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=8a4f9e2b397e6034b91a0508faae3cecb97f222313faa129d7cb0eb71e9d0e84/node_modules/chokidar/lib/constants.js
16571
16571
  var require_constants$2 = __commonJS({ "../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=8a4f9e2b397e6034b91a0508faae3cecb97f222313faa129d7cb0eb71e9d0e84/node_modules/chokidar/lib/constants.js"(exports) {
16572
- const { sep: sep$1 } = require("path");
16572
+ const { sep: sep$2 } = require("path");
16573
16573
  const { platform: platform$1 } = process;
16574
16574
  const os$2 = require("os");
16575
16575
  exports.EV_ALL = "all";
@@ -16602,7 +16602,7 @@ var require_constants$2 = __commonJS({ "../../node_modules/.pnpm/chokidar@3.6.0_
16602
16602
  exports.KEY_ERR,
16603
16603
  exports.KEY_RAW
16604
16604
  ];
16605
- exports.DOT_SLASH = `.${sep$1}`;
16605
+ exports.DOT_SLASH = `.${sep$2}`;
16606
16606
  exports.BACK_SLASH_RE = /\\/g;
16607
16607
  exports.DOUBLE_SLASH_RE = /\/\//;
16608
16608
  exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
@@ -26012,7 +26012,7 @@ function parse$1(req$4) {
26012
26012
  }
26013
26013
 
26014
26014
  //#endregion
26015
- //#region ../../node_modules/.pnpm/sirv@3.0.1_patch_hash=95b663b930c5cc6e609c7fa15b69a86ff3b30df68978611d1d3d724c65135cb1/node_modules/sirv/build.mjs
26015
+ //#region ../../node_modules/.pnpm/sirv@3.0.2_patch_hash=c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95/node_modules/sirv/build.mjs
26016
26016
  const noop = () => {};
26017
26017
  function isMatch(uri, arr) {
26018
26018
  for (let i$1 = 0; i$1 < arr.length; i$1++) if (arr[i$1].test(uri)) return true;
@@ -26134,7 +26134,7 @@ function build_default(dir, opts = {}) {
26134
26134
  headers
26135
26135
  };
26136
26136
  });
26137
- let lookup$1 = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
26137
+ let lookup$1 = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES);
26138
26138
  return function(req$4, res, next) {
26139
26139
  let extns = [""];
26140
26140
  let pathname = parse$1(req$4).pathname;
@@ -27792,7 +27792,12 @@ function indexHtmlMiddleware(root, server) {
27792
27792
  if (url$6?.endsWith(".html") && req$4.headers["sec-fetch-dest"] !== "script") {
27793
27793
  let filePath;
27794
27794
  if (isDev && url$6.startsWith(FS_PREFIX)) filePath = decodeURIComponent(fsPathFromId(url$6));
27795
- else filePath = path.join(root, decodeURIComponent(url$6));
27795
+ else filePath = normalizePath(path.resolve(path.join(root, decodeURIComponent(url$6))));
27796
+ if (isDev) {
27797
+ const servingAccessResult = checkLoadingAccess(server.config, filePath);
27798
+ if (servingAccessResult === "denied") return respondWithAccessDenied(filePath, server, res);
27799
+ if (servingAccessResult === "fallback") return next();
27800
+ } else if (!isParentDirectory(root, filePath)) return next();
27796
27801
  if (fs.existsSync(filePath)) {
27797
27802
  const headers = isDev ? server.config.server.headers : server.config.preview.headers;
27798
27803
  try {
@@ -30921,7 +30926,7 @@ function createFilterForTransform(idFilter, codeFilter, cwd) {
30921
30926
  async function resolvePlugins(config$2, prePlugins, normalPlugins, postPlugins) {
30922
30927
  const isBuild = config$2.command === "build";
30923
30928
  const isWorker = config$2.isWorker;
30924
- const buildPlugins = isBuild ? await (await import("./dep-CmzxWWz4.js")).resolveBuildPlugins(config$2) : {
30929
+ const buildPlugins = isBuild ? await (await import("./dep-zXgPjA_2.js")).resolveBuildPlugins(config$2) : {
30925
30930
  pre: [],
30926
30931
  post: []
30927
30932
  };
@@ -33100,16 +33105,16 @@ function formatStylusSourceMap(mapBefore, root) {
33100
33105
  map$1.sources = map$1.sources.map(resolveFromRoot);
33101
33106
  return map$1;
33102
33107
  }
33103
- async function getSource(source, filename, additionalData, enableSourcemap, sep$3 = "") {
33108
+ async function getSource(source, filename, additionalData, enableSourcemap, sep$4 = "") {
33104
33109
  if (!additionalData) return { content: source };
33105
33110
  if (typeof additionalData === "function") {
33106
33111
  const newContent = await additionalData(source, filename);
33107
33112
  if (typeof newContent === "string") return { content: newContent };
33108
33113
  return newContent;
33109
33114
  }
33110
- if (!enableSourcemap) return { content: additionalData + sep$3 + source };
33115
+ if (!enableSourcemap) return { content: additionalData + sep$4 + source };
33111
33116
  const ms = new MagicString(source);
33112
- ms.appendLeft(0, sep$3);
33117
+ ms.appendLeft(0, sep$4);
33113
33118
  ms.appendLeft(0, additionalData);
33114
33119
  const map$1 = ms.generateMap({ hires: "boundary" });
33115
33120
  map$1.file = filename;
@@ -35706,7 +35711,8 @@ async function preview(inlineConfig = {}) {
35706
35711
  if (config$2.appType === "spa" || config$2.appType === "mpa") app.use(htmlFallbackMiddleware(distDir, config$2.appType === "spa"));
35707
35712
  postHooks.forEach((fn) => fn && fn());
35708
35713
  if (config$2.appType === "spa" || config$2.appType === "mpa") {
35709
- app.use(indexHtmlMiddleware(distDir, server));
35714
+ const normalizedDistDir = normalizePath(distDir);
35715
+ app.use(indexHtmlMiddleware(normalizedDistDir, server));
35710
35716
  app.use(notFoundMiddleware());
35711
35717
  }
35712
35718
  const hostname = await resolveHostname(options$1.host);
@@ -1,5 +1,5 @@
1
1
  import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
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-BHkUv4Z8.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-D718l5rc.js";
3
3
  import "./dep-Ctugieod.js";
4
4
 
5
5
  export { optimizeDeps };
@@ -1,5 +1,5 @@
1
1
  import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults } from "./dep-BHkUv4Z8.js";
2
+ import { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults } from "./dep-D718l5rc.js";
3
3
  import "./dep-Ctugieod.js";
4
4
 
5
5
  export { createServer };
@@ -1,5 +1,5 @@
1
1
  import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { BuildEnvironment, build, buildEnvironmentOptionsDefaults, builderOptionsDefaults, createBuilder, createToImportMetaURLBasedRelativeRuntime, injectEnvironmentToHooks, onRollupLog, resolveBuildEnvironmentOptions, resolveBuildOutputs, resolveBuildPlugins, resolveBuilderOptions, resolveLibFilename, resolveUserExternal, toOutputFilePathInCss, toOutputFilePathInHtml, toOutputFilePathInJS, toOutputFilePathWithoutRuntime } from "./dep-BHkUv4Z8.js";
2
+ import { BuildEnvironment, build, buildEnvironmentOptionsDefaults, builderOptionsDefaults, createBuilder, createToImportMetaURLBasedRelativeRuntime, injectEnvironmentToHooks, onRollupLog, resolveBuildEnvironmentOptions, resolveBuildOutputs, resolveBuildPlugins, resolveBuilderOptions, resolveLibFilename, resolveUserExternal, toOutputFilePathInCss, toOutputFilePathInHtml, toOutputFilePathInJS, toOutputFilePathWithoutRuntime } from "./dep-D718l5rc.js";
3
3
  import "./dep-Ctugieod.js";
4
4
 
5
5
  export { createBuilder, resolveBuildPlugins };
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
2
  import { __toESM } from "./chunks/dep-Drtntmtt.js";
3
- import { createLogger, require_picocolors, resolveConfig } from "./chunks/dep-BHkUv4Z8.js";
3
+ import { createLogger, require_picocolors, resolveConfig } from "./chunks/dep-D718l5rc.js";
4
4
  import { VERSION } from "./chunks/dep-Ctugieod.js";
5
5
  import fs from "node:fs";
6
6
  import path from "node:path";
@@ -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-Ck0J6tA7.js");
571
+ const { createServer } = await import("./chunks/dep-ovf8FmPp.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-CmzxWWz4.js");
627
+ const { createBuilder } = await import("./chunks/dep-zXgPjA_2.js");
628
628
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
629
629
  try {
630
630
  const inlineConfig = {
@@ -649,7 +649,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
649
649
  });
650
650
  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) => {
651
651
  filterDuplicateOptions(options);
652
- const { optimizeDeps } = await import("./chunks/dep-Bg9-PZ8I.js");
652
+ const { optimizeDeps } = await import("./chunks/dep-V0qnk7_W.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-PzytSxfE.js");
670
+ const { preview } = await import("./chunks/dep-Cumava67.js");
671
671
  try {
672
672
  const server = await preview({
673
673
  root,
@@ -1,5 +1,5 @@
1
1
  import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, 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-BHkUv4Z8.js";
2
+ import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, 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-D718l5rc.js";
3
3
  import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, defaultAllowedOrigins } from "./chunks/dep-Ctugieod.js";
4
4
  import { parseAst, parseAstAsync } from "rollup/parseAst";
5
5
  import { version as esbuildVersion } from "esbuild";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "7.0.6",
3
+ "version": "7.0.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -129,7 +129,7 @@
129
129
  "rollup-plugin-license": "^3.6.0",
130
130
  "sass": "^1.89.2",
131
131
  "sass-embedded": "^1.89.2",
132
- "sirv": "^3.0.1",
132
+ "sirv": "^3.0.2",
133
133
  "strip-literal": "^3.0.0",
134
134
  "terser": "^5.43.1",
135
135
  "tsconfck": "^3.1.6",