vite 6.0.10 → 6.0.12
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.
- package/dist/node/chunks/{dep-BgKqB7IO.js → dep-B_t-fquM.js} +1 -1
- package/dist/node/chunks/{dep-DP_yvx5y.js → dep-BzsM_vHB.js} +34 -20
- package/dist/node/chunks/{dep-a6F3bn0a.js → dep-C1bPwvxG.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +2 -1
- package/dist/node/index.js +2 -2
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { O as commonjsGlobal, N as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { O as commonjsGlobal, N as getDefaultExportFromCjs } from './dep-BzsM_vHB.js';
|
2
2
|
import require$$0$2 from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
@@ -8,7 +8,7 @@ import { performance } from 'node:perf_hooks';
|
|
8
8
|
import require$$0$6, { createRequire as createRequire$1, builtinModules } from 'node:module';
|
9
9
|
import crypto$2 from 'node:crypto';
|
10
10
|
import esbuild, { transform as transform$1, formatMessages, build as build$b } from 'esbuild';
|
11
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEV_PROD_CONDITION, JS_TYPES_RE, KNOWN_ASSET_TYPES, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_MAIN_FIELDS, DEFAULT_CLIENT_CONDITIONS, DEFAULT_SERVER_CONDITIONS } from '../constants.js';
|
11
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEV_PROD_CONDITION, JS_TYPES_RE, KNOWN_ASSET_TYPES, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, defaultAllowedOrigins, CLIENT_DIR, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_MAIN_FIELDS, DEFAULT_CLIENT_CONDITIONS, DEFAULT_SERVER_CONDITIONS } from '../constants.js';
|
12
12
|
import require$$0$2, { posix, win32, isAbsolute, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join, sep } from 'path';
|
13
13
|
import require$$0$3, { existsSync, readFileSync, statSync, readdirSync } from 'fs';
|
14
14
|
import childProcess$2, { exec, execFile, execSync } from 'node:child_process';
|
@@ -37670,7 +37670,8 @@ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
37670
37670
|
|
37671
37671
|
var WebSocketServerRaw_ = /*@__PURE__*/getDefaultExportFromCjs(websocketServer);
|
37672
37672
|
|
37673
|
-
const
|
37673
|
+
const allowedHostsServerCache = /* @__PURE__ */ new WeakMap();
|
37674
|
+
const allowedHostsPreviewCache = /* @__PURE__ */ new WeakMap();
|
37674
37675
|
const isFileOrExtensionProtocolRE = /^(?:file|.+-extension):/i;
|
37675
37676
|
function getAdditionalAllowedHosts(resolvedServerOptions, resolvedPreviewOptions) {
|
37676
37677
|
const list = [];
|
@@ -37727,39 +37728,42 @@ function isHostAllowedWithoutCache(allowedHosts, additionalAllowedHosts, host) {
|
|
37727
37728
|
}
|
37728
37729
|
return false;
|
37729
37730
|
}
|
37730
|
-
function isHostAllowed(config, host) {
|
37731
|
-
|
37731
|
+
function isHostAllowed(config, isPreview, host) {
|
37732
|
+
const allowedHosts = isPreview ? config.preview.allowedHosts : config.server.allowedHosts;
|
37733
|
+
if (allowedHosts === true) {
|
37732
37734
|
return true;
|
37733
37735
|
}
|
37734
|
-
|
37735
|
-
|
37736
|
+
const cache = isPreview ? allowedHostsPreviewCache : allowedHostsServerCache;
|
37737
|
+
if (!cache.has(config)) {
|
37738
|
+
cache.set(config, /* @__PURE__ */ new Set());
|
37736
37739
|
}
|
37737
|
-
const
|
37738
|
-
if (
|
37740
|
+
const cachedAllowedHosts = cache.get(config);
|
37741
|
+
if (cachedAllowedHosts.has(host)) {
|
37739
37742
|
return true;
|
37740
37743
|
}
|
37741
37744
|
const result = isHostAllowedWithoutCache(
|
37742
|
-
|
37745
|
+
allowedHosts,
|
37743
37746
|
config.additionalAllowedHosts,
|
37744
37747
|
host
|
37745
37748
|
);
|
37746
37749
|
if (result) {
|
37747
|
-
|
37750
|
+
cachedAllowedHosts.add(host);
|
37748
37751
|
}
|
37749
37752
|
return result;
|
37750
37753
|
}
|
37751
|
-
function hostCheckMiddleware(config) {
|
37754
|
+
function hostCheckMiddleware(config, isPreview) {
|
37752
37755
|
return function viteHostCheckMiddleware(req, res, next) {
|
37753
37756
|
const hostHeader = req.headers.host;
|
37754
|
-
if (!hostHeader || !isHostAllowed(config, hostHeader)) {
|
37757
|
+
if (!hostHeader || !isHostAllowed(config, isPreview, hostHeader)) {
|
37755
37758
|
const hostname = hostHeader?.replace(/:\d+$/, "");
|
37756
37759
|
const hostnameWithQuotes = JSON.stringify(hostname);
|
37760
|
+
const optionName = `${isPreview ? "preview" : "server"}.allowedHosts`;
|
37757
37761
|
res.writeHead(403, {
|
37758
37762
|
"Content-Type": "text/plain"
|
37759
37763
|
});
|
37760
37764
|
res.end(
|
37761
37765
|
`Blocked request. This host (${hostnameWithQuotes}) is not allowed.
|
37762
|
-
To allow this host, add ${hostnameWithQuotes} to \`
|
37766
|
+
To allow this host, add ${hostnameWithQuotes} to \`${optionName}\` in vite.config.js.`
|
37763
37767
|
);
|
37764
37768
|
return;
|
37765
37769
|
}
|
@@ -37833,7 +37837,7 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
37833
37837
|
const protocol = req.headers["sec-websocket-protocol"];
|
37834
37838
|
if (protocol === "vite-ping") return true;
|
37835
37839
|
const hostHeader = req.headers.host;
|
37836
|
-
if (!hostHeader || !isHostAllowed(config, hostHeader)) {
|
37840
|
+
if (!hostHeader || !isHostAllowed(config, false, hostHeader)) {
|
37837
37841
|
return false;
|
37838
37842
|
}
|
37839
37843
|
if (config.legacy?.skipWebSocketTokenCheck) {
|
@@ -42533,6 +42537,7 @@ function incrementIndent(indent = "") {
|
|
42533
42537
|
|
42534
42538
|
const debugCache = createDebugger("vite:cache");
|
42535
42539
|
const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
|
42540
|
+
const trailingQuerySeparatorsRE = /[?&]+$/;
|
42536
42541
|
function cachedTransformMiddleware(server) {
|
42537
42542
|
return function viteCachedTransformMiddleware(req, res, next) {
|
42538
42543
|
const environment = server.environments.client;
|
@@ -42618,7 +42623,16 @@ function transformMiddleware(server) {
|
|
42618
42623
|
if (publicDirInRoot && url.startsWith(publicPath)) {
|
42619
42624
|
warnAboutExplicitPublicPathInUrl(url);
|
42620
42625
|
}
|
42621
|
-
|
42626
|
+
const urlWithoutTrailingQuerySeparators = url.replace(
|
42627
|
+
trailingQuerySeparatorsRE,
|
42628
|
+
""
|
42629
|
+
);
|
42630
|
+
if ((rawRE.test(urlWithoutTrailingQuerySeparators) || urlRE.test(urlWithoutTrailingQuerySeparators)) && !ensureServingAccess(
|
42631
|
+
urlWithoutTrailingQuerySeparators,
|
42632
|
+
server,
|
42633
|
+
res,
|
42634
|
+
next
|
42635
|
+
)) {
|
42622
42636
|
return;
|
42623
42637
|
}
|
42624
42638
|
if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
|
@@ -44033,7 +44047,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
44033
44047
|
}
|
44034
44048
|
const { allowedHosts } = serverConfig;
|
44035
44049
|
if (allowedHosts !== true && !serverConfig.https) {
|
44036
|
-
middlewares.use(hostCheckMiddleware(config));
|
44050
|
+
middlewares.use(hostCheckMiddleware(config, false));
|
44037
44051
|
}
|
44038
44052
|
middlewares.use(cachedTransformMiddleware(server));
|
44039
44053
|
const { proxy } = serverConfig;
|
@@ -44159,7 +44173,7 @@ const serverConfigDefaults = Object.freeze({
|
|
44159
44173
|
https: undefined,
|
44160
44174
|
open: false,
|
44161
44175
|
proxy: undefined,
|
44162
|
-
cors:
|
44176
|
+
cors: { origin: defaultAllowedOrigins },
|
44163
44177
|
headers: {},
|
44164
44178
|
// hmr
|
44165
44179
|
// ws
|
@@ -48875,8 +48889,8 @@ function createCachedImport(imp) {
|
|
48875
48889
|
return cached;
|
48876
48890
|
};
|
48877
48891
|
}
|
48878
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
48879
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
48892
|
+
const importPostcssImport = createCachedImport(() => import('./dep-C1bPwvxG.js').then(function (n) { return n.i; }));
|
48893
|
+
const importPostcssModules = createCachedImport(() => import('./dep-B_t-fquM.js').then(function (n) { return n.i; }));
|
48880
48894
|
const importPostcss = createCachedImport(() => import('postcss'));
|
48881
48895
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
48882
48896
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -53102,7 +53116,7 @@ async function preview(inlineConfig = {}) {
|
|
53102
53116
|
}
|
53103
53117
|
const { allowedHosts } = config.preview;
|
53104
53118
|
if (allowedHosts !== true && !config.preview.https) {
|
53105
|
-
app.use(hostCheckMiddleware(config));
|
53119
|
+
app.use(hostCheckMiddleware(config, true));
|
53106
53120
|
}
|
53107
53121
|
const { proxy } = config.preview;
|
53108
53122
|
if (proxy) {
|
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-BzsM_vHB.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-BzsM_vHB.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-BzsM_vHB.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-BzsM_vHB.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-BzsM_vHB.js').then(function (n) { return n.S; });
|
899
899
|
try {
|
900
900
|
const server = await preview({
|
901
901
|
root,
|
package/dist/node/constants.js
CHANGED
@@ -140,8 +140,9 @@ const wildcardHosts = /* @__PURE__ */ new Set([
|
|
140
140
|
const DEFAULT_DEV_PORT = 5173;
|
141
141
|
const DEFAULT_PREVIEW_PORT = 4173;
|
142
142
|
const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
|
143
|
+
const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
|
143
144
|
const METADATA_FILENAME = "_metadata.json";
|
144
145
|
const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
|
145
146
|
const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
|
146
147
|
|
147
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|
148
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, defaultAllowedOrigins, loopbackHosts, wildcardHosts };
|
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-BzsM_vHB.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-BzsM_vHB.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';
|