invariant.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-client-web-react`.
  3. * @module @deepseek-ai/dsh-client-web-react/invariant
  4. */
  5. /* jscpd:ignore-start */
  6. import type { Context } from '@deepseek-ai/cordis'
  7. import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
  8. const PACKAGE_NAME = '@deepseek-ai/dsh-client-web-react'
  9. /** Cordis companion plugin name. */
  10. export const name = 'client-web-react-invariant'
  11. /** Service required before the companion can reserve package ownership. */
  12. export const inject = ['invariants']
  13. /**
  14. * No runtime invariant: pure ctx-to-React glue — it emits no cordis events
  15. * and owns no cross-plugin mutable relation; store batching, selector
  16. * equality short-circuits, and inject-cache identity are asserted directly
  17. * by this package's behavior specs.
  18. */
  19. const install: InvariantInstaller = () => {}
  20. /**
  21. * Register this package's invariant companion.
  22. * @param ctx - Cordis context carrying the invariant service.
  23. * @returns the installed registration's disposer after setup succeeds.
  24. */
  25. export const apply = (ctx: Context): Promise<() => void> =>
  26. Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
  27. /* jscpd:ignore-end */