- B05_Profile_UI_Drainage_Pipes batched(같은 틱 부름 = 한 요청) · 배수유역 판 analyze 에 씌움 - 옛 소수 관 정수 맞춤(snapOldStations)이 관마다 부르던 POST detail-basins 가 한 번 · 계획고 따라가기 · 속성 이어받기 길은 그대로 - 시험 test_342_3_b05_detail_once(11번 부름 = 1번 · 다음 조작은 다시) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWh5wNNycMkbwMpACz1rte
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
/* 342-3 B05 첫 열기 세부 유역 요청 한 번 헬퍼 — `B05_Profile_UI_Drainage_Pipes.ts` 의 `batched` 를
|
|
* 그 자리에서 트랜스파일해 Node 로 돌리고 부른 수를 JSON 으로 낸다(틀 = helper_281_1).
|
|
*/
|
|
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.endsWith(".json")) return require(path.join(path.dirname(full), request));
|
|
if (request.startsWith(".")) return loadTs(path.join(path.dirname(full), `${request}.ts`));
|
|
if (request.startsWith("@ui/")) return { themeColor: () => "" };
|
|
return require(request);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
cache.set(full, box.exports);
|
|
return box.exports;
|
|
}
|
|
|
|
(async () => {
|
|
const { batched } = loadTs(path.join(ROOT, "B05_Profile", "B05_Profile_UI_Drainage_Pipes.ts"));
|
|
let runs = 0;
|
|
const analyze = batched(async () => {
|
|
runs += 1;
|
|
});
|
|
const first = Array.from({ length: 11 }, () => analyze()); // 옛 소수 관 11개 옮김
|
|
const samePromise = first.every((p) => p === first[0]);
|
|
await Promise.all(first);
|
|
const afterBurst = runs;
|
|
await analyze(); // 다음 조작은 다시 돈다
|
|
process.stdout.write(JSON.stringify({ afterBurst, samePromise, afterNext: runs }));
|
|
})();
|