wrangler 4.0.0-rc.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.0.0-rc.0",
3
+ "version": "4.1.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -50,18 +50,19 @@
50
50
  "config-schema.json"
51
51
  ],
52
52
  "dependencies": {
53
+ "@cloudflare/unenv-preset": "2.0.2",
53
54
  "blake3-wasm": "2.1.5",
54
55
  "esbuild": "0.24.2",
55
56
  "path-to-regexp": "6.3.0",
56
- "unenv": "2.0.0-rc.1",
57
- "workerd": "1.20250214.0",
58
- "miniflare": "4.20250214.0-rc.0",
59
- "@cloudflare/kv-asset-handler": "0.3.4"
57
+ "unenv": "2.0.0-rc.14",
58
+ "workerd": "1.20250317.0",
59
+ "@cloudflare/kv-asset-handler": "0.4.0",
60
+ "miniflare": "4.20250317.0"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@aws-sdk/client-s3": "^3.721.0",
63
64
  "@cloudflare/types": "6.18.4",
64
- "@cloudflare/workers-types": "^4.20250214.0",
65
+ "@cloudflare/workers-types": "^4.20250317.0",
65
66
  "@cspotcode/source-map-support": "0.8.1",
66
67
  "@iarna/toml": "^3.0.0",
67
68
  "@microsoft/api-extractor": "^7.47.0",
@@ -99,7 +100,6 @@
99
100
  "get-port": "^7.0.0",
100
101
  "glob-to-regexp": "^0.4.1",
101
102
  "https-proxy-agent": "7.0.2",
102
- "ignore": "^5.2.0",
103
103
  "is-ci": "^3.0.1",
104
104
  "itty-time": "^1.0.6",
105
105
  "javascript-time-ago": "^2.5.4",
@@ -137,12 +137,12 @@
137
137
  "yargs": "^17.7.2",
138
138
  "@cloudflare/cli": "1.1.1",
139
139
  "@cloudflare/eslint-config-worker": "1.1.0",
140
- "@cloudflare/pages-shared": "^0.13.10",
141
- "@cloudflare/workers-shared": "0.14.4",
140
+ "@cloudflare/pages-shared": "^0.13.15",
141
+ "@cloudflare/workers-shared": "0.16.0",
142
142
  "@cloudflare/workers-tsconfig": "0.0.0"
143
143
  },
144
144
  "peerDependencies": {
145
- "@cloudflare/workers-types": "^4.20250214.0"
145
+ "@cloudflare/workers-types": "^4.20250317.0"
146
146
  },
