Status: future · Priority: medium
Note: This page is the build-bridge sub-plan. The overarching architecture — manifest, registry, compiler plugins, versioning, ecosystem comparisons — lives in Package Ecosystem. Read that first.
Note: This is a future plan, not a commitment. The syntax and API shown here are proposals — they can be completely different when actually implemented.
Making morph pkg packages actually compile into your binary. The package CLI works — morph pkg add/remove/install/list/search — but packages are downloaded, not compiled. Full spec: help/package_authoring.md.
morph-icons, morph-animate, community widgets) as installable packagesmorph pkg install morph-icons should just work| Piece | State |
|---|---|
| Package CLI (add/remove/install/list/search) | ✅ Shipped |
morph.pkg.json manifest parsing |
✅ Shipped |
| Dependency resolver (versions, topological sort) | ⚠️ Stub — # TODO: topological sort + version conflict detection (pkg/resolver.py:5) |
| JS → C++ bridge at build time | ❌ Not implemented |
// morph.pkg.json
{
"name": "my-widget",
"js_entry": "src/index.ts", // JS entry the compiler translates
"runtime_headers": ["runtime/renderer.h"] // C++ headers baked into the build
}Package JS can annotate components that map to C++ nodes:
// src/index.ts
// @morph-component: MyWidgetNode
// @morph-header: runtime/renderer.h
export function MyWidget() { ... }// runtime/renderer.h — the package's C++ node
class MyWidgetNode : public MorphNode {
public:
void draw(Renderer& r) override { /* custom paint */ }
};At build time the compiler reads the annotations, includes runtime_headers into the generated translation unit, and wires JSX usage of <MyWidget/> to MyWidgetNode — exactly like the existing user-side C++ interop, but packaged and versioned.
morph.pkg.json dependencies by version (semver ranges)npm's postinstall scripts, but worse: arbitrary C++)morph pkg add user/repo?morph check (SUPPORTED_TAGS) + the IR builderpkg/resolver.pyjs_entry + runtime_headers, feed the translator, include headers in the generated TU@morph-component / @morph-header annotation parsing + tag registration