MCPcopy Create free account
hub / github.com/vercel/vercel / getMissingExportMessage

Function getMissingExportMessage

packages/python/src/entrypoint.ts:116–140  ·  view source on GitHub ↗
(
  framework: string,
  entrypoints: string[]
)

Source from the content-addressed store, hash-verified

114}
115
116function 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
142export function entrypointToModule(entrypoint: string): string {
143 return entrypoint

Callers 1

makeDiagnosticErrorFunction · 0.85

Calls 2

getFrameworkDisplayNameFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected