create-cloudflare 0.0.0-ad774e49b → 0.0.0-adc4941be

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 (167) hide show
  1. package/dist/cli.js +989 -867
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +8 -8
  4. package/templates/analog/c3.ts +0 -24
  5. package/templates/analog/templates/env.d.ts +1 -1
  6. package/templates/angular/pages/c3.ts +4 -3
  7. package/templates/angular/pages/templates/wrangler.jsonc +5 -0
  8. package/templates/angular/workers/c3.ts +1 -0
  9. package/templates/astro/pages/c3.ts +1 -0
  10. package/templates/astro/workers/templates/js/wrangler.jsonc +2 -1
  11. package/templates/astro/workers/templates/ts/wrangler.jsonc +3 -2
  12. package/templates/common/c3.ts +5 -1
  13. package/templates/common/ts/tsconfig.json +0 -3
  14. package/templates/docusaurus/pages/c3.ts +2 -0
  15. package/templates/docusaurus/workers/c3.ts +1 -0
  16. package/templates/gatsby/pages/c3.ts +2 -0
  17. package/templates/gatsby/workers/c3.ts +1 -0
  18. package/templates/hello-world/js/package.json +1 -1
  19. package/templates/hello-world/py/README.md +2 -2
  20. package/templates/hello-world/py/pyproject.toml +1 -1
  21. package/templates/hello-world/py/src/entry.py +3 -2
  22. package/templates/hello-world/ts/package.json +1 -1
  23. package/templates/hello-world/ts/test/env.d.ts +3 -0
  24. package/templates/hello-world/ts/test/index.spec.ts +0 -1
  25. package/templates/hello-world/ts/test/tsconfig.json +1 -1
  26. package/templates/hello-world/ts/tsconfig.json +0 -2
  27. package/templates/hello-world-assets-only/c3.ts +2 -2
  28. package/templates/hello-world-assets-only/templates/public/index.html +1 -0
  29. package/templates/hello-world-assets-only/templates/wrangler.jsonc +1 -0
  30. package/templates/hello-world-durable-object/c3.ts +7 -1
  31. package/templates/hello-world-durable-object/py/.python-version +1 -0
  32. package/templates/hello-world-durable-object/py/README.md +23 -0
  33. package/templates/hello-world-durable-object/py/__dot__gitignore +68 -0
  34. package/templates/hello-world-durable-object/py/package.json +13 -0
  35. package/templates/hello-world-durable-object/py/pyproject.toml +9 -0
  36. package/templates/hello-world-durable-object/py/src/entry.py +66 -0
  37. package/templates/hello-world-durable-object/py/uv.lock +22 -0
  38. package/templates/hello-world-durable-object/py/wrangler.jsonc +27 -0
  39. package/templates/hello-world-durable-object/ts/tsconfig.json +0 -2
  40. package/templates/hello-world-durable-object-with-assets/c3.ts +3 -0
  41. package/templates/hello-world-durable-object-with-assets/js/public/index.html +1 -0
  42. package/templates/hello-world-durable-object-with-assets/js/src/index.js +11 -10
  43. package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +3 -3
  44. package/templates/hello-world-durable-object-with-assets/py/.python-version +1 -0
  45. package/templates/hello-world-durable-object-with-assets/py/README.md +23 -0
  46. package/templates/hello-world-durable-object-with-assets/py/__dot__gitignore +68 -0
  47. package/templates/hello-world-durable-object-with-assets/py/package.json +13 -0
  48. package/templates/hello-world-durable-object-with-assets/py/public/index.html +20 -0
  49. package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +9 -0
  50. package/templates/hello-world-durable-object-with-assets/py/src/entry.py +66 -0
  51. package/templates/hello-world-durable-object-with-assets/py/uv.lock +22 -0
  52. package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +31 -0
  53. package/templates/hello-world-durable-object-with-assets/ts/public/index.html +1 -0
  54. package/templates/hello-world-durable-object-with-assets/ts/src/index.ts +10 -9
  55. package/templates/hello-world-durable-object-with-assets/ts/tsconfig.json +0 -2
  56. package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +2 -2
  57. package/templates/hello-world-with-assets/c3.ts +7 -3
  58. package/templates/hello-world-with-assets/js/package.json +1 -1
  59. package/templates/hello-world-with-assets/js/public/index.html +3 -2
  60. package/templates/hello-world-with-assets/js/wrangler.jsonc +3 -2
  61. package/templates/hello-world-with-assets/py/.python-version +1 -0
  62. package/templates/hello-world-with-assets/py/README.md +23 -0
  63. package/templates/hello-world-with-assets/py/public/index.html +3 -2
  64. package/templates/hello-world-with-assets/py/pyproject.toml +9 -0
  65. package/templates/hello-world-with-assets/py/src/entry.py +9 -7
  66. package/templates/hello-world-with-assets/py/uv.lock +22 -0
  67. package/templates/hello-world-with-assets/py/wrangler.jsonc +1 -1
  68. package/templates/hello-world-with-assets/ts/package.json +1 -1
  69. package/templates/hello-world-with-assets/ts/public/index.html +3 -2
  70. package/templates/hello-world-with-assets/ts/test/env.d.ts +3 -0
  71. package/templates/hello-world-with-assets/ts/test/tsconfig.json +2 -2
  72. package/templates/hello-world-with-assets/ts/tsconfig.json +0 -2
  73. package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -2
  74. package/templates/hono/pages/c3.ts +7 -2
  75. package/templates/hono/pages/templates/wrangler.jsonc +1 -2
  76. package/templates/hono/workers/c3.ts +3 -1
  77. package/templates/next/c3.ts +7 -221
  78. package/templates/next/pages/c3.ts +221 -0
  79. package/{templates-experimental/next → templates/next/workers}/c3.ts +12 -16
  80. package/templates/next/workers/templates/open-next.config.ts +9 -0
  81. package/{templates-experimental/next → templates/next/workers}/templates/wrangler.jsonc +3 -2
  82. package/templates/nuxt/pages/c3.ts +4 -26
  83. package/templates/nuxt/pages/templates/env.d.ts +1 -1
  84. package/templates/nuxt/workers/c3.ts +3 -26
  85. package/templates/nuxt/workers/templates/env.d.ts +1 -1
  86. package/templates/openapi/c3.ts +5 -1
  87. package/templates/openapi/ts/__dot__gitignore +1 -0
  88. package/templates/openapi/ts/package.json +7 -6
  89. package/templates/openapi/ts/src/endpoints/taskCreate.ts +2 -2
  90. package/templates/openapi/ts/src/endpoints/taskDelete.ts +2 -2
  91. package/templates/openapi/ts/src/endpoints/taskFetch.ts +2 -2
  92. package/templates/openapi/ts/src/endpoints/taskList.ts +2 -2
  93. package/templates/openapi/ts/src/index.ts +4 -1
  94. package/templates/openapi/ts/src/types.ts +3 -0
  95. package/templates/openapi/ts/tsconfig.json +18 -21
  96. package/templates/pre-existing/c3.ts +6 -2
  97. package/templates/queues/c3.ts +5 -1
  98. package/templates/queues/ts/tsconfig.json +0 -2
  99. package/templates/qwik/c3.ts +5 -144
  100. package/templates/qwik/pages/c3.ts +151 -0
  101. package/{templates-experimental/qwik → templates/qwik/workers}/c3.ts +5 -6
  102. package/{templates-experimental/qwik → templates/qwik/workers}/templates/wrangler.jsonc +2 -1
  103. package/templates/react/pages/c3.ts +5 -2
  104. package/templates/react/pages/templates/wrangler.jsonc +5 -0
  105. package/templates/react/workers/c3.ts +1 -1
  106. package/templates/react/workers/js/src/App.jsx +1 -1
  107. package/templates/react/workers/js/{api → worker}/index.js +1 -1
  108. package/templates/react/workers/js/wrangler.jsonc +2 -2
  109. package/templates/react/workers/ts/src/App.tsx +1 -1
  110. package/templates/react/workers/ts/tsconfig.worker.json +2 -2
  111. package/templates/react/workers/ts/{api → worker}/index.ts +2 -3
  112. package/templates/react/workers/ts/wrangler.jsonc +2 -2
  113. package/templates/react-router/c3.ts +41 -0
  114. package/templates/remix/c3.ts +1 -0
  115. package/templates/remix/pages/c3.ts +2 -0
  116. package/templates/remix/pages/templates/worker-configuration.d.ts +1 -1
  117. package/templates/remix/workers/c3.ts +1 -0
  118. package/templates/remix/workers/templates/wrangler.toml +1 -1
  119. package/templates/scheduled/c3.ts +5 -1
  120. package/templates/scheduled/ts/src/index.ts +7 -0
  121. package/templates/scheduled/ts/tsconfig.json +0 -2
  122. package/templates/solid/c3.ts +1 -0
  123. package/templates/svelte/pages/c3.ts +4 -3
  124. package/templates/svelte/workers/c3.ts +3 -3
  125. package/templates/vue/pages/c3.ts +6 -3
  126. package/templates/vue/pages/templates/wrangler.jsonc +5 -0
  127. package/templates/vue/workers/js/server/index.js +2 -2
  128. package/templates/vue/workers/js/wrangler.jsonc +0 -1
  129. package/templates/vue/workers/ts/server/index.ts +2 -3
  130. package/templates/vue/workers/ts/tsconfig.worker.json +1 -1
  131. package/templates/vue/workers/ts/wrangler.jsonc +0 -1
  132. package/templates-experimental/solid/c3.ts +1 -1
  133. package/templates/astro/workers/templates/ts/worker-configuration.d.ts +0 -4
  134. package/templates/common/ts/worker-configuration.d.ts +0 -4
  135. package/templates/hello-world/ts/worker-configuration.d.ts +0 -4
  136. package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +0 -5
  137. package/templates/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +0 -5
  138. package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +0 -4
  139. package/templates/hono/pages/templates/worker-configuration.d.ts +0 -4
  140. package/templates/hono/workers/templates/worker-configuration.d.ts +0 -4
  141. package/templates/next/env.d.ts +0 -5
  142. package/templates/nuxt/pages/templates/worker-configuration.d.ts +0 -4
  143. package/templates/nuxt/workers/templates/worker-configuration.d.ts +0 -4
  144. package/templates/openapi/ts/worker-configuration.d.ts +0 -4
  145. package/templates/queues/ts/worker-configuration.d.ts +0 -5
  146. package/templates/qwik/templates/worker-configuration.d.ts +0 -4
  147. package/templates/react/workers/ts/worker-configuration.d.ts +0 -5
  148. package/templates/scheduled/ts/worker-configuration.d.ts +0 -4
  149. package/templates/vue/workers/ts/worker-configuration.d.ts +0 -6
  150. package/templates-experimental/next/templates/cloudflare-env.d.ts +0 -5
  151. package/templates-experimental/next/templates/open-next.config.ts +0 -6
  152. /package/templates/next/{README.md → pages/README.md} +0 -0
  153. /package/templates/next/{app → pages/app}/js/app/api/hello/route.js +0 -0
  154. /package/templates/next/{app → pages/app}/js/app/not-found.js +0 -0
  155. /package/templates/next/{app → pages/app}/ts/app/api/hello/route.ts +0 -0
  156. /package/templates/next/{app → pages/app}/ts/app/not-found.tsx +0 -0
  157. /package/templates/next/pages/{js → pages/js}/pages/api/hello.js +0 -0
  158. /package/templates/next/pages/{ts → pages/ts}/pages/api/hello.ts +0 -0
  159. /package/templates/next/{wrangler.jsonc → pages/wrangler.jsonc} +0 -0
  160. /package/{templates-experimental/next → templates/next/workers}/templates/.dev.vars +0 -0
  161. /package/{templates-experimental/next → templates/next/workers}/templates/__dot__gitignore +0 -0
  162. /package/{templates-experimental/qwik → templates/qwik/pages}/snippets/getPlatformProxy.ts +0 -0
  163. /package/{templates-experimental/qwik → templates/qwik/pages}/templates/worker-configuration.d.ts +0 -0
  164. /package/templates/qwik/{templates → pages/templates}/wrangler.jsonc +0 -0
  165. /package/templates/qwik/{snippets → workers/snippets}/getPlatformProxy.ts +0 -0
  166. /package/{templates-experimental/qwik → templates/qwik/workers}/templates/public/.assetsignore +0 -0
  167. /package/templates/{analog → qwik/workers}/templates/worker-configuration.d.ts +0 -0
