@deepseek-ai/libreoffice-kit 0.0.1-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1,15 @@
1
+ import type { DocumentFontMetadata } from './ooxml.ts';
2
+ import type { ResolvedOptions } from './options.ts';
3
+ /** Input suffixes accepted by the public converter. */
4
+ export declare const DOCUMENT_EXTENSIONS: readonly ["doc", "docx", "odt", "xls", "xlsx", "ods", "ppt", "pptx", "odp"];
5
+ /**
6
+ * Inspect the input container before invoking LibreOffice's document importer.
7
+ * Compound-file streams and legacy font tables are interpreted by LibreOffice;
8
+ * they do not supply the API's OOXML font diagnostics.
9
+ * @param bytes - Source bytes already bounded by maxInputBytes.
10
+ * @param extension - Lowercase source suffix.
11
+ * @param limits - Limits applied to ZIP-based document contents.
12
+ * @returns OOXML font metadata, or empty diagnostics for a binary document.
13
+ */
14
+ export declare function inspectDocument(bytes: Uint8Array, extension: string, limits: Pick<ResolvedOptions, 'maxArchiveEntries' | 'maxUncompressedBytes'>): DocumentFontMetadata;
15
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1,15 @@
1
+ /** Shared bounded raster allocations for browser and Node engine owners. */
2
+ import { type EnginePage, type RasterTile, type TileRequest } from './rendering.ts';
3
+ export interface RasterModule {
4
+ readonly HEAPU32: Uint32Array;
5
+ ccall(name: string, returnType: string | null, argTypes: string[], args: unknown[]): number;
6
+ UTF8ToString(pointer: number): string;
7
+ }
8
+ export declare function numericCall(module: RasterModule, name: string, args: number[]): number;
9
+ /** Copy/free one engine-owned UTF-8 return value. */
10
+ export declare function engineString(module: RasterModule, name: string, types: string[], args: unknown[], failure: () => Error): string;
11
+ /** Paint into a temporary allocation; copy pixels before free or another engine call. */
12
+ export declare function renderRegion(module: RasterModule, document: number, request: TileRequest, pages: readonly EnginePage[], failure: () => Error, pdf?: boolean): RasterTile;
13
+ /** PDF page dimensions use the same twips ABI, with an immutable PDF page index as part. */
14
+ export declare function pdfPages(module: RasterModule, pdf: number, failure: () => Error): EnginePage[];
15
+ //# sourceMappingURL=engine-rendering.d.ts.map
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Engine-family version every installed engine package must carry. The engine
3
+ * family shares its release version with this Node API.
4
+ */
5
+ export declare const ENGINE_VERSION = "0.0.1-2";
6
+ /** Host diagnostic fields used to identify the runtime glibc version. */
7
+ export interface EngineHostReport {
8
+ readonly header?: {
9
+ readonly glibcVersionRuntime?: string;
10
+ };
11
+ }
12
+ /** Process identification and diagnostic report the resolver classifies the host with. */
13
+ export interface EngineResolutionHost {
14
+ readonly platform?: string;
15
+ readonly arch?: string;
16
+ readonly report?: () => EngineHostReport;
17
+ }
18
+ /** Engine installation fields both backends carry. */
19
+ interface EngineInstallation {
20
+ /** Installed package root the manifest resolved to. */
21
+ readonly root: string;
22
+ /** Program resources the engine loads: a real directory natively, a virtual path in WASM. */
23
+ readonly programDirectory: string;
24
+ /** Recorded glibc floor when the native manifest declares one. */
25
+ readonly glibcMinimum?: string;
26
+ }
27
+ /** A resolved native LibreOfficeKit helper. */
28
+ export interface NativeEngine extends EngineInstallation {
29
+ readonly backend: 'native';
30
+ readonly executable: string;
31
+ }
32
+ /** A resolved shared Node WebAssembly engine. */
33
+ export interface WasmEngine extends EngineInstallation {
34
+ readonly backend: 'wasm';
35
+ readonly loader: string;
36
+ readonly wasm: string;
37
+ readonly data: string;
38
+ readonly metadata: string;
39
+ }
40
+ /** One resolved engine installation. */
41
+ export type Engine = NativeEngine | WasmEngine;
42
+ /** Engine backend a conversion runs in. */
43
+ export type EngineBackend = Engine['backend'];
44
+ /**
45
+ * Whether an installed engine package directory is present on the resolution path.
46
+ * @param name - Engine package name.
47
+ * @returns true when at least one resolution directory holds the package.
48
+ */
49
+ export declare function installedPackageExists(name: string): boolean;
50
+ /**
51
+ * Return the optional package target for the current process ABI.
52
+ * @param platform - Host operating system.
53
+ * @param arch - Host CPU architecture.
54
+ * @param report - Host diagnostic report used to identify glibc.
55
+ * @returns the declared platform target, or undefined for an unsupported host.
56
+ */
57
+ export declare function platformTarget(platform?: string, arch?: string, report?: () => EngineHostReport): string | undefined;
58
+ /**
59
+ * macOS and Windows require their native engine. Linux uses WASM when no compatible development native engine is installed.
60
+ * @param resolvePackage - Package manifest resolver; injectable for selection tests.
61
+ * @param packageExists - Installed-package probe; injectable for selection tests.
62
+ * @param host - Process identification and diagnostic report.
63
+ * @returns the installed native engine, or the installed WASM engine.
64
+ */
65
+ export declare function resolveEngine(resolvePackage?: (name: string) => string, packageExists?: (name: string) => boolean, { platform, arch, report }?: EngineResolutionHost): Promise<Engine>;
66
+ export {};
67
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1,21 @@
1
+ /** Stable render failure categories shared across the Node worker and native helper transports. */
2
+ /** Categories a conversion can report across the worker and native helper messages. */
3
+ export type ConversionErrorCode = 'input-too-large' | 'output-too-large' | 'invalid-document' | 'unsupported-format' | 'invalid-output' | 'timeout' | 'unavailable' | 'failed';
4
+ /** An actionable converter failure; operating-system errors and caller abort reasons remain unchanged. */
5
+ export declare class ConversionError extends Error {
6
+ /** Published failure category carried across worker and helper transports. */
7
+ readonly code: ConversionErrorCode;
8
+ /**
9
+ * @param code - Published failure category.
10
+ * @param message - Consumer-facing failure description.
11
+ * @param options - Standard error options; a cause is preserved for diagnostics.
12
+ */
13
+ constructor(code: ConversionErrorCode, message: string, options?: ErrorOptions);
14
+ }
15
+ /**
16
+ * Only published categories cross worker/helper messages; unknown errors use the generic failure category.
17
+ * @param error - The thrown value, which may be any type and may carry an unpublished `code`.
18
+ * @returns The published category, or `failed` when no published category is present.
19
+ */
20
+ export declare function failureCode(error: unknown): ConversionErrorCode;
21
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { type FontFace } from './fonts.ts';
2
+ import type { ResolvedOptions } from './options.ts';
3
+ export type FontFileFormat = 'ttf' | 'otf' | 'ttc';
4
+ export declare function fontFileFormat(bytes: Uint8Array): FontFileFormat;
5
+ /** Keep full names, encoding tables and glyphs. Apple dfont containers expose one complete sfnt resource. */
6
+ export declare function fullFontFile(face: FontFace): {
7
+ bytes: Uint8Array;
8
+ sourceHash: string;
9
+ format: FontFileFormat;
10
+ };
11
+ /** Mount a fixed bounded set before PDFium performs its first installed-font enumeration. */
12
+ export declare function preloadPdfFonts(options: ResolvedOptions, faces: readonly FontFace[], install: (name: string, bytes: Uint8Array) => void): void;
13
+ //# sourceMappingURL=font-full.d.ts.map
@@ -0,0 +1,38 @@
1
+ import type { FontFace, FontMatchRequest } from './fonts.ts';
2
+ import type { DocumentFontMetadata } from './ooxml.ts';
3
+ import type { ResolvedOptions } from './options.ts';
4
+ /** Missing-family choices the native helper writes into its private profile. */
5
+ export interface FontSubstitution {
6
+ readonly family: string;
7
+ /** Installed family selected for the missing one. */
8
+ readonly substitute: string;
9
+ }
10
+ /** Serializable match state shared by converters created from one factory. */
11
+ export interface FontResolutionCacheEntry {
12
+ readonly key: string;
13
+ readonly codePoints: number[];
14
+ readonly emptyRequest: boolean;
15
+ readonly faces: {
16
+ readonly path: string;
17
+ readonly faceIndex: number;
18
+ }[];
19
+ readonly missingFamily?: string;
20
+ }
21
+ /** One conversion's font imports: a serialized resolver plus its diagnostics. */
22
+ export interface FontLoader {
23
+ readonly missingFonts: string[];
24
+ readonly substitutions: FontSubstitution[];
25
+ readonly files: string[];
26
+ /** Most-recently-used entries safe to merge into the owning factory. */
27
+ readonly cacheEntries: FontResolutionCacheEntry[];
28
+ resolve(request: FontMatchRequest): string[];
29
+ }
30
+ /** Place installed original bytes where the engine can read them. */
31
+ export type FontInstaller = (name: string, bytes: Buffer) => string;
32
+ /** Build one operation's loader over a factory-owned immutable font snapshot. */
33
+ export declare function createFontLoader(options: ResolvedOptions, document: DocumentFontMetadata, install: FontInstaller, faces: readonly FontFace[], cache?: readonly FontResolutionCacheEntry[]): FontLoader;
34
+ /** Supply native imports and seed WASM's first usable default font. */
35
+ export declare function preloadFonts(loader: FontLoader, options: ResolvedOptions, document: DocumentFontMetadata, native?: boolean): void;
36
+ /** Fontconfig XML restricts WASM discovery to imported originals in MEMFS. */
37
+ export declare function memoryFontConfig(families: readonly (readonly string[])[], requested?: Iterable<string>): string;
38
+ //# sourceMappingURL=font-loader.d.ts.map
@@ -0,0 +1,142 @@
1
+ import type { Font, FontCollection } from 'fontkit';
2
+ /** One inclusive Unicode range a physical face renders. */
3
+ export type GlyphRange = [number, number];
4
+ /** Metadata for one physical face, captured without retaining its bytes or glyph coverage. */
5
+ export interface FontFace {
6
+ readonly path: string;
7
+ readonly size: number;
8
+ readonly mtimeMs: number;
9
+ readonly ctimeMs: number;
10
+ readonly dev: number;
11
+ readonly ino: number;
12
+ readonly faceIndex: number;
13
+ readonly family: string;
14
+ readonly style: string;
15
+ readonly aliases: string[];
16
+ readonly weight: number;
17
+ readonly width: number;
18
+ readonly italic: boolean;
19
+ readonly fixed: boolean;
20
+ readonly postscriptName: string | null;
21
+ /** Decoded glyph ranges; absent until a match reads this face's coverage. */
22
+ coverage?: GlyphRange[];
23
+ }
24
+ /** VCL attributes LibreOffice requests one family for. */
25
+ export interface FontMatchRequest {
26
+ readonly family: string;
27
+ readonly style: string;
28
+ readonly weight: number;
29
+ readonly italic: number;
30
+ readonly width: number;
31
+ readonly pitch: number;
32
+ readonly language: string;
33
+ readonly codePoints: readonly number[];
34
+ }
35
+ /** Selected physical files and the requested family the catalog could not find. */
36
+ export interface FontMatchResult {
37
+ readonly fonts: FontFace[];
38
+ readonly missingFamily?: string;
39
+ readonly unresolvedCodePoints?: number[];
40
+ }
41
+ /** One host font snapshot and the ordered fallback groups a conversion supplies. */
42
+ export interface SystemFontCatalogOptions {
43
+ readonly faces: readonly FontFace[];
44
+ readonly fallbackFamilies: readonly (readonly string[])[];
45
+ }
46
+ /** Host font roots and physical file limits. */
47
+ export interface FontIndexOptions {
48
+ readonly directories: readonly string[];
49
+ readonly maxFiles: number;
50
+ readonly maxFileBytes: number;
51
+ }
52
+ /**
53
+ * @param error - Thrown filesystem value.
54
+ * @returns whether it means the path is not a usable font source.
55
+ */
56
+ export declare function absent(error: unknown): boolean;
57
+ /**
58
+ * Case- and separator-insensitive family key used to compare names across sources.
59
+ * @param value - Family, style, or postscript name as recorded by a document or font.
60
+ * @returns The normalized key.
61
+ */
62
+ export declare function normalize(value: string): string;
63
+ /**
64
+ * Order named substitutions and their generic text family without excluding unlisted fonts.
65
+ * @param requested - Original family names, in document order.
66
+ * @param groups - Ordered family groups shared with Fontconfig aliases.
67
+ * @param pitch - VCL pitch; one requests a monospaced fallback.
68
+ * @param symbols - Whether symbol alternatives precede the generic fallback.
69
+ * @returns distinct family names, with original requests first.
70
+ */
71
+ export declare function fontFamilyPriority(requested: readonly string[], groups: readonly (readonly string[])[], pitch?: number, symbols?: boolean): string[];
72
+ /**
73
+ * Discover system and per-user font roots using the selected platform's path separators.
74
+ * @param platform - Host operating system.
75
+ * @param home - Host user home used to locate per-user font directories.
76
+ * @param env - Host environment containing Windows and XDG directory overrides.
77
+ * @returns candidate directories; missing platform directories are ignored during indexing.
78
+ */
79
+ export declare function systemFontDirectories(platform?: NodeJS.Platform, home?: string, env?: NodeJS.ProcessEnv): string[];
80
+ /**
81
+ * Font asset directories macOS publishes under its MobileAsset root.
82
+ * @param assets - Absolute MobileAsset font directory root.
83
+ * @returns matching asset directories, sorted by name.
84
+ * @throws when the root exists but cannot be read for a reason other than its absence or protection.
85
+ */
86
+ export declare function mobileAssetFontDirectories(assets: string): string[];
87
+ /**
88
+ * Decode glyph coverage for one parsed face.
89
+ * @param font - The parsed physical face.
90
+ * @returns the inclusive ranges the face renders, or none when its glyph tables reject decoding.
91
+ */
92
+ export declare function faceCoverage(font: Font): GlyphRange[];
93
+ /**
94
+ * @param parsed - Parsed font file: one face, or a collection of faces.
95
+ * @param face - Indexed metadata naming the face inside that file.
96
+ * @returns the physical face the index names.
97
+ * @throws when the file no longer provides the indexed face.
98
+ */
99
+ export declare function indexedFace(parsed: Font | FontCollection, face: Pick<FontFace, 'faceIndex' | 'postscriptName'>): Font;
100
+ /**
101
+ * VCL weight, width, and fixed-pitch values for one parsed face.
102
+ * @param font - The parsed physical face, whose `OS/2` and `post` tables may be absent.
103
+ * @returns the recorded classes, or the regular defaults for an absent table.
104
+ */
105
+ export declare function faceMetrics(font: Pick<Font, 'OS/2' | 'post'>): {
106
+ weight: number;
107
+ width: number;
108
+ fixed: boolean;
109
+ };
110
+ /**
111
+ * Snapshot eligible local font metadata without retaining font bytes or decoding glyph coverage.
112
+ * @param options - Host font roots and physical file limits.
113
+ * @returns metadata reused for the converter lifetime; recreate it after changing installed fonts.
114
+ */
115
+ export declare function indexSystemFonts(options: FontIndexOptions): FontFace[];
116
+ /** Conversion-local glyph coverage over the converter's first metadata snapshot. */
117
+ export declare class SystemFontCatalog {
118
+ private readonly options;
119
+ private readonly faces;
120
+ /**
121
+ * @param options - Host metadata snapshot and fallback families.
122
+ */
123
+ constructor(options: SystemFontCatalogOptions);
124
+ /**
125
+ * Find installed faces covering the requested family or missing characters.
126
+ * Exact families precede configured alternatives, symbol families for missing symbols,
127
+ * generic families, then other glyph-covering faces.
128
+ * @param request - VCL family/style attributes and Unicode scalars missing from its current font.
129
+ * @param signal - cancellation checked between synchronous font reads.
130
+ * @returns selected physical files, deduplicated across collection faces; absent glyphs remain unresolved.
131
+ * @throws if an indexed font changes or cannot be read during glyph matching.
132
+ */
133
+ match(request: FontMatchRequest, signal: AbortSignal): FontMatchResult;
134
+ }
135
+ /**
136
+ * Read the unchanged indexed regular file; reject concurrent replacement or truncation.
137
+ * @param face - Indexed face metadata whose identity and timestamps must still match the file.
138
+ * @returns the complete original font bytes.
139
+ * @throws when the file changed, was replaced, or was truncated since indexing.
140
+ */
141
+ export declare function readFont(face: FontFace): Buffer;
142
+ //# sourceMappingURL=fonts.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { type Rectangle } from './sheet-geometry.ts';
2
+ export declare const IMAGE_FORMATS: readonly ["doc", "docx", "odt", "xls", "xlsx", "ods", "ppt", "pptx", "odp", "pdf"];
3
+ export interface RenderImagesRequest {
4
+ readonly inputPath: string;
5
+ /** Must not exist. A failed or cancelled batch removes this entire new directory. */
6
+ readonly outputDir: string;
7
+ /** One-based physical pages/slides; forbidden for worksheets. Default: all. */
8
+ readonly pages?: 'all' | readonly number[];
9
+ /** Calc only. Exact worksheet name. Without it, render each visible worksheet's data area. */
10
+ readonly sheet?: string;
11
+ /** Calc only. A1 rectangle, requiring an exact sheet. Default: A1 through the last data cell. */
12
+ readonly range?: string;
13
+ /** Raster DPI. Default 144, range 24–600. */
14
+ readonly dpi?: number;
15
+ /** Total output image limit, including worksheet fragments. Never truncates. Default: 100. */
16
+ readonly maxPages?: number;
17
+ /** Per-image pixel limit. Default and maximum: 16777216. */
18
+ readonly maxPixels?: number;
19
+ /** Per-image width/height limit in output pixels. Default: 8192. */
20
+ readonly maxDimension?: number;
21
+ }
22
+ export interface RenderedImage {
23
+ readonly index: number;
24
+ readonly page?: number;
25
+ readonly sheet?: string;
26
+ readonly range?: string;
27
+ readonly rtl?: boolean;
28
+ readonly path: string;
29
+ readonly width: number;
30
+ readonly height: number;
31
+ /** Source rectangle in CSS pixels at 96 DPI, before raster scale. */
32
+ readonly rectangle: Rectangle;
33
+ readonly byteLength: number;
34
+ }
35
+ export interface RenderImagesResult {
36
+ readonly schemaVersion: 1;
37
+ readonly backend: 'native' | 'wasm';
38
+ readonly rasterEngine: 'libreoffice' | 'pdfium';
39
+ readonly source: 'saved';
40
+ readonly inputPath: string;
41
+ readonly sourceSha256: string;
42
+ readonly dpi: number;
43
+ /** Total physical pages/slides, or visible worksheets; images contains the selected subset. */
44
+ readonly pageCount: number;
45
+ readonly images: readonly RenderedImage[];
46
+ readonly missingFonts: string[];
47
+ }
48
+ export interface ImageRenderSpec extends RenderImagesRequest {
49
+ readonly kind: 'images';
50
+ readonly extension: string;
51
+ readonly dpi: number;
52
+ readonly maxPages: number;
53
+ readonly maxPixels: number;
54
+ readonly maxDimension: number;
55
+ }
56
+ export declare function resolveImageRender(request: RenderImagesRequest): ImageRenderSpec;
57
+ export declare function selectedPages(pages: 'all' | readonly number[] | undefined, count: number, limit: number): number[];
58
+ //# sourceMappingURL=image-operations.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { type WasmConversionRequest } from './wasm.ts';
2
+ import { type ImageRenderSpec, type RenderImagesResult } from './image-operations.ts';
3
+ export declare function renderImagesWithWasm(request: Omit<WasmConversionRequest, 'operation'> & {
4
+ operation: ImageRenderSpec;
5
+ }): Promise<RenderImagesResult>;
6
+ //# sourceMappingURL=image-renderer.d.ts.map
@@ -0,0 +1,94 @@
1
+ import type { RenderImagesRequest, RenderImagesResult } from './image-operations.ts';
2
+ export { IMAGE_FORMATS } from './image-operations.ts';
3
+ export type { RenderImagesRequest, RenderImagesResult, RenderedImage } from './image-operations.ts';
4
+ import type { ConversionRequest } from './operations.ts';
5
+ export { CONVERSION_FORMATS } from './operations.ts';
6
+ export type { ConversionRequest } from './operations.ts';
7
+ export { discoverRuntime } from './runtime.ts';
8
+ export type { RuntimeInfo } from './runtime.ts';
9
+ export { ConversionError } from './errors.ts';
10
+ export type { ConversionErrorCode } from './errors.ts';
11
+ export { ENGINE_VERSION } from './engine.ts';
12
+ /** Host limits used by both native and Node WASM conversions. All byte limits are positive safe integers. */
13
+ export interface ConverterOptions {
14
+ /** Deadline after a queued conversion starts, including font work and output. Default: 120000 ms. */
15
+ timeoutMs?: number;
16
+ /** Maximum source bytes. Default: 64 MiB. */
17
+ maxInputBytes?: number;
18
+ /** Maximum generated output bytes. Default: 128 MiB. */
19
+ maxOutputBytes?: number;
20
+ /** PDF export image resolution in DPI. Default: 144. */
21
+ maxImageResolution?: number;
22
+ /** Maximum ZIP entries. Default: 20000. */
23
+ maxArchiveEntries?: number;
24
+ /** Maximum declared uncompressed archive bytes. Default: 512 MiB. */
25
+ maxUncompressedBytes?: number;
26
+ /** Font roots; defaults to conventional platform and user directories. */
27
+ fontDirectories?: string[];
28
+ /** Ordered family groups replace the defaults. Exact installed families precede alternatives; the full indexed
29
+ * catalog remains available for missing glyphs. Native LibreOffice also resolves installed metric-compatible
30
+ * fonts before configured choices. */
31
+ fontFallbacks?: string[][];
32
+ /** Families imported before loading a document. Defaults to none. */
33
+ initialFontFamilies?: string[];
34
+ /** Maximum visited physical font files. Default: 20000. */
35
+ maxFontFiles?: number;
36
+ /** Files exceeding this limit are omitted. Default: 256 MiB. */
37
+ maxFontFileBytes?: number;
38
+ /** Complete original font bytes imported per conversion. Default: 512 MiB. Native platform fonts remain OS-managed. */
39
+ maxLoadedFontBytes?: number;
40
+ /** Maximum font match records retained by each compatible process cache or explicit factory. Default: 4096. */
41
+ maxFontResolutionEntries?: number;
42
+ }
43
+ /** Result of one conversion. */
44
+ export interface RenderResult {
45
+ readonly backend: 'native' | 'wasm';
46
+ /** Declared OOXML families no installed font provides; binary formats return an empty list. */
47
+ readonly missingFonts: string[];
48
+ }
49
+ /** A converter serializes document operations; cancellation and disposal await process/worker exit. */
50
+ export interface Converter {
51
+ readonly backend: 'native' | 'wasm';
52
+ /**
53
+ * Convert a private, caller-authorized regular Office file to a fresh exclusive PDF path.
54
+ * The caller owns both directories and must prevent concurrent path changes.
55
+ * Rejects existing output paths; removes a newly created output on failure or cancellation.
56
+ * @param request - Absolute paths. Input suffixes are listed in CONVERSION_FORMATS.
57
+ * @param signal - Optional cancellation, including while queued.
58
+ * @returns Engine choice and missing declared font families.
59
+ */
60
+ render(request: {
61
+ inputPath: string;
62
+ outputPath: string;
63
+ }, signal?: AbortSignal): Promise<RenderResult>;
64
+ /** Render Office directly to PNG, or PDF through PDFium, in one fresh output directory.
65
+ * Worksheets use sheet/A1 coordinates; page selections are one-based for documents and slides.
66
+ * Failure/cancellation removes the complete batch. The manifest describes one saved input snapshot.
67
+ */
68
+ renderImages(request: RenderImagesRequest, signal?: AbortSignal): Promise<RenderImagesResult>;
69
+ /** Convert to the output extension; CSV requires a sheet for multi-sheet inputs. */
70
+ convert(request: ConversionRequest, signal?: AbortSignal): Promise<RenderResult>;
71
+ /**
72
+ * Recalculate the entire workbook synchronously and save formulas with refreshed cached results.
73
+ * This does not validate formulas or business data.
74
+ * @param request - XLS, XLSX, or ODS input and a distinct fresh XLSX or ODS output.
75
+ * @param signal - Cancellation, including while queued.
76
+ * @returns Engine choice and missing declared font families.
77
+ */
78
+ recalculate(request: Omit<ConversionRequest, 'sheet'>, signal?: AbortSignal): Promise<RenderResult>;
79
+ /** Abort queued and active work, await exit and cleanup, and permanently reject further renders. */
80
+ dispose(): Promise<void>;
81
+ }
82
+ /** Factory-scoped engine and font metadata shared by concurrent converters. */
83
+ export interface ConverterFactory {
84
+ readonly backend: 'native' | 'wasm';
85
+ /** Create one serial converter sharing this factory's bounded font cache. */
86
+ create(): Promise<Converter>;
87
+ /** Abort and join every converter created by this factory. */
88
+ dispose(): Promise<void>;
89
+ }
90
+ /** Resolve one engine and share its bounded font state across many converters. */
91
+ export declare function createConverterFactory(options?: ConverterOptions): Promise<ConverterFactory>;
92
+ /** Create one converter with process-shared, configuration-isolated bounded font metadata. */
93
+ export declare function createConverter(options?: ConverterOptions): Promise<Converter>;
94
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Localized search names from LibreOffice Core's fixed font-name dictionary. */
2
+ export declare const LOCALIZED_FONT_SEARCH_NAMES: Map<string, string>;
3
+ //# sourceMappingURL=native-font-names.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { type ImageRenderSpec, type RenderImagesResult } from './image-operations.ts';
2
+ import type { FontSubstitution } from './font-loader.ts';
3
+ import type { NativeEngine } from './engine.ts';
4
+ import type { ResolvedOptions } from './options.ts';
5
+ /** Run one native image batch and write final PNGs only after each bounded paint succeeds. */
6
+ export declare function renderImagesWithNative(request: {
7
+ readonly engine: NativeEngine;
8
+ readonly options: ResolvedOptions;
9
+ readonly inputPath: string;
10
+ readonly source: Uint8Array;
11
+ readonly scratch: string;
12
+ readonly profile: string;
13
+ readonly fonts: readonly string[];
14
+ readonly substitutions: readonly FontSubstitution[];
15
+ readonly missingFonts: string[];
16
+ readonly operation: ImageRenderSpec;
17
+ readonly signal: AbortSignal;
18
+ }): Promise<RenderImagesResult>;
19
+ //# sourceMappingURL=native-image-renderer.d.ts.map
@@ -0,0 +1,36 @@
1
+ import type { FontSubstitution } from './font-loader.ts';
2
+ import type { ConversionSpec } from './operations.ts';
3
+ import type { NativeEngine } from './engine.ts';
4
+ import type { ResolvedOptions } from './options.ts';
5
+ /**
6
+ * Write missing-family choices into the private profile's VCL substitution table.
7
+ * Installed originals and metric-compatible fonts are resolved before this table by LibreOffice.
8
+ * @param profile - Existing, conversion-owned profile directory.
9
+ * @param substitutions - Missing document families and the selected installed family.
10
+ * @returns Resolves after the exclusive profile file is written; empty choices still disable the interactive CSV warning.
11
+ */
12
+ export declare function prepareNativeFontProfile(profile: string, substitutions: readonly FontSubstitution[]): Promise<void>;
13
+ /**
14
+ * Linux searches the verified program directory; ambient loader overrides and credentials are excluded.
15
+ * @param profile - Conversion-owned profile directory the helper treats as home.
16
+ * @param programDirectory - Verified engine program directory.
17
+ * @param source - Embedding process environment.
18
+ * @param platform - Host operating system.
19
+ * @returns the environment the helper starts with.
20
+ */
21
+ export declare function nativeEnvironment(profile: string, programDirectory: string, source?: NodeJS.ProcessEnv, platform?: string): Record<string, string>;
22
+ /**
23
+ * Run one native conversion and await bounded result transport.
24
+ * @param engine - Resolved native engine installation.
25
+ * @param options - Validated conversion limits.
26
+ * @param input - Private source path inside the conversion scratch directory.
27
+ * @param output - Private PDF path inside the conversion scratch directory.
28
+ * @param profile - Conversion-owned profile directory.
29
+ * @param fonts - Installed font files the helper may load.
30
+ * @param substitutions - Missing families and their selected installed substitutes.
31
+ * @param signal - Cancellation; it kills the helper and awaits its exit.
32
+ * @param operation - Validated output format, recalculation, and worksheet selection.
33
+ * @throws ConversionError for a reported conversion failure, and the abort reason for cancellation.
34
+ */
35
+ export declare function runNative(engine: NativeEngine, options: ResolvedOptions, input: string, output: string, profile: string, fonts: readonly string[], substitutions: readonly FontSubstitution[], signal: AbortSignal, operation?: Pick<ConversionSpec, 'format' | 'recalculate' | 'sheet'>): Promise<void>;
36
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1,6 @@
1
+ import type { FontFace } from './fonts.ts';
2
+ /** @returns whether parsed font names belong to the curated Office compatibility set. */
3
+ export declare function officeFontFace(face: Pick<FontFace, 'aliases'>): boolean;
4
+ /** Find compatibility font files without exposing their paths outside the font Worker. */
5
+ export declare function officeFontFiles(platform?: NodeJS.Platform, home?: string, env?: NodeJS.ProcessEnv, applicationRoots?: readonly string[]): string[];
6
+ //# sourceMappingURL=office-fonts.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { ResolvedOptions } from './options.ts';
2
+ /** Declared font families and scalar values one inspected document carries. */
3
+ export interface DocumentFontMetadata {
4
+ /** Normalized family key to the family name as the document declared it. */
5
+ readonly families: Map<string, string>;
6
+ readonly codePoints: readonly number[];
7
+ }
8
+ /**
9
+ * Validate ZIP size and membership before decoding selected document XML.
10
+ * @param bytes - Complete source document bytes.
11
+ * @param extension - Input extension, which selects the main document part.
12
+ * @param limits - Archive entry and declared uncompressed byte limits.
13
+ * @returns declared font families and the scalar values readable document XML declares.
14
+ * @throws ConversionError when the extension is unsupported or the archive violates its limits.
15
+ */
16
+ export declare function inspectDocument(bytes: Uint8Array, extension: string, limits: Pick<ResolvedOptions, 'maxArchiveEntries' | 'maxUncompressedBytes'>): DocumentFontMetadata;
17
+ //# sourceMappingURL=ooxml.d.ts.map
@@ -0,0 +1,41 @@
1
+ /** Conversions supported by the bundled Writer, Calc, and Impress components. */
2
+ export declare const CONVERSION_FORMATS: readonly [{
3
+ readonly inputs: readonly ["doc", "docx", "odt"];
4
+ readonly outputs: readonly ["pdf", "docx", "odt", "txt"];
5
+ }, {
6
+ readonly inputs: readonly ["xls", "xlsx", "ods"];
7
+ readonly outputs: readonly ["pdf", "xlsx", "ods", "csv"];
8
+ }, {
9
+ readonly inputs: readonly ["ppt", "pptx", "odp"];
10
+ readonly outputs: readonly ["pdf", "pptx", "odp"];
11
+ }];
12
+ /** Absolute input and fresh output paths, with an exact worksheet name for CSV export. */
13
+ export interface ConversionRequest {
14
+ readonly inputPath: string;
15
+ readonly outputPath: string;
16
+ /** CSV only; required for a workbook containing multiple sheets. */
17
+ readonly sheet?: string;
18
+ }
19
+ /** Engine operation after extension and parameter validation. */
20
+ export interface ConversionSpec {
21
+ readonly inputPath: string;
22
+ readonly outputPath: string;
23
+ readonly extension: string;
24
+ readonly format: string;
25
+ readonly recalculate: boolean;
26
+ readonly sheet?: string;
27
+ }
28
+ /**
29
+ * Validate paths and the format matrix before file access or queue admission.
30
+ * @param request - Public conversion parameters.
31
+ * @param operation - PDF compatibility entry, general conversion, or workbook recalculation.
32
+ * @returns The explicit engine operation.
33
+ */
34
+ export declare function resolveConversion(request: ConversionRequest, operation: 'render' | 'convert' | 'recalculate'): ConversionSpec;
35
+ /**
36
+ * Reject an engine output with an incorrect container signature.
37
+ * @param bytes - Complete bounded output.
38
+ * @param format - Requested output suffix.
39
+ */
40
+ export declare function validateOutput(bytes: Uint8Array, format: string): void;
41
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1,30 @@
1
+ /** Validated deployment limits shared by native and Node WASM conversions. */
2
+ import type { ConverterOptions } from './index.ts';
3
+ /** Ordered family groups used when the caller supplies none. */
4
+ export declare const FONT_FALLBACKS: readonly (readonly string[])[];
5
+ /** Resolved limits and font settings used by every conversion of one converter. */
6
+ export interface ResolvedOptions {
7
+ readonly timeoutMs: number;
8
+ readonly maxInputBytes: number;
9
+ readonly maxOutputBytes: number;
10
+ readonly maxImageResolution: number;
11
+ readonly maxArchiveEntries: number;
12
+ readonly maxUncompressedBytes: number;
13
+ readonly maxFontFiles: number;
14
+ readonly maxFontFileBytes: number;
15
+ readonly maxLoadedFontBytes: number;
16
+ readonly maxFontResolutionEntries: number;
17
+ readonly fontDirectories: string[];
18
+ readonly includeOfficeFonts: boolean;
19
+ readonly fontFallbacks: string[][];
20
+ readonly initialFontFamilies: string[];
21
+ }
22
+ /**
23
+ * Resolve defaults once; reject misspelled options and malformed font settings.
24
+ * @param input - Caller options; absent fields keep their documented default.
25
+ * @returns The validated limits and font settings, with caller arrays copied.
26
+ * @throws TypeError for a non-object argument or an unknown option name.
27
+ * @throws RangeError for a limit outside the positive safe-integer timer range.
28
+ */
29
+ export declare function resolveOptions(input?: ConverterOptions): ResolvedOptions;
30
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function encodePng(width: number, height: number, rgba: Uint8Array | Uint8ClampedArray): Uint8Array;
2
+ //# sourceMappingURL=png.d.ts.map