Skip to content

Commit 85d0336

Browse files
penalosalrapoport-cfemily-shen
authored
Apply suggestions from code review
Co-authored-by: lrapoport-cf <[email protected]> Co-authored-by: emily-shen <[email protected]>
1 parent 048d519 commit 85d0336

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

src/content/changelog/workers/2025-03-13-wrangler-v4.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ date: 2025-02-28T22:30:00Z
88

99
import { PackageManagers } from "~/components";
1010

11-
We've released the next major version of [Wrangler](/workers/wrangler/), the CLI for Cloudflare Workers — `[email protected]`.
11+
We've released the next major version of [Wrangler](/workers/wrangler/), the CLI for Cloudflare Workers — `[email protected]`. Wrangler v4 is a major release focused on updates to underlying systems and dependencies, along with improvements to keep Wrangler commands consistent and clear.
1212

1313
You can run the following command to install it in your projects:
1414

src/content/docs/pages/functions/typescript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you already have a `tsconfig.json` at the root of your project, you may wish
4242
}
4343
```
4444

45-
Pages Functions can be typed using the `PagesFunction` type. This type accepts an `Env` parameter. The `Env` type should also have been generated by `wrangler types` and can be found at the top of `types.d.ts`.
45+
Pages Functions can be typed using the `PagesFunction` type. This type accepts an `Env` parameter. The `Env` type should have been generated by `wrangler types` and can be found at the top of `types.d.ts`.
4646

4747
Alternatively, you can define the `Env` type manually. For example:
4848

@@ -57,7 +57,7 @@ export const onRequest: PagesFunction<Env> = async (context) => {
5757
};
5858
```
5959

60-
If you are using `nodejs_compat`, you should also make sure you have installed `@types/node` and updated your `tsconfig.json`.
60+
If you are using `nodejs_compat`, make sure you have installed `@types/node` and updated your `tsconfig.json`.
6161

6262
```json
6363
{

src/content/docs/workers/languages/typescript/index.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This means the correct types for your Worker depend on:
2828
3. Your Worker's bindings, which are accessed on the `env` object.
2929
4. Any [module rules](/workers/wrangler/configuration/#inheritable-keys) you have specified in your Wrangler configuration file under `rules`.
3030

31-
For example, the runtime will onlly allow you to use the [`AsyncLocalStorage`](https://nodejs.org/api/async_context.html#class-asynclocalstorage) class if you have `compatibility_flags = ["nodejs_als"]` in your [Wrangler configuration file](/workers/wrangler/configuration/). This should be reflected in the type definitions.
31+
For example, the runtime will only allow you to use the [`AsyncLocalStorage`](https://nodejs.org/api/async_context.html#class-asynclocalstorage) class if you have `compatibility_flags = ["nodejs_als"]` in your [Wrangler configuration file](/workers/wrangler/configuration/). This should be reflected in the type definitions.
3232

3333
To ensure that your type definitions always match your Worker's configuration, you can dynamically generate types by running:
3434

@@ -58,7 +58,13 @@ To ensure that your types are always up-to-date, make sure to run `wrangler type
5858
Migrating from `@cloudflare/workers-types` to `wrangler types`
5959
</h3>
6060

61-
We recommend you use `wrangler types` to generate runtime types, rather than using the `@cloudflare/workers-types` package, as it generates types based on your Worker's [compatibility date](https://github.com/cloudflare/workerd/tree/main/npm/workers-types#compatibility-dates) and `compatibility flags`, ensuring that types match the exact runtime APIs made available to your Worker. Note that there are no plans to stop publishing the `@cloudflare/workers-types` package.
61+
We recommend you use `wrangler types` to generate runtime types, rather than using the `@cloudflare/workers-types` package, as it generates types based on your Worker's [compatibility date](https://github.com/cloudflare/workerd/tree/main/npm/workers-types#compatibility-dates) and `compatibility flags`, ensuring that types match the exact runtime APIs made available to your Worker.
62+
63+
:::note
64+
65+
There are no plans to stop publishing the `@cloudflare/workers-types` package, which will still be the recommended way to type libraries and shared packages in the workers environment.
66+
67+
:::
6268

6369
#### 1. Uninstall `@cloudflare/workers-types`
6470

@@ -157,4 +163,3 @@ We recommend you commit your generated types file for use in CI. Alternatively,
157163
- [@cloudflare/workers-types](https://github.com/cloudflare/workers-types)
158164
- [Runtime APIs](/workers/runtime-apis/)
159165
- [TypeScript Examples](/workers/examples/?languages=TypeScript)
160-
- [test link](/workers/languages/typescript/#type-short)

src/content/docs/workers/wrangler/migration/update-v3-to-v4.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77

88
Wrangler v4 is a major release focused on updates to underlying systems and dependencies, along with improvements to keep Wrangler commands consistent and clear. Unlike previous major versions of Wrangler, which were [foundational rewrites](https://blog.cloudflare.com/wrangler-v2-beta/) and [rearchitectures](https://blog.cloudflare.com/wrangler3/) — Version 4 of Wrangler includes a much smaller set of changes. If you use Wrangler today, your workflow is very unlikely to change.
99

10-
While many users should expect a no-op upgrade, the following sections outline significant changes and steps for migrating where necessary.
10+
While many users should expect a no-op upgrade, the following sections outline the more significant changes and steps for migrating where necessary.
1111

1212
### Summary of changes
1313

@@ -16,7 +16,7 @@ While many users should expect a no-op upgrade, the following sections outline s
1616

1717
- **esbuild Version Upgrade**: Wrangler v4 uses [esbuild](https://esbuild.github.io/) to bundle Worker code before deploying it, and was previously pinned to esbuild v0.17.19. Wrangler v4 uses esbuild v0.24, which could impact dynamic wildcard imports.
1818

19-
- **Commands default to local mode**: All commands now run in local mode by default, requiring a `--remote` flag for API queries,
19+
- **Commands default to local mode**: All commands that can run in either local or remote mode now default to local, requiring a `--remote` flag for API queries.
2020

2121
- **Deprecated commands and configurations removed:** Legacy commands, flags, and configurations have been removed.
2222

@@ -45,10 +45,10 @@ All commands now run in **local mode by default.** Wrangler has many commands fo
4545

4646
For example:
4747

48-
- **Previous Behavior (Wrangler v3):** `wrangler kv list` queried remotely by default.
49-
- **New Behavior (Wrangler v4):** `wrangler kv list` queries locally unless `--remote` is specified.
48+
- **Previous Behavior (Wrangler v3):** `wrangler kv get` queried remotely by default.
49+
- **New Behavior (Wrangler v4):** `wrangler kv get` queries locally unless `--remote` is specified.
5050

51-
Those using `wrangler kv` and/or `wrangler r2` commands to query or write to their data store will need to add the `--remote` flag in order to replicate previous behavior.
51+
Those using `wrangler kv key` and/or `wrangler r2 object` commands to query or write to their data store will need to add the `--remote` flag in order to replicate previous behavior.
5252

5353
### Deprecated Commands and Configurations Removed
5454

0 commit comments

Comments
 (0)