wrangler 2.0.23 → 2.0.26

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 (80) hide show
  1. package/README.md +20 -2
  2. package/bin/wrangler.js +1 -1
  3. package/miniflare-dist/index.mjs +235 -47
  4. package/package.json +11 -6
  5. package/src/__tests__/configuration.test.ts +89 -17
  6. package/src/__tests__/dev.test.tsx +29 -4
  7. package/src/__tests__/generate.test.ts +93 -0
  8. package/src/__tests__/helpers/mock-cfetch.ts +87 -2
  9. package/src/__tests__/index.test.ts +10 -27
  10. package/src/__tests__/init.test.ts +537 -359
  11. package/src/__tests__/jest.setup.ts +34 -1
  12. package/src/__tests__/kv.test.ts +2 -2
  13. package/src/__tests__/metrics.test.ts +5 -0
  14. package/src/__tests__/pages.test.ts +14 -0
  15. package/src/__tests__/publish.test.ts +497 -254
  16. package/src/__tests__/r2.test.ts +173 -71
  17. package/src/__tests__/tail.test.ts +112 -42
  18. package/src/__tests__/user.test.ts +1 -0
  19. package/src/__tests__/validate-dev-props.test.ts +56 -0
  20. package/src/__tests__/whoami.test.tsx +60 -1
  21. package/src/api/dev.ts +7 -0
  22. package/src/bundle.ts +279 -44
  23. package/src/cfetch/internal.ts +73 -2
  24. package/src/config/config.ts +8 -3
  25. package/src/config/environment.ts +40 -8
  26. package/src/config/index.ts +13 -0
  27. package/src/config/validation.ts +102 -8
  28. package/src/create-worker-upload-form.ts +25 -0
  29. package/src/dev/dev.tsx +121 -28
  30. package/src/dev/local.tsx +88 -14
  31. package/src/dev/remote.tsx +39 -8
  32. package/src/dev/use-esbuild.ts +28 -0
  33. package/src/dev/validate-dev-props.ts +31 -0
  34. package/src/dev-registry.tsx +160 -0
  35. package/src/dev.tsx +107 -80
  36. package/src/generate.ts +112 -14
  37. package/src/index.tsx +212 -4
  38. package/src/init.ts +111 -38
  39. package/src/inspect.ts +90 -5
  40. package/src/metrics/index.ts +1 -0
  41. package/src/metrics/metrics-dispatcher.ts +1 -0
  42. package/src/metrics/metrics-usage-headers.ts +24 -0
  43. package/src/metrics/send-event.ts +2 -2
  44. package/src/miniflare-cli/assets.ts +27 -16
  45. package/src/miniflare-cli/index.ts +124 -2
  46. package/src/module-collection.ts +3 -3
  47. package/src/pages/build.tsx +75 -41
  48. package/src/pages/constants.ts +5 -0
  49. package/src/pages/deployments.tsx +10 -10
  50. package/src/pages/dev.tsx +177 -52
  51. package/src/pages/errors.ts +22 -0
  52. package/src/pages/functions/buildPlugin.ts +4 -0
  53. package/src/pages/functions/buildWorker.ts +4 -0
  54. package/src/pages/functions/routes-consolidation.test.ts +250 -0
  55. package/src/pages/functions/routes-consolidation.ts +73 -0
  56. package/src/pages/functions/routes-transformation.test.ts +271 -0
  57. package/src/pages/functions/routes-transformation.ts +122 -0
  58. package/src/pages/functions.tsx +96 -0
  59. package/src/pages/index.tsx +65 -55
  60. package/src/pages/projects.tsx +9 -3
  61. package/src/pages/publish.tsx +76 -23
  62. package/src/pages/types.ts +9 -0
  63. package/src/pages/upload.tsx +38 -21
  64. package/src/publish.ts +126 -112
  65. package/src/r2.ts +81 -0
  66. package/src/tail/filters.ts +3 -1
  67. package/src/tail/index.ts +15 -2
  68. package/src/tail/printing.ts +43 -3
  69. package/src/user/user.tsx +20 -2
  70. package/src/whoami.tsx +79 -1
  71. package/src/worker.ts +12 -0
  72. package/templates/first-party-worker-module-facade.ts +18 -0
  73. package/templates/format-dev-errors.ts +32 -0
  74. package/templates/pages-template-plugin.ts +16 -4
  75. package/templates/pages-template-worker.ts +16 -5
  76. package/templates/{static-asset-facade.js → serve-static-assets.ts} +21 -7
  77. package/templates/service-bindings-module-facade.js +54 -0
  78. package/templates/service-bindings-sw-facade.js +42 -0
  79. package/wrangler-dist/cli.d.ts +7 -0
  80. package/wrangler-dist/cli.js +40851 -15332
@@ -9,7 +9,7 @@ import {
9
9
  setMockRawResponse,
10
10
  setMockResponse,
11
11
  unsetAllMocks,
12
- unsetMockFetchKVGetValues,
12
+ unsetSpecialMockFns,
13
13
  } from "./helpers/mock-cfetch";
14
14
  import { mockConsoleMethods, normalizeSlashes } from "./helpers/mock-console";
15
15
  import { mockConfirm } from "./helpers/mock-dialogs";
@@ -23,6 +23,7 @@ import writeWranglerToml from "./helpers/write-wrangler-toml";
23
23
  import type { Config } from "../config";
24
24
  import type { WorkerMetadata } from "../create-worker-upload-form";
25
25
  import type { KVNamespaceInfo } from "../kv";
26
+ import type { CustomDomainChangeset, CustomDomain } from "../publish";
26
27
  import type { CfWorkerInit } from "../worker";
27
28
  import type { FormData, File } from "undici";
28
29
 
