feat(hub): serve a definition's absolute-path page script automatically - #312
Merged
Conversation
Let a devframe declare its page script on `dock.clientScript.importFrom` as an absolute filesystem path. The hub install path mounts the file's directory under the devframe's mount base and rewrites `importFrom` to the served URL, so mounting the a11y inspector by package name works on every host with no per-host wiring. The a11y inspector now declares its own page script, and the reference hosts (hub-vite, hub-next, a11y-messages-playground) drop their manual mount + `clientScript` recipes. Closes #310
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
antfu
reviewed
Aug 27, 2026
antfu
reviewed
Aug 27, 2026
Use pathe consistently in the install-devframe test so the served-dir assertion matches the implementation's normalized path on Windows. Trim the verbose comments/descriptions added across the change per review.
antfu
reviewed
Aug 27, 2026
Move the absolute-path shape to the third bullet and drop the a11y parenthetical (review). Make the page-script docs, jsdocs, and comments as concise as possible.
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.
Why
Mounting the a11y inspector by package name (
initHub({ devframes: ['@devframes/plugin-a11y'] })) left its panel stuck on "No page connected": nothing booted its page script. The knowledge was split — the plugin knew the page-script file, the host knew the URL space, and every host had to hand-write the same mount +clientScriptrecipe to join them.Closes #310.
What
Let a devframe declare its page script by path.
DevframeDockDefaults.clientScriptnow accepts an absolute filesystem path inimportFrom; the hub install path (prepareDevframe) serves the file's directory under the devframe's mount base (<base>__page-script/) and rewritesimportFromto that served URL — the samemountStaticthe hub already uses for each devframe's SPA dist. A URL or bare-specifierimportFromstill passes through untouched, so the change is additive.The a11y inspector then declares its own page script:
so
devframes: ['@devframes/plugin-a11y']works on every host with no wiring. The three reference hosts (hub-vite,hub-next,a11y-messages-playground) drop their manual mount +clientScriptrecipes.Notes
/@fs/…, a mounted bundle) by existence on disk — only a real file is mounted and rewritten.knip.jsonc(hub-next's a11y dep is now referenced only via the runtimeimport()loop) updated to match.This PR was created with the help of an agent.