wrangler 2.12.2 → 2.12.3

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 (33) hide show
  1. package/package.json +4 -3
  2. package/src/__tests__/d1/execute.test.ts +2 -0
  3. package/src/__tests__/d1/migrate.test.ts +2 -0
  4. package/src/__tests__/delete.test.ts +6 -0
  5. package/src/__tests__/dev.test.tsx +71 -56
  6. package/src/__tests__/helpers/mock-console.ts +6 -0
  7. package/src/__tests__/helpers/worker-scripts/parent-worker.js +4 -1
  8. package/src/__tests__/init.test.ts +127 -96
  9. package/src/__tests__/kv.test.ts +9 -9
  10. package/src/__tests__/middleware.scheduled.test.ts +2 -2
  11. package/src/__tests__/middleware.test.ts +2 -2
  12. package/src/__tests__/pages/deployment-list.test.ts +2 -0
  13. package/src/__tests__/pages/project-list.test.ts +2 -0
  14. package/src/__tests__/pages/project-upload.test.ts +43 -24
  15. package/src/__tests__/pages/publish.test.ts +69 -69
  16. package/src/__tests__/publish.test.ts +138 -97
  17. package/src/__tests__/pubsub.test.ts +3 -0
  18. package/src/__tests__/tsconfig.tsbuildinfo +1 -1
  19. package/src/__tests__/worker-namespace.test.ts +1 -0
  20. package/src/d1/backups.tsx +15 -11
  21. package/src/d1/create.tsx +20 -16
  22. package/src/d1/execute.tsx +21 -18
  23. package/src/d1/list.tsx +2 -2
  24. package/src/d1/migrations/apply.tsx +33 -28
  25. package/src/d1/migrations/create.tsx +15 -12
  26. package/src/d1/migrations/list.tsx +10 -7
  27. package/src/pages/deployments.tsx +3 -5
  28. package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
  29. package/src/pages/projects.tsx +2 -5
  30. package/src/pages/upload.tsx +29 -9
  31. package/src/utils/render.ts +93 -0
  32. package/templates/d1-beta-facade.js +3 -0
  33. package/wrangler-dist/cli.js +225 -146
@@ -1,22 +1,22 @@
1
- /* eslint-disable no-shadow */
2
1
  import { Blob } from "node:buffer";
3
2
  import { mkdirSync, writeFileSync } from "node:fs";
4
3
  import { chdir } from "node:process";
5
4
  import { MockedRequest, rest } from "msw";
6
5
  import { FormData } from "undici";
6
+ import { version } from "../../../package.json";
7
+ import { ROUTES_SPEC_VERSION } from "../../pages/constants";
8
+ import { isRoutesJSONSpec } from "../../pages/functions/routes-validation";
9
+ import { endEventLoop } from "../helpers/end-event-loop";
10
+ import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
7
11
  import { mockConsoleMethods } from "../helpers/mock-console";
8
12
  import { mockGetUploadTokenRequest } from "../helpers/mock-get-pages-upload-token";
9
13
  import { mockSetTimeout } from "../helpers/mock-set-timeout";
10
- import { version } from "./../../../package.json";
11
- import { ROUTES_SPEC_VERSION } from "./../../pages/constants";
12
- import { isRoutesJSONSpec } from "./../../pages/functions/routes-validation";
13
- import { endEventLoop } from "./../helpers/end-event-loop";
14
- import { mockAccountId, mockApiToken } from "./../helpers/mock-account-id";
15
- import { msw } from "./../helpers/msw";
16
- import { FileReaderSync } from "./../helpers/msw/read-file-sync";
17
- import { runInTempDir } from "./../helpers/run-in-tmp";
18
- import { runWrangler } from "./../helpers/run-wrangler";
19
- import type { Project, UploadPayloadFile } from "./../../pages/types";
14
+ import { msw } from "../helpers/msw";
15
+ import { FileReaderSync } from "../helpers/msw/read-file-sync";
16
+ import { runInTempDir } from "../helpers/run-in-tmp";
17
+ import { runWrangler } from "../helpers/run-wrangler";
18
+ import { normalizeProgressSteps } from "./project-upload.test";
19
+ import type { Project, UploadPayloadFile } from "../../pages/types";
20
20
  import type { RestRequest } from "msw";
