← Back to Pull requests

[vite-plugin v1 backport] Support local image URL transformations #17315

Closed
unknown closed this pull request without merging on Dec 03, 2026 16:58 UTC
View on GitHub
unknown unknown commented on Dec 01, 2026 14:04 UTC
Author

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.

---

  • Tests

  • - [x] Tests included/updated
    - [ ] Automated tests not possible - manual testing has been completed as follows:
    - [ ] Additional testing not necessary because:
  • Public documentation

  • - [ ] Cloudflare docs PR(s):
    - [x] Documentation not necessary because: upstream docs follow general availability; the changeset explains local behavior and limitations.

    [!NOTE]

    This is a contribution from an AI agent: Codex.

    <!-- devin-review-badge-begin -->

    ---

    <a href="https://cloudflare.devinenterprise.com/review/cloudflare/workers-sdk/pull/17315" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
    <!-- devin-review-badge-end -->

    Diff: 331 lines (+248 / -83) across 4 files Reviewer: NuroDev Review duration: 3054m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 331 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #17315"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%