vite 8.0.3 → 8.0.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.
package/client.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  /// <reference path="./types/importMeta.d.ts" />
2
2
 
3
+ // virtual modules
4
+ declare module 'vite/modulepreload-polyfill' {}
5
+
3
6
  // CSS modules
4
7
  type CSSModuleClasses = { readonly [key: string]: string }
5
8
 
@@ -8,34 +8,34 @@ interface FetchFunctionOptions {
8
8
  type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
9
9
  interface CachedFetchResult {
10
10
  /**
11
- * If module cached in the runner, we can just confirm
12
- * it wasn't invalidated on the server side.
11
+ * If the module is cached in the runner, this confirms
12
+ * it was not invalidated on the server side.
13
13
  */
14
14
  cache: true;
15
15
  }
16
16
  interface ExternalFetchResult {
17
17
  /**
18
- * The path to the externalized module starting with file://,
19
- * by default this will be imported via a dynamic "import"
20
- * instead of being transformed by vite and loaded with vite runner
18
+ * The path to the externalized module starting with file://.
19
+ * By default this will be imported via a dynamic "import"
20
+ * instead of being transformed by Vite and loaded with the Vite runner.
21
21
  */
22
22
  externalize: string;
23
23
  /**
24
- * Type of the module. Will be used to determine if import statement is correct.
25
- * For example, if Vite needs to throw an error if variable is not actually exported
24
+ * Type of the module. Used to determine if the import statement is correct.
25
+ * For example, if Vite needs to throw an error if a variable is not actually exported.
26
26
  */
27
27
  type: "module" | "commonjs" | "builtin" | "network";
28
28
  }
29
29
  interface ViteFetchResult {
30
30
  /**
31
- * Code that will be evaluated by vite runner
32
- * by default this will be wrapped in an async function
31
+ * Code that will be evaluated by the Vite runner.
32
+ * By default this will be wrapped in an async function.
33
33
  */
34
34
  code: string;
35
35
  /**
36
36
  * File path of the module on disk.
37
- * This will be resolved as import.meta.url/filename
38
- * Will be equal to `null` for virtual modules
37
+ * This will be resolved as import.meta.url/filename.
38
+ * Will be `null` for virtual modules.
39
39
  */
40
40
  file: string | null;
41
41
  /**
@@ -2,7 +2,7 @@ import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __
2
2
  import { A as OPTIMIZABLE_ENTRY_RE, C as ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, D as JS_TYPES_RE, E as FS_PREFIX, F as defaultAllowedOrigins, I as loopbackHosts, L as wildcardHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as require_picocolors, S as ENV_PUBLIC_PATH, T as ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, _ as DEFAULT_SERVER_CONDITIONS, a as CLIENT_ENTRY, b as DEV_PROD_CONDITION, c as DEFAULT_ASSETS_INLINE_LIMIT, d as DEFAULT_CLIENT_MAIN_FIELDS, f as DEFAULT_CONFIG_FILES, g as DEFAULT_PREVIEW_PORT, h as DEFAULT_EXTERNAL_CONDITIONS, i as CLIENT_DIR, j as ROLLUP_HOOKS, k as METADATA_FILENAME, l as DEFAULT_ASSETS_RE, m as DEFAULT_EXTENSIONS, n as createLogger, o as CLIENT_PUBLIC_PATH, p as DEFAULT_DEV_PORT, r as printServerUrls, s as CSS_LANGS_RE, t as LogLevels, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS, w as ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, x as ENV_ENTRY, y as DEP_VERSION_RE } from "./logger.js";
3
3
  import { builtinModules, createRequire } from "node:module";
4
4
  import { parseAst, parseAstAsync } from "rolldown/parseAst";
5
- import { esmExternalRequirePlugin } from "rolldown/plugins";
5
+ import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequirePlugin$1 } from "rolldown/plugins";
6
6
  import { TsconfigCache, Visitor, minify, minifySync, parse, parseSync, transformSync } from "rolldown/utils";
7
7
  import * as fs$1 from "node:fs";
8
8
  import fs, { existsSync, readFileSync } from "node:fs";
@@ -1088,11 +1088,11 @@ function getDate() {
1088
1088
  function init$1(debug) {
1089
1089
  debug.inspectOpts = Object.assign({}, inspectOpts);
1090
1090
  }
1091
- var require$1, colors$36, inspectOpts, humanize$1, createDebug, node_default;
1091
+ var require$1, colors$37, inspectOpts, humanize$1, createDebug, node_default;
1092
1092
  var init_node = __esmMin((() => {
1093
1093
  init_core();
1094
1094
  require$1 = createRequire(import.meta.url);
1095
- colors$36 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
1095
+ colors$37 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
1096
1096
  20,
1097
1097
  21,
1098
1098
  26,
@@ -1194,7 +1194,7 @@ var init_node = __esmMin((() => {
1194
1194
  } catch (_unused) {
1195
1195
  humanize$1 = humanize;
1196
1196
  }
1197
- createDebug = setup(useColors(), colors$36, log, load, save, formatArgs, init$1);
1197
+ createDebug = setup(useColors(), colors$37, log, load, save, formatArgs, init$1);
1198
1198
  createDebug.inspectOpts = inspectOpts;
1199
1199
  createDebug.formatters.o = function(v) {
1200
1200
  this.inspectOpts.colors = this.useColors;
@@ -2252,7 +2252,7 @@ function hasBothRollupOptionsAndRolldownOptions(options) {
2252
2252
  options.worker,
2253
2253
  options.optimizeDeps,
2254
2254
  options.ssr?.optimizeDeps
2255
- ]) if (opt != null && opt.rollupOptions != null && opt.rolldownOptions != null) return true;
2255
+ ]) if (opt != null && opt.rollupOptions != null && opt.rolldownOptions != null && opt.rollupOptions !== opt.rolldownOptions) return true;
2256
2256
  return false;
2257
2257
  }
2258
2258
  function mergeConfigRecursively(defaults, overrides, rootPath) {
@@ -2521,6 +2521,25 @@ function monotonicDateNow() {
2521
2521
  lastDateNow++;
2522
2522
  return lastDateNow;
2523
2523
  }
2524
+ function formatAndTruncateFileList(files) {
2525
+ const MAX_LOG_LENGTH = 500;
2526
+ let log = "";
2527
+ let truncated = false;
2528
+ for (let i = 0; i < files.length; i++) {
2529
+ const file = files[i];
2530
+ if (log === "") log = file;
2531
+ else if (log.length + 2 + file.length < MAX_LOG_LENGTH) log += ", " + file;
2532
+ else {
2533
+ log += ` and ${files.length - i} more`;
2534
+ truncated = true;
2535
+ break;
2536
+ }
2537
+ }
2538
+ return {
2539
+ formatted: log,
2540
+ truncated
2541
+ };
2542
+ }
2524
2543
  //#endregion
2525
2544
  //#region src/node/plugin.ts
2526
2545
  async function resolveEnvironmentPlugins(environment) {
@@ -2795,7 +2814,7 @@ async function reloadOnTsconfigChange(server, changedFile) {
2795
2814
  }
2796
2815
  }
2797
2816
  //#endregion
2798
- //#region ../../node_modules/.pnpm/artichokie@0.4.2/node_modules/artichokie/dist/index.js
2817
+ //#region ../../node_modules/.pnpm/artichokie@0.4.3/node_modules/artichokie/dist/index.js
2799
2818
  const AsyncFunction = async function() {}.constructor;
2800
2819
  const codeToDataUrl = (code) => `data:application/javascript,${encodeURIComponent(code + "\n//# sourceURL=[worker-eval(artichokie)]")}`;
2801
2820
  const viteSsrDynamicImport = "__vite_ssr_dynamic_import__";
@@ -3024,10 +3043,10 @@ function genWorkerCode(fn, isModule, waitTimeout, parentFunctions) {
3024
3043
  else return resArgs.result;
3025
3044
  };
3026
3045
  asyncPort.on("message", (args) => {
3027
- const id$1 = args.id;
3028
- if (resolvers.has(id$1)) {
3029
- const { resolve, reject } = resolvers.get(id$1);
3030
- resolvers.delete(id$1);
3046
+ const id = args.id;
3047
+ if (resolvers.has(id)) {
3048
+ const { resolve, reject } = resolvers.get(id);
3049
+ resolvers.delete(id);
3031
3050
  if ("result" in args) resolve(args.result);
3032
3051
  else reject(args.error);
3033
3052
  }
@@ -15990,7 +16009,7 @@ require_subprotocol();
15990
16009
  require_websocket();
15991
16010
  var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
15992
16011
  //#endregion
15993
- //#region ../../node_modules/.pnpm/host-validation-middleware@0.1.2/node_modules/host-validation-middleware/dist/index.js
16012
+ //#region ../../node_modules/.pnpm/host-validation-middleware@0.1.4/node_modules/host-validation-middleware/dist/index.js
15994
16013
  /**
15995
16014
  * This function assumes that the input is not malformed.
15996
16015
  * This is because we only care about browser requests.
@@ -16052,8 +16071,8 @@ function isHostAllowed(hostHeader, allowedHosts) {
16052
16071
  * If the host header is not in the allowed hosts list, a 403 Forbidden response
16053
16072
  * is sent.
16054
16073
  */
16055
- function hostValidationMiddleware$2(options) {
16056
- return async function hostValidationMiddleware$1(req, res, next) {
16074
+ function hostValidationMiddleware$1(options) {
16075
+ return async function hostValidationMiddleware(req, res, next) {
16057
16076
  const hostHeader = req.headers.host;
16058
16077
  if (!isHostAllowed(hostHeader, options.allowedHosts)) {
16059
16078
  const hostname = hostHeader?.replace(/:\d+$/, "") ?? "";
@@ -19913,6 +19932,25 @@ var import_convert_source_map = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commo
19913
19932
  };
19914
19933
  })))(), 1);
19915
19934
  const debug$10 = createDebugger("vite:sourcemap", { onlyWhenFocused: true });
19935
+ /**
19936
+ * Given a file path inside node_modules, returns the package root directory.
19937
+ * For scoped packages like `node_modules/@scope/pkg/dist/foo.js`, returns `node_modules/@scope/pkg`.
19938
+ * Returns `undefined` if the file is not inside node_modules.
19939
+ */
19940
+ function getNodeModulesPackageRoot(filePath) {
19941
+ const normalized = normalizePath(filePath);
19942
+ const nodeModulesIndex = normalized.lastIndexOf("/node_modules/");
19943
+ if (nodeModulesIndex === -1) return void 0;
19944
+ const packageStart = nodeModulesIndex + 14;
19945
+ const rest = normalized.slice(packageStart);
19946
+ const firstSlash = rest.indexOf("/");
19947
+ let packageName;
19948
+ if (rest.startsWith("@")) {
19949
+ const secondSlash = rest.indexOf("/", firstSlash + 1);
19950
+ packageName = secondSlash === -1 ? rest : rest.slice(0, secondSlash);
19951
+ } else packageName = firstSlash === -1 ? rest : rest.slice(0, firstSlash);
19952
+ return normalized.slice(0, packageStart) + packageName;
19953
+ }
19916
19954
  const virtualSourceRE = /^(?:dep:|browser-external:|virtual:)|\0/;
19917
19955
  async function computeSourceRoute(map, file) {
19918
19956
  let sourceRoot;
@@ -19923,6 +19961,7 @@ async function computeSourceRoute(map, file) {
19923
19961
  }
19924
19962
  async function injectSourcesContent(map, file, logger) {
19925
19963
  let sourceRootPromise;
19964
+ const packageRoot = getNodeModulesPackageRoot(file);
19926
19965
  const missingSources = [];
19927
19966
  const sourcesContent = map.sourcesContent || [];
19928
19967
  const sourcesContentPromises = [];
@@ -19933,6 +19972,14 @@ async function injectSourcesContent(map, file, logger) {
19933
19972
  const sourceRoot = await sourceRootPromise;
19934
19973
  let resolvedSourcePath = cleanUrl(decodeURI(sourcePath));
19935
19974
  if (sourceRoot) resolvedSourcePath = path.resolve(sourceRoot, resolvedSourcePath);
19975
+ if (packageRoot) {
19976
+ const resolvedSourcePathNormalized = normalizePath(path.resolve(resolvedSourcePath));
19977
+ if (!isParentDirectory(packageRoot, resolvedSourcePathNormalized)) {
19978
+ sourcesContent[index] = null;
19979
+ logger.warnOnce(import_picocolors.default.yellow(`Sourcemap for ${JSON.stringify(file)} points to a source file outside its package: ${JSON.stringify(resolvedSourcePathNormalized)}`));
19980
+ return;
19981
+ }
19982
+ }
19936
19983
  sourcesContent[index] = await fsp.readFile(resolvedSourcePath, "utf-8").catch(() => {
19937
19984
  missingSources.push(resolvedSourcePath);
19938
19985
  return null;
@@ -19972,16 +20019,22 @@ function applySourcemapIgnoreList(map, sourcemapPath, sourcemapIgnoreList, logge
19972
20019
  }
19973
20020
  }
19974
20021
  }
19975
- function extractSourcemapFromFile(code, filePath) {
19976
- const map = (import_convert_source_map.fromSource(code) || import_convert_source_map.fromMapFileSource(code, createConvertSourceMapReadMap(filePath)))?.toObject();
20022
+ function extractSourcemapFromFile(code, filePath, logger) {
20023
+ const map = (import_convert_source_map.fromSource(code) || import_convert_source_map.fromMapFileSource(code, createConvertSourceMapReadMap(filePath, logger)))?.toObject();
19977
20024
  if (map) return {
19978
20025
  code: code.replace(import_convert_source_map.default.mapFileCommentRegex, blankReplacer),
19979
20026
  map
19980
20027
  };
19981
20028
  }
19982
- function createConvertSourceMapReadMap(originalFileName) {
20029
+ function createConvertSourceMapReadMap(originalFileName, logger) {
20030
+ const packageRoot = getNodeModulesPackageRoot(originalFileName);
19983
20031
  return (filename) => {
19984
- return fs.readFileSync(path.resolve(path.dirname(originalFileName), filename), "utf-8");
20032
+ const resolvedPath = path.resolve(path.dirname(originalFileName), filename);
20033
+ if (packageRoot && !isParentDirectory(packageRoot, normalizePath(resolvedPath))) {
20034
+ logger.warnOnce(import_picocolors.default.yellow(`Sourcemap in "${originalFileName}" references a map file outside its package: "${filename}"`));
20035
+ return "{}";
20036
+ }
20037
+ return fs.readFileSync(resolvedPath, "utf-8");
19985
20038
  };
19986
20039
  }
19987
20040
  //#endregion
@@ -22944,7 +22997,7 @@ async function getHmrImplementation(config) {
22944
22997
  //#endregion
22945
22998
  //#region src/node/ssr/fetchModule.ts
22946
22999
  /**
22947
- * Fetch module information for Vite runner.
23000
+ * Fetch module information for Vite module runner.
22948
23001
  * @experimental
22949
23002
  */
22950
23003
  async function fetchModule(environment, url, importer, options = {}) {
@@ -23107,6 +23160,9 @@ function createDepsOptimizer(environment) {
23107
23160
  (async () => {
23108
23161
  try {
23109
23162
  debug$9?.(import_picocolors.default.green(`scanning for dependencies...`));
23163
+ const scanTimer = setTimeout(() => {
23164
+ logger.info("[optimizer] scanning dependencies...", { timestamp: true });
23165
+ }, 1e3);
23110
23166
  let deps;
23111
23167
  try {
23112
23168
  discover = discoverProjectDependencies(devToScanEnvironment(environment));
@@ -23115,6 +23171,8 @@ function createDepsOptimizer(environment) {
23115
23171
  } catch (e) {
23116
23172
  environment.logger.error(import_picocolors.default.red("(!) Failed to run dependency scan. Skipping dependency pre-bundling. " + e.stack));
23117
23173
  return;
23174
+ } finally {
23175
+ clearTimeout(scanTimer);
23118
23176
  }
23119
23177
  const manuallyIncluded = Object.keys(manuallyIncludedDepsInfo);
23120
23178
  discoveredDepsWhileScanning.push(...Object.keys(metadata.discovered).filter((dep) => !deps[dep] && !manuallyIncluded.includes(dep)));
@@ -24045,15 +24103,239 @@ function renderRestrictedErrorHTML(msg) {
24045
24103
  `;
24046
24104
  }
24047
24105
  //#endregion
24048
- //#region src/node/server/transformRequest.ts
24106
+ //#region src/node/server/send.ts
24049
24107
  var import_etag = /* @__PURE__ */ __toESM(require_etag(), 1);
24108
+ const debug$8 = createDebugger("vite:send", { onlyWhenFocused: true });
24109
+ const alias = {
24110
+ js: "text/javascript",
24111
+ css: "text/css",
24112
+ html: "text/html",
24113
+ json: "application/json"
24114
+ };
24115
+ function send(req, res, content, type, options) {
24116
+ const { etag = (0, import_etag.default)(content, { weak: true }), cacheControl = "no-cache", headers, map } = options;
24117
+ if (res.writableEnded) return;
24118
+ if (req.headers["if-none-match"] === etag) {
24119
+ res.statusCode = 304;
24120
+ res.end();
24121
+ return;
24122
+ }
24123
+ res.setHeader("Content-Type", alias[type] || type);
24124
+ res.setHeader("Cache-Control", cacheControl);
24125
+ res.setHeader("Etag", etag);
24126
+ if (headers) for (const name in headers) res.setHeader(name, headers[name]);
24127
+ if (map && "version" in map && map.mappings) {
24128
+ if (type === "js" || type === "css") content = getCodeWithSourcemap(type, content.toString(), map);
24129
+ } else if (type === "js" && (!map || map.mappings !== "")) {
24130
+ const code = content.toString();
24131
+ if (import_convert_source_map.default.mapFileCommentRegex.test(code)) debug$8?.(`Skipped injecting fallback sourcemap for ${req.url}`);
24132
+ else {
24133
+ const urlWithoutTimestamp = removeTimestampQuery(req.url);
24134
+ content = getCodeWithSourcemap(type, code, new MagicString(code).generateMap({
24135
+ source: path.basename(urlWithoutTimestamp),
24136
+ hires: "boundary",
24137
+ includeContent: true
24138
+ }));
24139
+ }
24140
+ }
24141
+ res.statusCode = 200;
24142
+ if (req.method === "HEAD") res.end();
24143
+ else res.end(content);
24144
+ }
24145
+ //#endregion
24146
+ //#region src/node/server/middlewares/transform.ts
24147
+ const debugCache$1 = createDebugger("vite:cache");
24148
+ const knownIgnoreList = new Set(["/", "/favicon.ico"]);
24149
+ const documentFetchDests = new Set([
24150
+ "document",
24151
+ "iframe",
24152
+ "frame",
24153
+ "fencedframe"
24154
+ ]);
24155
+ function isDocumentFetchDest(req) {
24156
+ const fetchDest = req.headers["sec-fetch-dest"];
24157
+ return fetchDest !== void 0 && documentFetchDests.has(fetchDest);
24158
+ }
24159
+ const urlRE = /[?&]url\b/;
24160
+ const rawRE = /[?&]raw\b/;
24161
+ const inlineRE$1 = /[?&]inline\b/;
24162
+ const svgRE = /\.svg\b/;
24163
+ function isServerAccessDeniedForTransform(config, id) {
24164
+ if (rawRE.test(id) || urlRE.test(id) || inlineRE$1.test(id) || svgRE.test(id)) return checkLoadingAccess(config, cleanUrl(id)) !== "allowed" || checkLoadingAccess(config, id) !== "allowed";
24165
+ return false;
24166
+ }
24167
+ /**
24168
+ * A middleware that short-circuits the middleware chain to serve cached transformed modules
24169
+ */
24170
+ function cachedTransformMiddleware(server) {
24171
+ return function viteCachedTransformMiddleware(req, res, next) {
24172
+ const environment = server.environments.client;
24173
+ if (isDocumentFetchDest(req)) {
24174
+ res.appendHeader("Vary", "Sec-Fetch-Dest");
24175
+ return next();
24176
+ }
24177
+ const ifNoneMatch = req.headers["if-none-match"];
24178
+ if (ifNoneMatch) {
24179
+ const moduleByEtag = environment.moduleGraph.getModuleByEtag(ifNoneMatch);
24180
+ if (moduleByEtag?.transformResult?.etag === ifNoneMatch && moduleByEtag.url === req.url) {
24181
+ if (!isCSSRequest(req.url)) {
24182
+ debugCache$1?.(`[304] ${prettifyUrl(req.url, server.config.root)}`);
24183
+ res.statusCode = 304;
24184
+ return res.end();
24185
+ }
24186
+ }
24187
+ }
24188
+ next();
24189
+ };
24190
+ }
24191
+ function transformMiddleware(server) {
24192
+ const { root, publicDir } = server.config;
24193
+ const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
24194
+ const publicPath = `${publicDir.slice(root.length)}/`;
24195
+ return async function viteTransformMiddleware(req, res, next) {
24196
+ const environment = server.environments.client;
24197
+ if (req.method !== "GET" && req.method !== "HEAD" || knownIgnoreList.has(req.url) || isDocumentFetchDest(req)) return next();
24198
+ let url;
24199
+ try {
24200
+ url = decodeURI(removeTimestampQuery(req.url)).replace(NULL_BYTE_PLACEHOLDER, "\0");
24201
+ } catch (e) {
24202
+ if (e instanceof URIError) {
24203
+ server.config.logger.warn(import_picocolors.default.yellow(`Malformed URI sequence in request URL: ${removeTimestampQuery(req.url)}`));
24204
+ return next();
24205
+ }
24206
+ return next(e);
24207
+ }
24208
+ const withoutQuery = cleanUrl(url);
24209
+ try {
24210
+ if (withoutQuery.endsWith(".map")) {
24211
+ const depsOptimizer = environment.depsOptimizer;
24212
+ if (depsOptimizer?.isOptimizedDepUrl(url)) {
24213
+ const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath(path.resolve(server.config.root, url.slice(1)));
24214
+ if (!depsOptimizer.isOptimizedDepFile(sourcemapPath)) return next();
24215
+ try {
24216
+ const map = JSON.parse(await fsp.readFile(sourcemapPath, "utf-8"));
24217
+ applySourcemapIgnoreList(map, sourcemapPath, server.config.server.sourcemapIgnoreList, server.config.logger);
24218
+ return send(req, res, JSON.stringify(map), "json", { headers: server.config.server.headers });
24219
+ } catch {
24220
+ const dummySourceMap = {
24221
+ version: 3,
24222
+ file: sourcemapPath.replace(/\.map$/, ""),
24223
+ sources: [],
24224
+ sourcesContent: [],
24225
+ names: [],
24226
+ mappings: ";;;;;;;;;"
24227
+ };
24228
+ return send(req, res, JSON.stringify(dummySourceMap), "json", {
24229
+ cacheControl: "no-cache",
24230
+ headers: server.config.server.headers
24231
+ });
24232
+ }
24233
+ } else {
24234
+ const originalUrl = url.replace(/\.map($|\?)/, "$1");
24235
+ const map = (await environment.moduleGraph.getModuleByUrl(originalUrl))?.transformResult?.map;
24236
+ if (map) return send(req, res, JSON.stringify(map), "json", { headers: server.config.server.headers });
24237
+ else return next();
24238
+ }
24239
+ }
24240
+ if (publicDirInRoot && url.startsWith(publicPath)) warnAboutExplicitPublicPathInUrl(url);
24241
+ if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
24242
+ url = removeImportQuery(url);
24243
+ url = unwrapId(url);
24244
+ if (isCSSRequest(url)) {
24245
+ if (req.headers.accept?.includes("text/css") && !isDirectRequest(url)) url = injectQuery(url, "direct");
24246
+ const ifNoneMatch = req.headers["if-none-match"];
24247
+ if (ifNoneMatch && (await environment.moduleGraph.getModuleByUrl(url))?.transformResult?.etag === ifNoneMatch) {
24248
+ debugCache$1?.(`[304] ${prettifyUrl(url, server.config.root)}`);
24249
+ res.statusCode = 304;
24250
+ return res.end();
24251
+ }
24252
+ }
24253
+ const result = await environment.transformRequest(url);
24254
+ if (result) {
24255
+ const depsOptimizer = environment.depsOptimizer;
24256
+ const type = isDirectCSSRequest(url) ? "css" : "js";
24257
+ const isDep = DEP_VERSION_RE.test(url) || depsOptimizer?.isOptimizedDepUrl(url);
24258
+ return send(req, res, result.code, type, {
24259
+ etag: result.etag,
24260
+ cacheControl: isDep ? "max-age=31536000,immutable" : "no-cache",
24261
+ headers: server.config.server.headers,
24262
+ map: result.map
24263
+ });
24264
+ }
24265
+ }
24266
+ } catch (e) {
24267
+ if (e?.code === "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR") {
24268
+ if (!res.writableEnded) {
24269
+ res.statusCode = 504;
24270
+ res.statusMessage = "Optimize Deps Processing Error";
24271
+ res.end();
24272
+ }
24273
+ server.config.logger.error(e.message);
24274
+ return;
24275
+ }
24276
+ if (e?.code === "ERR_OUTDATED_OPTIMIZED_DEP") {
24277
+ if (!res.writableEnded) {
24278
+ res.statusCode = 504;
24279
+ res.statusMessage = "Outdated Optimize Dep";
24280
+ res.end();
24281
+ }
24282
+ return;
24283
+ }
24284
+ if (e?.code === "ERR_CLOSED_SERVER") {
24285
+ if (!res.writableEnded) {
24286
+ res.statusCode = 504;
24287
+ res.statusMessage = "Outdated Request";
24288
+ res.end();
24289
+ }
24290
+ return;
24291
+ }
24292
+ if (e?.code === "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR") {
24293
+ if (!res.writableEnded) {
24294
+ res.statusCode = 404;
24295
+ res.end();
24296
+ }
24297
+ server.config.logger.warn(import_picocolors.default.yellow(e.message));
24298
+ return;
24299
+ }
24300
+ if (e?.code === "ERR_LOAD_URL") return next();
24301
+ if (e?.code === "ERR_DENIED_ID") {
24302
+ const id = e.id;
24303
+ let servingAccessResult = checkLoadingAccess(server.config, cleanUrl(id));
24304
+ if (servingAccessResult === "allowed") servingAccessResult = checkLoadingAccess(server.config, id);
24305
+ if (servingAccessResult === "denied") {
24306
+ respondWithAccessDenied(id, server, res);
24307
+ return true;
24308
+ }
24309
+ if (servingAccessResult === "fallback") {
24310
+ next();
24311
+ return true;
24312
+ }
24313
+ throw new Error(`Unexpected access result for id ${id}`);
24314
+ }
24315
+ return next(e);
24316
+ }
24317
+ next();
24318
+ };
24319
+ function warnAboutExplicitPublicPathInUrl(url) {
24320
+ let warning;
24321
+ if (isImportRequest(url)) {
24322
+ const rawUrl = removeImportQuery(url);
24323
+ if (urlRE.test(url)) warning = `Assets in the public directory are served at the root path.\nInstead of ${import_picocolors.default.cyan(rawUrl)}, use ${import_picocolors.default.cyan(rawUrl.replace(publicPath, "/"))}.`;
24324
+ else warning = `Assets in public directory cannot be imported from JavaScript.
24325
+ If you intend to import that asset, put the file in the src directory, and use ${import_picocolors.default.cyan(rawUrl.replace(publicPath, "/src/"))} instead of ${import_picocolors.default.cyan(rawUrl)}.\nIf you intend to use the URL of that asset, use ${import_picocolors.default.cyan(injectQuery(rawUrl.replace(publicPath, "/"), "url"))}.`;
24326
+ } else warning = `Files in the public directory are served at the root path.\nInstead of ${import_picocolors.default.cyan(url)}, use ${import_picocolors.default.cyan(url.replace(publicPath, "/"))}.`;
24327
+ server.config.logger.warn(import_picocolors.default.yellow(warning));
24328
+ }
24329
+ }
24330
+ //#endregion
24331
+ //#region src/node/server/transformRequest.ts
24050
24332
  const ERR_LOAD_URL = "ERR_LOAD_URL";
24051
24333
  const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL";
24052
24334
  const ERR_DENIED_ID = "ERR_DENIED_ID";
24053
24335
  const debugLoad = createDebugger("vite:load");
24054
24336
  const debugTransform = createDebugger("vite:transform");
24055
- const debugCache$1 = createDebugger("vite:cache");
24056
- function transformRequest(environment, url, options = {}) {
24337
+ const debugCache = createDebugger("vite:cache");
24338
+ function transformRequest(environment, url, options) {
24057
24339
  if (environment._closing && environment.config.dev.recoverable) throwClosedServerError();
24058
24340
  const timestamp = monotonicDateNow();
24059
24341
  url = removeTimestampQuery(url);
@@ -24101,15 +24383,15 @@ async function doTransform(environment, url, options, timestamp) {
24101
24383
  return result;
24102
24384
  }
24103
24385
  async function getCachedTransformResult(environment, url, module, timestamp) {
24104
- const prettyUrl = debugCache$1 ? prettifyUrl(url, environment.config.root) : "";
24386
+ const prettyUrl = debugCache ? prettifyUrl(url, environment.config.root) : "";
24105
24387
  const softInvalidatedTransformResult = await handleModuleSoftInvalidation(environment, module, timestamp);
24106
24388
  if (softInvalidatedTransformResult) {
24107
- debugCache$1?.(`[memory-hmr] ${prettyUrl}`);
24389
+ debugCache?.(`[memory-hmr] ${prettyUrl}`);
24108
24390
  return softInvalidatedTransformResult;
24109
24391
  }
24110
24392
  const cached = module.transformResult;
24111
24393
  if (cached) {
24112
- debugCache$1?.(`[memory] ${prettyUrl}`);
24394
+ debugCache?.(`[memory] ${prettyUrl}`);
24113
24395
  return cached;
24114
24396
  }
24115
24397
  }
@@ -24117,7 +24399,7 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
24117
24399
  const { config, pluginContainer, logger } = environment;
24118
24400
  const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url, config.root) : "";
24119
24401
  const moduleGraph = environment.moduleGraph;
24120
- if (options.allowId && !options.allowId(id)) {
24402
+ if (!options.skipFsCheck && id[0] !== "\0" && isServerAccessDeniedForTransform(config, id)) {
24121
24403
  const err = /* @__PURE__ */ new Error(`Denied ID ${id}`);
24122
24404
  err.code = ERR_DENIED_ID;
24123
24405
  err.id = id;
@@ -24130,7 +24412,7 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
24130
24412
  const loadResult = await pluginContainer.load(id);
24131
24413
  if (loadResult == null) {
24132
24414
  const file = cleanUrl(id);
24133
- if (environment.config.consumer === "server" || isFileLoadingAllowed(environment.getTopLevelConfig(), slash(file))) {
24415
+ if (options.skipFsCheck || isFileLoadingAllowed(environment.getTopLevelConfig(), slash(file))) {
24134
24416
  try {
24135
24417
  code = await fsp.readFile(file, "utf-8");
24136
24418
  debugLoad?.(`${timeFrom(loadStart)} [fs] ${prettyUrl}`);
@@ -24140,7 +24422,7 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
24140
24422
  if (code != null && environment.pluginContainer.watcher) ensureWatchedFile(environment.pluginContainer.watcher, file, config.root);
24141
24423
  }
24142
24424
  if (code) try {
24143
- const extracted = extractSourcemapFromFile(code, file);
24425
+ const extracted = extractSourcemapFromFile(code, file, logger);
24144
24426
  if (extracted) {
24145
24427
  code = extracted.code;
24146
24428
  map = extracted.map;
@@ -24344,6 +24626,10 @@ var DevEnvironment = class extends BaseEnvironment {
24344
24626
  * @internal
24345
24627
  */
24346
24628
  _remoteRunnerOptions;
24629
+ /**
24630
+ * @internal
24631
+ */
24632
+ _skipFsCheck;
24347
24633
  get pluginContainer() {
24348
24634
  if (!this._pluginContainer) throw new Error(`${this.name} environment.pluginContainer called before initialized`);
24349
24635
  return this._pluginContainer;
@@ -24381,9 +24667,11 @@ var DevEnvironment = class extends BaseEnvironment {
24381
24667
  this.moduleGraph = new EnvironmentModuleGraph(name, (url) => this.pluginContainer.resolveId(url, void 0));
24382
24668
  this._crawlEndFinder = setupOnCrawlEnd();
24383
24669
  this._remoteRunnerOptions = context.remoteRunner ?? {};
24670
+ this._skipFsCheck = !!(context.transport && !(isWebSocketServer in context.transport) && context.transport.skipFsCheck);
24384
24671
  this.hot = context.transport ? isWebSocketServer in context.transport ? context.transport : normalizeHotChannel(context.transport, context.hot) : normalizeHotChannel({}, context.hot);
24385
24672
  this.hot.setInvokeHandler({
24386
24673
  fetchModule: (id, importer, options) => {
24674
+ if (context.disableFetchModule) throw new Error("fetchModule is disabled in this environment");
24387
24675
  return this.fetchModule(id, importer, options);
24388
24676
  },
24389
24677
  getBuiltins: async () => {
@@ -24427,6 +24715,12 @@ var DevEnvironment = class extends BaseEnvironment {
24427
24715
  await this.depsOptimizer?.init();
24428
24716
  warmupFiles(server, this);
24429
24717
  }
24718
+ /**
24719
+ * Called by the module runner to retrieve information about the specified
24720
+ * module. Internally calls `transformRequest` and wraps the result in the
24721
+ * format that the module runner understands.
24722
+ * This method is not meant to be called manually.
24723
+ */
24430
24724
  fetchModule(id, importer, options) {
24431
24725
  return fetchModule(this, id, importer, {
24432
24726
  ...this._remoteRunnerOptions,
@@ -24436,12 +24730,12 @@ var DevEnvironment = class extends BaseEnvironment {
24436
24730
  async reloadModule(module) {
24437
24731
  if (this.config.server.hmr !== false && module.file) updateModules(this, module.file, [module], monotonicDateNow());
24438
24732
  }
24439
- transformRequest(url, options) {
24440
- return transformRequest(this, url, options);
24733
+ transformRequest(url) {
24734
+ return transformRequest(this, url, { skipFsCheck: this._skipFsCheck });
24441
24735
  }
24442
24736
  async warmupRequest(url) {
24443
24737
  try {
24444
- await this.transformRequest(url);
24738
+ await transformRequest(this, url, { skipFsCheck: true });
24445
24739
  } catch (e) {
24446
24740
  if (e?.code === "ERR_OUTDATED_OPTIMIZED_DEP" || e?.code === "ERR_CLOSED_SERVER") return;
24447
24741
  this.logger.error(buildErrorMessage(e, [`Pre-transform error: ${e.message}`], false), {
@@ -24534,7 +24828,7 @@ function setupOnCrawlEnd() {
24534
24828
  }
24535
24829
  //#endregion
24536
24830
  //#region src/node/server/environments/fullBundleEnvironment.ts
24537
- const debug$8 = createDebugger("vite:full-bundle-mode");
24831
+ const debug$7 = createDebugger("vite:full-bundle-mode");
24538
24832
  var MemoryFiles = class {
24539
24833
  files = /* @__PURE__ */ new Map();
24540
24834
  get size() {
@@ -24581,7 +24875,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24581
24875
  }
24582
24876
  async listen(_server) {
24583
24877
  this.hot.listen();
24584
- debug$8?.("INITIAL: setup bundle options");
24878
+ debug$7?.("INITIAL: setup bundle options");
24585
24879
  const rollupOptions = await this.getRolldownOptions();
24586
24880
  if (Array.isArray(rollupOptions.output) && rollupOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
24587
24881
  const outputOptions = Array.isArray(rollupOptions.output) ? rollupOptions.output[0] : rollupOptions.output;
@@ -24605,7 +24899,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24605
24899
  const { updates, changedFiles } = result;
24606
24900
  if (changedFiles.length === 0) return;
24607
24901
  if (updates.every((update) => update.update.type === "Noop")) {
24608
- debug$8?.(`ignored file change for ${changedFiles.join(", ")}`);
24902
+ debug$7?.(`ignored file change for ${changedFiles.join(", ")}`);
24609
24903
  return;
24610
24904
  }
24611
24905
  for (const { clientId, update } of updates) {
@@ -24635,14 +24929,14 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24635
24929
  },
24636
24930
  watch: { skipWrite: true }
24637
24931
  });
24638
- debug$8?.("INITIAL: setup dev engine");
24932
+ debug$7?.("INITIAL: setup dev engine");
24639
24933
  this.devEngine.run().then(() => {
24640
- debug$8?.("INITIAL: run done");
24934
+ debug$7?.("INITIAL: run done");
24641
24935
  }, (e) => {
24642
- debug$8?.("INITIAL: run error", e);
24936
+ debug$7?.("INITIAL: run error", e);
24643
24937
  });
24644
24938
  this.waitForInitialBuildFinish().then(() => {
24645
- debug$8?.("INITIAL: build done");
24939
+ debug$7?.("INITIAL: build done");
24646
24940
  this.hot.send({
24647
24941
  type: "full-reload",
24648
24942
  path: "*"
@@ -24661,10 +24955,10 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24661
24955
  (async () => {
24662
24956
  const invalidateCalledModules = this.invalidateCalledModules.get(client);
24663
24957
  if (invalidateCalledModules?.has(m.path)) {
24664
- debug$8?.(`INVALIDATE: invalidate received from ${m.path}, but ignored because it was already invalidated`);
24958
+ debug$7?.(`INVALIDATE: invalidate received from ${m.path}, but ignored because it was already invalidated`);
24665
24959
  return;
24666
24960
  }
24667
- debug$8?.(`INVALIDATE: invalidate received from ${m.path}, re-triggering HMR`);
24961
+ debug$7?.(`INVALIDATE: invalidate received from ${m.path}, re-triggering HMR`);
24668
24962
  if (!invalidateCalledModules) this.invalidateCalledModules.set(client, /* @__PURE__ */ new Set([]));
24669
24963
  this.invalidateCalledModules.get(client).add(m.path);
24670
24964
  let update;
@@ -24689,7 +24983,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24689
24983
  this.devEngine.ensureLatestBuildOutput().then(() => {
24690
24984
  this.debouncedFullReload();
24691
24985
  });
24692
- debug$8?.(`TRIGGER: access to stale bundle, triggered bundle re-generation`);
24986
+ debug$7?.(`TRIGGER: access to stale bundle, triggered bundle re-generation`);
24693
24987
  }
24694
24988
  return shouldTrigger;
24695
24989
  }
@@ -24735,7 +25029,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24735
25029
  });
24736
25030
  return;
24737
25031
  }
24738
- debug$8?.(`handle hmr output for ${shortFile}`, {
25032
+ debug$7?.(`handle hmr output for ${shortFile}`, {
24739
25033
  ...hmrOutput,
24740
25034
  code: typeof hmrOutput.code === "string" ? "[code]" : hmrOutput.code
24741
25035
  });
@@ -24755,7 +25049,10 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24755
25049
  type: "update",
24756
25050
  updates
24757
25051
  });
24758
- this.logger.info(import_picocolors.default.green(`hmr update `) + import_picocolors.default.dim([...new Set(updates.map((u) => u.path))].join(", ")), {
25052
+ const filePaths = [...new Set(updates.map((u) => u.path))];
25053
+ const { formatted, truncated } = formatAndTruncateFileList(filePaths);
25054
+ if (truncated) debugHmr?.(`hmr update ${filePaths.join(", ")}`);
25055
+ this.logger.info(import_picocolors.default.green(`hmr update `) + import_picocolors.default.dim(formatted), {
24759
25056
  clear: !invalidateInformation,
24760
25057
  timestamp: true
24761
25058
  });
@@ -24799,7 +25096,7 @@ function debounce(time, cb) {
24799
25096
  }
24800
25097
  //#endregion
24801
25098
  //#region src/node/server/middlewares/htmlFallback.ts
24802
- const debug$7 = createDebugger("vite:html-fallback");
25099
+ const debug$6 = createDebugger("vite:html-fallback");
24803
25100
  function htmlFallbackMiddleware(root, spaFallback, clientEnvironment) {
24804
25101
  const memoryFiles = clientEnvironment instanceof FullBundleDevEnvironment ? clientEnvironment.memoryFiles : void 0;
24805
25102
  function checkFileExists(relativePath) {
@@ -24816,252 +25113,31 @@ function htmlFallbackMiddleware(root, spaFallback, clientEnvironment) {
24816
25113
  }
24817
25114
  if (pathname.endsWith(".html")) {
24818
25115
  if (checkFileExists(pathname)) {
24819
- debug$7?.(`Rewriting ${req.method} ${req.url} to ${url}`);
25116
+ debug$6?.(`Rewriting ${req.method} ${req.url} to ${url}`);
24820
25117
  req.url = url;
24821
25118
  return next();
24822
25119
  }
24823
25120
  } else if (pathname.endsWith("/")) {
24824
25121
  if (checkFileExists(joinUrlSegments(pathname, "index.html"))) {
24825
25122
  const newUrl = url + "index.html";
24826
- debug$7?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
25123
+ debug$6?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
24827
25124
  req.url = newUrl;
24828
25125
  return next();
24829
25126
  }
24830
25127
  } else if (checkFileExists(pathname + ".html")) {
24831
25128
  const newUrl = url + ".html";
24832
- debug$7?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
25129
+ debug$6?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
24833
25130
  req.url = newUrl;
24834
25131
  return next();
24835
25132
  }
24836
25133
  if (spaFallback) {
24837
- debug$7?.(`Rewriting ${req.method} ${req.url} to /index.html`);
25134
+ debug$6?.(`Rewriting ${req.method} ${req.url} to /index.html`);
24838
25135
  req.url = "/index.html";
24839
25136
  }
24840
25137
  next();
24841
25138
  };
24842
25139
  }
24843
25140
  //#endregion
24844
- //#region src/node/server/send.ts
24845
- const debug$6 = createDebugger("vite:send", { onlyWhenFocused: true });
24846
- const alias = {
24847
- js: "text/javascript",
24848
- css: "text/css",
24849
- html: "text/html",
24850
- json: "application/json"
24851
- };
24852
- function send(req, res, content, type, options) {
24853
- const { etag = (0, import_etag.default)(content, { weak: true }), cacheControl = "no-cache", headers, map } = options;
24854
- if (res.writableEnded) return;
24855
- if (req.headers["if-none-match"] === etag) {
24856
- res.statusCode = 304;
24857
- res.end();
24858
- return;
24859
- }
24860
- res.setHeader("Content-Type", alias[type] || type);
24861
- res.setHeader("Cache-Control", cacheControl);
24862
- res.setHeader("Etag", etag);
24863
- if (headers) for (const name in headers) res.setHeader(name, headers[name]);
24864
- if (map && "version" in map && map.mappings) {
24865
- if (type === "js" || type === "css") content = getCodeWithSourcemap(type, content.toString(), map);
24866
- } else if (type === "js" && (!map || map.mappings !== "")) {
24867
- const code = content.toString();
24868
- if (import_convert_source_map.default.mapFileCommentRegex.test(code)) debug$6?.(`Skipped injecting fallback sourcemap for ${req.url}`);
24869
- else {
24870
- const urlWithoutTimestamp = removeTimestampQuery(req.url);
24871
- content = getCodeWithSourcemap(type, code, new MagicString(code).generateMap({
24872
- source: path.basename(urlWithoutTimestamp),
24873
- hires: "boundary",
24874
- includeContent: true
24875
- }));
24876
- }
24877
- }
24878
- res.statusCode = 200;
24879
- if (req.method === "HEAD") res.end();
24880
- else res.end(content);
24881
- }
24882
- //#endregion
24883
- //#region src/node/server/middlewares/transform.ts
24884
- const debugCache = createDebugger("vite:cache");
24885
- const knownIgnoreList = new Set(["/", "/favicon.ico"]);
24886
- const documentFetchDests = new Set([
24887
- "document",
24888
- "iframe",
24889
- "frame",
24890
- "fencedframe"
24891
- ]);
24892
- function isDocumentFetchDest(req) {
24893
- const fetchDest = req.headers["sec-fetch-dest"];
24894
- return fetchDest !== void 0 && documentFetchDests.has(fetchDest);
24895
- }
24896
- const urlRE = /[?&]url\b/;
24897
- const rawRE = /[?&]raw\b/;
24898
- const inlineRE$1 = /[?&]inline\b/;
24899
- const svgRE = /\.svg\b/;
24900
- function isServerAccessDeniedForTransform(config, id) {
24901
- if (rawRE.test(id) || urlRE.test(id) || inlineRE$1.test(id) || svgRE.test(id)) return checkLoadingAccess(config, id) !== "allowed";
24902
- return false;
24903
- }
24904
- /**
24905
- * A middleware that short-circuits the middleware chain to serve cached transformed modules
24906
- */
24907
- function cachedTransformMiddleware(server) {
24908
- return function viteCachedTransformMiddleware(req, res, next) {
24909
- const environment = server.environments.client;
24910
- if (isDocumentFetchDest(req)) {
24911
- res.appendHeader("Vary", "Sec-Fetch-Dest");
24912
- return next();
24913
- }
24914
- const ifNoneMatch = req.headers["if-none-match"];
24915
- if (ifNoneMatch) {
24916
- const moduleByEtag = environment.moduleGraph.getModuleByEtag(ifNoneMatch);
24917
- if (moduleByEtag?.transformResult?.etag === ifNoneMatch && moduleByEtag.url === req.url) {
24918
- if (!isCSSRequest(req.url)) {
24919
- debugCache?.(`[304] ${prettifyUrl(req.url, server.config.root)}`);
24920
- res.statusCode = 304;
24921
- return res.end();
24922
- }
24923
- }
24924
- }
24925
- next();
24926
- };
24927
- }
24928
- function transformMiddleware(server) {
24929
- const { root, publicDir } = server.config;
24930
- const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
24931
- const publicPath = `${publicDir.slice(root.length)}/`;
24932
- return async function viteTransformMiddleware(req, res, next) {
24933
- const environment = server.environments.client;
24934
- if (req.method !== "GET" && req.method !== "HEAD" || knownIgnoreList.has(req.url) || isDocumentFetchDest(req)) return next();
24935
- let url;
24936
- try {
24937
- url = decodeURI(removeTimestampQuery(req.url)).replace(NULL_BYTE_PLACEHOLDER, "\0");
24938
- } catch (e) {
24939
- if (e instanceof URIError) {
24940
- server.config.logger.warn(import_picocolors.default.yellow(`Malformed URI sequence in request URL: ${removeTimestampQuery(req.url)}`));
24941
- return next();
24942
- }
24943
- return next(e);
24944
- }
24945
- const withoutQuery = cleanUrl(url);
24946
- try {
24947
- if (withoutQuery.endsWith(".map")) if (environment.depsOptimizer?.isOptimizedDepUrl(url)) {
24948
- const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath(path.resolve(server.config.root, url.slice(1)));
24949
- try {
24950
- const map = JSON.parse(await fsp.readFile(sourcemapPath, "utf-8"));
24951
- applySourcemapIgnoreList(map, sourcemapPath, server.config.server.sourcemapIgnoreList, server.config.logger);
24952
- return send(req, res, JSON.stringify(map), "json", { headers: server.config.server.headers });
24953
- } catch {
24954
- const dummySourceMap = {
24955
- version: 3,
24956
- file: sourcemapPath.replace(/\.map$/, ""),
24957
- sources: [],
24958
- sourcesContent: [],
24959
- names: [],
24960
- mappings: ";;;;;;;;;"
24961
- };
24962
- return send(req, res, JSON.stringify(dummySourceMap), "json", {
24963
- cacheControl: "no-cache",
24964
- headers: server.config.server.headers
24965
- });
24966
- }
24967
- } else {
24968
- const originalUrl = url.replace(/\.map($|\?)/, "$1");
24969
- const map = (await environment.moduleGraph.getModuleByUrl(originalUrl))?.transformResult?.map;
24970
- if (map) return send(req, res, JSON.stringify(map), "json", { headers: server.config.server.headers });
24971
- else return next();
24972
- }
24973
- if (publicDirInRoot && url.startsWith(publicPath)) warnAboutExplicitPublicPathInUrl(url);
24974
- if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
24975
- url = removeImportQuery(url);
24976
- url = unwrapId(url);
24977
- if (isCSSRequest(url)) {
24978
- if (req.headers.accept?.includes("text/css") && !isDirectRequest(url)) url = injectQuery(url, "direct");
24979
- const ifNoneMatch = req.headers["if-none-match"];
24980
- if (ifNoneMatch && (await environment.moduleGraph.getModuleByUrl(url))?.transformResult?.etag === ifNoneMatch) {
24981
- debugCache?.(`[304] ${prettifyUrl(url, server.config.root)}`);
24982
- res.statusCode = 304;
24983
- return res.end();
24984
- }
24985
- }
24986
- const result = await environment.transformRequest(url, { allowId(id) {
24987
- return id[0] === "\0" || !isServerAccessDeniedForTransform(server.config, id);
24988
- } });
24989
- if (result) {
24990
- const depsOptimizer = environment.depsOptimizer;
24991
- const type = isDirectCSSRequest(url) ? "css" : "js";
24992
- const isDep = DEP_VERSION_RE.test(url) || depsOptimizer?.isOptimizedDepUrl(url);
24993
- return send(req, res, result.code, type, {
24994
- etag: result.etag,
24995
- cacheControl: isDep ? "max-age=31536000,immutable" : "no-cache",
24996
- headers: server.config.server.headers,
24997
- map: result.map
24998
- });
24999
- }
25000
- }
25001
- } catch (e) {
25002
- if (e?.code === "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR") {
25003
- if (!res.writableEnded) {
25004
- res.statusCode = 504;
25005
- res.statusMessage = "Optimize Deps Processing Error";
25006
- res.end();
25007
- }
25008
- server.config.logger.error(e.message);
25009
- return;
25010
- }
25011
- if (e?.code === "ERR_OUTDATED_OPTIMIZED_DEP") {
25012
- if (!res.writableEnded) {
25013
- res.statusCode = 504;
25014
- res.statusMessage = "Outdated Optimize Dep";
25015
- res.end();
25016
- }
25017
- return;
25018
- }
25019
- if (e?.code === "ERR_CLOSED_SERVER") {
25020
- if (!res.writableEnded) {
25021
- res.statusCode = 504;
25022
- res.statusMessage = "Outdated Request";
25023
- res.end();
25024
- }
25025
- return;
25026
- }
25027
- if (e?.code === "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR") {
25028
- if (!res.writableEnded) {
25029
- res.statusCode = 404;
25030
- res.end();
25031
- }
25032
- server.config.logger.warn(import_picocolors.default.yellow(e.message));
25033
- return;
25034
- }
25035
- if (e?.code === "ERR_LOAD_URL") return next();
25036
- if (e?.code === "ERR_DENIED_ID") {
25037
- const id = e.id;
25038
- const servingAccessResult = checkLoadingAccess(server.config, id);
25039
- if (servingAccessResult === "denied") {
25040
- respondWithAccessDenied(id, server, res);
25041
- return true;
25042
- }
25043
- if (servingAccessResult === "fallback") {
25044
- next();
25045
- return true;
25046
- }
25047
- throw new Error(`Unexpected access result for id ${id}`);
25048
- }
25049
- return next(e);
25050
- }
25051
- next();
25052
- };
25053
- function warnAboutExplicitPublicPathInUrl(url) {
25054
- let warning;
25055
- if (isImportRequest(url)) {
25056
- const rawUrl = removeImportQuery(url);
25057
- if (urlRE.test(url)) warning = `Assets in the public directory are served at the root path.\nInstead of ${import_picocolors.default.cyan(rawUrl)}, use ${import_picocolors.default.cyan(rawUrl.replace(publicPath, "/"))}.`;
25058
- else warning = `Assets in public directory cannot be imported from JavaScript.
25059
- If you intend to import that asset, put the file in the src directory, and use ${import_picocolors.default.cyan(rawUrl.replace(publicPath, "/src/"))} instead of ${import_picocolors.default.cyan(rawUrl)}.\nIf you intend to use the URL of that asset, use ${import_picocolors.default.cyan(injectQuery(rawUrl.replace(publicPath, "/"), "url"))}.`;
25060
- } else warning = `Files in the public directory are served at the root path.\nInstead of ${import_picocolors.default.cyan(url)}, use ${import_picocolors.default.cyan(url.replace(publicPath, "/"))}.`;
25061
- server.config.logger.warn(import_picocolors.default.yellow(warning));
25062
- }
25063
- }
25064
- //#endregion
25065
25141
  //#region src/node/server/middlewares/indexHtml.ts
25066
25142
  function createDevHtmlTransformFn(config) {
25067
25143
  const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config.plugins);
@@ -25805,7 +25881,7 @@ function getAdditionalAllowedHosts(resolvedServerOptions, resolvedPreviewOptions
25805
25881
  return list;
25806
25882
  }
25807
25883
  function hostValidationMiddleware(allowedHosts, isPreview) {
25808
- return hostValidationMiddleware$2({
25884
+ return hostValidationMiddleware$1({
25809
25885
  allowedHosts: Object.freeze([...allowedHosts]),
25810
25886
  generateErrorMessage(hostname) {
25811
25887
  const hostnameWithQuotes = JSON.stringify(hostname);
@@ -26681,7 +26757,10 @@ function updateModules(environment, file, modules, timestamp, firstInvalidatedBy
26681
26757
  debugHmr?.(import_picocolors.default.yellow(`no update happened `) + import_picocolors.default.dim(file));
26682
26758
  return;
26683
26759
  }
26684
- environment.logger.info(import_picocolors.default.green(`hmr update `) + import_picocolors.default.dim([...new Set(updates.map((u) => u.path))].join(", ")), {
26760
+ const filePaths = [...new Set(updates.map((u) => u.path))];
26761
+ const { formatted, truncated } = formatAndTruncateFileList(filePaths);
26762
+ if (truncated) debugHmr?.(`hmr update ${filePaths.join(", ")}`);
26763
+ environment.logger.info(import_picocolors.default.green(`hmr update `) + import_picocolors.default.dim(formatted), {
26685
26764
  clear: !firstInvalidatedBy,
26686
26765
  timestamp: true
26687
26766
  });
@@ -26887,6 +26966,7 @@ function createServerHotChannel() {
26887
26966
  const innerEmitter = new EventEmitter();
26888
26967
  const outsideEmitter = new EventEmitter();
26889
26968
  return {
26969
+ skipFsCheck: true,
26890
26970
  send(payload) {
26891
26971
  outsideEmitter.emit("send", payload);
26892
26972
  },
@@ -29056,7 +29136,7 @@ function createFilterForTransform(idFilter, codeFilter, moduleTypeFilter, cwd) {
29056
29136
  };
29057
29137
  }
29058
29138
  //#endregion
29059
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/helpers.js
29139
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.2/node_modules/@vitest/utils/dist/helpers.js
29060
29140
  function notNullish(v) {
29061
29141
  return v != null;
29062
29142
  }
@@ -29064,7 +29144,7 @@ function isPrimitive(value) {
29064
29144
  return value === null || typeof value !== "function" && typeof value !== "object";
29065
29145
  }
29066
29146
  //#endregion
29067
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
29147
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.2/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
29068
29148
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
29069
29149
  function normalizeWindowsPath(input = "") {
29070
29150
  if (!input) return input;
@@ -29143,7 +29223,7 @@ const isAbsolute$2 = function(p) {
29143
29223
  return _IS_ABSOLUTE_RE.test(p);
29144
29224
  };
29145
29225
  //#endregion
29146
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.0/node_modules/@vitest/utils/dist/source-map.js
29226
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.2/node_modules/@vitest/utils/dist/source-map.js
29147
29227
  var comma = ",".charCodeAt(0);
29148
29228
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
29149
29229
  var intToChar = new Uint8Array(64);
@@ -29547,7 +29627,7 @@ function formatError(payload, environment, sourceMapCache) {
29547
29627
  const result = environment.moduleGraph.getModuleById(id)?.transformResult;
29548
29628
  if (result && !result.map) try {
29549
29629
  const filePath = id.split("?")[0];
29550
- const extracted = extractSourcemapFromFile(result.code, filePath);
29630
+ const extracted = extractSourcemapFromFile(result.code, filePath, environment.config.logger);
29551
29631
  sourceMapCache.set(id, extracted?.map);
29552
29632
  return extracted?.map;
29553
29633
  } catch {
@@ -31352,9 +31432,15 @@ function runOptimizeDeps(environment, depsInfo) {
31352
31432
  cancel: cleanUp
31353
31433
  };
31354
31434
  const start = performance$1.now();
31435
+ const bundleTimer = setTimeout(() => {
31436
+ environment.logger.info("[optimizer] bundling dependencies...", { timestamp: true });
31437
+ }, 1e3);
31355
31438
  const preparedRun = prepareRolldownOptimizerRun(environment, depsInfo, processingCacheDir, optimizerContext);
31356
31439
  const runResult = preparedRun.then(({ context, idToExports }) => {
31357
- if (!context || optimizerContext.cancelled) return cancelledResult;
31440
+ if (!context || optimizerContext.cancelled) {
31441
+ clearTimeout(bundleTimer);
31442
+ return cancelledResult;
31443
+ }
31358
31444
  return context.build().then((result) => {
31359
31445
  const depForEntryFileName = {};
31360
31446
  for (const dep of Object.values(depsInfo)) {
@@ -31385,9 +31471,11 @@ function runOptimizeDeps(environment, depsInfo) {
31385
31471
  });
31386
31472
  }
31387
31473
  }
31474
+ clearTimeout(bundleTimer);
31388
31475
  debug$2?.(`Dependencies bundled in ${(performance$1.now() - start).toFixed(2)}ms`);
31389
31476
  return successfulResult;
31390
31477
  }).catch((e) => {
31478
+ clearTimeout(bundleTimer);
31391
31479
  if (e.errors && e.message.includes("The build was canceled")) return cancelledResult;
31392
31480
  e.message = import_picocolors.default.red("Error during dependency optimization:\n\n") + e.message;
31393
31481
  throw e;
@@ -32015,6 +32103,7 @@ function resolveSubpathImports(id, importer, options) {
32015
32103
  importsPath = path.relative(basedir, path.join(pkgData.dir, importsPath));
32016
32104
  if (!relativePrefixRE.test(importsPath)) importsPath = `./${importsPath}`;
32017
32105
  }
32106
+ if (importsPath == null) return;
32018
32107
  return importsPath + postfix;
32019
32108
  }
32020
32109
  function ensureVersionQuery(resolved, id, options, depsOptimizer) {
@@ -32648,7 +32737,7 @@ const _buildEnvironmentOptionsDefaults = Object.freeze({
32648
32737
  watch: null
32649
32738
  });
32650
32739
  const buildEnvironmentOptionsDefaults = _buildEnvironmentOptionsDefaults;
32651
- function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev) {
32740
+ function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev, isSsrTargetWebworkerEnvironment) {
32652
32741
  const deprecatedPolyfillModulePreload = raw.polyfillModulePreload;
32653
32742
  const { polyfillModulePreload, ...rest } = raw;
32654
32743
  raw = rest;
@@ -32666,7 +32755,7 @@ function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev) {
32666
32755
  }, raw);
32667
32756
  setupRollupOptionCompat(merged, "build");
32668
32757
  merged.rolldownOptions = {
32669
- platform: consumer === "server" ? "node" : "browser",
32758
+ platform: consumer === "client" || isSsrTargetWebworkerEnvironment ? "browser" : "node",
32670
32759
  ...merged.rolldownOptions
32671
32760
  };
32672
32761
  if (merged.target === "baseline-widely-available") merged.target = ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET;
@@ -32760,6 +32849,7 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
32760
32849
  }
32761
32850
  };
32762
32851
  const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
32852
+ if (isSsrTargetWebworkerEnvironment) plugins.push(esmExternalRequirePlugin());
32763
32853
  const buildOutputOptions = (output = {}) => {
32764
32854
  if (output.output) logger.warn("You've set \"rollupOptions.output.output\" in your config. This is deprecated and will override all Vite.js default output options. Please use \"rollupOptions.output\" instead.");
32765
32855
  if (output.file) throw new Error("Vite does not support \"rollupOptions.output.file\". Please use \"rollupOptions.output.dir\" and \"rollupOptions.output.entryFileNames\" instead.");
@@ -33755,7 +33845,8 @@ function defaultCreateClientDevEnvironment(name, config, context) {
33755
33845
  });
33756
33846
  return new DevEnvironment(name, config, {
33757
33847
  hot: true,
33758
- transport: context.ws
33848
+ transport: context.ws,
33849
+ disableFetchModule: true
33759
33850
  });
33760
33851
  }
33761
33852
  function defaultCreateDevEnvironment(name, config) {
@@ -33880,7 +33971,7 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimi
33880
33971
  consumer,
33881
33972
  optimizeDeps: resolveDepOptimizationOptions(options.optimizeDeps, resolve.preserveSymlinks, forceOptimizeDeps, consumer, logger),
33882
33973
  dev: resolveDevEnvironmentOptions(options.dev, environmentName, consumer, preTransformRequests),
33883
- build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundledDev),
33974
+ build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundledDev, isSsrTargetWebworkerEnvironment),
33884
33975
  plugins: void 0,
33885
33976
  optimizeDepsPluginNames: void 0
33886
33977
  };
@@ -34676,4 +34767,4 @@ const parseAst$1 = parseAst;
34676
34767
  const parseAstAsync$1 = parseAstAsync;
34677
34768
  const esbuildVersion = "0.25.0";
34678
34769
  //#endregion
34679
- export { depsFromOptimizedDepInfo as $, builderOptionsDefaults as A, searchForWorkspaceRoot as At, resolveBuilderOptions as B, transformWithEsbuild as Bt, resolvePreviewOptions as C, send as Ct, ChunkMetadataMap as D, fetchModule as Dt, BuildEnvironment as E, isFileServingAllowed as Et, injectEnvironmentToHooks as F, createServerModuleRunnerTransport as Ft, toOutputFilePathInHtml as G, mergeConfig as Gt, resolveRolldownOptions as H, createFilter$1 as Ht, onRollupLog as I, buildErrorMessage as It, addManuallyIncludedOptimizeDeps as J, rollupVersion as Jt, toOutputFilePathInJS as K, normalizePath as Kt, resolveBuildEnvironmentOptions as L, loadEnv as Lt, createBuilder as M, perEnvironmentState as Mt, createToImportMetaURLBasedRelativeRuntime as N, ssrTransform as Nt, build as O, formatPostcssSourceMap as Ot, enhanceRollupError as P, createServerModuleRunner as Pt, createIsOptimizedDepUrl as Q, resolveBuildOutputs as R, resolveEnvPrefix as Rt, preview as S, serverConfigDefaults as St, isRunnableDevEnvironment as T, isFileLoadingAllowed as Tt, resolveUserExternal as U, isCSSRequest as Ut, resolveLibFilename as V, perEnvironmentPlugin as Vt, toOutputFilePathInCss as W, mergeAlias as Wt, cleanupDepsCacheStaleDirs as X, addOptimizedDepInfo as Y, withFilter as Yt, createIsOptimizedDepFile as Z, resolveConfig as _, createServer$2 as _t, minifySync as a, initDepsOptimizerMetadata as at, sortUserPlugins as b, resolveServerOptions as bt, parseAstAsync$1 as c, optimizeDeps as ct, isFetchableDevEnvironment as d, optimizedDepInfoFromId as dt, depsLogString as et, defineConfig as f, optimizedDepNeedsInterop as ft, resolveBaseUrl as g, _createServer as gt, loadConfigFromFile as h, createServerHotChannel as ht, minify as i, getOptimizedDepPath as it, clearLine as j, createIdResolver as jt, buildEnvironmentOptionsDefaults as k, preprocessCSS as kt, parseSync as l, optimizeExplicitEnvironmentDeps as lt, isResolvedConfig as m, toDiscoveredDependencies as mt, esbuildVersion as n, extractExportsData as nt, parse as o, isDepOptimizationDisabled as ot, getDefaultEnvironmentOptions as p, runOptimizeDeps as pt, toOutputFilePathWithoutRuntime as q, rolldownVersion as qt, esmExternalRequirePlugin as r, getDepsCacheDir as rt, parseAst$1 as s, loadCachedDepOptimizationMetadata as st, Visitor as t, discoverProjectDependencies as tt, createFetchableDevEnvironment as u, optimizedDepInfoFromFile as ut, resolveDevEnvironmentOptions as v, createServerCloseFn as vt, createRunnableDevEnvironment as w, DevEnvironment as wt, runnerImport as x, restartServerWithUrls as xt, resolveDevToolsConfig as y, resolveForwardConsoleOptions as yt, resolveBuildPlugins as z, transformWithOxc as zt };
34770
+ export { depsFromOptimizedDepInfo as $, builderOptionsDefaults as A, searchForWorkspaceRoot as At, resolveBuilderOptions as B, transformWithEsbuild as Bt, resolvePreviewOptions as C, DevEnvironment as Ct, ChunkMetadataMap as D, fetchModule as Dt, BuildEnvironment as E, isFileServingAllowed as Et, injectEnvironmentToHooks as F, createServerModuleRunnerTransport as Ft, toOutputFilePathInHtml as G, mergeConfig as Gt, resolveRolldownOptions as H, createFilter$1 as Ht, onRollupLog as I, buildErrorMessage as It, addManuallyIncludedOptimizeDeps as J, rollupVersion as Jt, toOutputFilePathInJS as K, normalizePath as Kt, resolveBuildEnvironmentOptions as L, loadEnv as Lt, createBuilder as M, perEnvironmentState as Mt, createToImportMetaURLBasedRelativeRuntime as N, ssrTransform as Nt, build as O, formatPostcssSourceMap as Ot, enhanceRollupError as P, createServerModuleRunner as Pt, createIsOptimizedDepUrl as Q, resolveBuildOutputs as R, resolveEnvPrefix as Rt, preview as S, serverConfigDefaults as St, isRunnableDevEnvironment as T, isFileLoadingAllowed as Tt, resolveUserExternal as U, isCSSRequest as Ut, resolveLibFilename as V, perEnvironmentPlugin as Vt, toOutputFilePathInCss as W, mergeAlias as Wt, cleanupDepsCacheStaleDirs as X, addOptimizedDepInfo as Y, withFilter as Yt, createIsOptimizedDepFile as Z, resolveConfig as _, createServer$2 as _t, minifySync as a, initDepsOptimizerMetadata as at, sortUserPlugins as b, resolveServerOptions as bt, parseAstAsync$1 as c, optimizeDeps as ct, isFetchableDevEnvironment as d, optimizedDepInfoFromId as dt, depsLogString as et, defineConfig as f, optimizedDepNeedsInterop as ft, resolveBaseUrl as g, _createServer as gt, loadConfigFromFile as h, createServerHotChannel as ht, minify as i, getOptimizedDepPath as it, clearLine as j, createIdResolver as jt, buildEnvironmentOptionsDefaults as k, preprocessCSS as kt, parseSync as l, optimizeExplicitEnvironmentDeps as lt, isResolvedConfig as m, toDiscoveredDependencies as mt, esbuildVersion as n, extractExportsData as nt, parse as o, isDepOptimizationDisabled as ot, getDefaultEnvironmentOptions as p, runOptimizeDeps as pt, toOutputFilePathWithoutRuntime as q, rolldownVersion as qt, esmExternalRequirePlugin$1 as r, getDepsCacheDir as rt, parseAst$1 as s, loadCachedDepOptimizationMetadata as st, Visitor as t, discoverProjectDependencies as tt, createFetchableDevEnvironment as u, optimizedDepInfoFromFile as ut, resolveDevEnvironmentOptions as v, createServerCloseFn as vt, createRunnableDevEnvironment as w, send as wt, runnerImport as x, restartServerWithUrls as xt, resolveDevToolsConfig as y, resolveForwardConsoleOptions as yt, resolveBuildPlugins as z, transformWithOxc as zt };
@@ -31,7 +31,7 @@ import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownA
31
31
 
32
32
  //#region \0rolldown/runtime.js
33
33
  //#endregion
34
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.5_typescript@5.9.3_vite@packages+vite_vue@3.5.30_typescript@5.9.3_/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
34
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.13_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
35
35
  //#region src/node/cli-commands.d.ts
36
36
  interface StartOptions {
37
37
  root?: string;
@@ -41,7 +41,7 @@ interface StartOptions {
41
41
  open?: boolean;
42
42
  }
43
43
  //#endregion
44
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.5_typescript@5.9.3_vite@packages+vite_vue@3.5.30_typescript@5.9.3_/node_modules/@vitejs/devtools/dist/config.d.ts
44
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.13_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
45
45
  //#region src/node/config.d.ts
46
46
  interface DevToolsConfig extends Partial<StartOptions> {
47
47
  enabled: boolean;
@@ -1019,7 +1019,6 @@ interface TransformOptions {
1019
1019
  */
1020
1020
  ssr?: boolean;
1021
1021
  }
1022
- interface TransformOptionsInternal {}
1023
1022
  //#endregion
1024
1023
  //#region src/node/server/moduleGraph.d.ts
1025
1024
  declare class EnvironmentModuleNode {
@@ -1184,6 +1183,11 @@ interface HotChannelClient {
1184
1183
  }
1185
1184
  type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void;
1186
1185
  interface HotChannel<Api = any> {
1186
+ /**
1187
+ * When true, the fs access check is skipped in fetchModule.
1188
+ * Set this for transports that is not exposed over the network.
1189
+ */
1190
+ skipFsCheck?: boolean;
1187
1191
  /**
1188
1192
  * Broadcast events to all clients
1189
1193
  */
@@ -1608,9 +1612,15 @@ declare class DevEnvironment extends BaseEnvironment {
1608
1612
  * - new instance `listen`
1609
1613
  */
1610
1614
  listen(server: ViteDevServer): Promise<void>;
1615
+ /**
1616
+ * Called by the module runner to retrieve information about the specified
1617
+ * module. Internally calls `transformRequest` and wraps the result in the
1618
+ * format that the module runner understands.
1619
+ * This method is not meant to be called manually.
1620
+ */
1611
1621
  fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<moduleRunner_FetchResult>;
1612
1622
  reloadModule(module: EnvironmentModuleNode): Promise<void>;
1613
- transformRequest(url: string, options?: TransformOptionsInternal): Promise<TransformResult | null>;
1623
+ transformRequest(url: string): Promise<TransformResult | null>;
1614
1624
  warmupRequest(url: string): Promise<void>;
1615
1625
  protected invalidateModule(m: {
1616
1626
  path: string;
@@ -3727,7 +3737,7 @@ interface FetchModuleOptions {
3727
3737
  startOffset?: number;
3728
3738
  }
3729
3739
  /**
3730
- * Fetch module information for Vite runner.
3740
+ * Fetch module information for Vite module runner.
3731
3741
  * @experimental
3732
3742
  */
3733
3743
  declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>;
@@ -1,3 +1,3 @@
1
1
  import { F as defaultAllowedOrigins, N as VERSION, _ as DEFAULT_SERVER_CONDITIONS, d as DEFAULT_CLIENT_MAIN_FIELDS, h as DEFAULT_EXTERNAL_CONDITIONS, n as createLogger, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS } from "./chunks/logger.js";
2
- import { At as searchForWorkspaceRoot, Bt as transformWithEsbuild, Ct as send, Dt as fetchModule, E as BuildEnvironment, Et as isFileServingAllowed, Ft as createServerModuleRunnerTransport, Gt as mergeConfig, Ht as createFilter, It as buildErrorMessage, Jt as rollupVersion, Kt as normalizePath, Lt as loadEnv, M as createBuilder, Mt as perEnvironmentState, Nt as ssrTransform, O as build, Ot as formatPostcssSourceMap, Pt as createServerModuleRunner, Rt as resolveEnvPrefix, S as preview, T as isRunnableDevEnvironment, Tt as isFileLoadingAllowed, Ut as isCSSRequest, Vt as perEnvironmentPlugin, Wt as mergeAlias, Yt as withFilter, _ as resolveConfig, _t as createServer, a as minifySync, b as sortUserPlugins, c as parseAstAsync, ct as optimizeDeps, d as isFetchableDevEnvironment, f as defineConfig, h as loadConfigFromFile, ht as createServerHotChannel, i as minify, jt as createIdResolver, kt as preprocessCSS, l as parseSync, n as esbuildVersion, o as parse, qt as rolldownVersion, r as esmExternalRequirePlugin, s as parseAst, t as Visitor, u as createFetchableDevEnvironment, w as createRunnableDevEnvironment, wt as DevEnvironment, x as runnerImport, zt as transformWithOxc } from "./chunks/node.js";
2
+ import { At as searchForWorkspaceRoot, Bt as transformWithEsbuild, Ct as DevEnvironment, Dt as fetchModule, E as BuildEnvironment, Et as isFileServingAllowed, Ft as createServerModuleRunnerTransport, Gt as mergeConfig, Ht as createFilter, It as buildErrorMessage, Jt as rollupVersion, Kt as normalizePath, Lt as loadEnv, M as createBuilder, Mt as perEnvironmentState, Nt as ssrTransform, O as build, Ot as formatPostcssSourceMap, Pt as createServerModuleRunner, Rt as resolveEnvPrefix, S as preview, T as isRunnableDevEnvironment, Tt as isFileLoadingAllowed, Ut as isCSSRequest, Vt as perEnvironmentPlugin, Wt as mergeAlias, Yt as withFilter, _ as resolveConfig, _t as createServer, a as minifySync, b as sortUserPlugins, c as parseAstAsync, ct as optimizeDeps, d as isFetchableDevEnvironment, f as defineConfig, h as loadConfigFromFile, ht as createServerHotChannel, i as minify, jt as createIdResolver, kt as preprocessCSS, l as parseSync, n as esbuildVersion, o as parse, qt as rolldownVersion, r as esmExternalRequirePlugin, s as parseAst, t as Visitor, u as createFetchableDevEnvironment, w as createRunnableDevEnvironment, wt as send, x as runnerImport, zt as transformWithOxc } from "./chunks/node.js";
3
3
  export { BuildEnvironment, DevEnvironment, Visitor, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.3",
3
+ "version": "8.0.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -80,10 +80,10 @@
80
80
  "@vercel/detect-agent": "^1.2.1",
81
81
  "@types/escape-html": "^1.0.4",
82
82
  "@types/pnpapi": "^0.0.5",
83
- "@vitest/utils": "4.1.0",
84
- "@vitejs/devtools": "^0.1.5",
85
- "artichokie": "^0.4.2",
86
- "baseline-browser-mapping": "^2.10.10",
83
+ "@vitest/utils": "4.1.2",
84
+ "@vitejs/devtools": "^0.1.13",
85
+ "artichokie": "^0.4.3",
86
+ "baseline-browser-mapping": "^2.10.15",
87
87
  "cac": "^7.0.0",
88
88
  "chokidar": "^3.6.0",
89
89
  "connect": "^3.7.0",
@@ -92,11 +92,11 @@
92
92
  "cross-spawn": "^7.0.6",
93
93
  "dotenv-expand": "^12.0.3",
94
94
  "es-module-lexer": "^1.7.0",
95
- "esbuild": "^0.27.4",
95
+ "esbuild": "^0.28.0",
96
96
  "escape-html": "^1.0.3",
97
97
  "estree-walker": "^3.0.3",
98
98
  "etag": "^1.8.1",
99
- "host-validation-middleware": "^0.1.2",
99
+ "host-validation-middleware": "^0.1.4",
100
100
  "http-proxy-3": "^1.23.2",
101
101
  "launch-editor-middleware": "^2.13.2",
102
102
  "magic-string": "^0.30.21",
@@ -114,11 +114,11 @@
114
114
  "postcss-modules": "^6.0.1",
115
115
  "premove": "^4.0.0",
116
116
  "resolve.exports": "^2.0.3",
117
- "rolldown-plugin-dts": "^0.22.5",
117
+ "rolldown-plugin-dts": "^0.23.2",
118
118
  "rollup": "^4.59.0",
119
119
  "rollup-plugin-license": "^3.7.0",
120
- "sass": "^1.98.0",
121
- "sass-embedded": "^1.98.0",
120
+ "sass": "^1.99.0",
121
+ "sass-embedded": "^1.99.0",
122
122
  "sirv": "^3.0.2",
123
123
  "strip-literal": "^3.1.0",
124
124
  "terser": "^5.46.1",
@@ -128,7 +128,7 @@
128
128
  "peerDependencies": {
129
129
  "@types/node": "^20.19.0 || >=22.12.0",
130
130
  "@vitejs/devtools": "^0.1.0",
131
- "esbuild": "^0.27.0",
131
+ "esbuild": "^0.27.0 || ^0.28.0",
132
132
  "jiti": ">=1.21.0",
133
133
  "less": "^4.0.0",
134
134
  "sass": "^1.70.0",