AgentnessArenav2 / tools /lib /play-record-node.mjs
irregular6612's picture
deploy: Space λ₯Ό main 9ad6588 트리둜 λ§žμΆ˜λ‹€
a3e6f31
Raw History Blame Contribute Delete
941 Bytes
/* tools/lib/play-record-node.mjs β€” μ»€λ„μ˜ node μ „μš© 쑰각.
play-record.mjs λŠ” λΈŒλΌμš°μ €Β·nodeΒ·Deno μ„Έ λŸ°νƒ€μž„μ΄ 같이 μ“΄λ‹€. node μ—μ„œλ§Œ ν•„μš”ν•œ
`createRequire`(engine.js / campaign.js λ₯Ό CommonJS 둜 μž‘λŠ” 데 μ“΄λ‹€)λ₯Ό μ—¬κΈ°λ‘œ 뗐닀.
컀널은 이 νŒŒμΌμ„ **ν•¨μˆ˜ μ•ˆμ—μ„œ 동적 import** ν•˜λ―€λ‘œ Deno λŠ” 이 νŒŒμΌμ„ μ•„μ˜ˆ ν•΄μ„ν•˜μ§€
μ•ŠλŠ”λ‹€ β€” Edge λŸ°νƒ€μž„μ— node: 폴리필이 μ•ˆ λ”Έλ € μ˜¨λ‹€.
이 νŒŒμΌμ€ node λ°–μ—μ„œ import 되면 μ•ˆ λœλ‹€. 호좜 κ²½λ‘œλŠ” loadEngines() 의 else λΆ„κΈ° ν•˜λ‚˜λΏ. */
import { createRequire } from 'node:module';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
export function loadEnginesNode(kernelUrl) {
const req = createRequire(kernelUrl);
const ROOT = join(dirname(fileURLToPath(kernelUrl)), '..', '..');
return { E: req(ROOT + '/engine.js'), C: req(ROOT + '/campaign.js') };
}