kordoc 4.4.0 → 4.4.1

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.
Files changed (82) hide show
  1. package/README.md +9 -3
  2. package/dist/{-R6NUMPRV.js → -7X4H77Z7.js} +8 -8
  3. package/dist/{chunk-YOZ7ZRCD.js → chunk-2352RXHG.js} +8 -8
  4. package/dist/{chunk-SKM6KZUH.cjs → chunk-3DX6VJGH.cjs} +9 -9
  5. package/dist/{chunk-SKM6KZUH.cjs.map → chunk-3DX6VJGH.cjs.map} +1 -1
  6. package/dist/{chunk-GHGZU2LQ.js → chunk-5A2TGIN7.js} +2 -2
  7. package/dist/{chunk-65DYCXGC.js → chunk-5PXCA3DN.js} +3 -3
  8. package/dist/{chunk-H2KMJOB6.cjs → chunk-7BIVNIK5.cjs} +2 -2
  9. package/dist/{chunk-H2KMJOB6.cjs.map → chunk-7BIVNIK5.cjs.map} +1 -1
  10. package/dist/{chunk-HNRULYUH.js → chunk-7MDLAKVO.js} +2 -2
  11. package/dist/{chunk-YVYU267E.js → chunk-AYM6UHFX.js} +2 -2
  12. package/dist/chunk-AYM6UHFX.js.map +1 -0
  13. package/dist/{chunk-AB322K3O.cjs → chunk-FR65WNLF.cjs} +3 -3
  14. package/dist/{chunk-AB322K3O.cjs.map → chunk-FR65WNLF.cjs.map} +1 -1
  15. package/dist/{chunk-UDGPM5R5.cjs → chunk-GC7WBHAN.cjs} +4 -4
  16. package/dist/{chunk-UDGPM5R5.cjs.map → chunk-GC7WBHAN.cjs.map} +1 -1
  17. package/dist/{chunk-W6CUD7V3.js → chunk-HGSO2H44.js} +2 -2
  18. package/dist/{chunk-RZURSA4N.js → chunk-IPOVUGXD.js} +3 -3
  19. package/dist/{chunk-5KLE3U23.js → chunk-JGHQFUKI.js} +2 -2
  20. package/dist/{chunk-V35DRUJC.js → chunk-NUGTEPKT.js} +2 -2
  21. package/dist/{chunk-QXYB74QF.js → chunk-SMPEZINI.js} +2 -2
  22. package/dist/{chunk-ONS7JKVA.js → chunk-T25FBUMN.js} +2 -2
  23. package/dist/{chunk-HFJF477F.js → chunk-TGAWXMXB.js} +2 -2
  24. package/dist/chunk-TGAWXMXB.js.map +1 -0
  25. package/dist/{chunk-XCIC7U6Y.js → chunk-UA53AA7R.js} +2 -2
  26. package/dist/{chunk-P7YPCK7C.js → chunk-WA7XLWZW.js} +2 -2
  27. package/dist/chunks-FMZK4QHL.js +10 -0
  28. package/dist/cli.js +16 -16
  29. package/dist/{image-ocr-U2DRRFL3.js → image-ocr-AHHY42OI.js} +4 -4
  30. package/dist/{image-ocr-XC52AQDV.js → image-ocr-K4XCRBTY.js} +4 -4
  31. package/dist/{image-ocr-F2BQA26V.cjs → image-ocr-VCXLT5Q6.cjs} +10 -10
  32. package/dist/{image-ocr-F2BQA26V.cjs.map → image-ocr-VCXLT5Q6.cjs.map} +1 -1
  33. package/dist/index.cjs +178 -178
  34. package/dist/index.js +4 -4
  35. package/dist/mcp.js +26 -24
  36. package/dist/mcp.js.map +1 -1
  37. package/dist/{parser-FFQN67O6.cjs → parser-ABYM2MVN.cjs} +24 -24
  38. package/dist/{parser-FFQN67O6.cjs.map → parser-ABYM2MVN.cjs.map} +1 -1
  39. package/dist/{parser-ESGFWWCT.js → parser-I3ELUUOG.js} +5 -5
  40. package/dist/{parser-TFPGQWCC.js → parser-IPVY56U3.js} +5 -5
  41. package/dist/pdf-ocr-EL3VSWWY.js +12 -0
  42. package/dist/{pdf-ocr-WE5TMRFU.js → pdf-ocr-FVLKQNAT.js} +4 -4
  43. package/dist/pdf-ocr-VQ3QWXGE.cjs +13 -0
  44. package/dist/{pdf-ocr-UQBZH3HE.cjs.map → pdf-ocr-VQ3QWXGE.cjs.map} +1 -1
  45. package/dist/{profile-io-O6BDCUJN.js → profile-io-YADU6SKH.js} +3 -3
  46. package/dist/{rasterize-V22VCCE7.js → rasterize-YV5VDSQX.js} +2 -2
  47. package/dist/render-K6M3P24X.js +10 -0
  48. package/dist/seal-YW3U5BCY.js +10 -0
  49. package/dist/{watch-HGKBICED.js → watch-5K2ZERXI.js} +8 -8
  50. package/package.json +1 -1
  51. package/dist/chunk-HFJF477F.js.map +0 -1
  52. package/dist/chunk-YVYU267E.js.map +0 -1
  53. package/dist/chunks-QMGCI5DG.js +0 -10
  54. package/dist/pdf-ocr-4R646OO6.js +0 -12
  55. package/dist/pdf-ocr-UQBZH3HE.cjs +0 -13
  56. package/dist/render-3BSVTTZE.js +0 -10
  57. package/dist/seal-6ZSEJVOD.js +0 -10
  58. /package/dist/{-R6NUMPRV.js.map → -7X4H77Z7.js.map} +0 -0
  59. /package/dist/{chunk-YOZ7ZRCD.js.map → chunk-2352RXHG.js.map} +0 -0
  60. /package/dist/{chunk-GHGZU2LQ.js.map → chunk-5A2TGIN7.js.map} +0 -0
  61. /package/dist/{chunk-65DYCXGC.js.map → chunk-5PXCA3DN.js.map} +0 -0
  62. /package/dist/{chunk-HNRULYUH.js.map → chunk-7MDLAKVO.js.map} +0 -0
  63. /package/dist/{chunk-W6CUD7V3.js.map → chunk-HGSO2H44.js.map} +0 -0
  64. /package/dist/{chunk-RZURSA4N.js.map → chunk-IPOVUGXD.js.map} +0 -0
  65. /package/dist/{chunk-5KLE3U23.js.map → chunk-JGHQFUKI.js.map} +0 -0
  66. /package/dist/{chunk-V35DRUJC.js.map → chunk-NUGTEPKT.js.map} +0 -0
  67. /package/dist/{chunk-QXYB74QF.js.map → chunk-SMPEZINI.js.map} +0 -0
  68. /package/dist/{chunk-ONS7JKVA.js.map → chunk-T25FBUMN.js.map} +0 -0
  69. /package/dist/{chunk-XCIC7U6Y.js.map → chunk-UA53AA7R.js.map} +0 -0
  70. /package/dist/{chunk-P7YPCK7C.js.map → chunk-WA7XLWZW.js.map} +0 -0
  71. /package/dist/{chunks-QMGCI5DG.js.map → chunks-FMZK4QHL.js.map} +0 -0
  72. /package/dist/{image-ocr-U2DRRFL3.js.map → image-ocr-AHHY42OI.js.map} +0 -0
  73. /package/dist/{image-ocr-XC52AQDV.js.map → image-ocr-K4XCRBTY.js.map} +0 -0
  74. /package/dist/{parser-ESGFWWCT.js.map → parser-I3ELUUOG.js.map} +0 -0
  75. /package/dist/{parser-TFPGQWCC.js.map → parser-IPVY56U3.js.map} +0 -0
  76. /package/dist/{pdf-ocr-4R646OO6.js.map → pdf-ocr-EL3VSWWY.js.map} +0 -0
  77. /package/dist/{pdf-ocr-WE5TMRFU.js.map → pdf-ocr-FVLKQNAT.js.map} +0 -0
  78. /package/dist/{profile-io-O6BDCUJN.js.map → profile-io-YADU6SKH.js.map} +0 -0
  79. /package/dist/{rasterize-V22VCCE7.js.map → rasterize-YV5VDSQX.js.map} +0 -0
  80. /package/dist/{render-3BSVTTZE.js.map → render-K6M3P24X.js.map} +0 -0
  81. /package/dist/{seal-6ZSEJVOD.js.map → seal-YW3U5BCY.js.map} +0 -0
  82. /package/dist/{watch-HGKBICED.js.map → watch-5K2ZERXI.js.map} +0 -0
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  flattenLayoutTables,
9
9
  inlineImagesIntoMarkdown,
