Skip to content

Move jimp and every @jimp/* package to 2.2.0 together

Jimp 2.2.0 added these packages to its closure. None is chosen or imported by AutoMobile; the pin tool promotes each to an exact pin, and the stdlib-first check asks for a record of each:

Dependency: @jimp/jpeg-js Dependency: @jimp/js-ico Dependency: @jimp/plugin-border Dependency: @jimp/plugin-draw Dependency: @jimp/plugin-lut Dependency: @jimp/plugin-morphology Dependency: @jimp/pngjs Dependency: fflate Dependency: opentype.js

Context

Dependabot opened one PR per @jimp/* package for 1.7.0 to 2.2.0. Each left a mixed 1.x/2.x tree, which scripts/release/pin-runtime-deps.ts cannot pin, so every PR failed the same required checks. Jimp 2 requires Node 22 and changes some image math (greyscale rounding, premultiplied-alpha resize, loadFont file handling).

Options

  • Merge the seven PRs one at a time. Each intermediate tree is mixed, so none can go green.
  • Hold jimp at 1.7.0 with a Dependabot ignore. The hold would only delay the move.
  • Move all packages in one PR and add a Dependabot group so they stay together.

Decision

One PR moves jimp and every @jimp/* entry to 2.2.0, and a jimp Dependabot group (jimp, @jimp/*) keeps them together. Jimp 2.2.0 changes the dependency holds:

  • zod stays held at the current major: every @jimp/* package needs ^4.6.7.
  • file-type moves to 22.x because @jimp/core needs ^22.3.0; its major hold stays.
  • pako hoists at 3.0.3 for @jimp/pngjs; utif2 keeps a nested 1.0.11.
  • @jimp/js-png leaves bundledDependencies: its decoder is now the separate @jimp/pngjs, so it no longer nests a conflicting pngjs.

The bundled closure grew past its 2.5 MB budget because @jimp/core now needs fflate, which ships a CJS twin beside its ESM build. The prepack prune drops that twin, as it does for zod, and the budget stays at 2.5 MB (the pruned closure is 2.22 MB).

Two behavior changes needed code:

  • Bun defines self, so Jimp 2 treats it as a web worker. loadFont then fetches the font and reads each page through Jimp.read with a file: URL. Jimp reads that URL as a missing path. loadJimp hides self while Jimp evaluates, so fonts are read from disk.
  • Resize now works in premultiplied alpha, so a translucent pixel can differ by one level in a color channel (0x31 at alpha 0x80 becomes 0x32). The Android icon test pins the new value.

Consequences

The runtime graph manifest, lock and Dependabot config describe one jimp version. A Dependabot group PR still needs scripts/release/pin-runtime-deps.ts --write run by hand, since Dependabot cannot regenerate the manifest. The buffer polyfill that Jimp 2 adds is skipped by the bundled-import smoke check, because a bare buffer import resolves to the Node builtin.