vite 6.0.13 → 6.0.14
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.
@@ -13528,8 +13528,9 @@ async function fileToDevUrl(environment, id, skipBase = false) {
|
|
13528
13528
|
const content = await fsp.readFile(file);
|
13529
13529
|
return assetToDataURL(environment, file, content);
|
13530
13530
|
}
|
13531
|
-
|
13532
|
-
|
13531
|
+
const cleanedId = cleanUrl(id);
|
13532
|
+
if (svgExtRE.test(cleanedId)) {
|
13533
|
+
const file = publicFile || cleanedId;
|
13533
13534
|
const content = await fsp.readFile(file);
|
13534
13535
|
if (shouldInline(environment, file, id, content, undefined, undefined)) {
|
13535
13536
|
return assetToDataURL(environment, file, content);
|
@@ -41027,6 +41028,7 @@ function renderRestrictedErrorHTML(msg) {
|
|
41027
41028
|
|
41028
41029
|
const ERR_LOAD_URL = "ERR_LOAD_URL";
|
41029
41030
|
const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL";
|
41031
|
+
const ERR_DENIED_ID = "ERR_DENIED_ID";
|
41030
41032
|
const debugLoad = createDebugger("vite:load");
|
41031
41033
|
const debugTransform = createDebugger("vite:transform");
|
41032
41034
|
const debugCache$1 = createDebugger("vite:cache");
|
@@ -41126,6 +41128,11 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
|
|
41126
41128
|
const { config, pluginContainer, logger } = environment;
|
41127
41129
|
const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url, config.root) : "";
|
41128
41130
|
const moduleGraph = environment.moduleGraph;
|
41131
|
+
if (options.allowId && !options.allowId(id)) {
|
41132
|
+
const err = new Error(`Denied ID ${id}`);
|
41133
|
+
err.code = ERR_DENIED_ID;
|
41134
|
+
throw err;
|
41135
|
+
}
|
41129
41136
|
let code = null;
|
41130
41137
|
let map = null;
|
41131
41138
|
const loadStart = debugLoad ? performance.now() : 0;
|
@@ -42541,6 +42548,10 @@ const trailingQuerySeparatorsRE = /[?&]+$/;
|
|
42541
42548
|
const urlRE = /[?&]url\b/;
|
42542
42549
|
const rawRE = /[?&]raw\b/;
|
42543
42550
|
const inlineRE$2 = /[?&]inline\b/;
|
42551
|
+
const svgRE = /\.svg\b/;
|
42552
|
+
function deniedServingAccessForTransform(url, server, res, next) {
|
42553
|
+
return (rawRE.test(url) || urlRE.test(url) || inlineRE$2.test(url) || svgRE.test(url)) && !ensureServingAccess(url, server, res, next);
|
42554
|
+
}
|
42544
42555
|
function cachedTransformMiddleware(server) {
|
42545
42556
|
return function viteCachedTransformMiddleware(req, res, next) {
|
42546
42557
|
const environment = server.environments.client;
|
@@ -42630,7 +42641,7 @@ function transformMiddleware(server) {
|
|
42630
42641
|
trailingQuerySeparatorsRE,
|
42631
42642
|
""
|
42632
42643
|
);
|
42633
|
-
if ((
|
42644
|
+
if (deniedServingAccessForTransform(
|
42634
42645
|
urlWithoutTrailingQuerySeparators,
|
42635
42646
|
server,
|
42636
42647
|
res,
|
@@ -42653,7 +42664,10 @@ function transformMiddleware(server) {
|
|
42653
42664
|
}
|
42654
42665
|
}
|
42655
42666
|
const result = await transformRequest(environment, url, {
|
42656
|
-
html: req.headers.accept?.includes("text/html")
|
42667
|
+
html: req.headers.accept?.includes("text/html"),
|
42668
|
+
allowId(id) {
|
42669
|
+
return !deniedServingAccessForTransform(id, server, res, next);
|
42670
|
+
}
|
42657
42671
|
});
|
42658
42672
|
if (result) {
|
42659
42673
|
const depsOptimizer = environment.depsOptimizer;
|
@@ -42705,6 +42719,9 @@ function transformMiddleware(server) {
|
|
42705
42719
|
if (e?.code === ERR_LOAD_URL) {
|
42706
42720
|
return next();
|
42707
42721
|
}
|
42722
|
+
if (e?.code === ERR_DENIED_ID) {
|
42723
|
+
return;
|
42724
|
+
}
|
42708
42725
|
return next(e);
|
42709
42726
|
}
|
42710
42727
|
next();
|
@@ -46370,6 +46387,7 @@ function escapeReplacement(value) {
|
|
46370
46387
|
}
|
46371
46388
|
|
46372
46389
|
const wasmHelperId = "\0vite/wasm-helper.js";
|
46390
|
+
const wasmInitRE = /(?<![?#].*)\.wasm\?init/;
|
46373
46391
|
const wasmHelper = async (opts = {}, url) => {
|
46374
46392
|
let result;
|
46375
46393
|
if (url.startsWith("data:")) {
|
@@ -46414,7 +46432,7 @@ const wasmHelperPlugin = () => {
|
|
46414
46432
|
if (id === wasmHelperId) {
|
46415
46433
|
return `export default ${wasmHelperCode}`;
|
46416
46434
|
}
|
46417
|
-
if (!
|
46435
|
+
if (!wasmInitRE.test(id)) {
|
46418
46436
|
return;
|
46419
46437
|
}
|
46420
46438
|
const url = await fileToUrl$1(this, id);
|
@@ -48892,8 +48910,8 @@ function createCachedImport(imp) {
|
|
48892
48910
|
return cached;
|
48893
48911
|
};
|
48894
48912
|
}
|
48895
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
48896
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
48913
|
+
const importPostcssImport = createCachedImport(() => import('./dep-CXwiT2Hf.js').then(function (n) { return n.i; }));
|
48914
|
+
const importPostcssModules = createCachedImport(() => import('./dep-DSU-v1Zt.js').then(function (n) { return n.i; }));
|
48897
48915
|
const importPostcss = createCachedImport(() => import('postcss'));
|
48898
48916
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
48899
48917
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { O as commonjsGlobal, N as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { O as commonjsGlobal, N as getDefaultExportFromCjs } from './dep-CJqJlo1l.js';
|
2
2
|
import require$$0$2 from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
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 { M as colors, G as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { M as colors, G as createLogger, r as resolveConfig } from './chunks/dep-CJqJlo1l.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -741,7 +741,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
741
741
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
742
742
|
).action(async (root, options) => {
|
743
743
|
filterDuplicateOptions(options);
|
744
|
-
const { createServer } = await import('./chunks/dep-
|
744
|
+
const { createServer } = await import('./chunks/dep-CJqJlo1l.js').then(function (n) { return n.Q; });
|
745
745
|
try {
|
746
746
|
const server = await createServer({
|
747
747
|
root,
|
@@ -834,7 +834,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
834
834
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
835
835
|
async (root, options) => {
|
836
836
|
filterDuplicateOptions(options);
|
837
|
-
const { createBuilder } = await import('./chunks/dep-
|
837
|
+
const { createBuilder } = await import('./chunks/dep-CJqJlo1l.js').then(function (n) { return n.R; });
|
838
838
|
const buildOptions = cleanGlobalCLIOptions(
|
839
839
|
cleanBuilderCLIOptions(options)
|
840
840
|
);
|
@@ -869,7 +869,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
|
|
869
869
|
).action(
|
870
870
|
async (root, options) => {
|
871
871
|
filterDuplicateOptions(options);
|
872
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
872
|
+
const { optimizeDeps } = await import('./chunks/dep-CJqJlo1l.js').then(function (n) { return n.P; });
|
873
873
|
try {
|
874
874
|
const config = await resolveConfig(
|
875
875
|
{
|
@@ -895,7 +895,7 @@ ${e.stack}`),
|
|
895
895
|
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(
|
896
896
|
async (root, options) => {
|
897
897
|
filterDuplicateOptions(options);
|
898
|
-
const { preview } = await import('./chunks/dep-
|
898
|
+
const { preview } = await import('./chunks/dep-CJqJlo1l.js').then(function (n) { return n.S; });
|
899
899
|
try {
|
900
900
|
const server = await preview({
|
901
901
|
root,
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, a as arraify } from './chunks/dep-
|
3
|
-
export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, C as createFilter, h as createIdResolver, G as createLogger, n as createRunnableDevEnvironment, c as createServer, w as createServerHotChannel, v as createServerModuleRunner, d as defineConfig, u as fetchModule, j as formatPostcssSourceMap, J as isFileLoadingAllowed, I as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, K as loadEnv, A as mergeAlias, z as mergeConfig, x as moduleRunnerTransform, y as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, L as resolveEnvPrefix, E as rollupVersion, H as searchForWorkspaceRoot, F as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-CJqJlo1l.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, C as createFilter, h as createIdResolver, G as createLogger, n as createRunnableDevEnvironment, c as createServer, w as createServerHotChannel, v as createServerModuleRunner, d as defineConfig, u as fetchModule, j as formatPostcssSourceMap, J as isFileLoadingAllowed, I as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, K as loadEnv, A as mergeAlias, z as mergeConfig, x as moduleRunnerTransform, y as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, L as resolveEnvPrefix, E as rollupVersion, H as searchForWorkspaceRoot, F as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-CJqJlo1l.js';
|
4
4
|
export { 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';
|