wrangler 2.6.2 → 2.7.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.
Files changed (128) hide show
  1. package/bin/wrangler.js +9 -1
  2. package/miniflare-dist/index.mjs +1 -1
  3. package/package.json +12 -10
  4. package/src/__tests__/api-dev.test.ts +65 -36
  5. package/src/__tests__/api-devregistry.test.js +14 -6
  6. package/src/__tests__/configuration.test.ts +2 -31
  7. package/src/__tests__/{d1.test.ts → d1/d1.test.ts} +48 -5
  8. package/src/__tests__/d1/splitter.test.ts +255 -0
  9. package/src/__tests__/delete.test.ts +5 -2
  10. package/src/__tests__/deployments.test.ts +20 -6
  11. package/src/__tests__/dev.test.tsx +52 -19
  12. package/src/__tests__/generate.test.ts +7 -4
  13. package/src/__tests__/helpers/mock-auth-domain.ts +20 -0
  14. package/src/__tests__/helpers/mock-cfetch.ts +2 -57
  15. package/src/__tests__/helpers/mock-dialogs.ts +70 -86
  16. package/src/__tests__/helpers/mock-oauth-flow.ts +64 -49
  17. package/src/__tests__/helpers/mock-process.ts +8 -13
  18. package/src/__tests__/helpers/msw/blob-worker.cjs +19 -0
  19. package/src/__tests__/helpers/msw/read-file-sync.js +61 -0
  20. package/src/__tests__/index.test.ts +46 -44
  21. package/src/__tests__/init.test.ts +761 -537
  22. package/src/__tests__/jest.setup.ts +20 -24
  23. package/src/__tests__/kv.test.ts +286 -173
  24. package/src/__tests__/logout.test.ts +1 -1
  25. package/src/__tests__/metrics.test.ts +5 -7
  26. package/src/__tests__/middleware.scheduled.test.ts +40 -30
  27. package/src/__tests__/middleware.test.ts +144 -120
  28. package/src/__tests__/pages.test.ts +1617 -1161
  29. package/src/__tests__/publish.test.ts +174 -125
  30. package/src/__tests__/r2.test.ts +2 -2
  31. package/src/__tests__/secret.test.ts +183 -126
  32. package/src/__tests__/tail.test.ts +6 -0
  33. package/src/__tests__/tsconfig-sanity.ts +12 -0
  34. package/src/__tests__/tsconfig.json +8 -0
  35. package/src/__tests__/tsconfig.tsbuildinfo +1 -0
  36. package/src/__tests__/whoami.test.tsx +1 -96
  37. package/src/api/dev.ts +78 -41
  38. package/src/api/index.ts +1 -1
  39. package/src/{bundle-reporter.tsx → bundle-reporter.ts} +0 -0
  40. package/src/cfetch/index.ts +0 -2
  41. package/src/cfetch/internal.ts +6 -15
  42. package/src/cli.ts +2 -2
  43. package/src/config/validation.ts +1 -2
  44. package/src/create-worker-upload-form.ts +2 -2
  45. package/src/d1/{delete.tsx → delete.ts} +0 -0
  46. package/src/d1/execute.tsx +8 -37
  47. package/src/d1/migrations/apply.tsx +29 -19
  48. package/src/d1/migrations/{index.tsx → index.ts} +0 -0
  49. package/src/d1/splitter.ts +161 -0
  50. package/src/d1/{types.tsx → types.ts} +0 -0
  51. package/src/delete.ts +3 -8
  52. package/src/deployments.ts +6 -0
  53. package/src/deprecated/index.ts +2 -295
  54. package/src/dev/dev.tsx +2 -2
  55. package/src/dev/{get-local-persistence-path.tsx → get-local-persistence-path.ts} +0 -0
  56. package/src/dev/local.tsx +16 -4
  57. package/src/dev/remote.tsx +28 -1
  58. package/src/dev/start-server.ts +19 -11
  59. package/src/dev/use-esbuild.ts +1 -1
  60. package/src/{dev-registry.tsx → dev-registry.ts} +0 -0
  61. package/src/dev.tsx +21 -2
  62. package/src/dialogs.ts +136 -0
  63. package/src/dispatch-namespace.ts +1 -1
  64. package/src/docs/index.ts +3 -0
  65. package/src/environment-variables/factory.ts +88 -0
  66. package/src/environment-variables/misc-variables.ts +30 -0
  67. package/src/generate/index.ts +300 -0
  68. package/src/{index.tsx → index.ts} +10 -13
  69. package/src/init.ts +92 -52
  70. package/src/jest.d.ts +4 -0
  71. package/src/logger.ts +15 -3
  72. package/src/metrics/metrics-config.ts +1 -1
  73. package/src/miniflare-cli/assets.ts +4 -0
  74. package/src/miniflare-cli/index.ts +1 -5
  75. package/src/miniflare-cli/tsconfig.json +9 -0
  76. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -0
  77. package/src/miniflare-cli/types.ts +11 -0
  78. package/src/pages/{build.tsx → build.ts} +0 -0
  79. package/src/pages/{deployment-tails.tsx → deployment-tails.ts} +0 -0
  80. package/src/pages/{dev.tsx → dev.ts} +53 -55
  81. package/src/pages/functions/buildWorker.ts +1 -1
  82. package/src/pages/functions/tsconfig.json +8 -0
  83. package/src/pages/functions/tsconfig.tsbuildinfo +1 -0
  84. package/src/pages/{functions.tsx → functions.ts} +0 -0
  85. package/src/pages/{hash.tsx → hash.ts} +0 -0
  86. package/src/pages/{index.tsx → index.ts} +0 -0
  87. package/src/pages/projects.tsx +3 -5
  88. package/src/pages/publish.tsx +5 -4
  89. package/src/pages/upload.tsx +1 -1
  90. package/src/publish/publish.ts +9 -7
  91. package/src/pubsub/{pubsub-commands.tsx → pubsub-commands.ts} +1 -1
  92. package/src/secret/index.ts +1 -1
  93. package/src/{sites.tsx → sites.ts} +0 -0
  94. package/src/tail/index.ts +2 -3
  95. package/src/tsconfig-sanity.ts +16 -0
  96. package/src/user/access.ts +0 -1
  97. package/src/user/auth-variables.ts +113 -0
  98. package/src/user/choose-account.tsx +1 -31
  99. package/src/user/index.ts +0 -1
  100. package/src/user/{user.tsx → user.ts} +107 -73
  101. package/src/{whoami.tsx → whoami.ts} +37 -71
  102. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  103. package/templates/__tests__/tsconfig.json +8 -0
  104. package/templates/__tests__/tsconfig.tsbuildinfo +1 -0
  105. package/templates/d1-beta-facade.js +36 -0
  106. package/templates/facade.d.ts +14 -0
  107. package/templates/first-party-worker-module-facade.ts +4 -3
  108. package/templates/format-dev-errors.ts +7 -6
  109. package/templates/init-tests/test-jest-new-worker.js +3 -5
  110. package/templates/init-tests/test-vitest-new-worker.js +3 -5
  111. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  112. package/templates/middleware/loader-modules.ts +0 -2
  113. package/templates/middleware/loader-sw.ts +6 -0
  114. package/templates/pages-dev-pipeline.ts +4 -1
  115. package/templates/pages-shim.ts +4 -1
  116. package/templates/pages-template-plugin.ts +12 -7
  117. package/templates/serve-static-assets.ts +16 -14
  118. package/templates/tsconfig-sanity.ts +11 -0
  119. package/templates/tsconfig.init.json +106 -0
  120. package/templates/tsconfig.json +5 -103
  121. package/templates/tsconfig.tsbuildinfo +1 -0
  122. package/wrangler-dist/cli.d.ts +58 -60
  123. package/wrangler-dist/cli.js +34440 -55514
  124. package/wrangler-dist/wasm-sync.wasm +0 -0
  125. package/src/__tests__/dialogs.test.tsx +0 -40
  126. package/src/dialogs.tsx +0 -168
  127. package/src/environment-variables.ts +0 -50
  128. package/src/user/env-vars.ts +0 -46
