vite 6.1.2 → 6.1.4

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 { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-CE7taEzf.js';
1
+ import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-B--GINb9.js';
2
2
  import require$$0$2 from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -9769,10 +9769,10 @@ function removeImportQuery(url) {
9769
9769
  function removeDirectQuery(url) {
9770
9770
  return url.replace(directRequestRE$1, "$1").replace(trailingSeparatorRE, "");
9771
9771
  }
9772
- const urlRE = /(\?|&)url(?:&|$)/;
9773
- const rawRE = /(\?|&)raw(?:&|$)/;
9772
+ const urlRE$1 = /(\?|&)url(?:&|$)/;
9773
+ const rawRE$1 = /(\?|&)raw(?:&|$)/;
9774
9774
  function removeUrlQuery(url) {
9775
- return url.replace(urlRE, "$1").replace(trailingSeparatorRE, "");
9775
+ return url.replace(urlRE$1, "$1").replace(trailingSeparatorRE, "");
9776
9776
  }
9777
9777
  function injectQuery(url, queryToInject) {
9778
9778
  const { file, postfix } = splitFileAndPostfix(url);
@@ -13444,7 +13444,7 @@ function checkPublicFile(url, config) {
13444
13444
  const assetUrlRE = /__VITE_ASSET__([\w$]+)__(?:\$_(.*?)__)?/g;
13445
13445
  const jsSourceMapRE = /\.[cm]?js\.map$/;
13446
13446
  const noInlineRE = /[?&]no-inline\b/;
13447
- const inlineRE$2 = /[?&]inline\b/;
13447
+ const inlineRE$3 = /[?&]inline\b/;
13448
13448
  const svgExtRE = /\.svg(?:$|\?)/;
13449
13449
  const assetCache = /* @__PURE__ */ new WeakMap();
13450
13450
  const cssEntriesMap = /* @__PURE__ */ new WeakMap();
@@ -13511,7 +13511,7 @@ function assetPlugin(config) {
13511
13511
  cssEntriesMap.set(this.environment, /* @__PURE__ */ new Set());
13512
13512
  },
13513
13513
  resolveId(id) {
13514
- if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
13514
+ if (!config.assetsInclude(cleanUrl(id)) && !urlRE$1.test(id)) {
13515
13515
  return;
13516
13516
  }
13517
13517
  const publicFile = checkPublicFile(id, config);
@@ -13523,14 +13523,14 @@ function assetPlugin(config) {
13523
13523
  if (id[0] === "\0") {
13524
13524
  return;
13525
13525
  }
13526
- if (rawRE.test(id)) {
13526
+ if (rawRE$1.test(id)) {
13527
13527
  const file = checkPublicFile(id, config) || cleanUrl(id);
13528
13528
  this.addWatchFile(file);
13529
13529
  return `export default ${JSON.stringify(
13530
13530
  await fsp.readFile(file, "utf-8")
13531
13531
  )}`;
13532
13532
  }
13533
- if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) {
13533
+ if (!urlRE$1.test(id) && !config.assetsInclude(cleanUrl(id))) {
13534
13534
  return;
13535
13535
  }
13536
13536
  id = removeUrlQuery(id);
@@ -13588,13 +13588,14 @@ async function fileToUrl$1(pluginContext, id) {
13588
13588
  async function fileToDevUrl(environment, id, skipBase = false) {
13589
13589
  const config = environment.getTopLevelConfig();
13590
13590
  const publicFile = checkPublicFile(id, config);
13591
- if (inlineRE$2.test(id)) {
13591
+ if (inlineRE$3.test(id)) {
13592
13592
  const file = publicFile || cleanUrl(id);
13593
13593
  const content = await fsp.readFile(file);
13594
13594
  return assetToDataURL(environment, file, content);
13595
13595
  }
13596
- if (svgExtRE.test(id)) {
13597
- const file = publicFile || cleanUrl(id);
13596
+ const cleanedId = cleanUrl(id);
13597
+ if (svgExtRE.test(cleanedId)) {
13598
+ const file = publicFile || cleanedId;
13598
13599
  const content = await fsp.readFile(file);
13599
13600
  if (shouldInline(environment, file, id, content, undefined, undefined)) {
13600
13601
  return assetToDataURL(environment, file, content);
@@ -13645,7 +13646,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
13645
13646
  if (!skipPublicCheck) {
13646
13647
  const publicFile = checkPublicFile(id, topLevelConfig);
13647
13648
  if (publicFile) {
13648
- if (inlineRE$2.test(id)) {
13649
+ if (inlineRE$3.test(id)) {
13649
13650
  id = publicFile;
13650
13651
  } else {
13651
13652
  return publicFileToBuiltUrl(id, topLevelConfig);
@@ -13694,7 +13695,7 @@ async function urlToBuiltUrl(pluginContext, url, importer, forceInline) {
13694
13695
  }
13695
13696
  function shouldInline(environment, file, id, content, buildPluginContext, forceInline) {
13696
13697
  if (noInlineRE.test(id)) return false;
13697
- if (inlineRE$2.test(id)) return true;
13698
+ if (inlineRE$3.test(id)) return true;
13698
13699
  if (buildPluginContext) {
13699
13700
  if (environment.config.build.lib) return true;
13700
13701
  if (buildPluginContext.getModuleInfo(id)?.isEntry) return false;
@@ -41862,7 +41863,7 @@ function servePublicMiddleware(server, publicFiles) {
41862
41863
  };
41863
41864
  return function viteServePublicMiddleware(req, res, next) {
41864
41865
  if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed
41865
- urlRE.test(req.url)) {
41866
+ urlRE$1.test(req.url)) {
41866
41867
  return next();
41867
41868
  }
41868
41869
  serve(req, res, next);
@@ -41995,6 +41996,7 @@ function renderRestrictedErrorHTML(msg) {
41995
41996
 
41996
41997
  const ERR_LOAD_URL = "ERR_LOAD_URL";
41997
41998
  const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL";
41999
+ const ERR_DENIED_ID = "ERR_DENIED_ID";
41998
42000
  const debugLoad = createDebugger("vite:load");
41999
42001
  const debugTransform = createDebugger("vite:transform");
42000
42002
  const debugCache$1 = createDebugger("vite:cache");
@@ -42094,6 +42096,11 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
42094
42096
  const { config, pluginContainer, logger } = environment;
42095
42097
  const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url, config.root) : "";
42096
42098
  const moduleGraph = environment.moduleGraph;
42099
+ if (options.allowId && !options.allowId(id)) {
42100
+ const err = new Error(`Denied ID ${id}`);
42101
+ err.code = ERR_DENIED_ID;
42102
+ throw err;
42103
+ }
42097
42104
  let code = null;
42098
42105
  let map = null;
42099
42106
  const loadStart = debugLoad ? performance.now() : 0;
@@ -43525,6 +43532,13 @@ function decodeURIIfPossible(input) {
43525
43532
  const debugCache = createDebugger("vite:cache");
43526
43533
  const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
43527
43534
  const trailingQuerySeparatorsRE = /[?&]+$/;
43535
+ const urlRE = /[?&]url\b/;
43536
+ const rawRE = /[?&]raw\b/;
43537
+ const inlineRE$2 = /[?&]inline\b/;
43538
+ const svgRE = /\.svg\b/;
43539
+ function deniedServingAccessForTransform(url, server, res, next) {
43540
+ return (rawRE.test(url) || urlRE.test(url) || inlineRE$2.test(url) || svgRE.test(url)) && !ensureServingAccess(url, server, res, next);
43541
+ }
43528
43542
  function cachedTransformMiddleware(server) {
43529
43543
  return function viteCachedTransformMiddleware(req, res, next) {
43530
43544
  const environment = server.environments.client;
@@ -43614,7 +43628,7 @@ function transformMiddleware(server) {
43614
43628
  trailingQuerySeparatorsRE,
43615
43629
  ""
43616
43630
  );
43617
- if ((rawRE.test(urlWithoutTrailingQuerySeparators) || urlRE.test(urlWithoutTrailingQuerySeparators)) && !ensureServingAccess(
43631
+ if (deniedServingAccessForTransform(
43618
43632
  urlWithoutTrailingQuerySeparators,
43619
43633
  server,
43620
43634
  res,
@@ -43637,7 +43651,10 @@ function transformMiddleware(server) {
43637
43651
  }
43638
43652
  }
43639
43653
  const result = await transformRequest(environment, url, {
43640
- html: req.headers.accept?.includes("text/html")
43654
+ html: req.headers.accept?.includes("text/html"),
43655
+ allowId(id) {
43656
+ return !deniedServingAccessForTransform(id, server, res, next);
43657
+ }
43641
43658
  });
43642
43659
  if (result) {
43643
43660
  const depsOptimizer = environment.depsOptimizer;
@@ -43689,6 +43706,9 @@ function transformMiddleware(server) {
43689
43706
  if (e?.code === ERR_LOAD_URL) {
43690
43707
  return next();
43691
43708
  }
43709
+ if (e?.code === ERR_DENIED_ID) {
43710
+ return;
43711
+ }
43692
43712
  return next(e);
43693
43713
  }
43694
43714
  next();
@@ -46486,7 +46506,7 @@ function webWorkerPlugin(config) {
46486
46506
  url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
46487
46507
  urlCode = JSON.stringify(url);
46488
46508
  }
46489
- if (urlRE.test(id)) {
46509
+ if (urlRE$1.test(id)) {
46490
46510
  return {
46491
46511
  code: `export default ${urlCode}`,
46492
46512
  map: { mappings: "" }
@@ -46928,7 +46948,7 @@ function importAnalysisPlugin(config) {
46928
46948
  if (specifier === clientPublicPath) {
46929
46949
  return;
46930
46950
  }
46931
- if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE.test(specifier)) && checkPublicFile(specifier, config)) {
46951
+ if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE$1.test(specifier)) && checkPublicFile(specifier, config)) {
46932
46952
  throw new Error(
46933
46953
  `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(
46934
46954
  specifier,
@@ -47388,6 +47408,7 @@ function escapeReplacement(value) {
47388
47408
  }
47389
47409
 
47390
47410
  const wasmHelperId = "\0vite/wasm-helper.js";
47411
+ const wasmInitRE = /(?<![?#].*)\.wasm\?init/;
47391
47412
  const wasmHelper = async (opts = {}, url) => {
47392
47413
  let result;
47393
47414
  if (url.startsWith("data:")) {
@@ -47432,7 +47453,7 @@ const wasmHelperPlugin = () => {
47432
47453
  if (id === wasmHelperId) {
47433
47454
  return `export default ${wasmHelperCode}`;
47434
47455
  }
47435
- if (!id.endsWith(".wasm?init")) {
47456
+ if (!wasmInitRE.test(id)) {
47436
47457
  return;
47437
47458
  }
47438
47459
  const url = await fileToUrl$1(this, id);
@@ -47949,7 +47970,7 @@ function parseDynamicImportPattern(strings) {
47949
47970
  let globParams = null;
47950
47971
  if (search) {
47951
47972
  search = "?" + search;
47952
- if (workerOrSharedWorkerRE.test(search) || urlRE.test(search) || rawRE.test(search)) {
47973
+ if (workerOrSharedWorkerRE.test(search) || urlRE$1.test(search) || rawRE$1.test(search)) {
47953
47974
  globParams = {
47954
47975
  query: search,
47955
47976
  import: "*"
@@ -49087,7 +49108,7 @@ function cssPlugin(config) {
49087
49108
  },
49088
49109
  async load(id) {
49089
49110
  if (!isCSSRequest(id)) return;
49090
- if (urlRE.test(id)) {
49111
+ if (urlRE$1.test(id)) {
49091
49112
  if (isModuleCSSRequest(id)) {
49092
49113
  throw new Error(
49093
49114
  `?url is not supported with CSS modules. (tried to import ${JSON.stringify(
@@ -49998,8 +50019,8 @@ function createCachedImport(imp) {
49998
50019
  return cached;
49999
50020
  };
50000
50021
  }
50001
- const importPostcssImport = createCachedImport(() => import('./dep-DmVEsGRf.js').then(function (n) { return n.i; }));
50002
- const importPostcssModules = createCachedImport(() => import('./dep-DEFzlAOo.js').then(function (n) { return n.i; }));
50022
+ const importPostcssImport = createCachedImport(() => import('./dep-stc9c31V.js').then(function (n) { return n.i; }));
50023
+ const importPostcssModules = createCachedImport(() => import('./dep-7B7unqQx.js').then(function (n) { return n.i; }));
50003
50024
  const importPostcss = createCachedImport(() => import('postcss'));
50004
50025
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
50005
50026
  let alwaysFakeWorkerWorkerControllerCache;
@@ -1,4 +1,4 @@
1
- import { P as getDefaultExportFromCjs } from './dep-CE7taEzf.js';
1
+ import { P as getDefaultExportFromCjs } from './dep-B--GINb9.js';
2
2
  import require$$0 from 'path';
3
3
  import { l as lib } from './dep-3RmXg9uo.js';
4
4
 
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-CE7taEzf.js';
5
+ import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-B--GINb9.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -745,7 +745,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
745
745
  `[boolean] force the optimizer to ignore the cache and re-bundle`
746
746
  ).action(async (root, options) => {
747
747
  filterDuplicateOptions(options);
748
- const { createServer } = await import('./chunks/dep-CE7taEzf.js').then(function (n) { return n.S; });
748
+ const { createServer } = await import('./chunks/dep-B--GINb9.js').then(function (n) { return n.S; });
749
749
  try {
750
750
  const server = await createServer({
751
751
  root,
@@ -839,7 +839,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
839
839
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
840
840
  async (root, options) => {
841
841
  filterDuplicateOptions(options);
842
- const { createBuilder } = await import('./chunks/dep-CE7taEzf.js').then(function (n) { return n.T; });
842
+ const { createBuilder } = await import('./chunks/dep-B--GINb9.js').then(function (n) { return n.T; });
843
843
  const buildOptions = cleanGlobalCLIOptions(
844
844
  cleanBuilderCLIOptions(options)
845
845
  );
@@ -878,7 +878,7 @@ cli.command(
878
878
  ).action(
879
879
  async (root, options) => {
880
880
  filterDuplicateOptions(options);
881
- const { optimizeDeps } = await import('./chunks/dep-CE7taEzf.js').then(function (n) { return n.R; });
881
+ const { optimizeDeps } = await import('./chunks/dep-B--GINb9.js').then(function (n) { return n.R; });
882
882
  try {
883
883
  const config = await resolveConfig(
884
884
  {
@@ -905,7 +905,7 @@ ${e.stack}`),
905
905
  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(
906
906
  async (root, options) => {
907
907
  filterDuplicateOptions(options);
908
- const { preview } = await import('./chunks/dep-CE7taEzf.js').then(function (n) { return n.U; });
908
+ const { preview } = await import('./chunks/dep-B--GINb9.js').then(function (n) { return n.U; });
909
909
  try {
910
910
  const server = await preview({
911
911
  root,
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-CE7taEzf.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-CE7taEzf.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-B--GINb9.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, F as createFilter, h as createIdResolver, I as createLogger, n as createRunnableDevEnvironment, c as createServer, y as createServerHotChannel, w as createServerModuleRunner, x as createServerModuleRunnerTransport, d as defineConfig, v as fetchModule, j as formatPostcssSourceMap, L as isFileLoadingAllowed, K as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, M as loadEnv, E as mergeAlias, C as mergeConfig, z as moduleRunnerTransform, A as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, N as resolveEnvPrefix, G as rollupVersion, u as runnerImport, J as searchForWorkspaceRoot, H as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-B--GINb9.js';
4
4
  export { defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.1.2",
3
+ "version": "6.1.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",