create-cloudflare 0.0.0-ecef68635 → 0.0.0-ed3bc2f3b

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 (180) hide show
  1. package/dist/cli.js +7669 -9338
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +13 -8
  4. package/templates/analog/templates/worker-configuration.d.ts +1 -1
  5. package/templates/analog/templates/wrangler.jsonc +5 -0
  6. package/templates/angular/c3.ts +25 -13
  7. package/templates/angular/templates/src/server.ts +15 -0
  8. package/templates/angular/templates/tools/copy-files.mjs +8 -2
  9. package/templates/astro/c3.ts +17 -33
  10. package/templates/astro/templates/js/wrangler.jsonc +8 -0
  11. package/templates/astro/templates/ts/worker-configuration.d.ts +4 -0
  12. package/templates/astro/templates/ts/wrangler.jsonc +8 -0
  13. package/templates/common/js/package.json +1 -1
  14. package/templates/common/js/wrangler.jsonc +8 -0
  15. package/templates/common/ts/package.json +1 -1
  16. package/templates/common/ts/src/index.ts +1 -1
  17. package/templates/common/ts/tsconfig.json +37 -95
  18. package/templates/common/ts/worker-configuration.d.ts +1 -1
  19. package/templates/common/ts/wrangler.jsonc +8 -0
  20. package/templates/hello-world/js/package.json +3 -3
  21. package/templates/hello-world/js/test/index.spec.js +1 -1
  22. package/templates/hello-world/js/vitest.config.js +1 -1
  23. package/templates/hello-world/js/wrangler.jsonc +8 -0
  24. package/templates/hello-world/py/package.json +1 -1
  25. package/templates/hello-world/py/wrangler.jsonc +9 -0
  26. package/templates/hello-world/ts/package.json +3 -3
  27. package/templates/hello-world/ts/src/index.ts +1 -1
  28. package/templates/hello-world/ts/test/tsconfig.json +1 -1
  29. package/templates/hello-world/ts/tsconfig.json +36 -95
  30. package/templates/hello-world/ts/vitest.config.mts +1 -1
  31. package/templates/hello-world/ts/worker-configuration.d.ts +1 -1
  32. package/templates/hello-world/ts/wrangler.jsonc +8 -0
  33. package/templates/hello-world-durable-object/js/package.json +1 -1
  34. package/templates/hello-world-durable-object/js/src/index.js +3 -3
  35. package/templates/hello-world-durable-object/js/wrangler.jsonc +24 -0
  36. package/templates/hello-world-durable-object/ts/package.json +1 -1
  37. package/templates/hello-world-durable-object/ts/src/index.ts +4 -4
  38. package/templates/hello-world-durable-object/ts/tsconfig.json +36 -95
  39. package/templates/hello-world-durable-object/ts/wrangler.jsonc +24 -0
  40. package/templates/hono/templates/worker-configuration.d.ts +1 -1
  41. package/templates/hono/templates/wrangler.jsonc +8 -0
  42. package/templates/next/README.md +3 -4
  43. package/templates/next/app/js/app/api/hello/route.js +4 -4
  44. package/templates/next/app/ts/app/api/hello/route.ts +4 -5
  45. package/templates/next/c3.ts +12 -30
  46. package/templates/next/wrangler.jsonc +8 -0
  47. package/templates/nuxt/c3.ts +1 -1
  48. package/templates/nuxt/templates/worker-configuration.d.ts +1 -1
  49. package/templates/nuxt/templates/wrangler.jsonc +8 -0
  50. package/templates/openapi/ts/package.json +1 -1
  51. package/templates/openapi/ts/worker-configuration.d.ts +1 -1
  52. package/templates/openapi/ts/wrangler.jsonc +8 -0
  53. package/templates/pre-existing/c3.ts +29 -10
  54. package/templates/pre-existing/js/package.json +1 -1
  55. package/templates/pre-existing/js/wrangler.jsonc +5 -0
  56. package/templates/queues/js/package.json +1 -1
  57. package/templates/queues/js/wrangler.jsonc +21 -0
  58. package/templates/queues/ts/package.json +1 -1
  59. package/templates/queues/ts/src/index.ts +1 -1
  60. package/templates/queues/ts/tsconfig.json +36 -95
  61. package/templates/queues/ts/worker-configuration.d.ts +1 -1
  62. package/templates/queues/ts/wrangler.jsonc +21 -0
  63. package/templates/qwik/templates/worker-configuration.d.ts +1 -1
  64. package/templates/qwik/templates/wrangler.jsonc +8 -0
  65. package/templates/remix/templates/worker-configuration.d.ts +1 -1
  66. package/templates/remix/templates/wrangler.jsonc +5 -0
  67. package/templates/scheduled/js/package.json +1 -1
  68. package/templates/scheduled/js/src/index.js +1 -1
  69. package/templates/scheduled/js/wrangler.jsonc +13 -0
  70. package/templates/scheduled/ts/package.json +1 -1
  71. package/templates/scheduled/ts/src/index.ts +4 -4
  72. package/templates/scheduled/ts/tsconfig.json +36 -95
  73. package/templates/scheduled/ts/worker-configuration.d.ts +1 -1
  74. package/templates/scheduled/ts/wrangler.jsonc +13 -0
  75. package/templates/solid/c3.ts +1 -1
  76. package/templates/solid/templates/wrangler.jsonc +8 -0
  77. package/templates/svelte/c3.ts +34 -7
  78. package/templates/svelte/templates/wrangler.jsonc +5 -0
  79. package/templates-experimental/angular/c3.ts +21 -7
  80. package/templates-experimental/angular/templates/src/server.ts +15 -0
  81. package/templates-experimental/angular/templates/wrangler.jsonc +12 -0
  82. package/templates-experimental/astro/c3.ts +17 -33
  83. package/templates-experimental/astro/templates/js/wrangler.jsonc +15 -0
  84. package/templates-experimental/astro/templates/ts/worker-configuration.d.ts +4 -0
  85. package/templates-experimental/astro/templates/ts/wrangler.jsonc +15 -0
  86. package/templates-experimental/docusaurus/templates/wrangler.jsonc +10 -0
  87. package/templates-experimental/gatsby/templates/wrangler.jsonc +10 -0
  88. package/templates-experimental/hello-world-assets-only/templates/wrangler.jsonc +10 -0
  89. package/templates-experimental/hello-world-durable-object-with-assets/js/package.json +1 -1
  90. package/templates-experimental/hello-world-durable-object-with-assets/js/src/index.js +3 -3
  91. package/templates-experimental/hello-world-durable-object-with-assets/js/wrangler.jsonc +28 -0
  92. package/templates-experimental/hello-world-durable-object-with-assets/ts/package.json +1 -1
  93. package/templates-experimental/hello-world-durable-object-with-assets/ts/src/index.ts +3 -3
  94. package/templates-experimental/hello-world-durable-object-with-assets/ts/tsconfig.json +36 -95
  95. package/templates-experimental/hello-world-durable-object-with-assets/ts/wrangler.jsonc +28 -0
  96. package/templates-experimental/hello-world-with-assets/js/package.json +3 -3
  97. package/templates-experimental/hello-world-with-assets/js/vitest.config.js +1 -1
  98. package/templates-experimental/hello-world-with-assets/js/wrangler.jsonc +15 -0
  99. package/templates-experimental/hello-world-with-assets/py/package.json +1 -1
  100. package/templates-experimental/hello-world-with-assets/py/wrangler.jsonc +15 -0
  101. package/templates-experimental/hello-world-with-assets/ts/package.json +3 -3
  102. package/templates-experimental/hello-world-with-assets/ts/src/index.ts +1 -1
  103. package/templates-experimental/hello-world-with-assets/ts/tsconfig.json +36 -95
  104. package/templates-experimental/hello-world-with-assets/ts/vitest.config.mts +1 -1
  105. package/templates-experimental/hello-world-with-assets/ts/worker-configuration.d.ts +1 -1
  106. package/templates-experimental/hello-world-with-assets/ts/wrangler.jsonc +15 -0
  107. package/templates-experimental/hono/templates/worker-configuration.d.ts +1 -1
  108. package/templates-experimental/hono/templates/wrangler.jsonc +9 -0
  109. package/templates-experimental/next/c3.ts +37 -5
  110. package/templates-experimental/next/templates/.dev.vars +2 -0
  111. package/templates-experimental/next/templates/__dot__gitignore +2 -5
  112. package/templates-experimental/next/templates/cloudflare-env.d.ts +5 -0
  113. package/templates-experimental/next/templates/open-next.config.ts +28 -0
  114. package/templates-experimental/next/templates/wrangler.jsonc +13 -0
  115. package/templates-experimental/nuxt/c3.ts +2 -2
  116. package/templates-experimental/nuxt/templates/worker-configuration.d.ts +1 -1
  117. package/templates-experimental/nuxt/templates/wrangler.jsonc +12 -0
  118. package/templates-experimental/qwik/templates/worker-configuration.d.ts +1 -1
  119. package/templates-experimental/qwik/templates/wrangler.jsonc +15 -0
  120. package/templates-experimental/remix/c3.ts +1 -26
  121. package/templates-experimental/remix/templates/public/.assetsignore +0 -4
  122. package/templates-experimental/remix/templates/wrangler.toml +1 -1
  123. package/templates-experimental/solid/c3.ts +8 -51
  124. package/templates-experimental/solid/templates/wrangler.jsonc +15 -0
  125. package/templates-experimental/svelte/c3.ts +4 -7
  126. package/templates-experimental/svelte/templates/wrangler.jsonc +12 -0
  127. package/templates-experimental/vue/c3.ts +33 -0
  128. package/templates-experimental/vue/templates/wrangler.jsonc +10 -0
  129. package/templates/analog/templates/wrangler.toml +0 -85
  130. package/templates/angular/templates/server.ts +0 -34
  131. package/templates/angular/templates/tools/alter-polyfills.mjs +0 -27
  132. package/templates/angular/templates/tools/paths.mjs +0 -9
  133. package/templates/astro/templates/wrangler.toml +0 -85
  134. package/templates/common/js/wrangler.toml +0 -113
  135. package/templates/common/ts/wrangler.toml +0 -113
  136. package/templates/hello-world/js/wrangler.toml +0 -114
  137. package/templates/hello-world/py/wrangler.toml +0 -114
  138. package/templates/hello-world/ts/wrangler.toml +0 -114
  139. package/templates/hello-world-durable-object/js/wrangler.toml +0 -113
  140. package/templates/hello-world-durable-object/ts/wrangler.toml +0 -113
  141. package/templates/hono/templates/wrangler.toml +0 -113
  142. package/templates/next/wrangler.toml +0 -86
  143. package/templates/nuxt/templates/wrangler.toml +0 -86
  144. package/templates/openapi/ts/wrangler.toml +0 -113
  145. package/templates/pre-existing/js/wrangler.toml +0 -4
  146. package/templates/queues/js/wrangler.toml +0 -118
  147. package/templates/queues/ts/wrangler.toml +0 -118
  148. package/templates/qwik/templates/wrangler.toml +0 -86
  149. package/templates/remix/templates/wrangler.toml +0 -85
  150. package/templates/scheduled/js/wrangler.toml +0 -119
  151. package/templates/scheduled/ts/wrangler.toml +0 -119
  152. package/templates/solid/templates/wrangler.toml +0 -84
  153. package/templates/svelte/js/wrangler.toml +0 -85
  154. package/templates/svelte/ts/wrangler.toml +0 -85
  155. package/templates-experimental/angular/templates/server.ts +0 -34
  156. package/templates-experimental/angular/templates/tools/alter-polyfills.mjs +0 -32
  157. package/templates-experimental/angular/templates/wrangler.toml +0 -11
  158. package/templates-experimental/astro/templates/wrangler.toml +0 -12
  159. package/templates-experimental/docusaurus/templates/wrangler.toml +0 -10
  160. package/templates-experimental/gatsby/templates/wrangler.toml +0 -10
  161. package/templates-experimental/hello-world-assets-only/templates/wrangler.toml +0 -10
  162. package/templates-experimental/hello-world-durable-object-with-assets/js/wrangler.toml +0 -24
  163. package/templates-experimental/hello-world-durable-object-with-assets/ts/wrangler.toml +0 -24
  164. package/templates-experimental/hello-world-with-assets/js/wrangler.toml +0 -12
  165. package/templates-experimental/hello-world-with-assets/py/wrangler.toml +0 -12
  166. package/templates-experimental/hello-world-with-assets/ts/wrangler.toml +0 -12
  167. package/templates-experimental/hono/templates/wrangler.toml +0 -5
  168. package/templates-experimental/next/templates/env.d.ts +0 -5
  169. package/templates-experimental/next/templates/wrangler.toml +0 -12
  170. package/templates-experimental/nuxt/templates/cloudflare-preset/nitro.config.ts +0 -27
  171. package/templates-experimental/nuxt/templates/wrangler.toml +0 -11
  172. package/templates-experimental/qwik/templates/wrangler.toml +0 -12
  173. package/templates-experimental/solid/templates/wrangler.toml +0 -12
  174. package/templates-experimental/svelte/js/wrangler.toml +0 -11
  175. package/templates-experimental/svelte/ts/wrangler.toml +0 -11
  176. /package/templates/astro/{snippets/runtimeDeclaration.ts → templates/ts/src/env.d.ts} +0 -0
  177. /package/templates-experimental/astro/templates/{public → js/public}/.assetsignore +0 -0
  178. /package/templates-experimental/{svelte/js/static → astro/templates/ts/public}/.assetsignore +0 -0
  179. /package/templates-experimental/astro/{snippets/runtimeDeclaration.ts → templates/ts/src/env.d.ts} +0 -0
  180. /package/templates-experimental/svelte/{ts → templates}/static/.assetsignore +0 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "src/index.ts",
4
+ "compatibility_date": "<TBD>",
5
+ "migrations": [
6
+ {
7
+ "new_classes": [
8
+ "MyDurableObject"
9
+ ],
10
+ "tag": "v1"
11
+ }
12
+ ],
13
+ "assets": {
14
+ "binding": "ASSETS",
15
+ "directory": "./public"
16
+ },
17
+ "durable_objects": {
18
+ "bindings": [
19
+ {
20
+ "class_name": "MyDurableObject",
21
+ "name": "MY_DURABLE_OBJECT"
22
+ }
23
+ ]
24
+ },
25
+ "observability": {
26
+ "enabled": true
27
+ }
28
+ }
@@ -9,8 +9,8 @@
9
9
  "test": "vitest"
10
10
  },
11
11
  "devDependencies": {
12
- "@cloudflare/vitest-pool-workers": "^0.5.2",
13
- "wrangler": "^3.60.3",
14
- "vitest": "2.0.5"
12
+ "@cloudflare/vitest-pool-workers": "^0.6.4",
13
+ "wrangler": "^3.101.0",
14
+ "vitest": "~2.1.9"
15
15
  }
16
16
  }
@@ -4,7 +4,7 @@ export default defineWorkersConfig({
4
4
  test: {
5
5
  poolOptions: {
6
6
  workers: {
7
- wrangler: { configPath: './wrangler.toml' },
7
+ wrangler: { configPath: './wrangler.jsonc' },
8
8
  },
9
9
  },
10
10
  },
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "src/index.js",
4
+ "compatibility_date": "<TBD>",
5
+ "compatibility_flags": [
6
+ "nodejs_compat"
7
+ ],
8
+ "assets": {
9
+ "binding": "ASSETS",
10
+ "directory": "./public"
11
+ },
12
+ "observability": {
13
+ "enabled": true
14
+ }
15
+ }
@@ -8,6 +8,6 @@
8
8
  "start": "wrangler dev"
9
9
  },