@@ -48,15 +49,24 @@ describe("publish", () => {
48
49
 
49
50
  afterEach(() => {
50
51
  unsetAllMocks();
51
- unsetMockFetchKVGetValues();
52
+ unsetSpecialMockFns();
52
53
  });
53
54
 
54
55
  describe("output additional script information", () => {
55
56
  mockApiToken();
56
57
 
57
- it("should print worker information at log level", async () => {
58
+ it("for first party workers, it should print worker information at log level", async () => {
58
59
  setIsTTY(false);
59
- writeWranglerToml();
60
+ fs.writeFileSync(
61
+ "./wrangler.toml",
62
+ TOML.stringify({
63
+ compatibility_date: "2022-01-12",
64
+ name: "test-name",
65
+ first_party_worker: true,
66
+ }),
67
+
68
+ "utf-8"
69
+ );
60
70
  writeWorkerSource();
61
71
  mockSubDomainRequest();
62
72
  mockUploadWorkerRequest({ expectedType: "esm", sendScriptIds: true });
@@ -71,7 +81,7 @@ describe("publish", () => {
71
81
  Worker PipelineHash: hash9999
72
82
  Uploaded test-name (TIMINGS)
73
83
  Published test-name (TIMINGS)
74
- test-name.test-sub-domain.workers.dev"
84
+ https://test-name.test-sub-domain.workers.dev"
75
85
  `);
76
86
  });
77
87
  });
@@ -107,7 +117,7 @@ describe("publish", () => {
107
117
  Total Upload: 0xx KiB / gzip: 0xx KiB
108
118
  Uploaded test-name (TIMINGS)
109
119
  Published test-name (TIMINGS)
110
- test-name.test-sub-domain.workers.dev"
120
+ https://test-name.test-sub-domain.workers.dev"
111
121
  `);
112
122
  expect(std.warn).toMatchInlineSnapshot(`""`);
113
123
  expect(std.err).toMatchInlineSnapshot(`""`);
@@ -128,7 +138,7 @@ describe("publish", () => {
128
138
  "Total Upload: 0xx KiB / gzip: 0xx KiB
129
139
  Uploaded test-name (TIMINGS)
130
140
  Published test-name (TIMINGS)
131
- test-name.test-sub-domain.workers.dev"
141
+ https://test-name.test-sub-domain.workers.dev"
132
142
  `);
133
143
  expect(std.warn).toMatchInlineSnapshot(`
134
144
  "▲ [WARNING] It looks like you have used Wrangler 1's \`config\` command to login with an API token.
@@ -168,7 +178,7 @@ describe("publish", () => {
168
178
  "Total Upload: 0xx KiB / gzip: 0xx KiB
169
179
  Uploaded test-name (TIMINGS)
170
180
  Published test-name (TIMINGS)
171
- test-name.test-sub-domain.workers.dev"
181
+ https://test-name.test-sub-domain.workers.dev"
172
182
  `);
173
183
  expect(std.err).toMatchInlineSnapshot(`""`);
174
184
  });
@@ -192,7 +202,7 @@ describe("publish", () => {
192
202
  "Total Upload: 0xx KiB / gzip: 0xx KiB
193
203
  Uploaded test-name (TIMINGS)
194
204
  Published test-name (TIMINGS)
195
- test-name.test-sub-domain.workers.dev"
205
+ https://test-name.test-sub-domain.workers.dev"
196
206
  `);
197
207
  expect(std.err).toMatchInlineSnapshot(`""`);
198
208
  });
@@ -294,7 +304,7 @@ describe("publish", () => {
294
304
  "Total Upload: 0xx KiB / gzip: 0xx KiB
295
305
  Uploaded test-name-some-env (TIMINGS)
296
306
  Published test-name-some-env (TIMINGS)
297
- test-name-some-env.test-sub-domain.workers.dev"
307
+ https://test-name-some-env.test-sub-domain.workers.dev"
298
308
  `);
299
309
  expect(std.err).toMatchInlineSnapshot(`""`);
300
310
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -313,7 +323,7 @@ describe("publish", () => {
313
323
  "Total Upload: 0xx KiB / gzip: 0xx KiB
314
324
  Uploaded test-name (TIMINGS)
315
325
  Published test-name (TIMINGS)
316
- test-name.test-sub-domain.workers.dev"
326
+ https://test-name.test-sub-domain.workers.dev"
317
327
  `);
318
328
  expect(std.err).toMatchInlineSnapshot(`""`);
319
329
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -332,7 +342,7 @@ describe("publish", () => {
332
342
  "Total Upload: 0xx KiB / gzip: 0xx KiB
333
343
  Uploaded test-name-some-env (TIMINGS)
334
344
  Published test-name-some-env (TIMINGS)
335
- test-name-some-env.test-sub-domain.workers.dev"
345
+ https://test-name-some-env.test-sub-domain.workers.dev"
336
346
  `);
337
347
  expect(std.err).toMatchInlineSnapshot(`""`);
338
348
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -351,7 +361,7 @@ describe("publish", () => {
351
361
  "Total Upload: 0xx KiB / gzip: 0xx KiB
352
362
  Uploaded test-name-some-env (TIMINGS)
353
363
  Published test-name-some-env (TIMINGS)
354
- test-name-some-env.test-sub-domain.workers.dev"
364
+ https://test-name-some-env.test-sub-domain.workers.dev"
355
365
  `);
356
366
  expect(std.err).toMatchInlineSnapshot(`""`);
357
367
  expect(std.warn).toMatchInlineSnapshot(`
@@ -421,7 +431,7 @@ describe("publish", () => {
421
431
  "Total Upload: 0xx KiB / gzip: 0xx KiB
422
432
  Uploaded test-name (TIMINGS)
423
433
  Published test-name (TIMINGS)
424
- test-name.test-sub-domain.workers.dev"
434
+ https://test-name.test-sub-domain.workers.dev"
425
435
  `);
426
436
  expect(std.err).toMatchInlineSnapshot(`""`);
427
437
  expect(std.warn).toMatchInlineSnapshot(`
@@ -447,7 +457,7 @@ describe("publish", () => {
447
457
  "Total Upload: 0xx KiB / gzip: 0xx KiB
448
458
  Uploaded test-name (some-env) (TIMINGS)
449
459
  Published test-name (some-env) (TIMINGS)
450
- some-env.test-name.test-sub-domain.workers.dev"
460
+ https://some-env.test-name.test-sub-domain.workers.dev"
451
461
  `);
452
462
  expect(std.err).toMatchInlineSnapshot(`""`);
453
463
  expect(std.warn).toMatchInlineSnapshot(`
@@ -493,7 +503,7 @@ describe("publish", () => {
493
503
  Total Upload: 0xx KiB / gzip: 0xx KiB
494
504
  Uploaded test-name (TIMINGS)
495
505
  Published test-name (TIMINGS)
496
- test-name.test-sub-domain.workers.dev"
506
+ https://test-name.test-sub-domain.workers.dev"
497
507
  `);
498
508
  expect(std.err).toMatchInlineSnapshot(`""`);
499
509
  });
@@ -527,7 +537,7 @@ describe("publish", () => {
527
537
  "out": "Total Upload: 0xx KiB / gzip: 0xx KiB
528
538
  Uploaded test-name (TIMINGS)
529
539
  Published test-name (TIMINGS)
530
- test-name.test-sub-domain.workers.dev",
540
+ https://test-name.test-sub-domain.workers.dev",
531
541
  "warn": "▲ [WARNING] Processing wrangler.toml configuration:
532
542
 
533
543
  - The \\"route\\" field in your configuration is an empty string and will be ignored.
@@ -782,6 +792,7 @@ describe("publish", () => {
782
792
  writeWorkerSource();
783
793
  mockUpdateWorkerRequest({ enabled: false });
784
794
  mockUploadWorkerRequest({ expectedType: "esm" });
795
+ mockCustomDomainsChangesetRequest({});
785
796
  mockPublishCustomDomainsRequest({
786
797
  publishFlags: {
787
798
  override_scope: true,
@@ -794,63 +805,145 @@ describe("publish", () => {
794
805
  expect(std.out).toContain("api.example.com (custom domain)");
795
806
  });
796
807
 
797
- it("should allow retrying if publish fails with a conflicting custom domain error", async () => {
808
+ it("should confirm override if custom domain publish would override an existing domain", async () => {
798
809
  writeWranglerToml({
799
810
  routes: [{ pattern: "api.example.com", custom_domain: true }],
800
811
  });
801
812
  writeWorkerSource();
802
813
  mockUpdateWorkerRequest({ enabled: false });
803
814
  mockUploadWorkerRequest({ expectedType: "esm" });
804
- mockPublishCustomDomainsRequestConflictWithoutOverride({
805
- originConflicts: true,
815
+ mockCustomDomainsChangesetRequest({
816
+ originConflicts: [
817
+ {
818
+ id: "101",
819
+ zone_id: "",
820
+ zone_name: "",
821
+ hostname: "api.example.com",
822
+ service: "test-name",
823
+ environment: "",
824
+ },
825
+ ],
826
+ });
827
+ mockCustomDomainLookup({
828
+ id: "101",
829
+ zone_id: "",
830
+ zone_name: "",
831
+ hostname: "api.example.com",
832
+ service: "other-script",
833
+ environment: "",
834
+ });
835
+ mockPublishCustomDomainsRequest({
836
+ publishFlags: {
837
+ override_scope: true,
838
+ override_existing_origin: true,
839
+ override_existing_dns_record: false,
840
+ },
806
841
  domains: [{ hostname: "api.example.com" }],
807
842
  });
808
843
  mockConfirm({
809
- text: `Custom Domains already exist for these domains: "api.example.com"\nUpdate them to point to this script instead?`,
844
+ text: `Custom Domains already exist for these domains:
845
+ \t• api.example.com (used as a domain for "other-script")
846
+ Update them to point to this script instead?`,
810
847
  result: true,
811
848
  });
812
849
  await runWrangler("publish ./index");
813
850
  expect(std.out).toContain("api.example.com (custom domain)");
814
851
  });
815
852
 
816
- it("should allow retrying if publish fails with a conflicting DNS record error", async () => {
853
+ it("should confirm override if custom domain publish contains a conflicting DNS record", async () => {
817
854
  writeWranglerToml({
818
855
  routes: [{ pattern: "api.example.com", custom_domain: true }],
819
856
  });
820
857
  writeWorkerSource();
821
858
  mockUpdateWorkerRequest({ enabled: false });
822
859
  mockUploadWorkerRequest({ expectedType: "esm" });
823
- mockPublishCustomDomainsRequestConflictWithoutOverride({
824
- dnsRecordConflicts: true,
860
+ mockCustomDomainsChangesetRequest({
861
+ dnsRecordConflicts: [
862
+ {
863
+ id: "",
864
+ zone_id: "",
865
+ zone_name: "",
866
+ hostname: "api.example.com",
867
+ service: "test-name",
868
+ environment: "",
869
+ },
870
+ ],
871
+ });
872
+ mockPublishCustomDomainsRequest({
873
+ publishFlags: {
874
+ override_scope: true,
875
+ override_existing_origin: false,
876
+ override_existing_dns_record: true,
877
+ },
825
878
  domains: [{ hostname: "api.example.com" }],
826
879
  });
827
880
  mockConfirm({
828
- text: `You already have conflicting DNS records for these domains: "api.example.com"\nUpdate them to point to this script instead?`,
881
+ text: `You already have DNS records that conflict for these Custom Domains:
882
+ \t• api.example.com
883
+ Update them to point to this script instead?`,
829
884
  result: true,
830
885
  });
831
886
  await runWrangler("publish ./index");
832
887
  expect(std.out).toContain("api.example.com (custom domain)");
833
888
  });
834
889
 
835
- it("should allow retrying for conflicting custom domains and then again for conflicting dns", async () => {
890
+ it("should confirm for conflicting custom domains and then again for conflicting dns", async () => {
836
891
  writeWranglerToml({
837
892
  routes: [{ pattern: "api.example.com", custom_domain: true }],
838
893
  });
839
894
  writeWorkerSource();
840
895
  mockUpdateWorkerRequest({ enabled: false });
841
896
  mockUploadWorkerRequest({ expectedType: "esm" });
842
- mockPublishCustomDomainsRequestConflictWithoutOverride({
843
- originConflicts: true,
844
- dnsRecordConflicts: true,
897
+ mockCustomDomainsChangesetRequest({
898
+ originConflicts: [
899
+ {
900
+ id: "101",
901
+ zone_id: "",
902
+ zone_name: "",
903
+ hostname: "api.example.com",
904
+ service: "test-name",
905
+ environment: "",
906
+ },
907
+ ],
908
+ dnsRecordConflicts: [
909
+ {
910
+ id: "",
911
+ zone_id: "",
912
+ zone_name: "",
913
+ hostname: "api.example.com",
914
+ service: "test-name",
915
+ environment: "",
916
+ },
917
+ ],
918
+ });
919
+ mockCustomDomainLookup({
920
+ id: "101",
921
+ zone_id: "",
922
+ zone_name: "",
923
+ hostname: "api.example.com",
924
+ service: "other-script",
925
+ environment: "",
926
+ });
927
+ mockPublishCustomDomainsRequest({
928
+ publishFlags: {
929
+ override_scope: true,
930
+ override_existing_origin: true,
931
+ override_existing_dns_record: true,
932
+ },
845
933
  domains: [{ hostname: "api.example.com" }],
846
934
  });
847
935
  mockConfirm(
848
936
  {
849
- text: `Custom Domains already exist for these domains: "api.example.com"\nUpdate them to point to this script instead?`,
937
+ text: `Custom Domains already exist for these domains:
938
+ \t• api.example.com (used as a domain for "other-script")
939
+ Update them to point to this script instead?`,
850
940
  result: true,
851
941
  },
852
942
  {
853
- text: `You already have conflicting DNS records for these domains: "api.example.com"\nUpdate them to point to this script instead?`,
943
+ text: `You already have DNS records that conflict for these Custom Domains:
944
+ \t• api.example.com
945
+ Update them to point to this script instead?`,
946
+
854
947
  result: true,
855
948
  }
856
949
  );
@@ -882,19 +975,37 @@ describe("publish", () => {
882
975
  );
883
976
  });
884
977
 
885
- it("should not retry publish on error if user does not confirm", async () => {
978
+ it("should not continue with publishing an override if user does not confirm", async () => {
886
979
  writeWranglerToml({
887
980
  routes: [{ pattern: "api.example.com", custom_domain: true }],
888
981
  });
889
982
  writeWorkerSource();
890
983
  mockUpdateWorkerRequest({ enabled: false });
891
984
  mockUploadWorkerRequest({ expectedType: "esm" });
892
- mockPublishCustomDomainsRequestConflictWithoutOverride({
893
- dnsRecordConflicts: true,
894
- domains: [{ hostname: "api.example.com" }],
985
+ mockCustomDomainsChangesetRequest({
986
+ originConflicts: [
987
+ {
988
+ id: "101",
989
+ zone_id: "",
990
+ zone_name: "",
991
+ hostname: "api.example.com",
992
+ service: "test-name",
993
+ environment: "",
994
+ },
995
+ ],
996
+ });
997
+ mockCustomDomainLookup({
998
+ id: "101",
999
+ zone_id: "",
1000
+ zone_name: "",
1001
+ hostname: "api.example.com",
1002
+ service: "other-script",
1003
+ environment: "",
895
1004
  });
896
1005
  mockConfirm({
897
- text: `You already have conflicting DNS records for these domains: "api.example.com"\nUpdate them to point to this script instead?`,
1006
+ text: `Custom Domains already exist for these domains:
1007
+ \t• api.example.com (used as a domain for "other-script")
1008
+ Update them to point to this script instead?`,
898
1009
  result: false,
899
1010
  });
900
1011
  await runWrangler("publish ./index");
@@ -920,7 +1031,7 @@ describe("publish", () => {
920
1031
  "Total Upload: 0xx KiB / gzip: 0xx KiB
921
1032
  Uploaded test-name (TIMINGS)
922
1033
  Published test-name (TIMINGS)
923
- test-name.test-sub-domain.workers.dev"
1034
+ https://test-name.test-sub-domain.workers.dev"
924
1035
  `);
925
1036
  expect(std.err).toMatchInlineSnapshot(`""`);
926
1037
  });
@@ -937,7 +1048,7 @@ describe("publish", () => {
937
1048
  "Total Upload: 0xx KiB / gzip: 0xx KiB
938
1049
  Uploaded test-name (TIMINGS)
939
1050
  Published test-name (TIMINGS)
940
- test-name.test-sub-domain.workers.dev"
1051
+ https://test-name.test-sub-domain.workers.dev"
941
1052
  `);
942
1053
  expect(std.err).toMatchInlineSnapshot(`""`);
943
1054
  });
@@ -954,7 +1065,7 @@ describe("publish", () => {
954
1065
  "Total Upload: 0xx KiB / gzip: 0xx KiB
955
1066
  Uploaded test-name (TIMINGS)
956
1067
  Published test-name (TIMINGS)
957
- test-name.test-sub-domain.workers.dev"
1068
+ https://test-name.test-sub-domain.workers.dev"
958
1069
  `);
959
1070
  expect(std.err).toMatchInlineSnapshot(`""`);
960
1071
  });
@@ -973,7 +1084,7 @@ describe("publish", () => {
973
1084
  "Total Upload: 0xx KiB / gzip: 0xx KiB
974
1085
  Uploaded test-name (TIMINGS)
975
1086
  Published test-name (TIMINGS)
976
- test-name.test-sub-domain.workers.dev"
1087
+ https://test-name.test-sub-domain.workers.dev"
977
1088
  `);
978
1089
  expect(std.err).toMatchInlineSnapshot(`""`);
979
1090
  });
@@ -990,7 +1101,7 @@ describe("publish", () => {
990
1101
  "Total Upload: 0xx KiB / gzip: 0xx KiB
991
1102
  Uploaded test-name (TIMINGS)
992
1103
  Published test-name (TIMINGS)
993
- test-name.test-sub-domain.workers.dev"
1104
+ https://test-name.test-sub-domain.workers.dev"
994
1105
  `);
995
1106
  expect(std.err).toMatchInlineSnapshot(`""`);
996
1107
  expect(std.warn).toMatchInlineSnapshot(`
@@ -1026,7 +1137,7 @@ describe("publish", () => {
1026
1137
  "Total Upload: 0xx KiB / gzip: 0xx KiB
1027
1138
  Uploaded test-name (TIMINGS)
1028
1139
  Published test-name (TIMINGS)
1029
- test-name.test-sub-domain.workers.dev"
1140
+ https://test-name.test-sub-domain.workers.dev"
1030
1141
  `);
1031
1142
  expect(std.err).toMatchInlineSnapshot(`""`);
1032
1143
  expect(std.warn).toMatchInlineSnapshot(`
@@ -1076,7 +1187,7 @@ describe("publish", () => {
1076
1187
  "Total Upload: 0xx KiB / gzip: 0xx KiB
1077
1188
  Uploaded test-name (TIMINGS)
1078
1189
  Published test-name (TIMINGS)
1079
- test-name.test-sub-domain.workers.dev"
1190
+ https://test-name.test-sub-domain.workers.dev"
1080
1191
  `);
1081
1192
  expect(std.err).toMatchInlineSnapshot(`""`);
1082
1193
  });
@@ -1095,7 +1206,7 @@ describe("publish", () => {
1095
1206
  "Total Upload: 0xx KiB / gzip: 0xx KiB
1096
1207
  Uploaded test-name (TIMINGS)
1097
1208
  Published test-name (TIMINGS)
1098
- test-name.test-sub-domain.workers.dev"
1209
+ https://test-name.test-sub-domain.workers.dev"
1099
1210
  `);
1100
1211
  expect(std.err).toMatchInlineSnapshot(`""`);
1101
1212
  });
@@ -1126,7 +1237,7 @@ export default{
1126
1237
  "Total Upload: 0xx KiB / gzip: 0xx KiB
1127
1238
  Uploaded test-name (TIMINGS)
1128
1239
  Published test-name (TIMINGS)
1129
- test-name.test-sub-domain.workers.dev"
1240
+ https://test-name.test-sub-domain.workers.dev"
1130
1241
  `);
1131
1242
  expect(std.err).toMatchInlineSnapshot(`""`);
1132
1243
  });
@@ -1143,7 +1254,7 @@ export default{
1143
1254
  "Total Upload: 0xx KiB / gzip: 0xx KiB
1144
1255
  Uploaded test-name (TIMINGS)
1145
1256
  Published test-name (TIMINGS)
1146
- test-name.test-sub-domain.workers.dev"
1257
+ https://test-name.test-sub-domain.workers.dev"
1147
1258
  `);
1148
1259
  expect(std.err).toMatchInlineSnapshot(`""`);
1149
1260
  });
@@ -1237,7 +1348,7 @@ addEventListener('fetch', event => {});`
1237
1348
  "Total Upload: 0xx KiB / gzip: 0xx KiB
1238
1349
  Uploaded test-name (TIMINGS)
1239
1350
  Published test-name (TIMINGS)
1240
- test-name.test-sub-domain.workers.dev"
1351
+ https://test-name.test-sub-domain.workers.dev"
1241
1352
  `);
1242
1353
  expect(std.err).toMatchInlineSnapshot(`""`);
1243
1354
  });
@@ -1319,7 +1430,7 @@ addEventListener('fetch', event => {});`
1319
1430
  Total Upload: 0xx KiB / gzip: 0xx KiB
1320
1431
  Uploaded test-name (TIMINGS)
1321
1432
  Published test-name (TIMINGS)
1322
- test-name.test-sub-domain.workers.dev",
1433
+ https://test-name.test-sub-domain.workers.dev",
1323
1434
  "warn": "▲ [WARNING] Processing wrangler.toml configuration:
1324
1435
 
1325
1436
  - Deprecation: \\"site.entry-point\\":
@@ -1371,7 +1482,7 @@ addEventListener('fetch', event => {});`
1371
1482
  Total Upload: 0xx KiB / gzip: 0xx KiB
1372
1483
  Uploaded test-name (TIMINGS)
1373
1484
  Published test-name (TIMINGS)
1374
- test-name.test-sub-domain.workers.dev"
1485
+ https://test-name.test-sub-domain.workers.dev"
1375
1486
  `);
1376
1487
  expect(std.err).toMatchInlineSnapshot(`""`);
1377
1488
  expect(normalizeSlashes(std.warn)).toMatchInlineSnapshot(`
@@ -1438,7 +1549,9 @@ addEventListener('fetch', event => {});`
1438
1549
  id: "__test-name-workers_sites_assets-id",
1439
1550
  };
1440
1551
  writeAssets(assets);
1441
- mockUploadWorkerRequest({ expectedMainModule: "stdin.js" });
1552
+ mockUploadWorkerRequest({
1553
+ expectedMainModule: "serve-static-assets.entry.js",
1554
+ });
1442
1555
  mockSubDomainRequest();
1443
1556
  mockListKVNamespacesRequest(kvNamespace);
1444
1557
  mockKeyListRequest(kvNamespace.id, []);
@@ -1447,28 +1560,28 @@ addEventListener('fetch', event => {});`
1447
1560
  await runWrangler("publish --assets assets --latest --name test-name");
1448
1561
 
1449
1562
  expect(std).toMatchInlineSnapshot(`
1450
- Object {
1451
- "debug": "",
1452
- "err": "",
1453
- "out": "Reading file-1.txt...
1454
- Uploading as file-1.2ca234f380.txt...
1455
- Reading file-2.txt...
1456
- Uploading as file-2.5938485188.txt...
1457
- ↗️ Done syncing assets
1458
- Total Upload: 52xx KiB / gzip: 13xx KiB
1459
- Uploaded test-name (TIMINGS)
1460
- Published test-name (TIMINGS)
1461
- test-name.test-sub-domain.workers.dev",
1462
- "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
1563
+ Object {
1564
+ "debug": "",
1565
+ "err": "",
1566
+ "out": "Reading file-1.txt...
1567
+ Uploading as file-1.2ca234f380.txt...
1568
+ Reading file-2.txt...
1569
+ Uploading as file-2.5938485188.txt...
1570
+ ↗️ Done syncing assets
1571
+ Total Upload: 52xx KiB / gzip: 14xx KiB
1572
+ Uploaded test-name (TIMINGS)
1573
+ Published test-name (TIMINGS)
1574
+ https://test-name.test-sub-domain.workers.dev",
1575
+ "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
1463
1576
 
1464
1577
 
1465
- ▲ [WARNING] Using the latest version of the Workers runtime. To silence this warning, please choose a specific version of the runtime with --compatibility-date, or add a compatibility_date to your wrangler.toml.
1578
+ ▲ [WARNING] Using the latest version of the Workers runtime. To silence this warning, please choose a specific version of the runtime with --compatibility-date, or add a compatibility_date to your wrangler.toml.
1466
1579
 
1467
1580
 
1468
1581
 
1469
- ",
1470
- }
1471
- `);
1582
+ ",
1583
+ }
1584
+ `);
1472
1585
  });
1473
1586
  });
1474
1587
 
@@ -1506,7 +1619,7 @@ addEventListener('fetch', event => {});`
1506
1619
  Total Upload: 0xx KiB / gzip: 0xx KiB
1507
1620
  Uploaded test-name (TIMINGS)
1508
1621
  Published test-name (TIMINGS)
1509
- test-name.test-sub-domain.workers.dev"
1622
+ https://test-name.test-sub-domain.workers.dev"
1510
1623
  `);
1511
1624
  expect(std.err).toMatchInlineSnapshot(`""`);
1512
1625
  });
@@ -1526,7 +1639,7 @@ addEventListener('fetch', event => {});`
1526
1639
  writeWorkerSource();
1527
1640
  writeAssets(assets);
1528
1641
  mockUploadWorkerRequest({
1529
- expectedMainModule: "stdin.js",
1642
+ expectedMainModule: "serve-static-assets.entry.js",
1530
1643
  });
1531
1644
  mockSubDomainRequest();
1532
1645
  mockListKVNamespacesRequest(kvNamespace);
@@ -1535,23 +1648,23 @@ addEventListener('fetch', event => {});`
1535
1648
  await runWrangler("publish --assets assets");
1536
1649
 
1537
1650
  expect(std).toMatchInlineSnapshot(`
1538
- Object {
1539
- "debug": "",
1540
- "err": "",
1541
- "out": "Reading file-1.txt...
1542
- Uploading as file-1.2ca234f380.txt...
1543
- Reading file-2.txt...
1544
- Uploading as file-2.5938485188.txt...
1545
- ↗️ Done syncing assets
1546
- Total Upload: 52xx KiB / gzip: 13xx KiB
1547
- Uploaded test-name (TIMINGS)
1548
- Published test-name (TIMINGS)
1549
- test-name.test-sub-domain.workers.dev",
1550
- "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
1651
+ Object {
1652
+ "debug": "",
1653
+ "err": "",
1654
+ "out": "Reading file-1.txt...
1655
+ Uploading as file-1.2ca234f380.txt...
1656
+ Reading file-2.txt...
1657
+ Uploading as file-2.5938485188.txt...
1658
+ ↗️ Done syncing assets
1659
+ Total Upload: 52xx KiB / gzip: 14xx KiB
1660
+ Uploaded test-name (TIMINGS)
1661
+ Published test-name (TIMINGS)
1662
+ https://test-name.test-sub-domain.workers.dev",
1663
+ "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
1551
1664
 
1552
- ",
1553
- }
1554
- `);
1665
+ ",
1666
+ }
1667
+ `);
1555
1668
  });
1556
1669
 
1557
1670
  it("should error when trying to use --assets with a service-worker Worker", async () => {
@@ -1634,6 +1747,7 @@ addEventListener('fetch', event => {});`
1634
1747
  it("should error if config.assets and --site are used together", async () => {
1635
1748
  writeWranglerToml({
1636
1749
  main: "./index.js",
1750
+ // @ts-expect-error we allow string inputs here
1637
1751
  assets: "abc",
1638
1752
  });
1639
1753
  writeWorkerSource();
@@ -1663,6 +1777,7 @@ addEventListener('fetch', event => {});`
1663
1777
  it("should error if config.assets and config.site are used together", async () => {
1664
1778
  writeWranglerToml({
1665
1779
  main: "./index.js",
1780
+ // @ts-expect-error we allow string inputs here
1666
1781
  assets: "abc",
1667
1782
  site: {
1668
1783
  bucket: "xyz",
@@ -1708,7 +1823,7 @@ addEventListener('fetch', event => {});`
1708
1823
  writeWorkerSource();
1709
1824
  writeAssets(assets);
1710
1825
  mockUploadWorkerRequest({
1711
- expectedMainModule: "stdin.js",
1826
+ expectedMainModule: "serve-static-assets.entry.js",
1712
1827
  });
1713
1828
  mockSubDomainRequest();
1714
1829
  mockListKVNamespacesRequest(kvNamespace);
@@ -1717,28 +1832,29 @@ addEventListener('fetch', event => {});`
1717
1832
 
1718
1833
  await runWrangler("publish --assets ./assets");
1719
1834
  expect(std).toMatchInlineSnapshot(`
1720
- Object {
1721
- "debug": "",
1722
- "err": "",
1723
- "out": "Reading subdir/file-1.txt...
1724
- Uploading as subdir/file-1.2ca234f380.txt...
1725
- Reading subdir/file-2.txt...
1726
- Uploading as subdir/file-2.5938485188.txt...
1727
- ↗️ Done syncing assets
1728
- Total Upload: 52xx KiB / gzip: 13xx KiB
1729
- Uploaded test-name (TIMINGS)
1730
- Published test-name (TIMINGS)
1731
- test-name.test-sub-domain.workers.dev",
1732
- "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
1835
+ Object {
1836
+ "debug": "",
1837
+ "err": "",
1838
+ "out": "Reading subdir/file-1.txt...
1839
+ Uploading as subdir/file-1.2ca234f380.txt...
1840
+ Reading subdir/file-2.txt...
1841
+ Uploading as subdir/file-2.5938485188.txt...
1842
+ ↗️ Done syncing assets
1843
+ Total Upload: 52xx KiB / gzip: 14xx KiB
1844
+ Uploaded test-name (TIMINGS)
1845
+ Published test-name (TIMINGS)
1846
+ https://test-name.test-sub-domain.workers.dev",
1847
+ "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
1733
1848
 
1734
- ",
1735
- }
1736
- `);
1849
+ ",
1850
+ }
1851
+ `);
1737
1852
  });
1738
1853
 
1739
1854
  it("should warn if config.assets is used", async () => {
1740
1855
  writeWranglerToml({
1741
1856
  main: "./index.js",
1857
+ // @ts-expect-error we allow string inputs here
1742
1858
  assets: "./assets",
1743
1859
  });
1744
1860
  const assets = [
@@ -1753,7 +1869,7 @@ addEventListener('fetch', event => {});`
1753
1869
  writeWorkerSource();
1754
1870
  writeAssets(assets);
1755
1871
  mockUploadWorkerRequest({
1756
- expectedMainModule: "stdin.js",
1872
+ expectedMainModule: "serve-static-assets.entry.js",
1757
1873
  });
1758
1874
  mockSubDomainRequest();
1759
1875
  mockListKVNamespacesRequest(kvNamespace);
@@ -1762,25 +1878,25 @@ addEventListener('fetch', event => {});`
1762
1878
 
1763
1879
  await runWrangler("publish");
1764
1880
  expect(std).toMatchInlineSnapshot(`
1765
- Object {
1766
- "debug": "",
1767
- "err": "",
1768
- "out": "Reading subdir/file-1.txt...
1769
- Uploading as subdir/file-1.2ca234f380.txt...
1770
- Reading subdir/file-2.txt...
1771
- Uploading as subdir/file-2.5938485188.txt...
1772
- ↗️ Done syncing assets
1773
- Total Upload: 52xx KiB / gzip: 13xx KiB
1774
- Uploaded test-name (TIMINGS)
1775
- Published test-name (TIMINGS)
1776
- test-name.test-sub-domain.workers.dev",
1777
- "warn": "▲ [WARNING] Processing wrangler.toml configuration:
1881
+ Object {
1882
+ "debug": "",
1883
+ "err": "",
1884
+ "out": "Reading subdir/file-1.txt...
1885
+ Uploading as subdir/file-1.2ca234f380.txt...
1886
+ Reading subdir/file-2.txt...
1887
+ Uploading as subdir/file-2.5938485188.txt...
1888
+ ↗️ Done syncing assets
1889
+ Total Upload: 52xx KiB / gzip: 14xx KiB
1890
+ Uploaded test-name (TIMINGS)
1891
+ Published test-name (TIMINGS)
1892
+ https://test-name.test-sub-domain.workers.dev",
1893
+ "warn": "▲ [WARNING] Processing wrangler.toml configuration:
1778
1894
 
1779
- - \\"assets\\" fields are experimental and may change or break at any time.
1895
+ - \\"assets\\" fields are experimental and may change or break at any time.
1780
1896
 
1781
- ",
1782
- }
1783
- `);
1897
+ ",
1898
+ }
1899
+ `);
1784
1900
  });
1785
1901
 
1786
1902
  it("should not contain backslash for assets with nested directories", async () => {
@@ -1829,7 +1945,7 @@ addEventListener('fetch', event => {});`
1829
1945
  Total Upload: 0xx KiB / gzip: 0xx KiB
1830
1946
  Uploaded test-name (TIMINGS)
1831
1947
  Published test-name (TIMINGS)
1832
- test-name.test-sub-domain.workers.dev"
1948
+ https://test-name.test-sub-domain.workers.dev"
1833
1949
  `);
1834
1950
  expect(std.err).toMatchInlineSnapshot(`""`);
1835
1951
  });
@@ -1886,7 +2002,7 @@ addEventListener('fetch', event => {});`
1886
2002
  Total Upload: 0xx KiB / gzip: 0xx KiB
1887
2003
  Uploaded test-name (TIMINGS)
1888
2004
  Published test-name (TIMINGS)
1889
- test-name.test-sub-domain.workers.dev"
2005
+ https://test-name.test-sub-domain.workers.dev"
1890
2006
  `);
1891
2007
  expect(std.err).toMatchInlineSnapshot(`""`);
1892
2008
  });
@@ -1937,7 +2053,7 @@ addEventListener('fetch', event => {});`
1937
2053
  Total Upload: 0xx KiB / gzip: 0xx KiB
1938
2054
  Uploaded test-name (TIMINGS)
1939
2055
  Published test-name (TIMINGS)
1940
- test-name.test-sub-domain.workers.dev"
2056
+ https://test-name.test-sub-domain.workers.dev"
1941
2057
  `);
1942
2058
  expect(std.err).toMatchInlineSnapshot(`""`);
1943
2059
  });
@@ -1986,7 +2102,7 @@ addEventListener('fetch', event => {});`
1986
2102
  Total Upload: 0xx KiB / gzip: 0xx KiB
1987
2103
  Uploaded test-name (some-env) (TIMINGS)
1988
2104
  Published test-name (some-env) (TIMINGS)
1989
- some-env.test-name.test-sub-domain.workers.dev"
2105
+ https://some-env.test-name.test-sub-domain.workers.dev"
1990
2106
  `);
1991
2107
  expect(std.err).toMatchInlineSnapshot(`""`);
1992
2108
  });
@@ -2036,7 +2152,7 @@ addEventListener('fetch', event => {});`
2036
2152
  Total Upload: 0xx KiB / gzip: 0xx KiB
2037
2153
  Uploaded test-name-some-env (TIMINGS)
2038
2154
  Published test-name-some-env (TIMINGS)
2039
- test-name-some-env.test-sub-domain.workers.dev"
2155
+ https://test-name-some-env.test-sub-domain.workers.dev"
2040
2156
  `);
2041
2157
  expect(std.err).toMatchInlineSnapshot(`""`);
2042
2158
  });
@@ -2079,7 +2195,7 @@ addEventListener('fetch', event => {});`
2079
2195
  Total Upload: 0xx KiB / gzip: 0xx KiB
2080
2196
  Uploaded test-name (TIMINGS)
2081
2197
  Published test-name (TIMINGS)
2082
- test-name.test-sub-domain.workers.dev"
2198
+ https://test-name.test-sub-domain.workers.dev"
2083
2199
  `);
2084
2200
  expect(std.err).toMatchInlineSnapshot(`""`);
2085
2201
  });
@@ -2119,7 +2235,7 @@ addEventListener('fetch', event => {});`
2119
2235
  Total Upload: 0xx KiB / gzip: 0xx KiB
2120
2236
  Uploaded test-name (TIMINGS)
2121
2237
  Published test-name (TIMINGS)
2122
- test-name.test-sub-domain.workers.dev"
2238
+ https://test-name.test-sub-domain.workers.dev"
2123
2239
  `);
2124
2240
  expect(std.err).toMatchInlineSnapshot(`""`);
2125
2241
  });
@@ -2159,7 +2275,7 @@ addEventListener('fetch', event => {});`
2159
2275
  Total Upload: 0xx KiB / gzip: 0xx KiB
2160
2276
  Uploaded test-name (TIMINGS)
2161
2277
  Published test-name (TIMINGS)
2162
- test-name.test-sub-domain.workers.dev"
2278
+ https://test-name.test-sub-domain.workers.dev"
2163
2279
  `);
2164
2280
  expect(std.err).toMatchInlineSnapshot(`""`);
2165
2281
  });
@@ -2200,7 +2316,7 @@ addEventListener('fetch', event => {});`
2200
2316
  Total Upload: 0xx KiB / gzip: 0xx KiB
2201
2317
  Uploaded test-name (TIMINGS)
2202
2318
  Published test-name (TIMINGS)
2203
- test-name.test-sub-domain.workers.dev"
2319
+ https://test-name.test-sub-domain.workers.dev"
2204
2320
  `);
2205
2321
  expect(std.err).toMatchInlineSnapshot(`""`);
2206
2322
  });
@@ -2241,7 +2357,7 @@ addEventListener('fetch', event => {});`
2241
2357
  Total Upload: 0xx KiB / gzip: 0xx KiB
2242
2358
  Uploaded test-name (TIMINGS)
2243
2359
  Published test-name (TIMINGS)
2244
- test-name.test-sub-domain.workers.dev"
2360
+ https://test-name.test-sub-domain.workers.dev"
2245
2361
  `);
2246
2362
  expect(std.err).toMatchInlineSnapshot(`""`);
2247
2363
  });
@@ -2282,7 +2398,7 @@ addEventListener('fetch', event => {});`
2282
2398
  Total Upload: 0xx KiB / gzip: 0xx KiB
2283
2399
  Uploaded test-name (TIMINGS)
2284
2400
  Published test-name (TIMINGS)
2285
- test-name.test-sub-domain.workers.dev"
2401
+ https://test-name.test-sub-domain.workers.dev"
2286
2402
  `);
2287
2403
  expect(std.err).toMatchInlineSnapshot(`""`);
2288
2404
  });
@@ -2323,7 +2439,7 @@ addEventListener('fetch', event => {});`
2323
2439
  Total Upload: 0xx KiB / gzip: 0xx KiB
2324
2440
  Uploaded test-name (TIMINGS)
2325
2441
  Published test-name (TIMINGS)
2326
- test-name.test-sub-domain.workers.dev"
2442
+ https://test-name.test-sub-domain.workers.dev"
2327
2443
  `);
2328
2444
  expect(std.err).toMatchInlineSnapshot(`""`);
2329
2445
  });
