Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a6be431
chore: update pnpm to v11.2.2
duniul May 23, 2026
6681b8d
chore: remove husky and lint-staged
duniul May 23, 2026
174e4fb
fix: set sideEffects: false in package.json
duniul May 23, 2026
79398e2
chore: replace prettier and biome with oxfmt and oxlint
duniul May 23, 2026
aa37ddf
chore: add .gitattributes
duniul May 23, 2026
3269d67
chore: replace tsup with tsdown
duniul May 23, 2026
a8aa963
chore: update @canvas/image-data
duniul May 23, 2026
18774c6
chore: update vitest to v4
duniul May 23, 2026
ecc1af0
chore: lock dependency versions
duniul May 23, 2026
51781c8
chore: update sharp and @types/sharp
duniul May 23, 2026
66ee5ae
chore: update changesets
duniul May 23, 2026
7e351a7
chore: update typescript to v6
duniul May 23, 2026
f5424a9
chore: remove @types/sharp
duniul May 23, 2026
f3f0787
chore: update package commands
duniul May 23, 2026
de23377
chore: update vscode settings
duniul May 23, 2026
6996a16
chore: update tsconfig
duniul May 23, 2026
2f83e49
feat!: only build for ESM
duniul May 23, 2026
7c6f86e
chore: fix formatting, linting, and types
duniul May 23, 2026
0c62943
chore: remove redundant test images
duniul May 24, 2026
d3b8999
fix: fix early exit when there's only one possible scale
duniul May 23, 2026
c47e980
fix: ensure `from` is used in `multiplyPixelScale` and `dividePixelSc…
duniul May 23, 2026
47e08ec
chore: fix variable typo
duniul May 23, 2026
82b1817
chore: fix type signature for isValidImageData
duniul May 23, 2026
e338e41
chore: add simple benchmark to compare performance over time
duniul May 23, 2026
4a446ff
fix: increase performance by preallocating the Uint8ClampedArray
duniul May 23, 2026
2b00b22
chore: update benchmark to include auto-detected scale
duniul May 23, 2026
eb10d68
fix: speed up getPixelScale by iterating over the data as a Uint32Array.
duniul May 23, 2026
2ca6839
fix: add early exit when `to` is the same as the current scale
duniul May 23, 2026
47388d7
chore: set verifyDepsBeforeRun: false for pnpm
duniul May 24, 2026
a26a74b
chore: remove demo
duniul May 24, 2026
b5c0c5f
feat!: add input validation and rejection
duniul May 24, 2026
6197162
chore: update CI jobs
duniul May 24, 2026
1f3b817
chore: update gitignore
duniul May 24, 2026
e458c7b
chore: move test setup steps to setup file
duniul May 24, 2026
8ecb443
chore: lint fix
duniul May 24, 2026
32c8eab
feat: add jsdoc/tsdoc to exported functions and types
duniul May 24, 2026
bff2583
chore: update README
duniul May 24, 2026
3db0f7a
chore: reword changesets
duniul May 24, 2026
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
5 changes: 5 additions & 0 deletions .changeset/busy-otters-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': minor
---

Export `assertValidImageData` for validating `ImageDataLike` input at runtime.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
"changelog": ["changesets-changelog-clean", { "repo": "duniul/pixel-scale" }],
"commit": false,
"fixed": [],
Expand Down
5 changes: 5 additions & 0 deletions .changeset/early-forks-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': patch
---

Speed up `scalePixels` by preallocating the output `Uint8ClampedArray` (up to 8x faster).
5 changes: 5 additions & 0 deletions .changeset/free-lions-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': major
---

**BREAKING** Validate all inputs and throw `TypeError`/`RangeError` early on invalid arguments.
5 changes: 5 additions & 0 deletions .changeset/funny-pigs-lose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': patch
---

Speed up `getPixelScale` by iterating data as a `Uint32Array`.
5 changes: 5 additions & 0 deletions .changeset/odd-radios-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': patch
---

Fix early exit in `getPixelScale` when only one scale is possible.
5 changes: 5 additions & 0 deletions .changeset/olive-carrots-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': minor
---

Add JSDoc/TSDoc comments to exported functions and types.
5 changes: 5 additions & 0 deletions .changeset/small-camels-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': patch
---

Add early exit in `scalePixels` when `to` equals the current scale.
5 changes: 5 additions & 0 deletions .changeset/stale-moles-enter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': major
---

**BREAKING** Drop CommonJS build; ship ESM only.
5 changes: 5 additions & 0 deletions .changeset/tender-experts-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': patch
---

Fix `multiplyPixelScale` and `dividePixelScale` ignoring `options.from`.
5 changes: 5 additions & 0 deletions .changeset/unlucky-sheep-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pixel-scale': patch
---

Mark the package as side-effect free for better tree-shaking.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text eol=lf
*.jpg binary
*.png binary
*.gif binary
14 changes: 8 additions & 6 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@ on:
- main
paths-ignore:
- '.vscode/**'
- 'demo/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
main:
name: Publish changed packages
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: 🏗 Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6

- name: 🏗 Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v6
with:
node-version: 18.x
node-version: 22.x
cache: pnpm

- name: 📦 Install dependencies
Expand All @@ -46,4 +49,3 @@ jobs:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
45 changes: 14 additions & 31 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,44 @@ on:
push:
paths-ignore:
- '.vscode/**'
- 'demo/**'
- '.gitattributes'
- '.gitignore'
- '*.md'
- 'LICENSE'

permissions:
contents: read

jobs:
build:
name: 🧱 Build
name: 🧱 Checks, tests and builds
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: 🏗 Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6

- name: 🏗 Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v6
with:
node-version: 18.x
node-version: 22.x
cache: pnpm

- name: 📦 Install dependencies
run: pnpm install

- name: 🧱 Build project
run: pnpm build

test:
name: 🧪 Test
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18.x, 20.x]

runs-on: ${{ matrix.os }}

steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup pnpm
uses: pnpm/action-setup@v4
- name: 🧹 Stylecheck project
run: pnpm stylecheck

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: pnpm
- name: 🧹 Typecheck project
run: pnpm typecheck

- name: 📦 Install dependencies
run: pnpm install
- name: 🧱 Build project
run: pnpm build

- name: 🧪 Run tests
run: pnpm test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ lib
.env.development.local
.env.test.local
.env.production.local
.history

npm-debug.log*
yarn-debug.log*
Expand All @@ -26,3 +27,6 @@ lerna-debug.log*

# Parcel cache
**/.cache

# TypeScript
.tsbuildinfo
4 changes: 0 additions & 4 deletions .husky/precommit

This file was deleted.

7 changes: 0 additions & 7 deletions .lintstagedrc.cjs

This file was deleted.

18 changes: 18 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": ["**/node_modules", "**/dist", "**/.history", "**/.tsbuildinfo", "**/bench.*.json"],
"printWidth": 110,
"trailingComma": "es5",
"jsxSingleQuote": true,
"singleQuote": true,
"arrowParens": "avoid",
"quoteProps": "consistent",
"sortPackageJson": {
"enabled": true,
"sortScripts": false
},
"sortImports": {
"enabled": true,
"newlinesBetween": false
}
}
127 changes: 127 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"ignorePatterns": ["**/node_modules", "**/dist", "**/.history", "**/.tsbuildinfo", "**/bench.*.json"],
"plugins": ["eslint", "import", "jsdoc", "node", "oxc", "promise", "typescript", "unicorn"],
"env": {
"builtin": true,
"browser": true,
"shared-node-browser": true
},
"categories": {
"correctness": "error",
"nursery": "error",
"pedantic": "error",
"perf": "error",
"restriction": "error",
"style": "error",
"suspicious": "error"
},
"rules": {
"capitalized-comments": "off",
"consistent-type-definitions": ["error", "type"],
"explicit-length-check": "off",
"exports-last": "off",
"filename-case": ["error", { "case": "camelCase" }],
"func-style": "off",
"id-length": "off",
"curly": ["error", "multi-line"],
"import/consistent-type-specifier-style": "off",
"import/group-exports": "off",
"import/no-named-export": "off",
"import/no-namespace": "off",
"import/no-nodejs-modules": "off",
"import/no-relative-parent-imports": "off",
"import/prefer-default-export": "off",
"init-declarations": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-param": "off",
"jsdoc/require-returns-type": "off",
"jsdoc/require-returns": "off",
"max-lines-per-function": "off",
"max-lines": "off",
"max-params": "off",
"max-statements": "off",
"number-literal-case": "off",
"no-array-callback-reference": "off",
"no-async-await": "off",
"no-continue": "off",
"no-duplicate-imports": ["error", { "allowSeparateTypeImports": true }],
"no-implicit-coercion": "off",
"no-inline-comments": "off",
"no-magic-numbers": "off",
"no-nested-ternary": "off",
"no-null": "off",
"no-optional-chaining": "off",
"no-plusplus": "off",
"no-rest-spread-properties": "off",
"no-ternary": "off",
"no-undefined": "off",
"operator-assignment": "off",
"prefer-await-to-then": "off",
"prefer-destructuring": "off",
"prefer-template": "off",
"prefer-ternary": "off",
"promise/avoid-new": "off",
"require-unicode-regexp": "off",
"sort-imports": "off",
"sort-keys": "off",
"typescript/explicit-member-accessibility": ["error", { "accessibility": "no-public" }],
"unicorn/no-nested-ternary": "off"
},
"overrides": [
{
"files": ["*.config.ts", "*.config.*.ts"],
"rules": {
"import/no-default-export": "off"
}
},
{
"files": ["src/cli/**/*.ts"],
"rules": {
"new-cap": "off",
"no-console": "off"
}
},
{
"files": ["__mocks__/fs/**/*"],
"rules": {
"unicorn/prefer-module": "off",
"import/no-commonjs": "off"
}
},
{
"files": ["bin/**/*"],
"rules": {
"import/no-unassigned-import": "off"
}
},
{
"files": ["*.test.ts", "__test__/**"],
"plugins": ["vitest"],
"env": {
"vitest": true,
"node": true
},
"rules": {
"vitest/no-hooks": "off",
"vitest/require-top-level-describe": "off",
"vitest/no-importing-vitest-globals": "off",
"vitest/consistent-test-it": "off",
"vitest/prefer-to-be-truthy": "off",
"vitest/prefer-to-be-falsy": "off",
"vitest/max-expects": "off",
"vitest/prefer-expect-assertions": [
"error",
{
"onlyFunctionsWithAsyncKeyword": true,
"onlyFunctionsWithExpectInCallback": true,
"onlyFunctionsWithExpectInLoop": true
}
],
"vitest/valid-title": "off",
"vitest/prefer-called-once": "off",
"no-magic-numbers": "off"
}
}
]
}
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

Loading