wrangler 2.2.3 → 2.2.4

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": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -57,15 +57,15 @@ describe("deployments", () => {
57
57
  "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
58
58
 
59
59
 
60
- Deployment ID: Intrepid-Class
61
- Created on: 2021-02-02T00:00:00.000000Z
62
- Author: Kathryn-Janeway@federation.org
63
- Source: Wrangler
64
-
65
60
  Deployment ID: Galaxy-Class
66
61
  Created on: 2021-01-01T00:00:00.000000Z
67
62
  Author: Jean-Luc-Picard@federation.org
68
63
  Source: Wrangler
64
+
65
+ Deployment ID: Intrepid-Class
66
+ Created on: 2021-02-02T00:00:00.000000Z
67
+ Author: Kathryn-Janeway@federation.org
68
+ Source: Wrangler
69
69
  🟩 Active"
70
70
  `);
71
71
  });
@@ -76,15 +76,15 @@ describe("deployments", () => {
76
76
  "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
77
77
 
78
78
 
79
- Deployment ID: Intrepid-Class
80
- Created on: 2021-02-02T00:00:00.000000Z
81
- Author: Kathryn-Janeway@federation.org
82
- Source: Wrangler
83
-
84
79
  Deployment ID: Galaxy-Class
85
80
  Created on: 2021-01-01T00:00:00.000000Z
86
81
  Author: Jean-Luc-Picard@federation.org
87
82
  Source: Wrangler
83
+
84
+ Deployment ID: Intrepid-Class
85
+ Created on: 2021-02-02T00:00:00.000000Z
86
+ Author: Kathryn-Janeway@federation.org
87
+ Source: Wrangler
88
88
  🟩 Active"
89
89
  `);
90
90
  });
@@ -4,7 +4,7 @@ import type { DeploymentListRes } from "../../../../deployments";
4
4
 