10
10
  "devDependencies": {
11
- "wrangler": "^3.60.3"
11
+ "wrangler": "^3.101.0"
12
12
  }
13
13
  }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "src/entry.py",
4
+ "compatibility_date": "<TBD>",
5
+ "compatibility_flags": [
6
+ "python_workers"
7
+ ],
8
+ "assets": {
9
+ "binding": "ASSETS",
10
+ "directory": "./public"
11
+ },
12
+ "observability": {
13
+ "enabled": true
14
+ }
15
+ }
@@ -10,9 +10,9 @@
10
10
  "cf-typegen": "wrangler types"
11
11
  },
12
12
  "devDependencies": {
13
- "@cloudflare/vitest-pool-workers": "^0.5.2",
13
+ "@cloudflare/vitest-pool-workers": "^0.6.4",
14
14
  "typescript": "^5.5.2",
15
- "vitest": "2.0.5",
16
- "wrangler": "^3.60.3"
15
+ "vitest": "~2.1.9",
16
+ "wrangler": "^3.101.0"
17
17
  }
18
18
  }
@@ -5,7 +5,7 @@
5
5
  * - Open a browser tab at http://localhost:8787/ to see your worker in action
6
6
  * - Run `npm run deploy` to publish your worker
7
7
  *
8
- * Bind resources to your worker in `wrangler.toml`. After adding bindings, a type definition for the
8
+ * Bind resources to your worker in `wrangler.jsonc`. After adding bindings, a type definition for the
9
9
  * `Env` object can be regenerated with `npm run cf-typegen`.
10
10
  *
11
11
  * Learn more at https://developers.cloudflare.com/workers/
@@ -2,101 +2,42 @@
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
4
 
5
- /* Projects */
6
- // "incremental": true, /* Enable incremental compilation */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
- "lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
16
- "jsx": "react-jsx" /* Specify what JSX code is generated. */,
17
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22
- // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
-
26
- /* Modules */
27
- "module": "es2022" /* Specify what module code is generated. */,
28
- // "rootDir": "./", /* Specify the root folder within your source files. */
29
- "moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
30
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
- // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34
- "types": ["@cloudflare/workers-types"] /* Specify type package names to be included without being referenced in a source file. */,
35
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
- "resolveJsonModule": true /* Enable importing .json files */,
37
- // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
38
-
39
- /* JavaScript Support */
40
- "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
41
- "checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
42
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43
-
44
- /* Emit */
45
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
- // "outDir": "./", /* Specify an output folder for all emitted files. */
51
- // "removeComments": true, /* Disable emitting comments. */
52
- "noEmit": true /* Disable emitting files from a compilation. */,
53
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61
- // "newLine": "crlf", /* Set the newline character for emitting files. */
62
- // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63
- // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65
- // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
68
-
69
- /* Interop Constraints */
70
- "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
71
- "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
72
- // "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
73
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
74
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
75
-
76
- /* Type Checking */
77
- "strict": true /* Enable all strict type-checking options. */,
78
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
79
- // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
80
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81
- // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
82
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83
- // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
84
- // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
85
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86
- // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
87
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
88
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
92
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
94
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
96
-
97
- /* Completeness */
98
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
5
+ /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
6
+ "target": "es2021",
7
+ /* Specify a set of bundled library declaration files that describe the target runtime environment. */
8
+ "lib": ["es2021"],
9
+ /* Specify what JSX code is generated. */
10
+ "jsx": "react-jsx",
11
+
12
+ /* Specify what module code is generated. */
13
+ "module": "es2022",
14
+ /* Specify how TypeScript looks up a file from a given module specifier. */
15
+ "moduleResolution": "Bundler",
16
+ /* Specify type package names to be included without being referenced in a source file. */
17
+ "types": ["@cloudflare/workers-types"],
18
+ /* Enable importing .json files */
19
+ "resolveJsonModule": true,
20
+
21
+ /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
22
+ "allowJs": true,
23
+ /* Enable error reporting in type-checked JavaScript files. */
24
+ "checkJs": false,
25
+
26
+ /* Disable emitting files from a compilation. */
27
+ "noEmit": true,
28
+
29
+ /* Ensure that each file can be safely transpiled without relying on other imports. */
30
+ "isolatedModules": true,
31
+ /* Allow 'import x from y' when a module doesn't have a default export. */
32
+ "allowSyntheticDefaultImports": true,
33
+ /* Ensure that casing is correct in imports. */
34
+ "forceConsistentCasingInFileNames": true,
35
+
36
+ /* Enable all strict type-checking options. */
37
+ "strict": true,
38
+
39
+ /* Skip type checking all .d.ts files. */
40
+ "skipLibCheck": true
100
41
  },
