import type { MessageReaderOptions } from "vscode-jsonrpc/node"; /** * The content-type decoder shape vscode-jsonrpc's {@link MessageReaderOptions} accepts. Derived * from the reader options rather than deep-imported, because the concrete `ContentTypeDecoder` * type is not re-exported from the package entrypoint. */ export type JsonRpcContentTypeDecoder = NonNullable; /** * Parses JSON directly from its UTF-8 bytes, never materializing the whole document as one JS * string. Structural punctuation is recognized byte-by-byte, while every scalar and every object key * is handed to the engine's `JSON.parse` as its own small slice — so escaping, number formatting and * literal validation match it exactly. This is the mirror of how `jsonFragments` defers to * `JSON.stringify`, and it accepts precisely the grammar `JSON.parse` accepts. * * Byte-level scanning is safe for the ASCII-compatible charsets vscode-jsonrpc supports (`utf-8`, * `ascii`): a UTF-8 continuation byte is always >= 0x80, so it can never be mistaken for a quote, * backslash, or structural character. Containers are tracked on an explicit stack, so nesting depth * is bounded by heap rather than by the call stack. */ export declare function parseJsonBytes(buf: Buffer, charset: BufferEncoding): unknown; /** * A drop-in replacement for vscode-jsonrpc's default `application/json` content-type decoder, which * does {@code JSON.parse(buffer.toString(charset))}. That intermediate string is capped at V8's * String.kMaxLength (~512 MB), so an inbound message above the cap throws "Cannot create a string * longer than 0x1fffffe8 characters" before it is ever parsed — the reader drops the message, the * peer's request is never answered, and the call hangs until it times out. Parsing straight from the * bytes raises the inbound ceiling to Node's Buffer.MAX_LENGTH, matching what {@link * chunkedJsonEncoder} does for outbound messages. * * A UTF-8 (or ASCII) decode never yields more UTF-16 code units than there are bytes, so a body at * or under the cap cannot overflow the intermediate string; those take the faster single-string * parse, and only genuinely oversized bodies pay for the byte-level walk. */ export declare const chunkedJsonDecoder: JsonRpcContentTypeDecoder; //# sourceMappingURL=message-decoder.d.ts.map