(context: ResolutionContext)
| 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. |
nothing calls this directly
no test coverage detected