@clazic/kordoc 2.5.0 → 2.5.2

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 (44) hide show
  1. package/dist/batch-provider-XRF6F26E.js +234 -0
  2. package/dist/batch-provider-XRF6F26E.js.map +1 -0
  3. package/dist/{chunk-NKUNXGWI.js → chunk-25ZYYLVP.js} +8 -6
  4. package/dist/chunk-25ZYYLVP.js.map +1 -0
  5. package/dist/{chunk-IJGNPAK2.js → chunk-5CILZHRW.js} +2 -2
  6. package/dist/chunk-S7BHLD2V.js +200 -0
  7. package/dist/{chunk-Y4WFKJ5P.js.map → chunk-S7BHLD2V.js.map} +1 -1
  8. package/dist/cli.js +6 -38
  9. package/dist/cli.js.map +1 -1
  10. package/dist/index.cjs +473 -2816
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +4 -1
  13. package/dist/index.d.ts +4 -1
  14. package/dist/index.js +482 -2826
  15. package/dist/index.js.map +1 -1
  16. package/dist/mcp.js +3 -6
  17. package/dist/mcp.js.map +1 -1
  18. package/dist/{resolve-XWYJYKKH.js → resolve-ZSUEJK3E.js} +4 -4
  19. package/dist/{utils-RBXHHCLI.js → utils-H2BL5GNR.js} +2 -2
  20. package/dist/{watch-FRLS6FKE.js → watch-D6ODQLPJ.js} +4 -7
  21. package/dist/{watch-FRLS6FKE.js.map → watch-D6ODQLPJ.js.map} +1 -1
  22. package/package.json +3 -7
  23. package/dist/batch-provider-5BFJRKAZ.js +0 -190
  24. package/dist/batch-provider-5BFJRKAZ.js.map +0 -1
  25. package/dist/chunk-AEWWERJ5.js +0 -35
  26. package/dist/chunk-AEWWERJ5.js.map +0 -1
  27. package/dist/chunk-CPTOBJJD.js +0 -125
  28. package/dist/chunk-CPTOBJJD.js.map +0 -1
  29. package/dist/chunk-NKUNXGWI.js.map +0 -1
  30. package/dist/chunk-THBLCND6.js +0 -33
  31. package/dist/chunk-THBLCND6.js.map +0 -1
  32. package/dist/chunk-Y4WFKJ5P.js +0 -167
  33. package/dist/doctor-SJ7NYSXC.js +0 -126
  34. package/dist/doctor-SJ7NYSXC.js.map +0 -1
  35. package/dist/install-commands-P2KTEXQ4.js +0 -11
  36. package/dist/pm-7KGLH6MX.js +0 -9
  37. package/dist/pm-7KGLH6MX.js.map +0 -1
  38. package/dist/setup/doctor.cjs +0 -308
  39. package/dist/setup/doctor.js +0 -288
  40. package/dist/utils-RBXHHCLI.js.map +0 -1
  41. package/scripts/postinstall.cjs +0 -27
  42. /package/dist/{chunk-IJGNPAK2.js.map → chunk-5CILZHRW.js.map} +0 -0
  43. /package/dist/{resolve-XWYJYKKH.js.map → resolve-ZSUEJK3E.js.map} +0 -0
  44. /package/dist/{install-commands-P2KTEXQ4.js.map → utils-H2BL5GNR.js.map} +0 -0
