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

Function hasWorkspaceDenoJSON

packages/vite/src/node/server/searchRoot.ts:39–54  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

37
38// https://docs.deno.com/runtime/fundamentals/workspaces/
39function hasWorkspaceDenoJSON(root: string): boolean {
40 for (const name of ['deno.json', 'deno.jsonc']) {
41 const path = join(root, name)
42 if (!isFileReadable(path)) {
43 continue
44 }
45 try {
46 const content = JSON.parse(fs.readFileSync(path, 'utf-8')) || {}
47 if (content.workspace) return true
48 } catch {
49 // deno.jsonc is only detected when it is also valid JSON. Full
50 // JSONC parsing would require an additional parser.
51 }
52 }
53 return false
54}
55
56function hasRootFile(root: string): boolean {
57 return ROOT_FILES.some((file) => fs.existsSync(join(root, file)))

Callers 1

searchForWorkspaceRootFunction · 0.85

Calls 2

isFileReadableFunction · 0.90
parseMethod · 0.80

Tested by

no test coverage detected