@@ -2366,7 +2482,7 @@ addEventListener('fetch', event => {});`
2366
2482
  Total Upload: 0xx KiB / gzip: 0xx KiB
2367
2483
  Uploaded test-name (TIMINGS)
2368
2484
  Published test-name (TIMINGS)
2369
- test-name.test-sub-domain.workers.dev"
2485
+ https://test-name.test-sub-domain.workers.dev"
2370
2486
  `);
2371
2487
  expect(std.err).toMatchInlineSnapshot(`""`);
2372
2488
  });
@@ -2413,7 +2529,7 @@ addEventListener('fetch', event => {});`
2413
2529
  Total Upload: 0xx KiB / gzip: 0xx KiB
2414
2530
  Uploaded test-name (TIMINGS)
2415
2531
  Published test-name (TIMINGS)
2416
- test-name.test-sub-domain.workers.dev"
2532
+ https://test-name.test-sub-domain.workers.dev"
2417
2533
  `);
2418
2534
  expect(std.err).toMatchInlineSnapshot(`""`);
2419
2535
  });
@@ -2562,7 +2678,7 @@ addEventListener('fetch', event => {});`
2562
2678
  Total Upload: 1xx KiB / gzip: 0xx KiB
2563
2679
  Uploaded test-name (TIMINGS)
2564
2680
  Published test-name (TIMINGS)
2565
- test-name.test-sub-domain.workers.dev",
2681
+ https://test-name.test-sub-domain.workers.dev",
2566
2682
  "warn": "",
2567
2683
  }
2568
2684
  `);
