( workPath: string, value: string )
| 226 | } |
| 227 | |
| 228 | async function resolveModuleAttrEntrypoint( |
| 229 | workPath: string, |
| 230 | value: string |
| 231 | ): Promise<PythonEntrypoint | null> { |
| 232 | // Expect values like "package.module:app". Extract the module portion. |
| 233 | const match = value.match(/([A-Za-z_][\w.]*)\s*:\s*([A-Za-z_][\w]*)/); |
| 234 | if (!match) return null; |
| 235 | const modulePath = match[1]; |
| 236 | const variableName = match[2]; |
| 237 | const relPath = modulePath.replace(/\./g, '/'); |
| 238 | |
| 239 | const candidates = [`${relPath}.py`, `${relPath}/__init__.py`]; |
| 240 | for (const candidate of candidates) { |
| 241 | if (await fileExists(join(workPath, candidate))) { |
| 242 | return { entrypoint: candidate, variableName }; |
| 243 | } |
| 244 | } |
| 245 | return null; |
| 246 | } |
| 247 | |
| 248 | export async function getVercelToolsEntrypoint( |
| 249 | workPath: string |
no test coverage detected