Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 31s
CI / tests-unit (push) Successful in 1m59s
CI / tests-integration (push) Successful in 2m19s
CI / tests-ui (push) Successful in 2m56s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 2m18s
Newly converted .nitro bundles now store their spritesheet as WebP VP8L instead of PNG, so imports land much smaller without changing a single pixel. The texture member and spritesheet.meta.image are both labelled from the actual bytes, never from a caller's assumption. - encode through sharp with lossless and exact, so colour hidden under alpha 0 survives; this mirrors ImageSharp's TransparentColorMode.Preserve - detect PNG/WebP by magic bytes and reject anything the client cannot render, on create, download and upload paths - keep the source format when deriving size-32 sheets, scaling composites and editing metadata, so existing bundles are never silently rewritten - report fidelity in the studio: the compression panel re-encodes with the same options the importer uses, so it cannot drift and invent false warnings, and shows PNG/WebP size estimates convertSwfToNitro and buildSpritesheet are now async, so the worker, the main-thread fallback and every import call site await them. PNG stays supported for existing bundles and icon sidecars are untouched.
19 lines
672 B
TypeScript
19 lines
672 B
TypeScript
import { expect, it } from "vitest";
|
|
import { createNitroBundle, parseNitroBundle } from "./nitro-builder";
|
|
|
|
it("honors an explicit decompression limit for imported bundles", () => {
|
|
const bundle = createNitroBundle(
|
|
{ name: "chair", value: "a".repeat(4096) },
|
|
Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]),
|
|
"chair",
|
|
);
|
|
expect(() => parseNitroBundle(bundle, { maxOutputLength: 1024 })).toThrow();
|
|
expect(parseNitroBundle(bundle).json.name).toBe("chair");
|
|
});
|
|
|
|
it("refuses to write a bundle whose texture is neither PNG nor WebP", () => {
|
|
expect(() =>
|
|
createNitroBundle({ name: "chair" }, Buffer.from("not an image"), "chair"),
|
|
).toThrow(/PNG or WebP/);
|
|
});
|