@@ -10,6 +10,7 @@ import {
10
10
  } from "../bundle-reporter";
11
11
  import { writeAuthConfigFile } from "../user";
12
12
  import { mockAccountId, mockApiToken } from "./helpers/mock-account-id";
13
+ import { mockAuthDomain } from "./helpers/mock-auth-domain";
13
14
  import {
14
15
  createFetchResult,
15
16
  setMockRawResponse,
@@ -47,6 +48,7 @@ describe("publish", () => {
47
48
  const { setIsTTY } = useMockIsTTY();
48
49
  const std = mockConsoleMethods();
49
50
  const {
51
+ mockDomainUsesAccess,
50
52
  mockOAuthServerCallback,
51
53
  mockGrantAccessToken,
52
54
  mockGrantAuthorization,
@@ -61,7 +63,7 @@ describe("publish", () => {
61
63
  setMockResponse(
62
64
  "/accounts/:accountId/workers/services/:scriptName",
63
65
  () => ({
64
- default_environment: { script: { last_deployed_from: "dash" } },
66
+ default_environment: { script: { last_deployed_from: "wrangler" } },
65
67
  })
66
68
  );
67
69
  setMockResponse(
@@ -99,15 +101,20 @@ describe("publish", () => {
99
101
 
100
102
  await runWrangler("publish ./index");
101
103
 
102
- expect(std.out).toMatchInlineSnapshot(`
103
- "Total Upload: xx KiB / gzip: xx KiB
104
+ expect(std).toMatchInlineSnapshot(`
105
+ Object {
106
+ "debug": "",
107
+ "err": "",
108
+ "out": "Total Upload: xx KiB / gzip: xx KiB
104
109
  Worker ID: abc12345
105
110
  Worker ETag: etag98765
106
111
  Worker PipelineHash: hash9999
107
112
  Uploaded test-name (TIMINGS)
108
113
  Published test-name (TIMINGS)
109
114
  https://test-name.test-sub-domain.workers.dev
110
- Current Deployment ID: undefined"
115
+ Current Deployment ID: undefined",
116
+ "warn": "",
117
+ }
111
118
  `);
112
119
  });
113
120
  });
@@ -124,6 +131,7 @@ describe("publish", () => {
124
131
  it("drops a user into the login flow if they're unauthenticated", async () => {
125
132
  writeWranglerToml();
126
133
  writeWorkerSource();
134
+ mockDomainUsesAccess({ usesAccess: false });
127
135
  mockSubDomainRequest();
128
136
  mockUploadWorkerRequest();
129
137
  mockOAuthServerCallback();
@@ -150,6 +158,46 @@ describe("publish", () => {
150
158
  expect(std.err).toMatchInlineSnapshot(`""`);
151
159
  });
152
160
 
161
+ describe("with an alternative auth domain", () => {
162
+ mockAuthDomain({ domain: "dash.staging.cloudflare.com" });
163
+
164
+ it("drops a user into the login flow if they're unauthenticated", async () => {
165
+ writeWranglerToml();
166
+ writeWorkerSource();
167
+ mockDomainUsesAccess({
168
+ usesAccess: false,
169
+ domain: "dash.staging.cloudflare.com",
170
+ });
171
+ mockSubDomainRequest();
172
+ mockUploadWorkerRequest();
173
+ mockOAuthServerCallback();
174
+ const accessTokenRequest = mockGrantAccessToken({
175
+ domain: "dash.staging.cloudflare.com",
176
+ respondWith: "ok",
177
+ });
178
+ mockGrantAuthorization({ respondWith: "success" });
179
+
180
+ await expect(runWrangler("publish index.js")).resolves.toBeUndefined();
181
+
182
+ expect(accessTokenRequest.actual.url).toEqual(
183
+ accessTokenRequest.expected.url
184
+ );
185
+
186
+ expect(std.out).toMatchInlineSnapshot(`
187
+ "Attempting to login via OAuth...
188
+ Opening a link in your default browser: https://dash.staging.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
189
+ Successfully logged in.
190
+ Total Upload: xx KiB / gzip: xx KiB
191
+ Uploaded test-name (TIMINGS)
192
+ Published test-name (TIMINGS)
193
+ https://test-name.test-sub-domain.workers.dev
194
+ Current Deployment ID: undefined"
195
+ `);
196
+ expect(std.warn).toMatchInlineSnapshot(`""`);
197
+ expect(std.err).toMatchInlineSnapshot(`""`);
198
+ });
199
+ });
200
+
153
201
  it("warns a user when they're authenticated with an API token in wrangler config file", async () => {
154
202
  writeWranglerToml();
155
203
  writeWorkerSource();
@@ -257,12 +305,12 @@ describe("publish", () => {
257
305
 
258
306
  await expect(runWrangler("publish index.js")).rejects
259
307
  .toMatchInlineSnapshot(`
260
- [Error: More than one account available but unable to select one in non-interactive mode.
261
- Please set the appropriate \`account_id\` in your \`wrangler.toml\` file.
262
- Available accounts are ("<name>" - "<id>"):
263
- "enterprise" - "1701")
264
- "enterprise-nx" - "nx01")]
265
- `);
308
+ [Error: More than one account available but unable to select one in non-interactive mode.
309
+ Please set the appropriate \`account_id\` in your \`wrangler.toml\` file.
310
+ Available accounts are (\`<name>\`: \`<account_id>\`):
311
+ \`enterprise\`: \`1701\`
312
+ \`enterprise-nx\`: \`nx01\`]
313
+ `);
266
314
  });
267
315
 
268
316
  it("should throw error in non-TTY if 'CLOUDFLARE_API_TOKEN' is missing", async () => {
@@ -329,6 +377,7 @@ describe("publish", () => {
329
377
  env: "some-env",
330
378
  legacyEnv: true,
331
379
  });
380
+
332
381
  await runWrangler("publish index.js --env some-env");
333
382
  expect(std.out).toMatchInlineSnapshot(`
334
383
  "Total Upload: xx KiB / gzip: xx KiB
@@ -349,6 +398,7 @@ describe("publish", () => {
349
398
  mockUploadWorkerRequest({
350
399
  legacyEnv: true,
351
400
  });
401
+
352
402
  await runWrangler("publish index.js --legacy-env true");
353
403
  expect(std.out).toMatchInlineSnapshot(`
354
404
  "Total Upload: xx KiB / gzip: xx KiB
@@ -369,6 +419,7 @@ describe("publish", () => {
369
419
  env: "some-env",
370
420
  legacyEnv: true,
371
421
  });
422
+
372
423
  await runWrangler("publish index.js --env some-env --legacy-env true");
373
424
  expect(std.out).toMatchInlineSnapshot(`
374
425
  "Total Upload: xx KiB / gzip: xx KiB
@@ -389,6 +440,7 @@ describe("publish", () => {
389
440
  env: "some-env",
390
441
  legacyEnv: true,
391
442
  });
443
+
392
444
  await runWrangler("publish index.js --env some-env --legacy-env true");
393
445
  expect(std.out).toMatchInlineSnapshot(`
394
446
  "Total Upload: xx KiB / gzip: xx KiB
@@ -460,6 +512,7 @@ describe("publish", () => {
460
512
  mockUploadWorkerRequest({
461
513
  legacyEnv: false,
462
514
  });
515
+
463
516
  await runWrangler("publish index.js --legacy-env false");
464
517
  expect(std.out).toMatchInlineSnapshot(`
465
518
  "Total Upload: xx KiB / gzip: xx KiB
@@ -487,6 +540,7 @@ describe("publish", () => {
487
540
  env: "some-env",
488
541
  legacyEnv: false,
489
542
  });
543
+
490
544
  await runWrangler("publish index.js --env some-env --legacy-env false");
491
545
  expect(std.out).toMatchInlineSnapshot(`
492
546
  "Total Upload: xx KiB / gzip: xx KiB
@@ -770,22 +824,22 @@ describe("publish", () => {
770
824
 
771
825
  expect(std.err).toMatchInlineSnapshot(`""`);
772
826
  expect(std.warn).toMatchInlineSnapshot(`
773
- "▲ [WARNING] The current authentication token does not have 'All Zones' permissions.
827
+ "▲ [WARNING] The current authentication token does not have 'All Zones' permissions.
774
828
 
775
- Falling back to using the zone-based API endpoint to update each route individually.
776
- Note that there is no access to routes associated with zones that the API token does not have
777
- permission for.
778
- Existing routes for this Worker in such zones will not be deleted.
829
+ Falling back to using the zone-based API endpoint to update each route individually.
830
+ Note that there is no access to routes associated with zones that the API token does not have
831
+ permission for.
832
+ Existing routes for this Worker in such zones will not be deleted.
779
833
 
780
834
 
781
- ▲ [WARNING] Previously deployed routes:
835
+ ▲ [WARNING] Previously deployed routes:
782
836
 
783
- The following routes were already associated with this worker, and have not been deleted:
784
- - \\"foo.example.com/other-route\\"
785
- If these routes are not wanted then you can remove them in the dashboard.
837
+ The following routes were already associated with this worker, and have not been deleted:
838
+ - \\"foo.example.com/other-route\\"
839
+ If these routes are not wanted then you can remove them in the dashboard.
786
840
 
787
- "
788
- `);
841
+ "
842
+ `);
789
843
  expect(std.out).toMatchInlineSnapshot(`
790
844
  "Total Upload: xx KiB / gzip: xx KiB
791
845
  Uploaded test-name (TIMINGS)
@@ -1150,17 +1204,17 @@ Update them to point to this script instead?`,
1150
1204
  `);
1151
1205
  expect(std.err).toMatchInlineSnapshot(`""`);
1152
1206
  expect(std.warn).toMatchInlineSnapshot(`
1153
- "▲ [WARNING] Processing wrangler.toml configuration:
1207
+ "▲ [WARNING] Processing wrangler.toml configuration:
1154
1208
 
1155
- - Deprecation: \\"build.upload.main\\":
1156
- Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
1157
- Then add the top level \`main\` field to your configuration file:
1158
- \`\`\`
1159
- main = \\"dist/index.js\\"
1160
- \`\`\`
1209
+ - Deprecation: \\"build.upload.main\\":
1210
+ Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
1211
+ Then add the top level \`main\` field to your configuration file:
1212
+ \`\`\`
1213
+ main = \\"dist/index.js\\"
1214
+ \`\`\`
1161
1215
 
1162
- "
1163
- `);
1216
+ "
1217
+ `);
1164
1218
  });
1165
1219
 
1166
1220
  it("should use `build.upload.main` relative to `build.upload.dir`", async () => {
@@ -1187,20 +1241,20 @@ Update them to point to this script instead?`,
1187
1241
  `);
1188
1242
  expect(std.err).toMatchInlineSnapshot(`""`);
1189
1243
  expect(std.warn).toMatchInlineSnapshot(`
1190
- "▲ [WARNING] Processing ../wrangler.toml configuration:
1244
+ "▲ [WARNING] Processing ../wrangler.toml configuration:
1191
1245
 
1192
- - Deprecation: \\"build.upload.main\\":
1193
- Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
1194
- Then add the top level \`main\` field to your configuration file:
1195
- \`\`\`
1196
- main = \\"foo/index.js\\"
1197
- \`\`\`
1198
- - Deprecation: \\"build.upload.dir\\":
1199
- Use the top level \\"main\\" field or a command-line argument to specify the entry-point for the
1200
- Worker.
1246
+ - Deprecation: \\"build.upload.main\\":
1247
+ Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
1248
+ Then add the top level \`main\` field to your configuration file:
1249
+ \`\`\`
1250
+ main = \\"foo/index.js\\"
1251
+ \`\`\`
1252
+ - Deprecation: \\"build.upload.dir\\":
1253
+ Use the top level \\"main\\" field or a command-line argument to specify the entry-point for the
1254
+ Worker.
1201
1255
 
1202
- "
1203
- `);
1256
+ "
1257
+ `);
1204
1258
  });
1205
1259
 
1206
1260
  it("should error when both `main` and `build.upload.main` are used", async () => {
@@ -1539,17 +1593,17 @@ addEventListener('fetch', event => {});`
1539
1593
  `);
1540
1594
  expect(std.err).toMatchInlineSnapshot(`""`);
1541
1595
  expect(normalizeSlashes(std.warn)).toMatchInlineSnapshot(`
1542
- "▲ [WARNING] Processing my-site/wrangler.toml configuration:
1596
+ "▲ [WARNING] Processing my-site/wrangler.toml configuration:
1543
1597
 
1544
- - Deprecation: \\"site.entry-point\\":
1545
- Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration
1546
- file:
1547
- \`\`\`
1548
- main = \\"my-entry/index.js\\"
1549
- \`\`\`
1598
+ - Deprecation: \\"site.entry-point\\":
1599
+ Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration
1600
+ file:
1601
+ \`\`\`
1602
+ main = \\"my-entry/index.js\\"
1603
+ \`\`\`
1550
1604
 
1551
- "
1552
- `);
1605
+ "
1606
+ `);
1553
1607
  });
1554
1608
 
1555
1609
  it("should error if both main and site.entry-point are specified", async () => {
@@ -4015,24 +4069,24 @@ addEventListener('fetch', event => {});`
4015
4069
  `);
4016
4070
  expect(std.err).toMatchInlineSnapshot(`""`);
4017
4071
  expect(std.warn).toMatchInlineSnapshot(`
4018
- "▲ [WARNING] Processing wrangler.toml configuration:
4072
+ "▲ [WARNING] Processing wrangler.toml configuration:
4019
4073
 
4020
- - In wrangler.toml, you have configured [durable_objects] exported by this Worker (SomeClass),
4021
- but no [migrations] for them. This may not work as expected until you add a [migrations] section
4022
- to your wrangler.toml. Add this configuration to your wrangler.toml:
4074
+ - In wrangler.toml, you have configured [durable_objects] exported by this Worker (SomeClass),
4075
+ but no [migrations] for them. This may not work as expected until you add a [migrations] section
4076
+ to your wrangler.toml. Add this configuration to your wrangler.toml:
4023
4077
 
4024
- \`\`\`
4025
- [[migrations]]
4026
- tag = \\"v1\\" # Should be unique for each entry
4027
- new_classes = [\\"SomeClass\\"]
4028
- \`\`\`
4078
+ \`\`\`
4079
+ [[migrations]]
4080
+ tag = \\"v1\\" # Should be unique for each entry
4081
+ new_classes = [\\"SomeClass\\"]
4082
+ \`\`\`
4029
4083
 
4030
- Refer to
4031
- https://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml
4032
- for more details.
4084
+ Refer to
4085
+ https://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml
4086
+ for more details.
4033
4087
 
4034
- "
4035
- `);
4088
+ "
4089
+ `);
4036
4090
  });
4037
4091
 
4038
4092
  it("does not warn if all the durable object bindings are to external classes", async () => {
@@ -4255,13 +4309,13 @@ addEventListener('fetch', event => {});`
4255
4309
  `);
4256
4310
  expect(std.err).toMatchInlineSnapshot(`""`);
4257
4311
  expect(std.warn).toMatchInlineSnapshot(`
4258
- "▲ [WARNING] Processing wrangler.toml configuration:
4312
+ "▲ [WARNING] Processing wrangler.toml configuration:
4259
4313
 
4260
- - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
4261
- the future. DO NOT USE IN PRODUCTION.
4314
+ - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
4315
+ the future. DO NOT USE IN PRODUCTION.
4262
4316
 
4263
- "
4264
- `);
4317
+ "
4318
+ `);
4265
4319
  });
4266
4320
 
4267
4321
  it("should publish all migrations on first publish (--env)", async () => {
@@ -4319,13 +4373,13 @@ addEventListener('fetch', event => {});`
4319
4373
  `);
4320
4374
  expect(std.err).toMatchInlineSnapshot(`""`);
4321
4375
  expect(std.warn).toMatchInlineSnapshot(`
4322
- "▲ [WARNING] Processing wrangler.toml configuration:
4376
+ "▲ [WARNING] Processing wrangler.toml configuration:
4323
4377
 
4324
- - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
4325
- the future. DO NOT USE IN PRODUCTION.
4378
+ - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
4379
+ the future. DO NOT USE IN PRODUCTION.
4326
4380
 
4327
- "
4328
- `);
4381
+ "
4382
+ `);
4329
4383
  });
4330
4384
 
4331
4385
  it("should use a script's current migration tag when publishing migrations", async () => {
@@ -4692,12 +4746,12 @@ addEventListener('fetch', event => {});`
4692
4746
  `);
4693
4747
  expect(std.err).toMatchInlineSnapshot(`""`);
4694
4748
  expect(std.warn).toMatchInlineSnapshot(`
4695
- "▲ [WARNING] Processing wrangler.toml configuration:
4749
+ "▲ [WARNING] Processing wrangler.toml configuration:
4696
4750
 
4697
- - \\"unsafe\\" fields are experimental and may change or break at any time.
4751
+ - \\"unsafe\\" fields are experimental and may change or break at any time.
4698
4752
 
4699
- "
4700
- `);
4753
+ "
4754
+ `);
4701
4755
  });
4702
4756
 
4703
4757
  it("should error when bindings of different types have the same name", async () => {
@@ -5099,6 +5153,7 @@ addEventListener('fetch', event => {});`
5099
5153
  ],
5100
5154
  });
5101
5155
  mockSubDomainRequest();
5156
+
5102
5157
  await runWrangler("publish index.js");
5103
5158
  expect(std.out).toMatchInlineSnapshot(`
5104
5159
  "Total Upload: xx KiB / gzip: xx KiB
@@ -5791,12 +5846,12 @@ addEventListener('fetch', event => {});`
5791
5846
  `);
5792
5847
  expect(std.err).toMatchInlineSnapshot(`""`);
5793
5848
  expect(std.warn).toMatchInlineSnapshot(`
5794
- "▲ [WARNING] Processing wrangler.toml configuration:
5849
+ "▲ [WARNING] Processing wrangler.toml configuration:
5795
5850
 
5796
- - \\"services\\" fields are experimental and may change or break at any time.
5851
+ - \\"services\\" fields are experimental and may change or break at any time.
5797
5852
 
5798
- "
5799
- `);
5853
+ "
5854
+ `);
5800
5855
  });
5801
5856
  });
5802
5857
 
@@ -5846,7 +5901,7 @@ addEventListener('fetch', event => {});`
5846
5901
  mockUploadWorkerRequest({
5847
5902
  expectedBindings: [
5848
5903
  {
5849
- type: "namespace",
5904
+ type: "dispatch_namespace",
5850
5905
  name: "foo",
5851
5906
  namespace: "Foo",
5852
5907
  },
@@ -5864,13 +5919,7 @@ addEventListener('fetch', event => {});`
5864
5919
  Current Deployment ID: undefined"
5865
5920
  `);
5866
5921
  expect(std.err).toMatchInlineSnapshot(`""`);
5867
- expect(std.warn).toMatchInlineSnapshot(`
5868
- "▲ [WARNING] Processing wrangler.toml configuration:
5869
-
5870
- - \\"dispatch_namespaces\\" fields are experimental and may change or break at any time.
5871
-
5872
- "
5873
- `);
5922
+ expect(std.warn).toMatchInlineSnapshot(`""`);
5874
5923
  });
5875
5924
  });
5876
5925
 
@@ -5912,12 +5961,12 @@ addEventListener('fetch', event => {});`
5912
5961
  `);
5913
5962
  expect(std.err).toMatchInlineSnapshot(`""`);
5914
5963
  expect(std.warn).toMatchInlineSnapshot(`
5915
- "▲ [WARNING] Processing wrangler.toml configuration:
5964
+ "▲ [WARNING] Processing wrangler.toml configuration:
5916
5965
 
5917
- - \\"unsafe\\" fields are experimental and may change or break at any time.
5966
+ - \\"unsafe\\" fields are experimental and may change or break at any time.
5918
5967
 
5919
- "
5920
- `);
5968
+ "
5969
+ `);
5921
5970
  });
5922
5971
  it("should warn if using unsafe bindings already handled by wrangler", async () => {
5923
5972
  writeWranglerToml({
@@ -5956,17 +6005,17 @@ addEventListener('fetch', event => {});`
5956
6005
  `);
5957
6006
  expect(std.err).toMatchInlineSnapshot(`""`);
5958
6007
  expect(std.warn).toMatchInlineSnapshot(`
5959
- "▲ [WARNING] Processing wrangler.toml configuration:
6008
+ "▲ [WARNING] Processing wrangler.toml configuration:
5960
6009
 
5961
- - \\"unsafe\\" fields are experimental and may change or break at any time.
5962
- - \\"unsafe.bindings[0]\\": {\\"name\\":\\"my-binding\\",\\"type\\":\\"plain_text\\",\\"text\\":\\"text\\"}
5963
- - The binding type \\"plain_text\\" is directly supported by wrangler.
5964
- Consider migrating this unsafe binding to a format for 'plain_text' bindings that is
5965
- supported by wrangler for optimal support.
5966
- For more details, see https://developers.cloudflare.com/workers/cli-wrangler/configuration
6010
+ - \\"unsafe\\" fields are experimental and may change or break at any time.
6011
+ - \\"unsafe.bindings[0]\\": {\\"name\\":\\"my-binding\\",\\"type\\":\\"plain_text\\",\\"text\\":\\"text\\"}
6012
+ - The binding type \\"plain_text\\" is directly supported by wrangler.
6013
+ Consider migrating this unsafe binding to a format for 'plain_text' bindings that is
6014
+ supported by wrangler for optimal support.
6015
+ For more details, see https://developers.cloudflare.com/workers/cli-wrangler/configuration
5967
6016
 
5968
- "
5969
- `);
6017
+ "
6018
+ `);
5970
6019
  });
5971
6020
  });
5972
6021
  });
