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

Function maybeLoadLockFile

packages/python-analysis/src/manifest/package.ts:474–495  ·  view source on GitHub ↗

* Check for lock files in the given directory. * Priority: uv.lock > pylock.toml (uv.lock is more common currently)

(
  root: AbsPath,
  subdir: RelPath
)

Source from the content-addressed store, hash-verified

472 * Priority: uv.lock > pylock.toml (uv.lock is more common currently)
473 */
474async function maybeLoadLockFile(
475 root: AbsPath,
476 subdir: RelPath
477): Promise<PythonLockFile | undefined> {
478 // Check for uv.lock first (higher priority)
479 const uvLockRelPath = path.join(subdir, 'uv.lock');
480 const uvLockPath = path.join(root, uvLockRelPath);
481 const uvLockContent = await readFileTextIfExists(uvLockPath);
482 if (uvLockContent != null) {
483 return { path: uvLockRelPath, kind: PythonLockFileKind.UvLock };
484 }
485
486 // Check for pylock.toml (PEP 751 standard lock file)
487 const pylockRelPath = path.join(subdir, 'pylock.toml');
488 const pylockPath = path.join(root, pylockRelPath);
489 const pylockContent = await readFileTextIfExists(pylockPath);
490 if (pylockContent != null) {
491 return { path: pylockRelPath, kind: PythonLockFileKind.PylockToml };
492 }
493
494 return undefined;
495}
496
497async function maybeLoadPyProjectToml(
498 root: AbsPath,

Callers 1

maybeLoadPyProjectTomlFunction · 0.85

Calls 2

readFileTextIfExistsFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected