create-cloudflare 0.0.0-9fb39e63 → 0.0.0-9fd7eba3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/cli.js +25965 -24706
  2. package/package.json +6 -6
  3. package/templates/angular/c3.ts +12 -12
  4. package/templates/astro/c3.ts +80 -18
  5. package/templates/astro/snippets/runtimeDeclaration.ts +4 -0
  6. package/templates/astro/templates/wrangler.toml +52 -0
  7. package/templates/common/c3.ts +7 -6
  8. package/templates/common/js/.editorconfig +0 -1
  9. package/templates/common/js/wrangler.toml +68 -22
  10. package/templates/common/ts/.editorconfig +0 -1
  11. package/templates/common/ts/wrangler.toml +68 -22
  12. package/templates/docusaurus/c3.ts +5 -6
  13. package/templates/gatsby/c3.ts +7 -5
  14. package/templates/hello-world/c3.ts +7 -6
  15. package/templates/hello-world/js/.editorconfig +0 -1
  16. package/templates/hello-world/js/package.json +3 -1
  17. package/templates/hello-world/js/test/index.spec.js +20 -0
  18. package/templates/hello-world/js/vitest.config.js +11 -0
  19. package/templates/hello-world/js/wrangler.toml +69 -22
  20. package/templates/hello-world/ts/.editorconfig +0 -1
  21. package/templates/hello-world/ts/package.json +5 -2
  22. package/templates/hello-world/ts/test/index.spec.ts +25 -0
  23. package/templates/hello-world/ts/test/tsconfig.json +11 -0
  24. package/templates/hello-world/ts/tsconfig.json +3 -2
  25. package/templates/hello-world/ts/vitest.config.ts +11 -0
  26. package/templates/hello-world/ts/wrangler.toml +69 -22
  27. package/templates/hello-world-durable-object/c3.ts +7 -6
  28. package/templates/hello-world-durable-object/js/.editorconfig +0 -1
  29. package/templates/hello-world-durable-object/js/wrangler.toml +69 -23
  30. package/templates/hello-world-durable-object/ts/.editorconfig +0 -1
  31. package/templates/hello-world-durable-object/ts/wrangler.toml +68 -21
  32. package/templates/hono/c3.ts +3 -3
  33. package/templates/next/README.md +68 -0
  34. package/templates/next/app/js/app/api/hello/route.js +21 -0
  35. package/templates/next/app/js/app/not-found.js +58 -0
  36. package/templates/next/app/ts/app/api/hello/route.ts +22 -0
  37. package/templates/next/app/ts/app/not-found.tsx +58 -0
  38. package/templates/next/c3.ts +83 -74
  39. package/templates/next/env.d.ts +5 -0
  40. package/templates/next/pages/js/pages/api/hello.js +23 -0
  41. package/templates/next/pages/ts/pages/api/hello.ts +24 -0
  42. package/templates/next/wrangler.toml +58 -0
  43. package/templates/nuxt/c3.ts +93 -18
  44. package/templates/nuxt/templates/env.d.ts +14 -0
  45. package/templates/nuxt/templates/worker-configuration.d.ts +4 -0
  46. package/templates/nuxt/templates/wrangler.toml +52 -0
  47. package/templates/openapi/c3.ts +0 -1
  48. package/templates/pre-existing/c3.ts +4 -6
  49. package/templates/pre-existing/js/.editorconfig +0 -1
  50. package/templates/queues/c3.ts +7 -6
  51. package/templates/queues/js/.editorconfig +0 -1
  52. package/templates/queues/js/wrangler.toml +85 -2
  53. package/templates/queues/ts/.editorconfig +0 -1
  54. package/templates/queues/ts/wrangler.toml +85 -2
  55. package/templates/qwik/c3.ts +117 -7
  56. package/templates/qwik/snippets/getPlatformProxy.ts +6 -0
  57. package/templates/qwik/templates/worker-configuration.d.ts +4 -0
  58. package/templates/qwik/templates/wrangler.toml +52 -0
  59. package/templates/react/c3.ts +7 -5
  60. package/templates/remix/c3.ts +40 -7
  61. package/templates/remix/templates/worker-configuration.d.ts +4 -0
  62. package/templates/remix/templates/wrangler.toml +52 -0
  63. package/templates/scheduled/c3.ts +7 -6
  64. package/templates/scheduled/js/.editorconfig +0 -1
  65. package/templates/scheduled/js/wrangler.toml +94 -0
  66. package/templates/scheduled/ts/.editorconfig +0 -1
  67. package/templates/scheduled/ts/wrangler.toml +94 -0
  68. package/templates/solid/c3.ts +53 -19
  69. package/templates/svelte/c3.ts +84 -29
  70. package/templates/svelte/js/wrangler.toml +52 -0
  71. package/templates/svelte/ts/wrangler.toml +52 -0
  72. package/templates/vue/c3.ts +7 -6
  73. package/templates/chatgptPlugin/c3.ts +0 -10
  74. package/templates/chatgptPlugin/ts/.assets/example.png +0 -0
  75. package/templates/chatgptPlugin/ts/README.md +0 -25
  76. package/templates/chatgptPlugin/ts/__dot__gitignore +0 -171
  77. package/templates/chatgptPlugin/ts/package.json +0 -16
  78. package/templates/chatgptPlugin/ts/src/index.ts +0 -33
  79. package/templates/chatgptPlugin/ts/src/search.ts +0 -59
  80. package/templates/chatgptPlugin/ts/wrangler.toml +0 -3
  81. package/templates/next/templates.ts +0 -281
  82. package/templates/solid/js/vite.config.js +0 -7
  83. package/templates/solid/ts/vite.config.ts +0 -7
  84. package/templates/svelte/templates.ts +0 -13
