fix: close durable queue and runtime gaps
Quality / quality (ubuntu-latest) (push) Failing after 9m54s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-23 20:47:00 +05:30
parent 1a94179b5f
commit a9670c2a1c
19 changed files with 198 additions and 26 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/dev-server",
"version": "0.8.51",
"version": "0.8.52",
"type": "module",
"main": "src/index.ts",
"exports": {
+1
View File
@@ -1960,6 +1960,7 @@ export function createHandlers(deps: RuntimeDeps): Handlers {
).getOrLoad(`route:${matched.route.raw}`, () => load(pageCtx));
}
(pageCtx as Context & { data?: unknown }).data = data;
if (data instanceof Response) return data;
if (data && typeof data === "object") Object.assign(pageCtx, data);
}
let body = await renderComponents(String(await component(pageCtx)), ctx.t, ctx.lang);
@@ -32,6 +32,32 @@ test("server loader data is available to page rendering", async () => {
expect(await response!.text()).toContain("Ada,Lin / 2");
});
test("a server loader can return a redirect Response", async () => {
const root = mkdtempSync(join(tmpdir(), "wrnexus-load-redirect-"));
roots.push(root);
const app = join(root, "app");
mkdirSync(join(app, "pages"), { recursive: true });
writeFileSync(join(app, "pages/private.ts"), "export default () => '';\n");
const handlers = createHandlers({
mode: "production",
hmr: false,
router: buildRouter(app),
loadModule: async () => ({
__wrnexusLoad: async () => Response.redirect("https://example.test/login", 303),
default: () => {
throw new Error("redirected pages must not render");
},
}),
getMiddleware: async () => [],
assets: { serve: async () => null },
} satisfies RuntimeDeps);
const response = await handlers.fetch(new Request("https://example.test/private"), {
upgrade: () => false,
});
expect(response?.status).toBe(303);
expect(response?.headers.get("location")).toBe("https://example.test/login");
});
test("HMR page synchronization initializes request-scoped loader caching", async () => {
const root = mkdtempSync(join(tmpdir(), "wrnexus-hmr-load-runtime-"));
roots.push(root);