@@ -2661,7 +2777,7 @@ addEventListener('fetch', event => {});`
2661
2777
  Total Upload: 0xx KiB / gzip: 0xx KiB
2662
2778
  Uploaded test-name (TIMINGS)
2663
2779
  Published test-name (TIMINGS)
2664
- test-name.test-sub-domain.workers.dev"
2780
+ https://test-name.test-sub-domain.workers.dev"
2665
2781
  `);
2666
2782
  expect(std.err).toMatchInlineSnapshot(`""`);
2667
2783
  });
@@ -2715,7 +2831,7 @@ addEventListener('fetch', event => {});`
2715
2831
  Total Upload: 0xx KiB / gzip: 0xx KiB
2716
2832
  Uploaded test-name (TIMINGS)
2717
2833
  Published test-name (TIMINGS)
2718
- test-name.test-sub-domain.workers.dev"
2834
+ https://test-name.test-sub-domain.workers.dev"
2719
2835
  `);
2720
2836
  expect(std.err).toMatchInlineSnapshot(`""`);
2721
2837
  });
@@ -2756,7 +2872,7 @@ addEventListener('fetch', event => {});`
2756
2872
  Total Upload: 0xx KiB / gzip: 0xx KiB
2757
2873
  Uploaded test-name (TIMINGS)
2758
2874
  Published test-name (TIMINGS)
2759
- test-name.test-sub-domain.workers.dev",
2875
+ https://test-name.test-sub-domain.workers.dev",
2760
2876
  "warn": "",
2761
2877
  }
2762
2878
  `);
