@clazic/kordoc 2.7.3 → 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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/utils.ts
4
- var VERSION = true ? "2.7.3" : "0.0.0-dev";
4
+ var VERSION = true ? "2.7.4" : "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;
@@ -105,4 +105,4 @@ export {
105
105
  classifyError,
106
106
  normalizeKordocError
107
107
  };
108
- //# sourceMappingURL=chunk-CIR4TB4K.js.map
108
+ //# sourceMappingURL=chunk-5CIZV5C3.js.map
@@ -7,7 +7,7 @@ import {
7
7
  precheckZipSize,
8
8
  sanitizeHref,
9
9
  toArrayBuffer
10
- } from "./chunk-CIR4TB4K.js";
10
+ } from "./chunk-5CIZV5C3.js";
11
11
  import {
12
12
  parsePageRange
13
13
  } from "./chunk-MOL7MDBG.js";
@@ -9956,8 +9956,13 @@ async function installForPlatform(pkg, onProgress) {
9956
9956
  async function installMacOS(pkg, downloadPath) {
9957
9957
  const mountPoint = `/Volumes/LibreOffice_${Date.now()}`;
9958
9958
  await new Promise((resolve2, reject) => {
9959
- const child = spawn("hdiutil", ["attach", "-nobrowse", "-mountpoint", mountPoint, downloadPath]);
9960
- child.on("close", (code) => code === 0 ? resolve2() : reject(new Error("dmg \uB9C8\uC6B4\uD2B8 \uC2E4\uD328")));
9959
+ const stderr = [];
9960
+ const child = spawn("hdiutil", ["attach", "-nobrowse", "-noverify", "-mountpoint", mountPoint, downloadPath]);
9961
+ child.stderr?.on("data", (d) => stderr.push(d.toString()));
9962
+ child.on(
9963
+ "close",
9964
+ (code) => code === 0 ? resolve2() : reject(new Error(`dmg \uB9C8\uC6B4\uD2B8 \uC2E4\uD328 (code=${code}): ${stderr.join("").trim()}`))
9965
+ );
9961
9966
  });
9962
9967
  try {
9963
9968
  const appSource = join2(mountPoint, "LibreOffice.app");
@@ -10085,15 +10090,15 @@ async function resolveSoffice(emitter, autoInstall = true) {
10085
10090
 
10086
10091
  // src/convert/libreoffice.ts
10087
10092
  var libreConvert = libre.convert;
10088
- async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
10093
+ var libreConvertWithOptions = libre.convertWithOptions;
10094
+ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath, sourceExt) {
10089
10095
  return new Promise((resolve2, reject) => {
10090
10096
  const timer = setTimeout(() => {
10091
10097
  reject(
10092
10098
  new ConvertError("TIMEOUT", `\uBCC0\uD658 \uD0C0\uC784\uC544\uC6C3 (${timeoutMs}ms \uCD08\uACFC)`)
10093
10099
  );
10094
10100
  }, timeoutMs);
10095
- const opts = sofficePath ? { sofficeBinaryPaths: [sofficePath] } : void 0;
10096
- libreConvert(buffer, targetExt, opts, (err, done) => {
10101
+ const cb = (err, done) => {
10097
10102
  clearTimeout(timer);
10098
10103
  if (err || !done) {
10099
10104
  reject(
@@ -10105,7 +10110,13 @@ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
10105
10110
  return;
10106
10111
  }
10107
10112
  resolve2(done);
10108
- });
10113
+ };
10114
+ if (sofficePath) {
10115
+ const fileName = sourceExt ? `source${sourceExt}` : "source";
10116
+ libreConvertWithOptions(buffer, targetExt, void 0, { sofficeBinaryPaths: [sofficePath], fileName }, cb);
10117
+ } else {
10118
+ libreConvert(buffer, targetExt, void 0, cb);
10119
+ }
10109
10120
  });
10110
10121
  }
10111
10122
 
@@ -10261,7 +10272,8 @@ async function convertToPdf(input, options) {
10261
10272
  try {
10262
10273
  emitter.convertStart("\uBCC0\uD658 \uC2DC\uC791...");
10263
10274
  emitter.progress(10, "\uBCC0\uD658 \uC911...");
10264
- const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath);
10275
+ const sourceExt = format === "hwpx" ? ".hwpx" : ".hwp";
10276
+ const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath, sourceExt);
10265
10277
  emitter.progress(100, "\uBCC0\uD658 \uC644\uB8CC");
10266
10278
  emitter.convertDone("\uBCC0\uD658 \uC644\uB8CC");
10267
10279
  const result = {
@@ -10691,4 +10703,4 @@ export {
10691
10703
  cfb/cfb.js:
10692
10704
  (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
10693
10705
  */
10694
- //# sourceMappingURL=chunk-WE7MWE73.js.map
10706
+ //# sourceMappingURL=chunk-6DUCYZRR.js.map