Skip to content

feat(vue): add @modular-vue/journeys provider, composables, plugin (PR-30) - #69

Merged
kibertoad merged 3 commits into
mainfrom
claude/vuejs-support-next-phase-rwkugq
Jul 16, 2026
Merged

feat(vue): add @modular-vue/journeys provider, composables, plugin (PR-30)#69
kibertoad merged 3 commits into
mainfrom
claude/vuejs-support-next-phase-rwkugq

Conversation

@kibertoad

@kibertoad kibertoad commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Kicks off Phase 3 of the Vue support initiative (journeys and compositions on Vue) with PR-30: the @modular-vue/journeys binding layer. Adds a new @modular-vue/journeys (0.1.0) package over the framework-neutral @modular-frontend/journeys-engine, mirroring @modular-react/journeys. See docs/vue-support-tracker.md for the full plan.

Each new file names the React source it ports, so reviewers can diff intent:

New file (packages/vue-journeys/src) React source Contents
provider.ts journeys/provider.tsx JourneyProvider (defineComponent + render fn per D4) provides { runtime, onModuleExit } and composes over <ModuleExitProvider> from @modular-vue/vue; useJourneyContext / journeyKey.
instance-hooks.ts journeys/instance-hooks.ts useInstanceSnapshot (a watchEffect bridge into a shallowRef — the Vue analog of React's useSyncExternalStore), useCallChain (walks activeChildId, hand-managing the per-instance subscription set), useLeafId.
use-journey-state.ts journeys/use-journey-state.ts useJourneyState / useJourneyInstance and the leaf-walking useActiveLeafJourneyState / useActiveLeafJourneyInstance.
plugin.ts journeys/plugin.tsx journeysPlugin()extend / validate / onResolve / contributeNavigation / providers, field-for-field with React except providers() returns a Vue <JourneyProvider>.
index.ts journeys/index.ts Vue provider/composables/plugin + re-exported engine authoring surface.

Notable decisions / deviations (all forced by the framework)

  • The plugin is the real object, not "type-only". PR-21 (registry-plugins.test.ts synthetic plugin) and PR-22 ("the only consumer is the journeys plugin, which lands in PR-30") both deferred the concrete journeys plugin to this PR, so it ships here. End-to-end registry wiring + outlet rendering stay with PR-32.
  • Composables return Vue refs, not plain values (ComputedRef / ShallowRef), matching the PR-23 reactive-source convention. Single-instance snapshots update synchronously on runtime events; leaf-walk re-subscription lands on the next tick, so the chain-walk tests await flushPromises() before asserting.
  • Ids accept MaybeRefOrGetter so a reactive id (or the internal ComputedRef leaf id) stays reactive through the composable; plain strings still work (React's InstanceId | null).

Testing

  • 17 tests pass across provider.test.ts (4), use-journey-state.test.ts (4), plugin.test.ts (9), porting provider.test.tsx / use-journey-state.test.tsx intent and adding focused plugin-surface coverage.
  • Full workspace typecheck (122 tasks) and vite build (JS + dts) pass; externals (vue, @modular-frontend/core, @modular-frontend/journeys-engine, @modular-vue/vue) stay unbundled.
  • Tracker updated: PR-30 marked done, status advanced to Phase 3 in progress.

The journey outlet, <ModuleTab>, and useWaitForExit follow in PR-31; end-to-end runtime wiring + renderJourney in PR-32.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MgWjMcA5t8zKEHpjrZhdYT


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added the Vue 3 journeys package with a journey provider for runtime/context access, reactive journey-state composables (including active-leaf support), and a registry plugin for registering journeys and launching them via navigation.
    • Exposed authoring/runtime/persistence/validation and related helper APIs through a single entry point.
  • Documentation
    • Added a package README with installation, usage, and reactivity guidance.
    • Updated Vue support tracking status to reflect Phase 3 progress and marked the associated work item as complete.

…R-30)

Start Phase 3 of the Vue port with the journeys binding layer: a new
`@modular-vue/journeys` (0.1.0) package over `@modular-frontend/journeys-engine`,
mirroring `@modular-react/journeys`.

- provider.ts: `JourneyProvider` (defineComponent + render fn) provides the
  journey runtime and composes over `<ModuleExitProvider>`; `useJourneyContext`.
- instance-hooks.ts: `useInstanceSnapshot` (watchEffect bridge, the Vue analog
  of `useSyncExternalStore`), `useCallChain` (hand-managed activeChild
  subscriptions), `useLeafId`.
- use-journey-state.ts: `useJourneyState` / `useJourneyInstance` and the
  leaf-walking `useActiveLeafJourneyState` / `useActiveLeafJourneyInstance`,
  returning Vue refs (PR-23 reactive-source convention).
- plugin.ts: `journeysPlugin()` — the concrete plugin PR-21/PR-22 deferred here;
  identical to the React plugin except `providers()` returns a Vue provider.

Composables accept `MaybeRefOrGetter` ids so a reactive/leaf id stays reactive.
17 tests (provider, use-journey-state, plugin) pass; workspace typecheck (122
tasks) and vite build (JS + dts) pass with externals unbundled. Tracker updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgWjMcA5t8zKEHpjrZhdYT
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kibertoad, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd421b9c-2a74-47b2-b327-a07294e708b7

📥 Commits

Reviewing files that changed from the base of the PR and between e394c60 and eb78491.

📒 Files selected for processing (2)
  • docs/vue-support-tracker.md
  • packages/vue-journeys/src/plugin.ts
📝 Walkthrough

Walkthrough

Adds @modular-vue/journeys, a Vue 3 binding for the journeys engine with provider/context support, reactive instance composables, registry plugin integration, package tooling, tests, exports, and documentation.

Changes

Vue journeys package

Layer / File(s) Summary
Package surface and build setup
packages/vue-journeys/package.json, packages/vue-journeys/src/index.ts, packages/vue-journeys/README.md, packages/vue-journeys/*config*
Defines package metadata, build and test configuration, consolidated engine and Vue exports, and installation and usage documentation.
Provider and reactive instance composables
packages/vue-journeys/src/provider.ts, packages/vue-journeys/src/instance-hooks.ts, packages/vue-journeys/src/use-journey-state.ts, packages/vue-journeys/src/*test*
Adds provider injection and exit forwarding, instance subscriptions, active-child traversal, reactive state and instance composables, and runtime and type-level tests.
Journeys registry plugin
packages/vue-journeys/src/plugin.ts, packages/vue-journeys/src/plugin.test.ts
Adds typed journey registration, validation, runtime creation, navigation contributions, provider wiring, and integration tests.
Support tracker update
docs/vue-support-tracker.md
Updates Phase 3 and PR-30 status with implementation and acceptance details.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VueComponent
  participant JourneyProvider
  participant useJourneyState
  participant JourneyRuntime
  VueComponent->>JourneyProvider: mount with runtime
  JourneyProvider->>useJourneyState: provide journey context
  VueComponent->>useJourneyState: request journey state
  useJourneyState->>JourneyRuntime: read and subscribe to instance
  JourneyRuntime-->>useJourneyState: publish instance updates
  useJourneyState-->>VueComponent: update computed state
Loading

Possibly related PRs

Suggested reviewers: diogomiguel

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding the Vue journeys provider, composables, and plugin.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/vuejs-support-next-phase-rwkugq

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/vue-support-tracker.md`:
- Line 333: Update the PR-30 entry in the Vue support tracker to include the
completed pull request link while preserving its existing status and dependency
references.

In `@packages/vue-journeys/src/plugin.ts`:
- Around line 98-104: Update the onModuleExit callback contract in the plugin
options to reuse the upstream ModuleExitEvent or handler type instead of
redeclaring its event shape. Preserve routeId and keep the plugin callback
synchronized with the complete upstream event contract.

In `@packages/vue-journeys/src/provider.ts`:
- Around line 63-64: Update the provider setup around journeyKey so the
context’s onModuleExit reads the current props.onModuleExit rather than
capturing the initial callback; use a stable provided object with a reactive or
getter-backed handler, while preserving the existing runtime value and
ModuleExitProvider rendering behavior.

In `@packages/vue-journeys/vite.config.ts`:
- Around line 2-5: Replace the rolldown-plugin-dts import and usage in the
package’s defineConfig build setup with the repository-standard vite-plugin-dts
implementation, preserving the existing command-based plugin selection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2501523e-9328-4d3c-b74f-4a59fcf905e4

📥 Commits

Reviewing files that changed from the base of the PR and between b122f14 and efd4508.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • docs/vue-support-tracker.md
  • packages/vue-journeys/README.md
  • packages/vue-journeys/package.json
  • packages/vue-journeys/src/index.ts
  • packages/vue-journeys/src/instance-hooks.ts
  • packages/vue-journeys/src/plugin.test.ts
  • packages/vue-journeys/src/plugin.ts
  • packages/vue-journeys/src/provider.test.ts
  • packages/vue-journeys/src/provider.ts
  • packages/vue-journeys/src/use-journey-state.test.ts
  • packages/vue-journeys/src/use-journey-state.ts
  • packages/vue-journeys/tsconfig.json
  • packages/vue-journeys/vite.config.ts
  • packages/vue-journeys/vitest.config.ts

Comment thread docs/vue-support-tracker.md Outdated
Comment thread packages/vue-journeys/src/plugin.ts Outdated
Comment thread packages/vue-journeys/src/provider.ts Outdated
Comment thread packages/vue-journeys/vite.config.ts
- provider: expose `onModuleExit` on the injected context value through a
  getter so a swapped handler is visible to consumers that introspect
  `useJourneyContext().onModuleExit` (parity with the React provider, which
  rebuilds its value object each render). `runtime` stays a raw, un-proxied
  reference so identity checks against `manifest.journeys` still hold.
- tests: add direct coverage for `useJourneyInstance` (full snapshot +
  no-provider null) instead of relying solely on transitive coverage.
- tests: add `use-journey-state.test-d.ts` so the type-level coverage the
  vitest config already enables (`*.test-d.ts`) actually exists, asserting the
  composable return types and `MaybeRefOrGetter` id acceptance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1a2CFQmnRZp25ZXAKAMEQ
@kibertoad kibertoad added the minor label Jul 16, 2026 — with Claude
- plugin: reuse the upstream `ModuleExitHandler` for the `onModuleExit`
  option instead of a duplicated inline event shape, so the full
  `ModuleExitEvent` (incl. `routeId`) stays in sync with @modular-vue/vue.
- docs: link PR-30's `done` status to #69, matching the tracker's
  "link the PR" convention.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1a2CFQmnRZp25ZXAKAMEQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants