MCPcopy
hub / github.com/vitest-dev/vitest / isFileServingAllowed

Function isFileServingAllowed

packages/vitest/src/node/vite.ts:38–54  ·  view source on GitHub ↗
(
  configOrUrl: ResolvedConfig | string,
  urlOrServer: string | ViteDevServer,
)

Source from the content-addressed store, hash-verified

36 server: ViteDevServer,
37): boolean
38export function isFileServingAllowed(
39 configOrUrl: ResolvedConfig | string,
40 urlOrServer: string | ViteDevServer,
41): boolean {
42 const config = (
43 typeof urlOrServer === 'string' ? configOrUrl : urlOrServer.config
44 ) as ResolvedConfig
45 const url = (
46 typeof urlOrServer === 'string' ? urlOrServer : configOrUrl
47 ) as string
48
49 if (!config.server.fs.strict) {
50 return true
51 }
52 const filePath = fsPathFromUrl(url)
53 return isFileLoadingAllowed(config, filePath)
54}
55
56const FS_PREFIX = '/@fs/'
57const VOLUME_RE = /^[A-Z]:/i

Callers 4

configureServerFunction · 0.90
handlerFunction · 0.90
getExternalResultFunction · 0.90
getTransformResultFunction · 0.90

Calls 1

fsPathFromUrlFunction · 0.85

Tested by

no test coverage detected