/** * Nexus Serialize — Lossless server→client data transport. * * The POJO Barrier problem: * JSON.stringify(new Date()) → '"2026-04-03T..."' (string, not Date) * JSON.stringify(new Map(...)) → '{}' (empty object!) * JSON.stringify(new Set(...)) → '{}' (empty object!) * JSON.stringify(42n) → throws TypeError * JSON.stringify(/foo/gi) → '{}' (empty object!) * * Nexus Serialize encodes rich types into a tagged wire format and * reconstructs them faithfully on the client — with zero external deps. * * Wire format: JSON with tagged wrapper objects * { __t: 'Date', v: '2026-04-03T...' } * { __t: 'Map', v: [[key, value], ...] } * { __t: 'Set', v: [item, ...] } * { __t: 'BigInt', v: '9007199254740993' } * { __t: 'RegExp', v: { src: 'foo', flags: 'gi' } } * { __t: 'URL', v: 'https://nexusjs.dev' } * { __t: 'Undef' } * { __t: 'NaN' } * { __t: 'Inf', v: 1 | -1 } * { __t: 'Buf', v: '' } (Uint8Array / Buffer) * { __t: 'Err', v: { msg, name, stack? } } * * Usage: * // Server (frontmatter or Server Action) * const wire = serialize({ user, createdAt: new Date(), tags: new Set(['a', 'b']) }); * * // Client (island) * const { user, createdAt, tags } = deserialize(wire); * createdAt instanceof Date // true ✓ * tags instanceof Set // true ✓ */ /** * Serializes any JavaScript value to a JSON string. * Preserves: Date, Map, Set, BigInt, RegExp, URL, Uint8Array, * undefined, NaN, Infinity, Error, nested objects/arrays. */ /** * Serializes to a JSON string safe to embed in `` cannot terminate the host tag; * `JSON.parse` still yields the original string values (round-trip preserves `<`). */ export declare function serialize(value: unknown): string; /** * Encodes a value for the wire format (pre-JSON.stringify step). */ export declare function encode(value: unknown): unknown; /** * Deserializes a Nexus wire-format JSON string back to rich JavaScript values. */ export declare function deserialize(json: string): T; /** * Decodes a pre-parsed wire-format value. */ export declare function decode(value: unknown): unknown; /** * Generates an inline