vite 6.1.3 → 6.1.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.
@@ -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
|
-
|
13597
|
-
|
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 ((
|
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();
|
@@ -44695,6 +44712,17 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
44695
44712
|
return searchForWorkspaceRoot(dir, root);
|
44696
44713
|
}
|
44697
44714
|
|
44715
|
+
function rejectInvalidRequestMiddleware() {
|
44716
|
+
return function viteRejectInvalidRequestMiddleware(req, res, next) {
|
44717
|
+
if (req.url?.includes("#")) {
|
44718
|
+
res.writeHead(400);
|
44719
|
+
res.end();
|
44720
|
+
return;
|
44721
|
+
}
|
44722
|
+
return next();
|
44723
|
+
};
|
44724
|
+
}
|
44725
|
+
|
44698
44726
|
function createServer(inlineConfig = {}) {
|
44699
44727
|
return _createServer(inlineConfig, { listen: true });
|
44700
44728
|
}
|
@@ -45032,6 +45060,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
45032
45060
|
if (process.env.DEBUG) {
|
45033
45061
|
middlewares.use(timeMiddleware(root));
|
45034
45062
|
}
|
45063
|
+
middlewares.use(rejectInvalidRequestMiddleware());
|
45035
45064
|
const { cors } = serverConfig;
|
45036
45065
|
if (cors !== false) {
|
45037
45066
|
middlewares.use(corsMiddleware(typeof cors === "boolean" ? {} : cors));
|
@@ -47391,6 +47420,7 @@ function escapeReplacement(value) {
|
|
47391
47420
|
}
|
47392
47421
|
|
47393
47422
|
const wasmHelperId = "\0vite/wasm-helper.js";
|
47423
|
+
const wasmInitRE = /(?<![?#].*)\.wasm\?init/;
|
47394
47424
|
const wasmHelper = async (opts = {}, url) => {
|
47395
47425
|
let result;
|
47396
47426
|
if (url.startsWith("data:")) {
|
@@ -47435,7 +47465,7 @@ const wasmHelperPlugin = () => {
|
|
47435
47465
|
if (id === wasmHelperId) {
|
47436
47466
|
return `export default ${wasmHelperCode}`;
|
47437
47467
|
}
|
47438
|
-
if (!
|
47468
|
+
if (!wasmInitRE.test(id)) {
|
47439
47469
|
return;
|
47440
47470
|
}
|
47441
47471
|
const url = await fileToUrl$1(this, id);
|
@@ -50001,8 +50031,8 @@ function createCachedImport(imp) {
|
|
50001
50031
|
return cached;
|
50002
50032
|
};
|
50003
50033
|
}
|
50004
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
50005
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
50034
|
+
const importPostcssImport = createCachedImport(() => import('./dep-CwTNmu7W.js').then(function (n) { return n.i; }));
|
50035
|
+
const importPostcssModules = createCachedImport(() => import('./dep-DWaGFX-v.js').then(function (n) { return n.i; }));
|
50006
50036
|
const importPostcss = createCachedImport(() => import('postcss'));
|
50007
50037
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
50008
50038
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-C6Xcw3Ji.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 { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { O as colors, I as createLogger, r as resolveConfig } from './chunks/dep-C6Xcw3Ji.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-
|
748
|
+
const { createServer } = await import('./chunks/dep-C6Xcw3Ji.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-
|
842
|
+
const { createBuilder } = await import('./chunks/dep-C6Xcw3Ji.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-
|
881
|
+
const { optimizeDeps } = await import('./chunks/dep-C6Xcw3Ji.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-
|
908
|
+
const { preview } = await import('./chunks/dep-C6Xcw3Ji.js').then(function (n) { return n.U; });
|
909
909
|
try {
|
910
910
|
const server = await preview({
|
911
911
|
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, 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-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-C6Xcw3Ji.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-C6Xcw3Ji.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';
|