@kreuzberg/wasm 4.0.0-rc.23 → 4.0.0-rc.25
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.
- package/dist/adapters/wasm-adapter.d.ts +7 -10
- package/dist/adapters/wasm-adapter.d.ts.map +1 -0
- package/dist/adapters/wasm-adapter.js +41 -19
- package/dist/adapters/wasm-adapter.js.map +1 -1
- package/dist/index.d.ts +23 -240
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -19
- package/dist/index.js.map +1 -1
- package/dist/ocr/registry.d.ts +7 -10
- package/dist/ocr/registry.d.ts.map +1 -0
- package/dist/ocr/tesseract-wasm-backend.d.ts +3 -6
- package/dist/ocr/tesseract-wasm-backend.d.ts.map +1 -0
- package/dist/plugin-registry.d.ts +246 -0
- package/dist/plugin-registry.d.ts.map +1 -0
- package/dist/runtime.d.ts +21 -22
- package/dist/runtime.d.ts.map +1 -0
- package/dist/{types-wVLLDHkl.d.cts → types.d.ts} +24 -25
- package/dist/types.d.ts.map +1 -0
- package/package.json +20 -63
- package/dist/adapters/wasm-adapter.cjs +0 -245
- package/dist/adapters/wasm-adapter.cjs.map +0 -1
- package/dist/adapters/wasm-adapter.d.cts +0 -121
- package/dist/index.cjs +0 -1389
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -639
- package/dist/ocr/registry.cjs +0 -92
- package/dist/ocr/registry.cjs.map +0 -1
- package/dist/ocr/registry.d.cts +0 -102
- package/dist/ocr/tesseract-wasm-backend.cjs +0 -410
- package/dist/ocr/tesseract-wasm-backend.cjs.map +0 -1
- package/dist/ocr/tesseract-wasm-backend.d.cts +0 -257
- package/dist/runtime.cjs +0 -173
- package/dist/runtime.cjs.map +0 -1
- package/dist/runtime.d.cts +0 -256
- package/dist/types-wVLLDHkl.d.ts +0 -364
package/dist/ocr/registry.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { O as OcrBackendProtocol } from '../types-wVLLDHkl.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* OCR Backend Registry
|
|
5
3
|
*
|
|
@@ -18,7 +16,7 @@ import { O as OcrBackendProtocol } from '../types-wVLLDHkl.js';
|
|
|
18
16
|
* await enableOcr();
|
|
19
17
|
* ```
|
|
20
18
|
*/
|
|
21
|
-
|
|
19
|
+
import type { OcrBackendProtocol } from "../types.d.ts";
|
|
22
20
|
/**
|
|
23
21
|
* Register an OCR backend
|
|
24
22
|
*
|
|
@@ -38,7 +36,7 @@ import { O as OcrBackendProtocol } from '../types-wVLLDHkl.js';
|
|
|
38
36
|
* registerOcrBackend(backend);
|
|
39
37
|
* ```
|
|
40
38
|
*/
|
|
41
|
-
declare function registerOcrBackend(backend: OcrBackendProtocol): void;
|
|
39
|
+
export declare function registerOcrBackend(backend: OcrBackendProtocol): void;
|
|
42
40
|
/**
|
|
43
41
|
* Get a registered OCR backend by name
|
|
44
42
|
*
|
|
@@ -55,7 +53,7 @@ declare function registerOcrBackend(backend: OcrBackendProtocol): void;
|
|
|
55
53
|
* }
|
|
56
54
|
* ```
|
|
57
55
|
*/
|
|
58
|
-
declare function getOcrBackend(name: string): OcrBackendProtocol | undefined;
|
|
56
|
+
export declare function getOcrBackend(name: string): OcrBackendProtocol | undefined;
|
|
59
57
|
/**
|
|
60
58
|
* List all registered OCR backends
|
|
61
59
|
*
|
|
@@ -69,7 +67,7 @@ declare function getOcrBackend(name: string): OcrBackendProtocol | undefined;
|
|
|
69
67
|
* console.log('Available OCR backends:', backends);
|
|
70
68
|
* ```
|
|
71
69
|
*/
|
|
72
|
-
declare function listOcrBackends(): string[];
|
|
70
|
+
export declare function listOcrBackends(): string[];
|
|
73
71
|
/**
|
|
74
72
|
* Unregister an OCR backend
|
|
75
73
|
*
|
|
@@ -83,7 +81,7 @@ declare function listOcrBackends(): string[];
|
|
|
83
81
|
* unregisterOcrBackend('tesseract-wasm');
|
|
84
82
|
* ```
|
|
85
83
|
*/
|
|
86
|
-
declare function unregisterOcrBackend(name: string): Promise<void>;
|
|
84
|
+
export declare function unregisterOcrBackend(name: string): Promise<void>;
|
|
87
85
|
/**
|
|
88
86
|
* Clear all registered OCR backends
|
|
89
87
|
*
|
|
@@ -97,6 +95,5 @@ declare function unregisterOcrBackend(name: string): Promise<void>;
|
|
|
97
95
|
* await clearOcrBackends();
|
|
98
96
|
* ```
|
|
99
97
|
*/
|
|
100
|
-
declare function clearOcrBackends(): Promise<void>;
|
|
101
|
-
|
|
102
|
-
export { clearOcrBackends, getOcrBackend, listOcrBackends, registerOcrBackend, unregisterOcrBackend };
|
|
98
|
+
export declare function clearOcrBackends(): Promise<void>;
|
|
99
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../typescript/ocr/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CA4BpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE1E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBtE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBtD"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { O as OcrBackendProtocol } from '../types-wVLLDHkl.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Tesseract WASM OCR Backend
|
|
5
3
|
*
|
|
@@ -62,14 +60,14 @@ import { O as OcrBackendProtocol } from '../types-wVLLDHkl.js';
|
|
|
62
60
|
* });
|
|
63
61
|
* ```
|
|
64
62
|
*/
|
|
65
|
-
|
|
63
|
+
import type { OcrBackendProtocol } from "../types.d.ts";
|
|
66
64
|
/**
|
|
67
65
|
* TesseractWasmBackend - OCR backend using tesseract-wasm library
|
|
68
66
|
*
|
|
69
67
|
* Implements the OcrBackendProtocol for Kreuzberg document extraction pipeline.
|
|
70
68
|
* Provides comprehensive OCR support with model caching, error handling, and progress reporting.
|
|
71
69
|
*/
|
|
72
|
-
declare class TesseractWasmBackend implements OcrBackendProtocol {
|
|
70
|
+
export declare class TesseractWasmBackend implements OcrBackendProtocol {
|
|
73
71
|
/** Tesseract WASM client instance */
|
|
74
72
|
private client;
|
|
75
73
|
/** Track which models are currently loaded to avoid redundant loads */
|
|
@@ -253,5 +251,4 @@ declare class TesseractWasmBackend implements OcrBackendProtocol {
|
|
|
253
251
|
*/
|
|
254
252
|
private reportProgress;
|
|
255
253
|
}
|
|
256
|
-
|
|
257
|
-
export { TesseractWasmBackend };
|
|
254
|
+
//# sourceMappingURL=tesseract-wasm-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tesseract-wasm-backend.d.ts","sourceRoot":"","sources":["../../typescript/ocr/tesseract-wasm-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAgBtD;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB;IAC9D,qCAAqC;IACrC,OAAO,CAAC,MAAM,CAAgC;IAE9C,uEAAuE;IACvE,OAAO,CAAC,eAAe,CAA0B;IAEjD,iDAAiD;IACjD,OAAO,CAAC,mBAAmB,CAAyB;IAEpD,uCAAuC;IACvC,OAAO,CAAC,gBAAgB,CAA6C;IAErE,qCAAqC;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6D;IAE1F;;;;OAIG;IACH,IAAI,IAAI,MAAM;IAId;;;;;;;OAOG;IACH,kBAAkB,IAAI,MAAM,EAAE;IAuD9B;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBjC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,YAAY,CACjB,UAAU,EAAE,UAAU,GAAG,MAAM,EAC/B,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,MAAM,EAAE,OAAO,EAAE,CAAC;KAClB,CAAC;IAqDF;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB/B;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAmB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAI/D;;;;;;;;;;OAUG;YACW,iBAAiB;IAgB/B;;;;;;;;;;;OAWG;YACW,oBAAoB;IAyBlC;;;;;;;;;OASG;YACW,kBAAkB;IAUhC;;;;;;;;OAQG;YACW,eAAe;IAS7B;;;;;;;;;;OAUG;YACW,iBAAiB;IAa/B;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;CAOtB"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Registry Module
|
|
3
|
+
*
|
|
4
|
+
* This module manages registrations and execution of post-processors and validators
|
|
5
|
+
* for document extraction pipelines.
|
|
6
|
+
*
|
|
7
|
+
* # Thread Safety
|
|
8
|
+
* All registrations are stored in Maps and are single-threaded safe for WASM environments.
|
|
9
|
+
*
|
|
10
|
+
* # Global Callback Functions
|
|
11
|
+
* The WASM module can invoke processing via global callback functions:
|
|
12
|
+
* - `__kreuzberg_execute_post_processor`: Execute a registered post-processor
|
|
13
|
+
* - `__kreuzberg_execute_validator`: Execute a registered validator
|
|
14
|
+
*/
|
|
15
|
+
import type { ExtractionResult } from "./types.d.ts";
|
|
16
|
+
/**
|
|
17
|
+
* Post-processor plugin interface
|
|
18
|
+
*
|
|
19
|
+
* A post-processor modifies extraction results after extraction completes.
|
|
20
|
+
*/
|
|
21
|
+
export interface PostProcessor {
|
|
22
|
+
/**
|
|
23
|
+
* Get the processor name (must be non-empty string)
|
|
24
|
+
*/
|
|
25
|
+
name(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get the processing stage (optional, defaults to "middle")
|
|
28
|
+
* - "early": Process early in the pipeline
|
|
29
|
+
* - "middle": Process in the middle of the pipeline
|
|
30
|
+
* - "late": Process late in the pipeline
|
|
31
|
+
*/
|
|
32
|
+
stage?(): "early" | "middle" | "late";
|
|
33
|
+
/**
|
|
34
|
+
* Process an extraction result
|
|
35
|
+
* Can be sync or async
|
|
36
|
+
*/
|
|
37
|
+
process(result: ExtractionResult): ExtractionResult | Promise<ExtractionResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Shutdown the processor (optional)
|
|
40
|
+
*/
|
|
41
|
+
shutdown?(): void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Validator plugin interface
|
|
45
|
+
*
|
|
46
|
+
* A validator checks extraction results for correctness
|
|
47
|
+
*/
|
|
48
|
+
export interface Validator {
|
|
49
|
+
/**
|
|
50
|
+
* Get the validator name (must be non-empty string)
|
|
51
|
+
*/
|
|
52
|
+
name(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Get the validation priority (optional, defaults to 50)
|
|
55
|
+
* Higher numbers = higher priority (execute first)
|
|
56
|
+
*/
|
|
57
|
+
priority?(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Validate an extraction result
|
|
60
|
+
* Can be sync or async
|
|
61
|
+
*/
|
|
62
|
+
validate(result: ExtractionResult): {
|
|
63
|
+
valid: boolean;
|
|
64
|
+
errors: string[];
|
|
65
|
+
} | Promise<{
|
|
66
|
+
valid: boolean;
|
|
67
|
+
errors: string[];
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Shutdown the validator (optional)
|
|
71
|
+
*/
|
|
72
|
+
shutdown?(): void | Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Register a post-processor plugin
|
|
76
|
+
*
|
|
77
|
+
* @param processor - The post-processor to register
|
|
78
|
+
* @throws {Error} If the processor is invalid or missing required methods
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const processor = {
|
|
83
|
+
* name: () => "my-processor",
|
|
84
|
+
* stage: () => "middle",
|
|
85
|
+
* process: async (result) => {
|
|
86
|
+
* result.content = result.content.toUpperCase();
|
|
87
|
+
* return result;
|
|
88
|
+
* }
|
|
89
|
+
* };
|
|
90
|
+
* registerPostProcessor(processor);
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function registerPostProcessor(processor: PostProcessor): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get a registered post-processor by name
|
|
96
|
+
*
|
|
97
|
+
* @param name - The processor name
|
|
98
|
+
* @returns The processor, or undefined if not found
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const processor = getPostProcessor("my-processor");
|
|
103
|
+
* if (processor) {
|
|
104
|
+
* console.log("Found processor:", processor.name());
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function getPostProcessor(name: string): PostProcessor | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* List all registered post-processor names
|
|
111
|
+
*
|
|
112
|
+
* @returns Array of processor names
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const names = listPostProcessors();
|
|
117
|
+
* console.log("Registered processors:", names);
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function listPostProcessors(): string[];
|
|
121
|
+
/**
|
|
122
|
+
* Unregister a post-processor and call its shutdown method
|
|
123
|
+
*
|
|
124
|
+
* @param name - The processor name
|
|
125
|
+
* @throws {Error} If the processor is not registered
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* await unregisterPostProcessor("my-processor");
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare function unregisterPostProcessor(name: string): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Clear all registered post-processors
|
|
135
|
+
*
|
|
136
|
+
* Calls shutdown on all processors before clearing.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* await clearPostProcessors();
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export declare function clearPostProcessors(): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Register a validator plugin
|
|
146
|
+
*
|
|
147
|
+
* @param validator - The validator to register
|
|
148
|
+
* @throws {Error} If the validator is invalid or missing required methods
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const validator = {
|
|
153
|
+
* name: () => "my-validator",
|
|
154
|
+
* priority: () => 50,
|
|
155
|
+
* validate: async (result) => {
|
|
156
|
+
* if (!result.content) {
|
|
157
|
+
* return { valid: false, errors: ["Content is empty"] };
|
|
158
|
+
* }
|
|
159
|
+
* return { valid: true, errors: [] };
|
|
160
|
+
* }
|
|
161
|
+
* };
|
|
162
|
+
* registerValidator(validator);
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare function registerValidator(validator: Validator): void;
|
|
166
|
+
/**
|
|
167
|
+
* Get a registered validator by name
|
|
168
|
+
*
|
|
169
|
+
* @param name - The validator name
|
|
170
|
+
* @returns The validator, or undefined if not found
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const validator = getValidator("my-validator");
|
|
175
|
+
* if (validator) {
|
|
176
|
+
* console.log("Found validator:", validator.name());
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export declare function getValidator(name: string): Validator | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* List all registered validator names
|
|
183
|
+
*
|
|
184
|
+
* @returns Array of validator names
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const names = listValidators();
|
|
189
|
+
* console.log("Registered validators:", names);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export declare function listValidators(): string[];
|
|
193
|
+
/**
|
|
194
|
+
* Unregister a validator and call its shutdown method
|
|
195
|
+
*
|
|
196
|
+
* @param name - The validator name
|
|
197
|
+
* @throws {Error} If the validator is not registered
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* await unregisterValidator("my-validator");
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare function unregisterValidator(name: string): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Clear all registered validators
|
|
207
|
+
*
|
|
208
|
+
* Calls shutdown on all validators before clearing.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* await clearValidators();
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
export declare function clearValidators(): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Global callback for executing a post-processor from WASM
|
|
218
|
+
*
|
|
219
|
+
* Called by the WASM module to execute a registered post-processor.
|
|
220
|
+
* Makes the callback available to WASM via the global scope.
|
|
221
|
+
*
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
export declare function executePostProcessor(name: string, result: ExtractionResult): Promise<ExtractionResult>;
|
|
225
|
+
/**
|
|
226
|
+
* Global callback for executing a validator from WASM
|
|
227
|
+
*
|
|
228
|
+
* Called by the WASM module to execute a registered validator.
|
|
229
|
+
* Makes the callback available to WASM via the global scope.
|
|
230
|
+
*
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
export declare function executeValidator(name: string, result: ExtractionResult): Promise<{
|
|
234
|
+
valid: boolean;
|
|
235
|
+
errors: string[];
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* Expose global callback functions for WASM module
|
|
239
|
+
*
|
|
240
|
+
* This makes the plugin execution functions available as global callbacks
|
|
241
|
+
* that the WASM module can invoke via JavaScript.
|
|
242
|
+
*
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
245
|
+
export declare function setupGlobalCallbacks(): void;
|
|
246
|
+
//# sourceMappingURL=plugin-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../typescript/plugin-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,IAAI,IAAI,MAAM,CAAC;IAEf;;;;;OAKG;IACH,KAAK,CAAC,IAAI,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEtC;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEhF;;OAEG;IACH,QAAQ,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,IAAI,IAAI,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CA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AC,CAcrD;AAMD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkBtG;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAkB/C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAO3C"}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
* }
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
type RuntimeType = "browser" | "node" | "deno" | "bun" | "unknown";
|
|
31
|
+
export type RuntimeType = "browser" | "node" | "deno" | "bun" | "unknown";
|
|
32
32
|
/**
|
|
33
33
|
* WebAssembly capabilities available in the runtime
|
|
34
34
|
*/
|
|
35
|
-
interface WasmCapabilities {
|
|
35
|
+
export interface WasmCapabilities {
|
|
36
36
|
/** Runtime environment type */
|
|
37
37
|
runtime: RuntimeType;
|
|
38
38
|
/** WebAssembly support available */
|
|
@@ -83,43 +83,43 @@ interface WasmCapabilities {
|
|
|
83
83
|
* }
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
declare function detectRuntime(): RuntimeType;
|
|
86
|
+
export declare function detectRuntime(): RuntimeType;
|
|
87
87
|
/**
|
|
88
88
|
* Check if running in a browser environment
|
|
89
89
|
*
|
|
90
90
|
* @returns True if running in a browser, false otherwise
|
|
91
91
|
*/
|
|
92
|
-
declare function isBrowser(): boolean;
|
|
92
|
+
export declare function isBrowser(): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Check if running in Node.js
|
|
95
95
|
*
|
|
96
96
|
* @returns True if running in Node.js, false otherwise
|
|
97
97
|
*/
|
|
98
|
-
declare function isNode(): boolean;
|
|
98
|
+
export declare function isNode(): boolean;
|
|
99
99
|
/**
|
|
100
100
|
* Check if running in Deno
|
|
101
101
|
*
|
|
102
102
|
* @returns True if running in Deno, false otherwise
|
|
103
103
|
*/
|
|
104
|
-
declare function isDeno(): boolean;
|
|
104
|
+
export declare function isDeno(): boolean;
|
|
105
105
|
/**
|
|
106
106
|
* Check if running in Bun
|
|
107
107
|
*
|
|
108
108
|
* @returns True if running in Bun, false otherwise
|
|
109
109
|
*/
|
|
110
|
-
declare function isBun(): boolean;
|
|
110
|
+
export declare function isBun(): boolean;
|
|
111
111
|
/**
|
|
112
112
|
* Check if running in a web environment (browser or similar)
|
|
113
113
|
*
|
|
114
114
|
* @returns True if running in a web browser, false otherwise
|
|
115
115
|
*/
|
|
116
|
-
declare function isWebEnvironment(): boolean;
|
|
116
|
+
export declare function isWebEnvironment(): boolean;
|
|
117
117
|
/**
|
|
118
118
|
* Check if running in a server-like environment (Node.js, Deno, Bun)
|
|
119
119
|
*
|
|
120
120
|
* @returns True if running on a server runtime, false otherwise
|
|
121
121
|
*/
|
|
122
|
-
declare function isServerEnvironment(): boolean;
|
|
122
|
+
export declare function isServerEnvironment(): boolean;
|
|
123
123
|
/**
|
|
124
124
|
* Check if File API is available
|
|
125
125
|
*
|
|
@@ -138,19 +138,19 @@ declare function isServerEnvironment(): boolean;
|
|
|
138
138
|
* }
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
|
-
declare function hasFileApi(): boolean;
|
|
141
|
+
export declare function hasFileApi(): boolean;
|
|
142
142
|
/**
|
|
143
143
|
* Check if Blob API is available
|
|
144
144
|
*
|
|
145
145
|
* @returns True if Blob API is available, false otherwise
|
|
146
146
|
*/
|
|
147
|
-
declare function hasBlob(): boolean;
|
|
147
|
+
export declare function hasBlob(): boolean;
|
|
148
148
|
/**
|
|
149
149
|
* Check if Web Workers are available
|
|
150
150
|
*
|
|
151
151
|
* @returns True if Web Workers can be created, false otherwise
|
|
152
152
|
*/
|
|
153
|
-
declare function hasWorkers(): boolean;
|
|
153
|
+
export declare function hasWorkers(): boolean;
|
|
154
154
|
/**
|
|
155
155
|
* Check if SharedArrayBuffer is available
|
|
156
156
|
*
|
|
@@ -159,7 +159,7 @@ declare function hasWorkers(): boolean;
|
|
|
159
159
|
*
|
|
160
160
|
* @returns True if SharedArrayBuffer is available, false otherwise
|
|
161
161
|
*/
|
|
162
|
-
declare function hasSharedArrayBuffer(): boolean;
|
|
162
|
+
export declare function hasSharedArrayBuffer(): boolean;
|
|
163
163
|
/**
|
|
164
164
|
* Check if module workers are available
|
|
165
165
|
*
|
|
@@ -167,13 +167,13 @@ declare function hasSharedArrayBuffer(): boolean;
|
|
|
167
167
|
*
|
|
168
168
|
* @returns True if module workers are supported, false otherwise
|
|
169
169
|
*/
|
|
170
|
-
declare function hasModuleWorkers(): boolean;
|
|
170
|
+
export declare function hasModuleWorkers(): boolean;
|
|
171
171
|
/**
|
|
172
172
|
* Check if WebAssembly is available
|
|
173
173
|
*
|
|
174
174
|
* @returns True if WebAssembly is supported, false otherwise
|
|
175
175
|
*/
|
|
176
|
-
declare function hasWasm(): boolean;
|
|
176
|
+
export declare function hasWasm(): boolean;
|
|
177
177
|
/**
|
|
178
178
|
* Check if WebAssembly.instantiateStreaming is available
|
|
179
179
|
*
|
|
@@ -181,13 +181,13 @@ declare function hasWasm(): boolean;
|
|
|
181
181
|
*
|
|
182
182
|
* @returns True if streaming WebAssembly is supported, false otherwise
|
|
183
183
|
*/
|
|
184
|
-
declare function hasWasmStreaming(): boolean;
|
|
184
|
+
export declare function hasWasmStreaming(): boolean;
|
|
185
185
|
/**
|
|
186
186
|
* Check if BigInt is available
|
|
187
187
|
*
|
|
188
188
|
* @returns True if BigInt type is supported, false otherwise
|
|
189
189
|
*/
|
|
190
|
-
declare function hasBigInt(): boolean;
|
|
190
|
+
export declare function hasBigInt(): boolean;
|
|
191
191
|
/**
|
|
192
192
|
* Get runtime version information
|
|
193
193
|
*
|
|
@@ -199,7 +199,7 @@ declare function hasBigInt(): boolean;
|
|
|
199
199
|
* console.log(`Running on Node ${version}`); // "Running on Node 18.12.0"
|
|
200
200
|
* ```
|
|
201
201
|
*/
|
|
202
|
-
declare function getRuntimeVersion(): string | undefined;
|
|
202
|
+
export declare function getRuntimeVersion(): string | undefined;
|
|
203
203
|
/**
|
|
204
204
|
* Get comprehensive WebAssembly capabilities for current runtime
|
|
205
205
|
*
|
|
@@ -222,7 +222,7 @@ declare function getRuntimeVersion(): string | undefined;
|
|
|
222
222
|
* }
|
|
223
223
|
* ```
|
|
224
224
|
*/
|
|
225
|
-
declare function getWasmCapabilities(): WasmCapabilities;
|
|
225
|
+
export declare function getWasmCapabilities(): WasmCapabilities;
|
|
226
226
|
/**
|
|
227
227
|
* Get comprehensive runtime information
|
|
228
228
|
*
|
|
@@ -240,7 +240,7 @@ declare function getWasmCapabilities(): WasmCapabilities;
|
|
|
240
240
|
* console.log(info.capabilities); // Detailed capability information
|
|
241
241
|
* ```
|
|
242
242
|
*/
|
|
243
|
-
declare function getRuntimeInfo(): {
|
|
243
|
+
export declare function getRuntimeInfo(): {
|
|
244
244
|
runtime: RuntimeType;
|
|
245
245
|
isBrowser: boolean;
|
|
246
246
|
isNode: boolean;
|
|
@@ -252,5 +252,4 @@ declare function getRuntimeInfo(): {
|
|
|
252
252
|
userAgent: string;
|
|
253
253
|
capabilities: WasmCapabilities;
|
|
254
254
|
};
|
|
255
|
-
|
|
256
|
-
export { type RuntimeType, type WasmCapabilities, detectRuntime, getRuntimeInfo, getRuntimeVersion, getWasmCapabilities, hasBigInt, hasBlob, hasFileApi, hasModuleWorkers, hasSharedArrayBuffer, hasWasm, hasWasmStreaming, hasWorkers, isBrowser, isBun, isDeno, isNode, isServerEnvironment, isWebEnvironment };
|
|
255
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../typescript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