refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries

This commit is contained in:
root committed 2026-10-13 14:37:03 +08:00
1 parent 3f1c6d02f6
commit 27c0f27434
268 files changed
+7468 -7852

No files matched your search

@@ -64,7 +64,7 @@ const mockFetch = (async (input: string | URL | Request) => {
if (url.href === EVIL)
return new Response("<html><title>x</title><body>x</body></html>", { headers: { "content-type": "text/html" } });
return new Response("not found", { status: 404 });
}) as typeof fetch;
}) as (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
const resolveHost = async () => ["93.184.216.34"];
/** fake 模型:照网页给值,简介是改写过的(不是原文),海报给一个网页里没有的地址(应被丢弃) */
@@ -360,7 +360,7 @@ describe.skipIf(!pg)("META-1 元数据补全", () => {
return new Response("User-agent: *\nDisallow: /series/\n", { headers: { "content-type": "text/plain" } });
if (u.hostname === "robots-b.example.com") return new Response("err", { status: 503 });
return new Response("nf", { status: 404 });
}) as typeof fetch;
}) as (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
const o = { fetch: f, resolveHost };
expect(await robotsAllowedFor(h.ctx, "https://robots-a.example.com/series/1", o)).toBe(false);
expect(await robotsAllowedFor(h.ctx, "https://robots-a.example.com/detail?id=1", o)).toBe(true);