@clazic/kordoc 2.7.4 → 2.7.5

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-EJZO6DUI.js";
8
+ } from "./chunk-6DUCYZRR.js";
9
9
  import {
10
10
  VERSION,
11
11
  toArrayBuffer
12
- } from "./chunk-CIR4TB4K.js";
12
+ } from "./chunk-5CIZV5C3.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-LYW4Z2Z6.js");
177
+ const { sanitizeError } = await import("./utils-NR7YWMWB.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-LYW4Z2Z6.js");
259
+ const { sanitizeError } = await import("./utils-NR7YWMWB.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-LYW4Z2Z6.js");
340
+ const { sanitizeError } = await import("./utils-NR7YWMWB.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-CVSZKJE3.js");
372
+ const { watchDirectory } = await import("./watch-LDX5GPEE.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.3" : "0.0.0-dev";
3140
+ var VERSION = true ? "2.7.4" : "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;
@@ -11503,7 +11503,7 @@ async function resolveSoffice(emitter, autoInstall = true) {
11503
11503
  // src/convert/libreoffice.ts
11504
11504
  var libreConvert = import_libreoffice_convert.default.convert;
11505
11505
  var libreConvertWithOptions = import_libreoffice_convert.default.convertWithOptions;
11506
- async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
11506
+ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath, sourceExt) {
11507
11507
  return new Promise((resolve4, reject) => {
11508
11508
  const timer = setTimeout(() => {
11509
11509
  reject(
@@ -11524,7 +11524,8 @@ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
11524
11524
  resolve4(done);
11525
11525
  };
11526
11526
  if (sofficePath) {
11527
- libreConvertWithOptions(buffer, targetExt, void 0, { sofficeBinaryPaths: [sofficePath] }, cb);
11527
+ const fileName = sourceExt ? `source${sourceExt}` : "source";
11528
+ libreConvertWithOptions(buffer, targetExt, void 0, { sofficeBinaryPaths: [sofficePath], fileName }, cb);
11528
11529
  } else {
11529
11530
  libreConvert(buffer, targetExt, void 0, cb);
11530
11531
  }
@@ -11683,7 +11684,8 @@ async function convertToPdf(input, options) {
11683
11684
  try {
11684
11685
  emitter.convertStart("\uBCC0\uD658 \uC2DC\uC791...");
11685
11686
  emitter.progress(10, "\uBCC0\uD658 \uC911...");
11686
- const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath);
11687
+ const sourceExt = format === "hwpx" ? ".hwpx" : ".hwp";
11688
+ const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath, sourceExt);
11687
11689
  emitter.progress(100, "\uBCC0\uD658 \uC644\uB8CC");
11688
11690
  emitter.convertDone("\uBCC0\uD658 \uC644\uB8CC");
11689
11691
  const result = {
@@ -12047,7 +12049,8 @@ async function runUnifiedOcrPipeline(inputPath, options = {}) {
12047
12049
  }
12048
12050
  workingPdfPath = (0, import_path6.join)(workspaceDir, `${stem}.pdf`);
12049
12051
  const inputBuffer = await (0, import_promises4.readFile)(absInput);
12050
- const out = await convertBuffer(inputBuffer, ".pdf", 5 * 6e4, resolvedSofficePath);
12052
+ const sourceExt = (0, import_path6.extname)(absInput).toLowerCase();
12053
+ const out = await convertBuffer(inputBuffer, ".pdf", 5 * 6e4, resolvedSofficePath, sourceExt);
12051
12054
  await (0, import_promises4.writeFile)(workingPdfPath, out);
12052
12055
  }
12053
12056
  timingsMs.convert = elapsedMs(convertStart);