Repository navigation
Suggestion: out-of-tree 'browser-half bundle' template + guide for dsh-plugin authors #5899
Replies: 1 comment
|
This gap is real and I hit the same wall when I published a browser-half plugin. I verified the actual mechanics against current 1. Node half — nearly empty. // src/index.ts
export function apply(): void {}The node half just has to exist so the plugin shows up in the host 2. The {
"name": "@scope/dsh-plugin-foo",
"exports": { "./client": "./lib/client/index.js" },
"dsh": {
"client": {
"inject": [
"@deepseek-ai/dsh-client-locale",
"@deepseek-ai/dsh-client-ui-conversation",
"@deepseek-ai/dsh-client-ui-renderer",
"@deepseek-ai/dsh-client-ui-session"
],
"platform": "web"
}
}
}The 3. The bundle entry — lazy-CJS factory via // the emitted artifact calls this once; the factory is NOT executed at load time
window.__ModuleLoader__.load({
id: '@scope/dsh-plugin-foo',
factory(require) {
// module body side effects (including CSS injection) run here, at materialization
const { inject, apply } = require('./index.js')
return { name: 'dsh-plugin-foo', inject, apply }
},
})The factory receives the injected The real gap is that none of this is any single discoverable doc — the
I've had to assemble exactly this template to publish my own browser-half plugins. Happy to post the full copyable template here (package.json + dsh.client + minimal entry) if that would unblock you — I can drop it in this thread rather than waiting on the upstream docs since the content is stable and self-contained. Also worth noting: the |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Providing an out-of-tree browser-half bundle is much harder than the authoring docs imply, and there is no template or guide to copy.
docs/cookbook/adding-a-settings-card.mdeven states: "No published preset exposes this package, so a package outside this repository has to reproduce the same output format itself." The required format (window.__ModuleLoader__.load({ id, factory })lazy-CJS factory that exports{ name, inject, apply }, served via a./clientexport +dsh.clientmanifest) is only discoverable from the internaltsdown.client.tspreset or by reading installed bundles.Motivation
dsh-plugin) commonly need a browser half; without the monorepo toolchain, authors must reverse-engineer the artifact format by hand.prepareruns), so the community needs a path that ships committed artifacts and a tiny reproducible build step.Suggested deliverables
A minimal, self-contained out-of-tree template plus a short guide (either in
docs/user/develop/or a newcreate-dsh-plugin/ template repo):package.jsonwithdsh.bundle.patch(cordis.patch.yml),dsh.client.platform: "web", and a./clientexport.scripts/build.mjsthat wraps a CJS source fragment into the__ModuleLoader__.loadclosure factory (committedlib/client.js, so git installs work with noprepare).index.js) needed to make the package a Loader entry.ctx).Reference implementation to model on: https://github.com/andreagosto/dsh-tab-watchdog.
All reactions