diff --git a/.changeset/bump-undici.md b/.changeset/bump-undici.md deleted file mode 100644 index 3c96965c3fda..000000000000 --- a/.changeset/bump-undici.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"wrangler": patch -"miniflare": patch ---- - -Bump undici from 7.18.2 to 7.24.4 diff --git a/.changeset/c3-frameworks-update-11639.md b/.changeset/c3-frameworks-update-11639.md deleted file mode 100644 index 0349a9d33a36..000000000000 --- a/.changeset/c3-frameworks-update-11639.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"create-cloudflare": patch ---- - -Update dependencies of "create-cloudflare" - -The following dependency versions have been updated: - -| Dependency | From | To | -| --------------- | ------ | ------ | -| create-next-app | 15.5.6 | 16.1.6 | diff --git a/.changeset/c3-frameworks-update-12905.md b/.changeset/c3-frameworks-update-12905.md deleted file mode 100644 index 34aff98588e8..000000000000 --- a/.changeset/c3-frameworks-update-12905.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"create-cloudflare": patch ---- - -Update dependencies of "create-cloudflare" - -The following dependency versions have been updated: - -| Dependency | From | To | -| ---------- | ------ | ------ | -| nuxi | 3.33.1 | 3.34.0 | diff --git a/.changeset/c3-frameworks-update-12907.md b/.changeset/c3-frameworks-update-12907.md deleted file mode 100644 index 9d7bf39e27f8..000000000000 --- a/.changeset/c3-frameworks-update-12907.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"create-cloudflare": patch ---- - -Update dependencies of "create-cloudflare" - -The following dependency versions have been updated: - -| Dependency | From | To | -| ------------ | ------ | ----- | -| create-astro | 4.13.2 | 5.0.0 | diff --git a/.changeset/c3-frameworks-update-12908.md b/.changeset/c3-frameworks-update-12908.md deleted file mode 100644 index c7e06ab287d4..000000000000 --- a/.changeset/c3-frameworks-update-12908.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"create-cloudflare": patch ---- - -Update dependencies of "create-cloudflare" - -The following dependency versions have been updated: - -| Dependency | From | To | -| --------------- | ------ | ------ | -| @angular/create | 21.2.1 | 21.2.2 | diff --git a/.changeset/c3-frameworks-update-12909.md b/.changeset/c3-frameworks-update-12909.md deleted file mode 100644 index 756dd07bd60a..000000000000 --- a/.changeset/c3-frameworks-update-12909.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"create-cloudflare": patch ---- - -Update dependencies of "create-cloudflare" - -The following dependency versions have been updated: - -| Dependency | From | To | -| ----------- | ------ | ------ | -| create-qwik | 1.19.1 | 1.19.2 | diff --git a/.changeset/dependabot-update-12875.md b/.changeset/dependabot-update-12875.md deleted file mode 100644 index 82ce2f928af5..000000000000 --- a/.changeset/dependabot-update-12875.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"miniflare": patch -"wrangler": patch ---- - -Update dependencies of "miniflare", "wrangler" - -The following dependency versions have been updated: - -| Dependency | From | To | -| ---------- | ------------ | ------------ | -| workerd | 1.20260312.1 | 1.20260316.1 | diff --git a/.changeset/dependabot-update-12935.md b/.changeset/dependabot-update-12935.md deleted file mode 100644 index 201562443b9f..000000000000 --- a/.changeset/dependabot-update-12935.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"miniflare": patch -"wrangler": patch ---- - -Update dependencies of "miniflare", "wrangler" - -The following dependency versions have been updated: - -| Dependency | From | To | -| ---------- | ------------ | ------------ | -| workerd | 1.20260316.1 | 1.20260317.1 | diff --git a/.changeset/migrate-devtools-to-workers-assets.md b/.changeset/migrate-devtools-to-workers-assets.md deleted file mode 100644 index c91d4c68d74c..000000000000 --- a/.changeset/migrate-devtools-to-workers-assets.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"@cloudflare/chrome-devtools-patches": patch -"wrangler": patch -"miniflare": patch ---- - -Migrate chrome-devtools-patches deployment from Cloudflare Pages to Workers + Assets - -The DevTools frontend is now deployed as a Cloudflare Workers + Assets project instead of a Cloudflare Pages project. This uses `wrangler deploy` for production deployments and `wrangler versions upload` for PR preview deployments. - -The inspector proxy origin allowlists in both wrangler and miniflare have been updated to accept connections from the new `workers.dev` domain patterns, while retaining the legacy `pages.dev` patterns for backward compatibility. diff --git a/.changeset/open-apples-heal.md b/.changeset/open-apples-heal.md deleted file mode 100644 index e808b18e444b..000000000000 --- a/.changeset/open-apples-heal.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -Fix execution freezing on `debugger` statements when DevTools is not attached - -Previously, `wrangler` always sent `Debugger.enable` to the runtime on connection, even when DevTools wasn't open. This caused scripts to freeze on `debugger` statements. Now `Debugger.enable` is only sent when DevTools is actually attached, and `Debugger.disable` is sent when DevTools disconnects to stop the runtime from performing debugging work. diff --git a/.changeset/quick-items-shine.md b/.changeset/quick-items-shine.md deleted file mode 100644 index e20138c25a4c..000000000000 --- a/.changeset/quick-items-shine.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -Simplify description of --json option - -Remove extraneous adjectives in the description of the `--json` option. diff --git a/.changeset/tunnel-commands.md b/.changeset/tunnel-commands.md deleted file mode 100644 index f4e7f9baf210..000000000000 --- a/.changeset/tunnel-commands.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"wrangler": minor ---- - -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 -- `wrangler tunnel delete ` - Delete a tunnel (with confirmation) -- `wrangler tunnel run ` - Run a tunnel using cloudflared -- `wrangler tunnel quick-start ` - Start a temporary tunnel (Try Cloudflare) - -The `run` and `quick-start` commands automatically download and manage the cloudflared binary, caching it in `~/.wrangler/cloudflared/`. Users are prompted before downloading and warned if their PATH-installed cloudflared is outdated. You can override the binary location with the `CLOUDFLARED_PATH` environment variable. - -All commands are marked as experimental. diff --git a/.changeset/warm-mirrors-allow.md b/.changeset/warm-mirrors-allow.md deleted file mode 100644 index f77c28c4a2a0..000000000000 --- a/.changeset/warm-mirrors-allow.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"wrangler": patch ---- - -Reject cross-drive module paths in Pages Functions routing - -On Windows, module paths using a different drive letter could be parsed in a way that bypassed the project-root check. These paths are now parsed correctly and rejected when they resolve outside the project. diff --git a/.github/workflows/vite-plugin-playgrounds.yml b/.github/workflows/vite-plugin-playgrounds.yml index 756448ca4881..67094905b1aa 100644 --- a/.github/workflows/vite-plugin-playgrounds.yml +++ b/.github/workflows/vite-plugin-playgrounds.yml @@ -23,12 +23,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - vite: ["vite-7"] + vite: ["vite-8"] include: - os: ubuntu-latest vite: "vite-6" - os: ubuntu-latest - vite: vite-8 + vite: "vite-7" runs-on: ${{ matrix.os }} steps: - name: Checkout Repo @@ -59,11 +59,11 @@ jobs: - name: Downgrade to Vite 6 if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.vite == 'vite-6' run: | - pnpm update -r --no-save vite@6.4.1 - - name: Upgrade to Vite 8 - if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.vite == 'vite-8' + pnpm update -r --no-save vite@^6.1.0 + - name: Downgrade to Vite 7 + if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.vite == 'vite-7' run: | - pnpm update -r --no-save vite@^8.0.0 + pnpm update -r --no-save vite@^7.0.0 - name: Run dev playground tests if: steps.changes.outputs.everything_but_markdown == 'true' # We use `--only` to prevent TurboRepo from rebuilding dependencies diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b8f696338ed1..9fecde033161 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -176,7 +176,6 @@ For TypeScript to work properly in the Monorepo the version used in VSCode must 3. In the command palette, type "Select TypeScript Version" and select the command with the same name that appears in the list. 4. A submenu will appear with a list of available TypeScript versions. Choose the desired version you want to use for this project. If you have multiple versions installed, they will be listed here. - - Selecting "Use Workspace Version" will use the version of TypeScript installed in the project's `node_modules` directory. 5. After selecting the TypeScript version, VSCode will reload the workspace using the chosen version. @@ -272,7 +271,6 @@ Changes should be committed to a new local branch, which then gets pushed to you ``` - Stage files to include in a commit - - Use [VS Code](https://code.visualstudio.com/docs/editor/versioncontrol#_git-support) - Or add and commit files via the command line diff --git a/fixtures/vitest-pool-workers-examples/README.md b/fixtures/vitest-pool-workers-examples/README.md index 020f74460ab1..670408302af3 100644 --- a/fixtures/vitest-pool-workers-examples/README.md +++ b/fixtures/vitest-pool-workers-examples/README.md @@ -2,22 +2,22 @@ This directory contains example projects tested with `@cloudflare/vitest-pool-workers`. It aims to provide the building blocks for you to write tests for your own Workers. Note the examples in this directory define `singleWorker: true` options. We recommend you enable this option if you have lots of small test files. Isolated storage is enabled by default meaning writes performed in each test are automatically undone when the test finishes. -| Directory | Overview | -| ---------------------------------------------------------------------------------- | --------------------------------------------------------- | -| [✅ basics-unit-integration-self](basics-unit-integration-self) | Basic unit tests and integration tests using `SELF` | -| [⚠️ basics-integration-auxiliary](basics-integration-auxiliary) | Basic integration tests using an auxiliary worker[^1] | +| Directory | Overview | +| --------------------------------------------------------------------------------- | --------------------------------------------------------- | +| [✅ basics-unit-integration-self](basics-unit-integration-self) | Basic unit tests and integration tests using `SELF` | +| [⚠️ basics-integration-auxiliary](basics-integration-auxiliary) | Basic integration tests using an auxiliary worker[^1] | | [⚡️ pages-functions-unit-integration-self](pages-functions-unit-integration-self) | Functions unit tests and integration tests using `SELF` | -| [📦 kv-r2-caches](kv-r2-caches) | Isolated tests using KV, R2 and the Cache API | -| [📚 d1](d1) | Isolated tests using D1 with migrations | -| [📌 durable-objects](durable-objects) | Isolated tests using Durable Objects with direct access | -| [🔁 workflows](workflows) | Tests using Workflows | -| [🚥 queues](queues) | Tests using Queue producers and consumers | -| [🚰 pipelines](pipelines) | Tests using Pipelines | -| [🚀 hyperdrive](hyperdrive) | Tests using Hyperdrive with a Vitest managed TCP server | -| [🤹 request-mocking](request-mocking) | Tests using declarative/imperative outbound request mocks | -| [🔌 multiple-workers](multiple-workers) | Tests using multiple auxiliary workers and request mocks | -| [⚙️ web-assembly](web-assembly) | Tests importing WebAssembly modules | -| [🤯 rpc](rpc) | Tests using named entrypoints, Durable Objects and RPC | -| [🤷 misc](misc) | Tests for other assorted Vitest features | +| [📦 kv-r2-caches](kv-r2-caches) | Isolated tests using KV, R2 and the Cache API | +| [📚 d1](d1) | Isolated tests using D1 with migrations | +| [📌 durable-objects](durable-objects) | Isolated tests using Durable Objects with direct access | +| [🔁 workflows](workflows) | Tests using Workflows | +| [🚥 queues](queues) | Tests using Queue producers and consumers | +| [🚰 pipelines](pipelines) | Tests using Pipelines | +| [🚀 hyperdrive](hyperdrive) | Tests using Hyperdrive with a Vitest managed TCP server | +| [🤹 request-mocking](request-mocking) | Tests using declarative/imperative outbound request mocks | +| [🔌 multiple-workers](multiple-workers) | Tests using multiple auxiliary workers and request mocks | +| [⚙️ web-assembly](web-assembly) | Tests importing WebAssembly modules | +| [🤯 rpc](rpc) | Tests using named entrypoints, Durable Objects and RPC | +| [🤷 misc](misc) | Tests for other assorted Vitest features | [^1]: When using `SELF` for integration tests, your worker code runs in the same context as the test runner. This means you can use global mocks to control your worker, but also means your worker uses the same subtly different module resolution behaviour provided by Vite. Usually this isn't a problem, but if you'd like to run your worker in a fresh environment that's as close to production as possible, using an auxiliary worker may be a good idea. Note this prevents global mocks from controlling your worker, and requires you to build your worker ahead-of-time. This means your tests won't re-run automatically if you change your worker's source code, but could be useful if you have a complicated build process (e.g. full-stack framework). diff --git a/fixtures/vitest-pool-workers-examples/misc/test/defines.test.ts b/fixtures/vitest-pool-workers-examples/misc/test/defines.test.ts index 9047a892f949..9eb8e640a2f3 100644 --- a/fixtures/vitest-pool-workers-examples/misc/test/defines.test.ts +++ b/fixtures/vitest-pool-workers-examples/misc/test/defines.test.ts @@ -9,5 +9,5 @@ it("replaces defines from wrangler.toml", async ({ expect }) => { it("replaces defines from vitest.config.mts", async ({ expect }) => { expect(CONFIG_DEFINED_THING).toBe("thing"); expect(CONFIG_NESTED.DEFINED.THING).toStrictEqual([1, 2, 3]); - expect(CONFIG_NESTED.DEFINED.THING).toBe(CONFIG_NESTED.DEFINED.THING); + // Note that, unlike ESBuild, Oxc does not share object references when using `define` (https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define) }); diff --git a/fixtures/vitest-pool-workers-examples/package.json b/fixtures/vitest-pool-workers-examples/package.json index 3e540d8bc60e..a714eedd3eca 100644 --- a/fixtures/vitest-pool-workers-examples/package.json +++ b/fixtures/vitest-pool-workers-examples/package.json @@ -29,7 +29,7 @@ "stripe": "^20.0.0", "toucan-js": "4.0.0", "typescript": "catalog:default", - "vite": "catalog:default", + "vite": "catalog:vitest-4", "vitest": "catalog:default", "wrangler": "workspace:*" }, diff --git a/package.json b/package.json index c57cbd99f5c9..1653faf3e3e6 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "esbuild": "catalog:default", "esbuild-register": "^3.5.0", "jsonc-parser": "catalog:default", - "prettier": "^3.2.5", + "prettier": "^3.8.1", "prettier-plugin-packagejson": "^2.2.18", "prettier-plugin-tailwindcss": "^0.7.2", "tree-kill": "^1.2.2", @@ -78,8 +78,8 @@ "@cloudflare/elements>@types/react": "^18", "@types/node": "$@types/node", "@types/node>undici-types": "catalog:default", - "vitest@4>vite": "catalog:vite-plugin", - "vitest@3>vite": "^5.0.0" + "vitest@4>vite": "catalog:vitest-4", + "vitest@3>vite": "catalog:vitest-3" }, "patchedDependencies": { "@cloudflare/component-listbox@1.10.6": "patches/@cloudflare__component-listbox@1.10.6.patch", diff --git a/packages/chrome-devtools-patches/CHANGELOG.md b/packages/chrome-devtools-patches/CHANGELOG.md index 7b4ae27ce678..2dfddb485239 100644 --- a/packages/chrome-devtools-patches/CHANGELOG.md +++ b/packages/chrome-devtools-patches/CHANGELOG.md @@ -1,5 +1,15 @@ # @cloudflare/chrome-devtools-patches +## 0.1.5 + +### Patch Changes + +- [#12928](https://github.com/cloudflare/workers-sdk/pull/12928) [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Migrate chrome-devtools-patches deployment from Cloudflare Pages to Workers + Assets + + The DevTools frontend is now deployed as a Cloudflare Workers + Assets project instead of a Cloudflare Pages project. This uses `wrangler deploy` for production deployments and `wrangler versions upload` for PR preview deployments. + + The inspector proxy origin allowlists in both wrangler and miniflare have been updated to accept connections from the new `workers.dev` domain patterns, while retaining the legacy `pages.dev` patterns for backward compatibility. + ## 0.1.4 ### Patch Changes @@ -29,7 +39,6 @@ ### Minor Changes - [#7137](https://github.com/cloudflare/workers-sdk/pull/7137) [`1b195bd`](https://github.com/cloudflare/workers-sdk/commit/1b195bd09aef282a8a205d341579cdb7e3755d89) Thanks [@andyjessop](https://github.com/andyjessop)! - feat: update devtools patches for release - - rebases patches on top of latest devtools head - removes CPU profiling tab - adds performance tab diff --git a/packages/chrome-devtools-patches/package.json b/packages/chrome-devtools-patches/package.json index 192bf18cd891..ee54c86795b3 100644 --- a/packages/chrome-devtools-patches/package.json +++ b/packages/chrome-devtools-patches/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/chrome-devtools-patches", - "version": "0.1.4", + "version": "0.1.5", "private": true, "description": "Chrome Devtools hosted for easy use with Workers tooling and applications (Wrangler, Playground, Quick Editor).", "homepage": "https://github.com/cloudflare/workers-sdk#readme", diff --git a/packages/containers-shared/src/utils.ts b/packages/containers-shared/src/utils.ts index 393e3dc47932..b4d1ebe3fe74 100644 --- a/packages/containers-shared/src/utils.ts +++ b/packages/containers-shared/src/utils.ts @@ -267,7 +267,7 @@ export function resolveDockerHost(dockerPath: string): string { export const getDockerHostFromEnv = (): string => { const fromEnv = process.env.WRANGLER_DOCKER_HOST ?? process.env.DOCKER_HOST; - return fromEnv ?? process.platform === "win32" + return (fromEnv ?? process.platform === "win32") ? "//./pipe/docker_engine" : "unix:///var/run/docker.sock"; }; diff --git a/packages/create-cloudflare/.prettierrc b/packages/create-cloudflare/.prettierrc deleted file mode 100644 index b28498d2d9c0..000000000000 --- a/packages/create-cloudflare/.prettierrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "printWidth": 80, - "singleQuote": false, - "semi": true, - "useTabs": true, - "plugins": ["@ianvs/prettier-plugin-sort-imports"], - "importOrder": [ - "", - "", - "^[.]{2}$", - "^[.]{2}/", - "^[.]/(?!index)", - "^[.]$", - "^[.]/index$", - "" - ] -} diff --git a/packages/create-cloudflare/CHANGELOG.md b/packages/create-cloudflare/CHANGELOG.md index eb523a3c6d85..5f50db78ceae 100644 --- a/packages/create-cloudflare/CHANGELOG.md +++ b/packages/create-cloudflare/CHANGELOG.md @@ -1,5 +1,49 @@ # create-cloudflare +## 2.64.9 + +### Patch Changes + +- [#11639](https://github.com/cloudflare/workers-sdk/pull/11639) [`e9f5f30`](https://github.com/cloudflare/workers-sdk/commit/e9f5f30d536e89d0f182e336a0abc0e246bdc615) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "create-cloudflare" + + The following dependency versions have been updated: + + | Dependency | From | To | + | --------------- | ------ | ------ | + | create-next-app | 15.5.6 | 16.1.6 | + +- [#12905](https://github.com/cloudflare/workers-sdk/pull/12905) [`e7ef325`](https://github.com/cloudflare/workers-sdk/commit/e7ef325cd069e55116d35f1fea572a87cb919dab) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "create-cloudflare" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ---------- | ------ | ------ | + | nuxi | 3.33.1 | 3.34.0 | + +- [#12907](https://github.com/cloudflare/workers-sdk/pull/12907) [`92402f6`](https://github.com/cloudflare/workers-sdk/commit/92402f677a9640a08cd7bff4b0d1bb301c52b030) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "create-cloudflare" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ------------ | ------ | ----- | + | create-astro | 4.13.2 | 5.0.0 | + +- [#12908](https://github.com/cloudflare/workers-sdk/pull/12908) [`eadb0fd`](https://github.com/cloudflare/workers-sdk/commit/eadb0fdc56db7984253dd725c4178c83dd70d948) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "create-cloudflare" + + The following dependency versions have been updated: + + | Dependency | From | To | + | --------------- | ------ | ------ | + | @angular/create | 21.2.1 | 21.2.2 | + +- [#12909](https://github.com/cloudflare/workers-sdk/pull/12909) [`75fa04b`](https://github.com/cloudflare/workers-sdk/commit/75fa04bf029a730513a58c1c1b26f33e93227137) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "create-cloudflare" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ----------- | ------ | ------ | + | create-qwik | 1.19.1 | 1.19.2 | + ## 2.64.8 ### Patch Changes @@ -261,7 +305,6 @@ New Workers projects created via `create-cloudflare` now include an `AGENTS.md` file that provides AI coding agents with retrieval-led guidance for Cloudflare APIs. This helps agents avoid using outdated knowledge from their training data and instead consult current documentation. The file includes: - - Links to Cloudflare documentation and MCP servers - Essential wrangler commands (`dev`, `deploy`, `types`) - Pointers to product-specific documentation for limits and APIs @@ -640,7 +683,6 @@ - [#11520](https://github.com/cloudflare/workers-sdk/pull/11520) [`85ec269`](https://github.com/cloudflare/workers-sdk/commit/85ec26985a05b2cc5e0dd3c4904f5b96b9e2de80) Thanks [@vicb](https://github.com/vicb)! - Add placeholder substitution in wrangler config files. When c3 updates the config file: - - The value `""` is replaced with the worker name. - The value `""` is replaced with the latest worked compatibility date. @@ -1115,7 +1157,6 @@ - [#10766](https://github.com/cloudflare/workers-sdk/pull/10766) [`bd5b720`](https://github.com/cloudflare/workers-sdk/commit/bd5b720c44f8bc04ac153154c1f8b8a291af7139) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Do not override any `.env` settings in `.gitignore` files Previously we only looked for `.env*` in the `gitignore` but now we cover more cases such as: - - `.env` - `.env\*` - `.env.` @@ -2431,7 +2472,6 @@ | @angular/create | 19.1.5 | 19.1.6 | - [#7854](https://github.com/cloudflare/workers-sdk/pull/7854) [`bff209d`](https://github.com/cloudflare/workers-sdk/commit/bff209d853ae081ec692c41a080071956bf4ae2d) Thanks [@beratbayram](https://github.com/beratbayram)! - Update the Next.js template - - Removed top-level `await` in `next.config.ts` as it is not allowed there and not required. - Improved `setupDevPlatform()` comment @@ -2564,7 +2604,6 @@ | nuxi | 3.17.2 | 3.20.0 | - [#7743](https://github.com/cloudflare/workers-sdk/pull/7743) [`5955dac`](https://github.com/cloudflare/workers-sdk/commit/5955dac5ef2c6a0b6eea6dc28d11491966c07c2b) Thanks [@vicb](https://github.com/vicb)! - Update the Next.js experimental template - - Use create-next-app@^14.2.23 - Rename wrangler types output to cloudflare-env.d.ts @@ -3786,7 +3825,6 @@ - [#5675](https://github.com/cloudflare/workers-sdk/pull/5675) [`235c439`](https://github.com/cloudflare/workers-sdk/commit/235c4398268322b6c0c13060bc3da91f52b4b066) Thanks [@jculvey](https://github.com/jculvey)! - feat: Improvements to `hono` template. The `hono` template has been updated as follows: - - Bumps `create-hono` to `0.7.0` - Automatically installs dependencies and specifies the detected package manager to avoid interactive prompts - Adds a `wrangler.toml` file with commented out examples of all available bindings to match other templates. @@ -3937,7 +3975,6 @@ ### Patch Changes - [#5218](https://github.com/cloudflare/workers-sdk/pull/5218) [`0c535e7`](https://github.com/cloudflare/workers-sdk/commit/0c535e7236cbfc4bf856889454298bb434e48650) Thanks [@jculvey](https://github.com/jculvey)! - refactor: Refactor C3 internal helpers. Includes a few small changes: - - Drops `--save` from internal `pnpm` and `npm` install invocations - Switches to `git branch --show-current` for detecting current branch @@ -4151,7 +4188,6 @@ - [#4754](https://github.com/cloudflare/workers-sdk/pull/4754) [`06f85613`](https://github.com/cloudflare/workers-sdk/commit/06f85613228066ccb323c2818b443e9460b02c94) Thanks [@jculvey](https://github.com/jculvey)! - Adds C3 support for external templates hosted in git repositories via the `--template ` option. The source may be specified as any of the following: - - `user/repo` - `git@github.com:user/repo` - `https://github.com/user/repo` @@ -4164,7 +4200,6 @@ See the `degit` [docs](https://github.com/Rich-Harris/degit) for more details. At a minimum, templates must contain the following: - - `package.json` - `wrangler.toml` - `src/` containing a worker script referenced from `wrangler.toml` @@ -4365,7 +4400,6 @@ * [#4530](https://github.com/cloudflare/workers-sdk/pull/4530) [`774b16c9`](https://github.com/cloudflare/workers-sdk/commit/774b16c9138bbe7e7d42a8a27048755191010167) Thanks [@dependabot](https://github.com/apps/dependabot)! - C3: Bumped `@angular/create` from `17.0.3` to `17.0.5` - [#4481](https://github.com/cloudflare/workers-sdk/pull/4481) [`18a4dd92`](https://github.com/cloudflare/workers-sdk/commit/18a4dd92456f955ccbb35567a88475beafda01c0) Thanks [@jculvey](https://github.com/jculvey)! - Minor improvements when using the `--existing-script scriptName` flag: - - Format the type as "Pre-existing Worker (from Dashboard)" - Defaults the project name to `scriptName` @@ -4634,7 +4668,6 @@ (such arguments will be completely ignored by C3) * [#3822](https://github.com/cloudflare/workers-sdk/pull/3822) [`3db34519`](https://github.com/cloudflare/workers-sdk/commit/3db3451988988c0af82023cc53975bbaef14ac8a) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - update the frameworks' cli versions used in C3 - - `@angular/cli` from 16.1.x to 16.2.0 - `create-next-app` from 13.4.2 to 13.4.19 - `create-remix` from 1.16.0 to 1.19.3 diff --git a/packages/create-cloudflare/e2e/helpers/constants.ts b/packages/create-cloudflare/e2e/helpers/constants.ts index 4dfad550eb56..7f2977f43f6e 100644 --- a/packages/create-cloudflare/e2e/helpers/constants.ts +++ b/packages/create-cloudflare/e2e/helpers/constants.ts @@ -15,7 +15,7 @@ export const frameworkToTestFilter = process.env.E2E_FRAMEWORK_TEMPLATE_TO_TEST; export const testPackageManager = isOneOf( "E2E_TEST_PM", ["pnpm", "npm", "yarn", "bun"] as const, - "pnpm", + "pnpm" ); export const testPackageManagerVersion = process.env.E2E_TEST_PM_VERSION ?? ""; export const runDeployTests = process.env.E2E_RUN_DEPLOY_TESTS === "true"; @@ -38,12 +38,12 @@ export const keys = { function isOneOf( key: string, possibleValues: Options, - defaultValue: Options[number], + defaultValue: Options[number] ): Options[number] { const value = process.env[key] ?? defaultValue; assert( possibleValues.includes(value), - `Invalid environment variable "${key}". Expected one of: ${possibleValues.join(", ")}`, + `Invalid environment variable "${key}". Expected one of: ${possibleValues.join(", ")}` ); return value; } diff --git a/packages/create-cloudflare/e2e/helpers/framework-helpers.ts b/packages/create-cloudflare/e2e/helpers/framework-helpers.ts index 6de0ed67ed9b..52f095ae9cb7 100644 --- a/packages/create-cloudflare/e2e/helpers/framework-helpers.ts +++ b/packages/create-cloudflare/e2e/helpers/framework-helpers.ts @@ -51,7 +51,7 @@ export async function runC3ForFrameworkTest( argv = [], promptHandlers = [], extraEnv, - }: Pick, + }: Pick ) { const args = [ projectPath, @@ -88,7 +88,7 @@ export async function runC3ForFrameworkTest( export function updateWranglerConfig( projectPath: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any - handleUpdate: >(config: T) => T, + handleUpdate: >(config: T) => T ) { const wranglerTomlPath = join(projectPath, "wrangler.toml"); const wranglerJsoncPath = join(projectPath, "wrangler.jsonc"); @@ -98,7 +98,7 @@ export function updateWranglerConfig( writeToml( wranglerTomlPath, - handleUpdate(JSON.parse(JSON.stringify(wranglerToml))), + handleUpdate(JSON.parse(JSON.stringify(wranglerToml))) ); return () => { @@ -111,7 +111,7 @@ export function updateWranglerConfig( writeJSON( wranglerJsoncPath, - handleUpdate(JSON.parse(JSON.stringify(wranglerJsonc))), + handleUpdate(JSON.parse(JSON.stringify(wranglerJsonc))) ); return () => { @@ -143,7 +143,7 @@ export async function verifyDeployment( frameworkId: string, projectName: string, deploymentUrl: string, - expectedText: string, + expectedText: string ) { if (!runDeployTests) { return; @@ -159,7 +159,7 @@ export async function verifyDeployment( const body = await res.text(); if (!body.includes(expectedText)) { throw new Error( - `Deployed page (${deploymentUrl}) didn't contain expected string: "${expectedText}"`, + `Deployed page (${deploymentUrl}) didn't contain expected string: "${expectedText}"` ); } }); @@ -169,7 +169,7 @@ export async function verifyDevScript( { verifyDev }: FrameworkTestConfig, { devScript }: TemplateConfig, projectPath: string, - logStream: Writable, + logStream: Writable ) { if (!verifyDev) { return; @@ -178,7 +178,7 @@ export async function verifyDevScript( assert( devScript, "Expected a dev script as we are verifying the dev session in " + - projectPath, + projectPath ); // Run the dev-server on random ports to avoid colliding with other tests @@ -199,7 +199,7 @@ export async function verifyDevScript( VITEST: undefined, }, }, - logStream, + logStream ); let restoreConfig: (() => void) | undefined; @@ -207,7 +207,7 @@ export async function verifyDevScript( try { await retry( { times: 300, sleepMs: 5_000 }, - async () => await fetch(`http://127.0.0.1:${port}${verifyDev.route}`), + async () => await fetch(`http://127.0.0.1:${port}${verifyDev.route}`) ); // Make a request to the specified test route @@ -246,7 +246,7 @@ export async function verifyPreviewScript( { verifyPreview }: FrameworkTestConfig, { previewScript }: TemplateConfig, projectPath: string, - logStream: Writable, + logStream: Writable ) { if (!verifyPreview) { return; @@ -255,7 +255,7 @@ export async function verifyPreviewScript( assert( previewScript, "Expected a preview script is we are verifying the preview in " + - projectPath, + projectPath ); if (verifyPreview.build) { await runCommand([packageManager.name, "run", "build"], { @@ -284,7 +284,7 @@ export async function verifyPreviewScript( NODE_ENV: "production", }, }, - logStream, + logStream ); try { @@ -292,7 +292,7 @@ export async function verifyPreviewScript( // so wait some time for the dev-server to be ready. await retry( { times: 60, sleepMs: 5_000 }, - async () => await fetch(`http://localhost:${port}${verifyPreview.route}`), + async () => await fetch(`http://localhost:${port}${verifyPreview.route}`) ); // Make a request to the specified test route @@ -314,7 +314,7 @@ export async function verifyTypes( typesPath = "./worker-configuration.d.ts", envInterfaceName = "Env", }: TemplateConfig, - projectPath: string, + projectPath: string ) { if (workersTypes === "none" || verify === false) { return; @@ -327,14 +327,14 @@ export async function verifyTypes( // old type gen - some framework templates pin older versions of wrangler line === `interface ${envInterfaceName} {` || // new after importable env change - line === `interface ${envInterfaceName} extends Cloudflare.Env {}`, + line === `interface ${envInterfaceName} extends Cloudflare.Env {}` ); expect(hasEnvInterface).toBe(true); // if the runtime types were installed, they wont be in this file if (workersTypes === "generated") { expect(outputFileContent[2]).match( - /\/\/ Runtime types generated with workerd@1\.\d{8}\.\d \d{4}-\d{2}-\d{2} ([a-z_]+,?)*/, + /\/\/ Runtime types generated with workerd@1\.\d{8}\.\d \d{4}-\d{2}-\d{2} ([a-z_]+,?)*/ ); } @@ -353,9 +353,7 @@ export async function verifyTypes( } if (workersTypes === "installed") { expect( - tsconfigTypes.some((x: string) => - x.includes("@cloudflare/workers-types"), - ), + tsconfigTypes.some((x: string) => x.includes("@cloudflare/workers-types")) ).toBe(true); } if (nodeCompat) { @@ -365,7 +363,7 @@ export async function verifyTypes( export async function verifyCloudflareVitePluginConfigured( { verifyCloudflareVitePluginConfigured: verify }: FrameworkTestConfig, - projectPath: string, + projectPath: string ) { if (!verify) { return; @@ -385,17 +383,17 @@ export async function verifyCloudflareVitePluginConfigured( } const prePackageJson = JSON.parse( - readFile(join(projectPath, "package.json")), + readFile(join(projectPath, "package.json")) ) as { devDependencies: Record }; expect( - prePackageJson.devDependencies?.["@cloudflare/vite-plugin"], + prePackageJson.devDependencies?.["@cloudflare/vite-plugin"] ).not.toBeUndefined(); const viteConfig = readFile(viteConfigPath); expect(viteConfig).toContain( - 'import { cloudflare } from "@cloudflare/vite-plugin"', + 'import { cloudflare } from "@cloudflare/vite-plugin"' ); expect(viteConfig).toMatch(/plugins:\s*?\[.*?cloudflare.*?]/); } @@ -426,17 +424,17 @@ export function getFrameworkConfig(frameworkKey: string) { if ("platformVariants" in frameworkMap[frameworkId]) { assert( platformVariant === "pages" || platformVariant === "workers", - `Missing or invalid platformVariant in "${frameworkKey}" test.\nPlease update the test maps to contain both "${frameworkId}:pages" and "${frameworkId}:workers" properties.`, + `Missing or invalid platformVariant in "${frameworkKey}" test.\nPlease update the test maps to contain both "${frameworkId}:pages" and "${frameworkId}:workers" properties.` ); assert( "platformVariants" in frameworkMap[frameworkId], - `Expected platformVariants for "${frameworkId}" framework config.`, + `Expected platformVariants for "${frameworkId}" framework config.` ); return frameworkMap[frameworkId].platformVariants[platformVariant]; } else { assert( platformVariant === undefined, - `Unexpected platform variant in test for ${frameworkId}`, + `Unexpected platform variant in test for ${frameworkId}` ); return frameworkMap[frameworkId]; } @@ -448,7 +446,7 @@ export function getFrameworkConfig(frameworkKey: string) { export async function testGitCommitMessage( projectName: string, framework: string, - projectPath: string, + projectPath: string ) { const commitMessage = await runCommand(["git", "log", "-1"], { silent: true, @@ -456,7 +454,7 @@ export async function testGitCommitMessage( }); expect(commitMessage).toMatch( - /Initialize web application via create-cloudflare CLI/, + /Initialize web application via create-cloudflare CLI/ ); expect(commitMessage).toContain(`C3 = create-cloudflare@${version}`); expect(commitMessage).toContain(`project name = ${projectName}`); @@ -468,7 +466,7 @@ export async function testGitCommitMessage( */ export async function testDeploymentCommitMessage( projectName: string, - framework: string, + framework: string ) { const projectLatestCommitMessage = await retry({ times: 5 }, async () => { // Wait for 2 seconds between each attempt @@ -481,7 +479,7 @@ export async function testDeploymentCommitMessage( headers: { Authorization: `Bearer ${CLOUDFLARE_API_TOKEN}`, }, - }, + } ); const result = ( @@ -508,10 +506,10 @@ export async function testDeploymentCommitMessage( }); expect(projectLatestCommitMessage).toMatch( - /Initialize web application via create-cloudflare CLI/, + /Initialize web application via create-cloudflare CLI/ ); expect(projectLatestCommitMessage).toContain( - `C3 = create-cloudflare@${version}`, + `C3 = create-cloudflare@${version}` ); expect(projectLatestCommitMessage).toContain(`project name = ${projectName}`); expect(projectLatestCommitMessage).toContain(`framework = ${framework}`); diff --git a/packages/create-cloudflare/e2e/helpers/log-stream.ts b/packages/create-cloudflare/e2e/helpers/log-stream.ts index ca3b77a578f2..1d04b2c5da7b 100644 --- a/packages/create-cloudflare/e2e/helpers/log-stream.ts +++ b/packages/create-cloudflare/e2e/helpers/log-stream.ts @@ -59,13 +59,13 @@ function getLogPath(suite: RunnerTestSuite) { return nodePath.join( getLogFolder(isExperimental, testPackageManager), - suiteFilename, + suiteFilename ); } export function getLogFolder(experimental: boolean, packageManager: string) { return nodePath.join( "./.e2e-logs" + (experimental ? "-experimental" : ""), - packageManager, + packageManager ); } diff --git a/packages/create-cloudflare/e2e/helpers/run-c3.ts b/packages/create-cloudflare/e2e/helpers/run-c3.ts index 0b00d4c38219..0fd587df11ff 100644 --- a/packages/create-cloudflare/e2e/helpers/run-c3.ts +++ b/packages/create-cloudflare/e2e/helpers/run-c3.ts @@ -73,7 +73,7 @@ export const runC3 = async ( argv: string[] = [], promptHandlers: PromptHandler[] = [], logStream: Writable, - extraEnv: Record = {}, + extraEnv: Record = {} ) => { // We don't use the "test" package manager here (i.e. E2E_TEST_PM and E2E_TEST_PM_VERSION) because yarn 1.x doesn't actually provide a `dlx` version. // And in any case, this first step just installs a temp copy of create-cloudflare and executes it. @@ -82,7 +82,7 @@ export const runC3 = async ( const proc = spawnWithLogging( cmd, { env: { ...testEnv, ...extraEnv }, cwd: tmpdir() }, - logStream, + logStream ); const onData = (data: string) => { @@ -105,7 +105,7 @@ export const runC3 = async ( } const matchesPrompt = lines.some((line) => - currentDialog.matcher.test(line), + currentDialog.matcher.test(line) ); // if we don't match the current question and we haven't already matched it previously @@ -127,7 +127,7 @@ export const runC3 = async ( !text.includes(assertErrorMessage) ) { throw new Error( - `The error message does not match; Expected "${assertErrorMessage}" but found "${text}".`, + `The error message does not match; Expected "${assertErrorMessage}" but found "${text}".` ); } @@ -161,7 +161,7 @@ export const runC3 = async ( assertDefaultSelection !== currentSelection ) { throw new Error( - `The default selection does not match; Expected "${assertDefaultSelection}" but found "${currentSelection}".`, + `The default selection does not match; Expected "${assertDefaultSelection}" but found "${currentSelection}".` ); } @@ -177,7 +177,7 @@ export const runC3 = async ( !description.includes(assertDescriptionText) ) { throw new Error( - `The description does not match; Expected "${assertDescriptionText}" but found "${description}".`, + `The description does not match; Expected "${assertDescriptionText}" but found "${description}".` ); } diff --git a/packages/create-cloudflare/e2e/helpers/spawn.ts b/packages/create-cloudflare/e2e/helpers/spawn.ts index d08340e2e742..4450d1bb26ad 100644 --- a/packages/create-cloudflare/e2e/helpers/spawn.ts +++ b/packages/create-cloudflare/e2e/helpers/spawn.ts @@ -21,7 +21,7 @@ import type { Writable } from "node:stream"; export const spawnWithLogging = ( args: string[], opts: SpawnOptionsWithoutStdio, - logStream: Writable, + logStream: Writable ) => { const [cmd, ...argv] = args; @@ -61,7 +61,7 @@ export const spawnWithLogging = ( export const waitForExit = async ( proc: ChildProcessWithoutNullStreams, - onData?: (chunk: string) => void, + onData?: (chunk: string) => void ) => { const stdout: string[] = []; const stderr: string[] = []; @@ -125,6 +125,6 @@ export const testEnv = { export function kill(proc: ChildProcess) { return new Promise( - (resolve) => proc.pid && treeKill(proc.pid, "SIGINT", () => resolve()), + (resolve) => proc.pid && treeKill(proc.pid, "SIGINT", () => resolve()) ); } diff --git a/packages/create-cloudflare/e2e/helpers/workers-helpers.ts b/packages/create-cloudflare/e2e/helpers/workers-helpers.ts index 9a3a2e1a8f40..3c38b92860d5 100644 --- a/packages/create-cloudflare/e2e/helpers/workers-helpers.ts +++ b/packages/create-cloudflare/e2e/helpers/workers-helpers.ts @@ -16,7 +16,7 @@ const { name: pm } = detectPackageManager(); export async function runC3ForWorkerTest( { argv, promptHandlers, template }: WorkerTestConfig, projectPath: string, - logStream: Writable, + logStream: Writable ) { const args = [ projectPath, @@ -55,7 +55,7 @@ export async function verifyDeployment( verifyDeploy: { route: string; expectedText: string; - }, + } ) { await retry({ times: 5 }, async () => { await setTimeout(1_000); @@ -63,7 +63,7 @@ export async function verifyDeployment( const body = await res.text(); if (!body.includes(verifyDeploy.expectedText)) { throw new Error( - `(Deployed page (${deploymentUrl}) didn't contain expected string: "${verifyDeploy.expectedText}" instead got ${body}`, + `(Deployed page (${deploymentUrl}) didn't contain expected string: "${verifyDeploy.expectedText}" instead got ${body}` ); } }); @@ -72,7 +72,7 @@ export async function verifyDeployment( export async function verifyLocalDev( { verifyDeploy }: WorkerTestConfig, projectPath: string, - logStream: Writable, + logStream: Writable ) { if (verifyDeploy === null) { return; @@ -99,14 +99,14 @@ export async function verifyLocalDev( VITEST: undefined, }, }, - logStream, + logStream ); try { // Wait for the dev-server to be ready await retry( { times: 20, sleepMs: 5_000 }, - async () => await fetch(`http://127.0.0.1:${port}${verifyDeploy.route}`), + async () => await fetch(`http://127.0.0.1:${port}${verifyDeploy.route}`) ); // Make a request to the specified test route @@ -123,7 +123,7 @@ export async function verifyLocalDev( export async function verifyTestScript( projectPath: string, - logStream: Writable, + logStream: Writable ) { const proc = spawnWithLogging( [pm, "run", "test"], @@ -136,7 +136,7 @@ export async function verifyTestScript( CI: "true", }, }, - logStream, + logStream ); return await waitForExit(proc); diff --git a/packages/create-cloudflare/e2e/tests/cli/cli.test.ts b/packages/create-cloudflare/e2e/tests/cli/cli.test.ts index d57c1079bd72..a79315a03bbe 100644 --- a/packages/create-cloudflare/e2e/tests/cli/cli.test.ts +++ b/packages/create-cloudflare/e2e/tests/cli/cli.test.ts @@ -77,7 +77,7 @@ describe("Create Cloudflare CLI", () => { input: [keys.enter], }, ], - logStream, + logStream ); expect(project.path).toExist(); @@ -85,7 +85,7 @@ describe("Create Cloudflare CLI", () => { expect(output).toContain(`type SSR / full-stack app`); expect(output).toContain(`lang TypeScript`); expect(output).toContain(`no deploy`); - }, + } ); test.skipIf(isWindows)( @@ -124,14 +124,14 @@ describe("Create Cloudflare CLI", () => { input: ["n"], }, ], - logStream, + logStream ); expect(project.path).toExist(); expect(output).toContain(`type Scheduled Worker (Cron Trigger)`); expect(output).toContain(`lang JavaScript`); expect(output).toContain(`no deploy`); - }, + } ); test.skipIf(isWindows)( @@ -141,7 +141,7 @@ describe("Create Cloudflare CLI", () => { const existingProjectName = Array.from(projectName).reverse().join(""); const existingProjectPath = project.path.replace( projectName, - existingProjectName, + existingProjectName ); const existingFilePath = `${existingProjectPath}/example.json`; @@ -180,7 +180,7 @@ describe("Create Cloudflare CLI", () => { input: ["n"], }, ], - logStream, + logStream ); expect(project.path).toExist(); @@ -196,7 +196,7 @@ describe("Create Cloudflare CLI", () => { retryDelay: 100, }); } - }, + } ); test.skipIf(isWindows)( @@ -211,17 +211,17 @@ describe("Create Cloudflare CLI", () => { "--no-agents", ], [], - logStream, + logStream ); expect(output).toContain( - `repository https://github.com/cloudflare/workers-graphql-server`, + `repository https://github.com/cloudflare/workers-graphql-server` ); expect(output).toContain( - `Cloning template from: https://github.com/cloudflare/workers-graphql-server`, + `Cloning template from: https://github.com/cloudflare/workers-graphql-server` ); expect(output).toContain(`template cloned and validated`); - }, + } ); // Skipping this on npm because the template that we are downloading has a package-lock file that @@ -244,14 +244,14 @@ describe("Create Cloudflare CLI", () => { "--no-agents", ], [], - logStream, + logStream ); expect(output).toContain( - `repository cloudflare/templates/multiplayer-globe-template`, + `repository cloudflare/templates/multiplayer-globe-template` ); expect(output).toContain( - `Cloning template from: cloudflare/templates/multiplayer-globe-template`, + `Cloning template from: cloudflare/templates/multiplayer-globe-template` ); expect(output).toContain(`template cloned and validated`); // the template fails between these two assertions. however, the @@ -266,7 +266,7 @@ describe("Create Cloudflare CLI", () => { } }" `); - }, + } ); test.skipIf(isWindows)( @@ -282,14 +282,14 @@ describe("Create Cloudflare CLI", () => { "--no-agents", ], [], - logStream, + logStream ); expect(project.path).toExist(); expect(output).toContain(`category Hello World example`); expect(output).toContain(`type Worker only`); expect(output).toContain(`lang Python`); - }, + } ); test.skipIf(isWindows)( @@ -305,14 +305,14 @@ describe("Create Cloudflare CLI", () => { "--no-agents", ], [], - logStream, + logStream ); expect(project.path).toExist(); expect(output).toContain(`category Hello World example`); expect(output).toContain(`type Worker only`); expect(output).toContain(`lang Python`); - }, + } ); test.skipIf(isWindows)( @@ -327,13 +327,13 @@ describe("Create Cloudflare CLI", () => { "--git=false", ], [], - logStream, + logStream ); expect(errors).toContain( - `No templates available for language "python" in the "demo" category`, + `No templates available for language "python" in the "demo" category` ); - }, + } ); /* @@ -370,13 +370,13 @@ describe("Create Cloudflare CLI", () => { }, }, ], - logStream, + logStream ); expect(project.path).toExist(); expect(output).toContain(`category Application Starter`); expect(output).toContain(`type API starter (OpenAPI compliant)`); - }, + } ); test.skipIf(isWindows)( @@ -480,13 +480,13 @@ describe("Create Cloudflare CLI", () => { }, }, ], - logStream, + logStream ); expect(project.path).toExist(); expect(output).toContain(`type Worker only`); expect(output).toContain(`lang JavaScript`); - }, + } ); test.skipIf(isWindows || pm === "yarn" || !CLOUDFLARE_API_TOKEN)( @@ -498,7 +498,7 @@ describe("Create Cloudflare CLI", () => { if ( ( await fetch( - "https://existing-script-test-do-not-delete.devprod-testing7928.workers.dev/", + "https://existing-script-test-do-not-delete.devprod-testing7928.workers.dev/" ) ).status === 404 ) { @@ -507,11 +507,11 @@ describe("Create Cloudflare CLI", () => { } catch { // eslint-disable-next-line no-console console.log( - "Redeploying the existing-script-test-do-not-delete worker", + "Redeploying the existing-script-test-do-not-delete worker" ); const workerPath = resolve( __dirname, - "fixtures/existing-script-test-do-not-delete", + "fixtures/existing-script-test-do-not-delete" ); execSync("pnpx wrangler@latest deploy", { cwd: workerPath }); } @@ -525,7 +525,7 @@ describe("Create Cloudflare CLI", () => { "--no-agents", ], [], - logStream, + logStream ); expect(output).toContain("Pre-existing Worker (from Dashboard)"); expect(output).toContain("Application created successfully!"); @@ -534,10 +534,10 @@ describe("Create Cloudflare CLI", () => { expect(fs.existsSync(join(project.path, "wrangler.toml"))).toBe(false); expect( JSON.parse( - fs.readFileSync(join(project.path, "wrangler.jsonc"), "utf8"), - ), + fs.readFileSync(join(project.path, "wrangler.jsonc"), "utf8") + ) ).toMatchObject({ vars: { FOO: "bar" } }); - }, + } ); }); @@ -547,7 +547,7 @@ describe("Create Cloudflare CLI", () => { const { output } = await runC3( ["--help", "--experimental"], [], - logStream, + logStream ); expect(normalizeOutput(output)).toMatchInlineSnapshot(` "create-cloudflare @@ -743,12 +743,12 @@ describe("Create Cloudflare CLI", () => { const { errors } = await runC3( ["--platform=pages", `--framework=${framework}`, "my-app"], [], - logStream, + logStream ); expect(errors).toMatch( - /Error: The .*? framework doesn't support the "pages" platform/, + /Error: The .*? framework doesn't support the "pages" platform/ ); - }), + }) ); test("error when using invalid --variant for React framework", async ({ @@ -764,10 +764,10 @@ describe("Create Cloudflare CLI", () => { "--git=false", ], [], - logStream, + logStream ); expect(errors).toContain( - 'Unknown variant "invalid-variant". Valid variants are: react-ts, react-swc-ts, react, react-swc', + 'Unknown variant "invalid-variant". Valid variants are: react-ts, react-swc-ts, react, react-swc' ); }); @@ -784,10 +784,10 @@ describe("Create Cloudflare CLI", () => { "--git=false", ], [], - logStream, + logStream ); expect(errors).toContain( - 'Unknown variant "invalid-variant". Valid variants are: react-ts, react-swc-ts, react, react-swc', + 'Unknown variant "invalid-variant". Valid variants are: react-ts, react-swc-ts, react, react-swc' ); }); @@ -804,7 +804,7 @@ describe("Create Cloudflare CLI", () => { "--git=false", ], [], - logStream, + logStream ); expect(output).toContain("--template react-ts"); expect(output).not.toContain("Select a variant"); diff --git a/packages/create-cloudflare/e2e/tests/frameworks/frameworks.test.ts b/packages/create-cloudflare/e2e/tests/frameworks/frameworks.test.ts index e55e0d46e28c..7c00d69f9028 100644 --- a/packages/create-cloudflare/e2e/tests/frameworks/frameworks.test.ts +++ b/packages/create-cloudflare/e2e/tests/frameworks/frameworks.test.ts @@ -60,7 +60,7 @@ describe if (!testConfig.verifyDeploy) { expect( true, - "A `deploy` configuration must be defined for all framework tests", + "A `deploy` configuration must be defined for all framework tests" ).toBe(false); return; } @@ -79,7 +79,7 @@ describe ], promptHandlers: testConfig.promptHandlers, extraEnv: testConfig.extraEnv, - }, + } ); // Relevant project files should have been created @@ -97,7 +97,7 @@ describe await testGitCommitMessage( project.name, frameworkConfig.id, - project.path, + project.path ); } @@ -107,7 +107,7 @@ describe frameworkConfig.id, project.name, `${deploymentUrl}${testConfig.verifyDeploy.route}`, - testConfig.verifyDeploy.expectedText, + testConfig.verifyDeploy.expectedText ); // Copy over any platform specific test fixture files @@ -115,7 +115,7 @@ describe __dirname, "fixtures", frameworkConfig.id, - frameworkConfig.platform, + frameworkConfig.platform ); if (existsSync(platformFixturePath)) { await cp(platformFixturePath, project.path, { @@ -127,7 +127,7 @@ describe const fixturePath = join( __dirname, "fixtures", - frameworkConfig.id, + frameworkConfig.id ); if (existsSync(fixturePath)) { await cp(fixturePath, project.path, { @@ -141,26 +141,26 @@ describe testConfig, frameworkConfig, project.path, - logStream, + logStream ); await verifyPreviewScript( testConfig, frameworkConfig, project.path, - logStream, + logStream ); await verifyTypes(testConfig, frameworkConfig, project.path); await verifyCloudflareVitePluginConfigured( testConfig, - project.path, + project.path ); } catch (e) { expect.fail( "Failed due to an exception while running C3. See logs for more details. Error: " + - e, + e ); } finally { // Cleanup the project in case we need to retry it @@ -170,7 +170,7 @@ describe await deleteProject(project.name); } } - }, + } ); }); }); diff --git a/packages/create-cloudflare/e2e/tests/frameworks/test-config.ts b/packages/create-cloudflare/e2e/tests/frameworks/test-config.ts index b2f309690375..6716897a7eae 100644 --- a/packages/create-cloudflare/e2e/tests/frameworks/test-config.ts +++ b/packages/create-cloudflare/e2e/tests/frameworks/test-config.ts @@ -648,7 +648,7 @@ function getFrameworkTestConfig(pm: string): NamedFrameworkTestConfig[] { * Gets the list of experimental framework test configurations. */ function getExperimentalFrameworkTestConfig( - pm: string, + pm: string ): NamedFrameworkTestConfig[] { return [ { diff --git a/packages/create-cloudflare/e2e/tests/workers/test-config.ts b/packages/create-cloudflare/e2e/tests/workers/test-config.ts index 5f2b82022140..964fc2acf94c 100644 --- a/packages/create-cloudflare/e2e/tests/workers/test-config.ts +++ b/packages/create-cloudflare/e2e/tests/workers/test-config.ts @@ -184,7 +184,7 @@ export function getWorkerTests(): WorkerTestConfig[] { argv: (testConfig.argv ?? []).concat("--lang", variant), } satisfies WorkerTestConfig; }) - : [{ ...testConfig, name: testConfig.name ?? testConfig.template }], + : [{ ...testConfig, name: testConfig.name ?? testConfig.template }] ) .filter((testConfig) => { if (!workerTemplateToTest) { diff --git a/packages/create-cloudflare/e2e/tests/workers/workers.test.ts b/packages/create-cloudflare/e2e/tests/workers/workers.test.ts index 8812768136c5..d395976bd289 100644 --- a/packages/create-cloudflare/e2e/tests/workers/workers.test.ts +++ b/packages/create-cloudflare/e2e/tests/workers/workers.test.ts @@ -46,7 +46,7 @@ describe const deployedUrl = await runC3ForWorkerTest( testConfig, project.path, - logStream, + logStream ); // Relevant project files should have been created @@ -73,7 +73,7 @@ describe } } else { expect.fail( - `Expected at least one of "${jsoncPath}" or "${tomlPath}" to exist.`, + `Expected at least one of "${jsoncPath}" or "${tomlPath}" to exist.` ); } @@ -92,7 +92,7 @@ describe } finally { await deleteWorker(project.name); } - }, + } ); }); }); diff --git a/packages/create-cloudflare/package.json b/packages/create-cloudflare/package.json index f9ade2a1e0a1..7ae7cf70a122 100644 --- a/packages/create-cloudflare/package.json +++ b/packages/create-cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "create-cloudflare", - "version": "2.64.8", + "version": "2.64.9", "description": "A CLI for creating and deploying new applications to Cloudflare.", "keywords": [ "cloudflare", @@ -28,17 +28,16 @@ ], "scripts": { "build": "node -r esbuild-register scripts/build.ts", - "dev:codemod": "node -r esbuild-register scripts/codemodDev.ts", "check:lint": "eslint . --max-warnings=0 --cache", "check:type": "tsc", + "dev": "node -r esbuild-register scripts/build.ts --watch", + "dev:codemod": "node -r esbuild-register scripts/codemodDev.ts", + "test:ci": "vitest run --config ./vitest.config.mts", "test:e2e": "vitest run --config ./vitest-e2e.config.mts", "test:unit": "vitest run --config ./vitest.config.mts", - "test:unit:watch": "vitest --config ./vitest.config.mts", - "dev": "node -r esbuild-register scripts/build.ts --watch", - "test:ci": "vitest run --config ./vitest.config.mts" + "test:unit:watch": "vitest --config ./vitest.config.mts" }, "devDependencies": { - "@cloudflare/workers-utils": "workspace:*", "@babel/parser": "^7.21.3", "@babel/types": "^7.21.4", "@clack/prompts": "^0.6.3", @@ -48,6 +47,7 @@ "@cloudflare/vite-plugin": "workspace:*", "@cloudflare/workers-tsconfig": "workspace:*", "@cloudflare/workers-types": "catalog:default", + "@cloudflare/workers-utils": "workspace:*", "@types/command-exists": "^1.2.0", "@types/cross-spawn": "^6.0.2", "@types/deepmerge": "^2.2.0", @@ -94,11 +94,11 @@ "engines": { "node": ">=18.14.1" }, + "volta": { + "extends": "../../package.json" + }, "workers-sdk": { "prerelease": true, "type": "cli" - }, - "volta": { - "extends": "../../package.json" } } diff --git a/packages/create-cloudflare/scripts/build.ts b/packages/create-cloudflare/scripts/build.ts index b08aebbc67bd..6bca1aa194db 100644 --- a/packages/create-cloudflare/scripts/build.ts +++ b/packages/create-cloudflare/scripts/build.ts @@ -16,7 +16,7 @@ const run = async () => { format: "cjs", define: { "process.env.SPARROW_SOURCE_KEY": JSON.stringify( - process.env.SPARROW_SOURCE_KEY ?? "", + process.env.SPARROW_SOURCE_KEY ?? "" ), }, }; diff --git a/packages/create-cloudflare/scripts/codemodDev.ts b/packages/create-cloudflare/scripts/codemodDev.ts index 8669c8435a3c..8624703b6434 100644 --- a/packages/create-cloudflare/scripts/codemodDev.ts +++ b/packages/create-cloudflare/scripts/codemodDev.ts @@ -21,7 +21,7 @@ import * as recast from "recast"; */ export const testTransform = ( filePath: string, - methods: recast.types.Visitor, + methods: recast.types.Visitor ) => { const ast = parseFile(join(__dirname, filePath)); diff --git a/packages/create-cloudflare/scripts/common.ts b/packages/create-cloudflare/scripts/common.ts index 3fea4bea7126..9cbabe46e336 100644 --- a/packages/create-cloudflare/scripts/common.ts +++ b/packages/create-cloudflare/scripts/common.ts @@ -17,7 +17,7 @@ export type Worker = { const apiFetch = async ( path: string, init = { method: "GET" }, - queryParams = {}, + queryParams = {} ) => { const baseUrl = `https://api.cloudflare.com/client/v4/accounts/${process.env.CLOUDFLARE_ACCOUNT_ID}`; const queryString = queryParams diff --git a/packages/create-cloudflare/scripts/e2e/run-tests.ts b/packages/create-cloudflare/scripts/e2e/run-tests.ts index ad7debe39bf9..ffb5b11e0c40 100644 --- a/packages/create-cloudflare/scripts/e2e/run-tests.ts +++ b/packages/create-cloudflare/scripts/e2e/run-tests.ts @@ -13,7 +13,7 @@ class TestRunner { try { console.log( - `::group::${description} (${testPackageManager}${testPackageManagerVersion ? `@${testPackageManagerVersion}` : ""}${isExperimental ? " / experimental" : ""})`, + `::group::${description} (${testPackageManager}${testPackageManagerVersion ? `@${testPackageManagerVersion}` : ""}${isExperimental ? " / experimental" : ""})` ); execSync( `pnpm turbo test:e2e --log-order=stream --output-logs=new-only --summarize --filter=create-cloudflare -- ${testFilter}`, @@ -25,7 +25,7 @@ class TestRunner { E2E_TEST_PM: testPackageManager, E2E_TEST_PM_VERSION: testPackageManagerVersion, }, - }, + } ); console.log("::endgroup::"); } catch (e) { @@ -41,7 +41,7 @@ class TestRunner { if (this.#failed.length > 0) { throw new Error( "At least one task failed:" + - this.#failed.map((group) => `\n - ${group}`), + this.#failed.map((group) => `\n - ${group}`) ); } } diff --git a/packages/create-cloudflare/src/__tests__/deploy.test.ts b/packages/create-cloudflare/src/__tests__/deploy.test.ts index d43396a7c43d..0b6fa9917bc9 100644 --- a/packages/create-cloudflare/src/__tests__/deploy.test.ts +++ b/packages/create-cloudflare/src/__tests__/deploy.test.ts @@ -16,13 +16,13 @@ vi.mock("helpers/files"); const mockInsideGitRepo = (isInside = true) => { if (isInside) { vi.mocked(runCommand).mockResolvedValueOnce( - "On branch master\nnothing to commit, working tree clean", + "On branch master\nnothing to commit, working tree clean" ); } else { vi.mocked(runCommand).mockRejectedValueOnce( new Error( - "fatal: not a git repository (or any of the parent directories): .git", - ), + "fatal: not a git repository (or any of the parent directories): .git" + ) ); } }; @@ -37,7 +37,7 @@ describe("deploy helpers", async () => { } throw new Error( - "If you don't want to accept the default, you must mock this function.", + "If you don't want to accept the default, you must mock this function." ); }); }); @@ -134,12 +134,12 @@ describe("deploy helpers", async () => { mockInsideGitRepo(false); vi.mocked(runCommand).mockResolvedValueOnce(""); vi.mocked(readFile).mockImplementationOnce( - () => `{"type":"deploy", "targets":["${deployedUrl}"]}`, + () => `{"type":"deploy", "targets":["${deployedUrl}"]}` ); await runDeploy(ctx); expect(runCommand).toHaveBeenCalledWith( ["npm", "run", "deploy", "--", "--commit-message", `"${commitMsg}"`], - expect.any(Object), + expect.any(Object) ); expect(ctx.deployment.url).toBe(deployedUrl); }); @@ -148,7 +148,7 @@ describe("deploy helpers", async () => { const ctx = createTestContext(); ctx.account = undefined; await expect(() => runDeploy(ctx)).rejects.toThrow( - "Failed to read Cloudflare account.", + "Failed to read Cloudflare account." ); }); @@ -161,7 +161,7 @@ describe("deploy helpers", async () => { vi.mocked(runCommand).mockResolvedValueOnce(""); await expect(() => runDeploy(ctx)).rejects.toThrow( - "Failed to find deployment url.", + "Failed to find deployment url." ); }); }); diff --git a/packages/create-cloudflare/src/__tests__/git.test.ts b/packages/create-cloudflare/src/__tests__/git.test.ts index ab4a7808e217..57ad45102675 100644 --- a/packages/create-cloudflare/src/__tests__/git.test.ts +++ b/packages/create-cloudflare/src/__tests__/git.test.ts @@ -26,11 +26,11 @@ beforeEach(() => { const mockGitInstalled = (isInstalled = true) => { if (isInstalled) { vi.mocked(runCommand).mockResolvedValueOnce( - "git version 2.20.2 (Apple Git-100)", + "git version 2.20.2 (Apple Git-100)" ); } else { vi.mocked(runCommand).mockRejectedValueOnce( - new Error("zsh: command not found: git"), + new Error("zsh: command not found: git") ); } }; @@ -43,13 +43,13 @@ const mockGitConfig = () => { const mockInsideGitRepo = (isInside: boolean) => { if (isInside) { vi.mocked(runCommand).mockResolvedValueOnce( - "On branch master\nnothing to commit, working tree clean", + "On branch master\nnothing to commit, working tree clean" ); } else { vi.mocked(runCommand).mockRejectedValueOnce( new Error( - "fatal: not a git repository (or any of the parent directories): .git", - ), + "fatal: not a git repository (or any of the parent directories): .git" + ) ); } }; @@ -62,7 +62,7 @@ describe("git helpers", () => { describe("isGitConfigured", () => { test("fully configured", async ({ expect }) => { vi.mocked(runCommand).mockImplementation((cmd) => - Promise.resolve(cmd.includes("email") ? "test@user.com" : "test user"), + Promise.resolve(cmd.includes("email") ? "test@user.com" : "test user") ); await expect(isGitConfigured()).resolves.toBe(true); @@ -70,14 +70,14 @@ describe("git helpers", () => { test("no name", async ({ expect }) => { vi.mocked(runCommand).mockImplementation((cmd) => - Promise.resolve(cmd.includes("email") ? "test@user.com" : ""), + Promise.resolve(cmd.includes("email") ? "test@user.com" : "") ); await expect(isGitConfigured()).resolves.toBe(false); }); test("no email", async ({ expect }) => { vi.mocked(runCommand).mockImplementation((cmd) => - Promise.resolve(cmd.includes("name") ? "test user" : ""), + Promise.resolve(cmd.includes("name") ? "test user" : "") ); await expect(isGitConfigured()).resolves.toBe(false); }); @@ -130,7 +130,7 @@ describe("git helpers", () => { await initializeGit("."); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["git", "init", "--initial-branch", "production"], - expect.any(Object), + expect.any(Object) ); }); @@ -140,7 +140,7 @@ describe("git helpers", () => { await initializeGit("."); expect(vi.mocked(runCommand)).toHaveBeenLastCalledWith( ["git", "init"], - expect.any(Object), + expect.any(Object) ); }); }); @@ -163,7 +163,7 @@ describe("git helpers", () => { expect(processArgument).toHaveBeenCalledOnce(); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["git", "init", "--initial-branch", "main"], - expect.any(Object), + expect.any(Object) ); expect(ctx.gitRepoAlreadyExisted).toBe(false); expect(ctx.args.git).toBe(true); @@ -189,7 +189,7 @@ describe("git helpers", () => { await offerGit(ctx); expect(updateStatus).toHaveBeenCalledWith( - expect.stringContaining("Continuing without git"), + expect.stringContaining("Continuing without git") ); expect(processArgument).not.toHaveBeenCalled(); expect(ctx.args.git).toBe(false); @@ -213,7 +213,7 @@ describe("git helpers", () => { await offerGit(ctx); expect(updateStatus).toHaveBeenCalledWith( - expect.stringContaining("Continuing without git"), + expect.stringContaining("Continuing without git") ); expect(processArgument).not.toHaveBeenCalled(); expect(ctx.args.git).toBe(false); @@ -237,7 +237,7 @@ describe("git helpers", () => { // Should not initialize git since we're in an existing repo expect(vi.mocked(runCommand)).not.toHaveBeenCalledWith( ["git", "init", "--initial-branch", "main"], - expect.any(Object), + expect.any(Object) ); }); @@ -255,7 +255,7 @@ describe("git helpers", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledOnce(); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( expect.arrayContaining(["git", "--version"]), - expect.any(Object), + expect.any(Object) ); expect(ctx.args.git).toBe(false); @@ -276,7 +276,7 @@ describe("git helpers", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledOnce(); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( expect.arrayContaining(["git", "--version"]), - expect.any(Object), + expect.any(Object) ); expect(ctx.args.git).toBe(false); @@ -301,15 +301,15 @@ describe("git helpers", () => { // This is called when creating the git commit message expect(vi.mocked(runCommand)).toHaveBeenCalledWith( expect.arrayContaining(["git", "--version"]), - expect.any(Object), + expect.any(Object) ); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["git", "add", "."], - expect.any(Object), + expect.any(Object) ); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["git", "commit", "-m", expect.any(String), "--no-verify"], - expect.any(Object), + expect.any(Object) ); expect(spinner.stop).toHaveBeenCalledOnce(); expect(ctx.commitMessage).toBeDefined(); @@ -328,7 +328,7 @@ describe("git helpers", () => { // This is called when creating the git commit message expect(vi.mocked(runCommand)).toHaveBeenCalledWith( expect.arrayContaining(["git", "--version"]), - expect.any(Object), + expect.any(Object) ); expect(ctx.commitMessage).toBeDefined(); @@ -348,7 +348,7 @@ describe("git helpers", () => { // This is called when creating the git commit message expect(vi.mocked(runCommand)).toHaveBeenCalledWith( expect.arrayContaining(["git", "--version"]), - expect.any(Object), + expect.any(Object) ); expect(ctx.commitMessage).toBeDefined(); @@ -363,7 +363,7 @@ describe("git helpers", () => { vi.mocked(runCommand) .mockResolvedValueOnce("") // git add .mockRejectedValueOnce( - new Error("gpg: signing failed: Operation cancelled"), + new Error("gpg: signing failed: Operation cancelled") ); // Should not throw @@ -372,7 +372,7 @@ describe("git helpers", () => { expect(spinner.start).toHaveBeenCalledOnce(); expect(spinner.stop).toHaveBeenCalledOnce(); expect(updateStatus).toHaveBeenCalledWith( - expect.stringContaining("Failed to create initial commit"), + expect.stringContaining("Failed to create initial commit") ); expect(ctx.commitMessage).toBeDefined(); }); diff --git a/packages/create-cloudflare/src/__tests__/helpers.ts b/packages/create-cloudflare/src/__tests__/helpers.ts index 02bcd550d903..bec3110861d4 100644 --- a/packages/create-cloudflare/src/__tests__/helpers.ts +++ b/packages/create-cloudflare/src/__tests__/helpers.ts @@ -22,7 +22,7 @@ export const createTestContext = (name = "test", args?: C3Args): C3Context => { }; export const createTestTemplate = ( - config?: Partial, + config?: Partial ): TemplateConfig => { return { ...config, diff --git a/packages/create-cloudflare/src/__tests__/metrics.test.ts b/packages/create-cloudflare/src/__tests__/metrics.test.ts index 0d3687c9ffb4..405e34f91c30 100644 --- a/packages/create-cloudflare/src/__tests__/metrics.test.ts +++ b/packages/create-cloudflare/src/__tests__/metrics.test.ts @@ -75,7 +75,7 @@ describe("createReporter", () => { }, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(1); @@ -103,7 +103,7 @@ describe("createReporter", () => { durationMs: 1234, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(2); }); @@ -142,7 +142,7 @@ describe("createReporter", () => { }, }, }, - true, + true ); expect(sendEvent).toBeCalledTimes(1); @@ -170,7 +170,7 @@ describe("createReporter", () => { durationMs: 1234, }, }, - true, + true ); expect(sendEvent).toBeCalledTimes(2); }); @@ -291,7 +291,7 @@ describe("createReporter", () => { }, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(1); @@ -318,7 +318,7 @@ describe("createReporter", () => { durationMs: 1234, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(2); }); @@ -353,7 +353,7 @@ describe("createReporter", () => { }, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(1); @@ -385,7 +385,7 @@ describe("createReporter", () => { }, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(2); }); @@ -423,7 +423,7 @@ describe("createReporter", () => { }, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(1); @@ -451,7 +451,7 @@ describe("createReporter", () => { durationMs: 1234, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(2); }); @@ -488,7 +488,7 @@ describe("createReporter", () => { }, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(1); @@ -516,7 +516,7 @@ describe("createReporter", () => { durationMs: 1234, }, }, - false, + false ); expect(sendEvent).toBeCalledTimes(2); }); diff --git a/packages/create-cloudflare/src/__tests__/pre-existing.test.ts b/packages/create-cloudflare/src/__tests__/pre-existing.test.ts index 39becf6a4f8b..0d6b87acd40e 100644 --- a/packages/create-cloudflare/src/__tests__/pre-existing.test.ts +++ b/packages/create-cloudflare/src/__tests__/pre-existing.test.ts @@ -35,7 +35,7 @@ describe("configure function", () => { const configure = buildConfigure(params); await expect(configure(ctx)).rejects.toThrow( - "Failed to login to Cloudflare", + "Failed to login to Cloudflare" ); expect(params.chooseAccount).not.toHaveBeenCalled(); expect(params.copyFiles).not.toHaveBeenCalled(); diff --git a/packages/create-cloudflare/src/__tests__/templates.test.ts b/packages/create-cloudflare/src/__tests__/templates.test.ts index aeca9fae5405..a8ada75e5090 100644 --- a/packages/create-cloudflare/src/__tests__/templates.test.ts +++ b/packages/create-cloudflare/src/__tests__/templates.test.ts @@ -47,7 +47,7 @@ describe("addWranglerToGitIgnore", () => { isDirectory() { return path.endsWith(".git"); }, - }), + }) ); }); @@ -58,7 +58,7 @@ describe("addWranglerToGitIgnore", () => { "my-project/.gitignore", ` node_modules - .vscode`, + .vscode` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -94,7 +94,7 @@ describe("addWranglerToGitIgnore", () => { !.env.example .vscode .wrangler - `, + ` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -116,7 +116,7 @@ describe("addWranglerToGitIgnore", () => { .env* # even more !.env.example # and a final one .vscode - `, + ` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -133,7 +133,7 @@ describe("addWranglerToGitIgnore", () => { ` node_modules .dev.vars* - .vscode`, + .vscode` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -165,7 +165,7 @@ describe("addWranglerToGitIgnore", () => { node_modules .wrangler .dev.vars* - .vscode`, + .vscode` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -197,7 +197,7 @@ describe("addWranglerToGitIgnore", () => { !.dev.vars.example .env* !.env.example - .vscode`, + .vscode` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -229,7 +229,7 @@ describe("addWranglerToGitIgnore", () => { !.env.example .vscode - `, + ` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -314,7 +314,7 @@ describe("addWranglerToGitIgnore", () => { node_modules .dev.vars .vscode - `, + ` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -346,7 +346,7 @@ describe("addWranglerToGitIgnore", () => { .env .env.* !.env.example - `, + ` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -376,7 +376,7 @@ describe("addWranglerToGitIgnore", () => { node_modules .wrangler/ # This is for wrangler .vscode - `, + ` ); addWranglerToGitIgnore({ project: { path: "my-project" }, @@ -399,10 +399,10 @@ describe("addWranglerToGitIgnore", () => { function mockGitIgnore(path: string, content: string) { vi.mocked(existsSync).mockImplementation( - (filePath: PathLike) => filePath === path, + (filePath: PathLike) => filePath === path ); vi.mocked(readFile).mockImplementation((filePath: string) => - filePath === path ? content.replace(/\n\s*/g, "\n") : "", + filePath === path ? content.replace(/\n\s*/g, "\n") : "" ); } }); @@ -469,12 +469,12 @@ describe("downloadRemoteTemplate", () => { expect, }) => { await downloadRemoteTemplate( - "https://github.com/cloudflare/workers-graphql-server", + "https://github.com/cloudflare/workers-graphql-server" ); expect(degit).toHaveBeenCalledWith( "github:cloudflare/workers-graphql-server", - expect.anything(), + expect.anything() ); }); @@ -485,7 +485,7 @@ describe("downloadRemoteTemplate", () => { expect(degit).toHaveBeenCalledWith( "github:cloudflare/workers-sdk", - expect.anything(), + expect.anything() ); }); @@ -493,12 +493,12 @@ describe("downloadRemoteTemplate", () => { expect, }) => { await downloadRemoteTemplate( - "https://github.com/cloudflare/workers-sdk/templates/worker-r2", + "https://github.com/cloudflare/workers-sdk/templates/worker-r2" ); expect(degit).toHaveBeenCalledWith( "github:cloudflare/workers-sdk/templates/worker-r2", - expect.anything(), + expect.anything() ); }); @@ -506,12 +506,12 @@ describe("downloadRemoteTemplate", () => { expect, }) => { await downloadRemoteTemplate( - "https://github.com/cloudflare/workers-sdk/tree/main", + "https://github.com/cloudflare/workers-sdk/tree/main" ); expect(degit).toHaveBeenCalledWith( "github:cloudflare/workers-sdk#main", - expect.anything(), + expect.anything() ); }); @@ -519,12 +519,12 @@ describe("downloadRemoteTemplate", () => { expect, }) => { await downloadRemoteTemplate( - "https://github.com/cloudflare/workers-sdk/tree/main/templates", + "https://github.com/cloudflare/workers-sdk/tree/main/templates" ); expect(degit).toHaveBeenCalledWith( "github:cloudflare/workers-sdk/templates#main", - expect.anything(), + expect.anything() ); }); @@ -533,10 +533,10 @@ describe("downloadRemoteTemplate", () => { }) => { await expect( downloadRemoteTemplate( - "https://github.com/cloudflare/workers-sdk/tree/dev", - ), + "https://github.com/cloudflare/workers-sdk/tree/dev" + ) ).rejects.toThrow( - "Failed to clone remote template: https://github.com/cloudflare/workers-sdk/tree/dev\nUse the format \"github://sub/directory[#]\" to clone a specific branch other than 'main'", + "Failed to clone remote template: https://github.com/cloudflare/workers-sdk/tree/dev\nUse the format \"github://sub/directory[#]\" to clone a specific branch other than 'main'" ); }); }); @@ -572,15 +572,15 @@ describe("deriveCorrelatedArgs", () => { expect(() => deriveCorrelatedArgs({ lang: "ts", - }), + }) ).not.toThrow(); expect(() => deriveCorrelatedArgs({ ts: true, lang: "ts", - }), + }) ).toThrow( - "The `--ts` argument cannot be specified in conjunction with the `--lang` argument", + "The `--ts` argument cannot be specified in conjunction with the `--lang` argument" ); }); }); @@ -615,7 +615,7 @@ describe("updatePackageName", () => { expect(writeJSONMock).toHaveBeenCalledWith( expect.stringContaining("package.json"), - expect.objectContaining({ name: "my-project" }), + expect.objectContaining({ name: "my-project" }) ); }); @@ -646,12 +646,12 @@ version = "0.1.0"`; expect(writeJSONMock).toHaveBeenCalledWith( expect.stringContaining("package.json"), - expect.objectContaining({ name: "my-project" }), + expect.objectContaining({ name: "my-project" }) ); expect(writeFileMock).toHaveBeenCalledWith( expect.stringContaining("pyproject.toml"), - expect.stringContaining(`name = "my-project"`), + expect.stringContaining(`name = "my-project"`) ); }); }); @@ -671,7 +671,7 @@ describe("writeAgentsMd", () => { expect(writeFileMock).toHaveBeenCalledWith( join(projectPath, "AGENTS.md"), - getAgentsMd(), + getAgentsMd() ); }); diff --git a/packages/create-cloudflare/src/__tests__/validators.test.ts b/packages/create-cloudflare/src/__tests__/validators.test.ts index b3837df6d78f..309cf4866bc6 100644 --- a/packages/create-cloudflare/src/__tests__/validators.test.ts +++ b/packages/create-cloudflare/src/__tests__/validators.test.ts @@ -22,7 +22,7 @@ describe("validators", () => { expect(validateProjectDirectory("-foobar-", args)).not.toBeUndefined(); expect(validateProjectDirectory("fo*o{ba)r", args)).not.toBeUndefined(); expect( - validateProjectDirectory("f".repeat(59), args), + validateProjectDirectory("f".repeat(59), args) ).not.toBeUndefined(); }); diff --git a/packages/create-cloudflare/src/__tests__/workers.test.ts b/packages/create-cloudflare/src/__tests__/workers.test.ts index 75e2111699db..7be430c80f23 100644 --- a/packages/create-cloudflare/src/__tests__/workers.test.ts +++ b/packages/create-cloudflare/src/__tests__/workers.test.ts @@ -31,7 +31,7 @@ describe("updateTsConfig", () => { // Mock the read of tsconfig.json vi.mocked(readFile).mockImplementation( - () => `{ "compilerOptions": { "types": ["@cloudflare/workers-types"]} }`, + () => `{ "compilerOptions": { "types": ["@cloudflare/workers-types"]} }` ); }); @@ -43,7 +43,7 @@ describe("updateTsConfig", () => { expect(writeFile).toHaveBeenCalled(); expect(vi.mocked(writeFile).mock.calls[0][1]).toContain( - `"@cloudflare/workers-types/${mockCompatDate}"`, + `"@cloudflare/workers-types/${mockCompatDate}"` ); }); @@ -66,12 +66,12 @@ describe("updateTsConfig", () => { ctx.template.workersTypes = "installed"; vi.mocked(readFile).mockImplementation( () => - `{ "compilerOptions": { "types" : ["@cloudflare/workers-types/2021-03-20"]} }`, + `{ "compilerOptions": { "types" : ["@cloudflare/workers-types/2021-03-20"]} }` ); await updateTsConfig(ctx, { usesNodeCompat: false }); expect(vi.mocked(writeFile).mock.calls[0][1]).toContain( - `"@cloudflare/workers-types/2021-03-20"`, + `"@cloudflare/workers-types/2021-03-20"` ); }); @@ -87,7 +87,7 @@ describe("updateTsConfig", () => { }); await updateTsConfig(ctx, { usesNodeCompat: false }); expect(vi.mocked(writeFile).mock.calls[0][1]).not.toContain( - `"@cloudflare/workers-types/2021-03-20"`, + `"@cloudflare/workers-types/2021-03-20"` ); }); @@ -104,14 +104,14 @@ describe("updateTsConfig", () => { await updateTsConfig(ctx, { usesNodeCompat: false }); expect(vi.mocked(writeFile).mock.calls[0][1]).toContain( - `"@cloudflare/workers-types/2021-03-20"`, + `"@cloudflare/workers-types/2021-03-20"` ); }); test("will add generated types file", async ({ expect }) => { await updateTsConfig(ctx, { usesNodeCompat: false }); expect(vi.mocked(writeFile).mock.calls[0][1]).toContain( - `./worker-configuration.d.ts`, + `./worker-configuration.d.ts` ); }); @@ -125,7 +125,7 @@ describe("updateTsConfig", () => { { "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" } ] - }`, + }` ); await updateTsConfig(ctx, { usesNodeCompat: false }); expect(writeFile).not.toHaveBeenCalled(); @@ -139,7 +139,7 @@ describe("updateTsConfig", () => { () => `{ "compilerOptions": { "types": [] }, "references": [] - }`, + }` ); await updateTsConfig(ctx, { usesNodeCompat: false }); expect(writeFile).toHaveBeenCalled(); diff --git a/packages/create-cloudflare/src/cli.ts b/packages/create-cloudflare/src/cli.ts index 6e1c9db70819..ee4aad8ff286 100644 --- a/packages/create-cloudflare/src/cli.ts +++ b/packages/create-cloudflare/src/cli.ts @@ -166,7 +166,7 @@ const create = async (ctx: C3Context) => { const configure = async (ctx: C3Context) => { startSection( `Configuring your application for Cloudflare${ctx.args.experimental ? ` via \`wrangler setup\`` : ""}`, - "Step 2 of 3", + "Step 2 of 3" ); // This is kept even in the autoconfig case because autoconfig will ultimately end up installing Wrangler anyway diff --git a/packages/create-cloudflare/src/deploy.ts b/packages/create-cloudflare/src/deploy.ts index 7221dc2b0e17..302663afc18b 100644 --- a/packages/create-cloudflare/src/deploy.ts +++ b/packages/create-cloudflare/src/deploy.ts @@ -29,8 +29,8 @@ export const offerToDeploy = async (ctx: C3Context) => { ctx.args.deploy = false; updateStatus( `Bindings must be configured in ${blue( - "`wrangler.toml`", - )} before your application can be deployed`, + "`wrangler.toml`" + )} before your application can be deployed` ); } @@ -113,7 +113,7 @@ export const runDeploy = async (ctx: C3Context) => { const outputFile = join( await mkdtemp(join(tmpdir(), "c3-wrangler-deploy-")), - "output.json", + "output.json" ); await runCommand(deployCmd, { @@ -125,7 +125,7 @@ export const runDeploy = async (ctx: C3Context) => { }, startText: "Deploying your application", doneText: `${brandColor("deployed")} ${dim( - `via \`${quoteShellArgs(baseDeployCmd)}\``, + `via \`${quoteShellArgs(baseDeployCmd)}\`` )}`, }); diff --git a/packages/create-cloudflare/src/dialog.ts b/packages/create-cloudflare/src/dialog.ts index d1a9fd82b117..8fcc18ddb417 100644 --- a/packages/create-cloudflare/src/dialog.ts +++ b/packages/create-cloudflare/src/dialog.ts @@ -12,7 +12,7 @@ export function createDialog(lines: string[]) { const screenWidth = process.stdout.columns; const maxLineWidth = Math.max( ...lines.map((line) => stripAnsi(line).length), - 60, // Min inner width + 60 // Min inner width ); const dividerWidth = Math.min(maxLineWidth, screenWidth); @@ -27,7 +27,7 @@ export function createDialog(lines: string[]) { export function printWelcomeMessage( version: string, telemetryEnabled: boolean, - args: Partial, + args: Partial ) { const lines = [ `👋 Welcome to create-cloudflare v${version}!`, @@ -48,7 +48,7 @@ export function printWelcomeMessage( lines.push( `📊 Cloudflare collects telemetry about your usage of Create-Cloudflare.`, "", - `Learn more at: ${blue.underline(hyperlink(telemetryDocsUrl))}`, + `Learn more at: ${blue.underline(hyperlink(telemetryDocsUrl))}` ); } @@ -87,7 +87,7 @@ export const printSummary = (ctx: C3Context) => { `🔍 View Project`, `${gray("Visit:")} ${blue.underline(hyperlink(ctx.deployment.url))}`, `${gray("Dash:")} ${blue.underline(hyperlink(dashboardUrl))}`, - ``, + `` ); } @@ -103,7 +103,7 @@ export const printSummary = (ctx: C3Context) => { `${blue.underline(hyperlink(reportIssueUrl))}`, ``, `💬 Join our Community`, - `${blue.underline(hyperlink(discordUrl))}`, + `${blue.underline(hyperlink(discordUrl))}` ); const dialog = createDialog(lines); diff --git a/packages/create-cloudflare/src/frameworks/__tests__/index.test.ts b/packages/create-cloudflare/src/frameworks/__tests__/index.test.ts index 2cd27f59bc81..a53893cdfd0f 100644 --- a/packages/create-cloudflare/src/frameworks/__tests__/index.test.ts +++ b/packages/create-cloudflare/src/frameworks/__tests__/index.test.ts @@ -47,7 +47,7 @@ describe("frameworks", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledWith( [pmCmd, cli, "-p", "my-project", "--template", "potato"], - { env }, + { env } ); }); }); diff --git a/packages/create-cloudflare/src/frameworks/index.ts b/packages/create-cloudflare/src/frameworks/index.ts index 3df098c5b0cb..943681aadf82 100644 --- a/packages/create-cloudflare/src/frameworks/index.ts +++ b/packages/create-cloudflare/src/frameworks/index.ts @@ -43,8 +43,8 @@ export const runFrameworkGenerator = async (ctx: C3Context, args: string[]) => { updateStatus( `Continue with ${ctx.template.displayName} ${dim( - `via \`${quoteShellArgs(cmd)}\``, - )}`, + `via \`${quoteShellArgs(cmd)}\`` + )}` ); // newline diff --git a/packages/create-cloudflare/src/frameworks/package.json b/packages/create-cloudflare/src/frameworks/package.json index 79fabb104e31..a78e2c5334fd 100644 --- a/packages/create-cloudflare/src/frameworks/package.json +++ b/packages/create-cloudflare/src/frameworks/package.json @@ -1,27 +1,27 @@ { "name": "frameworks_clis_info", - "info": [ - "This package.json is only used to keep track of the frameworks cli dependencies", - "so that we can use dependabot to update these dependencies automatically." - ], "dependencies": { - "create-astro": "5.0.0", - "create-analog": "2.3.1", "@angular/create": "21.2.2", + "@tanstack/create-start": "0.59.8", + "create-analog": "2.3.1", + "create-astro": "5.0.0", "create-docusaurus": "3.9.2", "create-hono": "0.19.4", "create-next-app": "16.1.6", "create-qwik": "1.19.2", - "create-vite": "8.3.0", - "create-rwsdk": "3.1.3", "create-react-router": "7.13.1", + "create-rwsdk": "3.1.3", "create-solid": "0.6.13", "create-vike": "0.0.592", + "create-vite": "8.3.0", "create-vue": "3.22.0", "create-waku": "0.12.5-1.0.0-alpha.5-0", - "@tanstack/create-start": "0.59.8", "gatsby": "5.16.1", - "sv": "0.12.4", - "nuxi": "3.34.0" - } + "nuxi": "3.34.0", + "sv": "0.12.4" + }, + "info": [ + "This package.json is only used to keep track of the frameworks cli dependencies", + "so that we can use dependabot to update these dependencies automatically." + ] } diff --git a/packages/create-cloudflare/src/git.ts b/packages/create-cloudflare/src/git.ts index 8913225d378d..5a60aaafd4a2 100644 --- a/packages/create-cloudflare/src/git.ts +++ b/packages/create-cloudflare/src/git.ts @@ -17,7 +17,7 @@ export const offerGit = async (ctx: C3Context) => { // haven't prompted yet, if provided as --git arg if (ctx.args.git) { updateStatus( - "Couldn't find `git` installed on your machine. Continuing without git.", + "Couldn't find `git` installed on your machine. Continuing without git." ); } @@ -43,7 +43,7 @@ export const offerGit = async (ctx: C3Context) => { const gitConfigured = await isGitConfigured(); if (!gitConfigured) { updateStatus( - "Must configure `user.name` and user.email` to use git. Continuing without git.", + "Must configure `user.name` and user.email` to use git. Continuing without git." ); // override ctx.args.git to false (don't use git) @@ -61,7 +61,7 @@ export const gitCommit = async (ctx: C3Context) => { assert.notStrictEqual( ctx.args.git, undefined, - "Expected git context to be defined by now", + "Expected git context to be defined by now" ); // Note: createCommitMessage stores the message in ctx so that it can // be used later even if we're not in a git repository, that's why @@ -92,14 +92,14 @@ export const gitCommit = async (ctx: C3Context) => { { silent: true, cwd: ctx.project.path, - }, + } ); s.stop(`${brandColor("git")} ${dim(`commit`)}`); } catch { s.stop(`${brandColor("git")} ${dim(`commit failed`)}`); updateStatus( - "Failed to create initial commit. You can commit manually later.", + "Failed to create initial commit. You can commit manually later." ); } }; @@ -226,13 +226,13 @@ export async function initializeGit(cwd: string) { // Get the default init branch name const defaultBranchName = await runCommand( ["git", "config", "--get", "init.defaultBranch"], - { useSpinner: false, silent: true, cwd }, + { useSpinner: false, silent: true, cwd } ); // Try to create the repository with the HEAD branch of defaultBranchName ?? `main`. await runCommand( ["git", "init", "--initial-branch", defaultBranchName.trim() ?? "main"], // branch names can't contain spaces, so this is safe - { useSpinner: false, silent: true, cwd }, + { useSpinner: false, silent: true, cwd } ); } catch { // Unable to create the repo with a HEAD branch name, so just fall back to the default. @@ -251,7 +251,7 @@ export async function getProductionBranch(cwd: string) { cwd, useSpinner: false, captureOutput: true, - }, + } ); return productionBranch.trim(); diff --git a/packages/create-cloudflare/src/help.ts b/packages/create-cloudflare/src/help.ts index 6332ab51857d..4b8990bdba00 100644 --- a/packages/create-cloudflare/src/help.ts +++ b/packages/create-cloudflare/src/help.ts @@ -17,7 +17,7 @@ const PADDING_RIGHT = 5; export const showHelp = ( args: Partial | null, - { positionals, options, intro }: ArgumentsDefinition, + { positionals, options, intro }: ArgumentsDefinition ) => { const { name: pm } = detectPackageManager(); @@ -34,8 +34,8 @@ export const showHelp = ( if (args?.experimental) { logRaw( blue( - "You have selected experimental mode - the options below are filtered to those that support experimental mode.\n", - ), + "You have selected experimental mode - the options below are filtered to those that support experimental mode.\n" + ) ); } @@ -71,7 +71,7 @@ const renderPositionals = (positionals?: ArgDefinition[]) => { const renderOptions = ( args: Partial | null, - options?: OptionDefinition[], + options?: OptionDefinition[] ) => { if (!options) { return; diff --git a/packages/create-cloudflare/src/helpers/__tests__/args.test.ts b/packages/create-cloudflare/src/helpers/__tests__/args.test.ts index 07afe9d0954c..2ffe913b2eae 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/args.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/args.test.ts @@ -30,7 +30,7 @@ describe("Cli", () => { expect(result.showHelpMessage).toBe(true); expect(result.args).not.toBe(null); expect(result.errorMessage).toBe( - "Too many positional arguments provided", + "Too many positional arguments provided" ); }); @@ -126,13 +126,13 @@ describe("Cli", () => { test.for(stringArgs)("%s requires an argument", async (arg, { expect }) => { const logSpy = vi.spyOn(console, "error").mockImplementation(() => {}); await expect( - parseArgs(["my-react-project", `--${arg}`]), + parseArgs(["my-react-project", `--${arg}`]) ).resolves.toEqual({ type: "unknown", args: null, }); expect(logSpy).toHaveBeenCalledWith( - expect.stringContaining(`Not enough arguments following: ${arg}`), + expect.stringContaining(`Not enough arguments following: ${arg}`) ); }); diff --git a/packages/create-cloudflare/src/helpers/__tests__/cli.test.ts b/packages/create-cloudflare/src/helpers/__tests__/cli.test.ts index 7b5d5076267b..6703d4a06e66 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/cli.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/cli.test.ts @@ -74,7 +74,7 @@ describe("isUpdateAvailable", () => { }, { headers: { "content-type": "application/json" }, - }, + } ); } }); diff --git a/packages/create-cloudflare/src/helpers/__tests__/codemod.test.ts b/packages/create-cloudflare/src/helpers/__tests__/codemod.test.ts index 0e21f97c9b62..f8b1705ba950 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/codemod.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/codemod.test.ts @@ -95,8 +95,8 @@ describe("mergeObjectProperties", () => { tests.forEach(({ testName, ...testObjects }) => test(testName, ({ expect }) => - testMergeObjectProperties(testObjects, expect), - ), + testMergeObjectProperties(testObjects, expect) + ) ); }); @@ -110,7 +110,7 @@ const testMergeObjectProperties = ( newPropertiesObject: Record; expectedPropertiesObject: Record; }, - expect: ExpectStatic, + expect: ExpectStatic ) => { const sourceObj = createObjectExpression(sourcePropertiesObject); const newProperties = createObjectExpression(newPropertiesObject) @@ -120,12 +120,12 @@ const testMergeObjectProperties = ( mergeObjectProperties(sourceObj, newProperties); expect(recast.prettyPrint(sourceObj, { parser }).code).toEqual( - recast.prettyPrint(expectedObj, { parser }).code, + recast.prettyPrint(expectedObj, { parser }).code ); }; const createObjectExpression = ( - sourceObj: Record, + sourceObj: Record ): recast.types.namedTypes.ObjectExpression => { return ( ( @@ -133,7 +133,7 @@ const createObjectExpression = ( `const obj = {${Object.entries(sourceObj) .map(([key, value]) => `${key}: ${JSON.stringify(value)}`) .join(",\n")}}`, - { parser }, + { parser } ).program.body[0] as recast.types.namedTypes.VariableDeclaration ).declarations[0] as recast.types.namedTypes.VariableDeclarator ).init as recast.types.namedTypes.ObjectExpression; diff --git a/packages/create-cloudflare/src/helpers/__tests__/command.test.ts b/packages/create-cloudflare/src/helpers/__tests__/command.test.ts index 52f7c5337a5e..18b9ef7091e4 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/command.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/command.test.ts @@ -78,7 +78,7 @@ describe("Command Helpers", () => { ["wrangler"], expect.objectContaining({ env: expect.objectContaining({ WRANGLER_SEND_METRICS: "false" }), - }), + }) ); }); @@ -98,7 +98,7 @@ describe("Command Helpers", () => { ["wrangler"], expect.objectContaining({ env: expect.not.objectContaining({ WRANGLER_SEND_METRICS: "false" }), - }), + }) ); }); @@ -118,7 +118,7 @@ describe("Command Helpers", () => { ["-l"], expect.objectContaining({ env: expect.not.objectContaining({ WRANGLER_SEND_METRICS: "false" }), - }), + }) ); }); }); @@ -128,7 +128,7 @@ describe("Command Helpers", () => { expect(quoteShellArgs([`pages:dev`])).toEqual("pages:dev"); expect(quoteShellArgs([`24.02 foo-bar`])).toEqual(`'24.02 foo-bar'`); expect(quoteShellArgs([`foo/10 bar/20-baz/`])).toEqual( - `'foo/10 bar/20-baz/'`, + `'foo/10 bar/20-baz/'` ); }); @@ -136,7 +136,7 @@ describe("Command Helpers", () => { expect(quoteShellArgs([`pages:dev`])).toEqual("pages:dev"); expect(quoteShellArgs([`24.02 foo-bar`])).toEqual(`"24.02 foo-bar"`); expect(quoteShellArgs([`foo/10 bar/20-baz/`])).toEqual( - `"foo/10 bar/20-baz/"`, + `"foo/10 bar/20-baz/"` ); }); }); diff --git a/packages/create-cloudflare/src/helpers/__tests__/compatDate.test.ts b/packages/create-cloudflare/src/helpers/__tests__/compatDate.test.ts index ee20e6e8b9a2..a3bb9d5c35bc 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/compatDate.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/compatDate.test.ts @@ -36,7 +36,7 @@ describe("Compatibility Date Helpers", () => { expect(date).toBe(expectedDate); expect(spinner.start).toHaveBeenCalled(); expect(spinner.stop).toHaveBeenCalledWith( - expect.stringContaining(expectedDate), + expect.stringContaining(expectedDate) ); }); @@ -52,7 +52,7 @@ describe("Compatibility Date Helpers", () => { expect(date).toBe(fallbackDate); expect(spinner.start).toHaveBeenCalled(); expect(spinner.stop).toHaveBeenCalledWith( - expect.stringContaining(fallbackDate), + expect.stringContaining(fallbackDate) ); }); }); diff --git a/packages/create-cloudflare/src/helpers/__tests__/json.test.ts b/packages/create-cloudflare/src/helpers/__tests__/json.test.ts index e1df30170f39..f6d6d8fea8cf 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/json.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/json.test.ts @@ -24,7 +24,7 @@ describe("json helpers", () => { describe("readJSONWithComments", () => { test("reads and parses JSON file with comments", ({ expect }) => { mockReadFile.mockReturnValue( - '{\n/* a comment */\n "name": "test"\n}\n// post-comment', + '{\n/* a comment */\n "name": "test"\n}\n// post-comment' ); const result = readJSONWithComments("/path/to/file.json"); expect(mockReadFile).toHaveBeenCalledWith("/path/to/file.json"); @@ -41,12 +41,12 @@ describe("json helpers", () => { value: "", list: [[""], ""], }, - }), + }) ); const result = readJSONWithComments( "/path/to/file.json", - (_key, value) => (value === "" ? "REPLACED" : value), + (_key, value) => (value === "" ? "REPLACED" : value) ); expect(mockReadFile).toHaveBeenCalledWith("/path/to/file.json"); expect(result).toEqual({ @@ -64,12 +64,12 @@ describe("json helpers", () => { describe("writeJSONWithComments", () => { test("stringifies and writes JSON object with comments", ({ expect }) => { mockReadFile.mockReturnValue( - '{\n\t/* a comment */\n\t"name": "test"\n}\n// post-comment', + '{\n\t/* a comment */\n\t"name": "test"\n}\n// post-comment' ); const result = readJSONWithComments("/path/to/file.json"); writeJSONWithComments("/path/to/file.json", result); expect(mockWriteFile.mock.calls[0][0]).toMatchInlineSnapshot( - `"/path/to/file.json"`, + `"/path/to/file.json"` ); expect(mockWriteFile.mock.calls[0][1]).toMatchInlineSnapshot(` "{ @@ -89,7 +89,7 @@ describe("json helpers", () => { writeJSONWithComments("/path/to/file.json", jsonObject); expect(mockWriteFile.mock.calls[0][0]).toMatchInlineSnapshot( - `"/path/to/file.json"`, + `"/path/to/file.json"` ); expect(mockWriteFile.mock.calls[0][1]).toMatchInlineSnapshot(` "{ @@ -109,7 +109,7 @@ describe("json helpers", () => { writeJSONWithComments("/path/to/file.json", jsonObject); expect(mockWriteFile.mock.calls[0][0]).toMatchInlineSnapshot( - `"/path/to/file.json"`, + `"/path/to/file.json"` ); expect(mockWriteFile.mock.calls[0][1]).toMatchInlineSnapshot(` "{ @@ -128,7 +128,7 @@ describe("json helpers", () => { writeJSONWithComments("/path/to/file.json", jsonObject); expect(mockWriteFile.mock.calls[0][0]).toMatchInlineSnapshot( - `"/path/to/file.json"`, + `"/path/to/file.json"` ); expect(mockWriteFile.mock.calls[0][1]).toMatchInlineSnapshot(` "{ @@ -145,14 +145,14 @@ describe("json helpers", () => { expect, }) => { mockReadFile.mockReturnValue( - '{\n/* a comment */\n "existing": "value"\n}\n// post-comment', + '{\n/* a comment */\n "existing": "value"\n}\n// post-comment' ); let jsonObject = readJSONWithComments("/path/to/file.json"); jsonObject = appendJSONProperty(jsonObject, "newProp", "newValue"); expect(jsonObject).toEqual({ existing: "value", newProp: "newValue" }); writeJSONWithComments("/path/to/file.json", jsonObject); expect(mockWriteFile.mock.calls[0][0]).toMatchInlineSnapshot( - `"/path/to/file.json"`, + `"/path/to/file.json"` ); expect(mockWriteFile.mock.calls[0][1]).toMatchInlineSnapshot(` "{ @@ -170,14 +170,14 @@ describe("json helpers", () => { expect, }) => { mockReadFile.mockReturnValue( - '{\n/* a comment */\n "existing": "value"\n}\n// post-comment', + '{\n/* a comment */\n "existing": "value"\n}\n// post-comment' ); let jsonObject = readJSONWithComments("/path/to/file.json"); jsonObject = insertJSONProperty(jsonObject, "newProp", "newValue"); expect(jsonObject).toEqual({ existing: "value", newProp: "newValue" }); writeJSONWithComments("/path/to/file.json", jsonObject); expect(mockWriteFile.mock.calls[0][0]).toMatchInlineSnapshot( - `"/path/to/file.json"`, + `"/path/to/file.json"` ); expect(mockWriteFile.mock.calls[0][1]).toMatchInlineSnapshot(` "{ diff --git a/packages/create-cloudflare/src/helpers/__tests__/mocks.ts b/packages/create-cloudflare/src/helpers/__tests__/mocks.ts index cf809701d4a7..ee0a47585959 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/mocks.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/mocks.ts @@ -8,18 +8,18 @@ import type { Dirent } from "node:fs"; export const mockPackageManager = (name: string, version = "1.0.0") => { if (!vi.isMockFunction(whichPMRuns)) { expect.fail( - "When using `mockPackageManager` you must first call: vi.mock('which-pm-runs');", + "When using `mockPackageManager` you must first call: vi.mock('which-pm-runs');" ); } vi.mocked(whichPMRuns).mockReturnValue({ name, version }); }; export const mockWorkersTypesDirectory = ( - mockImpl: () => string[] = () => [...mockWorkersTypesDirListing], + mockImpl: () => string[] = () => [...mockWorkersTypesDirListing] ) => { if (!vi.isMockFunction(readdirSync)) { expect.fail( - "When using `mockWorkersTypesDirectory` you must first call: vi.mock('fs');", + "When using `mockWorkersTypesDirectory` you must first call: vi.mock('fs');" ); } vi.mocked(readdirSync).mockImplementation((path) => { @@ -34,7 +34,7 @@ export const mockWorkersTypesDirectory = ( export const mockSpinner = () => { if (!vi.isMockFunction(spinner)) { expect.fail( - "When using `mockPackageManager` you must first call: vi.mock('@cloudflare/cli/interactive');", + "When using `mockPackageManager` you must first call: vi.mock('@cloudflare/cli/interactive');" ); } diff --git a/packages/create-cloudflare/src/helpers/__tests__/packageManagers.test.ts b/packages/create-cloudflare/src/helpers/__tests__/packageManagers.test.ts index d26e149b8ccf..13413253b744 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/packageManagers.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/packageManagers.test.ts @@ -89,10 +89,10 @@ describe("Package Managers", () => { ["bun.lockb", true], ] as const)("with %s", ([file, isMismatch], { expect }) => { vi.mocked(existsSync).mockImplementationOnce( - (path) => !!(path as string).includes(file), + (path) => !!(path as string).includes(file) ); expect(detectPmMismatch({ project: { path: "" } } as C3Context)).toBe( - isMismatch, + isMismatch ); }); }); @@ -109,10 +109,10 @@ describe("Package Managers", () => { ["bun.lockb", true], ] as const)("with %s", ([file, isMismatch], { expect }) => { vi.mocked(existsSync).mockImplementationOnce( - (path) => !!(path as string).includes(file), + (path) => !!(path as string).includes(file) ); expect(detectPmMismatch({ project: { path: "" } } as C3Context)).toBe( - isMismatch, + isMismatch ); }); }); @@ -129,10 +129,10 @@ describe("Package Managers", () => { ["bun.lockb", false], ] as const)("with %s", ([file, isMismatch], { expect }) => { vi.mocked(existsSync).mockImplementationOnce( - (path) => !!(path as string).includes(file), + (path) => !!(path as string).includes(file) ); expect(detectPmMismatch({ project: { path: "" } } as C3Context)).toBe( - isMismatch, + isMismatch ); }); }); diff --git a/packages/create-cloudflare/src/helpers/__tests__/packages.test.ts b/packages/create-cloudflare/src/helpers/__tests__/packages.test.ts index 17f48e0c711b..e6963d42843a 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/packages.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/packages.test.ts @@ -35,7 +35,7 @@ describe("Package Helpers", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["npm", "install"], - expect.anything(), + expect.anything() ); }); @@ -45,7 +45,7 @@ describe("Package Helpers", () => { await npmInstall(createTestContext()); expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["pnpm", "install"], - expect.anything(), + expect.anything() ); }); }); @@ -80,13 +80,13 @@ describe("Package Helpers", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledWith( [...initialArgs, ...packages, ...(additionalArgs ?? [])], - expect.anything(), + expect.anything() ); if (pm === "npm") { // Check that package.json was updated for npm expect(mockReadJSON).toHaveBeenCalledWith( - resolve(process.cwd(), "package.json"), + resolve(process.cwd(), "package.json") ); expect(mockWriteJSON).toHaveBeenCalledWith( resolve(process.cwd(), "package.json"), @@ -96,10 +96,10 @@ describe("Package Helpers", () => { bar: "^2.0.0", baz: "1.2.3", }, - }), + }) ); } - }, + } ); const devCases: TestCase[] = [ @@ -125,13 +125,13 @@ describe("Package Helpers", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledWith( [...initialArgs, ...packages, ...(additionalArgs ?? [])], - expect.anything(), + expect.anything() ); if (pm === "npm") { // Check that package.json was updated for npm expect(mockReadJSON).toHaveBeenCalledWith( - resolve(process.cwd(), "package.json"), + resolve(process.cwd(), "package.json") ); expect(mockWriteJSON).toHaveBeenCalledWith( resolve(process.cwd(), "package.json"), @@ -141,10 +141,10 @@ describe("Package Helpers", () => { bar: "^2.0.0", baz: "1.2.3", }, - }), + }) ); } - }, + } ); }); @@ -158,7 +158,7 @@ describe("Package Helpers", () => { expect(vi.mocked(runCommand)).toHaveBeenCalledWith( ["npm", "install", "--save-dev", "wrangler@latest"], - expect.anything(), + expect.anything() ); }); }); diff --git a/packages/create-cloudflare/src/helpers/__tests__/retry.test.ts b/packages/create-cloudflare/src/helpers/__tests__/retry.test.ts index ac36aa92b7c7..e9f988dc0e1c 100644 --- a/packages/create-cloudflare/src/helpers/__tests__/retry.test.ts +++ b/packages/create-cloudflare/src/helpers/__tests__/retry.test.ts @@ -63,7 +63,7 @@ describe("retry", () => { throw Error("error"); } throw Error("special condition"); - }, + } ); }).rejects.toThrowError("special condition"); }); diff --git a/packages/create-cloudflare/src/helpers/args.ts b/packages/create-cloudflare/src/helpers/args.ts index 8a48feb1bfb3..d56b02b214f2 100644 --- a/packages/create-cloudflare/src/helpers/args.ts +++ b/packages/create-cloudflare/src/helpers/args.ts @@ -120,7 +120,7 @@ export const cliDefinition: ArgumentsDefinition = { getNamesAndDescriptions( getFrameworkMap({ experimental: Boolean(args?.["experimental"]), - }), + }) ), }, { @@ -264,7 +264,7 @@ export const cliDefinition: ArgumentsDefinition = { }; export const parseArgs = async ( - argv: string[], + argv: string[] ): Promise< | { type: "default"; @@ -284,7 +284,7 @@ export const parseArgs = async ( const doubleDashesIdx = argv.indexOf("--"); const c3Args = argv.slice( 0, - doubleDashesIdx < 0 ? undefined : doubleDashesIdx, + doubleDashesIdx < 0 ? undefined : doubleDashesIdx ); const additionalArgs = doubleDashesIdx < 0 ? [] : argv.slice(doubleDashesIdx + 1); @@ -417,7 +417,7 @@ const camelize = (str: string) => str.replace(/-./g, (x) => x[1].toUpperCase()); export const processArgument = async ( args: Partial, key: Key, - promptConfig: PromptConfig, + promptConfig: PromptConfig ) => { return await reporter.collectAsyncMetrics({ eventPrefix: "c3 prompt", diff --git a/packages/create-cloudflare/src/helpers/codemod.ts b/packages/create-cloudflare/src/helpers/codemod.ts index 1b395ebd996b..b6d9c65b5d69 100644 --- a/packages/create-cloudflare/src/helpers/codemod.ts +++ b/packages/create-cloudflare/src/helpers/codemod.ts @@ -69,7 +69,7 @@ export const parseFile = (filePath: string) => { // Transform a file with the provided transformer methods and write it back to disk export const transformFile = ( filePath: string, - methods: recast.types.Visitor, + methods: recast.types.Visitor ) => { const ast = parseFile(filePath); @@ -118,7 +118,7 @@ export const loadTemplateSnippets = (ctx: C3Context) => { */ export const mergeObjectProperties = ( sourceObject: recast.types.namedTypes.ObjectExpression, - newProperties: recast.types.namedTypes.ObjectProperty[], + newProperties: recast.types.namedTypes.ObjectProperty[] ): void => { newProperties.forEach((newProp) => { const newPropName = getPropertyName(newProp); @@ -126,7 +126,7 @@ export const mergeObjectProperties = ( return false; } const indexOfExisting = sourceObject.properties.findIndex( - (p) => p.type === "ObjectProperty" && getPropertyName(p) === newPropName, + (p) => p.type === "ObjectProperty" && getPropertyName(p) === newPropName ); const existing = sourceObject.properties[indexOfExisting]; @@ -142,7 +142,7 @@ export const mergeObjectProperties = ( ) { mergeObjectProperties( existing.value, - newProp.value.properties as recast.types.namedTypes.ObjectProperty[], + newProp.value.properties as recast.types.namedTypes.ObjectProperty[] ); return; } diff --git a/packages/create-cloudflare/src/helpers/command.ts b/packages/create-cloudflare/src/helpers/command.ts index ebe96d3a2dc3..27ab2f2b7772 100644 --- a/packages/create-cloudflare/src/helpers/command.ts +++ b/packages/create-cloudflare/src/helpers/command.ts @@ -45,7 +45,7 @@ type PrintOptions = { */ export const runCommand = async ( command: Command, - opts: RunOptions = {}, + opts: RunOptions = {} ): Promise => { return printAsyncStatus({ useSpinner: opts.useSpinner ?? opts.silent, @@ -181,7 +181,7 @@ export function quoteShellArgs(args: string[]): string { const specialCharsMatcher = /[&<>[\]|{}^=;!'+,`~\s]/; return args .map((arg) => - arg.match(specialCharsMatcher) ? `"${arg.replaceAll(`"`, `""`)}"` : arg, + arg.match(specialCharsMatcher) ? `"${arg.replaceAll(`"`, `""`)}"` : arg ) .join(" "); } else { diff --git a/packages/create-cloudflare/src/helpers/compatDate.ts b/packages/create-cloudflare/src/helpers/compatDate.ts index fcba9dff2b64..6ccff0bd26ad 100644 --- a/packages/create-cloudflare/src/helpers/compatDate.ts +++ b/packages/create-cloudflare/src/helpers/compatDate.ts @@ -19,8 +19,8 @@ export function getWorkerdCompatibilityDate(projectPath: string) { if (source === "fallback") { s.stop( `${brandColor("compatibility date")} ${dim( - ` Could not find workerd date, falling back to ${date}`, - )}`, + ` Could not find workerd date, falling back to ${date}` + )}` ); } else { s.stop(`${brandColor("compatibility date")} ${dim(date)}`); @@ -43,7 +43,7 @@ export function getLatestTypesEntrypoint(ctx: C3Context) { ctx.project.path, "node_modules", "@cloudflare", - "workers-types", + "workers-types" ); try { diff --git a/packages/create-cloudflare/src/helpers/files.ts b/packages/create-cloudflare/src/helpers/files.ts index df03b9ff0d4b..3a3c34d02c5a 100644 --- a/packages/create-cloudflare/src/helpers/files.ts +++ b/packages/create-cloudflare/src/helpers/files.ts @@ -66,7 +66,7 @@ export const readToml = (path: string) => { export const writeJSON = ( path: string, object: unknown, - stringifySpace = "\t", + stringifySpace = "\t" ) => { writeFile(path, stringify(object, null, stringifySpace)); }; diff --git a/packages/create-cloudflare/src/helpers/json.ts b/packages/create-cloudflare/src/helpers/json.ts index 77c0d2c61e53..81ac06395b93 100644 --- a/packages/create-cloudflare/src/helpers/json.ts +++ b/packages/create-cloudflare/src/helpers/json.ts @@ -16,7 +16,7 @@ import type { */ export function readJSONWithComments( jsonFilePath: string, - reviver?: Reviver, + reviver?: Reviver ): CommentObject { const jsonString = readFile(jsonFilePath); const jsonObject = parse(jsonString, reviver) as unknown as CommentObject; @@ -30,7 +30,7 @@ export function readJSONWithComments( */ export function writeJSONWithComments( jsonFilePath: string, - jsonObject: CommentObject, + jsonObject: CommentObject ): void { const jsonStr = stringify(jsonObject, null, "\t"); writeFile(jsonFilePath, jsonStr); @@ -45,7 +45,7 @@ export function writeJSONWithComments( export function addJSONComment( jsonObject: Partial, descriptor: CommentDescriptor, - comment: string | Partial | (string | Partial)[], + comment: string | Partial | (string | Partial)[] ): void { if (!Array.isArray(comment)) { comment = [comment]; @@ -80,7 +80,7 @@ export function addJSONComment( export function appendJSONProperty( jsonObject: T, property: string, - value: unknown, + value: unknown ) { return assign(jsonObject, { [property]: value }); } @@ -95,7 +95,7 @@ export function appendJSONProperty( export function insertJSONProperty( jsonObject: T, property: string, - value: unknown, + value: unknown ) { return assign({ [property]: value }, jsonObject) as CommentObject; } diff --git a/packages/create-cloudflare/src/helpers/metrics-config.ts b/packages/create-cloudflare/src/helpers/metrics-config.ts index 5564a0321927..494c6cea2227 100644 --- a/packages/create-cloudflare/src/helpers/metrics-config.ts +++ b/packages/create-cloudflare/src/helpers/metrics-config.ts @@ -20,8 +20,8 @@ export function writeMetricsConfig(config: MetricsConfigFile) { JSON.stringify( config, (_key, value) => (value instanceof Date ? value.toISOString() : value), - "\t", - ), + "\t" + ) ); } @@ -32,7 +32,7 @@ export function readMetricsConfig(): MetricsConfigFile { try { const config = readFileSync(getMetricsConfigPath(), "utf8"); return JSON.parse(config, (key, value) => - key === "date" ? new Date(value) : value, + key === "date" ? new Date(value) : value ); } catch { return {}; diff --git a/packages/create-cloudflare/src/helpers/packages.ts b/packages/create-cloudflare/src/helpers/packages.ts index 87f5ad8e2abb..c39b5901418b 100644 --- a/packages/create-cloudflare/src/helpers/packages.ts +++ b/packages/create-cloudflare/src/helpers/packages.ts @@ -24,7 +24,7 @@ type InstallConfig = { */ export const installPackages = async ( packages: string[], - config: InstallConfig = {}, + config: InstallConfig = {} ) => { if (packages.length === 0) { return; @@ -121,10 +121,10 @@ export const installWrangler = async () => { await installPackages([`wrangler@latest`], { dev: true, startText: `Installing wrangler ${dim( - "A command line tool for building Cloudflare Workers", + "A command line tool for building Cloudflare Workers" )}`, doneText: `${brandColor("installed")} ${dim( - `via \`${npm} install wrangler --save-dev\``, + `via \`${npm} install wrangler --save-dev\`` )}`, }); }; diff --git a/packages/create-cloudflare/src/helpers/poll.ts b/packages/create-cloudflare/src/helpers/poll.ts index aa9ee1f5a07e..4ab6506bac73 100644 --- a/packages/create-cloudflare/src/helpers/poll.ts +++ b/packages/create-cloudflare/src/helpers/poll.ts @@ -35,8 +35,8 @@ export const poll = async (url: string): Promise => { s.stop( `${brandColor( - "timed out", - )} while waiting for ${url} - try accessing it in a few minutes.`, + "timed out" + )} while waiting for ${url} - try accessing it in a few minutes.` ); return false; }; @@ -44,11 +44,11 @@ export const poll = async (url: string): Promise => { const pollDns = async ( domain: string, start: number, - s: ReturnType, + s: ReturnType ) => { while (Date.now() - start < TIMEOUT_MS) { s.update( - `Waiting for DNS to propagate. This might take a few minutes. (${secondsSince(start)}s)`, + `Waiting for DNS to propagate. This might take a few minutes. (${secondsSince(start)}s)` ); if (await isDomainResolvable(domain)) { s.stop(`${brandColor("DNS propagation")} ${dim("complete")}.`); @@ -61,12 +61,12 @@ const pollDns = async ( const pollHttp = async ( url: string, start: number, - s: ReturnType, + s: ReturnType ) => { s.start("Waiting for deployment to become available"); while (Date.now() - start < TIMEOUT_MS) { s.update( - `Waiting for deployment to become available (${secondsSince(start)}s)`, + `Waiting for deployment to become available (${secondsSince(start)}s)` ); try { const { statusCode } = await request(url, { @@ -75,7 +75,7 @@ const pollHttp = async ( }); if (statusCode === 200) { s.stop( - `${brandColor("deployment")} ${dim("is ready at:")} ${blue(url)}`, + `${brandColor("deployment")} ${dim("is ready at:")} ${blue(url)}` ); return true; } diff --git a/packages/create-cloudflare/src/metrics.ts b/packages/create-cloudflare/src/metrics.ts index 735c6edac265..c05a246f03b7 100644 --- a/packages/create-cloudflare/src/metrics.ts +++ b/packages/create-cloudflare/src/metrics.ts @@ -79,7 +79,7 @@ export function createReporter() { function sendEvent( name: EventName, - properties: EventProperties, + properties: EventProperties ): void { if (!isEnabled) { return; @@ -100,7 +100,7 @@ export function createReporter() { ...properties, }, }, - enableLog, + enableLog ); // TODO(consider): retry failed requests @@ -210,7 +210,7 @@ export function createReporter() { tracker?.setEventProperty(key, value); }, }, - options.promise, + options.promise ), ]); @@ -235,14 +235,14 @@ export function createReporter() { // To be used within `collectAsyncMetrics` to update the properties object sent to sparrow function setEventProperty>( key: Key, - value: unknown, + value: unknown ) { const store = als.getStore(); // Throw only on test environment to avoid breaking the CLI if (!store && process.env.VITEST) { throw new Error( - "`setEventProperty` must be called within `collectAsyncMetrics`", + "`setEventProperty` must be called within `collectAsyncMetrics`" ); } @@ -298,14 +298,14 @@ function logTelemetryStatus(enabled: boolean) { } export const runTelemetryCommand = ( - action: "status" | "enable" | "disable", + action: "status" | "enable" | "disable" ) => { switch (action) { case "enable": { updateC3Permission(true); logTelemetryStatus(true); logRaw( - "Create-Cloudflare is now collecting telemetry about your usage. Thank you for helping us improve the experience!", + "Create-Cloudflare is now collecting telemetry about your usage. Thank you for helping us improve the experience!" ); break; } diff --git a/packages/create-cloudflare/src/pages.ts b/packages/create-cloudflare/src/pages.ts index 4285c0672d7a..93f465a4a1ee 100644 --- a/packages/create-cloudflare/src/pages.ts +++ b/packages/create-cloudflare/src/pages.ts @@ -47,7 +47,7 @@ export const createProject = async (ctx: C3Context) => { e instanceof Error && // if the error is regarding name duplication we can exist as retrying is not going to help e.message.includes( - "A project with this name already exists. Choose a different project name.", + "A project with this name already exists. Choose a different project name." ) ); }, @@ -61,9 +61,9 @@ export const createProject = async (ctx: C3Context) => { env: { CLOUDFLARE_ACCOUNT_ID }, startText: "Creating Pages project", doneText: `${brandColor("created")} ${dim( - `via \`${quoteShellArgs(cmd)}\``, + `via \`${quoteShellArgs(cmd)}\`` )}`, - }), + }) ); } catch { throw new Error("Failed to create pages project. See output above."); @@ -88,13 +88,13 @@ export const createProject = async (ctx: C3Context) => { env: { CLOUDFLARE_ACCOUNT_ID }, startText: "Verifying Pages project", doneText: `${brandColor("verified")} ${dim( - `project is ready for deployment`, + `project is ready for deployment` )}`, - }), + }) ); } catch { throw new Error( - "Pages project isn't ready yet. Please try deploying again later.", + "Pages project isn't ready yet. Please try deploying again later." ); } }; diff --git a/packages/create-cloudflare/src/templates.ts b/packages/create-cloudflare/src/templates.ts index 1d0550a47c02..a11577152bde 100644 --- a/packages/create-cloudflare/src/templates.ts +++ b/packages/create-cloudflare/src/templates.ts @@ -136,7 +136,7 @@ export type TemplateConfig = { * */ transformPackageJson?: ( pkgJson: PackageJson, - ctx: C3Context, + ctx: C3Context ) => Promise>; /** An array of compatibility flags to be specified when deploying to pages (unused for workers) */ @@ -191,7 +191,7 @@ const defaultSelectVariant = async (ctx: C3Context) => { */ const templateSupportsLanguage = ( config: TemplateConfig, - lang: string, + lang: string ): boolean => { const { copyFiles } = config; // If the template has no copyFiles or uses a single path, it doesn't support variants. @@ -213,7 +213,7 @@ const filterTemplatesByLanguage = < T extends TemplateConfig | MultiPlatformTemplateConfig, >( templates: Record, - lang: string | undefined, + lang: string | undefined ): Record => { // If no language is specified, return all templates if (!lang) { @@ -229,7 +229,7 @@ const filterTemplatesByLanguage = < ); } return templateSupportsLanguage(config, lang); - }), + }) ) as Record; }; @@ -324,7 +324,7 @@ export function getHelloWorldTemplateMap({ export function getNamesAndDescriptions(templateMap: TemplateMap) { return Array.from(Object.entries(templateMap)).map( - ([name, { description }]) => ({ name, description }), + ([name, { description }]) => ({ name, description }) ); } @@ -356,7 +356,7 @@ export const deriveCorrelatedArgs = (args: Partial) => { case "webFramework": // Add backwards compatibility for the older argument (webFramework) warn( - "The `webFramework` type is deprecated and will be removed in a future version. Please use `web-framework` instead.", + "The `webFramework` type is deprecated and will be removed in a future version. Please use `web-framework` instead." ); args.category ??= "web-framework"; args.type = "web-framework"; @@ -381,7 +381,7 @@ export const deriveCorrelatedArgs = (args: Partial) => { if (args.lang !== undefined) { throw new Error( - "The `--ts` argument cannot be specified in conjunction with the `--lang` argument", + "The `--ts` argument cannot be specified in conjunction with the `--lang` argument" ); } @@ -396,7 +396,7 @@ export const deriveCorrelatedArgs = (args: Partial) => { */ export const createContext = async ( args: Partial, - prevArgs?: Partial, + prevArgs?: Partial ): Promise => { // Derive all correlated arguments first so we can skip some prompts deriveCorrelatedArgs(args); @@ -405,17 +405,17 @@ export const createContext = async ( const frameworkMap = filterTemplatesByLanguage( getFrameworkMap({ experimental }), - args.lang, + args.lang ); const helloWorldTemplateMap = filterTemplatesByLanguage( getHelloWorldTemplateMap({ experimental, }), - args.lang, + args.lang ); const otherTemplateMap = filterTemplatesByLanguage( getOtherTemplateMap({ experimental }), - args.lang, + args.lang ); let linesPrinted = 0; @@ -423,7 +423,7 @@ export const createContext = async ( // Allows the users to go back to the previous step // By moving the cursor up to a certain line and clearing the screen const goBack = async ( - from: "category" | "type" | "framework" | "lang" | "platform", + from: "category" | "type" | "framework" | "lang" | "platform" ) => { const currentArgs = { ...args }; @@ -510,7 +510,7 @@ export const createContext = async ( }, // This is used only if the type is `pre-existing` { label: "Others", value: "others", hidden: true }, - backOption, + backOption ); const category = await processArgument(args, "category", { @@ -541,7 +541,7 @@ export const createContext = async ( } return acc; }, - [], + [] ); const framework = await processArgument(args, "framework", { @@ -565,7 +565,7 @@ export const createContext = async ( if ("platformVariants" in frameworkConfig) { const availableVariants = Object.entries( - frameworkConfig.platformVariants, + frameworkConfig.platformVariants ).filter(([, config]) => !config.hidden) as [ keyof typeof frameworkConfig.platformVariants, TemplateConfig, @@ -613,7 +613,7 @@ export const createContext = async ( frameworkConfig = frameworkConfig.platformVariants[platform]; } else if (args.platform && args.platform !== frameworkConfig.platform) { throw new Error( - `The ${frameworkConfig.displayName} framework doesn't support the "${args.platform}" platform`, + `The ${frameworkConfig.displayName} framework doesn't support the "${args.platform}" platform` ); } @@ -635,13 +635,13 @@ export const createContext = async ( description, hidden: hidden, }; - }, + } ); // If no templates are available for the specified language, throw an error if (args.lang && templateOptions.length === 0) { throw new Error( - `No templates available for language "${args.lang}" in the "${category}" category.`, + `No templates available for language "${args.lang}" in the "${category}" category.` ); } @@ -753,7 +753,7 @@ export async function copyTemplateFiles(ctx: C3Context) { if (!variantInfo) { throw new Error( - `Unknown variant provided: ${JSON.stringify(variant ?? "")}`, + `Unknown variant provided: ${JSON.stringify(variant ?? "")}` ); } @@ -842,7 +842,7 @@ const validateTemplateSrcDirectory = (path: string, config: TemplateConfig) => { !existsSync(wranglerJsoncPath) ) { throw new Error( - `create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`, + `create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.` ); } } @@ -850,7 +850,7 @@ const validateTemplateSrcDirectory = (path: string, config: TemplateConfig) => { const pkgJsonPath = resolve(path, "package.json"); if (!existsSync(pkgJsonPath)) { throw new Error( - `create-cloudflare templates must contain a "package.json" file.`, + `create-cloudflare templates must contain a "package.json" file.` ); } }; @@ -901,7 +901,7 @@ export async function downloadRemoteTemplate( options: { mode?: "git" | "tar"; intoFolder?: string; - } = {}, + } = {} ) { const ghRegex = /^https:\/\/github\.com\/(?[\w-]+)\/(?[\w.-]+)(?:\/(?.*))?$/; @@ -1035,13 +1035,13 @@ export const getTemplatePath = (ctx: C3Context) => { }; export const isVariantInfo = ( - copyFiles: CopyFiles, + copyFiles: CopyFiles ): copyFiles is VariantInfo => { return "path" in (copyFiles as VariantInfo); }; export const getCopyFilesDestinationDir = ( - ctx: C3Context, + ctx: C3Context ): undefined | string => { const { copyFiles } = ctx.template; @@ -1076,21 +1076,21 @@ export const addWranglerToGitIgnore = (ctx: C3Context) => { const wranglerGitIgnoreFilesToAdd: string[] = []; const hasDotWrangler = existingGitIgnoreContent.match( - /^\/?\.wrangler(\/|\s|$)/m, + /^\/?\.wrangler(\/|\s|$)/m ); if (!hasDotWrangler) { wranglerGitIgnoreFilesToAdd.push(".wrangler"); } const hasDotDevDotVars = existingGitIgnoreContent.match( - /^\/?\.dev\.vars\*(\s|$)/m, + /^\/?\.dev\.vars\*(\s|$)/m ); if (!hasDotDevDotVars) { wranglerGitIgnoreFilesToAdd.push(".dev.vars*"); } const hasDotDevVarsExample = existingGitIgnoreContent.match( - /^!\/?\.dev\.vars\.example(\s|$)/m, + /^!\/?\.dev\.vars\.example(\s|$)/m ); if (!hasDotDevVarsExample) { wranglerGitIgnoreFilesToAdd.push("!.dev.vars.example"); @@ -1113,14 +1113,14 @@ export const addWranglerToGitIgnore = (ctx: C3Context) => { * ``` */ const hasDotEnv = existingGitIgnoreContent.match( - /^\/?\.env\*?(\..*?)?(\s|$)/m, + /^\/?\.env\*?(\..*?)?(\s|$)/m ); if (!hasDotEnv) { wranglerGitIgnoreFilesToAdd.push(".env*"); } const hasDotEnvExample = existingGitIgnoreContent.match( - /^!\/?\.env\.example(\s|$)/m, + /^!\/?\.env\.example(\s|$)/m ); if (!hasDotEnvExample) { wranglerGitIgnoreFilesToAdd.push("!.env.example"); @@ -1150,7 +1150,7 @@ export const addWranglerToGitIgnore = (ctx: C3Context) => { s.stop( `${brandColor(gitIgnorePreExisted ? "updated" : "created")} ${dim( - ".gitignore file", - )}`, + ".gitignore file" + )}` ); }; diff --git a/packages/create-cloudflare/src/validators.ts b/packages/create-cloudflare/src/validators.ts index 1d9420708613..6edb25278a44 100644 --- a/packages/create-cloudflare/src/validators.ts +++ b/packages/create-cloudflare/src/validators.ts @@ -35,7 +35,7 @@ export const validateTemplateUrl = (value: Arg) => { */ export const validateProjectDirectory = ( relativePath: string, - args: Partial, + args: Partial ) => { // Validate that the directory is non-existent or empty const path = resolve(relativePath); diff --git a/packages/create-cloudflare/src/workers.ts b/packages/create-cloudflare/src/workers.ts index 767962677fc1..a4beb8d78f54 100644 --- a/packages/create-cloudflare/src/workers.ts +++ b/packages/create-cloudflare/src/workers.ts @@ -96,7 +96,7 @@ const maybeInstallNodeTypes = async (ctx: C3Context, npm: string) => { */ export async function updateTsConfig( ctx: C3Context, - { usesNodeCompat }: { usesNodeCompat: boolean }, + { usesNodeCompat }: { usesNodeCompat: boolean } ) { const tsconfigPath = join(ctx.project.path, "tsconfig.json"); if (!existsSync(tsconfigPath)) { @@ -121,7 +121,7 @@ export async function updateTsConfig( } const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`; const explicitEntrypoint = currentTypes.some((t) => - t.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/), + t.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/) ); // If a type declaration with an explicit entrypoint exists, leave the types as is. // Otherwise, add the latest entrypoint @@ -134,17 +134,17 @@ export async function updateTsConfig( // if generated types include runtime types, remove @cloudflare/workers-types const typegen = readFile( - ctx.template.typesPath ?? "./worker-configuration.d.ts", + ctx.template.typesPath ?? "./worker-configuration.d.ts" ).split("\n"); if ( typegen.some((line) => - line.includes("// Runtime types generated with workerd"), + line.includes("// Runtime types generated with workerd") ) ) { newTypes = new Set( [...newTypes].filter( - (type) => !type.startsWith("@cloudflare/workers-types"), - ), + (type) => !type.startsWith("@cloudflare/workers-types") + ) ); } } @@ -164,7 +164,7 @@ export async function updateTsConfig( [...newTypes].sort(), { formattingOptions: { insertSpaces: useSpaces }, - }, + } ); const updated = jsonc.applyEdits(tsconfig, edits); writeFile(tsconfigPath, updated); diff --git a/packages/create-cloudflare/src/wrangler/__tests__/accounts.test.ts b/packages/create-cloudflare/src/wrangler/__tests__/accounts.test.ts index 3752d438a5ef..d8592fed30be 100644 --- a/packages/create-cloudflare/src/wrangler/__tests__/accounts.test.ts +++ b/packages/create-cloudflare/src/wrangler/__tests__/accounts.test.ts @@ -78,11 +78,11 @@ describe("wrangler account helpers", () => { expect(loggedIn).toBe(true); expect(mock).toHaveBeenCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); expect(mock).not.toHaveBeenCalledWith( ["npx", "wrangler", "login"], - expect.anything(), + expect.anything() ); expect(spinner.start).toHaveBeenCalledOnce(); expect(spinner.stop).toHaveBeenCalledOnce(); @@ -99,11 +99,11 @@ describe("wrangler account helpers", () => { expect(loggedIn).toBe(true); expect(mock).toHaveBeenCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); expect(mock).toHaveBeenCalledWith( ["npx", "wrangler", "login"], - expect.anything(), + expect.anything() ); expect(spinner.start).toHaveBeenCalledTimes(2); expect(spinner.stop).toHaveBeenCalledTimes(2); @@ -120,11 +120,11 @@ describe("wrangler account helpers", () => { expect(loggedIn).toBe(false); expect(mock).toHaveBeenCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); expect(mock).toHaveBeenCalledWith( ["npx", "wrangler", "login"], - expect.anything(), + expect.anything() ); expect(spinner.start).toHaveBeenCalledTimes(2); expect(spinner.stop).toHaveBeenCalledTimes(2); @@ -140,7 +140,7 @@ describe("wrangler account helpers", () => { expect(accounts).keys("testacct"); expect(mock).toHaveBeenLastCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); }); @@ -155,7 +155,7 @@ describe("wrangler account helpers", () => { expect(result).toBe(true); expect(mock).toHaveBeenLastCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); }); @@ -169,7 +169,7 @@ describe("wrangler account helpers", () => { expect(result).toBe(false); expect(mock).toHaveBeenLastCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); }); @@ -183,7 +183,7 @@ describe("wrangler account helpers", () => { expect(result).toBe(false); expect(mock).toHaveBeenLastCalledWith( ["npx", "wrangler", "whoami"], - expect.anything(), + expect.anything() ); }); }); diff --git a/packages/create-cloudflare/src/wrangler/__tests__/config.test.ts b/packages/create-cloudflare/src/wrangler/__tests__/config.test.ts index 34a302530cdc..d093bcca152e 100644 --- a/packages/create-cloudflare/src/wrangler/__tests__/config.test.ts +++ b/packages/create-cloudflare/src/wrangler/__tests__/config.test.ts @@ -18,13 +18,13 @@ describe("update wrangler config", () => { beforeEach(() => { vi.mocked(getWorkerdCompatibilityDate).mockReturnValue(mockCompatDate); vi.mocked(existsSync).mockImplementation((f) => - (f as string).endsWith(".toml"), + (f as string).endsWith(".toml") ); mockWorkersTypesDirectory(); // Mock the read of tsconfig.json vi.mocked(readFile).mockImplementation( - () => `{ "compilerOptions": { "types": ["@cloudflare/workers-types"]} }`, + () => `{ "compilerOptions": { "types": ["@cloudflare/workers-types"]} }` ); }); @@ -144,7 +144,7 @@ describe("update wrangler config", () => { test("placeholder replacement `` (json)", async ({ expect }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "", @@ -213,7 +213,7 @@ describe("update wrangler config", () => { test("placeholder replacement (json)", async ({ expect }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "", @@ -282,7 +282,7 @@ describe("update wrangler config", () => { test("string literal replacement", async ({ expect }) => { const toml = [`name = "my-cool-worker"`, `main = "src/index.ts"`].join( - "\n", + "\n" ); vi.mocked(readFile).mockReturnValue(toml); @@ -442,7 +442,7 @@ describe("update wrangler config", () => { test("placeholder replacement with Workflows (json)", async ({ expect }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "", @@ -567,7 +567,7 @@ describe("update wrangler config", () => { expect, }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "my-worker", @@ -586,7 +586,7 @@ describe("update wrangler config", () => { expect, }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "my-worker", @@ -606,7 +606,7 @@ describe("update wrangler config", () => { expect, }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "my-worker", @@ -643,7 +643,7 @@ describe("update wrangler config", () => { expect, }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const json = JSON.stringify({ name: "my-worker", @@ -679,7 +679,7 @@ describe("update wrangler config", () => { expect, }) => { vi.mocked(existsSync).mockImplementationOnce((f) => - (f as string).endsWith(".json"), + (f as string).endsWith(".json") ); const pythonCtx = createTestContext("test", { ...ctx.args, diff --git a/packages/create-cloudflare/src/wrangler/accounts.ts b/packages/create-cloudflare/src/wrangler/accounts.ts index 562a9992e1d3..04b5c7ad9e8a 100644 --- a/packages/create-cloudflare/src/wrangler/accounts.ts +++ b/packages/create-cloudflare/src/wrangler/accounts.ts @@ -24,7 +24,7 @@ export const chooseAccount = async (ctx: C3Context) => { const numAccounts = Object.keys(accounts).length; if (numAccounts === 0) { throw new Error( - "Unable to find any accounts to deploy to! Please ensure you're logged in as a user that can deploy Workers.", + "Unable to find any accounts to deploy to! Please ensure you're logged in as a user that can deploy Workers." ); } else if (numAccounts === 1) { const accountName = Object.keys(accounts)[0]; @@ -32,13 +32,13 @@ export const chooseAccount = async (ctx: C3Context) => { s.stop(`${brandColor("account")} ${dim(accountName)}`); } else { s.stop( - `${brandColor("account")} ${dim("more than one account available")}`, + `${brandColor("account")} ${dim("more than one account available")}` ); const accountOptions = Object.entries(accounts).map( ([accountName, id]) => ({ label: accountName, value: id, - }), + }) ); accountId = await inputPrompt({ @@ -50,7 +50,7 @@ export const chooseAccount = async (ctx: C3Context) => { }); } const accountName = Object.keys(accounts).find( - (account) => accounts[account] == accountId, + (account) => accounts[account] == accountId ) as string; ctx.account = { id: accountId, name: accountName }; @@ -67,7 +67,7 @@ export const wranglerLogin = async (ctx: C3Context) => { const s = spinner(); s.start( - `Logging into Cloudflare ${dim("checking authentication status")}`, + `Logging into Cloudflare ${dim("checking authentication status")}` ); const isAlreadyLoggedIn = await isLoggedIn(); s.stop(brandColor(isAlreadyLoggedIn ? "logged in" : "not logged in")); @@ -79,7 +79,7 @@ export const wranglerLogin = async (ctx: C3Context) => { } s.start( - `Logging into Cloudflare ${dim("This will open a browser window")}`, + `Logging into Cloudflare ${dim("This will open a browser window")}` ); // We're using a custom spinner since this is a little complicated. diff --git a/packages/create-cloudflare/src/wrangler/config.ts b/packages/create-cloudflare/src/wrangler/config.ts index ece78026ae82..f429e259c61a 100644 --- a/packages/create-cloudflare/src/wrangler/config.ts +++ b/packages/create-cloudflare/src/wrangler/config.ts @@ -53,7 +53,7 @@ export const updateWranglerConfig = async (ctx: C3Context) => { wranglerJson = insertJSONProperty( wranglerJson, "$schema", - "node_modules/wrangler/config-schema.json", + "node_modules/wrangler/config-schema.json" ); wranglerJson = appendJSONProperty(wranglerJson, "name", ctx.project.name); @@ -62,8 +62,8 @@ export const updateWranglerConfig = async (ctx: C3Context) => { "compatibility_date", await getCompatibilityDate( wranglerJson.compatibility_date, - ctx.project.path, - ), + ctx.project.path + ) ); wranglerJson = appendJSONProperty(wranglerJson, "observability", { enabled: true, @@ -88,7 +88,7 @@ export const updateWranglerConfig = async (ctx: C3Context) => { wranglerToml.name = ctx.project.name; wranglerToml.compatibility_date = await getCompatibilityDate( wranglerToml.compatibility_date, - ctx.project.path, + ctx.project.path ); wranglerToml.observability ??= { enabled: true }; // Skip adding nodejs_compat for Python projects since it's not compatible with Python workers @@ -102,7 +102,7 @@ export const updateWranglerConfig = async (ctx: C3Context) => { # For more details on how to configure Wrangler, refer to:\n# https://developers.cloudflare.com/workers/wrangler/configuration/ ${TOML.stringify(wranglerToml)} ${generateHintsAsTomlComments(wranglerToml)} -`, +` ); } }; @@ -147,7 +147,7 @@ export const readWranglerToml = (ctx: C3Context) => { */ export const readWranglerJsonOrJsonc = ( ctx: C3Context, - reviver?: Reviver, + reviver?: Reviver ): CommentObject => { const wranglerJsonPath = getWranglerJsonPath(ctx); if (existsSync(wranglerJsonPath)) { @@ -209,7 +209,7 @@ export const addVscodeConfig = (ctx: C3Context) => { */ async function getCompatibilityDate( tentativeDate: unknown, - projectPath: string, + projectPath: string ): Promise { if (typeof tentativeDate === "string" && isCompatDate(tentativeDate)) { // Use the tentative date when it is valid. @@ -265,7 +265,7 @@ function addHintsAsJsonComments(wranglerConfig: CommentObject) { addJSONComment( wranglerConfig, "before-all", - "*\n * For more details on how to configure Wrangler, refer to:\n * https://developers.cloudflare.com/workers/wrangler/configuration/\n ", + "*\n * For more details on how to configure Wrangler, refer to:\n * https://developers.cloudflare.com/workers/wrangler/configuration/\n " ); const commentsToAdd = []; @@ -275,7 +275,7 @@ function addHintsAsJsonComments(wranglerConfig: CommentObject) { if (!(key in wranglerConfig)) { // Add block comment with the hint description commentsToAdd.push( - `*\n\t * ${hint.comment.split("\n").join("\n\t * ")}\n\t `, + `*\n\t * ${hint.comment.split("\n").join("\n\t * ")}\n\t ` ); // Add line comment with the example value @@ -319,7 +319,7 @@ function generateHintsAsTomlComments(wranglerConfig: TomlTable): string { .trimEnd() .split("\n") .map((line) => `# ${line}`) - .join("\n"), + .join("\n") ); } diff --git a/packages/create-cloudflare/templates/analog/c3.ts b/packages/create-cloudflare/templates/analog/c3.ts index a47af32cc1be..b7689918044b 100644 --- a/packages/create-cloudflare/templates/analog/c3.ts +++ b/packages/create-cloudflare/templates/analog/c3.ts @@ -39,13 +39,13 @@ const configure = async (ctx: C3Context) => { // preset: "cloudflare_module" b.objectProperty( b.identifier("preset"), - b.stringLiteral("cloudflare_module"), + b.stringLiteral("cloudflare_module") ), b.objectProperty( b.identifier("compatibilityDate"), - b.stringLiteral(compatDate), + b.stringLiteral(compatDate) ), - ]), + ]) ), ]; @@ -54,7 +54,7 @@ const configure = async (ctx: C3Context) => { } else { mergeObjectProperties( n.node.arguments[0] as recast.types.namedTypes.ObjectExpression, - presetDef, + presetDef ); } diff --git a/packages/create-cloudflare/templates/angular/pages/c3.ts b/packages/create-cloudflare/templates/angular/pages/c3.ts index 6329d26520c4..150006b1abef 100644 --- a/packages/create-cloudflare/templates/angular/pages/c3.ts +++ b/packages/create-cloudflare/templates/angular/pages/c3.ts @@ -41,7 +41,7 @@ async function updateAppCode() { "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace( "providers: [", - "providers: [provideHttpClient(withFetch()), ", + "providers: [provideHttpClient(withFetch()), " ); writeFile(resolve(appConfigPath), newAppConfig); s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`); @@ -51,7 +51,7 @@ async function updateAppCode() { const appRoutes = readFile(resolve(appServerRoutesPath)); const newAppRoutes = appRoutes.replace( "RenderMode.Prerender", - "RenderMode.Server", + "RenderMode.Server" ); writeFile(resolve(appServerRoutesPath), newAppRoutes); s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`); diff --git a/packages/create-cloudflare/templates/angular/workers/c3.ts b/packages/create-cloudflare/templates/angular/workers/c3.ts index 60f56eccc63f..c12225188dbd 100644 --- a/packages/create-cloudflare/templates/angular/workers/c3.ts +++ b/packages/create-cloudflare/templates/angular/workers/c3.ts @@ -41,7 +41,7 @@ async function updateAppCode() { "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace( "providers: [", - "providers: [provideHttpClient(withFetch()), ", + "providers: [provideHttpClient(withFetch()), " ); writeFile(resolve(appConfigPath), newAppConfig); s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`); @@ -51,7 +51,7 @@ async function updateAppCode() { const appRoutes = readFile(resolve(appServerRoutesPath)); const newAppRoutes = appRoutes.replace( "RenderMode.Prerender", - "RenderMode.Server", + "RenderMode.Server" ); writeFile(resolve(appServerRoutesPath), newAppRoutes); s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`); diff --git a/packages/create-cloudflare/templates/astro/pages/c3.ts b/packages/create-cloudflare/templates/astro/pages/c3.ts index 9c00b1d165aa..ead39a86a870 100644 --- a/packages/create-cloudflare/templates/astro/pages/c3.ts +++ b/packages/create-cloudflare/templates/astro/pages/c3.ts @@ -30,7 +30,7 @@ const configure = async () => { silent: true, startText: "Installing adapter", doneText: `${brandColor("installed")} ${dim( - `via \`${npx} astro add cloudflare\``, + `via \`${npx} astro add cloudflare\`` )}`, }); @@ -56,12 +56,12 @@ const configure = async () => { b.identifier("platformProxy"), b.objectExpression([ b.objectProperty(b.identifier("enabled"), b.booleanLiteral(true)), - ]), + ]) ), // imageService: "cloudflare", b.objectProperty( b.identifier("imageService"), - b.stringLiteral("cloudflare"), + b.stringLiteral("cloudflare") ), ]), ]; diff --git a/packages/create-cloudflare/templates/astro/workers/c3.ts b/packages/create-cloudflare/templates/astro/workers/c3.ts index 3128ba710e57..f4867217f89f 100644 --- a/packages/create-cloudflare/templates/astro/workers/c3.ts +++ b/packages/create-cloudflare/templates/astro/workers/c3.ts @@ -28,7 +28,7 @@ const configure = async () => { silent: true, startText: "Installing adapter", doneText: `${brandColor("installed")} ${dim( - `via \`${npx} astro add cloudflare\``, + `via \`${npx} astro add cloudflare\`` )}`, }); }; diff --git a/packages/create-cloudflare/templates/nuxt/pages/c3.ts b/packages/create-cloudflare/templates/nuxt/pages/c3.ts index 2221dcb09058..9ae716c0ca08 100644 --- a/packages/create-cloudflare/templates/nuxt/pages/c3.ts +++ b/packages/create-cloudflare/templates/nuxt/pages/c3.ts @@ -59,24 +59,24 @@ const updateNuxtConfig = () => { b.objectExpression([ b.objectProperty( b.identifier("preset"), - b.stringLiteral("cloudflare-pages"), + b.stringLiteral("cloudflare-pages") ), b.objectProperty( b.identifier("cloudflare"), b.objectExpression([ b.objectProperty( b.identifier("deployConfig"), - b.booleanLiteral(true), + b.booleanLiteral(true) ), b.objectProperty(b.identifier("nodeCompat"), b.booleanLiteral(true)), - ]), + ]) ), - ]), + ]) ); const moduleDef = b.objectProperty( b.identifier("modules"), - b.arrayExpression([b.stringLiteral("nitro-cloudflare-dev")]), + b.arrayExpression([b.stringLiteral("nitro-cloudflare-dev")]) ); transformFile(configFile, { @@ -85,7 +85,7 @@ const updateNuxtConfig = () => { if (callee.name === "defineNuxtConfig") { mergeObjectProperties( n.node.arguments[0] as recast.types.namedTypes.ObjectExpression, - [presetDef, moduleDef], + [presetDef, moduleDef] ); } diff --git a/packages/create-cloudflare/templates/nuxt/workers/c3.ts b/packages/create-cloudflare/templates/nuxt/workers/c3.ts index a89af1fe71a8..ce6f7b5ab4ae 100644 --- a/packages/create-cloudflare/templates/nuxt/workers/c3.ts +++ b/packages/create-cloudflare/templates/nuxt/workers/c3.ts @@ -59,24 +59,24 @@ const updateNuxtConfig = () => { b.objectExpression([ b.objectProperty( b.identifier("preset"), - b.stringLiteral("cloudflare_module"), + b.stringLiteral("cloudflare_module") ), b.objectProperty( b.identifier("cloudflare"), b.objectExpression([ b.objectProperty( b.identifier("deployConfig"), - b.booleanLiteral(true), + b.booleanLiteral(true) ), b.objectProperty(b.identifier("nodeCompat"), b.booleanLiteral(true)), - ]), + ]) ), - ]), + ]) ); const moduleDef = b.objectProperty( b.identifier("modules"), - b.arrayExpression([b.stringLiteral("nitro-cloudflare-dev")]), + b.arrayExpression([b.stringLiteral("nitro-cloudflare-dev")]) ); transformFile(configFile, { @@ -85,7 +85,7 @@ const updateNuxtConfig = () => { if (callee.name === "defineNuxtConfig") { mergeObjectProperties( n.node.arguments[0] as recast.types.namedTypes.ObjectExpression, - [presetDef, moduleDef], + [presetDef, moduleDef] ); } diff --git a/packages/create-cloudflare/templates/pre-existing/c3.ts b/packages/create-cloudflare/templates/pre-existing/c3.ts index 41c0dfacfd61..b0e79fa86e01 100644 --- a/packages/create-cloudflare/templates/pre-existing/c3.ts +++ b/packages/create-cloudflare/templates/pre-existing/c3.ts @@ -23,7 +23,7 @@ export async function copyExistingWorkerFiles(ctx: C3Context) { "Please specify the name of the existing worker in this account?", label: "worker", defaultValue: ctx.project.name, - }, + } ); } @@ -46,16 +46,16 @@ export async function copyExistingWorkerFiles(ctx: C3Context) { env: { CLOUDFLARE_ACCOUNT_ID: ctx.account?.id }, startText: "Downloading existing worker files", doneText: `${brandColor("downloaded")} ${dim( - `existing "${ctx.args.existingScript}" worker files`, + `existing "${ctx.args.existingScript}" worker files` )}`, - }, + } ); // copy src/* files from the downloaded Worker await cp( join(tempdir, ctx.args.existingScript, "src"), join(ctx.project.path, "src"), - { recursive: true }, + { recursive: true } ); // copy wrangler config file from the downloaded Worker @@ -73,7 +73,7 @@ export async function copyExistingWorkerFiles(ctx: C3Context) { if (!configFileCopied) { throw new Error( - `No wrangler configuration file found in downloaded worker. Expected one of: ${configFiles.join(", ")}`, + `No wrangler configuration file found in downloaded worker. Expected one of: ${configFiles.join(", ")}` ); } } diff --git a/packages/create-cloudflare/templates/qwik/pages/c3.ts b/packages/create-cloudflare/templates/qwik/pages/c3.ts index 05637075aafb..e7005bf04938 100644 --- a/packages/create-cloudflare/templates/qwik/pages/c3.ts +++ b/packages/create-cloudflare/templates/qwik/pages/c3.ts @@ -43,7 +43,7 @@ const addBindingsProxy = (ctx: C3Context) => { // Insert the env declaration after the last import (but before the rest of the body) visitProgram: function (n) { const lastImportIndex = n.node.body.findLastIndex( - (t) => t.type === "ImportDeclaration", + (t) => t.type === "ImportDeclaration" ); const lastImport = n.get("body", lastImportIndex); lastImport.insertAfter(...snippets.getPlatformProxyTs); diff --git a/packages/create-cloudflare/templates/qwik/workers/c3.ts b/packages/create-cloudflare/templates/qwik/workers/c3.ts index 03440311e120..1aa3f0df74ee 100644 --- a/packages/create-cloudflare/templates/qwik/workers/c3.ts +++ b/packages/create-cloudflare/templates/qwik/workers/c3.ts @@ -46,7 +46,7 @@ const addBindingsProxy = (ctx: C3Context) => { // Insert the env declaration after the last import (but before the rest of the body) visitProgram: function (n) { const lastImportIndex = n.node.body.findLastIndex( - (t) => t.type === "ImportDeclaration", + (t) => t.type === "ImportDeclaration" ); const lastImport = n.get("body", lastImportIndex); lastImport.insertAfter(...snippets.getPlatformProxyTs); diff --git a/packages/create-cloudflare/templates/react/pages/c3.ts b/packages/create-cloudflare/templates/react/pages/c3.ts index 16d4f39491ca..fbd9de10f8fb 100644 --- a/packages/create-cloudflare/templates/react/pages/c3.ts +++ b/packages/create-cloudflare/templates/react/pages/c3.ts @@ -44,7 +44,7 @@ async function getVariant(ctx: C3Context) { const selected = variantsOptions.find((v) => v.value === ctx.args.variant); if (!selected) { throw new Error( - `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions.map((v) => v.value).join(", ")}`, + `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions.map((v) => v.value).join(", ")}` ); } return selected.value; diff --git a/packages/create-cloudflare/templates/react/workers/c3.ts b/packages/create-cloudflare/templates/react/workers/c3.ts index 2b60b50096e4..e94e0d42cda8 100644 --- a/packages/create-cloudflare/templates/react/workers/c3.ts +++ b/packages/create-cloudflare/templates/react/workers/c3.ts @@ -54,12 +54,12 @@ function transformViteConfig(ctx: C3Context) { // import {cloudflare} from "@cloudflare/vite-plugin"; // ``` const lastImportIndex = n.node.body.findLastIndex( - (statement) => statement.type === "ImportDeclaration", + (statement) => statement.type === "ImportDeclaration" ); const lastImport = n.get("body", lastImportIndex); const importAst = b.importDeclaration( [b.importSpecifier(b.identifier("cloudflare"))], - b.stringLiteral("@cloudflare/vite-plugin"), + b.stringLiteral("@cloudflare/vite-plugin") ); lastImport.insertAfter(importAst); @@ -81,7 +81,7 @@ function transformViteConfig(ctx: C3Context) { const pluginsProp = config.properties.find((prop) => isPluginsProp(prop)); assert(pluginsProp && t.ArrayExpression.check(pluginsProp.value)); pluginsProp.value.elements.push( - b.callExpression(b.identifier("cloudflare"), []), + b.callExpression(b.identifier("cloudflare"), []) ); return false; @@ -90,7 +90,7 @@ function transformViteConfig(ctx: C3Context) { } function isPluginsProp( - prop: unknown, + prop: unknown ): prop is types.namedTypes.ObjectProperty | types.namedTypes.Property { return ( (t.Property.check(prop) || t.ObjectProperty.check(prop)) && @@ -142,11 +142,11 @@ async function getVariant(ctx: C3Context) { // If variant is provided via CLI args, use it directly if (ctx.args.variant) { const selected = variantsOptions.find( - (variant) => variant.value === ctx.args.variant, + (variant) => variant.value === ctx.args.variant ); if (!selected) { throw new Error( - `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions.map((v) => v.value).join(", ")}`, + `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions.map((v) => v.value).join(", ")}` ); } return selected; diff --git a/packages/create-cloudflare/templates/solid/c3.ts b/packages/create-cloudflare/templates/solid/c3.ts index 3cdc1d44dfd6..8b2d23169832 100644 --- a/packages/create-cloudflare/templates/solid/c3.ts +++ b/packages/create-cloudflare/templates/solid/c3.ts @@ -34,7 +34,7 @@ const configure = async (ctx: C3Context) => { const b = recast.types.builders; const presetProp = b.objectProperty( b.identifier("preset"), - b.stringLiteral("cloudflare-module"), + b.stringLiteral("cloudflare-module") ); if (n.node.arguments.length === 0) { @@ -42,7 +42,7 @@ const configure = async (ctx: C3Context) => { } else { mergeObjectProperties( n.node.arguments[0] as recast.types.namedTypes.ObjectExpression, - [presetProp], + [presetProp] ); } diff --git a/packages/create-cloudflare/templates/svelte/pages/c3.ts b/packages/create-cloudflare/templates/svelte/pages/c3.ts index 7c2b6fa17a92..81bc40505460 100644 --- a/packages/create-cloudflare/templates/svelte/pages/c3.ts +++ b/packages/create-cloudflare/templates/svelte/pages/c3.ts @@ -98,21 +98,21 @@ const updateTypeDefinitions = (ctx: C3Context) => { b.tsInterfaceBody([ b.tsPropertySignature( b.identifier("env"), - b.tsTypeAnnotation(b.tsTypeReference(b.identifier("Env"))), + b.tsTypeAnnotation(b.tsTypeReference(b.identifier("Env"))) ), b.tsPropertySignature( b.identifier("cf"), b.tsTypeAnnotation( - b.tsTypeReference(b.identifier("CfProperties")), - ), + b.tsTypeReference(b.identifier("CfProperties")) + ) ), b.tsPropertySignature( b.identifier("ctx"), b.tsTypeAnnotation( - b.tsTypeReference(b.identifier("ExecutionContext")), - ), + b.tsTypeReference(b.identifier("ExecutionContext")) + ) ), - ]), + ]) ); moduleBlock.body.unshift(platformInterface); diff --git a/packages/create-cloudflare/templates/svelte/workers/c3.ts b/packages/create-cloudflare/templates/svelte/workers/c3.ts index cda88ca08784..7d59205b0612 100644 --- a/packages/create-cloudflare/templates/svelte/workers/c3.ts +++ b/packages/create-cloudflare/templates/svelte/workers/c3.ts @@ -68,21 +68,21 @@ const updateTypeDefinitions = (ctx: C3Context) => { b.tsInterfaceBody([ b.tsPropertySignature( b.identifier("env"), - b.tsTypeAnnotation(b.tsTypeReference(b.identifier("Env"))), + b.tsTypeAnnotation(b.tsTypeReference(b.identifier("Env"))) ), b.tsPropertySignature( b.identifier("cf"), b.tsTypeAnnotation( - b.tsTypeReference(b.identifier("CfProperties")), - ), + b.tsTypeReference(b.identifier("CfProperties")) + ) ), b.tsPropertySignature( b.identifier("ctx"), b.tsTypeAnnotation( - b.tsTypeReference(b.identifier("ExecutionContext")), - ), + b.tsTypeReference(b.identifier("ExecutionContext")) + ) ), - ]), + ]) ); moduleBlock.body.unshift(platformInterface); diff --git a/packages/create-cloudflare/vitest.config.mts b/packages/create-cloudflare/vitest.config.mts index 2b2bed20cd24..888f587adb27 100644 --- a/packages/create-cloudflare/vitest.config.mts +++ b/packages/create-cloudflare/vitest.config.mts @@ -10,5 +10,5 @@ export default mergeConfig( include: ["src/**/__tests__/**.test.ts"], setupFiles: ["vitest.setup.ts"], }, - }), + }) ); diff --git a/packages/local-explorer-ui/src/components/studio/SQLWhereEditor.tsx b/packages/local-explorer-ui/src/components/studio/SQLWhereEditor.tsx index 5dfba36e5ffb..a0f143cfa17f 100644 --- a/packages/local-explorer-ui/src/components/studio/SQLWhereEditor.tsx +++ b/packages/local-explorer-ui/src/components/studio/SQLWhereEditor.tsx @@ -12,8 +12,10 @@ import type { } from "./Code/Mirror"; import type { Extension } from "@codemirror/state"; -interface SutdioSQLWhereEditor - extends Omit { +interface SutdioSQLWhereEditor extends Omit< + StudioCodeMirrorProps, + "extensions" +> { columnNames?: string[]; functionNames?: string[]; onEnterPressed?: () => void; diff --git a/packages/local-explorer-ui/src/components/studio/Table/BaseTable.tsx b/packages/local-explorer-ui/src/components/studio/Table/BaseTable.tsx index f67ca5b0536a..ddf3a2a0cbeb 100644 --- a/packages/local-explorer-ui/src/components/studio/Table/BaseTable.tsx +++ b/packages/local-explorer-ui/src/components/studio/Table/BaseTable.tsx @@ -147,8 +147,9 @@ export function StudioBaseTable({ ); } -export interface StudioTableHeaderProps - extends StudioTableHeaderInput { +export interface StudioTableHeaderProps< + MetadataType = unknown, +> extends StudioTableHeaderInput { index: number; sticky: boolean; } @@ -185,15 +186,17 @@ interface TableCellListCommonProps { state: StudioTableState; } -export interface StudioTableProps - extends TableCellListCommonProps { +export interface StudioTableProps< + HeaderMetadata = unknown, +> extends TableCellListCommonProps { arrangeHeaderIndex: number[]; renderAhead: number; stickyHeaderIndex?: number; } -interface RenderCellListProps - extends TableCellListCommonProps { +interface RenderCellListProps< + HeaderMetadata = unknown, +> extends TableCellListCommonProps { colEnd: number; colStart: number; customStyles?: React.CSSProperties; diff --git a/packages/local-explorer-ui/src/components/studio/index.tsx b/packages/local-explorer-ui/src/components/studio/index.tsx index dc604fef78f3..22dee83f9f4d 100644 --- a/packages/local-explorer-ui/src/components/studio/index.tsx +++ b/packages/local-explorer-ui/src/components/studio/index.tsx @@ -414,7 +414,7 @@ export const Studio = forwardRef(function Studio( const tableMatch = selectedTab.identifier.match( /^(?:table|edit-table)\/[^.]+\.(.+)$/ ); - lastOpenedTable.current = tableMatch ? tableMatch[1] ?? null : null; + lastOpenedTable.current = tableMatch ? (tableMatch[1] ?? null) : null; onTableChange(tableMatch?.[1]); }, [initialTable, loadingSchema, onTableChange, selectedTabKey, tabs]); diff --git a/packages/local-explorer-ui/src/styles/tailwind.css b/packages/local-explorer-ui/src/styles/tailwind.css index 1faa1f0b6bf9..49db18131f9f 100644 --- a/packages/local-explorer-ui/src/styles/tailwind.css +++ b/packages/local-explorer-ui/src/styles/tailwind.css @@ -139,8 +139,9 @@ @layer base { body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, - Ubuntu, sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, + sans-serif; @apply text-text bg-bg-secondary text-sm leading-normal; } } diff --git a/packages/miniflare/CHANGELOG.md b/packages/miniflare/CHANGELOG.md index 4b375a17a98e..14f7938d688e 100644 --- a/packages/miniflare/CHANGELOG.md +++ b/packages/miniflare/CHANGELOG.md @@ -1,5 +1,33 @@ # miniflare +## 4.20260317.0 + +### Patch Changes + +- [#12927](https://github.com/cloudflare/workers-sdk/pull/12927) [`c9b3184`](https://github.com/cloudflare/workers-sdk/commit/c9b31840631585418b8926e8228db486b619b4c7) Thanks [@penalosa](https://github.com/penalosa)! - Bump undici from 7.18.2 to 7.24.4 + +- [#12875](https://github.com/cloudflare/workers-sdk/pull/12875) [`13df6c7`](https://github.com/cloudflare/workers-sdk/commit/13df6c75be49ac32fc1c57e2e24523e86ced2115) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "miniflare", "wrangler" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ---------- | ------------ | ------------ | + | workerd | 1.20260312.1 | 1.20260316.1 | + +- [#12935](https://github.com/cloudflare/workers-sdk/pull/12935) [`df0d112`](https://github.com/cloudflare/workers-sdk/commit/df0d1120a856bd65553bf92b4bc6380c15e81cc7) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "miniflare", "wrangler" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ---------- | ------------ | ------------ | + | workerd | 1.20260316.1 | 1.20260317.1 | + +- [#12928](https://github.com/cloudflare/workers-sdk/pull/12928) [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Migrate chrome-devtools-patches deployment from Cloudflare Pages to Workers + Assets + + The DevTools frontend is now deployed as a Cloudflare Workers + Assets project instead of a Cloudflare Pages project. This uses `wrangler deploy` for production deployments and `wrangler versions upload` for PR preview deployments. + + The inspector proxy origin allowlists in both wrangler and miniflare have been updated to accept connections from the new `workers.dev` domain patterns, while retaining the legacy `pages.dev` patterns for backward compatibility. + ## 4.20260312.1 ### Patch Changes @@ -25,7 +53,6 @@ - [#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/*`) @@ -263,7 +290,6 @@ - [#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 @@ -304,7 +330,6 @@ - [#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`. @@ -361,7 +386,6 @@ - [#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. @@ -513,7 +537,6 @@ 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 @@ -627,7 +650,6 @@ 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` @@ -686,7 +708,6 @@ ### 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. @@ -1614,7 +1635,6 @@ - [#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. @@ -1636,7 +1656,6 @@ - [#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 @@ -2653,7 +2672,6 @@ - [#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. @@ -3023,7 +3041,6 @@ - [#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. diff --git a/packages/miniflare/README.md b/packages/miniflare/README.md index 7da2d6c0b530..f6f2408a5e4b 100644 --- a/packages/miniflare/README.md +++ b/packages/miniflare/README.md @@ -260,7 +260,6 @@ parameter in module format Workers. have any _npm_ imports, and `modules: true` must be set. - `modules?: boolean | ModuleDefinition[]` - - If `true`, Miniflare will treat `script`/`scriptPath` as an ES Module and automatically locate transitive module dependencies according to `modulesRules`. Note that automatic location is not perfect: if the @@ -335,7 +334,6 @@ parameter in module format Workers. `{ fetch: typeof fetch }` [service bindings](https://developers.cloudflare.com/workers/platform/bindings/about-service-bindings/) into this Worker. - - If the designator is a `string`, requests will be dispatched to the Worker with that `name`. - If the designator is `(await import("miniflare")).kCurrentWorker`, requests @@ -535,7 +533,6 @@ parameter in module format Workers. Record mapping binding name to Durable Object class designators to inject as `DurableObjectNamespace` bindings into this Worker. - - If the designator is a `string`, it should be the name of a `class` exported by this Worker. - If the designator is an object, and `scriptName` is `undefined`, `className` @@ -569,11 +566,9 @@ parameter in module format Workers. If set, only files with paths _not_ matching these glob patterns will be served. - - `assetsPath?: string` Path to serve Workers assets from. - - `assetsKVBindingName?: string` Name of the binding to the KV namespace that the assets are in. If `assetsPath` is set, this binding will be injected into this Worker. @@ -763,7 +758,6 @@ Options shared between all Workers/"nanoservices". - `cf?: boolean | string | Record` Controls the object returned from incoming `Request`'s `cf` property. - - If set to a falsy value, an object with default placeholder values will be used - If set to an object, that object will be used diff --git a/packages/miniflare/package.json b/packages/miniflare/package.json index 7a90ecfa740c..0831ff4bc8f2 100644 --- a/packages/miniflare/package.json +++ b/packages/miniflare/package.json @@ -1,6 +1,6 @@ { "name": "miniflare", - "version": "4.20260312.1", + "version": "4.20260317.0", "description": "Fun, full-featured, fully-local simulator for Cloudflare Workers", "keywords": [ "cloudflare", diff --git a/packages/miniflare/src/workers/local-explorer/resources/kv.ts b/packages/miniflare/src/workers/local-explorer/resources/kv.ts index bc9c62fae1a2..2626b5591846 100644 --- a/packages/miniflare/src/workers/local-explorer/resources/kv.ts +++ b/packages/miniflare/src/workers/local-explorer/resources/kv.ts @@ -183,7 +183,7 @@ async function executeListKeys( options: { cursor?: string; limit?: number; prefix?: string } ) { const listResult = await kv.list(options); - const resultCursor = "cursor" in listResult ? listResult.cursor ?? "" : ""; + const resultCursor = "cursor" in listResult ? (listResult.cursor ?? "") : ""; return c.json({ ...wrapResponse( diff --git a/packages/miniflare/src/workers/shared/keyvalue.worker.ts b/packages/miniflare/src/workers/shared/keyvalue.worker.ts index a25231ff4129..261a7b89040f 100644 --- a/packages/miniflare/src/workers/shared/keyvalue.worker.ts +++ b/packages/miniflare/src/workers/shared/keyvalue.worker.ts @@ -20,8 +20,9 @@ export interface KeyEntry { export interface KeyValueEntry extends KeyEntry { value: ReadableStream; } -export interface KeyMultipartValueEntry - extends KeyEntry { +export interface KeyMultipartValueEntry< + Metadata = unknown, +> extends KeyEntry { value: MultipartReadableStream; } diff --git a/packages/miniflare/test/plugins/email/index.spec.ts b/packages/miniflare/test/plugins/email/index.spec.ts index a406703affde..811e6b5fc24a 100644 --- a/packages/miniflare/test/plugins/email/index.spec.ts +++ b/packages/miniflare/test/plugins/email/index.spec.ts @@ -4,7 +4,7 @@ import dedent from "ts-dedent"; import { test, vi } from "vitest"; import { TestLog, useDispose } from "../../test-shared"; -const SEND_EMAIL_WORKER = dedent/* javascript */ ` +const SEND_EMAIL_WORKER = dedent /* javascript */ ` import { EmailMessage } from "cloudflare:email"; export default { @@ -23,7 +23,7 @@ const SEND_EMAIL_WORKER = dedent/* javascript */ ` }; `; -const REPLY_EMAIL_WORKER = (email = "message.raw") => dedent/* javascript */ ` +const REPLY_EMAIL_WORKER = (email = "message.raw") => dedent /* javascript */ ` import { EmailMessage } from "cloudflare:email"; export default { @@ -984,7 +984,7 @@ test("reply: references generated correctly", async ({ expect }) => { ).toBe(true); }); -const MESSAGE_BUILDER_WORKER = dedent/* javascript */ ` +const MESSAGE_BUILDER_WORKER = dedent /* javascript */ ` export default { async fetch(request, env) { const builder = await request.json(); diff --git a/packages/pages-shared/CHANGELOG.md b/packages/pages-shared/CHANGELOG.md index d04e9b30ecd2..931f3ba694c2 100644 --- a/packages/pages-shared/CHANGELOG.md +++ b/packages/pages-shared/CHANGELOG.md @@ -1,5 +1,12 @@ # @cloudflare/pages-shared +## 0.13.116 + +### Patch Changes + +- Updated dependencies [[`c9b3184`](https://github.com/cloudflare/workers-sdk/commit/c9b31840631585418b8926e8228db486b619b4c7), [`13df6c7`](https://github.com/cloudflare/workers-sdk/commit/13df6c75be49ac32fc1c57e2e24523e86ced2115), [`df0d112`](https://github.com/cloudflare/workers-sdk/commit/df0d1120a856bd65553bf92b4bc6380c15e81cc7), [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a)]: + - miniflare@4.20260317.0 + ## 0.13.115 ### Patch Changes @@ -438,7 +445,6 @@ ### 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 @@ -1153,7 +1159,6 @@ ### Patch Changes - [#4797](https://github.com/cloudflare/workers-sdk/pull/4797) [`007ba93`](https://github.com/cloudflare/workers-sdk/commit/007ba9397be9a2914254d0b59e0695df1a518b52) Thanks [@jahands](https://github.com/jahands)! - refactor: Store asset key instead of body in preservation cache - - Add HTTP method to cache key to prevent returning null bodies in cached GET requests that follow a HEAD request - Only write unchanged assets to preservation cache every 24-36 hours instead of on every request diff --git a/packages/pages-shared/environment-polyfills/html-rewriter.ts b/packages/pages-shared/environment-polyfills/html-rewriter.ts index 24d56fed963e..9dbed3092c3b 100644 --- a/packages/pages-shared/environment-polyfills/html-rewriter.ts +++ b/packages/pages-shared/environment-polyfills/html-rewriter.ts @@ -49,9 +49,8 @@ export class HTMLRewriter { const { HTMLRewriter: BaseHTMLRewriter, // eslint-disable-next-line @typescript-eslint/consistent-type-imports - }: typeof import("html-rewriter-wasm") = await import( - "html-rewriter-wasm" - ); + }: typeof import("html-rewriter-wasm") = + await import("html-rewriter-wasm"); rewriter = new BaseHTMLRewriter((output) => { // enqueue will throw on empty chunks if (output.length !== 0) { diff --git a/packages/pages-shared/package.json b/packages/pages-shared/package.json index 42a3b19a4e4c..aa7f953f282f 100644 --- a/packages/pages-shared/package.json +++ b/packages/pages-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cloudflare/pages-shared", - "version": "0.13.115", + "version": "0.13.116", "repository": { "type": "git", "url": "https://github.com/cloudflare/workers-sdk.git", diff --git a/packages/playground-preview-worker/src/realish.ts b/packages/playground-preview-worker/src/realish.ts index 5c893d4278d8..e7b9d46e3b89 100644 --- a/packages/playground-preview-worker/src/realish.ts +++ b/packages/playground-preview-worker/src/realish.ts @@ -96,8 +96,8 @@ export async function setupTokens( ): Promise { const previewSession = await initialiseSubdomainPreview(accountId, apiToken); const uploadConfigToken = previewSession.exchange_url - ? (await tryExpandToken(previewSession.exchange_url)) ?? - previewSession.token + ? ((await tryExpandToken(previewSession.exchange_url)) ?? + previewSession.token) : previewSession.token; return { diff --git a/packages/vite-plugin-cloudflare/CHANGELOG.md b/packages/vite-plugin-cloudflare/CHANGELOG.md index 446a742d2413..20ce9606977c 100644 --- a/packages/vite-plugin-cloudflare/CHANGELOG.md +++ b/packages/vite-plugin-cloudflare/CHANGELOG.md @@ -1,5 +1,17 @@ # @cloudflare/vite-plugin +## 1.29.1 + +### Patch Changes + +- [#12936](https://github.com/cloudflare/workers-sdk/pull/12936) [`cff91ff`](https://github.com/cloudflare/workers-sdk/commit/cff91ff4bbbfcc2b59eb9b0d26b5ae8188823197) Thanks [@jamesopstad](https://github.com/jamesopstad)! - Select the appropriate `vite/module-runner` implementation during dev based on the user's Vite version + + The plugin now builds against Vite 8 and ships two bundled copies of `vite/module-runner`: one from Vite 8 and one from Vite 7.1.12 (the last version before a breaking change to the module runner in Vite 7.2.0). At dev server startup, the correct implementation is selected based on the user's installed Vite version. This is Vite 8's module runner for users on Vite >= 7.2.0, and the legacy module runner for users on older versions. + +- Updated dependencies [[`c9b3184`](https://github.com/cloudflare/workers-sdk/commit/c9b31840631585418b8926e8228db486b619b4c7), [`13df6c7`](https://github.com/cloudflare/workers-sdk/commit/13df6c75be49ac32fc1c57e2e24523e86ced2115), [`df0d112`](https://github.com/cloudflare/workers-sdk/commit/df0d1120a856bd65553bf92b4bc6380c15e81cc7), [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a), [`c600ce0`](https://github.com/cloudflare/workers-sdk/commit/c600ce0a45ad334a5a961cf7774758860581d9d2), [`f509d13`](https://github.com/cloudflare/workers-sdk/commit/f509d13b97a832a28ed6bc568c7bcf6fc7d4a4ff), [`3b81fc6`](https://github.com/cloudflare/workers-sdk/commit/3b81fc6a75857d5c158824f17d9316adc55878fc), [`0a7fef9`](https://github.com/cloudflare/workers-sdk/commit/0a7fef9ee924b6d0817a69be9d893dc8a40c9a19)]: + - wrangler@4.75.0 + - miniflare@4.20260317.0 + ## 1.29.0 ### Minor Changes @@ -320,7 +332,6 @@ 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` @@ -1024,7 +1035,6 @@ 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. @@ -1277,7 +1287,6 @@ 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 diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/basic/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/basic/package.json index f8dbac8ee1c2..66b48bef2614 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/basic/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/basic/package.json @@ -20,14 +20,14 @@ "@eslint/js": "^9.19.0", "@types/react": "19.1.0", "@types/react-dom": "19.1.0", - "@vitejs/plugin-react": "^4.7.0", + "@vitejs/plugin-react": "^5.2.0", "eslint": "^9.19.0", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.18", "globals": "^15.14.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/dynamic/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/dynamic/package.json index 7429e1e93146..fc481c9dfe7b 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/dynamic/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/dynamic/package.json @@ -20,7 +20,7 @@ "globals": "^15.14.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-worker-environment-options/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-worker-environment-options/package.json index a81da2a7a630..0b827037b518 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-worker-environment-options/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-worker-environment-options/package.json @@ -7,7 +7,7 @@ }, "devDependencies": { "@cloudflare/vite-plugin": "*", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-wrangler-version/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-wrangler-version/package.json index 522302c00438..a9a6e8563899 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-wrangler-version/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/invalid-wrangler-version/package.json @@ -20,7 +20,7 @@ "globals": "^15.14.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^6.1.0", + "vite": "^8.0.0", "wrangler": "4.20.0" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/no-wrangler-config-for-auxiliary-worker/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/no-wrangler-config-for-auxiliary-worker/package.json index 9743e359b974..22380a04c814 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/no-wrangler-config-for-auxiliary-worker/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/no-wrangler-config-for-auxiliary-worker/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@cloudflare/vite-plugin": "*", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/dependency-import/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/dependency-import/package.json index c146bc0d0727..5d78d08b8069 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/dependency-import/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/dependency-import/package.json @@ -10,7 +10,7 @@ }, "devDependencies": { "@cloudflare/vite-plugin": "*", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/direct-import/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/direct-import/package.json index c80d9306d3a3..64009ca8700d 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/direct-import/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/nodejs-compat-warnings/direct-import/package.json @@ -7,7 +7,7 @@ }, "devDependencies": { "@cloudflare/vite-plugin": "*", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-config-account-id/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-config-account-id/package.json index b06a0a400ad4..6b24dc62f728 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-config-account-id/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-config-account-id/package.json @@ -21,7 +21,7 @@ "miniflare": "*", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-disabled/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-disabled/package.json index ca71628296e2..051cd534b3b3 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-disabled/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-disabled/package.json @@ -20,7 +20,7 @@ "globals": "^15.14.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-incorrect-r2-config/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-incorrect-r2-config/package.json index 2b3300a630ab..4d4d7d5378e4 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-incorrect-r2-config/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings-incorrect-r2-config/package.json @@ -20,7 +20,7 @@ "globals": "^15.14.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings/package.json index 689543d48bab..8103274e3669 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/remote-bindings/package.json @@ -20,7 +20,7 @@ "globals": "^15.14.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/e2e/fixtures/unresolved-main/package.json b/packages/vite-plugin-cloudflare/e2e/fixtures/unresolved-main/package.json index d6fb30d581e4..605f2ad1dde9 100644 --- a/packages/vite-plugin-cloudflare/e2e/fixtures/unresolved-main/package.json +++ b/packages/vite-plugin-cloudflare/e2e/fixtures/unresolved-main/package.json @@ -7,7 +7,7 @@ }, "devDependencies": { "@cloudflare/vite-plugin": "*", - "vite": "^7.0.0", + "vite": "^8.0.0", "wrangler": "*" } } diff --git a/packages/vite-plugin-cloudflare/package.json b/packages/vite-plugin-cloudflare/package.json index 8f7e3a134901..86164beacc91 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.0", + "version": "1.29.1", "description": "Cloudflare plugin for Vite", "keywords": [ "cloudflare", @@ -71,6 +71,7 @@ "tsdown": "0.16.3", "typescript": "catalog:default", "vite": "catalog:vite-plugin", + "vite-legacy": "npm:vite@7.1.12", "vitest": "catalog:vitest-3" }, "peerDependencies": { diff --git a/packages/vite-plugin-cloudflare/playground/module-resolution/__tests__/base-tests.ts b/packages/vite-plugin-cloudflare/playground/module-resolution/__tests__/base-tests.ts index c161e90e9de6..eeae8f6d53e0 100644 --- a/packages/vite-plugin-cloudflare/playground/module-resolution/__tests__/base-tests.ts +++ b/packages/vite-plugin-cloudflare/playground/module-resolution/__tests__/base-tests.ts @@ -105,8 +105,7 @@ describe("module resolution", async () => { expect(result).toEqual({ "(slash-create/web) VERSION": "6.2.1", "(slash-create/web) myCollection.random()": 54321, - "(slash-create/web) slashCreatorInstance is instance of SlashCreator": - true, + "(slash-create/web) slashCreatorInstance is instance of SlashCreator": true, }); }); }); diff --git a/packages/vite-plugin-cloudflare/playground/partyserver/package.json b/packages/vite-plugin-cloudflare/playground/partyserver/package.json index 440dd81d57ed..8de10a77b16a 100644 --- a/packages/vite-plugin-cloudflare/playground/partyserver/package.json +++ b/packages/vite-plugin-cloudflare/playground/partyserver/package.json @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "partyserver": "^0.0.64", - "partysocket": "^1.0.3", + "partyserver": "^0.3.3", + "partysocket": "^1.1.16", "react": "^19.2.1", "react-dom": "^19.2.1" }, @@ -21,7 +21,7 @@ "@tailwindcss/vite": "^4.0.15", "@types/react": "19.1.0", "@types/react-dom": "19.1.0", - "@vitejs/plugin-react": "^4.7.0", + "@vitejs/plugin-react": "^5.2.0", "tailwindcss": "^4.0.15", "typescript": "catalog:default", "vite": "catalog:vite-plugin", diff --git a/packages/vite-plugin-cloudflare/playground/react-spa/package.json b/packages/vite-plugin-cloudflare/playground/react-spa/package.json index fc60e8e2ecfc..cfed635a2cf5 100644 --- a/packages/vite-plugin-cloudflare/playground/react-spa/package.json +++ b/packages/vite-plugin-cloudflare/playground/react-spa/package.json @@ -19,7 +19,7 @@ "@cloudflare/workers-types": "catalog:default", "@types/react": "19.1.0", "@types/react-dom": "19.1.0", - "@vitejs/plugin-react": "^4.7.0", + "@vitejs/plugin-react": "^5.2.0", "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "workspace:*" diff --git a/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json b/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json index a225edafe30c..0e21ffecf6a4 100644 --- a/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json +++ b/packages/vite-plugin-cloudflare/playground/spa-with-api/package.json @@ -26,7 +26,7 @@ "@types/react": "19.1.0", "@types/react-dom": "19.1.0", "@vitejs/plugin-basic-ssl": "^2.0.0", - "@vitejs/plugin-react": "^4.7.0", + "@vitejs/plugin-react": "^5.2.0", "typescript": "catalog:default", "vite": "catalog:vite-plugin", "wrangler": "workspace:*" diff --git a/packages/vite-plugin-cloudflare/src/cloudflare-environment.ts b/packages/vite-plugin-cloudflare/src/cloudflare-environment.ts index fc22adf10808..672bb89131ac 100644 --- a/packages/vite-plugin-cloudflare/src/cloudflare-environment.ts +++ b/packages/vite-plugin-cloudflare/src/cloudflare-environment.ts @@ -291,7 +291,6 @@ export function createCloudflareEnvironmentOptions({ noDiscovery: false, // Workaround for https://github.com/vitejs/vite/issues/20867 // Longer term solution is to use full-bundle mode rather than `optimizeDeps` - // @ts-expect-error - option added in Vite 7.3.1 ignoreOutdatedRequests: true, // We need to normalize the path as it is treated as a glob and backslashes are therefore treated as escape characters. entries: vite.normalizePath(workerConfig.main), @@ -316,7 +315,6 @@ export function createCloudflareEnvironmentOptions({ }, plugins: [ // In Vite 8, `require` calls are not automatically replaced when the format is ESM and `platform` is `neutral` - // @ts-expect-error: added in Vite 8 vite.esmExternalRequirePlugin({ external: [nodeBuiltinsRE], skipDuplicateCheck: true, diff --git a/packages/vite-plugin-cloudflare/src/context.ts b/packages/vite-plugin-cloudflare/src/context.ts index 71f700194bfd..fd58f91ba571 100644 --- a/packages/vite-plugin-cloudflare/src/context.ts +++ b/packages/vite-plugin-cloudflare/src/context.ts @@ -214,8 +214,9 @@ export class PluginContext { } } -interface NarrowedPluginContext - extends PluginContext { +interface NarrowedPluginContext< + T extends ResolvedPluginConfig, +> extends PluginContext { readonly resolvedPluginConfig: T; } diff --git a/packages/vite-plugin-cloudflare/src/miniflare-options.ts b/packages/vite-plugin-cloudflare/src/miniflare-options.ts index d6e846d6e000..c6974aba80be 100644 --- a/packages/vite-plugin-cloudflare/src/miniflare-options.ts +++ b/packages/vite-plugin-cloudflare/src/miniflare-options.ts @@ -29,7 +29,7 @@ import { getContainerOptions, getDockerPath } from "./containers"; import { getInputInspectorPort } from "./debug"; import { additionalModuleRE } from "./plugins/additional-modules"; import { ENVIRONMENT_NAME_HEADER } from "./shared"; -import { withTrailingSlash } from "./utils"; +import { satisfiesViteVersion, withTrailingSlash } from "./utils"; import type { CloudflareDevEnvironment } from "./cloudflare-environment"; import type { ContainerTagToOptionsMap } from "./containers"; import type { @@ -80,10 +80,13 @@ function getPersistenceRoot( // to paths ensures correct names. This requires us to specify `contents` in // the miniflare module definitions though, as the new paths don't exist. const miniflareModulesRoot = process.platform === "win32" ? "Z:\\" : "/"; -const ROUTER_WORKER_PATH = "./workers/router-worker.js"; -const ASSET_WORKER_PATH = "./workers/asset-worker.js"; -const VITE_PROXY_WORKER_PATH = "./workers/vite-proxy-worker.js"; -const RUNNER_PATH = "./workers/runner-worker.js"; +const ROUTER_WORKER_PATH = "./workers/router-worker/index.js"; +const ASSET_WORKER_PATH = "./workers/asset-worker/index.js"; +const VITE_PROXY_WORKER_PATH = "./workers/vite-proxy-worker/index.js"; +const RUNNER_PATH = "./workers/runner-worker/index.js"; +const MODULE_RUNNER_PATH = "./workers/runner-worker/module-runner.js"; +const MODULE_RUNNER_LEGACY_PATH = + "./workers/runner-worker/module-runner-legacy.js"; const WRAPPER_PATH = "__VITE_WORKER_ENTRY__"; /** Map that maps worker configPaths to their existing remote proxy session data (if any) */ @@ -347,6 +350,27 @@ export async function getDevMiniflareOptions( fileURLToPath(new URL(RUNNER_PATH, import.meta.url)) ), }, + // A breaking change to the module runner was introduced in + // https://github.com/vitejs/vite/pull/20924 and released in Vite 7.2.0. + // We ship two bundled copies of vite/module-runner and select the + // appropriate one based on the user's installed Vite version. + { + type: "ESModule", + path: path.join( + miniflareModulesRoot, + "workers/runner-worker/vite/module-runner" + ), + contents: fs.readFileSync( + fileURLToPath( + new URL( + satisfiesViteVersion("7.2.0") + ? MODULE_RUNNER_PATH + : MODULE_RUNNER_LEGACY_PATH, + import.meta.url + ) + ) + ), + }, ], unsafeUseModuleFallbackService: true, unsafeInspectorProxy: inputInspectorPort !== false, diff --git a/packages/vite-plugin-cloudflare/src/plugins/nodejs-compat.ts b/packages/vite-plugin-cloudflare/src/plugins/nodejs-compat.ts index 36bf907bf186..986457399f95 100644 --- a/packages/vite-plugin-cloudflare/src/plugins/nodejs-compat.ts +++ b/packages/vite-plugin-cloudflare/src/plugins/nodejs-compat.ts @@ -50,7 +50,6 @@ export const nodeJsCompatPlugin = createPlugin("nodejs-compat", (ctx) => { rolldownOptions: { plugins: [ // In Vite 8, `require` calls are not automatically replaced when the format is ESM and `platform` is `neutral` - // @ts-expect-error: added in Vite 8 vite.esmExternalRequirePlugin({ external: [...nodeJsCompat.externals], skipDuplicateCheck: true, diff --git a/packages/vite-plugin-cloudflare/src/workers-configs.ts b/packages/vite-plugin-cloudflare/src/workers-configs.ts index c0cda76adeb7..bfca1a48174c 100644 --- a/packages/vite-plugin-cloudflare/src/workers-configs.ts +++ b/packages/vite-plugin-cloudflare/src/workers-configs.ts @@ -12,14 +12,12 @@ export type WorkerResolvedConfig = | AssetsOnlyWorkerResolvedConfig | WorkerWithServerLogicResolvedConfig; -export interface AssetsOnlyWorkerResolvedConfig - extends WorkerBaseResolvedConfig { +export interface AssetsOnlyWorkerResolvedConfig extends WorkerBaseResolvedConfig { type: "assets-only"; config: ResolvedAssetsOnlyConfig; } -export interface WorkerWithServerLogicResolvedConfig - extends WorkerBaseResolvedConfig { +export interface WorkerWithServerLogicResolvedConfig extends WorkerBaseResolvedConfig { type: "worker"; config: ResolvedWorkerConfig; } diff --git a/packages/vite-plugin-cloudflare/src/workers/runner-worker/module-runner.ts b/packages/vite-plugin-cloudflare/src/workers/runner-worker/module-runner.ts index 41f1f7f6fb12..7f934a49801c 100644 --- a/packages/vite-plugin-cloudflare/src/workers/runner-worker/module-runner.ts +++ b/packages/vite-plugin-cloudflare/src/workers/runner-worker/module-runner.ts @@ -267,9 +267,8 @@ async function createModuleRunner( }, async runExternalModule(filepath) { if (filepath === "cloudflare:workers") { - const originalCloudflareWorkersModule = await import( - "cloudflare:workers" - ); + const originalCloudflareWorkersModule = + await import("cloudflare:workers"); return Object.seal({ ...originalCloudflareWorkersModule, diff --git a/packages/vite-plugin-cloudflare/tsdown.config.ts b/packages/vite-plugin-cloudflare/tsdown.config.ts index cfad46d45968..e55421e04a1a 100644 --- a/packages/vite-plugin-cloudflare/tsdown.config.ts +++ b/packages/vite-plugin-cloudflare/tsdown.config.ts @@ -23,7 +23,14 @@ export default defineConfig([ }, worker("asset-worker"), worker("router-worker"), - worker("runner-worker", { noExternal: ["vite/module-runner"] }), + worker("runner-worker", { + entry: { + index: "src/workers/runner-worker/index.ts", + "module-runner": "vite/module-runner", + "module-runner-legacy": "vite-legacy/module-runner", + }, + external: ["cloudflare:workers", "vite/module-runner"], + }), worker("vite-proxy-worker"), ]); @@ -32,8 +39,8 @@ export default defineConfig([ */ function worker(name: string, options: UserConfig = {}): UserConfig { return { - entry: { [name]: `src/workers/${name}/index.ts` }, - outDir: "dist/workers", + entry: { index: `src/workers/${name}/index.ts` }, + outDir: `dist/workers/${name}`, platform: "neutral", inputOptions: { resolve: { diff --git a/packages/vitest-pool-workers/CHANGELOG.md b/packages/vitest-pool-workers/CHANGELOG.md index d077b3d31cc5..69643d043fb0 100644 --- a/packages/vitest-pool-workers/CHANGELOG.md +++ b/packages/vitest-pool-workers/CHANGELOG.md @@ -1,5 +1,13 @@ # @cloudflare/vitest-pool-workers +## 0.13.2 + +### Patch Changes + +- Updated dependencies [[`c9b3184`](https://github.com/cloudflare/workers-sdk/commit/c9b31840631585418b8926e8228db486b619b4c7), [`13df6c7`](https://github.com/cloudflare/workers-sdk/commit/13df6c75be49ac32fc1c57e2e24523e86ced2115), [`df0d112`](https://github.com/cloudflare/workers-sdk/commit/df0d1120a856bd65553bf92b4bc6380c15e81cc7), [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a), [`c600ce0`](https://github.com/cloudflare/workers-sdk/commit/c600ce0a45ad334a5a961cf7774758860581d9d2), [`f509d13`](https://github.com/cloudflare/workers-sdk/commit/f509d13b97a832a28ed6bc568c7bcf6fc7d4a4ff), [`3b81fc6`](https://github.com/cloudflare/workers-sdk/commit/3b81fc6a75857d5c158824f17d9316adc55878fc), [`0a7fef9`](https://github.com/cloudflare/workers-sdk/commit/0a7fef9ee924b6d0817a69be9d893dc8a40c9a19)]: + - wrangler@4.75.0 + - miniflare@4.20260317.0 + ## 0.13.1 ### Patch Changes @@ -208,7 +216,6 @@ - [#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) @@ -224,7 +231,6 @@ 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 @@ -273,7 +279,6 @@ 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` @@ -311,7 +316,6 @@ ### 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. @@ -356,7 +360,6 @@ - [#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. @@ -624,7 +627,6 @@ - [#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. @@ -1257,7 +1259,6 @@ - [#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 @@ -1269,7 +1270,6 @@ 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 @@ -1326,7 +1326,6 @@ ``` 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: @@ -1351,7 +1350,6 @@ 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 @@ -1360,7 +1358,6 @@ ``` - 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 @@ -1376,7 +1373,6 @@ ``` 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 diff --git a/packages/vitest-pool-workers/package.json b/packages/vitest-pool-workers/package.json index 43535aa4904d..e0e00f285b82 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.1", + "version": "0.13.2", "description": "Workers Vitest integration for writing Vitest unit and integration tests that run inside the Workers runtime", "keywords": [ "cloudflare", diff --git a/packages/vitest-pool-workers/src/worker/index.ts b/packages/vitest-pool-workers/src/worker/index.ts index 534cb66c4b24..c9163bc1b140 100644 --- a/packages/vitest-pool-workers/src/worker/index.ts +++ b/packages/vitest-pool-workers/src/worker/index.ts @@ -189,9 +189,8 @@ export class __VITEST_POOL_WORKERS_RUNNER_DURABLE_OBJECT__ extends DurableObject cwd = wd.cwd; - const { init, runBaseTests, setupEnvironment } = await import( - "vitest/worker" - ); + const { init, runBaseTests, setupEnvironment } = + await import("vitest/worker"); poolSocket.accept(); diff --git a/packages/vitest-pool-workers/src/worker/node/console.ts b/packages/vitest-pool-workers/src/worker/node/console.ts index 1ec811d02f3c..c6892e313f07 100644 --- a/packages/vitest-pool-workers/src/worker/node/console.ts +++ b/packages/vitest-pool-workers/src/worker/node/console.ts @@ -31,7 +31,7 @@ export class Console { this.#stdout = opts.stdout; this.#stderr = opts.stderr ?? this.#stdout; const colors = - typeof opts.colorMode === "string" ? false : opts.colorMode ?? false; + typeof opts.colorMode === "string" ? false : (opts.colorMode ?? false); this.#inspectOptions = opts.inspectOptions ?? { colors }; // Ensure methods are bound to the instance diff --git a/packages/vitest-pool-workers/src/worker/workflows.ts b/packages/vitest-pool-workers/src/worker/workflows.ts index 220f7e25de64..8e7d72f0f675 100644 --- a/packages/vitest-pool-workers/src/worker/workflows.ts +++ b/packages/vitest-pool-workers/src/worker/workflows.ts @@ -40,9 +40,7 @@ export async function introspectWorkflowInstance( return new WorkflowInstanceIntrospectorHandle(workflow, instanceId); } -class WorkflowInstanceIntrospectorHandle - implements WorkflowInstanceIntrospector -{ +class WorkflowInstanceIntrospectorHandle implements WorkflowInstanceIntrospector { #workflow: WorkflowBinding; #instanceId: string; #instanceModifier: WorkflowInstanceModifier | undefined; diff --git a/packages/vitest-pool-workers/test/helpers.ts b/packages/vitest-pool-workers/test/helpers.ts index 77bb3575f0cd..3461fcfaf0c8 100644 --- a/packages/vitest-pool-workers/test/helpers.ts +++ b/packages/vitest-pool-workers/test/helpers.ts @@ -15,7 +15,7 @@ const debuglog = util.debuglog("vitest-pool-workers:test"); export const vitestConfig = ( cfOptions: Record = {}, testOptions: Record = {} -) => dedent/* javascript */ ` +) => dedent /* javascript */ ` import { cloudflareTest } from "@cloudflare/vitest-pool-workers" import { BaseSequencer } from "vitest/node"; diff --git a/packages/vitest-pool-workers/test/isolation.test.ts b/packages/vitest-pool-workers/test/isolation.test.ts index d6085a816281..67d8e239a04f 100644 --- a/packages/vitest-pool-workers/test/isolation.test.ts +++ b/packages/vitest-pool-workers/test/isolation.test.ts @@ -8,7 +8,7 @@ test( // Check unique global scopes, storage isolated, and unique auxiliaries: // https://developers.cloudflare.com/workers/testing/vitest-integration/isolation-and-concurrency/#isolatedstorage-true-singleworker-false-default await seed({ - "auxiliary.mjs": dedent/* javascript */ ` + "auxiliary.mjs": dedent /* javascript */ ` let count = 0; export default { fetch() { @@ -31,7 +31,7 @@ test( ], }, }), - "a.test.ts": dedent/* javascript */ ` + "a.test.ts": dedent /* javascript */ ` import { env } from "cloudflare:test"; import { it, expect } from "vitest"; it("does something", async () => { @@ -45,7 +45,7 @@ test( expect(await response.text()).toBe("1"); }); `, - "b.test.ts": dedent/* javascript */ ` + "b.test.ts": dedent /* javascript */ ` import { env } from "cloudflare:test"; import { it, expect } from "vitest"; it("does something else", async () => { @@ -95,7 +95,7 @@ test( ], }, }), - "a.test.ts": dedent/* javascript */ ` + "a.test.ts": dedent /* javascript */ ` import { env } from "cloudflare:test"; import { it, expect } from "vitest"; it("does something", async () => { @@ -106,7 +106,7 @@ test( expect(await response.text()).toBe("1"); }); `, - "b.test.ts": dedent/* javascript */ ` + "b.test.ts": dedent /* javascript */ ` import { env } from "cloudflare:test"; import { it, expect } from "vitest"; it("does something else", async () => { @@ -130,7 +130,7 @@ test( async ({ expect, seed, vitestRun }) => { // With --no-isolate --max-workers=1, test files share globals, storage, and auxiliaries await seed({ - "auxiliary.mjs": dedent/* javascript */ ` + "auxiliary.mjs": dedent /* javascript */ ` let count = 0; export default { fetch() { @@ -153,7 +153,7 @@ test( ], }, }), - "a.test.ts": dedent/* javascript */ ` + "a.test.ts": dedent /* javascript */ ` import { env } from "cloudflare:test"; import { it, expect } from "vitest"; it("does something", async () => { @@ -167,7 +167,7 @@ test( expect(await response.text()).toBe("1"); }); `, - "b.test.ts": dedent/* javascript */ ` + "b.test.ts": dedent /* javascript */ ` import { env } from "cloudflare:test"; import { it, expect } from "vitest"; it("does something else", async () => { diff --git a/packages/vitest-pool-workers/test/validation.test.ts b/packages/vitest-pool-workers/test/validation.test.ts index 51122c1a15e3..322e6ec5ac11 100644 --- a/packages/vitest-pool-workers/test/validation.test.ts +++ b/packages/vitest-pool-workers/test/validation.test.ts @@ -67,7 +67,7 @@ test( compatibilityFlags: ["nodejs_compat"], }, }), - "index.test.ts": dedent/* javascript */ ` + "index.test.ts": dedent /* javascript */ ` import { SELF } from "cloudflare:test"; import { it, expect } from "vitest"; it("sends request", async () => { @@ -92,7 +92,7 @@ test( compatibilityFlags: ["nodejs_compat"], }, }), - "index.ts": dedent/* javascript */ ` + "index.ts": dedent /* javascript */ ` addEventListener("fetch", (event) => { event.respondWith(new Response("body")); }); diff --git a/packages/vitest-pool-workers/test/watch.test.ts b/packages/vitest-pool-workers/test/watch.test.ts index c2d0bf5fc58f..81eaa9a730f2 100644 --- a/packages/vitest-pool-workers/test/watch.test.ts +++ b/packages/vitest-pool-workers/test/watch.test.ts @@ -11,14 +11,14 @@ test("automatically re-runs unit tests", async ({ }) => { await seed({ "vitest.config.mts": vitestConfig(), - "index.ts": dedent/* javascript */ ` + "index.ts": dedent /* javascript */ ` export default { async fetch(request, env, ctx) { return new Response("wrong"); } } `, - "index.test.ts": dedent/* javascript */ ` + "index.test.ts": dedent /* javascript */ ` import { env, createExecutionContext, waitOnExecutionContext } from "cloudflare:test"; import { it, expect } from "vitest"; import worker from "./index"; @@ -38,7 +38,7 @@ test("automatically re-runs unit tests", async ({ }); await seed({ - "index.ts": dedent/* javascript */ ` + "index.ts": dedent /* javascript */ ` export default { async fetch(request, env, ctx) { return new Response("correct"); @@ -64,14 +64,14 @@ test("automatically re-runs integration tests", async ({ compatibilityFlags: ["nodejs_compat"], }, }), - "index.ts": dedent/* javascript */ ` + "index.ts": dedent /* javascript */ ` export default { async fetch(request, env, ctx) { return new Response("wrong"); } } `, - "index.test.ts": dedent/* javascript */ ` + "index.test.ts": dedent /* javascript */ ` import { SELF } from "cloudflare:test"; import { it, expect } from "vitest"; it("sends request", async () => { @@ -87,7 +87,7 @@ test("automatically re-runs integration tests", async ({ }); await seed({ - "index.ts": dedent/* javascript */ ` + "index.ts": dedent /* javascript */ ` export default { async fetch(request, env, ctx) { return new Response("correct"); @@ -113,12 +113,12 @@ test("automatically reset module graph", async ({ compatibilityFlags: ["nodejs_compat"], }, }), - "answer.ts": dedent/* javascript */ ` + "answer.ts": dedent /* javascript */ ` export function getAnswer() { return "wrong"; } `, - "index.ts": dedent/* javascript */ ` + "index.ts": dedent /* javascript */ ` import { getAnswer } from "./answer"; export default { @@ -128,7 +128,7 @@ test("automatically reset module graph", async ({ } } `, - "index.test.ts": dedent/* javascript */ ` + "index.test.ts": dedent /* javascript */ ` import { env, createExecutionContext, waitOnExecutionContext } from "cloudflare:test"; import { it, expect, vi } from "vitest"; import worker from "./index"; @@ -155,7 +155,7 @@ test("automatically reset module graph", async ({ // Trigger a re-run by updating the test file with an extra test. await seed({ - "index.test.ts": dedent/* javascript */ ` + "index.test.ts": dedent /* javascript */ ` import { env, createExecutionContext, waitOnExecutionContext } from "cloudflare:test"; import { it, expect, vi } from "vitest"; import worker from "./index"; diff --git a/packages/workers-playground/src/index.css b/packages/workers-playground/src/index.css index 24ff9f97641d..23b329091fd9 100644 --- a/packages/workers-playground/src/index.css +++ b/packages/workers-playground/src/index.css @@ -1,8 +1,8 @@ :root { /* Font stack taken from workers.cloudflare.com */ - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", + "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; line-height: 1.5; font-weight: 400; diff --git a/packages/workers-shared/asset-worker/src/handler.ts b/packages/workers-shared/asset-worker/src/handler.ts index 85c133a1e240..c6ac33feccfe 100644 --- a/packages/workers-shared/asset-worker/src/handler.ts +++ b/packages/workers-shared/asset-worker/src/handler.ts @@ -109,7 +109,7 @@ const getResponseOrAssetIntent = async ( location: encodedDestination !== pathname ? encodedDestination - : intent.redirect ?? "", + : (intent.redirect ?? ""), status: TemporaryRedirectResponse.status, }); diff --git a/packages/workers-utils/src/config/environment.ts b/packages/workers-utils/src/config/environment.ts index 26bd4e48aba1..e44df3fc0132 100644 --- a/packages/workers-utils/src/config/environment.ts +++ b/packages/workers-utils/src/config/environment.ts @@ -7,8 +7,7 @@ import type { Json } from "../types"; * This could be the top-level default environment, or a specific named environment. */ export interface Environment - extends EnvironmentInheritable, - EnvironmentNonInheritable {} + extends EnvironmentInheritable, EnvironmentNonInheritable {} type SimpleRoute = string; export type ZoneIdRoute = { diff --git a/packages/workers-utils/src/config/validation.ts b/packages/workers-utils/src/config/validation.ts index 0dff9e292b86..9f8d6885f5de 100644 --- a/packages/workers-utils/src/config/validation.ts +++ b/packages/workers-utils/src/config/validation.ts @@ -699,7 +699,7 @@ function normalizeAndValidateDev( inspector_ip, local_protocol = localProtocolArg ?? "http", // In remote mode upstream_protocol must be https, otherwise it defaults to local_protocol. - upstream_protocol = upstreamProtocolArg ?? remoteArg + upstream_protocol = (upstreamProtocolArg ?? remoteArg) ? "https" : local_protocol, host, diff --git a/packages/wrangler/CHANGELOG.md b/packages/wrangler/CHANGELOG.md index a5394cc5cbe5..f515b2f14621 100644 --- a/packages/wrangler/CHANGELOG.md +++ b/packages/wrangler/CHANGELOG.md @@ -1,5 +1,64 @@ # wrangler +## 4.75.0 + +### Minor Changes + +- [#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 + - `wrangler tunnel delete ` - Delete a tunnel (with confirmation) + - `wrangler tunnel run ` - Run a tunnel using cloudflared + - `wrangler tunnel quick-start ` - Start a temporary tunnel (Try Cloudflare) + + The `run` and `quick-start` commands automatically download and manage the cloudflared binary, caching it in `~/.wrangler/cloudflared/`. Users are prompted before downloading and warned if their PATH-installed cloudflared is outdated. You can override the binary location with the `CLOUDFLARED_PATH` environment variable. + + All commands are marked as experimental. + +### Patch Changes + +- [#12927](https://github.com/cloudflare/workers-sdk/pull/12927) [`c9b3184`](https://github.com/cloudflare/workers-sdk/commit/c9b31840631585418b8926e8228db486b619b4c7) Thanks [@penalosa](https://github.com/penalosa)! - Bump undici from 7.18.2 to 7.24.4 + +- [#12875](https://github.com/cloudflare/workers-sdk/pull/12875) [`13df6c7`](https://github.com/cloudflare/workers-sdk/commit/13df6c75be49ac32fc1c57e2e24523e86ced2115) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "miniflare", "wrangler" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ---------- | ------------ | ------------ | + | workerd | 1.20260312.1 | 1.20260316.1 | + +- [#12935](https://github.com/cloudflare/workers-sdk/pull/12935) [`df0d112`](https://github.com/cloudflare/workers-sdk/commit/df0d1120a856bd65553bf92b4bc6380c15e81cc7) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update dependencies of "miniflare", "wrangler" + + The following dependency versions have been updated: + + | Dependency | From | To | + | ---------- | ------------ | ------------ | + | workerd | 1.20260316.1 | 1.20260317.1 | + +- [#12928](https://github.com/cloudflare/workers-sdk/pull/12928) [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a) Thanks [@petebacondarwin](https://github.com/petebacondarwin)! - Migrate chrome-devtools-patches deployment from Cloudflare Pages to Workers + Assets + + The DevTools frontend is now deployed as a Cloudflare Workers + Assets project instead of a Cloudflare Pages project. This uses `wrangler deploy` for production deployments and `wrangler versions upload` for PR preview deployments. + + The inspector proxy origin allowlists in both wrangler and miniflare have been updated to accept connections from the new `workers.dev` domain patterns, while retaining the legacy `pages.dev` patterns for backward compatibility. + +- [#12835](https://github.com/cloudflare/workers-sdk/pull/12835) [`c600ce0`](https://github.com/cloudflare/workers-sdk/commit/c600ce0a45ad334a5a961cf7774758860581d9d2) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - Fix execution freezing on `debugger` statements when DevTools is not attached + + Previously, `wrangler` always sent `Debugger.enable` to the runtime on connection, even when DevTools wasn't open. This caused scripts to freeze on `debugger` statements. Now `Debugger.enable` is only sent when DevTools is actually attached, and `Debugger.disable` is sent when DevTools disconnects to stop the runtime from performing debugging work. + +- [#12894](https://github.com/cloudflare/workers-sdk/pull/12894) [`f509d13`](https://github.com/cloudflare/workers-sdk/commit/f509d13b97a832a28ed6bc568c7bcf6fc7d4a4ff) Thanks [@gpanders](https://github.com/gpanders)! - Simplify description of --json option + + Remove extraneous adjectives in the description of the `--json` option. + +- [#11888](https://github.com/cloudflare/workers-sdk/pull/11888) [`0a7fef9`](https://github.com/cloudflare/workers-sdk/commit/0a7fef9ee924b6d0817a69be9d893dc8a40c9a19) Thanks [@staticpayload](https://github.com/staticpayload)! - Reject cross-drive module paths in Pages Functions routing + + On Windows, module paths using a different drive letter could be parsed in a way that bypassed the project-root check. These paths are now parsed correctly and rejected when they resolve outside the project. + +- Updated dependencies [[`c9b3184`](https://github.com/cloudflare/workers-sdk/commit/c9b31840631585418b8926e8228db486b619b4c7), [`13df6c7`](https://github.com/cloudflare/workers-sdk/commit/13df6c75be49ac32fc1c57e2e24523e86ced2115), [`df0d112`](https://github.com/cloudflare/workers-sdk/commit/df0d1120a856bd65553bf92b4bc6380c15e81cc7), [`81ee98e`](https://github.com/cloudflare/workers-sdk/commit/81ee98e6a0c6be879757289ef6e34e1559d6ee2a)]: + - miniflare@4.20260317.0 + ## 4.74.0 ### Minor Changes @@ -99,7 +158,6 @@ - [#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` @@ -459,7 +517,6 @@ - [#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 @@ -532,7 +589,6 @@ - [#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 @@ -603,7 +659,6 @@ ``` 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) @@ -643,7 +698,6 @@ - [#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) @@ -667,7 +721,6 @@ - [#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 @@ -737,13 +790,11 @@ 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. @@ -782,7 +833,6 @@ 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` @@ -839,7 +889,6 @@ 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) @@ -894,7 +943,6 @@ 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 @@ -1038,11 +1086,9 @@ 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. @@ -1078,13 +1124,11 @@ 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` @@ -1130,7 +1174,6 @@ - [#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 @@ -1244,7 +1287,6 @@ - [#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 @@ -1417,7 +1459,6 @@ - [#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 @@ -1580,7 +1621,6 @@ ``` 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 @@ -1610,7 +1650,6 @@ 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. @@ -1629,14 +1668,12 @@ - [#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") @@ -1669,7 +1706,6 @@ 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` @@ -1709,7 +1745,6 @@ - [#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 @@ -1841,7 +1876,6 @@ - [#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 @@ -2400,7 +2434,6 @@ - [#10923](https://github.com/cloudflare/workers-sdk/pull/10923) [`2429533`](https://github.com/cloudflare/workers-sdk/commit/2429533d7c6810165761aad828462614c50a585f) Thanks [@emily-shen](https://github.com/emily-shen)! - fix: update `docker manifest inspect` to use full image registry uri when checking if the image exists remotely - [#10521](https://github.com/cloudflare/workers-sdk/pull/10521) [`88b5b7f`](https://github.com/cloudflare/workers-sdk/commit/88b5b7ff1ace3bf982d2562ad1e01e39ffce9517) Thanks [@penalosa](https://github.com/penalosa)! - Improves the Wrangler auto-provisioning feature (gated behind the experimental flag `--x-provision`) by: - - Writing back changes to the user's config file (not necessary, but can make it resilient to binding name changes) - Fixing `--dry-run`, which previously threw an error when your config file had auto provisioned resources - Improve R2 bindings display to include the `bucket_name` from the config file on upload @@ -2411,7 +2444,6 @@ ### 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]` @@ -2791,7 +2823,6 @@ 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. @@ -3044,7 +3075,6 @@ 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. @@ -3222,7 +3252,6 @@ - [#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 @@ -3244,7 +3273,6 @@ - [#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 @@ -3488,7 +3516,6 @@ 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 @@ -3529,7 +3556,6 @@ - [#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 @@ -3608,7 +3634,6 @@ ### 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 @@ -3633,7 +3658,6 @@ - [#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. @@ -3652,7 +3676,6 @@ 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 @@ -3662,7 +3685,6 @@ 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. @@ -3833,7 +3855,6 @@ - [#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` @@ -4024,7 +4045,6 @@ - [#8711](https://github.com/cloudflare/workers-sdk/pull/8711) [`4cc036d`](https://github.com/cloudflare/workers-sdk/commit/4cc036d46b2f5c3ceacb344882e713e7840becde) Thanks [@CarmenPopoviciu](https://github.com/CarmenPopoviciu)! - Add the Pages deployment id to the JSON output for `wrangler pages deployment list` - [#8244](https://github.com/cloudflare/workers-sdk/pull/8244) [`84ecfe9`](https://github.com/cloudflare/workers-sdk/commit/84ecfe9b4962d1edbe7967cfe4151f26de252a9d) Thanks [@CarmenPopoviciu](https://github.com/CarmenPopoviciu)! - feat: Add debug logs to capture assets upload status, specifically: - - which asset files were read from the file system - which files were successfully uploaded @@ -4076,7 +4096,6 @@ 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 @@ -4096,7 +4115,6 @@ ### 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` @@ -4107,7 +4125,6 @@ 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 @@ -4326,7 +4343,6 @@ - [#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` @@ -4369,14 +4385,12 @@ - [#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 *` @@ -4389,7 +4403,6 @@ - [#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 @@ -4401,7 +4414,6 @@ 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 @@ -4458,7 +4470,6 @@ ``` 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: @@ -4483,7 +4494,6 @@ 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 @@ -4492,7 +4502,6 @@ ``` - 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 @@ -4508,7 +4517,6 @@ ``` 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 @@ -4738,7 +4746,6 @@ 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/ @@ -4912,7 +4919,6 @@ - [#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 @@ -4939,11 +4945,9 @@ 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 @@ -5011,7 +5015,6 @@ - [#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 @@ -5174,7 +5177,6 @@ ### Affected commands The commands that use this feature are: - - `wrangler deploy` - `wrangler dev` - `wrangler versions upload` @@ -5198,7 +5200,6 @@ ### 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 @@ -5315,7 +5316,6 @@ - [#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,7 +5351,6 @@ 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` @@ -5455,7 +5454,6 @@ - [#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) @@ -5610,7 +5608,6 @@ - [#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 @@ -6196,7 +6193,6 @@ 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/\*" @@ -6489,7 +6485,6 @@ - [#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 @@ -6573,7 +6568,6 @@ - [#6295](https://github.com/cloudflare/workers-sdk/pull/6295) [`ebc85c3`](https://github.com/cloudflare/workers-sdk/commit/ebc85c362a424778b7f0565217488504bd42964e) Thanks [@andyjessop](https://github.com/andyjessop)! - feat: introduce an experimental flag for `wrangler types` to dynamically generate runtime types according to the user's project configuration. - [#6272](https://github.com/cloudflare/workers-sdk/pull/6272) [`084d39e`](https://github.com/cloudflare/workers-sdk/commit/084d39e15e35471fabfb789dd280afe16a919fcf) Thanks [@emily-shen](https://github.com/emily-shen)! - fix: add `legacy-assets` config and flag as alias of current `assets` behavior - - The existing behavior of the `assets` config key/flag will change on August 15th. - `legacy-assets` will preserve current functionality. @@ -6671,7 +6665,6 @@ make sure that the same behavior is applied to the `ctx` object returned by `getPlatformProxy` - [#5569](https://github.com/cloudflare/workers-sdk/pull/5569) [`75ba960`](https://github.com/cloudflare/workers-sdk/commit/75ba9608faa9e5710fe1dc75b5852ae446696245) Thanks [@penalosa](https://github.com/penalosa)! - fix: Simplify `wrangler pages download config`: - - Don't include inheritable keys in the production override if they're equal to production - Only create a preview environment if needed, otherwise put the preview config at the top level @@ -6866,7 +6859,6 @@ - [#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. @@ -7054,7 +7046,6 @@ ``` 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 @@ -7108,7 +7099,6 @@ ### 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. @@ -7500,7 +7490,6 @@ - [#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`) @@ -7936,7 +7925,6 @@ 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. @@ -8520,7 +8508,6 @@ 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 @@ -8771,7 +8758,6 @@ * [#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 @@ -9146,7 +9132,6 @@ `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. @@ -9435,7 +9420,6 @@ ### Minor Changes - [#3098](https://github.com/cloudflare/workers-sdk/pull/3098) [`8818f551`](https://github.com/cloudflare/workers-sdk/commit/8818f5516ca909cc941deb953b6359030a8c0301) Thanks [@mrbbot](https://github.com/mrbbot)! - fix: improve Workers Sites asset upload reliability - - Wrangler no longer buffers all assets into memory before uploading. This should prevent out-of-memory errors when publishing sites with many large files. - Wrangler now limits the number of in-flight asset upload requests to 5, fixing the `Too many bulk operations already in progress` error. - Wrangler now correctly logs upload progress. Previously, the reported percentage was per upload request group, not across all assets. @@ -9613,7 +9597,6 @@ 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 @@ -9763,7 +9746,6 @@ 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 @@ -10203,7 +10185,6 @@ 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 @@ -10463,7 +10444,6 @@ rozenmd@cflaptop test1 % npx wrangler d1 execute test --command="select * from c ### Minor Changes - [#2107](https://github.com/cloudflare/workers-sdk/pull/2107) [`511943e9`](https://github.com/cloudflare/workers-sdk/commit/511943e9226f787aa997a325d39dc2caac05a73c) Thanks [@celso](https://github.com/celso)! - fix: D1 execute and backup commands improvements - - Better and faster handling when importing big SQL files using execute --file - Increased visibility during imports, sends output with each batch API call - Backups are now downloaded to the directory where wrangler was initiated from @@ -10596,7 +10576,6 @@ 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 @@ -10793,7 +10772,6 @@ 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 @@ -11041,7 +11019,6 @@ 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. @@ -11050,7 +11027,6 @@ 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 @@ -11078,7 +11054,6 @@ 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 @@ -11142,7 +11117,6 @@ 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 @@ -11332,7 +11306,6 @@ 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