Skip to content

refactor(devtools): single source of truth for shared protocol types#8712

Open
Aejkatappaja wants to merge 1 commit into
QwikDev:build/v2from
Aejkatappaja:refactor/shared-protocol-types
Open

refactor(devtools): single source of truth for shared protocol types#8712
Aejkatappaja wants to merge 1 commit into
QwikDev:build/v2from
Aejkatappaja:refactor/shared-protocol-types

Conversation

@Aejkatappaja

Copy link
Copy Markdown

Problem

The VNode tree node, component detail entry, and render event shapes were declared three times with identical fields:

  • packages/browser-extension/src/shared/types.ts (VNodeTreeNode, ComponentDetailEntry, RenderEvent)
  • packages/devtools/ui/src/devtools/page-data-source.ts (same names)
  • packages/devtools/kit/src/client-bridge.ts (DevtoolsVNodeTreeNode, DevtoolsComponentDetailEntry, DevtoolsRenderEvent)

Three copies of the same data contract had to be kept in sync by hand.

Solution

Make @qwik.dev/devtools/kit the single source of truth.

  • The three interfaces now live once in the kit protocol module: DevtoolsVNodeTreeNode in protocol/vnode.ts, DevtoolsRenderEvent in protocol/perf.ts, DevtoolsComponentDetailEntry in protocol/hooks.ts.
  • kit/client-bridge.ts imports them from the protocol module instead of declaring its own copies, so it becomes a consumer of the shared types too.
  • The browser extension and the devtools UI drop their local declarations and re-export the kit types under their existing local names, so every consumer keeps a single import source and cannot drift.
  • The Devtools prefix is kept on purpose: a bare RenderEvent would collide with the DOM lib global.

No public API change: the same type names are still exported from @qwik.dev/devtools/kit, just from the protocol module rather than the client bridge.

Verification

  • @qwik.dev/devtools/kit builds and its generated .d.mts exports all three types.
  • tsc on the devtools UI passes with zero errors.
  • tsc on the browser extension reports only two preexisting wxt TS2742 errors, unrelated to this change.
  • eslint passes on every touched file.

References

QwikDev project board, card "p1 Shared Type Duplication": https://github.com/orgs/QwikDev/projects/6/views/1

The VNode tree node, component detail entry, and render event shapes were
declared three times with identical fields: in the browser extension, in the
devtools UI, and in the kit client bridge.

Move them into the kit protocol module (DevtoolsVNodeTreeNode in protocol/vnode,
DevtoolsRenderEvent in protocol/perf, DevtoolsComponentDetailEntry in
protocol/hooks). The client bridge, the extension, and the UI now all import
them from @qwik.dev/devtools/kit. No public API change: the same names are still
exported, just from the protocol module.
@Aejkatappaja Aejkatappaja requested a review from a team as a code owner June 9, 2026 23:07
@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0fdd84a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@qwik.dev/devtools Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8712

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8712

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8712

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8712

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@8712

commit: 0fdd84a

@JerryWu1234

Copy link
Copy Markdown
Contributor

@wmertens i done please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants