/* PLAN 332-2 단위검증 헬퍼 — ☰ [설정] CAD 별칭 검사(`A00_Common/app_settings_cad.ts`)를 Node 로 돌림. * 결과 = 표준출력 JSON 한 벌. 짝 = `test_app_settings.py`. */ const fs = require("fs"); const path = require("path"); const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript")); const ROOT = path.join(__dirname, "..", ".."); const file = path.join(ROOT, "A00_Common", "app_settings_cad.ts"); const js = ts.transpileModule(fs.readFileSync(file, "utf8"), { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020, esModuleInterop: true, }, }).outputText; const box = { exports: {} }; const req = (p) => p.endsWith(".json") ? require(path.join(ROOT, "A00_Common", p)) : p === "@ui/ui_template_locale" ? { t: (k) => k } : {}; new Function("exports", "module", "require", js)(box.exports, box, req); const m = box.exports; const check = (aliases) => m.checkCadAliases(aliases); process.stdout.write( JSON.stringify({ commands: m.CAD_COMMANDS.length, parse: [m.parseAliases(" ll, Cc x1 "), m.parseAliases(""), m.parseAliases(",, ")], ok: check({ LINE: ["LL"], CIRCLE: ["CC", "C2"], COPY: ["C"] }), chars: check({ LINE: ["L!"], CIRCLE: ["원"] }), dup: check({ LINE: ["LL"], CIRCLE: ["LL"], ARC: ["AA", "AA"] }), name: check({ CIRCLE: ["LINE"] }), }), );