Skip to content

Version Packages - #139

Merged
ivanbarlog merged 1 commit into
mainfrom
changeset-release/main
Dec 3, 2026
Merged

ivanbarlog merged 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

@github-actions github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@beesolve/file-storage@0.3.0

Minor Changes

  • f103771: Add readImageDimensions({ identifier, access }) to the object returned by createFileStorage. It reads the pixel size of an uploaded JPEG, PNG, WebP (animated included) or GIF with ranged GetObject requests (64 KiB, then 256 KiB, then 1 MiB) and writes nothing to S3. JPEG sizes are after EXIF orientation, which is what the optimizer expects as source: { width, height } for rect chains. It returns undefined for other files and unreadable headers and throws for a missing object. Persist the result yourself, for example in your onUploaded handler. New exports: parseImageDimensions (pure header parser over bytes), ImageDimensions, ReadImageDimensionsProps.

Patch Changes

  • Updated dependencies [c838917]
  • Updated dependencies [c838917]
  • Updated dependencies [c838917]
    • @beesolve/image-optimizer@0.4.0

@beesolve/image-optimizer@0.4.0

Minor Changes

  • c838917: Cache only what is meant to be cached, and negative-cache platform errors briefly. A function timeout is answered by the Function URL as HTTP 200 with the body Sandbox.Timedout and no Cache-Control, which CloudFront used to cache for cacheTtl (a year by default). Every handler response sets Cache-Control (public, max-age={cacheTtl} or no-store), so the cache policy DefaultTTL now only applies to responses the Lambda platform produces itself (timeouts, runtime errors, out-of-memory kills). New prop failureCacheTtl (default Duration.minutes(5), Duration.seconds(0) disables, whole seconds, at most cacheTtl) is that DefaultTTL; MinTTL is 0 and MaxTTL is cacheTtl. A repeat of a failing URL is a cache hit for 5 minutes instead of running the full timeout again. Trade-offs: a transient failure sticks for the TTL per edge location, and it throttles repeats of the same URL only, not distinct URLs (use reservedConcurrentExecutions and WAF rate limiting for that). 4xx and 5xx statuses are governed by CloudFront error caching, not by this TTL. Handler errors (no-store) are not cached, measured for 404 and 422. The bucket behavior for other files is unchanged. Behavior change: deploying updates the cache policy, responses cached earlier stay until they expire or are invalidated. See ADR-023 and ADR-024.

  • c838917: Add the rect=x,y,w,h parameter. Integers are pixels of the oriented original, a value with a decimal point is a fraction of the width or height (0.5 puts the edge at the centre, 1.0 is the whole size), full is the whole width or height for w and h. 1 is one pixel, 1.0 is 100 percent. Fractions are rounded to 4 decimals and keep their decimal point in the cache key, they are resolved against the oriented original (Math.round(fraction * size)). The position keywords work like in imgix: x accepts left, center and right, y accepts top, middle and bottom (center is half of the free space, (size - region size) / 2, rounded). Keywords stay in the cache key as written in lowercase, on the wrong axis or for w and h they answer 400. The region is cut first and the other parameters work on it. Out-of-range values are clamped, a region without pixels answers 400. Needs the native module and skips size buckets.

    Add the original=1 parameter and the original mutation. The optimizer streams the stored bytes with the stored content type and cache headers (X-Image-Optimizer: original, no Vary), without sniffing or decoding, so maxSourceBytes does not apply. Combined with any other supported parameter it answers 400, at the edge as well. generateUrl and imageUrl(...).original() throw when original is combined with another mutation. Large files stream through the Lambda (200 MB limit, 2 MBps after 6 MB), raise timeout for them. New export: Original. The Outcome type has a new original kind.

    Add the rect mutation, order-aware chains and the imageUrl builder to the SDK. generateUrl applies an array that contains a rect in array order, maps the rect back to pixels of the original (new optional source: { width, height }, required when a size mutation comes before a rect) and collapses the chain into one URL. Size mutations may repeat when a rect separates them. Arrays without rect produce the same URLs as before. Mapped coordinates are rounded, so the cut can differ by one pixel from a step-by-step edit. rotate, flip, pixelRatio, coverBox and padBox in positions that the optimizer can not honor throw an error that names the mutations. New exports: imageUrl, ImageUrlBuilder, ImageUrlProps, MutationProps, Rect, SourceSize.

    Add the rectFraction mutation (and imageUrl(...).rectFraction) with fractions and "full", and the keywords "left", "center", "right" for x and "top", "middle", "bottom" for y. A single rectFraction stays in the URL as fractions, needs no source even after fitBox, fitWidth, fitHeight or stretch (a resize keeps fractions) and throws after coverBox or padBox. It needs source when the result size depends on the canvas (a size mutation before it and none or enlarge: false after it) and next to any other rect. New export: RectFraction. The viewer request function is now fully minified (identifiers and syntax, ADR-021) and is 6767 bytes, far below the 10240 byte limit. Behavior is unchanged.

    Add focal point cropping: fit=crop&crop=focalpoint&fp-x=..&fp-y=..&fp-z=... fp-x and fp-y are fractions (0 to 1, default 0.5) and the box is centred on the point and clamped to stay inside the image. fp-z (1 to 100, default 1, imgix semantics: 2 is 200 percent) zooms around the point. Values are rounded to at most 4 decimals, defaults are dropped, and crop=focalpoint without a non-default value canonicalizes to plain fit=crop. fp-* without crop=focalpoint, crop=focalpoint without fit=crop, and out-of-range values answer 400, at the edge as well. A zoomed image above maxPixels answers 400. Size buckets use the zoomed cover scale. Needs the native module like fit=crop. coverBox.position accepts a focal point { x, y, zoom? }. New export: FocalPoint. faces, edges and facearea stay unsupported.

    Add crop=entropy with fit=crop. The native module scores a 16x16 grid of the scaled image by edge density and anchors the box at the weighted centroid (the focal point geometry at fp-z=1). It needs the native module (501 without), answers 400 for animated images, without fit=crop, and combined with fp-* or edge values, also at the edge. coverBox.position accepts "entropy". New export: EntropyPosition. Native module: new optional entropy step flag. crop=faces and crop=edges stay unsupported.

Patch Changes

  • c838917: Document the cost of each operation measured on a deployed stack: new how-to docs/how-to/performance.md and a README section. Only the first request for a URL (per edge location) pays, a function timeout is not cached but repeats on every request (see the cache policy changeset), rect decodes the whole original on every miss. The documented cost of a 30 frame 2000x2000 animation is corrected to the measured 1.7 seconds and 156 MB. No behavior change.

@ivanbarlog
ivanbarlog merged commit 6a186bf into main Dec 3, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
image-optimizer-visual-review — 798515ee Deployed Dec 3, 2026 by github-actions[bot] via visual-review #18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant