Files
Aislo/resources/tester/helper_54_14_balloon_lines.cjs
T
eomsangdonandClaude Opus 5.5 281c71b55b refactor(logic): 348-1 순수 계산 TS 49 파일 <페이지>/logic/ 로 옮김 — 이름 앞머리 그대로 · 동작 고침 없음
- 옮김: B04 2 · B05 23 · B06 11 · A00_Common/design 13 (9,299 줄) · 이미 logic/ 에 있던 16 파일 그대로
- 안 옮김: 묶음 입구(package.json build:*) · 파이썬 · 순수지만 계산 아닌 8 (보기 결선 · 콜백 · API 타입 · 갈아끼움 알림판)
- import 266 줄(142 파일) · 시험 · 주석 · 짝 표시 문자열 경로 고침 · B05 · B06 CLAUDE.md 짝 줄 logic/
- 시험 도우미 새 경로: 가짜 require 열쇠 · B05()/B06() 부름 · 형제 import 자리 · tsc 묶어 돌리는 시험 · 정규식 · rglob
- design_view_cross 줄 한도 시험 685 → 688 (긴 import 경로 줄바꿈 3줄)
- 확인: typecheck 0 · 서버 묶음 넷(corridor · server-calc · b07-extent · b07-note) 다시 지어 코드 같음(//#region 경로 주석만 다름) · 관련 시험 270 파일 — 남은 실패 19 는 옮기기 전과 같음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-16 13:44:50 +09:00

124 lines
4.5 KiB
JavaScript

/* 54-14 종단 알약 정보 라벨 줄 단위검증 헬퍼 — TS 를 그 자리에서 트랜스파일해 Node 로 돌린다.
* 결과는 표준출력에 JSON 한 벌. 화면 그릇은 쓰지 않는다.
*
* ⚠ 확장자가 `.cjs` 인 까닭은 `helper_b05_structures_form_summary.cjs` 머리와 같다.
*/
const fs = require("fs");
const path = require("path");
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
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) => {
if (CATALOG.isCatalogRequest(request)) return CATALOG; // 구조물 표(본보기 · 323-7)
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);
cache.set(full, box.exports);
return box.exports;
}
const { balloonLines } = loadTs(
path.join(ROOT, "B05_Profile", "logic", "B05_Profile_UI_Structures_Balloon.ts"),
);
const opt = (key, label, extra = {}) => ({ key, label, default: null, unit: null, ...extra });
const TYPES = {
pipe: {
type_id: "pipe",
name: "배관",
options: [
opt("pipe_diameter_mm", "관경", { default: "1000" }),
opt("inlet_type", "유입", { default: "기슭막이" }),
],
groups: [
{ id: "grv6lny", name: "관", options: [] },
{ id: "gnbf9m9", name: "관 보호공(유입)", options: [] },
{ id: "g9lq9uk", name: "관 보호공(유출)", options: [] },
],
spec_names: { soil_add: "흙막이 추가" },
},
box_culvert: {
type_id: "box_culvert",
name: "BOX암거",
options: [
opt("body_width_m", "폭", { default: 2 }),
opt("body_height_m", "높이", { default: 2 }),
],
groups: [],
},
cross_underdrain: {
type_id: "cross_underdrain",
name: "맹암거",
options: [
opt("culvert_height_m", "높이", { unit: "m" }),
opt("culvert_slope_pct", "기울기", { unit: "%" }),
],
groups: [
{ id: "gcrossud", name: "맹암거", options: ["culvert_height_m", "culvert_slope_pct"] },
],
},
retaining_wall: {
type_id: "retaining_wall",
name: "옹벽",
options: [
opt("height_m", "높이", { default: 2, unit: "m", visible: false }),
opt("length_m", "길이", { default: 10, unit: "m" }),
],
groups: [{ id: "gretaindetail", name: "상세 내용", options: ["height_m", "length_m"] }],
},
mirror: { type_id: "mirror", name: "반사경", options: [], groups: [] },
etc: { type_id: "etc", name: "기타", options: [opt("name", "이름")], groups: [] },
};
const point = (type_id, options = {}) => ({
structure_id: type_id,
type_id,
placement: "point",
chainage_m: 100,
options,
memo: "메모는 안 씀",
});
const head = (name) => ({ name, position: "5+0" });
const run = (structure, count) =>
balloonLines(structure, TYPES[structure.type_id], head("이름"), count);
const out = {
pipeFull: run(
point("pipe", {
pipe_diameter_mm: 1200,
inlet_type: "집수정",
inlet_structure: "L",
outlet_type: "기슭막이",
soil_add_1_structure: "기슭막이",
soil_add_1_form: "돌망태",
chute_add_1_structure: "도수로",
}),
),
pipeBlank: run(point("pipe")),
// 흙막이 개수 = 밖에서 정한 단 수(2) — 저장 1 벌 · 모자란 둘째는 빈 상자
pipeCount: run(point("pipe", { soil_add_1_structure: "기슭막이" }), (id) =>
id === "soil_add" ? 2 : undefined,
),
boxPreset: run(point("box_culvert", { body_width_m: 3, body_height_m: 3, wing_in: "있음" })),
boxBlank: run(point("box_culvert")),
underdrain: run(point("cross_underdrain", { culvert_height_m: 0.6 })),
underdrainBlank: run(point("cross_underdrain")),
wall: run(point("retaining_wall")),
wallAuto: run(point("retaining_wall", { length_m: "auto" })),
mirror: run(point("mirror", { anything: 1 })),
etcEmpty: run(point("etc", { name: "안내판" })),
etcNote: run(point("etc", { name: "안내판", etc_detail_1_note: "시험 비고" })),
};
process.stdout.write(JSON.stringify(out));