Skip to content

feat(dynjandi): add Dynjandi image CDN provider - #201

Draft
baldurpan wants to merge 2 commits into
ascorbic:mainfrom
baldurpan:feature/dynjandi-provider
Draft

baldurpan wants to merge 2 commits into
ascorbic:mainfrom
baldurpan:feature/dynjandi-provider

Conversation

@baldurpan

Copy link
Copy Markdown

Adds Dynjandi as an image CDN provider.

URL shape

Dynjandi serves an uploaded image at /<id> and a variant at /<id>/ followed by a chain of -/<operation>/<arguments>/ segments, applied in order:

https://cdn.dynjandi.dev/556eef1b-9ce4-4c64-b7a2-fa723772334e/-/resize/800x450/-/format/webp/-/quality/80/

The grammar is specified in the project's OpenAPI spec (the "Variant URL grammar" section).

Operations

  • width and height map to resize/<w>x<h>/, either side optional. With both, the service scales to cover and centre-crops, which is the default fit unpic asks for.
  • format maps to format/<f>/ for jpeg, png, webp and avif. jpg is sent as jpeg.
  • quality maps to quality/<q>/: an integer from 1 to 100, or one of the service's named levels (lightest, lighter, normal, smart, better, best).
  • crop is provider-specific and carries the grammar's <w>x<h>/<position> text (compass, attention, entropy, face chains, or focal/<x>x<y>). scale_crop is read as crop. extract reads crops back, so transform of an already-cropped URL keeps the crop.
  • Operations are emitted in a fixed order: crop, resize, format, quality.

The service answers any operation it doesn't support with a 400, so anything without a Dynjandi equivalent is dropped, never sent. That includes out-of-range or non-integer sizes, unsupported formats and unknown quality values.

Defaults and caveats

  • No default format. The service doesn't negotiate format from Accept, and format/auto is a 400, so when no format is given the original format is served.
  • Upscaling. The service upscales when asked for more pixels than the source has, and the provider can't know the source size from the URL. This departs from the "never upscale" guideline in CONTRIBUTING.md. It is documented in the provider's header comment.

Detection

cdn.dynjandi.dev is added to data/domains.json. Custom domains aren't detected and need provider: "dynjandi".

Checks

  • deno check src/ is clean, and deno test -A src/ passes (88 tests, 314 steps). deno fmt --check is clean on every touched file except deno.jsonc, which already lacks a final newline on main. deno publish --dry-run passes.
  • e2e.test.ts: both Dynjandi steps pass against production with the demo image, a CC0 photo of the Dynjandi waterfall. Six other steps (Cloudflare ×2, IPX ×2, Next.js, Vercel) fail the same way on the base commit without this change.
  • 4031 URLs from generate were parsed with the service's own grammar package (@dynjandi/transform-grammar). They cover a matrix of every operation, alone and combined, at boundary values. URLs built by the Dynjandi SDK extract back to the same width, height, format, quality and crop.
  • A srcset built by @unpic/core with this provider loads at every width (640w to 1600w).

Adds extract, generate and transform for Dynjandi image URLs
(https://cdn.dynjandi.dev). Supports resize, crop, format and quality, and
drops anything the service would reject. Wire-up follows separately.
@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1ac8d20

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
unpic Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@baldurpan
baldurpan marked this pull request as draft October 4, 2026 22:09
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