147
147
  "peerDependenciesMeta": {
148
148
  "@cloudflare/workers-types": {
@@ -167,7 +167,7 @@
167
167
  "build": "pnpm run clean && pnpm run bundle && pnpm run emit-types && pnpm run generate-json-schema",
168
168
  "bundle": "node -r esbuild-register scripts/bundle.ts",
169
169
  "check:lint": "eslint . --max-warnings=0",
170
- "check:type": "tsc",
170
+ "check:type": "tsc -p ./tsconfig.json && tsc -p ./templates/tsconfig.json",
171
171
  "clean": "rimraf wrangler-dist miniflare-dist emitted-types",
172
172
  "dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"",
173
173
  "emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
@@ -20,10 +20,11 @@ export default <ExportedHandler<{ ASSETS: Fetcher }>>{
20
20
 
21
21
  for (const include of routes.include) {
22
22
  if (isRoutingRuleMatch(pathname, include)) {
23
- if (worker.fetch === undefined) {
23
+ const workerAsHandler = worker as ExportedHandler;
24
+ if (workerAsHandler.fetch === undefined) {
24
25
  throw new TypeError("Entry point missing `fetch` handler");
25
26
  }
26
- return worker.fetch(request, env, context);
27
+ return workerAsHandler.fetch(request, env, context);
27
28
  }
28
29
  }
29
30
 
@@ -4,5 +4,12 @@
4
4
  "types": ["@cloudflare/workers-types"]
5
5
  },
6
6
  "include": ["**/*.ts"],
7
- "exclude": ["__tests__", "./init-tests/**"]
7
+ "exclude": [
8
+ "__tests__",
9
+ "./init-tests/**",
10
+ // Note: `startDevWorker` and `middleware` should also be included but some work is needed
11
+ // for that first (see: https://github.com/cloudflare/workers-sdk/issues/8303)
12
+ "startDevWorker",
13
+ "middleware"
14
+ ]
8
15
  }
@@ -74,20 +74,137 @@ declare type ApiCredentials = {
74
74
  declare type AssetConfig = z.infer<typeof AssetConfigSchema>;
75
75
 
76
76
  declare const AssetConfigSchema: z.ZodObject<{
77
+ account_id: z.ZodOptional<z.ZodNumber>;
78
+ script_id: z.ZodOptional<z.ZodNumber>;
79
+ compatibility_date: z.ZodOptional<z.ZodString>;
80
+ compatibility_flags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
77
81
  html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
78
82
  not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
79
- serve_directly: z.ZodOptional<z.ZodBoolean>;
80
- run_worker_first: z.ZodOptional<z.ZodBoolean>;
83
+ redirects: z.ZodOptional<z.ZodObject<{
84
+ version: z.ZodLiteral<1>;
85
+ staticRules: z.ZodRecord<z.ZodString, z.ZodObject<{
86
+ status: z.ZodNumber;
87
+ to: z.ZodString;
88
+ lineNumber: z.ZodNumber;
89
+ }, "strip", z.ZodTypeAny, {
90
+ status?: number;
91
+ to?: string;
92
+ lineNumber?: number;
93
+ }, {
94
+ status?: number;
95
+ to?: string;
96
+ lineNumber?: number;
97
+ }>>;
98
+ rules: z.ZodRecord<z.ZodString, z.ZodObject<{
99
+ status: z.ZodNumber;
100
+ to: z.ZodString;
101
+ }, "strip", z.ZodTypeAny, {
102
+ status?: number;
103
+ to?: string;
104
+ }, {
105
+ status?: number;
106
+ to?: string;
107
+ }>>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ version?: 1;
110
+ staticRules?: Record<string, {
111
+ status?: number;
112
+ to?: string;
113
+ lineNumber?: number;
114
+ }>;
115
+ rules?: Record<string, {
116
+ status?: number;
117
+ to?: string;
118
+ }>;
119
+ }, {
120
+ version?: 1;
121
+ staticRules?: Record<string, {
122
+ status?: number;
123
+ to?: string;
124
+ lineNumber?: number;
125
+ }>;
126
+ rules?: Record<string, {
127
+ status?: number;
128
+ to?: string;
129
+ }>;
130
+ }>>;
131
+ headers: z.ZodOptional<z.ZodObject<{
132
+ version: z.ZodLiteral<2>;
133
+ rules: z.ZodRecord<z.ZodString, z.ZodObject<{
134
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
135
+ unset: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ set?: Record<string, string>;
138
+ unset?: string[];
139
+ }, {
140
+ set?: Record<string, string>;
141
+ unset?: string[];
142
+ }>>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ version?: 2;
145
+ rules?: Record<string, {
146
+ set?: Record<string, string>;
147
+ unset?: string[];
148
+ }>;
149
+ }, {
150
+ version?: 2;
151
+ rules?: Record<string, {
152
+ set?: Record<string, string>;
153
+ unset?: string[];
154
+ }>;
155
+ }>>;
81
156
  }, "strip", z.ZodTypeAny, {
157
+ account_id?: number;
158
+ script_id?: number;
159
+ compatibility_date?: string;
160
+ compatibility_flags?: string[];
82
161
  html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
83
162
  not_found_handling?: "none" | "single-page-application" | "404-page";
84
- serve_directly?: boolean;
85
- run_worker_first?: boolean;
163
+ redirects?: {
164
+ version?: 1;
165
+ staticRules?: Record<string, {
166
+ status?: number;
167
+ to?: string;
168
+ lineNumber?: number;
169
+ }>;
170
+ rules?: Record<string, {
171
+ status?: number;
172
+ to?: string;
173
+ }>;
174
+ };
175
+ headers?: {
176
+ version?: 2;
177
+ rules?: Record<string, {
178
+ set?: Record<string, string>;
179
+ unset?: string[];
180
+ }>;
181
+ };
86
182
  }, {
183
+ account_id?: number;
184
+ script_id?: number;
185
+ compatibility_date?: string;
186
+ compatibility_flags?: string[];
87
187
  html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
88
188
  not_found_handling?: "none" | "single-page-application" | "404-page";
89
- serve_directly?: boolean;
90
- run_worker_first?: boolean;
189
+ redirects?: {
190
+ version?: 1;
191
+ staticRules?: Record<string, {
192
+ status?: number;
193
+ to?: string;
194
+ lineNumber?: number;
195
+ }>;
196
+ rules?: Record<string, {
197
+ status?: number;
198
+ to?: string;
199
+ }>;
200
+ };
201
+ headers?: {
202
+ version?: 2;
203
+ rules?: Record<string, {
204
+ set?: Record<string, string>;
205
+ unset?: string[];
206
+ }>;
207
+ };
91
208
  }>;
92
209
 
93
210
  declare type Assets = {
@@ -109,8 +226,10 @@ declare type Assets = {
109
226
  declare type AssetsOptions = {
110
227
  directory: string;
111
228
  binding?: string;
112
- routingConfig: RoutingConfig;
229
+ routerConfig: RouterConfig;
113
230
  assetConfig: AssetConfig;
231
+ _redirects?: string;
232
+ _headers?: string;
114
233
  };
115
234
 
116
235
  declare type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
@@ -25862,23 +25981,23 @@ declare namespace RetryHandler {
25862
25981
 
25863
25982
  declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
25864
25983
 
25865
- declare type RoutingConfig = z.infer<typeof RoutingConfigSchema>;
25984
+ declare type RouterConfig = z.infer<typeof RouterConfigSchema>;
25866
25985
 
25867
- declare const RoutingConfigSchema: z.ZodObject<{
25868
- has_user_worker: z.ZodOptional<z.ZodBoolean>;
25869
- invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
25986
+ declare const RouterConfigSchema: z.ZodObject<{
25870
25987
  account_id: z.ZodOptional<z.ZodNumber>;
25871
25988
  script_id: z.ZodOptional<z.ZodNumber>;
25989
+ invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
25990
+ has_user_worker: z.ZodOptional<z.ZodBoolean>;
25872
25991
  }, "strip", z.ZodTypeAny, {
25873
- has_user_worker?: boolean;
25874
- invoke_user_worker_ahead_of_assets?: boolean;
25875
25992
  account_id?: number;
25876
25993
  script_id?: number;
25877
- }, {
25878
- has_user_worker?: boolean;
25879
25994
  invoke_user_worker_ahead_of_assets?: boolean;
25995
+ has_user_worker?: boolean;
25996
+ }, {
25880
25997
  account_id?: number;
25881
25998
  script_id?: number;
25999
+ invoke_user_worker_ahead_of_assets?: boolean;
26000
+ has_user_worker?: boolean;
25882
26001
  }>;
25883
26002
 
25884
26003
  /**
@@ -26393,14 +26512,19 @@ export declare interface Unstable_DevWorker {
26393
26512
 
26394
26513
  export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
26395
26514
 
26396
- export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): Unstable_MiniflareWorkerOptions;
26515
+ export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string, options?: {
26516
+ imagesLocalMode: boolean;
26517
+ }): Unstable_MiniflareWorkerOptions;
26397
26518
 
26398
- export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string): Unstable_MiniflareWorkerOptions;
26519
+ export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string, options?: {
26520
+ imagesLocalMode: boolean;
26521
+ }): Unstable_MiniflareWorkerOptions;
26399
26522
 
26400
26523
  export declare interface Unstable_MiniflareWorkerOptions {
26401
26524
  workerOptions: SourcelessWorkerOptions;
26402
26525
  define: Record<string, string>;
26403
26526
  main?: string;
26527
+ externalWorkers: WorkerOptions[];
26404
26528
  }
26405
26529
 
26406
26530
  export declare const unstable_pages: {