@kreuzberg/wasm 4.0.8 → 4.1.1

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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/extraction/batch.d.ts +80 -0
  3. package/dist/extraction/batch.d.ts.map +1 -0
  4. package/dist/extraction/bytes.d.ts +69 -0
  5. package/dist/extraction/bytes.d.ts.map +1 -0
  6. package/dist/extraction/files.d.ts +77 -0
  7. package/dist/extraction/files.d.ts.map +1 -0
  8. package/dist/extraction/index.d.ts +11 -0
  9. package/dist/extraction/index.d.ts.map +1 -0
  10. package/dist/extraction/internal.d.ts +21 -0
  11. package/dist/extraction/internal.d.ts.map +1 -0
  12. package/dist/index.d.ts +9 -323
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +677 -591
  15. package/dist/index.js.map +1 -1
  16. package/dist/initialization/pdfium-loader.d.ts +30 -0
  17. package/dist/initialization/pdfium-loader.d.ts.map +1 -0
  18. package/dist/initialization/state.d.ts +100 -0
  19. package/dist/initialization/state.d.ts.map +1 -0
  20. package/dist/initialization/wasm-loader.d.ts +81 -0
  21. package/dist/initialization/wasm-loader.d.ts.map +1 -0
  22. package/dist/ocr/enabler.d.ts +86 -0
  23. package/dist/ocr/enabler.d.ts.map +1 -0
  24. package/dist/pkg/README.md +1 -1
  25. package/dist/pkg/kreuzberg_wasm.d.ts +76 -0
  26. package/dist/pkg/kreuzberg_wasm.js +142 -82
  27. package/dist/pkg/kreuzberg_wasm_bg.js +7 -7
  28. package/dist/pkg/kreuzberg_wasm_bg.wasm +0 -0
  29. package/dist/pkg/kreuzberg_wasm_bg.wasm.d.ts +3 -3
  30. package/dist/pkg/package.json +5 -1
  31. package/dist/runtime.d.ts +22 -2
  32. package/dist/runtime.d.ts.map +1 -1
  33. package/dist/runtime.js +21 -1
  34. package/dist/runtime.js.map +1 -1
  35. package/dist/types.d.ts +75 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +6 -6
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * Get information about the WASM module
5
5
  */
