@clazic/kordoc 2.7.1 → 2.7.3

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/index.js CHANGED
@@ -3112,7 +3112,7 @@ import JSZip2 from "jszip";
3112
3112
  import { DOMParser } from "@xmldom/xmldom";
3113
3113
 
3114
3114
  // src/utils.ts
3115
- var VERSION = true ? "2.7.1" : "0.0.0-dev";
3115
+ var VERSION = true ? "2.7.3" : "0.0.0-dev";
3116
3116
  function toArrayBuffer(buf) {
3117
3117
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
3118
3118
  return buf.buffer;
@@ -11234,19 +11234,19 @@ var CACHE_DIR = join4(homedir(), ".cache", "kordoc", "libreoffice");
11234
11234
  var VERSION_FILE = join4(CACHE_DIR, "version");
11235
11235
  var PACKAGES = {
11236
11236
  darwin: {
11237
- url: "https://download.documentfoundation.org/libreoffice/stable/24.8.4/mac/x86_64/LibreOffice_24.8.4_MacOS_x86-64.dmg",
11237
+ url: "https://ftp.osuosl.org/pub/tdf/libreoffice/stable/26.2.3/mac/x86_64/LibreOffice_26.2.3_MacOS_x86-64.dmg",
11238
11238
  binPath: "LibreOffice.app/Contents/MacOS/soffice",
11239
11239
  sizeMb: 300
11240
11240
  },
11241
11241
  linux: {
11242
- url: "https://download.documentfoundation.org/libreoffice/stable/24.8.4/deb/x86_64/LibreOffice_24.8.4_Linux_x86-64_deb.tar.gz",
11243
- binPath: "opt/libreoffice24.8/program/soffice",
11244
- sizeMb: 200
11242
+ url: "https://ftp.osuosl.org/pub/tdf/libreoffice/stable/26.2.3/deb/x86_64/LibreOffice_26.2.3_Linux_x86-64_deb.tar.gz",
11243
+ binPath: "opt/libreoffice26.2/program/soffice",
11244
+ sizeMb: 210
11245
11245
  },
11246
11246
  win32: {
11247
- url: "https://download.documentfoundation.org/libreoffice/stable/24.8.4/win/x86_64/LibreOffice_24.8.4_Win_x86-64.msi",
11247
+ url: "https://ftp.osuosl.org/pub/tdf/libreoffice/stable/26.2.3/win/x86_64/LibreOffice_26.2.3_Win_x86-64.msi",
11248
11248
  binPath: "LibreOffice/program/soffice.exe",
11249
- sizeMb: 350
11249
+ sizeMb: 360
11250
11250
  }
11251
11251
  };
11252
11252
  async function findInPath() {
@@ -11299,6 +11299,7 @@ async function findInDefaultPaths() {
11299
11299
  }
11300
11300
  async function downloadWithProgress(url, dest, totalBytes, onProgress) {
11301
11301
  const response = await fetch(url);
11302
+ if (!response.ok) throw new Error(`\uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328: HTTP ${response.status} (${url})`);
11302
11303
  if (!response.body) throw new Error("\uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328: response body \uC5C6\uC74C");
11303
11304
  const file = createWriteStream(dest);
11304
11305
  const reader = response.body.getReader();
@@ -11471,14 +11472,15 @@ async function resolveSoffice(emitter, autoInstall = true) {
11471
11472
 
11472
11473
  // src/convert/libreoffice.ts
11473
11474
  var libreConvert = libre.convert;
11474
- async function convertBuffer(buffer, targetExt, timeoutMs = 6e4) {
11475
+ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
11475
11476
  return new Promise((resolve4, reject) => {
11476
11477
  const timer = setTimeout(() => {
11477
11478
  reject(
11478
11479
  new ConvertError("TIMEOUT", `\uBCC0\uD658 \uD0C0\uC784\uC544\uC6C3 (${timeoutMs}ms \uCD08\uACFC)`)
11479
11480
  );
11480
11481
  }, timeoutMs);
11481
- libreConvert(buffer, targetExt, void 0, (err, done) => {
11482
+ const opts = sofficePath ? { sofficeBinaryPaths: [sofficePath] } : void 0;
11483
+ libreConvert(buffer, targetExt, opts, (err, done) => {
11482
11484
  clearTimeout(timer);
11483
11485
  if (err || !done) {
11484
11486
  reject(
@@ -11646,7 +11648,7 @@ async function convertToPdf(input, options) {
11646
11648
  try {
11647
11649
  emitter.convertStart("\uBCC0\uD658 \uC2DC\uC791...");
11648
11650
  emitter.progress(10, "\uBCC0\uD658 \uC911...");
11649
- const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs);
11651
+ const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath);
11650
11652
  emitter.progress(100, "\uBCC0\uD658 \uC644\uB8CC");
11651
11653
  emitter.convertDone("\uBCC0\uD658 \uC644\uB8CC");
11652
11654
  const result = {
@@ -11999,16 +12001,18 @@ async function runUnifiedOcrPipeline(inputPath, options = {}) {
11999
12001
  }
12000
12002
  });
12001
12003
  }
12004
+ let resolvedSofficePath;
12002
12005
  if (options.sofficePath) {
12003
12006
  const sofficeDir = dirname3(options.sofficePath);
12004
12007
  process.env.PATH = `${sofficeDir}${delimiter2}${process.env.PATH ?? ""}`;
12005
12008
  convertEmitter.validate("soffice_found", "\uC9C1\uC811 \uC9C0\uC815\uB41C LibreOffice \uACBD\uB85C \uC0AC\uC6A9", { sofficePath: options.sofficePath });
12009
+ resolvedSofficePath = options.sofficePath;
12006
12010
  } else {
12007
- await resolveSoffice(convertEmitter, options.autoInstallLibreOffice ?? false);
12011
+ resolvedSofficePath = await resolveSoffice(convertEmitter, options.autoInstallLibreOffice ?? false);
12008
12012
  }
12009
12013
  workingPdfPath = join5(workspaceDir, `${stem}.pdf`);
12010
12014
  const inputBuffer = await readFile2(absInput);
12011
- const out = await convertBuffer(inputBuffer, ".pdf");
12015
+ const out = await convertBuffer(inputBuffer, ".pdf", 5 * 6e4, resolvedSofficePath);
12012
12016
  await writeFile2(workingPdfPath, out);
12013
12017
  }
12014
12018
  timingsMs.convert = elapsedMs(convertStart);