wrangler 2.8.1 → 2.9.1
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/miniflare-dist/index.mjs +1 -14
- package/package.json +2 -2
- package/src/__tests__/d1/d1.test.ts +11 -56
- package/src/__tests__/d1/migrate.test.ts +141 -0
- package/src/__tests__/dev.test.tsx +5 -4
- package/src/__tests__/generate.test.ts +1 -1
- package/src/__tests__/helpers/end-event-loop.ts +6 -0
- package/src/__tests__/helpers/mock-get-pages-upload-token.ts +25 -0
- package/src/__tests__/helpers/mock-set-timeout.ts +16 -0
- package/src/__tests__/index.test.ts +36 -32
- package/src/__tests__/init.test.ts +1 -1
- package/src/__tests__/kv.test.ts +55 -44
- package/src/__tests__/pages/deployment-list.test.ts +78 -0
- package/src/__tests__/pages/pages.test.ts +81 -0
- package/src/__tests__/pages/project-create.test.ts +63 -0
- package/src/__tests__/pages/project-list.test.ts +108 -0
- package/src/__tests__/pages/project-upload.test.ts +481 -0
- package/src/__tests__/pages/publish.test.ts +2221 -0
- package/src/__tests__/parse.test.ts +106 -0
- package/src/__tests__/pubsub.test.ts +15 -12
- package/src/__tests__/queues.test.ts +35 -28
- package/src/__tests__/r2.test.ts +25 -20
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/worker-namespace.test.ts +26 -21
- package/src/api/dev.ts +80 -11
- package/src/api/pages/publish.tsx +7 -4
- package/src/bundle.ts +1 -1
- package/src/config/config.ts +7 -0
- package/src/config/index.ts +24 -20
- package/src/d1/backups.tsx +20 -24
- package/src/d1/create.tsx +6 -5
- package/src/d1/delete.ts +7 -10
- package/src/d1/execute.tsx +83 -85
- package/src/d1/index.ts +5 -6
- package/src/d1/list.tsx +21 -9
- package/src/d1/migrations/apply.tsx +13 -9
- package/src/d1/migrations/create.tsx +9 -10
- package/src/d1/migrations/list.tsx +19 -9
- package/src/d1/migrations/options.ts +2 -2
- package/src/d1/options.ts +3 -3
- package/src/delete.ts +5 -8
- package/src/deprecated/index.ts +7 -8
- package/src/dev.tsx +42 -80
- package/src/dispatch-namespace.ts +20 -16
- package/src/docs/index.ts +7 -8
- package/src/generate/index.ts +5 -7
- package/src/index.ts +22 -21
- package/src/init.ts +5 -7
- package/src/kv/index.ts +15 -17
- package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
- package/src/pages/build.ts +6 -4
- package/src/pages/deployment-tails.ts +7 -10
- package/src/pages/deployments.tsx +6 -4
- package/src/pages/dev.ts +15 -17
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/pages/functions.ts +8 -4
- package/src/pages/index.ts +3 -3
- package/src/pages/projects.tsx +7 -12
- package/src/pages/publish.tsx +6 -4
- package/src/pages/types.ts +5 -0
- package/src/pages/upload.tsx +6 -4
- package/src/parse.ts +23 -1
- package/src/publish/index.ts +19 -15
- package/src/publish/publish.ts +2 -2
- package/src/pubsub/pubsub-commands.ts +18 -19
- package/src/queues/cli/commands/consumer/add.ts +18 -24
- package/src/queues/cli/commands/consumer/index.ts +3 -6
- package/src/queues/cli/commands/consumer/remove.ts +11 -18
- package/src/queues/cli/commands/create.ts +8 -8
- package/src/queues/cli/commands/delete.ts +8 -8
- package/src/queues/cli/commands/index.ts +3 -4
- package/src/queues/cli/commands/list.ts +8 -8
- package/src/r2/index.ts +28 -28
- package/src/secret/index.ts +9 -14
- package/src/tail/index.ts +6 -8
- package/src/yargs-types.ts +18 -5
- package/templates/checked-fetch.js +9 -1
- package/templates/tsconfig.init.json +1 -1
- package/templates/tsconfig.tsbuildinfo +1 -1
- package/wrangler-dist/cli.js +2180 -1799
- package/src/__tests__/pages.test.ts +0 -2898
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
indexLocation,
|
|
5
5
|
parseJSON,
|
|
6
6
|
parseTOML,
|
|
7
|
+
parseJSONC,
|
|
7
8
|
} from "../parse";
|
|
8
9
|
import type { Message } from "../parse";
|
|
9
10
|
|
|
@@ -257,7 +258,112 @@ describe("parseJSON", () => {
|
|
|
257
258
|
}
|
|
258
259
|
});
|
|
259
260
|
});
|
|
261
|
+
describe("parseJSONC", () => {
|
|
262
|
+
it("should parse jsonc that is empty", () => {
|
|
263
|
+
expect(parseJSONC("{}")).toStrictEqual({});
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it("should parse jsonc with basic values", () => {
|
|
267
|
+
expect(
|
|
268
|
+
parseJSONC(`
|
|
269
|
+
{
|
|
270
|
+
"name" : "basic",
|
|
271
|
+
"version": 1
|
|
272
|
+
}`)
|
|
273
|
+
).toStrictEqual({
|
|
274
|
+
name: "basic",
|
|
275
|
+
version: 1,
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it("should parse jsonc with complex values", () => {
|
|
280
|
+
expect(
|
|
281
|
+
parseJSONC(
|
|
282
|
+
`{
|
|
283
|
+
"name":"complex",
|
|
284
|
+
"spec":{
|
|
285
|
+
"uptime":[1,2.5,3],
|
|
286
|
+
"ok":true
|
|
287
|
+
}
|
|
288
|
+
}`
|
|
289
|
+
)
|
|
290
|
+
).toStrictEqual({
|
|
291
|
+
name: "complex",
|
|
292
|
+
spec: {
|
|
293
|
+
uptime: [1, 2.5, 3],
|
|
294
|
+
ok: true,
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
});
|
|
260
298
|
|
|
299
|
+
it("should parse jsonc with comments", () => {
|
|
300
|
+
expect(
|
|
301
|
+
parseJSONC(
|
|
302
|
+
`{
|
|
303
|
+
// Comment A
|
|
304
|
+
"name":"complex",
|
|
305
|
+
"spec":{
|
|
306
|
+
// Nested comment
|
|
307
|
+
"uptime":[1,2.5,3],
|
|
308
|
+
"ok":true
|
|
309
|
+
}
|
|
310
|
+
}`
|
|
311
|
+
)
|
|
312
|
+
).toStrictEqual({
|
|
313
|
+
name: "complex",
|
|
314
|
+
spec: {
|
|
315
|
+
uptime: [1, 2.5, 3],
|
|
316
|
+
ok: true,
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("should fail to parse jsonc with invalid string", () => {
|
|
322
|
+
try {
|
|
323
|
+
parseJSONC(`\n{\n"version" "1\n}\n`);
|
|
324
|
+
fail("parseJSONC did not throw");
|
|
325
|
+
} catch (err) {
|
|
326
|
+
expect({ ...(err as Error) }).toStrictEqual({
|
|
327
|
+
name: "ParseError",
|
|
328
|
+
text: "UnexpectedEndOfString",
|
|
329
|
+
kind: "error",
|
|
330
|
+
location: {
|
|
331
|
+
length: 2,
|
|
332
|
+
line: 3,
|
|
333
|
+
column: 10,
|
|
334
|
+
lineText: '"version" "1',
|
|
335
|
+
file: undefined,
|
|
336
|
+
fileText: `\n{\n"version" "1\n}\n`,
|
|
337
|
+
},
|
|
338
|
+
notes: [],
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it("should fail to parse jsonc with invalid number", () => {
|
|
344
|
+
const file = "config.json",
|
|
345
|
+
fileText = `{\n\t"a":{\n\t\t"b":{\n\t\t\t"c":[012345]\n}\n}\n}`;
|
|
346
|
+
try {
|
|
347
|
+
parseJSONC(fileText, file);
|
|
348
|
+
fail("parseJSONC did not throw");
|
|
349
|
+
} catch (err) {
|
|
350
|
+
expect({ ...(err as Error) }).toStrictEqual({
|
|
351
|
+
name: "ParseError",
|
|
352
|
+
text: "CommaExpected",
|
|
353
|
+
kind: "error",
|
|
354
|
+
location: {
|
|
355
|
+
file,
|
|
356
|
+
fileText,
|
|
357
|
+
length: 5,
|
|
358
|
+
line: 4,
|
|
359
|
+
column: 9,
|
|
360
|
+
lineText: `\t\t\t"c":[012345]`,
|
|
361
|
+
},
|
|
362
|
+
notes: [],
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
261
367
|
describe("indexLocation", () => {
|
|
262
368
|
it("should calculate location from one-line input", () => {
|
|
263
369
|
const fileText = "";
|
|
@@ -34,10 +34,11 @@ describe("wrangler", () => {
|
|
|
34
34
|
wrangler pubsub broker Interact with your Pub/Sub Brokers
|
|
35
35
|
|
|
36
36
|
Flags:
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
37
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
38
|
+
-c, --config Path to .toml configuration file [string]
|
|
39
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
40
|
+
-h, --help Show help [boolean]
|
|
41
|
+
-v, --version Show version number [boolean]
|
|
41
42
|
|
|
42
43
|
👷🏽 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/",
|
|
43
44
|
"warn": "",
|
|
@@ -65,10 +66,11 @@ describe("wrangler", () => {
|
|
|
65
66
|
wrangler pubsub namespace describe <name> Describe a Pub/Sub Namespace
|
|
66
67
|
|
|
67
68
|
Flags:
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
69
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
70
|
+
-c, --config Path to .toml configuration file [string]
|
|
71
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
72
|
+
-h, --help Show help [boolean]
|
|
73
|
+
-v, --version Show version number [boolean]
|
|
72
74
|
|
|
73
75
|
👷🏽 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/",
|
|
74
76
|
"warn": "",
|
|
@@ -186,10 +188,11 @@ describe("wrangler", () => {
|
|
|
186
188
|
wrangler pubsub broker public-keys <name> Show the public keys used for verifying on-publish hooks and credentials for a Broker.
|
|
187
189
|
|
|
188
190
|
Flags:
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
191
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
192
|
+
-c, --config Path to .toml configuration file [string]
|
|
193
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
194
|
+
-h, --help Show help [boolean]
|
|
195
|
+
-v, --version Show version number [boolean]
|
|
193
196
|
|
|
194
197
|
👷🏽 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/",
|
|
195
198
|
"warn": "",
|
|
@@ -28,10 +28,11 @@ describe("wrangler", () => {
|
|
|
28
28
|
wrangler queues consumer Configure Queue Consumers
|
|
29
29
|
|
|
30
30
|
Flags:
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
31
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
32
|
+
-c, --config Path to .toml configuration file [string]
|
|
33
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
34
|
+
-h, --help Show help [boolean]
|
|
35
|
+
-v, --version Show version number [boolean]"
|
|
35
36
|
`);
|
|
36
37
|
});
|
|
37
38
|
|
|
@@ -69,10 +70,11 @@ describe("wrangler", () => {
|
|
|
69
70
|
List Queues
|
|
70
71
|
|
|
71
72
|
Flags:
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
73
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
74
|
+
-c, --config Path to .toml configuration file [string]
|
|
75
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
76
|
+
-h, --help Show help [boolean]
|
|
77
|
+
-v, --version Show version number [boolean]
|
|
76
78
|
|
|
77
79
|
Options:
|
|
78
80
|
--page Page number for pagination [number]"
|
|
@@ -162,10 +164,11 @@ describe("wrangler", () => {
|
|
|
162
164
|
name The name of the queue [string] [required]
|
|
163
165
|
|
|
164
166
|
Flags:
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
167
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
168
|
+
-c, --config Path to .toml configuration file [string]
|
|
169
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
170
|
+
-h, --help Show help [boolean]
|
|
171
|
+
-v, --version Show version number [boolean]"
|
|
169
172
|
`);
|
|
170
173
|
});
|
|
171
174
|
|
|
@@ -255,10 +258,11 @@ describe("wrangler", () => {
|
|
|
255
258
|
name The name of the queue [string] [required]
|
|
256
259
|
|
|
257
260
|
Flags:
|
|
258
|
-
-
|
|
259
|
-
-
|
|
260
|
-
-
|
|
261
|
-
-
|
|
261
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
262
|
+
-c, --config Path to .toml configuration file [string]
|
|
263
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
264
|
+
-h, --help Show help [boolean]
|
|
265
|
+
-v, --version Show version number [boolean]"
|
|
262
266
|
`);
|
|
263
267
|
});
|
|
264
268
|
|
|
@@ -288,10 +292,11 @@ describe("wrangler", () => {
|
|
|
288
292
|
wrangler queues consumer remove <queue-name> <script-name> Remove a Queue Consumer
|
|
289
293
|
|
|
290
294
|
Flags:
|
|
291
|
-
-
|
|
292
|
-
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
296
|
+
-c, --config Path to .toml configuration file [string]
|
|
297
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
298
|
+
-h, --help Show help [boolean]
|
|
299
|
+
-v, --version Show version number [boolean]"
|
|
295
300
|
`);
|
|
296
301
|
});
|
|
297
302
|
|
|
@@ -336,10 +341,11 @@ describe("wrangler", () => {
|
|
|
336
341
|
script-name Name of the consumer script [string] [required]
|
|
337
342
|
|
|
338
343
|
Flags:
|
|
339
|
-
-
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
-
|
|
344
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
345
|
+
-c, --config Path to .toml configuration file [string]
|
|
346
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
347
|
+
-h, --help Show help [boolean]
|
|
348
|
+
-v, --version Show version number [boolean]
|
|
343
349
|
|
|
344
350
|
Options:
|
|
345
351
|
--batch-size Maximum number of messages per batch [number]
|
|
@@ -482,10 +488,11 @@ describe("wrangler", () => {
|
|
|
482
488
|
script-name Name of the consumer script [string] [required]
|
|
483
489
|
|
|
484
490
|
Flags:
|
|
485
|
-
-
|
|
486
|
-
-
|
|
487
|
-
-
|
|
488
|
-
-
|
|
491
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
492
|
+
-c, --config Path to .toml configuration file [string]
|
|
493
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
494
|
+
-h, --help Show help [boolean]
|
|
495
|
+
-v, --version Show version number [boolean]"
|
|
489
496
|
`);
|
|
490
497
|
});
|
|
491
498
|
|
package/src/__tests__/r2.test.ts
CHANGED
|
@@ -39,10 +39,11 @@ describe("r2", () => {
|
|
|
39
39
|
wrangler r2 bucket delete <name> Delete an R2 bucket
|
|
40
40
|
|
|
41
41
|
Flags:
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
42
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
43
|
+
-c, --config Path to .toml configuration file [string]
|
|
44
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
45
|
+
-h, --help Show help [boolean]
|
|
46
|
+
-v, --version Show version number [boolean]"
|
|
46
47
|
`);
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -103,10 +104,11 @@ describe("r2", () => {
|
|
|
103
104
|
name The name of the new bucket [string] [required]
|
|
104
105
|
|
|
105
106
|
Flags:
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
107
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
108
|
+
-c, --config Path to .toml configuration file [string]
|
|
109
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
110
|
+
-h, --help Show help [boolean]
|
|
111
|
+
-v, --version Show version number [boolean]"
|
|
110
112
|
`);
|
|
111
113
|
expect(std.err).toMatchInlineSnapshot(`
|
|
112
114
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
|
|
@@ -131,10 +133,11 @@ describe("r2", () => {
|
|
|
131
133
|
name The name of the new bucket [string] [required]
|
|
132
134
|
|
|
133
135
|
Flags:
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
136
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
137
|
+
-c, --config Path to .toml configuration file [string]
|
|
138
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
139
|
+
-h, --help Show help [boolean]
|
|
140
|
+
-v, --version Show version number [boolean]"
|
|
138
141
|
`);
|
|
139
142
|
expect(std.err).toMatchInlineSnapshot(`
|
|
140
143
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mUnknown arguments: def, ghi[0m
|
|
@@ -180,10 +183,11 @@ describe("r2", () => {
|
|
|
180
183
|
name The name of the bucket to delete [string] [required]
|
|
181
184
|
|
|
182
185
|
Flags:
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
186
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
187
|
+
-c, --config Path to .toml configuration file [string]
|
|
188
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
189
|
+
-h, --help Show help [boolean]
|
|
190
|
+
-v, --version Show version number [boolean]"
|
|
187
191
|
`);
|
|
188
192
|
expect(std.err).toMatchInlineSnapshot(`
|
|
189
193
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
|
|
@@ -208,10 +212,11 @@ describe("r2", () => {
|
|
|
208
212
|
name The name of the bucket to delete [string] [required]
|
|
209
213
|
|
|
210
214
|
Flags:
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
-
|
|
214
|
-
-
|
|
215
|
+
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
|
|
216
|
+
-c, --config Path to .toml configuration file [string]
|
|
217
|
+
-e, --env Environment to use for operations and .env files [string]
|
|
218
|
+
-h, --help Show help [boolean]
|
|
219
|
+
-v, --version Show version number [boolean]"
|
|
215
220
|
`);
|
|
216
221
|
expect(std.err).toMatchInlineSnapshot(`
|
|
217
222
|
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mUnknown arguments: def, ghi[0m
|