vite 6.1.3 → 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-DsKUDpAA.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';
@@ -13593,8 +13593,9 @@ async function fileToDevUrl(environment, id, skipBase = false) {
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);
@@ -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;
@@ -43528,6 +43535,10 @@ const trailingQuerySeparatorsRE = /[?&]+$/;
43528
43535
  const urlRE = /[?&]url\b/;
43529
43536
  const rawRE = /[?&]raw\b/;
43530
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
+ }
43531
43542
  function cachedTransformMiddleware(server) {
43532
43543
  return function viteCachedTransformMiddleware(req, res, next) {
43533
43544
  const environment = server.environments.client;
@@ -43617,7 +43628,7 @@ function transformMiddleware(server) {
43617
43628
  trailingQuerySeparatorsRE,
43618
43629
  ""
43619
43630
  );
43620
- if ((rawRE.test(urlWithoutTrailingQuerySeparators) || urlRE.test(urlWithoutTrailingQuerySeparators) || inlineRE$2.test(urlWithoutTrailingQuerySeparators)) && !ensureServingAccess(
43631
+ if (deniedServingAccessForTransform(
43621
43632
  urlWithoutTrailingQuerySeparators,
43622
43633
  server,
43623
43634
  res,
@@ -43640,7 +43651,10 @@ function transformMiddleware(server) {
43640
43651
  }
43641
43652
  }
43642
43653
  const result = await transformRequest(environment, url, {
43643
- 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
+ }
43644
43658
  });
43645
43659
  if (result) {
43646
43660
  const depsOptimizer = environment.depsOptimizer;
@@ -43692,6 +43706,9 @@ function transformMiddleware(server) {
43692
43706
  if (e?.code === ERR_LOAD_URL) {
43693
43707
  return next();
43694
43708
  }
43709
+ if (e?.code === ERR_DENIED_ID) {
43710
+ return;
43711
+ }
43695
43712
  return next(e);
43696
43713
  }
43697
43714
  next();
@@ -47391,6 +47408,7 @@ function escapeReplacement(value) {
47391
47408
  }
47392
47409
 
47393
47410
  const wasmHelperId = "\0vite/wasm-helper.js";
47411
+ const wasmInitRE = /(?<![?#].*)\.wasm\?init/;
47394
47412
  const wasmHelper = async (opts = {}, url) => {
47395
47413
  let result;
47396
47414
  if (url.startsWith("data:")) {
@@ -47435,7 +47453,7 @@ const wasmHelperPlugin = () => {
47435
47453
  if (id === wasmHelperId) {
47436
47454
  return `export default ${wasmHelperCode}`;
47437
47455
  }
47438
- if (!id.endsWith(".wasm?init")) {
47456
+ if (!wasmInitRE.test(id)) {
47439
47457
  return;
47440
47458
  }
47441
47459
  const url = await fileToUrl$1(this, id);
@@ -50001,8 +50019,8 @@ function createCachedImport(imp) {
50001
50019
  return cached;
50002
50020
  };
50003
50021
  }
50004
- const importPostcssImport = createCachedImport(() => import('./dep-BSgDXZup.js').then(function (n) { return n.i; }));
50005
- const importPostcssModules = createCachedImport(() => import('./dep-DxUYic98.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; }));
50006
50024
  const importPostcss = createCachedImport(() => import('postcss'));
50007
50025
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
50008
50026
  let alwaysFakeWorkerWorkerControllerCache;
@@ -1,4 +1,4 @@
1
- import { P as getDefaultExportFromCjs } from './dep-DsKUDpAA.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-DsKUDpAA.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-DsKUDpAA.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-DsKUDpAA.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-DsKUDpAA.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-DsKUDpAA.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-DsKUDpAA.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-DsKUDpAA.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.3",
3
+ "version": "6.1.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",