From fd0fb2304ad9087d9ad0329e3218e52193886899 Mon Sep 17 00:00:00 2001 From: "workers-devprod@cloudflare.com" <116369605+workers-devprod@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:02:43 +0000 Subject: [PATCH] Version Packages (#5006) Co-authored-by: github-actions[bot] --- .changeset/c3-frameworks-update-5001.md | 5 - .changeset/c3-frameworks-update-5011.md | 5 - .changeset/c3-frameworks-update-5019.md | 5 - .changeset/c3-frameworks-update-5020.md | 5 - .changeset/c3-frameworks-update-5021.md | 5 - .changeset/cuddly-icons-itch.md | 12 --- .changeset/four-comics-battle.md | 7 -- .changeset/gentle-mayflies-shout.md | 17 --- .changeset/khaki-feet-exist.md | 7 -- .changeset/khaki-wasps-glow.md | 7 -- .changeset/poor-carrots-bathe.md | 26 ----- .changeset/proud-plums-refuse.md | 7 -- .changeset/rich-needles-dress.md | 11 -- .changeset/rotten-suns-nail.md | 39 ------- .changeset/sharp-mayflies-flow.md | 7 -- .changeset/slimy-apples-reply.md | 7 -- .changeset/spotty-shirts-drop.md | 7 -- .changeset/spotty-suns-learn.md | 5 - .changeset/ten-jars-play.md | 9 -- .changeset/tidy-beans-raise.md | 34 ------ .changeset/twelve-moons-fly.md | 11 -- .changeset/warm-weeks-stare.md | 7 -- .changeset/yellow-kings-behave.md | 7 -- fixtures/dev-env/package.json | 2 +- packages/create-cloudflare/CHANGELOG.md | 44 ++++++++ packages/create-cloudflare/package.json | 2 +- packages/miniflare/CHANGELOG.md | 121 ++++++++++++++++++++++ packages/miniflare/package.json | 2 +- packages/pages-shared/CHANGELOG.md | 7 ++ packages/pages-shared/package.json | 2 +- packages/vitest-pool-workers/CHANGELOG.md | 8 ++ packages/vitest-pool-workers/package.json | 2 +- packages/wrangler/CHANGELOG.md | 36 +++++++ packages/wrangler/package.json | 2 +- pnpm-lock.yaml | 2 +- 35 files changed, 223 insertions(+), 259 deletions(-) delete mode 100644 .changeset/c3-frameworks-update-5001.md delete mode 100644 .changeset/c3-frameworks-update-5011.md delete mode 100644 .changeset/c3-frameworks-update-5019.md delete mode 100644 .changeset/c3-frameworks-update-5020.md delete mode 100644 .changeset/c3-frameworks-update-5021.md delete mode 100644 .changeset/cuddly-icons-itch.md delete mode 100644 .changeset/four-comics-battle.md delete mode 100644 .changeset/gentle-mayflies-shout.md delete mode 100644 .changeset/khaki-feet-exist.md delete mode 100644 .changeset/khaki-wasps-glow.md delete mode 100644 .changeset/poor-carrots-bathe.md delete mode 100644 .changeset/proud-plums-refuse.md delete mode 100644 .changeset/rich-needles-dress.md delete mode 100644 .changeset/rotten-suns-nail.md delete mode 100644 .changeset/sharp-mayflies-flow.md delete mode 100644 .changeset/slimy-apples-reply.md delete mode 100644 .changeset/spotty-shirts-drop.md delete mode 100644 .changeset/spotty-suns-learn.md delete mode 100644 .changeset/ten-jars-play.md delete mode 100644 .changeset/tidy-beans-raise.md delete mode 100644 .changeset/twelve-moons-fly.md delete mode 100644 .changeset/warm-weeks-stare.md delete mode 100644 .changeset/yellow-kings-behave.md create mode 100644 packages/vitest-pool-workers/CHANGELOG.md diff --git a/.changeset/c3-frameworks-update-5001.md b/.changeset/c3-frameworks-update-5001.md deleted file mode 100644 index f1fcf85f384a..000000000000 --- a/.changeset/c3-frameworks-update-5001.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: Bumped `create-hono` from `0.3.2` to `0.4.0` diff --git a/.changeset/c3-frameworks-update-5011.md b/.changeset/c3-frameworks-update-5011.md deleted file mode 100644 index 112266ad60d7..000000000000 --- a/.changeset/c3-frameworks-update-5011.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: Bumped `create-qwik` from `1.4.4` to `1.4.5` diff --git a/.changeset/c3-frameworks-update-5019.md b/.changeset/c3-frameworks-update-5019.md deleted file mode 100644 index f1c83ddea4d8..000000000000 --- a/.changeset/c3-frameworks-update-5019.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: Bumped `@angular/create` from `17.1.3` to `17.2.0` diff --git a/.changeset/c3-frameworks-update-5020.md b/.changeset/c3-frameworks-update-5020.md deleted file mode 100644 index b754a0da6c42..000000000000 --- a/.changeset/c3-frameworks-update-5020.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: Bumped `nuxi` from `3.10.0` to `3.10.1` diff --git a/.changeset/c3-frameworks-update-5021.md b/.changeset/c3-frameworks-update-5021.md deleted file mode 100644 index 71ce38dd7053..000000000000 --- a/.changeset/c3-frameworks-update-5021.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: Bumped `create-astro` from `4.7.2` to `4.7.3` diff --git a/.changeset/cuddly-icons-itch.md b/.changeset/cuddly-icons-itch.md deleted file mode 100644 index 801bd6dbbd0b..000000000000 --- a/.changeset/cuddly-icons-itch.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"wrangler": patch ---- - -fix: make sure `getPlatformProxy` produces a production-like `caches` object - -make sure that the `caches` object returned to `getPlatformProxy` behaves -in the same manner as the one present in production (where calling unsupported -methods throws a helpful error message) - -note: make sure that the unsupported methods are however not included in the -`CacheStorage` type definition diff --git a/.changeset/four-comics-battle.md b/.changeset/four-comics-battle.md deleted file mode 100644 index 691345e48d89..000000000000 --- a/.changeset/four-comics-battle.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -fix: don't suggest reporting user errors to GitHub - -Wrangler has two different types of errors: internal errors caused by something going wrong, and user errors caused by an invalid configuration. Previously, we would encourage users to submit bug reports for user errors, even though there's nothing we can do to fix them. This change ensures we only suggest this for internal errors. diff --git a/.changeset/gentle-mayflies-shout.md b/.changeset/gentle-mayflies-shout.md deleted file mode 100644 index 894d46019bb6..000000000000 --- a/.changeset/gentle-mayflies-shout.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -"miniflare": patch ---- - -fix: allow relative `scriptPath`/`modulesRoot`s to break out of current working directory - -Previously, Miniflare would resolve relative `scriptPath`s against `moduleRoot` multiple times resulting in incorrect paths and module names. This would lead to `can't use ".." to break out of starting directory` `workerd` errors. This change ensures Miniflare uses `scriptPath` as is, and only resolves it relative to `modulesRoot` when computing module names. Note this bug didn't affect service workers. This allows you to reference a modules `scriptPath` outside the working directory with something like: - -```js -const mf = new Miniflare({ - modules: true, - modulesRoot: "..", - scriptPath: "../worker.mjs", -}); -``` - -Fixes #4721 diff --git a/.changeset/khaki-feet-exist.md b/.changeset/khaki-feet-exist.md deleted file mode 100644 index 6589068d026a..000000000000 --- a/.changeset/khaki-feet-exist.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -feature: allow hyperdrive users to set local connection string as environment variable - -Wrangler dev now supports the HYPERDRIVE_LOCAL_CONNECTION_STRING environmental variable for connecting to a local database instance when testing Hyperdrive in local development. This environmental variable takes precedence over the localConnectionString set in wrangler.toml. diff --git a/.changeset/khaki-wasps-glow.md b/.changeset/khaki-wasps-glow.md deleted file mode 100644 index 51cd366ac57f..000000000000 --- a/.changeset/khaki-wasps-glow.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -fix: wait for actual port before opening browser with `--port=0` - -Previously, running `wrangler dev --remote --port=0` and then immediately pressing `b` would open `localhost:0` in your default browser. This change queues up opening the browser until Wrangler knows the port the dev server was started on. diff --git a/.changeset/poor-carrots-bathe.md b/.changeset/poor-carrots-bathe.md deleted file mode 100644 index d56773ba58b1..000000000000 --- a/.changeset/poor-carrots-bathe.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -"miniflare": minor ---- - -feat: pass `Miniflare` instance as argument to custom service binding handlers - -This change adds a new `Miniflare`-typed parameter to function-valued service binding handlers. This provides easy access to the correct bindings when re-using service functions across instances. - - - -```js -import assert from "node:assert"; -import { Miniflare, Response } from "miniflare"; - -const mf = new Miniflare({ - // ... - serviceBindings: { - SERVICE(request, instance) { - assert(instance === mf); - return new Response(); - }, - }, -}); -``` - - diff --git a/.changeset/proud-plums-refuse.md b/.changeset/proud-plums-refuse.md deleted file mode 100644 index e4d4da5e88b8..000000000000 --- a/.changeset/proud-plums-refuse.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"miniflare": minor ---- - -feat: allow `URL`s to be passed in `hyperdrives` - -Previously, the `hyperdrives` option only accepted `string`s as connection strings. This change allows `URL` objects to be passed too. diff --git a/.changeset/rich-needles-dress.md b/.changeset/rich-needles-dress.md deleted file mode 100644 index 583778ad230a..000000000000 --- a/.changeset/rich-needles-dress.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"wrangler": patch ---- - -fix: relax the `getPlatformProxy`'s' cache request/response types - -prior to these changes the caches obtained from `getPlatformProxy` -would use `unknown`s as their types, this proved too restrictive -and incompatible with the equivalent `@cloudflare/workers-types` -types, we decided to use `any`s instead to allow for more flexibility -whilst also making the type compatible with workers-types diff --git a/.changeset/rotten-suns-nail.md b/.changeset/rotten-suns-nail.md deleted file mode 100644 index 50939c4d4bbd..000000000000 --- a/.changeset/rotten-suns-nail.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -"miniflare": minor ---- - -feat: add support for custom root paths - -Miniflare has lots of file-path-valued options (e.g. `scriptPath`, `kvPersist`, `textBlobBindings`). Previously, these were always resolved relative to the current working directory before being used. This change adds a new `rootPath` shared, and per-worker option for customising this behaviour. Instead of resolving relative to the current working directory, Miniflare will now resolve path-valued options relative to the closest `rootPath` option. Paths are still resolved relative to the current working directory if no `rootPath`s are defined. Worker-level `rootPath`s are themselves resolved relative to the shared `rootPath` if defined. - - - -```js -import { Miniflare } from "miniflare"; - -const mf1 = new Miniflare({ - scriptPath: "index.mjs", // Resolves to "$PWD/index.mjs" -}); - -const mf2 = new Miniflare({ - rootPath: "a/b", - scriptPath: "c/index.mjs", // Resolves to "$PWD/a/b/c/index.mjs" -}); - -const mf3 = new Miniflare({ - rootPath: "/a/b", - workers: [ - { - name: "1", - rootPath: "c", - scriptPath: "index.mjs", // Resolves to "/a/b/c/index.mjs" - }, - { - name: "2", - scriptPath: "index.mjs", // Resolves to "/a/b/index.mjs" - } - ], -}); -``` - - diff --git a/.changeset/sharp-mayflies-flow.md b/.changeset/sharp-mayflies-flow.md deleted file mode 100644 index 1b683646107f..000000000000 --- a/.changeset/sharp-mayflies-flow.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"miniflare": patch ---- - -fix: return non-WebSocket responses for failed WebSocket upgrading `fetch()`es - -Previously, Miniflare's `fetch()` would throw an error if the `Upgrade: websocket` header was set, and a non-WebSocket response was returned from the origin. This change ensures the non-WebSocket response is returned from `fetch()` instead, with `webSocket` set to `null`. This allows the caller to handle the response as they see fit. diff --git a/.changeset/slimy-apples-reply.md b/.changeset/slimy-apples-reply.md deleted file mode 100644 index 3dd52d080d9f..000000000000 --- a/.changeset/slimy-apples-reply.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"create-cloudflare": minor ---- - -feature: Add `getBindingsProxy` support to `nuxt` template via `nitro-cloudflare-dev` module. - -The `nuxt` template now uses the default dev command from `create-nuxt` instead of using `wrangler pages dev` on build output in order to improve the developer workflow. `nitro-cloudflare-dev` is a nitro module that leverages `getBindingsProxy` and allows bindings to work in nitro commands. diff --git a/.changeset/spotty-shirts-drop.md b/.changeset/spotty-shirts-drop.md deleted file mode 100644 index 2378b211636c..000000000000 --- a/.changeset/spotty-shirts-drop.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: update Next.js template - -Update the C3 Next.js template so that it uses the latest `@cloudflare/next-on-pages` tooling (i.e. `setupDevPlatform` and `getRequestContext`) diff --git a/.changeset/spotty-suns-learn.md b/.changeset/spotty-suns-learn.md deleted file mode 100644 index b21469801d23..000000000000 --- a/.changeset/spotty-suns-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"create-cloudflare": patch ---- - -feature: Add an empty `wrangler.toml` file to qwik and nuxt templates. diff --git a/.changeset/ten-jars-play.md b/.changeset/ten-jars-play.md deleted file mode 100644 index 873eedff9aa3..000000000000 --- a/.changeset/ten-jars-play.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"create-cloudflare": patch ---- - -fix: make sure not to wrongly ask users if they want to use typescript - -currently if a CLI invoked by C3 asks the user if they want to use -typescript and the user opted out of it, C3 could actually again offer -typescript to the user afterwords, make sure that this does not happen diff --git a/.changeset/tidy-beans-raise.md b/.changeset/tidy-beans-raise.md deleted file mode 100644 index a244221a0e76..000000000000 --- a/.changeset/tidy-beans-raise.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -"miniflare": minor ---- - -feat: allow easy binding to current worker - -Previously, if you wanted to create a service binding to the current Worker, you'd need to know the Worker's name. This is usually possible, but can get tricky when dealing with many Workers. This change adds a new `kCurrentWorker` symbol that can be used instead of a Worker name in `serviceBindings`. `kCurrentWorker` always points to the Worker with the binding. - - - -```js -import { Miniflare, kCurrentWorker } from "miniflare"; - -const mf = new Miniflare({ - serviceBindings: { - SELF: kCurrentWorker, - }, - modules: true, - script: `export default { - fetch(request, env, ctx) { - const { pathname } = new URL(request.url); - if (pathname === "/recurse") { - return env.SELF.fetch("http://placeholder"); - } - return new Response("body"); - } - }`, -}); - -const response = await mf.dispatchFetch("http://placeholder/recurse"); -console.log(await response.text()); // body -``` - - diff --git a/.changeset/twelve-moons-fly.md b/.changeset/twelve-moons-fly.md deleted file mode 100644 index 721afdc36da3..000000000000 --- a/.changeset/twelve-moons-fly.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"create-cloudflare": minor ---- - -feature: Improve bindings support in Svelte template. - -C3 will now create Svelte projects with a hook that uses `getPlatformProxy` to proxy bindings in development mode. A `wrangler.toml` file will also be added where bindings can be added to be used in conjunction with `getPlatformProxy`. - -Along with this change, projects will use the default vite-based dev command from `create-svelte` instead of using `wrangler pages dev` on build output. - -When Typescript is used, the `app.d.ts` will be updated to add type definitions for `cf` and `ctx` to the `Platform` interface from the `@cloudflare/workers-types` package. Types for bindings on `platform.env` can be re-generated with a newly added `build-cf-types` script. diff --git a/.changeset/warm-weeks-stare.md b/.changeset/warm-weeks-stare.md deleted file mode 100644 index 2640877e528e..000000000000 --- a/.changeset/warm-weeks-stare.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"create-cloudflare": patch ---- - -chore: update qwik template to use `getPlatformProxy` - -update the C3 Qwik template to use the `getPlatformProxy` utility instead of the deprecated `getBindingsProxy` one diff --git a/.changeset/yellow-kings-behave.md b/.changeset/yellow-kings-behave.md deleted file mode 100644 index 629c39edb53f..000000000000 --- a/.changeset/yellow-kings-behave.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"miniflare": patch ---- - -fix: ensure `MiniflareOptions`, `WorkerOptions`, and `SharedOptions` types are correct - -Miniflare uses Zod for validating options. Previously, Miniflare inferred `*Options` from the _output_ types of its Zod schemas, rather than the _input_ types. In most cases, these were the same. However, the `hyperdrives` option has different input/output types, preventing these from being type checked correctly. diff --git a/fixtures/dev-env/package.json b/fixtures/dev-env/package.json index 41c1b6a77acb..9a98ebbac555 100644 --- a/fixtures/dev-env/package.json +++ b/fixtures/dev-env/package.json @@ -16,7 +16,7 @@ "@types/ws": "^8.5.7", "@cloudflare/workers-tsconfig": "workspace:^", "get-port": "^7.0.0", - "miniflare": "3.20240129.2", + "miniflare": "3.20240129.3", "undici": "^5.28.2", "wrangler": "workspace:*", "ws": "^8.14.2" diff --git a/packages/create-cloudflare/CHANGELOG.md b/packages/create-cloudflare/CHANGELOG.md index acc2f04bf598..7df418e0c415 100644 --- a/packages/create-cloudflare/CHANGELOG.md +++ b/packages/create-cloudflare/CHANGELOG.md @@ -1,5 +1,49 @@ # create-cloudflare +## 2.12.0 + +### Minor Changes + +- [#4996](https://github.com/cloudflare/workers-sdk/pull/4996) [`246512c8`](https://github.com/cloudflare/workers-sdk/commit/246512c8e34fa218b1d52d3a52cd6aa348fdf563) Thanks [@jculvey](https://github.com/jculvey)! - feature: Add `getBindingsProxy` support to `nuxt` template via `nitro-cloudflare-dev` module. + + The `nuxt` template now uses the default dev command from `create-nuxt` instead of using `wrangler pages dev` on build output in order to improve the developer workflow. `nitro-cloudflare-dev` is a nitro module that leverages `getBindingsProxy` and allows bindings to work in nitro commands. + +* [#5027](https://github.com/cloudflare/workers-sdk/pull/5027) [`a751489f`](https://github.com/cloudflare/workers-sdk/commit/a751489f2530bc7a7adec1167319cd145f080812) Thanks [@jculvey](https://github.com/jculvey)! - feature: Improve bindings support in Svelte template. + + C3 will now create Svelte projects with a hook that uses `getPlatformProxy` to proxy bindings in development mode. A `wrangler.toml` file will also be added where bindings can be added to be used in conjunction with `getPlatformProxy`. + + Along with this change, projects will use the default vite-based dev command from `create-svelte` instead of using `wrangler pages dev` on build output. + + When Typescript is used, the `app.d.ts` will be updated to add type definitions for `cf` and `ctx` to the `Platform` interface from the `@cloudflare/workers-types` package. Types for bindings on `platform.env` can be re-generated with a newly added `build-cf-types` script. + +### Patch Changes + +- [#5001](https://github.com/cloudflare/workers-sdk/pull/5001) [`efe8b444`](https://github.com/cloudflare/workers-sdk/commit/efe8b444e4220cfb23c443dc172582ee58119bc5) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: Bumped `create-hono` from `0.3.2` to `0.4.0` + +* [#5011](https://github.com/cloudflare/workers-sdk/pull/5011) [`89482d44`](https://github.com/cloudflare/workers-sdk/commit/89482d4475780c3cd3efbbd004c6b4f85c8daf53) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: Bumped `create-qwik` from `1.4.4` to `1.4.5` + +- [#5019](https://github.com/cloudflare/workers-sdk/pull/5019) [`f939ed73`](https://github.com/cloudflare/workers-sdk/commit/f939ed739a89de174099f128530a29bd51b04899) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: Bumped `@angular/create` from `17.1.3` to `17.2.0` + +* [#5020](https://github.com/cloudflare/workers-sdk/pull/5020) [`0e74c743`](https://github.com/cloudflare/workers-sdk/commit/0e74c743236d2a9055648eac9397d566ac90d83b) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: Bumped `nuxi` from `3.10.0` to `3.10.1` + +- [#5021](https://github.com/cloudflare/workers-sdk/pull/5021) [`ae1ef47c`](https://github.com/cloudflare/workers-sdk/commit/ae1ef47c8981a1059b5c8a2adaf7edeb38c1c49d) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: Bumped `create-astro` from `4.7.2` to `4.7.3` + +* [#5009](https://github.com/cloudflare/workers-sdk/pull/5009) [`1e263694`](https://github.com/cloudflare/workers-sdk/commit/1e2636940cc05b06475cce6d96a882f03216ff78) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - chore: update Next.js template + + Update the C3 Next.js template so that it uses the latest `@cloudflare/next-on-pages` tooling (i.e. `setupDevPlatform` and `getRequestContext`) + +- [#4996](https://github.com/cloudflare/workers-sdk/pull/4996) [`246512c8`](https://github.com/cloudflare/workers-sdk/commit/246512c8e34fa218b1d52d3a52cd6aa348fdf563) Thanks [@jculvey](https://github.com/jculvey)! - feature: Add an empty `wrangler.toml` file to qwik and nuxt templates. + +* [#4999](https://github.com/cloudflare/workers-sdk/pull/4999) [`ce6d4bc4`](https://github.com/cloudflare/workers-sdk/commit/ce6d4bc4753625d2aaf1b832bbb47fc50b24a98b) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - fix: make sure not to wrongly ask users if they want to use typescript + + currently if a CLI invoked by C3 asks the user if they want to use + typescript and the user opted out of it, C3 could actually again offer + typescript to the user afterwords, make sure that this does not happen + +- [#5010](https://github.com/cloudflare/workers-sdk/pull/5010) [`9f787042`](https://github.com/cloudflare/workers-sdk/commit/9f787042fc6894f5f1ebdc99e0ae10afbe6bdae6) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - chore: update qwik template to use `getPlatformProxy` + + update the C3 Qwik template to use the `getPlatformProxy` utility instead of the deprecated `getBindingsProxy` one + ## 2.11.3 ### Patch Changes diff --git a/packages/create-cloudflare/package.json b/packages/create-cloudflare/package.json index bf66a0153fe9..7b3e564a01f7 100644 --- a/packages/create-cloudflare/package.json +++ b/packages/create-cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "create-cloudflare", - "version": "2.11.3", + "version": "2.12.0", "description": "A CLI for creating and deploying new applications to Cloudflare.", "keywords": [ "cloudflare", diff --git a/packages/miniflare/CHANGELOG.md b/packages/miniflare/CHANGELOG.md index 0f763dc93698..4bb46b51631c 100644 --- a/packages/miniflare/CHANGELOG.md +++ b/packages/miniflare/CHANGELOG.md @@ -1,5 +1,126 @@ # miniflare +## 3.20240129.3 + +### Minor Changes + +- [#4795](https://github.com/cloudflare/workers-sdk/pull/4795) [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229) Thanks [@mrbbot](https://github.com/mrbbot)! - feat: pass `Miniflare` instance as argument to custom service binding handlers + + This change adds a new `Miniflare`-typed parameter to function-valued service binding handlers. This provides easy access to the correct bindings when re-using service functions across instances. + + + + ```js + import assert from "node:assert"; + import { Miniflare, Response } from "miniflare"; + + const mf = new Miniflare({ + serviceBindings: { + SERVICE(request, instance) { + assert(instance === mf); + return new Response(); + }, + }, + }); + ``` + + + +* [#4795](https://github.com/cloudflare/workers-sdk/pull/4795) [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229) Thanks [@mrbbot](https://github.com/mrbbot)! - feat: allow `URL`s to be passed in `hyperdrives` + + Previously, the `hyperdrives` option only accepted `string`s as connection strings. This change allows `URL` objects to be passed too. + +- [#4795](https://github.com/cloudflare/workers-sdk/pull/4795) [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229) Thanks [@mrbbot](https://github.com/mrbbot)! - feat: add support for custom root paths + + Miniflare has lots of file-path-valued options (e.g. `scriptPath`, `kvPersist`, `textBlobBindings`). Previously, these were always resolved relative to the current working directory before being used. This change adds a new `rootPath` shared, and per-worker option for customising this behaviour. Instead of resolving relative to the current working directory, Miniflare will now resolve path-valued options relative to the closest `rootPath` option. Paths are still resolved relative to the current working directory if no `rootPath`s are defined. Worker-level `rootPath`s are themselves resolved relative to the shared `rootPath` if defined. + + + + ```js + import { Miniflare } from "miniflare"; + + const mf1 = new Miniflare({ + scriptPath: "index.mjs", + }); + + const mf2 = new Miniflare({ + 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", + }, + ], + }); + ``` + + + +* [#4795](https://github.com/cloudflare/workers-sdk/pull/4795) [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229) Thanks [@mrbbot](https://github.com/mrbbot)! - feat: allow easy binding to current worker + + Previously, if you wanted to create a service binding to the current Worker, you'd need to know the Worker's name. This is usually possible, but can get tricky when dealing with many Workers. This change adds a new `kCurrentWorker` symbol that can be used instead of a Worker name in `serviceBindings`. `kCurrentWorker` always points to the Worker with the binding. + + + + ```js + import { kCurrentWorker, Miniflare } from "miniflare"; + + const mf = new Miniflare({ + serviceBindings: { + SELF: kCurrentWorker, + }, + modules: true, + script: `export default { + fetch(request, env, ctx) { + const { pathname } = new URL(request.url); + if (pathname === "/recurse") { + return env.SELF.fetch("http://placeholder"); + } + return new Response("body"); + } + }`, + }); + + const response = await mf.dispatchFetch("http://placeholder/recurse"); + console.log(await response.text()); // body + ``` + + + +### Patch Changes + +- [#4954](https://github.com/cloudflare/workers-sdk/pull/4954) [`7723ac17`](https://github.com/cloudflare/workers-sdk/commit/7723ac17906f894afe9af2152437726ac09a6290) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: allow relative `scriptPath`/`modulesRoot`s to break out of current working directory + + Previously, Miniflare would resolve relative `scriptPath`s against `moduleRoot` multiple times resulting in incorrect paths and module names. This would lead to `can't use ".." to break out of starting directory` `workerd` errors. This change ensures Miniflare uses `scriptPath` as is, and only resolves it relative to `modulesRoot` when computing module names. Note this bug didn't affect service workers. This allows you to reference a modules `scriptPath` outside the working directory with something like: + + ```js + const mf = new Miniflare({ + modules: true, + modulesRoot: "..", + scriptPath: "../worker.mjs", + }); + ``` + + Fixes #4721 + +* [#4795](https://github.com/cloudflare/workers-sdk/pull/4795) [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: return non-WebSocket responses for failed WebSocket upgrading `fetch()`es + + Previously, Miniflare's `fetch()` would throw an error if the `Upgrade: websocket` header was set, and a non-WebSocket response was returned from the origin. This change ensures the non-WebSocket response is returned from `fetch()` instead, with `webSocket` set to `null`. This allows the caller to handle the response as they see fit. + +- [#4795](https://github.com/cloudflare/workers-sdk/pull/4795) [`027f9719`](https://github.com/cloudflare/workers-sdk/commit/027f971975a48a564603275f3583d21e9d053229) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: ensure `MiniflareOptions`, `WorkerOptions`, and `SharedOptions` types are correct + + Miniflare uses Zod for validating options. Previously, Miniflare inferred `*Options` from the _output_ types of its Zod schemas, rather than the _input_ types. In most cases, these were the same. However, the `hyperdrives` option has different input/output types, preventing these from being type checked correctly. + ## 3.20240129.2 ### Patch Changes diff --git a/packages/miniflare/package.json b/packages/miniflare/package.json index 560a30cfccfb..3f8683282e2d 100644 --- a/packages/miniflare/package.json +++ b/packages/miniflare/package.json @@ -1,6 +1,6 @@ { "name": "miniflare", - "version": "3.20240129.2", + "version": "3.20240129.3", "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 5e4a99433b60..0bbfec284b9d 100644 --- a/packages/pages-shared/CHANGELOG.md +++ b/packages/pages-shared/CHANGELOG.md @@ -1,5 +1,12 @@ # @cloudflare/pages-shared +## 0.11.13 + +### Patch Changes + +- 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 + ## 0.11.12 ### Patch Changes diff --git a/packages/pages-shared/package.json b/packages/pages-shared/package.json index 747aad63cde2..af8f95ef273d 100644 --- a/packages/pages-shared/package.json +++ b/packages/pages-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/pages-shared", - "version": "0.11.12", + "version": "0.11.13", "repository": { "type": "git", "url": "https://github.com/cloudflare/workers-sdk.git", diff --git a/packages/vitest-pool-workers/CHANGELOG.md b/packages/vitest-pool-workers/CHANGELOG.md new file mode 100644 index 000000000000..7f2fdeaa3998 --- /dev/null +++ b/packages/vitest-pool-workers/CHANGELOG.md @@ -0,0 +1,8 @@ +# @cloudflare/vitest-pool-workers + +## 0.0.2 + +### Patch Changes + +- 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.20240130.0 diff --git a/packages/vitest-pool-workers/package.json b/packages/vitest-pool-workers/package.json index 96cfad49ba3e..2da36db686a2 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.0.1", + "version": "0.0.2", "private": true, "main": "dist/pool/index.mjs", "types": "test/cloudflare-test.d.ts", diff --git a/packages/wrangler/CHANGELOG.md b/packages/wrangler/CHANGELOG.md index 84bf195d613e..e14f36e1e9ef 100644 --- a/packages/wrangler/CHANGELOG.md +++ b/packages/wrangler/CHANGELOG.md @@ -1,5 +1,41 @@ # wrangler +## 3.28.3 + +### Patch Changes + +- [#5026](https://github.com/cloudflare/workers-sdk/pull/5026) [`04584722`](https://github.com/cloudflare/workers-sdk/commit/0458472251f17e864b45a167750baa50ca641e46) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - fix: make sure `getPlatformProxy` produces a production-like `caches` object + + make sure that the `caches` object returned to `getPlatformProxy` behaves + in the same manner as the one present in production (where calling unsupported + methods throws a helpful error message) + + note: make sure that the unsupported methods are however not included in the + `CacheStorage` type definition + +* [#5030](https://github.com/cloudflare/workers-sdk/pull/5030) [`55ea0721`](https://github.com/cloudflare/workers-sdk/commit/55ea0721b2550c8c24d79ddcc116ba5b4bc75028) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: don't suggest reporting user errors to GitHub + + Wrangler has two different types of errors: internal errors caused by something going wrong, and user errors caused by an invalid configuration. Previously, we would encourage users to submit bug reports for user errors, even though there's nothing we can do to fix them. This change ensures we only suggest this for internal errors. + +- [#4900](https://github.com/cloudflare/workers-sdk/pull/4900) [`3389f2e9`](https://github.com/cloudflare/workers-sdk/commit/3389f2e9daa27f89c2dc35c2ccd4da4ec54db683) Thanks [@OilyLime](https://github.com/OilyLime)! - feature: allow hyperdrive users to set local connection string as environment variable + + Wrangler dev now supports the HYPERDRIVE_LOCAL_CONNECTION_STRING environmental variable for connecting to a local database instance when testing Hyperdrive in local development. This environmental variable takes precedence over the localConnectionString set in wrangler.toml. + +* [#5033](https://github.com/cloudflare/workers-sdk/pull/5033) [`b1ace91b`](https://github.com/cloudflare/workers-sdk/commit/b1ace91bbfa9c484a931639a38e3798b1b217c89) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: wait for actual port before opening browser with `--port=0` + + Previously, running `wrangler dev --remote --port=0` and then immediately pressing `b` would open `localhost:0` in your default browser. This change queues up opening the browser until Wrangler knows the port the dev server was started on. + +- [#5026](https://github.com/cloudflare/workers-sdk/pull/5026) [`04584722`](https://github.com/cloudflare/workers-sdk/commit/0458472251f17e864b45a167750baa50ca641e46) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - fix: relax the `getPlatformProxy`'s' cache request/response types + + prior to these changes the caches obtained from `getPlatformProxy` + would use `unknown`s as their types, this proved too restrictive + and incompatible with the equivalent `@cloudflare/workers-types` + types, we decided to use `any`s instead to allow for more flexibility + 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 + ## 3.28.2 ### Patch Changes diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index a9bacffafeec..7d2a92f00580 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -1,6 +1,6 @@ { "name": "wrangler", - "version": "3.28.2", + "version": "3.28.3", "description": "Command-line interface for all things Cloudflare Workers", "keywords": [ "wrangler", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0fca11445a24..e0d8a3298cfc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -144,7 +144,7 @@ importers: specifier: ^7.0.0 version: 7.0.0 miniflare: - specifier: 3.20240129.2 + specifier: 3.20240129.3 version: link:../../packages/miniflare undici: specifier: ^5.28.2