- 공용 불러오기: target(트랜스파일 대상) · rewrite(트랜스파일 글 손봄 · import.meta) 옵션 - 280_2(import.meta.env.DEV) · 345_4(import.meta.url) = rewrite · 298_3 = target ES2022 - 322_0 = fileStub(경로 가짜 맵 · .css) · 347 = 파일별 진짜 import 목록 · 427_1 · 459 = load(뿌리 기준) - 풀이 함수 본문 그대로 · 헬퍼 출력 전 · 후 같음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.4 KiB
JavaScript
31 lines
1.4 KiB
JavaScript
/* 427-1 관 · 구조물 옮김 때 꼭짓점 따라감 — 진짜 `common_util_structure_station.ts` 의 `followMovedNodes` +
|
|
* `B05_Profile_Grade_Seat.ts` 의 `seatBornNodes`(화면 `listedBase` 차례)를 Node 로 돌림.
|
|
* 입력 argv[2] JSON [{ base, gone, born, edited }, …] · 표준출력 = 꼭짓점 목록 한 벌씩.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
|
const CATALOG = require("./helper_322_catalog_module.cjs");
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
|
|
const { loadTs: loadFull, load } = makeLoader({
|
|
root: ROOT,
|
|
cache: false,
|
|
requireFor: (full) => (request) => {
|
|
if (CATALOG.isCatalogRequest(request)) return CATALOG;
|
|
if (request.startsWith(".")) return loadFull(path.join(path.dirname(full), `${request}.ts`));
|
|
throw new Error(`stub 없음: ${request} (${path.relative(ROOT, full)})`);
|
|
},
|
|
});
|
|
const loadTs = (file) => load(file); // 뿌리 기준 상대 경로
|
|
|
|
const cases = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const station = loadTs("common_util/common_util_structure_station.ts");
|
|
const seat = loadTs("B05_Profile/logic/B05_Profile_Grade_Seat.ts");
|
|
const out = cases.map((item) => {
|
|
const moved = station.followMovedNodes(item.base.basePvi, item.gone, item.born, item.edited);
|
|
return seat.seatBornNodes(item.base, moved.nodes, moved.seat, moved.held);
|
|
});
|
|
process.stdout.write(JSON.stringify(out));
|