MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / collect

Function collect

scripts/gen-ui-licenses.py:21–40  ·  view source on GitHub ↗
(ui_dir, dep_tree, out, excluded)

Source from the content-addressed store, hash-verified

19
20
21def collect(ui_dir, dep_tree, out, excluded):
22 for name, info in (dep_tree or {}).items():
23 version = info.get("version")
24 if not version:
25 continue # unmet optional peer — not installed, nothing shipped
26 pkg_dir = os.path.join(ui_dir, "node_modules", *name.split("/"))
27 try:
28 with open(os.path.join(pkg_dir, "package.json"), encoding="utf-8") as fh:
29 meta = json.load(fh)
30 except (OSError, ValueError):
31 continue # not physically installed — nothing shipped
32 # Platform-restricted packages (os/cpu fields) are native build
33 # tooling (esbuild/rollup/lightningcss/oxide binaries). They cannot
34 # be part of a browser bundle — exclude them and do not recurse into
35 # their dependency subtrees (wasm runtime shims etc.).
36 if meta.get("os") or meta.get("cpu"):
37 excluded.add((name, version))
38 continue
39 out.add((name, version))
40 collect(ui_dir, info.get("dependencies"), out, excluded)
41
42
43def license_text(pkg_dir):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected