vite 5.4.18 → 5.4.20
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-DbT5NFX0.js → dep-D_zLpgQd.js} +113 -47
- package/dist/node/chunks/{dep-75Pw0qnz.js → dep-YkMKzX4u.js} +1 -1
- package/dist/node/chunks/{dep-nOVVHa2_.js → dep-e9kYborm.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +3 -1
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +13 -7
- package/package.json +1 -1
@@ -36991,8 +36991,8 @@ function createCachedImport(imp) {
|
|
36991
36991
|
return cached;
|
36992
36992
|
};
|
36993
36993
|
}
|
36994
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
36995
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
36994
|
+
const importPostcssImport = createCachedImport(() => import('./dep-YkMKzX4u.js').then(function (n) { return n.i; }));
|
36995
|
+
const importPostcssModules = createCachedImport(() => import('./dep-e9kYborm.js').then(function (n) { return n.i; }));
|
36996
36996
|
const importPostcss = createCachedImport(() => import('postcss'));
|
36997
36997
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
36998
36998
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -51568,7 +51568,7 @@ function sirv (dir, opts={}) {
|
|
51568
51568
|
});
|
51569
51569
|
}
|
51570
51570
|
|
51571
|
-
let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
|
51571
|
+
let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep$1) ? dir : dir + sep$1, isEtag) : viaCache.bind(0, FILES);
|
51572
51572
|
|
51573
51573
|
return function (req, res, next) {
|
51574
51574
|
let extns = [''];
|
@@ -51601,8 +51601,11 @@ function sirv (dir, opts={}) {
|
|
51601
51601
|
}
|
51602
51602
|
|
51603
51603
|
const knownJavascriptExtensionRE = /\.[tj]sx?$/;
|
51604
|
+
const ERR_DENIED_FILE = "ERR_DENIED_FILE";
|
51604
51605
|
const sirvOptions = ({
|
51605
|
-
|
51606
|
+
server,
|
51607
|
+
getHeaders,
|
51608
|
+
disableFsServeCheck
|
51606
51609
|
}) => {
|
51607
51610
|
return {
|
51608
51611
|
dev: true,
|
@@ -51618,6 +51621,19 @@ const sirvOptions = ({
|
|
51618
51621
|
res.setHeader(name, headers[name]);
|
51619
51622
|
}
|
51620
51623
|
}
|
51624
|
+
},
|
51625
|
+
shouldServe: disableFsServeCheck ? void 0 : (filePath) => {
|
51626
|
+
const servingAccessResult = checkLoadingAccess(server, filePath);
|
51627
|
+
if (servingAccessResult === "denied") {
|
51628
|
+
const error = new Error("denied access");
|
51629
|
+
error.code = ERR_DENIED_FILE;
|
51630
|
+
error.path = filePath;
|
51631
|
+
throw error;
|
51632
|
+
}
|
51633
|
+
if (servingAccessResult === "fallback") {
|
51634
|
+
return false;
|
51635
|
+
}
|
51636
|
+
return true;
|
51621
51637
|
}
|
51622
51638
|
};
|
51623
51639
|
};
|
@@ -51626,7 +51642,9 @@ function servePublicMiddleware(server, publicFiles) {
|
|
51626
51642
|
const serve = sirv(
|
51627
51643
|
dir,
|
51628
51644
|
sirvOptions({
|
51629
|
-
|
51645
|
+
server,
|
51646
|
+
getHeaders: () => server.config.server.headers,
|
51647
|
+
disableFsServeCheck: true
|
51630
51648
|
})
|
51631
51649
|
);
|
51632
51650
|
const toFilePath = (url) => {
|
@@ -51652,6 +51670,7 @@ function serveStaticMiddleware(server) {
|
|
51652
51670
|
const serve = sirv(
|
51653
51671
|
dir,
|
51654
51672
|
sirvOptions({
|
51673
|
+
server,
|
51655
51674
|
getHeaders: () => server.config.server.headers
|
51656
51675
|
})
|
51657
51676
|
);
|
@@ -51676,42 +51695,47 @@ function serveStaticMiddleware(server) {
|
|
51676
51695
|
}
|
51677
51696
|
}
|
51678
51697
|
const resolvedPathname = redirectedPathname || pathname;
|
51679
|
-
|
51680
|
-
if (resolvedPathname[resolvedPathname.length - 1] === "/" && fileUrl[fileUrl.length - 1] !== "/") {
|
51681
|
-
fileUrl = withTrailingSlash(fileUrl);
|
51682
|
-
}
|
51683
|
-
if (!ensureServingAccess(fileUrl, server, res, next)) {
|
51684
|
-
return;
|
51685
|
-
}
|
51698
|
+
path$n.resolve(dir, removeLeadingSlash(resolvedPathname));
|
51686
51699
|
if (redirectedPathname) {
|
51687
51700
|
url.pathname = encodeURI(redirectedPathname);
|
51688
51701
|
req.url = url.href.slice(url.origin.length);
|
51689
51702
|
}
|
51690
|
-
|
51703
|
+
try {
|
51704
|
+
serve(req, res, next);
|
51705
|
+
} catch (e) {
|
51706
|
+
if (e && "code" in e && e.code === ERR_DENIED_FILE) {
|
51707
|
+
respondWithAccessDenied(e.path, server, res);
|
51708
|
+
return;
|
51709
|
+
}
|
51710
|
+
throw e;
|
51711
|
+
}
|
51691
51712
|
};
|
51692
51713
|
}
|
51693
51714
|
function serveRawFsMiddleware(server) {
|
51694
51715
|
const serveFromRoot = sirv(
|
51695
51716
|
"/",
|
51696
|
-
sirvOptions({
|
51717
|
+
sirvOptions({
|
51718
|
+
server,
|
51719
|
+
getHeaders: () => server.config.server.headers
|
51720
|
+
})
|
51697
51721
|
);
|
51698
51722
|
return function viteServeRawFsMiddleware(req, res, next) {
|
51699
51723
|
const url = new URL(req.url.replace(/^\/{2,}/, "/"), "http://example.com");
|
51700
51724
|
if (url.pathname.startsWith(FS_PREFIX)) {
|
51701
51725
|
const pathname = decodeURI(url.pathname);
|
51702
|
-
if (!ensureServingAccess(
|
51703
|
-
slash$1(path$n.resolve(fsPathFromId(pathname))),
|
51704
|
-
server,
|
51705
|
-
res,
|
51706
|
-
next
|
51707
|
-
)) {
|
51708
|
-
return;
|
51709
|
-
}
|
51710
51726
|
let newPathname = pathname.slice(FS_PREFIX.length);
|
51711
51727
|
if (isWindows$3) newPathname = newPathname.replace(/^[A-Z]:/i, "");
|
51712
51728
|
url.pathname = encodeURI(newPathname);
|
51713
51729
|
req.url = url.href.slice(url.origin.length);
|
51714
|
-
|
51730
|
+
try {
|
51731
|
+
serveFromRoot(req, res, next);
|
51732
|
+
} catch (e) {
|
51733
|
+
if (e && "code" in e && e.code === ERR_DENIED_FILE) {
|
51734
|
+
respondWithAccessDenied(e.path, server, res);
|
51735
|
+
return;
|
51736
|
+
}
|
51737
|
+
throw e;
|
51738
|
+
}
|
51715
51739
|
} else {
|
51716
51740
|
next();
|
51717
51741
|
}
|
@@ -51719,34 +51743,49 @@ function serveRawFsMiddleware(server) {
|
|
51719
51743
|
}
|
51720
51744
|
function isFileServingAllowed(url, server) {
|
51721
51745
|
if (!server.config.server.fs.strict) return true;
|
51722
|
-
const
|
51723
|
-
|
51724
|
-
|
51725
|
-
|
51726
|
-
|
51727
|
-
|
51728
|
-
|
51746
|
+
const filePath = fsPathFromUrl(url);
|
51747
|
+
return isFileLoadingAllowed(server, filePath);
|
51748
|
+
}
|
51749
|
+
function isUriInFilePath(uri, filePath) {
|
51750
|
+
return isSameFileUri(uri, filePath) || isParentDirectory(uri, filePath);
|
51751
|
+
}
|
51752
|
+
function isFileLoadingAllowed(server, filePath) {
|
51753
|
+
const { fs } = server.config.server;
|
51754
|
+
if (!fs.strict) return true;
|
51755
|
+
if (server._fsDenyGlob(filePath)) return false;
|
51756
|
+
if (server.moduleGraph.safeModulesPath.has(filePath)) return true;
|
51757
|
+
if (fs.allow.some((uri) => isUriInFilePath(uri, filePath))) return true;
|
51729
51758
|
return false;
|
51730
51759
|
}
|
51731
|
-
function
|
51760
|
+
function checkLoadingAccess(server, path2) {
|
51761
|
+
if (isFileLoadingAllowed(server, slash$1(path2))) {
|
51762
|
+
return "allowed";
|
51763
|
+
}
|
51764
|
+
if (isFileReadable(path2)) {
|
51765
|
+
return "denied";
|
51766
|
+
}
|
51767
|
+
return "fallback";
|
51768
|
+
}
|
51769
|
+
function checkServingAccess(url, server) {
|
51732
51770
|
if (isFileServingAllowed(url, server)) {
|
51733
|
-
return
|
51771
|
+
return "allowed";
|
51734
51772
|
}
|
51735
51773
|
if (isFileReadable(cleanUrl(url))) {
|
51736
|
-
|
51737
|
-
|
51774
|
+
return "denied";
|
51775
|
+
}
|
51776
|
+
return "fallback";
|
51777
|
+
}
|
51778
|
+
function respondWithAccessDenied(url, server, res) {
|
51779
|
+
const urlMessage = `The request url "${url}" is outside of Vite serving allow list.`;
|
51780
|
+
const hintMessage = `
|
51738
51781
|
${server.config.server.fs.allow.map((i) => `- ${i}`).join("\n")}
|
51739
51782
|
|
51740
51783
|
Refer to docs https://vite.dev/config/server-options.html#server-fs-allow for configurations and more details.`;
|
51741
|
-
|
51742
|
-
|
51743
|
-
|
51744
|
-
|
51745
|
-
|
51746
|
-
} else {
|
51747
|
-
next();
|
51748
|
-
}
|
51749
|
-
return false;
|
51784
|
+
server.config.logger.error(urlMessage);
|
51785
|
+
server.config.logger.warnOnce(hintMessage + "\n");
|
51786
|
+
res.statusCode = 403;
|
51787
|
+
res.write(renderRestrictedErrorHTML(urlMessage + "\n" + hintMessage));
|
51788
|
+
res.end();
|
51750
51789
|
}
|
51751
51790
|
function renderRestrictedErrorHTML(msg) {
|
51752
51791
|
const html = String.raw;
|
@@ -61941,7 +61980,18 @@ const rawRE = /[?&]raw\b/;
|
|
61941
61980
|
const inlineRE = /[?&]inline\b/;
|
61942
61981
|
const svgRE = /\.svg\b/;
|
61943
61982
|
function deniedServingAccessForTransform(url, server, res, next) {
|
61944
|
-
|
61983
|
+
if (rawRE.test(url) || urlRE.test(url) || inlineRE.test(url) || svgRE.test(url)) {
|
61984
|
+
const servingAccessResult = checkServingAccess(url, server);
|
61985
|
+
if (servingAccessResult === "denied") {
|
61986
|
+
respondWithAccessDenied(url, server, res);
|
61987
|
+
return true;
|
61988
|
+
}
|
61989
|
+
if (servingAccessResult === "fallback") {
|
61990
|
+
next();
|
61991
|
+
return true;
|
61992
|
+
}
|
61993
|
+
}
|
61994
|
+
return false;
|
61945
61995
|
}
|
61946
61996
|
function cachedTransformMiddleware(server) {
|
61947
61997
|
return function viteCachedTransformMiddleware(req, res, next) {
|
@@ -62420,7 +62470,22 @@ function indexHtmlMiddleware(root, server) {
|
|
62420
62470
|
if (isDev && url.startsWith(FS_PREFIX)) {
|
62421
62471
|
filePath = decodeURIComponent(fsPathFromId(url));
|
62422
62472
|
} else {
|
62423
|
-
filePath =
|
62473
|
+
filePath = normalizePath$3(
|
62474
|
+
path$n.resolve(path$n.join(root, decodeURIComponent(url)))
|
62475
|
+
);
|
62476
|
+
}
|
62477
|
+
if (isDev) {
|
62478
|
+
const servingAccessResult = checkLoadingAccess(server, filePath);
|
62479
|
+
if (servingAccessResult === "denied") {
|
62480
|
+
return respondWithAccessDenied(filePath, server, res);
|
62481
|
+
}
|
62482
|
+
if (servingAccessResult === "fallback") {
|
62483
|
+
return next();
|
62484
|
+
}
|
62485
|
+
} else {
|
62486
|
+
if (!isParentDirectory(root, filePath)) {
|
62487
|
+
return next();
|
62488
|
+
}
|
62424
62489
|
}
|
62425
62490
|
if (fsUtils.existsSync(filePath)) {
|
62426
62491
|
const headers = isDev ? server.config.server.headers : server.config.preview.headers;
|
@@ -66253,7 +66318,8 @@ async function preview(inlineConfig = {}) {
|
|
66253
66318
|
}
|
66254
66319
|
postHooks.forEach((fn) => fn && fn());
|
66255
66320
|
if (config.appType === "spa" || config.appType === "mpa") {
|
66256
|
-
|
66321
|
+
const normalizedDistDir = normalizePath$3(distDir);
|
66322
|
+
app.use(indexHtmlMiddleware(normalizedDistDir, server));
|
66257
66323
|
app.use(notFoundMiddleware());
|
66258
66324
|
}
|
66259
66325
|
const hostname = await resolveHostname(options.host);
|
@@ -66978,4 +67044,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
66978
67044
|
}
|
66979
67045
|
}
|
66980
67046
|
|
66981
|
-
export { colors$1 as
|
67047
|
+
export { resolveEnvPrefix as A, colors$1 as B, getDefaultExportFromCjs as C, commonjsGlobal as D, index$1 as E, index as F, build$1 as G, preview$1 as H, arraify as a, build as b, createServer as c, defineConfig as d, preprocessCSS as e, formatPostcssSourceMap as f, buildErrorMessage as g, fetchModule as h, isInNodeModules$1 as i, mergeAlias as j, createFilter as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, rollupVersion as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, send as u, createLogger as v, searchForWorkspaceRoot as w, isFileServingAllowed as x, isFileLoadingAllowed as y, loadEnv as z };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { D as commonjsGlobal, C as getDefaultExportFromCjs } from './dep-D_zLpgQd.js';
|
2
2
|
import require$$0__default 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 {
|
5
|
+
import { B as colors, v as createLogger, r as resolveConfig } from './chunks/dep-D_zLpgQd.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -731,7 +731,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
731
731
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
732
732
|
).action(async (root, options) => {
|
733
733
|
filterDuplicateOptions(options);
|
734
|
-
const { createServer } = await import('./chunks/dep-
|
734
|
+
const { createServer } = await import('./chunks/dep-D_zLpgQd.js').then(function (n) { return n.F; });
|
735
735
|
try {
|
736
736
|
const server = await createServer({
|
737
737
|
root,
|
@@ -823,7 +823,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
823
823
|
`[boolean] force empty outDir when it's outside of root`
|
824
824
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
|
825
825
|
filterDuplicateOptions(options);
|
826
|
-
const { build } = await import('./chunks/dep-
|
826
|
+
const { build } = await import('./chunks/dep-D_zLpgQd.js').then(function (n) { return n.G; });
|
827
827
|
const buildOptions = cleanOptions(options);
|
828
828
|
try {
|
829
829
|
await build({
|
@@ -852,7 +852,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
|
|
852
852
|
).action(
|
853
853
|
async (root, options) => {
|
854
854
|
filterDuplicateOptions(options);
|
855
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
855
|
+
const { optimizeDeps } = await import('./chunks/dep-D_zLpgQd.js').then(function (n) { return n.E; });
|
856
856
|
try {
|
857
857
|
const config = await resolveConfig(
|
858
858
|
{
|
@@ -878,7 +878,7 @@ ${e.stack}`),
|
|
878
878
|
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(
|
879
879
|
async (root, options) => {
|
880
880
|
filterDuplicateOptions(options);
|
881
|
-
const { preview } = await import('./chunks/dep-
|
881
|
+
const { preview } = await import('./chunks/dep-D_zLpgQd.js').then(function (n) { return n.H; });
|
882
882
|
try {
|
883
883
|
const server = await preview({
|
884
884
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -3567,8 +3567,10 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
3567
3567
|
|
3568
3568
|
/**
|
3569
3569
|
* Check if the url is allowed to be served, via the `server.fs` config.
|
3570
|
+
* @deprecated Use the `isFileLoadingAllowed` function instead.
|
3570
3571
|
*/
|
3571
3572
|
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
3573
|
+
declare function isFileLoadingAllowed(server: ViteDevServer, filePath: string): boolean;
|
3572
3574
|
|
3573
3575
|
declare function loadEnv(mode: string, envDir: string, prefixes?: string | string[]): Record<string, string>;
|
3574
3576
|
declare function resolveEnvPrefix({ envPrefix, }: UserConfig): string[];
|
@@ -3622,4 +3624,4 @@ declare class ServerHMRConnector implements HMRRuntimeConnection {
|
|
3622
3624
|
onUpdate(handler: (payload: HMRPayload) => void): void;
|
3623
3625
|
}
|
3624
3626
|
|
3625
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
3627
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
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 build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile,
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-D_zLpgQd.js';
|
3
|
+
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, y as isFileLoadingAllowed, x as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-D_zLpgQd.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import { existsSync, readFileSync } from 'node:fs';
|
@@ -5543,13 +5543,18 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
5543
5543
|
|
5544
5544
|
function isFileServingAllowed(url, server) {
|
5545
5545
|
if (!server.config.server.fs.strict) return true;
|
5546
|
-
const
|
5547
|
-
|
5548
|
-
|
5549
|
-
|
5550
|
-
|
5551
|
-
|
5552
|
-
|
5546
|
+
const filePath = fsPathFromUrl(url);
|
5547
|
+
return isFileLoadingAllowed(server, filePath);
|
5548
|
+
}
|
5549
|
+
function isUriInFilePath(uri, filePath) {
|
5550
|
+
return isSameFileUri(uri, filePath) || isParentDirectory(uri, filePath);
|
5551
|
+
}
|
5552
|
+
function isFileLoadingAllowed(server, filePath) {
|
5553
|
+
const { fs } = server.config.server;
|
5554
|
+
if (!fs.strict) return true;
|
5555
|
+
if (server._fsDenyGlob(filePath)) return false;
|
5556
|
+
if (server.moduleGraph.safeModulesPath.has(filePath)) return true;
|
5557
|
+
if (fs.allow.some((uri) => isUriInFilePath(uri, filePath))) return true;
|
5553
5558
|
return false;
|
5554
5559
|
}
|
5555
5560
|
|
@@ -6151,6 +6156,7 @@ exports.esbuildVersion = esbuild.version;
|
|
6151
6156
|
exports.createFilter = createFilter;
|
6152
6157
|
exports.createLogger = createLogger;
|
6153
6158
|
exports.isCSSRequest = isCSSRequest;
|
6159
|
+
exports.isFileLoadingAllowed = isFileLoadingAllowed;
|
6154
6160
|
exports.isFileServingAllowed = isFileServingAllowed;
|
6155
6161
|
exports.loadEnv = loadEnv;
|
6156
6162
|
exports.mergeAlias = mergeAlias;
|