@clazic/kordoc 2.2.8 → 2.2.9

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/utils.ts
4
- var VERSION = true ? "2.2.8" : "0.0.0-dev";
4
+ var VERSION = true ? "2.2.9" : "0.0.0-dev";
5
5
  function toArrayBuffer(buf) {
6
6
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
7
7
  return buf.buffer;
@@ -90,4 +90,4 @@ export {
90
90
  sanitizeHref,
91
91
  classifyError
92
92
  };
93
- //# sourceMappingURL=chunk-6KLTURMA.js.map
93
+ //# sourceMappingURL=chunk-FF5M4SDK.js.map
@@ -6,7 +6,7 @@ import {
6
6
  precheckZipSize,
7
7
  sanitizeHref,
8
8
  toArrayBuffer
9
- } from "./chunk-6KLTURMA.js";
9
+ } from "./chunk-FF5M4SDK.js";
10
10
  import {
11
11
  parsePageRange
12
12
  } from "./chunk-MOL7MDBG.js";
@@ -5419,21 +5419,28 @@ async function parsePdfDocument(buffer, options) {
5419
5419
  }
5420
5420
  }
5421
5421
  if (ocrProvider) {
5422
+ let ocrBlocks = [];
5422
5423
  try {
5423
5424
  const { ocrPages } = await import("./provider-I3XGSVL6.js");
5424
5425
  const concurrency = options?.ocrConcurrency ?? 1;
5425
- const ocrBlocks = await ocrPages(doc, ocrProvider, pageFilter, effectivePageCount, warnings, concurrency);
5426
- if (ocrBlocks.length > 0) {
5427
- const ocrMarkdown = blocksToMarkdown(ocrBlocks);
5428
- return {
5429
- markdown: ocrMarkdown,
5430
- blocks: ocrBlocks,
5431
- metadata,
5432
- warnings: warnings.length > 0 ? warnings : void 0,
5433
- isImageBased: true
5434
- };
5435
- }
5426
+ ocrBlocks = await ocrPages(doc, ocrProvider, pageFilter, effectivePageCount, warnings, concurrency);
5436
5427
  } catch {
5428
+ } finally {
5429
+ const terminable = ocrProvider;
5430
+ if (typeof terminable.terminate === "function") {
5431
+ await terminable.terminate().catch(() => {
5432
+ });
5433
+ }
5434
+ }
5435
+ if (ocrBlocks.length > 0) {
5436
+ const ocrMarkdown = blocksToMarkdown(ocrBlocks);
5437
+ return {
5438
+ markdown: ocrMarkdown,
5439
+ blocks: ocrBlocks,
5440
+ metadata,
5441
+ warnings: warnings.length > 0 ? warnings : void 0,
5442
+ isImageBased: true
5443
+ };
5437
5444
  }
5438
5445
  }
5439
5446
  if (ocrMode === "off") {
@@ -9616,4 +9623,4 @@ export {
9616
9623
  cfb/cfb.js:
9617
9624
  (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
9618
9625
  */
9619
- //# sourceMappingURL=chunk-FC6BQOWD.js.map
9626
+ //# sourceMappingURL=chunk-OL2NDK3E.js.map