package/dist/cli.js CHANGED
@@ -568,7 +568,7 @@ var require_XDGAppPaths = __commonJS({
568
568
  XDGAppPaths.cache = function cache(dirOptions) {
569
569
  return path6.join(xdg.cache(), finalPathSegment(dirOptions));
570
570
  };
571
- XDGAppPaths.config = function config38(dirOptions) {
571
+ XDGAppPaths.config = function config48(dirOptions) {
572
572
  return path6.join(xdg.config(), finalPathSegment(dirOptions));
573
573
  };
574
574
  XDGAppPaths.data = function data(dirOptions) {
@@ -625,7 +625,7 @@ var require_XDG = __commonJS({
625
625
  var cache = function() {
626
626
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
627
627
  };
628
- var config38 = function() {
628
+ var config48 = function() {
629
629
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
630
630
  };
631
631
  var data = function() {
@@ -637,13 +637,13 @@ var require_XDG = __commonJS({
637
637
  var state = function() {
638
638
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
639
639
  };
640
- return { cache, config: config38, data, runtime, state };
640
+ return { cache, config: config48, data, runtime, state };
641
641
  };
642
642
  var macos = function() {
643
643
  var cache = function() {
644
644
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
645
645
  };
646
- var config38 = function() {
646
+ var config48 = function() {
647
647
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
648
648
  };
649
649
  var data = function() {
@@ -655,7 +655,7 @@ var require_XDG = __commonJS({
655
655
  var state = function() {
656
656
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
657
657
  };
658
- return { cache, config: config38, data, runtime, state };
658
+ return { cache, config: config48, data, runtime, state };
659
659
  };
660
660
  var windows = function() {
661
661
  function appData() {
@@ -667,7 +667,7 @@ var require_XDG = __commonJS({
667
667
  var cache = function() {
668
668
  return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
669
669
  };
670
- var config38 = function() {
670
+ var config48 = function() {
671
671
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
672
672
  };
673
673
  var data = function() {
@@ -679,7 +679,7 @@ var require_XDG = __commonJS({
679
679
  var state = function() {
680
680
  return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
681
681
  };
682
- return { cache, config: config38, data, runtime, state };
682
+ return { cache, config: config48, data, runtime, state };
683
683
  };
684
684
  var XDG_ = /* @__PURE__ */ function() {
685
685
  function XDG_2() {
@@ -3111,8 +3111,8 @@ var require_path_key = __commonJS({
3111
3111
  "use strict";
3112
3112
  var pathKey = (options = {}) => {
3113
3113
  const environment = options.env || process.env;
3114
- const platform3 = options.platform || process.platform;
3115
- if (platform3 !== "win32") {
3114
+ const platform = options.platform || process.platform;
3115
+ if (platform !== "win32") {
3116
3116
  return "PATH";
3117
3117
  }
3118
3118
  return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
@@ -26411,7 +26411,7 @@ var require_index_688c5d50 = __commonJS({
26411
26411
  }
26412
26412
  var origCwd = process.cwd;
26413
26413
  var cwd = null;
26414
- var platform3 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
26414
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
26415
26415
  process.cwd = function() {
26416
26416
  if (!cwd)
26417
26417
  cwd = origCwd.call(process);
@@ -26466,7 +26466,7 @@ var require_index_688c5d50 = __commonJS({
26466
26466
  fs4.lchownSync = function() {
26467
26467
  };
26468
26468
  }
26469
- if (platform3 === "win32") {
26469
+ if (platform === "win32") {
26470
26470
  fs4.rename = /* @__PURE__ */ function(fs$rename) {
26471
26471
  return function(from, to, cb) {
26472
26472
  var start = Date.now();
@@ -31509,21 +31509,21 @@ var require_dist_web = __commonJS({
31509
31509
  _createClass(Haikunator3, [{
31510
31510
  key: "haikunate",
31511
31511
  value: function haikunate(options) {
31512
- var config38 = (0, _lodash["default"])(options, this.config);
31513
- if (config38.tokenHex === true) {
31514
- config38.tokenChars = "0123456789abcdef";
31512
+ var config48 = (0, _lodash["default"])(options, this.config);
31513
+ if (config48.tokenHex === true) {
31514
+ config48.tokenChars = "0123456789abcdef";
31515
31515
  }
31516
31516
  var adjective = this._randomElement(this.adjectives);
31517
31517
  var noun = this._randomElement(this.nouns);
31518
- if (!config38.tokenLength) config38.tokenLength = 0;
31518
+ if (!config48.tokenLength) config48.tokenLength = 0;
31519
31519
  var token = "";
31520
- for (var i = 0; i < config38.tokenLength; i++) {
31521
- token += this._randomElement(config38.tokenChars);
31520
+ for (var i = 0; i < config48.tokenLength; i++) {
31521
+ token += this._randomElement(config48.tokenChars);
31522
31522
  }
31523
31523
  var sections = [adjective, noun, token];
31524
31524
  return sections.filter(function(e) {
31525
31525
  return !!e;
31526
- }).join(config38.delimiter);
31526
+ }).join(config48.delimiter);
31527
31527
  }
31528
31528
  /**
31529
31529
  * Get a random element from an array/string
@@ -31639,7 +31639,7 @@ var require_open = __commonJS({
31639
31639
  var isDocker = require_is_docker();
31640
31640
  var defineLazyProperty = require_define_lazy_prop();
31641
31641
  var localXdgOpenPath = path6.join(__dirname, "xdg-open");
31642
- var { platform: platform3, arch } = process;
31642
+ var { platform, arch } = process;
31643
31643
  var getWslDrivesMountPoint = /* @__PURE__ */ (() => {
31644
31644
  const defaultMountPoint = "/mnt/";
31645
31645
  let mountPoint;
@@ -31706,7 +31706,7 @@ var require_open = __commonJS({
31706
31706
  let command2;
31707
31707
  const cliArguments = [];
31708
31708
  const childProcessOptions = {};
31709
- if (platform3 === "darwin") {
31709
+ if (platform === "darwin") {
31710
31710
  command2 = "open";
31711
31711
  if (options.wait) {
31712
31712
  cliArguments.push("--wait-apps");
@@ -31720,7 +31720,7 @@ var require_open = __commonJS({
31720
31720
  if (app) {
31721
31721
  cliArguments.push("-a", app);
31722
31722
  }
31723
- } else if (platform3 === "win32" || isWsl && !isDocker()) {
31723
+ } else if (platform === "win32" || isWsl && !isDocker()) {
31724
31724
  const mountPoint = await getWslDrivesMountPoint();
31725
31725
  command2 = isWsl ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
31726
31726
  cliArguments.push(
@@ -31761,7 +31761,7 @@ var require_open = __commonJS({
31761
31761
  exeLocalXdgOpen = true;
31762
31762
  } catch {
31763
31763
  }
31764
- const useSystemXdgOpen = process.versions.electron || platform3 === "android" || isBundled || !exeLocalXdgOpen;
31764
+ const useSystemXdgOpen = process.versions.electron || platform === "android" || isBundled || !exeLocalXdgOpen;
31765
31765
  command2 = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
31766
31766
  }
31767
31767
  if (appArguments.length > 0) {
@@ -31775,7 +31775,7 @@ var require_open = __commonJS({
31775
31775
  if (options.target) {
31776
31776
  cliArguments.push(options.target);
31777
31777
  }
31778
- if (platform3 === "darwin" && appArguments.length > 0) {
31778
+ if (platform === "darwin" && appArguments.length > 0) {
31779
31779
  cliArguments.push("--args", ...appArguments);
31780
31780
  }
31781
31781
  const subprocess = childProcess.spawn(command2, cliArguments, childProcessOptions);
@@ -31829,12 +31829,12 @@ var require_open = __commonJS({
31829
31829
  }
31830
31830
  return archBinary;
31831
31831
  }
31832
- function detectPlatformBinary({ [platform3]: platformBinary }, { wsl }) {
31832
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
31833
31833
  if (wsl && isWsl) {
31834
31834
  return detectArchBinary(wsl);
31835
31835
  }
31836
31836
  if (!platformBinary) {
31837
- throw new Error(`${platform3} is not supported`);
31837
+ throw new Error(`${platform} is not supported`);
31838
31838
  }
31839
31839
  return detectArchBinary(platformBinary);
31840
31840
  }
@@ -40036,13 +40036,13 @@ var require_esprima = __commonJS({
40036
40036
  return Reader2;
40037
40037
  }();
40038
40038
  var Tokenizer = function() {
40039
- function Tokenizer2(code, config38) {
40039
+ function Tokenizer2(code, config48) {
40040
40040
  this.errorHandler = new error_handler_1.ErrorHandler();
40041
- this.errorHandler.tolerant = config38 ? typeof config38.tolerant === "boolean" && config38.tolerant : false;
40041
+ this.errorHandler.tolerant = config48 ? typeof config48.tolerant === "boolean" && config48.tolerant : false;
40042
40042
  this.scanner = new scanner_1.Scanner(code, this.errorHandler);
40043
- this.scanner.trackComment = config38 ? typeof config38.comment === "boolean" && config38.comment : false;
40044
- this.trackRange = config38 ? typeof config38.range === "boolean" && config38.range : false;
40045
- this.trackLoc = config38 ? typeof config38.loc === "boolean" && config38.loc : false;
40043
+ this.scanner.trackComment = config48 ? typeof config48.comment === "boolean" && config48.comment : false;
40044
+ this.trackRange = config48 ? typeof config48.range === "boolean" && config48.range : false;
40045
+ this.trackLoc = config48 ? typeof config48.loc === "boolean" && config48.loc : false;
40046
40046
  this.buffer = [];
40047
40047
  this.reader = new Reader();
40048
40048
  }
@@ -49803,11 +49803,11 @@ var require_printer = __commonJS({
49803
49803
  return this.code;
49804
49804
  };
49805
49805
  var emptyPrintResult = new PrintResult("");
49806
- var Printer = function Printer2(config38) {
49806
+ var Printer = function Printer2(config48) {
49807
49807
  assert_1.default.ok(this instanceof Printer2);
49808
- var explicitTabWidth = config38 && config38.tabWidth;
49809
- config38 = options_1.normalize(config38);
49810
- config38.sourceFileName = null;
49808
+ var explicitTabWidth = config48 && config48.tabWidth;
49809
+ config48 = options_1.normalize(config48);
49810
+ config48.sourceFileName = null;
49811
49811
  function makePrintFunctionWith(options, overrides) {
49812
49812
  options = Object.assign({}, options, overrides);
49813
49813
  return function(path6) {
@@ -49822,11 +49822,11 @@ var require_printer = __commonJS({
49822
49822
  includeComments: false
49823
49823
  }));
49824
49824
  }
49825
- var oldTabWidth = config38.tabWidth;
49825
+ var oldTabWidth = config48.tabWidth;
49826
49826
  if (!explicitTabWidth) {
49827
49827
  var loc = path6.getNode().loc;
49828
49828
  if (loc && loc.lines && loc.lines.guessTabWidth) {
49829
- config38.tabWidth = loc.lines.guessTabWidth();
49829
+ config48.tabWidth = loc.lines.guessTabWidth();
49830
49830
  }
49831
49831
  }
49832
49832
  var reprinter = patcher_1.getReprinter(path6);
@@ -49840,11 +49840,11 @@ var require_printer = __commonJS({
49840
49840
  // right choice because it gives us the opportunity to reprint
49841
49841
  // such nodes using their original source.
49842
49842
  reprinter(print2)
49843
- ) : genericPrint(path6, config38, options, makePrintFunctionWith(options, {
49843
+ ) : genericPrint(path6, config48, options, makePrintFunctionWith(options, {
49844
49844
  includeComments: true,
49845
49845
  avoidRootParens: false
49846
49846
  }));
49847
- config38.tabWidth = oldTabWidth;
49847
+ config48.tabWidth = oldTabWidth;
49848
49848
  return lines;
49849
49849
  }
49850
49850
  this.print = function(ast) {
@@ -49855,7 +49855,7 @@ var require_printer = __commonJS({
49855
49855
  includeComments: true,
49856
49856
  avoidRootParens: false
49857
49857
  });
49858
- return new PrintResult(lines.toString(config38), util.composeSourceMaps(config38.inputSourceMap, lines.getSourceMap(config38.sourceMapName, config38.sourceRoot)));
49858
+ return new PrintResult(lines.toString(config48), util.composeSourceMaps(config48.inputSourceMap, lines.getSourceMap(config48.sourceMapName, config48.sourceRoot)));
49859
49859
  };
49860
49860
  this.printGenerically = function(ast) {
49861
49861
  if (!ast) {
@@ -49863,26 +49863,26 @@ var require_printer = __commonJS({
49863
49863
  }
49864
49864
  function printGenerically(path7) {
49865
49865
  return comments_1.printComments(path7, function(path8) {
49866
- return genericPrint(path8, config38, {
49866
+ return genericPrint(path8, config48, {
49867
49867
  includeComments: true,
49868
49868
  avoidRootParens: false
49869
49869
  }, printGenerically);
49870
49870
  });
49871
49871
  }
49872
49872
  var path6 = fast_path_1.default.from(ast);
49873
- var oldReuseWhitespace = config38.reuseWhitespace;
49874
- config38.reuseWhitespace = false;
49875
- var pr = new PrintResult(printGenerically(path6).toString(config38));
49876
- config38.reuseWhitespace = oldReuseWhitespace;
49873
+ var oldReuseWhitespace = config48.reuseWhitespace;
49874
+ config48.reuseWhitespace = false;
49875
+ var pr = new PrintResult(printGenerically(path6).toString(config48));
49876
+ config48.reuseWhitespace = oldReuseWhitespace;
49877
49877
  return pr;
49878
49878
  };
49879
49879
  };
49880
49880
  exports2.Printer = Printer;
49881
- function genericPrint(path6, config38, options, printPath) {
49881
+ function genericPrint(path6, config48, options, printPath) {
49882
49882
  assert_1.default.ok(path6 instanceof fast_path_1.default);
49883
49883
  var node = path6.getValue();
49884
49884
  var parts = [];
49885
- var linesWithoutParens = genericPrintNoParens(path6, config38, printPath);
49885
+ var linesWithoutParens = genericPrintNoParens(path6, config48, printPath);
49886
49886
  if (!node || linesWithoutParens.isEmpty()) {
49887
49887
  return linesWithoutParens;
49888
49888
  }
@@ -69380,33 +69380,33 @@ var inputPrompt = async (promptConfig) => {
69380
69380
  }
69381
69381
  return input;
69382
69382
  };
69383
- var renderSubmit = (config38, value) => {
69384
- const { question, label } = config38;
69385
- if (config38.type !== "confirm" && !value) {
69383
+ var renderSubmit = (config48, value) => {
69384
+ const { question, label } = config48;
69385
+ if (config48.type !== "confirm" && !value) {
69386
69386
  return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
69387
69387
  }
69388
- const content = config38.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69388
+ const content = config48.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69389
69389
  return [`${leftT} ${question}`, content, `${grayBar}`];
69390
69390
  };
69391
- var getRenderers = (config38) => {
69392
- switch (config38.type) {
69391
+ var getRenderers = (config48) => {
69392
+ switch (config48.type) {
69393
69393
  case "select":
69394
- return getSelectRenderers(config38);
69394
+ return getSelectRenderers(config48);
69395
69395
  case "confirm":
69396
- return getConfirmRenderers(config38);
69396
+ return getConfirmRenderers(config48);
69397
69397
  case "text":
69398
- return getTextRenderers(config38);
69398
+ return getTextRenderers(config48);
69399
69399
  case "multiselect":
69400
- return getSelectRenderers(config38);
69400
+ return getSelectRenderers(config48);
69401
69401
  case "list":
69402
- return getSelectListRenderers(config38);
69402
+ return getSelectListRenderers(config48);
69403
69403
  }
69404
69404
  };
69405
- var getTextRenderers = (config38) => {
69406
- const { question } = config38;
69407
- const helpText = config38.helpText ?? "";
69408
- const format5 = config38.format ?? ((val) => String(val));
69409
- const defaultValue = config38.defaultValue?.toString() ?? "";
69405
+ var getTextRenderers = (config48) => {
69406
+ const { question } = config48;
69407
+ const helpText = config48.helpText ?? "";
69408
+ const format5 = config48.format ?? ((val) => String(val));
69409
+ const defaultValue = config48.defaultValue?.toString() ?? "";
69410
69410
  const activeRenderer = ({ value }) => [
69411
69411
  `${blCorner} ${bold(question)} ${dim(helpText)}`,
69412
69412
  `${space(2)}${format5(value || dim(defaultValue))}`,
@@ -69429,14 +69429,14 @@ var getTextRenderers = (config38) => {
69429
69429
  ``
69430
69430
  // extra line for readability
69431
69431
  ],
69432
- submit: ({ value }) => renderSubmit(config38, format5(value ?? "")),
69432
+ submit: ({ value }) => renderSubmit(config48, format5(value ?? "")),
69433
69433
  cancel: activeRenderer
69434
69434
  };
69435
69435
  };
69436
- var getSelectRenderers = (config38) => {
69437
- const { options, question, helpText: _helpText } = config38;
69436
+ var getSelectRenderers = (config48) => {
69437
+ const { options, question, helpText: _helpText } = config48;
69438
69438
  const helpText = _helpText ?? "";
69439
- const maxItemsPerPage = config38.maxItemsPerPage ?? 32;
69439
+ const maxItemsPerPage = config48.maxItemsPerPage ?? 32;
69440
69440
  const defaultRenderer = ({ cursor = 0, value }) => {
69441
69441
  const renderOption = (opt, i) => {
69442
69442
  const { label: optionLabel, value: optionValue } = opt;
@@ -69511,21 +69511,21 @@ ${space(2)}${dim("...")}` : ""}`,
69511
69511
  submit: ({ value }) => {
69512
69512
  if (Array.isArray(value)) {
69513
69513
  return renderSubmit(
69514
- config38,
69514
+ config48,
69515
69515
  options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
69516
69516
  );
69517
69517
  }
69518
69518
  return renderSubmit(
69519
- config38,
69519
+ config48,
69520
69520
  options.find((o) => o.value === value)?.label
69521
69521
  );
69522
69522
  },
69523
69523
  cancel: defaultRenderer
69524
69524
  };
69525
69525
  };
69526
- var getSelectListRenderers = (config38) => {
69527
- const { question, helpText: _helpText } = config38;
69528
- let options = config38.options;
69526
+ var getSelectListRenderers = (config48) => {
69527
+ const { question, helpText: _helpText } = config48;
69528
+ let options = config48.options;
69529
69529
  const helpText = _helpText ?? "";
69530
69530
  const { rows } = stdout;
69531
69531
  const defaultRenderer = ({ cursor, value }, prompt) => {
@@ -69606,20 +69606,20 @@ var getSelectListRenderers = (config38) => {
69606
69606
  submit: ({ value }) => {
69607
69607
  if (Array.isArray(value)) {
69608
69608
  return renderSubmit(
69609
- config38,
69609
+ config48,
69610
69610
  options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
69611
69611
  );
69612
69612
  }
69613
69613
  return renderSubmit(
69614
- config38,
69614
+ config48,
69615
69615
  options.find((o) => o.value === value)?.value
69616
69616
  );
69617
69617
  },
69618
69618
  cancel: defaultRenderer
69619
69619
  };
69620
69620
  };
69621
- var getConfirmRenderers = (config38) => {
69622
- const { activeText, inactiveText, question, helpText: _helpText } = config38;
69621
+ var getConfirmRenderers = (config48) => {
69622
+ const { activeText, inactiveText, question, helpText: _helpText } = config48;
69623
69623
  const helpText = _helpText ?? "";
69624
69624
  const active = activeText || "Yes";
69625
69625
  const inactive = inactiveText || "No";
@@ -69636,7 +69636,7 @@ var getConfirmRenderers = (config38) => {
69636
69636
  active: defaultRenderer,
69637
69637
  confirm: defaultRenderer,
69638
69638
  error: defaultRenderer,
69639
- submit: ({ value }) => renderSubmit(config38, value ? "yes" : "no"),
69639
+ submit: ({ value }) => renderSubmit(config48, value ? "yes" : "no"),
69640
69640
  cancel: defaultRenderer
69641
69641
  };
69642
69642
  };
@@ -70604,23 +70604,23 @@ var YargsParser = class {
70604
70604
  const configPath = argv2[configKey] || configLookup[configKey];
70605
70605
  if (configPath) {
70606
70606
  try {
70607
- let config38 = null;
70607
+ let config48 = null;
70608
70608
  const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
70609
70609
  const resolveConfig = flags.configs[configKey];
70610
70610
  if (typeof resolveConfig === "function") {
70611
70611
  try {
70612
- config38 = resolveConfig(resolvedConfigPath);
70612
+ config48 = resolveConfig(resolvedConfigPath);
70613
70613
  } catch (e) {
70614
- config38 = e;
70614
+ config48 = e;
70615
70615
  }
70616
- if (config38 instanceof Error) {
70617
- error2 = config38;
70616
+ if (config48 instanceof Error) {
70617
+ error2 = config48;
70618
70618
  return;
70619
70619
  }
70620
70620
  } else {
70621
- config38 = mixin2.require(resolvedConfigPath);
70621
+ config48 = mixin2.require(resolvedConfigPath);
70622
70622
  }
70623
- setConfigObject(config38);
70623
+ setConfigObject(config48);
70624
70624
  } catch (ex) {
70625
70625
  if (ex.name === "PermissionDenied")
70626
70626
  error2 = ex;
@@ -70630,9 +70630,9 @@ var YargsParser = class {
70630
70630
  }
70631
70631
  });
70632
70632
  }
70633
- function setConfigObject(config38, prev) {
70634
- Object.keys(config38).forEach(function(key) {
70635
- const value = config38[key];
70633
+ function setConfigObject(config48, prev) {
70634
+ Object.keys(config48).forEach(function(key) {
70635
+ const value = config48[key];
70636
70636
  const fullKey = prev ? prev + "." + key : key;
70637
70637
  if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
70638
70638
  setConfigObject(value, fullKey);
@@ -71784,11 +71784,11 @@ var CommandInstance = class {
71784
71784
  });
71785
71785
  if (!unparsed.length)
71786
71786
  return;
71787
- const config38 = Object.assign({}, options.configuration, {
71787
+ const config48 = Object.assign({}, options.configuration, {
71788
71788
  "populate--": false
71789
71789
  });
71790
71790
  const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
71791
- configuration: config38
71791
+ configuration: config48
71792
71792
  }));
71793
71793
  if (parsed.error) {
71794
71794
  yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
@@ -73011,31 +73011,31 @@ ${customMsgs.join("\n")}` : "";
73011
73011
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
73012
73012
  var previouslyVisitedConfigs = [];
73013
73013
  var shim2;
73014
- function applyExtends(config38, cwd, mergeExtends, _shim) {
73014
+ function applyExtends(config48, cwd, mergeExtends, _shim) {
73015
73015
  shim2 = _shim;
73016
73016
  let defaultConfig = {};
73017
- if (Object.prototype.hasOwnProperty.call(config38, "extends")) {
73018
- if (typeof config38.extends !== "string")
73017
+ if (Object.prototype.hasOwnProperty.call(config48, "extends")) {
73018
+ if (typeof config48.extends !== "string")
73019
73019
  return defaultConfig;
73020
- const isPath = /\.json|\..*rc$/.test(config38.extends);
73020
+ const isPath = /\.json|\..*rc$/.test(config48.extends);
73021
73021
  let pathToDefault = null;
73022
73022
  if (!isPath) {
73023
73023
  try {
73024
- pathToDefault = require.resolve(config38.extends);
73024
+ pathToDefault = require.resolve(config48.extends);
73025
73025
  } catch (_err) {
73026
- return config38;
73026
+ return config48;
73027
73027
  }
73028
73028
  } else {
73029
- pathToDefault = getPathToDefaultConfig(cwd, config38.extends);
73029
+ pathToDefault = getPathToDefaultConfig(cwd, config48.extends);
73030
73030
  }
73031
73031
  checkForCircularExtends(pathToDefault);
73032
73032
  previouslyVisitedConfigs.push(pathToDefault);
73033
- defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config38.extends);
73034
- delete config38.extends;
73033
+ defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config48.extends);
73034
+ delete config48.extends;
73035
73035
  defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
73036
73036
  }
73037
73037
  previouslyVisitedConfigs = [];
73038
- return mergeExtends ? mergeDeep(defaultConfig, config38) : Object.assign({}, defaultConfig, config38);
73038
+ return mergeExtends ? mergeDeep(defaultConfig, config48) : Object.assign({}, defaultConfig, config48);
73039
73039
  }
73040
73040
  function checkForCircularExtends(cfgPath) {
73041
73041
  if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
@@ -73811,9 +73811,9 @@ var YargsInstance = class {
73811
73811
  }
73812
73812
  return maybePromise;
73813
73813
  }
73814
- parserConfiguration(config38) {
73815
- argsert("<object>", [config38], arguments.length);
73816
- __classPrivateFieldSet(this, _YargsInstance_parserConfig, config38, "f");
73814
+ parserConfiguration(config48) {
73815
+ argsert("<object>", [config48], arguments.length);
73816
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config48, "f");
73817
73817
  return this;
73818
73818
  }
73819
73819
  pkgConf(key, rootPath) {
@@ -73985,9 +73985,9 @@ var YargsInstance = class {
73985
73985
  return this;
73986
73986
  }
73987
73987
  }
73988
- usageConfiguration(config38) {
73989
- argsert("<object>", [config38], arguments.length);
73990
- __classPrivateFieldSet(this, _YargsInstance_usageConfig, config38, "f");
73988
+ usageConfiguration(config48) {
73989
+ argsert("<object>", [config48], arguments.length);
73990
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config48, "f");
73991
73991
  return this;
73992
73992
  }
73993
73993
  version(opt, msg, ver) {
@@ -74393,11 +74393,11 @@ var YargsInstance = class {
74393
74393
  __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
74394
74394
  __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
74395
74395
  const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
74396
- const config38 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74396
+ const config48 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74397
74397
  "populate--": true
74398
74398
  });
74399
74399
  const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
74400
- configuration: { "parse-positional-numbers": false, ...config38 }
74400
+ configuration: { "parse-positional-numbers": false, ...config48 }
74401
74401
  }));
74402
74402
  const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
74403
74403
  let argvPromise = void 0;
@@ -74560,7 +74560,7 @@ var Yargs = YargsFactory(esm_default);
74560
74560
  var yargs_default = Yargs;
74561
74561
 
74562
74562
  // package.json
74563
- var version = "0.0.0-ad774e49b";
74563
+ var version = "0.0.0-adc4941be";
74564
74564
 
74565
74565
  // src/metrics.ts
74566
74566
  var import_node_async_hooks = require("node:async_hooks");
@@ -74604,12 +74604,12 @@ function getGlobalWranglerConfigPath() {
74604
74604
  }
74605
74605
 
74606
74606
  // src/helpers/metrics-config.ts
74607
- function writeMetricsConfig(config38) {
74607
+ function writeMetricsConfig(config48) {
74608
74608
  (0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
74609
74609
  (0, import_node_fs2.writeFileSync)(
74610
74610
  getMetricsConfigPath(),
74611
74611
  JSON.stringify(
74612
- config38,
74612
+ config48,
74613
74613
  (_key, value) => value instanceof Date ? value.toISOString() : value,
74614
74614
  " "
74615
74615
  )
@@ -74617,9 +74617,9 @@ function writeMetricsConfig(config38) {
74617
74617
  }
74618
74618
  function readMetricsConfig() {
74619
74619
  try {
74620
- const config38 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
74620
+ const config48 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
74621
74621
  return JSON.parse(
74622
- config38,
74622
+ config48,
74623
74623
  (key, value) => key === "date" ? new Date(value) : value
74624
74624
  );
74625
74625
  } catch {
@@ -74629,10 +74629,10 @@ function readMetricsConfig() {
74629
74629
  function getMetricsConfigPath() {
74630
74630
  return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
74631
74631
  }
74632
- function getDeviceId(config38) {
74633
- const deviceId = config38.deviceId ?? (0, import_node_crypto.randomUUID)();
74634
- if (config38.deviceId === void 0) {
74635
- writeMetricsConfig({ ...config38, deviceId });
74632
+ function getDeviceId(config48) {
74633
+ const deviceId = config48.deviceId ?? (0, import_node_crypto.randomUUID)();
74634
+ if (config48.deviceId === void 0) {
74635
+ writeMetricsConfig({ ...config48, deviceId });
74636
74636
  }
74637
74637
  return deviceId;
74638
74638
  }
@@ -74817,7 +74817,7 @@ var detectPackageManager = () => {
74817
74817
  }
74818
74818
  };
74819
74819
  var rectifyPmMismatch = async (ctx) => {
74820
- const { npm: npm24 } = detectPackageManager();
74820
+ const { npm: npm25 } = detectPackageManager();
74821
74821
  if (!detectPmMismatch(ctx)) {
74822
74822
  return;
74823
74823
  }
@@ -74829,17 +74829,17 @@ var rectifyPmMismatch = async (ctx) => {
74829
74829
  if ((0, import_fs5.existsSync)(lockfilePath)) {
74830
74830
  (0, import_fs5.rmSync)(lockfilePath);
74831
74831
  }
74832
- await runCommand([npm24, "install"], {
74832
+ await runCommand([npm25, "install"], {
74833
74833
  silent: true,
74834
74834
  cwd: ctx.project.path,
74835
74835
  startText: "Installing dependencies",
74836
- doneText: `${brandColor("installed")} ${dim(`via \`${npm24} install\``)}`
74836
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
74837
74837
  });
74838
74838
  };
74839
74839
  var detectPmMismatch = (ctx) => {
74840
- const { npm: npm24 } = detectPackageManager();
74840
+ const { npm: npm25 } = detectPackageManager();
74841
74841
  const projectPath = ctx.project.path;
74842
- switch (npm24) {
74842
+ switch (npm25) {
74843
74843
  case "npm":
74844
74844
  return false;
74845
74845
  case "yarn":
@@ -74892,8 +74892,8 @@ function promiseWithResolvers() {
74892
74892
  return { resolve: resolve12, reject, promise };
74893
74893
  }
74894
74894
  function getPlatform() {
74895
- const platform3 = process.platform;
74896
- switch (platform3) {
74895
+ const platform = process.platform;
74896
+ switch (platform) {
74897
74897
  case "win32":
74898
74898
  return "Windows";
74899
74899
  case "darwin":
@@ -74901,18 +74901,18 @@ function getPlatform() {
74901
74901
  case "linux":
74902
74902
  return "Linux";
74903
74903
  default:
74904
- return `Others: ${platform3}`;
74904
+ return `Others: ${platform}`;
74905
74905
  }
74906
74906
  }
74907
74907
  function createReporter() {
74908
74908
  const events = [];
74909
74909
  const als = new import_node_async_hooks.AsyncLocalStorage();
74910
- const config38 = readMetricsConfig() ?? {};
74911
- const isFirstUsage = config38.c3permission === void 0;
74910
+ const config48 = readMetricsConfig() ?? {};
74911
+ const isFirstUsage = config48.c3permission === void 0;
74912
74912
  const isEnabled = isTelemetryEnabled();
74913
- const deviceId = getDeviceId(config38);
74913
+ const deviceId = getDeviceId(config48);
74914
74914
  const packageManager = detectPackageManager();
74915
- const platform3 = getPlatform();
74915
+ const platform = getPlatform();
74916
74916
  const amplitude_session_id = Date.now();
74917
74917
  const enableLog = process.env.CREATE_CLOUDFLARE_TELEMETRY_DEBUG === "1";
74918
74918
  let amplitude_event_id = 0;
@@ -74928,7 +74928,7 @@ function createReporter() {
74928
74928
  properties: {
74929
74929
  amplitude_session_id,
74930
74930
  amplitude_event_id: amplitude_event_id++,
74931
- platform: platform3,
74931
+ platform,
74932
74932
  c3Version: version,
74933
74933
  isFirstUsage,
74934
74934
  packageManager: packageManager.name,
@@ -74943,7 +74943,7 @@ function createReporter() {
74943
74943
  if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
74944
74944
  return false;
74945
74945
  }
74946
- return hasSparrowSourceKey() && getC3Permission(config38).enabled;
74946
+ return hasSparrowSourceKey() && getC3Permission(config48).enabled;
74947
74947
  }
74948
74948
  async function waitForAllEventsSettled() {
74949
74949
  await Promise.allSettled(events);
@@ -75049,20 +75049,20 @@ function initializeC3Permission(enabled = true) {
75049
75049
  date: /* @__PURE__ */ new Date()
75050
75050
  };
75051
75051
  }
75052
- function getC3Permission(config38 = readMetricsConfig() ?? {}) {
75053
- if (!config38.c3permission) {
75054
- config38.c3permission = initializeC3Permission();
75055
- writeMetricsConfig(config38);
75052
+ function getC3Permission(config48 = readMetricsConfig() ?? {}) {
75053
+ if (!config48.c3permission) {
75054
+ config48.c3permission = initializeC3Permission();
75055
+ writeMetricsConfig(config48);
75056
75056
  }
75057
- return config38.c3permission;
75057
+ return config48.c3permission;
75058
75058
  }
75059
75059
  function updateC3Pemission(enabled) {
75060
- const config38 = readMetricsConfig();
75061
- if (config38.c3permission?.enabled === enabled) {
75060
+ const config48 = readMetricsConfig();
75061
+ if (config48.c3permission?.enabled === enabled) {
75062
75062
  return;
75063
75063
  }
75064
- config38.c3permission = initializeC3Permission(enabled);
75065
- writeMetricsConfig(config38);
75064
+ config48.c3permission = initializeC3Permission(enabled);
75065
+ writeMetricsConfig(config48);
75066
75066
  }
75067
75067
  var runTelemetryCommand = (action) => {
75068
75068
  const logTelemetryStatus = (enabled) => {
@@ -75107,39 +75107,39 @@ var import_haikunator = __toESM(require_dist_web());
75107
75107
  var import_fs6 = require("fs");
75108
75108
  var import_path6 = __toESM(require("path"));
75109
75109
  var import_undici2 = __toESM(require_undici());
75110
- var installPackages = async (packages, config38 = {}) => {
75111
- const { npm: npm24 } = detectPackageManager();
75110
+ var installPackages = async (packages, config48 = {}) => {
75111
+ const { npm: npm25 } = detectPackageManager();
75112
75112
  let saveFlag;
75113
75113
  let cmd;
75114
- switch (npm24) {
75114
+ switch (npm25) {
75115
75115
  case "yarn":
75116
75116
  cmd = "add";
75117
- saveFlag = config38.dev ? "-D" : "";
75117
+ saveFlag = config48.dev ? "-D" : "";
75118
75118
  break;
75119
75119
  case "bun":
75120
75120
  cmd = "add";
75121
- saveFlag = config38.dev ? "-d" : "";
75121
+ saveFlag = config48.dev ? "-d" : "";
75122
75122
  break;
75123
75123
  case "npm":
75124
75124
  case "pnpm":
75125
75125
  default:
75126
75126
  cmd = "install";
75127
- saveFlag = config38.dev ? "--save-dev" : "";
75127
+ saveFlag = config48.dev ? "--save-dev" : "";
75128
75128
  break;
75129
75129
  }
75130
75130
  await runCommand(
75131
75131
  [
75132
- npm24,
75132
+ npm25,
75133
75133
  cmd,
75134
75134
  ...saveFlag ? [saveFlag] : [],
75135
75135
  ...packages,
75136
75136
  // Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
75137
75137
  // frameworks that haven't updated their peer dependency for Wrangler v4
75138
75138
  // TODO: Remove this once Wrangler v4 has been released and framework templates are updated
75139
- ...npm24 === "npm" ? ["--legacy-peer-deps"] : []
75139
+ ...npm25 === "npm" ? ["--legacy-peer-deps"] : []
75140
75140
  ],
75141
75141
  {
75142
- ...config38,
75142
+ ...config48,
75143
75143
  silent: true
75144
75144
  }
75145
75145
  );
@@ -75149,16 +75149,16 @@ var npmInstall = async (ctx) => {
75149
75149
  if ((0, import_fs6.existsSync)(nodeModulesPath)) {
75150
75150
  return;
75151
75151
  }
75152
- const { npm: npm24 } = detectPackageManager();
75152
+ const { npm: npm25 } = detectPackageManager();
75153
75153
  await runCommand(
75154
75154
  // Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
75155
75155
  // frameworks that haven't updated their peer dependency for Wrangler v4
75156
75156
  // TODO: Remove this once Wrangler v4 has been released and framework templates are updated
75157
- [npm24, "install", ...npm24 === "npm" ? ["--legacy-peer-deps"] : []],
75157
+ [npm25, "install", ...npm25 === "npm" ? ["--legacy-peer-deps"] : []],
75158
75158
  {
75159
75159
  silent: true,
75160
75160
  startText: "Installing dependencies",
75161
- doneText: `${brandColor("installed")} ${dim(`via \`${npm24} install\``)}`
75161
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
75162
75162
  }
75163
75163
  );
75164
75164
  };
@@ -75168,14 +75168,14 @@ async function getLatestPackageVersion(packageSpecifier) {
75168
75168
  return npmInfo["dist-tags"].latest;
75169
75169
  }
75170
75170
  var installWrangler = async () => {
75171
- const { npm: npm24 } = detectPackageManager();
75171
+ const { npm: npm25 } = detectPackageManager();
75172
75172
  await installPackages([`wrangler@latest`], {
75173
75173
  dev: true,
75174
75174
  startText: `Installing wrangler ${dim(
75175
75175
  "A command line tool for building Cloudflare Workers"
75176
75176
  )}`,
75177
75177
  doneText: `${brandColor("installed")} ${dim(
75178
- `via \`${npm24} install wrangler --save-dev\``
75178
+ `via \`${npm25} install wrangler --save-dev\``
75179
75179
  )}`
75180
75180
  });
75181
75181
  };
@@ -75335,20 +75335,21 @@ var package_default = {
75335
75335
  "so that we can use dependabot to update these dependencies automatically."
75336
75336
  ],
75337
75337
  dependencies: {
75338
- "create-astro": "4.11.0",
75338
+ "create-astro": "4.11.4",
75339
75339
  "create-analog": "1.8.1",
75340
- "@angular/create": "19.1.6",
75340
+ "@angular/create": "19.2.12",
75341
75341
  "create-docusaurus": "3.7.0",
75342
- "create-hono": "0.15.3",
75343
- "create-next-app": "15.2.1",
75344
- "create-qwik": "1.12.0",
75345
- "create-vite": "6.1.1",
75346
- "create-remix": "2.15.3",
75347
- "create-solid": "0.6.1",
75348
- "create-vue": "3.14.2",
75349
- gatsby: "5.14.1",
75350
- sv: "0.6.23",
75351
- nuxi: "3.21.1"
75342
+ "create-hono": "0.19.1",
75343
+ "create-next-app": "15.3.2",
75344
+ "create-qwik": "1.13.0",
75345
+ "create-vite": "6.5.0",
75346
+ "create-remix": "2.16.6",
75347
+ "create-react-router": "7.6.0",
75348
+ "create-solid": "0.6.2",
75349
+ "create-vue": "3.16.4",
75350
+ gatsby: "5.14.3",
75351
+ sv: "0.8.6",
75352
+ nuxi: "3.25.1"
75352
75353
  }
75353
75354
  };
75354
75355
 
@@ -75363,9 +75364,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
75363
75364
  };
75364
75365
  var runFrameworkGenerator = async (ctx, args) => {
75365
75366
  const cli = getFrameworkCli(ctx, true);
75366
- const { npm: npm24, dlx } = detectPackageManager();
75367
- const cmd = [...npm24 === "yarn" ? ["npx"] : dlx, cli, ...args];
75368
- const env3 = npm24 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
75367
+ const { npm: npm25, dlx } = detectPackageManager();
75368
+ const cmd = [...npm25 === "yarn" ? ["npx"] : dlx, cli, ...args];
75369
+ const env3 = npm25 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
75369
75370
  if (ctx.args.additionalArgs?.length) {
75370
75371
  cmd.push(...ctx.args.additionalArgs);
75371
75372
  }
@@ -75378,63 +75379,6 @@ var runFrameworkGenerator = async (ctx, args) => {
75378
75379
  await runCommand(cmd, { env: env3 });
75379
75380
  };
75380
75381
 
75381
- // templates-experimental/next/c3.ts
75382
- var generate = async (ctx) => {
75383
- await runFrameworkGenerator(ctx, [ctx.project.name]);
75384
- };
75385
- var configure = async (ctx) => {
75386
- const packages = [
75387
- "@opennextjs/cloudflare@0.5.x",
75388
- "@cloudflare/workers-types"
75389
- ];
75390
- await installPackages(packages, {
75391
- dev: true,
75392
- startText: "Adding the Cloudflare adapter",
75393
- doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
75394
- });
75395
- const usesTs = usesTypescript(ctx);
75396
- updateNextConfig(usesTs);
75397
- };
75398
- var updateNextConfig = (usesTs) => {
75399
- const s = spinner();
75400
- const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
75401
- s.start(`Updating \`${configFile}\``);
75402
- const configContent = readFile(configFile);
75403
- const updatedConfigFile = configContent + `
75404
- // added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
75405
- import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
75406
- initOpenNextCloudflareForDev();
75407
- `.replace(/\n\t*/g, "\n");
75408
- writeFile2(configFile, updatedConfigFile);
75409
- s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
75410
- };
75411
- var c3_default = {
75412
- configVersion: 1,
75413
- id: "next",
75414
- frameworkCli: "create-next-app",
75415
- // TODO: Stop using a pinned version when the template graduates.
75416
- frameworkCliPinnedVersion: "~15.2.2",
75417
- platform: "workers",
75418
- displayName: "Next.js (using Node.js compat + Workers Assets)",
75419
- path: "templates-experimental/next",
75420
- copyFiles: {
75421
- path: "./templates"
75422
- },
75423
- generate,
75424
- configure,
75425
- transformPackageJson: async () => ({
75426
- scripts: {
75427
- deploy: `opennextjs-cloudflare && wrangler deploy`,
75428
- preview: `opennextjs-cloudflare && wrangler dev`,
75429
- "cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
75430
- }
75431
- }),
75432
- devScript: "dev",
75433
- previewScript: "preview",
75434
- deployScript: "deploy",
75435
- compatibilityFlags: ["nodejs_compat"]
75436
- };
75437
-
75438
75382
  // src/helpers/codemod.ts
75439
75383
  var import_fs8 = require("fs");
75440
75384
  var import_path8 = __toESM(require("path"));
@@ -75510,117 +75454,6 @@ var getPropertyName = (newProp) => {
75510
75454
  return newProp.key.type === "Identifier" ? newProp.key.name : newProp.key.type === "StringLiteral" ? newProp.key.value : null;
75511
75455
  };
75512
75456
 
75513
- // templates-experimental/qwik/c3.ts
75514
- var recast2 = __toESM(require_main3());
75515
- var { npm, npx, name } = detectPackageManager();
75516
- var generate2 = async (ctx) => {
75517
- await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
75518
- };
75519
- var configure2 = async (ctx) => {
75520
- const cmd = [name === "pnpm" ? npm : npx, "qwik", "add", "cloudflare-pages"];
75521
- endSection(`Running ${quoteShellArgs(cmd)}`);
75522
- await runCommand(cmd);
75523
- removeFile("./public/_headers");
75524
- removeFile("./public/_redirects");
75525
- removeFile("./public/_routes.json");
75526
- addBindingsProxy(ctx);
75527
- populateCloudflareEnv();
75528
- };
75529
- var addBindingsProxy = (ctx) => {
75530
- if (!usesTypescript(ctx)) {
75531
- return;
75532
- }
75533
- const s = spinner();
75534
- s.start("Updating `vite.config.ts`");
75535
- const snippets = loadTemplateSnippets(ctx);
75536
- const b3 = recast2.types.builders;
75537
- transformFile("vite.config.ts", {
75538
- // Insert the env declaration after the last import (but before the rest of the body)
75539
- visitProgram: function(n) {
75540
- const lastImportIndex = n.node.body.findLastIndex(
75541
- (t2) => t2.type === "ImportDeclaration"
75542
- );
75543
- const lastImport = n.get("body", lastImportIndex);
75544
- lastImport.insertAfter(...snippets.getPlatformProxyTs);
75545
- return this.traverse(n);
75546
- },
75547
- // Pass the `platform` object from the declaration to the `qwikCity` plugin
75548
- visitCallExpression: function(n) {
75549
- const callee = n.node.callee;
75550
- if (callee.name !== "qwikCity") {
75551
- return this.traverse(n);
75552
- }
75553
- const configArgument = n.node.arguments[0];
75554
- const platformPropery = b3.objectProperty.from({
75555
- key: b3.identifier("platform"),
75556
- value: b3.identifier("platform"),
75557
- shorthand: true
75558
- });
75559
- if (!configArgument) {
75560
- n.node.arguments = [b3.objectExpression([platformPropery])];
75561
- return false;
75562
- }
75563
- if (configArgument.type !== "ObjectExpression") {
75564
- crash("Failed to update `vite.config.ts`");
75565
- }
75566
- configArgument.properties.push(platformPropery);
75567
- return false;
75568
- }
75569
- });
75570
- s.stop(`${brandColor("updated")} \`vite.config.ts\``);
75571
- };
75572
- var populateCloudflareEnv = () => {
75573
- const entrypointPath = "src/entry.cloudflare-pages.tsx";
75574
- const s = spinner();
75575
- s.start(`Updating \`${entrypointPath}\``);
75576
- transformFile(entrypointPath, {
75577
- visitTSInterfaceDeclaration: function(n) {
75578
- const b3 = recast2.types.builders;
75579
- const id = n.node.id;
75580
- if (id.name !== "QwikCityPlatform") {
75581
- this.traverse(n);
75582
- }
75583
- const newBody = [
75584
- ["env", "Env"]
75585
- // Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
75586
- // ["cf", "CfProperties"],
75587
- ].map(
75588
- ([varName, type]) => b3.tsPropertySignature(
75589
- b3.identifier(varName),
75590
- b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
75591
- )
75592
- );
75593
- n.node.body.body = newBody;
75594
- return false;
75595
- }
75596
- });
75597
- s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
75598
- };
75599
- var config = {
75600
- configVersion: 1,
75601
- id: "qwik",
75602
- frameworkCli: "create-qwik",
75603
- displayName: "Qwik",
75604
- platform: "workers",
75605
- copyFiles: {
75606
- path: "./templates"
75607
- },
75608
- path: "templates-experimental/qwik",
75609
- generate: generate2,
75610
- configure: configure2,
75611
- transformPackageJson: async () => ({
75612
- scripts: {
75613
- deploy: `${npm} run build && wrangler deploy`,
75614
- preview: `${npm} run build && wrangler dev`,
75615
- "cf-typegen": `wrangler types`
75616
- }
75617
- }),
75618
- devScript: "dev",
75619
- deployScript: "deploy",
75620
- previewScript: "preview"
75621
- };
75622
- var c3_default2 = config;
75623
-
75624
75457
  // src/helpers/compatDate.ts
75625
75458
  var import_fs9 = require("fs");
75626
75459
  var import_path9 = require("path");
@@ -75650,10 +75483,6 @@ async function getWorkerdCompatibilityDate() {
75650
75483
  );
75651
75484
  return fallbackDate;
75652
75485
  }
75653
- var compatDateFlag = async () => {
75654
- const workerdCompatDate = await getWorkerdCompatibilityDate();
75655
- return `--compatibility-date=${workerdCompatDate}`;
75656
- };
75657
75486
  function getLatestTypesEntrypoint(ctx) {
75658
75487
  const workersTypesPath = (0, import_path9.resolve)(
75659
75488
  ctx.project.path,
@@ -75674,18 +75503,18 @@ function getLatestTypesEntrypoint(ctx) {
75674
75503
  }
75675
75504
 
75676
75505
  // templates-experimental/solid/c3.ts
75677
- var recast3 = __toESM(require_main3());
75678
- var { npm: npm2 } = detectPackageManager();
75679
- var generate3 = async (ctx) => {
75506
+ var recast2 = __toESM(require_main3());
75507
+ var { npm } = detectPackageManager();
75508
+ var generate = async (ctx) => {
75680
75509
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
75681
75510
  logRaw("");
75682
75511
  };
75683
- var configure3 = async (ctx) => {
75512
+ var configure = async (ctx) => {
75684
75513
  const packages = ["nitropack"];
75685
75514
  await installPackages(packages, {
75686
75515
  dev: true,
75687
75516
  startText: "Installing nitro module `nitropack`",
75688
- doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
75517
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
75689
75518
  });
75690
75519
  usesTypescript(ctx);
75691
75520
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
@@ -75697,7 +75526,7 @@ var configure3 = async (ctx) => {
75697
75526
  if (callee.name !== "defineConfig") {
75698
75527
  return this.traverse(n);
75699
75528
  }
75700
- const b3 = recast3.types.builders;
75529
+ const b3 = recast2.types.builders;
75701
75530
  mergeObjectProperties(
75702
75531
  n.node.arguments[0],
75703
75532
  [
@@ -75721,7 +75550,7 @@ var configure3 = async (ctx) => {
75721
75550
  }
75722
75551
  });
75723
75552
  };
75724
- var config2 = {
75553
+ var config = {
75725
75554
  configVersion: 1,
75726
75555
  id: "solid",
75727
75556
  frameworkCli: "create-solid",
@@ -75731,25 +75560,25 @@ var config2 = {
75731
75560
  path: "./templates"
75732
75561
  },
75733
75562
  path: "templates-experimental/solid",
75734
- generate: generate3,
75735
- configure: configure3,
75563
+ generate,
75564
+ configure,
75736
75565
  transformPackageJson: async () => ({
75737
75566
  scripts: {
75738
- preview: `${npm2} run build && npx wrangler dev`,
75739
- deploy: `${npm2} run build && wrangler deploy`
75567
+ preview: `${npm} run build && npx wrangler dev`,
75568
+ deploy: `${npm} run build && wrangler deploy`,
75569
+ "cf-typegen": `wrangler types`
75740
75570
  }
75741
75571
  }),
75742
- compatibilityFlags: ["nodejs_compat"],
75743
75572
  devScript: "dev",
75744
75573
  deployScript: "deploy",
75745
75574
  previewScript: "preview"
75746
75575
  };
75747
- var c3_default3 = config2;
75576
+ var c3_default = config;
75748
75577
 
75749
75578
  // templates/analog/c3.ts
75750
- var recast4 = __toESM(require_main3());
75751
- var { npm: npm3, name: pm } = detectPackageManager();
75752
- var generate4 = async (ctx) => {
75579
+ var recast3 = __toESM(require_main3());
75580
+ var { npm: npm2, name: pm } = detectPackageManager();
75581
+ var generate2 = async (ctx) => {
75753
75582
  await runFrameworkGenerator(ctx, [
75754
75583
  ctx.project.name,
75755
75584
  "--template",
@@ -75757,7 +75586,7 @@ var generate4 = async (ctx) => {
75757
75586
  ]);
75758
75587
  logRaw("");
75759
75588
  };
75760
- var configure4 = async (ctx) => {
75589
+ var configure2 = async (ctx) => {
75761
75590
  if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
75762
75591
  const packages = [];
75763
75592
  packages.push("nitropack");
@@ -75767,28 +75596,13 @@ var configure4 = async (ctx) => {
75767
75596
  await installPackages(packages, {
75768
75597
  dev: true,
75769
75598
  startText: `Installing ${packages.join(", ")}`,
75770
- doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
75599
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
75771
75600
  });
75772
75601
  }
75773
75602
  updateViteConfig(ctx);
75774
- updateEnvTypes(ctx);
75775
- };
75776
- var updateEnvTypes = (ctx) => {
75777
- const filepath = "env.d.ts";
75778
- const s = spinner();
75779
- s.start(`Updating ${filepath}`);
75780
- let file = readFile(filepath);
75781
- let typesEntrypoint = `@cloudflare/workers-types`;
75782
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
75783
- if (latestEntrypoint) {
75784
- typesEntrypoint += `/${latestEntrypoint}`;
75785
- }
75786
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
75787
- writeFile2("env.d.ts", file);
75788
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
75789
75603
  };
75790
75604
  var updateViteConfig = (ctx) => {
75791
- const b3 = recast4.types.builders;
75605
+ const b3 = recast3.types.builders;
75792
75606
  const s = spinner();
75793
75607
  const configFile = "vite.config.ts";
75794
75608
  s.start(`Updating \`${configFile}\``);
@@ -75825,7 +75639,7 @@ var updateViteConfig = (ctx) => {
75825
75639
  });
75826
75640
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
75827
75641
  };
75828
- var config3 = {
75642
+ var config2 = {
75829
75643
  configVersion: 1,
75830
75644
  id: "analog",
75831
75645
  frameworkCli: "create-analog",
@@ -75834,12 +75648,12 @@ var config3 = {
75834
75648
  copyFiles: {
75835
75649
  path: "./templates"
75836
75650
  },
75837
- generate: generate4,
75838
- configure: configure4,
75651
+ generate: generate2,
75652
+ configure: configure2,
75839
75653
  transformPackageJson: async () => ({
75840
75654
  scripts: {
75841
- preview: `${npm3} run build && wrangler pages dev`,
75842
- deploy: `${npm3} run build && wrangler pages deploy`,
75655
+ preview: `${npm2} run build && wrangler pages dev`,
75656
+ deploy: `${npm2} run build && wrangler pages deploy`,
75843
75657
  "cf-typegen": `wrangler types`
75844
75658
  }
75845
75659
  }),
@@ -75847,12 +75661,12 @@ var config3 = {
75847
75661
  deployScript: "deploy",
75848
75662
  previewScript: "preview"
75849
75663
  };
75850
- var c3_default4 = config3;
75664
+ var c3_default2 = config2;
75851
75665
 
75852
75666
  // templates/angular/pages/c3.ts
75853
75667
  var import_node_path3 = require("node:path");
75854
- var { npm: npm4 } = detectPackageManager();
75855
- var generate5 = async (ctx) => {
75668
+ var { npm: npm3 } = detectPackageManager();
75669
+ var generate3 = async (ctx) => {
75856
75670
  await runFrameworkGenerator(ctx, [
75857
75671
  ctx.project.name,
75858
75672
  "--ssr",
@@ -75860,7 +75674,7 @@ var generate5 = async (ctx) => {
75860
75674
  ]);
75861
75675
  logRaw("");
75862
75676
  };
75863
- var configure5 = async (ctx) => {
75677
+ var configure3 = async (ctx) => {
75864
75678
  updateAngularJson(ctx);
75865
75679
  await updateAppCode();
75866
75680
  await installCFWorker();
@@ -75869,7 +75683,7 @@ async function installCFWorker() {
75869
75683
  await installPackages(["xhr2"], {
75870
75684
  dev: true,
75871
75685
  startText: "Installing additional dependencies",
75872
- doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
75686
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
75873
75687
  });
75874
75688
  }
75875
75689
  async function updateAppCode() {
@@ -75911,12 +75725,13 @@ function updateAngularJson(ctx) {
75911
75725
  writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
75912
75726
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
75913
75727
  }
75914
- var config4 = {
75728
+ var config3 = {
75915
75729
  configVersion: 1,
75916
75730
  id: "angular",
75917
75731
  frameworkCli: "@angular/create",
75918
75732
  displayName: "Angular",
75919
75733
  platform: "pages",
75734
+ hidden: true,
75920
75735
  copyFiles: {
75921
75736
  path: "./templates"
75922
75737
  },
@@ -75924,23 +75739,24 @@ var config4 = {
75924
75739
  devScript: "start",
75925
75740
  deployScript: "deploy",
75926
75741
  previewScript: "start",
75927
- generate: generate5,
75928
- configure: configure5,
75742
+ generate: generate3,
75743
+ configure: configure3,
75929
75744
  transformPackageJson: async () => ({
75930
75745
  scripts: {
75931
- start: `${npm4} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
75932
- build: `ng build && ${npm4} run process`,
75746
+ start: `${npm3} run build && wrangler pages dev`,
75747
+ build: `ng build && ${npm3} run process`,
75933
75748
  process: "node ./tools/copy-files.mjs",
75934
- deploy: `${npm4} run build && wrangler pages deploy dist/cloudflare`
75749
+ deploy: `${npm3} run build && wrangler pages deploy`,
75750
+ "cf-typegen": `wrangler types`
75935
75751
  }
75936
75752
  })
75937
75753
  };
75938
- var c3_default5 = config4;
75754
+ var c3_default3 = config3;
75939
75755
 
75940
75756
  // templates/angular/workers/c3.ts
75941
75757
  var import_node_path4 = require("node:path");
75942
- var { npm: npm5 } = detectPackageManager();
75943
- var generate6 = async (ctx) => {
75758
+ var { npm: npm4 } = detectPackageManager();
75759
+ var generate4 = async (ctx) => {
75944
75760
  await runFrameworkGenerator(ctx, [
75945
75761
  ctx.project.name,
75946
75762
  "--ssr",
@@ -75948,7 +75764,7 @@ var generate6 = async (ctx) => {
75948
75764
  ]);
75949
75765
  logRaw("");
75950
75766
  };
75951
- var configure6 = async (ctx) => {
75767
+ var configure4 = async (ctx) => {
75952
75768
  updateAngularJson2(ctx);
75953
75769
  await updateAppCode2();
75954
75770
  await installCFWorker2();
@@ -75957,7 +75773,7 @@ async function installCFWorker2() {
75957
75773
  await installPackages(["xhr2"], {
75958
75774
  dev: true,
75959
75775
  startText: "Installing additional dependencies",
75960
- doneText: `${brandColor("installed")} ${dim(`via \`${npm5} install\``)}`
75776
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
75961
75777
  });
75962
75778
  }
75963
75779
  async function updateAppCode2() {
@@ -75998,7 +75814,7 @@ function updateAngularJson2(ctx) {
75998
75814
  writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
75999
75815
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
76000
75816
  }
76001
- var config5 = {
75817
+ var config4 = {
76002
75818
  configVersion: 1,
76003
75819
  id: "angular",
76004
75820
  frameworkCli: "@angular/create",
@@ -76011,38 +75827,39 @@ var config5 = {
76011
75827
  devScript: "start",
76012
75828
  deployScript: "deploy",
76013
75829
  previewScript: "start",
76014
- generate: generate6,
76015
- configure: configure6,
75830
+ generate: generate4,
75831
+ configure: configure4,
76016
75832
  transformPackageJson: async () => ({
76017
75833
  scripts: {
76018
- start: `${npm5} run build && wrangler dev`,
75834
+ start: `${npm4} run build && wrangler dev`,
76019
75835
  build: `ng build`,
76020
- deploy: `${npm5} run build && wrangler deploy`
75836
+ deploy: `${npm4} run build && wrangler deploy`,
75837
+ "cf-typegen": `wrangler types`
76021
75838
  }
76022
75839
  })
76023
75840
  };
76024
- var c3_default6 = config5;
75841
+ var c3_default4 = config4;
76025
75842
 
76026
75843
  // templates/angular/c3.ts
76027
- var config6 = {
75844
+ var config5 = {
76028
75845
  displayName: "Angular",
76029
- platformVariants: { pages: c3_default5, workers: c3_default6 }
75846
+ platformVariants: { pages: c3_default3, workers: c3_default4 }
76030
75847
  };
76031
- var c3_default7 = config6;
75848
+ var c3_default5 = config5;
76032
75849
 
76033
75850
  // templates/astro/pages/c3.ts
76034
- var recast5 = __toESM(require_main3());
76035
- var { npx: npx2 } = detectPackageManager();
76036
- var generate7 = async (ctx) => {
75851
+ var recast4 = __toESM(require_main3());
75852
+ var { npx } = detectPackageManager();
75853
+ var generate5 = async (ctx) => {
76037
75854
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
76038
75855
  logRaw("");
76039
75856
  };
76040
- var configure7 = async () => {
76041
- await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
75857
+ var configure5 = async () => {
75858
+ await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
76042
75859
  silent: true,
76043
75860
  startText: "Installing adapter",
76044
75861
  doneText: `${brandColor("installed")} ${dim(
76045
- `via \`${npx2} astro add cloudflare\``
75862
+ `via \`${npx} astro add cloudflare\``
76046
75863
  )}`
76047
75864
  });
76048
75865
  updateAstroConfig();
@@ -76056,7 +75873,7 @@ var updateAstroConfig = () => {
76056
75873
  if (callee.name !== "cloudflare") {
76057
75874
  return this.traverse(n);
76058
75875
  }
76059
- const b3 = recast5.types.builders;
75876
+ const b3 = recast4.types.builders;
76060
75877
  n.node.arguments = [
76061
75878
  b3.objectExpression([
76062
75879
  b3.objectProperty(
@@ -76071,11 +75888,12 @@ var updateAstroConfig = () => {
76071
75888
  }
76072
75889
  });
76073
75890
  };
76074
- var config7 = {
75891
+ var config6 = {
76075
75892
  configVersion: 1,
76076
75893
  id: "astro",
76077
75894
  frameworkCli: "create-astro",
76078
75895
  platform: "pages",
75896
+ hidden: true,
76079
75897
  displayName: "Astro",
76080
75898
  path: "templates/astro/pages",
76081
75899
  copyFiles: {
@@ -76094,8 +75912,8 @@ var config7 = {
76094
75912
  devScript: "dev",
76095
75913
  deployScript: "deploy",
76096
75914
  previewScript: "preview",
76097
- generate: generate7,
76098
- configure: configure7,
75915
+ generate: generate5,
75916
+ configure: configure5,
76099
75917
  transformPackageJson: async (pkgJson, ctx) => ({
76100
75918
  scripts: {
76101
75919
  deploy: `astro build && wrangler pages deploy`,
@@ -76104,21 +75922,21 @@ var config7 = {
76104
75922
  }
76105
75923
  })
76106
75924
  };
76107
- var c3_default8 = config7;
75925
+ var c3_default6 = config6;
76108
75926
 
76109
75927
  // templates/astro/workers/c3.ts
76110
- var recast6 = __toESM(require_main3());
76111
- var { npx: npx3 } = detectPackageManager();
76112
- var generate8 = async (ctx) => {
75928
+ var recast5 = __toESM(require_main3());
75929
+ var { npx: npx2 } = detectPackageManager();
75930
+ var generate6 = async (ctx) => {
76113
75931
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
76114
75932
  logRaw("");
76115
75933
  };
76116
- var configure8 = async () => {
76117
- await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
75934
+ var configure6 = async () => {
75935
+ await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
76118
75936
  silent: true,
76119
75937
  startText: "Installing adapter",
76120
75938
  doneText: `${brandColor("installed")} ${dim(
76121
- `via \`${npx3} astro add cloudflare\``
75939
+ `via \`${npx2} astro add cloudflare\``
76122
75940
  )}`
76123
75941
  });
76124
75942
  updateAstroConfig2();
@@ -76132,7 +75950,7 @@ var updateAstroConfig2 = () => {
76132
75950
  if (callee.name !== "cloudflare") {
76133
75951
  return this.traverse(n);
76134
75952
  }
76135
- const b3 = recast6.types.builders;
75953
+ const b3 = recast5.types.builders;
76136
75954
  n.node.arguments = [
76137
75955
  b3.objectExpression([
76138
75956
  b3.objectProperty(
@@ -76147,7 +75965,7 @@ var updateAstroConfig2 = () => {
76147
75965
  }
76148
75966
  });
76149
75967
  };
76150
- var config8 = {
75968
+ var config7 = {
76151
75969
  configVersion: 1,
76152
75970
  id: "astro",
76153
75971
  frameworkCli: "create-astro",
@@ -76170,8 +75988,8 @@ var config8 = {
76170
75988
  deployScript: "deploy",
76171
75989
  previewScript: "preview",
76172
75990
  path: "templates/astro/workers",
76173
- generate: generate8,
76174
- configure: configure8,
75991
+ generate: generate6,
75992
+ configure: configure6,
76175
75993
  transformPackageJson: async (pkgJson, ctx) => ({
76176
75994
  scripts: {
76177
75995
  deploy: `astro build && wrangler deploy`,
@@ -76180,17 +75998,17 @@ var config8 = {
76180
75998
  }
76181
75999
  })
76182
76000
  };
76183
- var c3_default9 = config8;
76001
+ var c3_default7 = config7;
76184
76002
 
76185
76003
  // templates/astro/c3.ts
76186
- var config9 = {
76004
+ var config8 = {
76187
76005
  displayName: "Astro",
76188
- platformVariants: { pages: c3_default8, workers: c3_default9 }
76006
+ platformVariants: { pages: c3_default6, workers: c3_default7 }
76189
76007
  };
76190
- var c3_default10 = config9;
76008
+ var c3_default8 = config8;
76191
76009
 
76192
76010
  // templates/common/c3.ts
76193
- var c3_default11 = {
76011
+ var config9 = {
76194
76012
  configVersion: 1,
76195
76013
  id: "common",
76196
76014
  displayName: "Example router & proxy Worker",
@@ -76208,10 +76026,11 @@ var c3_default11 = {
76208
76026
  }
76209
76027
  }
76210
76028
  };
76029
+ var c3_default9 = config9;
76211
76030
 
76212
76031
  // templates/docusaurus/pages/c3.ts
76213
- var { npm: npm6 } = detectPackageManager();
76214
- var generate9 = async (ctx) => {
76032
+ var { npm: npm5 } = detectPackageManager();
76033
+ var generate7 = async (ctx) => {
76215
76034
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
76216
76035
  };
76217
76036
  var config10 = {
@@ -76219,24 +76038,26 @@ var config10 = {
76219
76038
  id: "docusaurus",
76220
76039
  frameworkCli: "create-docusaurus",
76221
76040
  platform: "pages",
76041
+ hidden: true,
76222
76042
  displayName: "Docusaurus",
76223
76043
  path: "templates/docusaurus/pages",
76224
- generate: generate9,
76044
+ generate: generate7,
76225
76045
  transformPackageJson: async () => ({
76226
76046
  scripts: {
76227
- preview: `${npm6} run build && wrangler pages dev ./build`,
76228
- deploy: `${npm6} run build && wrangler pages deploy ./build`
76047
+ preview: `${npm5} run build && wrangler pages dev ./build`,
76048
+ deploy: `${npm5} run build && wrangler pages deploy ./build`
76229
76049
  }
76230
76050
  }),
76231
76051
  devScript: "preview",
76232
76052
  deployScript: "deploy",
76233
- previewScript: "preview"
76053
+ previewScript: "preview",
76054
+ workersTypes: "none"
76234
76055
  };
76235
- var c3_default12 = config10;
76056
+ var c3_default10 = config10;
76236
76057
 
76237
76058
  // templates/docusaurus/workers/c3.ts
76238
- var { npm: npm7 } = detectPackageManager();
76239
- var generate10 = async (ctx) => {
76059
+ var { npm: npm6 } = detectPackageManager();
76060
+ var generate8 = async (ctx) => {
76240
76061
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
76241
76062
  };
76242
76063
  var config11 = {
@@ -76249,29 +76070,30 @@ var config11 = {
76249
76070
  path: "./templates"
76250
76071
  },
76251
76072
  path: "templates/docusaurus/workers",
76252
- generate: generate10,
76073
+ generate: generate8,
76253
76074
  transformPackageJson: async () => ({
76254
76075
  scripts: {
76255
- deploy: `${npm7} run build && wrangler deploy`,
76256
- preview: `${npm7} run build && wrangler dev`
76076
+ deploy: `${npm6} run build && wrangler deploy`,
76077
+ preview: `${npm6} run build && wrangler dev`
76257
76078
  }
76258
76079
  }),
76259
76080
  devScript: "start",
76260
76081
  deployScript: "deploy",
76261
- previewScript: "preview"
76082
+ previewScript: "preview",
76083
+ workersTypes: "none"
76262
76084
  };
76263
- var c3_default13 = config11;
76085
+ var c3_default11 = config11;
76264
76086
 
76265
76087
  // templates/docusaurus/c3.ts
76266
76088
  var config12 = {
76267
76089
  displayName: "Docusaurus",
76268
- platformVariants: { pages: c3_default12, workers: c3_default13 }
76090
+ platformVariants: { pages: c3_default10, workers: c3_default11 }
76269
76091
  };
76270
- var c3_default14 = config12;
76092
+ var c3_default12 = config12;
76271
76093
 
76272
76094
  // templates/gatsby/pages/c3.ts
76273
- var { npm: npm8 } = detectPackageManager();
76274
- var generate11 = async (ctx) => {
76095
+ var { npm: npm7 } = detectPackageManager();
76096
+ var generate9 = async (ctx) => {
76275
76097
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76276
76098
  const useTemplate = await inputPrompt({
76277
76099
  type: "confirm",
@@ -76295,24 +76117,26 @@ var config13 = {
76295
76117
  id: "gatsby",
76296
76118
  frameworkCli: "gatsby",
76297
76119
  platform: "pages",
76120
+ hidden: true,
76298
76121
  displayName: "Gatsby",
76299
76122
  path: "templates/gatsby/pages",
76300
- generate: generate11,
76123
+ generate: generate9,
76301
76124
  transformPackageJson: async () => ({
76302
76125
  scripts: {
76303
- deploy: `${npm8} run build && wrangler pages deploy ./public`,
76304
- preview: `${npm8} run build && wrangler pages dev ./public`
76126
+ deploy: `${npm7} run build && wrangler pages deploy ./public`,
76127
+ preview: `${npm7} run build && wrangler pages dev ./public`
76305
76128
  }
76306
76129
  }),
76307
76130
  devScript: "develop",
76308
76131
  deployScript: "deploy",
76309
- previewScript: "preview"
76132
+ previewScript: "preview",
76133
+ workersTypes: "none"
76310
76134
  };
76311
- var c3_default15 = config13;
76135
+ var c3_default13 = config13;
76312
76136
 
76313
76137
  // templates/gatsby/workers/c3.ts
76314
- var { npm: npm9 } = detectPackageManager();
76315
- var generate12 = async (ctx) => {
76138
+ var { npm: npm8 } = detectPackageManager();
76139
+ var generate10 = async (ctx) => {
76316
76140
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76317
76141
  const useTemplate = await inputPrompt({
76318
76142
  type: "confirm",
@@ -76341,39 +76165,40 @@ var config14 = {
76341
76165
  path: "./templates"
76342
76166
  },
76343
76167
  path: "templates/gatsby/workers",
76344
- generate: generate12,
76168
+ generate: generate10,
76345
76169
  transformPackageJson: async () => ({
76346
76170
  scripts: {
76347
- deploy: `${npm9} run build && wrangler deploy`,
76348
- preview: `${npm9} run build && wrangler dev`
76171
+ deploy: `${npm8} run build && wrangler deploy`,
76172
+ preview: `${npm8} run build && wrangler dev`
76349
76173
  }
76350
76174
  }),
76351
76175
  devScript: "develop",
76352
76176
  deployScript: "deploy",
76353
- previewScript: "preview"
76177
+ previewScript: "preview",
76178
+ workersTypes: "none"
76354
76179
  };
76355
- var c3_default16 = config14;
76180
+ var c3_default14 = config14;
76356
76181
 
76357
76182
  // templates/gatsby/c3.ts
76358
76183
  var config15 = {
76359
76184
  displayName: "Gatsby",
76360
- platformVariants: { pages: c3_default15, workers: c3_default16 }
76185
+ platformVariants: { pages: c3_default13, workers: c3_default14 }
76361
76186
  };
76362
- var c3_default17 = config15;
76187
+ var c3_default15 = config15;
76363
76188
 
76364
76189
  // templates/hello-world-assets-only/c3.ts
76365
76190
  var config16 = {
76366
76191
  configVersion: 1,
76367
76192
  id: "hello-world-assets-only",
76368
76193
  path: "templates/hello-world-assets-only",
76369
- displayName: "Assets only",
76370
- description: "For static sites (including SPAs) or when using your own backend",
76194
+ displayName: "Static site",
76195
+ description: "For static sites or when using your own backend. Uses Workers Static Assets.",
76371
76196
  platform: "workers",
76372
76197
  copyFiles: {
76373
76198
  path: "./templates"
76374
76199
  }
76375
76200
  };
76376
- var c3_default18 = config16;
76201
+ var c3_default16 = config16;
76377
76202
 
76378
76203
  // templates/hello-world-durable-object-with-assets/c3.ts
76379
76204
  var config17 = {
@@ -76390,14 +76215,17 @@ var config17 = {
76390
76215
  },
76391
76216
  ts: {
76392
76217
  path: "./ts"
76218
+ },
76219
+ python: {
76220
+ path: "./py"
76393
76221
  }
76394
76222
  }
76395
76223
  }
76396
76224
  };
76397
- var c3_default19 = config17;
76225
+ var c3_default17 = config17;
76398
76226
 
76399
76227
  // templates/hello-world-durable-object/c3.ts
76400
- var c3_default20 = {
76228
+ var config18 = {
76401
76229
  configVersion: 1,
76402
76230
  id: "hello-world-durable-object",
76403
76231
  displayName: "Worker + Durable Objects",
@@ -76410,18 +76238,22 @@ var c3_default20 = {
76410
76238
  },
76411
76239
  ts: {
76412
76240
  path: "./ts"
76241
+ },
76242
+ python: {
76243
+ path: "./py"
76413
76244
  }
76414
76245
  }
76415
76246
  }
76416
76247
  };
76248
+ var c3_default18 = config18;
76417
76249
 
76418
76250
  // templates/hello-world-with-assets/c3.ts
76419
- var c3_default21 = {
76251
+ var config19 = {
76420
76252
  configVersion: 1,
76421
76253
  id: "hello-world-with-assets",
76422
76254
  path: "templates/hello-world-with-assets",
76423
- displayName: "Worker + Assets",
76424
- description: "For static sites with an API or server-side rendering (SSR)",
76255
+ displayName: "SSR / full-stack app",
76256
+ description: "For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
76425
76257
  platform: "workers",
76426
76258
  copyFiles: {
76427
76259
  variants: {
@@ -76437,11 +76269,12 @@ var c3_default21 = {
76437
76269
  }
76438
76270
  }
76439
76271
  };
76272
+ var c3_default19 = config19;
76440
76273
 
76441
76274
  // templates/hello-world/c3.ts
76442
76275
  var import_promises2 = require("node:fs/promises");
76443
76276
  var import_node_path5 = require("node:path");
76444
- var c3_default22 = {
76277
+ var c3_default20 = {
76445
76278
  configVersion: 1,
76446
76279
  id: "hello-world",
76447
76280
  displayName: "Worker only",
@@ -76475,7 +76308,7 @@ var c3_default22 = {
76475
76308
  };
76476
76309
 
76477
76310
  // templates/hono/pages/c3.ts
76478
- var generate13 = async (ctx) => {
76311
+ var generate11 = async (ctx) => {
76479
76312
  const { name: pm4 } = detectPackageManager();
76480
76313
  await runFrameworkGenerator(ctx, [
76481
76314
  ctx.project.name,
@@ -76487,7 +76320,8 @@ var generate13 = async (ctx) => {
76487
76320
  ]);
76488
76321
  logRaw("");
76489
76322
  };
76490
- var config18 = {
76323
+ var envInterfaceName = "CloudflareBindings";
76324
+ var config20 = {
76491
76325
  configVersion: 1,
76492
76326
  id: "hono",
76493
76327
  frameworkCli: "create-hono",
@@ -76497,20 +76331,23 @@ var config18 = {
76497
76331
  },
76498
76332
  path: "templates/hono/pages",
76499
76333
  platform: "pages",
76500
- generate: generate13,
76334
+ hidden: true,
76335
+ generate: generate11,
76501
76336
  transformPackageJson: async () => ({
76502
76337
  scripts: {
76503
- "cf-typegen": "wrangler types --env-interface CloudflareBindings"
76338
+ "cf-typegen": `wrangler types --env-interface ${envInterfaceName}`,
76339
+ preview: "vite build && wrangler pages dev"
76504
76340
  }
76505
76341
  }),
76506
76342
  devScript: "dev",
76507
76343
  deployScript: "deploy",
76508
- previewScript: "dev"
76344
+ previewScript: "preview",
76345
+ envInterfaceName
76509
76346
  };
76510
- var c3_default23 = config18;
76347
+ var c3_default21 = config20;
76511
76348
 
76512
76349
  // templates/hono/workers/c3.ts
76513
- var generate14 = async (ctx) => {
76350
+ var generate12 = async (ctx) => {
76514
76351
  const { name: pm4 } = detectPackageManager();
76515
76352
  await runFrameworkGenerator(ctx, [
76516
76353
  ctx.project.name,
@@ -76522,7 +76359,8 @@ var generate14 = async (ctx) => {
76522
76359
  ]);
76523
76360
  logRaw("");
76524
76361
  };
76525
- var config19 = {
76362
+ var envInterfaceName2 = "CloudflareBindings";
76363
+ var config21 = {
76526
76364
  configVersion: 1,
76527
76365
  id: "hono",
76528
76366
  frameworkCli: "create-hono",
@@ -76532,36 +76370,37 @@ var config19 = {
76532
76370
  },
76533
76371
  platform: "workers",
76534
76372
  path: "templates/hono/workers",
76535
- generate: generate14,
76373
+ generate: generate12,
76536
76374
  transformPackageJson: async () => ({
76537
76375
  scripts: {
76538
- "cf-typegen": "wrangler types --env-interface CloudflareBindings"
76376
+ "cf-typegen": `wrangler types --env-interface ${envInterfaceName2}`
76539
76377
  }
76540
76378
  }),
76541
76379
  devScript: "dev",
76542
76380
  deployScript: "deploy",
76543
- previewScript: "dev"
76381
+ previewScript: "dev",
76382
+ envInterfaceName: envInterfaceName2
76544
76383
  };
76545
- var c3_default24 = config19;
76384
+ var c3_default22 = config21;
76546
76385
 
76547
76386
  // templates/hono/c3.ts
76548
- var config20 = {
76387
+ var config22 = {
76549
76388
  displayName: "Hono",
76550
- platformVariants: { pages: c3_default23, workers: c3_default24 }
76389
+ platformVariants: { pages: c3_default21, workers: c3_default22 }
76551
76390
  };
76552
- var c3_default25 = config20;
76391
+ var c3_default23 = config22;
76553
76392
 
76554
- // templates/next/c3.ts
76393
+ // templates/next/pages/c3.ts
76555
76394
  var import_path10 = require("path");
76556
- var { npm: npm10, npx: npx4 } = detectPackageManager();
76557
- var generate15 = async (ctx) => {
76395
+ var { npm: npm9, npx: npx3 } = detectPackageManager();
76396
+ var generate13 = async (ctx) => {
76558
76397
  const projectName = ctx.project.name;
76559
76398
  await runFrameworkGenerator(ctx, [projectName]);
76560
76399
  const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
76561
76400
  writeFile2((0, import_path10.join)(ctx.project.path, "wrangler.jsonc"), wranglerConfig);
76562
76401
  updateStatus("Created wrangler.jsonc file");
76563
76402
  };
76564
- var updateNextConfig2 = (usesTs) => {
76403
+ var updateNextConfig = (usesTs) => {
76565
76404
  const s = spinner();
76566
76405
  const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
76567
76406
  s.start(`Updating \`${configFile}\``);
@@ -76579,7 +76418,7 @@ var updateNextConfig2 = (usesTs) => {
76579
76418
  writeFile2(configFile, updatedConfigFile);
76580
76419
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76581
76420
  };
76582
- var configure9 = async (ctx) => {
76421
+ var configure7 = async (ctx) => {
76583
76422
  const projectPath = ctx.project.path;
76584
76423
  const path6 = probePaths([
76585
76424
  `${projectPath}/pages/api`,
@@ -76593,18 +76432,11 @@ var configure9 = async (ctx) => {
76593
76432
  throw new Error("Could not find the `/api` or `/app` directory");
76594
76433
  }
76595
76434
  const usesTs = usesTypescript(ctx);
76596
- if (usesTs) {
76597
- copyFile(
76598
- (0, import_path10.join)(getTemplatePath(ctx), "env.d.ts"),
76599
- (0, import_path10.join)(projectPath, "env.d.ts")
76600
- );
76601
- updateStatus("Created an env.d.ts file");
76602
- }
76603
76435
  const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
76604
76436
  if (installEslintPlugin) {
76605
76437
  await writeEslintrc(ctx);
76606
76438
  }
76607
- updateNextConfig2(usesTs);
76439
+ updateNextConfig(usesTs);
76608
76440
  copyFile(
76609
76441
  (0, import_path10.join)(getTemplatePath(ctx), "README.md"),
76610
76442
  (0, import_path10.join)(projectPath, "README.md")
@@ -76644,7 +76476,6 @@ var writeEslintrc = async (ctx) => {
76644
76476
  var addDevDependencies = async (installEslintPlugin) => {
76645
76477
  const packages = [
76646
76478
  "@cloudflare/next-on-pages@1",
76647
- "@cloudflare/workers-types",
76648
76479
  "vercel",
76649
76480
  ...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
76650
76481
  ];
@@ -76654,14 +76485,18 @@ var addDevDependencies = async (installEslintPlugin) => {
76654
76485
  doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
76655
76486
  });
76656
76487
  };
76657
- var c3_default26 = {
76488
+ var envInterfaceName3 = "CloudflareEnv";
76489
+ var typesPath = "./env.d.ts";
76490
+ var c3_default24 = {
76658
76491
  configVersion: 1,
76659
76492
  id: "next",
76660
76493
  frameworkCli: "create-next-app",
76661
76494
  platform: "pages",
76495
+ hidden: true,
76662
76496
  displayName: "Next.js",
76663
- generate: generate15,
76664
- configure: configure9,
76497
+ path: "templates/next/pages",
76498
+ generate: generate13,
76499
+ configure: configure7,
76665
76500
  copyFiles: {
76666
76501
  async selectVariant(ctx) {
76667
76502
  const isApp = probePaths([
@@ -76692,12 +76527,12 @@ var c3_default26 = {
76692
76527
  }
76693
76528
  },
76694
76529
  transformPackageJson: async (_3, ctx) => {
76695
- const isNpm = npm10 === "npm";
76696
- const isBun = npm10 === "bun";
76530
+ const isNpm = npm9 === "npm";
76531
+ const isBun = npm9 === "bun";
76697
76532
  const isNpmOrBun = isNpm || isBun;
76698
76533
  const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
76699
76534
  const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
76700
- const pmCommand = isNpmOrBun ? npx4 : npm10;
76535
+ const pmCommand = isNpmOrBun ? npx3 : npm9;
76701
76536
  const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
76702
76537
  return {
76703
76538
  scripts: {
@@ -76705,7 +76540,7 @@ var c3_default26 = {
76705
76540
  preview: `${pagesBuildRunCommand} && wrangler pages dev`,
76706
76541
  deploy: `${pagesBuildRunCommand} && wrangler pages deploy`,
76707
76542
  ...usesTypescript(ctx) && {
76708
- "cf-typegen": `wrangler types --env-interface CloudflareEnv env.d.ts`
76543
+ "cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
76709
76544
  }
76710
76545
  }
76711
76546
  };
@@ -76713,25 +76548,88 @@ var c3_default26 = {
76713
76548
  devScript: "dev",
76714
76549
  previewScript: "preview",
76715
76550
  deployScript: "deploy",
76716
- compatibilityFlags: ["nodejs_compat"]
76551
+ compatibilityFlags: ["nodejs_compat"],
76552
+ typesPath,
76553
+ envInterfaceName: envInterfaceName3
76717
76554
  };
76718
76555
 
76556
+ // templates/next/workers/c3.ts
76557
+ var generate14 = async (ctx) => {
76558
+ await runFrameworkGenerator(ctx, [ctx.project.name]);
76559
+ };
76560
+ var configure8 = async (ctx) => {
76561
+ await installPackages(["@opennextjs/cloudflare@^1.0.2"], {
76562
+ startText: "Adding the Cloudflare adapter",
76563
+ doneText: `${brandColor(`installed`)} @opennextjs/cloudflare)}`
76564
+ });
76565
+ const usesTs = usesTypescript(ctx);
76566
+ updateNextConfig2(usesTs);
76567
+ };
76568
+ var updateNextConfig2 = (usesTs) => {
76569
+ const s = spinner();
76570
+ const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
76571
+ s.start(`Updating \`${configFile}\``);
76572
+ const configContent = readFile(configFile);
76573
+ const updatedConfigFile = configContent + `
76574
+ // added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
76575
+ import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
76576
+ initOpenNextCloudflareForDev();
76577
+ `.replace(/\n\t*/g, "\n");
76578
+ writeFile2(configFile, updatedConfigFile);
76579
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76580
+ };
76581
+ var envInterfaceName4 = "CloudflareEnv";
76582
+ var typesPath2 = "./cloudflare-env.d.ts";
76583
+ var c3_default25 = {
76584
+ configVersion: 1,
76585
+ id: "next",
76586
+ frameworkCli: "create-next-app",
76587
+ platform: "workers",
76588
+ displayName: "Next.js",
76589
+ path: "templates/next/workers",
76590
+ copyFiles: {
76591
+ path: "./templates"
76592
+ },
76593
+ generate: generate14,
76594
+ configure: configure8,
76595
+ transformPackageJson: async () => ({
76596
+ scripts: {
76597
+ deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
76598
+ preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
76599
+ "cf-typegen": `wrangler types --env-interface ${envInterfaceName4} ${typesPath2}`
76600
+ }
76601
+ }),
76602
+ devScript: "dev",
76603
+ previewScript: "preview",
76604
+ deployScript: "deploy",
76605
+ typesPath: typesPath2,
76606
+ envInterfaceName: envInterfaceName4
76607
+ };
76608
+
76609
+ // templates/next/c3.ts
76610
+ var config23 = {
76611
+ displayName: "Next.js",
76612
+ platformVariants: { pages: c3_default24, workers: c3_default25 }
76613
+ };
76614
+ var c3_default26 = config23;
76615
+
76719
76616
  // templates/nuxt/pages/c3.ts
76720
- var recast7 = __toESM(require_main3());
76721
- var { npm: npm11, name: pm2 } = detectPackageManager();
76722
- var generate16 = async (ctx) => {
76617
+ var recast6 = __toESM(require_main3());
76618
+ var { npm: npm10, name: pm2 } = detectPackageManager();
76619
+ var generate15 = async (ctx) => {
76723
76620
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76724
76621
  await runFrameworkGenerator(ctx, [
76725
76622
  "init",
76726
76623
  ctx.project.name,
76727
76624
  "--packageManager",
76728
- npm11,
76625
+ npm10,
76626
+ "--no-install",
76729
76627
  gitFlag
76730
76628
  ]);
76731
76629
  writeFile2("./.node-version", "18");
76732
76630
  logRaw("");
76733
76631
  };
76734
- var configure10 = async (ctx) => {
76632
+ var configure9 = async () => {
76735
76633
  const packages = ["nitro-cloudflare-dev"];
76736
76634
  if (pm2 === "pnpm") {
76737
76635
  packages.push("h3");
@@ -76739,30 +76637,15 @@ var configure10 = async (ctx) => {
76739
76637
  await installPackages(packages, {
76740
76638
  dev: true,
76741
76639
  startText: "Installing nitro module `nitro-cloudflare-dev`",
76742
- doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
76640
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
76743
76641
  });
76744
76642
  updateNuxtConfig();
76745
- updateEnvTypes2(ctx);
76746
- };
76747
- var updateEnvTypes2 = (ctx) => {
76748
- const filepath = "env.d.ts";
76749
- const s = spinner();
76750
- s.start(`Updating ${filepath}`);
76751
- let file = readFile(filepath);
76752
- let typesEntrypoint = `@cloudflare/workers-types`;
76753
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
76754
- if (latestEntrypoint) {
76755
- typesEntrypoint += `/${latestEntrypoint}`;
76756
- }
76757
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
76758
- writeFile2("env.d.ts", file);
76759
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76760
76643
  };
76761
76644
  var updateNuxtConfig = () => {
76762
76645
  const s = spinner();
76763
76646
  const configFile = "nuxt.config.ts";
76764
76647
  s.start(`Updating \`${configFile}\``);
76765
- const b3 = recast7.types.builders;
76648
+ const b3 = recast6.types.builders;
76766
76649
  const presetDef = b3.objectProperty(
76767
76650
  b3.identifier("nitro"),
76768
76651
  b3.objectExpression([
@@ -76800,22 +76683,23 @@ var updateNuxtConfig = () => {
76800
76683
  });
76801
76684
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76802
76685
  };
76803
- var config21 = {
76686
+ var config24 = {
76804
76687
  configVersion: 1,
76805
76688
  id: "nuxt",
76806
76689
  frameworkCli: "nuxi",
76807
76690
  platform: "pages",
76691
+ hidden: true,
76808
76692
  displayName: "Nuxt",
76809
76693
  copyFiles: {
76810
76694
  path: "./templates"
76811
76695
  },
76812
76696
  path: "templates/nuxt/pages",
76813
- generate: generate16,
76814
- configure: configure10,
76697
+ generate: generate15,
76698
+ configure: configure9,
76815
76699
  transformPackageJson: async () => ({
76816
76700
  scripts: {
76817
- deploy: `${npm11} run build && wrangler pages deploy`,
76818
- preview: `${npm11} run build && wrangler pages dev`,
76701
+ deploy: `${npm10} run build && wrangler pages deploy`,
76702
+ preview: `${npm10} run build && wrangler pages dev`,
76819
76703
  "cf-typegen": `wrangler types`
76820
76704
  }
76821
76705
  }),
@@ -76823,24 +76707,25 @@ var config21 = {
76823
76707
  deployScript: "deploy",
76824
76708
  previewScript: "preview"
76825
76709
  };
76826
- var c3_default27 = config21;
76710
+ var c3_default27 = config24;
76827
76711
 
76828
76712
  // templates/nuxt/workers/c3.ts
76829
- var recast8 = __toESM(require_main3());
76830
- var { npm: npm12, name: pm3 } = detectPackageManager();
76831
- var generate17 = async (ctx) => {
76713
+ var recast7 = __toESM(require_main3());
76714
+ var { npm: npm11, name: pm3 } = detectPackageManager();
76715
+ var generate16 = async (ctx) => {
76832
76716
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76833
76717
  await runFrameworkGenerator(ctx, [
76834
76718
  "init",
76835
76719
  ctx.project.name,
76836
76720
  "--packageManager",
76837
- npm12,
76721
+ npm11,
76722
+ "--no-install",
76838
76723
  gitFlag
76839
76724
  ]);
76840
76725
  writeFile2("./.node-version", "18");
76841
76726
  logRaw("");
76842
76727
  };
76843
- var configure11 = async (ctx) => {
76728
+ var configure10 = async () => {
76844
76729
  const packages = ["nitro-cloudflare-dev", "nitropack"];
76845
76730
  if (pm3 === "pnpm") {
76846
76731
  packages.push("h3");
@@ -76848,30 +76733,15 @@ var configure11 = async (ctx) => {
76848
76733
  await installPackages(packages, {
76849
76734
  dev: true,
76850
76735
  startText: "Installing nitro module `nitro-cloudflare-dev`",
76851
- doneText: `${brandColor("installed")} ${dim(`via \`${npm12} install\``)}`
76736
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
76852
76737
  });
76853
76738
  updateNuxtConfig2();
76854
- updateEnvTypes3(ctx);
76855
- };
76856
- var updateEnvTypes3 = (ctx) => {
76857
- const filepath = "env.d.ts";
76858
- const s = spinner();
76859
- s.start(`Updating ${filepath}`);
76860
- let file = readFile(filepath);
76861
- let typesEntrypoint = `@cloudflare/workers-types`;
76862
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
76863
- if (latestEntrypoint) {
76864
- typesEntrypoint += `/${latestEntrypoint}`;
76865
- }
76866
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
76867
- writeFile2("env.d.ts", file);
76868
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76869
76739
  };
76870
76740
  var updateNuxtConfig2 = () => {
76871
76741
  const s = spinner();
76872
76742
  const configFile = "nuxt.config.ts";
76873
76743
  s.start(`Updating \`${configFile}\``);
76874
- const b3 = recast8.types.builders;
76744
+ const b3 = recast7.types.builders;
76875
76745
  const presetDef = b3.objectProperty(
76876
76746
  b3.identifier("nitro"),
76877
76747
  b3.objectExpression([
@@ -76909,7 +76779,7 @@ var updateNuxtConfig2 = () => {
76909
76779
  });
76910
76780
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76911
76781
  };
76912
- var config22 = {
76782
+ var config25 = {
76913
76783
  configVersion: 1,
76914
76784
  id: "nuxt",
76915
76785
  frameworkCli: "nuxi",
@@ -76919,12 +76789,12 @@ var config22 = {
76919
76789
  path: "./templates"
76920
76790
  },
76921
76791
  path: "templates/nuxt/workers",
76922
- generate: generate17,
76923
- configure: configure11,
76792
+ generate: generate16,
76793
+ configure: configure10,
76924
76794
  transformPackageJson: async () => ({
76925
76795
  scripts: {
76926
- deploy: `${npm12} run build && wrangler deploy`,
76927
- preview: `${npm12} run build && wrangler dev`,
76796
+ deploy: `${npm11} run build && wrangler deploy`,
76797
+ preview: `${npm11} run build && wrangler dev`,
76928
76798
  "cf-typegen": `wrangler types`
76929
76799
  }
76930
76800
  }),
@@ -76932,17 +76802,17 @@ var config22 = {
76932
76802
  deployScript: "deploy",
76933
76803
  previewScript: "preview"
76934
76804
  };
76935
- var c3_default28 = config22;
76805
+ var c3_default28 = config25;
76936
76806
 
76937
76807
  // templates/nuxt/c3.ts
76938
- var config23 = {
76808
+ var config26 = {
76939
76809
  displayName: "Nuxt",
76940
76810
  platformVariants: { pages: c3_default27, workers: c3_default28 }
76941
76811
  };
76942
- var c3_default29 = config23;
76812
+ var c3_default29 = config26;
76943
76813
 
76944
76814
  // templates/openapi/c3.ts
76945
- var c3_default30 = {
76815
+ var config27 = {
76946
76816
  configVersion: 1,
76947
76817
  id: "openapi",
76948
76818
  displayName: "API starter (OpenAPI compliant)",
@@ -76952,6 +76822,7 @@ var c3_default30 = {
76952
76822
  path: "./ts"
76953
76823
  }
76954
76824
  };
76825
+ var c3_default30 = config27;
76955
76826
 
76956
76827
  // templates/pre-existing/c3.ts
76957
76828
  var import_promises3 = require("fs/promises");
@@ -77073,7 +76944,7 @@ async function copyExistingWorkerFiles(ctx) {
77073
76944
  await runCommand(
77074
76945
  [
77075
76946
  ...dlx,
77076
- "wrangler@3",
76947
+ "wrangler@latest",
77077
76948
  "init",
77078
76949
  "--from-dash",
77079
76950
  ctx.args.existingScript,
@@ -77101,10 +76972,11 @@ async function copyExistingWorkerFiles(ctx) {
77101
76972
  (0, import_path11.join)(ctx.project.path, "wrangler.toml")
77102
76973
  );
77103
76974
  }
77104
- var c3_default31 = {
76975
+ var config28 = {
77105
76976
  configVersion: 1,
77106
76977
  id: "pre-existing",
77107
76978
  displayName: "Pre-existing Worker (from Dashboard)",
76979
+ description: "Fetch a Worker initialized from the Cloudflare dashboard.",
77108
76980
  platform: "workers",
77109
76981
  hidden: true,
77110
76982
  copyFiles: {
@@ -77116,6 +76988,7 @@ var c3_default31 = {
77116
76988
  copyFiles: copyExistingWorkerFiles
77117
76989
  })
77118
76990
  };
76991
+ var c3_default31 = config28;
77119
76992
  function buildConfigure(params) {
77120
76993
  return async function configure21(ctx) {
77121
76994
  const loginSuccess = await params.login(ctx);
@@ -77129,7 +77002,7 @@ function buildConfigure(params) {
77129
77002
  }
77130
77003
 
77131
77004
  // templates/queues/c3.ts
77132
- var c3_default32 = {
77005
+ var config29 = {
77133
77006
  configVersion: 1,
77134
77007
  id: "queues",
77135
77008
  displayName: "Queue consumer & producer Worker",
@@ -77156,8 +77029,119 @@ var c3_default32 = {
77156
77029
  ]
77157
77030
  }
77158
77031
  };
77032
+ var c3_default32 = config29;
77159
77033
 
77160
- // templates/qwik/c3.ts
77034
+ // templates/qwik/pages/c3.ts
77035
+ var recast8 = __toESM(require_main3());
77036
+ var { npm: npm12, npx: npx4, name } = detectPackageManager();
77037
+ var generate17 = async (ctx) => {
77038
+ await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
77039
+ };
77040
+ var configure11 = async (ctx) => {
77041
+ const cmd = [name === "pnpm" ? npm12 : npx4, "qwik", "add", "cloudflare-pages"];
77042
+ endSection(`Running ${quoteShellArgs(cmd)}`);
77043
+ await runCommand(cmd);
77044
+ addBindingsProxy(ctx);
77045
+ populateCloudflareEnv();
77046
+ };
77047
+ var addBindingsProxy = (ctx) => {
77048
+ if (!usesTypescript(ctx)) {
77049
+ return;
77050
+ }
77051
+ const s = spinner();
77052
+ s.start("Updating `vite.config.ts`");
77053
+ const snippets = loadTemplateSnippets(ctx);
77054
+ const b3 = recast8.types.builders;
77055
+ transformFile("vite.config.ts", {
77056
+ // Insert the env declaration after the last import (but before the rest of the body)
77057
+ visitProgram: function(n) {
77058
+ const lastImportIndex = n.node.body.findLastIndex(
77059
+ (t2) => t2.type === "ImportDeclaration"
77060
+ );
77061
+ const lastImport = n.get("body", lastImportIndex);
77062
+ lastImport.insertAfter(...snippets.getPlatformProxyTs);
77063
+ return this.traverse(n);
77064
+ },
77065
+ // Pass the `platform` object from the declaration to the `qwikCity` plugin
77066
+ visitCallExpression: function(n) {
77067
+ const callee = n.node.callee;
77068
+ if (callee.name !== "qwikCity") {
77069
+ return this.traverse(n);
77070
+ }
77071
+ const configArgument = n.node.arguments[0];
77072
+ const platformPropery = b3.objectProperty.from({
77073
+ key: b3.identifier("platform"),
77074
+ value: b3.identifier("platform"),
77075
+ shorthand: true
77076
+ });
77077
+ if (!configArgument) {
77078
+ n.node.arguments = [b3.objectExpression([platformPropery])];
77079
+ return false;
77080
+ }
77081
+ if (configArgument.type !== "ObjectExpression") {
77082
+ throw new Error("Failed to update `vite.config.ts`");
77083
+ }
77084
+ configArgument.properties.push(platformPropery);
77085
+ return false;
77086
+ }
77087
+ });
77088
+ s.stop(`${brandColor("updated")} \`vite.config.ts\``);
77089
+ };
77090
+ var populateCloudflareEnv = () => {
77091
+ const entrypointPath = "src/entry.cloudflare-pages.tsx";
77092
+ const s = spinner();
77093
+ s.start(`Updating \`${entrypointPath}\``);
77094
+ transformFile(entrypointPath, {
77095
+ visitTSInterfaceDeclaration: function(n) {
77096
+ const b3 = recast8.types.builders;
77097
+ const id = n.node.id;
77098
+ if (id.name !== "QwikCityPlatform") {
77099
+ this.traverse(n);
77100
+ }
77101
+ const newBody = [
77102
+ ["env", "Env"]
77103
+ // Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
77104
+ // ["cf", "CfProperties"],
77105
+ ].map(
77106
+ ([varName, type]) => b3.tsPropertySignature(
77107
+ b3.identifier(varName),
77108
+ b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
77109
+ )
77110
+ );
77111
+ n.node.body.body = newBody;
77112
+ return false;
77113
+ }
77114
+ });
77115
+ s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
77116
+ };
77117
+ var config30 = {
77118
+ configVersion: 1,
77119
+ id: "qwik",
77120
+ frameworkCli: "create-qwik",
77121
+ displayName: "Qwik",
77122
+ platform: "pages",
77123
+ hidden: true,
77124
+ copyFiles: {
77125
+ path: "./templates"
77126
+ },
77127
+ path: "templates/qwik/pages",
77128
+ generate: generate17,
77129
+ configure: configure11,
77130
+ transformPackageJson: async () => ({
77131
+ scripts: {
77132
+ deploy: `${npm12} run build && wrangler pages deploy`,
77133
+ preview: `${npm12} run build && wrangler pages dev`,
77134
+ "cf-typegen": `wrangler types`
77135
+ }
77136
+ }),
77137
+ devScript: "dev",
77138
+ deployScript: "deploy",
77139
+ previewScript: "preview",
77140
+ workersTypes: "installed"
77141
+ };
77142
+ var c3_default33 = config30;
77143
+
77144
+ // templates/qwik/workers/c3.ts
77161
77145
  var recast9 = __toESM(require_main3());
77162
77146
  var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
77163
77147
  var generate18 = async (ctx) => {
@@ -77167,6 +77151,7 @@ var configure12 = async (ctx) => {
77167
77151
  const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
77168
77152
  endSection(`Running ${quoteShellArgs(cmd)}`);
77169
77153
  await runCommand(cmd);
77154
+ removeFile("./public/_routes.json");
77170
77155
  addBindingsProxy2(ctx);
77171
77156
  populateCloudflareEnv2();
77172
77157
  };
@@ -77240,33 +77225,76 @@ var populateCloudflareEnv2 = () => {
77240
77225
  });
77241
77226
  s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
77242
77227
  };
77243
- var config24 = {
77228
+ var config31 = {
77244
77229
  configVersion: 1,
77245
77230
  id: "qwik",
77246
77231
  frameworkCli: "create-qwik",
77247
77232
  displayName: "Qwik",
77248
- platform: "pages",
77233
+ platform: "workers",
77249
77234
  copyFiles: {
77250
77235
  path: "./templates"
77251
77236
  },
77237
+ path: "templates/qwik/workers",
77252
77238
  generate: generate18,
77253
77239
  configure: configure12,
77254
77240
  transformPackageJson: async () => ({
77255
77241
  scripts: {
77256
- deploy: `${npm13} run build && wrangler pages deploy`,
77257
- preview: `${npm13} run build && wrangler pages dev`,
77242
+ deploy: `${npm13} run build && wrangler deploy`,
77243
+ preview: `${npm13} run build && wrangler dev`,
77258
77244
  "cf-typegen": `wrangler types`
77259
77245
  }
77260
77246
  }),
77261
77247
  devScript: "dev",
77262
77248
  deployScript: "deploy",
77263
- previewScript: "preview"
77249
+ previewScript: "preview",
77250
+ workersTypes: "installed"
77264
77251
  };
77265
- var c3_default33 = config24;
77252
+ var c3_default34 = config31;
77266
77253
 
77267
- // templates/react/pages/c3.ts
77254
+ // templates/qwik/c3.ts
77255
+ var config32 = {
77256
+ displayName: "Qwik",
77257
+ platformVariants: { pages: c3_default33, workers: c3_default34 }
77258
+ };
77259
+ var c3_default35 = config32;
77260
+
77261
+ // templates/react-router/c3.ts
77268
77262
  var { npm: npm14 } = detectPackageManager();
77269
77263
  var generate19 = async (ctx) => {
77264
+ await runFrameworkGenerator(ctx, [
77265
+ ctx.project.name,
77266
+ "--template",
77267
+ "https://github.com/remix-run/react-router-templates/tree/main/cloudflare",
77268
+ // to prevent asking about git twice, just let c3 do it
77269
+ "--no-git-init",
77270
+ "--no-install"
77271
+ ]);
77272
+ logRaw("");
77273
+ };
77274
+ var config33 = {
77275
+ configVersion: 1,
77276
+ id: "react-router",
77277
+ platform: "workers",
77278
+ frameworkCli: "create-react-router",
77279
+ displayName: "React Router (formerly Remix)",
77280
+ generate: generate19,
77281
+ // configure,
77282
+ transformPackageJson: async () => ({
77283
+ scripts: {
77284
+ deploy: `${npm14} run build && wrangler deploy`,
77285
+ preview: `${npm14} run build && vite preview`,
77286
+ "cf-typegen": `wrangler types`
77287
+ }
77288
+ }),
77289
+ devScript: "dev",
77290
+ deployScript: "deploy",
77291
+ previewScript: "preview"
77292
+ };
77293
+ var c3_default36 = config33;
77294
+
77295
+ // templates/react/pages/c3.ts
77296
+ var { npm: npm15 } = detectPackageManager();
77297
+ var generate20 = async (ctx) => {
77270
77298
  const variant = await inputPrompt({
77271
77299
  type: "select",
77272
77300
  question: "Select a variant:",
@@ -77295,34 +77323,37 @@ var variantsOptions = [
77295
77323
  label: "JavaScript + SWC"
77296
77324
  }
77297
77325
  ];
77298
- var config25 = {
77326
+ var config34 = {
77299
77327
  configVersion: 1,
77300
77328
  id: "react",
77301
77329
  // React's documentation now recommends using create-vite.
77302
77330
  frameworkCli: "create-vite",
77303
77331
  displayName: "React",
77304
77332
  platform: "pages",
77333
+ hidden: true,
77305
77334
  path: "templates/react/pages",
77306
- generate: generate19,
77335
+ copyFiles: { path: "./templates" },
77336
+ generate: generate20,
77307
77337
  transformPackageJson: async () => ({
77308
77338
  scripts: {
77309
- deploy: `${npm14} run build && wrangler pages deploy ./dist`,
77310
- preview: `${npm14} run build && wrangler pages dev ./dist`
77339
+ deploy: `${npm15} run build && wrangler pages deploy`,
77340
+ preview: `${npm15} run build && wrangler pages dev`,
77341
+ "cf-typegen": `wrangler types`
77311
77342
  }
77312
77343
  }),
77313
77344
  devScript: "dev",
77314
77345
  deployScript: "deploy",
77315
77346
  previewScript: "preview"
77316
77347
  };
77317
- var c3_default34 = config25;
77348
+ var c3_default37 = config34;
77318
77349
 
77319
77350
  // templates/react/workers/c3.ts
77320
77351
  var import_assert2 = __toESM(require("assert"));
77321
77352
  var recast10 = __toESM(require_main3());
77322
77353
  var b2 = recast10.types.builders;
77323
77354
  var t = recast10.types.namedTypes;
77324
- var { npm: npm15 } = detectPackageManager();
77325
- var generate20 = async (ctx) => {
77355
+ var { npm: npm16 } = detectPackageManager();
77356
+ var generate21 = async (ctx) => {
77326
77357
  const variant = await getVariant();
77327
77358
  ctx.args.lang = variant.lang;
77328
77359
  await runFrameworkGenerator(ctx, [
@@ -77338,7 +77369,7 @@ var configure13 = async (ctx) => {
77338
77369
  startText: "Installing the Cloudflare Vite plugin",
77339
77370
  doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
77340
77371
  });
77341
- await transformViteConfig(ctx);
77372
+ transformViteConfig(ctx);
77342
77373
  if (usesTypescript(ctx)) {
77343
77374
  updateTsconfigJson();
77344
77375
  }
@@ -77363,9 +77394,9 @@ function transformViteConfig(ctx) {
77363
77394
  if (callee.name !== "defineConfig") {
77364
77395
  return this.traverse(n);
77365
77396
  }
77366
- const config38 = n.node.arguments[0];
77367
- (0, import_assert2.default)(t.ObjectExpression.check(config38));
77368
- const pluginsProp = config38.properties.find((prop) => isPluginsProp(prop));
77397
+ const config48 = n.node.arguments[0];
77398
+ (0, import_assert2.default)(t.ObjectExpression.check(config48));
77399
+ const pluginsProp = config48.properties.find((prop) => isPluginsProp(prop));
77369
77400
  (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
77370
77401
  pluginsProp.value.elements.push(
77371
77402
  b2.callExpression(b2.identifier("cloudflare"), [])
@@ -77422,7 +77453,7 @@ async function getVariant() {
77422
77453
  (0, import_assert2.default)(selected, "Expected a variant to be selected");
77423
77454
  return selected;
77424
77455
  }
77425
- var config26 = {
77456
+ var config35 = {
77426
77457
  configVersion: 1,
77427
77458
  id: "react",
77428
77459
  frameworkCli: "create-vite",
@@ -77439,12 +77470,12 @@ var config26 = {
77439
77470
  }
77440
77471
  }
77441
77472
  },
77442
- generate: generate20,
77473
+ generate: generate21,
77443
77474
  configure: configure13,
77444
77475
  transformPackageJson: async (_3, ctx) => ({
77445
77476
  scripts: {
77446
- deploy: `${npm15} run build && wrangler deploy`,
77447
- preview: `${npm15} run build && vite preview`,
77477
+ deploy: `${npm16} run build && wrangler deploy`,
77478
+ preview: `${npm16} run build && vite preview`,
77448
77479
  ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
77449
77480
  }
77450
77481
  }),
@@ -77452,18 +77483,18 @@ var config26 = {
77452
77483
  deployScript: "deploy",
77453
77484
  previewScript: "preview"
77454
77485
  };
77455
- var c3_default35 = config26;
77486
+ var c3_default38 = config35;
77456
77487
 
77457
77488
  // templates/react/c3.ts
77458
- var config27 = {
77489
+ var config36 = {
77459
77490
  displayName: "React",
77460
- platformVariants: { pages: c3_default34, workers: c3_default35 }
77491
+ platformVariants: { pages: c3_default37, workers: c3_default38 }
77461
77492
  };
77462
- var c3_default36 = config27;
77493
+ var c3_default39 = config36;
77463
77494
 
77464
77495
  // templates/remix/pages/c3.ts
77465
- var { npm: npm16 } = detectPackageManager();
77466
- var generate21 = async (ctx) => {
77496
+ var { npm: npm17 } = detectPackageManager();
77497
+ var generate22 = async (ctx) => {
77467
77498
  await runFrameworkGenerator(ctx, [
77468
77499
  ctx.project.name,
77469
77500
  "--template",
@@ -77486,34 +77517,36 @@ var configure14 = async () => {
77486
77517
  });
77487
77518
  s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
77488
77519
  };
77489
- var config28 = {
77520
+ var config37 = {
77490
77521
  configVersion: 1,
77491
77522
  id: "remix",
77492
77523
  frameworkCli: "create-remix",
77493
77524
  platform: "pages",
77525
+ hidden: true,
77494
77526
  displayName: "Remix",
77495
77527
  copyFiles: {
77496
77528
  path: "./templates"
77497
77529
  },
77498
77530
  path: "templates/remix/pages",
77499
- generate: generate21,
77531
+ generate: generate22,
77500
77532
  configure: configure14,
77501
77533
  transformPackageJson: async () => ({
77502
77534
  scripts: {
77503
- deploy: `${npm16} run build && wrangler pages deploy`,
77504
- preview: `${npm16} run build && wrangler pages dev`,
77535
+ deploy: `${npm17} run build && wrangler pages deploy`,
77536
+ preview: `${npm17} run build && wrangler pages dev`,
77505
77537
  "cf-typegen": `wrangler types`
77506
77538
  }
77507
77539
  }),
77508
77540
  devScript: "dev",
77509
77541
  deployScript: "deploy",
77510
- previewScript: "preview"
77542
+ previewScript: "preview",
77543
+ workersTypes: "installed"
77511
77544
  };
77512
- var c3_default37 = config28;
77545
+ var c3_default40 = config37;
77513
77546
 
77514
77547
  // templates/remix/workers/c3.ts
77515
- var { npm: npm17 } = detectPackageManager();
77516
- var generate22 = async (ctx) => {
77548
+ var { npm: npm18 } = detectPackageManager();
77549
+ var generate23 = async (ctx) => {
77517
77550
  await runFrameworkGenerator(ctx, [
77518
77551
  ctx.project.name,
77519
77552
  "--template",
@@ -77528,7 +77561,7 @@ var configure15 = async () => {
77528
77561
  doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
77529
77562
  });
77530
77563
  };
77531
- var config29 = {
77564
+ var config38 = {
77532
77565
  configVersion: 1,
77533
77566
  id: "remix",
77534
77567
  frameworkCli: "create-remix",
@@ -77538,30 +77571,32 @@ var config29 = {
77538
77571
  path: "./templates"
77539
77572
  },
77540
77573
  path: "templates/remix/workers",
77541
- generate: generate22,
77574
+ generate: generate23,
77542
77575
  configure: configure15,
77543
77576
  transformPackageJson: async () => ({
77544
77577
  scripts: {
77545
- deploy: `${npm17} run build && wrangler deploy`,
77546
- preview: `${npm17} run build && wrangler dev`,
77578
+ deploy: `${npm18} run build && wrangler deploy`,
77579
+ preview: `${npm18} run build && wrangler dev`,
77547
77580
  "cf-typegen": `wrangler types`
77548
77581
  }
77549
77582
  }),
77550
77583
  devScript: "dev",
77551
77584
  deployScript: "deploy",
77552
- previewScript: "preview"
77585
+ previewScript: "preview",
77586
+ workersTypes: "installed"
77553
77587
  };
77554
- var c3_default38 = config29;
77588
+ var c3_default41 = config38;
77555
77589
 
77556
77590
  // templates/remix/c3.ts
77557
- var config30 = {
77591
+ var config39 = {
77558
77592
  displayName: "Remix",
77559
- platformVariants: { pages: c3_default37, workers: c3_default38 }
77593
+ platformVariants: { pages: c3_default40, workers: c3_default41 },
77594
+ hidden: true
77560
77595
  };
77561
- var c3_default39 = config30;
77596
+ var c3_default42 = config39;
77562
77597
 
77563
77598
  // templates/scheduled/c3.ts
77564
- var c3_default40 = {
77599
+ var config40 = {
77565
77600
  configVersion: 1,
77566
77601
  id: "scheduled",
77567
77602
  displayName: "Scheduled Worker (Cron Trigger)",
@@ -77578,11 +77613,12 @@ var c3_default40 = {
77578
77613
  }
77579
77614
  }
77580
77615
  };
77616
+ var c3_default43 = config40;
77581
77617
 
77582
77618
  // templates/solid/c3.ts
77583
77619
  var recast11 = __toESM(require_main3());
77584
- var { npm: npm18 } = detectPackageManager();
77585
- var generate23 = async (ctx) => {
77620
+ var { npm: npm19 } = detectPackageManager();
77621
+ var generate24 = async (ctx) => {
77586
77622
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
77587
77623
  logRaw("");
77588
77624
  };
@@ -77624,7 +77660,7 @@ var configure16 = async (ctx) => {
77624
77660
  }
77625
77661
  });
77626
77662
  };
77627
- var config31 = {
77663
+ var config41 = {
77628
77664
  configVersion: 1,
77629
77665
  id: "solid",
77630
77666
  frameworkCli: "create-solid",
@@ -77633,12 +77669,13 @@ var config31 = {
77633
77669
  copyFiles: {
77634
77670
  path: "./templates"
77635
77671
  },
77636
- generate: generate23,
77672
+ generate: generate24,
77637
77673
  configure: configure16,
77638
77674
  transformPackageJson: async () => ({
77639
77675
  scripts: {
77640
- preview: `${npm18} run build && npx wrangler pages dev`,
77641
- deploy: `${npm18} run build && wrangler pages deploy`
77676
+ preview: `${npm19} run build && npx wrangler pages dev`,
77677
+ deploy: `${npm19} run build && wrangler pages deploy`,
77678
+ "cf-typegen": `wrangler types`
77642
77679
  }
77643
77680
  }),
77644
77681
  compatibilityFlags: ["nodejs_compat"],
@@ -77646,14 +77683,13 @@ var config31 = {
77646
77683
  deployScript: "deploy",
77647
77684
  previewScript: "preview"
77648
77685
  };
77649
- var c3_default41 = config31;
77686
+ var c3_default44 = config41;
77650
77687
 
77651
77688
  // templates/svelte/pages/c3.ts
77652
77689
  var import_node_fs3 = require("node:fs");
77653
- var import_node_os3 = require("node:os");
77654
77690
  var recast12 = __toESM(require_main3());
77655
- var { npm: npm19 } = detectPackageManager();
77656
- var generate24 = async (ctx) => {
77691
+ var { npm: npm20 } = detectPackageManager();
77692
+ var generate25 = async (ctx) => {
77657
77693
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
77658
77694
  logRaw("");
77659
77695
  };
@@ -77739,43 +77775,44 @@ var updateTypeDefinitions = (ctx) => {
77739
77775
  }
77740
77776
  });
77741
77777
  };
77742
- var config32 = {
77778
+ var typesPath3 = "src/worker-configuration.d.ts";
77779
+ var config42 = {
77743
77780
  configVersion: 1,
77744
77781
  id: "svelte",
77745
77782
  frameworkCli: "sv",
77746
77783
  displayName: "SvelteKit",
77747
77784
  platform: "pages",
77785
+ hidden: true,
77748
77786
  copyFiles: {
77749
77787
  path: "./templates"
77750
77788
  },
77751
77789
  path: "templates/svelte/pages",
77752
- generate: generate24,
77790
+ generate: generate25,
77753
77791
  configure: configure17,
77754
77792
  transformPackageJson: async (original, ctx) => {
77755
77793
  let scripts = {
77756
- preview: `${npm19} run build && wrangler pages dev`,
77757
- deploy: `${npm19} run build && wrangler pages deploy`
77794
+ preview: `${npm20} run build && wrangler pages dev`,
77795
+ deploy: `${npm20} run build && wrangler pages deploy`
77758
77796
  };
77759
77797
  if (usesTypescript(ctx)) {
77760
- const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
77761
77798
  scripts = {
77762
77799
  ...scripts,
77763
- "cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
77800
+ "cf-typegen": `wrangler types ${typesPath3}`
77764
77801
  };
77765
77802
  }
77766
77803
  return { scripts };
77767
77804
  },
77768
77805
  devScript: "dev",
77769
77806
  deployScript: "deploy",
77770
- previewScript: "preview"
77807
+ previewScript: "preview",
77808
+ typesPath: typesPath3
77771
77809
  };
77772
- var c3_default42 = config32;
77810
+ var c3_default45 = config42;
77773
77811
 
77774
77812
  // templates/svelte/workers/c3.ts
77775
- var import_node_os4 = require("node:os");
77776
77813
  var recast13 = __toESM(require_main3());
77777
- var { npm: npm20 } = detectPackageManager();
77778
- var generate25 = async (ctx) => {
77814
+ var { npm: npm21 } = detectPackageManager();
77815
+ var generate26 = async (ctx) => {
77779
77816
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
77780
77817
  logRaw("");
77781
77818
  };
@@ -77838,7 +77875,8 @@ var updateTypeDefinitions2 = (ctx) => {
77838
77875
  }
77839
77876
  });
77840
77877
  };
77841
- var config33 = {
77878
+ var typesPath4 = "./src/worker-configuration.d.ts";
77879
+ var config43 = {
77842
77880
  configVersion: 1,
77843
77881
  id: "svelte",
77844
77882
  frameworkCli: "sv",
@@ -77848,63 +77886,66 @@ var config33 = {
77848
77886
  path: "./templates"
77849
77887
  },
77850
77888
  path: "templates/svelte/workers",
77851
- generate: generate25,
77889
+ generate: generate26,
77852
77890
  configure: configure18,
77853
77891
  transformPackageJson: async (original, ctx) => {
77854
77892
  let scripts = {
77855
- preview: `${npm20} run build && wrangler dev`,
77856
- deploy: `${npm20} run build && wrangler deploy`
77893
+ preview: `${npm21} run build && wrangler dev`,
77894
+ deploy: `${npm21} run build && wrangler deploy`
77857
77895
  };
77858
77896
  if (usesTypescript(ctx)) {
77859
- const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
77860
77897
  scripts = {
77861
77898
  ...scripts,
77862
- "cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
77899
+ "cf-typegen": `wrangler types ${typesPath4}`
77863
77900
  };
77864
77901
  }
77865
77902
  return { scripts };
77866
77903
  },
77867
77904
  devScript: "dev",
77868
77905
  deployScript: "deploy",
77869
- previewScript: "preview"
77906
+ previewScript: "preview",
77907
+ typesPath: typesPath4
77870
77908
  };
77871
- var c3_default43 = config33;
77909
+ var c3_default46 = config43;
77872
77910
 
77873
77911
  // templates/svelte/c3.ts
77874
- var config34 = {
77912
+ var config44 = {
77875
77913
  displayName: "SvelteKit",
77876
- platformVariants: { pages: c3_default42, workers: c3_default43 }
77914
+ platformVariants: { pages: c3_default45, workers: c3_default46 }
77877
77915
  };
77878
- var c3_default44 = config34;
77916
+ var c3_default47 = config44;
77879
77917
 
77880
77918
  // templates/vue/pages/c3.ts
77881
- var { npm: npm21 } = detectPackageManager();
77882
- var generate26 = async (ctx) => {
77919
+ var { npm: npm22 } = detectPackageManager();
77920
+ var generate27 = async (ctx) => {
77883
77921
  await runFrameworkGenerator(ctx, [ctx.project.name]);
77884
77922
  };
77885
- var config35 = {
77923
+ var config45 = {
77886
77924
  configVersion: 1,
77887
77925
  id: "vue",
77888
77926
  frameworkCli: "create-vue",
77889
77927
  displayName: "Vue",
77890
77928
  platform: "pages",
77891
- path: "templates/pages/vue",
77892
- generate: generate26,
77929
+ hidden: true,
77930
+ path: "templates/vue/pages",
77931
+ copyFiles: { path: "./templates" },
77932
+ generate: generate27,
77893
77933
  transformPackageJson: async () => ({
77894
77934
  scripts: {
77895
- deploy: `${npm21} run build && wrangler pages deploy ./dist`,
77896
- preview: `${npm21} run build && wrangler pages dev ./dist`
77935
+ deploy: `${npm22} run build && wrangler pages deploy`,
77936
+ preview: `${npm22} run build && wrangler pages dev`,
77937
+ "cf-typegen": `wrangler types`
77897
77938
  }
77898
77939
  }),
77899
77940
  devScript: "dev",
77900
77941
  deployScript: "deploy",
77901
77942
  previewScript: "preview"
77902
77943
  };
77903
- var c3_default45 = config35;
77944
+ var c3_default48 = config45;
77904
77945
 
77905
77946
  // templates/vue/workers/c3.ts
77906
- var { npm: npm22 } = detectPackageManager();
77907
- var generate27 = async (ctx) => {
77947
+ var { npm: npm23 } = detectPackageManager();
77948
+ var generate28 = async (ctx) => {
77908
77949
  const lang = ctx.args.lang ?? await inputPrompt({
77909
77950
  type: "select",
77910
77951
  question: "Would you like to use TypeScript?",
@@ -77942,7 +77983,7 @@ function updateTsconfigJson2() {
77942
77983
  writeJSON("tsconfig.json", tsconfig);
77943
77984
  s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
77944
77985
  }
77945
- var config36 = {
77986
+ var config46 = {
77946
77987
  configVersion: 1,
77947
77988
  id: "vue",
77948
77989
  frameworkCli: "create-vue",
@@ -77963,11 +78004,11 @@ var config36 = {
77963
78004
  }
77964
78005
  },
77965
78006
  configure: configure19,
77966
- generate: generate27,
78007
+ generate: generate28,
77967
78008
  transformPackageJson: async (_3, ctx) => ({
77968
78009
  scripts: {
77969
- deploy: `${npm22} run build && wrangler deploy`,
77970
- preview: `${npm22} run build && wrangler dev`,
78010
+ deploy: `${npm23} run build && wrangler deploy`,
78011
+ preview: `${npm23} run build && wrangler dev`,
77971
78012
  ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
77972
78013
  }
77973
78014
  }),
@@ -77975,20 +78016,20 @@ var config36 = {
77975
78016
  deployScript: "deploy",
77976
78017
  previewScript: "preview"
77977
78018
  };
77978
- var c3_default46 = config36;
78019
+ var c3_default49 = config46;
77979
78020
 
77980
78021
  // templates/vue/c3.ts
77981
- var config37 = {
78022
+ var config47 = {
77982
78023
  displayName: "Vue",
77983
- platformVariants: { pages: c3_default45, workers: c3_default46 }
78024
+ platformVariants: { pages: c3_default48, workers: c3_default49 }
77984
78025
  };
77985
- var c3_default47 = config37;
78026
+ var c3_default50 = config47;
77986
78027
 
77987
78028
  // src/git.ts
77988
78029
  var import_node_assert = __toESM(require("node:assert"));
77989
78030
 
77990
78031
  // ../wrangler/package.json
77991
- var version2 = "0.0.0-ad774e49b";
78032
+ var version2 = "0.0.0-adc4941be";
77992
78033
 
77993
78034
  // src/git.ts
77994
78035
  var offerGit = async (ctx) => {
@@ -78249,41 +78290,57 @@ var defaultSelectVariant = async (ctx) => {
78249
78290
  function getFrameworkMap({ experimental = false }) {
78250
78291
  if (experimental) {
78251
78292
  return {
78252
- next: c3_default,
78253
- qwik: c3_default2,
78254
- solid: c3_default3
78293
+ solid: c3_default
78255
78294
  };
78256
78295
  } else {
78257
78296
  return {
78258
- analog: c3_default4,
78259
- angular: c3_default7,
78260
- astro: c3_default10,
78261
- docusaurus: c3_default14,
78262
- gatsby: c3_default17,
78263
- hono: c3_default25,
78297
+ analog: c3_default2,
78298
+ angular: c3_default5,
78299
+ astro: c3_default8,
78300
+ docusaurus: c3_default12,
78301
+ gatsby: c3_default15,
78302
+ hono: c3_default23,
78264
78303
  next: c3_default26,
78265
78304
  nuxt: c3_default29,
78266
- qwik: c3_default33,
78267
- react: c3_default36,
78268
- remix: c3_default39,
78269
- solid: c3_default41,
78270
- svelte: c3_default44,
78271
- vue: c3_default47
78305
+ qwik: c3_default35,
78306
+ react: c3_default39,
78307
+ "react-router": c3_default36,
78308
+ remix: c3_default42,
78309
+ solid: c3_default44,
78310
+ svelte: c3_default47,
78311
+ vue: c3_default50
78312
+ };
78313
+ }
78314
+ }
78315
+ function getOtherTemplateMap({
78316
+ experimental = false
78317
+ }) {
78318
+ if (experimental) {
78319
+ return {};
78320
+ } else {
78321
+ return {
78322
+ common: c3_default9,
78323
+ scheduled: c3_default43,
78324
+ queues: c3_default32,
78325
+ openapi: c3_default30,
78326
+ "pre-existing": c3_default31
78272
78327
  };
78273
78328
  }
78274
78329
  }
78275
- function getTemplateMap({ experimental = false }) {
78330
+ function getHelloWorldTemplateMap({
78331
+ experimental = false
78332
+ }) {
78276
78333
  if (experimental) {
78277
78334
  return {};
78278
78335
  } else {
78279
78336
  return {
78280
- "hello-world": c3_default22,
78281
- "hello-world-assets-only": c3_default18,
78282
- "hello-world-with-assets": c3_default21,
78283
- "hello-world-durable-object": c3_default20,
78284
- "hello-world-durable-object-with-assets": c3_default19,
78285
- common: c3_default11,
78286
- scheduled: c3_default40,
78337
+ "hello-world": c3_default20,
78338
+ "hello-world-assets-only": c3_default16,
78339
+ "hello-world-with-assets": c3_default19,
78340
+ "hello-world-durable-object": c3_default18,
78341
+ "hello-world-durable-object-with-assets": c3_default17,
78342
+ common: c3_default9,
78343
+ scheduled: c3_default43,
78287
78344
  queues: c3_default32,
78288
78345
  openapi: c3_default30,
78289
78346
  "pre-existing": c3_default31
@@ -78346,6 +78403,12 @@ var deriveCorrelatedArgs = (args) => {
78346
78403
  };
78347
78404
  var createContext = async (args, prevArgs) => {
78348
78405
  deriveCorrelatedArgs(args);
78406
+ const experimental = args.experimental;
78407
+ const frameworkMap = getFrameworkMap({ experimental });
78408
+ const helloWorldTemplateMap = getHelloWorldTemplateMap({
78409
+ experimental
78410
+ });
78411
+ const otherTemplateMap = getOtherTemplateMap({ experimental });
78349
78412
  let linesPrinted = 0;
78350
78413
  const goBack = async (from) => {
78351
78414
  const currentArgs = { ...args };
@@ -78392,22 +78455,29 @@ var createContext = async (args, prevArgs) => {
78392
78455
  validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
78393
78456
  format: (val) => `./${val}`
78394
78457
  });
78395
- const categoryOptions = [
78396
- {
78397
- label: "Hello World Starter",
78458
+ const categoryOptions = [];
78459
+ if (Object.keys(helloWorldTemplateMap).length) {
78460
+ categoryOptions.push({
78461
+ label: "Hello World example",
78398
78462
  value: "hello-world",
78399
- description: "Select from basic scaffolds to get started with Workers, Assets and Durable Objects"
78400
- },
78401
- {
78463
+ description: "Select from barebones examples to get started with Workers"
78464
+ });
78465
+ }
78466
+ if (Object.keys(frameworkMap).length) {
78467
+ categoryOptions.push({
78402
78468
  label: "Framework Starter",
78403
78469
  value: "web-framework",
78404
78470
  description: "Select from the most popular full-stack web frameworks"
78405
- },
78406
- {
78471
+ });
78472
+ }
78473
+ if (Object.keys(otherTemplateMap).length) {
78474
+ categoryOptions.push({
78407
78475
  label: "Application Starter",
78408
78476
  value: "demo",
78409
78477
  description: "Select from a range of starter applications using various Cloudflare products"
78410
- },
78478
+ });
78479
+ }
78480
+ categoryOptions.push(
78411
78481
  {
78412
78482
  label: "Template from a GitHub repo",
78413
78483
  value: "remote-template",
@@ -78416,7 +78486,7 @@ var createContext = async (args, prevArgs) => {
78416
78486
  // This is used only if the type is `pre-existing`
78417
78487
  { label: "Others", value: "others", hidden: true },
78418
78488
  backOption
78419
- ];
78489
+ );
78420
78490
  const category = await processArgument(args, "category", {
78421
78491
  type: "select",
78422
78492
  question: "What would you like to start with?",
@@ -78430,14 +78500,17 @@ var createContext = async (args, prevArgs) => {
78430
78500
  }
78431
78501
  let template;
78432
78502
  if (category === "web-framework") {
78433
- const frameworkMap = getFrameworkMap({
78434
- experimental: args.experimental
78435
- });
78436
- const frameworkOptions = Object.entries(frameworkMap).map(
78437
- ([key, config38]) => ({
78438
- label: config38.displayName,
78439
- value: key
78440
- })
78503
+ const frameworkOptions = Object.entries(frameworkMap).reduce(
78504
+ (acc, [key, config48]) => {
78505
+ if (!config48.hidden || args.framework) {
78506
+ acc.push({
78507
+ label: config48.displayName,
78508
+ value: key
78509
+ });
78510
+ }
78511
+ return acc;
78512
+ },
78513
+ []
78441
78514
  );
78442
78515
  const framework = await processArgument(args, "framework", {
78443
78516
  type: "select",
@@ -78455,30 +78528,40 @@ var createContext = async (args, prevArgs) => {
78455
78528
  throw new Error(`Unsupported framework: ${framework}`);
78456
78529
  }
78457
78530
  if ("platformVariants" in frameworkConfig) {
78458
- const platform3 = await processArgument(args, "platform", {
78531
+ const availableVariants = Object.entries(
78532
+ frameworkConfig.platformVariants
78533
+ ).filter(([, config48]) => !config48.hidden);
78534
+ if (availableVariants.length === 1) {
78535
+ args.platform ??= availableVariants[0][0];
78536
+ }
78537
+ const platform = await processArgument(args, "platform", {
78459
78538
  type: "select",
78460
78539
  label: "platform",
78461
78540
  question: "Select your deployment platform",
78462
78541
  options: [
78463
- {
78464
- label: "Workers with Assets (BETA)",
78465
- value: "workers",
78466
- description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
78467
- },
78468
- {
78469
- label: "Pages",
78470
- value: "pages",
78471
- description: "Great for simple websites and applications."
78472
- },
78542
+ ...args.platform === "workers" || !frameworkConfig.platformVariants.workers.hidden ? [
78543
+ {
78544
+ label: "Workers with Assets",
78545
+ value: "workers",
78546
+ description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
78547
+ }
78548
+ ] : [],
78549
+ ...args.platform === "pages" || !frameworkConfig.platformVariants.pages.hidden ? [
78550
+ {
78551
+ label: "Pages",
78552
+ value: "pages",
78553
+ description: "Great for simple websites and applications."
78554
+ }
78555
+ ] : [],
78473
78556
  backOption
78474
78557
  ],
78475
78558
  defaultValue: "workers"
78476
78559
  });
78477
78560
  linesPrinted += 3;
78478
- if (platform3 === BACK_VALUE) {
78561
+ if (platform === BACK_VALUE) {
78479
78562
  return goBack("platform");
78480
78563
  }
78481
- frameworkConfig = frameworkConfig.platformVariants[platform3];
78564
+ frameworkConfig = frameworkConfig.platformVariants[platform];
78482
78565
  }
78483
78566
  template = {
78484
78567
  deployScript: "pages:deploy",
@@ -78488,18 +78571,14 @@ var createContext = async (args, prevArgs) => {
78488
78571
  } else if (category === "remote-template") {
78489
78572
  template = await processRemoteTemplate(args);
78490
78573
  } else {
78491
- const templateMap = await getTemplateMap({
78492
- experimental: args.experimental
78493
- });
78574
+ const templateMap = category === "hello-world" ? helloWorldTemplateMap : otherTemplateMap;
78494
78575
  const templateOptions = Object.entries(templateMap).map(
78495
78576
  ([value, { displayName, description, hidden: hidden2 }]) => {
78496
- const isHelloWorldExample = value.startsWith("hello-world");
78497
- const isCategoryMatched = category === "hello-world" ? isHelloWorldExample : !isHelloWorldExample;
78498
78577
  return {
78499
78578
  value,
78500
78579
  label: displayName,
78501
78580
  description,
78502
- hidden: hidden2 || !isCategoryMatched
78581
+ hidden: hidden2
78503
78582
  };
78504
78583
  }
78505
78584
  );
@@ -78519,6 +78598,12 @@ var createContext = async (args, prevArgs) => {
78519
78598
  throw new Error(`Unknown application type provided: ${type}.`);
78520
78599
  }
78521
78600
  }
78601
+ template = {
78602
+ workersTypes: "generated",
78603
+ typesPath: "./worker-configuration.d.ts",
78604
+ envInterfaceName: "Env",
78605
+ ...template
78606
+ };
78522
78607
  const path6 = (0, import_path13.resolve)(projectName);
78523
78608
  const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
78524
78609
  if (languageVariants.length > 0) {
@@ -78578,7 +78663,7 @@ async function copyTemplateFiles(ctx) {
78578
78663
  }
78579
78664
  srcdir = (0, import_path13.join)(getTemplatePath(ctx), variantInfo.path);
78580
78665
  }
78581
- const copyDestDir = await getCopyFilesDestinationDir(ctx);
78666
+ const copyDestDir = getCopyFilesDestinationDir(ctx);
78582
78667
  const destdir = (0, import_path13.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
78583
78668
  const s = spinner();
78584
78669
  s.start(`Copying template files`);
@@ -78601,29 +78686,29 @@ var processRemoteTemplate = async (args) => {
78601
78686
  if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
78602
78687
  src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
78603
78688
  }
78604
- const path6 = await downloadRemoteTemplate(src);
78605
- const config38 = inferTemplateConfig(path6);
78606
- validateTemplate(path6, config38);
78689
+ const path6 = await downloadRemoteTemplate(src, args.templateMode);
78690
+ const config48 = inferTemplateConfig(path6);
78691
+ validateTemplate(path6, config48);
78607
78692
  updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
78608
78693
  return {
78609
78694
  path: path6,
78610
- ...config38
78695
+ ...config48
78611
78696
  };
78612
78697
  };
78613
- var validateTemplate = (path6, config38) => {
78614
- if (!config38.copyFiles) {
78698
+ var validateTemplate = (path6, config48) => {
78699
+ if (!config48.copyFiles) {
78615
78700
  return;
78616
78701
  }
78617
- if (isVariantInfo(config38.copyFiles)) {
78618
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config38.copyFiles.path), config38);
78702
+ if (isVariantInfo(config48.copyFiles)) {
78703
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config48.copyFiles.path), config48);
78619
78704
  } else {
78620
- for (const variant of Object.values(config38.copyFiles.variants)) {
78621
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config38);
78705
+ for (const variant of Object.values(config48.copyFiles.variants)) {
78706
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config48);
78622
78707
  }
78623
78708
  }
78624
78709
  };
78625
- var validateTemplateSrcDirectory = (path6, config38) => {
78626
- if (config38.platform === "workers") {
78710
+ var validateTemplateSrcDirectory = (path6, config48) => {
78711
+ if (config48.platform === "workers") {
78627
78712
  const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
78628
78713
  const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
78629
78714
  const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
@@ -78660,13 +78745,14 @@ var inferCopyFilesDefinition = (path6) => {
78660
78745
  const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
78661
78746
  return copyFiles;
78662
78747
  };
78663
- var downloadRemoteTemplate = async (src) => {
78748
+ var downloadRemoteTemplate = async (src, mode) => {
78664
78749
  try {
78665
78750
  updateStatus(`Cloning template from: ${blue(src)}`);
78666
78751
  const emitter = (0, import_degit.default)(src, {
78667
78752
  cache: false,
78668
78753
  verbose: false,
78669
- force: true
78754
+ force: true,
78755
+ mode
78670
78756
  });
78671
78757
  const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path13.join)((0, import_os2.tmpdir)(), "c3-template"));
78672
78758
  await emitter.clone(tmpDir);
@@ -78796,10 +78882,7 @@ var cliDefinition = {
78796
78882
  values(args) {
78797
78883
  const experimental = Boolean(args?.["experimental"]);
78798
78884
  if (experimental) {
78799
- return [
78800
- { name: "hello-world", description: "Hello World Starter" },
78801
- { name: "web-framework", description: "Framework Starter" }
78802
- ];
78885
+ return [{ name: "web-framework", description: "Framework Starter" }];
78803
78886
  } else {
78804
78887
  return [
78805
78888
  { name: "hello-world", description: "Hello World Starter" },
@@ -78825,40 +78908,10 @@ var cliDefinition = {
78825
78908
  `,
78826
78909
  values(args) {
78827
78910
  const experimental = Boolean(args?.["experimental"]);
78828
- if (experimental) {
78829
- return getNamesAndDescriptions(getTemplateMap({ experimental }));
78830
- } else {
78831
- return [
78832
- {
78833
- name: "hello-world",
78834
- description: "A basic \u201CHello World\u201D Cloudflare Worker."
78835
- },
78836
- {
78837
- name: "hello-world-durable-object",
78838
- description: "A basic \u201CHello World\u201D Cloudflare Worker with a Durable Worker."
78839
- },
78840
- {
78841
- name: "common",
78842
- description: "A Cloudflare Worker which implements a common example of routing/proxying functionalities."
78843
- },
78844
- {
78845
- name: "scheduled",
78846
- description: "A scheduled Cloudflare Worker (triggered via Cron Triggers)."
78847
- },
78848
- {
78849
- name: "queues",
78850
- description: "A Cloudflare Worker which is both a consumer and produced of Queues."
78851
- },
78852
- {
78853
- name: "openapi",
78854
- description: "A Worker implementing an OpenAPI REST endpoint."
78855
- },
78856
- {
78857
- name: "pre-existing",
78858
- description: "Fetch a Worker initialized from the Cloudflare dashboard."
78859
- }
78860
- ];
78861
- }
78911
+ return getNamesAndDescriptions({
78912
+ ...getHelloWorldTemplateMap({ experimental }),
78913
+ ...getOtherTemplateMap({ experimental })
78914
+ });
78862
78915
  }
78863
78916
  },
78864
78917
  {
@@ -78873,7 +78926,7 @@ var cliDefinition = {
78873
78926
  You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
78874
78927
 
78875
78928
  npm create cloudflare -- --framework next -- --ts
78876
- pnpm create clouldfare --framework next -- --ts
78929
+ pnpm create cloudflare --framework next -- --ts
78877
78930
  `,
78878
78931
  values: (args) => getNamesAndDescriptions(
78879
78932
  getFrameworkMap({
@@ -78887,12 +78940,12 @@ var cliDefinition = {
78887
78940
  description: `Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.`,
78888
78941
  values: [
78889
78942
  {
78890
- name: "pages",
78891
- description: "Create a web application that can be deployed to Pages."
78943
+ name: "workers",
78944
+ description: "Create a web application that can be deployed to Workers."
78892
78945
  },
78893
78946
  {
78894
- name: "workers",
78895
- description: "Create a web application that can be deployed to Workers (BETA)."
78947
+ name: "pages",
78948
+ description: "Create a web application that can be deployed to Pages."
78896
78949
  }
78897
78950
  ],
78898
78951
  requiresArg: true
@@ -78954,6 +79007,27 @@ var cliDefinition = {
78954
79007
  npm create cloudflare -- --template https://github.com/cloudflare/workers-sdk/templates/worker-r2
78955
79008
  `
78956
79009
  },
79010
+ {
79011
+ name: "template-mode",
79012
+ type: "string",
79013
+ requiresArg: true,
79014
+ description: `The mechanism to use when fetching the template.
79015
+
79016
+ Can be either "git" or "tar". "tar" does not support fetching from private
79017
+ repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
79018
+ Otherwise, it will use "git".
79019
+ `,
79020
+ values: [
79021
+ {
79022
+ name: "git",
79023
+ description: "Use git to fetch the template. Supports private repositories."
79024
+ },
79025
+ {
79026
+ name: "tar",
79027
+ description: "Use tar to fetch the template. Only supported on public repositories hosted on GitHub, BitBucket, GitLab, or git.sr.ht."
79028
+ }
79029
+ ]
79030
+ },
78957
79031
  {
78958
79032
  name: "accept-defaults",
78959
79033
  alias: "y",
@@ -79118,7 +79192,7 @@ var processArgument = async (args, key, promptConfig) => {
79118
79192
 
79119
79193
  // src/deploy.ts
79120
79194
  var import_promises5 = require("node:fs/promises");
79121
- var import_node_os5 = require("node:os");
79195
+ var import_node_os3 = require("node:os");
79122
79196
  var import_node_path6 = require("node:path");
79123
79197
  var import_toml3 = __toESM(require_toml());
79124
79198
 
@@ -80534,20 +80608,20 @@ function applyEdits(text, edits) {
80534
80608
  var import_fs12 = require("fs");
80535
80609
  var import_path14 = require("path");
80536
80610
  var import_toml2 = __toESM(require_toml());
80537
- function ensureNameExists(config38, projectName) {
80538
- config38["name"] = projectName;
80539
- return config38;
80611
+ function ensureNameExists(config48, projectName) {
80612
+ config48["name"] = projectName;
80613
+ return config48;
80540
80614
  }
80541
- async function ensureCompatDateExists(config38) {
80542
- if (typeof config38["compatibility_date"] === "string") {
80615
+ async function ensureCompatDateExists(config48) {
80616
+ if (typeof config48["compatibility_date"] === "string") {
80543
80617
  const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
80544
- if (!config38["compatibility_date"].match(validCompatDateRe)) {
80545
- config38["compatibility_date"] = await getWorkerdCompatibilityDate();
80618
+ if (!config48["compatibility_date"].match(validCompatDateRe)) {
80619
+ config48["compatibility_date"] = await getWorkerdCompatibilityDate();
80546
80620
  }
80547
80621
  } else {
80548
- config38["compatibility_date"] = await getWorkerdCompatibilityDate();
80622
+ config48["compatibility_date"] = await getWorkerdCompatibilityDate();
80549
80623
  }
80550
- return config38;
80624
+ return config48;
80551
80625
  }
80552
80626
  var updateWranglerConfig = async (ctx) => {
80553
80627
  if (wranglerJsonExists(ctx)) {
@@ -80558,12 +80632,15 @@ var updateWranglerConfig = async (ctx) => {
80558
80632
  const modified = await ensureCompatDateExists(
80559
80633
  ensureNameExists(parsed, ctx.project.name)
80560
80634
  );
80561
- const comment = `/**
80635
+ let comment = `/**
80562
80636
  * For more details on how to configure Wrangler, refer to:
80563
80637
  * https://developers.cloudflare.com/workers/wrangler/configuration/
80564
80638
  */
80565
- {
80639
+ {`;
80640
+ if (!modified["$schema"]) {
80641
+ comment += `
80566
80642
  "$schema": "node_modules/wrangler/config-schema.json",`;
80643
+ }
80567
80644
  if (!modified["observability"]) {
80568
80645
  modified["observability"] = { enabled: true };
80569
80646
  }
@@ -80718,7 +80795,7 @@ var addVscodeConfig = (ctx) => {
80718
80795
 
80719
80796
  // src/deploy.ts
80720
80797
  var offerToDeploy = async (ctx) => {
80721
- const { npm: npm24 } = detectPackageManager();
80798
+ const { npm: npm25 } = detectPackageManager();
80722
80799
  startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
80723
80800
  if (!await isDeployable(ctx)) {
80724
80801
  ctx.args.deploy = false;
@@ -80729,7 +80806,7 @@ var offerToDeploy = async (ctx) => {
80729
80806
  );
80730
80807
  }
80731
80808
  const label = `deploy via \`${quoteShellArgs([
80732
- npm24,
80809
+ npm25,
80733
80810
  "run",
80734
80811
  ctx.template.deployScript ?? "deploy"
80735
80812
  ])}\``;
@@ -80766,11 +80843,11 @@ var readWranglerConfig = (ctx) => {
80766
80843
  return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
80767
80844
  };
80768
80845
  var runDeploy = async (ctx) => {
80769
- const { npm: npm24, name: pm4 } = detectPackageManager();
80846
+ const { npm: npm25, name: pm4 } = detectPackageManager();
80770
80847
  if (!ctx.account?.id) {
80771
80848
  throw new Error("Failed to read Cloudflare account.");
80772
80849
  }
80773
- const baseDeployCmd = [npm24, "run", ctx.template.deployScript ?? "deploy"];
80850
+ const baseDeployCmd = [npm25, "run", ctx.template.deployScript ?? "deploy"];
80774
80851
  const insideGitRepo = await isInsideGitRepo(ctx.project.path);
80775
80852
  const deployCmd = [
80776
80853
  ...baseDeployCmd,
@@ -80782,7 +80859,7 @@ var runDeploy = async (ctx) => {
80782
80859
  ] : []
80783
80860
  ];
80784
80861
  const outputFile = (0, import_node_path6.join)(
80785
- await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0, import_node_os5.tmpdir)(), "c3-wrangler-deploy-")),
80862
+ await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0, import_node_os3.tmpdir)(), "c3-wrangler-deploy-")),
80786
80863
  "output.json"
80787
80864
  );
80788
80865
  await runCommand(deployCmd, {
@@ -80886,14 +80963,14 @@ var printSummary = (ctx) => {
80886
80963
  const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
80887
80964
  const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
80888
80965
  const cdCommand = relativePath ? `cd ${relativePath}` : null;
80889
- const { npm: npm24 } = detectPackageManager();
80966
+ const { npm: npm25 } = detectPackageManager();
80890
80967
  const devServerCommand = quoteShellArgs([
80891
- npm24,
80968
+ npm25,
80892
80969
  "run",
80893
80970
  ctx.template.devScript ?? "start"
80894
80971
  ]);
80895
80972
  const deployCommand = quoteShellArgs([
80896
- npm24,
80973
+ npm25,
80897
80974
  "run",
80898
80975
  ctx.template.deployScript ?? "deploy"
80899
80976
  ]);
@@ -81261,8 +81338,8 @@ var renderValues = (values) => {
81261
81338
  };
81262
81339
 
81263
81340
  // src/helpers/retry.ts
81264
- var retry = async (config38, fn) => {
81265
- let { times } = config38;
81341
+ var retry = async (config48, fn) => {
81342
+ let { times } = config48;
81266
81343
  let error2 = null;
81267
81344
  while (times > 0) {
81268
81345
  try {
@@ -81270,10 +81347,10 @@ var retry = async (config38, fn) => {
81270
81347
  } catch (e) {
81271
81348
  error2 = e;
81272
81349
  times--;
81273
- if (config38.exitCondition?.(e)) {
81350
+ if (config48.exitCondition?.(e)) {
81274
81351
  break;
81275
81352
  }
81276
- await sleep(config38.sleepMs ?? 1e3);
81353
+ await sleep(config48.sleepMs ?? 1e3);
81277
81354
  }
81278
81355
  }
81279
81356
  throw error2;
@@ -81362,48 +81439,107 @@ var createProject = async (ctx) => {
81362
81439
  // src/workers.ts
81363
81440
  var import_fs13 = require("fs");
81364
81441
  var import_path16 = require("path");
81365
- async function installWorkersTypes(ctx) {
81366
- const { npm: npm24 } = detectPackageManager();
81367
- if (!usesTypescript(ctx)) {
81442
+ var import_toml4 = __toESM(require_toml());
81443
+ async function addTypes(ctx) {
81444
+ if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
81368
81445
  return;
81369
81446
  }
81370
- await installPackages(["@cloudflare/workers-types"], {
81371
- dev: true,
81372
- startText: "Installing @cloudflare/workers-types",
81373
- doneText: `${brandColor("installed")} ${dim(`via ${npm24}`)}`
81447
+ const { npm: npm25 } = detectPackageManager();
81448
+ if (ctx.template.workersTypes === "installed") {
81449
+ await installWorkersTypes(npm25);
81450
+ } else if (ctx.template.workersTypes === "generated") {
81451
+ await generateWorkersTypes(ctx, npm25);
81452
+ }
81453
+ const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm25);
81454
+ await updateTsConfig(ctx, { usesNodeCompat });
81455
+ }
81456
+ async function generateWorkersTypes(ctx, npm25) {
81457
+ const packageJsonPath = (0, import_path16.join)(ctx.project.path, "package.json");
81458
+ if (!(0, import_fs13.existsSync)(packageJsonPath)) {
81459
+ return;
81460
+ }
81461
+ const packageManifest = readJSON(packageJsonPath);
81462
+ if (!packageManifest.scripts?.["cf-typegen"]) {
81463
+ return;
81464
+ }
81465
+ const typesCmd = [npm25, "run", "cf-typegen"];
81466
+ await runCommand(typesCmd, {
81467
+ cwd: ctx.project.path,
81468
+ silent: true,
81469
+ startText: "Generating types for your application",
81470
+ doneText: `${brandColor("generated")} ${dim(`to \`${ctx.template.typesPath}\` via \`${typesCmd.join(" ")}\``)}`
81374
81471
  });
81375
- await addWorkersTypesToTsConfig(ctx);
81472
+ if (packageManifest["devDependencies"]?.["@cloudflare/workers-types"]) {
81473
+ delete packageManifest["devDependencies"]?.["@cloudflare/workers-types"];
81474
+ writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
81475
+ }
81376
81476
  }
81377
- async function addWorkersTypesToTsConfig(ctx) {
81477
+ var maybeInstallNodeTypes = async (ctx, npm25) => {
81478
+ let parsedConfig = {};
81479
+ if (wranglerJsonExists(ctx)) {
81480
+ const wranglerJsonStr = readWranglerJson(ctx);
81481
+ parsedConfig = parse4(wranglerJsonStr, void 0, {
81482
+ allowTrailingComma: true
81483
+ });
81484
+ } else if (wranglerTomlExists(ctx)) {
81485
+ const wranglerTomlStr = readWranglerToml(ctx);
81486
+ parsedConfig = import_toml4.default.parse(wranglerTomlStr);
81487
+ }
81488
+ const compatibilityFlags = Array.isArray(parsedConfig["compatibility_flags"]) ? parsedConfig["compatibility_flags"] : [];
81489
+ if (compatibilityFlags.includes("nodejs_compat") || compatibilityFlags.includes("nodejs_compat_v2")) {
81490
+ await installPackages(["@types/node"], {
81491
+ dev: true,
81492
+ startText: "Installing @types/node",
81493
+ doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
81494
+ });
81495
+ return true;
81496
+ }
81497
+ return false;
81498
+ };
81499
+ async function updateTsConfig(ctx, { usesNodeCompat }) {
81378
81500
  const tsconfigPath = (0, import_path16.join)(ctx.project.path, "tsconfig.json");
81379
81501
  if (!(0, import_fs13.existsSync)(tsconfigPath)) {
81380
81502
  return;
81381
81503
  }
81382
- const s = spinner();
81383
- s.start("Adding latest types to `tsconfig.json`");
81384
81504
  const tsconfig = readFile(tsconfigPath);
81385
- const entrypointVersion = getLatestTypesEntrypoint(ctx);
81386
- if (entrypointVersion === null) {
81387
- s.stop(
81388
- `${brandColor(
81389
- "skipped"
81390
- )} couldn't find latest compatible version of @cloudflare/workers-types`
81391
- );
81392
- return;
81393
- }
81394
- const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
81395
81505
  try {
81396
- const config38 = parse4(tsconfig);
81397
- const currentTypes = config38.compilerOptions?.types ?? [];
81398
- const explicitEntrypoint = currentTypes.some(
81399
- (t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
81400
- );
81401
- const newTypes = explicitEntrypoint ? [...currentTypes] : [
81402
- ...currentTypes.filter(
81403
- (t2) => t2 !== "@cloudflare/workers-types"
81404
- ),
81405
- typesEntrypoint
81406
- ];
81506
+ const config48 = parse4(tsconfig);
81507
+ const currentTypes = config48.compilerOptions?.types ?? [];
81508
+ let newTypes = [...currentTypes];
81509
+ if (ctx.template.workersTypes === "installed") {
81510
+ const entrypointVersion = getLatestTypesEntrypoint(ctx);
81511
+ if (entrypointVersion === null) {
81512
+ return;
81513
+ }
81514
+ const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
81515
+ const explicitEntrypoint = currentTypes.some(
81516
+ (t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
81517
+ );
81518
+ if (!explicitEntrypoint) {
81519
+ newTypes = newTypes.filter(
81520
+ (t2) => t2 !== "@cloudflare/workers-types"
81521
+ );
81522
+ newTypes.push(typesEntrypoint);
81523
+ }
81524
+ } else if (ctx.template.workersTypes === "generated") {
81525
+ newTypes.push(ctx.template.typesPath ?? "./worker-configuration.d.ts");
81526
+ const typegen = readFile(
81527
+ ctx.template.typesPath ?? "./worker-configuration.d.ts"
81528
+ ).split("\n");
81529
+ if (typegen.some(
81530
+ (line) => line.includes("// Runtime types generated with workerd")
81531
+ )) {
81532
+ newTypes = newTypes.filter(
81533
+ (t2) => !t2.startsWith("@cloudflare/workers-types")
81534
+ );
81535
+ }
81536
+ }
81537
+ if (usesNodeCompat) {
81538
+ newTypes.push("node");
81539
+ }
81540
+ if (newTypes.sort() === currentTypes.sort()) {
81541
+ return;
81542
+ }
81407
81543
  const useSpaces = !tsconfig.match(/\t/g);
81408
81544
  const edits = modify(
81409
81545
  tsconfig,
@@ -81416,15 +81552,19 @@ async function addWorkersTypesToTsConfig(ctx) {
81416
81552
  const updated = applyEdits(tsconfig, edits);
81417
81553
  writeFile2(tsconfigPath, updated);
81418
81554
  } catch (error2) {
81419
- warn(
81420
- "Failed to update `tsconfig.json` with latest `@cloudflare/workers-types` entrypoint."
81421
- );
81555
+ warn("Failed to update `tsconfig.json`.");
81422
81556
  }
81423
- s.stop(`${brandColor("added")} ${dim(typesEntrypoint)}`);
81557
+ }
81558
+ async function installWorkersTypes(npm25) {
81559
+ await installPackages(["@cloudflare/workers-types"], {
81560
+ dev: true,
81561
+ startText: "Installing @cloudflare/workers-types",
81562
+ doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
81563
+ });
81424
81564
  }
81425
81565
 
81426
81566
  // src/cli.ts
81427
- var { npm: npm23 } = detectPackageManager();
81567
+ var { npm: npm24 } = detectPackageManager();
81428
81568
  var main = async (argv) => {
81429
81569
  const result = await parseArgs(argv);
81430
81570
  if (result.type === "unknown") {
@@ -81460,10 +81600,10 @@ ${result.errorMessage}`);
81460
81600
  };
81461
81601
  var runLatest = async () => {
81462
81602
  const args = process.argv.slice(2);
81463
- if (npm23 === "npm") {
81603
+ if (npm24 === "npm") {
81464
81604
  args.unshift("--");
81465
81605
  }
81466
- await runCommand([npm23, "create", "cloudflare@latest", ...args]);
81606
+ await runCommand([npm24, "create", "cloudflare@latest", ...args]);
81467
81607
  };
81468
81608
  var runCli = async (args) => {
81469
81609
  printBanner(args);
@@ -81500,7 +81640,6 @@ var create = async (ctx) => {
81500
81640
  var configure20 = async (ctx) => {
81501
81641
  startSection("Configuring your application for Cloudflare", "Step 2 of 3");
81502
81642
  await installWrangler();
81503
- await installWorkersTypes(ctx);
81504
81643
  await updateWranglerConfig(ctx);
81505
81644
  const { template } = ctx;
81506
81645
  if (template.configure) {
@@ -81508,6 +81647,7 @@ var configure20 = async (ctx) => {
81508
81647
  }
81509
81648
  addWranglerToGitIgnore(ctx);
81510
81649
  await updatePackageScripts(ctx);
81650
+ await addTypes(ctx);
81511
81651
  await offerGit(ctx);
81512
81652
  await gitCommit(ctx);
81513
81653
  endSection(`Application configured`);
@@ -81558,26 +81698,8 @@ repeat-string/index.js:
81558
81698
  *)
81559
81699
 
81560
81700
  yargs-parser/build/lib/string-utils.js:
81561
- (**
81562
- * @license
81563
- * Copyright (c) 2016, Contributors
81564
- * SPDX-License-Identifier: ISC
81565
- *)
81566
-
81567
81701
  yargs-parser/build/lib/tokenize-arg-string.js:
81568
- (**
81569
- * @license
81570
- * Copyright (c) 2016, Contributors
81571
- * SPDX-License-Identifier: ISC
81572
- *)
81573
-
81574
81702
  yargs-parser/build/lib/yargs-parser-types.js:
81575
- (**
81576
- * @license
81577
- * Copyright (c) 2016, Contributors
81578
- * SPDX-License-Identifier: ISC
81579
- *)
81580
-
81581
81703
  yargs-parser/build/lib/yargs-parser.js:
81582
81704
  (**
81583
81705
  * @license