- 구조물마다 조합 줄 뒤에 좌측 패널 옵션 줄 — 폼과 같은 컨테이너 · 이름 · 보이는 칸(`structureOptionLines`) · 구조 갈래에 안 맞는 옛 값 뺌 · 필수 상자 빈 칸 = 폼 기본값 - B06 [상세] 모달 = 화면 TS 직접 · B07 = 같은 TS 를 Node 번들(B07_DesignDetail_Note_Options_Node · build:b07-note)로 받아 파이썬 짝이 붙임 · 실패는 조합 줄만 - 번들 낡음 판정에 A00_Common/design 더함 - 시험 test_166_1(진짜 명세 · B07 = 화면 같은 줄) · test_260 · test_265 기대값 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
46 lines
1.8 KiB
JavaScript
46 lines
1.8 KiB
JavaScript
/* 166-1 CAD 칸 미리 넣음 옵션 줄 — 진짜 `structureOptionLines`(명세 · 정의 덧칸)를 Node 로 돌림.
|
|
* 표준입력 { things: [{type_id, options}], types, definition } → 표준출력 { lines: string[][] }
|
|
* (B07 번들 `B07_DesignDetail_Note_Options_Node` 와 같은 입력 · 같은 함수 — 짝 = test_166_1_note_options.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 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 (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 { structureOptionLines } = loadTs(
|
|
path.join(ROOT, "B05_Profile", "B05_Profile_UI_Structures_Balloon.ts"),
|
|
);
|
|
const { withDefinition } = loadTs(
|
|
path.join(ROOT, "B05_Profile", "B05_Profile_UI_Structures_Define.ts"),
|
|
);
|
|
const input = JSON.parse(fs.readFileSync(0, "utf8"));
|
|
const types = new Map(
|
|
withDefinition(input.types ?? [], input.definition ?? null).map((type) => [type.type_id, type]),
|
|
);
|
|
const lines = (input.things ?? []).map((thing) =>
|
|
structureOptionLines(
|
|
{ type_id: thing.type_id, options: thing.options ?? {} },
|
|
types.get(thing.type_id),
|
|
),
|
|
);
|
|
process.stdout.write(JSON.stringify({ lines }));
|