fix: clean up plugin dependency metadata#1892
Conversation
🦋 Changeset detectedLatest commit: 97488e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size ChangesSize change: +64 B (+0.00%) | Total size: 9775.83 kB
|
| File | Base | PR | Diff |
|---|---|---|---|
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.cjs |
36.71 kB | 36.71 kB | +8 B (+0.02%) |
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.js |
36.57 kB | 36.58 kB | +8 B (+0.02%) |
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.cjs |
37.76 kB | 37.77 kB | +8 B (+0.02%) |
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.min.cjs |
22.33 kB | 22.34 kB | +8 B (+0.03%) |
packages/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.cjs |
33.50 kB | 33.50 kB | +8 B (+0.02%) |
packages/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.js |
33.38 kB | 33.39 kB | +8 B (+0.02%) |
packages/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.cjs |
34.55 kB | 34.56 kB | +8 B (+0.02%) |
packages/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.min.cjs |
20.67 kB | 20.68 kB | +8 B (+0.04%) |
…ugin-dependency-design # Conflicts: # packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json # packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json # packages/plugins/rrweb-plugin-console-replay/package.json # packages/plugins/rrweb-plugin-network-record/package.json # packages/plugins/rrweb-plugin-network-replay/package.json # packages/plugins/rrweb-plugin-sequential-id-record/package.json # packages/plugins/rrweb-plugin-sequential-id-replay/package.json
There was a problem hiding this comment.
Pull request overview
This pull request refactors rrweb plugin type/dependency surfaces to be host-entrypoint agnostic (monolithic rrweb vs split @rrweb/record / @rrweb/replay), and updates plugin package metadata/docs accordingly so published artifacts declare the dependencies they actually import.
Changes:
- Introduces a host-neutral
ReplayPlugincontract in@rrweb/types, keepsrrweb’s concrete alias, and re-exportsReplayPluginfrom@rrweb/replay. - Removes plugin source/declaration coupling to
rrwebby switching replay plugins to importReplayPluginfrom@rrweb/types, and updates TS project references accordingly. - Updates plugin
package.jsondependency/peer metadata, adds documentation about compatible host entrypoints, adds a changeset, and adds a packed-install smoke test script.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/check-plugin-host-smoke.mjs | Adds a pack-and-install TypeScript smoke test for plugin/host install combinations and declaration host-neutrality. |
| packages/types/src/index.ts | Adds a generic, host-neutral ReplayPlugin type alongside existing plugin types. |
| packages/rrweb/src/types.ts | Replaces the concrete ReplayPlugin definition with a specialization of the base type for compatibility. |
| packages/replay/src/index.ts | Re-exports ReplayPlugin type from the replay entrypoint for @rrweb/replay consumers. |
| packages/plugins/rrweb-plugin-sequential-id-replay/tsconfig.json | Updates TS references to align with importing shared types instead of rrweb. |
| packages/plugins/rrweb-plugin-sequential-id-replay/src/index.ts | Switches ReplayPlugin import to @rrweb/types. |
| packages/plugins/rrweb-plugin-sequential-id-replay/README.md | Documents compatible replay host entrypoints. |
| packages/plugins/rrweb-plugin-sequential-id-replay/package.json | Moves published-artifact type deps into dependencies and removes host peer metadata. |
| packages/plugins/rrweb-plugin-sequential-id-record/tsconfig.json | Updates TS references to align with shared type dependency direction. |
| packages/plugins/rrweb-plugin-sequential-id-record/README.md | Documents compatible recording host entrypoints. |
| packages/plugins/rrweb-plugin-sequential-id-record/package.json | Declares @rrweb/types as a runtime/type dependency and removes rrweb peer metadata. |
| packages/plugins/rrweb-plugin-network-replay/tsconfig.json | Adjusts TS references to match record-plugin + shared type dependencies. |
| packages/plugins/rrweb-plugin-network-replay/src/index.ts | Removes local replay-plugin type and uses shared ReplayPlugin from @rrweb/types. |
| packages/plugins/rrweb-plugin-network-replay/README.md | Documents compatible replay host entrypoints. |
| packages/plugins/rrweb-plugin-network-replay/package.json | Moves required imports to dependencies and removes misleading peers. |
| packages/plugins/rrweb-plugin-network-record/README.md | Documents compatible recording host entrypoints. |
| packages/plugins/rrweb-plugin-network-record/package.json | Moves required imports to dependencies and removes host peer metadata. |
| packages/plugins/rrweb-plugin-console-replay/tsconfig.json | Updates TS references to align with shared type dependency direction. |
| packages/plugins/rrweb-plugin-console-replay/src/index.ts | Switches to shared ReplayPlugin and introduces a local structural replayer context type. |
| packages/plugins/rrweb-plugin-console-replay/README.md | Documents compatible replay host entrypoints. |
| packages/plugins/rrweb-plugin-console-replay/package.json | Declares actual published-artifact deps in dependencies and removes host peer metadata. |
| packages/plugins/rrweb-plugin-console-record/tsconfig.json | Formats config and adds TS references for types/utils. |
| packages/plugins/rrweb-plugin-console-record/README.md | Documents compatible recording host entrypoints. |
| packages/plugins/rrweb-plugin-console-record/package.json | Moves @rrweb/types/@rrweb/utils into dependencies and removes peer metadata. |
| packages/plugins/rrweb-plugin-canvas-webrtc-replay/tsconfig.json | Updates TS references to depend on shared types rather than rrweb. |
| packages/plugins/rrweb-plugin-canvas-webrtc-replay/src/index.ts | Removes concrete host-type imports and uses structural types + shared ReplayPlugin. |
| packages/plugins/rrweb-plugin-canvas-webrtc-replay/README.md | Documents compatible replay host entrypoints. |
| packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json | Declares @rrweb/types and simple-peer-light as dependencies and removes host peers. |
| packages/plugins/rrweb-plugin-canvas-webrtc-record/tsconfig.json | Updates TS references to depend on shared types rather than rrweb. |
| packages/plugins/rrweb-plugin-canvas-webrtc-record/src/index.ts | Introduces structural peer/signal types to avoid leaking simple-peer-light types and updates callback signatures. |
| packages/plugins/rrweb-plugin-canvas-webrtc-record/README.md | Documents compatible recording host entrypoints. |
| packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json | Declares @rrweb/types and simple-peer-light as dependencies and removes host peers. |
| package.json | Adds check:plugin-hosts script to run the new smoke test. |
| docs/superpowers/specs/2026-06-27-plugin-dependencies-design.md | Adds design rationale/constraints for the dependency/host-neutrality approach. |
| docs/superpowers/plans/2026-06-27-plugin-dependencies.md | Adds an implementation plan/checklist for the change set. |
| docs/recipes/plugin-api.md | Updates docs to reference importing RecordPlugin/ReplayPlugin from @rrweb/types and reflects the new replay shape. |
| docs/recipes/network.md | Updates replay example to use @rrweb/replay’s Replayer entrypoint. |
| .changeset/plugin-dependency-cleanup.md | Adds a patch changeset covering affected packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| '@rrweb/rrweb-plugin-sequential-id-record': packed.sequentialIdRecord, | ||
| rrdom: packed.rrdom, | ||
| rrweb: packed.rrweb, | ||
| 'rrweb-snapshot': packed.rrwebSnapshot, | ||
| }, |
| '@rrweb/rrweb-plugin-sequential-id-replay': packed.sequentialIdReplay, | ||
| rrdom: packed.rrdom, | ||
| rrweb: packed.rrweb, | ||
| 'rrweb-snapshot': packed.rrwebSnapshot, | ||
| }, |
What changed
ReplayPlugincontract in@rrweb/types, keeps the concreterrwebalias for compatibility, and re-exportsReplayPluginfrom@rrweb/replay.rrwebhost where plugins only need shared public types.dependencies, while misleading host peers are removed.Options considered
Option 1: No host peer
Pros:
rrweb,rrweb/all,@rrweb/record, and@rrweb/replayCons:
Chosen because npm peer dependencies cannot express “one of these hosts is required” cleanly. A strict
rrwebpeer is now misleading, and optional peers add noise without enforcing that any compatible host exists.Option 2: Optional host peers
Pros:
Cons:
Option 3: Strict host peer
Pros:
Cons:
rrwebfor valid@rrweb/record,@rrweb/replay, andrrweb/allconsumersValidation
@rrweb/types,rrweb,@rrweb/record,@rrweb/replay, and all record/replay plugin packages.@rrweb/types,rrweb,@rrweb/replay, and all eight plugin packages.node --check scripts/check-plugin-host-smoke.mjs && yarn check:plugin-hosts.yarn workspace @rrweb/rrweb-plugin-console-record test && yarn workspace @rrweb/rrweb-plugin-network-record test.rrwebimports withrg.git diff --checkacross the branch diff.