( framework: string, entrypoints: string[] )
| 114 | } |
| 115 | |
| 116 | function getMissingExportMessage( |
| 117 | framework: string, |
| 118 | entrypoints: string[] |
| 119 | ): string { |
| 120 | const fileList = entrypoints.slice(0, 3).join(', '); |
| 121 | const found = `Found ${fileList}`; |
| 122 | const subject = entrypoints.length === 1 ? 'it' : 'none'; |
| 123 | const verb = entrypoints.length === 1 ? 'does not define' : 'define'; |
| 124 | const displayName = getFrameworkDisplayName(framework); |
| 125 | |
| 126 | switch (framework) { |
| 127 | case 'fastapi': |
| 128 | return `${found} but ${subject} ${verb} a top-level "app" FastAPI instance.`; |
| 129 | case 'flask': |
| 130 | return `${found} but ${subject} ${verb} a top-level "app" Flask instance.`; |
| 131 | case 'django': |
| 132 | return `${found} but ${subject} ${verb} a top-level "application" ASGI or WSGI instance.`; |
| 133 | case 'fasthtml': |
| 134 | return `${found} but ${subject} ${verb} a top-level "app" ${displayName} instance.`; |
| 135 | default: |
| 136 | return entrypoints.length === 1 |
| 137 | ? `Found ${fileList} but it does not export a top-level "app", "application", or "handler" variable.` |
| 138 | : `Found ${fileList} but none export a top-level "app", "application", or "handler" variable.`; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | export function entrypointToModule(entrypoint: string): string { |
| 143 | return entrypoint |
no test coverage detected