From bb016f13c2694315db1dc3afb7194a1e35b2ea0f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 00:41:23 +0000 Subject: [PATCH] Version Packages --- .changeset/containers-list-dash-api.md | 10 - .changeset/filter-metadata-sqlite.md | 7 - .changeset/four-teachers-double.md | 8 - .../graduate-nodejs-experimental-flags.md | 7 - .changeset/local-explorer-worker-filter.md | 10 - .changeset/nasty-bars-study.md | 7 - .changeset/open-gifts-repair.md | 7 - .changeset/purple-towns-tell.md | 7 - .changeset/sour-lions-march.md | 12 - .changeset/sour-sides-enjoy.md | 14 - .changeset/spicy-buttons-heal.md | 7 - .changeset/tender-hoops-strive.md | 11 - .changeset/workflows-instance-methods.md | 17 - .../workflows-vitest-pool-waitforstatus.md | 5 - packages/containers-shared/CHANGELOG.md | 16 + packages/containers-shared/package.json | 2 +- packages/local-explorer-ui/CHANGELOG.md | 26 + packages/local-explorer-ui/package.json | 2 +- packages/miniflare/CHANGELOG.md | 420 +++++---- packages/miniflare/package.json | 2 +- packages/pages-shared/CHANGELOG.md | 8 + packages/pages-shared/package.json | 2 +- packages/unenv-preset/CHANGELOG.md | 12 +- packages/unenv-preset/package.json | 2 +- packages/vite-plugin-cloudflare/CHANGELOG.md | 200 +++-- packages/vite-plugin-cloudflare/package.json | 2 +- packages/vitest-pool-workers/CHANGELOG.md | 172 ++-- packages/vitest-pool-workers/package.json | 2 +- packages/workers-utils/CHANGELOG.md | 44 +- packages/workers-utils/package.json | 2 +- packages/workflows-shared/CHANGELOG.md | 45 +- packages/workflows-shared/package.json | 2 +- packages/wrangler/CHANGELOG.md | 834 +++++++++++------- packages/wrangler/package.json | 2 +- 34 files changed, 1066 insertions(+), 860 deletions(-) delete mode 100644 .changeset/containers-list-dash-api.md delete mode 100644 .changeset/filter-metadata-sqlite.md delete mode 100644 .changeset/four-teachers-double.md delete mode 100644 .changeset/graduate-nodejs-experimental-flags.md delete mode 100644 .changeset/local-explorer-worker-filter.md delete mode 100644 .changeset/nasty-bars-study.md delete mode 100644 .changeset/open-gifts-repair.md delete mode 100644 .changeset/purple-towns-tell.md delete mode 100644 .changeset/sour-lions-march.md delete mode 100644 .changeset/sour-sides-enjoy.md delete mode 100644 .changeset/spicy-buttons-heal.md delete mode 100644 .changeset/tender-hoops-strive.md delete mode 100644 .changeset/workflows-instance-methods.md delete mode 100644 .changeset/workflows-vitest-pool-waitforstatus.md diff --git a/.changeset/containers-list-dash-api.md b/.changeset/containers-list-dash-api.md deleted file mode 100644 index 6c9a36518d6d..000000000000 --- a/.changeset/containers-list-dash-api.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -"wrangler": minor -"@cloudflare/containers-shared": patch ---- - -Rewrite `wrangler containers list` to use the paginated Dash API endpoint - -`wrangler containers list` now fetches from the `/dash/applications` endpoint instead of `/applications`, displaying results in a paginated table with columns for ID, Name, State, Live Instances, and Last Modified. Container state is derived from health instance counters (active, degraded, provisioning, ready). - -The command supports `--per-page` (default 25) for interactive pagination with Enter to load more and q/Esc to quit, and `--json` for machine-readable output. Non-interactive environments load all results in a single request. diff --git a/.changeset/filter-metadata-sqlite.md b/.changeset/filter-metadata-sqlite.md deleted file mode 100644 index 304ec2403554..000000000000 --- a/.changeset/filter-metadata-sqlite.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"miniflare": patch ---- - -Exclude `metadata.sqlite` when listing Durable Object instances - -An upcoming version of workerd stores per-namespace alarm metadata in a `metadata.sqlite` file alongside per-actor `.sqlite` files. The local explorer's DO object listing was treating this file as a Durable Object instance, inflating counts and breaking pagination. This file is now filtered out. diff --git a/.changeset/four-teachers-double.md b/.changeset/four-teachers-double.md deleted file mode 100644 index 587fa4cd9a15..000000000000 --- a/.changeset/four-teachers-double.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"wrangler": minor -"@cloudflare/workers-utils": minor ---- - -Add Stream binding support to Wrangler and workers-utils - -Wrangler and workers-utils now recognize the `stream` binding in configuration, deployment metadata, and generated worker types. This enables projects to declare Stream bindings in `wrangler.json` and have the binding represented consistently across validation, metadata mapping, and type generation. diff --git a/.changeset/graduate-nodejs-experimental-flags.md b/.changeset/graduate-nodejs-experimental-flags.md deleted file mode 100644 index 4d51dc683fee..000000000000 --- a/.changeset/graduate-nodejs-experimental-flags.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@cloudflare/unenv-preset": minor ---- - -Graduate experimental Node.js module flags to date-gated flags - -The following Node.js module compatibility flags are no longer experimental and are now automatically enabled for workers using `nodejs_compat` with a compatibility date of `2026-03-17` or later: `perf_hooks`, `v8`, `tty`, `child_process`, `worker_threads`, `readline`, and `repl`. Each flag can still be explicitly enabled or disabled via the corresponding `enable_`/`disable_` compatibility flags. diff --git a/.changeset/local-explorer-worker-filter.md b/.changeset/local-explorer-worker-filter.md deleted file mode 100644 index 22c43bae29a2..000000000000 --- a/.changeset/local-explorer-worker-filter.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -"miniflare": minor -"@cloudflare/local-explorer-ui": minor ---- - -Add worker filtering to the local explorer UI - -When multiple workers share a dev registry, all their bindings were previously shown together in a single flat list. The explorer now shows a worker selector dropdown, letting you inspect each worker's bindings independently. - -The selected worker is reflected in the URL as a `?worker=` search param, so deep links work correctly. By default the explorer selects the worker that is hosting the dashboard itself. diff --git a/.changeset/nasty-bars-study.md b/.changeset/nasty-bars-study.md deleted file mode 100644 index 679cab07d874..000000000000 --- a/.changeset/nasty-bars-study.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@cloudflare/local-explorer-ui": patch ---- - -Fixed listing internal Cloudflare Durable Object tables. - -The internal `_cf_KV` table that is used when using Durable Objects KV storage is now hidden from the table list dropdown in the local explorer as it is not accessible. diff --git a/.changeset/open-gifts-repair.md b/.changeset/open-gifts-repair.md deleted file mode 100644 index 055037ac9525..000000000000 --- a/.changeset/open-gifts-repair.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@cloudflare/containers-shared": minor ---- - -containers: Upgrade proxy-everything to cloudflare/proxy-everything:3cb1195 - -This proxy-everything version adds support to filter DNS queries, necessary for interceptOutboundHttp constrained by domain. diff --git a/.changeset/purple-towns-tell.md b/.changeset/purple-towns-tell.md deleted file mode 100644 index 93d081319b7b..000000000000 --- a/.changeset/purple-towns-tell.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@cloudflare/vite-plugin": patch ---- - -Avoid splicing into the middleware stack for Vite versions other than v6 - -Previously, the plugin spliced its pre-middleware into the Vite middleware stack relative to `viteCachedTransformMiddleware`. In Vite 8, this middleware can be omitted in some scenarios, which would cause the splice to fail. The plugin now registers pre-middleware using `server.middlewares.use()` directly, which places it in the correct position for Vite 7+. For Vite 6, the middleware is moved to the correct position in a post hook. diff --git a/.changeset/sour-lions-march.md b/.changeset/sour-lions-march.md deleted file mode 100644 index 0d7f22c8334f..000000000000 --- a/.changeset/sour-lions-march.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"wrangler": patch ---- - -Add backward-compatible autoconfig support for Astro v5 and v4 projects - -The `astro add cloudflare` command in older Astro versions installs the latest adapter version, which causes compatibility issues. This change adds manual configuration logic for projects using Astro versions before 6.0.0: - -- **Astro 6.0.0+**: Uses the native `astro add cloudflare` command (unchanged behavior) -- **Astro 5.x**: Installs `@astrojs/cloudflare@12` and manually configures the adapter -- **Astro 4.x**: Installs `@astrojs/cloudflare@11` and manually configures the adapter -- **Astro < 4.0.0**: Returns an error prompting the user to upgrade diff --git a/.changeset/sour-sides-enjoy.md b/.changeset/sour-sides-enjoy.md deleted file mode 100644 index 61232df4a7de..000000000000 --- a/.changeset/sour-sides-enjoy.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -"@cloudflare/local-explorer-ui": minor -"miniflare": minor ---- - -Add R2 support to the local explorer. - -The local explorer now supports the following: - -- Viewing, modifying & deleting objects -- Uploading files -- Creating directories / prefixes - -Note: The local explorer is an experimental WIP feature that is now enabled by default. This can still be opt-ed out of by using `X_LOCAL_EXPLORER=false` to disable it. diff --git a/.changeset/spicy-buttons-heal.md b/.changeset/spicy-buttons-heal.md deleted file mode 100644 index b638bb366064..000000000000 --- a/.changeset/spicy-buttons-heal.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -Handle registry ports when matching container image digests - -Wrangler now strips tags without breaking registry ports when comparing local images to remote digests. This prevents unnecessary pushes for tags like `localhost:5000/app:tag`. diff --git a/.changeset/tender-hoops-strive.md b/.changeset/tender-hoops-strive.md deleted file mode 100644 index 02207da209de..000000000000 --- a/.changeset/tender-hoops-strive.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"@cloudflare/vite-plugin": minor -"miniflare": minor -"wrangler": minor ---- - -Enable local explorer by default - -This ungates the local explorer, a UI that lets you inspect the state of D1, DO and KV resources locally by visiting `/cdn-cgi/explorer` during local development. - -Note: this feature is still experimental, and can be disabled by setting the env var `X_LOCAL_EXPLORER=false`. diff --git a/.changeset/workflows-instance-methods.md b/.changeset/workflows-instance-methods.md deleted file mode 100644 index 5caac400c135..000000000000 --- a/.changeset/workflows-instance-methods.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -"@cloudflare/workflows-shared": minor -"miniflare": minor ---- - -Workflow instances now support pause, resume, restart, and terminate in local dev. - -```js -const instance = await env.MY_WORKFLOW.create({ - id: "my-instance", -}); - -await instance.pause(); // pauses after the current step completes -await instance.resume(); // resumes from where it left off -await instance.restart(); // restarts the workflow from the beginning -await instance.terminate(); // terminates the workflow immediately -``` diff --git a/.changeset/workflows-vitest-pool-waitforstatus.md b/.changeset/workflows-vitest-pool-waitforstatus.md deleted file mode 100644 index 94b6398018a5..000000000000 --- a/.changeset/workflows-vitest-pool-waitforstatus.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@cloudflare/vitest-pool-workers": patch ---- - -Workflows testing util `waitForStatus` now supports waiting for "terminated" and "paused" states. diff --git a/packages/containers-shared/CHANGELOG.md b/packages/containers-shared/CHANGELOG.md index a7c996494c5c..c52bb004f931 100644 --- a/packages/containers-shared/CHANGELOG.md +++ b/packages/containers-shared/CHANGELOG.md @@ -1,5 +1,21 @@ # @cloudflare/containers-shared +## 0.13.0 + +### Minor Changes + +- [#12943](https://github.com/cloudflare/workers-sdk/pull/12943) [`0f10583`](https://github.com/cloudflare/workers-sdk/commit/0f10583f53d050df06413e1f65fb147a4aea9976) Thanks [@gabivlj](https://github.com/gabivlj)! - containers: Upgrade proxy-everything to cloudflare/proxy-everything:3cb1195 + + This proxy-everything version adds support to filter DNS queries, necessary for interceptOutboundHttp constrained by domain. + +### Patch Changes + +- [#12893](https://github.com/cloudflare/workers-sdk/pull/12893) [`782df44`](https://github.com/cloudflare/workers-sdk/commit/782df4495f14f1366cf03e808ddddea0102eb011) Thanks [@gpanders](https://github.com/gpanders)! - Rewrite `wrangler containers list` to use the paginated Dash API endpoint + + `wrangler containers list` now fetches from the `/dash/applications` endpoint instead of `/applications`, displaying results in a paginated table with columns for ID, Name, State, Live Instances, and Last Modified. Container state is derived from health instance counters (active, degraded, provisioning, ready). + + The command supports `--per-page` (default 25) for interactive pagination with Enter to load more and q/Esc to quit, and `--json` for machine-readable output. Non-interactive environments load all results in a single request. + ## 0.12.0 ### Minor Changes diff --git a/packages/containers-shared/package.json b/packages/containers-shared/package.json index 390951ef1fd5..298fe760d15d 100644 --- a/packages/containers-shared/package.json +++ b/packages/containers-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/containers-shared", - "version": "0.12.0", + "version": "0.13.0", "private": true, "description": "Package that contains shared container functionality for Cloudflare Workers SDK.", "homepage": "https://github.com/cloudflare/workers-sdk/tree/main/packages/containers-shared#readme", diff --git a/packages/local-explorer-ui/CHANGELOG.md b/packages/local-explorer-ui/CHANGELOG.md index 16524806c6e0..248f418a217e 100644 --- a/packages/local-explorer-ui/CHANGELOG.md +++ b/packages/local-explorer-ui/CHANGELOG.md @@ -1,5 +1,31 @@ # @cloudflare/local-explorer-ui +## 0.9.0 + +### Minor Changes + +- [#12972](https://github.com/cloudflare/workers-sdk/pull/12972) [`cb71403`](https://github.com/cloudflare/workers-sdk/commit/cb714036d95ad0429f7e7a24c3c3a4317748ce22) Thanks [@NuroDev](https://github.com/NuroDev)! - Add worker filtering to the local explorer UI + + When multiple workers share a dev registry, all their bindings were previously shown together in a single flat list. The explorer now shows a worker selector dropdown, letting you inspect each worker's bindings independently. + + The selected worker is reflected in the URL as a `?worker=` search param, so deep links work correctly. By default the explorer selects the worker that is hosting the dashboard itself. + +- [#12888](https://github.com/cloudflare/workers-sdk/pull/12888) [`3a1c149`](https://github.com/cloudflare/workers-sdk/commit/3a1c149e1edf126ab072bf74ed624d3c42d561fb) Thanks [@emily-shen](https://github.com/emily-shen)! - Add R2 support to the local explorer. + + The local explorer now supports the following: + + - Viewing, modifying & deleting objects + - Uploading files + - Creating directories / prefixes + + Note: The local explorer is an experimental WIP feature that is now enabled by default. This can still be opt-ed out of by using `X_LOCAL_EXPLORER=false` to disable it. + +### Patch Changes + +- [#12918](https://github.com/cloudflare/workers-sdk/pull/12918) [`3de3ce5`](https://github.com/cloudflare/workers-sdk/commit/3de3ce519383b634bd1315eb94d789ec8def0670) Thanks [@NuroDev](https://github.com/NuroDev)! - Fixed listing internal Cloudflare Durable Object tables. + + The internal `_cf_KV` table that is used when using Durable Objects KV storage is now hidden from the table list dropdown in the local explorer as it is not accessible. + ## 0.8.2 ### Patch Changes diff --git a/packages/local-explorer-ui/package.json b/packages/local-explorer-ui/package.json index e4f1de61857c..5f28d31fc112 100644 --- a/packages/local-explorer-ui/package.json +++ b/packages/local-explorer-ui/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/local-explorer-ui", - "version": "0.8.2", + "version": "0.9.0", "private": true, "type": "module", "scripts": { diff --git a/packages/miniflare/CHANGELOG.md b/packages/miniflare/CHANGELOG.md index 14f7938d688e..cd807c923729 100644 --- a/packages/miniflare/CHANGELOG.md +++ b/packages/miniflare/CHANGELOG.md @@ -1,5 +1,50 @@ # miniflare +## 4.20260317.1 + +### Minor Changes + +- [#12972](https://github.com/cloudflare/workers-sdk/pull/12972) [`cb71403`](https://github.com/cloudflare/workers-sdk/commit/cb714036d95ad0429f7e7a24c3c3a4317748ce22) Thanks [@NuroDev](https://github.com/NuroDev)! - Add worker filtering to the local explorer UI + + When multiple workers share a dev registry, all their bindings were previously shown together in a single flat list. The explorer now shows a worker selector dropdown, letting you inspect each worker's bindings independently. + + The selected worker is reflected in the URL as a `?worker=` search param, so deep links work correctly. By default the explorer selects the worker that is hosting the dashboard itself. + +- [#12888](https://github.com/cloudflare/workers-sdk/pull/12888) [`3a1c149`](https://github.com/cloudflare/workers-sdk/commit/3a1c149e1edf126ab072bf74ed624d3c42d561fb) Thanks [@emily-shen](https://github.com/emily-shen)! - Add R2 support to the local explorer. + + The local explorer now supports the following: + + - Viewing, modifying & deleting objects + - Uploading files + - Creating directories / prefixes + + Note: The local explorer is an experimental WIP feature that is now enabled by default. This can still be opt-ed out of by using `X_LOCAL_EXPLORER=false` to disable it. + +- [#12848](https://github.com/cloudflare/workers-sdk/pull/12848) [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb) Thanks [@emily-shen](https://github.com/emily-shen)! - Enable local explorer by default + + This ungates the local explorer, a UI that lets you inspect the state of D1, DO and KV resources locally by visiting `/cdn-cgi/explorer` during local development. + + Note: this feature is still experimental, and can be disabled by setting the env var `X_LOCAL_EXPLORER=false`. + +- [#12881](https://github.com/cloudflare/workers-sdk/pull/12881) [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787) Thanks [@pombosilva](https://github.com/pombosilva)! - Workflow instances now support pause, resume, restart, and terminate in local dev. + + ```js + const instance = await env.MY_WORKFLOW.create({ + id: "my-instance", + }); + + await instance.pause(); // pauses after the current step completes + await instance.resume(); // resumes from where it left off + await instance.restart(); // restarts the workflow from the beginning + await instance.terminate(); // terminates the workflow immediately + ``` + +### Patch Changes + +- [#12960](https://github.com/cloudflare/workers-sdk/pull/12960) [`3c988e2`](https://github.com/cloudflare/workers-sdk/commit/3c988e204ac0d6117ace9cc8fa5fd2479868811c) Thanks [@penalosa](https://github.com/penalosa)! - Exclude `metadata.sqlite` when listing Durable Object instances + + An upcoming version of workerd stores per-namespace alarm metadata in a `metadata.sqlite` file alongside per-actor `.sqlite` files. The local explorer's DO object listing was treating this file as a Durable Object instance, inflating counts and breaking pagination. This file is now filtered out. + ## 4.20260317.0 ### Patch Changes @@ -53,6 +98,7 @@ - [#12864](https://github.com/cloudflare/workers-sdk/pull/12864) [`ecc7f79`](https://github.com/cloudflare/workers-sdk/commit/ecc7f792f950fc786ff40fa140bd8907bd26ff31) Thanks [@NuroDev](https://github.com/NuroDev)! - Fix local explorer route matching to be more precise Previously, the route matching used `startsWith("/cdn-cgi/explorer")` which would incorrectly match paths like `/cdn-cgi/explorerfoo` or `/cdn-cgi/explorereeeeee`, causing unexpected behavior. The route matching has been improved to only match: + - `/cdn-cgi/explorer` (exact match) - `/cdn-cgi/explorer/` and any sub-paths (e.g., `/cdn-cgi/explorer/api/*`) @@ -127,16 +173,16 @@ ```jsonc // wrangler.jsonc { - "workflows": [ - { - "binding": "MY_WORKFLOW", - "name": "my-workflow", - "class_name": "MyWorkflow", - "limits": { - "steps": 5000, - }, - }, - ], + "workflows": [ + { + "binding": "MY_WORKFLOW", + "name": "my-workflow", + "class_name": "MyWorkflow", + "limits": { + "steps": 5000 + } + } + ] } ``` @@ -213,7 +259,7 @@ ```typescript const mf = new Miniflare({ - /* options */ + /* options */ }); // Purge the default cache @@ -290,6 +336,7 @@ - [#12466](https://github.com/cloudflare/workers-sdk/pull/12466) [`caf9b11`](https://github.com/cloudflare/workers-sdk/commit/caf9b114391d7708b38e8d37bca6dae6f2b4927e) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Add `MINIFLARE_CACHE_DIR` environment variable and smart cache directory detection Miniflare now intelligently detects where to store its cf.json cache file: + 1. Use `MINIFLARE_CACHE_DIR` env var if set 2. Use existing cache directory if found (`node_modules/.mf` or `.wrangler/cache`) 3. Create cache in `node_modules/.mf` if `node_modules` exists @@ -330,6 +377,7 @@ - [#12469](https://github.com/cloudflare/workers-sdk/pull/12469) [`2d90127`](https://github.com/cloudflare/workers-sdk/commit/2d90127f47dbcacf377842b3452d00a68a7abdc9) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Add environment variables to control cf.json fetching behavior You can now use environment variables to control how Miniflare handles the `Request.cf` object caching: + - `CLOUDFLARE_CF_FETCH_ENABLED` - Set to "false" to disable fetching entirely and use fallback data. No `node_modules/.mf/cf.json` file will be created. Defaults to "true". - `CLOUDFLARE_CF_FETCH_PATH` - Set to a custom path to use a different location for caching the cf.json file instead of the default `node_modules/.mf/cf.json`. @@ -386,6 +434,7 @@ - [#12267](https://github.com/cloudflare/workers-sdk/pull/12267) [`83adb2c`](https://github.com/cloudflare/workers-sdk/commit/83adb2cb7f909857d79208474b78cdb7ac4e0638) Thanks [@NuroDev](https://github.com/NuroDev)! - Implement local D1 API for experimental/WIP local resource explorer The following APIs have been implemented: + - `GET /d1/database` - Returns a list of D1 databases. - `POST /d1/database/{database_id}/raw` - Returns the query result rows as arrays rather than objects. @@ -491,9 +540,9 @@ ```jsonc // wrangler.json { - "dev": { - "inspector_ip": "0.0.0.0", - }, + "dev": { + "inspector_ip": "0.0.0.0" + } } ``` @@ -537,6 +586,7 @@ into miniflare and @cloudflare/vitest-pool-workers. Other dependencies remain external for technical reasons: + - `sharp`: Native binary with platform-specific builds - `undici`: Dynamically required at runtime in worker threads - `ws`: Has optional native bindings for performance @@ -568,19 +618,19 @@ ```javascript await env.EMAIL.send({ - from: { name: "Alice", email: "alice@example.com" }, - to: ["bob@example.com"], - subject: "Hello", - text: "Plain text version", - html: "

