wrangler 2.0.6 → 2.0.9
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/README.md +1 -1
- package/bin/wrangler.js +16 -4
- package/package.json +6 -4
- package/pages/functions/buildPlugin.ts +13 -0
- package/pages/functions/buildWorker.ts +13 -0
- package/src/__tests__/configuration.test.ts +132 -60
- package/src/__tests__/dev.test.tsx +168 -67
- package/src/__tests__/helpers/mock-dialogs.ts +41 -1
- package/src/__tests__/index.test.ts +25 -10
- package/src/__tests__/init.test.ts +252 -131
- package/src/__tests__/kv.test.ts +16 -16
- package/src/__tests__/package-manager.test.ts +154 -7
- package/src/__tests__/pages.test.ts +442 -38
- package/src/__tests__/parse.test.ts +5 -1
- package/src/__tests__/publish.test.ts +377 -84
- package/src/__tests__/secret.test.ts +4 -4
- package/src/__tests__/whoami.test.tsx +34 -0
- package/src/abort.d.ts +3 -0
- package/src/cfetch/index.ts +21 -4
- package/src/cfetch/internal.ts +20 -18
- package/src/config/config.ts +1 -1
- package/src/config/index.ts +162 -0
- package/src/config/validation.ts +77 -29
- package/src/create-worker-preview.ts +32 -22
- package/src/dev/dev.tsx +6 -16
- package/src/dev/remote.tsx +40 -16
- package/src/dialogs.tsx +48 -0
- package/src/durable.ts +102 -0
- package/src/index.tsx +291 -207
- package/src/inspect.ts +39 -0
- package/src/kv.ts +74 -25
- package/src/open-in-browser.ts +5 -12
- package/src/package-manager.ts +50 -3
- package/src/pages.tsx +218 -61
- package/src/parse.ts +21 -4
- package/src/proxy.ts +38 -22
- package/src/publish.ts +166 -108
- package/src/sites.tsx +8 -8
- package/src/user.tsx +12 -1
- package/src/whoami.tsx +3 -2
- package/src/worker.ts +2 -1
- package/src/zones.ts +73 -0
- package/templates/new-worker-scheduled.js +17 -0
- package/templates/new-worker-scheduled.ts +32 -0
- package/templates/new-worker.ts +16 -1
- package/wrangler-dist/cli.js +33066 -20052
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Welcome to Cloudflare Workers! This is your first scheduled worker.
|
|
3
|
+
*
|
|
4
|
+
* - Run `wrangler dev --local` in your terminal to start a development server
|
|
5
|
+
* - Run `curl "http://localhost:8787/cdn-cgi/mf/scheduled"` to trigger the scheduled event
|
|
6
|
+
* - Go back to the console to see what your worker has logged
|
|
7
|
+
* - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers)
|
|
8
|
+
* - Run `wrangler publish --name my-worker` to publish your worker
|
|
9
|
+
*
|
|
10
|
+
* Learn more at https://developers.cloudflare.com/workers/runtime-apis/scheduled-event/
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export interface Env {
|
|
14
|
+
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
|
|
15
|
+
// MY_KV_NAMESPACE: KVNamespace;
|
|
16
|
+
//
|
|
17
|
+
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
|
|
18
|
+
// MY_DURABLE_OBJECT: DurableObjectNamespace;
|
|
19
|
+
//
|
|
20
|
+
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
|
|
21
|
+
// MY_BUCKET: R2Bucket;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
async scheduled(
|
|
26
|
+
controller: ScheduledController,
|
|
27
|
+
env: Env,
|
|
28
|
+
ctx: ExecutionContext
|
|
29
|
+
): Promise<void> {
|
|
30
|
+
console.log(`Hello World!`);
|
|
31
|
+
},
|
|
32
|
+
};
|
package/templates/new-worker.ts
CHANGED
|
@@ -8,8 +8,23 @@
|
|
|
8
8
|
* Learn more at https://developers.cloudflare.com/workers/
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
export interface Env {
|
|
12
|
+
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
|
|
13
|
+
// MY_KV_NAMESPACE: KVNamespace;
|
|
14
|
+
//
|
|
15
|
+
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
|
|
16
|
+
// MY_DURABLE_OBJECT: DurableObjectNamespace;
|
|
17
|
+
//
|
|
18
|
+
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
|
|
19
|
+
// MY_BUCKET: R2Bucket;
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
export default {
|
|
12
|
-
async fetch(
|
|
23
|
+
async fetch(
|
|
24
|
+
request: Request,
|
|
25
|
+
env: Env,
|
|
26
|
+
ctx: ExecutionContext
|
|
27
|
+
): Promise<Response> {
|
|
13
28
|
return new Response("Hello World!");
|
|
14
29
|
},
|
|
15
30
|
};
|