@@ -2777,7 +2893,7 @@ addEventListener('fetch', event => {});`
2777
2893
  writeWorkerSource();
2778
2894
  writeAssets(assets, "my-assets");
2779
2895
  mockUploadWorkerRequest({
2780
- expectedMainModule: "stdin.js",
2896
+ expectedMainModule: "serve-static-assets.entry.js",
2781
2897
  });
2782
2898
  mockSubDomainRequest();
2783
2899
  mockListKVNamespacesRequest(kvNamespace);
@@ -2787,23 +2903,23 @@ addEventListener('fetch', event => {});`
2787
2903
  await runWrangler("publish --assets .");
2788
2904
 
2789
2905
  expect(std).toMatchInlineSnapshot(`
2790
- Object {
2791
- "debug": "",
2792
- "err": "",
2793
- "out": "Reading file-1.txt...
2794
- Uploading as file-1.2ca234f380.txt...
2795
- Reading file-2.txt...
2796
- Uploading as file-2.5938485188.txt...
2797
- ↗️ Done syncing assets
2798
- Total Upload: 52xx KiB / gzip: 13xx KiB
2799
- Uploaded test-name (TIMINGS)
2800
- Published test-name (TIMINGS)
2801
- test-name.test-sub-domain.workers.dev",
2802
- "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
2906
+ Object {
2907
+ "debug": "",
2908
+ "err": "",
2909
+ "out": "Reading file-1.txt...
2910
+ Uploading as file-1.2ca234f380.txt...
2911
+ Reading file-2.txt...
2912
+ Uploading as file-2.5938485188.txt...
2913
+ ↗️ Done syncing assets
2914
+ Total Upload: 52xx KiB / gzip: 14xx KiB
2915
+ Uploaded test-name (TIMINGS)
2916
+ Published test-name (TIMINGS)
2917
+ https://test-name.test-sub-domain.workers.dev",
2918
+ "warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time
2803
2919
 
2804
- ",
2805
- }
2806
- `);
2920
+ ",
2921
+ }
2922
+ `);
2807
2923
  });
2808
2924
  });
2809
2925
 
@@ -2820,7 +2936,7 @@ addEventListener('fetch', event => {});`
2820
2936
  "Total Upload: 0xx KiB / gzip: 0xx KiB
2821
2937
  Uploaded test-name (TIMINGS)
2822
2938
  Published test-name (TIMINGS)
2823
- test-name.test-sub-domain.workers.dev"
2939
+ https://test-name.test-sub-domain.workers.dev"
2824
2940
  `);
2825
2941
  expect(std.err).toMatchInlineSnapshot(`""`);
2826
2942
  });
@@ -2840,7 +2956,7 @@ addEventListener('fetch', event => {});`
2840
2956
  "Total Upload: 0xx KiB / gzip: 0xx KiB
2841
2957
  Uploaded test-name (TIMINGS)
2842
2958
  Published test-name (TIMINGS)
2843
- test-name.test-sub-domain.workers.dev"
2959
+ https://test-name.test-sub-domain.workers.dev"
2844
2960
  `);
2845
2961
  expect(std.err).toMatchInlineSnapshot(`""`);
2846
2962
  });
@@ -2859,7 +2975,7 @@ addEventListener('fetch', event => {});`
2859
2975
  "Total Upload: 0xx KiB / gzip: 0xx KiB
2860
2976
  Uploaded test-name (TIMINGS)
2861
2977
  Published test-name (TIMINGS)
2862
- test-name.test-sub-domain.workers.dev"
2978
+ https://test-name.test-sub-domain.workers.dev"
2863
2979
  `);
2864
2980
  expect(std.err).toMatchInlineSnapshot(`""`);
2865
2981
  });
@@ -2972,7 +3088,7 @@ addEventListener('fetch', event => {});`
2972
3088
  "Total Upload: 0xx KiB / gzip: 0xx KiB
2973
3089
  Uploaded test-name (dev) (TIMINGS)
2974
3090
  Published test-name (dev) (TIMINGS)
2975
- dev.test-name.test-sub-domain.workers.dev"
3091
+ https://dev.test-name.test-sub-domain.workers.dev"
2976
3092
  `);
2977
3093
  expect(std.err).toMatchInlineSnapshot(`""`);
2978
3094
  });
@@ -2999,7 +3115,7 @@ addEventListener('fetch', event => {});`
2999
3115
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3000
3116
  Uploaded test-name (dev) (TIMINGS)
3001
3117
  Published test-name (dev) (TIMINGS)
3002
- dev.test-name.test-sub-domain.workers.dev"
3118
+ https://dev.test-name.test-sub-domain.workers.dev"
3003
3119
  `);
3004
3120
  expect(std.err).toMatchInlineSnapshot(`""`);
3005
3121
  });
@@ -3027,7 +3143,7 @@ addEventListener('fetch', event => {});`
3027
3143
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3028
3144
  Uploaded test-name (dev) (TIMINGS)
3029
3145
  Published test-name (dev) (TIMINGS)
3030
- dev.test-name.test-sub-domain.workers.dev"
3146
+ https://dev.test-name.test-sub-domain.workers.dev"
3031
3147
  `);
3032
3148
  expect(std.err).toMatchInlineSnapshot(`""`);
3033
3149
  });
@@ -3058,7 +3174,7 @@ addEventListener('fetch', event => {});`
3058
3174
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3059
3175
  Uploaded test-name (dev) (TIMINGS)
3060
3176
  Published test-name (dev) (TIMINGS)
3061
- dev.test-name.test-sub-domain.workers.dev"
3177
+ https://dev.test-name.test-sub-domain.workers.dev"
3062
3178
  `);
3063
3179
  expect(std.err).toMatchInlineSnapshot(`""`);
3064
3180
  });
@@ -3091,7 +3207,7 @@ addEventListener('fetch', event => {});`
3091
3207
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3092
3208
  Uploaded test-name (dev) (TIMINGS)
3093
3209
  Published test-name (dev) (TIMINGS)
3094
- dev.test-name.test-sub-domain.workers.dev"
3210
+ https://dev.test-name.test-sub-domain.workers.dev"
3095
3211
  `);
3096
3212
  expect(std.err).toMatchInlineSnapshot(`""`);
3097
3213
  });
@@ -3128,7 +3244,7 @@ addEventListener('fetch', event => {});`
3128
3244
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3129
3245
  Uploaded test-name (TIMINGS)
3130
3246
  Published test-name (TIMINGS)
3131
- test-name.test-sub-domain.workers.dev"
3247
+ https://test-name.test-sub-domain.workers.dev"
3132
3248
  `);
3133
3249
  expect(std.err).toMatchInlineSnapshot(`""`);
3134
3250
  });
@@ -3146,7 +3262,7 @@ addEventListener('fetch', event => {});`
3146
3262
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3147
3263
  Uploaded test-name (TIMINGS)
3148
3264
  Published test-name (TIMINGS)
3149
- test-name.test-sub-domain.workers.dev"
3265
+ https://test-name.test-sub-domain.workers.dev"
3150
3266
  `);
3151
3267
  expect(std.err).toMatchInlineSnapshot(`""`);
3152
3268
  });
@@ -3277,7 +3393,7 @@ addEventListener('fetch', event => {});`
3277
3393
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3278
3394
  Uploaded test-name (TIMINGS)
3279
3395
  Published test-name (TIMINGS)
3280
- test-name.test-sub-domain.workers.dev
3396
+ https://test-name.test-sub-domain.workers.dev
3281
3397
  http://example.com/*"
3282
3398
  `);
3283
3399
  expect(std.err).toMatchInlineSnapshot(`""`);
@@ -3312,7 +3428,7 @@ addEventListener('fetch', event => {});`
3312
3428
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3313
3429
  Uploaded test-name-production (TIMINGS)
3314
3430
  Published test-name-production (TIMINGS)
3315
- test-name-production.test-sub-domain.workers.dev
3431
+ https://test-name-production.test-sub-domain.workers.dev
3316
3432
  http://production.example.com/*"
3317
3433
  `);
3318
3434
  expect(std.err).toMatchInlineSnapshot(`""`);
@@ -3347,7 +3463,7 @@ addEventListener('fetch', event => {});`
3347
3463
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3348
3464
  Uploaded test-name-production (TIMINGS)