@@ -1,288 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/setup/detect.ts
9
- import { spawnSync } from "child_process";
10
- import { existsSync } from "fs";
11
- import { join } from "path";
12
- var isWin = process.platform === "win32";
13
- function which(cmd) {
14
- const finder = isWin ? "where" : "which";
15
- const r = spawnSync(finder, [cmd], { encoding: "utf8", shell: isWin });
16
- if (r.status !== 0) return void 0;
17
- return r.stdout.split(/\r?\n/).find(Boolean)?.trim();
18
- }
19
- function resolveCmd(cmd, envKey) {
20
- const override = process.env[envKey];
21
- if (override) return override;
22
- const found = which(cmd);
23
- if (found) return found;
24
- if (isWin) return findWinCandidate(cmd);
25
- return void 0;
26
- }
27
- function findWinCandidate(cmd) {
28
- const exe = cmd.endsWith(".exe") ? cmd : `${cmd}.exe`;
29
- const userProfile = process.env["USERPROFILE"] ?? "C:\\Users\\Default";
30
- const localAppData = process.env["LOCALAPPDATA"] ?? join(userProfile, "AppData", "Local");
31
- const programFiles = process.env["ProgramFiles"] ?? "C:\\Program Files";
32
- const programFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
33
- const isPopplerExe = ["pdftoppm.exe", "pdfinfo.exe", "pdftotext.exe"].includes(exe);
34
- const isSoffice = exe === "soffice.exe";
35
- if (isPopplerExe) return findPopplerWin(exe, { userProfile, localAppData, programFiles, programFilesX86 });
36
- if (isSoffice) return findSofficeWin({ programFiles, programFilesX86, localAppData });
37
- return void 0;
38
- }
39
- function findPopplerWin(exe, p) {
40
- const scoopPath = join(p.userProfile, "scoop", "apps", "poppler", "current", "bin", exe);
41
- if (existsSync(scoopPath)) return scoopPath;
42
- const wingetBase = join(p.localAppData, "Microsoft", "WinGet", "Packages");
43
- const wingetResult = globFirst(wingetBase, ["oschwartz10612.Poppler_*"], ["poppler-*", "Library", "bin", exe]);
44
- if (wingetResult) return wingetResult;
45
- const chocoBase = join("C:", "ProgramData", "chocolatey", "lib", "poppler", "tools");
46
- const chocoResult = globFirst(chocoBase, ["poppler-*"], ["bin", exe]);
47
- if (chocoResult) return chocoResult;
48
- for (const base of [
49
- join("C:", "poppler", "bin", exe),
50
- join("C:", "tools", "poppler", "bin", exe),
51
- join(p.programFiles, "poppler", "bin", exe),
52
- join(p.programFilesX86, "poppler", "bin", exe),
53
- join(p.localAppData, "Programs", "poppler", "bin", exe)
54
- ]) {
55
- if (existsSync(base)) return base;
56
- }
57
- return void 0;
58
- }
59
- function findSofficeWin(p) {
60
- for (const candidate of [
61
- join(p.programFiles, "LibreOffice", "program", "soffice.exe"),
62
- join(p.programFilesX86, "LibreOffice", "program", "soffice.exe"),
63
- join(p.localAppData, "Programs", "LibreOffice", "program", "soffice.exe"),
64
- // winget 설치는 Program Files와 동일
65
- join(p.programFiles, "LibreOffice 24", "program", "soffice.exe"),
66
- join(p.programFiles, "LibreOffice 25", "program", "soffice.exe")
67
- ]) {
68
- if (existsSync(candidate)) return candidate;
69
- }
70
- return void 0;
71
- }
72
- function globFirst(base, wildcardSegments, rest) {
73
- if (!existsSync(base)) return void 0;
74
- let current = base;
75
- for (const seg of wildcardSegments) {
76
- if (!seg.includes("*")) {
77
- current = join(current, seg);
78
- if (!existsSync(current)) return void 0;
79
- continue;
80
- }
81
- try {
82
- const { readdirSync } = __require("fs");
83
- const entries = readdirSync(current);
84
- const pattern = seg.replace(/\*/g, ".*");
85
- const re = new RegExp(`^${pattern}$`, "i");
86
- const match = entries.find((e) => re.test(e));
87
- if (!match) return void 0;
88
- current = join(current, match);
89
- } catch {
90
- return void 0;
91
- }
92
- }
93
- const final = join(current, ...rest);
94
- return existsSync(final) ? final : void 0;
95
- }
96
- function probe(cmd, envKey, versionArgs = ["--version"]) {
97
- const resolvedPath = resolveCmd(cmd, envKey);
98
- if (!resolvedPath) return { name: cmd, found: false };
99
- const v = spawnSync(resolvedPath, versionArgs, { encoding: "utf8", shell: isWin });
100
- const versionLine = (v.stdout || v.stderr).split(/\r?\n/)[0]?.trim();
101
- return { name: cmd, found: true, path: resolvedPath, version: versionLine };
102
- }
103
- function probeOcrToolchain() {
104
- return {
105
- // poppler는 --version이 비표준이므로 -v 사용
106
- pdftoppm: probe("pdftoppm", "KORDOC_PDFTOPPM_PATH", ["-v"]),
107
- pdfinfo: probe("pdfinfo", "KORDOC_PDFINFO_PATH", ["-v"]),
108
- pdftotext: probe("pdftotext", "KORDOC_PDFTOTEXT_PATH", ["-v"]),
109
- soffice: probe("soffice", "KORDOC_SOFFICE_PATH", ["--version"])
110
- };
111
- }
112
- function isWSL() {
113
- if (process.platform !== "linux") return false;
114
- try {
115
- const { readFileSync } = __require("fs");
116
- const version = readFileSync("/proc/version", "utf8");
117
- return /microsoft|wsl/i.test(version);
118
- } catch {
119
- return false;
120
- }
121
- }
122
-
123
- // src/setup/pm.ts
124
- import { spawnSync as spawnSync2 } from "child_process";
125
- var isWin2 = process.platform === "win32";
126
- function which2(cmd) {
127
- const finder = isWin2 ? "where" : "which";
128
- const r = spawnSync2(finder, [cmd], { encoding: "utf8", shell: isWin2 });
129
- return r.status === 0;
130
- }
131
- function detectPackageManager() {
132
- if (process.platform === "darwin") {
133
- return which2("brew") ? "brew" : "unknown";
134
- }
135
- if (isWin2) {
136
- if (which2("winget")) return "winget";
137
- if (which2("scoop")) return "scoop";
138
- if (which2("choco")) return "choco";
139
- return "unknown";
140
- }
141
- if (which2("apt-get") || which2("apt")) return "apt";
142
- if (which2("dnf")) return "dnf";
143
- if (which2("yum")) return "yum";
144
- if (which2("pacman")) return "pacman";
145
- if (which2("zypper")) return "zypper";
146
- if (which2("apk")) return "apk";
147
- return "unknown";
148
- }
149
-
150
- // src/setup/install-commands.ts
151
- var POPPLER_RECIPES = {
152
- brew: { pm: "brew", cmd: "brew install poppler", needsSudo: false },
153
- winget: { pm: "winget", cmd: "winget install --id oschwartz10612.Poppler", needsSudo: false, notes: "\uC2E4\uC874 \uD655\uC778\uB428 (winget-pkgs 25.07.0-0)" },
154
- scoop: { pm: "scoop", cmd: "scoop install poppler", needsSudo: false, notes: "main \uBC84\uD0B7 \uD3EC\uD568, PATH \uC790\uB3D9 \uB4F1\uB85D" },
155
- choco: { pm: "choco", cmd: "choco install poppler -y", needsSudo: true, notes: "\uAD00\uB9AC\uC790 PowerShell \uD544\uC694" },
156
- apt: { pm: "apt", cmd: "sudo apt-get install -y poppler-utils", needsSudo: true },
157
- dnf: { pm: "dnf", cmd: "sudo dnf install -y poppler-utils", needsSudo: true },
158
- yum: { pm: "yum", cmd: "sudo yum install -y poppler-utils", needsSudo: true },
159
- pacman: { pm: "pacman", cmd: "sudo pacman -S --noconfirm poppler", needsSudo: true },
160
- zypper: { pm: "zypper", cmd: "sudo zypper install -y poppler-tools", needsSudo: true },
161
- apk: { pm: "apk", cmd: "apk add --no-cache poppler-utils", needsSudo: false, notes: "Alpine/Docker \uCE5C\uD654" },
162
- unknown: null
163
- };
164
- var LIBREOFFICE_RECIPES = {
165
- brew: { pm: "brew", cmd: "brew install --cask libreoffice", needsSudo: false },
166
- winget: { pm: "winget", cmd: "winget install --id TheDocumentFoundation.LibreOffice", needsSudo: false, notes: "\uC2E4\uC874 \uD655\uC778\uB428" },
167
- scoop: { pm: "scoop", cmd: "scoop bucket add extras && scoop install libreoffice", needsSudo: false },
168
- choco: { pm: "choco", cmd: "choco install libreoffice-fresh -y", needsSudo: true, notes: "\uAD00\uB9AC\uC790 PowerShell \uD544\uC694" },
169
- apt: { pm: "apt", cmd: "sudo apt-get install -y libreoffice", needsSudo: true },
170
- dnf: { pm: "dnf", cmd: "sudo dnf install -y libreoffice", needsSudo: true },
171
- yum: { pm: "yum", cmd: "sudo yum install -y libreoffice", needsSudo: true },
172
- pacman: { pm: "pacman", cmd: "sudo pacman -S --noconfirm libreoffice-still", needsSudo: true },
173
- zypper: { pm: "zypper", cmd: "sudo zypper install -y libreoffice", needsSudo: true },
174
- apk: { pm: "apk", cmd: "apk add --no-cache libreoffice", needsSudo: false, notes: "Alpine \uBBF8\uC9C0\uC6D0 \uAC00\uB2A5 \u2014 node:20-slim(Debian) \uAD8C\uC7A5" },
175
- unknown: null
176
- };
177
-
178
- // src/setup/doctor.ts
179
- var hr = "\u2500".repeat(45);
180
- function platform() {
181
- const arch = process.arch;
182
- if (isWSL()) return `linux/WSL (arch: ${arch})`;
183
- return `${process.platform} (arch: ${arch})`;
184
- }
185
- function icon(found) {
186
- return found ? "\u2705" : "\u274C";
187
- }
188
- function pad(s, n) {
189
- return s.padEnd(n);
190
- }
191
- function formatTool(name, status) {
192
- const ico = icon(status.found);
193
- if (!status.found) return ` ${pad(name, 10)} ${ico} \uCC3E\uC744 \uC218 \uC5C6\uC74C`;
194
- const ver = status.version ? ` (${status.version})` : "";
195
- return ` ${pad(name, 10)} ${ico} ${status.path}${ver}`;
196
- }
197
- function runDoctor(opts = {}) {
198
- const toolchain = probeOcrToolchain();
199
- const pm = detectPackageManager();
200
- const popplerOk = toolchain.pdftoppm.found && toolchain.pdfinfo.found;
201
- const sofficeOk = toolchain.soffice.found;
202
- const missing = [];
203
- if (!popplerOk) missing.push("poppler");
204
- if (!sofficeOk) missing.push("libreoffice");
205
- const out = opts.postinstall ? process.stderr : process.stdout;
206
- out.write(`${hr}
207
- `);
208
- out.write(`kordoc OCR \uC758\uC874\uC131 \uC810\uAC80
209
- `);
210
- out.write(`${hr}
211
- `);
212
- out.write(`\uD50C\uB7AB\uD3FC: ${platform()}
213
- `);
214
- out.write(`\uD328\uD0A4\uC9C0 \uB9E4\uB2C8\uC800: ${pm === "unknown" ? "\uAC10\uC9C0 \uC2E4\uD328" : pm}
215
- `);
216
- out.write(`Node.js: ${process.version}
217
- `);
218
- out.write(`
219
- `);
220
- out.write(`[OCR \uD30C\uC774\uD504\uB77C\uC778 \uC758\uC874\uC131]
221
- `);
222
- out.write(`${formatTool("pdftoppm", toolchain.pdftoppm)}
223
- `);
224
- out.write(`${formatTool("pdfinfo", toolchain.pdfinfo)}
225
- `);
226
- out.write(`${formatTool("pdftotext", toolchain.pdftotext)}
227
- `);
228
- out.write(`${formatTool("soffice", toolchain.soffice)}
229
- `);
230
- if (missing.length > 0) {
231
- out.write(`
232
- \uAD8C\uC7A5 \uC124\uCE58 \uBA85\uB839:
233
- `);
234
- if (!popplerOk) {
235
- const recipe = POPPLER_RECIPES[pm];
236
- if (recipe) {
237
- out.write(` # poppler (pdftoppm/pdfinfo)
238
- `);
239
- out.write(` ${recipe.cmd}
240
- `);
241
- if (recipe.notes) out.write(` # ${recipe.notes}
242
- `);
243
- } else {
244
- out.write(` poppler: OS\uC5D0 \uB9DE\uB294 \uBC29\uBC95\uC73C\uB85C \uC124\uCE58\uD558\uC138\uC694 (README \uCC38\uACE0)
245
- `);
246
- }
247
- }
248
- if (!sofficeOk) {
249
- const recipe = LIBREOFFICE_RECIPES[pm];
250
- if (recipe) {
251
- out.write(`
252
- # LibreOffice (soffice)
253
- `);
254
- out.write(` ${recipe.cmd}
255
- `);
256
- if (recipe.notes) out.write(` # ${recipe.notes}
257
- `);
258
- } else {
259
- out.write(` LibreOffice: OS\uC5D0 \uB9DE\uB294 \uBC29\uBC95\uC73C\uB85C \uC124\uCE58\uD558\uC138\uC694 (README \uCC38\uACE0)
260
- `);
261
- }
262
- }
263
- if (process.platform === "win32") {
264
- out.write(`
265
- \u26A0\uFE0F \uC124\uCE58 \uD6C4 \uC0C8 \uD130\uBBF8\uB110\uC744 \uC5F4\uAC70\uB098 PATH\uB97C \uAC31\uC2E0\uD574\uC57C \uD569\uB2C8\uB2E4.
266
- `);
267
- out.write(` PowerShell: $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
268
- `);
269
- }
270
- out.write(`
271
- \uD658\uACBD\uBCC0\uC218\uB85C \uACBD\uB85C\uB97C \uC9C1\uC811 \uC9C0\uC815\uD560 \uC218\uB3C4 \uC788\uC2B5\uB2C8\uB2E4:
272
- `);
273
- out.write(` KORDOC_PDFTOPPM_PATH, KORDOC_PDFINFO_PATH, KORDOC_SOFFICE_PATH
274
- `);
275
- out.write(`
276
- \uC790\uC138\uD55C \uC810\uAC80: npx kordoc doctor
277
- `);
278
- }
279
- out.write(`${hr}
280
- `);
281
- const summary = missing.length === 0 ? "\uBAA8\uB4E0 \uC758\uC874\uC131\uC774 \uC124\uCE58\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4 \u2705" : `${missing.length}\uAC1C \uACB0\uC190 \u2014 OCR \uBAA8\uB4DC \uC0AC\uC6A9 \uC2DC \uCC28\uB2E8\uB429\uB2C8\uB2E4 (${missing.join(", ")})`;
282
- out.write(`\uC694\uC57D: ${summary}
283
- `);
284
- return { ok: missing.length === 0, missing, toolchain, pm };
285
- }
286
- export {
287
- runDoctor
288
- };
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,27 +0,0 @@
1
- "use strict"
2
- // postinstall — 검사·안내 전용. 절대 자동 설치하지 않으며 항상 exit 0.
3
- const { spawnSync } = require("node:child_process")
4
- const fs = require("node:fs")
5
- const path = require("node:path")
6
-
7
- // 건너뛰는 조건: CI, 프로덕션 모드, 스킵 플래그, 잘못된 lifecycle
8
- const skip =
9
- process.env.CI === "true" ||
10
- process.env.KORDOC_SKIP_DOCTOR === "1" ||
11
- process.env.npm_config_production === "true" ||
12
- process.env.npm_lifecycle_event !== "postinstall"
13
-
14
- if (skip) process.exit(0)
15
-
16
- try {
17
- // dist/setup/doctor.cjs가 없으면 (git clone 직후 등) 조용히 종료
18
- const entry = path.join(__dirname, "..", "dist", "setup", "doctor.cjs")
19
- if (!fs.existsSync(entry)) process.exit(0)
20
-
21
- const result = spawnSync(process.execPath, [entry, "--postinstall"], { stdio: "inherit" })
22
- // doctor 결과와 무관하게 항상 성공으로 끝낸다 — npm install 차단 금지
23
- } catch (_e) {
24
- // 어떤 오류도 npm install을 실패시키지 않는다
25
- }
26
-
27
- process.exit(0)