( projectRoot: string )
| 21 | * environments) until a runtime framework is actually detected. |
| 22 | */ |
| 23 | export function createDetectEntrypoint( |
| 24 | projectRoot: string |
| 25 | ): DetectEntrypointFn { |
| 26 | return async ({ workPath, framework }): Promise<DetectedEntrypoint> => { |
| 27 | // Normalize to forward slashes so the path is platform-consistent; |
| 28 | // Node's `fs` accepts either separator on Windows. |
| 29 | const absWorkPath = normalizePath(join(projectRoot, workPath)); |
| 30 | // Builder packages ship without `.d.ts`; casts re-narrow the |
| 31 | // `allowJs`-inferred return type back to `DetectedEntrypoint`. |
| 32 | if (isPythonFramework(framework)) { |
| 33 | const { detectEntrypoint } = await import('@vercel/python'); |
| 34 | return detectEntrypoint({ |
| 35 | workPath: absWorkPath, |
| 36 | framework, |
| 37 | }) as Promise<DetectedEntrypoint>; |
| 38 | } |
| 39 | if (isNodeBackendFramework(framework)) { |
| 40 | const { detectEntrypoint } = await import('@vercel/backends'); |
| 41 | return detectEntrypoint({ |
| 42 | workPath: absWorkPath, |
| 43 | }) as Promise<DetectedEntrypoint>; |
| 44 | } |
| 45 | if (framework === 'go') { |
| 46 | const { detectEntrypoint } = await import('@vercel/go'); |
| 47 | return detectEntrypoint({ |
| 48 | workPath: absWorkPath, |
| 49 | }) as Promise<DetectedEntrypoint>; |
| 50 | } |
| 51 | return null; |
| 52 | }; |
| 53 | } |
no test coverage detected