wrangler 2.0.27 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/wrangler.js +1 -1
- package/miniflare-dist/index.mjs +1141 -369
- package/package.json +6 -4
- package/src/__tests__/api-dev.test.ts +19 -0
- package/src/__tests__/configuration.test.ts +27 -27
- package/src/__tests__/dev.test.tsx +8 -6
- package/src/__tests__/helpers/hello-world-worker.js +5 -0
- package/src/__tests__/helpers/mock-cfetch.ts +4 -4
- package/src/__tests__/helpers/mock-console.ts +11 -2
- package/src/__tests__/helpers/mock-get-zone-from-host.ts +8 -0
- package/src/__tests__/helpers/mock-known-routes.ts +7 -0
- package/src/__tests__/index.test.ts +37 -37
- package/src/__tests__/init.test.ts +356 -5
- package/src/__tests__/jest.setup.ts +13 -0
- package/src/__tests__/middleware.test.ts +768 -0
- package/src/__tests__/pages.test.ts +829 -104
- package/src/__tests__/paths.test.ts +17 -0
- package/src/__tests__/publish.test.ts +512 -445
- package/src/__tests__/tail.test.ts +79 -72
- package/src/__tests__/test-old-node-version.js +3 -3
- package/src/__tests__/worker-namespace.test.ts +37 -35
- package/src/api/dev.ts +93 -28
- package/src/bundle.ts +239 -12
- package/src/cfetch/internal.ts +64 -3
- package/src/cli.ts +1 -1
- package/src/config/environment.ts +1 -1
- package/src/config/index.ts +4 -4
- package/src/config/validation.ts +3 -3
- package/src/create-worker-upload-form.ts +29 -26
- package/src/dev/dev.tsx +3 -1
- package/src/dev/local.tsx +319 -171
- package/src/dev/remote.tsx +16 -4
- package/src/dev/start-server.ts +416 -0
- package/src/dev/use-esbuild.ts +4 -0
- package/src/dev.tsx +340 -166
- package/src/dialogs.tsx +12 -0
- package/src/{worker-namespace.ts → dispatch-namespace.ts} +18 -18
- package/src/entry.ts +2 -1
- package/src/index.tsx +59 -12
- package/src/init.ts +291 -16
- package/src/metrics/send-event.ts +6 -5
- package/src/miniflare-cli/assets.ts +130 -476
- package/src/miniflare-cli/index.ts +39 -33
- package/src/pages/constants.ts +3 -0
- package/src/pages/dev.tsx +8 -3
- package/src/pages/functions/buildPlugin.ts +2 -1
- package/src/pages/functions/buildWorker.ts +2 -1
- package/src/pages/functions/routes-transformation.test.ts +12 -1
- package/src/pages/functions/routes-transformation.ts +7 -1
- package/src/pages/hash.tsx +13 -0
- package/src/pages/publish.tsx +82 -38
- package/src/pages/upload.tsx +3 -18
- package/src/paths.ts +20 -1
- package/src/publish.ts +49 -8
- package/src/tail/filters.ts +1 -5
- package/src/tail/index.ts +6 -3
- package/src/worker.ts +10 -9
- package/src/zones.ts +91 -0
- package/templates/middleware/common.ts +62 -0
- package/templates/middleware/loader-modules.ts +84 -0
- package/templates/middleware/loader-sw.ts +213 -0
- package/templates/middleware/middleware-pretty-error.ts +40 -0
- package/templates/middleware/middleware-scheduled.ts +14 -0
- package/wrangler-dist/cli.d.ts +22 -8
- package/wrangler-dist/cli.js +71020 -65212
|
@@ -11,9 +11,15 @@ import {
|
|
|
11
11
|
unsetAllMocks,
|
|
12
12
|
unsetSpecialMockFns,
|
|
13
13
|
} from "./helpers/mock-cfetch";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
mockConsoleMethods,
|
|
16
|
+
normalizeSlashes,
|
|
17
|
+
normalizeTempDirs,
|
|
18
|
+
} from "./helpers/mock-console";
|
|
15
19
|
import { mockConfirm } from "./helpers/mock-dialogs";
|
|
20
|
+
import { mockGetZoneFromHostRequest } from "./helpers/mock-get-zone-from-host";
|
|
16
21
|
import { useMockIsTTY } from "./helpers/mock-istty";
|
|
22
|
+
import { mockCollectKnownRoutesRequest } from "./helpers/mock-known-routes";
|
|
17
23
|
import { mockKeyListRequest } from "./helpers/mock-kv";
|
|
18
24
|
import { mockGetMemberships, mockOAuthFlow } from "./helpers/mock-oauth-flow";
|
|
19
25
|
import { runInTempDir } from "./helpers/run-in-tmp";
|
|
@@ -45,6 +51,12 @@ describe("publish", () => {
|
|
|
45
51
|
setImmediate(fn);
|
|
46
52
|
});
|
|
47
53
|
setIsTTY(true);
|
|
54
|
+
setMockResponse(
|
|
55
|
+
"/accounts/:accountId/workers/services/:scriptName",
|
|
56
|
+
() => ({
|
|
57
|
+
default_environment: { script: { last_deployed_from: "dash" } },
|
|
58
|
+
})
|
|
59
|
+
);
|
|
48
60
|
});
|
|
49
61
|
|
|
50
62
|
afterEach(() => {
|
|
@@ -75,7 +87,7 @@ describe("publish", () => {
|
|
|
75
87
|
await runWrangler("publish ./index");
|
|
76
88
|
|
|
77
89
|
expect(std.out).toMatchInlineSnapshot(`
|
|
78
|
-
"Total Upload:
|
|
90
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
79
91
|
Worker ID: abc12345
|
|
80
92
|
Worker ETag: etag98765
|
|
81
93
|
Worker PipelineHash: hash9999
|
|
@@ -114,7 +126,7 @@ describe("publish", () => {
|
|
|
114
126
|
"Attempting to login via OAuth...
|
|
115
127
|
Opening a link in your default browser: https://dash.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%20pages%3Awrite%20zone%3Aread%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256
|
|
116
128
|
Successfully logged in.
|
|
117
|
-
Total Upload:
|
|
129
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
118
130
|
Uploaded test-name (TIMINGS)
|
|
119
131
|
Published test-name (TIMINGS)
|
|
120
132
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -135,7 +147,7 @@ describe("publish", () => {
|
|
|
135
147
|
await expect(runWrangler("publish index.js")).resolves.toBeUndefined();
|
|
136
148
|
|
|
137
149
|
expect(std.out).toMatchInlineSnapshot(`
|
|
138
|
-
"Total Upload:
|
|
150
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
139
151
|
Uploaded test-name (TIMINGS)
|
|
140
152
|
Published test-name (TIMINGS)
|
|
141
153
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -175,7 +187,7 @@ describe("publish", () => {
|
|
|
175
187
|
await runWrangler("publish index.js");
|
|
176
188
|
|
|
177
189
|
expect(std.out).toMatchInlineSnapshot(`
|
|
178
|
-
"Total Upload:
|
|
190
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
179
191
|
Uploaded test-name (TIMINGS)
|
|
180
192
|
Published test-name (TIMINGS)
|
|
181
193
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -199,7 +211,7 @@ describe("publish", () => {
|
|
|
199
211
|
await runWrangler("publish index.js");
|
|
200
212
|
|
|
201
213
|
expect(std.out).toMatchInlineSnapshot(`
|
|
202
|
-
"Total Upload:
|
|
214
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
203
215
|
Uploaded test-name (TIMINGS)
|
|
204
216
|
Published test-name (TIMINGS)
|
|
205
217
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -301,7 +313,7 @@ describe("publish", () => {
|
|
|
301
313
|
});
|
|
302
314
|
await runWrangler("publish index.js --env some-env");
|
|
303
315
|
expect(std.out).toMatchInlineSnapshot(`
|
|
304
|
-
"Total Upload:
|
|
316
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
305
317
|
Uploaded test-name-some-env (TIMINGS)
|
|
306
318
|
Published test-name-some-env (TIMINGS)
|
|
307
319
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -320,7 +332,7 @@ describe("publish", () => {
|
|
|
320
332
|
});
|
|
321
333
|
await runWrangler("publish index.js --legacy-env true");
|
|
322
334
|
expect(std.out).toMatchInlineSnapshot(`
|
|
323
|
-
"Total Upload:
|
|
335
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
324
336
|
Uploaded test-name (TIMINGS)
|
|
325
337
|
Published test-name (TIMINGS)
|
|
326
338
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -339,7 +351,7 @@ describe("publish", () => {
|
|
|
339
351
|
});
|
|
340
352
|
await runWrangler("publish index.js --env some-env --legacy-env true");
|
|
341
353
|
expect(std.out).toMatchInlineSnapshot(`
|
|
342
|
-
"Total Upload:
|
|
354
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
343
355
|
Uploaded test-name-some-env (TIMINGS)
|
|
344
356
|
Published test-name-some-env (TIMINGS)
|
|
345
357
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -358,7 +370,7 @@ describe("publish", () => {
|
|
|
358
370
|
});
|
|
359
371
|
await runWrangler("publish index.js --env some-env --legacy-env true");
|
|
360
372
|
expect(std.out).toMatchInlineSnapshot(`
|
|
361
|
-
"Total Upload:
|
|
373
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
362
374
|
Uploaded test-name-some-env (TIMINGS)
|
|
363
375
|
Published test-name-some-env (TIMINGS)
|
|
364
376
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -428,7 +440,7 @@ describe("publish", () => {
|
|
|
428
440
|
});
|
|
429
441
|
await runWrangler("publish index.js --legacy-env false");
|
|
430
442
|
expect(std.out).toMatchInlineSnapshot(`
|
|
431
|
-
"Total Upload:
|
|
443
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
432
444
|
Uploaded test-name (TIMINGS)
|
|
433
445
|
Published test-name (TIMINGS)
|
|
434
446
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -454,7 +466,7 @@ describe("publish", () => {
|
|
|
454
466
|
});
|
|
455
467
|
await runWrangler("publish index.js --env some-env --legacy-env false");
|
|
456
468
|
expect(std.out).toMatchInlineSnapshot(`
|
|
457
|
-
"Total Upload:
|
|
469
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
458
470
|
Uploaded test-name (some-env) (TIMINGS)
|
|
459
471
|
Published test-name (some-env) (TIMINGS)
|
|
460
472
|
https://some-env.test-name.test-sub-domain.workers.dev"
|
|
@@ -497,14 +509,14 @@ describe("publish", () => {
|
|
|
497
509
|
mockSubDomainRequest();
|
|
498
510
|
await runWrangler("publish ./some-path/worker/index.js");
|
|
499
511
|
expect(std.out).toMatchInlineSnapshot(`
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
512
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
513
|
+
Your worker has access to the following bindings:
|
|
514
|
+
- Vars:
|
|
515
|
+
- xyz: \\"123\\"
|
|
516
|
+
Uploaded test-name (TIMINGS)
|
|
517
|
+
Published test-name (TIMINGS)
|
|
518
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
519
|
+
`);
|
|
508
520
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
509
521
|
});
|
|
510
522
|
|
|
@@ -534,7 +546,7 @@ describe("publish", () => {
|
|
|
534
546
|
Object {
|
|
535
547
|
"debug": "",
|
|
536
548
|
"err": "",
|
|
537
|
-
"out": "Total Upload:
|
|
549
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
538
550
|
Uploaded test-name (TIMINGS)
|
|
539
551
|
Published test-name (TIMINGS)
|
|
540
552
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -581,7 +593,7 @@ describe("publish", () => {
|
|
|
581
593
|
Object {
|
|
582
594
|
"debug": "",
|
|
583
595
|
"err": "",
|
|
584
|
-
"out": "Total Upload:
|
|
596
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
585
597
|
Uploaded test-name (TIMINGS)
|
|
586
598
|
Published test-name (TIMINGS)
|
|
587
599
|
some-example.com/some-route/*
|
|
@@ -642,7 +654,7 @@ describe("publish", () => {
|
|
|
642
654
|
Object {
|
|
643
655
|
"debug": "",
|
|
644
656
|
"err": "",
|
|
645
|
-
"out": "Total Upload:
|
|
657
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
646
658
|
Uploaded test-name (staging) (TIMINGS)
|
|
647
659
|
Published test-name (staging) (TIMINGS)
|
|
648
660
|
some-example.com/some-route/*
|
|
@@ -748,7 +760,7 @@ describe("publish", () => {
|
|
|
748
760
|
"
|
|
749
761
|
`);
|
|
750
762
|
expect(std.out).toMatchInlineSnapshot(`
|
|
751
|
-
"Total Upload:
|
|
763
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
752
764
|
Uploaded test-name (TIMINGS)
|
|
753
765
|
Published test-name (TIMINGS)
|
|
754
766
|
example.com/some-route/*"
|
|
@@ -1028,7 +1040,7 @@ Update them to point to this script instead?`,
|
|
|
1028
1040
|
await runWrangler("publish ./index");
|
|
1029
1041
|
|
|
1030
1042
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1031
|
-
"Total Upload:
|
|
1043
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1032
1044
|
Uploaded test-name (TIMINGS)
|
|
1033
1045
|
Published test-name (TIMINGS)
|
|
1034
1046
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1045,7 +1057,7 @@ Update them to point to this script instead?`,
|
|
|
1045
1057
|
await runWrangler("publish ./index");
|
|
1046
1058
|
|
|
1047
1059
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1048
|
-
"Total Upload:
|
|
1060
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1049
1061
|
Uploaded test-name (TIMINGS)
|
|
1050
1062
|
Published test-name (TIMINGS)
|
|
1051
1063
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1062,7 +1074,7 @@ Update them to point to this script instead?`,
|
|
|
1062
1074
|
await runWrangler("publish");
|
|
1063
1075
|
|
|
1064
1076
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1065
|
-
"Total Upload:
|
|
1077
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1066
1078
|
Uploaded test-name (TIMINGS)
|
|
1067
1079
|
Published test-name (TIMINGS)
|
|
1068
1080
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1081,7 +1093,7 @@ Update them to point to this script instead?`,
|
|
|
1081
1093
|
await runWrangler("publish");
|
|
1082
1094
|
|
|
1083
1095
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1084
|
-
"Total Upload:
|
|
1096
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1085
1097
|
Uploaded test-name (TIMINGS)
|
|
1086
1098
|
Published test-name (TIMINGS)
|
|
1087
1099
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1098,7 +1110,7 @@ Update them to point to this script instead?`,
|
|
|
1098
1110
|
await runWrangler("publish");
|
|
1099
1111
|
|
|
1100
1112
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1101
|
-
"Total Upload:
|
|
1113
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1102
1114
|
Uploaded test-name (TIMINGS)
|
|
1103
1115
|
Published test-name (TIMINGS)
|
|
1104
1116
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1134,7 +1146,7 @@ Update them to point to this script instead?`,
|
|
|
1134
1146
|
await runWrangler("publish");
|
|
1135
1147
|
|
|
1136
1148
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1137
|
-
"Total Upload:
|
|
1149
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1138
1150
|
Uploaded test-name (TIMINGS)
|
|
1139
1151
|
Published test-name (TIMINGS)
|
|
1140
1152
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1184,7 +1196,7 @@ Update them to point to this script instead?`,
|
|
|
1184
1196
|
await runWrangler("publish index.ts");
|
|
1185
1197
|
|
|
1186
1198
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1187
|
-
"Total Upload:
|
|
1199
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1188
1200
|
Uploaded test-name (TIMINGS)
|
|
1189
1201
|
Published test-name (TIMINGS)
|
|
1190
1202
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1203,7 +1215,7 @@ Update them to point to this script instead?`,
|
|
|
1203
1215
|
await runWrangler("publish index.ts");
|
|
1204
1216
|
|
|
1205
1217
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1206
|
-
"Total Upload:
|
|
1218
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1207
1219
|
Uploaded test-name (TIMINGS)
|
|
1208
1220
|
Published test-name (TIMINGS)
|
|
1209
1221
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1234,7 +1246,7 @@ export default{
|
|
|
1234
1246
|
mockSubDomainRequest();
|
|
1235
1247
|
await runWrangler("publish index.js");
|
|
1236
1248
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1237
|
-
"Total Upload:
|
|
1249
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1238
1250
|
Uploaded test-name (TIMINGS)
|
|
1239
1251
|
Published test-name (TIMINGS)
|
|
1240
1252
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1251,7 +1263,7 @@ export default{
|
|
|
1251
1263
|
await runWrangler("publish ./src/index.js");
|
|
1252
1264
|
|
|
1253
1265
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1254
|
-
"Total Upload:
|
|
1266
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1255
1267
|
Uploaded test-name (TIMINGS)
|
|
1256
1268
|
Published test-name (TIMINGS)
|
|
1257
1269
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1288,14 +1300,14 @@ export default {};`
|
|
|
1288
1300
|
`);
|
|
1289
1301
|
|
|
1290
1302
|
expect(std).toMatchInlineSnapshot(`
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1303
|
+
Object {
|
|
1304
|
+
"debug": "",
|
|
1305
|
+
"err": "",
|
|
1306
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
1307
|
+
--dry-run: exiting now.",
|
|
1308
|
+
"warn": "",
|
|
1309
|
+
}
|
|
1310
|
+
`);
|
|
1299
1311
|
});
|
|
1300
1312
|
|
|
1301
1313
|
it("should not preserve exports on a service-worker format worker", async () => {
|
|
@@ -1321,16 +1333,16 @@ addEventListener('fetch', event => {});`
|
|
|
1321
1333
|
).toMatchInlineSnapshot(`Array []`);
|
|
1322
1334
|
|
|
1323
1335
|
expect(std).toMatchInlineSnapshot(`
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1336
|
+
Object {
|
|
1337
|
+
"debug": "",
|
|
1338
|
+
"err": "",
|
|
1339
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
1340
|
+
--dry-run: exiting now.",
|
|
1341
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mThe entrypoint index.js has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using \\"service-worker\\" format...[0m
|
|
1330
1342
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1343
|
+
",
|
|
1344
|
+
}
|
|
1345
|
+
`);
|
|
1334
1346
|
});
|
|
1335
1347
|
|
|
1336
1348
|
it("should be able to transpile entry-points in sub-directories (sw)", async () => {
|
|
@@ -1345,7 +1357,7 @@ addEventListener('fetch', event => {});`
|
|
|
1345
1357
|
await runWrangler("publish ./src/index.js");
|
|
1346
1358
|
|
|
1347
1359
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1348
|
-
"Total Upload:
|
|
1360
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
1349
1361
|
Uploaded test-name (TIMINGS)
|
|
1350
1362
|
Published test-name (TIMINGS)
|
|
1351
1363
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1427,7 +1439,7 @@ addEventListener('fetch', event => {});`
|
|
|
1427
1439
|
Reading file-2.txt...
|
|
1428
1440
|
Uploading as file-2.5938485188.txt...
|
|
1429
1441
|
↗️ Done syncing assets
|
|
1430
|
-
Total Upload:
|
|
1442
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1431
1443
|
Uploaded test-name (TIMINGS)
|
|
1432
1444
|
Published test-name (TIMINGS)
|
|
1433
1445
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1479,7 +1491,7 @@ addEventListener('fetch', event => {});`
|
|
|
1479
1491
|
Reading file-2.txt...
|
|
1480
1492
|
Uploading as file-2.5938485188.txt...
|
|
1481
1493
|
↗️ Done syncing assets
|
|
1482
|
-
Total Upload:
|
|
1494
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1483
1495
|
Uploaded test-name (TIMINGS)
|
|
1484
1496
|
Published test-name (TIMINGS)
|
|
1485
1497
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1568,7 +1580,7 @@ addEventListener('fetch', event => {});`
|
|
|
1568
1580
|
Reading file-2.txt...
|
|
1569
1581
|
Uploading as file-2.5938485188.txt...
|
|
1570
1582
|
↗️ Done syncing assets
|
|
1571
|
-
Total Upload:
|
|
1583
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1572
1584
|
Uploaded test-name (TIMINGS)
|
|
1573
1585
|
Published test-name (TIMINGS)
|
|
1574
1586
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1616,7 +1628,7 @@ addEventListener('fetch', event => {});`
|
|
|
1616
1628
|
Reading file-2.txt...
|
|
1617
1629
|
Uploading as file-2.5938485188.txt...
|
|
1618
1630
|
↗️ Done syncing assets
|
|
1619
|
-
Total Upload:
|
|
1631
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1620
1632
|
Uploaded test-name (TIMINGS)
|
|
1621
1633
|
Published test-name (TIMINGS)
|
|
1622
1634
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1656,7 +1668,7 @@ addEventListener('fetch', event => {});`
|
|
|
1656
1668
|
Reading file-2.txt...
|
|
1657
1669
|
Uploading as file-2.5938485188.txt...
|
|
1658
1670
|
↗️ Done syncing assets
|
|
1659
|
-
Total Upload:
|
|
1671
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1660
1672
|
Uploaded test-name (TIMINGS)
|
|
1661
1673
|
Published test-name (TIMINGS)
|
|
1662
1674
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1840,7 +1852,7 @@ addEventListener('fetch', event => {});`
|
|
|
1840
1852
|
Reading subdir/file-2.txt...
|
|
1841
1853
|
Uploading as subdir/file-2.5938485188.txt...
|
|
1842
1854
|
↗️ Done syncing assets
|
|
1843
|
-
Total Upload:
|
|
1855
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1844
1856
|
Uploaded test-name (TIMINGS)
|
|
1845
1857
|
Published test-name (TIMINGS)
|
|
1846
1858
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1886,7 +1898,7 @@ addEventListener('fetch', event => {});`
|
|
|
1886
1898
|
Reading subdir/file-2.txt...
|
|
1887
1899
|
Uploading as subdir/file-2.5938485188.txt...
|
|
1888
1900
|
↗️ Done syncing assets
|
|
1889
|
-
Total Upload:
|
|
1901
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1890
1902
|
Uploaded test-name (TIMINGS)
|
|
1891
1903
|
Published test-name (TIMINGS)
|
|
1892
1904
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -1942,7 +1954,7 @@ addEventListener('fetch', event => {});`
|
|
|
1942
1954
|
Reading subdir/file-2.txt...
|
|
1943
1955
|
Uploading as subdir/file-2.5938485188.txt...
|
|
1944
1956
|
↗️ Done syncing assets
|
|
1945
|
-
Total Upload:
|
|
1957
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
1946
1958
|
Uploaded test-name (TIMINGS)
|
|
1947
1959
|
Published test-name (TIMINGS)
|
|
1948
1960
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -1999,7 +2011,7 @@ addEventListener('fetch', event => {});`
|
|
|
1999
2011
|
Reading file-2.txt...
|
|
2000
2012
|
Uploading as file-2.5938485188.txt...
|
|
2001
2013
|
↗️ Done syncing assets
|
|
2002
|
-
Total Upload:
|
|
2014
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2003
2015
|
Uploaded test-name (TIMINGS)
|
|
2004
2016
|
Published test-name (TIMINGS)
|
|
2005
2017
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2050,7 +2062,7 @@ addEventListener('fetch', event => {});`
|
|
|
2050
2062
|
Reading file-2.txt...
|
|
2051
2063
|
Uploading as file-2.5938485188.txt...
|
|
2052
2064
|
↗️ Done syncing assets
|
|
2053
|
-
Total Upload:
|
|
2065
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2054
2066
|
Uploaded test-name (TIMINGS)
|
|
2055
2067
|
Published test-name (TIMINGS)
|
|
2056
2068
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2099,7 +2111,7 @@ addEventListener('fetch', event => {});`
|
|
|
2099
2111
|
Reading file-2.txt...
|
|
2100
2112
|
Uploading as file-2.5938485188.txt...
|
|
2101
2113
|
↗️ Done syncing assets
|
|
2102
|
-
Total Upload:
|
|
2114
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2103
2115
|
Uploaded test-name (some-env) (TIMINGS)
|
|
2104
2116
|
Published test-name (some-env) (TIMINGS)
|
|
2105
2117
|
https://some-env.test-name.test-sub-domain.workers.dev"
|
|
@@ -2149,7 +2161,7 @@ addEventListener('fetch', event => {});`
|
|
|
2149
2161
|
Reading file-2.txt...
|
|
2150
2162
|
Uploading as file-2.5938485188.txt...
|
|
2151
2163
|
↗️ Done syncing assets
|
|
2152
|
-
Total Upload:
|
|
2164
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2153
2165
|
Uploaded test-name-some-env (TIMINGS)
|
|
2154
2166
|
Published test-name-some-env (TIMINGS)
|
|
2155
2167
|
https://test-name-some-env.test-sub-domain.workers.dev"
|
|
@@ -2192,7 +2204,7 @@ addEventListener('fetch', event => {});`
|
|
|
2192
2204
|
Reading file-2.txt...
|
|
2193
2205
|
Uploading as file-2.5938485188.txt...
|
|
2194
2206
|
↗️ Done syncing assets
|
|
2195
|
-
Total Upload:
|
|
2207
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2196
2208
|
Uploaded test-name (TIMINGS)
|
|
2197
2209
|
Published test-name (TIMINGS)
|
|
2198
2210
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2232,7 +2244,7 @@ addEventListener('fetch', event => {});`
|
|
|
2232
2244
|
"Reading file-1.txt...
|
|
2233
2245
|
Uploading as file-1.2ca234f380.txt...
|
|
2234
2246
|
↗️ Done syncing assets
|
|
2235
|
-
Total Upload:
|
|
2247
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2236
2248
|
Uploaded test-name (TIMINGS)
|
|
2237
2249
|
Published test-name (TIMINGS)
|
|
2238
2250
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2272,7 +2284,7 @@ addEventListener('fetch', event => {});`
|
|
|
2272
2284
|
"Reading file-1.txt...
|
|
2273
2285
|
Uploading as file-1.2ca234f380.txt...
|
|
2274
2286
|
↗️ Done syncing assets
|
|
2275
|
-
Total Upload:
|
|
2287
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2276
2288
|
Uploaded test-name (TIMINGS)
|
|
2277
2289
|
Published test-name (TIMINGS)
|
|
2278
2290
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2313,7 +2325,7 @@ addEventListener('fetch', event => {});`
|
|
|
2313
2325
|
"Reading file-1.txt...
|
|
2314
2326
|
Uploading as file-1.2ca234f380.txt...
|
|
2315
2327
|
↗️ Done syncing assets
|
|
2316
|
-
Total Upload:
|
|
2328
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2317
2329
|
Uploaded test-name (TIMINGS)
|
|
2318
2330
|
Published test-name (TIMINGS)
|
|
2319
2331
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2354,7 +2366,7 @@ addEventListener('fetch', event => {});`
|
|
|
2354
2366
|
"Reading file-1.txt...
|
|
2355
2367
|
Uploading as file-1.2ca234f380.txt...
|
|
2356
2368
|
↗️ Done syncing assets
|
|
2357
|
-
Total Upload:
|
|
2369
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2358
2370
|
Uploaded test-name (TIMINGS)
|
|
2359
2371
|
Published test-name (TIMINGS)
|
|
2360
2372
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2395,7 +2407,7 @@ addEventListener('fetch', event => {});`
|
|
|
2395
2407
|
"Reading file-1.txt...
|
|
2396
2408
|
Uploading as file-1.2ca234f380.txt...
|
|
2397
2409
|
↗️ Done syncing assets
|
|
2398
|
-
Total Upload:
|
|
2410
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2399
2411
|
Uploaded test-name (TIMINGS)
|
|
2400
2412
|
Published test-name (TIMINGS)
|
|
2401
2413
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2436,7 +2448,7 @@ addEventListener('fetch', event => {});`
|
|
|
2436
2448
|
"Reading file-1.txt...
|
|
2437
2449
|
Uploading as file-1.2ca234f380.txt...
|
|
2438
2450
|
↗️ Done syncing assets
|
|
2439
|
-
Total Upload:
|
|
2451
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2440
2452
|
Uploaded test-name (TIMINGS)
|
|
2441
2453
|
Published test-name (TIMINGS)
|
|
2442
2454
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2479,7 +2491,7 @@ addEventListener('fetch', event => {});`
|
|
|
2479
2491
|
"Reading directory-1/file-1.txt...
|
|
2480
2492
|
Uploading as directory-1/file-1.2ca234f380.txt...
|
|
2481
2493
|
↗️ Done syncing assets
|
|
2482
|
-
Total Upload:
|
|
2494
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2483
2495
|
Uploaded test-name (TIMINGS)
|
|
2484
2496
|
Published test-name (TIMINGS)
|
|
2485
2497
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2526,7 +2538,7 @@ addEventListener('fetch', event => {});`
|
|
|
2526
2538
|
"Reading .well-known/file-2.txt...
|
|
2527
2539
|
Uploading as .well-known/file-2.5938485188.txt...
|
|
2528
2540
|
↗️ Done syncing assets
|
|
2529
|
-
Total Upload:
|
|
2541
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2530
2542
|
Uploaded test-name (TIMINGS)
|
|
2531
2543
|
Published test-name (TIMINGS)
|
|
2532
2544
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2675,7 +2687,7 @@ addEventListener('fetch', event => {});`
|
|
|
2675
2687
|
Reading file-19.txt...
|
|
2676
2688
|
Uploading as file-19.f0d69f705d.txt...
|
|
2677
2689
|
↗️ Done syncing assets
|
|
2678
|
-
Total Upload:
|
|
2690
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2679
2691
|
Uploaded test-name (TIMINGS)
|
|
2680
2692
|
Published test-name (TIMINGS)
|
|
2681
2693
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -2774,7 +2786,7 @@ addEventListener('fetch', event => {});`
|
|
|
2774
2786
|
Deleting file-3.somehash.txt from the asset store...
|
|
2775
2787
|
Deleting file-4.anotherhash.txt from the asset store...
|
|
2776
2788
|
↗️ Done syncing assets
|
|
2777
|
-
Total Upload:
|
|
2789
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2778
2790
|
Uploaded test-name (TIMINGS)
|
|
2779
2791
|
Published test-name (TIMINGS)
|
|
2780
2792
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2828,7 +2840,7 @@ addEventListener('fetch', event => {});`
|
|
|
2828
2840
|
Reading file-2.txt...
|
|
2829
2841
|
Uploading as file-2.5938485188.txt...
|
|
2830
2842
|
↗️ Done syncing assets
|
|
2831
|
-
Total Upload:
|
|
2843
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2832
2844
|
Uploaded test-name (TIMINGS)
|
|
2833
2845
|
Published test-name (TIMINGS)
|
|
2834
2846
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2869,7 +2881,7 @@ addEventListener('fetch', event => {});`
|
|
|
2869
2881
|
Reading file-2.txt...
|
|
2870
2882
|
Uploading as file-2.5938485188.txt...
|
|
2871
2883
|
↗️ Done syncing assets
|
|
2872
|
-
Total Upload:
|
|
2884
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2873
2885
|
Uploaded test-name (TIMINGS)
|
|
2874
2886
|
Published test-name (TIMINGS)
|
|
2875
2887
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -2911,7 +2923,7 @@ addEventListener('fetch', event => {});`
|
|
|
2911
2923
|
Reading file-2.txt...
|
|
2912
2924
|
Uploading as file-2.5938485188.txt...
|
|
2913
2925
|
↗️ Done syncing assets
|
|
2914
|
-
Total Upload:
|
|
2926
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
2915
2927
|
Uploaded test-name (TIMINGS)
|
|
2916
2928
|
Published test-name (TIMINGS)
|
|
2917
2929
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -2933,7 +2945,7 @@ addEventListener('fetch', event => {});`
|
|
|
2933
2945
|
await runWrangler("publish ./index");
|
|
2934
2946
|
|
|
2935
2947
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2936
|
-
"Total Upload:
|
|
2948
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2937
2949
|
Uploaded test-name (TIMINGS)
|
|
2938
2950
|
Published test-name (TIMINGS)
|
|
2939
2951
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2953,7 +2965,7 @@ addEventListener('fetch', event => {});`
|
|
|
2953
2965
|
await runWrangler("publish ./index");
|
|
2954
2966
|
|
|
2955
2967
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2956
|
-
"Total Upload:
|
|
2968
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2957
2969
|
Uploaded test-name (TIMINGS)
|
|
2958
2970
|
Published test-name (TIMINGS)
|
|
2959
2971
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2972,7 +2984,7 @@ addEventListener('fetch', event => {});`
|
|
|
2972
2984
|
await runWrangler("publish ./index");
|
|
2973
2985
|
|
|
2974
2986
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2975
|
-
"Total Upload:
|
|
2987
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2976
2988
|
Uploaded test-name (TIMINGS)
|
|
2977
2989
|
Published test-name (TIMINGS)
|
|
2978
2990
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -2991,7 +3003,7 @@ addEventListener('fetch', event => {});`
|
|
|
2991
3003
|
await runWrangler("publish ./index");
|
|
2992
3004
|
|
|
2993
3005
|
expect(std.out).toMatchInlineSnapshot(`
|
|
2994
|
-
"Total Upload:
|
|
3006
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
2995
3007
|
Uploaded test-name (TIMINGS)
|
|
2996
3008
|
No publish targets for test-name (TIMINGS)"
|
|
2997
3009
|
`);
|
|
@@ -3011,7 +3023,7 @@ addEventListener('fetch', event => {});`
|
|
|
3011
3023
|
await runWrangler("publish ./index");
|
|
3012
3024
|
|
|
3013
3025
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3014
|
-
"Total Upload:
|
|
3026
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3015
3027
|
Uploaded test-name (TIMINGS)
|
|
3016
3028
|
No publish targets for test-name (TIMINGS)"
|
|
3017
3029
|
`);
|
|
@@ -3035,7 +3047,7 @@ addEventListener('fetch', event => {});`
|
|
|
3035
3047
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3036
3048
|
|
|
3037
3049
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3038
|
-
"Total Upload:
|
|
3050
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3039
3051
|
Uploaded test-name (dev) (TIMINGS)
|
|
3040
3052
|
No publish targets for test-name (dev) (TIMINGS)"
|
|
3041
3053
|
`);
|
|
@@ -3060,7 +3072,7 @@ addEventListener('fetch', event => {});`
|
|
|
3060
3072
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3061
3073
|
|
|
3062
3074
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3063
|
-
"Total Upload:
|
|
3075
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3064
3076
|
Uploaded test-name (dev) (TIMINGS)
|
|
3065
3077
|
No publish targets for test-name (dev) (TIMINGS)"
|
|
3066
3078
|
`);
|
|
@@ -3085,7 +3097,7 @@ addEventListener('fetch', event => {});`
|
|
|
3085
3097
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3086
3098
|
|
|
3087
3099
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3088
|
-
"Total Upload:
|
|
3100
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3089
3101
|
Uploaded test-name (dev) (TIMINGS)
|
|
3090
3102
|
Published test-name (dev) (TIMINGS)
|
|
3091
3103
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3112,7 +3124,7 @@ addEventListener('fetch', event => {});`
|
|
|
3112
3124
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3113
3125
|
|
|
3114
3126
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3115
|
-
"Total Upload:
|
|
3127
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3116
3128
|
Uploaded test-name (dev) (TIMINGS)
|
|
3117
3129
|
Published test-name (dev) (TIMINGS)
|
|
3118
3130
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3140,7 +3152,7 @@ addEventListener('fetch', event => {});`
|
|
|
3140
3152
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3141
3153
|
|
|
3142
3154
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3143
|
-
"Total Upload:
|
|
3155
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3144
3156
|
Uploaded test-name (dev) (TIMINGS)
|
|
3145
3157
|
Published test-name (dev) (TIMINGS)
|
|
3146
3158
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3171,7 +3183,7 @@ addEventListener('fetch', event => {});`
|
|
|
3171
3183
|
await runWrangler("publish ./index --env dev --legacy-env false");
|
|
3172
3184
|
|
|
3173
3185
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3174
|
-
"Total Upload:
|
|
3186
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3175
3187
|
Uploaded test-name (dev) (TIMINGS)
|
|
3176
3188
|
Published test-name (dev) (TIMINGS)
|
|
3177
3189
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3204,7 +3216,7 @@ addEventListener('fetch', event => {});`
|
|
|
3204
3216
|
);
|
|
3205
3217
|
|
|
3206
3218
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3207
|
-
"Total Upload:
|
|
3219
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3208
3220
|
Uploaded test-name (dev) (TIMINGS)
|
|
3209
3221
|
Published test-name (dev) (TIMINGS)
|
|
3210
3222
|
https://dev.test-name.test-sub-domain.workers.dev"
|
|
@@ -3231,6 +3243,29 @@ addEventListener('fetch', event => {});`
|
|
|
3231
3243
|
`);
|
|
3232
3244
|
});
|
|
3233
3245
|
|
|
3246
|
+
it("should error if a compatibility_date is missing and suggest the correct month", async () => {
|
|
3247
|
+
jest.spyOn(Date.prototype, "getMonth").mockImplementation(() => 11);
|
|
3248
|
+
jest.spyOn(Date.prototype, "getFullYear").mockImplementation(() => 2020);
|
|
3249
|
+
jest.spyOn(Date.prototype, "getDate").mockImplementation(() => 1);
|
|
3250
|
+
|
|
3251
|
+
writeWorkerSource();
|
|
3252
|
+
let err: undefined | Error;
|
|
3253
|
+
try {
|
|
3254
|
+
await runWrangler("publish ./index.js");
|
|
3255
|
+
} catch (e) {
|
|
3256
|
+
err = e as Error;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
expect(err?.message).toMatchInlineSnapshot(`
|
|
3260
|
+
"A compatibility_date is required when publishing. Add the following to your wrangler.toml file:.
|
|
3261
|
+
\`\`\`
|
|
3262
|
+
compatibility_date = \\"2020-12-01\\"
|
|
3263
|
+
\`\`\`
|
|
3264
|
+
Or you could pass it in your terminal as \`--compatibility-date 2020-12-01\`
|
|
3265
|
+
See https://developers.cloudflare.com/workers/platform/compatibility-dates for more information."
|
|
3266
|
+
`);
|
|
3267
|
+
});
|
|
3268
|
+
|
|
3234
3269
|
it("should enable the workers.dev domain if workers_dev is undefined and subdomain is not already available", async () => {
|
|
3235
3270
|
writeWranglerToml();
|
|
3236
3271
|
writeWorkerSource();
|
|
@@ -3241,7 +3276,7 @@ addEventListener('fetch', event => {});`
|
|
|
3241
3276
|
await runWrangler("publish ./index");
|
|
3242
3277
|
|
|
3243
3278
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3244
|
-
"Total Upload:
|
|
3279
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3245
3280
|
Uploaded test-name (TIMINGS)
|
|
3246
3281
|
Published test-name (TIMINGS)
|
|
3247
3282
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3259,7 +3294,7 @@ addEventListener('fetch', event => {});`
|
|
|
3259
3294
|
await runWrangler("publish ./index");
|
|
3260
3295
|
|
|
3261
3296
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3262
|
-
"Total Upload:
|
|
3297
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3263
3298
|
Uploaded test-name (TIMINGS)
|
|
3264
3299
|
Published test-name (TIMINGS)
|
|
3265
3300
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3297,7 +3332,7 @@ addEventListener('fetch', event => {});`
|
|
|
3297
3332
|
await runWrangler("publish index.js");
|
|
3298
3333
|
|
|
3299
3334
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3300
|
-
"Total Upload:
|
|
3335
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3301
3336
|
Uploaded test-name (TIMINGS)
|
|
3302
3337
|
Published test-name (TIMINGS)
|
|
3303
3338
|
http://example.com/*"
|
|
@@ -3331,7 +3366,7 @@ addEventListener('fetch', event => {});`
|
|
|
3331
3366
|
await runWrangler("publish index.js --env production");
|
|
3332
3367
|
|
|
3333
3368
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3334
|
-
"Total Upload:
|
|
3369
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3335
3370
|
Uploaded test-name-production (TIMINGS)
|
|
3336
3371
|
Published test-name-production (TIMINGS)
|
|
3337
3372
|
http://production.example.com/*"
|
|
@@ -3364,7 +3399,7 @@ addEventListener('fetch', event => {});`
|
|
|
3364
3399
|
await runWrangler("publish index.js --env production");
|
|
3365
3400
|
|
|
3366
3401
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3367
|
-
"Total Upload:
|
|
3402
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3368
3403
|
Uploaded test-name-production (TIMINGS)
|
|
3369
3404
|
Published test-name-production (TIMINGS)
|
|
3370
3405
|
http://production.example.com/*"
|
|
@@ -3390,7 +3425,7 @@ addEventListener('fetch', event => {});`
|
|
|
3390
3425
|
await runWrangler("publish index.js");
|
|
3391
3426
|
|
|
3392
3427
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3393
|
-
"Total Upload:
|
|
3428
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3394
3429
|
Uploaded test-name (TIMINGS)
|
|
3395
3430
|
Published test-name (TIMINGS)
|
|
3396
3431
|
https://test-name.test-sub-domain.workers.dev
|
|
@@ -3425,7 +3460,7 @@ addEventListener('fetch', event => {});`
|
|
|
3425
3460
|
await runWrangler("publish index.js --env production");
|
|
3426
3461
|
|
|
3427
3462
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3428
|
-
"Total Upload:
|
|
3463
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3429
3464
|
Uploaded test-name-production (TIMINGS)
|
|
3430
3465
|
Published test-name-production (TIMINGS)
|
|
3431
3466
|
https://test-name-production.test-sub-domain.workers.dev
|
|
@@ -3460,7 +3495,7 @@ addEventListener('fetch', event => {});`
|
|
|
3460
3495
|
await runWrangler("publish index.js --env production");
|
|
3461
3496
|
|
|
3462
3497
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3463
|
-
"Total Upload:
|
|
3498
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3464
3499
|
Uploaded test-name-production (TIMINGS)
|
|
3465
3500
|
Published test-name-production (TIMINGS)
|
|
3466
3501
|
https://test-name-production.test-sub-domain.workers.dev
|
|
@@ -3495,7 +3530,7 @@ addEventListener('fetch', event => {});`
|
|
|
3495
3530
|
await runWrangler("publish index.js --env production");
|
|
3496
3531
|
|
|
3497
3532
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3498
|
-
"Total Upload:
|
|
3533
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3499
3534
|
Uploaded test-name-production (TIMINGS)
|
|
3500
3535
|
Published test-name-production (TIMINGS)
|
|
3501
3536
|
http://production.example.com/*"
|
|
@@ -3529,7 +3564,7 @@ addEventListener('fetch', event => {});`
|
|
|
3529
3564
|
await runWrangler("publish index.js --env production");
|
|
3530
3565
|
|
|
3531
3566
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3532
|
-
"Total Upload:
|
|
3567
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3533
3568
|
Uploaded test-name-production (TIMINGS)
|
|
3534
3569
|
Published test-name-production (TIMINGS)
|
|
3535
3570
|
http://production.example.com/*"
|
|
@@ -3567,20 +3602,17 @@ addEventListener('fetch', event => {});`
|
|
|
3567
3602
|
mockSubDomainRequest();
|
|
3568
3603
|
mockUploadWorkerRequest();
|
|
3569
3604
|
await runWrangler("build");
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
//# sourceMappingURL=index.js.map
|
|
3582
|
-
"
|
|
3583
|
-
`);
|
|
3605
|
+
|
|
3606
|
+
const outFile = normalizeSlashes(
|
|
3607
|
+
normalizeTempDirs(fs.readFileSync("dist/index.js", "utf-8"))
|
|
3608
|
+
);
|
|
3609
|
+
|
|
3610
|
+
// We don't check against the whole file as there is middleware being injected
|
|
3611
|
+
expect(outFile).toContain("console.log(123);");
|
|
3612
|
+
expect(outFile).toContain("console.log(globalThis.abc);");
|
|
3613
|
+
expect(outFile).toContain(`const abc2 = "a string";`);
|
|
3614
|
+
expect(outFile).toContain("console.log(abc2);");
|
|
3615
|
+
expect(outFile).toContain("console.log(foo);");
|
|
3584
3616
|
});
|
|
3585
3617
|
|
|
3586
3618
|
it("can be overriden in environments", async () => {
|
|
@@ -3606,14 +3638,35 @@ addEventListener('fetch', event => {});`
|
|
|
3606
3638
|
mockSubDomainRequest();
|
|
3607
3639
|
mockUploadWorkerRequest();
|
|
3608
3640
|
await runWrangler("build --env staging");
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3641
|
+
|
|
3642
|
+
const outFile = normalizeSlashes(
|
|
3643
|
+
normalizeTempDirs(fs.readFileSync("dist/index.js", "utf-8"))
|
|
3644
|
+
);
|
|
3645
|
+
|
|
3646
|
+
// We don't check against the whole file as there is middleware being injected
|
|
3647
|
+
expect(outFile).toContain("console.log(456);");
|
|
3648
|
+
});
|
|
3649
|
+
|
|
3650
|
+
it("can be overridden with cli args", async () => {
|
|
3651
|
+
writeWranglerToml({
|
|
3652
|
+
main: "index.js",
|
|
3653
|
+
define: {
|
|
3654
|
+
abc: "123",
|
|
3655
|
+
},
|
|
3656
|
+
});
|
|
3657
|
+
fs.writeFileSync(
|
|
3658
|
+
"index.js",
|
|
3659
|
+
`
|
|
3660
|
+
console.log(abc);
|
|
3661
|
+
`
|
|
3662
|
+
);
|
|
3663
|
+
mockSubDomainRequest();
|
|
3664
|
+
mockUploadWorkerRequest();
|
|
3665
|
+
await runWrangler("publish --dry-run --outdir dist --define abc:789");
|
|
3666
|
+
|
|
3667
|
+
expect(fs.readFileSync("dist/index.js", "utf-8")).toContain(
|
|
3668
|
+
`console.log(789);`
|
|
3669
|
+
);
|
|
3617
3670
|
});
|
|
3618
3671
|
});
|
|
3619
3672
|
|
|
@@ -3637,12 +3690,12 @@ addEventListener('fetch', event => {});`
|
|
|
3637
3690
|
|
|
3638
3691
|
await runWrangler("publish index.js");
|
|
3639
3692
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3693
|
+
"Running custom build: node -e \\"console.log('custom build'); require('fs').writeFileSync('index.js', 'export default { fetch(){ return new Response(123) } }')\\"
|
|
3694
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
3695
|
+
Uploaded test-name (TIMINGS)
|
|
3696
|
+
Published test-name (TIMINGS)
|
|
3697
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3698
|
+
`);
|
|
3646
3699
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3647
3700
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
3648
3701
|
});
|
|
@@ -3663,7 +3716,7 @@ addEventListener('fetch', event => {});`
|
|
|
3663
3716
|
await runWrangler("publish index.js");
|
|
3664
3717
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3665
3718
|
"Running custom build: echo \\"custom build\\" && echo \\"export default { fetch(){ return new Response(123) } }\\" > index.js
|
|
3666
|
-
Total Upload:
|
|
3719
|
+
Total Upload: xx KiB / gzip: xx KiB
|
|
3667
3720
|
Uploaded test-name (TIMINGS)
|
|
3668
3721
|
Published test-name (TIMINGS)
|
|
3669
3722
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3769,7 +3822,7 @@ addEventListener('fetch', event => {});`
|
|
|
3769
3822
|
mockSubDomainRequest();
|
|
3770
3823
|
await runWrangler("publish index.js --minify");
|
|
3771
3824
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3772
|
-
"Total Upload:
|
|
3825
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3773
3826
|
Uploaded test-name (TIMINGS)
|
|
3774
3827
|
Published test-name (TIMINGS)
|
|
3775
3828
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -3808,7 +3861,7 @@ addEventListener('fetch', event => {});`
|
|
|
3808
3861
|
mockSubDomainRequest();
|
|
3809
3862
|
await runWrangler("publish -e testEnv index.js");
|
|
3810
3863
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3811
|
-
"Total Upload:
|
|
3864
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3812
3865
|
Uploaded test-name (testEnv) (TIMINGS)
|
|
3813
3866
|
Published test-name (testEnv) (TIMINGS)
|
|
3814
3867
|
https://testEnv.test-name.test-sub-domain.workers.dev"
|
|
@@ -3832,14 +3885,14 @@ addEventListener('fetch', event => {});`
|
|
|
3832
3885
|
mockUploadWorkerRequest();
|
|
3833
3886
|
await runWrangler("publish index.js");
|
|
3834
3887
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3888
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3889
|
+
Your worker has access to the following bindings:
|
|
3890
|
+
- Durable Objects:
|
|
3891
|
+
- SOMENAME: SomeClass
|
|
3892
|
+
Uploaded test-name (TIMINGS)
|
|
3893
|
+
Published test-name (TIMINGS)
|
|
3894
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3895
|
+
`);
|
|
3843
3896
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3844
3897
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
3845
3898
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -3882,14 +3935,14 @@ addEventListener('fetch', event => {});`
|
|
|
3882
3935
|
mockUploadWorkerRequest();
|
|
3883
3936
|
await runWrangler("publish index.js");
|
|
3884
3937
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3938
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3939
|
+
Your worker has access to the following bindings:
|
|
3940
|
+
- Durable Objects:
|
|
3941
|
+
- SOMENAME: SomeClass (defined in some-script)
|
|
3942
|
+
Uploaded test-name (TIMINGS)
|
|
3943
|
+
Published test-name (TIMINGS)
|
|
3944
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3945
|
+
`);
|
|
3893
3946
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3894
3947
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
3895
3948
|
});
|
|
@@ -3925,15 +3978,15 @@ addEventListener('fetch', event => {});`
|
|
|
3925
3978
|
|
|
3926
3979
|
await runWrangler("publish index.js");
|
|
3927
3980
|
expect(std.out).toMatchInlineSnapshot(`
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3981
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
3982
|
+
Your worker has access to the following bindings:
|
|
3983
|
+
- Durable Objects:
|
|
3984
|
+
- SOMENAME: SomeClass
|
|
3985
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
3986
|
+
Uploaded test-name (TIMINGS)
|
|
3987
|
+
Published test-name (TIMINGS)
|
|
3988
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
3989
|
+
`);
|
|
3937
3990
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
3938
3991
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
3939
3992
|
});
|
|
@@ -3973,20 +4026,20 @@ addEventListener('fetch', event => {});`
|
|
|
3973
4026
|
|
|
3974
4027
|
await runWrangler("publish index.js");
|
|
3975
4028
|
expect(std).toMatchInlineSnapshot(`
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4029
|
+
Object {
|
|
4030
|
+
"debug": "",
|
|
4031
|
+
"err": "",
|
|
4032
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4033
|
+
Your worker has access to the following bindings:
|
|
4034
|
+
- Durable Objects:
|
|
4035
|
+
- SOMENAME: SomeClass
|
|
4036
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4037
|
+
Uploaded test-name (TIMINGS)
|
|
4038
|
+
Published test-name (TIMINGS)
|
|
4039
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
4040
|
+
"warn": "",
|
|
4041
|
+
}
|
|
4042
|
+
`);
|
|
3990
4043
|
});
|
|
3991
4044
|
|
|
3992
4045
|
it("should not send migrations if they've all already been sent", async () => {
|
|
@@ -4017,20 +4070,20 @@ addEventListener('fetch', event => {});`
|
|
|
4017
4070
|
|
|
4018
4071
|
await runWrangler("publish index.js");
|
|
4019
4072
|
expect(std).toMatchInlineSnapshot(`
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4073
|
+
Object {
|
|
4074
|
+
"debug": "",
|
|
4075
|
+
"err": "",
|
|
4076
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4077
|
+
Your worker has access to the following bindings:
|
|
4078
|
+
- Durable Objects:
|
|
4079
|
+
- SOMENAME: SomeClass
|
|
4080
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4081
|
+
Uploaded test-name (TIMINGS)
|
|
4082
|
+
Published test-name (TIMINGS)
|
|
4083
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
4084
|
+
"warn": "",
|
|
4085
|
+
}
|
|
4086
|
+
`);
|
|
4034
4087
|
});
|
|
4035
4088
|
|
|
4036
4089
|
describe("service environments", () => {
|
|
@@ -4066,15 +4119,15 @@ addEventListener('fetch', event => {});`
|
|
|
4066
4119
|
|
|
4067
4120
|
await runWrangler("publish index.js --legacy-env false");
|
|
4068
4121
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4122
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4123
|
+
Your worker has access to the following bindings:
|
|
4124
|
+
- Durable Objects:
|
|
4125
|
+
- SOMENAME: SomeClass
|
|
4126
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4127
|
+
Uploaded test-name (TIMINGS)
|
|
4128
|
+
Published test-name (TIMINGS)
|
|
4129
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4130
|
+
`);
|
|
4078
4131
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4079
4132
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
4080
4133
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -4129,15 +4182,15 @@ addEventListener('fetch', event => {});`
|
|
|
4129
4182
|
|
|
4130
4183
|
await runWrangler("publish index.js --legacy-env false --env xyz");
|
|
4131
4184
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4185
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4186
|
+
Your worker has access to the following bindings:
|
|
4187
|
+
- Durable Objects:
|
|
4188
|
+
- SOMENAME: SomeClass
|
|
4189
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4190
|
+
Uploaded test-name (xyz) (TIMINGS)
|
|
4191
|
+
Published test-name (xyz) (TIMINGS)
|
|
4192
|
+
https://xyz.test-name.test-sub-domain.workers.dev"
|
|
4193
|
+
`);
|
|
4141
4194
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4142
4195
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
4143
4196
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -4150,6 +4203,7 @@ addEventListener('fetch', event => {});`
|
|
|
4150
4203
|
});
|
|
4151
4204
|
|
|
4152
4205
|
it("should use a script's current migration tag when publishing migrations", async () => {
|
|
4206
|
+
unsetAllMocks();
|
|
4153
4207
|
writeWranglerToml({
|
|
4154
4208
|
durable_objects: {
|
|
4155
4209
|
bindings: [
|
|
@@ -4185,25 +4239,25 @@ addEventListener('fetch', event => {});`
|
|
|
4185
4239
|
|
|
4186
4240
|
await runWrangler("publish index.js --legacy-env false");
|
|
4187
4241
|
expect(std).toMatchInlineSnapshot(`
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4242
|
+
Object {
|
|
4243
|
+
"debug": "",
|
|
4244
|
+
"err": "",
|
|
4245
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4246
|
+
Your worker has access to the following bindings:
|
|
4247
|
+
- Durable Objects:
|
|
4248
|
+
- SOMENAME: SomeClass
|
|
4249
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4250
|
+
Uploaded test-name (TIMINGS)
|
|
4251
|
+
Published test-name (TIMINGS)
|
|
4252
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
4253
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
4200
4254
|
|
|
4201
|
-
|
|
4202
|
-
|
|
4255
|
+
- Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
|
|
4256
|
+
the future. DO NOT USE IN PRODUCTION.
|
|
4203
4257
|
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4258
|
+
",
|
|
4259
|
+
}
|
|
4260
|
+
`);
|
|
4207
4261
|
});
|
|
4208
4262
|
|
|
4209
4263
|
it("should use an environment's current migration tag when publishing migrations", async () => {
|
|
@@ -4254,25 +4308,25 @@ addEventListener('fetch', event => {});`
|
|
|
4254
4308
|
|
|
4255
4309
|
await runWrangler("publish index.js --legacy-env false --env xyz");
|
|
4256
4310
|
expect(std).toMatchInlineSnapshot(`
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4311
|
+
Object {
|
|
4312
|
+
"debug": "",
|
|
4313
|
+
"err": "",
|
|
4314
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
4315
|
+
Your worker has access to the following bindings:
|
|
4316
|
+
- Durable Objects:
|
|
4317
|
+
- SOMENAME: SomeClass
|
|
4318
|
+
- SOMEOTHERNAME: SomeOtherClass
|
|
4319
|
+
Uploaded test-name (xyz) (TIMINGS)
|
|
4320
|
+
Published test-name (xyz) (TIMINGS)
|
|
4321
|
+
https://xyz.test-name.test-sub-domain.workers.dev",
|
|
4322
|
+
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
4269
4323
|
|
|
4270
|
-
|
|
4271
|
-
|
|
4324
|
+
- Experimental: Service environments are in beta, and their behaviour is guaranteed to change in
|
|
4325
|
+
the future. DO NOT USE IN PRODUCTION.
|
|
4272
4326
|
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4327
|
+
",
|
|
4328
|
+
}
|
|
4329
|
+
`);
|
|
4276
4330
|
});
|
|
4277
4331
|
});
|
|
4278
4332
|
});
|
|
@@ -4451,39 +4505,39 @@ addEventListener('fetch', event => {});`
|
|
|
4451
4505
|
|
|
4452
4506
|
await expect(runWrangler("publish index.js")).resolves.toBeUndefined();
|
|
4453
4507
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4508
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4509
|
+
Your worker has access to the following bindings:
|
|
4510
|
+
- Data Blobs:
|
|
4511
|
+
- DATA_BLOB_ONE: some-data-blob.bin
|
|
4512
|
+
- DATA_BLOB_TWO: more-data-blob.bin
|
|
4513
|
+
- Durable Objects:
|
|
4514
|
+
- DURABLE_OBJECT_ONE: SomeDurableObject (defined in some-durable-object-worker)
|
|
4515
|
+
- DURABLE_OBJECT_TWO: AnotherDurableObject (defined in another-durable-object-worker) - staging
|
|
4516
|
+
- KV Namespaces:
|
|
4517
|
+
- KV_NAMESPACE_ONE: kv-ns-one-id
|
|
4518
|
+
- KV_NAMESPACE_TWO: kv-ns-two-id
|
|
4519
|
+
- R2 Buckets:
|
|
4520
|
+
- R2_BUCKET_ONE: r2-bucket-one-name
|
|
4521
|
+
- R2_BUCKET_TWO: r2-bucket-two-name
|
|
4522
|
+
- logfwdr:
|
|
4523
|
+
- httplogs: httplogs
|
|
4524
|
+
- trace: trace
|
|
4525
|
+
- Text Blobs:
|
|
4526
|
+
- TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg
|
|
4527
|
+
- TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt
|
|
4528
|
+
- Unsafe:
|
|
4529
|
+
- some unsafe thing: UNSAFE_BINDING_ONE
|
|
4530
|
+
- another unsafe thing: UNSAFE_BINDING_TWO
|
|
4531
|
+
- Vars:
|
|
4532
|
+
- ENV_VAR_ONE: \\"123\\"
|
|
4533
|
+
- ENV_VAR_TWO: \\"Hello, I'm an environment variable\\"
|
|
4534
|
+
- Wasm Modules:
|
|
4535
|
+
- WASM_MODULE_ONE: some_wasm.wasm
|
|
4536
|
+
- WASM_MODULE_TWO: more_wasm.wasm
|
|
4537
|
+
Uploaded test-name (TIMINGS)
|
|
4538
|
+
Published test-name (TIMINGS)
|
|
4539
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4540
|
+
`);
|
|
4487
4541
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4488
4542
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
4489
4543
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -4856,14 +4910,14 @@ addEventListener('fetch', event => {});`
|
|
|
4856
4910
|
mockSubDomainRequest();
|
|
4857
4911
|
await runWrangler("publish index.js");
|
|
4858
4912
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4913
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4914
|
+
Your worker has access to the following bindings:
|
|
4915
|
+
- Wasm Modules:
|
|
4916
|
+
- TESTWASMNAME: path/to/test.wasm
|
|
4917
|
+
Uploaded test-name (TIMINGS)
|
|
4918
|
+
Published test-name (TIMINGS)
|
|
4919
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4920
|
+
`);
|
|
4867
4921
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4868
4922
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
4869
4923
|
});
|
|
@@ -4926,14 +4980,14 @@ addEventListener('fetch', event => {});`
|
|
|
4926
4980
|
mockSubDomainRequest();
|
|
4927
4981
|
await runWrangler("publish index.js --config ./path/to/wrangler.toml");
|
|
4928
4982
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4983
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4984
|
+
Your worker has access to the following bindings:
|
|
4985
|
+
- Wasm Modules:
|
|
4986
|
+
- TESTWASMNAME: path/to/and/the/path/to/test.wasm
|
|
4987
|
+
Uploaded test-name (TIMINGS)
|
|
4988
|
+
Published test-name (TIMINGS)
|
|
4989
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
4990
|
+
`);
|
|
4937
4991
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
4938
4992
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
4939
4993
|
});
|
|
@@ -4962,7 +5016,7 @@ addEventListener('fetch', event => {});`
|
|
|
4962
5016
|
mockSubDomainRequest();
|
|
4963
5017
|
await runWrangler("publish index.js");
|
|
4964
5018
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4965
|
-
"Total Upload:
|
|
5019
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
4966
5020
|
Uploaded test-name (TIMINGS)
|
|
4967
5021
|
Published test-name (TIMINGS)
|
|
4968
5022
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -4996,14 +5050,14 @@ addEventListener('fetch', event => {});`
|
|
|
4996
5050
|
mockSubDomainRequest();
|
|
4997
5051
|
await runWrangler("publish index.js");
|
|
4998
5052
|
expect(std.out).toMatchInlineSnapshot(`
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5053
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5054
|
+
Your worker has access to the following bindings:
|
|
5055
|
+
- Text Blobs:
|
|
5056
|
+
- TESTTEXTBLOBNAME: path/to/text.file
|
|
5057
|
+
Uploaded test-name (TIMINGS)
|
|
5058
|
+
Published test-name (TIMINGS)
|
|
5059
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5060
|
+
`);
|
|
5007
5061
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5008
5062
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5009
5063
|
});
|
|
@@ -5070,14 +5124,14 @@ addEventListener('fetch', event => {});`
|
|
|
5070
5124
|
mockSubDomainRequest();
|
|
5071
5125
|
await runWrangler("publish index.js --config ./path/to/wrangler.toml");
|
|
5072
5126
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5127
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5128
|
+
Your worker has access to the following bindings:
|
|
5129
|
+
- Text Blobs:
|
|
5130
|
+
- TESTTEXTBLOBNAME: path/to/and/the/path/to/text.file
|
|
5131
|
+
Uploaded test-name (TIMINGS)
|
|
5132
|
+
Published test-name (TIMINGS)
|
|
5133
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5134
|
+
`);
|
|
5081
5135
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5082
5136
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5083
5137
|
});
|
|
@@ -5107,14 +5161,14 @@ addEventListener('fetch', event => {});`
|
|
|
5107
5161
|
mockSubDomainRequest();
|
|
5108
5162
|
await runWrangler("publish index.js");
|
|
5109
5163
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5164
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5165
|
+
Your worker has access to the following bindings:
|
|
5166
|
+
- Data Blobs:
|
|
5167
|
+
- TESTDATABLOBNAME: path/to/data.bin
|
|
5168
|
+
Uploaded test-name (TIMINGS)
|
|
5169
|
+
Published test-name (TIMINGS)
|
|
5170
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5171
|
+
`);
|
|
5118
5172
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5119
5173
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5120
5174
|
});
|
|
@@ -5181,14 +5235,14 @@ addEventListener('fetch', event => {});`
|
|
|
5181
5235
|
mockSubDomainRequest();
|
|
5182
5236
|
await runWrangler("publish index.js --config ./path/to/wrangler.toml");
|
|
5183
5237
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5238
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5239
|
+
Your worker has access to the following bindings:
|
|
5240
|
+
- Data Blobs:
|
|
5241
|
+
- TESTDATABLOBNAME: path/to/and/the/path/to/data.bin
|
|
5242
|
+
Uploaded test-name (TIMINGS)
|
|
5243
|
+
Published test-name (TIMINGS)
|
|
5244
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5245
|
+
`);
|
|
5192
5246
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5193
5247
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5194
5248
|
});
|
|
@@ -5219,19 +5273,42 @@ addEventListener('fetch', event => {});`
|
|
|
5219
5273
|
|
|
5220
5274
|
await runWrangler("publish index.js");
|
|
5221
5275
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5276
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5277
|
+
Your worker has access to the following bindings:
|
|
5278
|
+
- Vars:
|
|
5279
|
+
- text: \\"plain ol' string\\"
|
|
5280
|
+
- count: \\"1\\"
|
|
5281
|
+
- complex: \\"[object Object]\\"
|
|
5282
|
+
Uploaded test-name (TIMINGS)
|
|
5283
|
+
Published test-name (TIMINGS)
|
|
5284
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5285
|
+
`);
|
|
5232
5286
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5233
5287
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5234
5288
|
});
|
|
5289
|
+
|
|
5290
|
+
it("should read vars passed as cli arguments", async () => {
|
|
5291
|
+
writeWranglerToml();
|
|
5292
|
+
writeWorkerSource();
|
|
5293
|
+
mockSubDomainRequest();
|
|
5294
|
+
mockUploadWorkerRequest();
|
|
5295
|
+
await runWrangler("publish index.js --var TEXT:sometext --var COUNT:1");
|
|
5296
|
+
expect(std).toMatchInlineSnapshot(`
|
|
5297
|
+
Object {
|
|
5298
|
+
"debug": "",
|
|
5299
|
+
"err": "",
|
|
5300
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
5301
|
+
Your worker has access to the following bindings:
|
|
5302
|
+
- Vars:
|
|
5303
|
+
- TEXT: \\"(hidden)\\"
|
|
5304
|
+
- COUNT: \\"(hidden)\\"
|
|
5305
|
+
Uploaded test-name (TIMINGS)
|
|
5306
|
+
Published test-name (TIMINGS)
|
|
5307
|
+
https://test-name.test-sub-domain.workers.dev",
|
|
5308
|
+
"warn": "",
|
|
5309
|
+
}
|
|
5310
|
+
`);
|
|
5311
|
+
});
|
|
5235
5312
|
});
|
|
5236
5313
|
|
|
5237
5314
|
describe("[r2_buckets]", () => {
|
|
@@ -5249,14 +5326,14 @@ addEventListener('fetch', event => {});`
|
|
|
5249
5326
|
|
|
5250
5327
|
await runWrangler("publish index.js");
|
|
5251
5328
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5329
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5330
|
+
Your worker has access to the following bindings:
|
|
5331
|
+
- R2 Buckets:
|
|
5332
|
+
- FOO: foo-bucket
|
|
5333
|
+
Uploaded test-name (TIMINGS)
|
|
5334
|
+
Published test-name (TIMINGS)
|
|
5335
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5336
|
+
`);
|
|
5260
5337
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5261
5338
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5262
5339
|
});
|
|
@@ -5300,15 +5377,15 @@ addEventListener('fetch', event => {});`
|
|
|
5300
5377
|
|
|
5301
5378
|
await runWrangler("publish index.js");
|
|
5302
5379
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5380
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5381
|
+
Your worker has access to the following bindings:
|
|
5382
|
+
- logfwdr:
|
|
5383
|
+
- httplogs: httplogs
|
|
5384
|
+
- trace: trace
|
|
5385
|
+
Uploaded test-name (TIMINGS)
|
|
5386
|
+
Published test-name (TIMINGS)
|
|
5387
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5388
|
+
`);
|
|
5312
5389
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5313
5390
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5314
5391
|
});
|
|
@@ -5347,14 +5424,14 @@ addEventListener('fetch', event => {});`
|
|
|
5347
5424
|
|
|
5348
5425
|
await runWrangler("publish index.js");
|
|
5349
5426
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5427
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5428
|
+
Your worker has access to the following bindings:
|
|
5429
|
+
- Durable Objects:
|
|
5430
|
+
- EXAMPLE_DO_BINDING: ExampleDurableObject
|
|
5431
|
+
Uploaded test-name (TIMINGS)
|
|
5432
|
+
Published test-name (TIMINGS)
|
|
5433
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5434
|
+
`);
|
|
5358
5435
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5359
5436
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5360
5437
|
});
|
|
@@ -5387,14 +5464,14 @@ addEventListener('fetch', event => {});`
|
|
|
5387
5464
|
|
|
5388
5465
|
await runWrangler("publish index.js");
|
|
5389
5466
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5467
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5468
|
+
Your worker has access to the following bindings:
|
|
5469
|
+
- Durable Objects:
|
|
5470
|
+
- EXAMPLE_DO_BINDING: ExampleDurableObject (defined in example-do-binding-worker)
|
|
5471
|
+
Uploaded test-name (TIMINGS)
|
|
5472
|
+
Published test-name (TIMINGS)
|
|
5473
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5474
|
+
`);
|
|
5398
5475
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5399
5476
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5400
5477
|
});
|
|
@@ -5432,14 +5509,14 @@ addEventListener('fetch', event => {});`
|
|
|
5432
5509
|
|
|
5433
5510
|
await runWrangler("publish index.js");
|
|
5434
5511
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5512
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5513
|
+
Your worker has access to the following bindings:
|
|
5514
|
+
- Durable Objects:
|
|
5515
|
+
- EXAMPLE_DO_BINDING: ExampleDurableObject
|
|
5516
|
+
Uploaded test-name (TIMINGS)
|
|
5517
|
+
Published test-name (TIMINGS)
|
|
5518
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5519
|
+
`);
|
|
5443
5520
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5444
5521
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
5445
5522
|
});
|
|
@@ -5495,14 +5572,14 @@ addEventListener('fetch', event => {});`
|
|
|
5495
5572
|
|
|
5496
5573
|
await runWrangler("publish index.js");
|
|
5497
5574
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5575
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5576
|
+
Your worker has access to the following bindings:
|
|
5577
|
+
- Services:
|
|
5578
|
+
- FOO: foo-service - production
|
|
5579
|
+
Uploaded test-name (TIMINGS)
|
|
5580
|
+
Published test-name (TIMINGS)
|
|
5581
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5582
|
+
`);
|
|
5506
5583
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5507
5584
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5508
5585
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5514,10 +5591,10 @@ addEventListener('fetch', event => {});`
|
|
|
5514
5591
|
});
|
|
5515
5592
|
});
|
|
5516
5593
|
|
|
5517
|
-
describe("[
|
|
5518
|
-
it("should support bindings to a
|
|
5594
|
+
describe("[dispatch_namespaces]", () => {
|
|
5595
|
+
it("should support bindings to a dispatch namespace", async () => {
|
|
5519
5596
|
writeWranglerToml({
|
|
5520
|
-
|
|
5597
|
+
dispatch_namespaces: [
|
|
5521
5598
|
{
|
|
5522
5599
|
binding: "foo",
|
|
5523
5600
|
namespace: "Foo",
|
|
@@ -5537,19 +5614,19 @@ addEventListener('fetch', event => {});`
|
|
|
5537
5614
|
});
|
|
5538
5615
|
await runWrangler("publish index.js");
|
|
5539
5616
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5617
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5618
|
+
Your worker has access to the following bindings:
|
|
5619
|
+
- dispatch namespaces:
|
|
5620
|
+
- foo: Foo
|
|
5621
|
+
Uploaded test-name (TIMINGS)
|
|
5622
|
+
Published test-name (TIMINGS)
|
|
5623
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5624
|
+
`);
|
|
5548
5625
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5549
5626
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5550
5627
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
5551
5628
|
|
|
5552
|
-
- \\"
|
|
5629
|
+
- \\"dispatch_namespaces\\" fields are experimental and may change or break at any time.
|
|
5553
5630
|
|
|
5554
5631
|
"
|
|
5555
5632
|
`);
|
|
@@ -5583,14 +5660,14 @@ addEventListener('fetch', event => {});`
|
|
|
5583
5660
|
|
|
5584
5661
|
await runWrangler("publish index.js");
|
|
5585
5662
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5663
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5664
|
+
Your worker has access to the following bindings:
|
|
5665
|
+
- Unsafe:
|
|
5666
|
+
- binding-type: my-binding
|
|
5667
|
+
Uploaded test-name (TIMINGS)
|
|
5668
|
+
Published test-name (TIMINGS)
|
|
5669
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5670
|
+
`);
|
|
5594
5671
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5595
5672
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5596
5673
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5626,14 +5703,14 @@ addEventListener('fetch', event => {});`
|
|
|
5626
5703
|
|
|
5627
5704
|
await runWrangler("publish index.js");
|
|
5628
5705
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5706
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5707
|
+
Your worker has access to the following bindings:
|
|
5708
|
+
- Unsafe:
|
|
5709
|
+
- plain_text: my-binding
|
|
5710
|
+
Uploaded test-name (TIMINGS)
|
|
5711
|
+
Published test-name (TIMINGS)
|
|
5712
|
+
https://test-name.test-sub-domain.workers.dev"
|
|
5713
|
+
`);
|
|
5637
5714
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
5638
5715
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
5639
5716
|
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
@@ -5675,7 +5752,7 @@ addEventListener('fetch', event => {});`
|
|
|
5675
5752
|
});
|
|
5676
5753
|
await runWrangler("publish index.js");
|
|
5677
5754
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5678
|
-
"Total Upload:
|
|
5755
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5679
5756
|
Uploaded test-name (TIMINGS)
|
|
5680
5757
|
Published test-name (TIMINGS)
|
|
5681
5758
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5704,7 +5781,7 @@ addEventListener('fetch', event => {});`
|
|
|
5704
5781
|
});
|
|
5705
5782
|
await runWrangler("publish index.js");
|
|
5706
5783
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5707
|
-
"Total Upload:
|
|
5784
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5708
5785
|
Uploaded test-name (TIMINGS)
|
|
5709
5786
|
Published test-name (TIMINGS)
|
|
5710
5787
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5737,7 +5814,7 @@ addEventListener('fetch', event => {});`
|
|
|
5737
5814
|
});
|
|
5738
5815
|
await runWrangler("publish index.js");
|
|
5739
5816
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5740
|
-
"Total Upload:
|
|
5817
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5741
5818
|
Uploaded test-name (TIMINGS)
|
|
5742
5819
|
Published test-name (TIMINGS)
|
|
5743
5820
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5786,7 +5863,7 @@ addEventListener('fetch', event => {});`
|
|
|
5786
5863
|
});
|
|
5787
5864
|
await runWrangler("publish index.js");
|
|
5788
5865
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5789
|
-
"Total Upload:
|
|
5866
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5790
5867
|
Uploaded test-name (TIMINGS)
|
|
5791
5868
|
Published test-name (TIMINGS)
|
|
5792
5869
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5883,7 +5960,7 @@ addEventListener('fetch', event => {});`
|
|
|
5883
5960
|
});
|
|
5884
5961
|
await runWrangler("publish index.js");
|
|
5885
5962
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5886
|
-
"Total Upload:
|
|
5963
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5887
5964
|
Uploaded test-name (TIMINGS)
|
|
5888
5965
|
Published test-name (TIMINGS)
|
|
5889
5966
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5913,7 +5990,7 @@ addEventListener('fetch', event => {});`
|
|
|
5913
5990
|
});
|
|
5914
5991
|
await runWrangler("publish index.js");
|
|
5915
5992
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5916
|
-
"Total Upload:
|
|
5993
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5917
5994
|
Uploaded test-name (TIMINGS)
|
|
5918
5995
|
Published test-name (TIMINGS)
|
|
5919
5996
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5942,7 +6019,7 @@ addEventListener('fetch', event => {});`
|
|
|
5942
6019
|
});
|
|
5943
6020
|
await runWrangler("publish index.js");
|
|
5944
6021
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5945
|
-
"Total Upload:
|
|
6022
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5946
6023
|
Uploaded test-name (TIMINGS)
|
|
5947
6024
|
Published test-name (TIMINGS)
|
|
5948
6025
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -5973,7 +6050,7 @@ addEventListener('fetch', event => {});`
|
|
|
5973
6050
|
});
|
|
5974
6051
|
await runWrangler("publish index.js");
|
|
5975
6052
|
expect(std.out).toMatchInlineSnapshot(`
|
|
5976
|
-
"Total Upload:
|
|
6053
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
5977
6054
|
Uploaded test-name (TIMINGS)
|
|
5978
6055
|
Published test-name (TIMINGS)
|
|
5979
6056
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -6002,7 +6079,7 @@ addEventListener('fetch', event => {});`
|
|
|
6002
6079
|
"publish index.js --compatibility-date 2022-03-17 --name test-name"
|
|
6003
6080
|
);
|
|
6004
6081
|
expect(std.out).toMatchInlineSnapshot(`
|
|
6005
|
-
"Total Upload:
|
|
6082
|
+
"Total Upload: xx KiB / gzip: xx KiB
|
|
6006
6083
|
Uploaded test-name (TIMINGS)
|
|
6007
6084
|
Published test-name (TIMINGS)
|
|
6008
6085
|
https://test-name.test-sub-domain.workers.dev"
|
|
@@ -6043,7 +6120,7 @@ addEventListener('fetch', event => {});`
|
|
|
6043
6120
|
Object {
|
|
6044
6121
|
"debug": "",
|
|
6045
6122
|
"err": "",
|
|
6046
|
-
"out": "Total Upload:
|
|
6123
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6047
6124
|
Uploaded test-name (TIMINGS)
|
|
6048
6125
|
Published test-name (TIMINGS)
|
|
6049
6126
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6073,7 +6150,7 @@ addEventListener('fetch', event => {});`
|
|
|
6073
6150
|
Object {
|
|
6074
6151
|
"debug": "",
|
|
6075
6152
|
"err": "",
|
|
6076
|
-
"out": "Total Upload:
|
|
6153
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6077
6154
|
Uploaded test-name (TIMINGS)
|
|
6078
6155
|
Published test-name (TIMINGS)
|
|
6079
6156
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6096,7 +6173,7 @@ addEventListener('fetch', event => {});`
|
|
|
6096
6173
|
Object {
|
|
6097
6174
|
"debug": "",
|
|
6098
6175
|
"err": "",
|
|
6099
|
-
"out": "Total Upload:
|
|
6176
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6100
6177
|
Uploaded test-name (TIMINGS)
|
|
6101
6178
|
Published test-name (TIMINGS)
|
|
6102
6179
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6120,17 +6197,17 @@ addEventListener('fetch', event => {});`
|
|
|
6120
6197
|
process.env.CLOUDFLARE_ACCOUNT_ID = "";
|
|
6121
6198
|
await runWrangler("publish index.js --dry-run");
|
|
6122
6199
|
expect(std).toMatchInlineSnapshot(`
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6200
|
+
Object {
|
|
6201
|
+
"debug": "",
|
|
6202
|
+
"err": "",
|
|
6203
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6204
|
+
Your worker has access to the following bindings:
|
|
6205
|
+
- Durable Objects:
|
|
6206
|
+
- NAME: SomeClass
|
|
6207
|
+
--dry-run: exiting now.",
|
|
6208
|
+
"warn": "",
|
|
6209
|
+
}
|
|
6210
|
+
`);
|
|
6134
6211
|
});
|
|
6135
6212
|
});
|
|
6136
6213
|
|
|
@@ -6143,7 +6220,7 @@ addEventListener('fetch', event => {});`
|
|
|
6143
6220
|
Object {
|
|
6144
6221
|
"debug": "",
|
|
6145
6222
|
"err": "",
|
|
6146
|
-
"out": "Total Upload:
|
|
6223
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6147
6224
|
--dry-run: exiting now.",
|
|
6148
6225
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mEnabling node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.[0m
|
|
6149
6226
|
|
|
@@ -6188,7 +6265,7 @@ addEventListener('fetch', event => {});`
|
|
|
6188
6265
|
Object {
|
|
6189
6266
|
"debug": "",
|
|
6190
6267
|
"err": "",
|
|
6191
|
-
"out": "Total Upload:
|
|
6268
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6192
6269
|
--dry-run: exiting now.",
|
|
6193
6270
|
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mEnabling node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.[0m
|
|
6194
6271
|
|
|
@@ -6238,7 +6315,7 @@ addEventListener('fetch', event => {});`
|
|
|
6238
6315
|
Object {
|
|
6239
6316
|
"debug": "",
|
|
6240
6317
|
"err": "",
|
|
6241
|
-
"out": "Total Upload:
|
|
6318
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6242
6319
|
Uploaded test-name (TIMINGS)
|
|
6243
6320
|
Published test-name (TIMINGS)
|
|
6244
6321
|
https://test-name.test-sub-domain.workers.dev",
|
|
@@ -6293,7 +6370,7 @@ addEventListener('fetch', event => {});`
|
|
|
6293
6370
|
Object {
|
|
6294
6371
|
"debug": "",
|
|
6295
6372
|
"err": "",
|
|
6296
|
-
"out": "Total Upload:
|
|
6373
|
+
"out": "Total Upload: xx KiB / gzip: xx KiB
|
|
6297
6374
|
|
|
6298
6375
|
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.[0m
|
|
6299
6376
|
|
|
@@ -6487,6 +6564,9 @@ function mockUploadWorkerRequest(
|
|
|
6487
6564
|
} else {
|
|
6488
6565
|
expect(metadata.body_part).toEqual("index.js");
|
|
6489
6566
|
}
|
|
6567
|
+
|
|
6568
|
+
expect(metadata.keep_bindings).toEqual(["plain_text", "json"]);
|
|
6569
|
+
|
|
6490
6570
|
if ("expectedBindings" in options) {
|
|
6491
6571
|
expect(metadata.bindings).toEqual(expectedBindings);
|
|
6492
6572
|
}
|
|
@@ -6622,19 +6702,6 @@ function mockUnauthorizedPublishRoutesRequest({
|
|
|
6622
6702
|
);
|
|
6623
6703
|
}
|
|
6624
6704
|
|
|
6625
|
-
function mockCollectKnownRoutesRequest(
|
|
6626
|
-
routes: { pattern: string; script: string }[]
|
|
6627
|
-
) {
|
|
6628
|
-
setMockResponse(`/zones/:zoneId/workers/routes`, "GET", () => routes);
|
|
6629
|
-
}
|
|
6630
|
-
|
|
6631
|
-
function mockGetZoneFromHostRequest(host: string, zone: string) {
|
|
6632
|
-
setMockResponse("/zones", (_uri, _init, queryParams) => {
|
|
6633
|
-
expect(queryParams.get("name")).toEqual(host);
|
|
6634
|
-
return [{ id: zone }];
|
|
6635
|
-
});
|
|
6636
|
-
}
|
|
6637
|
-
|
|
6638
6705
|
function mockPublishRoutesFallbackRequest(route: {
|
|
6639
6706
|
pattern: string;
|
|
6640
6707
|
script: string;
|