21
21
 
22
22
  describe("deployment create", () => {
@@ -171,11 +171,11 @@ describe("deployment create", () => {
171
171
 
172
172
  await runWrangler("pages publish . --project-name=foo");
173
173
 
174
- expect(std.out).toMatchInlineSnapshot(`
175
- "✨ Success! Uploaded 1 files (TIMINGS)
174
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
175
+ "✨ Success! Uploaded 1 files (TIMINGS)
176
176
 
177
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
178
- `);
177
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
178
+ `);
179
179
  });
180
180
 
181
181
  it("should retry uploads", async () => {
@@ -300,11 +300,11 @@ describe("deployment create", () => {
300
300
 
301
301
  await runWrangler("pages publish . --project-name=foo");
302
302
 
303
- expect(std.out).toMatchInlineSnapshot(`
304
- "✨ Success! Uploaded 1 files (TIMINGS)
303
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
304
+ "✨ Success! Uploaded 1 files (TIMINGS)
305
305
 
306
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
307
- `);
306
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
307
+ `);
308
308
  });
309
309
 
310
310
  it("should refetch a JWT if it expires while uploading", async () => {
@@ -437,11 +437,11 @@ describe("deployment create", () => {
437
437
  "Bearer <<funfetti-auth-jwt2>>"
438
438
  );
439
439
 
440
- expect(std.out).toMatchInlineSnapshot(`
441
- "✨ Success! Uploaded 1 files (TIMINGS)
440
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
441
+ "✨ Success! Uploaded 1 files (TIMINGS)
442
442
 
443
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
444
- `);
443
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
444
+ `);
445
445
  });
446
446
 
447
447
  it("should try to use multiple buckets (up to the max concurrency)", async () => {
@@ -592,11 +592,11 @@ describe("deployment create", () => {
592
592
  ])
593
593
  );
594
594
 
595
- expect(std.out).toMatchInlineSnapshot(`
596
- "✨ Success! Uploaded 4 files (TIMINGS)
595
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
596
+ "✨ Success! Uploaded 4 files (TIMINGS)
597
597
 
598
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
599
- `);
598
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
599
+ `);
600
600
  });
601
601
 
602
602
  it("should resolve child directories correctly", async () => {
@@ -744,11 +744,11 @@ describe("deployment create", () => {
744
744
  ])
745
745
  );
746
746
 
747
- expect(std.out).toMatchInlineSnapshot(`
748
- "✨ Success! Uploaded 4 files (TIMINGS)
747
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
748
+ "✨ Success! Uploaded 4 files (TIMINGS)
749
749
 
750
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
751
- `);
750
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
751
+ `);
752
752
  });
753
753
 
754
754
  it("should resolve the current directory correctly", async () => {
@@ -897,11 +897,11 @@ describe("deployment create", () => {
897
897
  ])
898
898
  );
899
899
 
900
- expect(std.out).toMatchInlineSnapshot(`
901
- "✨ Success! Uploaded 4 files (TIMINGS)
900
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
901
+ "✨ Success! Uploaded 4 files (TIMINGS)
902
902
 
903
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
904
- `);
903
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
904
+ `);
905
905
  });
906
906
 
