vite 6.4.1 → 6.4.2
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-C9BXG1mU.js → dep-4-IQbZQm.js} +1 -1
- package/dist/node/chunks/{dep-D4NMHUTW.js → dep-Dq2t6Dq0.js} +45 -11
- package/dist/node/chunks/{dep-DWMUTS1A.js → dep-lpEPC2f9.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +5 -0
- package/dist/node/index.js +2 -2
- package/package.json +1 -1
|
@@ -35662,8 +35662,9 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
|
|
|
35662
35662
|
const { config, pluginContainer, logger } = environment;
|
|
35663
35663
|
const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url, config.root) : "";
|
|
35664
35664
|
const moduleGraph = environment.moduleGraph;
|
|
35665
|
-
if (options.
|
|
35665
|
+
if (!options.skipFsCheck && id[0] !== "\0" && isServerAccessDeniedForTransform(config, id)) {
|
|
35666
35666
|
const err = new Error(`Denied ID ${id}`);
|
|
35667
|
+
err.id = id;
|
|
35667
35668
|
err.code = ERR_DENIED_ID;
|
|
35668
35669
|
throw err;
|
|
35669
35670
|
}
|
|
@@ -35676,7 +35677,7 @@ async function loadAndTransform(environment, id, url, options, timestamp, mod, r
|
|
|
35676
35677
|
if (options.html && !id.endsWith(".html")) {
|
|
35677
35678
|
return null;
|
|
35678
35679
|
}
|
|
35679
|
-
if (
|
|
35680
|
+
if (options.skipFsCheck || isFileLoadingAllowed(environment.getTopLevelConfig(), slash$1(file))) {
|
|
35680
35681
|
try {
|
|
35681
35682
|
code = await fsp.readFile(file, "utf-8");
|
|
35682
35683
|
debugLoad?.(`${timeFrom(loadStart)} [fs] ${prettyUrl}`);
|
|
@@ -37134,6 +37135,12 @@ function deniedServingAccessForTransform(url, server, res, next) {
|
|
|
37134
37135
|
}
|
|
37135
37136
|
return false;
|
|
37136
37137
|
}
|
|
37138
|
+
function isServerAccessDeniedForTransform(config, id) {
|
|
37139
|
+
if (rawRE.test(id) || urlRE.test(id) || inlineRE$2.test(id) || svgRE.test(id)) {
|
|
37140
|
+
return checkLoadingAccess(config, id) !== "allowed";
|
|
37141
|
+
}
|
|
37142
|
+
return false;
|
|
37143
|
+
}
|
|
37137
37144
|
function cachedTransformMiddleware(server) {
|
|
37138
37145
|
return function viteCachedTransformMiddleware(req, res, next) {
|
|
37139
37146
|
const environment = server.environments.client;
|
|
@@ -37183,6 +37190,9 @@ function transformMiddleware(server) {
|
|
|
37183
37190
|
const depsOptimizer = environment.depsOptimizer;
|
|
37184
37191
|
if (depsOptimizer?.isOptimizedDepUrl(url)) {
|
|
37185
37192
|
const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$3(path$b.resolve(server.config.root, url.slice(1)));
|
|
37193
|
+
if (!depsOptimizer.isOptimizedDepFile(sourcemapPath)) {
|
|
37194
|
+
return next();
|
|
37195
|
+
}
|
|
37186
37196
|
try {
|
|
37187
37197
|
const map = JSON.parse(
|
|
37188
37198
|
await fsp.readFile(sourcemapPath, "utf-8")
|
|
@@ -37253,9 +37263,7 @@ function transformMiddleware(server) {
|
|
|
37253
37263
|
}
|
|
37254
37264
|
const result = await transformRequest(environment, url, {
|
|
37255
37265
|
html: req.headers.accept?.includes("text/html"),
|
|
37256
|
-
|
|
37257
|
-
return !deniedServingAccessForTransform(id, server, res, next);
|
|
37258
|
-
}
|
|
37266
|
+
skipFsCheck: environment._skipFsCheck
|
|
37259
37267
|
});
|
|
37260
37268
|
if (result) {
|
|
37261
37269
|
const depsOptimizer = environment.depsOptimizer;
|
|
@@ -37308,7 +37316,23 @@ function transformMiddleware(server) {
|
|
|
37308
37316
|
return next();
|
|
37309
37317
|
}
|
|
37310
37318
|
if (e?.code === ERR_DENIED_ID) {
|
|
37311
|
-
|
|
37319
|
+
const id = e.id;
|
|
37320
|
+
let servingAccessResult = checkLoadingAccess(
|
|
37321
|
+
server.config,
|
|
37322
|
+
cleanUrl(id)
|
|
37323
|
+
);
|
|
37324
|
+
if (servingAccessResult === "allowed") {
|
|
37325
|
+
servingAccessResult = checkLoadingAccess(server.config, id);
|
|
37326
|
+
}
|
|
37327
|
+
if (servingAccessResult === "denied") {
|
|
37328
|
+
respondWithAccessDenied(id, server, res);
|
|
37329
|
+
return true;
|
|
37330
|
+
}
|
|
37331
|
+
if (servingAccessResult === "fallback") {
|
|
37332
|
+
next();
|
|
37333
|
+
return true;
|
|
37334
|
+
}
|
|
37335
|
+
throw new Error(`Unexpected access result for id ${id}`);
|
|
37312
37336
|
}
|
|
37313
37337
|
return next(e);
|
|
37314
37338
|
}
|
|
@@ -39656,6 +39680,7 @@ function createServerHotChannel() {
|
|
|
39656
39680
|
const innerEmitter = new EventEmitter$4();
|
|
39657
39681
|
const outsideEmitter = new EventEmitter$4();
|
|
39658
39682
|
return {
|
|
39683
|
+
skipFsCheck: true,
|
|
39659
39684
|
send(payload) {
|
|
39660
39685
|
outsideEmitter.emit("send", payload);
|
|
39661
39686
|
},
|
|
@@ -43941,8 +43966,8 @@ function createCachedImport(imp) {
|
|
|
43941
43966
|
return cached;
|
|
43942
43967
|
};
|
|
43943
43968
|
}
|
|
43944
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
43945
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
43969
|
+
const importPostcssImport = createCachedImport(() => import('./dep-4-IQbZQm.js').then(function (n) { return n.i; }));
|
|
43970
|
+
const importPostcssModules = createCachedImport(() => import('./dep-lpEPC2f9.js').then(function (n) { return n.i; }));
|
|
43946
43971
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
43947
43972
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
|
43948
43973
|
let alwaysFakeWorkerWorkerControllerCache;
|
|
@@ -47834,6 +47859,10 @@ class DevEnvironment extends BaseEnvironment {
|
|
|
47834
47859
|
* @internal
|
|
47835
47860
|
*/
|
|
47836
47861
|
_remoteRunnerOptions;
|
|
47862
|
+
/**
|
|
47863
|
+
* @internal
|
|
47864
|
+
*/
|
|
47865
|
+
_skipFsCheck;
|
|
47837
47866
|
get pluginContainer() {
|
|
47838
47867
|
if (!this._pluginContainer)
|
|
47839
47868
|
throw new Error(
|
|
@@ -47881,9 +47910,13 @@ class DevEnvironment extends BaseEnvironment {
|
|
|
47881
47910
|
);
|
|
47882
47911
|
this._crawlEndFinder = setupOnCrawlEnd();
|
|
47883
47912
|
this._remoteRunnerOptions = context.remoteRunner ?? {};
|
|
47913
|
+
this._skipFsCheck = !!(context.transport && !(isWebSocketServer in context.transport) && context.transport.skipFsCheck);
|
|
47884
47914
|
this.hot = context.transport ? isWebSocketServer in context.transport ? context.transport : normalizeHotChannel(context.transport, context.hot) : normalizeHotChannel({}, context.hot);
|
|
47885
47915
|
this.hot.setInvokeHandler({
|
|
47886
47916
|
fetchModule: (id, importer, options2) => {
|
|
47917
|
+
if (context.disableFetchModule) {
|
|
47918
|
+
throw new Error("fetchModule is disabled in this environment");
|
|
47919
|
+
}
|
|
47887
47920
|
return this.fetchModule(id, importer, options2);
|
|
47888
47921
|
}
|
|
47889
47922
|
});
|
|
@@ -47941,11 +47974,11 @@ class DevEnvironment extends BaseEnvironment {
|
|
|
47941
47974
|
}
|
|
47942
47975
|
}
|
|
47943
47976
|
transformRequest(url) {
|
|
47944
|
-
return transformRequest(this, url);
|
|
47977
|
+
return transformRequest(this, url, { skipFsCheck: this._skipFsCheck });
|
|
47945
47978
|
}
|
|
47946
47979
|
async warmupRequest(url) {
|
|
47947
47980
|
try {
|
|
47948
|
-
await
|
|
47981
|
+
await transformRequest(this, url, { skipFsCheck: true });
|
|
47949
47982
|
} catch (e) {
|
|
47950
47983
|
if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP || e?.code === ERR_CLOSED_SERVER) {
|
|
47951
47984
|
return;
|
|
@@ -48445,7 +48478,8 @@ function defineConfig(config) {
|
|
|
48445
48478
|
function defaultCreateClientDevEnvironment(name, config, context) {
|
|
48446
48479
|
return new DevEnvironment(name, config, {
|
|
48447
48480
|
hot: true,
|
|
48448
|
-
transport: context.ws
|
|
48481
|
+
transport: context.ws,
|
|
48482
|
+
disableFetchModule: true
|
|
48449
48483
|
});
|
|
48450
48484
|
}
|
|
48451
48485
|
function defaultCreateDevEnvironment(name, config) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-Dq2t6Dq0.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-Dq2t6Dq0.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -748,7 +748,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
748
748
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
|
749
749
|
).action(async (root, options) => {
|
|
750
750
|
filterDuplicateOptions(options);
|
|
751
|
-
const { createServer } = await import('./chunks/dep-
|
|
751
|
+
const { createServer } = await import('./chunks/dep-Dq2t6Dq0.js').then(function (n) { return n.S; });
|
|
752
752
|
try {
|
|
753
753
|
const server = await createServer({
|
|
754
754
|
root,
|
|
@@ -843,7 +843,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
843
843
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
|
844
844
|
async (root, options) => {
|
|
845
845
|
filterDuplicateOptions(options);
|
|
846
|
-
const { createBuilder } = await import('./chunks/dep-
|
|
846
|
+
const { createBuilder } = await import('./chunks/dep-Dq2t6Dq0.js').then(function (n) { return n.T; });
|
|
847
847
|
const buildOptions = cleanGlobalCLIOptions(
|
|
848
848
|
cleanBuilderCLIOptions(options)
|
|
849
849
|
);
|
|
@@ -882,7 +882,7 @@ cli.command(
|
|
|
882
882
|
).action(
|
|
883
883
|
async (root, options) => {
|
|
884
884
|
filterDuplicateOptions(options);
|
|
885
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
885
|
+
const { optimizeDeps } = await import('./chunks/dep-Dq2t6Dq0.js').then(function (n) { return n.R; });
|
|
886
886
|
try {
|
|
887
887
|
const config = await resolveConfig(
|
|
888
888
|
{
|
|
@@ -909,7 +909,7 @@ ${e.stack}`),
|
|
|
909
909
|
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(
|
|
910
910
|
async (root, options) => {
|
|
911
911
|
filterDuplicateOptions(options);
|
|
912
|
-
const { preview } = await import('./chunks/dep-
|
|
912
|
+
const { preview } = await import('./chunks/dep-Dq2t6Dq0.js').then(function (n) { return n.U; });
|
|
913
913
|
try {
|
|
914
914
|
const server = await preview({
|
|
915
915
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1220,6 +1220,11 @@ interface HotChannelClient {
|
|
|
1220
1220
|
type HMRBroadcasterClient = HotChannelClient;
|
|
1221
1221
|
type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void;
|
|
1222
1222
|
interface HotChannel<Api = any> {
|
|
1223
|
+
/**
|
|
1224
|
+
* When true, the fs access check is skipped in fetchModule.
|
|
1225
|
+
* Set this for transports that is not exposed over the network.
|
|
1226
|
+
*/
|
|
1227
|
+
skipFsCheck?: boolean;
|
|
1223
1228
|
/**
|
|
1224
1229
|
* Broadcast events to all clients
|
|
1225
1230
|
*/
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
|
2
|
-
import { a as arraify, i as isInNodeModules, D as DevEnvironment } from './chunks/dep-
|
|
3
|
-
export { B as BuildEnvironment, 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 { a as arraify, i as isInNodeModules, D as DevEnvironment } from './chunks/dep-Dq2t6Dq0.js';
|
|
3
|
+
export { B as BuildEnvironment, 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-Dq2t6Dq0.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';
|