Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 6ecb639 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
@mglewis @petebacondarwin — please check this v1 backport of #16678 and approve if it looks good. petebacondarwin is the verified latest human ant-core approver before merge. #17293 already supplies the original public Miniflare/Wrangler runtime. This remaining integration maps v1 Wrangler fields into the same router image options and copies the public-URL setting, original playground regression and PNG. Published Wrangler already supplies the per-worker route-hostname fields. The original test fails 404 before this change and passes in dev and preview after it; build, full checks and retained package tests pass. The PR description explains the V4WorkerOptions and wrangler.jsonc adaptations. |
|
Codeowners approval required for this PR:
|
commit: |
There was a problem hiding this comment.
✅ Approved — This backport passes the images.url_transformations config, the route hostname (routes takes precedence over an inherited route) and the public URL to the router worker, with regression tests for worker, assets-only and middleware modes. The only change since the last review is the Windows temp-path fix in the spec, and no issues were found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
Release risk: low.
The change adds local /cdn-cgi/image/ transformation support. A minor plugin changeset is the right classification for a new capability. Deployed production behaviour is unchanged.
🔒 Security: ✅ LGTM
No issues found.
enabledandallowed_originsreach the router unchanged, so the origin allowlist still applies.- In middleware mode, the public URL comes from the socket address, not from request headers.
📖 AGENTS.md: ✅ LGTM
No issues found.
📋 Code Quality: ✅ LGTM
src/miniflare-options.ts:- The route hostname is taken from
routes[0]whenroutesis set and fromrouteotherwise. This matches Wrangler'sroutes ?? routeprecedence. - An empty
routes: []leaves the hostname unset. - A config with no
imagesleavesimageUrlTransformationsasundefined, so existing behaviour does not change.
- The route hostname is taken from
src/plugins/dev.ts:- In middleware mode,
publicUrlis set from the connection's socket once Miniflare is ready. - Every other mode still sets it from the
listeninghandler.
- In middleware mode,
- Tests:
- The spec covers a single route, the first of several routes, an environment's
routesover an inheritedroute, no route, a disallowed origin (403), and middleware mode with forgedHostandX-Forwarded-*headers. - The new Windows
realpathtemp-directory setup follows the existing pattern inruntime-bindings.spec.ts.
- The spec covers a single route, the first of several routes, an environment's
📝 Documentation: ✅ LGTM
No issues found. The changeset describes the new local behaviour for plugin users.
Reviewed commit: 6ecb639f
4fa533d to
3710536
Compare
…ute hostname Match Wrangler's `routes ?? route` precedence so a named environment's `routes` decides the hostname used to check same-host image sources against `allowed_origins`, even when a top-level `route` is inherited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
clanky review |
…m spec Vite cannot load the Worker entry from the 8.3 short temp path on Windows runners, so every worker-mode case failed. Use the same realpath setup as `runtime-bindings.spec.ts`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Backports the remaining Vite integration and regression coverage from #16678. With images.url_transformations enabled, /cdn-cgi/image/ transforms work locally, including Vite public/ files. Disabled transformations return 404 and disallowed origins return 403, as upstream specifies.
Depends on #17293, which already supplies the original Miniflare 5.20261129.0-beta runtime and coupled Wrangler 4.170.0 / workers-utils 0.60.0 graph from #17276. This PR adds no dependency upgrades or absent public source. The upstream runtime implementation and its tests remain in Miniflare. Wrangler's published getMiniflareWorkerOptions already supplies the per-worker image and route-hostname options.
Necessary v1 adaptations: v1 uses V4WorkerOptions and Wrangler snake_case config, so the router receives the equivalent imageUrlTransformations object (enabled / allowedOrigins). The upstream unsafeImageUrlTransformationsFetchViaPublicUrl option is copied directly. The original playground test and PNG are copied unchanged; cloudflare.config.ts is represented by v1's wrangler.jsonc with the equivalent name/date/assets/images fields. No alternate transform implementation is introduced. Wrangler, direct Miniflare and Vitest consumers receive their integration from upstream; this diff completes Vite v1.
Validation: the original playground regression fails before this integration (404 instead of 200) on the already-upgraded runtime and passes afterward in both dev and build/preview (2 tests each). Node 22.22.1 / pnpm 10.33.0: build passes, all 58 check tasks pass, all 8 retained package-test tasks pass including 287 plugin tests. OS and supported Vite matrix CI will validate the published PR head. A plugin minor changeset describes the new capability and intentional local routing behavior change.
Note
This is a contribution from an AI agent: Codex.