chore(vendor): import pi 1.3.0

Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
2026-10-15 17:58:48 -04:00
parent 719370c8f7
commit 6081e3e325
1743 changed files with 205460 additions and 131705 deletions

View File

@@ -3,7 +3,7 @@
*/
import { describe, expect, it } from "vitest";
import { convertToPng } from "../src/utils/image-convert.ts";
import { convertToPng, loadPngTranscoder } from "../src/utils/image-convert.ts";
import { formatDimensionNote, resizeImage } from "../src/utils/image-resize.ts";
// Small 2x2 red PNG image (base64) - generated with ImageMagick
@@ -82,6 +82,14 @@ describe("convertToPng", () => {
});
});
// Issue #10292: pi-tui uses this transcoder to show non-PNG images on Kitty-protocol terminals.
it("loadPngTranscoder converts synchronously to oriented PNG data", async () => {
const transcoder = (await loadPngTranscoder())!;
const png = Buffer.from(transcoder(jpegWithXmpBeforeOrientation(), "image/jpeg")!, "base64");
expect([png.readUInt32BE(16), png.readUInt32BE(20)]).toEqual([1, 2]);
expect(transcoder(Buffer.from("not an image").toString("base64"), "image/jpeg")).toBeNull();
});
describe("resizeImage", () => {
it("should keep caller input bytes intact", async () => {
const input = new Uint8Array(imageBytes(TINY_PNG));