release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
+24
View File
@@ -64,3 +64,27 @@ test("streams async body chunks inside the document shell", async () => {
).text();
expect(html).toContain('<div id="app"><h1>Shell</h1><p>Later</p></div>');
});
test("renders rich script metadata and deduplicates by source", () => {
const html = renderDocument({
meta: { title: "Runtime" },
body: '<main data-wrnexus-runtime="captcha"></main>',
scripts: [
{
src: "/__wrnexus/assets/captcha.abc.js",
type: "classic",
defer: true,
integrity: "sha256-test",
crossOrigin: "anonymous",
attributes: { "data-wrnexus-runtime-src": "captcha" },
},
{ src: "/__wrnexus/assets/captcha.abc.js", type: "classic" },
],
});
expect(html.match(/captcha\.abc\.js/g)).toHaveLength(1);
expect(html).toContain("defer");
expect(html).toContain('integrity="sha256-test"');
expect(html).toContain('crossorigin="anonymous"');
expect(html).toContain('data-wrnexus-runtime-src="captcha"');
expect(html).not.toContain('rel="modulepreload" href="/__wrnexus/assets/captcha.abc.js"');
});