index.ts 624 B

1234567891011121314151617
  1. /** Host configuration for browser document previews. */
  2. import type { Context } from '@deepseek-ai/cordis'
  3. import type {} from '@deepseek-ai/dsh-host-webserver'
  4. import type { Config } from './config.ts'
  5. export { Config } from './config.ts'
  6. /**
  7. * Embed validated preview settings in browser pages.
  8. * @param ctx - Host context serving browser pages.
  9. * @param config - Cache limits adopted when the page loads.
  10. */
  11. export function apply(ctx: Context, config: Config): void {
  12. ctx.on('webserver/index-inject', (table) => {
  13. table.push({ kind: 'global', name: '__DSH_DOCUMENT_PREVIEW_CONFIG__', value: config })
  14. })
  15. }