3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Measure each package as a namespace so default exports count, add the loaded JavaScript to the WebAssembly row, drop the growth claim

This commit is contained in:
2026-11-15 13:57:35 +01:00
committed by Lillem4n
parent d3832a85b6
commit 14b5680304
5 changed files with 24 additions and 9 deletions
+11
View File
@@ -34,6 +34,17 @@ test("minified size counts every package it is given", async () => {
assert.ok(await minifiedGzippedBytes(dir, ["./one.js", "./two.js"]) > await minifiedGzippedBytes(dir, ["./one.js"]) + 500);
});
test("minified size counts a default export and exports two packages share by name", async () => {
const dir = fixture({
"first.js": `export const same = ${JSON.stringify(Array.from({ length: 200 }, (_, i) => (i * 2654435761 % 4294967296).toString(36)))};`,
"second.js": `export const same = ${JSON.stringify(Array.from({ length: 200 }, (_, i) => (i * 40503 % 4294967296 * 65537).toString(36)))};`,
"only-default.js": `export default ${JSON.stringify(Array.from({ length: 200 }, (_, i) => (i * 69069 % 4294967296 * 97).toString(36)))};`,
});
const first = await minifiedGzippedBytes(dir, ["./first.js"]);
assert.ok(await minifiedGzippedBytes(dir, ["./first.js", "./second.js"]) > first + 500);
assert.ok(await minifiedGzippedBytes(dir, ["./only-default.js"]) > 500);
});
test("minified size counts the dependencies a bundler pulls in", async () => {
const alone = fixture({ "entry.js": "export const a = 1;" });
const withDependency = fixture({