Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- The VS Code extension icon fits within the Marketplace's 1024 × 1024 pixel limit, which blocked publishing 0.1.5 to the Marketplace.

## 0.1.5

### Fixed
Expand Down
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 22 additions & 1 deletion test/vsix.spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

import { readFile } from "node:fs/promises";
import { unzipSync } from "fflate";
import { expect, it } from "vitest";
import { assert, expect, it } from "vitest";
import { z } from "zod";
import {
extensionArchivePath,
packageManifest,
} from "../scripts/package/metadata.js";
import { extensionFileList } from "./package/contents.js";

// The Marketplace rejects a larger icon at publication.
const MAXIMUM_ICON_DIMENSION = 1_024;

it("contains only the extension runtime and required metadata", async () => {
expect(
Object.keys(
Expand Down Expand Up @@ -72,3 +75,21 @@ it("targets the Busy Octopus UI extension", async () => {
new Uint8Array(await readFile(manifest.icon)),
);
});

it("keeps the icon within the Marketplace dimension limit", async () => {
const icon = unzipSync(new Uint8Array(await readFile(extensionArchivePath)))[
`extension/${packageManifest.icon}`
];

assert(icon !== undefined);
// A PNG signature is followed by the IHDR chunk, whose data starts with the width and height.
expect(Array.from(icon.subarray(0, 8))).toEqual([
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
]);
expect(new TextDecoder().decode(icon.subarray(12, 16))).toBe("IHDR");

const view = new DataView(icon.buffer, icon.byteOffset, icon.byteLength);

expect(view.getUint32(16)).toBeLessThanOrEqual(MAXIMUM_ICON_DIMENSION);
expect(view.getUint32(20)).toBeLessThanOrEqual(MAXIMUM_ICON_DIMENSION);
});
Loading