@@ -0,0 +1,58 @@
1
+ name = "<TBD>"
2
+ compatibility_date = "<TBD>"
3
+ compatibility_flags = ["nodejs_compat"]
4
+
5
+ # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
6
+ # Note: Use secrets to store sensitive data.
7
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
8
+ # [vars]
9
+ # MY_VARIABLE = "production_value"
10
+
11
+ # Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
12
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
13
+ # [ai]
14
+ # binding = "AI"
15
+
16
+ # Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
17
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
18
+ # [[d1_databases]]
19
+ # binding = "MY_DB"
20
+ # database_name = "my-database"
21
+ # database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
22
+
23
+ # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
24
+ # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
25
+ # Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
26
+ # [[durable_objects.bindings]]
27
+ # name = "MY_DURABLE_OBJECT"
28
+ # class_name = "MyDurableObject"
29
+ # script_name = 'my-durable-object'
30
+
31
+ # Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
32
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
33
+ # [[kv_namespaces]]
34
+ # binding = "MY_KV_NAMESPACE"
35
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
36
+
37
+ # Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
38
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
39
+ # [[queues.producers]]
40
+ # binding = "MY_QUEUE"
41
+ # queue = "my-queue"
42
+
43
+ # Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
44
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
45
+ # [[r2_buckets]]
46
+ # binding = "MY_BUCKET"
47
+ # bucket_name = "my-bucket"
48
+
49
+ # Bind another Worker service. Use this binding to call another Worker without network overhead.
50
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
51
+ # [[services]]
52
+ # binding = "MY_SERVICE"
53
+ # service = "my-service"
54
+
55
+ # KV Example:
56
+ # [[kv_namespaces]]
57
+ # binding = "MY_KV"
58
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
@@ -1,15 +1,17 @@
1
- import { readFileSync } from "node:fs";
2
- import { resolve } from "node:path";
3
1
  import { logRaw } from "@cloudflare/cli";
4
2
  import { brandColor, dim } from "@cloudflare/cli/colors";
5
3
  import { spinner } from "@cloudflare/cli/interactive";
6
- import { runFrameworkGenerator } from "helpers/command";
7
- import { compatDateFlag, writeFile } from "helpers/files";
8
- import { detectPackageManager } from "helpers/packages";
4
+ import { runFrameworkGenerator } from "frameworks/index";
5
+ import { transformFile } from "helpers/codemod";
6
+ import { getLatestTypesEntrypoint } from "helpers/compatDate";
7
+ import { readFile, writeFile } from "helpers/files";
8
+ import { detectPackageManager } from "helpers/packageManagers";
9
+ import { installPackages } from "helpers/packages";
10
+ import * as recast from "recast";
9
11
  import type { TemplateConfig } from "../../src/templates";
10
12
  import type { C3Context } from "types";
11
13
 
12
- const { npm } = detectPackageManager();
14
+ const { npm, name: pm } = detectPackageManager();
13
15
 
