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

Function findWorkspaceManifestFor

packages/python-analysis/src/manifest/package.ts:377–420  ·  view source on GitHub ↗
(
  manifest: PythonManifest,
  manifestStack: PythonManifest[]
)

Source from the content-addressed store, hash-verified

375}
376
377function findWorkspaceManifestFor(
378 manifest: PythonManifest,
379 manifestStack: PythonManifest[]
380): PythonManifest {
381 if (manifest.isRoot) {
382 return manifest;
383 }
384
385 for (const parentManifest of manifestStack) {
386 if (parentManifest.path === manifest.path) {
387 continue;
388 }
389
390 const workspace = parentManifest.data.tool?.uv?.workspace;
391 if (workspace !== undefined) {
392 let members = workspace.members ?? [];
393 if (!Array.isArray(members)) {
394 members = [];
395 }
396 let exclude = workspace.exclude ?? [];
397 if (!Array.isArray(exclude)) {
398 exclude = [];
399 }
400
401 const entrypointRelPath = path.relative(
402 path.dirname(parentManifest.path),
403 path.dirname(manifest.path)
404 );
405 if (
406 members.length > 0 &&
407 members.some(
408 pat => minimatchMatch([entrypointRelPath], pat).length > 0
409 ) &&
410 !exclude.some(
411 pat => minimatchMatch([entrypointRelPath], pat).length > 0
412 )
413 ) {
414 return parentManifest;
415 }
416 }
417 }
418
419 return manifest;
420}
421
422async function loadPythonManifest(
423 root: AbsPath,

Callers 1

discoverPythonPackageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected