seed.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Platform-singleton module-table. These are the ONLY entities the shell
  3. * shares into the frozen module table — fetch bundles resolve their externals
  4. * against exactly this set through the loader's require. Keys come from the
  5. * platform constant module ({@link ./platform.ts}, the single source
  6. * of truth with the tsdown client externals); values stay shell-static
  7. * imports so every bundle sees the same instance.
  8. */
  9. import * as React from 'react'
  10. import * as ReactJsxRuntime from 'react/jsx-runtime'
  11. import * as ReactDom from 'react-dom'
  12. import * as ReactDomClient from 'react-dom/client'
  13. import * as Cordis from '@deepseek-ai/cordis'
  14. import * as UiSlots from '@deepseek-ai/dsh-client-ui-slots'
  15. import * as WebReact from '@deepseek-ai/dsh-client-web-react'
  16. import * as UiPrimitives from '@deepseek-ai/dsh-client-ui-primitives'
  17. import * as SchemaForm from '@deepseek-ai/dsh-client-schema-form'
  18. import type { PlatformModule } from './platform.ts'
  19. /**
  20. * Build the static table handed to the module loader at boot.
  21. * @returns module specifier → exported entity (one entry per platform word).
  22. */
  23. export function getStaticModules(): Record<string, unknown> {
  24. // The satisfies pin is the projection contract: a word added to
  25. // PLATFORM_MODULES without a static import here (or vice versa) fails to
  26. // compile instead of drifting into a runtime require miss.
  27. return {
  28. 'react': React,
  29. 'react/jsx-runtime': ReactJsxRuntime,
  30. 'react-dom': ReactDom,
  31. 'react-dom/client': ReactDomClient,
  32. '@deepseek-ai/cordis': Cordis,
  33. '@deepseek-ai/dsh-client-ui-slots': UiSlots,
  34. '@deepseek-ai/dsh-client-web-react': WebReact,
  35. '@deepseek-ai/dsh-client-ui-primitives': UiPrimitives,
  36. '@deepseek-ai/dsh-client-schema-form': SchemaForm,
  37. } satisfies Record<PlatformModule, unknown>
  38. }