@@ -6067,20 +6116,20 @@ addEventListener('fetch', event => {});`
6067
6116
  `);
6068
6117
  expect(std.err).toMatchInlineSnapshot(`""`);
6069
6118
  expect(std.warn).toMatchInlineSnapshot(`
6070
- "▲ [WARNING] Processing wrangler.toml configuration:
6119
+ "▲ [WARNING] Processing wrangler.toml configuration:
6071
6120
 
6072
- - Deprecation: The \`build.upload.rules\` config field is no longer used, the rules should be
6073
- specified via the \`rules\` config field. Delete the \`build.upload\` field from the configuration
6074
- file, and add this:
6075
- \`\`\`
6076
- [[rules]]
6077
- type = \\"Text\\"
6078
- globs = [ \\"**/*.file\\" ]
6079
- fallthrough = true
6080
- \`\`\`
6121
+ - Deprecation: The \`build.upload.rules\` config field is no longer used, the rules should be
6122
+ specified via the \`rules\` config field. Delete the \`build.upload\` field from the configuration
6123
+ file, and add this:
6124
+ \`\`\`
6125
+ [[rules]]
6126
+ type = \\"Text\\"
6127
+ globs = [ \\"**/*.file\\" ]
6128
+ fallthrough = true
6129
+ \`\`\`
6081
6130
 
6082
- "
6083
- `);
6131
+ "
6132
+ `);
6084
6133
  });
6085
6134
 
6086
6135
  it("should be able to use fallthrough:true for multiple rules", async () => {
@@ -6246,10 +6295,10 @@ addEventListener('fetch', event => {});`
6246
6295
  `);
6247
6296
  expect(std.err).toMatchInlineSnapshot(`""`);
6248
6297
  expect(std.warn).toMatchInlineSnapshot(`
