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

Function resolveModuleAttrEntrypoint

packages/python/src/entrypoint.ts:228–246  ·  view source on GitHub ↗
(
  workPath: string,
  value: string
)

Source from the content-addressed store, hash-verified

226}
227
228async 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
248export async function getVercelToolsEntrypoint(
249 workPath: string

Callers 2

getVercelToolsEntrypointFunction · 0.85

Calls 3

replaceMethod · 0.80
fileExistsFunction · 0.70
matchMethod · 0.45

Tested by

no test coverage detected