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

Function searchForWorkspaceRoot

packages/vite/src/node/server/searchRoot.ts:84–97  ·  view source on GitHub ↗
(
  current: string,
  root: string = searchForPackageRoot(current),
)

Source from the content-addressed store, hash-verified

82 * Search up for the nearest workspace root
83 */
84export function searchForWorkspaceRoot(
85 current: string,
86 root: string = searchForPackageRoot(current),
87): string {
88 if (hasRootFile(current)) return current
89 if (hasWorkspacePackageJSON(current)) return current
90 if (hasWorkspaceDenoJSON(current)) return current
91
92 const dir = dirname(current)
93 // reach the fs root
94 if (!dir || dir === current) return root
95
96 return searchForWorkspaceRoot(dir, root)
97}

Callers 3

resolveServerOptionsFunction · 0.90
resolvePostcssConfigFunction · 0.90

Calls 4

searchForPackageRootFunction · 0.85
hasRootFileFunction · 0.85
hasWorkspacePackageJSONFunction · 0.85
hasWorkspaceDenoJSONFunction · 0.85

Tested by

no test coverage detected