- 서버 재계산(_recompute) 맨 앞 refresh_alignment — 저장 base_pvi · 편집 · 정책 · 기준으로 경고만 지금 코드 값 · 기하(계획고 · 곡선 · 표본 · 위반)는 저장값 그대로 · 같으면 안 씀 · grade_summary 함께 - 파이썬 경고 글을 TS buildAlignment 꼴로(접두 「chainage 」 뺌 · 기울기 초과 · 불균형 총괄 줄 뺌 — violations · balance 칸이 정본) - 거울 시험 test_472_save_warnings(옛 코드 실패 확인) · 기준값 경고 칸만 다시 뜸(server_save 5→50 · server_route 51→50 · 브레인 승인) · W0 정리 · W1 지움 - 위키 계산 목록 P8 · [저장] 차례 cross 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
/* 472 덧 종단 경고 거울 헬퍼 — `logic/B05_Profile_UI_Profile_Alignment.ts` `buildAlignment` 를 그 자리에서
|
|
* 트랜스파일해 돌림. 입력 argv[2] JSON { base, cases: [edits] } · 표준출력 JSON [{ warnings, violations }].
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const cache = new Map();
|
|
function loadTs(file) {
|
|
const full = path.resolve(file);
|
|
if (cache.has(full)) return cache.get(full);
|
|
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
cache.set(full, box.exports);
|
|
const localRequire = (request) =>
|
|
request.startsWith(".")
|
|
? loadTs(path.join(path.dirname(full), `${request}.ts`))
|
|
: require(request);
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
const align = loadTs(
|
|
path.join(__dirname, "..", "..", "B05_Profile", "logic", "B05_Profile_UI_Profile_Alignment.ts"),
|
|
);
|
|
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
console.log(
|
|
JSON.stringify(
|
|
input.cases.map((edits) => {
|
|
const built = align.buildAlignment(input.base, edits);
|
|
return { warnings: built.warnings, violations: built.violations.length };
|
|
}),
|
|
),
|
|
);
|