Reorganize modules into layered directories

This commit is contained in:
Youzini-afk
2026-04-08 01:17:47 +08:00
parent 59942541ea
commit feec17f3e3
90 changed files with 284 additions and 219 deletions

View File

@@ -6,7 +6,7 @@ import vm from "node:vm";
async function loadRetrieve(stubs) {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const retrieverPath = path.resolve(__dirname, "../retriever.js");
const retrieverPath = path.resolve(__dirname, "../retrieval/retriever.js");
const source = await fs.readFile(retrieverPath, "utf8");
const transformed = `${source
.replace(/^import[\s\S]*?from\s+["'][^"']+["'];\r?\n/gm, "")
@@ -16,6 +16,7 @@ this.retrieve = retrieve;
const context = vm.createContext({
console: { log() {}, error() {}, warn() {} },
debugLog() {},
...stubs,
});
new vm.Script(transformed).runInContext(context);