The module system moves out of dsh-client-runtime (./loader retired) into its own package: a lazy CJS table where executing a bundle only registers its factory and materialization happens at first require, memoized, with recursive requires self-ordering. ClientModuleSystem is a class; index.ts keeps the types and a thin factory. Boot is two-phase: phase one prefetches the immediately tier in parallel (registration only, failures deferred to phase two's loud import); phase two mounts the vendored Loader with the module system as internal, creates one entry per graph row plus the app-shell pseudo-row the kernel appends itself, and settles on an all-ACTIVE sweep. The shell kernel is self-sufficient: hand-rolled loader-status stores, no plugin value imports, platform seed list single- sourced in platform.ts.
17 lines
761 B
TypeScript
17 lines
761 B
TypeScript
/**
|
|
* Browser stand-in for `node:module`, mapped by the vite alias in
|
|
* vite.config.ts (design §2.4). The vendored Loader's internal.ts imports
|
|
* `createRequire` at module scope but only calls it inside
|
|
* `ModuleLoader.fromInternal()`, whose version probe is compiled to the
|
|
* `"0.0.0"` define in the browser build — so this throw is a fail-loud
|
|
* tripwire for any path that would genuinely need Node's module machinery.
|
|
*/
|
|
|
|
/** Throwing stand-in for node:module's createRequire (never reached in the browser boot). */
|
|
export const createRequire = (): never => {
|
|
throw new Error('node:module is not available in the browser')
|
|
}
|
|
|
|
/** Erased type peer for the vendored loader's type-only LoadHookContext import. */
|
|
export type LoadHookContext = never
|