Home / Function/ isFileServingAllowed() — vite Function Reference

isFileServingAllowed() — vite Function Reference

Architecture documentation for the isFileServingAllowed() function in static.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  a29ea500_1ac9_5bca_45d3_fc9f72429363["isFileServingAllowed()"]
  d91d6c8f_e2c2_3b92_12c3_391c9ba06183["static.ts"]
  a29ea500_1ac9_5bca_45d3_fc9f72429363 -->|defined in| d91d6c8f_e2c2_3b92_12c3_391c9ba06183
  1c19c7da_486b_6fa0_e7ab_0c3784456fc6["fsPathFromUrl()"]
  a29ea500_1ac9_5bca_45d3_fc9f72429363 -->|calls| 1c19c7da_486b_6fa0_e7ab_0c3784456fc6
  b5f75f2b_ae88_b9ce_360f_813018b7842e["isFileLoadingAllowed()"]
  a29ea500_1ac9_5bca_45d3_fc9f72429363 -->|calls| b5f75f2b_ae88_b9ce_360f_813018b7842e
  style a29ea500_1ac9_5bca_45d3_fc9f72429363 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/middlewares/static.ts lines 257–271

export function isFileServingAllowed(
  configOrUrl: ResolvedConfig | string,
  urlOrServer: string | ViteDevServer,
): boolean {
  const config = (
    typeof urlOrServer === 'string' ? configOrUrl : urlOrServer.config
  ) as ResolvedConfig
  const url = (
    typeof urlOrServer === 'string' ? urlOrServer : configOrUrl
  ) as string

  if (!config.server.fs.strict) return true
  const filePath = fsPathFromUrl(url)
  return isFileLoadingAllowed(config, filePath)
}

Domain

Subdomains

Frequently Asked Questions

What does isFileServingAllowed() do?
isFileServingAllowed() is a function in the vite codebase, defined in packages/vite/src/node/server/middlewares/static.ts.
Where is isFileServingAllowed() defined?
isFileServingAllowed() is defined in packages/vite/src/node/server/middlewares/static.ts at line 257.
What does isFileServingAllowed() call?
isFileServingAllowed() calls 2 function(s): fsPathFromUrl, isFileLoadingAllowed.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free