5
5
  export const mswSuccessDeployments = [
6
6
  rest.get(
7
- "*/accounts/:accountId/workers/versions/by-script/:scriptTag",
7
+ "*/accounts/:accountId/workers/deployments/by-script/:scriptTag",
8
8
  (_, response, context) =>
9
9
  response.once(
10
10
  context.status(200),
@@ -65,7 +65,7 @@ describe("publish", () => {
65
65
  })
66
66
  );
67
67
  setMockResponse(
68
- "/accounts/:accountId/workers/versions/by-script/:scriptTag",
68
+ "/accounts/:accountId/workers/deployments/by-script/:scriptTag",
69
69
  () => ({
70
70
  latest: { number: "2" },
71
71
  })
@@ -4363,7 +4363,7 @@ addEventListener('fetch', event => {});`
4363
4363
  },
4364
4364
  });
4365
4365
  setMockResponse(
4366
- "/accounts/:accountId/workers/versions/by-script/:scriptTag",
4366
+ "/accounts/:accountId/workers/deployments/by-script/:scriptTag",
4367
4367
  () => ({
4368
4368
  latest: { number: "2" },
4369
4369
  })
@@ -6861,7 +6861,7 @@ addEventListener('fetch', event => {});`
6861
6861
  mockSubDomainRequest();
6862
6862
  mockUploadWorkerRequest();
6863
6863
  setMockResponse(
6864
- "/accounts/:accountId/workers/versions/by-script/:scriptTag",
6864
+ "/accounts/:accountId/workers/deployments/by-script/:scriptTag",
6865
6865
  () => ({
6866
6866
  latest: { number: "2" },
6867
6867
  })
@@ -6907,7 +6907,7 @@ addEventListener('fetch', event => {});`
6907
6907
  }
6908
6908
  );
6909
6909
  setMockResponse(
6910
- "/accounts/:accountId/workers/versions/by-script/:scriptTag",
6910
+ "/accounts/:accountId/workers/deployments/by-script/:scriptTag",
6911
6911
  () => ({
6912
6912
  latest: { number: "2" },
6913
6913
  })
@@ -4,11 +4,8 @@ import { mockConsoleMethods } from "./helpers/mock-console";
4
4
  import { runInTempDir } from "./helpers/run-in-tmp";
5
5
  import { runWrangler } from "./helpers/run-wrangler";
6
6
  import type { Config } from "../config";
7
- import type { CfWorkerInit } from "../worker";
8
7
 
9
- const bindingsConfigMock: CfWorkerInit["bindings"] & {
10
- rules: Config["rules"];
11
- } = {
8
+ const bindingsConfigMock: Partial<Config> = {
12
9
  kv_namespaces: [{ binding: "TEST_KV_NAMESPACE", id: "1234" }],
13
10
  vars: {
14
11
  SOMETHING: "asdasdfasdf",
@@ -19,6 +16,22 @@ const bindingsConfigMock: CfWorkerInit["bindings"] & {
19
16
  captian: "Picard",
20
17
  }, // We can assume the objects will be stringified
21
18
  },
19
+ queues: {
20
+ producers: [
21
+ {
22
+ binding: "TEST_QUEUE_BINDING",
23
+ queue: "TEST_QUEUE",
24
+ },
25
+ ],
26
+ consumers: [
27
+ {
28
+ queue: "my-queue",
29
+ max_batch_size: 10,
30
+ max_batch_timeout: 1,
31
+ max_retries: 3,
32
+ },
33
+ ],
34
+ },
22
35
  durable_objects: {
23
36
  bindings: [
24
37
  { name: "DURABLE_TEST1", class_name: "Durability1" },
@@ -33,7 +46,6 @@ const bindingsConfigMock: CfWorkerInit["bindings"] & {
33
46
  ],
34
47
  d1_databases: [
35
48
  {
36
- // @ts-expect-error This type is resolved in the function that handles creating BETA string
37
49
  binding: "D1_TESTING_SOMETHING",
38
50
  database_name: "D1_BINDING",
39
51
  database_id: "1234",
@@ -56,12 +68,9 @@ const bindingsConfigMock: CfWorkerInit["bindings"] & {
56
68
  SOME_TEXT_BLOB2: "SOME_TEXT_BLOB2.txt",
57
69
  },
58
70
  wasm_modules: { MODULE1: "module1.wasm", MODULE2: "module2.wasm" },
59
- unsafe: [
60
- {
61
- // @ts-expect-error Unsafe bindings type is somewhat different in different places
62
- bindings: [{ name: "testing_unsafe", type: "plain_text" }],
63
- },
64
- ],
71
+ unsafe: {
72
+ bindings: [{ name: "testing_unsafe", type: "plain_text" }],
73
+ },
65
74
  rules: [
66
75
  {
67
76
  type: "Text",
@@ -89,10 +98,9 @@ describe("generateTypes()", () => {
89
98
  compatibility_date: "2022-01-12",
90
99
  name: "test-name",
91
100
  main: "./index.ts",
92
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
- ...(bindingsConfigMock as any),
94
- unsafe: bindingsConfigMock.unsafe?.at(0) ?? {},
95
- }),
101
+ ...bindingsConfigMock,
102
+ unsafe: bindingsConfigMock.unsafe ?? {},
103
+ } as unknown as TOML.JsonMap),
96
104
  "utf-8"
97
105
  );
98
106
 
@@ -115,6 +123,7 @@ describe("generateTypes()", () => {
115
123
  SOME_TEXT_BLOB1: string;
116
124
  SOME_TEXT_BLOB2: string;
117
125
  testing_unsafe: any;
126
+ TEST_QUEUE_BINDING: Queue;
118
127
  }
119
128
  declare module \\"*.txt\\" {
120
129
  const value: string;
@@ -139,9 +148,9 @@ describe("generateTypes()", () => {
139
148
  compatibility_date: "2022-01-12",
140
149
  name: "test-name",
141
150
  main: "./index.ts",
142
- // @ts-expect-error This type is out of sync with the actual bindingsConfig type
143
151
  vars: bindingsConfigMock.vars,
144
- }),
152
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
+ } as any),
145
154
  "utf-8"
146
155
  );
147
156
  await runWrangler("types");
@@ -159,6 +168,7 @@ describe("generateTypes()", () => {
159
168
  }),
160
169
  "utf-8"
161
170
  );
171
+
162
172
  await runWrangler("types");
163
173
  expect(fs.existsSync("./worker-configuration.d.ts")).toBe(false);
164
174
  expect(std.out).toMatchInlineSnapshot(`""`);
@@ -176,9 +186,8 @@ describe("generateTypes()", () => {
176
186
  compatibility_date: "2022-01-12",
177
187
  name: "test-name",
178
188
  main: "./index.ts",
179
- // @ts-expect-error This type is out of sync with the actual bindingsConfig type
180
189
  vars: bindingsConfigMock.vars,
181
- }),
190
+ } as TOML.JsonMap),
182
191
  "utf-8"
183
192
  );
184
193
 
@@ -200,9 +209,8 @@ describe("generateTypes()", () => {
200
209
  compatibility_date: "2022-01-12",
201
210
  name: "test-name",
202
211
  main: "./index.ts",
203
- // @ts-expect-error This type is out of sync with the actual bindingsConfig type
204
- unsafe: bindingsConfigMock.unsafe?.at(0) ?? {},
205
- }),
212
+ unsafe: bindingsConfigMock.unsafe ?? {},
213
+ } as TOML.JsonMap),
206
214
  "utf-8"
207
215
  );
208
216
 
@@ -1,3 +1,4 @@
1
+ import { URLSearchParams } from "url";
1
2
  import { fetchResult } from "./cfetch";
2
3
  import { logger } from "./logger";
3
4
  import type { ServiceMetadataRes } from "./init";
@@ -40,8 +41,11 @@ export async function deployments(
40
41
  );
41
42
 
42
43
  const scriptTag = scriptMetadata.default_environment.script.tag;
44
+ const params = new URLSearchParams({ order: "asc" });
43
45
  const { items: deploys } = await fetchResult<DeploymentListRes>(
44
- `/accounts/${accountId}/workers/versions/by-script/${scriptTag}`
46
+ `/accounts/${accountId}/workers/deployments/by-script/${scriptTag}`,
47
+ undefined,
48
+ params
45
49
  );
46
50
 
47
51
  const versionMessages = deploys.map(
@@ -52,8 +56,8 @@ Author: ${versions.metadata.author_email}
52
56
  Source: ${sourceStr(versions.metadata.source)}\n`
53
57
  );
54
58
 
55
- versionMessages[0] += "🟩 Active";
56
- logger.log(...versionMessages.reverse());
59
+ versionMessages[versionMessages.length - 1] += "🟩 Active";
60
+ logger.log(...versionMessages);
57
61
  }
58
62
 
59
63
  // TODO Include emoji/icon for each source
package/src/index.tsx CHANGED
@@ -50,7 +50,6 @@ import {
50
50
  import { whoami } from "./whoami";
51
51
 
52
52
  import type { Config } from "./config";
53
- import type { PartialConfigToDTS } from "./type-generation";
54
53
  import type { CommonYargsOptions } from "./yargs-types";
55
54
  import type { ArgumentsCamelCase } from "yargs";
56
55
  import type Yargs from "yargs";
@@ -527,7 +526,7 @@ export function createCLIParser(argv: string[]) {
527
526
  await printWranglerBanner();
528
527
  const config = readConfig(undefined, {});
529
528
 
530
- const configBindings: PartialConfigToDTS = {
529
+ const configBindings: Partial<Config> = {
531
530
  kv_namespaces: config.kv_namespaces ?? [],
532
531
  vars: { ...config.vars },
533
532
  wasm_modules: config.wasm_modules,
@@ -537,13 +536,13 @@ export function createCLIParser(argv: string[]) {
537
536
  data_blobs: config.data_blobs,
538
537
  durable_objects: config.durable_objects,
539
538
  r2_buckets: config.r2_buckets,
540
- // @ts-expect-error - We don't want the type generated to inlcude the Beta prefix
541
539
  d1_databases: config.d1_databases,
542
540
  services: config.services,
543
541
  dispatch_namespaces: config.dispatch_namespaces,
544
542
  logfwdr: config.logfwdr,
545
- unsafe: config.unsafe?.bindings,
543
+ unsafe: { bindings: config.unsafe?.bindings },
546
544
  rules: config.rules,
545
+ queues: config.queues,
547
546
  };
548
547
 
549
548
  await generateTypes(configBindings, config);
@@ -821,13 +821,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
821
821
 
822
822
  try {
823
823
  const deploymentsList = await fetchResult<DeploymentListRes>(
824
- `/accounts/${accountId}/workers/versions/by-script/${scriptTag}`
824
+ `/accounts/${accountId}/workers/deployments/by-script/${scriptTag}`
825
825
  );
826
826
 
827
827
  logger.log("Current Deployment ID:", deploymentsList.latest.id);
828
828
  } catch (e) {
829
829
  if ((e as { code: number }).code === 10023) {
830
- // TODO: remove this try/catch once versions is completely rolled out
830
+ // TODO: remove this try/catch once deployments is completely rolled out
831
831
  } else {
832
832
  throw e;
833
833
  }
@@ -3,14 +3,11 @@ import { findUpSync } from "find-up";
3
3
  import { getEntry } from "./entry";
4
4
  import { logger } from "./logger";
5
5
  import type { Config } from "./config";
6
- import type { CfWorkerInit } from "./worker";
7
6
 
8
7
  // Currently includes bindings & rules for declaring modules
9
- export type PartialConfigToDTS = CfWorkerInit["bindings"] & {
10
- rules: Config["rules"];
11
- };
8
+
12
9
  export async function generateTypes(
13
- configToDTS: PartialConfigToDTS,
10
+ configToDTS: Partial<Config>,
14
11
  config: Config
15
12
  ) {
16
13
  const entry = await getEntry({}, config, "types");
@@ -85,11 +82,19 @@ export async function generateTypes(
85
82
  }
86
83
 
87
84
  if (configToDTS.unsafe) {
88
- for (const unsafe of configToDTS.unsafe) {
85
+ for (const unsafe of configToDTS.unsafe.bindings) {
89
86
  envTypeStructure.push(` ${unsafe.name}: any;`);
90
87
  }
91
88
  }
92
89
 
90
+ if (configToDTS.queues) {
91
+ if (configToDTS.queues.producers) {
92
+ for (const queue of configToDTS.queues.producers) {
93
+ envTypeStructure.push(` ${queue.binding}: Queue;`);
94
+ }
95
+ }
96
+ }
97
+
93
98
  const modulesTypeStructure: string[] = [];
94
99
  if (configToDTS.rules) {
95
100
  const moduleTypeMap = {
@@ -113,47 +118,56 @@ export async function generateTypes(
113
118
  }
114
119
  }
115
120
 
116
- function writeDTSFile(
117
- typesString: string[],
118
- formatType: "modules" | "service-worker"
119
- ) {
120
- const wranglerOverrideDTSPath = findUpSync("worker-configuration.d.ts");
121
- try {
122
- if (
123
- wranglerOverrideDTSPath !== undefined &&
124
- !fs
125
- .readFileSync(wranglerOverrideDTSPath, "utf8")
126
- .includes("***AUTO GENERATED BY WORKERS CLI WRANGLER***")
127
- ) {
128
- throw new Error(
129
- "A non-wrangler worker-configuration.d.ts already exists, please rename and try again."
130
- );
131
- }
132
- } catch (error) {
133
- if (error instanceof Error && !error.message.includes("not found")) {
134
- throw error;
135
- }
136
- }
137
-
138
- let combinedTypeStrings = "";
139
- if (formatType === "modules") {
140
- combinedTypeStrings = `interface Env {\n${typesString.join(
141
- "\n"
142
- )} \n}\n${modulesTypeStructure.join("\n")}`;
143
- } else {
144
- combinedTypeStrings = `declare global {\n${typesString.join(
145
- "\n"
146
- )} \n}\n${modulesTypeStructure.join("\n")}`;
147
- }
121
+ writeDTSFile({
122
+ envTypeStructure,
123
+ modulesTypeStructure,
124
+ formatType: entry.format,
125
+ });
126
+ }
148
127
 
149
- if (envTypeStructure.length || modulesTypeStructure.length) {
150
- fs.writeFileSync(
151
- "worker-configuration.d.ts",
152
- `// Generated by Wrangler on ${new Date()}` + "\n" + combinedTypeStrings
128
+ function writeDTSFile({
129
+ envTypeStructure,
130
+ modulesTypeStructure,
131
+ formatType,
132
+ }: {
133
+ envTypeStructure: string[];
134
+ modulesTypeStructure: string[];
135
+ formatType: "modules" | "service-worker";
136
+ }) {
137
+ const wranglerOverrideDTSPath = findUpSync("worker-configuration.d.ts");
138
+ try {
139
+ if (
140
+ wranglerOverrideDTSPath !== undefined &&
141
+ !fs
142
+ .readFileSync(wranglerOverrideDTSPath, "utf8")
143
+ .includes("Generated by Wrangler")
144
+ ) {
145
+ throw new Error(
146
+ "A non-wrangler worker-configuration.d.ts already exists, please rename and try again."
153
147
  );
154
- logger.log(combinedTypeStrings);
155
148
  }
149
+ } catch (error) {
150
+ if (error instanceof Error && !error.message.includes("not found")) {
151
+ throw error;
152
+ }
153
+ }
154
+
155
+ let combinedTypeStrings = "";
156
+ if (formatType === "modules") {
157
+ combinedTypeStrings += `interface Env {\n${envTypeStructure.join(
158
+ "\n"
159
+ )} \n}\n${modulesTypeStructure.join("\n")}`;
160
+ } else {
161
+ combinedTypeStrings += `declare global {\n${envTypeStructure.join(
162
+ "\n"
163
+ )} \n}\n${modulesTypeStructure.join("\n")}`;
156
164
  }
157
165
 
158
- writeDTSFile(envTypeStructure, entry.format);
166
+ if (envTypeStructure.length || modulesTypeStructure.length) {
167
+ fs.writeFileSync(
168
+ "worker-configuration.d.ts",
169
+ `// Generated by Wrangler on ${new Date()}` + "\n" + combinedTypeStrings
170
+ );
171
+ logger.log(combinedTypeStrings);
172
+ }
159
173
  }
@@ -141159,7 +141159,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
141159
141159
  var wrapper_default = import_websocket.default;
141160
141160
 
141161
141161
  // package.json
141162
- var version = "2.2.3";
141162
+ var version = "2.2.4";
141163
141163
  var package_default = {
141164
141164
  name: "wrangler",
141165
141165
  version,
@@ -147432,7 +147432,7 @@ async function getMetricsDispatcher(options6) {
147432
147432
  }
147433
147433
  };
147434
147434
  async function dispatch(event) {
147435
- if (false) {
147435
+ if (!SPARROW_SOURCE_KEY) {
147436
147436
  logger.debug(
147437
147437
  "Metrics dispatcher: Source Key not provided. Be sure to initialize before sending events.",
147438
147438
  event
@@ -147465,7 +147465,7 @@ async function getMetricsDispatcher(options6) {
147465
147465
  headers: {
147466
147466
  Accept: "*/*",
147467
147467
  "Content-Type": "application/json",
147468
- "Sparrow-Source-Key": "50598e014ed44c739ec8074fdc16057c"
147468
+ "Sparrow-Source-Key": SPARROW_SOURCE_KEY
147469
147469
  },
147470
147470
  mode: "cors",
147471
147471
  keepalive: true,
@@ -154566,13 +154566,17 @@ async function deleteSiteNamespaceIfExisting(scriptName, accountId) {
154566
154566
 
154567
154567
  // src/deployments.ts
154568
154568
  init_import_meta_url();
154569
+ var import_url2 = require("url");
154569
154570
  async function deployments(accountId, scriptName) {
154570
154571
  const scriptMetadata = await fetchResult(
154571
154572
  `/accounts/${accountId}/workers/services/${scriptName}`
154572
154573
  );
154573
154574
  const scriptTag = scriptMetadata.default_environment.script.tag;
154575
+ const params = new import_url2.URLSearchParams({ order: "asc" });
154574
154576
  const { items: deploys } = await fetchResult(
154575
- `/accounts/${accountId}/workers/versions/by-script/${scriptTag}`
154577
+ `/accounts/${accountId}/workers/deployments/by-script/${scriptTag}`,
154578
+ void 0,
154579
+ params
154576
154580
  );
154577
154581
  const versionMessages = deploys.map(
154578
154582
  (versions) => `
@@ -154582,8 +154586,8 @@ Author: ${versions.metadata.author_email}
154582
154586
  Source: ${sourceStr(versions.metadata.source)}
154583
154587
  `
154584
154588
  );
154585
- versionMessages[0] += "\u{1F7E9} Active";
154586
- logger.log(...versionMessages.reverse());
154589
+ versionMessages[versionMessages.length - 1] += "\u{1F7E9} Active";
154590
+ logger.log(...versionMessages);
154587
154591
  }
154588
154592
  function sourceStr(source) {
154589
154593
  switch (source) {
@@ -160177,7 +160181,7 @@ ${dashLink}`);
160177
160181
  }
160178
160182
  try {
160179
160183
  const deploymentsList = await fetchResult(
160180
- `/accounts/${accountId}/workers/versions/by-script/${scriptTag}`
160184
+ `/accounts/${accountId}/workers/deployments/by-script/${scriptTag}`
160181
160185
  );
160182
160186
  logger.log("Current Deployment ID:", deploymentsList.latest.id);
160183
160187
  } catch (e2) {
@@ -162273,10 +162277,17 @@ async function generateTypes(configToDTS, config) {
162273
162277
  }
162274
162278
  }
162275
162279
  if (configToDTS.unsafe) {
162276
- for (const unsafe of configToDTS.unsafe) {
162280
+ for (const unsafe of configToDTS.unsafe.bindings) {
162277
162281
  envTypeStructure.push(` ${unsafe.name}: any;`);
162278
162282
  }
162279
162283
  }
162284
+ if (configToDTS.queues) {
162285
+ if (configToDTS.queues.producers) {
162286
+ for (const queue of configToDTS.queues.producers) {
162287
+ envTypeStructure.push(` ${queue.binding}: Queue;`);
162288
+ }
162289
+ }
162290
+ }
162280
162291
  const modulesTypeStructure = [];
162281
162292
  if (configToDTS.rules) {
162282
162293
  const moduleTypeMap = {
@@ -162296,45 +162307,53 @@ async function generateTypes(configToDTS, config) {
162296
162307
  }
162297
162308
  }
162298
162309
  }
162299
- function writeDTSFile(typesString, formatType) {
162300
- const wranglerOverrideDTSPath = findUpSync("worker-configuration.d.ts");
162301
- try {
162302
- if (wranglerOverrideDTSPath !== void 0 && !fs15.readFileSync(wranglerOverrideDTSPath, "utf8").includes("***AUTO GENERATED BY WORKERS CLI WRANGLER***")) {
162303
- throw new Error(
162304
- "A non-wrangler worker-configuration.d.ts already exists, please rename and try again."
162305
- );
162306
- }
162307
- } catch (error) {
162308
- if (error instanceof Error && !error.message.includes("not found")) {
162309
- throw error;
162310
- }
162310
+ writeDTSFile({
162311
+ envTypeStructure,
162312
+ modulesTypeStructure,
162313
+ formatType: entry.format
162314
+ });
162315
+ }
162316
+ function writeDTSFile({
162317
+ envTypeStructure,
162318
+ modulesTypeStructure,
162319
+ formatType
162320
+ }) {
162321
+ const wranglerOverrideDTSPath = findUpSync("worker-configuration.d.ts");
162322
+ try {
162323
+ if (wranglerOverrideDTSPath !== void 0 && !fs15.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
162324
+ throw new Error(
162325
+ "A non-wrangler worker-configuration.d.ts already exists, please rename and try again."
162326
+ );
162311
162327
  }
162312
- let combinedTypeStrings = "";
162313
- if (formatType === "modules") {
162314
- combinedTypeStrings = `interface Env {
162315
- ${typesString.join(
162316
- "\n"
162317
- )}
162328
+ } catch (error) {
162329
+ if (error instanceof Error && !error.message.includes("not found")) {
162330
+ throw error;
162331
+ }
162332
+ }
162333
+ let combinedTypeStrings = "";
162334
+ if (formatType === "modules") {
162335
+ combinedTypeStrings += `interface Env {
162336
+ ${envTypeStructure.join(
162337
+ "\n"
162338
+ )}
162318
162339
  }
162319
162340
  ${modulesTypeStructure.join("\n")}`;
162320
- } else {
162321
- combinedTypeStrings = `declare global {
162322
- ${typesString.join(
162323
- "\n"
162324
- )}
162341
+ } else {
162342
+ combinedTypeStrings += `declare global {
162343
+ ${envTypeStructure.join(
162344
+ "\n"
162345
+ )}
162325
162346
  }
162326
162347
  ${modulesTypeStructure.join("\n")}`;
162327
- }
162328
- if (envTypeStructure.length || modulesTypeStructure.length) {
162329
- fs15.writeFileSync(
162330
- "worker-configuration.d.ts",
162331
- `// Generated by Wrangler on ${new Date()}
162348
+ }
162349
+ if (envTypeStructure.length || modulesTypeStructure.length) {
162350
+ fs15.writeFileSync(
162351
+ "worker-configuration.d.ts",
162352
+ `// Generated by Wrangler on ${new Date()}
162332
162353
  ` + combinedTypeStrings
162333
- );
162334
- logger.log(combinedTypeStrings);
162335
- }
162354
+ );
162355
+ logger.log(combinedTypeStrings);
162336
162356
  }
162337
- writeDTSFile(envTypeStructure, entry.format);
162338
162357
  }
162339
162358
 
162340
162359
  // src/update-check.ts
@@ -162772,8 +162791,9 @@ function createCLIParser(argv) {
162772
162791
  services: config.services,
162773
162792
  dispatch_namespaces: config.dispatch_namespaces,
162774
162793
  logfwdr: config.logfwdr,
162775
- unsafe: config.unsafe?.bindings,
162776
- rules: config.rules
162794
+ unsafe: { bindings: config.unsafe?.bindings },
162795
+ rules: config.rules,
162796
+ queues: config.queues
162777
162797
  };
162778
162798
  await generateTypes(configBindings, config);
162779
162799
  }