refactor(compositions): extract framework-neutral @modular-frontend/compositions-engine - #56
Conversation
…ompositions-engine PR-03 of the Vue-support initiative. Splits the framework-neutral guts of @modular-react/compositions into a new @modular-frontend/compositions-engine package so a future Vue binding can reuse them, mirroring the journeys-engine extraction (#55) and the frontend-core extraction (#54). What moves: the pure files (runtime.ts, stores.ts, validation.ts, define-composition.ts, types.ts) plus their non-.tsx tests. The engine depends only on @modular-frontend/core; happy-dom is a dev dep for the test environment. @modular-react/compositions keeps its React files (outlet.tsx, provider.tsx, plugin.tsx, hooks.ts) and all .tsx tests, and re-exports the engine so its public export surface is unchanged. One React reference had to be neutralized, matching #54/PR-02: CompositionZoneDescriptor.fallback used React.ComponentType; it moves to the neutral UiComponent seam from @modular-frontend/core. Source-compatible for authors (a React component still satisfies UiComponent). Error-message prefixes stay [@modular-react/compositions] on purpose — they name the package users import. Test counts preserved: 52 in the engine + 63 in the binding = the pre-split total of 115. Full workspace typecheck and lint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sf7deW3iRQaaSjZuj3akTA
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (32)
📝 WalkthroughWalkthroughA new framework-neutral ChangesCompositions Engine Extraction
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR-03 of the Vue-support initiative. Splits the framework-neutral guts of
@modular-react/compositionsinto a new@modular-frontend/compositions-enginepackage so a future Vue binding can reuse them, mirroring the@modular-frontend/journeys-engineextraction in #55 and the@modular-frontend/coreextraction in #54.What moves
New package
@modular-frontend/compositions-engine(v0.1.0, depends only on@modular-frontend/core;happy-domis a dev dep for the test environment). It holds the composition runtime, scoped stores, validation, authoring helpers (defineComposition/defineCompositionHandle), and the full type surface, plus their non-React tests (runtime.test.ts,stores.test.ts,validation.test.ts,define-composition.test-d.ts,mount-kinds.test-d.ts). Single build entry:index.@modular-react/compositionskeeps its React files (outlet.tsx,provider.tsx,plugin.tsx,hooks.ts) and all.tsxtests, and re-exports the engine, so its public export surface is unchanged.Deviation from the tracker's PR-03 plan
One React reference had to be neutralized, matching how #54 handled
NavigationItem.iconand PR-02 (#55) handledJourneyNavContribution.icon:CompositionZoneDescriptor.fallbackused theReact.ComponentTypenamespace (with no@types/reactin the engine, this fails to resolve). It moves to the neutralUiComponentseam from@modular-frontend/core. Source-compatible for authors — a React component still satisfiesUiComponent, and the outlet still renders it as a JSX element in the binding.stores.tskept itsuseSyncExternalStore-motivated referential-stability logic as-is (it is still pure); only the doc comment namingReact.useSyncExternalStoreremains, and it stays descriptive.Error-message prefixes stay
[@modular-react/compositions]on purpose: they name the package users import, so the moved tests pass unmodified.Verification
@modular-frontend/compositions-engine: 52 tests (5 files);@modular-react/compositions: 63 tests (8 files). 52 + 63 = the pre-split total of 115.@modular-react/compositionsentry (the three example apps'editor-compositionshells/modules included).pnpm lintclean;oxfmt --checkreports no format changes.Also marks PR-03 done in the tracker and records
compositions-engineunder decision D2.🤖 Generated with Claude Code
https://claude.ai/code/session_01Sf7deW3iRQaaSjZuj3akTA
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation