/* 403 곡선 창 하단 글 헬퍼 — `_Label.curveInfoText` 를 트랜스파일해 경우별 글을 JSON 으로 낸다. */ const fs = require("fs"); const path = require("path"); const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript")); const B05 = path.join(__dirname, "..", "..", "B05_Profile"); const STUBS = { "@ui/ui_template_elements": { createButton: () => null }, "./B05_Profile_UI_Panel_Fields": { numberField: () => null, toggleButton: () => null }, }; function loadTs(full) { const js = ts.transpileModule(fs.readFileSync(full, "utf8"), { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 }, }).outputText; const box = { exports: {} }; const localRequire = (request) => { if (STUBS[request]) return STUBS[request]; if (request.startsWith(".")) return loadTs(path.join(path.dirname(full), `${request}.ts`)); return require(request); }; new Function("exports", "module", "require", js)(box.exports, box, localRequire); return box.exports; } const { curveInfoText } = loadTs(path.join(B05, "B05_Profile_UI_RouteEdit_Label.ts")); process.stdout.write( JSON.stringify({ curve: curveInfoText(true, 132.4, false), curveOptional: curveInfoText(true, 160.2, true), triangle: curveInfoText(false, 132.6, false), triangleOptional: curveInfoText(false, 168.4, true), triangleUnknown: curveInfoText(false, null, false), }), );