( configOrUrl: ResolvedConfig | string, urlOrServer: string | ViteDevServer, )
| 36 | server: ViteDevServer, |
| 37 | ): boolean |
| 38 | export 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 | |
| 56 | const FS_PREFIX = '/@fs/' |
| 57 | const VOLUME_RE = /^[A-Z]:/i |
no test coverage detected