3349
3465
  Published test-name-production (TIMINGS)
3350
- test-name-production.test-sub-domain.workers.dev
3466
+ https://test-name-production.test-sub-domain.workers.dev
3351
3467
  http://production.example.com/*"
3352
3468
  `);
3353
3469
  expect(std.err).toMatchInlineSnapshot(`""`);
@@ -3525,7 +3641,7 @@ addEventListener('fetch', event => {});`
3525
3641
  Total Upload: 0xx KiB / gzip: 0xx KiB
3526
3642
  Uploaded test-name (TIMINGS)
3527
3643
  Published test-name (TIMINGS)
3528
- test-name.test-sub-domain.workers.dev"
3644
+ https://test-name.test-sub-domain.workers.dev"
3529
3645
  `);
3530
3646
  expect(std.err).toMatchInlineSnapshot(`""`);
3531
3647
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -3550,7 +3666,7 @@ addEventListener('fetch', event => {});`
3550
3666
  Total Upload: 0xx KiB / gzip: 0xx KiB
3551
3667
  Uploaded test-name (TIMINGS)
3552
3668
  Published test-name (TIMINGS)
3553
- test-name.test-sub-domain.workers.dev"
3669
+ https://test-name.test-sub-domain.workers.dev"
3554
3670
  `);
3555
3671
  expect(std.err).toMatchInlineSnapshot(`""`);
3556
3672
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -3656,7 +3772,7 @@ addEventListener('fetch', event => {});`
3656
3772
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3657
3773
  Uploaded test-name (TIMINGS)
3658
3774
  Published test-name (TIMINGS)
3659
- test-name.test-sub-domain.workers.dev"
3775
+ https://test-name.test-sub-domain.workers.dev"
3660
3776
  `);
3661
3777
  expect(std.err).toMatchInlineSnapshot(`""`);
3662
3778
  });
@@ -3695,7 +3811,7 @@ addEventListener('fetch', event => {});`
3695
3811
  "Total Upload: 0xx KiB / gzip: 0xx KiB
3696
3812
  Uploaded test-name (testEnv) (TIMINGS)
3697
3813
  Published test-name (testEnv) (TIMINGS)
3698
- testEnv.test-name.test-sub-domain.workers.dev"
3814
+ https://testEnv.test-name.test-sub-domain.workers.dev"
3699
3815
  `);
3700
3816
  expect(std.err).toMatchInlineSnapshot(`""`);
3701
3817
  });
@@ -3722,7 +3838,7 @@ addEventListener('fetch', event => {});`
3722
3838
  Total Upload: 0xx KiB / gzip: 0xx KiB
3723
3839
  Uploaded test-name (TIMINGS)
3724
3840
  Published test-name (TIMINGS)
3725
- test-name.test-sub-domain.workers.dev"
3841
+ https://test-name.test-sub-domain.workers.dev"
3726
3842
  `);
3727
3843
  expect(std.err).toMatchInlineSnapshot(`""`);
3728
3844
  expect(std.warn).toMatchInlineSnapshot(`
@@ -3772,7 +3888,7 @@ addEventListener('fetch', event => {});`
3772
3888
  Total Upload: 0xx KiB / gzip: 0xx KiB
3773
3889
  Uploaded test-name (TIMINGS)
3774
3890
  Published test-name (TIMINGS)
3775
- test-name.test-sub-domain.workers.dev"
3891
+ https://test-name.test-sub-domain.workers.dev"
3776
3892
  `);
3777
3893
  expect(std.err).toMatchInlineSnapshot(`""`);
3778
3894
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -3816,7 +3932,7 @@ addEventListener('fetch', event => {});`
3816
3932
  Total Upload: 0xx KiB / gzip: 0xx KiB
3817
3933
  Uploaded test-name (TIMINGS)
3818
3934
  Published test-name (TIMINGS)
3819
- test-name.test-sub-domain.workers.dev"
3935
+ https://test-name.test-sub-domain.workers.dev"
3820
3936
  `);
3821
3937
  expect(std.err).toMatchInlineSnapshot(`""`);
3822
3938
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -3867,7 +3983,7 @@ addEventListener('fetch', event => {});`
3867
3983
  Total Upload: 0xx KiB / gzip: 0xx KiB
3868
3984
  Uploaded test-name (TIMINGS)
3869
3985
  Published test-name (TIMINGS)
3870
- test-name.test-sub-domain.workers.dev",
3986
+ https://test-name.test-sub-domain.workers.dev",
3871
3987
  "warn": "",
3872
3988
  }
3873
3989
  `);
@@ -3911,7 +4027,7 @@ addEventListener('fetch', event => {});`
3911
4027
  Total Upload: 0xx KiB / gzip: 0xx KiB
3912
4028
  Uploaded test-name (TIMINGS)
3913
4029
  Published test-name (TIMINGS)
3914
- test-name.test-sub-domain.workers.dev",
4030
+ https://test-name.test-sub-domain.workers.dev",
3915
4031
  "warn": "",
3916
4032
  }
3917
4033
  `);
@@ -3957,7 +4073,7 @@ addEventListener('fetch', event => {});`
3957
4073
  Total Upload: 0xx KiB / gzip: 0xx KiB
3958
4074
  Uploaded test-name (TIMINGS)
3959
4075
  Published test-name (TIMINGS)
3960
- test-name.test-sub-domain.workers.dev"
4076
+ https://test-name.test-sub-domain.workers.dev"
3961
4077
  `);
3962
4078
  expect(std.err).toMatchInlineSnapshot(`""`);
