MCPcopy
hub / github.com/vitejs/vite / resolveEmptyOutDir

Function resolveEmptyOutDir

packages/vite/src/node/watch.ts:26–49  ·  view source on GitHub ↗
(
  emptyOutDir: boolean | null,
  root: string,
  outDirs: Set<string>,
  logger?: Logger,
)

Source from the content-addressed store, hash-verified

24}
25
26export function resolveEmptyOutDir(
27 emptyOutDir: boolean | null,
28 root: string,
29 outDirs: Set<string>,
30 logger?: Logger,
31): boolean {
32 if (emptyOutDir != null) return emptyOutDir
33
34 for (const outDir of outDirs) {
35 if (!normalizePath(outDir).startsWith(withTrailingSlash(root))) {
36 // warn if outDir is outside of root
37 logger?.warn(
38 colors.yellow(
39 `\n${colors.bold(`(!)`)} outDir ${colors.white(
40 colors.dim(outDir),
41 )} is not inside project root and will not be emptied.\n` +
42 `Use --emptyOutDir to override.\n`,
43 ),
44 )
45 return false
46 }
47 }
48 return true
49}
50
51export function resolveChokidarOptions(
52 options: WatchOptions | undefined,

Callers 3

buildEnvironmentFunction · 0.90
_createServerFunction · 0.90
handlerFunction · 0.90

Calls 3

normalizePathFunction · 0.90
withTrailingSlashFunction · 0.90
warnMethod · 0.65

Tested by

no test coverage detected