This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
PXON (Pixel Object Notation) is a TypeScript library for handling pixel art data in a JSON-based format. It provides import, export, and manipulation of pixel data with EXIF-like metadata. Zero runtime dependencies. Published to npm with CJS, ESM, and type definition outputs.
- Build:
pnpm run build(cleans dist/ then bundles via tsup) - Dev mode:
pnpm run dev(tsup watch mode) - Test:
pnpm run test(vitest run) - Run single test:
pnpm exec vitest run --testPathPattern="<pattern>" - Test watch:
pnpm run test:watch - Test coverage:
pnpm run test:coverage - Lint:
pnpm run lint/pnpm run lint:fix - Format:
pnpm run format/pnpm run format:check - Typecheck:
pnpm run typecheck - Full validation:
pnpm run validate(lint + format + typecheck + test)
The entire library is a single source file (src/index.ts) with its tests in src/index.test.ts.
Core class: PXON
- Stores pixels in a
Map<string, Pixel>keyed by"x:y"coordinate strings for O(1) lookups - Private
_data: PXONDataholds metadata (artist, software, copyright, etc.) exposed via getter/setter pairs import(data)/export()handle serialization to/from thePXONImportData/PXONExportDatainterfacessetPixel()defaults: color#ffffff, size1
Interfaces: PXONData, Pixel, PXONImportData, PXONExportData — all defined in src/index.ts.
tsup produces artifacts in dist/:
dist/index.mjs— ES Modulesdist/index.cjs— CommonJSdist/index.d.ts— Type declarationsdist/index.d.cts— CJS type declarations
- Prettier: No semicolons, single quotes, trailing commas (ES5), 100 char width
- TypeScript: Strict mode with
noImplicitAnyandstrictNullChecks - ESLint: Flat config format (
eslint.config.js), typescript-eslint + prettier plugins - Node: v22 required (enforced via
.nvmrcandengine-strict=true)
- Package manager: pnpm
- Bundler: tsup (esbuild-based)
- Test runner: Vitest
- CI: GitHub Actions with pnpm
Uses Changesets for versioning. Commits follow conventional commit format.