3963
4079
  expect(std.warn).toMatchInlineSnapshot(`
@@ -4020,7 +4136,7 @@ addEventListener('fetch', event => {});`
4020
4136
  Total Upload: 0xx KiB / gzip: 0xx KiB
4021
4137
  Uploaded test-name (xyz) (TIMINGS)
4022
4138
  Published test-name (xyz) (TIMINGS)
4023
- xyz.test-name.test-sub-domain.workers.dev"
4139
+ https://xyz.test-name.test-sub-domain.workers.dev"
4024
4140
  `);
4025
4141
  expect(std.err).toMatchInlineSnapshot(`""`);
4026
4142
  expect(std.warn).toMatchInlineSnapshot(`
@@ -4079,7 +4195,7 @@ addEventListener('fetch', event => {});`
4079
4195
  Total Upload: 0xx KiB / gzip: 0xx KiB
4080
4196
  Uploaded test-name (TIMINGS)
4081
4197
  Published test-name (TIMINGS)
4082
- test-name.test-sub-domain.workers.dev",
4198
+ https://test-name.test-sub-domain.workers.dev",
4083
4199
  "warn": "▲ [WARNING] Processing wrangler.toml configuration:
4084
4200
 
4085
4201
  - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
@@ -4148,7 +4264,7 @@ addEventListener('fetch', event => {});`
4148
4264
  Total Upload: 0xx KiB / gzip: 0xx KiB
4149
4265
  Uploaded test-name (xyz) (TIMINGS)
4150
4266
  Published test-name (xyz) (TIMINGS)
4151
- xyz.test-name.test-sub-domain.workers.dev",
4267
+ https://xyz.test-name.test-sub-domain.workers.dev",
4152
4268
  "warn": "▲ [WARNING] Processing wrangler.toml configuration:
4153
4269
 
4154
4270
  - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
@@ -4223,6 +4339,19 @@ addEventListener('fetch', event => {});`
4223
4339
  DATA_BLOB_ONE: "./some-data-blob.bin",
4224
4340
  DATA_BLOB_TWO: "./more-data-blob.bin",
4225
4341
  },
4342
+ logfwdr: {
4343
+ schema: "./message.capnp.compiled",
4344
+ bindings: [
4345
+ {
4346
+ name: "httplogs",
4347
+ destination: "httplogs",
4348
+ },
4349
+ {
4350
+ name: "trace",
4351
+ destination: "trace",
4352
+ },
4353
+ ],
4354
+ },
4226
4355
  });
4227
4356
 
4228
4357
  writeWorkerSource({ type: "sw" });
@@ -4237,6 +4366,8 @@ addEventListener('fetch', event => {});`
4237
4366
  fs.writeFileSync("./some-data-blob.bin", "some data");
4238
4367
  fs.writeFileSync("./more-data-blob.bin", "more data");
4239
4368
 
4369
+ fs.writeFileSync("./message.capnp.compiled", "compiled capnp messages");
4370
+
4240
4371
  mockUploadWorkerRequest({
4241
4372
  expectedType: "sw",
4242
4373
  expectedBindings: [
@@ -4279,6 +4410,16 @@ addEventListener('fetch', event => {});`
4279
4410
  name: "R2_BUCKET_TWO",
4280
4411
  type: "r2_bucket",
4281
4412
  },
4413
+ {
4414
+ name: "httplogs",
4415
+ type: "logfwdr",
4416
+ destination: "httplogs",
4417
+ },
4418
+ {
4419
+ name: "trace",
4420
+ type: "logfwdr",
4421
+ destination: "trace",
4422
+ },
4282
4423
  {
4283
4424
  name: "WASM_MODULE_ONE",
4284
4425
  part: "WASM_MODULE_ONE",
@@ -4323,6 +4464,9 @@ addEventListener('fetch', event => {});`
4323
4464
  - R2 Buckets:
4324
4465
  - R2_BUCKET_ONE: r2-bucket-one-name
4325
4466
  - R2_BUCKET_TWO: r2-bucket-two-name
4467
+ - logfwdr:
4468
+ - httplogs: httplogs
4469
+ - trace: trace
4326
4470
  - Text Blobs:
4327
4471
  - TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg
4328
4472
  - TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt
@@ -4338,7 +4482,7 @@ addEventListener('fetch', event => {});`
4338
4482
  Total Upload: 0xx KiB / gzip: 0xx KiB
4339
4483
  Uploaded test-name (TIMINGS)
4340
4484
  Published test-name (TIMINGS)
4341
- test-name.test-sub-domain.workers.dev"
4485
+ https://test-name.test-sub-domain.workers.dev"
4342
4486
  `);
4343
4487
  expect(std.err).toMatchInlineSnapshot(`""`);
4344
4488
  expect(std.warn).toMatchInlineSnapshot(`
@@ -4718,7 +4862,7 @@ addEventListener('fetch', event => {});`
4718
4862
  Total Upload: 0xx KiB / gzip: 0xx KiB
4719
4863
  Uploaded test-name (TIMINGS)
4720
4864
  Published test-name (TIMINGS)
4721
- test-name.test-sub-domain.workers.dev"
4865
+ https://test-name.test-sub-domain.workers.dev"
4722
4866
  `);
4723
4867
  expect(std.err).toMatchInlineSnapshot(`""`);
4724
4868
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -4788,7 +4932,7 @@ addEventListener('fetch', event => {});`
4788
4932
  Total Upload: 0xx KiB / gzip: 0xx KiB
4789
4933
  Uploaded test-name (TIMINGS)
4790
4934
  Published test-name (TIMINGS)
4791
- test-name.test-sub-domain.workers.dev"
4935
+ https://test-name.test-sub-domain.workers.dev"
4792
4936
  `);
4793
4937
  expect(std.err).toMatchInlineSnapshot(`""`);
4794
4938
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -4821,7 +4965,7 @@ addEventListener('fetch', event => {});`
4821
4965
  "Total Upload: 0xx KiB / gzip: 0xx KiB
4822
4966
  Uploaded test-name (TIMINGS)
4823
4967
  Published test-name (TIMINGS)
4824
- test-name.test-sub-domain.workers.dev"
4968
+ https://test-name.test-sub-domain.workers.dev"
4825
4969
  `);
4826
4970
  expect(std.err).toMatchInlineSnapshot(`""`);
4827
4971
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -4858,7 +5002,7 @@ addEventListener('fetch', event => {});`
4858
5002
  Total Upload: 0xx KiB / gzip: 0xx KiB
4859
5003
  Uploaded test-name (TIMINGS)
4860
5004
  Published test-name (TIMINGS)
4861
- test-name.test-sub-domain.workers.dev"
5005
+ https://test-name.test-sub-domain.workers.dev"
4862
5006
  `);
4863
5007
  expect(std.err).toMatchInlineSnapshot(`""`);
4864
5008
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -4932,7 +5076,7 @@ addEventListener('fetch', event => {});`
4932
5076
  Total Upload: 0xx KiB / gzip: 0xx KiB
4933
5077
  Uploaded test-name (TIMINGS)
4934
5078
  Published test-name (TIMINGS)
4935
- test-name.test-sub-domain.workers.dev"
5079
+ https://test-name.test-sub-domain.workers.dev"
4936
5080
  `);
4937
5081
  expect(std.err).toMatchInlineSnapshot(`""`);
4938
5082
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -4969,7 +5113,7 @@ addEventListener('fetch', event => {});`
4969
5113
  Total Upload: 0xx KiB / gzip: 0xx KiB
4970
5114
  Uploaded test-name (TIMINGS)
4971
5115
  Published test-name (TIMINGS)
4972
- test-name.test-sub-domain.workers.dev"
5116
+ https://test-name.test-sub-domain.workers.dev"
4973
5117
  `);
4974
5118
  expect(std.err).toMatchInlineSnapshot(`""`);
4975
5119
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5043,7 +5187,7 @@ addEventListener('fetch', event => {});`
5043
5187
  Total Upload: 0xx KiB / gzip: 0xx KiB
5044
5188
  Uploaded test-name (TIMINGS)
5045
5189
  Published test-name (TIMINGS)
5046
- test-name.test-sub-domain.workers.dev"
5190
+ https://test-name.test-sub-domain.workers.dev"
5047
5191
  `);
5048
5192
  expect(std.err).toMatchInlineSnapshot(`""`);
5049
5193
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5083,7 +5227,7 @@ addEventListener('fetch', event => {});`
5083
5227
  Total Upload: 0xx KiB / gzip: 0xx KiB
5084
5228
  Uploaded test-name (TIMINGS)
5085
5229
  Published test-name (TIMINGS)
5086
- test-name.test-sub-domain.workers.dev"
5230
+ https://test-name.test-sub-domain.workers.dev"
5087
5231
  `);
5088
5232
  expect(std.err).toMatchInlineSnapshot(`""`);
5089
5233
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5111,7 +5255,59 @@ addEventListener('fetch', event => {});`
5111
5255
  Total Upload: 0xx KiB / gzip: 0xx KiB
5112
5256
  Uploaded test-name (TIMINGS)
5113
5257
  Published test-name (TIMINGS)
5114
- test-name.test-sub-domain.workers.dev"
5258
+ https://test-name.test-sub-domain.workers.dev"
5259
+ `);
5260
+ expect(std.err).toMatchInlineSnapshot(`""`);
5261
+ expect(std.warn).toMatchInlineSnapshot(`""`);
5262
+ });
5263
+ });
5264
+
5265
+ describe("[logfwdr]", () => {
5266
+ it("should support logfwdr bindings", async () => {
5267
+ fs.writeFileSync("./message.capnp.compiled", "compiled capnp messages");
5268
+
5269
+ writeWranglerToml({
5270
+ logfwdr: {
5271
+ schema: "./message.capnp.compiled",
5272
+ bindings: [
5273
+ {
5274
+ name: "httplogs",
5275
+ destination: "httplogs",
5276
+ },
5277
+ {
5278
+ name: "trace",
5279
+ destination: "trace",
5280
+ },
5281
+ ],
5282
+ },
5283
+ });
5284
+ writeWorkerSource();
5285
+ mockSubDomainRequest();
5286
+ mockUploadWorkerRequest({
5287
+ expectedBindings: [
5288
+ {
5289
+ name: "httplogs",
5290
+ type: "logfwdr",
5291
+ destination: "httplogs",
5292
+ },
5293
+ {
5294
+ name: "trace",
5295
+ type: "logfwdr",
5296
+ destination: "trace",
5297
+ },
5298
+ ],
5299
+ });
5300
+
5301
+ await runWrangler("publish index.js");
5302
+ expect(std.out).toMatchInlineSnapshot(`
5303
+ "Your worker has access to the following bindings:
5304
+ - logfwdr:
5305
+ - httplogs: httplogs
5306
+ - trace: trace
5307
+ Total Upload: 0xx KiB / gzip: 0xx KiB
5308
+ Uploaded test-name (TIMINGS)
5309
+ Published test-name (TIMINGS)
5310
+ https://test-name.test-sub-domain.workers.dev"
5115
5311
  `);
5116
5312
  expect(std.err).toMatchInlineSnapshot(`""`);
5117
5313
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5157,7 +5353,7 @@ addEventListener('fetch', event => {});`
5157
5353
  Total Upload: 0xx KiB / gzip: 0xx KiB
5158
5354
  Uploaded test-name (TIMINGS)
5159
5355
  Published test-name (TIMINGS)
5160
- test-name.test-sub-domain.workers.dev"
5356
+ https://test-name.test-sub-domain.workers.dev"
5161
5357
  `);
5162
5358
  expect(std.err).toMatchInlineSnapshot(`""`);
5163
5359
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5197,7 +5393,7 @@ addEventListener('fetch', event => {});`
5197
5393
  Total Upload: 0xx KiB / gzip: 0xx KiB
5198
5394
  Uploaded test-name (TIMINGS)
5199
5395
  Published test-name (TIMINGS)
5200
- test-name.test-sub-domain.workers.dev"
5396
+ https://test-name.test-sub-domain.workers.dev"
5201
5397
  `);
5202
5398
  expect(std.err).toMatchInlineSnapshot(`""`);
5203
5399
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5242,7 +5438,7 @@ addEventListener('fetch', event => {});`
5242
5438
  Total Upload: 0xx KiB / gzip: 0xx KiB
5243
5439
  Uploaded test-name (TIMINGS)
5244
5440
  Published test-name (TIMINGS)
5245
- test-name.test-sub-domain.workers.dev"
5441
+ https://test-name.test-sub-domain.workers.dev"
5246
5442
  `);
5247
5443
  expect(std.err).toMatchInlineSnapshot(`""`);
5248
5444
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5305,7 +5501,7 @@ addEventListener('fetch', event => {});`
5305
5501
  Total Upload: 0xx KiB / gzip: 0xx KiB
5306
5502
  Uploaded test-name (TIMINGS)
5307
5503
  Published test-name (TIMINGS)
5308
- test-name.test-sub-domain.workers.dev"
5504
+ https://test-name.test-sub-domain.workers.dev"
5309
5505
  `);
5310
5506
  expect(std.err).toMatchInlineSnapshot(`""`);
5311
5507
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5347,7 +5543,7 @@ addEventListener('fetch', event => {});`
5347
5543
  Total Upload: 0xx KiB / gzip: 0xx KiB
5348
5544
  Uploaded test-name (TIMINGS)
5349
5545
  Published test-name (TIMINGS)
5350
- test-name.test-sub-domain.workers.dev"
5546
+ https://test-name.test-sub-domain.workers.dev"
5351
5547
  `);
5352
5548
  expect(std.err).toMatchInlineSnapshot(`""`);
5353
5549
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5393,7 +5589,7 @@ addEventListener('fetch', event => {});`
5393
5589
  Total Upload: 0xx KiB / gzip: 0xx KiB
5394
5590
  Uploaded test-name (TIMINGS)
5395
5591
  Published test-name (TIMINGS)
5396
- test-name.test-sub-domain.workers.dev"
5592
+ https://test-name.test-sub-domain.workers.dev"
5397
5593
  `);
5398
5594
  expect(std.err).toMatchInlineSnapshot(`""`);
5399
5595
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5436,7 +5632,7 @@ addEventListener('fetch', event => {});`
5436
5632
  Total Upload: 0xx KiB / gzip: 0xx KiB
5437
5633
  Uploaded test-name (TIMINGS)
5438
5634
  Published test-name (TIMINGS)
5439
- test-name.test-sub-domain.workers.dev"
5635
+ https://test-name.test-sub-domain.workers.dev"
5440
5636
  `);
5441
5637
  expect(std.err).toMatchInlineSnapshot(`""`);
5442
5638
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5482,7 +5678,7 @@ addEventListener('fetch', event => {});`
5482
5678
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5483
5679
  Uploaded test-name (TIMINGS)
5484
5680
  Published test-name (TIMINGS)
5485
- test-name.test-sub-domain.workers.dev"
5681
+ https://test-name.test-sub-domain.workers.dev"
5486
5682
  `);
5487
5683
  expect(std.err).toMatchInlineSnapshot(`""`);
5488
5684
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5511,7 +5707,7 @@ addEventListener('fetch', event => {});`
5511
5707
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5512
5708
  Uploaded test-name (TIMINGS)
5513
5709
  Published test-name (TIMINGS)
5514
- test-name.test-sub-domain.workers.dev"
5710
+ https://test-name.test-sub-domain.workers.dev"
5515
5711
  `);
5516
5712
  expect(std.err).toMatchInlineSnapshot(`""`);
5517
5713
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5544,7 +5740,7 @@ addEventListener('fetch', event => {});`
5544
5740
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5545
5741
  Uploaded test-name (TIMINGS)
5546
5742
  Published test-name (TIMINGS)
5547
- test-name.test-sub-domain.workers.dev"
5743
+ https://test-name.test-sub-domain.workers.dev"
5548
5744
  `);
5549
5745
  expect(std.err).toMatchInlineSnapshot(`""`);
5550
5746
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5593,7 +5789,7 @@ addEventListener('fetch', event => {});`
5593
5789
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5594
5790
  Uploaded test-name (TIMINGS)
5595
5791
  Published test-name (TIMINGS)
5596
- test-name.test-sub-domain.workers.dev"
5792
+ https://test-name.test-sub-domain.workers.dev"
5597
5793
  `);
5598
5794
  expect(std.err).toMatchInlineSnapshot(`""`);
5599
5795
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5690,7 +5886,7 @@ addEventListener('fetch', event => {});`
5690
5886
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5691
5887
  Uploaded test-name (TIMINGS)
5692
5888
  Published test-name (TIMINGS)
5693
- test-name.test-sub-domain.workers.dev"
5889
+ https://test-name.test-sub-domain.workers.dev"
5694
5890
  `);
5695
5891
  expect(std.err).toMatchInlineSnapshot(`""`);
5696
5892
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5720,7 +5916,7 @@ addEventListener('fetch', event => {});`
5720
5916
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5721
5917
  Uploaded test-name (TIMINGS)
5722
5918
  Published test-name (TIMINGS)
5723
- test-name.test-sub-domain.workers.dev"
5919
+ https://test-name.test-sub-domain.workers.dev"
5724
5920
  `);
5725
5921
  expect(std.err).toMatchInlineSnapshot(`""`);
5726
5922
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5749,7 +5945,7 @@ addEventListener('fetch', event => {});`
5749
5945
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5750
5946
  Uploaded test-name (TIMINGS)
5751
5947
  Published test-name (TIMINGS)
5752
- test-name.test-sub-domain.workers.dev"
5948
+ https://test-name.test-sub-domain.workers.dev"
5753
5949
  `);
5754
5950
  expect(std.err).toMatchInlineSnapshot(`""`);
5755
5951
  expect(std.warn).toMatchInlineSnapshot(`
@@ -5759,6 +5955,37 @@ addEventListener('fetch', event => {});`
5759
5955
  `);
5760
5956
  });
5761
5957
 
5958
+ it("should work with legacy module specifiers, with a deprecation warning (3)", async () => {
5959
+ writeWranglerToml({
5960
+ rules: [{ type: "Text", globs: ["**/*.file"], fallthrough: false }],
5961
+ });
5962
+ fs.writeFileSync(
5963
+ "./index.js",
5964
+ `import TEXT from 'text+name.file'; export default {};`
5965
+ );
5966
+ fs.writeFileSync("./text+name.file", "SOME TEXT CONTENT");
5967
+ mockSubDomainRequest();
5968
+ mockUploadWorkerRequest({
5969
+ expectedModules: {
5970
+ "./2d91d1c4dd6e57d4f5432187ab7c25f45a8973f0-text+name.file":
5971
+ "SOME TEXT CONTENT",
5972
+ },
5973
+ });
5974
+ await runWrangler("publish index.js");
5975
+ expect(std.out).toMatchInlineSnapshot(`
5976
+ "Total Upload: 0xx KiB / gzip: 0xx KiB
5977
+ Uploaded test-name (TIMINGS)
5978
+ Published test-name (TIMINGS)
5979
+ https://test-name.test-sub-domain.workers.dev"
5980
+ `);
5981
+ expect(std.err).toMatchInlineSnapshot(`""`);
5982
+ expect(std.warn).toMatchInlineSnapshot(`
5983
+ "▲ [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\\";
5984
+
5985
+ "
5986
+ `);
5987
+ });
5988
+
5762
5989
  it("should not match regular module specifiers when there aren't any possible legacy module matches", async () => {
5763
5990
  // see https://github.com/cloudflare/wrangler2/issues/655 for bug details
5764
5991
 
@@ -5778,7 +6005,7 @@ addEventListener('fetch', event => {});`
5778
6005
  "Total Upload: 0xx KiB / gzip: 0xx KiB
5779
6006
  Uploaded test-name (TIMINGS)
5780
6007
  Published test-name (TIMINGS)
5781
- test-name.test-sub-domain.workers.dev"
6008
+ https://test-name.test-sub-domain.workers.dev"
5782
6009
  `);
5783
6010
  expect(std.err).toMatchInlineSnapshot(`""`);
5784
6011
  expect(std.warn).toMatchInlineSnapshot(`""`);
@@ -5819,7 +6046,7 @@ addEventListener('fetch', event => {});`
5819
6046
  "out": "Total Upload: 0xx KiB / gzip: 0xx KiB
5820
6047
  Uploaded test-name (TIMINGS)
5821
6048
  Published test-name (TIMINGS)
5822
- test-name.test-sub-domain.workers.dev",
6049
+ https://test-name.test-sub-domain.workers.dev",
5823
6050
  "warn": "",
5824
6051
  }
5825
6052
  `);
@@ -5849,7 +6076,7 @@ addEventListener('fetch', event => {});`
5849
6076
  "out": "Total Upload: 0xx KiB / gzip: 0xx KiB
5850
6077
  Uploaded test-name (TIMINGS)
5851
6078
  Published test-name (TIMINGS)
5852
- test-name.test-sub-domain.workers.dev",
6079
+ https://test-name.test-sub-domain.workers.dev",
5853
6080
  "warn": "",
5854
6081
  }
5855
6082
  `);
