(context: ResolutionContext)
| 115 | languages: ['javascript', 'typescript'], |
| 116 | |
| 117 | detect(context: ResolutionContext): boolean { |
| 118 | // Express in a package.json — the root's, or a workspace's (`backend/`, `apps/api/`). |
| 119 | if (dependsOn(context, 'express', 'fastify', 'koa', 'hapi', '@hapi/hapi')) return true; |
| 120 | |
| 121 | // Check for common Express patterns |
| 122 | const allFiles = context.getAllFiles(); |
| 123 | for (const file of allFiles) { |
| 124 | if ( |
| 125 | file.includes('routes') || |
| 126 | file.includes('controllers') || |
| 127 | file.includes('middleware') |
| 128 | ) { |
| 129 | const content = context.readFile(file); |
| 130 | if (content && (content.includes('express') || content.includes('app.get') || content.includes('router.get'))) { |
| 131 | return true; |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | return false; |
| 137 | }, |
| 138 | |
| 139 | resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null { |
| 140 | // A JS/TS module reaches another file's middleware, controller or service |
nothing calls this directly
no test coverage detected