export { createStreamingReplacer }; import type { ServerReplacerContext, ReplacerType, TypeContract } from '../../types.js'; import type { AbortError } from '../../../shared/Abort.js'; /** Creates a JSON-serializer replacer that delegates to type-specific plugins. * The caller provides `getContext(value)` which returns a per-value ServerReplacerContext — * the registry has no shield logic, it just iterates types and forwards the context. * * Duplicated references are deduplicated: `JSON.stringify` visits every occurrence of a shared * reference, so without the cache each occurrence would run `replace()` again — minting another * stub channel, another lifecycle registration, another wire subscription. Instead, duplicates * re-emit the first occurrence's replacement verbatim (wire format unchanged), and the client's * mirror cache (createStreamingReviver) revives equal wire strings to one object. */ declare function createStreamingReplacer(getContext: (value: unknown) => ServerReplacerContext, onReplaced: (replaced: { close: () => Promise | void; abort: (abortError: AbortError) => void; }) => void, extensionTypes: ReplacerType[]): (_key: string, value: unknown, serializer: (v: unknown) => string) => { replacement: string; resolved: boolean; } | undefined;