/** * Value marshalling between host JS and JSC JSValueRef. * * Strategy: JSON round-trip. `JSValueMakeFromJSONString` and * `JSValueCreateJSONString` are both in the public C API and avoid the * "walk the value graph through FFI" trap that other JSC wrappers fall into. * The cost is one stringify on each side per cross. For everything except * massive buffers (where the user should use ExternalCopy / typed arrays * directly) this is the right trade. * * Things that JSON-round-trip lose: `undefined` (collapses to `null` or * absent), `Function`, `Symbol`, `BigInt`, host-side `Error` instances, * cyclic refs. Callers that need those use specific helpers * (`makeUndefined`, `makeError`, `Reference` for functions). */ import type { JscSymbols } from "./bindings"; /** Allocate a JSStringRef from a UTF-8 string. Caller must * `JSStringRelease` when done. */ export declare const makeJsString: (s: JscSymbols, text: string) => bigint; /** Copy a JSStringRef back to a host JS string. */ export declare const readJsString: (s: JscSymbols, str: bigint) => string; /** Host JS value → JSValueRef in `ctx`. Returns 0n (null pointer) on * unrepresentable input. */ export declare const hostToJs: (s: JscSymbols, ctx: bigint, value: unknown) => bigint; /** JSValueRef → host JS value via JSON round-trip. Throws if the value * doesn't serialise (cyclic, etc). For primitives the conversion uses * the typed helpers (JSValueToBoolean / Number / StringCopy) directly, * skipping JSON. */ export declare const jsToHost: (s: JscSymbols, ctx: bigint, value: bigint) => unknown;