@kreuzberg/wasm 4.0.0-rc.6 → 4.0.0
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/LICENSE +7 -0
- package/README.md +321 -800
- 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 +53 -54
- package/dist/adapters/wasm-adapter.js.map +1 -1
- package/dist/index.d.ts +23 -67
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1102 -104
- 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/registry.js +9 -28
- package/dist/ocr/registry.js.map +1 -1
- package/dist/ocr/tesseract-wasm-backend.d.ts +3 -6
- package/dist/ocr/tesseract-wasm-backend.d.ts.map +1 -0
- package/dist/ocr/tesseract-wasm-backend.js +8 -83
- package/dist/ocr/tesseract-wasm-backend.js.map +1 -1
- package/dist/pdfium.js +77 -0
- package/dist/pkg/LICENSE +7 -0
- package/dist/pkg/README.md +503 -0
- package/dist/{kreuzberg_wasm.d.ts → pkg/kreuzberg_wasm.d.ts} +24 -12
- package/dist/{kreuzberg_wasm.js → pkg/kreuzberg_wasm.js} +224 -233
- package/dist/pkg/kreuzberg_wasm_bg.js +1871 -0
- package/dist/{kreuzberg_wasm_bg.wasm → pkg/kreuzberg_wasm_bg.wasm} +0 -0
- package/dist/{kreuzberg_wasm_bg.wasm.d.ts → pkg/kreuzberg_wasm_bg.wasm.d.ts} +10 -13
- package/dist/pkg/package.json +27 -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/runtime.js +21 -41
- package/dist/runtime.js.map +1 -1
- package/dist/types.d.ts +363 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +34 -51
- package/dist/adapters/wasm-adapter.d.mts +0 -121
- package/dist/adapters/wasm-adapter.mjs +0 -221
- package/dist/adapters/wasm-adapter.mjs.map +0 -1
- package/dist/index.d.mts +0 -466
- package/dist/index.mjs +0 -384
- package/dist/index.mjs.map +0 -1
- package/dist/kreuzberg_wasm.d.mts +0 -758
- package/dist/kreuzberg_wasm.mjs +0 -48
- package/dist/ocr/registry.d.mts +0 -102
- package/dist/ocr/registry.mjs +0 -70
- package/dist/ocr/registry.mjs.map +0 -1
- package/dist/ocr/tesseract-wasm-backend.d.mts +0 -257
- package/dist/ocr/tesseract-wasm-backend.mjs +0 -424
- package/dist/ocr/tesseract-wasm-backend.mjs.map +0 -1
- package/dist/runtime.d.mts +0 -256
- package/dist/runtime.mjs +0 -152
- package/dist/runtime.mjs.map +0 -1
- package/dist/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +0 -107
- package/dist/types-GJVIvbPy.d.mts +0 -221
- package/dist/types-GJVIvbPy.d.ts +0 -221
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
3
4
|
export const __wbg_moduleinfo_free: (a: number, b: number) => void;
|
|
4
5
|
export const batchExtractBytes: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
5
6
|
export const batchExtractBytesSync: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
@@ -17,6 +18,7 @@ export const extractFileSync: () => [number, number, number];
|
|
|
17
18
|
export const getExtensionsForMime: (a: number, b: number) => [number, number, number];
|
|
18
19
|
export const getMimeFromExtension: (a: number, b: number) => [number, number];
|
|
19
20
|
export const get_module_info: () => number;
|
|
21
|
+
export const initThreadPool: (a: number) => any;
|
|
20
22
|
export const init_thread_pool_safe: (a: number) => number;
|
|
21
23
|
export const list_ocr_backends: () => [number, number, number];
|
|
22
24
|
export const list_post_processors: () => [number, number, number];
|
|
@@ -33,22 +35,17 @@ export const unregister_post_processor: (a: number, b: number) => [number, numbe
|
|
|
33
35
|
export const unregister_validator: (a: number, b: number) => [number, number];
|
|
34
36
|
export const version: () => [number, number];
|
|
35
37
|
export const init: () => void;
|
|
36
|
-
export const
|
|
37
|
-
export const
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
43
|
-
export const wasm_bindgen_3a2dd18e2c0b33f8___closure__destroy___dyn_core_f96ffdd67f65b3d8___ops__function__FnMut__wasm_bindgen_3a2dd18e2c0b33f8___JsValue____Output_______: (a: number, b: number) => void;
|
|
44
|
-
export const wasm_bindgen_3a2dd18e2c0b33f8___convert__closures_____invoke___wasm_bindgen_3a2dd18e2c0b33f8___JsValue__wasm_bindgen_3a2dd18e2c0b33f8___JsValue_____: (a: number, b: number, c: any, d: any) => void;
|
|
45
|
-
export const memory: WebAssembly.Memory;
|
|
38
|
+
export const initialize_pdfium_render: (a: any, b: any, c: number) => number;
|
|
39
|
+
export const read_block_from_callback_wasm: (a: number, b: number, c: number, d: number) => number;
|
|
40
|
+
export const write_block_from_callback_wasm: (a: number, b: number, c: number) => number;
|
|
41
|
+
export const wasm_bindgen_4fcc1eb3154b8c24___convert__closures_____invoke___wasm_bindgen_4fcc1eb3154b8c24___JsValue_____: (a: number, b: number, c: any) => void;
|
|
42
|
+
export const wasm_bindgen_4fcc1eb3154b8c24___closure__destroy___dyn_core_67558b4ca73dc0a8___ops__function__FnMut__wasm_bindgen_4fcc1eb3154b8c24___JsValue____Output_______: (a: number, b: number) => void;
|
|
43
|
+
export const wasm_bindgen_4fcc1eb3154b8c24___convert__closures_____invoke___wasm_bindgen_4fcc1eb3154b8c24___JsValue__wasm_bindgen_4fcc1eb3154b8c24___JsValue_____: (a: number, b: number, c: any, d: any) => void;
|
|
44
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
46
45
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
47
46
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
48
47
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
49
48
|
export const __externref_table_alloc: () => number;
|
|
50
|
-
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
51
49
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
52
50
|
export const __externref_table_dealloc: (a: number) => void;
|
|
53
|
-
export const
|
|
54
|
-
export const __wbindgen_start: (a: number) => void;
|
|
51
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kreuzberg-wasm",
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"Na'aman Hirschfeld <nhirschfeld@gmail.com>"
|
|
5
|
+
],
|
|
6
|
+
"description": "Kreuzberg document intelligence - WebAssembly bindings",
|
|
7
|
+
"version": "4.0.0",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/kreuzberg-dev/kreuzberg"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"kreuzberg_wasm_bg.wasm",
|
|
15
|
+
"kreuzberg_wasm.js",
|
|
16
|
+
"kreuzberg_wasm.d.ts"
|
|
17
|
+
],
|
|
18
|
+
"main": "kreuzberg_wasm.js",
|
|
19
|
+
"types": "kreuzberg_wasm.d.ts",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"wasm",
|
|
22
|
+
"webassembly",
|
|
23
|
+
"document",
|
|
24
|
+
"extraction",
|
|
25
|
+
"bindings"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -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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C,IAAI,CAAC,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":"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,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAkB1C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAOnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAkBtD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAgBtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc;;;;;;;;;;;EAgB7B"}
|
package/dist/runtime.js
CHANGED
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var runtime_exports = {};
|
|
20
|
-
__export(runtime_exports, {
|
|
21
|
-
detectRuntime: () => detectRuntime,
|
|
22
|
-
getRuntimeInfo: () => getRuntimeInfo,
|
|
23
|
-
getRuntimeVersion: () => getRuntimeVersion,
|
|
24
|
-
getWasmCapabilities: () => getWasmCapabilities,
|
|
25
|
-
hasBigInt: () => hasBigInt,
|
|
26
|
-
hasBlob: () => hasBlob,
|
|
27
|
-
hasFileApi: () => hasFileApi,
|
|
28
|
-
hasModuleWorkers: () => hasModuleWorkers,
|
|
29
|
-
hasSharedArrayBuffer: () => hasSharedArrayBuffer,
|
|
30
|
-
hasWasm: () => hasWasm,
|
|
31
|
-
hasWasmStreaming: () => hasWasmStreaming,
|
|
32
|
-
hasWorkers: () => hasWorkers,
|
|
33
|
-
isBrowser: () => isBrowser,
|
|
34
|
-
isBun: () => isBun,
|
|
35
|
-
isDeno: () => isDeno,
|
|
36
|
-
isNode: () => isNode,
|
|
37
|
-
isServerEnvironment: () => isServerEnvironment,
|
|
38
|
-
isWebEnvironment: () => isWebEnvironment
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(runtime_exports);
|
|
1
|
+
// typescript/runtime.ts
|
|
41
2
|
function detectRuntime() {
|
|
42
3
|
if (typeof globalThis.Deno !== "undefined") {
|
|
43
4
|
return "deno";
|
|
@@ -122,7 +83,6 @@ function getRuntimeVersion() {
|
|
|
122
83
|
switch (runtime) {
|
|
123
84
|
case "node":
|
|
124
85
|
return process.version?.substring(1);
|
|
125
|
-
// Remove 'v' prefix
|
|
126
86
|
case "deno": {
|
|
127
87
|
const deno = globalThis.Deno;
|
|
128
88
|
const version = deno?.version;
|
|
@@ -169,4 +129,24 @@ function getRuntimeInfo() {
|
|
|
169
129
|
capabilities
|
|
170
130
|
};
|
|
171
131
|
}
|
|
132
|
+
export {
|
|
133
|
+
detectRuntime,
|
|
134
|
+
getRuntimeInfo,
|
|
135
|
+
getRuntimeVersion,
|
|
136
|
+
getWasmCapabilities,
|
|
137
|
+
hasBigInt,
|
|
138
|
+
hasBlob,
|
|
139
|
+
hasFileApi,
|
|
140
|
+
hasModuleWorkers,
|
|
141
|
+
hasSharedArrayBuffer,
|
|
142
|
+
hasWasm,
|
|
143
|
+
hasWasmStreaming,
|
|
144
|
+
hasWorkers,
|
|
145
|
+
isBrowser,
|
|
146
|
+
isBun,
|
|
147
|
+
isDeno,
|
|
148
|
+
isNode,
|
|
149
|
+
isServerEnvironment,
|
|
150
|
+
isWebEnvironment
|
|
151
|
+
};
|
|
172
152
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../typescript/runtime.ts"],"sourcesContent":["/**\n * Runtime detection and environment-specific utilities\n *\n * This module provides utilities for detecting the JavaScript runtime environment,\n * checking for feature availability, and enabling environment-specific WASM loading strategies.\n *\n * @example Basic Runtime Detection\n * ```typescript\n * import { detectRuntime, isBrowser, isNode } from '@kreuzberg/wasm/runtime';\n *\n * if (isBrowser()) {\n * console.log('Running in browser');\n * } else if (isNode()) {\n * console.log('Running in Node.js');\n * }\n * ```\n *\n * @example Feature Detection\n * ```typescript\n * import { hasFileApi, hasWorkers } from '@kreuzberg/wasm/runtime';\n *\n * if (hasFileApi()) {\n * // Can use File API for browser file uploads\n * }\n *\n * if (hasWorkers()) {\n * // Can use Web Workers for parallel processing\n * }\n * ```\n */\n\nexport type RuntimeType = \"browser\" | \"node\" | \"deno\" | \"bun\" | \"unknown\";\n\n/**\n * WebAssembly capabilities available in the runtime\n */\nexport interface WasmCapabilities {\n\t/** Runtime environment type */\n\truntime: RuntimeType;\n\t/** WebAssembly support available */\n\thasWasm: boolean;\n\t/** Streaming WebAssembly instantiation available */\n\thasWasmStreaming: boolean;\n\t/** File API available (browser) */\n\thasFileApi: boolean;\n\t/** Blob API available */\n\thasBlob: boolean;\n\t/** Worker support available */\n\thasWorkers: boolean;\n\t/** SharedArrayBuffer available (may be restricted) */\n\thasSharedArrayBuffer: boolean;\n\t/** Module Workers available */\n\thasModuleWorkers: boolean;\n\t/** BigInt support */\n\thasBigInt: boolean;\n\t/** Specific runtime version if available */\n\truntimeVersion?: string;\n}\n\n/**\n * Detect the current JavaScript runtime\n *\n * Checks for various global objects and properties to determine\n * which JavaScript runtime environment is currently executing.\n *\n * @returns The detected runtime type\n *\n * @example\n * ```typescript\n * import { detectRuntime } from '@kreuzberg/wasm/runtime';\n *\n * const runtime = detectRuntime();\n * switch (runtime) {\n * case 'browser':\n * console.log('Running in browser');\n * break;\n * case 'node':\n * console.log('Running in Node.js');\n * break;\n * case 'deno':\n * console.log('Running in Deno');\n * break;\n * case 'bun':\n * console.log('Running in Bun');\n * break;\n * }\n * ```\n */\nexport function detectRuntime(): RuntimeType {\n\t// Check for Deno\n\tif (typeof (globalThis as unknown as Record<string, unknown>).Deno !== \"undefined\") {\n\t\treturn \"deno\";\n\t}\n\n\t// Check for Bun\n\tif (typeof (globalThis as unknown as Record<string, unknown>).Bun !== \"undefined\") {\n\t\treturn \"bun\";\n\t}\n\n\t// Check for Node.js\n\tif (typeof process !== \"undefined\" && process.versions && process.versions.node) {\n\t\treturn \"node\";\n\t}\n\n\t// Check for browser\n\tif (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n\t\treturn \"browser\";\n\t}\n\n\treturn \"unknown\";\n}\n\n/**\n * Check if running in a browser environment\n *\n * @returns True if running in a browser, false otherwise\n */\nexport function isBrowser(): boolean {\n\treturn detectRuntime() === \"browser\";\n}\n\n/**\n * Check if running in Node.js\n *\n * @returns True if running in Node.js, false otherwise\n */\nexport function isNode(): boolean {\n\treturn detectRuntime() === \"node\";\n}\n\n/**\n * Check if running in Deno\n *\n * @returns True if running in Deno, false otherwise\n */\nexport function isDeno(): boolean {\n\treturn detectRuntime() === \"deno\";\n}\n\n/**\n * Check if running in Bun\n *\n * @returns True if running in Bun, false otherwise\n */\nexport function isBun(): boolean {\n\treturn detectRuntime() === \"bun\";\n}\n\n/**\n * Check if running in a web environment (browser or similar)\n *\n * @returns True if running in a web browser, false otherwise\n */\nexport function isWebEnvironment(): boolean {\n\tconst runtime = detectRuntime();\n\treturn runtime === \"browser\";\n}\n\n/**\n * Check if running in a server-like environment (Node.js, Deno, Bun)\n *\n * @returns True if running on a server runtime, false otherwise\n */\nexport function isServerEnvironment(): boolean {\n\tconst runtime = detectRuntime();\n\treturn runtime === \"node\" || runtime === \"deno\" || runtime === \"bun\";\n}\n\n/**\n * Check if File API is available\n *\n * The File API is required for handling browser file uploads.\n *\n * @returns True if File API is available, false otherwise\n *\n * @example\n * ```typescript\n * if (hasFileApi()) {\n * const fileInput = document.getElementById('file');\n * fileInput.addEventListener('change', (e) => {\n * const file = e.target.files?.[0];\n * // Handle file\n * });\n * }\n * ```\n */\nexport function hasFileApi(): boolean {\n\treturn typeof window !== \"undefined\" && typeof File !== \"undefined\" && typeof Blob !== \"undefined\";\n}\n\n/**\n * Check if Blob API is available\n *\n * @returns True if Blob API is available, false otherwise\n */\nexport function hasBlob(): boolean {\n\treturn typeof Blob !== \"undefined\";\n}\n\n/**\n * Check if Web Workers are available\n *\n * @returns True if Web Workers can be created, false otherwise\n */\nexport function hasWorkers(): boolean {\n\treturn typeof Worker !== \"undefined\";\n}\n\n/**\n * Check if SharedArrayBuffer is available\n *\n * Note: SharedArrayBuffer is restricted in some browser contexts\n * due to security considerations (Spectre/Meltdown mitigations).\n *\n * @returns True if SharedArrayBuffer is available, false otherwise\n */\nexport function hasSharedArrayBuffer(): boolean {\n\treturn typeof SharedArrayBuffer !== \"undefined\";\n}\n\n/**\n * Check if module workers are available\n *\n * Module workers allow importing ES modules in worker threads.\n *\n * @returns True if module workers are supported, false otherwise\n */\nexport function hasModuleWorkers(): boolean {\n\tif (!hasWorkers()) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\t// Try to detect module worker support\n\t\tconst blob = new Blob(['console.log(\"test\")'], {\n\t\t\ttype: \"application/javascript\",\n\t\t});\n\t\tconst workerUrl = URL.createObjectURL(blob);\n\t\ttry {\n\t\t\t// Module workers require type: 'module' option\n\t\t\t// We can't actually instantiate without issues, so we check the API exists\n\t\t\treturn true;\n\t\t} finally {\n\t\t\tURL.revokeObjectURL(workerUrl);\n\t\t}\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Check if WebAssembly is available\n *\n * @returns True if WebAssembly is supported, false otherwise\n */\nexport function hasWasm(): boolean {\n\treturn typeof WebAssembly !== \"undefined\" && WebAssembly.instantiate !== undefined;\n}\n\n/**\n * Check if WebAssembly.instantiateStreaming is available\n *\n * Streaming instantiation is more efficient than buffering the entire WASM module.\n *\n * @returns True if streaming WebAssembly is supported, false otherwise\n */\nexport function hasWasmStreaming(): boolean {\n\treturn typeof WebAssembly !== \"undefined\" && WebAssembly.instantiateStreaming !== undefined;\n}\n\n/**\n * Check if BigInt is available\n *\n * @returns True if BigInt type is supported, false otherwise\n */\nexport function hasBigInt(): boolean {\n\ttry {\n\t\tconst test = BigInt(\"1\");\n\t\treturn typeof test === \"bigint\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Get runtime version information\n *\n * @returns Version string if available, undefined otherwise\n *\n * @example\n * ```typescript\n * const version = getRuntimeVersion();\n * console.log(`Running on Node ${version}`); // \"Running on Node 18.12.0\"\n * ```\n */\nexport function getRuntimeVersion(): string | undefined {\n\tconst runtime = detectRuntime();\n\n\tswitch (runtime) {\n\t\tcase \"node\":\n\t\t\treturn process.version?.substring(1); // Remove 'v' prefix\n\t\tcase \"deno\": {\n\t\t\tconst deno = (globalThis as unknown as Record<string, unknown>).Deno as Record<string, unknown> | undefined;\n\t\t\tconst version = deno?.version as Record<string, unknown> | undefined;\n\t\t\treturn version?.deno as string | undefined;\n\t\t}\n\t\tcase \"bun\": {\n\t\t\tconst bun = (globalThis as unknown as Record<string, unknown>).Bun as Record<string, unknown> | undefined;\n\t\t\treturn bun?.version as string | undefined;\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Get comprehensive WebAssembly capabilities for current runtime\n *\n * Returns detailed information about WASM and related APIs available\n * in the current runtime environment.\n *\n * @returns Object describing available WASM capabilities\n *\n * @example\n * ```typescript\n * import { getWasmCapabilities } from '@kreuzberg/wasm/runtime';\n *\n * const caps = getWasmCapabilities();\n * console.log(`WASM available: ${caps.hasWasm}`);\n * console.log(`Streaming WASM: ${caps.hasWasmStreaming}`);\n * console.log(`Workers available: ${caps.hasWorkers}`);\n *\n * if (caps.hasWasm && caps.hasWorkers) {\n * // Can offload WASM processing to workers\n * }\n * ```\n */\nexport function getWasmCapabilities(): WasmCapabilities {\n\tconst runtime = detectRuntime();\n\tconst version = getRuntimeVersion();\n\tconst capabilities: WasmCapabilities = {\n\t\truntime,\n\t\thasWasm: hasWasm(),\n\t\thasWasmStreaming: hasWasmStreaming(),\n\t\thasFileApi: hasFileApi(),\n\t\thasBlob: hasBlob(),\n\t\thasWorkers: hasWorkers(),\n\t\thasSharedArrayBuffer: hasSharedArrayBuffer(),\n\t\thasModuleWorkers: hasModuleWorkers(),\n\t\thasBigInt: hasBigInt(),\n\t\t...(version !== undefined ? { runtimeVersion: version } : {}),\n\t};\n\treturn capabilities;\n}\n\n/**\n * Get comprehensive runtime information\n *\n * Returns detailed information about the current runtime environment,\n * capabilities, and identifying information.\n *\n * @returns Object with runtime details and capabilities\n *\n * @example\n * ```typescript\n * const info = getRuntimeInfo();\n * console.log(info.runtime); // 'browser' | 'node' | 'deno' | 'bun'\n * console.log(info.isBrowser); // true/false\n * console.log(info.userAgent); // Browser user agent string\n * console.log(info.capabilities); // Detailed capability information\n * ```\n */\nexport function getRuntimeInfo() {\n\tconst runtime = detectRuntime();\n\tconst capabilities = getWasmCapabilities();\n\n\treturn {\n\t\truntime,\n\t\tisBrowser: isBrowser(),\n\t\tisNode: isNode(),\n\t\tisDeno: isDeno(),\n\t\tisBun: isBun(),\n\t\tisWeb: isWebEnvironment(),\n\t\tisServer: isServerEnvironment(),\n\t\truntimeVersion: getRuntimeVers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,YAAY,SAAY,EAAE,gBAAgB,QAAQ,IAAI,CAAC;AAAA,EAC5D;AACA,SAAO;AACR;AAmBO,SAAS,iBAAiB;AAChC,QAAM,UAAU,cAAc;AAC9B,QAAM,eAAe,oBAAoB;AAEzC,SAAO;AAAA,IACN;AAAA,IACA,WAAW,UAAU;AAAA,IACrB,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,OAAO,MAAM;AAAA,IACb,OAAO,iBAAiB;AAAA,IACxB,UAAU,oBAAoB;AAAA,IAC9B,gBAAgB,kBAAkB;AAAA,IAClC,WAAW,OAAO,cAAc,cAAc,UAAU,YAAY;AAAA,IACpE;AAAA,EACD;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../typescript/runtime.ts"],"sourcesContent":["/**\n * Runtime detection and environment-specific utilities\n *\n * This module provides utilities for detecting the JavaScript runtime environment,\n * checking for feature availability, and enabling environment-specific WASM loading strategies.\n *\n * @example Basic Runtime Detection\n * ```typescript\n * import { detectRuntime, isBrowser, isNode } from '@kreuzberg/wasm/runtime';\n *\n * if (isBrowser()) {\n * console.log('Running in browser');\n * } else if (isNode()) {\n * console.log('Running in Node.js');\n * }\n * ```\n *\n * @example Feature Detection\n * ```typescript\n * import { hasFileApi, hasWorkers } from '@kreuzberg/wasm/runtime';\n *\n * if (hasFileApi()) {\n * // Can use File API for browser file uploads\n * }\n *\n * if (hasWorkers()) {\n * // Can use Web Workers for parallel processing\n * }\n * ```\n */\n\nexport type RuntimeType = \"browser\" | \"node\" | \"deno\" | \"bun\" | \"unknown\";\n\n/**\n * WebAssembly capabilities available in the runtime\n */\nexport interface WasmCapabilities {\n\t/** Runtime environment type */\n\truntime: RuntimeType;\n\t/** WebAssembly support available */\n\thasWasm: boolean;\n\t/** Streaming WebAssembly instantiation available */\n\thasWasmStreaming: boolean;\n\t/** File API available (browser) */\n\thasFileApi: boolean;\n\t/** Blob API available */\n\thasBlob: boolean;\n\t/** Worker support available */\n\thasWorkers: boolean;\n\t/** SharedArrayBuffer available (may be restricted) */\n\thasSharedArrayBuffer: boolean;\n\t/** Module Workers available */\n\thasModuleWorkers: boolean;\n\t/** BigInt support */\n\thasBigInt: boolean;\n\t/** Specific runtime version if available */\n\truntimeVersion?: string;\n}\n\n/**\n * Detect the current JavaScript runtime\n *\n * Checks for various global objects and properties to determine\n * which JavaScript runtime environment is currently executing.\n *\n * @returns The detected runtime type\n *\n * @example\n * ```typescript\n * import { detectRuntime } from '@kreuzberg/wasm/runtime';\n *\n * const runtime = detectRuntime();\n * switch (runtime) {\n * case 'browser':\n * console.log('Running in browser');\n * break;\n * case 'node':\n * console.log('Running in Node.js');\n * break;\n * case 'deno':\n * console.log('Running in Deno');\n * break;\n * case 'bun':\n * console.log('Running in Bun');\n * break;\n * }\n * ```\n */\nexport function detectRuntime(): RuntimeType {\n\tif (typeof (globalThis as unknown as Record<string, unknown>).Deno !== \"undefined\") {\n\t\treturn \"deno\";\n\t}\n\n\tif (typeof (globalThis as unknown as Record<string, unknown>).Bun !== \"undefined\") {\n\t\treturn \"bun\";\n\t}\n\n\tif (typeof process !== \"undefined\" && process.versions && process.versions.node) {\n\t\treturn \"node\";\n\t}\n\n\tif (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n\t\treturn \"browser\";\n\t}\n\n\treturn \"unknown\";\n}\n\n/**\n * Check if running in a browser environment\n *\n * @returns True if running in a browser, false otherwise\n */\nexport function isBrowser(): boolean {\n\treturn detectRuntime() === \"browser\";\n}\n\n/**\n * Check if running in Node.js\n *\n * @returns True if running in Node.js, false otherwise\n */\nexport function isNode(): boolean {\n\treturn detectRuntime() === \"node\";\n}\n\n/**\n * Check if running in Deno\n *\n * @returns True if running in Deno, false otherwise\n */\nexport function isDeno(): boolean {\n\treturn detectRuntime() === \"deno\";\n}\n\n/**\n * Check if running in Bun\n *\n * @returns True if running in Bun, false otherwise\n */\nexport function isBun(): boolean {\n\treturn detectRuntime() === \"bun\";\n}\n\n/**\n * Check if running in a web environment (browser or similar)\n *\n * @returns True if running in a web browser, false otherwise\n */\nexport function isWebEnvironment(): boolean {\n\tconst runtime = detectRuntime();\n\treturn runtime === \"browser\";\n}\n\n/**\n * Check if running in a server-like environment (Node.js, Deno, Bun)\n *\n * @returns True if running on a server runtime, false otherwise\n */\nexport function isServerEnvironment(): boolean {\n\tconst runtime = detectRuntime();\n\treturn runtime === \"node\" || runtime === \"deno\" || runtime === \"bun\";\n}\n\n/**\n * Check if File API is available\n *\n * The File API is required for handling browser file uploads.\n *\n * @returns True if File API is available, false otherwise\n *\n * @example\n * ```typescript\n * if (hasFileApi()) {\n * const fileInput = document.getElementById('file');\n * fileInput.addEventListener('change', (e) => {\n * const file = e.target.files?.[0];\n * // Handle file\n * });\n * }\n * ```\n */\nexport function hasFileApi(): boolean {\n\treturn typeof window !== \"undefined\" && typeof File !== \"undefined\" && typeof Blob !== \"undefined\";\n}\n\n/**\n * Check if Blob API is available\n *\n * @returns True if Blob API is available, false otherwise\n */\nexport function hasBlob(): boolean {\n\treturn typeof Blob !== \"undefined\";\n}\n\n/**\n * Check if Web Workers are available\n *\n * @returns True if Web Workers can be created, false otherwise\n */\nexport function hasWorkers(): boolean {\n\treturn typeof Worker !== \"undefined\";\n}\n\n/**\n * Check if SharedArrayBuffer is available\n *\n * Note: SharedArrayBuffer is restricted in some browser contexts\n * due to security considerations (Spectre/Meltdown mitigations).\n *\n * @returns True if SharedArrayBuffer is available, false otherwise\n */\nexport function hasSharedArrayBuffer(): boolean {\n\treturn typeof SharedArrayBuffer !== \"undefined\";\n}\n\n/**\n * Check if module workers are available\n *\n * Module workers allow importing ES modules in worker threads.\n *\n * @returns True if module workers are supported, false otherwise\n */\nexport function hasModuleWorkers(): boolean {\n\tif (!hasWorkers()) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tconst blob = new Blob(['console.log(\"test\")'], {\n\t\t\ttype: \"application/javascript\",\n\t\t});\n\t\tconst workerUrl = URL.createObjectURL(blob);\n\t\ttry {\n\t\t\treturn true;\n\t\t} finally {\n\t\t\tURL.revokeObjectURL(workerUrl);\n\t\t}\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Check if WebAssembly is available\n *\n * @returns True if WebAssembly is supported, false otherwise\n */\nexport function hasWasm(): boolean {\n\treturn typeof WebAssembly !== \"undefined\" && WebAssembly.instantiate !== undefined;\n}\n\n/**\n * Check if WebAssembly.instantiateStreaming is available\n *\n * Streaming instantiation is more efficient than buffering the entire WASM module.\n *\n * @returns True if streaming WebAssembly is supported, false otherwise\n */\nexport function hasWasmStreaming(): boolean {\n\treturn typeof WebAssembly !== \"undefined\" && WebAssembly.instantiateStreaming !== undefined;\n}\n\n/**\n * Check if BigInt is available\n *\n * @returns True if BigInt type is supported, false otherwise\n */\nexport function hasBigInt(): boolean {\n\ttry {\n\t\tconst test = BigInt(\"1\");\n\t\treturn typeof test === \"bigint\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Get runtime version information\n *\n * @returns Version string if available, undefined otherwise\n *\n * @example\n * ```typescript\n * const version = getRuntimeVersion();\n * console.log(`Running on Node ${version}`); // \"Running on Node 18.12.0\"\n * ```\n */\nexport function getRuntimeVersion(): string | undefined {\n\tconst runtime = detectRuntime();\n\n\tswitch (runtime) {\n\t\tcase \"node\":\n\t\t\treturn process.version?.substring(1);\n\t\tcase \"deno\": {\n\t\t\tconst deno = (globalThis as unknown as Record<string, unknown>).Deno as Record<string, unknown> | undefined;\n\t\t\tconst version = deno?.version as Record<string, unknown> | undefined;\n\t\t\treturn version?.deno as string | undefined;\n\t\t}\n\t\tcase \"bun\": {\n\t\t\tconst bun = (globalThis as unknown as Record<string, unknown>).Bun as Record<string, unknown> | undefined;\n\t\t\treturn bun?.version as string | undefined;\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Get comprehensive WebAssembly capabilities for current runtime\n *\n * Returns detailed information about WASM and related APIs available\n * in the current runtime environment.\n *\n * @returns Object describing available WASM capabilities\n *\n * @example\n * ```typescript\n * import { getWasmCapabilities } from '@kreuzberg/wasm/runtime';\n *\n * const caps = getWasmCapabilities();\n * console.log(`WASM available: ${caps.hasWasm}`);\n * console.log(`Streaming WASM: ${caps.hasWasmStreaming}`);\n * console.log(`Workers available: ${caps.hasWorkers}`);\n *\n * if (caps.hasWasm && caps.hasWorkers) {\n * // Can offload WASM processing to workers\n * }\n * ```\n */\nexport function getWasmCapabilities(): WasmCapabilities {\n\tconst runtime = detectRuntime();\n\tconst version = getRuntimeVersion();\n\tconst capabilities: WasmCapabilities = {\n\t\truntime,\n\t\thasWasm: hasWasm(),\n\t\thasWasmStreaming: hasWasmStreaming(),\n\t\thasFileApi: hasFileApi(),\n\t\thasBlob: hasBlob(),\n\t\thasWorkers: hasWorkers(),\n\t\thasSharedArrayBuffer: hasSharedArrayBuffer(),\n\t\thasModuleWorkers: hasModuleWorkers(),\n\t\thasBigInt: hasBigInt(),\n\t\t...(version !== undefined ? { runtimeVersion: version } : {}),\n\t};\n\treturn capabilities;\n}\n\n/**\n * Get comprehensive runtime information\n *\n * Returns detailed information about the current runtime environment,\n * capabilities, and identifying information.\n *\n * @returns Object with runtime details and capabilities\n *\n * @example\n * ```typescript\n * const info = getRuntimeInfo();\n * console.log(info.runtime); // 'browser' | 'node' | 'deno' | 'bun'\n * console.log(info.isBrowser); // true/false\n * console.log(info.userAgent); // Browser user agent string\n * console.log(info.capabilities); // Detailed capability information\n * ```\n */\nexport function getRuntimeInfo() {\n\tconst runtime = detectRuntime();\n\tconst capabilities = getWasmCapabilities();\n\n\treturn {\n\t\truntime,\n\t\tisBrowser: isBrowser(),\n\t\tisNode: isNode(),\n\t\tisDeno: isDeno(),\n\t\tisBun: isBun(),\n\t\tisWeb: isWebEnvironment(),\n\t\tisServer: isServerEnvironment(),\n\t\truntimeVersion: getRuntimeVersion(),\n\t\tuserAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : \"N/A\",\n\t\tcapabilities,\n\t};\n}\n"],"mappings":";AAwFO,S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