vite 5.4.15 → 5.4.17

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,4 +1,4 @@
1
- import { B as getDefaultExportFromCjs } from './dep-CevzF2vT.js';
1
+ import { B as getDefaultExportFromCjs } from './dep-Dyl6b77n.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-IQS-Za7F.js';
@@ -1,4 +1,4 @@
1
- import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-CevzF2vT.js';
1
+ import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-Dyl6b77n.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -16865,10 +16865,10 @@ function removeImportQuery(url) {
16865
16865
  function removeDirectQuery(url) {
16866
16866
  return url.replace(directRequestRE$1, "$1").replace(trailingSeparatorRE, "");
16867
16867
  }
16868
- const urlRE = /(\?|&)url(?:&|$)/;
16869
- const rawRE = /(\?|&)raw(?:&|$)/;
16868
+ const urlRE$1 = /(\?|&)url(?:&|$)/;
16869
+ const rawRE$1 = /(\?|&)raw(?:&|$)/;
16870
16870
  function removeUrlQuery(url) {
16871
- return url.replace(urlRE, "$1").replace(trailingSeparatorRE, "");
16871
+ return url.replace(urlRE$1, "$1").replace(trailingSeparatorRE, "");
16872
16872
  }
16873
16873
  const replacePercentageRE = /%/g;
16874
16874
  function injectQuery(url, queryToInject) {
@@ -20302,7 +20302,7 @@ function assetPlugin(config) {
20302
20302
  moduleGraph = server.moduleGraph;
20303
20303
  },
20304
20304
  resolveId(id) {
20305
- if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
20305
+ if (!config.assetsInclude(cleanUrl(id)) && !urlRE$1.test(id)) {
20306
20306
  return;
20307
20307
  }
20308
20308
  const publicFile = checkPublicFile(id, config);
@@ -20314,14 +20314,14 @@ function assetPlugin(config) {
20314
20314
  if (id[0] === "\0") {
20315
20315
  return;
20316
20316
  }
20317
- if (rawRE.test(id)) {
20317
+ if (rawRE$1.test(id)) {
20318
20318
  const file = checkPublicFile(id, config) || cleanUrl(id);
20319
20319
  this.addWatchFile(file);
20320
20320
  return `export default ${JSON.stringify(
20321
20321
  await fsp.readFile(file, "utf-8")
20322
20322
  )}`;
20323
20323
  }
20324
- if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) {
20324
+ if (!urlRE$1.test(id) && !config.assetsInclude(cleanUrl(id))) {
20325
20325
  return;
20326
20326
  }
20327
20327
  id = removeUrlQuery(id);
@@ -36062,7 +36062,7 @@ const directRequestRE = /[?&]direct\b/;
36062
36062
  const htmlProxyRE = /[?&]html-proxy\b/;
36063
36063
  const htmlProxyIndexRE = /&index=(\d+)/;
36064
36064
  const commonjsProxyRE = /\?commonjs-proxy/;
36065
- const inlineRE$1 = /[?&]inline\b/;
36065
+ const inlineRE$2 = /[?&]inline\b/;
36066
36066
  const inlineCSSRE = /[?&]inline-css\b/;
36067
36067
  const styleAttrRE = /[?&]style-attr\b/;
36068
36068
  const functionCallRE = /^[A-Z_][\w-]*\(/i;
@@ -36111,7 +36111,7 @@ function cssPlugin(config) {
36111
36111
  },
36112
36112
  async load(id) {
36113
36113
  if (!isCSSRequest(id)) return;
36114
- if (urlRE.test(id)) {
36114
+ if (urlRE$1.test(id)) {
36115
36115
  if (isModuleCSSRequest(id)) {
36116
36116
  throw new Error(
36117
36117
  `?url is not supported with CSS modules. (tried to import ${JSON.stringify(
@@ -36245,7 +36245,7 @@ function cssPostPlugin(config) {
36245
36245
  );
36246
36246
  return `export default ''`;
36247
36247
  }
36248
- const inlined = inlineRE$1.test(id);
36248
+ const inlined = inlineRE$2.test(id);
36249
36249
  const modules = cssModulesCache.get(config).get(id);
36250
36250
  const modulesCode = modules && !inlined && dataToEsm(modules, { namedExports: true, preferConst: true });
36251
36251
  if (config.command === "serve") {
@@ -36620,7 +36620,7 @@ function cssAnalysisPlugin(config) {
36620
36620
  const { moduleGraph } = server;
36621
36621
  const thisModule = moduleGraph.getModuleById(id);
36622
36622
  if (thisModule) {
36623
- const isSelfAccepting = !cssModulesCache.get(config)?.get(id) && !inlineRE$1.test(id) && !htmlProxyRE.test(id);
36623
+ const isSelfAccepting = !cssModulesCache.get(config)?.get(id) && !inlineRE$2.test(id) && !htmlProxyRE.test(id);
36624
36624
  const pluginImports = this._addedImports;
36625
36625
  if (pluginImports) {
36626
36626
  const depModules = /* @__PURE__ */ new Set();
@@ -36991,8 +36991,8 @@ function createCachedImport(imp) {
36991
36991
  return cached;
36992
36992
  };
36993
36993
  }
36994
- const importPostcssImport = createCachedImport(() => import('./dep-Bhfdk6-y.js').then(function (n) { return n.i; }));
36995
- const importPostcssModules = createCachedImport(() => import('./dep-DzdyzNcV.js').then(function (n) { return n.i; }));
36994
+ const importPostcssImport = createCachedImport(() => import('./dep-Bg3it0Nb.js').then(function (n) { return n.i; }));
36995
+ const importPostcssModules = createCachedImport(() => import('./dep-DeS6hsO7.js').then(function (n) { return n.i; }));
36996
36996
  const importPostcss = createCachedImport(() => import('postcss'));
36997
36997
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
36998
36998
  let alwaysFakeWorkerWorkerControllerCache;
@@ -47527,6 +47527,7 @@ function escapeReplacement(value) {
47527
47527
  }
47528
47528
 
47529
47529
  const wasmHelperId = "\0vite/wasm-helper.js";
47530
+ const wasmInitRE = /(?<![?#].*)\.wasm\?init/;
47530
47531
  const wasmHelper = async (opts = {}, url) => {
47531
47532
  let result;
47532
47533
  if (url.startsWith("data:")) {
@@ -47571,7 +47572,7 @@ const wasmHelperPlugin = (config) => {
47571
47572
  if (id === wasmHelperId) {
47572
47573
  return `export default ${wasmHelperCode}`;
47573
47574
  }
47574
- if (!id.endsWith(".wasm?init")) {
47575
+ if (!wasmInitRE.test(id)) {
47575
47576
  return;
47576
47577
  }
47577
47578
  const url = await fileToUrl$1(id, config, this);
@@ -47598,7 +47599,7 @@ const wasmFallbackPlugin = () => {
47598
47599
 
47599
47600
  const workerOrSharedWorkerRE = /(?:\?|&)(worker|sharedworker)(?:&|$)/;
47600
47601
  const workerFileRE = /(?:\?|&)worker_file&type=(\w+)(?:&|$)/;
47601
- const inlineRE = /[?&]inline\b/;
47602
+ const inlineRE$1 = /[?&]inline\b/;
47602
47603
  const WORKER_FILE_ID = "worker_file";
47603
47604
  const workerCache = /* @__PURE__ */ new WeakMap();
47604
47605
  function saveEmitWorkerAsset(config, asset) {
@@ -47796,7 +47797,7 @@ function webWorkerPlugin(config) {
47796
47797
  if (isBuild) {
47797
47798
  if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) {
47798
47799
  urlCode = "self.location.href";
47799
- } else if (inlineRE.test(id)) {
47800
+ } else if (inlineRE$1.test(id)) {
47800
47801
  const chunk = await bundleWorkerEntry(config, id);
47801
47802
  const encodedJs = `const encodedJs = "${Buffer.from(
47802
47803
  chunk.code
@@ -47851,7 +47852,7 @@ function webWorkerPlugin(config) {
47851
47852
  url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
47852
47853
  urlCode = JSON.stringify(url);
47853
47854
  }
47854
- if (urlRE.test(id)) {
47855
+ if (urlRE$1.test(id)) {
47855
47856
  return {
47856
47857
  code: `export default ${urlCode}`,
47857
47858
  map: { mappings: "" }
@@ -48488,7 +48489,7 @@ function parseDynamicImportPattern(strings) {
48488
48489
  let globParams = null;
48489
48490
  if (search) {
48490
48491
  search = "?" + search;
48491
- if (workerOrSharedWorkerRE.test(search) || urlRE.test(search) || rawRE.test(search)) {
48492
+ if (workerOrSharedWorkerRE.test(search) || urlRE$1.test(search) || rawRE$1.test(search)) {
48492
48493
  globParams = {
48493
48494
  query: search,
48494
48495
  import: "*"
@@ -51640,7 +51641,7 @@ function servePublicMiddleware(server, publicFiles) {
51640
51641
  };
51641
51642
  return function viteServePublicMiddleware(req, res, next) {
51642
51643
  if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed
51643
- urlRE.test(req.url)) {
51644
+ urlRE$1.test(req.url)) {
51644
51645
  return next();
51645
51646
  }
51646
51647
  serve(req, res, next);
@@ -51764,6 +51765,7 @@ function renderRestrictedErrorHTML(msg) {
51764
51765
 
51765
51766
  const ERR_LOAD_URL = "ERR_LOAD_URL";
51766
51767
  const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL";
51768
+ const ERR_DENIED_ID = "ERR_DENIED_ID";
51767
51769
  const debugLoad = createDebugger("vite:load");
51768
51770
  const debugTransform = createDebugger("vite:transform");
51769
51771
  const debugCache$1 = createDebugger("vite:cache");
@@ -51865,6 +51867,11 @@ async function loadAndTransform(id, url, server, options, timestamp, mod, resolv
51865
51867
  const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url, config.root) : "";
51866
51868
  const ssr = !!options.ssr;
51867
51869
  const file = cleanUrl(id);
51870
+ if (options.allowId && !options.allowId(id)) {
51871
+ const err = new Error(`Denied ID ${id}`);
51872
+ err.code = ERR_DENIED_ID;
51873
+ throw err;
51874
+ }
51868
51875
  let code = null;
51869
51876
  let map = null;
51870
51877
  const loadStart = debugLoad ? performance$1.now() : 0;
@@ -61929,6 +61936,13 @@ function send(req, res, content, type, options) {
61929
61936
  const debugCache = createDebugger("vite:cache");
61930
61937
  const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
61931
61938
  const trailingQuerySeparatorsRE = /[?&]+$/;
61939
+ const urlRE = /[?&]url\b/;
61940
+ const rawRE = /[?&]raw\b/;
61941
+ const inlineRE = /[?&]inline\b/;
61942
+ const svgRE = /\.svg\b/;
61943
+ function deniedServingAccessForTransform(url, server, res, next) {
61944
+ return (rawRE.test(url) || urlRE.test(url) || inlineRE.test(url) || svgRE.test(url)) && !ensureServingAccess(url, server, res, next);
61945
+ }
61932
61946
  function cachedTransformMiddleware(server) {
61933
61947
  return function viteCachedTransformMiddleware(req, res, next) {
61934
61948
  const ifNoneMatch = req.headers["if-none-match"];
@@ -62016,7 +62030,7 @@ function transformMiddleware(server) {
62016
62030
  trailingQuerySeparatorsRE,
62017
62031
  ""
62018
62032
  );
62019
- if ((rawRE.test(urlWithoutTrailingQuerySeparators) || urlRE.test(urlWithoutTrailingQuerySeparators)) && !ensureServingAccess(
62033
+ if (deniedServingAccessForTransform(
62020
62034
  urlWithoutTrailingQuerySeparators,
62021
62035
  server,
62022
62036
  res,
@@ -62039,7 +62053,10 @@ function transformMiddleware(server) {
62039
62053
  }
62040
62054
  }
62041
62055
  const result = await transformRequest(url, server, {
62042
- html: req.headers.accept?.includes("text/html")
62056
+ html: req.headers.accept?.includes("text/html"),
62057
+ allowId(id) {
62058
+ return !deniedServingAccessForTransform(id, server, res, next);
62059
+ }
62043
62060
  });
62044
62061
  if (result) {
62045
62062
  const depsOptimizer = getDepsOptimizer(server.config, false);
@@ -62091,6 +62108,9 @@ function transformMiddleware(server) {
62091
62108
  if (e?.code === ERR_LOAD_URL) {
62092
62109
  return next();
62093
62110
  }
62111
+ if (e?.code === ERR_DENIED_ID) {
62112
+ return;
62113
+ }
62094
62114
  return next(e);
62095
62115
  }
62096
62116
  next();
@@ -64330,7 +64350,7 @@ function importAnalysisPlugin(config) {
64330
64350
  if (specifier === clientPublicPath) {
64331
64351
  return;
64332
64352
  }
64333
- if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE.test(specifier)) && checkPublicFile(specifier, config)) {
64353
+ if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE$1.test(specifier)) && checkPublicFile(specifier, config)) {
64334
64354
  throw new Error(
64335
64355
  `Cannot import non-asset file ${specifier} which is inside /public. JS/CSS files inside /public are copied as-is on build and can only be referenced via <script src> or <link href> in html. If you want to get the URL of that file, use ${injectQuery(
64336
64356
  specifier,
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-CevzF2vT.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-Dyl6b77n.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -731,7 +731,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
731
731
  `[boolean] force the optimizer to ignore the cache and re-bundle`
732
732
  ).action(async (root, options) => {
733
733
  filterDuplicateOptions(options);
734
- const { createServer } = await import('./chunks/dep-CevzF2vT.js').then(function (n) { return n.E; });
734
+ const { createServer } = await import('./chunks/dep-Dyl6b77n.js').then(function (n) { return n.E; });
735
735
  try {
736
736
  const server = await createServer({
737
737
  root,
@@ -823,7 +823,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
823
823
  `[boolean] force empty outDir when it's outside of root`
824
824
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
825
825
  filterDuplicateOptions(options);
826
- const { build } = await import('./chunks/dep-CevzF2vT.js').then(function (n) { return n.F; });
826
+ const { build } = await import('./chunks/dep-Dyl6b77n.js').then(function (n) { return n.F; });
827
827
  const buildOptions = cleanOptions(options);
828
828
  try {
829
829
  await build({
@@ -852,7 +852,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
852
852
  ).action(
853
853
  async (root, options) => {
854
854
  filterDuplicateOptions(options);
855
- const { optimizeDeps } = await import('./chunks/dep-CevzF2vT.js').then(function (n) { return n.D; });
855
+ const { optimizeDeps } = await import('./chunks/dep-Dyl6b77n.js').then(function (n) { return n.D; });
856
856
  try {
857
857
  const config = await resolveConfig(
858
858
  {
@@ -878,7 +878,7 @@ ${e.stack}`),
878
878
  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(
879
879
  async (root, options) => {
880
880
  filterDuplicateOptions(options);
881
- const { preview } = await import('./chunks/dep-CevzF2vT.js').then(function (n) { return n.G; });
881
+ const { preview } = await import('./chunks/dep-Dyl6b77n.js').then(function (n) { return n.G; });
882
882
  try {
883
883
  const server = await preview({
884
884
  root,
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-CevzF2vT.js';
3
- export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-CevzF2vT.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-Dyl6b77n.js';
3
+ export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Dyl6b77n.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import { existsSync, readFileSync } from 'node:fs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.4.15",
3
+ "version": "5.4.17",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",