feat!: adopt plugin API v2 - #2
Closed
thecuriographer wants to merge 1 commit into
Closed
Conversation
Splits each kind's single `NodeDefinition` into the three manifests v2 defines, so every concept is imported from the package that owns it: - `treesCoreManifest` — schema, defaults, semantic capabilities, relations - `treesViewerManifest` — geometry, renderers, instanced systems - `treesEditorManifest` — parametrics, placement tools, plan symbols `NodeDefinition` and `AnyNodeDefinition` no longer appear anywhere in this package. That is the point of the change: those types transitively named React and Three.js, which forced `@pascal-app/core` to re-export renderer types it does not own. Reaching for `sceneRegistry`, `useRegistry` and `GridEvent` from `@pascal-app/viewer` and `@pascal-app/editor` instead of core adds no dependency — this package already peer-depends on all three. The split is authored, not derived. Each definition file exports its three parts separately, and `index.test.ts` asserts in both directions that no semantic field appears in a presentation manifest and no presentation field appears in a base definition. BREAKING CHANGE: requires a host on plugin API v2. Peer ranges move to >=1.0.0-beta.4; `treesPlugin` is replaced by the three manifests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts the three-manifest plugin contract (
apiVersion: 2) that Pascal isintroducing, replacing the single
NodeDefinitionper kind.What changes
Each of the three kinds now exports its parts separately:
treesCoreManifestschemaVersion, defaults, semantic capabilities, relationstreesViewerManifesttreesEditorManifesttreesPluginis gone; a host loads the three manifests withloadCoreManifest,loadViewerManifestandloadEditorManifest. Coreregisters the kind; the presentation manifests attach to it by
kindand arerejected if no base definition exists.
Why
NodeDefinitiontransitively named React and Three.js types, which is whatforced
@pascal-app/coreto re-export renderer types it does not own. Withthose types gone from the contract, a plugin imports each concept from its
actual owner —
sceneRegistryanduseRegistryfrom@pascal-app/viewer,GridEventandParametricDescriptorfrom@pascal-app/editor. That is not anew dependency: this package already peer-depends on all three.
The split here is authored rather than derived.
index.test.tsasserts it inboth directions — no semantic field (
schema,defaults,capabilities, …)appears in a presentation manifest, and no presentation field (
renderer,system,parametrics,floorplan, …) appears in a base definition — so afield added to the wrong half fails the suite rather than silently working.
Compatibility
Breaking: needs a host on plugin API v2. Peer ranges move to
>=1.0.0-beta.4.Nothing in the authored scene format changes — schemas,
schemaVersionandnode types are untouched, so existing scenes containing
trees:tree,trees:flowerandtrees:grassload unchanged.Verification
bun test(17 tests) andtsc --noEmitboth pass against Pascal'splugin-api-v2branch, with no type assertions anywhere in the manifests —that last part was the acceptance bar for the contract itself, and it caught a
real flaw in the first draft of v2 (the manifest element types fixed the schema
generic, forcing a cast per kind; Pascal now erases it).