@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/cli.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  markdownToHwpx,
6
6
  markdownToXlsx,
7
7
  parse
8
- } from "./chunk-FZJLIDFL.js";
8
+ } from "./chunk-WE7MWE73.js";
9
9
  import {
10
10
  VERSION,
11
11
  toArrayBuffer
12
- } from "./chunk-YIJCHZLO.js";
12
+ } from "./chunk-CIR4TB4K.js";
13
13
  import "./chunk-MOL7MDBG.js";
14
14
  import "./chunk-S7BHLD2V.js";
15
15
  import "./chunk-YW5G6BCJ.js";
@@ -174,7 +174,7 @@ async function runParse(files, opts) {
174
174
  saveImages(absPath);
175
175
  }
176
176
  } catch (err) {
177
- const { sanitizeError } = await import("./utils-MAETCW66.js");
177
+ const { sanitizeError } = await import("./utils-LYW4Z2Z6.js");
178
178
  process.stderr.write(`
179
179
  [kordoc] ERROR: ${fileName} \u2014 ${sanitizeError(err)}
180
180
  `);
@@ -256,7 +256,7 @@ program.command("convert <input>").description("\uB9C8\uD06C\uB2E4\uC6B4 \uD30C\
256
256
  `));
257
257
  }
258
258
  } catch (err) {
259
- const { sanitizeError } = await import("./utils-MAETCW66.js");
259
+ const { sanitizeError } = await import("./utils-LYW4Z2Z6.js");
260
260
  process.stderr.write(` FAIL
261
261
  `);
262
262
  process.stderr.write(` \u2192 ${sanitizeError(err)}
@@ -337,7 +337,7 @@ program.command("convert-pdf <input>").description("HWP/HWPX \uD30C\uC77C\uC744
337
337
  `);
338
338
  }
339
339
  } catch (err) {
340
- const { sanitizeError } = await import("./utils-MAETCW66.js");
340
+ const { sanitizeError } = await import("./utils-LYW4Z2Z6.js");
341
341
  process.stderr.write(` FAIL
342
342
  `);
343
343
  process.stderr.write(` \u2192 ${sanitizeError(err)}
@@ -369,7 +369,7 @@ program.command("init-env").description("kordoc\uC6A9 .env \uD15C\uD50C\uB9BF \u
369
369
  }
370
370
  });
371
371
  program.command("watch <dir>").description("\uB514\uB809\uD1A0\uB9AC \uAC10\uC2DC \u2014 \uC0C8 \uBB38\uC11C \uC790\uB3D9 \uBCC0\uD658").option("--webhook <url>", "\uACB0\uACFC \uC804\uC1A1 \uC6F9\uD6C5 URL").option("-d, --out-dir <dir>", "\uBCC0\uD658 \uACB0\uACFC \uCD9C\uB825 \uB514\uB809\uD1A0\uB9AC").option("-p, --pages <range>", "\uD398\uC774\uC9C0/\uC139\uC158 \uBC94\uC704").option("--format <type>", "\uCD9C\uB825 \uD615\uC2DD: markdown \uB610\uB294 json", "markdown").option("--silent", "\uC9C4\uD589 \uBA54\uC2DC\uC9C0 \uC228\uAE30\uAE30").action(async (dir, opts) => {
372
- const { watchDirectory } = await import("./watch-6HVRALTX.js");
372
+ const { watchDirectory } = await import("./watch-A4DEF4GF.js");
373
373
  await watchDirectory({
374
374
  dir,
375
375
  outDir: opts.outDir,
package/dist/index.cjs CHANGED
@@ -3137,7 +3137,7 @@ var import_jszip2 = __toESM(require("jszip"), 1);
3137
3137
  var import_xmldom = require("@xmldom/xmldom");
3138
3138
 
3139
3139
  // src/utils.ts
3140
- var VERSION = true ? "2.7.1" : "0.0.0-dev";
3140
+ var VERSION = true ? "2.7.3" : "0.0.0-dev";
3141
3141
  function toArrayBuffer(buf) {
3142
3142
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
3143
3143
  return buf.buffer;
@@ -11259,19 +11259,19 @@ var CACHE_DIR = (0, import_path5.join)((0, import_os3.homedir)(), ".cache", "kor
11259
11259
  var VERSION_FILE = (0, import_path5.join)(CACHE_DIR, "version");
11260
11260
  var PACKAGES = {
11261
11261
  darwin: {
11262
- url: "https://download.documentfoundation.org/libreoffice/stable/24.8.4/mac/x86_64/LibreOffice_24.8.4_MacOS_x86-64.dmg",
11262
+ url: "https://ftp.osuosl.org/pub/tdf/libreoffice/stable/26.2.3/mac/x86_64/LibreOffice_26.2.3_MacOS_x86-64.dmg",
11263
11263
  binPath: "LibreOffice.app/Contents/MacOS/soffice",
11264
11264
  sizeMb: 300
11265
11265
  },
11266
11266
  linux: {
11267
- url: "https://download.documentfoundation.org/libreoffice/stable/24.8.4/deb/x86_64/LibreOffice_24.8.4_Linux_x86-64_deb.tar.gz",
11268
- binPath: "opt/libreoffice24.8/program/soffice",
11269
- sizeMb: 200
11267
+ 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",
11268
+ binPath: "opt/libreoffice26.2/program/soffice",
11269
+ sizeMb: 210
11270
11270
  },
11271
11271
  win32: {
11272
- url: "https://download.documentfoundation.org/libreoffice/stable/24.8.4/win/x86_64/LibreOffice_24.8.4_Win_x86-64.msi",
11272
+ url: "https://ftp.osuosl.org/pub/tdf/libreoffice/stable/26.2.3/win/x86_64/LibreOffice_26.2.3_Win_x86-64.msi",
11273
11273
  binPath: "LibreOffice/program/soffice.exe",
11274
- sizeMb: 350
11274
+ sizeMb: 360
11275
11275
  }
11276
11276
  };
11277
11277
  async function findInPath() {
@@ -11324,6 +11324,7 @@ async function findInDefaultPaths() {
11324
11324
  }
11325
11325
  async function downloadWithProgress(url, dest, totalBytes, onProgress) {
11326
11326
  const response = await fetch(url);
11327
+ if (!response.ok) throw new Error(`\uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328: HTTP ${response.status} (${url})`);
11327
11328
  if (!response.body) throw new Error("\uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328: response body \uC5C6\uC74C");
11328
11329
  const file = (0, import_fs4.createWriteStream)(dest);
11329
11330
  const reader = response.body.getReader();
@@ -11496,14 +11497,15 @@ async function resolveSoffice(emitter, autoInstall = true) {
11496
11497
 
11497
11498
  // src/convert/libreoffice.ts
11498
11499
  var libreConvert = import_libreoffice_convert.default.convert;
11499
- async function convertBuffer(buffer, targetExt, timeoutMs = 6e4) {
11500
+ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
11500
11501
  return new Promise((resolve4, reject) => {
11501
11502
  const timer = setTimeout(() => {
11502
11503
  reject(
11503
11504
  new ConvertError("TIMEOUT", `\uBCC0\uD658 \uD0C0\uC784\uC544\uC6C3 (${timeoutMs}ms \uCD08\uACFC)`)
11504
11505
  );
11505
11506
  }, timeoutMs);
11506
- libreConvert(buffer, targetExt, void 0, (err, done) => {
11507
+ const opts = sofficePath ? { sofficeBinaryPaths: [sofficePath] } : void 0;
11508
+ libreConvert(buffer, targetExt, opts, (err, done) => {
11507
11509
  clearTimeout(timer);
11508
11510
  if (err || !done) {
11509
11511
  reject(
@@ -11671,7 +11673,7 @@ async function convertToPdf(input, options) {
11671
11673
  try {
11672
11674
  emitter.convertStart("\uBCC0\uD658 \uC2DC\uC791...");
11673
11675
  emitter.progress(10, "\uBCC0\uD658 \uC911...");
11674
- const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs);
11676
+ const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath);
11675
11677
  emitter.progress(100, "\uBCC0\uD658 \uC644\uB8CC");
11676
11678
  emitter.convertDone("\uBCC0\uD658 \uC644\uB8CC");
11677
11679
  const result = {
@@ -12024,16 +12026,18 @@ async function runUnifiedOcrPipeline(inputPath, options = {}) {
12024
12026
  }
12025
12027
  });
12026
12028
  }
12029
+ let resolvedSofficePath;
12027
12030
  if (options.sofficePath) {
12028
12031
  const sofficeDir = (0, import_path6.dirname)(options.sofficePath);
12029
12032
  process.env.PATH = `${sofficeDir}${import_path6.delimiter}${process.env.PATH ?? ""}`;
12030
12033
  convertEmitter.validate("soffice_found", "\uC9C1\uC811 \uC9C0\uC815\uB41C LibreOffice \uACBD\uB85C \uC0AC\uC6A9", { sofficePath: options.sofficePath });
12034
+ resolvedSofficePath = options.sofficePath;
12031
12035
  } else {
12032
- await resolveSoffice(convertEmitter, options.autoInstallLibreOffice ?? false);
12036
+ resolvedSofficePath = await resolveSoffice(convertEmitter, options.autoInstallLibreOffice ?? false);
12033
12037
  }
12034
12038
  workingPdfPath = (0, import_path6.join)(workspaceDir, `${stem}.pdf`);
12035
12039
  const inputBuffer = await (0, import_promises4.readFile)(absInput);
12036
- const out = await convertBuffer(inputBuffer, ".pdf");
12040
+ const out = await convertBuffer(inputBuffer, ".pdf", 5 * 6e4, resolvedSofficePath);
12037
12041
  await (0, import_promises4.writeFile)(workingPdfPath, out);
12038
12042
  }
12039
12043
  timingsMs.convert = elapsedMs(convertStart);