Skip to content

Client Modules

pawaca edited this page Aug 30, 2026 · 1 revision

Client Modules

Edge replaces upstream's runtime module scanning with build-time static assembly.

Upstream reference: Client Modules

What Upstream Provides

The ClientModuleRegistry (ctx.clientModules) manages web plugin integration through incremental package scanning, boot graph composition, bundle routing, and index injection. At startup it scans dsh.client declarations in package.json files, builds a WebBootGraph with dependency edges and content hashes, and injects it as window.__DSH_BOOT__. Bundle changes trigger HMR updates via stat polling.

What Edge Changed

Replacement Build-time static assembly

Edge replaces runtime module scanning with a build-time pipeline:

  • assemble-standalone-web.mjs reads upstream published packages, builds each client plugin's bundle, and outputs them to dist/plugins/.
  • The boot graph is pre-computed and frozen at build time — no runtime scanning, no HMR.
  • verify-standalone.mjs checks the assembled plugin set against expected-boot-graph.json to catch accidental additions or removals.
  • Bundles are served as Cloudflare Assets (static files) with the Worker.

Direct Reuse All client plugins

The 32 upstream client plugins run unmodified in the browser. Edge adds one custom plugin (ui-edge) for workspace directory picker and file download — 33 total.

What Edge Did NOT Change

  • Client plugin code — all 32 upstream bundles run as published
  • Boot graph wire format (window.__DSH_BOOT__)
  • Plugin dependency resolution in the browser
  • cordis Context composition on the client side

Performance Characteristics

Load time

Static assets served from Cloudflare's edge CDN — no server-side rendering or module scanning at request time. The boot graph is a single JSON object embedded in the HTML. Plugin bundles are fetched in dependency order with content-hash cache busting.

Bundle verification

verify-standalone.mjs runs at build time (CI) in milliseconds. It compares the assembled plugin list against the reviewed expected-boot-graph.json. Any upstream dependency change that adds or removes a client plugin fails the build until the expectation is explicitly updated.

Architecture Summary

Component Category Upstream Equivalent
Build-time assembly Replace Runtime ClientModuleRegistry
Static asset serving Replace Bundle route + HMR
Boot graph verification Replace Runtime graph composition
32 upstream client plugins Reuse
ui-edge Replace No equivalent (Edge-specific UI)

Key observation: Edge trades runtime flexibility (HMR, dynamic scanning) for deployment simplicity (static bundles, build-time verification). The client-side plugin system is identical — only the delivery mechanism changes.

English

中文

Clone this wiki locally