UNPKG

@jsonjoy.com/json-type

Version:

High-performance JSON Pointer implementation

27 lines (26 loc) 1.2 kB
import { Codegen } from '@jsonjoy.com/util/lib/codegen'; import type { TypeSystem } from '../../system'; import type { Type } from '../../type'; import type { CompiledBinaryEncoder } from '../types'; import type { BinaryJsonEncoder } from '@jsonjoy.com/json-pack/lib/types'; export interface BinaryEncoderCodegenContextOptions<Encoder extends BinaryJsonEncoder> { /** Type for which to generate the encoder. */ type: Type; /** Encoder to generate inlined blobs. */ encoder: Encoder; /** Type system to use for alias and validator resolution. */ system?: TypeSystem; /** Name to concatenate to the end of the generated function. */ name?: string; } export declare class BinaryEncoderCodegenContext<Encoder extends BinaryJsonEncoder> { readonly options: BinaryEncoderCodegenContextOptions<Encoder>; readonly codegen: Codegen<CompiledBinaryEncoder>; constructor(options: BinaryEncoderCodegenContextOptions<Encoder>); getBigIntStr(arr: Uint8Array, offset: number): string; private codegenBlob; js(js: string): void; gen(callback: (encoder: Encoder) => void): Uint8Array; blob(arr: Uint8Array): void; compile(): CompiledBinaryEncoder; }