6249
- "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"text.file\\" with \\"./text.file\\";
6298
+ "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"text.file\\" with \\"./text.file\\";
6250
6299
 
6251
- "
6252
- `);
6300
+ "
6301
+ `);
6253
6302
  });
6254
6303
 
6255
6304
  it("should work with legacy module specifiers, with a deprecation warning (2)", async () => {
@@ -6276,10 +6325,10 @@ addEventListener('fetch', event => {});`
6276
6325
  `);
6277
6326
  expect(std.err).toMatchInlineSnapshot(`""`);
6278
6327
  expect(std.warn).toMatchInlineSnapshot(`
6279
- "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"index.wasm\\" with \\"./index.wasm\\";
6328
+ "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"index.wasm\\" with \\"./index.wasm\\";
6280
6329
 
6281
- "
6282
- `);
6330
+ "
6331
+ `);
6283
6332
  });
6284
6333
 
6285
6334
  it("should work with legacy module specifiers, with a deprecation warning (3)", async () => {
@@ -6308,10 +6357,10 @@ addEventListener('fetch', event => {});`
6308
6357
  `);
6309
6358
  expect(std.err).toMatchInlineSnapshot(`""`);
6310
6359
  expect(std.warn).toMatchInlineSnapshot(`
6311
- "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"text+name.file\\" with \\"./text+name.file\\";
6360
+ "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"text+name.file\\" with \\"./text+name.file\\";
6312
6361
 
6313
- "
6314
- `);
6362
+ "
6363
+ `);
6315
6364
  });
6316
6365
 
6317
6366
  it("should not match regular module specifiers when there aren't any possible legacy module matches", async () => {
@@ -155,7 +155,7 @@ describe("r2", () => {
155
155
  const { accountId } = request.params;
156
156
  expect(accountId).toEqual("some-account-id");
157
157
  expect(await request.json()).toEqual({ name: "testBucket" });
158
- response.once(
158
+ return response.once(
159
159
  context.status(200),
160
160
  context.json({
161
161
  success: true,
@@ -332,7 +332,7 @@ describe("r2", () => {
332
332
  "host": "api.cloudflare.com",
333
333
  }
334
334
  `);
335
- response.once(
335
+ return response.once(
336
336
  context.status(200),
337
337
  context.json({
338
338
  success: true,