14
16
  const generate = async (ctx: C3Context) => {
15
17
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
@@ -28,18 +30,84 @@ const generate = async (ctx: C3Context) => {
28
30
  };
29
31
 
30
32
  const configure = async (ctx: C3Context) => {
31
- const configFileName = "nuxt.config.ts";
32
- const configFilePath = resolve(configFileName);
33
+ const packages = ["nitro-cloudflare-dev"];
34
+
35
+ // When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
36
+ // Package managers other than pnpm will hoist the dependency, as will pnpm with `--shamefully-hoist`
37
+ if (pm === "pnpm") {
38
+ packages.push("h3");
39
+ }
40
+
41
+ await installPackages(packages, {
42
+ dev: true,
43
+ startText: "Installing nitro module `nitro-cloudflare-dev`",
44
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
45
+ });
46
+ updateNuxtConfig();
47
+
48
+ updateEnvTypes(ctx);
49
+ };
50
+
51
+ const updateEnvTypes = (ctx: C3Context) => {
52
+ const filepath = "env.d.ts";
53
+
33
54
  const s = spinner();
34
- s.start(`Updating \`${configFileName}\``);
35
- // Add the cloudflare preset into the configuration file.
36
- const originalConfigFile = readFileSync(configFilePath, "utf8");
37
- const updatedConfigFile = originalConfigFile.replace(
38
- "defineNuxtConfig({",
39
- "defineNuxtConfig({\n nitro: {\n preset: 'cloudflare-pages'\n },"
55
+ s.start(`Updating ${filepath}`);
56
+
57
+ let file = readFile(filepath);
58
+
59
+ let typesEntrypoint = `@cloudflare/workers-types/`;
60
+ const latestEntrypoint = getLatestTypesEntrypoint(ctx);
61
+ if (latestEntrypoint) {
62
+ typesEntrypoint += `/${latestEntrypoint}`;
63
+ }
64
+
65
+ // Replace placeholder with actual types entrypoint
66
+ file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
67
+ writeFile("env.d.ts", file);
68
+
69
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
70
+ };
71
+
72
+ const updateNuxtConfig = () => {
73
+ const s = spinner();
74
+
75
+ const configFile = "nuxt.config.ts";
76
+ s.start(`Updating \`${configFile}\``);
77
+
78
+ const b = recast.types.builders;
79
+
80
+ const presetDef = b.objectProperty(
81
+ b.identifier("nitro"),
82
+ b.objectExpression([
83
+ b.objectProperty(
84
+ b.identifier("preset"),
85
+ b.stringLiteral("cloudflare-pages")
86
+ ),
87
+ ])
88
+ );
89
+
90
+ const moduleDef = b.objectProperty(
91
+ b.identifier("modules"),
92
+ b.arrayExpression([b.stringLiteral("nitro-cloudflare-dev")])
40
93
  );
41
- writeFile(configFilePath, updatedConfigFile);
42
- s.stop(`${brandColor(`updated`)} ${dim(`\`${configFileName}\``)}`);
94
+
95
+ transformFile(configFile, {
96
+ visitCallExpression: function (n) {
97
+ const callee = n.node.callee as recast.types.namedTypes.Identifier;
98
+ if (callee.name === "defineNuxtConfig") {
99
+ const obj = n.node
100
+ .arguments[0] as recast.types.namedTypes.ObjectExpression;
101
+
102
+ obj.properties.push(presetDef);
103
+ obj.properties.push(moduleDef);
104
+ }
105
+
106
+ return this.traverse(n);
107
+ },
108
+ });
109
+
110
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
43
111
  };
44
112
 
45
113
  const config: TemplateConfig = {
@@ -47,13 +115,20 @@ const config: TemplateConfig = {
47
115
  id: "nuxt",
48
116
  platform: "pages",
49
117
  displayName: "Nuxt",
118
+ copyFiles: {
119
+ path: "./templates",
120
+ },
50
121
  generate,
51
122
  configure,
52
123
  transformPackageJson: async () => ({
53
124
  scripts: {
54
- "pages:dev": `wrangler pages dev ${await compatDateFlag()} --proxy 3000 -- ${npm} run dev`,
55
- "pages:deploy": `${npm} run build && wrangler pages deploy ./dist`,
125
+ deploy: `${npm} run build && wrangler pages deploy ./dist`,
126
+ preview: `${npm} run build && wrangler pages dev ./dist`,
127
+ "build-cf-types": `wrangler types`,
56
128
  },
57
129
  }),
130
+ devScript: "dev",
131
+ deployScript: "deploy",
132
+ previewScript: "preview",
58
133
  };
59
134
  export default config;
@@ -0,0 +1,14 @@
1
+ /// <reference types="WORKERS_TYPES_ENTRYPOINT" />
2
+
3
+ declare module "h3" {
4
+ interface H3EventContext {
5
+ cf: CfProperties;
6
+ cloudflare: {
7
+ request: Request;
8
+ env: Env;
9
+ context: ExecutionContext;
10
+ };
11
+ }
12
+ }
13
+
14
+ export {};
@@ -0,0 +1,4 @@
1
+ // Generated by Wrangler
2
+ // After adding bindings to `wrangler.toml`, regenerate this interface via `npm build-cf-types`
3
+ interface Env {
4
+ }
@@ -0,0 +1,52 @@
1
+ name = "<TBD>"
2
+ compatibility_date = "<TBD>"
3
+
4
+ # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
5
+ # Note: Use secrets to store sensitive data.
6
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
7
+ # [vars]
8
+ # MY_VARIABLE = "production_value"
9
+
10
+ # Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
11
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
12
+ # [ai]
13
+ # binding = "AI"
14
+
15
+ # Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
16
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
17
+ # [[d1_databases]]
18
+ # binding = "MY_DB"
19
+ # database_name = "my-database"
20
+ # database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
21
+
22
+ # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
23
+ # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
24
+ # Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
25
+ # [[durable_objects.bindings]]
26
+ # name = "MY_DURABLE_OBJECT"
27
+ # class_name = "MyDurableObject"
28
+ # script_name = 'my-durable-object'
29
+
30
+ # Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
31
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
32
+ # [[kv_namespaces]]
33
+ # binding = "MY_KV_NAMESPACE"
34
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
35
+
36
+ # Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
37
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
38
+ # [[queues.producers]]
39
+ # binding = "MY_QUEUE"
40
+ # queue = "my-queue"
41
+
42
+ # Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
43
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
44
+ # [[r2_buckets]]
45
+ # binding = "MY_BUCKET"
46
+ # bucket_name = "my-bucket"
47
+
48
+ # Bind another Worker service. Use this binding to call another Worker without network overhead.
49
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
50
+ # [[services]]
51
+ # binding = "MY_SERVICE"
52
+ # service = "my-service"
@@ -3,7 +3,6 @@ export default {
3
3
  id: "openapi",
4
4
  displayName: "API starter (OpenAPI compliant)",
5
5
  platform: "workers",
6
- languages: ["ts"],
7
6
  copyFiles: {
8
7
  path: "./ts",
9
8
  },
@@ -1,16 +1,15 @@
1
- import { cp, mkdtemp, readdir, rm } from "fs/promises";
1
+ import { cp, mkdtemp } from "fs/promises";
2
2
  import { tmpdir } from "os";
3
3
  import { join } from "path";
4
- import { crash } from "@cloudflare/cli";
5
4
  import { processArgument } from "@cloudflare/cli/args";
6
5
  import { brandColor, dim } from "@cloudflare/cli/colors";
7
6
  import { runCommand } from "helpers/command";
8
- import { detectPackageManager } from "helpers/packages";
9
- import { chooseAccount } from "../../src/common";
7
+ import { detectPackageManager } from "helpers/packageManagers";
8
+ import { chooseAccount } from "../../src/wrangler/accounts";
10
9
  import type { C3Context } from "types";
11
10
 
12
11
  export async function copyExistingWorkerFiles(ctx: C3Context) {
13
- const { dlx, npm } = detectPackageManager();
12
+ const { dlx } = detectPackageManager();
14
13
 
15
14
  await chooseAccount(ctx);
16
15
 
@@ -72,7 +71,6 @@ export default {
72
71
  displayName: "Pre-existing Worker (from Dashboard)",
73
72
  platform: "workers",
74
73
  hidden: true,
75
- languages: ["js"],
76
74
  copyFiles: {
77
75
  path: "./js",
78
76
  },
@@ -3,7 +3,6 @@ root = true
3
3
 
4
4
  [*]
5
5
  indent_style = tab
6
- tab_width = 2
7
6
  end_of_line = lf
8
7
  charset = utf-8
9
8
  trim_trailing_whitespace = true
@@ -3,13 +3,14 @@ export default {
3
3
  id: "queues",
4
4
  displayName: "Queue consumer & producer Worker",
5
5
  platform: "workers",
6
- languages: ["js", "ts"],
7
6
  copyFiles: {
8
- js: {
9
- path: "./js",
10
- },
11
- ts: {
12
- path: "./ts",
7
+ variants: {
8
+ js: {
9
+ path: "./js",
10
+ },
11
+ ts: {
12
+ path: "./ts",
13
+ },
13
14
  },
14
15
  },
15
16
  bindings: {
@@ -3,7 +3,6 @@ root = true
3
3
 
4
4
  [*]
5
5
  indent_style = tab
6
- tab_width = 2
7
6
  end_of_line = lf
8
7
  charset = utf-8
9
8
  trim_trailing_whitespace = true
@@ -2,14 +2,79 @@ name = "<TBD>"
2
2
  main = "src/index.js"
3
3
  compatibility_date = "<TBD>"
4
4
 
5
+ # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
6
+ # Note: Use secrets to store sensitive data.
7
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
8
+ # [vars]
9
+ # MY_VARIABLE = "production_value"
10
+
11
+ # Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
12
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
13
+ # [ai]
14
+ # binding = "AI"
15
+
16
+ # Bind an Analytics Engine dataset. Use Analytics Engine to write analytics within your Pages Function.
17
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
18
+ # [[analytics_engine_datasets]]
19
+ # binding = "MY_DATASET"
20
+
21
+ # Bind a headless browser instance running on Cloudflare's global network.
22
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
23
+ # [browser]
24
+ # binding = "MY_BROWSER"
25
+
26
+ # Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
27
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
28
+ # [[d1_databases]]
29
+ # binding = "MY_DB"
30
+ # database_name = "my-database"
31
+ # database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
32
+
33
+ # Bind a dispatch namespace. Use Workers for Platforms to deploy serverless functions programmatically on behalf of your customers.
34
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
35
+ # [[dispatch_namespaces]]
36
+ # binding = "MY_DISPATCHER"
37
+ # namespace = "my-namespace"
38
+
39
+ # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
40
+ # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
41
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
42
+ # [[durable_objects.bindings]]
43
+ # name = "MY_DURABLE_OBJECT"
44
+ # class_name = "MyDurableObject"
45
+
46
+ # Durable Object migrations.
47
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
48
+ # [[migrations]]
49
+ # tag = "v1"
50
+ # new_classes = ["MyDurableObject"]
51
+
52
+ # Bind a Hyperdrive configuration. Use to accelerate access to your existing databases from Cloudflare Workers.
53
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
54
+ # [[hyperdrive]]
55
+ # binding = "MY_HYPERDRIVE"
56
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
57
+
58
+ # Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
59
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
60
+ # [[kv_namespaces]]
61
+ # binding = "MY_KV_NAMESPACE"
62
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
63
+
64
+ # Bind an mTLS certificate. Use to present a client certificate when communicating with another service.
65
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
66
+ # [[mtls_certificates]]
67
+ # binding = "MY_CERTIFICATE"
68
+ # certificate_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
69
+
5
70
  # Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
6
- # Docs: https://developers.cloudflare.com/queues/get-started
71
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
7
72
  [[queues.producers]]
8
73
  binding = "MY_QUEUE"
9
74
  queue = "my-queue"
10
75
 
11
76
  # Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
12
- # Docs: https://developers.cloudflare.com/queues/get-started
77
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
13
78
  [[queues.consumers]]
14
79
  queue = "my-queue"
15
80
  # Optional: Configure batching and retries: https://developers.cloudflare.com/queues/learning/batching-retries/
@@ -17,3 +82,21 @@ queue = "my-queue"
17
82
  # max_batch_timeout = 30
18
83
  # max_retries = 10
19
84
  # dead_letter_queue = "my-queue-dlq"
85
+
86
+ # Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
87
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
88
+ # [[r2_buckets]]
89
+ # binding = "MY_BUCKET"
90
+ # bucket_name = "my-bucket"
91
+
92
+ # Bind another Worker service. Use this binding to call another Worker without network overhead.
93
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
94
+ # [[services]]
95
+ # binding = "MY_SERVICE"
96
+ # service = "my-service"
97
+
98
+ # Bind a Vectorize index. Use to store and query vector embeddings for semantic search, classification and other vector search use-cases.
99
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
100
+ # [[vectorize]]
101
+ # binding = "MY_INDEX"
102
+ # index_name = "my-index"
@@ -3,7 +3,6 @@ root = true
3
3
 
4
4
  [*]
5
5
  indent_style = tab
6
- tab_width = 2
7
6
  end_of_line = lf
8
7
  charset = utf-8
9
8
  trim_trailing_whitespace = true
@@ -2,14 +2,79 @@ name = "<TBD>"
2
2
  main = "src/index.ts"
3
3
  compatibility_date = "<TBD>"
4
4
 
5
+ # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
6
+ # Note: Use secrets to store sensitive data.
7
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
8
+ # [vars]
9
+ # MY_VARIABLE = "production_value"
10
+
11
+ # Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
12
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
13
+ # [ai]
14
+ # binding = "AI"
15
+
16
+ # Bind an Analytics Engine dataset. Use Analytics Engine to write analytics within your Pages Function.
17
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
18
+ # [[analytics_engine_datasets]]
19
+ # binding = "MY_DATASET"
20
+
21
+ # Bind a headless browser instance running on Cloudflare's global network.
22
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
23
+ # [browser]
24
+ # binding = "MY_BROWSER"
25
+
26
+ # Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
27
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
28
+ # [[d1_databases]]
29
+ # binding = "MY_DB"
30
+ # database_name = "my-database"
31
+ # database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
32
+
33
+ # Bind a dispatch namespace. Use Workers for Platforms to deploy serverless functions programmatically on behalf of your customers.
34
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
35
+ # [[dispatch_namespaces]]
36
+ # binding = "MY_DISPATCHER"
37
+ # namespace = "my-namespace"
38
+
39
+ # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
40
+ # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
41
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
42
+ # [[durable_objects.bindings]]
43
+ # name = "MY_DURABLE_OBJECT"
44
+ # class_name = "MyDurableObject"
45
+
46
+ # Durable Object migrations.
47
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
48
+ # [[migrations]]
49
+ # tag = "v1"
50
+ # new_classes = ["MyDurableObject"]
51
+
52
+ # Bind a Hyperdrive configuration. Use to accelerate access to your existing databases from Cloudflare Workers.
53
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
54
+ # [[hyperdrive]]
55
+ # binding = "MY_HYPERDRIVE"
56
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
57
+
58
+ # Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
59
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
60
+ # [[kv_namespaces]]
61
+ # binding = "MY_KV_NAMESPACE"
62
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
63
+
64
+ # Bind an mTLS certificate. Use to present a client certificate when communicating with another service.
65
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
66
+ # [[mtls_certificates]]
67
+ # binding = "MY_CERTIFICATE"
68
+ # certificate_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
69
+
5
70
  # Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
6
- # Docs: https://developers.cloudflare.com/queues/get-started
71
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
7
72
  [[queues.producers]]
8
73
  binding = "MY_QUEUE"
9
74
  queue = "my-queue"
10
75
 
11
76
  # Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
12
- # Docs: https://developers.cloudflare.com/queues/get-started
77
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
13
78
  [[queues.consumers]]
14
79
  queue = "my-queue"
15
80
  # Optional: Configure batching and retries: https://developers.cloudflare.com/queues/learning/batching-retries/
@@ -17,3 +82,21 @@ queue = "my-queue"
17
82
  # max_batch_timeout = 30
18
83
  # max_retries = 10
19
84
  # dead_letter_queue = "my-queue-dlq"
85
+
86
+ # Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
87
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
88
+ # [[r2_buckets]]
89
+ # binding = "MY_BUCKET"
90
+ # bucket_name = "my-bucket"
91
+
92
+ # Bind another Worker service. Use this binding to call another Worker without network overhead.
93
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
94
+ # [[services]]
95
+ # binding = "MY_SERVICE"
96
+ # service = "my-service"
97
+
98
+ # Bind a Vectorize index. Use to store and query vector embeddings for semantic search, classification and other vector search use-cases.
99
+ # Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
100
+ # [[vectorize]]
101
+ # binding = "MY_INDEX"
102
+ # index_name = "my-index"