101
42
  "exclude": ["test"],
102
43
  "include": ["worker-configuration.d.ts", "src/**/*.ts"]
@@ -4,7 +4,7 @@ export default defineWorkersConfig({
4
4
  test: {
5
5
  poolOptions: {
6
6
  workers: {
7
- wrangler: { configPath: './wrangler.toml' },
7
+ wrangler: { configPath: './wrangler.jsonc' },
8
8
  },
9
9
  },
10
10
  },
@@ -1,4 +1,4 @@
1
1
  // Generated by Wrangler
2
- // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
2
+ // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
3
  interface Env {
4
4
  }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "src/index.ts",
4
+ "compatibility_date": "<TBD>",
5
+ "compatibility_flags": [
6
+ "nodejs_compat"
7
+ ],
8
+ "assets": {
9
+ "binding": "ASSETS",
10
+ "directory": "./public"
11
+ },
12
+ "observability": {
13
+ "enabled": true
14
+ }
15
+ }
@@ -1,4 +1,4 @@
1
1
  // Generated by Wrangler
2
- // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
2
+ // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
3
  interface CloudflareBindings {
4
4
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "src/index.ts",
4
+ "compatibility_date": "<TBD>",
5
+ "assets": {
6
+ "binding": "ASSETS",
7
+ "directory": "./public"
8
+ }
9
+ }
@@ -1,5 +1,7 @@
1
1
  import { brandColor, dim } from "@cloudflare/cli/colors";
2
+ import { spinner } from "@cloudflare/cli/interactive";
2
3
  import { runFrameworkGenerator } from "frameworks/index";
4
+ import { readFile, writeFile } from "helpers/files";
3
5
  import { installPackages } from "helpers/packages";
4
6
  import type { TemplateConfig } from "../../src/templates";
5
7
  import type { C3Context } from "types";
@@ -18,20 +20,50 @@ const generate = async (ctx: C3Context) => {
18
20
  };
19
21
 
20
22
  const configure = async () => {
21
- const packages = ["@opennextjs/cloudflare", "@cloudflare/workers-types"];
23
+ const packages = [
24
+ "@opennextjs/cloudflare@0.4.x",
25
+ "@cloudflare/workers-types",
26
+ ];
22
27
  await installPackages(packages, {
23
28
  dev: true,
24
29
  startText: "Adding the Cloudflare adapter",
25
30
  doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`,
26
31
  });
32
+
33
+ updateNextConfig();
34
+ };
35
+
36
+ const updateNextConfig = () => {
37
+ const s = spinner();
38
+
39
+ const configFile = "next.config.mjs";
40
+ s.start(`Updating \`${configFile}\``);
41
+
42
+ const configContent = readFile(configFile);
43
+
44
+ const updatedConfigFile =
45
+ configContent +
46
+ `
47
+ // added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
48
+ import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
49
+ initOpenNextCloudflareForDev();
50
+ `.replace(/\n\t*/g, "\n");
51
+
52
+ writeFile(configFile, updatedConfigFile);
53
+
54
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
27
55
  };
28
56
 
29
57
  export default {
30
58
  configVersion: 1,
31
59
  id: "next",
32
60
  frameworkCli: "create-next-app",
61
+ // TODO: here we need to specify a version of create-next-app which is different from the
62
+ // standard one used in the stable Next.js template, that's because our open-next adapter
63
+ // is not yet fully ready for Next.js 15, once it is we should remove the following
64
+ frameworkCliPinnedVersion: "^14.2.23",
33
65
  platform: "workers",
34
- displayName: "Next (using Node.js compat + Workers Assets)",
66
+ displayName: "Next.js (using Node.js compat + Workers Assets)",
35
67
  path: "templates-experimental/next",
36
68
  copyFiles: {
37
69
  path: "./templates",
@@ -40,9 +72,9 @@ export default {
40
72
  configure,
41
73
  transformPackageJson: async () => ({
42
74
  scripts: {
43
- deploy: `cloudflare && wrangler deploy`,
44
- preview: `cloudflare && wrangler dev`,
45
- "cf-typegen": `wrangler types --env-interface CloudflareEnv env.d.ts`,
75
+ deploy: `opennextjs-cloudflare && wrangler deploy`,
76
+ preview: `opennextjs-cloudflare && wrangler dev`,
77
+ "cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`,
46
78
  },
47
79
  }),
48
80
  devScript: "dev",
@@ -0,0 +1,2 @@
1
+ # Load .env.development* files when running `wrangler dev`
2
+ NEXTJS_ENV=development
@@ -35,8 +35,5 @@ yarn-error.log*
35
35
  *.tsbuildinfo
36
36
  next-env.d.ts
37
37
 
38
-
39
- # Cloudflare related
40
- /.save.next
41
- /.worker-next
42
- /.wrangler
38
+ # OpenNext
39
+ /.open-next
@@ -0,0 +1,5 @@
1
+ // Generated by Wrangler
2
+ // by running `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
3
+
4
+ interface CloudflareEnv {
5
+ }
@@ -0,0 +1,28 @@
1
+ import cache from "@opennextjs/cloudflare/kvCache";
2
+
3
+ const config = {
4
+ default: {
5
+ override: {
6
+ wrapper: "cloudflare-node",
7
+ converter: "edge",
8
+ incrementalCache: async () => cache,
9
+ tagCache: "dummy",
10
+ queue: "dummy",
11
+ },
12
+ },
13
+
14
+ middleware: {
15
+ external: true,
16
+ override: {
17
+ wrapper: "cloudflare-edge",
18
+ converter: "edge",
19
+ proxyExternalRequest: "fetch",
20
+ },
21
+ },
22
+
23
+ dangerous: {
24
+ enableCacheInterception: false,
25
+ },
26
+ };
27
+
28
+ export default config;
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "<app-name>",
3
+ "main": ".open-next/worker.js",
4
+ "compatibility_date": "2024-09-26",
5
+ "compatibility_flags": [
6
+ "nodejs_compat"
7
+ ],
8
+ "minify": true,
9
+ "assets": {
10
+ "binding": "ASSETS",
11
+ "directory": ".open-next/assets"
12
+ }
13
+ }
@@ -24,7 +24,7 @@ const generate = async (ctx: C3Context) => {
24
24
  gitFlag,
25
25
  ]);
26
26
 
27
- writeFile("./.node-version", "17");
27
+ writeFile("./.node-version", "18");
28
28
 
29
29
  logRaw(""); // newline
30
30
  };
@@ -82,7 +82,7 @@ const updateNuxtConfig = () => {
82
82
  b.objectExpression([
83
83
  b.objectProperty(
84
84
  b.identifier("preset"),
85
- b.stringLiteral("./cloudflare-preset"),
85
+ b.stringLiteral("cloudflare_module"),
86
86
  ),
87
87
  ]),
88
88
  );
@@ -1,4 +1,4 @@
1
1
  // Generated by Wrangler
2
- // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
2
+ // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
3
  interface Env {
4
4
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "./.output/server/index.mjs",
4
+ "compatibility_date": "<TBD>",
5
+ "assets": {
6
+ "binding": "ASSETS",
7
+ "directory": "./.output/public/"
8
+ },
9
+ "observability": {
10
+ "enabled": true
11
+ }
12
+ }
@@ -1,4 +1,4 @@
1
1
  // Generated by Wrangler
2
- // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
2
+ // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
3
  interface Env {
4
4
  }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "main": "./dist/_worker.js",
4
+ "compatibility_date": "<TBD>",
5
+ "compatibility_flags": [
6
+ "nodejs_compat"
7
+ ],
8
+ "assets": {
9
+ "binding": "ASSET",
10
+ "directory": "./dist"
11
+ },
12
+ "observability": {
13
+ "enabled": true
14
+ }
15
+ }
@@ -1,8 +1,6 @@
1
1
  import { logRaw } from "@cloudflare/cli";
2
2
  import { brandColor, dim } from "@cloudflare/cli/colors";
3
- import { spinner } from "@cloudflare/cli/interactive";
4
3
  import { runFrameworkGenerator } from "frameworks/index";
5
- import { transformFile } from "helpers/codemod";
6
4
  import { detectPackageManager } from "helpers/packageManagers";
7
5
  import { installPackages } from "helpers/packages";
8
6
  import type { TemplateConfig } from "../../src/templates";
@@ -14,7 +12,7 @@ const generate = async (ctx: C3Context) => {
14
12
  await runFrameworkGenerator(ctx, [
15
13
  ctx.project.name,
16
14
  "--template",
17
- "https://github.com/remix-run/remix/tree/main/templates/cloudflare",
15
+ "https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers",
18
16
  ]);
19
17
 
20
18
  logRaw(""); // newline
@@ -26,27 +24,6 @@ const configure = async () => {
26
24
  startText: "Updating the Wrangler version",
27
25
  doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`,
28
26
  });
29
-
30
- const typeDefsPath = "load-context.ts";
31
-
32
- const s = spinner();
33
- s.start(`Updating \`${typeDefsPath}\``);
34
-
35
- // Remove the empty Env declaration from the template to allow the type from
36
- // worker-configuration.d.ts to take over
37
- transformFile(typeDefsPath, {
38
- visitTSInterfaceDeclaration(n) {
39
- if (n.node.id.type === "Identifier" && n.node.id.name !== "Env") {
40
- return this.traverse(n);
41
- }
42
-
43
- // Removes the node
44
- n.replace();
45
- return false;
46
- },
47
- });
48
-
49
- s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
50
27
  };
51
28
 
52
29
  const config: TemplateConfig = {
@@ -63,8 +40,6 @@ const config: TemplateConfig = {
63
40
  configure,
64
41
  transformPackageJson: async () => ({
65
42
  scripts: {
66
- build:
67
- "remix vite:build && wrangler pages functions build --outdir build/worker",
68
43
  deploy: `${npm} run build && wrangler deploy`,
69
44
  preview: `${npm} run build && wrangler dev`,
70
45
  "cf-typegen": `wrangler types`,
@@ -1,4 +0,0 @@
1
- _worker.js
2
- _routes.json
3
- _headers
4
- _redirects
@@ -1,7 +1,7 @@
1
1
  #:schema node_modules/wrangler/config-schema.json
2
2
  name = "<TBD>"
3
3
  compatibility_date = "<TBD>"
4
- main = "./build/worker/index.js"
4
+ main = "./server.ts"
5
5
  assets = { directory = "./build/client" }
6
6
 
7
7
  # Workers Logs