- 되돌리기 사진 = 연 프로젝트 초안 칸만(projectStateKeys) · 옛 b05/b06 접두 지움 - 관 자리 b05:pipes 걷음 → 가게 pipes 초안으로 되돌림 - 조정창 · 연동 · 세월교 · BOX 세션 맵 = readByKey · writeByKey - 노선 편집 횡단 반폭 = routeStateKeys · 계획고 옛 키(프로젝트 없음) 안 받음 - 새 test_384_1_session_keys · 사진첩 시험 헬퍼 = 진짜 등록부 부름 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
/* 진짜 TS 를 그 자리에서 CommonJS 로 트랜스파일해 부름 — 상대 경로는 진짜 파일(.ts)로 따라감.
|
|
* ESM 드라이버는 `createRequire(import.meta.url)(이 파일)` 로 받음(test_346_4_profile_history · test_364_1).
|
|
*/
|
|
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 near = (request) =>
|
|
request.startsWith(".")
|
|
? loadTs(path.join(path.dirname(full), `${request}.ts`))
|
|
: require(request);
|
|
new Function("exports", "module", "require", js)(box.exports, box, near);
|
|
return box.exports;
|
|
}
|
|
|
|
module.exports = { loadTs };
|