907
907
  it("should not error when directory names contain periods and houses a extensionless file", async () => {
@@ -1211,13 +1211,13 @@ describe("deployment create", () => {
1211
1211
 
1212
1212
  await runWrangler("pages publish public --project-name=foo");
1213
1213
 
1214
- expect(std.out).toMatchInlineSnapshot(`
1215
- "✨ Compiled Worker successfully
1216
- ✨ Success! Uploaded 1 files (TIMINGS)
1214
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
1215
+ "✨ Compiled Worker successfully
1216
+ ✨ Success! Uploaded 1 files (TIMINGS)
1217
1217
 
1218
- ✨ Uploading Functions bundle
1219
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1220
- `);
1218
+ ✨ Uploading Functions bundle
1219
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1220
+ `);
1221
1221
 
1222
1222
  expect(std.err).toMatchInlineSnapshot('""');
1223
1223
  });
@@ -1361,13 +1361,13 @@ describe("deployment create", () => {
1361
1361
 
1362
1362
  await runWrangler("pages publish public --project-name=foo");
1363
1363
 
1364
- expect(std.out).toMatchInlineSnapshot(`
1365
- "✨ Success! Uploaded 1 files (TIMINGS)
1364
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
1365
+ "✨ Success! Uploaded 1 files (TIMINGS)
1366
1366
 
1367
- ✨ Compiled Worker successfully
1368
- ✨ Uploading Worker bundle
1369
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1370
- `);
1367
+ ✨ Compiled Worker successfully
1368
+ ✨ Uploading Worker bundle
1369
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1370
+ `);
1371
1371
 
1372
1372
  expect(std.err).toMatchInlineSnapshot('""');
1373
1373
  });
@@ -1583,14 +1583,14 @@ describe("deployment create", () => {
1583
1583
 
1584
1584
  await runWrangler("pages publish public --project-name=foo");
1585
1585
 
1586
- expect(std.out).toMatchInlineSnapshot(`
1587
- "✨ Compiled Worker successfully
1588
- ✨ Success! Uploaded 1 files (TIMINGS)
1586
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
1587
+ "✨ Compiled Worker successfully
1588
+ ✨ Success! Uploaded 1 files (TIMINGS)
1589
1589
 
1590
- ✨ Uploading Functions bundle
1591
- ✨ Uploading _routes.json
1592
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1593
- `);
1590
+ ✨ Uploading Functions bundle
1591
+ ✨ Uploading _routes.json
1592
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1593
+ `);
1594
1594
 
1595
1595
  expect(std.warn).toMatchInlineSnapshot(`""`);
1596
1596
  expect(std.err).toMatchInlineSnapshot('""');
@@ -1920,14 +1920,14 @@ and that at least one include rule is provided.
1920
1920
 
1921
1921
  await runWrangler("pages publish public --project-name=foo");
1922
1922
 
1923
- expect(std.out).toMatchInlineSnapshot(`
1924
- "✨ Success! Uploaded 1 files (TIMINGS)
1923
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
1924
+ "✨ Success! Uploaded 1 files (TIMINGS)
1925
1925
 
1926
- ✨ Compiled Worker successfully
1927
- ✨ Uploading Worker bundle
1928
- ✨ Uploading _routes.json
1929
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1930
- `);
1926
+ ✨ Compiled Worker successfully
1927
+ ✨ Uploading Worker bundle
1928
+ ✨ Uploading _routes.json
1929
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
1930
+ `);
1931
1931
 
1932
1932
  expect(std.warn).toMatchInlineSnapshot(`""`);
1933
1933
  expect(std.err).toMatchInlineSnapshot(`""`);
@@ -2229,13 +2229,13 @@ and that at least one include rule is provided.
2229
2229
 
2230
2230
  await runWrangler("pages publish public --project-name=foo");
2231
2231
 
2232
- expect(std.out).toMatchInlineSnapshot(`
2233
- "✨ Success! Uploaded 1 files (TIMINGS)
2232
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
2233
+ "✨ Success! Uploaded 1 files (TIMINGS)
2234
2234
 
2235
- ✨ Compiled Worker successfully
2236
- ✨ Uploading Worker bundle
2237
- ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
2238
- `);
2235
+ ✨ Compiled Worker successfully
2236
+ ✨ Uploading Worker bundle
2237
+ ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
2238
+ `);
2239
2239
 
2240
2240
  expect(std.err).toMatchInlineSnapshot('""');
2241
2241
  });
@@ -2427,7 +2427,7 @@ async function onRequest() {
2427
2427
 
2428
2428
  await runWrangler("pages publish public --project-name=foo");
2429
2429
 
2430
- expect(std.out).toMatchInlineSnapshot(`
2430
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
2431
2431
  "✨ Compiled Worker successfully
2432
2432
  ✨ Success! Uploaded 1 files (TIMINGS)
2433
2433
 
@@ -2631,7 +2631,7 @@ async function onRequest() {
2631
2631
 
2632
2632
  await runWrangler("pages publish public --project-name=foo");
2633
2633
 
2634
- expect(std.out).toMatchInlineSnapshot(`
2634
+ expect(normalizeProgressSteps(std.out)).toMatchInlineSnapshot(`
2635
2635
  "✨ Success! Uploaded 1 files (TIMINGS)
2636
2636
 
2637
2637
  ✨ Compiled Worker successfully