HTML version

", - attachments: [ - { - disposition: "attachment", - filename: "report.pdf", - type: "application/pdf", - content: pdfData, - }, - ], + from: { name: "Alice", email: "alice@example.com" }, + to: ["bob@example.com"], + subject: "Hello", + text: "Plain text version", + html: "

HTML version

", + attachments: [ + { + disposition: "attachment", + filename: "report.pdf", + type: "application/pdf", + content: pdfData, + }, + ], }); ``` @@ -626,10 +676,10 @@ ```js export default { - async fetch(request) { - const originalHostname = request.headers.get("MF-Original-Hostname"); - // originalHostname contains the hostname before it was rewritten - }, + async fetch(request) { + const originalHostname = request.headers.get("MF-Original-Hostname"); + // originalHostname contains the hostname before it was rewritten + }, }; ``` @@ -650,6 +700,7 @@ reducing the number of external dependencies users need to trust. Bundled dependencies: + - **miniflare**: `acorn`, `acorn-walk`, `exit-hook`, `glob-to-regexp`, `stoppable` - **kv-asset-handler**: `mime` - **vite-plugin-cloudflare**: `@remix-run/node-fetch-server`, `defu`, `get-port`, `picocolors`, `tinyglobby` @@ -708,6 +759,7 @@ ### Minor Changes - [#11648](https://github.com/cloudflare/workers-sdk/pull/11648) [`eac5cf7`](https://github.com/cloudflare/workers-sdk/commit/eac5cf74db6d1b0865f5dc3a744ff28e695d53ca) Thanks [@pombosilva](https://github.com/pombosilva)! - Add Workflows test handlers in vitest-pool-workers to get the Workflow instance output and error: + - `getOutput()`: Returns the output of the successfully completed Workflow instance. - `getError()`: Returns the error information of the errored Workflow instance. @@ -716,7 +768,7 @@ ```ts // First wait for the workflow instance to complete: await expect( - instance.waitForStatus({ status: "complete" }) + instance.waitForStatus({ status: "complete" }) ).resolves.not.toThrow(); // Then, get its output @@ -724,7 +776,7 @@ // Or for errored workflow instances, get their error: await expect( - instance.waitForStatus({ status: "errored" }) + instance.waitForStatus({ status: "errored" }) ).resolves.not.toThrow(); const error = await instance.getError(); ``` @@ -1301,11 +1353,11 @@ ```typescript const mf = new Miniflare({ - // ... other options - unsafeHandleDevRegistryUpdate(registry) { - console.log("Dev registry updated:", registry); - // Handle registry updates (e.g., reprint bindings, reload config) - }, + // ... other options + unsafeHandleDevRegistryUpdate(registry) { + console.log("Dev registry updated:", registry); + // Handle registry updates (e.g., reprint bindings, reload config) + }, }); ``` @@ -1635,6 +1687,7 @@ - [#9313](https://github.com/cloudflare/workers-sdk/pull/9313) [`92719a5`](https://github.com/cloudflare/workers-sdk/commit/92719a535bf6bae9d660a05d5c8f8823004929c5) Thanks [@edmundhung](https://github.com/edmundhung)! - feat: add Dev Registry support This change introduces two new options to support cross-process service bindings, durable objects and tail consumers via a file-system based registry, with backward compatibility to Wrangler’s implementation: + - **`unsafeDevRegistryPath`** (`string`): Filesystem path to the Dev Registry directory. - **`unsafeDevRegistryDurableObjectProxy`** (`boolean`): When enabled, exposes internal Durable Objects to other local dev sessions and allows Workers to connect to external Durable Objects. @@ -1644,10 +1697,10 @@ import { Miniflare } from "miniflare"; const mf = new Miniflare({ - scriptPath: "./dist/worker.js", - unsafeDevRegistryPath: "/registry", - unsafeDevRegistryDurableObjectProxy: true, - // ...other options + scriptPath: "./dist/worker.js", + unsafeDevRegistryPath: "/registry", + unsafeDevRegistryDurableObjectProxy: true, + // ...other options }); ``` @@ -1656,6 +1709,7 @@ - [#9440](https://github.com/cloudflare/workers-sdk/pull/9440) [`8c7ce77`](https://github.com/cloudflare/workers-sdk/commit/8c7ce7728ccc467aa19b60c8f32c90e6f06442d1) Thanks [@penalosa](https://github.com/penalosa)! - Preserve original error messages - [#9390](https://github.com/cloudflare/workers-sdk/pull/9390) [`80e75f4`](https://github.com/cloudflare/workers-sdk/commit/80e75f4a67b4e4b7a1bc92e0a93659e5d6f141dc) Thanks [@penalosa](https://github.com/penalosa)! - Support additional Mixed Mode resources in Wrangler: + - AI - Browser - Images @@ -1674,13 +1728,13 @@ ```js new Miniflare({ - serviceBindings: { - CUSTOM: { - node: (req, res) => { - res.end(`Hello world`); - }, - }, - }, + serviceBindings: { + CUSTOM: { + node: (req, res) => { + res.end(`Hello world`); + }, + }, + }, }); ``` @@ -1704,19 +1758,19 @@ ```js // Before this change / No `defaultPersistRoot` new Miniflare({ - kvPersist: undefined, // → "/(tmp)/kv" - d1Persist: true, // → "$PWD/.mf/d1" - r2Persist: false, // → "/(tmp)/r2" - cachePersist: "/my-cache", // → "/my-cache" + kvPersist: undefined, // → "/(tmp)/kv" + d1Persist: true, // → "$PWD/.mf/d1" + r2Persist: false, // → "/(tmp)/r2" + cachePersist: "/my-cache", // → "/my-cache" }); // With `defaultPersistRoot` new Miniflare({ - defaultPersistRoot: "/storage", - kvPersist: undefined, // → "/storage/kv" - d1Persist: true, // → "/storage/d1" - r2Persist: false, // → "/(tmp)/r2" - cachePersist: "/my-cache", // → "/my-cache" + defaultPersistRoot: "/storage", + kvPersist: undefined, // → "/storage/kv" + d1Persist: true, // → "/storage/d1" + r2Persist: false, // → "/(tmp)/r2" + cachePersist: "/my-cache", // → "/my-cache" }); ``` @@ -1874,13 +1928,13 @@ ```json { - "services": [ - { - "binding": "MY_SERVICE", - "service": "some-worker", - "props": { "foo": 123, "bar": "value" } - } - ] + "services": [ + { + "binding": "MY_SERVICE", + "service": "some-worker", + "props": { "foo": 123, "bar": "value" } + } + ] } ``` @@ -1890,9 +1944,9 @@ import { WorkerEntrypoint } from "cloudflare:workers"; export default class extends WorkerEntrypoint { - fetch() { - return new Response(JSON.stringify(this.ctx.props)); - } + fetch() { + return new Response(JSON.stringify(this.ctx.props)); + } } ``` @@ -2114,27 +2168,27 @@ import { Miniflare } from "miniflare"; const mf = new Miniflare({ - // the inspector proxy will be accessible through port 9229 - inspectorPort: 9229, - workers: [ - { - name: "worker-a", - scriptPath: "./worker-a.js", - // enable the inspector proxy for worker-a - unsafeInspectorProxy: true, - }, - { - name: "worker-b", - scriptPath: "./worker-b.js", - // worker-b is not going to be proxied - }, - { - name: "worker-c", - scriptPath: "./worker-c.js", - // enable the inspector proxy for worker-c - unsafeInspectorProxy: true, - }, - ], + // the inspector proxy will be accessible through port 9229 + inspectorPort: 9229, + workers: [ + { + name: "worker-a", + scriptPath: "./worker-a.js", + // enable the inspector proxy for worker-a + unsafeInspectorProxy: true, + }, + { + name: "worker-b", + scriptPath: "./worker-b.js", + // worker-b is not going to be proxied + }, + { + name: "worker-c", + scriptPath: "./worker-c.js", + // enable the inspector proxy for worker-c + unsafeInspectorProxy: true, + }, + ], }); ``` @@ -2672,6 +2726,7 @@ - [#6058](https://github.com/cloudflare/workers-sdk/pull/6058) [`31cd51f`](https://github.com/cloudflare/workers-sdk/commit/31cd51f251050b0d6db97857a8d1d5427c855d99) Thanks [@threepointone](https://github.com/threepointone)! - chore: Quieter builds This patch cleans up warnings we were seeing when doing a full build. Specifically: + - fixtures/remix-pages-app had a bunch of warnings about impending features that it should be upgraded to, so I did that. (tbh this one needs a full upgrade of packages, but we'll get to that later when we're upgrading across the codebase) - updated `@microsoft/api-extractor` so it didn't complain that it didn't match the `typescript` version (that we'd recently upgraded) - it also silenced a bunch of warnings when exporting types from `wrangler`. We'll need to fix those, but we'll do that when we work on unstable_dev etc. @@ -2805,20 +2860,20 @@ import { Miniflare } from "miniflare"; const mf = new Miniflare({ - workers: [ - { - wrappedBindings: { - Greeter: { - scriptName: "impl", - }, - }, - modules: true, - script: `export default { fetch(){ return new Response(''); } }`, - }, - { - modules: true, - name: "impl", - script: ` + workers: [ + { + wrappedBindings: { + Greeter: { + scriptName: "impl", + }, + }, + modules: true, + script: `export default { fetch(){ return new Response(''); } }`, + }, + { + modules: true, + name: "impl", + script: ` class Greeter { sayHello(name) { return "Hello " + name; @@ -2829,8 +2884,8 @@ return new Greeter(); } `, - }, - ], + }, + ], }); const { Greeter } = await mf.getBindings(); @@ -2850,21 +2905,21 @@ import { Miniflare } from "miniflare"; const mf = new Miniflare({ - workers: [ - { - modules: true, - script: `export default { fetch() { return new Response(''); } }`, - serviceBindings: { - SUM: { - name: "sum-worker", - entrypoint: "SumEntrypoint", - }, - }, - }, - { - modules: true, - name: "sum-worker", - script: ` + workers: [ + { + modules: true, + script: `export default { fetch() { return new Response(''); } }`, + serviceBindings: { + SUM: { + name: "sum-worker", + entrypoint: "SumEntrypoint", + }, + }, + }, + { + modules: true, + name: "sum-worker", + script: ` import { WorkerEntrypoint } from 'cloudflare:workers'; export default { fetch() { return new Response(''); } } @@ -2875,8 +2930,8 @@ } } `, - }, - ], + }, + ], }); const { SUM } = await mf.getBindings(); @@ -2942,17 +2997,17 @@ import { kCurrentWorker, Miniflare } from "miniflare"; const mf = new Miniflare({ - workers: [ - { - name: "a", - serviceBindings: { - A_RPC_SERVICE: { name: kCurrentWorker, entrypoint: "RpcEntrypoint" }, - A_NAMED_SERVICE: { name: "a", entrypoint: "namedEntrypoint" }, - B_NAMED_SERVICE: { name: "b", entrypoint: "anotherNamedEntrypoint" }, - }, - compatibilityFlags: ["rpc"], - modules: true, - script: ` + workers: [ + { + name: "a", + serviceBindings: { + A_RPC_SERVICE: { name: kCurrentWorker, entrypoint: "RpcEntrypoint" }, + A_NAMED_SERVICE: { name: "a", entrypoint: "namedEntrypoint" }, + B_NAMED_SERVICE: { name: "b", entrypoint: "anotherNamedEntrypoint" }, + }, + compatibilityFlags: ["rpc"], + modules: true, + script: ` import { WorkerEntrypoint } from "cloudflare:workers"; export class RpcEntrypoint extends WorkerEntrypoint { @@ -2965,17 +3020,17 @@ ... `, - }, - { - name: "b", - modules: true, - script: ` + }, + { + name: "b", + modules: true, + script: ` export const anotherNamedEntrypoint = { fetch(request, env, ctx) { return new Response("b:named:pong"); } }; `, - }, - ], + }, + ], }); ``` @@ -3041,6 +3096,7 @@ - [#5191](https://github.com/cloudflare/workers-sdk/pull/5191) [`27fb22b`](https://github.com/cloudflare/workers-sdk/commit/27fb22b7c6b224aecc852915d9fee600d9d86efc) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: ensure redirect responses handled correctly with `dispatchFetch()` Previously, if your Worker returned a redirect response, calling `dispatchFetch(url)` would send another request to the original `url` rather than the redirect. This change ensures redirects are followed correctly. + - If your Worker returns a relative redirect or an absolute redirect with the same origin as the original `url`, the request will be sent to the Worker. - If your Worker instead returns an absolute redirect with a different origin, the request will be sent to the Internet. - If a redirected request to a different origin returns an absolute redirect with the same origin as the original `url`, the request will also be sent to the Worker. @@ -3092,12 +3148,12 @@ import { Miniflare, Response } from "miniflare"; const mf = new Miniflare({ - serviceBindings: { - SERVICE(request, instance) { - assert(instance === mf); - return new Response(); - }, - }, + serviceBindings: { + SERVICE(request, instance) { + assert(instance === mf); + return new Response(); + }, + }, }); ``` @@ -3117,27 +3173,27 @@ import { Miniflare } from "miniflare"; const mf1 = new Miniflare({ - scriptPath: "index.mjs", + scriptPath: "index.mjs", }); const mf2 = new Miniflare({ - rootPath: "a/b", - scriptPath: "c/index.mjs", + rootPath: "a/b", + scriptPath: "c/index.mjs", }); const mf3 = new Miniflare({ - rootPath: "/a/b", - workers: [ - { - name: "1", - rootPath: "c", - scriptPath: "index.mjs", - }, - { - name: "2", - scriptPath: "index.mjs", - }, - ], + rootPath: "/a/b", + workers: [ + { + name: "1", + rootPath: "c", + scriptPath: "index.mjs", + }, + { + name: "2", + scriptPath: "index.mjs", + }, + ], }); ``` @@ -3153,11 +3209,11 @@ import { kCurrentWorker, Miniflare } from "miniflare"; const mf = new Miniflare({ - serviceBindings: { - SELF: kCurrentWorker, - }, - modules: true, - script: `export default { + serviceBindings: { + SELF: kCurrentWorker, + }, + modules: true, + script: `export default { fetch(request, env, ctx) { const { pathname } = new URL(request.url); if (pathname === "/recurse") { @@ -3182,9 +3238,9 @@ ```js const mf = new Miniflare({ - modules: true, - modulesRoot: "..", - scriptPath: "../worker.mjs", + modules: true, + modulesRoot: "..", + scriptPath: "../worker.mjs", }); ``` @@ -3242,15 +3298,15 @@ ```js const mf = new Miniflare({ - modules: [ - { - type: "PythonModule", - path: "index", - contents: - "from js import Response;\ndef fetch(request):\n return Response.new('hello')", - }, - ], - compatibilityFlags: ["experimental"], + modules: [ + { + type: "PythonModule", + path: "index", + contents: + "from js import Response;\ndef fetch(request):\n return Response.new('hello')", + }, + ], + compatibilityFlags: ["experimental"], }); ``` @@ -3387,9 +3443,9 @@ ```ts const mf = new Miniflare({ - log, - modules: true, - script: ` + log, + modules: true, + script: ` export default { fetch(req, env, ctx) { const two = env.UNSAFE_EVAL.eval('1+1'); @@ -3397,7 +3453,7 @@ } } `, - unsafeEvalBinding: "UNSAFE_EVAL", + unsafeEvalBinding: "UNSAFE_EVAL", }); ``` diff --git a/packages/miniflare/package.json b/packages/miniflare/package.json index 1dbe414d6ae6..18328016b675 100644 --- a/packages/miniflare/package.json +++ b/packages/miniflare/package.json @@ -1,6 +1,6 @@ { "name": "miniflare", - "version": "4.20260317.0", + "version": "4.20260317.1", "description": "Fun, full-featured, fully-local simulator for Cloudflare Workers", "keywords": [ "cloudflare", diff --git a/packages/pages-shared/CHANGELOG.md b/packages/pages-shared/CHANGELOG.md index 931f3ba694c2..5fc206c282a0 100644 --- a/packages/pages-shared/CHANGELOG.md +++ b/packages/pages-shared/CHANGELOG.md @@ -1,5 +1,12 @@ # @cloudflare/pages-shared +## 0.13.117 + +### Patch Changes + +- Updated dependencies [[`3c988e2`](https://github.com/cloudflare/workers-sdk/commit/3c988e204ac0d6117ace9cc8fa5fd2479868811c), [`cb71403`](https://github.com/cloudflare/workers-sdk/commit/cb714036d95ad0429f7e7a24c3c3a4317748ce22), [`3a1c149`](https://github.com/cloudflare/workers-sdk/commit/3a1c149e1edf126ab072bf74ed624d3c42d561fb), [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb), [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787)]: + - miniflare@4.20260317.1 + ## 0.13.116 ### Patch Changes @@ -445,6 +452,7 @@ ### Patch Changes - [#9817](https://github.com/cloudflare/workers-sdk/pull/9817) [`6a0d990`](https://github.com/cloudflare/workers-sdk/commit/6a0d99066ef0633fb28d8ab3989ce943a02ec514) Thanks [@GregBrimble](https://github.com/GregBrimble)! - Add `x-cf-pages-analytics` header when Web Analytics token is injected + - Emit `x-cf-pages-analytics: 1` header when analytics script is added to HTML responses - Add comprehensive tests covering HTML with/without body, non-HTML responses, and missing analytics config - Header indicates when analytics injection is attempted regardless of HTMLRewriter success diff --git a/packages/pages-shared/package.json b/packages/pages-shared/package.json index 6bf6b5b2fcee..432693df3edb 100644 --- a/packages/pages-shared/package.json +++ b/packages/pages-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/pages-shared", - "version": "0.13.116", + "version": "0.13.117", "repository": { "type": "git", "url": "https://github.com/cloudflare/workers-sdk.git", diff --git a/packages/unenv-preset/CHANGELOG.md b/packages/unenv-preset/CHANGELOG.md index e19185ff5319..945a21370209 100644 --- a/packages/unenv-preset/CHANGELOG.md +++ b/packages/unenv-preset/CHANGELOG.md @@ -1,5 +1,13 @@ # @cloudflare/unenv-preset +## 2.16.0 + +### Minor Changes + +- [#12763](https://github.com/cloudflare/workers-sdk/pull/12763) [`d028ffb`](https://github.com/cloudflare/workers-sdk/commit/d028ffb40c308e4ad7b2a98c6ae0577a2f4e8d8a) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Graduate experimental Node.js module flags to date-gated flags + + The following Node.js module compatibility flags are no longer experimental and are now automatically enabled for workers using `nodejs_compat` with a compatibility date of `2026-03-17` or later: `perf_hooks`, `v8`, `tty`, `child_process`, `worker_threads`, `readline`, and `repl`. Each flag can still be explicitly enabled or disabled via the corresponding `enable_`/`disable_` compatibility flags. + ## 2.15.0 ### Minor Changes @@ -111,7 +119,7 @@ ```jsonc { - "compatibility_flags": ["experimental", "enable_nodejs_inspector_module"], + "compatibility_flags": ["experimental", "enable_nodejs_inspector_module"] } ``` @@ -131,7 +139,7 @@ ```jsonc { - "compatibility_flags": ["experimental", "enable_nodejs_inspector_module"], + "compatibility_flags": ["experimental", "enable_nodejs_inspector_module"] } ``` diff --git a/packages/unenv-preset/package.json b/packages/unenv-preset/package.json index 3816d65b3eda..e054765a446d 100644 --- a/packages/unenv-preset/package.json +++ b/packages/unenv-preset/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/unenv-preset", - "version": "2.15.0", + "version": "2.16.0", "description": "cloudflare preset for unenv", "keywords": [ "Node.js", diff --git a/packages/vite-plugin-cloudflare/CHANGELOG.md b/packages/vite-plugin-cloudflare/CHANGELOG.md index 20ce9606977c..d2aa4b75783d 100644 --- a/packages/vite-plugin-cloudflare/CHANGELOG.md +++ b/packages/vite-plugin-cloudflare/CHANGELOG.md @@ -1,5 +1,26 @@ # @cloudflare/vite-plugin +## 1.30.0 + +### Minor Changes + +- [#12848](https://github.com/cloudflare/workers-sdk/pull/12848) [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb) Thanks [@emily-shen](https://github.com/emily-shen)! - Enable local explorer by default + + This ungates the local explorer, a UI that lets you inspect the state of D1, DO and KV resources locally by visiting `/cdn-cgi/explorer` during local development. + + Note: this feature is still experimental, and can be disabled by setting the env var `X_LOCAL_EXPLORER=false`. + +### Patch Changes + +- [#12942](https://github.com/cloudflare/workers-sdk/pull/12942) [`4f7fd79`](https://github.com/cloudflare/workers-sdk/commit/4f7fd79d83185df593167751ceca44d50d926aea) Thanks [@jamesopstad](https://github.com/jamesopstad)! - Avoid splicing into the middleware stack for Vite versions other than v6 + + Previously, the plugin spliced its pre-middleware into the Vite middleware stack relative to `viteCachedTransformMiddleware`. In Vite 8, this middleware can be omitted in some scenarios, which would cause the splice to fail. The plugin now registers pre-middleware using `server.middlewares.use()` directly, which places it in the correct position for Vite 7+. For Vite 6, the middleware is moved to the correct position in a post hook. + +- Updated dependencies [[`782df44`](https://github.com/cloudflare/workers-sdk/commit/782df4495f14f1366cf03e808ddddea0102eb011), [`3c988e2`](https://github.com/cloudflare/workers-sdk/commit/3c988e204ac0d6117ace9cc8fa5fd2479868811c), [`62545c9`](https://github.com/cloudflare/workers-sdk/commit/62545c9e9146d5107df7bd3d75fa3c453fa7d96b), [`d028ffb`](https://github.com/cloudflare/workers-sdk/commit/d028ffb40c308e4ad7b2a98c6ae0577a2f4e8d8a), [`cb71403`](https://github.com/cloudflare/workers-sdk/commit/cb714036d95ad0429f7e7a24c3c3a4317748ce22), [`71ab981`](https://github.com/cloudflare/workers-sdk/commit/71ab9816dc80acba346073bc9d02bd45d1fb5b9a), [`3a1c149`](https://github.com/cloudflare/workers-sdk/commit/3a1c149e1edf126ab072bf74ed624d3c42d561fb), [`7c3c6c6`](https://github.com/cloudflare/workers-sdk/commit/7c3c6c6e9c8b4b58e438a9ce8426241f58d8fe82), [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb), [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787)]: + - wrangler@4.76.0 + - miniflare@4.20260317.1 + - @cloudflare/unenv-preset@2.16.0 + ## 1.29.1 ### Patch Changes @@ -94,9 +115,9 @@ ```jsonc // wrangler.jsonc { - "secrets": { - "required": ["API_KEY", "DB_PASSWORD"], - }, + "secrets": { + "required": ["API_KEY", "DB_PASSWORD"] + } } ``` @@ -192,14 +213,14 @@ ```ts export default defineConfig({ - environments: { - my_worker: { - build: { - sourcemap: true, - }, - }, - }, - plugins: [cloudflare()], + environments: { + my_worker: { + build: { + sourcemap: true, + }, + }, + }, + plugins: [cloudflare()], }); ``` @@ -312,14 +333,14 @@ ```ts export default defineConfig({ - plugins: [ - cloudflare({ - viteEnvironment: { - name: "rsc", - childEnvironments: ["ssr"], - }, - }), - ], + plugins: [ + cloudflare({ + viteEnvironment: { + name: "rsc", + childEnvironments: ["ssr"], + }, + }), + ], }); ``` @@ -332,6 +353,7 @@ reducing the number of external dependencies users need to trust. Bundled dependencies: + - **miniflare**: `acorn`, `acorn-walk`, `exit-hook`, `glob-to-regexp`, `stoppable` - **kv-asset-handler**: `mime` - **vite-plugin-cloudflare**: `@remix-run/node-fetch-server`, `defu`, `get-port`, `picocolors`, `tinyglobby` @@ -425,21 +447,21 @@ ```ts export default defineConfig({ - plugins: [ - cloudflare({ - auxiliaryWorkers: [ - { - config: (_, { entryWorkerConfig }) => ({ - name: "auxiliary-worker", - main: "./src/auxiliary-worker.ts", - // Inherit compatibility settings from entry Worker - compatibility_date: entryWorkerConfig.compatibility_date, - compatibility_flags: entryWorkerConfig.compatibility_flags, - }), - }, - ], - }), - ], + plugins: [ + cloudflare({ + auxiliaryWorkers: [ + { + config: (_, { entryWorkerConfig }) => ({ + name: "auxiliary-worker", + main: "./src/auxiliary-worker.ts", + // Inherit compatibility settings from entry Worker + compatibility_date: entryWorkerConfig.compatibility_date, + compatibility_flags: entryWorkerConfig.compatibility_flags, + }), + }, + ], + }), + ], }); ``` @@ -517,41 +539,41 @@ // Define a partial config object export default defineConfig({ - plugins: [ - cloudflare({ - config: { - compatibility_date: "2025-01-01", - }, - }), - ], + plugins: [ + cloudflare({ + config: { + compatibility_date: "2025-01-01", + }, + }), + ], }); // Return a partial config from a function, conditional on some logic export default defineConfig({ - plugins: [ - cloudflare({ - config: (workerConfig) => { - if (workerConfig.name === "my-worker") { - return { - compatibility_flags: ["nodejs_compat"], - }; - } - }, - }), - ], + plugins: [ + cloudflare({ + config: (workerConfig) => { + if (workerConfig.name === "my-worker") { + return { + compatibility_flags: ["nodejs_compat"], + }; + } + }, + }), + ], }); // Modify the config in place export default defineConfig({ - plugins: [ - cloudflare({ - config: (workerConfig) => { - workerConfig.compatibility_date = "2025-01-01"; - }, - }), - ], + plugins: [ + cloudflare({ + config: (workerConfig) => { + workerConfig.compatibility_date = "2025-01-01"; + }, + }), + ], }); ``` @@ -1035,6 +1057,7 @@ Wrangler and Vite will continue to load `.env` files in order to configure themselves as a tool. Further details: + - In `vite build` the local vars will be computed and stored in a `.dev.vars` file next to the compiled Worker code, so that `vite preview` can use them. - The `wrangler types` command will similarly read the `.env` files (if no `.dev.vars` files) in order to generate the `Env` interface. - If the `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` environment variable is `"false"` then local dev variables will not be loaded from `.env` files. @@ -1095,7 +1118,7 @@ ```ts if (import.meta.hot) { - import.meta.hot.accept(); + import.meta.hot.accept(); } ``` @@ -1246,13 +1269,13 @@ ```jsonc { - "assets": { - "not_found_handling": "single-page-application", - "run_worker_first": [ - "/api/*", // These routes go directly to the Worker - "!/api/docs/*", // These routes are still treated as assets - ], - }, + "assets": { + "not_found_handling": "single-page-application", + "run_worker_first": [ + "/api/*", // These routes go directly to the Worker + "!/api/docs/*" // These routes are still treated as assets + ] + } } ``` @@ -1287,6 +1310,7 @@ Assets that are imported in the entry Worker are now automatically moved to the client build output. This enables importing assets in your Worker and accessing them via the [assets binding](https://developers.cloudflare.com/workers/static-assets/binding/#binding). See [Static Asset Handling](https://vite.dev/guide/assets) to find out about all the ways you can import assets in Vite. Additionally, a broader range of build scenarios are now supported. These are: + - Assets only build with client entry/entries - Assets only build with no client entry/entries that includes `public` directory assets - Worker(s) + assets build with client entry/entries @@ -1335,14 +1359,14 @@ ```jsonc // ./worker-a/wrangler.jsonc { - "name": "worker-a", - "main": "./src/index.ts", - "services": [ - { - "binding": "SERVICE", - "service": "worker-b", - }, - ], + "name": "worker-a", + "main": "./src/index.ts", + "services": [ + { + "binding": "SERVICE", + "service": "worker-b" + } + ] } ``` @@ -1351,13 +1375,13 @@ ```jsonc // ./worker-b/wrangler.jsonc { - "name": "worker-b", - "main": "./src/index.ts", - "tail_consumers": [ - { - "service": "worker-a", - }, - ], + "name": "worker-b", + "main": "./src/index.ts", + "tail_consumers": [ + { + "service": "worker-a" + } + ] } ``` @@ -1398,12 +1422,12 @@ ```js export default defineConfig({ - plugins: [ - cloudflare({ - // ... - experimental: { mixedMode: true }, - }), - ], + plugins: [ + cloudflare({ + // ... + experimental: { mixedMode: true }, + }), + ], }); ``` diff --git a/packages/vite-plugin-cloudflare/package.json b/packages/vite-plugin-cloudflare/package.json index 86818120d0bd..de6c1a4116ee 100644 --- a/packages/vite-plugin-cloudflare/package.json +++ b/packages/vite-plugin-cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/vite-plugin", - "version": "1.29.1", + "version": "1.30.0", "description": "Cloudflare plugin for Vite", "keywords": [ "cloudflare", diff --git a/packages/vitest-pool-workers/CHANGELOG.md b/packages/vitest-pool-workers/CHANGELOG.md index 69643d043fb0..cecff06ee006 100644 --- a/packages/vitest-pool-workers/CHANGELOG.md +++ b/packages/vitest-pool-workers/CHANGELOG.md @@ -1,5 +1,15 @@ # @cloudflare/vitest-pool-workers +## 0.13.3 + +### Patch Changes + +- [#12881](https://github.com/cloudflare/workers-sdk/pull/12881) [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787) Thanks [@pombosilva](https://github.com/pombosilva)! - Workflows testing util `waitForStatus` now supports waiting for "terminated" and "paused" states. + +- Updated dependencies [[`782df44`](https://github.com/cloudflare/workers-sdk/commit/782df4495f14f1366cf03e808ddddea0102eb011), [`3c988e2`](https://github.com/cloudflare/workers-sdk/commit/3c988e204ac0d6117ace9cc8fa5fd2479868811c), [`62545c9`](https://github.com/cloudflare/workers-sdk/commit/62545c9e9146d5107df7bd3d75fa3c453fa7d96b), [`cb71403`](https://github.com/cloudflare/workers-sdk/commit/cb714036d95ad0429f7e7a24c3c3a4317748ce22), [`71ab981`](https://github.com/cloudflare/workers-sdk/commit/71ab9816dc80acba346073bc9d02bd45d1fb5b9a), [`3a1c149`](https://github.com/cloudflare/workers-sdk/commit/3a1c149e1edf126ab072bf74ed624d3c42d561fb), [`7c3c6c6`](https://github.com/cloudflare/workers-sdk/commit/7c3c6c6e9c8b4b58e438a9ce8426241f58d8fe82), [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb), [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787)]: + - wrangler@4.76.0 + - miniflare@4.20260317.1 + ## 0.13.2 ### Patch Changes @@ -44,13 +54,13 @@ import { defineWorkersProject } from "@cloudflare/vitest-pool-workers/config"; export default defineWorkersProject({ - test: { - poolOptions: { - workers: { - wrangler: { configPath: "./wrangler.jsonc" }, - }, - }, - }, + test: { + poolOptions: { + workers: { + wrangler: { configPath: "./wrangler.jsonc" }, + }, + }, + }, }); ``` @@ -61,11 +71,11 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ - plugins: [ - cloudflareTest({ - wrangler: { configPath: "./wrangler.jsonc" }, - }), - ], + plugins: [ + cloudflareTest({ + wrangler: { configPath: "./wrangler.jsonc" }, + }), + ], }); ``` @@ -216,6 +226,7 @@ - [#12056](https://github.com/cloudflare/workers-sdk/pull/12056) [`6d5f69f`](https://github.com/cloudflare/workers-sdk/commit/6d5f69fa0c86eed05875603ac31a9f32a4a2bfbd) Thanks [@edmundhung](https://github.com/edmundhung)! - fix: allow Vite query parameters like `?raw` on `.sql` file imports Importing `.sql` files with Vite query parameters (e.g., `import sql from "./query.sql?raw"`) would fail with "No such module" errors in vitest-pool-workers 0.12.x. Both import styles now work: + - `import sql from "./query.sql?raw"` (Vite handles the `?raw` transform) - `import sql from "./query.sql"` (loaded as Text module) @@ -231,6 +242,7 @@ into miniflare and @cloudflare/vitest-pool-workers. Other dependencies remain external for technical reasons: + - `sharp`: Native binary with platform-specific builds - `undici`: Dynamically required at runtime in worker threads - `ws`: Has optional native bindings for performance @@ -279,6 +291,7 @@ reducing the number of external dependencies users need to trust. Bundled dependencies: + - **miniflare**: `acorn`, `acorn-walk`, `exit-hook`, `glob-to-regexp`, `stoppable` - **kv-asset-handler**: `mime` - **vite-plugin-cloudflare**: `@remix-run/node-fetch-server`, `defu`, `get-port`, `picocolors`, `tinyglobby` @@ -316,6 +329,7 @@ ### Minor Changes - [#11648](https://github.com/cloudflare/workers-sdk/pull/11648) [`eac5cf7`](https://github.com/cloudflare/workers-sdk/commit/eac5cf74db6d1b0865f5dc3a744ff28e695d53ca) Thanks [@pombosilva](https://github.com/pombosilva)! - Add Workflows test handlers in vitest-pool-workers to get the Workflow instance output and error: + - `getOutput()`: Returns the output of the successfully completed Workflow instance. - `getError()`: Returns the error information of the errored Workflow instance. @@ -324,7 +338,7 @@ ```ts // First wait for the workflow instance to complete: await expect( - instance.waitForStatus({ status: "complete" }) + instance.waitForStatus({ status: "complete" }) ).resolves.not.toThrow(); // Then, get its output @@ -332,7 +346,7 @@ // Or for errored workflow instances, get their error: await expect( - instance.waitForStatus({ status: "errored" }) + instance.waitForStatus({ status: "errored" }) ).resolves.not.toThrow(); const error = await instance.getError(); ``` @@ -360,6 +374,7 @@ - [#11533](https://github.com/cloudflare/workers-sdk/pull/11533) [`8d9003e`](https://github.com/cloudflare/workers-sdk/commit/8d9003e144156f32aef03aba71b18c7e5c5b202d) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Add support for ctx.exports It is now possible to access `ctx.exports` properties for the `main` (`SELF`) worker. + - Integration tests: in the `SELF` worker the `ctx.exports` object now contains the expected stubs to the exported entry-points. - Unit tests: the object returned from `createExecutionContext()` has `exports` property that exposes the exports of the `SELF` worker. @@ -627,6 +642,7 @@ - [#10494](https://github.com/cloudflare/workers-sdk/pull/10494) [`e2b838f`](https://github.com/cloudflare/workers-sdk/commit/e2b838ff56572d581661143d56f2485d7bcf1e0e) Thanks [@pombosilva](https://github.com/pombosilva)! - Add Workflows test support to the `cloudflare:test` module. The `cloudflare:test` module has two new APIs: + - `introspectWorkflowInstance` - `introspectWorkflow` which allow changing the behavior of one or multiple Workflow instances created during tests. @@ -1259,6 +1275,7 @@ - [#7334](https://github.com/cloudflare/workers-sdk/pull/7334) [`869ec7b`](https://github.com/cloudflare/workers-sdk/commit/869ec7b916487ec43b958a27bdfea13588c5685f) Thanks [@threepointone](https://github.com/threepointone)! - chore: update esbuild This patch updates esbuild from 0.17.19 to 0.24.2. That's a big bump! Lots has gone into esbuild since May '23. All the details are available at https://github.com/evanw/esbuild/blob/main/CHANGELOG.md / https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md. + - We now support all modern JavasScript/TypeScript features suported by esbuild (as of December 2024). New additions include standard decorators, auto-accessors, and the `using` syntax. - 0.18 introduced wider support for configuration specified via `tsconfig.json` https://github.com/evanw/esbuild/issues/3019. After observing the (lack of) any actual broken code over the last year for this release, we feel comfortable releasing this without considering it a breaking change. - 0.19.3 introduced support for import attributes @@ -1270,6 +1287,7 @@ While we don't currently expose the esbuild configuration for developers to add their own plugins to customise how modules with import attributes are bundled, we may introduce new "types" ourselves in the future. - 0.19.0 introduced support for wildcard imports. Specifics here (https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md#0190). tl;dr - + - These 2 patterns will bundle all files that match the glob pattern into a single file. ```js @@ -1292,12 +1310,12 @@ ```js // src/index.js export default { - async fetch() { - const url = new URL(request.url); - const name = url.pathname; - const value = (await import("." + name)).default; - return new Response(value); - }, + async fetch() { + const url = new URL(request.url); + const name = url.pathname; + const value = (await import("." + name)).default; + return new Response(value); + }, }; ``` @@ -1326,6 +1344,7 @@ ``` Before this update: + 1. A request to anything but `http://localhost:8787/` would error. For example, a request to `http://localhost:8787/one.js` would error with _No such module "one.js"._ 2. Let's configure `wrangler.toml` to include all `.js` files in the `src` folder: @@ -1350,6 +1369,7 @@ Then, a request to `http://localhost:8787/hidden/secret.js` will return the contents of `src/hidden/secret.js`. After this update: + - Let's put the wrangler.toml back to its original configuration: ```toml @@ -1358,22 +1378,22 @@ ``` - Now, a request to `http://localhost:8787/one.js` will return the contents of `src/one.js`, but a request to `http://localhost:8787/hidden/secret.js` will ALSO return the contents of `src/hidden/secret.js`. THIS MAY NOT BE WHAT YOU WANT. You can "fix" this in 2 ways: + 1. Remove the inline wildcard import: ```js // src/index.js export default { - async fetch() { - const name = new URL(request.url).pathname; - const moduleName = "./" + name; - const value = (await import(moduleName)).default; - return new Response(value); - }, + async fetch() { + const name = new URL(request.url).pathname; + const moduleName = "./" + name; + const value = (await import(moduleName)).default; + return new Response(value); + }, }; ``` - Now, no extra modules are included in the bundle, and a request to `http://localhost:8787/hidden/secret.js` will throw an error. You can use the `find_additional_modules` feature to include it again. - 2. Don't use the wildcard import pattern: + Now, no extra modules are included in the bundle, and a request to `http://localhost:8787/hidden/secret.js` will throw an error. You can use the `find_additional_modules` feature to include it again. 2. Don't use the wildcard import pattern: ```js // src/index.js @@ -1381,17 +1401,17 @@ import two from "./two.js"; export default { - async fetch() { - const name = new URL(request.url).pathname; - switch (name) { - case "/one.js": - return new Response(one); - case "/two.js": - return new Response(two); - default: - return new Response("Not found", { status: 404 }); - } - }, + async fetch() { + const name = new URL(request.url).pathname; + switch (name) { + case "/one.js": + return new Response(one); + case "/two.js": + return new Response(two); + default: + return new Response("Not found", { status: 404 }); + } + }, }; ``` @@ -1406,18 +1426,18 @@ ```js // eslint.config.js export default [ - { - rules: { - "no-restricted-syntax": [ - "error", - { - selector: "ImportExpression[argument.type!='Literal']", - message: - "Dynamic imports with non-literal arguments are not allowed.", - }, - ], - }, - }, + { + rules: { + "no-restricted-syntax": [ + "error", + { + selector: "ImportExpression[argument.type!='Literal']", + message: + "Dynamic imports with non-literal arguments are not allowed.", + }, + ], + }, + }, ]; ``` @@ -1549,21 +1569,21 @@ import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config"; export default defineWorkersConfig({ - test: { - deps: { - optimizer: { - ssr: { - enabled: true, - include: ["your-package-name"], - }, - }, - }, - poolOptions: { - workers: { - // ... - }, - }, - }, + test: { + deps: { + optimizer: { + ssr: { + enabled: true, + include: ["your-package-name"], + }, + }, + }, + poolOptions: { + workers: { + // ... + }, + }, + }, }); ``` @@ -2437,16 +2457,16 @@ import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config"; export default defineWorkersConfig({ - test: { - poolOptions: { - workers: { - wrangler: { - configPath: "./wrangler.toml", - environment: "production", - }, - }, - }, - }, + test: { + poolOptions: { + workers: { + wrangler: { + configPath: "./wrangler.toml", + environment: "production", + }, + }, + }, + }, }); ``` diff --git a/packages/vitest-pool-workers/package.json b/packages/vitest-pool-workers/package.json index 77cad153caf5..c1186853d099 100644 --- a/packages/vitest-pool-workers/package.json +++ b/packages/vitest-pool-workers/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/vitest-pool-workers", - "version": "0.13.2", + "version": "0.13.3", "description": "Workers Vitest integration for writing Vitest unit and integration tests that run inside the Workers runtime", "keywords": [ "cloudflare", diff --git a/packages/workers-utils/CHANGELOG.md b/packages/workers-utils/CHANGELOG.md index 6e797ff03007..f14c4b90f135 100644 --- a/packages/workers-utils/CHANGELOG.md +++ b/packages/workers-utils/CHANGELOG.md @@ -1,5 +1,13 @@ # @cloudflare/workers-utils +## 0.13.0 + +### Minor Changes + +- [#12957](https://github.com/cloudflare/workers-sdk/pull/12957) [`62545c9`](https://github.com/cloudflare/workers-sdk/commit/62545c9e9146d5107df7bd3d75fa3c453fa7d96b) Thanks [@natewong1313](https://github.com/natewong1313)! - Add Stream binding support to Wrangler and workers-utils + + Wrangler and workers-utils now recognize the `stream` binding in configuration, deployment metadata, and generated worker types. This enables projects to declare Stream bindings in `wrangler.json` and have the binding represented consistently across validation, metadata mapping, and type generation. + ## 0.12.0 ### Minor Changes @@ -12,9 +20,9 @@ ```jsonc { - "cache": { - "enabled": true, - }, + "cache": { + "enabled": true + } } ``` @@ -86,11 +94,11 @@ ```json { - "$schema": "./node_modules/wrangler/config-schema.json", - "limits": { - "cpu_ms": 1000, - "subrequests": 150 // newly added field - } + "$schema": "./node_modules/wrangler/config-schema.json", + "limits": { + "cpu_ms": 1000, + "subrequests": 150 // newly added field + } } ``` @@ -128,9 +136,9 @@ ```jsonc // wrangler.json { - "dev": { - "inspector_ip": "0.0.0.0", - }, + "dev": { + "inspector_ip": "0.0.0.0" + } } ``` @@ -182,13 +190,13 @@ ```json { - "$schema": "node_modules/wrangler/config-schema.json", - "name": "example", - "main": "src/index.ts", - "compatibility_date": "2025-12-12", - "dev": { - "generate_types": true - } + "$schema": "node_modules/wrangler/config-schema.json", + "name": "example", + "main": "src/index.ts", + "compatibility_date": "2025-12-12", + "dev": { + "generate_types": true + } } ``` diff --git a/packages/workers-utils/package.json b/packages/workers-utils/package.json index 4d80e977af69..5393d9f3eb40 100644 --- a/packages/workers-utils/package.json +++ b/packages/workers-utils/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/workers-utils", - "version": "0.12.0", + "version": "0.13.0", "private": true, "description": "Utility package for common Worker operations", "homepage": "https://github.com/cloudflare/workers-sdk#readme", diff --git a/packages/workflows-shared/CHANGELOG.md b/packages/workflows-shared/CHANGELOG.md index e7d0eecb2fce..d69a192191ce 100644 --- a/packages/workflows-shared/CHANGELOG.md +++ b/packages/workflows-shared/CHANGELOG.md @@ -1,5 +1,22 @@ # @cloudflare/workflows-shared +## 0.7.0 + +### Minor Changes + +- [#12881](https://github.com/cloudflare/workers-sdk/pull/12881) [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787) Thanks [@pombosilva](https://github.com/pombosilva)! - Workflow instances now support pause, resume, restart, and terminate in local dev. + + ```js + const instance = await env.MY_WORKFLOW.create({ + id: "my-instance", + }); + + await instance.pause(); // pauses after the current step completes + await instance.resume(); // resumes from where it left off + await instance.restart(); // restarts the workflow from the beginning + await instance.terminate(); // terminates the workflow immediately + ``` + ## 0.6.0 ### Minor Changes @@ -13,8 +30,8 @@ ```ts await step.do("my-step", async (ctx) => { - // ctx.attempt is 1 on first try, 2 on first retry, etc. - console.log(`Attempt ${ctx.attempt}`); + // ctx.attempt is 1 on first try, 2 on first retry, etc. + console.log(`Attempt ${ctx.attempt}`); }); ``` @@ -29,16 +46,16 @@ ```jsonc // wrangler.jsonc { - "workflows": [ - { - "binding": "MY_WORKFLOW", - "name": "my-workflow", - "class_name": "MyWorkflow", - "limits": { - "steps": 5000, - }, - }, - ], + "workflows": [ + { + "binding": "MY_WORKFLOW", + "name": "my-workflow", + "class_name": "MyWorkflow", + "limits": { + "steps": 5000 + } + } + ] } ``` @@ -58,7 +75,7 @@ ```ts // First wait for the workflow instance to complete: await expect( - instance.waitForStatus({ status: "complete" }) + instance.waitForStatus({ status: "complete" }) ).resolves.not.toThrow(); // Then, get its output @@ -66,7 +83,7 @@ // Or for errored workflow instances, get their error: await expect( - instance.waitForStatus({ status: "errored" }) + instance.waitForStatus({ status: "errored" }) ).resolves.not.toThrow(); const error = await instance.getError(); ``` diff --git a/packages/workflows-shared/package.json b/packages/workflows-shared/package.json index 75f1ce5f7d0a..e8e3b0b57522 100644 --- a/packages/workflows-shared/package.json +++ b/packages/workflows-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/workflows-shared", - "version": "0.6.0", + "version": "0.7.0", "private": true, "description": "Package that is used at Cloudflare to power some internal features of Cloudflare Workflows.", "keywords": [ diff --git a/packages/wrangler/CHANGELOG.md b/packages/wrangler/CHANGELOG.md index f515b2f14621..5ca88b06ef14 100644 --- a/packages/wrangler/CHANGELOG.md +++ b/packages/wrangler/CHANGELOG.md @@ -1,5 +1,44 @@ # wrangler +## 4.76.0 + +### Minor Changes + +- [#12893](https://github.com/cloudflare/workers-sdk/pull/12893) [`782df44`](https://github.com/cloudflare/workers-sdk/commit/782df4495f14f1366cf03e808ddddea0102eb011) Thanks [@gpanders](https://github.com/gpanders)! - Rewrite `wrangler containers list` to use the paginated Dash API endpoint + + `wrangler containers list` now fetches from the `/dash/applications` endpoint instead of `/applications`, displaying results in a paginated table with columns for ID, Name, State, Live Instances, and Last Modified. Container state is derived from health instance counters (active, degraded, provisioning, ready). + + The command supports `--per-page` (default 25) for interactive pagination with Enter to load more and q/Esc to quit, and `--json` for machine-readable output. Non-interactive environments load all results in a single request. + +- [#12957](https://github.com/cloudflare/workers-sdk/pull/12957) [`62545c9`](https://github.com/cloudflare/workers-sdk/commit/62545c9e9146d5107df7bd3d75fa3c453fa7d96b) Thanks [@natewong1313](https://github.com/natewong1313)! - Add Stream binding support to Wrangler and workers-utils + + Wrangler and workers-utils now recognize the `stream` binding in configuration, deployment metadata, and generated worker types. This enables projects to declare Stream bindings in `wrangler.json` and have the binding represented consistently across validation, metadata mapping, and type generation. + +- [#12848](https://github.com/cloudflare/workers-sdk/pull/12848) [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb) Thanks [@emily-shen](https://github.com/emily-shen)! - Enable local explorer by default + + This ungates the local explorer, a UI that lets you inspect the state of D1, DO and KV resources locally by visiting `/cdn-cgi/explorer` during local development. + + Note: this feature is still experimental, and can be disabled by setting the env var `X_LOCAL_EXPLORER=false`. + +### Patch Changes + +- [#12938](https://github.com/cloudflare/workers-sdk/pull/12938) [`71ab981`](https://github.com/cloudflare/workers-sdk/commit/71ab9816dc80acba346073bc9d02bd45d1fb5b9a) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - Add backward-compatible autoconfig support for Astro v5 and v4 projects + + The `astro add cloudflare` command in older Astro versions installs the latest adapter version, which causes compatibility issues. This change adds manual configuration logic for projects using Astro versions before 6.0.0: + + - **Astro 6.0.0+**: Uses the native `astro add cloudflare` command (unchanged behavior) + - **Astro 5.x**: Installs `@astrojs/cloudflare@12` and manually configures the adapter + - **Astro 4.x**: Installs `@astrojs/cloudflare@11` and manually configures the adapter + - **Astro < 4.0.0**: Returns an error prompting the user to upgrade + +- [#11892](https://github.com/cloudflare/workers-sdk/pull/11892) [`7c3c6c6`](https://github.com/cloudflare/workers-sdk/commit/7c3c6c6e9c8b4b58e438a9ce8426241f58d8fe82) Thanks [@staticpayload](https://github.com/staticpayload)! - Handle registry ports when matching container image digests + + Wrangler now strips tags without breaking registry ports when comparing local images to remote digests. This prevents unnecessary pushes for tags like `localhost:5000/app:tag`. + +- Updated dependencies [[`3c988e2`](https://github.com/cloudflare/workers-sdk/commit/3c988e204ac0d6117ace9cc8fa5fd2479868811c), [`d028ffb`](https://github.com/cloudflare/workers-sdk/commit/d028ffb40c308e4ad7b2a98c6ae0577a2f4e8d8a), [`cb71403`](https://github.com/cloudflare/workers-sdk/commit/cb714036d95ad0429f7e7a24c3c3a4317748ce22), [`3a1c149`](https://github.com/cloudflare/workers-sdk/commit/3a1c149e1edf126ab072bf74ed624d3c42d561fb), [`ce48b77`](https://github.com/cloudflare/workers-sdk/commit/ce48b77c4e8796359d86e88f8b18c36b653757cb), [`8729f3d`](https://github.com/cloudflare/workers-sdk/commit/8729f3d0954c5325a0a28da6fa87129411819787)]: + - miniflare@4.20260317.1 + - @cloudflare/unenv-preset@2.16.0 + ## 4.75.0 ### Minor Changes @@ -7,6 +46,7 @@ - [#12492](https://github.com/cloudflare/workers-sdk/pull/12492) [`3b81fc6`](https://github.com/cloudflare/workers-sdk/commit/3b81fc6a75857d5c158824f17d9316adc55878fc) Thanks [@thomasgauvin](https://github.com/thomasgauvin)! - feat: add `wrangler tunnel` commands for managing Cloudflare Tunnels Adds a new set of commands for managing remotely-managed Cloudflare Tunnels directly from Wrangler: + - `wrangler tunnel create ` - Create a new Cloudflare Tunnel - `wrangler tunnel list` - List all tunnels in your account - `wrangler tunnel info ` - Display details about a specific tunnel @@ -113,7 +153,7 @@ ```typescript const worker = await unstable_dev("./src/worker.ts", { - persist: false, + persist: false, }); ``` @@ -121,10 +161,10 @@ ```typescript const worker = await unstable_startWorker({ - entrypoint: "./src/worker.ts", - dev: { - persist: false, - }, + entrypoint: "./src/worker.ts", + dev: { + persist: false, + }, }); ``` @@ -158,6 +198,7 @@ - [#12807](https://github.com/cloudflare/workers-sdk/pull/12807) [`8d1e130`](https://github.com/cloudflare/workers-sdk/commit/8d1e130bba5fa4019edab855e817a17110b360d0) Thanks [@MaxwellCalkin](https://github.com/MaxwellCalkin)! - fix: `vectorize` commands now output valid json This fixes: + - `wrangler vectorize create` - `wrangler vectorize info` - `wrangler vectorize insert` @@ -191,14 +232,14 @@ ```json { - "assets": { - "binding": "ASSETS", - "directory": "./public" - }, - "env": { - "staging": {}, - "production": {} - } + "assets": { + "binding": "ASSETS", + "directory": "./public" + }, + "env": { + "staging": {}, + "production": {} + } } ``` @@ -315,9 +356,9 @@ ```jsonc // wrangler.jsonc { - "secrets": { - "required": ["API_KEY", "DB_PASSWORD"], - }, + "secrets": { + "required": ["API_KEY", "DB_PASSWORD"] + } } ``` @@ -334,9 +375,9 @@ ```jsonc // wrangler.jsonc { - "secrets": { - "required": ["API_KEY", "DB_PASSWORD"], - }, + "secrets": { + "required": ["API_KEY", "DB_PASSWORD"] + } } ``` @@ -365,16 +406,16 @@ ```jsonc // wrangler.jsonc { - "workflows": [ - { - "binding": "MY_WORKFLOW", - "name": "my-workflow", - "class_name": "MyWorkflow", - "limits": { - "steps": 5000, - }, - }, - ], + "workflows": [ + { + "binding": "MY_WORKFLOW", + "name": "my-workflow", + "class_name": "MyWorkflow", + "limits": { + "steps": 5000 + } + } + ] } ``` @@ -412,9 +453,9 @@ ```jsonc { - "cache": { - "enabled": true, - }, + "cache": { + "enabled": true + } } ``` @@ -517,6 +558,7 @@ - [#12401](https://github.com/cloudflare/workers-sdk/pull/12401) [`8723684`](https://github.com/cloudflare/workers-sdk/commit/872368456bfd72cdb45dc8c82f1ab16392d6a1f8) Thanks [@jonesphillip](https://github.com/jonesphillip)! - Add validation retry loops to pipelines setup command The `wrangler pipelines setup` command now prompts users to retry when validation errors occur, instead of failing the entire setup process. This includes: + - Validation retry prompts for pipeline names, bucket names, and field names - A "simple" mode for sink configuration that uses sensible defaults - Automatic bucket creation when buckets don't exist @@ -531,9 +573,7 @@ ```jsonc // wrangler.json { - "pipelines": [ - { "binding": "ANALYTICS", "pipeline": "analytics-stream-id" }, - ], + "pipelines": [{ "binding": "ANALYTICS", "pipeline": "analytics-stream-id" }] } ``` @@ -541,10 +581,10 @@ ```typescript declare namespace Cloudflare { - type AnalyticsStreamRecord = { user_id: string; event_count: number }; - interface Env { - ANALYTICS: Pipeline; - } + type AnalyticsStreamRecord = { user_id: string; event_count: number }; + interface Env { + ANALYTICS: Pipeline; + } } ``` @@ -589,6 +629,7 @@ - [#12466](https://github.com/cloudflare/workers-sdk/pull/12466) [`caf9b11`](https://github.com/cloudflare/workers-sdk/commit/caf9b114391d7708b38e8d37bca6dae6f2b4927e) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Add `WRANGLER_CACHE_DIR` environment variable and smart cache directory detection Wrangler now intelligently detects where to store cache files: + 1. Use `WRANGLER_CACHE_DIR` env var if set 2. Use existing cache directory if found (`node_modules/.cache/wrangler` or `.wrangler/cache`) 3. Create cache in `node_modules/.cache/wrangler` if `node_modules` exists @@ -654,11 +695,12 @@ ```ts export default defineConfig(({ isSsrBuild }) => ({ - plugins: [reactRouter(), tsconfigPaths()], + plugins: [reactRouter(), tsconfigPaths()], })); ``` This pattern is used by several official framework templates, including React Router's `node-postgres` and `node-custom-server` templates. The following `defineConfig()` patterns are now supported: + - `defineConfig({ ... })` (object literal, already worked) - `defineConfig(() => ({ ... }))` (arrow function with expression body) - `defineConfig(({ isSsrBuild }) => ({ ... }))` (arrow function with destructured params) @@ -698,6 +740,7 @@ - [#12473](https://github.com/cloudflare/workers-sdk/pull/12473) [`b900c5a`](https://github.com/cloudflare/workers-sdk/commit/b900c5adc18c12d500e0fb8c58c2295843518695) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Add CF_PAGES environment variables to `wrangler pages dev` `wrangler pages dev` now automatically injects Pages-specific environment variables (`CF_PAGES`, `CF_PAGES_BRANCH`, `CF_PAGES_COMMIT_SHA`, `CF_PAGES_URL`) for improved dev/prod parity. This enables frameworks like SvelteKit to auto-detect the Pages environment during local development. + - `CF_PAGES` is set to `"1"` to indicate the Pages environment - `CF_PAGES_BRANCH` defaults to the current git branch (or `"local"` if not in a git repo) - `CF_PAGES_COMMIT_SHA` defaults to the current git commit SHA (or a placeholder if not in a git repo) @@ -721,6 +764,7 @@ - [#12382](https://github.com/cloudflare/workers-sdk/pull/12382) [`d7b492c`](https://github.com/cloudflare/workers-sdk/commit/d7b492c37838929d37901c628ecbdd718f5a1258) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - Add Pages detection to autoconfig flows When running the autoconfig logic (via `wrangler setup`, `wrangler deploy --x-autoconfig`, or the programmatic autoconfig API), Wrangler now detects when a project appears to be a Pages project and handles it appropriately: + - For `wrangler deploy`, it warns the user but still allows them to proceed - For `wrangler setup` and the programmatic autoconfig API, it throws a fatal error @@ -790,11 +834,13 @@ Fixes the issue of the default maximum message retention (365400 seconds) being longer than the maximum allowed retention period for free tier users (86400 seconds). Previous: + - Wrangler set a default value of 365400 seconds max message retention if the setting was not explicitly provided in the Wrangler configuration. - The maximum retention period was documented as 1209600 seconds for all queues users because it was required to be on paid tier. - Wrangler also set a default value of 0 seconds for delivery delay if the setting was not explicitly provided in the Wrangler configuration. Updated: + - Wrangler no longer sets a default value for max message retention so that the default can be applied at the API. - The maximum retention period is now documented as 86400 seconds for free tier queues and 1209600 seconds for paid tier queues - Wrangler also no longer sets a default value for delivery delay so that the default can be applied at the API. @@ -833,6 +879,7 @@ Previously, only command-based telemetry events (e.g., "wrangler command started/completed") included the full set of common properties. Ad-hoc events sent via `sendAdhocEvent` were missing important context like OS information, CI detection, and session tracking. Now, all telemetry events include the complete set of common properties: + - `amplitude_session_id` and `amplitude_event_id` for session tracking - `wranglerVersion` (and major/minor/patch variants) - `osPlatform`, `osVersion`, `nodeVersion` @@ -889,6 +936,7 @@ When running `wrangler pages deploy`, the command automatically detects git information (branch, commit hash, commit message, dirty state) from the local repository. Previously, when this detection failed, there was no way to troubleshoot the issue. Now, running with `WRANGLER_LOG=debug` will output detailed information about: + - Whether a git repository is detected - Each git command being executed and its result - The detected values (branch, commit hash, commit message, dirty status) @@ -943,6 +991,7 @@ When attempting to create a D1 database after reaching your account's limit, the CLI now shows a more helpful error message with actionable guidance instead of the raw API error. The new message includes: + - A clear explanation that the account limit has been reached - A link to D1 documentation - Commands to list and delete databases @@ -1065,11 +1114,11 @@ ```json { - "$schema": "./node_modules/wrangler/config-schema.json", - "limits": { - "cpu_ms": 1000, - "subrequests": 150 // newly added field - } + "$schema": "./node_modules/wrangler/config-schema.json", + "limits": { + "cpu_ms": 1000, + "subrequests": 150 // newly added field + } } ``` @@ -1086,9 +1135,11 @@ Add the version upload command to the output being printed by `wrangler deploy` to `WRANGLER_OUTPUT_FILE_DIRECTORY`/`WRANGLER_OUTPUT_FILE_PATH`. This complements the existing `buildCommand` and `deployCommand` fields and allows CI systems to know how to upload new versions of Workers. For example, for a standard npm project this would be: + - Version command: `npx wrangler versions upload` While for a Next.js project it would be: + - Version command: `npx @opennextjs/cloudflare upload` - [#12050](https://github.com/cloudflare/workers-sdk/pull/12050) [`b05b919`](https://github.com/cloudflare/workers-sdk/commit/b05b919b22a421a85a07fb8daccf9e22219dac53) Thanks [@NuroDev](https://github.com/NuroDev)! - Fixed Wrangler's error handling for both invalid commands with and without the `--help` flag, ensuring consistent and clear error messages. @@ -1124,11 +1175,13 @@ Add the framework id alongside the commands to build and deploy the project to the output being printed by `wrangler deploy` to `WRANGLER_OUTPUT_FILE_DIRECTORY` or `WRANGLER_OUTPUT_FILE_PATH`. For example for an npm Astro project these would be: + - Framework id: `astro` - Build command: `npm run build` - Deploy command: `npx wrangler deploy` While for a Next.js project they would instead be: + - Framework id: `next` - Build command: `npx @opennextjs/cloudflare build` - Deploy command: `npx @opennextjs/cloudflare deploy` @@ -1174,6 +1227,7 @@ - [#12153](https://github.com/cloudflare/workers-sdk/pull/12153) [`cb72c11`](https://github.com/cloudflare/workers-sdk/commit/cb72c1146fdab8af7d071ea0af0ea04c7523ee5b) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Sanitize commands and arguments in telemetry to prevent accidentally capturing sensitive information. **Changes:** + - Renamed telemetry fields from `command`/`args` to `sanitizedCommand`/`sanitizedArgs` to distinguish from historical fields that may have contained sensitive data in older versions - Command names now come from command definitions rather than user input, preventing accidental capture of sensitive data pasted as positional arguments - Sentry breadcrumbs now use the safe command name from definitions @@ -1202,9 +1256,9 @@ ```jsonc // wrangler.json { - "dev": { - "inspector_ip": "0.0.0.0", - }, + "dev": { + "inspector_ip": "0.0.0.0" + } } ``` @@ -1287,6 +1341,7 @@ - [#11893](https://github.com/cloudflare/workers-sdk/pull/11893) [`f9e8a45`](https://github.com/cloudflare/workers-sdk/commit/f9e8a452fb299e6cb1a0ff2985347bfc277deac8) Thanks [@NuroDev](https://github.com/NuroDev)! - `wrangler types` now generates per-environment TypeScript interfaces when named environments exist in your configuration. When your configuration has named environments (an `env` object), `wrangler types` now generates both: + - **Per-environment interfaces** (e.g., `StagingEnv`, `ProductionEnv`) containing only the bindings explicitly declared in each environment, plus inherited secrets - **An aggregated `Env` interface** with all bindings from all environments (top-level + named environments), where: - Bindings present in **all** environments are required @@ -1302,21 +1357,21 @@ ```jsonc { - "name": "my-worker", - "kv_namespaces": [ - { - "binding": "SHARED_KV", - "id": "abc123", - }, - ], - "env": { - "staging": { - "kv_namespaces": [ - { "binding": "SHARED_KV", "id": "staging-kv" }, - { "binding": "STAGING_CACHE", "id": "staging-cache" }, - ], - }, - }, + "name": "my-worker", + "kv_namespaces": [ + { + "binding": "SHARED_KV", + "id": "abc123" + } + ], + "env": { + "staging": { + "kv_namespaces": [ + { "binding": "SHARED_KV", "id": "staging-kv" }, + { "binding": "STAGING_CACHE", "id": "staging-cache" } + ] + } + } } ``` @@ -1324,14 +1379,14 @@ ```ts declare namespace Cloudflare { - interface StagingEnv { - SHARED_KV: KVNamespace; - STAGING_CACHE: KVNamespace; - } - interface Env { - SHARED_KV: KVNamespace; // Required: in all environments - STAGING_CACHE?: KVNamespace; // Optional: only in staging - } + interface StagingEnv { + SHARED_KV: KVNamespace; + STAGING_CACHE: KVNamespace; + } + interface Env { + SHARED_KV: KVNamespace; // Required: in all environments + STAGING_CACHE?: KVNamespace; // Optional: only in staging + } } interface Env extends Cloudflare.Env {} ``` @@ -1459,6 +1514,7 @@ - [#11880](https://github.com/cloudflare/workers-sdk/pull/11880) [`fe4faa3`](https://github.com/cloudflare/workers-sdk/commit/fe4faa306609514863fa770bac1dba5ff618f4be) Thanks [@penalosa](https://github.com/penalosa)! - Show helpful messages for errors outside of Wrangler's control. This prevents unnecessary Sentry reports. Errors now handled with user-friendly messages: + - Connection timeouts to Cloudflare's API (`UND_ERR_CONNECT_TIMEOUT`) - typically due to slow networks or connectivity issues - File system permission errors (`EPERM`, `EACCES`) - caused by insufficient permissions, locked files, or antivirus software - DNS resolution failures (`ENOTFOUND`) - caused by network connectivity issues or DNS configuration problems @@ -1621,6 +1677,7 @@ ``` The command returns whichever authentication method is currently configured: + - OAuth token from `wrangler login` (automatically refreshed if expired) - API token from `CLOUDFLARE_API_TOKEN` environment variable @@ -1650,30 +1707,33 @@ You can now have your worker configuration types be automatically generated when the local Wrangler development server starts. To use it you can either: + 1. Add the `--types` flag when running `wrangler dev`. 2. Update your Wrangler configuration file to add the new `dev.generate_types` boolean property. ```json { - "$schema": "node_modules/wrangler/config-schema.json", - "name": "example", - "main": "src/index.ts", - "compatibility_date": "2025-12-12", - "dev": { - "generate_types": true - } + "$schema": "node_modules/wrangler/config-schema.json", + "name": "example", + "main": "src/index.ts", + "compatibility_date": "2025-12-12", + "dev": { + "generate_types": true + } } ``` - [#11524](https://github.com/cloudflare/workers-sdk/pull/11524) [`b0dbf1a`](https://github.com/cloudflare/workers-sdk/commit/b0dbf1ac5c998365bb14e9a25f9a28773ba299d5) Thanks [@penalosa](https://github.com/penalosa)! - Add hidden CLI flags to `wrangler setup` for suppressing output Two new hidden flags have been added to `wrangler setup`: + - `--no-completion-message`: Suppresses the deployment details message after setup completes - `--no-install-wrangler`: Skips Wrangler installation during project setup - [#11777](https://github.com/cloudflare/workers-sdk/pull/11777) [`69979a3`](https://github.com/cloudflare/workers-sdk/commit/69979a3e0c20c8c8ec6c41253876e594ffb899f3) Thanks [@MattieTK](https://github.com/MattieTK)! - Add analytics properties to secret commands for better usage insights Secret commands (`wrangler secret put`, `wrangler secret bulk`, and their Pages/versions equivalents) now include additional analytics properties to help understand how secrets are being managed: + - `secretOperation`: Whether this is a "single" or "bulk" secret operation - `secretSource`: How the secret was provided ("interactive", "stdin", or "file") - `secretFormat`: For bulk operations, the format used ("json" or "dotenv") @@ -1706,6 +1766,7 @@ The `wrangler r2 bucket catalog snapshot-expiration enable` command was sending incorrect field names to the Cloudflare API, resulting in a 422 Unprocessable Entity error. This fix updates the API request body to use the correct field names: + - `olderThanDays` -> `max_snapshot_age` (as duration string, e.g., "30d") - `retainLast` -> `min_snapshots_to_keep` @@ -1745,6 +1806,7 @@ - [#11646](https://github.com/cloudflare/workers-sdk/pull/11646) [`472cf72`](https://github.com/cloudflare/workers-sdk/commit/472cf72a6f340e30499daa1d04bf5f17621044bf) Thanks [@vovacf201](https://github.com/vovacf201)! - feat: add R2 Data Catalog snapshot expiration commands Adds new commands to manage automatic snapshot expiration for R2 Data Catalog tables: + - `wrangler r2 bucket catalog snapshot-expiration enable` - Enable automatic snapshot expiration - `wrangler r2 bucket catalog snapshot-expiration disable` - Disable automatic snapshot expiration @@ -1876,6 +1938,7 @@ - [#10937](https://github.com/cloudflare/workers-sdk/pull/10937) [`9514c9a`](https://github.com/cloudflare/workers-sdk/commit/9514c9a0ed28fed349126384d1f646c9165be914) Thanks [@ReppCodes](https://github.com/ReppCodes)! - Add support for "targeted" placement mode with region, host, and hostname fields This change adds a new mode to `placement` configuration. You can specify one of the following fields to target specific external resources for Worker placement: + - `region`: Specify a region identifier (e.g., "aws:us-east-1") to target a region from another cloud service provider - `host`: Specify a host with (required) port (e.g., "example.com:8123") to target a TCP service - `hostname`: Specify a hostname (e.g., "example.com") to target an HTTP resource @@ -2323,9 +2386,9 @@ ```jsonc { - "kv_namespaces": [{ "binding": "MY_KV" }], - "d1_databases": [{ "binding": "MY_DB" }], - "r2_buckets": [{ "binding": "MY_R2" }], + "kv_namespaces": [{ "binding": "MY_KV" }], + "d1_databases": [{ "binding": "MY_DB" }], + "r2_buckets": [{ "binding": "MY_R2" }] } ``` @@ -2373,9 +2436,9 @@ ```ts interface Env { - MY_WORKFLOW: Workflow< - Parameters[0]["payload"] - >; + MY_WORKFLOW: Workflow< + Parameters[0]["payload"] + >; } ``` @@ -2444,6 +2507,7 @@ ### Patch Changes - [#10881](https://github.com/cloudflare/workers-sdk/pull/10881) [`ce832d5`](https://github.com/cloudflare/workers-sdk/commit/ce832d5222f1034bd02c3bac4952c72ec99020bc) Thanks [@garvit-gupta](https://github.com/garvit-gupta)! - Add table-level compaction commands for R2 Data Catalog: + - `wrangler r2 bucket catalog compaction enable [namespace] [table]` - `wrangler r2 bucket catalog compaction disable [namespace] [table]` @@ -2823,6 +2887,7 @@ When re-deploying a Worker using `wrangler deploy`, if the configuration has been modified in the Cloudflare dashboard, the local configuration will overwrite the remote one. This can lead to unexpected results for users. To address this, currently `wrangler deploy` warns users about potential configuration overrides (without presenting them) and prompts them to confirm whether they want to proceed. The changes here improve the above flow in the following way: + - If the local changes only add new configurations (without modifying or removing existing ones), the deployment proceeds automatically without warnings or prompts, as these changes are non-destructive and safe. - If the local changes modify or remove existing configurations, `wrangler deploy` now displays a git-like diff showing the differences between the dashboard and local configurations. This allows users to review and understand the impact of their changes before confirming the deployment. @@ -2951,8 +3016,8 @@ ```ts await maybeStartOrUpdateRemoteProxySession({ - path: configPath, - environment: targetEnvironment, + path: configPath, + environment: targetEnvironment, }); ``` @@ -2974,22 +3039,22 @@ import { unstable_startWorker } from "wrangler"; const worker = await unstable_startWorker({ - entrypoint: "./worker.js", - bindings: { - AI: { - type: "ai", - experimental_remote: true, - }, - }, - dev: { - experimentalRemoteBindings: true, - auth: { - accountId: "", - apiToken: { - apiToken: "", - }, - }, - }, + entrypoint: "./worker.js", + bindings: { + AI: { + type: "ai", + experimental_remote: true, + }, + }, + dev: { + experimentalRemoteBindings: true, + auth: { + accountId: "", + apiToken: { + apiToken: "", + }, + }, + }, }); await worker.ready; @@ -3075,6 +3140,7 @@ Wrangler and Vite will continue to load `.env` files in order to configure themselves as a tool. Further details: + - In `vite build` the local vars will be computed and stored in a `.dev.vars` file next to the compiled Worker code, so that `vite preview` can use them. - The `wrangler types` command will similarly read the `.env` files (if no `.dev.vars` files) in order to generate the `Env` interface. - If the `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` environment variable is `"false"` then local dev variables will not be loaded from `.env` files. @@ -3252,6 +3318,7 @@ - [#9825](https://github.com/cloudflare/workers-sdk/pull/9825) [`49c85c5`](https://github.com/cloudflare/workers-sdk/commit/49c85c5306b3dbfa9342baeab3b7d14d954d4ade) Thanks [@ReppCodes](https://github.com/ReppCodes)! - Add support for origin_connection_limit to Wrangler Configure connection limits to Hyperdrive via command line options: + - `--origin-connection-limit`: The (soft) maximum number of connections that Hyperdrive may establish to the origin database. - [#9064](https://github.com/cloudflare/workers-sdk/pull/9064) [`a1181bf`](https://github.com/cloudflare/workers-sdk/commit/a1181bf804e3ee4b6c2034fa3e429fd6b71f4c13) Thanks [@sdnts](https://github.com/sdnts)! - Added an `event-subscriptions` subcommand @@ -3273,6 +3340,7 @@ - [#9840](https://github.com/cloudflare/workers-sdk/pull/9840) [`7c55f9e`](https://github.com/cloudflare/workers-sdk/commit/7c55f9e1eac4fb0d53f9180a011172328296be16) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - fix: make sure that the experimental `remoteBindings` flag is properly handled in `getPlatformProxy` There are two issues related to how the experimental `remoteBindings` flag is handled in `getPlatformProxy` that are being fixed by this change: + - the `experimental_remote` configuration flag set on service bindings is incorrectly always taken into account, even if `remoteBindings` is set to `false` - the `experimental_remote` configuration flag of all the other bindings is never taken into account (effectively preventing the bindings to be used in remote mode) since the `remoteBindings` flag is not being properly propagated @@ -3324,11 +3392,11 @@ ```jsonc // wrangler.jsonc { - "name": "my-worker", - "assets": { - "directory": "./public/", - "binding": "ASSETS", - }, + "name": "my-worker", + "assets": { + "directory": "./public/", + "binding": "ASSETS" + } } ``` @@ -3414,14 +3482,14 @@ ```json // wrangler.jsonc { - "name": "get-platform-proxy-test", - "services": [ - { - "binding": "MY_WORKER", - "service": "my-worker", - "experimental_remote": true - } - ] + "name": "get-platform-proxy-test", + "services": [ + { + "binding": "MY_WORKER", + "service": "my-worker", + "experimental_remote": true + } + ] } ``` @@ -3430,9 +3498,9 @@ import { getPlatformProxy } from "wrangler"; const { env } = await getPlatformProxy({ - experimental: { - remoteBindings: true, - }, + experimental: { + remoteBindings: true, + }, }); // env.MY_WORKER.fetch() fetches from the remote my-worker service @@ -3516,6 +3584,7 @@ add a warning suggesting users to specify their target environment (via `-e` or `--env`) when their wrangler config file contains some environments and they are calling one of the following commands: + - wrangler deploy - wrangler versions upload - wrangler versions deploy @@ -3556,6 +3625,7 @@ - [#9507](https://github.com/cloudflare/workers-sdk/pull/9507) [`1914b87`](https://github.com/cloudflare/workers-sdk/commit/1914b87e254bb733298cb0c0e96bb0bd234acde4) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - slightly improve wrangler dev bindings loggings improve the bindings loggings by: + - removing the unnecessary (and potentially incorrect) `[connected]` suffix for remote bindings - making sure that the modes presented in the bindings logs are correctly aligned @@ -3596,22 +3666,22 @@ import { unstable_startWorker } from "wrangler"; await unstable_startWorker({ - dev: { - experimentalMixedMode: true, - }, + dev: { + experimentalMixedMode: true, + }, }); ``` ```json // wrangler.jsonc { - "$schema": "node_modules/wrangler/config-schema.json", - "name": "programmatic-start-worker-example", - "main": "src/index.ts", - "compatibility_date": "2025-06-01", - "services": [ - { "binding": "REMOTE_WORKER", "service": "remote-worker", "remote": true } - ] + "$schema": "node_modules/wrangler/config-schema.json", + "name": "programmatic-start-worker-example", + "main": "src/index.ts", + "compatibility_date": "2025-06-01", + "services": [ + { "binding": "REMOTE_WORKER", "service": "remote-worker", "remote": true } + ] } ``` @@ -3634,6 +3704,7 @@ ### Patch Changes - [#9390](https://github.com/cloudflare/workers-sdk/pull/9390) [`80e75f4`](https://github.com/cloudflare/workers-sdk/commit/80e75f4a67b4e4b7a1bc92e0a93659e5d6f141dc) Thanks [@penalosa](https://github.com/penalosa)! - Support additional Mixed Mode resources in Wrangler: + - AI - Browser - Images @@ -3658,6 +3729,7 @@ - [#9308](https://github.com/cloudflare/workers-sdk/pull/9308) [`d3a6eb3`](https://github.com/cloudflare/workers-sdk/commit/d3a6eb30e58de2b8f12fc899a70a31518968b910) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - expose new utilities and types to aid consumers of the programmatic mixed-mode API Specifically the exports have been added: + - `Experimental_MixedModeSession`: type representing a mixed-mode session - `Experimental_ConfigBindingsOptions`: type representing config-bindings - `experimental_pickRemoteBindings`: utility for picking only the remote bindings from a record of start-worker bindings. @@ -3676,6 +3748,7 @@ Now it is possible to target Wrangler at the FedRAMP High compliance region. There are two ways to signal to Wrangler to run in this mode: + - set `"compliance_region": "fedramp_high"` in a Wrangler configuration - set `CLOUDFLARE_COMPLIANCE_REGION=fedramp_high` environment variable when running Wrangler @@ -3685,6 +3758,7 @@ It is necessary to authenticate using a Cloudflare API Token acquired from the Cloudflare FedRAMP High dashboard. Most bindings and commands are supported in this mode. + - Unsupported commands may result in API requests that are not supported - possibly 422 Unprocessable Entity responses. - Unsupported bindings may work in local dev, as there is no local validation, but will fail at Worker deployment time. @@ -3808,7 +3882,7 @@ ```ts interface Env { - SERVICE_BINDING: Fetcher; + SERVICE_BINDING: Fetcher; } ``` @@ -3816,7 +3890,7 @@ ```ts interface Env { - SERVICE_BINDING: Service; + SERVICE_BINDING: Service; } ``` @@ -3855,6 +3929,7 @@ - [#9124](https://github.com/cloudflare/workers-sdk/pull/9124) [`d0d62e6`](https://github.com/cloudflare/workers-sdk/commit/d0d62e6e4bb3ac6e0b6d9a0140a2825249f32e89) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - make that `unstable_startWorker` can correctly throw configuration errors make sure that `unstable_startWorker` can throw configuration related errors when: + - the utility is called - the worker's `setConfig` is called with the `throwErrors` argument set to `true` @@ -3955,13 +4030,13 @@ ```json { - "services": [ - { - "binding": "MY_SERVICE", - "service": "some-worker", - "props": { "foo": 123, "bar": "value" } - } - ] + "services": [ + { + "binding": "MY_SERVICE", + "service": "some-worker", + "props": { "foo": 123, "bar": "value" } + } + ] } ``` @@ -3971,9 +4046,9 @@ import { WorkerEntrypoint } from "cloudflare:workers"; export default class extends WorkerEntrypoint { - fetch() { - return new Response(JSON.stringify(this.ctx.props)); - } + fetch() { + return new Response(JSON.stringify(this.ctx.props)); + } } ``` @@ -3988,9 +4063,9 @@ ```json { - "name": "my-worker", - "main": "src/worker.ts", - "keep_names": false + "name": "my-worker", + "main": "src/worker.ts", + "keep_names": false } ``` @@ -4096,6 +4171,7 @@ this change improves that validation error message that users see when a redirected config file contains environments, by: + - cleaning the message formatting and displaying the offending environments in a list - prompting the user to report the issue to the author @@ -4115,6 +4191,7 @@ ### Patch Changes - [#8780](https://github.com/cloudflare/workers-sdk/pull/8780) [`4e69fb6`](https://github.com/cloudflare/workers-sdk/commit/4e69fb6f05138b32500695846482dd22bb2590d9) Thanks [@cmackenzie1](https://github.com/cmackenzie1)! - - Rename `wrangler pipelines show` to `wrangler pipelines get` + - Replace `--enable-worker-binding` and `--enable-http` with `--source worker` and `--source http` (or `--source http worker` for both) - Remove `--file-template` and `--partition-template` flags from `wrangler pipelines create|update` @@ -4125,6 +4202,7 @@ add the following validation behaviors to wrangler deploy commands, that relate to redirected configs (i.e. config files specified by `.wrangler/deploy/config.json` files): + - redirected configs are supposed to be already flattened configurations without any environment (i.e. a build tool should generate redirected configs already targeting specific environments), so if wrangler encounters a redirected config with some environments defined @@ -4343,6 +4421,7 @@ - [#7334](https://github.com/cloudflare/workers-sdk/pull/7334) [`869ec7b`](https://github.com/cloudflare/workers-sdk/commit/869ec7b916487ec43b958a27bdfea13588c5685f) Thanks [@penalosa](https://github.com/penalosa)! - Remove the deprecated `--format` argument on `wrangler deploy` and `wrangler dev`. Remove deprecated config fields: + - `type` - `webpack_config` - `miniflare` @@ -4385,12 +4464,14 @@ - [#7334](https://github.com/cloudflare/workers-sdk/pull/7334) [`869ec7b`](https://github.com/cloudflare/workers-sdk/commit/869ec7b916487ec43b958a27bdfea13588c5685f) Thanks [@penalosa](https://github.com/penalosa)! - Remove the deprecated `wrangler publish` command. Instead, use `wrangler deploy`, which takes exactly the same arguments. Additionally, remove the following deprecated commands, which are no longer supported. + - `wrangler config` - `wrangler preview` - `wrangler route` - `wrangler subdomain` Remove the following deprecated command aliases: + - `wrangler secret:*`, replaced by `wrangler secret *` - `wrangler kv:*`, replaced by `wrangler kv *` @@ -4403,6 +4484,7 @@ - [#7334](https://github.com/cloudflare/workers-sdk/pull/7334) [`869ec7b`](https://github.com/cloudflare/workers-sdk/commit/869ec7b916487ec43b958a27bdfea13588c5685f) Thanks [@threepointone](https://github.com/threepointone)! - chore: update esbuild This patch updates esbuild from 0.17.19 to 0.24.2. That's a big bump! Lots has gone into esbuild since May '23. All the details are available at https://github.com/evanw/esbuild/blob/main/CHANGELOG.md / https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md. + - We now support all modern JavasScript/TypeScript features suported by esbuild (as of December 2024). New additions include standard decorators, auto-accessors, and the `using` syntax. - 0.18 introduced wider support for configuration specified via `tsconfig.json` https://github.com/evanw/esbuild/issues/3019. After observing the (lack of) any actual broken code over the last year for this release, we feel comfortable releasing this without considering it a breaking change. - 0.19.3 introduced support for import attributes @@ -4414,6 +4496,7 @@ While we don't currently expose the esbuild configuration for developers to add their own plugins to customise how modules with import attributes are bundled, we may introduce new "types" ourselves in the future. - 0.19.0 introduced support for wildcard imports. Specifics here (https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md#0190). tl;dr - + - These 2 patterns will bundle all files that match the glob pattern into a single file. ```js @@ -4436,12 +4519,12 @@ ```js // src/index.js export default { - async fetch() { - const url = new URL(request.url); - const name = url.pathname; - const value = (await import("." + name)).default; - return new Response(value); - }, + async fetch() { + const url = new URL(request.url); + const name = url.pathname; + const value = (await import("." + name)).default; + return new Response(value); + }, }; ``` @@ -4470,6 +4553,7 @@ ``` Before this update: + 1. A request to anything but `http://localhost:8787/` would error. For example, a request to `http://localhost:8787/one.js` would error with _No such module "one.js"._ 2. Let's configure `wrangler.toml` to include all `.js` files in the `src` folder: @@ -4494,6 +4578,7 @@ Then, a request to `http://localhost:8787/hidden/secret.js` will return the contents of `src/hidden/secret.js`. After this update: + - Let's put the wrangler.toml back to its original configuration: ```toml @@ -4502,22 +4587,22 @@ ``` - Now, a request to `http://localhost:8787/one.js` will return the contents of `src/one.js`, but a request to `http://localhost:8787/hidden/secret.js` will ALSO return the contents of `src/hidden/secret.js`. THIS MAY NOT BE WHAT YOU WANT. You can "fix" this in 2 ways: + 1. Remove the inline wildcard import: ```js // src/index.js export default { - async fetch() { - const name = new URL(request.url).pathname; - const moduleName = "./" + name; - const value = (await import(moduleName)).default; - return new Response(value); - }, + async fetch() { + const name = new URL(request.url).pathname; + const moduleName = "./" + name; + const value = (await import(moduleName)).default; + return new Response(value); + }, }; ``` - Now, no extra modules are included in the bundle, and a request to `http://localhost:8787/hidden/secret.js` will throw an error. You can use the `find_additional_modules` feature to include it again. - 2. Don't use the wildcard import pattern: + Now, no extra modules are included in the bundle, and a request to `http://localhost:8787/hidden/secret.js` will throw an error. You can use the `find_additional_modules` feature to include it again. 2. Don't use the wildcard import pattern: ```js // src/index.js @@ -4525,17 +4610,17 @@ import two from "./two.js"; export default { - async fetch() { - const name = new URL(request.url).pathname; - switch (name) { - case "/one.js": - return new Response(one); - case "/two.js": - return new Response(two); - default: - return new Response("Not found", { status: 404 }); - } - }, + async fetch() { + const name = new URL(request.url).pathname; + switch (name) { + case "/one.js": + return new Response(one); + case "/two.js": + return new Response(two); + default: + return new Response("Not found", { status: 404 }); + } + }, }; ``` @@ -4550,18 +4635,18 @@ ```js // eslint.config.js export default [ - { - rules: { - "no-restricted-syntax": [ - "error", - { - selector: "ImportExpression[argument.type!='Literal']", - message: - "Dynamic imports with non-literal arguments are not allowed.", - }, - ], - }, - }, + { + rules: { + "no-restricted-syntax": [ + "error", + { + selector: "ImportExpression[argument.type!='Literal']", + message: + "Dynamic imports with non-literal arguments are not allowed.", + }, + ], + }, + }, ]; ``` @@ -4746,6 +4831,7 @@ This can be imported into Chrome DevTools or opened directly in VSCode to view a flamegraph of your Worker's startup phase. Additionally, when a Worker deployment fails with a startup time error Wrangler will automatically generate a CPU profile for easy investigation. Advanced usage: + - `--args`: to customise the way `wrangler check startup` builds your Worker for analysis, provide the exact arguments you use when deploying your Worker with `wrangler deploy`. For instance, if you deploy your Worker with `wrangler deploy --no-bundle`, you should use `wrangler check startup --args="--no-bundle"` to profile the startup phase. - `--worker-bundle`: if you don't use Wrangler to deploy your Worker, you can use this argument to provide a Worker bundle to analyse. This should be a file path to a serialised multipart upload, with the exact same format as the API expects: https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update/ @@ -4919,6 +5005,7 @@ - [#7860](https://github.com/cloudflare/workers-sdk/pull/7860) [`13ab591`](https://github.com/cloudflare/workers-sdk/commit/13ab5916058e8e834f3e13fb9b5b9d9addc0f930) Thanks [@vicb](https://github.com/vicb)! - refactor(wrangler): make JSON parsing independent of Node Switch `jsonc-parser` to parse json: + - `JSON.parse()` exception messages are not stable across Node versions - While `jsonc-parser` is used, JSONC specific syntax is disabled @@ -4945,9 +5032,11 @@ This command allows users to upload a mTLS certificate/private key or certificate-authority certificate chain. For uploading mTLS certificate, run: + - `wrangler cert upload mtls-certificate --cert cert.pem --key key.pem --name MY_CERT` For uploading CA certificate chain, run: + - `wrangler cert upload certificate-authority --ca-cert server-ca.pem --name SERVER_CA` ### Patch Changes @@ -4975,14 +5064,14 @@ ```json // wrangler.json { - "name": "my-worker", - "assets": { - "directory": "./public/", - "binding": "ASSETS" - }, - "vars": { - "MY_VAR": "my-var" - } + "name": "my-worker", + "assets": { + "directory": "./public/", + "binding": "ASSETS" + }, + "vars": { + "MY_VAR": "my-var" + } } ``` @@ -4992,10 +5081,10 @@ const { env, dispose } = await getPlatformProxy(); if (env.ASSETS) { - const text = await ( - await env.ASSETS.fetch("http://0.0.0.0/file.txt") - ).text(); - console.log(text); // logs the content of file.txt + const text = await ( + await env.ASSETS.fetch("http://0.0.0.0/file.txt") + ).text(); + console.log(text); // logs the content of file.txt } await dispose(); @@ -5015,6 +5104,7 @@ - [#7806](https://github.com/cloudflare/workers-sdk/pull/7806) [`d7adb50`](https://github.com/cloudflare/workers-sdk/commit/d7adb50fcc9e3c509365fed8a86df485ea9f739b) Thanks [@vicb](https://github.com/vicb)! - chore: update unenv to 2.0.0-rc.0 Pull a couple changes in node:timers + - unjs/unenv#384 fix function bindings in node:timer - unjs/unenv#385 implement active and \_unrefActive in node:timer @@ -5112,7 +5202,7 @@ ```ts interface Env { - MY_VAR: "dev value"; + MY_VAR: "dev value"; } ``` @@ -5122,7 +5212,7 @@ ```ts interface Env { - MY_VAR: "dev value" | "prod value"; + MY_VAR: "dev value" | "prod value"; } ``` @@ -5177,6 +5267,7 @@ ### Affected commands The commands that use this feature are: + - `wrangler deploy` - `wrangler dev` - `wrangler versions upload` @@ -5200,6 +5291,7 @@ ### Custom build tool example A common approach that a build tool might choose to implement. + - The user writes code that uses Cloudflare Workers resources, configured via a user `wrangler.toml` file. ```toml @@ -5233,11 +5325,11 @@ ```json { - "name": "my-worker", - "main": "./index.js", - "kv_namespaces": [ - { "binding": "", "id": "" } - ] + "name": "my-worker", + "main": "./index.js", + "kv_namespaces": [ + { "binding": "", "id": "" } + ] } ``` @@ -5245,7 +5337,7 @@ ```json { - "configPath": "../../dist/wrangler.json" + "configPath": "../../dist/wrangler.json" } ``` @@ -5316,6 +5408,7 @@ - [#7425](https://github.com/cloudflare/workers-sdk/pull/7425) [`8757579`](https://github.com/cloudflare/workers-sdk/commit/8757579a47d675909230a51f8e09d1611d5cadb1) Thanks [@CarmenPopoviciu](https://github.com/CarmenPopoviciu)! - feat: Make DX improvements in `wrangler dev --remote` Workers + Assets projects have, in certain situations, a relatively degraded `wrangler dev --remote` developer experience, as opposed to Workers proper projects. This is due to the fact that, for Workers + Assets, we need to make extra API calls to: + 1. check for asset files changes 2. upload the changed assets, if any @@ -5351,6 +5444,7 @@ Adds a Wrangler API to find and read a config file - [#7549](https://github.com/cloudflare/workers-sdk/pull/7549) [`42b9429`](https://github.com/cloudflare/workers-sdk/commit/42b942916efbd4eb8060e4d61c2e805ec78a1a89) Thanks [@penalosa](https://github.com/penalosa)! - Expand metrics collection to: + - Detect Pages & Workers CI - Filter out default args (e.g. `--x-versions`, `--x-dev-env`, and `--latest`) by only including args that were in `argv` @@ -5454,6 +5548,7 @@ - [#7431](https://github.com/cloudflare/workers-sdk/pull/7431) [`8f25ebe`](https://github.com/cloudflare/workers-sdk/commit/8f25ebe74d19237e85b6dada1eb34236add11d48) Thanks [@vicb](https://github.com/vicb)! - chore(wrangler): update unenv dependency version Pull in: + - refactor(cloudflare): reimplement module:createRequire for latest workerd (unjs/unenv#351) - refactor: use node:events instead of relative path (unjs/unenv#354) - refactor(http, cloudflare): use unenv/ imports inside node:http (unjs/unenv#363) @@ -5540,9 +5635,9 @@ ```json { - "name": "worker-ts", - "main": "src/index.ts", - "compatibility_date": "2023-05-04" + "name": "worker-ts", + "main": "src/index.ts", + "compatibility_date": "2023-05-04" } ``` @@ -5608,6 +5703,7 @@ - [#7173](https://github.com/cloudflare/workers-sdk/pull/7173) [`b6cbfbd`](https://github.com/cloudflare/workers-sdk/commit/b6cbfbdd10dfbb732ec12a5c69bd4a74b07de8a0) Thanks [@Ankcorn](https://github.com/Ankcorn)! - Adds [observability.logs] settings to wrangler. This setting lets developers control the settings for logs as an independent dataset enabling more dataset types in the future. The most specific setting will win if any of the datasets are not enabled. It also adds the following setting to the logs config + - `invocation_logs` - set to false to disable invocation logs. Defaults to true. ```toml @@ -6193,6 +6289,7 @@ We want wrangler to error if users are trying to deploy a Worker with assets, and routes with a path component. All Workers with assets must have either: + - custom domain routes - pattern routes which have no path component (except for the wildcard splat) "some.domain.com/\*" @@ -6258,15 +6355,15 @@ const { env, dispose } = await getPlatformProxy(); try { - const sql = postgres( - // Note: connectionString points to `postgres://user:pass@127.0.0.1:1234/db` not to the actual hyperdrive - // connection string, for more details see the explanation below - env.MY_HYPERDRIVE.connectionString - ); - const results = await sql`SELECT * FROM pg_tables`; - await sql.end(); + const sql = postgres( + // Note: connectionString points to `postgres://user:pass@127.0.0.1:1234/db` not to the actual hyperdrive + // connection string, for more details see the explanation below + env.MY_HYPERDRIVE.connectionString + ); + const results = await sql`SELECT * FROM pg_tables`; + await sql.end(); } catch (e) { - console.error(e); + console.error(e); } await dispose(); @@ -6485,6 +6582,7 @@ - [#6370](https://github.com/cloudflare/workers-sdk/pull/6370) [`8a3c6c0`](https://github.com/cloudflare/workers-sdk/commit/8a3c6c00105a3420e46da660bd3f317b26f1c6d4) Thanks [@CarmenPopoviciu](https://github.com/CarmenPopoviciu)! - feat: Create very basic Asset Server Worker and plumb it into `wrangler dev` These changes do the ground work needed in order to add Assets support for Workers in `wrangler dev`. They implement the following: + - it creates a new package called `workers-shared` that hosts the `Asset Server Worker`, and the `Router Worker`in the future - it scaffolds the `Asset Server Worker` in some very basic form, with basic configuration. Further behaviour implementation will follow in a subsequent PR - it does the ground work of plumbing ASW into Miniflare @@ -6600,7 +6698,7 @@ ```ts interface Env { - OBJECT: DurableObjectNamespace; + OBJECT: DurableObjectNamespace; } ``` @@ -6655,10 +6753,10 @@ ```js export default { - async fetch(_request, _env, { waitUntil }) { - waitUntil(() => {}); // <-- throws an illegal invocation error - return new Response("Hello World!"); - }, + async fetch(_request, _env, { waitUntil }) { + waitUntil(() => {}); // <-- throws an illegal invocation error + return new Response("Hello World!"); + }, }; ``` @@ -6859,6 +6957,7 @@ - [#6058](https://github.com/cloudflare/workers-sdk/pull/6058) [`31cd51f`](https://github.com/cloudflare/workers-sdk/commit/31cd51f251050b0d6db97857a8d1d5427c855d99) Thanks [@threepointone](https://github.com/threepointone)! - chore: Quieter builds This patch cleans up warnings we were seeing when doing a full build. Specifically: + - fixtures/remix-pages-app had a bunch of warnings about impending features that it should be upgraded to, so I did that. (tbh this one needs a full upgrade of packages, but we'll get to that later when we're upgrading across the codebase) - updated `@microsoft/api-extractor` so it didn't complain that it didn't match the `typescript` version (that we'd recently upgraded) - it also silenced a bunch of warnings when exporting types from `wrangler`. We'll need to fix those, but we'll do that when we work on unstable_dev etc. @@ -7046,6 +7145,7 @@ ``` This commit ensures that we provide users with: + - the correct feedback with respect to their Pages deployment - the appropriate messaging depending on the status of their project's deployment status - the appropriate logs in case of a deployment failure @@ -7099,6 +7199,7 @@ ### Patch Changes - [#5813](https://github.com/cloudflare/workers-sdk/pull/5813) [`9627cef`](https://github.com/cloudflare/workers-sdk/commit/9627cef2f1aadb44aa677e429b6cb6af9c8ee495) Thanks [@GregBrimble](https://github.com/GregBrimble)! - fix: Upload Pages project assets with more grace + - Reduces the maximum bucket size from 50 MiB to 40 MiB. - Reduces the maximum asset count from 5000 to 2000. - Allows for more retries (with increased sleep between attempts) when encountering an API gateway failure. @@ -7148,7 +7249,7 @@ ```typescript interface Env { - "some-var": "foobar"; + "some-var": "foobar"; } ``` @@ -7170,7 +7271,7 @@ ```js const { env } = await getPlatformProxy({ - environment: "production", + environment: "production", }); ``` @@ -7347,21 +7448,21 @@ import { WorkerEntrypoint } from "cloudflare:workers"; export class EntrypointA extends WorkerEntrypoint { - fetch(request) { - return new Response("Hello from entrypoint A!"); - } + fetch(request) { + return new Response("Hello from entrypoint A!"); + } } export const entrypointB: ExportedHandler = { - fetch(request, env, ctx) { - return new Response("Hello from entrypoint B!"); - }, + fetch(request, env, ctx) { + return new Response("Hello from entrypoint B!"); + }, }; export default { - fetch(request, env, ctx) { - return new Response("Hello from the default entrypoint!"); - }, + fetch(request, env, ctx) { + return new Response("Hello from the default entrypoint!"); + }, }; ``` @@ -7490,6 +7591,7 @@ - [#5258](https://github.com/cloudflare/workers-sdk/pull/5258) [`fbdca7d`](https://github.com/cloudflare/workers-sdk/commit/fbdca7d93156f9db2a1513573e45f10fac7e57d1) Thanks [@OilyLime](https://github.com/OilyLime)! - feature: URL decode components of the Hyperdrive config connection string - [#5416](https://github.com/cloudflare/workers-sdk/pull/5416) [`47b325a`](https://github.com/cloudflare/workers-sdk/commit/47b325af0df87bcf20d922ff385ae9cd21726863) Thanks [@mattdeboard](https://github.com/mattdeboard)! - fix: minor improvements to R2 notification subcommand + 1. `r2 bucket event-notification ` becomes `r2 bucket notification ` 2. Parameters to `--event-type` use `-` instead of `_` (e.g. `object_create` -> `object-create`) @@ -7720,12 +7822,12 @@ ```ts interface Env { - SEND_EMAIL: SendEmail; - VECTORIZE: VectorizeIndex; - HYPERDRIVE: Hyperdrive; - MTLS: Fetcher; - BROWSER: Fetcher; - AI: Fetcher; + SEND_EMAIL: SendEmail; + VECTORIZE: VectorizeIndex; + HYPERDRIVE: Hyperdrive; + MTLS: Fetcher; + BROWSER: Fetcher; + AI: Fetcher; } ``` @@ -7748,7 +7850,7 @@ ```js const worker = await unstable_dev("path/to/script.js", { - logLevel: "none", + logLevel: "none", }); ``` @@ -7925,6 +8027,7 @@ whilst also making the type compatible with workers-types - Updated dependencies [[`7723ac17`](https://github.com/cloudflare/workers-sdk/commit/7723ac17906f894afe9af2152437726ac09a6290), [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229), [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229), [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229), [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229), [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229), [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229)]: + - miniflare@3.20240129.3 - [#4475](https://github.com/cloudflare/workers-sdk/pull/4475) [86d94ff](https://github.com/cloudflare/workers-sdk/commit/86d94ff5acd31eee7f02bc68e0b70f792eb3e74c) Thanks [@paulrostorp](https://github.com/paulrostorp)! - feat: support custom HTTPS certificate paths in Wrangler dev commands. @@ -7982,11 +8085,11 @@ ```ts export function randomBytes(length: number) { - if (navigator.userAgent !== "Cloudflare-Workers") { - return new Uint8Array(require("node:crypto").randomBytes(length)); - } else { - return crypto.getRandomValues(new Uint8Array(length)); - } + if (navigator.userAgent !== "Cloudflare-Workers") { + return new Uint8Array(require("node:crypto").randomBytes(length)); + } else { + return crypto.getRandomValues(new Uint8Array(length)); + } } ``` @@ -8111,17 +8214,17 @@ ```json { - "error": { - "text": "A request to the Cloudflare API (/accounts/xxxx/d1/database/xxxxxxx/query) failed.", - "notes": [ - { - "text": "no such column: asdf at offset 7 [code: 7500]" - } - ], - "kind": "error", - "name": "APIError", - "code": 7500 - } + "error": { + "text": "A request to the Cloudflare API (/accounts/xxxx/d1/database/xxxxxxx/query) failed.", + "notes": [ + { + "text": "no such column: asdf at offset 7 [code: 7500]" + } + ], + "kind": "error", + "name": "APIError", + "code": 7500 + } } ``` @@ -8285,12 +8388,12 @@ const { bindings, dispose } = await getBindingsProxy(); try { - const myKv = bindings.MY_KV; - const kvValue = await myKv.get("my-kv-key"); + const myKv = bindings.MY_KV; + const kvValue = await myKv.get("my-kv-key"); - console.log(`KV Value = ${kvValue}`); + console.log(`KV Value = ${kvValue}`); } finally { - await dispose(); + await dispose(); } ``` @@ -8508,6 +8611,7 @@ These changes were released in 3.13.0 and reverted in 3.13.1 -- we believe the changes are now more stable and ready for release again. There are no changes required for developers to opt-in. Improvements include: + - fewer 'address in use' errors upon reloads - upon config/source file changes, requests are buffered to guarantee the response is from the new version of the Worker @@ -8680,17 +8784,17 @@ ```jsonc { - "configurations": [ - { - "name": "Wrangler", - "type": "node", - "request": "attach", - "port": 9229, - // These can be omitted, but doing so causes silent errors in the runtime - "attachExistingChildren": false, - "autoAttachChildProcesses": false, - }, - ], + "configurations": [ + { + "name": "Wrangler", + "type": "node", + "request": "attach", + "port": 9229, + // These can be omitted, but doing so causes silent errors in the runtime + "attachExistingChildren": false, + "autoAttachChildProcesses": false + } + ] } ``` @@ -8758,6 +8862,7 @@ * [#3960](https://github.com/cloudflare/workers-sdk/pull/3960) [`c36b78b4`](https://github.com/cloudflare/workers-sdk/commit/c36b78b4109c05f47556972e66673f64ec0baa3b) Thanks [@RamIdeas](https://github.com/RamIdeas)! - Refactoring the internals of wrangler dev servers (including `wrangler dev`, `wrangler dev --remote` and `unstable_dev()`). There are no changes required for developers to opt-in. Improvements include: + - fewer 'address in use' errors upon reloads - upon config/source file changes, requests are buffered to guarantee the response is from the new version of the Worker @@ -8803,7 +8908,7 @@ Wrangler can operate in two modes: the default bundling mode and `--no-bundle` mode. In bundling mode, dynamic imports (e.g. `await import("./large-dep.mjs")`) would be bundled into your entrypoint, making lazy loading less effective. - Additionally, variable dynamic imports (e.g. ``await import(`./lang/${language}.mjs`)``) would always fail at runtime, + Additionally, variable dynamic imports (e.g. `` await import(`./lang/${language}.mjs`) ``) would always fail at runtime, as Wrangler would have no way of knowing which modules to upload. The `--no-bundle` mode sought to address these issues by disabling Wrangler's bundling entirely, and just deploying code as is. Unfortunately, this also disabled Wrangler's code transformations (e.g. TypeScript compilation, `--assets`, `--test-scheduled`, etc). @@ -8947,18 +9052,18 @@ ```json { - "configurations": [ - { - "name": "Wrangler", - "type": "node", - "request": "attach", - "port": 9229, - "cwd": "/", - "resolveSourceMapLocations": null, - "attachExistingChildren": false, - "autoAttachChildProcesses": false - } - ] + "configurations": [ + { + "name": "Wrangler", + "type": "node", + "request": "attach", + "port": 9229, + "cwd": "/", + "resolveSourceMapLocations": null, + "attachExistingChildren": false, + "autoAttachChildProcesses": false + } + ] } ``` @@ -9132,6 +9237,7 @@ `wrangler deploy` immediately deletes assets that are no longer current, which has a side-effect for existing progressive web app users of seeing 404 errors as the app tries to access assets that no longer exist. This new feature: + - does not change the default behavior of immediately deleting no-longer needed assets. - allows users to opt-in to expiring newly obsoleted assets after the provided number of seconds hence, so that current users will have a time buffer before seeing 404 errors. - is similar in concept to what was introduced in Wrangler 1.x with https://github.com/cloudflare/wrangler-legacy/pull/2221. @@ -9558,11 +9664,11 @@ ```js export default { - fetch(req) { - const url = new URL(req.url); - const name = url.searchParams.get("name"); - return new Response("Hello, " + name); - }, + fetch(req) { + const url = new URL(req.url); + const name = url.searchParams.get("name"); + return new Response("Hello, " + name); + }, }; ``` @@ -9597,6 +9703,7 @@ Support send email bindings in order to send emails from a worker. There are three types of bindings: + - Unrestricted: can send email to any verified destination address. - Restricted: can only send email to the supplied destination address (which does not need to be specified when sending the email but also needs to be a @@ -9746,6 +9853,7 @@ binding = "yeee" - [#2810](https://github.com/cloudflare/workers-sdk/pull/2810) [`62784131`](https://github.com/cloudflare/workers-sdk/commit/62784131385d641c3512b09565d801a5ecd39725) Thanks [@mrbbot](https://github.com/mrbbot)! - chore: upgrade `@miniflare/tre` to [`3.0.0-next.12`](https://github.com/cloudflare/miniflare/releases/tag/v3.0.0-next.12), incorporating changes from [`3.0.0-next.11`](https://github.com/cloudflare/miniflare/releases/tag/v3.0.0-next.11) Notably, this brings the following improvements to `wrangler dev --experimental-local`: + - Adds support for Durable Objects and D1 - Fixes an issue blocking clean exits and script reloads - Bumps to `better-sqlite3@8`, allowing installation on Node 19 @@ -10185,6 +10293,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c * [#2479](https://github.com/cloudflare/workers-sdk/pull/2479) [`7b479b91`](https://github.com/cloudflare/workers-sdk/commit/7b479b9104266c83dda3b4e4a89ab9b919b743f0) Thanks [@rozenmd](https://github.com/rozenmd)! - fix: bump d1js This PR bumps d1js, adding the following functionality to the d1 alpha shim: + - validates supported types - converts ArrayBuffer to array - converts typedArray to array @@ -10226,9 +10335,9 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```js worker = await unstable_dev( - "src/index.js", - {}, - { disableExperimentalWarning: true } + "src/index.js", + {}, + { disableExperimentalWarning: true } ); ``` @@ -10236,7 +10345,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```js worker = await unstable_dev("src/index.js", { - experimental: { disableExperimentalWarning: true }, + experimental: { disableExperimentalWarning: true }, }); ``` @@ -10508,9 +10617,9 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```ts export const onRequest = ({ passThroughOnException }) => { - passThroughOnException(); + passThroughOnException(); - x; // Would ordinarily throw an error, but instead, static assets are served. + x; // Would ordinarily throw an error, but instead, static assets are served. }; ``` @@ -10529,8 +10638,8 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```ts declare module "**/*.wasm" { - const value: WebAssembly.Module; - export default value; + const value: WebAssembly.Module; + export default value; } ``` @@ -10538,8 +10647,8 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```ts declare module "**/*.webp" { - const value: ArrayBuffer; - export default value; + const value: ArrayBuffer; + export default value; } ``` @@ -10547,8 +10656,8 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```ts declare module "**/*.text" { - const value: string; - export default value; + const value: string; + export default value; } ``` @@ -10576,6 +10685,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c Added support for the deployments command, which allows you to list the last ten deployments for a given script. The information will include: + - Version ID - Version number - Author email @@ -10742,7 +10852,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ```js await unstable_dev("src/index.ts", { - local: false, + local: false, }); ``` @@ -10772,6 +10882,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c We change how websockets are handled in the proxy server, fixing multiple issues of websocket behaviour, particularly to do with headers. In particular this fixes: + - the protocol passed between the client and the worker was being stripped out by wrangler - wrangler was discarding additional headesr from websocket upgrade response - websocket close code and reason was not being propagated by wrangler @@ -10853,42 +10964,42 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c import { unstable_dev } from "wrangler"; describe("multi-worker testing", () => { - let childWorker; - let parentWorker; - - beforeAll(async () => { - childWorker = await unstable_dev( - "src/child-worker.js", - { config: "src/child-wrangler.toml" }, - { disableExperimentalWarning: true } - ); - parentWorker = await unstable_dev( - "src/parent-worker.js", - { config: "src/parent-wrangler.toml" }, - { disableExperimentalWarning: true } - ); - }); - - afterAll(async () => { - await childWorker.stop(); - await parentWorker.stop(); - }); - - it("childWorker should return Hello World itself", async () => { - const resp = await childWorker.fetch(); - if (resp) { - const text = await resp.text(); - expect(text).toMatchInlineSnapshot(`"Hello World!"`); - } - }); - - it("parentWorker should return Hello World by invoking the child worker", async () => { - const resp = await parentWorker.fetch(); - if (resp) { - const parsedResp = await resp.text(); - expect(parsedResp).toEqual("Parent worker sees: Hello World!"); - } - }); + let childWorker; + let parentWorker; + + beforeAll(async () => { + childWorker = await unstable_dev( + "src/child-worker.js", + { config: "src/child-wrangler.toml" }, + { disableExperimentalWarning: true } + ); + parentWorker = await unstable_dev( + "src/parent-worker.js", + { config: "src/parent-wrangler.toml" }, + { disableExperimentalWarning: true } + ); + }); + + afterAll(async () => { + await childWorker.stop(); + await parentWorker.stop(); + }); + + it("childWorker should return Hello World itself", async () => { + const resp = await childWorker.fetch(); + if (resp) { + const text = await resp.text(); + expect(text).toMatchInlineSnapshot(`"Hello World!"`); + } + }); + + it("parentWorker should return Hello World by invoking the child worker", async () => { + const resp = await parentWorker.fetch(); + if (resp) { + const parsedResp = await resp.text(); + expect(parsedResp).toEqual("Parent worker sees: Hello World!"); + } + }); }); ``` @@ -11019,6 +11130,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c - [#1781](https://github.com/cloudflare/workers-sdk/pull/1781) [`603d0b35`](https://github.com/cloudflare/workers-sdk/commit/603d0b35074e2c59484e39305e0b01121de20f15) Thanks [@JacobMGEvans](https://github.com/JacobMGEvans)! - feat: Publish Origin Messaging feat: warn about potential conflicts during `publish` and `init --from-dash`. + - If publishing to a worker that has been modified in the dashboard, warn that the dashboard changes will be overwritten. - When initializing from the dashboard, warn that future changes via the dashboard will not automatically appear in the local Worker config. @@ -11027,6 +11139,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c * [#1735](https://github.com/cloudflare/workers-sdk/pull/1735) [`de29a445`](https://github.com/cloudflare/workers-sdk/commit/de29a4459750cf229fb563bcc8191ab3ad77bf4d) Thanks [@cameron-robey](https://github.com/cameron-robey)! - feat: new internal middleware A new way of registering middleware that gets bundled and executed on the edge. + - the same middleware functions can be used for both modules workers and service workers - only requires running esbuild a fixed number of times, rather than for each middleware added @@ -11054,6 +11167,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c Prior to this change, `wrangler.unstable_dev()` would only support running one instance of wrangler at a time, as Ink only lets you render one instance of React. This resulted in test failures in CI. This change creates pure JS/TS versions of these React hooks: + - useEsbuild - useLocalWorker - useCustomBuild @@ -11117,6 +11231,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c * [#1720](https://github.com/cloudflare/workers-sdk/pull/1720) [`f638de64`](https://github.com/cloudflare/workers-sdk/commit/f638de6426619a899367ba41674179b8ca67c6ab) Thanks [@mrbbot](https://github.com/mrbbot)! - Upgrade `miniflare` to [`2.7.1`](https://github.com/cloudflare/miniflare/releases/tag/v2.7.1) incorporating changes from [`2.7.0`](https://github.com/cloudflare/miniflare/releases/tag/v2.7.0) - [#1691](https://github.com/cloudflare/workers-sdk/pull/1691) [`5b2c3ee2`](https://github.com/cloudflare/workers-sdk/commit/5b2c3ee2c5d65b25c966ca07751f544f282525b9) Thanks [@cameron-robey](https://github.com/cameron-robey)! - chore: bump undici and increase minimum node version to 16.13 + - We bump undici to version to 5.9.1 to patch some security vulnerabilities in previous versions - This requires bumping the minimum node version to >= 16.8 so we update the minimum to the LTS 16.13 @@ -11306,6 +11421,7 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c * [#1558](https://github.com/cloudflare/workers-sdk/pull/1558) [`b43a7f98`](https://github.com/cloudflare/workers-sdk/commit/b43a7f9836e8f2d969624c2c5a88adf374a1ebe3) Thanks [@rozenmd](https://github.com/rozenmd)! - chore: extract devProps parsing into own function - [#1438](https://github.com/cloudflare/workers-sdk/pull/1438) [`0a9fe918`](https://github.com/cloudflare/workers-sdk/commit/0a9fe918216264a2f6fa3f69dd596f89de7d9f56) Thanks [@caass](https://github.com/caass)! - Initial implementation of `wrangler generate` + - `wrangler generate` and `wrangler generate ` delegate to `wrangler init`. - `wrangler generate