refactor(devtools): generate the extension VNode bridge from one shared source#8713
Merged
wmertens merged 1 commit intoJun 25, 2026
Merged
Conversation
…ed source The browser extension's public/vnode-bridge.js duplicated the VNode bridge logic that the Vite plugin already owns via __qwik_install_vnode_runtime__ / createVNodeRuntime(). Generate it from that single canonical source instead. - Expose createVNodeRuntime through the internal codegen entry. - Generalize the extension generate step (gen-injected-scripts.mjs) to emit both devtools-hook.js and vnode-bridge.js, wired into build and dev. - Stop tracking public/vnode-bridge.js; it is gitignored and generated, matching the devtools-hook.js approach.
🦋 Changeset detectedLatest commit: 2e6ed3b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
Contributor
|
done, @wmertens please take a look |
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.

Problem
packages/browser-extension/public/vnode-bridge.jsduplicated the VNode bridge logic the Vite plugin already owns inpackages/devtools/plugin/src/virtualmodules/vnodeBridge.ts(viacreateVNodeRuntime()/__qwik_install_vnode_runtime__): tree building, prop serialization, component name normalization, DOM element resolution, highlighting, and component tree update posting. Both had to be kept in sync by hand.Solution
Generate the extension bridge from the single canonical source, the same way
devtools-hook.jsis handled.createVNodeRuntimethrough the internalcodegenentry of@qwik.dev/devtools(build-time only, not a published subpath).scripts/gen-injected-scripts.mjs, which now emits bothdevtools-hook.jsandvnode-bridge.jsfrom their canonical builders. It replacesgen-devtools-hook.mjsand stays wired as the first step ofbuildanddev(and the firefox variants).public/vnode-bridge.js: it is gitignored and generated on build/dev, matching thedevtools-hook.jsapproach.The extension bridge is now byte-for-byte the same module the plugin injects (same
createVNodeRuntime()output), so the two cannot drift.Verification
@qwik.dev/devtoolsbuilds andcodegen.mjsexportscreateVNodeRuntime.vnode-bridge.jsis valid ESM and exposes the full bridge surface (getVNodeTree,resolveElementToComponent,getElementRect,highlightNode,unhighlightNode,getNodeProps, component tree update posting), installed with the bound@qwik.dev/core/internalhelpers.References
QwikDev project board, card "p1 VNode Bridge Duplication": https://github.com/orgs/QwikDev/projects/6/views/1