Skip to content

v0.4.0

Choose a tag to compare

@chad-hill chad-hill released this 16 Jun 20:03
· 20 commits to main since this release

Two major features land in this release: on-demand image transforms and a reworked font pipeline. Both are breaking (the workspace is pre-1.0), so check Migration below.

On-demand image transforms — @pro-laico/images

@pro-laico/images is now a full on-demand image pipeline. Uploads store only the original; there's no fixed size ladder. The first time a page asks for a given size, a Sharp-backed endpoint (/api/img/:id) resizes and crops it to the image's focal point, streams it back same-origin with immutable cache headers, and caches the result in a new hidden generatedImages collection so it's only ever built once.

Render with the bundled <ResponsiveImage> component, a plain <img> whose srcset points at the endpoint (no next/image), in server or client trees:

<ResponsiveImage image={image} aspectRatio="16:9" sizes="(max-width: 768px) 100vw, 50vw" />

Highlights:

  • Focal-point cropping with an admin picker whose live ratio previews match the rendered crop exactly.
  • Built-in blur placeholders generated on upload, replacing the @oversightstudio/blur-data-urls peer. Tune or disable with the blur option.
  • Correct cache invalidation: every URL carries a version token derived from the file + focal point, so editing either busts immutable browser/CDN caches, and stale cached variants are purged automatically (and via a "Purge variants" button).
  • A new standalone images-only example app to see it in isolation.

Font typefaces & optimize-on-upload — @pro-laico/fonts

A font is now one typeface that holds its weight/style files (Regular, Bold, Italic, …) through a new fontFile upload collection, fed to next/font/local as a single family.

  • Optimize-on-upload (fontsPlugin({ optimize: true })): each weight is subset to a WOFF2 on save (default latin charset), the untouched original is archived in fontOriginal, weight/style/family are auto-detected via fontkit, and the size reduction is reported. subset-font + fontkit ship bundled (no consumer install).
  • A premium drag uploader replaces the native upload UI: drop one or many files, get a client-side preview with duplicate detection, assign roles, and save. Files are staged and only written on save, so abandoning a draft leaves no orphans.

Breaking changes & migration

@pro-laico/images

  • Images no longer pre-generates WebP imageSizes (stores the original only). On SQL adapters this drops the old size columns; set pregenerateSizes: true to restore the legacy ladder.
  • Removed: the @oversightstudio/blur-data-urls peer (blur is built in).
  • The ImageChild block renders <ResponsiveImage> instead of next/image. Migrate by rendering through <ResponsiveImage> and dropping any blurDataUrlsPlugin wiring.
  • New setup: pass sharp to buildConfig, add 'sharp' to serverExternalPackages, set NEXT_PUBLIC_SERVER_URL, and register generatedImages with your storage adapter (server-side uploads).

@pro-laico/fonts

  • A font is now a non-upload typeface (previously one upload = one weight). Role slots become a single relationship → font; weight files live in the new fontFile collection; optimize / staticDir / mimeTypes move from fontOptions to fontFileOptions. The GET /api/fonts/export shape is unchanged. Migrate by re-pointing each role at a typeface id and regenerating types.
  • With optimize on: register fontFile + fontOriginal for server-side uploads and add ['subset-font', 'harfbuzzjs', 'fontkit'] to serverExternalPackages.

All @pro-laico/* packages share this version (lockstep 0.4.0). Compare: v0.3.4...v0.4.0.