10
10
  mapPuaText
11
- } from "./chunk-XCIC7U6Y.js";
11
+ } from "./chunk-UA53AA7R.js";
12
12
  import {
13
13
  parsePageRange
14
14
  } from "./chunk-GE43BE46.js";
@@ -27,7 +27,7 @@ import {
27
27
  sanitizeHref,
28
28
  stripDtd,
29
29
  toArrayBuffer
30
- } from "./chunk-ONS7JKVA.js";
30
+ } from "./chunk-T25FBUMN.js";
31
31
 
32
32
  // src/index.ts
33
33
  import { readFile } from "fs/promises";
@@ -31062,7 +31062,7 @@ async function parse(input, options) {
31062
31062
  }
31063
31063
  async function parseImage(buffer, options) {
31064
31064
  try {
31065
- const { parseImageDocument } = await import("./image-ocr-U2DRRFL3.js");
31065
+ const { parseImageDocument } = await import("./image-ocr-AHHY42OI.js");
31066
31066
  const { blocks, warnings } = await parseImageDocument(buffer, options);
31067
31067
  return {
31068
31068
  success: true,
@@ -31121,7 +31121,7 @@ async function parseHwp(buffer, options) {
31121
31121
  async function parsePdf(buffer, options) {
31122
31122
  let parsePdfDocument;
31123
31123
  try {
31124
- const mod = await import("./parser-TFPGQWCC.js");
31124
+ const mod = await import("./parser-IPVY56U3.js");
31125
31125
  parsePdfDocument = mod.parsePdfDocument;
31126
31126
  } catch {
31127
31127
  return {
package/dist/mcp.js CHANGED
@@ -37,25 +37,25 @@ import {
37
37
  readBuiltinTemplate,
38
38
  resolveBuiltinTemplate,
39
39
  unknownFontWarnings
40
- } from "./chunk-YOZ7ZRCD.js";
40
+ } from "./chunk-2352RXHG.js";
41
41
  import "./chunk-7FCNOKOR.js";
42
42
  import "./chunk-A73RMJ6B.js";
43
43
  import "./chunk-MOL7MDBG.js";
44
- import "./chunk-RZURSA4N.js";
44
+ import "./chunk-IPOVUGXD.js";
45
45
  import "./chunk-DZIXKL7E.js";
46
- import "./chunk-HNRULYUH.js";
46
+ import "./chunk-7MDLAKVO.js";
47
47
  import {
48
48
  blocksToMarkdown
49
- } from "./chunk-QXYB74QF.js";
50
- import "./chunk-65DYCXGC.js";
51
- import "./chunk-5KLE3U23.js";
49
+ } from "./chunk-SMPEZINI.js";
50
+ import "./chunk-5PXCA3DN.js";
51
+ import "./chunk-JGHQFUKI.js";
52
52
  import {
53
53
  KordocError,
54
54
  VERSION,
55
55
  classifyError,
56
56
  sanitizeError,
57
57
  toArrayBuffer
58
- } from "./chunk-P7YPCK7C.js";
58
+ } from "./chunk-WA7XLWZW.js";
59
59
 
60
60
  // src/mcp.ts
61
61
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -66,6 +66,7 @@ import { readFile, writeFile, mkdir, stat } from "fs/promises";
66
66
  import { pathToFileURL } from "url";
67
67
  import { resolve, isAbsolute, extname, dirname, basename } from "path";
68
68
  var ALLOWED_EXTENSIONS = /* @__PURE__ */ new Set([".hwp", ".hwpx", ".hml", ".pdf", ".xls", ".xlsx", ".docx"]);
69
+ var PARSE_EXTENSIONS = /* @__PURE__ */ new Set([...ALLOWED_EXTENSIONS, ".png", ".jpg", ".jpeg", ".webp"]);
69
70
  var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp"]);
70
71
  var PROFILE_EXTENSIONS = /* @__PURE__ */ new Set([".json"]);
71
72
  var MAX_FILE_SIZE = 500 * 1024 * 1024;
@@ -175,7 +176,7 @@ server.tool(
175
176
  },
176
177
  async ({ file_path, ocr, remove_header_footer, formula_ocr, dedupe_running_headers, keep_trailing_empty_cols, keep_empty_paragraphs, password }) => {
177
178
  try {
178
- const { buffer, resolved } = await readValidatedFile(file_path);
179
+ const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
179
180
  const format = detectFormat(buffer);
180
181
  if (format === "unknown") {
181
182
  return {
@@ -242,13 +243,13 @@ server.tool(
242
243
  },
243
244
  async ({ file_path }) => {
244
245
  try {
245
- const resolved = safePath(file_path);
246
+ const resolved = safePath(file_path, PARSE_EXTENSIONS);
246
247
  let format = detectFormatFromHeader(resolved);
247
248
  if (format === "hwpx") {
248
- const { buffer } = await readValidatedFile(file_path);
249
+ const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
249
250
  format = await detectZipFormat(buffer);
250
251
  } else if (format === "hwp") {
251
- const { buffer } = await readValidatedFile(file_path);
252
+ const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
252
253
  const ole2Format = detectOle2Format(buffer);
253
254
  if (ole2Format !== "unknown") format = ole2Format;
254
255
  }
@@ -271,7 +272,7 @@ server.tool(
271
272
  },
272
273
  async ({ file_path }) => {
273
274
  try {
274
- const resolved = safePath(file_path);
275
+ const resolved = safePath(file_path, PARSE_EXTENSIONS);
275
276
  const format = detectFormatFromHeader(resolved);
276
277
  if (format === "unknown") {
277
278
  return {
@@ -279,7 +280,7 @@ server.tool(
279
280
  isError: true
280
281
  };
281
282
  }
282
- const { buffer } = await readValidatedFile(file_path, MAX_METADATA_FILE_SIZE);
283
+ const { buffer } = await readValidatedFile(file_path, MAX_METADATA_FILE_SIZE, PARSE_EXTENSIONS);
283
284
  let metadata;
284
285
  let effectiveFormat = format;
285
286
  if (format === "hwpx") {
@@ -297,7 +298,7 @@ server.tool(
297
298
  break;
298
299
  case "pdf":
299
300
  try {
300
- const { extractPdfMetadataOnly } = await import("./parser-ESGFWWCT.js");
301
+ const { extractPdfMetadataOnly } = await import("./parser-I3ELUUOG.js");
301
302
  metadata = await extractPdfMetadataOnly(buffer);
302
303
  } catch {
303
304
  metadata = void 0;
@@ -336,8 +337,8 @@ server.tool(
336
337
  },
337
338
  async ({ file_path, pages }) => {
338
339
  try {
339
- const resolved = safePath(file_path);
340
- const { buffer } = await readValidatedFile(file_path);
340
+ const resolved = safePath(file_path, PARSE_EXTENSIONS);
341
+ const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
341
342
  const format = detectFormat(buffer);
342
343
  if (format === "unknown") {
343
344
  return {
@@ -379,7 +380,7 @@ server.tool(
379
380
  },
380
381
  async ({ file_path, table_index }) => {
381
382
  try {
382
- const { buffer } = await readValidatedFile(file_path);
383
+ const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
383
384
  const format = detectFormat(buffer);
384
385
  if (format === "unknown") {
385
386
  return {
@@ -678,7 +679,7 @@ server.tool(
678
679
  }
679
680
  const image = new Uint8Array(await readFile(imgResolved));
680
681
  const ext = extname(imgResolved).slice(1).toLowerCase();
681
- const { placeSealHwpx } = await import("./seal-6ZSEJVOD.js");
682
+ const { placeSealHwpx } = await import("./seal-YW3U5BCY.js");
682
683
  const result = await placeSealHwpx(buffer, [{
683
684
  anchor,
684
685
  occurrence,
@@ -780,7 +781,7 @@ server.tool(
780
781
  }
781
782
  const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
782
783
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
783
- const { renderHwpxToSvg } = await import("./render-3BSVTTZE.js");
784
+ const { renderHwpxToSvg } = await import("./render-K6M3P24X.js");
784
785
  const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
785
786
  const summary = [
786
787
  `\uB80C\uB354 \uC644\uB8CC: ${result.pageCount}\uD398\uC774\uC9C0, ${Math.round(result.width)}x${Math.round(result.height)}pt (\uD14D\uC2A4\uD2B8 ${result.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${result.stats.images}\xB7\uD45C ${result.stats.tables})`,
@@ -792,7 +793,7 @@ server.tool(
792
793
  summary.push(`\uC800\uC7A5: ${outPath}`);
793
794
  return { content: [{ type: "text", text: summary.join("\n") }] };
794
795
  }
795
- const { rasterizeSvg } = await import("./rasterize-V22VCCE7.js");
796
+ const { rasterizeSvg } = await import("./rasterize-YV5VDSQX.js");
796
797
  const raster = await rasterizeSvg(result.svg, result.width, result.height);
797
798
  if (outPath) {
798
799
  await mkdir(dirname(outPath), { recursive: true });
@@ -885,12 +886,12 @@ server.tool(
885
886
  },
886
887
  async ({ file_path, granularity, include_table_cells }) => {
887
888
  try {
888
- const { buffer } = await readValidatedFile(file_path);
889
+ const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
889
890
  const parsed = await parse(buffer, { filePath: file_path });
890
891
  if (!parsed.success) {
891
892
  return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
892
893
  }
893
- const { blocksToChunks } = await import("./chunks-QMGCI5DG.js");
894
+ const { blocksToChunks } = await import("./chunks-FMZK4QHL.js");
894
895
  const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
895
896
  return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
896
897
  } catch (err) {
@@ -909,7 +910,7 @@ server.tool(
909
910
  try {
910
911
  const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
911
912
  const { buffer } = await readValidatedFile(hwpx_path);
912
- const { hwpxToProfile } = await import("./-R6NUMPRV.js");
913
+ const { hwpxToProfile } = await import("./-7X4H77Z7.js");
913
914
  const profile = await hwpxToProfile(buffer);
914
915
  await mkdir(dirname(out), { recursive: true });
915
916
  await writeFile(out, JSON.stringify(profile, null, 2));
@@ -992,7 +993,7 @@ server.tool(
992
993
  }
993
994
  let profile;
994
995
  if (profile_path) {
995
- const { parseFormatProfileJson } = await import("./profile-io-O6BDCUJN.js");
996
+ const { parseFormatProfileJson } = await import("./profile-io-YADU6SKH.js");
996
997
  profile = parseFormatProfileJson(await readFile(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
997
998
  }
998
999
  const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
@@ -1038,6 +1039,7 @@ if (autoStart) startMcpServer().catch((err) => {
1038
1039
  export {
1039
1040
  ALLOWED_EXTENSIONS,
1040
1041
  IMAGE_EXTENSIONS,
1042
+ PARSE_EXTENSIONS,
1041
1043
  PROFILE_EXTENSIONS,
1042
1044
  buildFillInputs,
1043
1045
  capResponseText,