6
- class ModuleInfo {
6
+ export class ModuleInfo {
7
7
  static __wrap(ptr) {
8
8
  ptr = ptr >>> 0;
9
9
  const obj = Object.create(ModuleInfo.prototype);
@@ -43,7 +43,6 @@ class ModuleInfo {
43
43
  }
44
44
  }
45
45
  if (Symbol.dispose) ModuleInfo.prototype[Symbol.dispose] = ModuleInfo.prototype.free;
46
- exports.ModuleInfo = ModuleInfo;
47
46
 
48
47
  /**
49
48
  * Batch extract from multiple byte arrays (asynchronous).
@@ -90,7 +89,7 @@ exports.ModuleInfo = ModuleInfo;
90
89
  * @param {any | null} [config]
91
90
  * @returns {Promise<any>}
92
91
  */
93
- function batchExtractBytes(data_list, mime_types, config) {
92
+ export function batchExtractBytes(data_list, mime_types, config) {
94
93
  const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
95
94
  const len0 = WASM_VECTOR_LEN;
96
95
  const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
@@ -98,7 +97,6 @@ function batchExtractBytes(data_list, mime_types, config) {
98
97
  const ret = wasm.batchExtractBytes(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
99
98
  return ret;
100
99
  }
101
- exports.batchExtractBytes = batchExtractBytes;
102
100
 
103
101
  /**
104
102
  * Batch extract from multiple byte arrays (synchronous).
@@ -138,7 +136,7 @@ exports.batchExtractBytes = batchExtractBytes;
138
136
  * @param {any | null} [config]
139
137
  * @returns {any}
140
138
  */
141
- function batchExtractBytesSync(data_list, mime_types, config) {
139
+ export function batchExtractBytesSync(data_list, mime_types, config) {
142
140
  const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
143
141
  const len0 = WASM_VECTOR_LEN;
144
142
  const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
@@ -149,7 +147,6 @@ function batchExtractBytesSync(data_list, mime_types, config) {
149
147
  }
150
148
  return takeFromExternrefTable0(ret[0]);
151
149
  }
152
- exports.batchExtractBytesSync = batchExtractBytesSync;
153
150
 
154
151
  /**
155
152
  * Batch extract from multiple Files or Blobs (asynchronous).
@@ -182,13 +179,12 @@ exports.batchExtractBytesSync = batchExtractBytesSync;
182
179
  * @param {any | null} [config]
183
180
  * @returns {Promise<any>}
184
181
  */
185
- function batchExtractFiles(files, config) {
182
+ export function batchExtractFiles(files, config) {
186
183
  const ptr0 = passArrayJsValueToWasm0(files, wasm.__wbindgen_malloc);
187
184
  const len0 = WASM_VECTOR_LEN;
188
185
  const ret = wasm.batchExtractFiles(ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
189
186
  return ret;
190
187
  }
191
- exports.batchExtractFiles = batchExtractFiles;
192
188
 
193
189
  /**
194
190
  * Batch extract from multiple files (synchronous) - NOT AVAILABLE IN WASM.
@@ -201,14 +197,13 @@ exports.batchExtractFiles = batchExtractFiles;
201
197
  * Always throws: "File operations are not available in WASM. Use batchExtractBytesSync or batchExtractBytes instead."
202
198
  * @returns {any}
203
199
  */
204
- function batchExtractFilesSync() {
200
+ export function batchExtractFilesSync() {
205
201
  const ret = wasm.batchExtractFilesSync();
206
202
  if (ret[2]) {
207
203
  throw takeFromExternrefTable0(ret[1]);
208
204
  }
209
205
  return takeFromExternrefTable0(ret[0]);
210
206
  }
211
- exports.batchExtractFilesSync = batchExtractFilesSync;
212
207
 
213
208
  /**
214
209
  * Clear all registered OCR backends.
@@ -223,13 +218,12 @@ exports.batchExtractFilesSync = batchExtractFilesSync;
223
218
  * clearOcrBackends();
224
219
  * ```
225
220
  */
226
- function clear_ocr_backends() {
221
+ export function clear_ocr_backends() {
227
222
  const ret = wasm.clear_ocr_backends();
228
223
  if (ret[1]) {
229
224
  throw takeFromExternrefTable0(ret[0]);
230
225
  }
231
226
  }
232
- exports.clear_ocr_backends = clear_ocr_backends;
233
227
 
234
228
  /**
235
229
  * Clear all registered post-processors.
@@ -244,13 +238,12 @@ exports.clear_ocr_backends = clear_ocr_backends;
244
238
  * clearPostProcessors();
245
239
  * ```
246
240
  */
247
- function clear_post_processors() {
241
+ export function clear_post_processors() {
248
242
  const ret = wasm.clear_post_processors();
249
243
  if (ret[1]) {
250
244
  throw takeFromExternrefTable0(ret[0]);
251
245
  }
252
246
  }
253
- exports.clear_post_processors = clear_post_processors;
254
247
 
255
248
  /**
256
249
  * Clear all registered validators.
@@ -265,13 +258,12 @@ exports.clear_post_processors = clear_post_processors;
265
258
  * clearValidators();
266
259
  * ```
267
260
  */
268
- function clear_validators() {
261
+ export function clear_validators() {
269
262
  const ret = wasm.clear_validators();
270
263
  if (ret[1]) {
271
264
  throw takeFromExternrefTable0(ret[0]);
272
265
  }
273
266
  }
274
- exports.clear_validators = clear_validators;
275
267
 
276
268
  /**
277
269
  * Detect MIME type from raw file bytes.
@@ -305,7 +297,7 @@ exports.clear_validators = clear_validators;
305
297
  * @param {Uint8Array} data
306
298
  * @returns {string}
307
299
  */
308
- function detectMimeFromBytes(data) {
300
+ export function detectMimeFromBytes(data) {
309
301
  const ret = wasm.detectMimeFromBytes(data);
310
302
  if (ret[3]) {
311
303
  throw takeFromExternrefTable0(ret[2]);
@@ -314,7 +306,6 @@ function detectMimeFromBytes(data) {
314
306
  if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
315
307
  return v1;
316
308
  }
317
- exports.detectMimeFromBytes = detectMimeFromBytes;
318
309
 
319
310
  /**
320
311
  * Discover configuration file in the project hierarchy.
@@ -351,14 +342,13 @@ exports.detectMimeFromBytes = detectMimeFromBytes;
351
342
  * ```
352
343
  * @returns {any}
353
344
  */
354
- function discoverConfig() {
345
+ export function discoverConfig() {
355
346
  const ret = wasm.discoverConfig();
356
347
  if (ret[2]) {
357
348
  throw takeFromExternrefTable0(ret[1]);
358
349
  }
359
350
  return takeFromExternrefTable0(ret[0]);
360
351
  }
361
- exports.discoverConfig = discoverConfig;
362
352
 
363
353
  /**
364
354
  * Extract content from a byte array (asynchronous).
@@ -399,13 +389,12 @@ exports.discoverConfig = discoverConfig;
399
389
  * @param {any | null} [config]
400
390
  * @returns {Promise<any>}
401
391
  */
402
- function extractBytes(data, mime_type, config) {
392
+ export function extractBytes(data, mime_type, config) {
403
393
  const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
404
394
  const len0 = WASM_VECTOR_LEN;
405
395
  const ret = wasm.extractBytes(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
406
396
  return ret;
407
397
  }
408
- exports.extractBytes = extractBytes;
409
398
 
410
399
  /**
411
400
  * Extract content from a byte array (synchronous).
@@ -444,7 +433,7 @@ exports.extractBytes = extractBytes;
444
433
  * @param {any | null} [config]
445
434
  * @returns {any}
446
435
  */
447
- function extractBytesSync(data, mime_type, config) {
436
+ export function extractBytesSync(data, mime_type, config) {
448
437
  const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
449
438
  const len0 = WASM_VECTOR_LEN;
450
439
  const ret = wasm.extractBytesSync(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
@@ -453,7 +442,6 @@ function extractBytesSync(data, mime_type, config) {
453
442
  }
454
443
  return takeFromExternrefTable0(ret[0]);
455
444
  }
456
- exports.extractBytesSync = extractBytesSync;
457
445
 
458
446
  /**
459
447
  * Extract content from a web File or Blob (asynchronous).
@@ -492,13 +480,12 @@ exports.extractBytesSync = extractBytesSync;
492
480
  * @param {any | null} [config]
493
481
  * @returns {Promise<any>}
494
482
  */
495
- function extractFile(file, mime_type, config) {
483
+ export function extractFile(file, mime_type, config) {
496
484
  var ptr0 = isLikeNone(mime_type) ? 0 : passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
497
485
  var len0 = WASM_VECTOR_LEN;
498
486
  const ret = wasm.extractFile(file, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
499
487
  return ret;
500
488
  }
501
- exports.extractFile = extractFile;
502
489
 
503
490
  /**
504
491
  * Extract content from a file (synchronous) - NOT AVAILABLE IN WASM.
@@ -511,14 +498,13 @@ exports.extractFile = extractFile;
511
498
  * Always throws: "File operations are not available in WASM. Use extractBytesSync or extractBytes instead."
512
499
  * @returns {any}
513
500
  */
514
- function extractFileSync() {
501
+ export function extractFileSync() {
515
502
  const ret = wasm.extractFileSync();
516
503
  if (ret[2]) {
517
504
  throw takeFromExternrefTable0(ret[1]);
518
505
  }
519
506
  return takeFromExternrefTable0(ret[0]);
520
507
  }
521
- exports.extractFileSync = extractFileSync;
522
508
 
523
509
  /**
524
510
  * Get file extensions for a given MIME type.
@@ -552,7 +538,7 @@ exports.extractFileSync = extractFileSync;
552
538
  * @param {string} mime_type
553
539
  * @returns {Array<any>}
554
540
  */
555
- function getExtensionsForMime(mime_type) {
541
+ export function getExtensionsForMime(mime_type) {
556
542
  const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
557
543
  const len0 = WASM_VECTOR_LEN;
558
544
  const ret = wasm.getExtensionsForMime(ptr0, len0);
@@ -561,7 +547,6 @@ function getExtensionsForMime(mime_type) {
561
547
  }
562
548
  return takeFromExternrefTable0(ret[0]);
563
549
  }
564
- exports.getExtensionsForMime = getExtensionsForMime;
565
550
 
566
551
  /**
567
552
  * Get MIME type from file extension.
@@ -594,7 +579,7 @@ exports.getExtensionsForMime = getExtensionsForMime;
594
579
  * @param {string} extension
595
580
  * @returns {string}
596
581
  */
597
- function getMimeFromExtension(extension) {
582
+ export function getMimeFromExtension(extension) {
598
583
  const ptr0 = passStringToWasm0(extension, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
599
584
  const len0 = WASM_VECTOR_LEN;
600
585
  const ret = wasm.getMimeFromExtension(ptr0, len0);
@@ -602,36 +587,32 @@ function getMimeFromExtension(extension) {
602
587
  if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
603
588
  return v2;
604
589
  }
605
- exports.getMimeFromExtension = getMimeFromExtension;
606
590
 
607
591
  /**
608
592
  * Get module information
609
593
  * @returns {ModuleInfo}
610
594
  */
611
- function get_module_info() {
595
+ export function get_module_info() {
612
596
  const ret = wasm.get_module_info();
613
597
  return ModuleInfo.__wrap(ret);
614
598
  }
615
- exports.get_module_info = get_module_info;
616
599
 
617
600
  /**
618
601
  * Initialize the WASM module
619
602
  * This function should be called once at application startup
620
603
  */
621
- function init() {
604
+ export function init() {
622
605
  wasm.init();
623
606
  }
624
- exports.init = init;
625
607
 
626
608
  /**
627
609
  * @param {number} _num_threads
628
610
  * @returns {Promise<any>}
629
611
  */
630
- function initThreadPool(_num_threads) {
612
+ export function initThreadPool(_num_threads) {
631
613
  const ret = wasm.initThreadPool(_num_threads);
632
614
  return ret;
633
615
  }
634
- exports.initThreadPool = initThreadPool;
635
616
 
636
617
  /**
637
618
  * Helper function to initialize the thread pool with error handling
@@ -644,11 +625,10 @@ exports.initThreadPool = initThreadPool;
644
625
  * @param {number} num_threads
645
626
  * @returns {boolean}
646
627
  */
647
- function init_thread_pool_safe(num_threads) {
628
+ export function init_thread_pool_safe(num_threads) {
648
629
  const ret = wasm.init_thread_pool_safe(num_threads);
649
630
  return ret !== 0;
650
631
  }
651
- exports.init_thread_pool_safe = init_thread_pool_safe;
652
632
 
653
633
  /**
654
634
  * Establishes a binding between an external Pdfium WASM module and `pdfium-render`'s WASM module.
@@ -661,11 +641,10 @@ exports.init_thread_pool_safe = init_thread_pool_safe;
661
641
  * @param {boolean} debug
662
642
  * @returns {boolean}
663
643
  */
664
- function initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug) {
644
+ export function initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug) {
665
645
  const ret = wasm.initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug);
666
646
  return ret !== 0;
667
647
  }
668
- exports.initialize_pdfium_render = initialize_pdfium_render;
669
648
 
670
649
  /**
671
650
  * List all registered OCR backend names.
@@ -682,14 +661,13 @@ exports.initialize_pdfium_render = initialize_pdfium_render;
682
661
  * ```
683
662
  * @returns {Array<any>}
684
663
  */
685
- function list_ocr_backends() {
664
+ export function list_ocr_backends() {
686
665
  const ret = wasm.list_ocr_backends();
687
666
  if (ret[2]) {
688
667
  throw takeFromExternrefTable0(ret[1]);
689
668
  }
690
669
  return takeFromExternrefTable0(ret[0]);
691
670
  }
692
- exports.list_ocr_backends = list_ocr_backends;
693
671
 
694
672
  /**
695
673
  * List all registered post-processor names.
@@ -706,14 +684,13 @@ exports.list_ocr_backends = list_ocr_backends;
706
684
  * ```
707
685
  * @returns {Array<any>}
708
686
  */
709
- function list_post_processors() {
687
+ export function list_post_processors() {
710
688
  const ret = wasm.list_post_processors();
711
689
  if (ret[2]) {
712
690
  throw takeFromExternrefTable0(ret[1]);
713
691
  }
714
692
  return takeFromExternrefTable0(ret[0]);
715
693
  }
716
- exports.list_post_processors = list_post_processors;
717
694
 
718
695
  /**
719
696
  * List all registered validator names.
@@ -730,14 +707,13 @@ exports.list_post_processors = list_post_processors;
730
707
  * ```
731
708
  * @returns {Array<any>}
732
709
  */
733
- function list_validators() {
710
+ export function list_validators() {
734
711
  const ret = wasm.list_validators();
735
712
  if (ret[2]) {
736
713
  throw takeFromExternrefTable0(ret[1]);
737
714
  }
738
715
  return takeFromExternrefTable0(ret[0]);
739
716
  }
740
- exports.list_validators = list_validators;
741
717
 
742
718
  /**
743
719
  * Load configuration from a string in the specified format.
@@ -791,7 +767,7 @@ exports.list_validators = list_validators;
791
767
  * @param {string} format
792
768
  * @returns {any}
793
769
  */
794
- function loadConfigFromString(content, format) {
770
+ export function loadConfigFromString(content, format) {
795
771
  const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
796
772
  const len0 = WASM_VECTOR_LEN;
797
773
  const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -802,7 +778,6 @@ function loadConfigFromString(content, format) {
802
778
  }
803
779
  return takeFromExternrefTable0(ret[0]);
804
780
  }
805
- exports.loadConfigFromString = loadConfigFromString;
806
781
 
807
782
  /**
808
783
  * Normalize a MIME type string.
@@ -836,7 +811,7 @@ exports.loadConfigFromString = loadConfigFromString;
836
811
  * @param {string} mime_type
837
812
  * @returns {string}
838
813
  */
839
- function normalizeMimeType(mime_type) {
814
+ export function normalizeMimeType(mime_type) {
840
815
  const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
841
816
  const len0 = WASM_VECTOR_LEN;
842
817
  const ret = wasm.normalizeMimeType(ptr0, len0);
@@ -844,7 +819,6 @@ function normalizeMimeType(mime_type) {
844
819
  if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
845
820
  return v2;
846
821
  }
847
- exports.normalizeMimeType = normalizeMimeType;
848
822
 
849
823
  /**
850
824
  * A callback function that can be invoked by Pdfium's `FPDF_LoadCustomDocument()` function,
@@ -856,11 +830,10 @@ exports.normalizeMimeType = normalizeMimeType;
856
830
  * @param {number} size
857
831
  * @returns {number}
858
832
  */
859
- function read_block_from_callback_wasm(param, position, pBuf, size) {
833
+ export function read_block_from_callback_wasm(param, position, pBuf, size) {
860
834
  const ret = wasm.read_block_from_callback_wasm(param, position, pBuf, size);
861
835
  return ret;
862
836
  }
863
- exports.read_block_from_callback_wasm = read_block_from_callback_wasm;
864
837
 
865
838
  /**
866
839
  * Register a custom OCR backend.
@@ -896,13 +869,12 @@ exports.read_block_from_callback_wasm = read_block_from_callback_wasm;
896
869
  * ```
897
870
  * @param {any} backend
898
871
  */
899
- function register_ocr_backend(backend) {
872
+ export function register_ocr_backend(backend) {
900
873
  const ret = wasm.register_ocr_backend(backend);
901
874
  if (ret[1]) {
902
875
  throw takeFromExternrefTable0(ret[0]);
903
876
  }
904
877
  }
905
- exports.register_ocr_backend = register_ocr_backend;
906
878
 
907
879
  /**
908
880
  * Register a custom post-processor.
@@ -934,13 +906,12 @@ exports.register_ocr_backend = register_ocr_backend;
934
906
  * ```
935
907
  * @param {any} processor
936
908
  */
937
- function register_post_processor(processor) {
909
+ export function register_post_processor(processor) {
938
910
  const ret = wasm.register_post_processor(processor);
939
911
  if (ret[1]) {
940
912
  throw takeFromExternrefTable0(ret[0]);
941
913
  }
942
914
  }
943
- exports.register_post_processor = register_post_processor;
944
915
 
945
916
  /**
946
917
  * Register a custom validator.
@@ -973,13 +944,12 @@ exports.register_post_processor = register_post_processor;
973
944
  * ```
974
945
  * @param {any} validator
975
946
  */
976
- function register_validator(validator) {
947
+ export function register_validator(validator) {
977
948
  const ret = wasm.register_validator(validator);
978
949
  if (ret[1]) {
979
950
  throw takeFromExternrefTable0(ret[0]);
980
951
  }
981
952
  }
982
- exports.register_validator = register_validator;
983
953
 
984
954
  /**
985
955
  * Unregister an OCR backend by name.
@@ -999,7 +969,7 @@ exports.register_validator = register_validator;
999
969
  * ```
1000
970
  * @param {string} name
1001
971
  */
1002
- function unregister_ocr_backend(name) {
972
+ export function unregister_ocr_backend(name) {
1003
973
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1004
974
  const len0 = WASM_VECTOR_LEN;
1005
975
  const ret = wasm.unregister_ocr_backend(ptr0, len0);
@@ -1007,7 +977,6 @@ function unregister_ocr_backend(name) {
1007
977
  throw takeFromExternrefTable0(ret[0]);
1008
978
  }
1009
979
  }
1010
- exports.unregister_ocr_backend = unregister_ocr_backend;
1011
980
 
1012
981
  /**
1013
982
  * Unregister a post-processor by name.
@@ -1027,7 +996,7 @@ exports.unregister_ocr_backend = unregister_ocr_backend;
1027
996
  * ```
1028
997
  * @param {string} name
1029
998
  */
1030
- function unregister_post_processor(name) {
999
+ export function unregister_post_processor(name) {
1031
1000
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1032
1001
  const len0 = WASM_VECTOR_LEN;
1033
1002
  const ret = wasm.unregister_post_processor(ptr0, len0);
@@ -1035,7 +1004,6 @@ function unregister_post_processor(name) {
1035
1004
  throw takeFromExternrefTable0(ret[0]);
1036
1005
  }
1037
1006
  }
1038
- exports.unregister_post_processor = unregister_post_processor;
1039
1007
 
1040
1008
  /**
1041
1009
  * Unregister a validator by name.
@@ -1055,7 +1023,7 @@ exports.unregister_post_processor = unregister_post_processor;
1055
1023
  * ```
1056
1024
  * @param {string} name
1057
1025
  */
1058
- function unregister_validator(name) {
1026
+ export function unregister_validator(name) {
1059
1027
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1060
1028
  const len0 = WASM_VECTOR_LEN;
1061
1029
  const ret = wasm.unregister_validator(ptr0, len0);
@@ -1063,19 +1031,17 @@ function unregister_validator(name) {
1063
1031
  throw takeFromExternrefTable0(ret[0]);
1064
1032
  }
1065
1033
  }
1066
- exports.unregister_validator = unregister_validator;
1067
1034
 
1068
1035
  /**
1069
1036
  * Version of the kreuzberg-wasm binding
1070
1037
  * @returns {string}
1071
1038
  */
1072
- function version() {
1039
+ export function version() {
1073
1040
  const ret = wasm.version();
1074
1041
  var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
1075
1042
  if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
1076
1043
  return v1;
1077
1044
  }
1078
- exports.version = version;
1079
1045
 
1080
1046
  /**
1081
1047
  * A callback function that can be invoked by Pdfium's `FPDF_SaveAsCopy()` and `FPDF_SaveWithVersion()`
@@ -1086,11 +1052,10 @@ exports.version = version;
1086
1052
  * @param {number} size
1087
1053
  * @returns {number}
1088
1054
  */
1089
- function write_block_from_callback_wasm(param, buf, size) {
1055
+ export function write_block_from_callback_wasm(param, buf, size) {
1090
1056
  const ret = wasm.write_block_from_callback_wasm(param, buf, size);
1091
1057
  return ret;
1092
1058
  }
1093
- exports.write_block_from_callback_wasm = write_block_from_callback_wasm;
1094
1059
 
1095
1060
  function __wbg_get_imports() {
1096
1061
  const import0 = {
@@ -1363,7 +1328,7 @@ function __wbg_get_imports() {
1363
1328
  const a = state0.a;
1364
1329
  state0.a = 0;
1365
1330
  try {
1366
- return wasm_bindgen_d5f0760cbbd6023b___convert__closures_____invoke___wasm_bindgen_d5f0760cbbd6023b___JsValue__wasm_bindgen_d5f0760cbbd6023b___JsValue_____(a, state0.b, arg0, arg1);
1331
+ return wasm_bindgen_37c4960e3490cba2___convert__closures_____invoke___wasm_bindgen_37c4960e3490cba2___JsValue__wasm_bindgen_37c4960e3490cba2___JsValue_____(a, state0.b, arg0, arg1);
1367
1332
  } finally {
1368
1333
  state0.a = a;
1369
1334
  }
@@ -1527,8 +1492,8 @@ function __wbg_get_imports() {
1527
1492
  console.warn(arg0);
1528
1493
  },
1529
1494
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1530
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1981, function: Function { arguments: [Externref], shim_idx: 1982, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1531
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_d5f0760cbbd6023b___closure__destroy___dyn_core_67558b4ca73dc0a8___ops__function__FnMut__wasm_bindgen_d5f0760cbbd6023b___JsValue____Output_______, wasm_bindgen_d5f0760cbbd6023b___convert__closures_____invoke___wasm_bindgen_d5f0760cbbd6023b___JsValue_____);
1495
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1987, function: Function { arguments: [Externref], shim_idx: 1988, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1496
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_37c4960e3490cba2___closure__destroy___dyn_core_67558b4ca73dc0a8___ops__function__FnMut__wasm_bindgen_37c4960e3490cba2___JsValue____Output_______, wasm_bindgen_37c4960e3490cba2___convert__closures_____invoke___wasm_bindgen_37c4960e3490cba2___JsValue_____);
1532
1497
  return ret;
1533
1498
  },
1534
1499
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -1577,12 +1542,12 @@ function __wbg_get_imports() {
1577
1542
  };
1578
1543
  }
1579
1544
 
1580
- function wasm_bindgen_d5f0760cbbd6023b___convert__closures_____invoke___wasm_bindgen_d5f0760cbbd6023b___JsValue_____(arg0, arg1, arg2) {
1581
- wasm.wasm_bindgen_d5f0760cbbd6023b___convert__closures_____invoke___wasm_bindgen_d5f0760cbbd6023b___JsValue_____(arg0, arg1, arg2);
1545
+ function wasm_bindgen_37c4960e3490cba2___convert__closures_____invoke___wasm_bindgen_37c4960e3490cba2___JsValue_____(arg0, arg1, arg2) {
1546
+ wasm.wasm_bindgen_37c4960e3490cba2___convert__closures_____invoke___wasm_bindgen_37c4960e3490cba2___JsValue_____(arg0, arg1, arg2);
1582
1547
  }
1583
1548
 
1584
- function wasm_bindgen_d5f0760cbbd6023b___convert__closures_____invoke___wasm_bindgen_d5f0760cbbd6023b___JsValue__wasm_bindgen_d5f0760cbbd6023b___JsValue_____(arg0, arg1, arg2, arg3) {
1585
- wasm.wasm_bindgen_d5f0760cbbd6023b___convert__closures_____invoke___wasm_bindgen_d5f0760cbbd6023b___JsValue__wasm_bindgen_d5f0760cbbd6023b___JsValue_____(arg0, arg1, arg2, arg3);
1549
+ function wasm_bindgen_37c4960e3490cba2___convert__closures_____invoke___wasm_bindgen_37c4960e3490cba2___JsValue__wasm_bindgen_37c4960e3490cba2___JsValue_____(arg0, arg1, arg2, arg3) {
1550
+ wasm.wasm_bindgen_37c4960e3490cba2___convert__closures_____invoke___wasm_bindgen_37c4960e3490cba2___JsValue__wasm_bindgen_37c4960e3490cba2___JsValue_____(arg0, arg1, arg2, arg3);
1586
1551
  }
1587
1552
 
1588
1553
  const ModuleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1796,7 +1761,15 @@ function takeFromExternrefTable0(idx) {
1796
1761
 
1797
1762
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1798
1763
  cachedTextDecoder.decode();
1764
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1765
+ let numBytesDecoded = 0;
1799
1766
  function decodeText(ptr, len) {
1767
+ numBytesDecoded += len;
1768
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1769
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1770
+ cachedTextDecoder.decode();
1771
+ numBytesDecoded = len;
1772
+ }
1800
1773
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1801
1774
  }
1802
1775
 
@@ -1815,8 +1788,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
1815
1788
 
1816
1789
  let WASM_VECTOR_LEN = 0;
1817
1790
 
1818
- const wasmPath = `${__dirname}/kreuzberg_wasm_bg.wasm`;
1819
- const wasmBytes = require('fs').readFileSync(wasmPath);
1820
- const wasmModule = new WebAssembly.Module(wasmBytes);
1821
- const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1822
- wasm.__wbindgen_start();
1791
+ let wasmModule, wasm;
1792
+ function __wbg_finalize_init(instance, module) {
1793
+ wasm = instance.exports;
1794
+ wasmModule = module;
1795
+ cachedDataViewMemory0 = null;
1796
+ cachedUint8ArrayMemory0 = null;
1797
+ wasm.__wbindgen_start();
1798
+ return wasm;
1799
+ }
1800
+
1801
+ async function __wbg_load(module, imports) {
1802
+ if (typeof Response === 'function' && module instanceof Response) {
1803
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1804
+ try {
1805
+ return await WebAssembly.instantiateStreaming(module, imports);
1806
+ } catch (e) {
1807
+ const validResponse = module.ok && expectedResponseType(module.type);
1808
+
1809
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1810
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1811
+
1812
+ } else { throw e; }
1813
+ }
1814
+ }
1815
+
1816
+ const bytes = await module.arrayBuffer();
1817
+ return await WebAssembly.instantiate(bytes, imports);
1818
+ } else {
1819
+ const instance = await WebAssembly.instantiate(module, imports);
1820
+
1821
+ if (instance instanceof WebAssembly.Instance) {
1822
+ return { instance, module };
1823
+ } else {
1824
+ return instance;
1825
+ }
1826
+ }
1827
+
1828
+ function expectedResponseType(type) {
1829
+ switch (type) {
1830
+ case 'basic': case 'cors': case 'default': return true;
1831
+ }
1832
+ return false;
1833
+ }
1834
+ }
1835
+
1836
+ function initSync(module) {
1837
+ if (wasm !== undefined) return wasm;
1838
+
1839
+
1840
+ if (module !== undefined) {
1841
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1842
+ ({module} = module)
1843
+ } else {
1844
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1845
+ }
1846
+ }
1847
+
1848
+ const imports = __wbg_get_imports();
1849
+ if (!(module instanceof WebAssembly.Module)) {
1850
+ module = new WebAssembly.Module(module);
1851
+ }
1852
+ const instance = new WebAssembly.Instance(module, imports);
1853
+ return __wbg_finalize_init(instance, module);
1854
+ }
1855
+
1856
+ async function __wbg_init(module_or_path) {
1857
+ if (wasm !== undefined) return wasm;
1858
+
1859
+
1860
+ if (module_or_path !== undefined) {
1861
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1862
+ ({module_or_path} = module_or_path)
1863
+ } else {
1864
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1865
+ }
1866
+ }
1867
+
1868
+ if (module_or_path === undefined) {
1869
+ module_or_path = new URL('kreuzberg_wasm_bg.wasm', import.meta.url);
1870
+ }
1871
+ const imports = __wbg_get_imports();
1872
+
1873
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1874
+ module_or_path = fetch(module_or_path);
1875
+ }
1876
+
1877
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1878
+
1879
+ return __wbg_finalize_init(instance, module);
1880
+ }
1881
+
1882
+ export { initSync, __wbg_init as default };