MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / detect

Function detect

src/resolution/frameworks/astro.ts:31–49  ·  view source on GitHub ↗
(context: ResolutionContext)

Source from the content-addressed store, hash-verified

29 name: 'astro',
30
31 detect(context: ResolutionContext): boolean {
32 // Check for astro in package.json
33 const packageJson = context.readFile('package.json');
34 if (packageJson) {
35 try {
36 const pkg = JSON.parse(packageJson);
37 const deps = { ...pkg.dependencies, ...pkg.devDependencies };
38 if (deps.astro) {
39 return true;
40 }
41 } catch {
42 // Invalid JSON
43 }
44 }
45
46 // Check for .astro files in project
47 const allFiles = context.getAllFiles();
48 return allFiles.some((f) => f.endsWith('.astro'));
49 },
50
51 resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null {
52 // A page route names the component its file is.

Callers

nothing calls this directly

Calls 3

parseMethod · 0.80
readFileMethod · 0.65
getAllFilesMethod · 0.65

Tested by

no test coverage detected