@@ -5872,7 +6099,7 @@ addEventListener('fetch', event => {});`
5872
6099
  "out": "Total Upload: 0xx KiB / gzip: 0xx KiB
5873
6100
  Uploaded test-name (TIMINGS)
5874
6101
  Published test-name (TIMINGS)
5875
- test-name.test-sub-domain.workers.dev",
6102
+ https://test-name.test-sub-domain.workers.dev",
5876
6103
  "warn": "",
5877
6104
  }
5878
6105
  `);
@@ -6014,7 +6241,7 @@ addEventListener('fetch', event => {});`
6014
6241
  "out": "Total Upload: 4xx KiB / gzip: 0xx KiB
6015
6242
  Uploaded test-name (TIMINGS)
6016
6243
  Published test-name (TIMINGS)
6017
- test-name.test-sub-domain.workers.dev",
6244
+ https://test-name.test-sub-domain.workers.dev",
6018
6245
  "warn": "",
6019
6246
  }
6020
6247
  `);
@@ -6418,20 +6645,27 @@ function mockPublishRoutesFallbackRequest(route: {
6418
6645
  });
6419
6646
  }
6420
6647
 
6421
- function mockPublishCustomDomainsRequest({
6422
- publishFlags,
6423
- domains = [],
6648
+ function mockCustomDomainLookup(origin: CustomDomain) {
6649
+ setMockResponse(
6650
+ `/accounts/:accountId/workers/domains/records/:domainTag`,
6651
+ "GET",
6652
+ ([_url, accountId, domainTag]) => {
6653
+ expect(accountId).toEqual("some-account-id");
6654
+ expect(domainTag).toEqual(origin.id);
6655
+
6656
+ return origin;
6657
+ }
6658
+ );
6659
+ }
6660
+
6661
+ function mockCustomDomainsChangesetRequest({
6662
+ originConflicts = [],
6663
+ dnsRecordConflicts = [],
6424
6664
  env = undefined,
6425
6665
  legacyEnv = false,
6426
6666
  }: {
6427
- publishFlags: {
6428
- override_scope: boolean;
6429
- override_existing_origin: boolean;
6430
- override_existing_dns_record: boolean;
6431
- };
6432
- domains: Array<
6433
- { hostname: string } & ({ zone_id?: string } | { zone_name?: string })
6434
- >;
6667
+ originConflicts?: Array<CustomDomain>;
6668
+ dnsRecordConflicts?: Array<CustomDomain>;
6435
6669
  env?: string | undefined;
6436
6670
  legacyEnv?: boolean | undefined;
6437
6671
  }) {
@@ -6439,8 +6673,8 @@ function mockPublishCustomDomainsRequest({
6439
6673
  const environment = env && !legacyEnv ? "/environments/:envName" : "";
6440
6674
 
6441
6675
  setMockResponse(
6442
- `/accounts/:accountId/workers/${servicesOrScripts}/:scriptName${environment}/domains`,
6443
- "PUT",
6676
+ `/accounts/:accountId/workers/${servicesOrScripts}/:scriptName${environment}/domains/changeset`,
6677
+ "POST",
6444
6678
  ([_url, accountId, scriptName, envName], { body }) => {
6445
6679
  expect(accountId).toEqual("some-account-id");
6446
6680
  expect(scriptName).toEqual(
@@ -6450,25 +6684,48 @@ function mockPublishCustomDomainsRequest({
6450
6684
  expect(envName).toEqual(env);
6451
6685
  }
6452
6686
 
6453
- expect(JSON.parse(body as string)).toEqual({
6454
- ...publishFlags,
6455
- origins: domains,
6456
- });
6687
+ const domains: Array<
6688
+ { hostname: string } & ({ zone_id?: string } | { zone_name?: string })
6689
+ > = JSON.parse(body as string);
6690
+
6691
+ const changeset: CustomDomainChangeset = {
6692
+ added: domains.map((domain) => {
6693
+ return {
6694
+ ...domain,
6695
+ id: "",
6696
+ service: scriptName,
6697
+ environment: envName,
6698
+ zone_name: "",
6699
+ zone_id: "",
6700
+ };
6701
+ }),
6702
+ removed: [],
6703
+ updated:
6704
+ originConflicts?.map((domain) => {
6705
+ return {
6706
+ ...domain,
6707
+ modified: true,
6708
+ };
6709
+ }) ?? [],
6710
+ conflicting: dnsRecordConflicts,
6711
+ };
6457
6712
 
6458
- return null;
6713
+ return changeset;
6459
6714
  }
6460
6715
  );
6461
6716
  }
6462
6717
 
6463
- function mockPublishCustomDomainsRequestConflictWithoutOverride({
6718
+ function mockPublishCustomDomainsRequest({
6719
+ publishFlags,
6464
6720
  domains = [],
6465
- originConflicts = false,
6466
- dnsRecordConflicts = false,
6467
6721
  env = undefined,
6468
6722
  legacyEnv = false,
6469
6723
  }: {
6470
- originConflicts?: boolean;
6471
- dnsRecordConflicts?: boolean;
6724
+ publishFlags: {
6725
+ override_scope: boolean;
6726
+ override_existing_origin: boolean;
6727
+ override_existing_dns_record: boolean;
6728
+ };
6472
6729
  domains: Array<
6473
6730
  { hostname: string } & ({ zone_id?: string } | { zone_name?: string })
6474
6731
  >;
@@ -6478,8 +6735,8 @@ function mockPublishCustomDomainsRequestConflictWithoutOverride({
6478
6735
  const servicesOrScripts = env && !legacyEnv ? "services" : "scripts";
6479
6736
  const environment = env && !legacyEnv ? "/environments/:envName" : "";
6480
6737
 
6481
- setMockRawResponse(
6482
- `/accounts/:accountId/workers/${servicesOrScripts}/:scriptName${environment}/domains`,
6738
+ setMockResponse(
6739
+ `/accounts/:accountId/workers/${servicesOrScripts}/:scriptName${environment}/domains/records`,
6483
6740
  "PUT",
6484
6741
  ([_url, accountId, scriptName, envName], { body }) => {
6485
6742
  expect(accountId).toEqual("some-account-id");
@@ -6490,26 +6747,12 @@ function mockPublishCustomDomainsRequestConflictWithoutOverride({
6490
6747
  expect(envName).toEqual(env);
6491
6748
  }
6492
6749
 
6493
- const parsed = JSON.parse(body as string);
6494
- expect(parsed.origins).toEqual(domains);
6750
+ expect(JSON.parse(body as string)).toEqual({
6751
+ ...publishFlags,
6752
+ origins: domains,
6753
+ });
6495
6754
 
6496
- if (originConflicts && !parsed.override_existing_origin) {
6497
- return createFetchResult(null, false, [
6498
- {
6499
- code: 100116,
6500
- message: `Cannot create Custom Domain "${domains[0].hostname}": Custom Domain already exists and points to a different script; retry and use option "override_existing_origin" to override`,
6501
- },
6502
- ]);
6503
- }
6504
- if (dnsRecordConflicts && !parsed.override_existing_dns_record) {
6505
- return createFetchResult(null, false, [
6506
- {
6507
- code: 100117,
6508
- message: `Cannot create Custom Domain "${domains[0].hostname}": a DNS record already exists for this origin; retry and use option "override_existing_dns_record" to override`,
6509
- },
6510
- ]);
6511
- }
6512
- return createFetchResult(null, true);
6755
+ return null;
6513
6756
  }
6514
6757
  );
6515
6758
  }