create-cloudflare 2.21.6 → 2.21.8
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/dist/cli.js +730 -1758
- package/package.json +11 -11
- package/templates/common/js/package.json +1 -1
- package/templates/common/ts/package.json +2 -2
- package/templates/common/ts/src/ab-test.ts +2 -2
- package/templates/common/ts/src/index.ts +2 -2
- package/templates/common/ts/src/proxy.ts +2 -2
- package/templates/common/ts/src/redirect.ts +2 -2
- package/templates/hello-world/js/package.json +3 -3
- package/templates/hello-world/ts/package.json +4 -4
- package/templates/hello-world/ts/src/index.ts +2 -2
- package/templates/hello-world-durable-object/js/package.json +1 -1
- package/templates/hello-world-durable-object/ts/package.json +2 -2
- package/templates/hello-world-durable-object/ts/src/index.ts +2 -2
- package/templates/hello-world-python/py/package.json +1 -1
- package/templates/openapi/ts/package.json +2 -2
- package/templates/openapi/ts/src/index.ts +1 -1
- package/templates/pre-existing/js/package.json +1 -1
- package/templates/queues/js/package.json +1 -1
- package/templates/queues/ts/package.json +2 -2
- package/templates/queues/ts/src/index.ts +3 -3
- package/templates/scheduled/js/package.json +1 -1
- package/templates/scheduled/ts/package.json +2 -2
- package/templates/scheduled/ts/src/index.ts +2 -2
- /package/templates/hello-world/ts/{vitest.config.ts → vitest.config.mts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.8",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"@types/degit": "^2.8.6",
|
|
38
38
|
"@types/dns2": "^2.0.3",
|
|
39
39
|
"@types/esprima": "^4.0.3",
|
|
40
|
-
"@types/node": "
|
|
40
|
+
"@types/node": "20.8.3",
|
|
41
41
|
"@types/semver": "^7.5.1",
|
|
42
42
|
"@types/which-pm-runs": "^1.0.0",
|
|
43
43
|
"@types/yargs": "^17.0.22",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
45
|
-
"@typescript-eslint/parser": "^
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
45
|
+
"@typescript-eslint/parser": "^6.9.0",
|
|
46
46
|
"chalk": "^5.2.0",
|
|
47
47
|
"command-exists": "^1.2.9",
|
|
48
48
|
"cross-spawn": "^7.0.3",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"degit": "^2.8.4",
|
|
51
51
|
"dns2": "^2.1.0",
|
|
52
52
|
"dotenv": "^16.0.0",
|
|
53
|
-
"esbuild": "
|
|
53
|
+
"esbuild": "0.17.19",
|
|
54
54
|
"execa": "^7.1.1",
|
|
55
55
|
"glob": "^10.3.3",
|
|
56
56
|
"haikunator": "^2.1.2",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"open": "^8.4.0",
|
|
60
60
|
"recast": "^0.22.0",
|
|
61
61
|
"semver": "^7.5.1",
|
|
62
|
-
"undici": "5.28.4",
|
|
62
|
+
"undici": "^5.28.4",
|
|
63
63
|
"vite-tsconfig-paths": "^4.0.8",
|
|
64
64
|
"which-pm-runs": "^1.1.0",
|
|
65
65
|
"wrap-ansi": "^9.0.0",
|
|
66
|
-
"yargs": "^17.7.
|
|
66
|
+
"yargs": "^17.7.2",
|
|
67
67
|
"@cloudflare/cli": "1.1.1",
|
|
68
68
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
69
69
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
70
|
-
"wrangler": "3.
|
|
70
|
+
"wrangler": "3.61.0"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=18.14.1"
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"test:e2e:pnpm": "pnpm run build && cross-env TEST_PM=pnpm vitest run --config ./vitest-e2e.config.ts",
|
|
90
90
|
"test:e2e:bun": "pnpm run build && cross-env TEST_PM=bun vitest run --config ./vitest-e2e.config.ts",
|
|
91
91
|
"test:e2e:yarn": "pnpm run build && cross-env TEST_PM=yarn vitest run --config ./vitest-e2e.config.ts",
|
|
92
|
-
"test:unit": "vitest run --config ./vitest.config.
|
|
93
|
-
"test:unit:watch": "vitest --config ./vitest.config.
|
|
92
|
+
"test:unit": "vitest run --config ./vitest.config.mts",
|
|
93
|
+
"test:unit:watch": "vitest --config ./vitest.config.mts",
|
|
94
94
|
"watch": "node -r esbuild-register scripts/build.ts --watch",
|
|
95
|
-
"test:ci": "vitest run --config ./vitest.config.
|
|
95
|
+
"test:ci": "vitest run --config ./vitest.config.mts"
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -6,7 +6,7 @@ const EXPERIMENTS = [
|
|
|
6
6
|
];
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
async fetch(request
|
|
9
|
+
async fetch(request, env, ctx): Promise<Response> {
|
|
10
10
|
const fingerprint = [request.headers.get('cf-connecting-ip'), request.cf?.postalCode]; // add any values you want considered as a fingerprint
|
|
11
11
|
const activeExperiments = await getActiveExperiments(fingerprint, EXPERIMENTS);
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
|
|
23
23
|
return rewriter.transform(res);
|
|
24
24
|
},
|
|
25
|
-
}
|
|
25
|
+
} satisfies ExportedHandler<Env>;
|
|
26
26
|
|
|
27
27
|
// Get active experiments by hashing a fingerprint
|
|
28
28
|
async function getActiveExperiments(fingerprint: unknown, experiments: Array<{ name: string; threshold: number }>) {
|
|
@@ -19,7 +19,7 @@ import apiRouter from './router';
|
|
|
19
19
|
export default {
|
|
20
20
|
// The fetch handler is invoked when this worker receives a HTTP(S) request
|
|
21
21
|
// and should return a Response (optionally wrapped in a Promise)
|
|
22
|
-
async fetch(request
|
|
22
|
+
async fetch(request, env, ctx): Promise<Response> {
|
|
23
23
|
// You'll find it helpful to parse the request.url string into a URL object. Learn more at https://developer.mozilla.org/en-US/docs/Web/API/URL
|
|
24
24
|
const url = new URL(request.url);
|
|
25
25
|
|
|
@@ -46,4 +46,4 @@ export default {
|
|
|
46
46
|
{ headers: { 'Content-Type': 'text/html' } }
|
|
47
47
|
);
|
|
48
48
|
},
|
|
49
|
-
}
|
|
49
|
+
} satisfies ExportedHandler<Env>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
async fetch(request
|
|
2
|
+
async fetch(request, env, ctx): Promise<Response> {
|
|
3
3
|
const url = new URL(request.url);
|
|
4
4
|
|
|
5
5
|
const proxyUrl = url.searchParams.get('proxyUrl'); // get a query param value (?proxyUrl=...)
|
|
@@ -20,4 +20,4 @@ export default {
|
|
|
20
20
|
|
|
21
21
|
return res;
|
|
22
22
|
},
|
|
23
|
-
}
|
|
23
|
+
} satisfies ExportedHandler<Env>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
async fetch(request
|
|
2
|
+
async fetch(request, env, ctx): Promise<Response> {
|
|
3
3
|
const url = new URL(request.url);
|
|
4
4
|
const redirectUrl = url.searchParams.get('redirectUrl'); // get a query param value (?redirectUrl=...)
|
|
5
5
|
|
|
@@ -10,4 +10,4 @@ export default {
|
|
|
10
10
|
// The Response class has static methods to create common Response objects as a convenience
|
|
11
11
|
return Response.redirect(redirectUrl);
|
|
12
12
|
},
|
|
13
|
-
}
|
|
13
|
+
} satisfies ExportedHandler<Env>;
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"cf-typegen": "wrangler types"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"vitest": "1.
|
|
16
|
-
"
|
|
13
|
+
"@cloudflare/vitest-pool-workers": "^0.4.5",
|
|
14
|
+
"typescript": "^5.4.5",
|
|
15
|
+
"vitest": "1.5.0",
|
|
16
|
+
"wrangler": "^3.60.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
|
-
async fetch(request
|
|
15
|
+
async fetch(request, env, ctx): Promise<Response> {
|
|
16
16
|
return new Response('Hello World!');
|
|
17
17
|
},
|
|
18
|
-
}
|
|
18
|
+
} satisfies ExportedHandler<Env>;
|
|
@@ -68,7 +68,7 @@ export default {
|
|
|
68
68
|
* @param ctx - The execution context of the Worker
|
|
69
69
|
* @returns The response to be sent back to the client
|
|
70
70
|
*/
|
|
71
|
-
async fetch(request
|
|
71
|
+
async fetch(request, env, ctx): Promise<Response> {
|
|
72
72
|
// We will create a `DurableObjectId` using the pathname from the Worker request
|
|
73
73
|
// This id refers to a unique instance of our 'MyDurableObject' class above
|
|
74
74
|
let id: DurableObjectId = env.MY_DURABLE_OBJECT.idFromName(new URL(request.url).pathname);
|
|
@@ -83,4 +83,4 @@ export default {
|
|
|
83
83
|
|
|
84
84
|
return new Response(greeting);
|
|
85
85
|
},
|
|
86
|
-
}
|
|
86
|
+
} satisfies ExportedHandler<Env>;
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
// Our fetch handler is invoked on a HTTP request: we can send a message to a queue
|
|
19
19
|
// during (or after) a request.
|
|
20
20
|
// https://developers.cloudflare.com/queues/platform/javascript-apis/#producer
|
|
21
|
-
async fetch(req
|
|
21
|
+
async fetch(req, env, ctx): Promise<Response> {
|
|
22
22
|
// To send a message on a queue, we need to create the queue first
|
|
23
23
|
// https://developers.cloudflare.com/queues/get-started/#3-create-a-queue
|
|
24
24
|
await env.MY_QUEUE.send({
|
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
},
|
|
31
31
|
// The queue handler is invoked when a batch of messages is ready to be delivered
|
|
32
32
|
// https://developers.cloudflare.com/queues/platform/javascript-apis/#messagebatch
|
|
33
|
-
async queue(batch
|
|
33
|
+
async queue(batch, env): Promise<void> {
|
|
34
34
|
// A queue consumer can make requests to other endpoints on the Internet,
|
|
35
35
|
// write to R2 object storage, query a D1 Database, and much more.
|
|
36
36
|
for (let message of batch.messages) {
|
|
@@ -38,4 +38,4 @@ export default {
|
|
|
38
38
|
console.log(`message ${message.id} processed: ${JSON.stringify(message.body)}`);
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
}
|
|
41
|
+
} satisfies ExportedHandler<Env, Error>;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
export default {
|
|
19
19
|
// The scheduled handler is invoked at the interval set in our wrangler.toml's
|
|
20
20
|
// [[triggers]] configuration.
|
|
21
|
-
async scheduled(event
|
|
21
|
+
async scheduled(event, env, ctx): Promise<void> {
|
|
22
22
|
// A Cron Trigger can make requests to other endpoints on the Internet,
|
|
23
23
|
// publish to a Queue, query a D1 Database, and much more.
|
|
24
24
|
//
|
|
@@ -30,4 +30,4 @@ export default {
|
|
|
30
30
|
// In this template, we'll just log the result:
|
|
31
31
|
console.log(`trigger fired at ${event.cron}: ${wasSuccessful}`);
|
|
32
32
|
},
|
|
33
|
-
}
|
|
33
|
+
} satisfies ExportedHandler<Env>;
|
|
File without changes
|