//#region src/engine/generated/jspi/interfaces/typst-engine-types.d.ts /** @module Interface typst:engine/types **/ /** * # Variants * * ## `"project"` * * ## `"package"` * * ## `"url"` */ type FileKind = 'project' | 'package' | 'url'; interface FetchRequest { path: string; kind: FileKind; } /** * # Variants * * ## `"pdf"` * * ## `"png"` * * ## `"svg"` * * ## `"html"` * * ## `"bundle"` */ type CompileFormat = 'pdf' | 'png' | 'svg' | 'html' | 'bundle'; interface InputEntry { key: string; value: string; } /** * # Variants * * ## `"v17"` * * ## `"a2b"` * * ## `"a3b"` */ type PdfStandard = 'v17' | 'a2b' | 'a3b'; interface CompileOptions { format?: CompileFormat; main?: string; inputs?: Array; pages?: string; pdfStandards?: Array; ppi?: number; } interface BytePage { page: number; data: Uint8Array; } interface TextPage { page: number; data: string; } interface BundleFile { path: string; data: Uint8Array; mediaType?: string; } type CompilePayload = CompilePayloadPdf | CompilePayloadPng | CompilePayloadSvg | CompilePayloadHtml | CompilePayloadBundle; interface CompilePayloadPdf { tag: 'pdf'; val: Uint8Array; } interface CompilePayloadPng { tag: 'png'; val: Array; } interface CompilePayloadSvg { tag: 'svg'; val: Array; } interface CompilePayloadHtml { tag: 'html'; val: string; } interface CompilePayloadBundle { tag: 'bundle'; val: Array; } /** * # Variants * * ## `"warning"` * * ## `"error"` */ type DiagnosticSeverity = 'warning' | 'error'; interface Diagnostic { message: string; severity: DiagnosticSeverity; file?: string; line?: number; column?: number; start?: number; end?: number; formatted: string; hints: Array; trace: Array; } interface CustomMetadata { label?: string; valueJson: string; } interface DocumentMetadata { title?: string; description?: string; author: Array; keywords: Array; custom: Array; } interface LoadedFile { kind: FileKind; path: string; resolvedPath?: string; mediaType?: string; } interface CompileSuccess { output: CompilePayload; diagnostics: Array; metadata?: DocumentMetadata; dependencies: Array; } //#endregion //#region src/engine/types.d.ts type EngineFetchRequest = FetchRequest; type EngineCompileOptions = CompileOptions; type EngineCompileSuccess = CompileSuccess; //#endregion //#region src/worker/protocol.d.ts declare const SharedMemoryCommunicationStatus: { readonly None: 0; readonly Pending: 1; readonly Error: 2; readonly Success: 3; }; declare const SharedMemoryCommunicationError: { readonly Other: 0; readonly NotFound: 1; readonly Denied: 2; readonly Timeout: 3; readonly Unavailable: 4; }; type SharedMemoryCommunicationError = (typeof SharedMemoryCommunicationError)[keyof typeof SharedMemoryCommunicationError]; type SharedMemoryCommunicationStatus = (typeof SharedMemoryCommunicationStatus)[keyof typeof SharedMemoryCommunicationStatus]; declare class SharedMemoryCommunication { dataBuf: SharedArrayBuffer; statusBuf: SharedArrayBuffer; sizeBuf: SharedArrayBuffer; errorBuf: SharedArrayBuffer; constructor(); private getStatusView; private getSizeView; getStatus(): SharedMemoryCommunicationStatus; setStatus(status: SharedMemoryCommunicationStatus): void; setBuffer(buf: Uint8Array): void; getBuffer(): Uint8Array; setError(error: SharedMemoryCommunicationError): void; getError(): SharedMemoryCommunicationError; waitForStatusChange(expectedStatus: SharedMemoryCommunicationStatus, timeoutMs?: number): boolean; static hydrateObj(obj: SharedMemoryCommunication): SharedMemoryCommunication; } interface TypstWorkerProtocol { init: { request: { sharedMemoryCommunication: SharedMemoryCommunication; coreModules?: Record; }; response: void; }; add_file: { request: { path: string; data: Uint8Array; }; response: void; }; add_source: { request: { path: string; text: string; }; response: void; }; add_fonts: { request: { data: Uint8Array[]; }; response: void; }; remove_file: { request: { path: string; }; response: void; }; clear_files: { request: void; response: void; }; set_main: { request: { path: string; }; response: void; }; compile: { request: { options: EngineCompileOptions; }; response: EngineCompileSuccess; }; list_files: { request: void; response: string[]; }; has_file: { request: { path: string; }; response: boolean; }; } type RequestOf = M extends { request: infer P; } ? P : void; type RpcRequestMessage = { [K in keyof T]: { kind: K; requestId: number; } & (RequestOf extends void ? Record : { payload: RequestOf; }) }[keyof T]; type RpcResponseMessage = { requestId: number; result: TResult; } | { requestId: number; error: TError; }; //#endregion //#region src/worker/messages.d.ts type MainToWorkerMessage = RpcRequestMessage; type WorkerEventMessage = { kind: "web_fetch"; payload: { request: EngineFetchRequest; }; }; type WorkerToMainMessage = RpcResponseMessage | WorkerEventMessage; //#endregion export { type MainToWorkerMessage, type WorkerToMainMessage }; //# sourceMappingURL=worker-thread.d.ts.map