2026-07-19 21:17:57 +08:00
|
|
|
/**
|
2026-07-23 21:55:39 +08:00
|
|
|
* Platform-singleton module-table. These are the ONLY entities the shell
|
|
|
|
|
* shares into the frozen module table — fetch bundles resolve their externals
|
|
|
|
|
* against exactly this set through the loader's require. Keys come from the
|
|
|
|
|
* platform constant module ({@link ./platform.ts}, contract C1: single source
|
|
|
|
|
* of truth with the tsdown client externals); values stay shell-static
|
|
|
|
|
* imports so every bundle sees the same instance.
|
2026-07-19 21:17:57 +08:00
|
|
|
*/
|
|
|
|
|
import * as React from 'react'
|
|
|
|
|
import * as ReactJsxRuntime from 'react/jsx-runtime'
|
|
|
|
|
import * as ReactDom from 'react-dom'
|
|
|
|
|
import * as ReactDomClient from 'react-dom/client'
|
|
|
|
|
import * as Cordis from 'cordis'
|
|
|
|
|
import * as UiSlots from '@deepseek-ai/dsh-client-ui-slots'
|
|
|
|
|
import * as WebReact from '@deepseek-ai/dsh-client-web-react'
|
|
|
|
|
import * as UiPrimitives from '@deepseek-ai/dsh-client-ui-primitives'
|
2026-07-23 21:55:39 +08:00
|
|
|
import type { PlatformModule } from './platform.ts'
|
2026-07-19 21:17:57 +08:00
|
|
|
|
|
|
|
|
/**
|
2026-07-23 21:55:39 +08:00
|
|
|
* Build the static table handed to the module loader at boot.
|
|
|
|
|
* @returns module specifier → export-surface entity (one entry per platform word).
|
2026-07-19 21:17:57 +08:00
|
|
|
*/
|
2026-07-23 21:55:39 +08:00
|
|
|
export function getStaticModules(): Record<string, unknown> {
|
|
|
|
|
// The satisfies pin is the projection contract: a word added to
|
|
|
|
|
// PLATFORM_MODULES without a static import here (or vice versa) fails to
|
|
|
|
|
// compile instead of drifting into a runtime require miss.
|
2026-07-19 21:17:57 +08:00
|
|
|
return {
|
|
|
|
|
'react': React,
|
|
|
|
|
'react/jsx-runtime': ReactJsxRuntime,
|
|
|
|
|
'react-dom': ReactDom,
|
|
|
|
|
'react-dom/client': ReactDomClient,
|
|
|
|
|
'cordis': Cordis,
|
|
|
|
|
'@deepseek-ai/dsh-client-ui-slots': UiSlots,
|
|
|
|
|
'@deepseek-ai/dsh-client-web-react': WebReact,
|
|
|
|
|
'@deepseek-ai/dsh-client-ui-primitives': UiPrimitives,
|
2026-07-23 21:55:39 +08:00
|
|
|
} satisfies Record<PlatformModule, unknown>
|
2026-07-19 21:17:57 +08:00
|
|
|
}
|