release: WRNexusJS 0.5.0

This commit is contained in:
2026-07-29 12:51:10 +05:30
parent 76c768099d
commit 6afe32f63f
456 changed files with 40879 additions and 8850 deletions
+21 -4
View File
@@ -599,10 +599,20 @@ export const HMR_CLIENT_JS = `
// Minimal index-based DOM morph: preserve matching nodes (keeps state/focus),
// patch text and attributes, clone genuinely new nodes, drop removed ones.
// Hydrated subtrees (reactive scopes) are CLIENT-OWNED and left untouched,
// so live state (e.g. a counter at 5) is never reset to the SSR 0.
// Preserve a hydrated subtree only while its server hydration signature and
// behavior are unchanged. Component edits must replace and re-hydrate the
// old subtree or HMR will keep stale markup indefinitely.
function morph(from, to) {
if (from.__wrnexusHydrated) return;
if (from.__wrnexusHydrated) {
var sameHydration =
from.getAttribute("data-wrn-hydration") === to.getAttribute("data-wrn-hydration") &&
from.getAttribute("data-wrn-behavior") === to.getAttribute("data-wrn-behavior") &&
from.getAttribute("data-scope") === to.getAttribute("data-scope");
if (sameHydration) return;
if (window.__wrnexusDisposeBehaviors) window.__wrnexusDisposeBehaviors(from);
from.replaceWith(to.cloneNode(true));
return;
}
syncAttrs(from, to);
var fc = from.childNodes, tc = to.childNodes, i;
for (i = 0; i < tc.length; i++) {
@@ -1070,6 +1080,14 @@ export function createHandlers(deps: RuntimeDeps): Handlers {
const matched = router.matchApi(ctx.url.pathname);
if (!matched) return Response.json({ error: "Not Found" }, { status: 404 });
// Expose the canonical matched route to package dispatchers. A package may
// contribute several URL paths from one module, and request URLs can be
// rewritten by gateways or internal framework calls. The router match is
// the authoritative route identity.
ctx.params = matched.params;
ctx.locals.__wrnexusRoute = matched.route.raw;
ctx.locals.__wrnexusRouteKind = "api";
const mod = await loadModule(matched.route.file);
const method = ctx.req.method.toUpperCase();
const embeddedApi = mod.__wrnexusApi as ApiRegistry | undefined;
@@ -1087,7 +1105,6 @@ export function createHandlers(deps: RuntimeDeps): Handlers {
});
}
ctx.params = matched.params;
return (await handler(ctx)) as Response;
}