create-cloudflare 0.0.0-595f17092 → 0.0.0-597255fd3

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 (57) hide show
  1. package/dist/cli.js +960 -859
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +6 -5
  4. package/templates/angular/c3.ts +5 -129
  5. package/templates/angular/pages/c3.ts +134 -0
  6. package/{templates-experimental/angular → templates/angular/workers}/c3.ts +2 -2
  7. package/templates/gatsby/c3.ts +5 -45
  8. package/templates/gatsby/pages/c3.ts +50 -0
  9. package/{templates-experimental/gatsby → templates/gatsby/workers}/c3.ts +2 -2
  10. package/templates/hello-world/js/package.json +2 -2
  11. package/templates/hello-world/ts/package.json +2 -2
  12. package/templates/nuxt/c3.ts +5 -130
  13. package/templates/nuxt/pages/c3.ts +145 -0
  14. package/templates/nuxt/{templates → pages/templates}/wrangler.jsonc +0 -3
  15. package/{templates-experimental/nuxt → templates/nuxt/workers}/c3.ts +12 -2
  16. package/templates/react/c3.ts +5 -57
  17. package/templates/react/pages/c3.ts +62 -0
  18. package/{templates-experimental/react → templates/react/workers}/c3.ts +4 -3
  19. package/{templates-experimental/react → templates/react/workers}/ts/api/index.ts +0 -4
  20. package/{templates-experimental/react → templates/react/workers}/ts/tsconfig.worker.json +1 -1
  21. package/templates/react/workers/ts/worker-configuration.d.ts +5 -0
  22. package/templates/vue/c3.ts +5 -25
  23. package/{templates-experimental/vue → templates/vue/pages}/c3.ts +5 -8
  24. package/templates/vue/workers/c3.ts +98 -0
  25. package/templates/vue/workers/js/server/index.js +13 -0
  26. package/templates/vue/workers/js/src/App.vue +107 -0
  27. package/templates/vue/workers/js/src/components/HelloWorld.vue +47 -0
  28. package/templates/vue/workers/js/vite.config.js +21 -0
  29. package/templates/vue/workers/js/wrangler.jsonc +12 -0
  30. package/templates/vue/workers/ts/server/index.ts +13 -0
  31. package/templates/vue/workers/ts/src/App.vue +107 -0
  32. package/templates/vue/workers/ts/src/components/HelloWorld.vue +44 -0
  33. package/templates/vue/workers/ts/tsconfig.worker.json +8 -0
  34. package/templates/vue/workers/ts/vite.config.ts +21 -0
  35. package/templates/vue/workers/ts/worker-configuration.d.ts +6 -0
  36. package/templates/vue/workers/ts/wrangler.jsonc +12 -0
  37. package/templates-experimental/hello-world-with-assets/js/package.json +2 -2
  38. package/templates-experimental/hello-world-with-assets/ts/package.json +2 -2
  39. package/templates-experimental/vue/templates/wrangler.jsonc +0 -10
  40. /package/templates/angular/{templates → pages/templates}/src/_routes.json +0 -0
  41. /package/{templates-experimental/angular → templates/angular/pages}/templates/src/server.ts +0 -0
  42. /package/templates/angular/{templates → pages/templates}/tools/copy-files.mjs +0 -0
  43. /package/templates/angular/{templates → workers/templates}/src/server.ts +0 -0
  44. /package/{templates-experimental/angular → templates/angular/workers}/templates/wrangler.jsonc +0 -0
  45. /package/{templates-experimental/gatsby → templates/gatsby/workers}/templates/wrangler.jsonc +0 -0
  46. /package/{templates-experimental/nuxt → templates/nuxt/pages}/templates/env.d.ts +0 -0
  47. /package/{templates-experimental/nuxt → templates/nuxt/pages}/templates/worker-configuration.d.ts +0 -0
  48. /package/templates/nuxt/{templates → workers/templates}/env.d.ts +0 -0
  49. /package/templates/nuxt/{templates → workers/templates}/worker-configuration.d.ts +0 -0
  50. /package/{templates-experimental/nuxt → templates/nuxt/workers}/templates/wrangler.jsonc +0 -0
  51. /package/{templates-experimental/react → templates/react/workers}/js/api/index.js +0 -0
  52. /package/{templates-experimental/react → templates/react/workers}/js/src/App.jsx +0 -0
  53. /package/{templates-experimental/react → templates/react/workers}/js/src/assets/Cloudflare_Logo.svg +0 -0
  54. /package/{templates-experimental/react/js/wrangler.json → templates/react/workers/js/wrangler.jsonc} +0 -0
  55. /package/{templates-experimental/react → templates/react/workers}/ts/src/App.tsx +0 -0
  56. /package/{templates-experimental/react → templates/react/workers}/ts/src/assets/Cloudflare_Logo.svg +0 -0
  57. /package/{templates-experimental/react/ts/wrangler.json → templates/react/workers/ts/wrangler.jsonc} +0 -0
package/dist/cli.js CHANGED
@@ -573,7 +573,7 @@ var require_XDGAppPaths = __commonJS({
573
573
  XDGAppPaths.cache = function cache(dirOptions) {
574
574
  return path6.join(xdg.cache(), finalPathSegment(dirOptions));
575
575
  };
576
- XDGAppPaths.config = function config29(dirOptions) {
576
+ XDGAppPaths.config = function config34(dirOptions) {
577
577
  return path6.join(xdg.config(), finalPathSegment(dirOptions));
578
578
  };
579
579
  XDGAppPaths.data = function data(dirOptions) {
@@ -630,7 +630,7 @@ var require_XDG = __commonJS({
630
630
  var cache = function() {
631
631
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
632
632
  };
633
- var config29 = function() {
633
+ var config34 = function() {
634
634
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
635
635
  };
636
636
  var data = function() {
@@ -642,13 +642,13 @@ var require_XDG = __commonJS({
642
642
  var state = function() {
643
643
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
644
644
  };
645
- return { cache, config: config29, data, runtime, state };
645
+ return { cache, config: config34, data, runtime, state };
646
646
  };
647
647
  var macos = function() {
648
648
  var cache = function() {
649
649
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
650
650
  };
651
- var config29 = function() {
651
+ var config34 = function() {
652
652
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
653
653
  };
654
654
  var data = function() {
@@ -660,7 +660,7 @@ var require_XDG = __commonJS({
660
660
  var state = function() {
661
661
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
662
662
  };
663
- return { cache, config: config29, data, runtime, state };
663
+ return { cache, config: config34, data, runtime, state };
664
664
  };
665
665
  var windows = function() {
666
666
  function appData() {
@@ -672,7 +672,7 @@ var require_XDG = __commonJS({
672
672
  var cache = function() {
673
673
  return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
674
674
  };
675
- var config29 = function() {
675
+ var config34 = function() {
676
676
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
677
677
  };
678
678
  var data = function() {
@@ -684,7 +684,7 @@ var require_XDG = __commonJS({
684
684
  var state = function() {
685
685
  return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
686
686
  };
687
- return { cache, config: config29, data, runtime, state };
687
+ return { cache, config: config34, data, runtime, state };
688
688
  };
689
689
  var XDG_ = function() {
690
690
  function XDG_2() {
@@ -31619,22 +31619,22 @@ var require_dist_web = __commonJS({
31619
31619
  _createClass(Haikunator3, [{
31620
31620
  key: "haikunate",
31621
31621
  value: function haikunate(options) {
31622
- var config29 = (0, _lodash["default"])(options, this.config);
31623
- if (config29.tokenHex === true) {
31624
- config29.tokenChars = "0123456789abcdef";
31622
+ var config34 = (0, _lodash["default"])(options, this.config);
31623
+ if (config34.tokenHex === true) {
31624
+ config34.tokenChars = "0123456789abcdef";
31625
31625
  }
31626
31626
  var adjective = this._randomElement(this.adjectives);
31627
31627
  var noun = this._randomElement(this.nouns);
31628
- if (!config29.tokenLength)
31629
- config29.tokenLength = 0;
31628
+ if (!config34.tokenLength)
31629
+ config34.tokenLength = 0;
31630
31630
  var token = "";
31631
- for (var i = 0; i < config29.tokenLength; i++) {
31632
- token += this._randomElement(config29.tokenChars);
31631
+ for (var i = 0; i < config34.tokenLength; i++) {
31632
+ token += this._randomElement(config34.tokenChars);
31633
31633
  }
31634
31634
  var sections = [adjective, noun, token];
31635
31635
  return sections.filter(function(e) {
31636
31636
  return !!e;
31637
- }).join(config29.delimiter);
31637
+ }).join(config34.delimiter);
31638
31638
  }
31639
31639
  /**
31640
31640
  * Get a random element from an array/string
@@ -40191,13 +40191,13 @@ var require_esprima = __commonJS({
40191
40191
  return Reader2;
40192
40192
  }();
40193
40193
  var Tokenizer = function() {
40194
- function Tokenizer2(code, config29) {
40194
+ function Tokenizer2(code, config34) {
40195
40195
  this.errorHandler = new error_handler_1.ErrorHandler();
40196
- this.errorHandler.tolerant = config29 ? typeof config29.tolerant === "boolean" && config29.tolerant : false;
40196
+ this.errorHandler.tolerant = config34 ? typeof config34.tolerant === "boolean" && config34.tolerant : false;
40197
40197
  this.scanner = new scanner_1.Scanner(code, this.errorHandler);
40198
- this.scanner.trackComment = config29 ? typeof config29.comment === "boolean" && config29.comment : false;
40199
- this.trackRange = config29 ? typeof config29.range === "boolean" && config29.range : false;
40200
- this.trackLoc = config29 ? typeof config29.loc === "boolean" && config29.loc : false;
40198
+ this.scanner.trackComment = config34 ? typeof config34.comment === "boolean" && config34.comment : false;
40199
+ this.trackRange = config34 ? typeof config34.range === "boolean" && config34.range : false;
40200
+ this.trackLoc = config34 ? typeof config34.loc === "boolean" && config34.loc : false;
40201
40201
  this.buffer = [];
40202
40202
  this.reader = new Reader();
40203
40203
  }
@@ -50020,11 +50020,11 @@ var require_printer = __commonJS({
50020
50020
  return this.code;
50021
50021
  };
50022
50022
  var emptyPrintResult = new PrintResult("");
50023
- var Printer = function Printer2(config29) {
50023
+ var Printer = function Printer2(config34) {
50024
50024
  assert_1.default.ok(this instanceof Printer2);
50025
- var explicitTabWidth = config29 && config29.tabWidth;
50026
- config29 = options_1.normalize(config29);
50027
- config29.sourceFileName = null;
50025
+ var explicitTabWidth = config34 && config34.tabWidth;
50026
+ config34 = options_1.normalize(config34);
50027
+ config34.sourceFileName = null;
50028
50028
  function makePrintFunctionWith(options, overrides) {
50029
50029
  options = Object.assign({}, options, overrides);
50030
50030
  return function(path6) {
@@ -50039,11 +50039,11 @@ var require_printer = __commonJS({
50039
50039
  includeComments: false
50040
50040
  }));
50041
50041
  }
50042
- var oldTabWidth = config29.tabWidth;
50042
+ var oldTabWidth = config34.tabWidth;
50043
50043
  if (!explicitTabWidth) {
50044
50044
  var loc = path6.getNode().loc;
50045
50045
  if (loc && loc.lines && loc.lines.guessTabWidth) {
50046
- config29.tabWidth = loc.lines.guessTabWidth();
50046
+ config34.tabWidth = loc.lines.guessTabWidth();
50047
50047
  }
50048
50048
  }
50049
50049
  var reprinter = patcher_1.getReprinter(path6);
@@ -50057,11 +50057,11 @@ var require_printer = __commonJS({
50057
50057
  // right choice because it gives us the opportunity to reprint
50058
50058
  // such nodes using their original source.
50059
50059
  reprinter(print2)
50060
- ) : genericPrint(path6, config29, options, makePrintFunctionWith(options, {
50060
+ ) : genericPrint(path6, config34, options, makePrintFunctionWith(options, {
50061
50061
  includeComments: true,
50062
50062
  avoidRootParens: false
50063
50063
  }));
50064
- config29.tabWidth = oldTabWidth;
50064
+ config34.tabWidth = oldTabWidth;
50065
50065
  return lines;
50066
50066
  }
50067
50067
  this.print = function(ast) {
@@ -50072,7 +50072,7 @@ var require_printer = __commonJS({
50072
50072
  includeComments: true,
50073
50073
  avoidRootParens: false
50074
50074
  });
50075
- return new PrintResult(lines.toString(config29), util.composeSourceMaps(config29.inputSourceMap, lines.getSourceMap(config29.sourceMapName, config29.sourceRoot)));
50075
+ return new PrintResult(lines.toString(config34), util.composeSourceMaps(config34.inputSourceMap, lines.getSourceMap(config34.sourceMapName, config34.sourceRoot)));
50076
50076
  };
50077
50077
  this.printGenerically = function(ast) {
50078
50078
  if (!ast) {
@@ -50080,26 +50080,26 @@ var require_printer = __commonJS({
50080
50080
  }
50081
50081
  function printGenerically(path7) {
50082
50082
  return comments_1.printComments(path7, function(path8) {
50083
- return genericPrint(path8, config29, {
50083
+ return genericPrint(path8, config34, {
50084
50084
  includeComments: true,
50085
50085
  avoidRootParens: false
50086
50086
  }, printGenerically);
50087
50087
  });
50088
50088
  }
50089
50089
  var path6 = fast_path_1.default.from(ast);
50090
- var oldReuseWhitespace = config29.reuseWhitespace;
50091
- config29.reuseWhitespace = false;
50092
- var pr = new PrintResult(printGenerically(path6).toString(config29));
50093
- config29.reuseWhitespace = oldReuseWhitespace;
50090
+ var oldReuseWhitespace = config34.reuseWhitespace;
50091
+ config34.reuseWhitespace = false;
50092
+ var pr = new PrintResult(printGenerically(path6).toString(config34));
50093
+ config34.reuseWhitespace = oldReuseWhitespace;
50094
50094
  return pr;
50095
50095
  };
50096
50096
  };
50097
50097
  exports2.Printer = Printer;
50098
- function genericPrint(path6, config29, options, printPath) {
50098
+ function genericPrint(path6, config34, options, printPath) {
50099
50099
  assert_1.default.ok(path6 instanceof fast_path_1.default);
50100
50100
  var node = path6.getValue();
50101
50101
  var parts = [];
50102
- var linesWithoutParens = genericPrintNoParens(path6, config29, printPath);
50102
+ var linesWithoutParens = genericPrintNoParens(path6, config34, printPath);
50103
50103
  if (!node || linesWithoutParens.isEmpty()) {
50104
50104
  return linesWithoutParens;
50105
50105
  }
@@ -69790,33 +69790,33 @@ var inputPrompt = async (promptConfig) => {
69790
69790
  }
69791
69791
  return input;
69792
69792
  };
69793
- var renderSubmit = (config29, value) => {
69794
- const { question, label } = config29;
69795
- if (config29.type !== "confirm" && !value) {
69793
+ var renderSubmit = (config34, value) => {
69794
+ const { question, label } = config34;
69795
+ if (config34.type !== "confirm" && !value) {
69796
69796
  return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
69797
69797
  }
69798
- const content = config29.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69798
+ const content = config34.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69799
69799
  return [`${leftT} ${question}`, content, `${grayBar}`];
69800
69800
  };
69801
- var getRenderers = (config29) => {
69802
- switch (config29.type) {
69801
+ var getRenderers = (config34) => {
69802
+ switch (config34.type) {
69803
69803
  case "select":
69804
- return getSelectRenderers(config29);
69804
+ return getSelectRenderers(config34);
69805
69805
  case "confirm":
69806
- return getConfirmRenderers(config29);
69806
+ return getConfirmRenderers(config34);
69807
69807
  case "text":
69808
- return getTextRenderers(config29);
69808
+ return getTextRenderers(config34);
69809
69809
  case "multiselect":
69810
- return getSelectRenderers(config29);
69810
+ return getSelectRenderers(config34);
69811
69811
  case "list":
69812
- return getSelectListRenderers(config29);
69812
+ return getSelectListRenderers(config34);
69813
69813
  }
69814
69814
  };
69815
- var getTextRenderers = (config29) => {
69816
- const { question } = config29;
69817
- const helpText = config29.helpText ?? "";
69818
- const format5 = config29.format ?? ((val) => String(val));
69819
- const defaultValue = config29.defaultValue?.toString() ?? "";
69815
+ var getTextRenderers = (config34) => {
69816
+ const { question } = config34;
69817
+ const helpText = config34.helpText ?? "";
69818
+ const format5 = config34.format ?? ((val) => String(val));
69819
+ const defaultValue = config34.defaultValue?.toString() ?? "";
69820
69820
  const activeRenderer = ({ value }) => [
69821
69821
  `${blCorner} ${bold(question)} ${dim(helpText)}`,
69822
69822
  `${space(2)}${format5(value || dim(defaultValue))}`,
@@ -69839,14 +69839,14 @@ var getTextRenderers = (config29) => {
69839
69839
  ``
69840
69840
  // extra line for readability
69841
69841
  ],
69842
- submit: ({ value }) => renderSubmit(config29, format5(value ?? "")),
69842
+ submit: ({ value }) => renderSubmit(config34, format5(value ?? "")),
69843
69843
  cancel: activeRenderer
69844
69844
  };
69845
69845
  };
69846
- var getSelectRenderers = (config29) => {
69847
- const { options, question, helpText: _helpText } = config29;
69846
+ var getSelectRenderers = (config34) => {
69847
+ const { options, question, helpText: _helpText } = config34;
69848
69848
  const helpText = _helpText ?? "";
69849
- const maxItemsPerPage = config29.maxItemsPerPage ?? 32;
69849
+ const maxItemsPerPage = config34.maxItemsPerPage ?? 32;
69850
69850
  const defaultRenderer = ({ cursor = 0, value }) => {
69851
69851
  const renderOption = (opt, i) => {
69852
69852
  const { label: optionLabel, value: optionValue } = opt;
@@ -69921,21 +69921,21 @@ ${space(2)}${dim("...")}` : ""}`,
69921
69921
  submit: ({ value }) => {
69922
69922
  if (Array.isArray(value)) {
69923
69923
  return renderSubmit(
69924
- config29,
69924
+ config34,
69925
69925
  options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
69926
69926
  );
69927
69927
  }
69928
69928
  return renderSubmit(
69929
- config29,
69929
+ config34,
69930
69930
  options.find((o) => o.value === value)?.label
69931
69931
  );
69932
69932
  },
69933
69933
  cancel: defaultRenderer
69934
69934
  };
69935
69935
  };
69936
- var getSelectListRenderers = (config29) => {
69937
- const { question, helpText: _helpText } = config29;
69938
- let options = config29.options;
69936
+ var getSelectListRenderers = (config34) => {
69937
+ const { question, helpText: _helpText } = config34;
69938
+ let options = config34.options;
69939
69939
  const helpText = _helpText ?? "";
69940
69940
  const { rows } = stdout;
69941
69941
  const defaultRenderer = ({ cursor, value }, prompt) => {
@@ -70016,20 +70016,20 @@ var getSelectListRenderers = (config29) => {
70016
70016
  submit: ({ value }) => {
70017
70017
  if (Array.isArray(value)) {
70018
70018
  return renderSubmit(
70019
- config29,
70019
+ config34,
70020
70020
  options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
70021
70021
  );
70022
70022
  }
70023
70023
  return renderSubmit(
70024
- config29,
70024
+ config34,
70025
70025
  options.find((o) => o.value === value)?.value
70026
70026
  );
70027
70027
  },
70028
70028
  cancel: defaultRenderer
70029
70029
  };
70030
70030
  };
70031
- var getConfirmRenderers = (config29) => {
70032
- const { activeText, inactiveText, question, helpText: _helpText } = config29;
70031
+ var getConfirmRenderers = (config34) => {
70032
+ const { activeText, inactiveText, question, helpText: _helpText } = config34;
70033
70033
  const helpText = _helpText ?? "";
70034
70034
  const active = activeText || "Yes";
70035
70035
  const inactive = inactiveText || "No";
@@ -70046,7 +70046,7 @@ var getConfirmRenderers = (config29) => {
70046
70046
  active: defaultRenderer,
70047
70047
  confirm: defaultRenderer,
70048
70048
  error: defaultRenderer,
70049
- submit: ({ value }) => renderSubmit(config29, value ? "yes" : "no"),
70049
+ submit: ({ value }) => renderSubmit(config34, value ? "yes" : "no"),
70050
70050
  cancel: defaultRenderer
70051
70051
  };
70052
70052
  };
@@ -71016,23 +71016,23 @@ var YargsParser = class {
71016
71016
  const configPath = argv2[configKey] || configLookup[configKey];
71017
71017
  if (configPath) {
71018
71018
  try {
71019
- let config29 = null;
71019
+ let config34 = null;
71020
71020
  const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
71021
71021
  const resolveConfig = flags.configs[configKey];
71022
71022
  if (typeof resolveConfig === "function") {
71023
71023
  try {
71024
- config29 = resolveConfig(resolvedConfigPath);
71024
+ config34 = resolveConfig(resolvedConfigPath);
71025
71025
  } catch (e) {
71026
- config29 = e;
71026
+ config34 = e;
71027
71027
  }
71028
- if (config29 instanceof Error) {
71029
- error2 = config29;
71028
+ if (config34 instanceof Error) {
71029
+ error2 = config34;
71030
71030
  return;
71031
71031
  }
71032
71032
  } else {
71033
- config29 = mixin2.require(resolvedConfigPath);
71033
+ config34 = mixin2.require(resolvedConfigPath);
71034
71034
  }
71035
- setConfigObject(config29);
71035
+ setConfigObject(config34);
71036
71036
  } catch (ex) {
71037
71037
  if (ex.name === "PermissionDenied")
71038
71038
  error2 = ex;
@@ -71042,9 +71042,9 @@ var YargsParser = class {
71042
71042
  }
71043
71043
  });
71044
71044
  }
71045
- function setConfigObject(config29, prev) {
71046
- Object.keys(config29).forEach(function(key) {
71047
- const value = config29[key];
71045
+ function setConfigObject(config34, prev) {
71046
+ Object.keys(config34).forEach(function(key) {
71047
+ const value = config34[key];
71048
71048
  const fullKey = prev ? prev + "." + key : key;
71049
71049
  if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
71050
71050
  setConfigObject(value, fullKey);
@@ -72196,11 +72196,11 @@ var CommandInstance = class {
72196
72196
  });
72197
72197
  if (!unparsed.length)
72198
72198
  return;
72199
- const config29 = Object.assign({}, options.configuration, {
72199
+ const config34 = Object.assign({}, options.configuration, {
72200
72200
  "populate--": false
72201
72201
  });
72202
72202
  const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
72203
- configuration: config29
72203
+ configuration: config34
72204
72204
  }));
72205
72205
  if (parsed.error) {
72206
72206
  yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
@@ -73423,31 +73423,31 @@ ${customMsgs.join("\n")}` : "";
73423
73423
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
73424
73424
  var previouslyVisitedConfigs = [];
73425
73425
  var shim2;
73426
- function applyExtends(config29, cwd, mergeExtends, _shim) {
73426
+ function applyExtends(config34, cwd, mergeExtends, _shim) {
73427
73427
  shim2 = _shim;
73428
73428
  let defaultConfig = {};
73429
- if (Object.prototype.hasOwnProperty.call(config29, "extends")) {
73430
- if (typeof config29.extends !== "string")
73429
+ if (Object.prototype.hasOwnProperty.call(config34, "extends")) {
73430
+ if (typeof config34.extends !== "string")
73431
73431
  return defaultConfig;
73432
- const isPath = /\.json|\..*rc$/.test(config29.extends);
73432
+ const isPath = /\.json|\..*rc$/.test(config34.extends);
73433
73433
  let pathToDefault = null;
73434
73434
  if (!isPath) {
73435
73435
  try {
73436
- pathToDefault = require.resolve(config29.extends);
73436
+ pathToDefault = require.resolve(config34.extends);
73437
73437
  } catch (_err) {
73438
- return config29;
73438
+ return config34;
73439
73439
  }
73440
73440
  } else {
73441
- pathToDefault = getPathToDefaultConfig(cwd, config29.extends);
73441
+ pathToDefault = getPathToDefaultConfig(cwd, config34.extends);
73442
73442
  }
73443
73443
  checkForCircularExtends(pathToDefault);
73444
73444
  previouslyVisitedConfigs.push(pathToDefault);
73445
- defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config29.extends);
73446
- delete config29.extends;
73445
+ defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config34.extends);
73446
+ delete config34.extends;
73447
73447
  defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
73448
73448
  }
73449
73449
  previouslyVisitedConfigs = [];
73450
- return mergeExtends ? mergeDeep(defaultConfig, config29) : Object.assign({}, defaultConfig, config29);
73450
+ return mergeExtends ? mergeDeep(defaultConfig, config34) : Object.assign({}, defaultConfig, config34);
73451
73451
  }
73452
73452
  function checkForCircularExtends(cfgPath) {
73453
73453
  if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
@@ -73457,17 +73457,17 @@ function checkForCircularExtends(cfgPath) {
73457
73457
  function getPathToDefaultConfig(cwd, pathToExtend) {
73458
73458
  return shim2.path.resolve(cwd, pathToExtend);
73459
73459
  }
73460
- function mergeDeep(config1, config29) {
73460
+ function mergeDeep(config1, config210) {
73461
73461
  const target = {};
73462
73462
  function isObject(obj) {
73463
73463
  return obj && typeof obj === "object" && !Array.isArray(obj);
73464
73464
  }
73465
73465
  Object.assign(target, config1);
73466
- for (const key of Object.keys(config29)) {
73467
- if (isObject(config29[key]) && isObject(target[key])) {
73468
- target[key] = mergeDeep(config1[key], config29[key]);
73466
+ for (const key of Object.keys(config210)) {
73467
+ if (isObject(config210[key]) && isObject(target[key])) {
73468
+ target[key] = mergeDeep(config1[key], config210[key]);
73469
73469
  } else {
73470
- target[key] = config29[key];
73470
+ target[key] = config210[key];
73471
73471
  }
73472
73472
  }
73473
73473
  return target;
@@ -74228,9 +74228,9 @@ var YargsInstance = class {
74228
74228
  }
74229
74229
  return maybePromise;
74230
74230
  }
74231
- parserConfiguration(config29) {
74232
- argsert("<object>", [config29], arguments.length);
74233
- __classPrivateFieldSet(this, _YargsInstance_parserConfig, config29, "f");
74231
+ parserConfiguration(config34) {
74232
+ argsert("<object>", [config34], arguments.length);
74233
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config34, "f");
74234
74234
  return this;
74235
74235
  }
74236
74236
  pkgConf(key, rootPath) {
@@ -74402,9 +74402,9 @@ var YargsInstance = class {
74402
74402
  return this;
74403
74403
  }
74404
74404
  }
74405
- usageConfiguration(config29) {
74406
- argsert("<object>", [config29], arguments.length);
74407
- __classPrivateFieldSet(this, _YargsInstance_usageConfig, config29, "f");
74405
+ usageConfiguration(config34) {
74406
+ argsert("<object>", [config34], arguments.length);
74407
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config34, "f");
74408
74408
  return this;
74409
74409
  }
74410
74410
  version(opt, msg, ver) {
@@ -74810,11 +74810,11 @@ var YargsInstance = class {
74810
74810
  __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
74811
74811
  __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
74812
74812
  const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
74813
- const config29 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74813
+ const config34 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74814
74814
  "populate--": true
74815
74815
  });
74816
74816
  const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
74817
- configuration: { "parse-positional-numbers": false, ...config29 }
74817
+ configuration: { "parse-positional-numbers": false, ...config34 }
74818
74818
  }));
74819
74819
  const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
74820
74820
  let argvPromise = void 0;
@@ -74977,7 +74977,7 @@ var Yargs = YargsFactory(esm_default);
74977
74977
  var yargs_default = Yargs;
74978
74978
 
74979
74979
  // package.json
74980
- var version = "0.0.0-595f17092";
74980
+ var version = "0.0.0-597255fd3";
74981
74981
 
74982
74982
  // src/metrics.ts
74983
74983
  var import_node_async_hooks = require("node:async_hooks");
@@ -75021,12 +75021,12 @@ function getGlobalWranglerConfigPath() {
75021
75021
  }
75022
75022
 
75023
75023
  // src/helpers/metrics-config.ts
75024
- function writeMetricsConfig(config29) {
75024
+ function writeMetricsConfig(config34) {
75025
75025
  (0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
75026
75026
  (0, import_node_fs2.writeFileSync)(
75027
75027
  getMetricsConfigPath(),
75028
75028
  JSON.stringify(
75029
- config29,
75029
+ config34,
75030
75030
  (_key, value) => value instanceof Date ? value.toISOString() : value,
75031
75031
  " "
75032
75032
  )
@@ -75034,9 +75034,9 @@ function writeMetricsConfig(config29) {
75034
75034
  }
75035
75035
  function readMetricsConfig() {
75036
75036
  try {
75037
- const config29 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
75037
+ const config34 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
75038
75038
  return JSON.parse(
75039
- config29,
75039
+ config34,
75040
75040
  (key, value) => key === "date" ? new Date(value) : value
75041
75041
  );
75042
75042
  } catch {
@@ -75046,10 +75046,10 @@ function readMetricsConfig() {
75046
75046
  function getMetricsConfigPath() {
75047
75047
  return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
75048
75048
  }
75049
- function getDeviceId(config29) {
75050
- const deviceId = config29.deviceId ?? (0, import_node_crypto.randomUUID)();
75051
- if (config29.deviceId === void 0) {
75052
- writeMetricsConfig({ ...config29, deviceId });
75049
+ function getDeviceId(config34) {
75050
+ const deviceId = config34.deviceId ?? (0, import_node_crypto.randomUUID)();
75051
+ if (config34.deviceId === void 0) {
75052
+ writeMetricsConfig({ ...config34, deviceId });
75053
75053
  }
75054
75054
  return deviceId;
75055
75055
  }
@@ -75324,10 +75324,10 @@ function getPlatform() {
75324
75324
  function createReporter() {
75325
75325
  const events = [];
75326
75326
  const als = new import_node_async_hooks.AsyncLocalStorage();
75327
- const config29 = readMetricsConfig() ?? {};
75328
- const isFirstUsage = config29.c3permission === void 0;
75327
+ const config34 = readMetricsConfig() ?? {};
75328
+ const isFirstUsage = config34.c3permission === void 0;
75329
75329
  const isEnabled = isTelemetryEnabled();
75330
- const deviceId = getDeviceId(config29);
75330
+ const deviceId = getDeviceId(config34);
75331
75331
  const packageManager = detectPackageManager();
75332
75332
  const platform3 = getPlatform();
75333
75333
  const amplitude_session_id = Date.now();
@@ -75360,7 +75360,7 @@ function createReporter() {
75360
75360
  if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
75361
75361
  return false;
75362
75362
  }
75363
- return hasSparrowSourceKey() && getC3Permission(config29).enabled;
75363
+ return hasSparrowSourceKey() && getC3Permission(config34).enabled;
75364
75364
  }
75365
75365
  async function waitForAllEventsSettled() {
75366
75366
  await Promise.allSettled(events);
@@ -75466,20 +75466,20 @@ function initializeC3Permission(enabled = true) {
75466
75466
  date: /* @__PURE__ */ new Date()
75467
75467
  };
75468
75468
  }
75469
- function getC3Permission(config29 = readMetricsConfig() ?? {}) {
75470
- if (!config29.c3permission) {
75471
- config29.c3permission = initializeC3Permission();
75472
- writeMetricsConfig(config29);
75469
+ function getC3Permission(config34 = readMetricsConfig() ?? {}) {
75470
+ if (!config34.c3permission) {
75471
+ config34.c3permission = initializeC3Permission();
75472
+ writeMetricsConfig(config34);
75473
75473
  }
75474
- return config29.c3permission;
75474
+ return config34.c3permission;
75475
75475
  }
75476
75476
  function updateC3Pemission(enabled) {
75477
- const config29 = readMetricsConfig();
75478
- if (config29.c3permission?.enabled === enabled) {
75477
+ const config34 = readMetricsConfig();
75478
+ if (config34.c3permission?.enabled === enabled) {
75479
75479
  return;
75480
75480
  }
75481
- config29.c3permission = initializeC3Permission(enabled);
75482
- writeMetricsConfig(config29);
75481
+ config34.c3permission = initializeC3Permission(enabled);
75482
+ writeMetricsConfig(config34);
75483
75483
  }
75484
75484
  var runTelemetryCommand = (action) => {
75485
75485
  const logTelemetryStatus = (enabled) => {
@@ -75524,28 +75524,28 @@ var import_haikunator = __toESM(require_dist_web());
75524
75524
  var import_fs6 = require("fs");
75525
75525
  var import_path6 = __toESM(require("path"));
75526
75526
  var import_undici2 = __toESM(require_undici());
75527
- var installPackages = async (packages, config29 = {}) => {
75527
+ var installPackages = async (packages, config34 = {}) => {
75528
75528
  const { npm: npm24 } = detectPackageManager();
75529
75529
  let saveFlag;
75530
75530
  let cmd;
75531
75531
  switch (npm24) {
75532
75532
  case "yarn":
75533
75533
  cmd = "add";
75534
- saveFlag = config29.dev ? "-D" : "";
75534
+ saveFlag = config34.dev ? "-D" : "";
75535
75535
  break;
75536
75536
  case "bun":
75537
75537
  cmd = "add";
75538
- saveFlag = config29.dev ? "-d" : "";
75538
+ saveFlag = config34.dev ? "-d" : "";
75539
75539
  break;
75540
75540
  case "npm":
75541
75541
  case "pnpm":
75542
75542
  default:
75543
75543
  cmd = "install";
75544
- saveFlag = config29.dev ? "--save-dev" : "";
75544
+ saveFlag = config34.dev ? "--save-dev" : "";
75545
75545
  break;
75546
75546
  }
75547
75547
  await runCommand([npm24, cmd, ...saveFlag ? [saveFlag] : [], ...packages], {
75548
- ...config29,
75548
+ ...config34,
75549
75549
  silent: true
75550
75550
  });
75551
75551
  };
@@ -75726,9 +75726,6 @@ var usesEslint = (ctx) => {
75726
75726
  return { used: false };
75727
75727
  };
75728
75728
 
75729
- // templates-experimental/angular/c3.ts
75730
- var import_node_path3 = require("node:path");
75731
-
75732
75729
  // src/frameworks/package.json
75733
75730
  var package_default = {
75734
75731
  name: "frameworks_clis_info",
@@ -75780,91 +75777,6 @@ var runFrameworkGenerator = async (ctx, args) => {
75780
75777
  await runCommand(cmd, { env: env3 });
75781
75778
  };
75782
75779
 
75783
- // templates-experimental/angular/c3.ts
75784
- var { npm } = detectPackageManager();
75785
- var generate = async (ctx) => {
75786
- await runFrameworkGenerator(ctx, [
75787
- ctx.project.name,
75788
- "--ssr",
75789
- "--server-routing"
75790
- ]);
75791
- logRaw("");
75792
- };
75793
- var configure = async (ctx) => {
75794
- updateAngularJson(ctx);
75795
- await updateAppCode();
75796
- await installCFWorker();
75797
- };
75798
- async function installCFWorker() {
75799
- await installPackages(["xhr2"], {
75800
- dev: true,
75801
- startText: "Installing additional dependencies",
75802
- doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
75803
- });
75804
- }
75805
- async function updateAppCode() {
75806
- const s = spinner();
75807
- s.start(`Updating application code`);
75808
- const appConfigPath = "src/app/app.config.ts";
75809
- const appConfig = readFile((0, import_node_path3.resolve)(appConfigPath));
75810
- const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
75811
- "providers: [",
75812
- "providers: [provideHttpClient(withFetch()), "
75813
- );
75814
- writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
75815
- s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
75816
- const appServerRoutesPath = "src/app/app.routes.server.ts";
75817
- const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
75818
- const newAppRoutes = appRoutes.replace(
75819
- "RenderMode.Prerender",
75820
- "RenderMode.Server"
75821
- );
75822
- writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
75823
- s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
75824
- s.start(`Updating package.json`);
75825
- const packageJsonPath = (0, import_node_path3.resolve)("package.json");
75826
- const packageManifest = readJSON(packageJsonPath);
75827
- delete packageManifest["dependencies"]?.["express"];
75828
- delete packageManifest["devDependencies"]?.["@types/express"];
75829
- writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
75830
- s.stop(`${brandColor(`updated`)} ${dim(`\`package.json\``)}`);
75831
- }
75832
- function updateAngularJson(ctx) {
75833
- const s = spinner();
75834
- s.start(`Updating angular.json config`);
75835
- const angularJson = readJSON((0, import_node_path3.resolve)("angular.json"));
75836
- const architectSection = angularJson.projects[ctx.project.name].architect;
75837
- architectSection.build.options.outputPath = "dist";
75838
- architectSection.build.options.outputMode = "server";
75839
- architectSection.build.options.ssr.experimentalPlatform = "neutral";
75840
- writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
75841
- s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
75842
- }
75843
- var config = {
75844
- configVersion: 1,
75845
- id: "angular",
75846
- frameworkCli: "@angular/create",
75847
- displayName: "Angular",
75848
- platform: "workers",
75849
- copyFiles: {
75850
- path: "./templates"
75851
- },
75852
- path: "templates-experimental/angular",
75853
- devScript: "start",
75854
- deployScript: "deploy",
75855
- previewScript: "start",
75856
- generate,
75857
- configure,
75858
- transformPackageJson: async () => ({
75859
- scripts: {
75860
- start: `${npm} run build && wrangler dev`,
75861
- build: `ng build`,
75862
- deploy: `${npm} run build && wrangler deploy`
75863
- }
75864
- })
75865
- };
75866
- var c3_default = config;
75867
-
75868
75780
  // src/helpers/codemod.ts
75869
75781
  var import_fs8 = require("fs");
75870
75782
  var import_path8 = __toESM(require("path"));
@@ -75943,11 +75855,11 @@ var getPropertyName = (newProp) => {
75943
75855
  // templates-experimental/astro/c3.ts
75944
75856
  var recast2 = __toESM(require_main3());
75945
75857
  var { npx } = detectPackageManager();
75946
- var generate2 = async (ctx) => {
75858
+ var generate = async (ctx) => {
75947
75859
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
75948
75860
  logRaw("");
75949
75861
  };
75950
- var configure2 = async () => {
75862
+ var configure = async () => {
75951
75863
  await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
75952
75864
  silent: true,
75953
75865
  startText: "Installing adapter",
@@ -75981,7 +75893,7 @@ var updateAstroConfig = () => {
75981
75893
  }
75982
75894
  });
75983
75895
  };
75984
- var config2 = {
75896
+ var config = {
75985
75897
  configVersion: 1,
75986
75898
  id: "astro",
75987
75899
  frameworkCli: "create-astro",
@@ -76004,8 +75916,8 @@ var config2 = {
76004
75916
  deployScript: "deploy",
76005
75917
  previewScript: "preview",
76006
75918
  path: "templates-experimental/astro",
76007
- generate: generate2,
76008
- configure: configure2,
75919
+ generate,
75920
+ configure,
76009
75921
  transformPackageJson: async (pkgJson, ctx) => ({
76010
75922
  scripts: {
76011
75923
  deploy: `astro build && wrangler deploy`,
@@ -76014,54 +75926,10 @@ var config2 = {
76014
75926
  }
76015
75927
  })
76016
75928
  };
76017
- var c3_default2 = config2;
76018
-
76019
- // templates-experimental/gatsby/c3.ts
76020
- var { npm: npm2 } = detectPackageManager();
76021
- var generate3 = async (ctx) => {
76022
- const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76023
- const useTemplate = await inputPrompt({
76024
- type: "confirm",
76025
- question: "Would you like to use a template?",
76026
- label: "template",
76027
- defaultValue: true
76028
- });
76029
- let templateUrl = "";
76030
- if (useTemplate) {
76031
- templateUrl = await inputPrompt({
76032
- type: "text",
76033
- question: `Please specify the url of the template you'd like to use`,
76034
- label: "template",
76035
- defaultValue: defaultTemplate
76036
- });
76037
- }
76038
- await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76039
- };
76040
- var config3 = {
76041
- configVersion: 1,
76042
- id: "gatsby",
76043
- frameworkCli: "gatsby",
76044
- platform: "workers",
76045
- displayName: "Gatsby",
76046
- copyFiles: {
76047
- path: "./templates"
76048
- },
76049
- path: "templates-experimental/gatsby",
76050
- generate: generate3,
76051
- transformPackageJson: async () => ({
76052
- scripts: {
76053
- deploy: `${npm2} run build && wrangler deploy`,
76054
- preview: `${npm2} run build && wrangler dev`
76055
- }
76056
- }),
76057
- devScript: "develop",
76058
- deployScript: "deploy",
76059
- previewScript: "preview"
76060
- };
76061
- var c3_default3 = config3;
75929
+ var c3_default = config;
76062
75930
 
76063
75931
  // templates-experimental/hello-world-assets-only/c3.ts
76064
- var config4 = {
75932
+ var config2 = {
76065
75933
  configVersion: 1,
76066
75934
  id: "hello-world-assets-only",
76067
75935
  path: "templates-experimental/hello-world-assets-only",
@@ -76072,10 +75940,10 @@ var config4 = {
76072
75940
  path: "./templates"
76073
75941
  }
76074
75942
  };
76075
- var c3_default4 = config4;
75943
+ var c3_default2 = config2;
76076
75944
 
76077
75945
  // templates-experimental/hello-world-durable-object-with-assets/c3.ts
76078
- var config5 = {
75946
+ var config3 = {
76079
75947
  configVersion: 1,
76080
75948
  id: "hello-world-durable-object-with-assets",
76081
75949
  path: "templates-experimental/hello-world-durable-object-with-assets",
@@ -76093,10 +75961,10 @@ var config5 = {
76093
75961
  }
76094
75962
  }
76095
75963
  };
76096
- var c3_default5 = config5;
75964
+ var c3_default3 = config3;
76097
75965
 
76098
75966
  // templates-experimental/hello-world-with-assets/c3.ts
76099
- var c3_default6 = {
75967
+ var c3_default4 = {
76100
75968
  configVersion: 1,
76101
75969
  id: "hello-world-with-assets",
76102
75970
  path: "templates-experimental/hello-world-with-assets",
@@ -76119,7 +75987,7 @@ var c3_default6 = {
76119
75987
  };
76120
75988
 
76121
75989
  // templates-experimental/hono/c3.ts
76122
- var generate4 = async (ctx) => {
75990
+ var generate2 = async (ctx) => {
76123
75991
  const { name: pm4 } = detectPackageManager();
76124
75992
  await runFrameworkGenerator(ctx, [
76125
75993
  ctx.project.name,
@@ -76131,7 +75999,7 @@ var generate4 = async (ctx) => {
76131
75999
  ]);
76132
76000
  logRaw("");
76133
76001
  };
76134
- var config6 = {
76002
+ var config4 = {
76135
76003
  configVersion: 1,
76136
76004
  id: "hono",
76137
76005
  frameworkCli: "create-hono",
@@ -76141,7 +76009,7 @@ var config6 = {
76141
76009
  },
76142
76010
  platform: "workers",
76143
76011
  path: "templates-experimental/hono",
76144
- generate: generate4,
76012
+ generate: generate2,
76145
76013
  transformPackageJson: async () => ({
76146
76014
  scripts: {
76147
76015
  dev: "wrangler dev",
@@ -76153,13 +76021,13 @@ var config6 = {
76153
76021
  deployScript: "deploy",
76154
76022
  previewScript: "dev"
76155
76023
  };
76156
- var c3_default7 = config6;
76024
+ var c3_default5 = config4;
76157
76025
 
76158
76026
  // templates-experimental/next/c3.ts
76159
- var generate5 = async (ctx) => {
76027
+ var generate3 = async (ctx) => {
76160
76028
  await runFrameworkGenerator(ctx, [ctx.project.name]);
76161
76029
  };
76162
- var configure3 = async () => {
76030
+ var configure2 = async () => {
76163
76031
  const packages = [
76164
76032
  "@opennextjs/cloudflare@0.5.x",
76165
76033
  "@cloudflare/workers-types"
@@ -76184,7 +76052,7 @@ var updateNextConfig = () => {
76184
76052
  writeFile2(configFile, updatedConfigFile);
76185
76053
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76186
76054
  };
76187
- var c3_default8 = {
76055
+ var c3_default6 = {
76188
76056
  configVersion: 1,
76189
76057
  id: "next",
76190
76058
  frameworkCli: "create-next-app",
@@ -76198,8 +76066,8 @@ var c3_default8 = {
76198
76066
  copyFiles: {
76199
76067
  path: "./templates"
76200
76068
  },
76201
- generate: generate5,
76202
- configure: configure3,
76069
+ generate: generate3,
76070
+ configure: configure2,
76203
76071
  transformPackageJson: async () => ({
76204
76072
  scripts: {
76205
76073
  deploy: `opennextjs-cloudflare && wrangler deploy`,
@@ -76213,165 +76081,14 @@ var c3_default8 = {
76213
76081
  compatibilityFlags: ["nodejs_compat"]
76214
76082
  };
76215
76083
 
76216
- // src/helpers/compatDate.ts
76217
- var import_fs9 = require("fs");
76218
- var import_path9 = require("path");
76219
- async function getWorkerdCompatibilityDate() {
76220
- const s = spinner();
76221
- s.start("Retrieving current workerd compatibility date");
76222
- try {
76223
- const latestWorkerdVersion = await getLatestPackageVersion("workerd");
76224
- const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
76225
- if (match) {
76226
- const [, year, month, date] = match;
76227
- let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
76228
- if (compatDate.getTime() > Date.now()) {
76229
- compatDate = new Date(Date.now());
76230
- }
76231
- const compatDateString = compatDate.toISOString().slice(0, 10);
76232
- s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
76233
- return compatDateString;
76234
- }
76235
- } catch {
76236
- }
76237
- const fallbackDate = "2024-11-11";
76238
- s.stop(
76239
- `${brandColor("compatibility date")} ${dim(
76240
- ` Could not find workerd date, falling back to ${fallbackDate}`
76241
- )}`
76242
- );
76243
- return fallbackDate;
76244
- }
76245
- var compatDateFlag = async () => {
76246
- const workerdCompatDate = await getWorkerdCompatibilityDate();
76247
- return `--compatibility-date=${workerdCompatDate}`;
76248
- };
76249
- function getLatestTypesEntrypoint(ctx) {
76250
- const workersTypesPath = (0, import_path9.resolve)(
76251
- ctx.project.path,
76252
- "node_modules",
76253
- "@cloudflare",
76254
- "workers-types"
76255
- );
76256
- try {
76257
- const entrypoints = (0, import_fs9.readdirSync)(workersTypesPath);
76258
- const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
76259
- if (sorted.length === 0) {
76260
- return null;
76261
- }
76262
- return sorted[0];
76263
- } catch (error2) {
76264
- return null;
76265
- }
76266
- }
76267
-
76268
- // templates-experimental/nuxt/c3.ts
76269
- var recast3 = __toESM(require_main3());
76270
- var { npm: npm3, name: pm } = detectPackageManager();
76271
- var generate6 = async (ctx) => {
76272
- const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76273
- await runFrameworkGenerator(ctx, [
76274
- "init",
76275
- ctx.project.name,
76276
- "--packageManager",
76277
- npm3,
76278
- gitFlag
76279
- ]);
76280
- writeFile2("./.node-version", "18");
76281
- logRaw("");
76282
- };
76283
- var configure4 = async (ctx) => {
76284
- const packages = ["nitro-cloudflare-dev", "nitropack"];
76285
- if (pm === "pnpm") {
76286
- packages.push("h3");
76287
- }
76288
- await installPackages(packages, {
76289
- dev: true,
76290
- startText: "Installing nitro module `nitro-cloudflare-dev`",
76291
- doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
76292
- });
76293
- updateNuxtConfig();
76294
- updateEnvTypes(ctx);
76295
- };
76296
- var updateEnvTypes = (ctx) => {
76297
- const filepath = "env.d.ts";
76298
- const s = spinner();
76299
- s.start(`Updating ${filepath}`);
76300
- let file = readFile(filepath);
76301
- let typesEntrypoint = `@cloudflare/workers-types`;
76302
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
76303
- if (latestEntrypoint) {
76304
- typesEntrypoint += `/${latestEntrypoint}`;
76305
- }
76306
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
76307
- writeFile2("env.d.ts", file);
76308
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76309
- };
76310
- var updateNuxtConfig = () => {
76311
- const s = spinner();
76312
- const configFile = "nuxt.config.ts";
76313
- s.start(`Updating \`${configFile}\``);
76314
- const b3 = recast3.types.builders;
76315
- const presetDef = b3.objectProperty(
76316
- b3.identifier("nitro"),
76317
- b3.objectExpression([
76318
- b3.objectProperty(
76319
- b3.identifier("preset"),
76320
- b3.stringLiteral("cloudflare_module")
76321
- )
76322
- ])
76323
- );
76324
- const moduleDef = b3.objectProperty(
76325
- b3.identifier("modules"),
76326
- b3.arrayExpression([b3.stringLiteral("nitro-cloudflare-dev")])
76327
- );
76328
- transformFile(configFile, {
76329
- visitCallExpression: function(n) {
76330
- const callee = n.node.callee;
76331
- if (callee.name === "defineNuxtConfig") {
76332
- mergeObjectProperties(
76333
- n.node.arguments[0],
76334
- [presetDef, moduleDef]
76335
- );
76336
- }
76337
- return this.traverse(n);
76338
- }
76339
- });
76340
- s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76341
- };
76342
- var config7 = {
76343
- configVersion: 1,
76344
- id: "nuxt",
76345
- frameworkCli: "nuxi",
76346
- platform: "workers",
76347
- displayName: "Nuxt",
76348
- copyFiles: {
76349
- path: "./templates"
76350
- },
76351
- path: "templates-experimental/nuxt",
76352
- generate: generate6,
76353
- configure: configure4,
76354
- transformPackageJson: async () => ({
76355
- scripts: {
76356
- deploy: `${npm3} run build && wrangler deploy`,
76357
- preview: `${npm3} run build && wrangler dev`,
76358
- "cf-typegen": `wrangler types`
76359
- }
76360
- }),
76361
- devScript: "dev",
76362
- deployScript: "deploy",
76363
- previewScript: "preview"
76364
- };
76365
- var c3_default9 = config7;
76366
-
76367
76084
  // templates-experimental/qwik/c3.ts
76368
- var recast4 = __toESM(require_main3());
76369
- var { npm: npm4, npx: npx2, name } = detectPackageManager();
76370
- var generate7 = async (ctx) => {
76085
+ var recast3 = __toESM(require_main3());
76086
+ var { npm, npx: npx2, name } = detectPackageManager();
76087
+ var generate4 = async (ctx) => {
76371
76088
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
76372
76089
  };
76373
- var configure5 = async (ctx) => {
76374
- const cmd = [name === "pnpm" ? npm4 : npx2, "qwik", "add", "cloudflare-pages"];
76090
+ var configure3 = async (ctx) => {
76091
+ const cmd = [name === "pnpm" ? npm : npx2, "qwik", "add", "cloudflare-pages"];
76375
76092
  endSection(`Running ${quoteShellArgs(cmd)}`);
76376
76093
  await runCommand(cmd);
76377
76094
  removeFile("./public/_headers");
@@ -76387,7 +76104,7 @@ var addBindingsProxy = (ctx) => {
76387
76104
  const s = spinner();
76388
76105
  s.start("Updating `vite.config.ts`");
76389
76106
  const snippets = loadTemplateSnippets(ctx);
76390
- const b3 = recast4.types.builders;
76107
+ const b3 = recast3.types.builders;
76391
76108
  transformFile("vite.config.ts", {
76392
76109
  // Insert the env declaration after the last import (but before the rest of the body)
76393
76110
  visitProgram: function(n) {
@@ -76429,7 +76146,7 @@ var populateCloudflareEnv = () => {
76429
76146
  s.start(`Updating \`${entrypointPath}\``);
76430
76147
  transformFile(entrypointPath, {
76431
76148
  visitTSInterfaceDeclaration: function(n) {
76432
- const b3 = recast4.types.builders;
76149
+ const b3 = recast3.types.builders;
76433
76150
  const id = n.node.id;
76434
76151
  if (id.name !== "QwikCityPlatform") {
76435
76152
  this.traverse(n);
@@ -76450,7 +76167,7 @@ var populateCloudflareEnv = () => {
76450
76167
  });
76451
76168
  s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
76452
76169
  };
76453
- var config8 = {
76170
+ var config5 = {
76454
76171
  configVersion: 1,
76455
76172
  id: "qwik",
76456
76173
  frameworkCli: "create-qwik",
@@ -76460,12 +76177,12 @@ var config8 = {
76460
76177
  path: "./templates"
76461
76178
  },
76462
76179
  path: "templates-experimental/qwik",
76463
- generate: generate7,
76464
- configure: configure5,
76180
+ generate: generate4,
76181
+ configure: configure3,
76465
76182
  transformPackageJson: async () => ({
76466
76183
  scripts: {
76467
- deploy: `${npm4} run build && wrangler deploy`,
76468
- preview: `${npm4} run build && wrangler dev`,
76184
+ deploy: `${npm} run build && wrangler deploy`,
76185
+ preview: `${npm} run build && wrangler dev`,
76469
76186
  "cf-typegen": `wrangler types`
76470
76187
  }
76471
76188
  }),
@@ -76473,148 +76190,11 @@ var config8 = {
76473
76190
  deployScript: "deploy",
76474
76191
  previewScript: "preview"
76475
76192
  };
76476
- var c3_default10 = config8;
76477
-
76478
- // templates-experimental/react/c3.ts
76479
- var import_assert2 = __toESM(require("assert"));
76480
- var recast5 = __toESM(require_main3());
76481
- var b2 = recast5.types.builders;
76482
- var t = recast5.types.namedTypes;
76483
- var { npm: npm5 } = detectPackageManager();
76484
- var generate8 = async (ctx) => {
76485
- const variant = await getVariant();
76486
- ctx.args.lang = variant.lang;
76487
- await runFrameworkGenerator(ctx, [
76488
- ctx.project.name,
76489
- "--template",
76490
- variant.value
76491
- ]);
76492
- logRaw("");
76493
- };
76494
- var configure6 = async (ctx) => {
76495
- await installPackages(["@cloudflare/vite-plugin"], {
76496
- dev: true,
76497
- startText: "Installing the Cloudflare Vite plugin",
76498
- doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
76499
- });
76500
- await transformViteConfig(ctx);
76501
- if (usesTypescript(ctx)) {
76502
- updateTsconfigJson();
76503
- }
76504
- };
76505
- function transformViteConfig(ctx) {
76506
- const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
76507
- transformFile(filePath, {
76508
- visitProgram(n) {
76509
- const lastImportIndex = n.node.body.findLastIndex(
76510
- (statement) => statement.type === "ImportDeclaration"
76511
- );
76512
- const lastImport = n.get("body", lastImportIndex);
76513
- const importAst = b2.importDeclaration(
76514
- [b2.importSpecifier(b2.identifier("cloudflare"))],
76515
- b2.stringLiteral("@cloudflare/vite-plugin")
76516
- );
76517
- lastImport.insertAfter(importAst);
76518
- return this.traverse(n);
76519
- },
76520
- visitCallExpression: function(n) {
76521
- const callee = n.node.callee;
76522
- if (callee.name !== "defineConfig") {
76523
- return this.traverse(n);
76524
- }
76525
- const config29 = n.node.arguments[0];
76526
- (0, import_assert2.default)(t.ObjectExpression.check(config29));
76527
- const pluginsProp = config29.properties.find((prop) => isPluginsProp(prop));
76528
- (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
76529
- pluginsProp.value.elements.push(
76530
- b2.callExpression(b2.identifier("cloudflare"), [])
76531
- );
76532
- return false;
76533
- }
76534
- });
76535
- }
76536
- function isPluginsProp(prop) {
76537
- return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
76538
- }
76539
- function updateTsconfigJson() {
76540
- const s = spinner();
76541
- s.start(`Updating tsconfig.json config`);
76542
- const tsconfig = readJSON("tsconfig.json");
76543
- if (tsconfig && typeof tsconfig === "object") {
76544
- tsconfig.references ??= [];
76545
- tsconfig.references.push({ path: "./tsconfig.worker.json" });
76546
- }
76547
- writeJSON("tsconfig.json", tsconfig);
76548
- s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
76549
- }
76550
- async function getVariant() {
76551
- const variantsOptions2 = [
76552
- {
76553
- value: "react-ts",
76554
- lang: "ts",
76555
- label: "TypeScript"
76556
- },
76557
- {
76558
- value: "react-swc-ts",
76559
- lang: "ts",
76560
- label: "TypeScript + SWC"
76561
- },
76562
- {
76563
- value: "react",
76564
- lang: "js",
76565
- label: "JavaScript"
76566
- },
76567
- {
76568
- value: "react-swc",
76569
- lang: "js",
76570
- label: "JavaScript + SWC"
76571
- }
76572
- ];
76573
- const value = await inputPrompt({
76574
- type: "select",
76575
- question: "Select a variant:",
76576
- label: "variant",
76577
- options: variantsOptions2,
76578
- defaultValue: variantsOptions2[0].value
76579
- });
76580
- const selected = variantsOptions2.find((variant) => variant.value === value);
76581
- (0, import_assert2.default)(selected, "Expected a variant to be selected");
76582
- return selected;
76583
- }
76584
- var config9 = {
76585
- configVersion: 1,
76586
- id: "react",
76587
- frameworkCli: "create-vite",
76588
- displayName: "React",
76589
- platform: "workers",
76590
- path: "templates-experimental/react",
76591
- copyFiles: {
76592
- variants: {
76593
- ts: {
76594
- path: "./ts"
76595
- },
76596
- js: {
76597
- path: "./js"
76598
- }
76599
- }
76600
- },
76601
- generate: generate8,
76602
- configure: configure6,
76603
- transformPackageJson: async () => ({
76604
- scripts: {
76605
- deploy: `${npm5} run build && wrangler deploy`,
76606
- preview: `${npm5} run build && vite preview`
76607
- }
76608
- }),
76609
- devScript: "dev",
76610
- deployScript: "deploy",
76611
- previewScript: "preview"
76612
- };
76613
- var c3_default11 = config9;
76193
+ var c3_default7 = config5;
76614
76194
 
76615
76195
  // templates-experimental/remix/c3.ts
76616
- var { npm: npm6 } = detectPackageManager();
76617
- var generate9 = async (ctx) => {
76196
+ var { npm: npm2 } = detectPackageManager();
76197
+ var generate5 = async (ctx) => {
76618
76198
  await runFrameworkGenerator(ctx, [
76619
76199
  ctx.project.name,
76620
76200
  "--template",
@@ -76622,14 +76202,14 @@ var generate9 = async (ctx) => {
76622
76202
  ]);
76623
76203
  logRaw("");
76624
76204
  };
76625
- var configure7 = async () => {
76205
+ var configure4 = async () => {
76626
76206
  await installPackages(["wrangler@latest"], {
76627
76207
  dev: true,
76628
76208
  startText: "Updating the Wrangler version",
76629
76209
  doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
76630
76210
  });
76631
76211
  };
76632
- var config10 = {
76212
+ var config6 = {
76633
76213
  configVersion: 1,
76634
76214
  id: "remix",
76635
76215
  frameworkCli: "create-remix",
@@ -76639,12 +76219,12 @@ var config10 = {
76639
76219
  path: "./templates"
76640
76220
  },
76641
76221
  path: "templates-experimental/remix",
76642
- generate: generate9,
76643
- configure: configure7,
76222
+ generate: generate5,
76223
+ configure: configure4,
76644
76224
  transformPackageJson: async () => ({
76645
76225
  scripts: {
76646
- deploy: `${npm6} run build && wrangler deploy`,
76647
- preview: `${npm6} run build && wrangler dev`,
76226
+ deploy: `${npm2} run build && wrangler deploy`,
76227
+ preview: `${npm2} run build && wrangler dev`,
76648
76228
  "cf-typegen": `wrangler types`
76649
76229
  }
76650
76230
  }),
@@ -76652,21 +76232,73 @@ var config10 = {
76652
76232
  deployScript: "deploy",
76653
76233
  previewScript: "preview"
76654
76234
  };
76655
- var c3_default12 = config10;
76235
+ var c3_default8 = config6;
76236
+
76237
+ // src/helpers/compatDate.ts
76238
+ var import_fs9 = require("fs");
76239
+ var import_path9 = require("path");
76240
+ async function getWorkerdCompatibilityDate() {
76241
+ const s = spinner();
76242
+ s.start("Retrieving current workerd compatibility date");
76243
+ try {
76244
+ const latestWorkerdVersion = await getLatestPackageVersion("workerd");
76245
+ const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
76246
+ if (match) {
76247
+ const [, year, month, date] = match;
76248
+ let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
76249
+ if (compatDate.getTime() > Date.now()) {
76250
+ compatDate = new Date(Date.now());
76251
+ }
76252
+ const compatDateString = compatDate.toISOString().slice(0, 10);
76253
+ s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
76254
+ return compatDateString;
76255
+ }
76256
+ } catch {
76257
+ }
76258
+ const fallbackDate = "2024-11-11";
76259
+ s.stop(
76260
+ `${brandColor("compatibility date")} ${dim(
76261
+ ` Could not find workerd date, falling back to ${fallbackDate}`
76262
+ )}`
76263
+ );
76264
+ return fallbackDate;
76265
+ }
76266
+ var compatDateFlag = async () => {
76267
+ const workerdCompatDate = await getWorkerdCompatibilityDate();
76268
+ return `--compatibility-date=${workerdCompatDate}`;
76269
+ };
76270
+ function getLatestTypesEntrypoint(ctx) {
76271
+ const workersTypesPath = (0, import_path9.resolve)(
76272
+ ctx.project.path,
76273
+ "node_modules",
76274
+ "@cloudflare",
76275
+ "workers-types"
76276
+ );
76277
+ try {
76278
+ const entrypoints = (0, import_fs9.readdirSync)(workersTypesPath);
76279
+ const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
76280
+ if (sorted.length === 0) {
76281
+ return null;
76282
+ }
76283
+ return sorted[0];
76284
+ } catch (error2) {
76285
+ return null;
76286
+ }
76287
+ }
76656
76288
 
76657
76289
  // templates-experimental/solid/c3.ts
76658
- var recast6 = __toESM(require_main3());
76659
- var { npm: npm7 } = detectPackageManager();
76660
- var generate10 = async (ctx) => {
76290
+ var recast4 = __toESM(require_main3());
76291
+ var { npm: npm3 } = detectPackageManager();
76292
+ var generate6 = async (ctx) => {
76661
76293
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
76662
76294
  logRaw("");
76663
76295
  };
76664
- var configure8 = async (ctx) => {
76296
+ var configure5 = async (ctx) => {
76665
76297
  const packages = ["nitropack"];
76666
76298
  await installPackages(packages, {
76667
76299
  dev: true,
76668
76300
  startText: "Installing nitro module `nitropack`",
76669
- doneText: `${brandColor("installed")} ${dim(`via \`${npm7} install\``)}`
76301
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
76670
76302
  });
76671
76303
  usesTypescript(ctx);
76672
76304
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
@@ -76678,7 +76310,7 @@ var configure8 = async (ctx) => {
76678
76310
  if (callee.name !== "defineConfig") {
76679
76311
  return this.traverse(n);
76680
76312
  }
76681
- const b3 = recast6.types.builders;
76313
+ const b3 = recast4.types.builders;
76682
76314
  mergeObjectProperties(
76683
76315
  n.node.arguments[0],
76684
76316
  [
@@ -76702,7 +76334,7 @@ var configure8 = async (ctx) => {
76702
76334
  }
76703
76335
  });
76704
76336
  };
76705
- var config11 = {
76337
+ var config7 = {
76706
76338
  configVersion: 1,
76707
76339
  id: "solid",
76708
76340
  frameworkCli: "create-solid",
@@ -76712,12 +76344,12 @@ var config11 = {
76712
76344
  path: "./templates"
76713
76345
  },
76714
76346
  path: "templates-experimental/solid",
76715
- generate: generate10,
76716
- configure: configure8,
76347
+ generate: generate6,
76348
+ configure: configure5,
76717
76349
  transformPackageJson: async () => ({
76718
76350
  scripts: {
76719
- preview: `${npm7} run build && npx wrangler dev`,
76720
- deploy: `${npm7} run build && wrangler deploy`
76351
+ preview: `${npm3} run build && npx wrangler dev`,
76352
+ deploy: `${npm3} run build && wrangler deploy`
76721
76353
  }
76722
76354
  }),
76723
76355
  compatibilityFlags: ["nodejs_compat"],
@@ -76725,17 +76357,17 @@ var config11 = {
76725
76357
  deployScript: "deploy",
76726
76358
  previewScript: "preview"
76727
76359
  };
76728
- var c3_default13 = config11;
76360
+ var c3_default9 = config7;
76729
76361
 
76730
76362
  // templates-experimental/svelte/c3.ts
76731
76363
  var import_node_os3 = require("node:os");
76732
- var recast7 = __toESM(require_main3());
76733
- var { npm: npm8 } = detectPackageManager();
76734
- var generate11 = async (ctx) => {
76364
+ var recast5 = __toESM(require_main3());
76365
+ var { npm: npm4 } = detectPackageManager();
76366
+ var generate7 = async (ctx) => {
76735
76367
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
76736
76368
  logRaw("");
76737
76369
  };
76738
- var configure9 = async (ctx) => {
76370
+ var configure6 = async (ctx) => {
76739
76371
  const pkg = `@sveltejs/adapter-cloudflare`;
76740
76372
  await installPackages([pkg], {
76741
76373
  dev: true,
@@ -76762,7 +76394,7 @@ var updateTypeDefinitions = (ctx) => {
76762
76394
  return;
76763
76395
  }
76764
76396
  updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
76765
- const b3 = recast7.types.builders;
76397
+ const b3 = recast5.types.builders;
76766
76398
  transformFile("src/app.d.ts", {
76767
76399
  visitTSModuleDeclaration(n) {
76768
76400
  if (n.value.id.name === "App" && n.node.body) {
@@ -76794,7 +76426,7 @@ var updateTypeDefinitions = (ctx) => {
76794
76426
  }
76795
76427
  });
76796
76428
  };
76797
- var config12 = {
76429
+ var config8 = {
76798
76430
  configVersion: 1,
76799
76431
  id: "svelte",
76800
76432
  frameworkCli: "sv",
@@ -76804,12 +76436,12 @@ var config12 = {
76804
76436
  path: "./templates"
76805
76437
  },
76806
76438
  path: "templates-experimental/svelte",
76807
- generate: generate11,
76808
- configure: configure9,
76439
+ generate: generate7,
76440
+ configure: configure6,
76809
76441
  transformPackageJson: async (original, ctx) => {
76810
76442
  let scripts = {
76811
- preview: `${npm8} run build && wrangler dev`,
76812
- deploy: `${npm8} run build && wrangler deploy`
76443
+ preview: `${npm4} run build && wrangler dev`,
76444
+ deploy: `${npm4} run build && wrangler deploy`
76813
76445
  };
76814
76446
  if (usesTypescript(ctx)) {
76815
76447
  const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
@@ -76824,40 +76456,12 @@ var config12 = {
76824
76456
  deployScript: "deploy",
76825
76457
  previewScript: "preview"
76826
76458
  };
76827
- var c3_default14 = config12;
76828
-
76829
- // templates-experimental/vue/c3.ts
76830
- var { npm: npm9 } = detectPackageManager();
76831
- var generate12 = async (ctx) => {
76832
- await runFrameworkGenerator(ctx, [ctx.project.name]);
76833
- };
76834
- var config13 = {
76835
- configVersion: 1,
76836
- id: "vue",
76837
- frameworkCli: "create-vue",
76838
- platform: "workers",
76839
- displayName: "Vue",
76840
- copyFiles: {
76841
- path: "./templates"
76842
- },
76843
- path: "templates-experimental/vue",
76844
- generate: generate12,
76845
- transformPackageJson: async () => ({
76846
- scripts: {
76847
- deploy: `${npm9} run build && wrangler deploy`,
76848
- preview: `${npm9} run build && wrangler dev`
76849
- }
76850
- }),
76851
- devScript: "dev",
76852
- deployScript: "deploy",
76853
- previewScript: "preview"
76854
- };
76855
- var c3_default15 = config13;
76459
+ var c3_default10 = config8;
76856
76460
 
76857
76461
  // templates/analog/c3.ts
76858
- var recast8 = __toESM(require_main3());
76859
- var { npm: npm10, name: pm2 } = detectPackageManager();
76860
- var generate13 = async (ctx) => {
76462
+ var recast6 = __toESM(require_main3());
76463
+ var { npm: npm5, name: pm } = detectPackageManager();
76464
+ var generate8 = async (ctx) => {
76861
76465
  await runFrameworkGenerator(ctx, [
76862
76466
  ctx.project.name,
76863
76467
  "--template",
@@ -76865,8 +76469,8 @@ var generate13 = async (ctx) => {
76865
76469
  ]);
76866
76470
  logRaw("");
76867
76471
  };
76868
- var configure10 = async (ctx) => {
76869
- if (pm2 === "pnpm" || pm2 === "yarn" || pm2 === "bun") {
76472
+ var configure7 = async (ctx) => {
76473
+ if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
76870
76474
  const packages = [];
76871
76475
  packages.push("nitropack");
76872
76476
  packages.push("h3");
@@ -76875,13 +76479,13 @@ var configure10 = async (ctx) => {
76875
76479
  await installPackages(packages, {
76876
76480
  dev: true,
76877
76481
  startText: `Installing ${packages.join(", ")}`,
76878
- doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
76482
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm5} install\``)}`
76879
76483
  });
76880
76484
  }
76881
76485
  updateViteConfig(ctx);
76882
- updateEnvTypes2(ctx);
76486
+ updateEnvTypes(ctx);
76883
76487
  };
76884
- var updateEnvTypes2 = (ctx) => {
76488
+ var updateEnvTypes = (ctx) => {
76885
76489
  const filepath = "env.d.ts";
76886
76490
  const s = spinner();
76887
76491
  s.start(`Updating ${filepath}`);
@@ -76896,7 +76500,7 @@ var updateEnvTypes2 = (ctx) => {
76896
76500
  s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76897
76501
  };
76898
76502
  var updateViteConfig = (ctx) => {
76899
- const b3 = recast8.types.builders;
76503
+ const b3 = recast6.types.builders;
76900
76504
  const s = spinner();
76901
76505
  const configFile = "vite.config.ts";
76902
76506
  s.start(`Updating \`${configFile}\``);
@@ -76933,7 +76537,7 @@ var updateViteConfig = (ctx) => {
76933
76537
  });
76934
76538
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76935
76539
  };
76936
- var config14 = {
76540
+ var config9 = {
76937
76541
  configVersion: 1,
76938
76542
  id: "analog",
76939
76543
  frameworkCli: "create-analog",
@@ -76942,12 +76546,12 @@ var config14 = {
76942
76546
  copyFiles: {
76943
76547
  path: "./templates"
76944
76548
  },
76945
- generate: generate13,
76946
- configure: configure10,
76549
+ generate: generate8,
76550
+ configure: configure7,
76947
76551
  transformPackageJson: async () => ({
76948
76552
  scripts: {
76949
- preview: `${npm10} run build && wrangler pages dev`,
76950
- deploy: `${npm10} run build && wrangler pages deploy`,
76553
+ preview: `${npm5} run build && wrangler pages dev`,
76554
+ deploy: `${npm5} run build && wrangler pages deploy`,
76951
76555
  "cf-typegen": `wrangler types`
76952
76556
  }
76953
76557
  }),
@@ -76955,12 +76559,100 @@ var config14 = {
76955
76559
  deployScript: "deploy",
76956
76560
  previewScript: "preview"
76957
76561
  };
76958
- var c3_default16 = config14;
76562
+ var c3_default11 = config9;
76959
76563
 
76960
- // templates/angular/c3.ts
76564
+ // templates/angular/pages/c3.ts
76565
+ var import_node_path3 = require("node:path");
76566
+ var { npm: npm6 } = detectPackageManager();
76567
+ var generate9 = async (ctx) => {
76568
+ await runFrameworkGenerator(ctx, [
76569
+ ctx.project.name,
76570
+ "--ssr",
76571
+ "--server-routing"
76572
+ ]);
76573
+ logRaw("");
76574
+ };
76575
+ var configure8 = async (ctx) => {
76576
+ updateAngularJson(ctx);
76577
+ await updateAppCode();
76578
+ await installCFWorker();
76579
+ };
76580
+ async function installCFWorker() {
76581
+ await installPackages(["xhr2"], {
76582
+ dev: true,
76583
+ startText: "Installing additional dependencies",
76584
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm6} install\``)}`
76585
+ });
76586
+ }
76587
+ async function updateAppCode() {
76588
+ const s = spinner();
76589
+ s.start(`Updating application code`);
76590
+ const appConfigPath = "src/app/app.config.ts";
76591
+ const appConfig = readFile((0, import_node_path3.resolve)(appConfigPath));
76592
+ const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
76593
+ "providers: [",
76594
+ "providers: [provideHttpClient(withFetch()), "
76595
+ );
76596
+ writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
76597
+ s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
76598
+ const appServerRoutesPath = "src/app/app.routes.server.ts";
76599
+ const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
76600
+ const newAppRoutes = appRoutes.replace(
76601
+ "RenderMode.Prerender",
76602
+ "RenderMode.Server"
76603
+ );
76604
+ writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
76605
+ s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
76606
+ s.start(`Updating package.json`);
76607
+ const packageJsonPath = (0, import_node_path3.resolve)("package.json");
76608
+ const packageManifest = readJSON(packageJsonPath);
76609
+ delete packageManifest["dependencies"]?.["express"];
76610
+ delete packageManifest["devDependencies"]?.["@types/express"];
76611
+ writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
76612
+ s.stop(`${brandColor(`updated`)} ${dim(`\`package.json\``)}`);
76613
+ }
76614
+ function updateAngularJson(ctx) {
76615
+ const s = spinner();
76616
+ s.start(`Updating angular.json config`);
76617
+ const angularJson = readJSON("angular.json");
76618
+ const architectSection = angularJson.projects[ctx.project.name].architect;
76619
+ architectSection.build.options.outputPath = "dist";
76620
+ architectSection.build.options.outputMode = "server";
76621
+ architectSection.build.options.ssr.experimentalPlatform = "neutral";
76622
+ architectSection.build.options.assets.push("src/_routes.json");
76623
+ writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
76624
+ s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
76625
+ }
76626
+ var config10 = {
76627
+ configVersion: 1,
76628
+ id: "angular",
76629
+ frameworkCli: "@angular/create",
76630
+ displayName: "Angular",
76631
+ platform: "pages",
76632
+ copyFiles: {
76633
+ path: "./templates"
76634
+ },
76635
+ path: "templates/angular/pages",
76636
+ devScript: "start",
76637
+ deployScript: "deploy",
76638
+ previewScript: "start",
76639
+ generate: generate9,
76640
+ configure: configure8,
76641
+ transformPackageJson: async () => ({
76642
+ scripts: {
76643
+ start: `${npm6} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
76644
+ build: `ng build && ${npm6} run process`,
76645
+ process: "node ./tools/copy-files.mjs",
76646
+ deploy: `${npm6} run build && wrangler pages deploy dist/cloudflare`
76647
+ }
76648
+ })
76649
+ };
76650
+ var c3_default12 = config10;
76651
+
76652
+ // templates/angular/workers/c3.ts
76961
76653
  var import_node_path4 = require("node:path");
76962
- var { npm: npm11 } = detectPackageManager();
76963
- var generate14 = async (ctx) => {
76654
+ var { npm: npm7 } = detectPackageManager();
76655
+ var generate10 = async (ctx) => {
76964
76656
  await runFrameworkGenerator(ctx, [
76965
76657
  ctx.project.name,
76966
76658
  "--ssr",
@@ -76968,7 +76660,7 @@ var generate14 = async (ctx) => {
76968
76660
  ]);
76969
76661
  logRaw("");
76970
76662
  };
76971
- var configure11 = async (ctx) => {
76663
+ var configure9 = async (ctx) => {
76972
76664
  updateAngularJson2(ctx);
76973
76665
  await updateAppCode2();
76974
76666
  await installCFWorker2();
@@ -76977,7 +76669,7 @@ async function installCFWorker2() {
76977
76669
  await installPackages(["xhr2"], {
76978
76670
  dev: true,
76979
76671
  startText: "Installing additional dependencies",
76980
- doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
76672
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm7} install\``)}`
76981
76673
  });
76982
76674
  }
76983
76675
  async function updateAppCode2() {
@@ -77010,48 +76702,54 @@ async function updateAppCode2() {
77010
76702
  function updateAngularJson2(ctx) {
77011
76703
  const s = spinner();
77012
76704
  s.start(`Updating angular.json config`);
77013
- const angularJson = readJSON("angular.json");
76705
+ const angularJson = readJSON((0, import_node_path4.resolve)("angular.json"));
77014
76706
  const architectSection = angularJson.projects[ctx.project.name].architect;
77015
76707
  architectSection.build.options.outputPath = "dist";
77016
76708
  architectSection.build.options.outputMode = "server";
77017
76709
  architectSection.build.options.ssr.experimentalPlatform = "neutral";
77018
- architectSection.build.options.assets.push("src/_routes.json");
77019
76710
  writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
77020
76711
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
77021
76712
  }
77022
- var config15 = {
76713
+ var config11 = {
77023
76714
  configVersion: 1,
77024
76715
  id: "angular",
77025
76716
  frameworkCli: "@angular/create",
77026
76717
  displayName: "Angular",
77027
- platform: "pages",
76718
+ platform: "workers",
77028
76719
  copyFiles: {
77029
76720
  path: "./templates"
77030
76721
  },
76722
+ path: "templates/angular/workers",
77031
76723
  devScript: "start",
77032
76724
  deployScript: "deploy",
77033
76725
  previewScript: "start",
77034
- generate: generate14,
77035
- configure: configure11,
76726
+ generate: generate10,
76727
+ configure: configure9,
77036
76728
  transformPackageJson: async () => ({
77037
76729
  scripts: {
77038
- start: `${npm11} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
77039
- build: `ng build && ${npm11} run process`,
77040
- process: "node ./tools/copy-files.mjs",
77041
- deploy: `${npm11} run build && wrangler pages deploy dist/cloudflare`
76730
+ start: `${npm7} run build && wrangler dev`,
76731
+ build: `ng build`,
76732
+ deploy: `${npm7} run build && wrangler deploy`
77042
76733
  }
77043
76734
  })
77044
76735
  };
77045
- var c3_default17 = config15;
76736
+ var c3_default13 = config11;
76737
+
76738
+ // templates/angular/c3.ts
76739
+ var config12 = {
76740
+ displayName: "Angular",
76741
+ platformVariants: { pages: c3_default12, workers: c3_default13 }
76742
+ };
76743
+ var c3_default14 = config12;
77046
76744
 
77047
76745
  // templates/astro/c3.ts
77048
- var recast9 = __toESM(require_main3());
76746
+ var recast7 = __toESM(require_main3());
77049
76747
  var { npx: npx3 } = detectPackageManager();
77050
- var generate15 = async (ctx) => {
76748
+ var generate11 = async (ctx) => {
77051
76749
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
77052
76750
  logRaw("");
77053
76751
  };
77054
- var configure12 = async () => {
76752
+ var configure10 = async () => {
77055
76753
  await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
77056
76754
  silent: true,
77057
76755
  startText: "Installing adapter",
@@ -77070,7 +76768,7 @@ var updateAstroConfig2 = () => {
77070
76768
  if (callee.name !== "cloudflare") {
77071
76769
  return this.traverse(n);
77072
76770
  }
77073
- const b3 = recast9.types.builders;
76771
+ const b3 = recast7.types.builders;
77074
76772
  n.node.arguments = [
77075
76773
  b3.objectExpression([
77076
76774
  b3.objectProperty(
@@ -77085,7 +76783,7 @@ var updateAstroConfig2 = () => {
77085
76783
  }
77086
76784
  });
77087
76785
  };
77088
- var config16 = {
76786
+ var config13 = {
77089
76787
  configVersion: 1,
77090
76788
  id: "astro",
77091
76789
  frameworkCli: "create-astro",
@@ -77107,8 +76805,8 @@ var config16 = {
77107
76805
  devScript: "dev",
77108
76806
  deployScript: "deploy",
77109
76807
  previewScript: "preview",
77110
- generate: generate15,
77111
- configure: configure12,
76808
+ generate: generate11,
76809
+ configure: configure10,
77112
76810
  transformPackageJson: async (pkgJson, ctx) => ({
77113
76811
  scripts: {
77114
76812
  deploy: `astro build && wrangler pages deploy`,
@@ -77117,10 +76815,10 @@ var config16 = {
77117
76815
  }
77118
76816
  })
77119
76817
  };
77120
- var c3_default18 = config16;
76818
+ var c3_default15 = config13;
77121
76819
 
77122
76820
  // templates/common/c3.ts
77123
- var c3_default19 = {
76821
+ var c3_default16 = {
77124
76822
  configVersion: 1,
77125
76823
  id: "common",
77126
76824
  displayName: "Example router & proxy Worker",
@@ -77140,36 +76838,36 @@ var c3_default19 = {
77140
76838
  };
77141
76839
 
77142
76840
  // templates/docusaurus/pages/c3.ts
77143
- var { npm: npm12 } = detectPackageManager();
77144
- var generate16 = async (ctx) => {
76841
+ var { npm: npm8 } = detectPackageManager();
76842
+ var generate12 = async (ctx) => {
77145
76843
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
77146
76844
  };
77147
- var config17 = {
76845
+ var config14 = {
77148
76846
  configVersion: 1,
77149
76847
  id: "docusaurus",
77150
76848
  frameworkCli: "create-docusaurus",
77151
76849
  platform: "pages",
77152
76850
  displayName: "Docusaurus",
77153
76851
  path: "templates/docusaurus/pages",
77154
- generate: generate16,
76852
+ generate: generate12,
77155
76853
  transformPackageJson: async () => ({
77156
76854
  scripts: {
77157
- preview: `${npm12} run build && wrangler pages dev ./build`,
77158
- deploy: `${npm12} run build && wrangler pages deploy ./build`
76855
+ preview: `${npm8} run build && wrangler pages dev ./build`,
76856
+ deploy: `${npm8} run build && wrangler pages deploy ./build`
77159
76857
  }
77160
76858
  }),
77161
76859
  devScript: "preview",
77162
76860
  deployScript: "deploy",
77163
76861
  previewScript: "preview"
77164
76862
  };
77165
- var c3_default20 = config17;
76863
+ var c3_default17 = config14;
77166
76864
 
77167
76865
  // templates/docusaurus/workers/c3.ts
77168
- var { npm: npm13 } = detectPackageManager();
77169
- var generate17 = async (ctx) => {
76866
+ var { npm: npm9 } = detectPackageManager();
76867
+ var generate13 = async (ctx) => {
77170
76868
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
77171
76869
  };
77172
- var config18 = {
76870
+ var config15 = {
77173
76871
  configVersion: 1,
77174
76872
  id: "docusaurus",
77175
76873
  frameworkCli: "create-docusaurus",
@@ -77179,29 +76877,29 @@ var config18 = {
77179
76877
  path: "./templates"
77180
76878
  },
77181
76879
  path: "templates/docusaurus/workers",
77182
- generate: generate17,
76880
+ generate: generate13,
77183
76881
  transformPackageJson: async () => ({
77184
76882
  scripts: {
77185
- deploy: `${npm13} run build && wrangler deploy`,
77186
- preview: `${npm13} run build && wrangler dev`
76883
+ deploy: `${npm9} run build && wrangler deploy`,
76884
+ preview: `${npm9} run build && wrangler dev`
77187
76885
  }
77188
76886
  }),
77189
76887
  devScript: "start",
77190
76888
  deployScript: "deploy",
77191
76889
  previewScript: "preview"
77192
76890
  };
77193
- var c3_default21 = config18;
76891
+ var c3_default18 = config15;
77194
76892
 
77195
76893
  // templates/docusaurus/c3.ts
77196
- var config19 = {
76894
+ var config16 = {
77197
76895
  displayName: "Docusaurus",
77198
- platformVariants: { pages: c3_default20, workers: c3_default21 }
76896
+ platformVariants: { pages: c3_default17, workers: c3_default18 }
77199
76897
  };
77200
- var c3_default22 = config19;
76898
+ var c3_default19 = config16;
77201
76899
 
77202
- // templates/gatsby/c3.ts
77203
- var { npm: npm14 } = detectPackageManager();
77204
- var generate18 = async (ctx) => {
76900
+ // templates/gatsby/pages/c3.ts
76901
+ var { npm: npm10 } = detectPackageManager();
76902
+ var generate14 = async (ctx) => {
77205
76903
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
77206
76904
  const useTemplate = await inputPrompt({
77207
76905
  type: "confirm",
@@ -77220,27 +76918,79 @@ var generate18 = async (ctx) => {
77220
76918
  }
77221
76919
  await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
77222
76920
  };
77223
- var config20 = {
76921
+ var config17 = {
77224
76922
  configVersion: 1,
77225
76923
  id: "gatsby",
77226
76924
  frameworkCli: "gatsby",
77227
76925
  platform: "pages",
77228
76926
  displayName: "Gatsby",
77229
- generate: generate18,
76927
+ path: "templates/gatsby/pages",
76928
+ generate: generate14,
77230
76929
  transformPackageJson: async () => ({
77231
76930
  scripts: {
77232
- deploy: `${npm14} run build && wrangler pages deploy ./public`,
77233
- preview: `${npm14} run build && wrangler pages dev ./public`
76931
+ deploy: `${npm10} run build && wrangler pages deploy ./public`,
76932
+ preview: `${npm10} run build && wrangler pages dev ./public`
77234
76933
  }
77235
76934
  }),
77236
76935
  devScript: "develop",
77237
76936
  deployScript: "deploy",
77238
76937
  previewScript: "preview"
77239
76938
  };
77240
- var c3_default23 = config20;
76939
+ var c3_default20 = config17;
76940
+
76941
+ // templates/gatsby/workers/c3.ts
76942
+ var { npm: npm11 } = detectPackageManager();
76943
+ var generate15 = async (ctx) => {
76944
+ const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76945
+ const useTemplate = await inputPrompt({
76946
+ type: "confirm",
76947
+ question: "Would you like to use a template?",
76948
+ label: "template",
76949
+ defaultValue: true
76950
+ });
76951
+ let templateUrl = "";
76952
+ if (useTemplate) {
76953
+ templateUrl = await inputPrompt({
76954
+ type: "text",
76955
+ question: `Please specify the url of the template you'd like to use`,
76956
+ label: "template",
76957
+ defaultValue: defaultTemplate
76958
+ });
76959
+ }
76960
+ await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76961
+ };
76962
+ var config18 = {
76963
+ configVersion: 1,
76964
+ id: "gatsby",
76965
+ frameworkCli: "gatsby",
76966
+ platform: "workers",
76967
+ displayName: "Gatsby",
76968
+ copyFiles: {
76969
+ path: "./templates"
76970
+ },
76971
+ path: "templates/gatsby/workers",
76972
+ generate: generate15,
76973
+ transformPackageJson: async () => ({
76974
+ scripts: {
76975
+ deploy: `${npm11} run build && wrangler deploy`,
76976
+ preview: `${npm11} run build && wrangler dev`
76977
+ }
76978
+ }),
76979
+ devScript: "develop",
76980
+ deployScript: "deploy",
76981
+ previewScript: "preview"
76982
+ };
76983
+ var c3_default21 = config18;
76984
+
76985
+ // templates/gatsby/c3.ts
76986
+ var config19 = {
76987
+ displayName: "Gatsby",
76988
+ platformVariants: { pages: c3_default20, workers: c3_default21 }
76989
+ };
76990
+ var c3_default22 = config19;
77241
76991
 
77242
76992
  // templates/hello-world-durable-object/c3.ts
77243
- var c3_default24 = {
76993
+ var c3_default23 = {
77244
76994
  configVersion: 1,
77245
76995
  id: "hello-world-durable-object",
77246
76996
  displayName: "Hello World Worker Using Durable Objects",
@@ -77261,7 +77011,7 @@ var c3_default24 = {
77261
77011
  // templates/hello-world/c3.ts
77262
77012
  var import_promises2 = require("node:fs/promises");
77263
77013
  var import_node_path5 = require("node:path");
77264
- var c3_default25 = {
77014
+ var c3_default24 = {
77265
77015
  configVersion: 1,
77266
77016
  id: "hello-world",
77267
77017
  displayName: "Hello World Worker",
@@ -77295,7 +77045,7 @@ var c3_default25 = {
77295
77045
  };
77296
77046
 
77297
77047
  // templates/hono/c3.ts
77298
- var generate19 = async (ctx) => {
77048
+ var generate16 = async (ctx) => {
77299
77049
  const { name: pm4 } = detectPackageManager();
77300
77050
  await runFrameworkGenerator(ctx, [
77301
77051
  ctx.project.name,
@@ -77307,7 +77057,7 @@ var generate19 = async (ctx) => {
77307
77057
  ]);
77308
77058
  logRaw("");
77309
77059
  };
77310
- var configure13 = async (ctx) => {
77060
+ var configure11 = async (ctx) => {
77311
77061
  const indexFile = "src/index.ts";
77312
77062
  const s = spinner();
77313
77063
  s.start(`Updating \`${indexFile}\``);
@@ -77322,7 +77072,7 @@ var configure13 = async (ctx) => {
77322
77072
  });
77323
77073
  s.stop(`${brandColor("updated")} \`${dim(indexFile)}\``);
77324
77074
  };
77325
- var config21 = {
77075
+ var config20 = {
77326
77076
  configVersion: 1,
77327
77077
  id: "hono",
77328
77078
  frameworkCli: "create-hono",
@@ -77331,8 +77081,8 @@ var config21 = {
77331
77081
  path: "./templates"
77332
77082
  },
77333
77083
  platform: "workers",
77334
- generate: generate19,
77335
- configure: configure13,
77084
+ generate: generate16,
77085
+ configure: configure11,
77336
77086
  transformPackageJson: async () => ({
77337
77087
  scripts: {
77338
77088
  dev: "wrangler dev",
@@ -77344,12 +77094,12 @@ var config21 = {
77344
77094
  deployScript: "deploy",
77345
77095
  previewScript: "dev"
77346
77096
  };
77347
- var c3_default26 = config21;
77097
+ var c3_default25 = config20;
77348
77098
 
77349
77099
  // templates/next/c3.ts
77350
77100
  var import_path10 = require("path");
77351
- var { npm: npm15, npx: npx4 } = detectPackageManager();
77352
- var generate20 = async (ctx) => {
77101
+ var { npm: npm12, npx: npx4 } = detectPackageManager();
77102
+ var generate17 = async (ctx) => {
77353
77103
  const projectName = ctx.project.name;
77354
77104
  await runFrameworkGenerator(ctx, [projectName]);
77355
77105
  const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
@@ -77374,7 +77124,7 @@ var updateNextConfig2 = (usesTs) => {
77374
77124
  writeFile2(configFile, updatedConfigFile);
77375
77125
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
77376
77126
  };
77377
- var configure14 = async (ctx) => {
77127
+ var configure12 = async (ctx) => {
77378
77128
  const projectPath = ctx.project.path;
77379
77129
  const path6 = probePaths([
77380
77130
  `${projectPath}/pages/api`,
@@ -77449,14 +77199,14 @@ var addDevDependencies = async (installEslintPlugin) => {
77449
77199
  doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
77450
77200
  });
77451
77201
  };
77452
- var c3_default27 = {
77202
+ var c3_default26 = {
77453
77203
  configVersion: 1,
77454
77204
  id: "next",
77455
77205
  frameworkCli: "create-next-app",
77456
77206
  platform: "pages",
77457
77207
  displayName: "Next.js",
77458
- generate: generate20,
77459
- configure: configure14,
77208
+ generate: generate17,
77209
+ configure: configure12,
77460
77210
  copyFiles: {
77461
77211
  async selectVariant(ctx) {
77462
77212
  const isApp = probePaths([
@@ -77487,12 +77237,12 @@ var c3_default27 = {
77487
77237
  }
77488
77238
  },
77489
77239
  transformPackageJson: async (_3, ctx) => {
77490
- const isNpm = npm15 === "npm";
77491
- const isBun = npm15 === "bun";
77240
+ const isNpm = npm12 === "npm";
77241
+ const isBun = npm12 === "bun";
77492
77242
  const isNpmOrBun = isNpm || isBun;
77493
77243
  const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
77494
77244
  const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
77495
- const pmCommand = isNpmOrBun ? npx4 : npm15;
77245
+ const pmCommand = isNpmOrBun ? npx4 : npm12;
77496
77246
  const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
77497
77247
  return {
77498
77248
  scripts: {
@@ -77511,30 +77261,139 @@ var c3_default27 = {
77511
77261
  compatibilityFlags: ["nodejs_compat"]
77512
77262
  };
77513
77263
 
77514
- // templates/nuxt/c3.ts
77515
- var recast10 = __toESM(require_main3());
77516
- var { npm: npm16, name: pm3 } = detectPackageManager();
77517
- var generate21 = async (ctx) => {
77264
+ // templates/nuxt/pages/c3.ts
77265
+ var recast8 = __toESM(require_main3());
77266
+ var { npm: npm13, name: pm2 } = detectPackageManager();
77267
+ var generate18 = async (ctx) => {
77518
77268
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
77519
77269
  await runFrameworkGenerator(ctx, [
77520
77270
  "init",
77521
77271
  ctx.project.name,
77522
77272
  "--packageManager",
77523
- npm16,
77273
+ npm13,
77524
77274
  gitFlag
77525
77275
  ]);
77526
77276
  writeFile2("./.node-version", "18");
77527
77277
  logRaw("");
77528
77278
  };
77529
- var configure15 = async (ctx) => {
77279
+ var configure13 = async (ctx) => {
77530
77280
  const packages = ["nitro-cloudflare-dev"];
77281
+ if (pm2 === "pnpm") {
77282
+ packages.push("h3");
77283
+ }
77284
+ await installPackages(packages, {
77285
+ dev: true,
77286
+ startText: "Installing nitro module `nitro-cloudflare-dev`",
77287
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm13} install\``)}`
77288
+ });
77289
+ updateNuxtConfig();
77290
+ updateEnvTypes2(ctx);
77291
+ };
77292
+ var updateEnvTypes2 = (ctx) => {
77293
+ const filepath = "env.d.ts";
77294
+ const s = spinner();
77295
+ s.start(`Updating ${filepath}`);
77296
+ let file = readFile(filepath);
77297
+ let typesEntrypoint = `@cloudflare/workers-types`;
77298
+ const latestEntrypoint = getLatestTypesEntrypoint(ctx);
77299
+ if (latestEntrypoint) {
77300
+ typesEntrypoint += `/${latestEntrypoint}`;
77301
+ }
77302
+ file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
77303
+ writeFile2("env.d.ts", file);
77304
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
77305
+ };
77306
+ var updateNuxtConfig = () => {
77307
+ const s = spinner();
77308
+ const configFile = "nuxt.config.ts";
77309
+ s.start(`Updating \`${configFile}\``);
77310
+ const b3 = recast8.types.builders;
77311
+ const presetDef = b3.objectProperty(
77312
+ b3.identifier("nitro"),
77313
+ b3.objectExpression([
77314
+ b3.objectProperty(
77315
+ b3.identifier("preset"),
77316
+ b3.stringLiteral("cloudflare-pages")
77317
+ ),
77318
+ b3.objectProperty(
77319
+ b3.identifier("cloudflare"),
77320
+ b3.objectExpression([
77321
+ b3.objectProperty(
77322
+ b3.identifier("deployConfig"),
77323
+ b3.booleanLiteral(true)
77324
+ ),
77325
+ b3.objectProperty(b3.identifier("nodeCompat"), b3.booleanLiteral(true))
77326
+ ])
77327
+ )
77328
+ ])
77329
+ );
77330
+ const moduleDef = b3.objectProperty(
77331
+ b3.identifier("modules"),
77332
+ b3.arrayExpression([b3.stringLiteral("nitro-cloudflare-dev")])
77333
+ );
77334
+ transformFile(configFile, {
77335
+ visitCallExpression: function(n) {
77336
+ const callee = n.node.callee;
77337
+ if (callee.name === "defineNuxtConfig") {
77338
+ mergeObjectProperties(
77339
+ n.node.arguments[0],
77340
+ [presetDef, moduleDef]
77341
+ );
77342
+ }
77343
+ return this.traverse(n);
77344
+ }
77345
+ });
77346
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
77347
+ };
77348
+ var config21 = {
77349
+ configVersion: 1,
77350
+ id: "nuxt",
77351
+ frameworkCli: "nuxi",
77352
+ platform: "pages",
77353
+ displayName: "Nuxt",
77354
+ copyFiles: {
77355
+ path: "./templates"
77356
+ },
77357
+ path: "templates/nuxt/pages",
77358
+ generate: generate18,
77359
+ configure: configure13,
77360
+ transformPackageJson: async () => ({
77361
+ scripts: {
77362
+ deploy: `${npm13} run build && wrangler pages deploy`,
77363
+ preview: `${npm13} run build && wrangler pages dev`,
77364
+ "cf-typegen": `wrangler types`
77365
+ }
77366
+ }),
77367
+ devScript: "dev",
77368
+ deployScript: "deploy",
77369
+ previewScript: "preview"
77370
+ };
77371
+ var c3_default27 = config21;
77372
+
77373
+ // templates/nuxt/workers/c3.ts
77374
+ var recast9 = __toESM(require_main3());
77375
+ var { npm: npm14, name: pm3 } = detectPackageManager();
77376
+ var generate19 = async (ctx) => {
77377
+ const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
77378
+ await runFrameworkGenerator(ctx, [
77379
+ "init",
77380
+ ctx.project.name,
77381
+ "--packageManager",
77382
+ npm14,
77383
+ gitFlag
77384
+ ]);
77385
+ writeFile2("./.node-version", "18");
77386
+ logRaw("");
77387
+ };
77388
+ var configure14 = async (ctx) => {
77389
+ const packages = ["nitro-cloudflare-dev", "nitropack"];
77531
77390
  if (pm3 === "pnpm") {
77532
77391
  packages.push("h3");
77533
77392
  }
77534
77393
  await installPackages(packages, {
77535
77394
  dev: true,
77536
77395
  startText: "Installing nitro module `nitro-cloudflare-dev`",
77537
- doneText: `${brandColor("installed")} ${dim(`via \`${npm16} install\``)}`
77396
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm14} install\``)}`
77538
77397
  });
77539
77398
  updateNuxtConfig2();
77540
77399
  updateEnvTypes3(ctx);
@@ -77557,13 +77416,23 @@ var updateNuxtConfig2 = () => {
77557
77416
  const s = spinner();
77558
77417
  const configFile = "nuxt.config.ts";
77559
77418
  s.start(`Updating \`${configFile}\``);
77560
- const b3 = recast10.types.builders;
77419
+ const b3 = recast9.types.builders;
77561
77420
  const presetDef = b3.objectProperty(
77562
77421
  b3.identifier("nitro"),
77563
77422
  b3.objectExpression([
77564
77423
  b3.objectProperty(
77565
77424
  b3.identifier("preset"),
77566
- b3.stringLiteral("cloudflare-pages")
77425
+ b3.stringLiteral("cloudflare_module")
77426
+ ),
77427
+ b3.objectProperty(
77428
+ b3.identifier("cloudflare"),
77429
+ b3.objectExpression([
77430
+ b3.objectProperty(
77431
+ b3.identifier("deployConfig"),
77432
+ b3.booleanLiteral(true)
77433
+ ),
77434
+ b3.objectProperty(b3.identifier("nodeCompat"), b3.booleanLiteral(true))
77435
+ ])
77567
77436
  )
77568
77437
  ])
77569
77438
  );
@@ -77589,17 +77458,18 @@ var config22 = {
77589
77458
  configVersion: 1,
77590
77459
  id: "nuxt",
77591
77460
  frameworkCli: "nuxi",
77592
- platform: "pages",
77461
+ platform: "workers",
77593
77462
  displayName: "Nuxt",
77594
77463
  copyFiles: {
77595
77464
  path: "./templates"
77596
77465
  },
77597
- generate: generate21,
77598
- configure: configure15,
77466
+ path: "templates/nuxt/workers",
77467
+ generate: generate19,
77468
+ configure: configure14,
77599
77469
  transformPackageJson: async () => ({
77600
77470
  scripts: {
77601
- deploy: `${npm16} run build && wrangler pages deploy`,
77602
- preview: `${npm16} run build && wrangler pages dev`,
77471
+ deploy: `${npm14} run build && wrangler deploy`,
77472
+ preview: `${npm14} run build && wrangler dev`,
77603
77473
  "cf-typegen": `wrangler types`
77604
77474
  }
77605
77475
  }),
@@ -77609,8 +77479,15 @@ var config22 = {
77609
77479
  };
77610
77480
  var c3_default28 = config22;
77611
77481
 
77482
+ // templates/nuxt/c3.ts
77483
+ var config23 = {
77484
+ displayName: "Nuxt",
77485
+ platformVariants: { pages: c3_default27, workers: c3_default28 }
77486
+ };
77487
+ var c3_default29 = config23;
77488
+
77612
77489
  // templates/openapi/c3.ts
77613
- var c3_default29 = {
77490
+ var c3_default30 = {
77614
77491
  configVersion: 1,
77615
77492
  id: "openapi",
77616
77493
  displayName: "API starter (OpenAPI compliant)",
@@ -77769,7 +77646,7 @@ async function copyExistingWorkerFiles(ctx) {
77769
77646
  (0, import_path11.join)(ctx.project.path, "wrangler.toml")
77770
77647
  );
77771
77648
  }
77772
- var c3_default30 = {
77649
+ var c3_default31 = {
77773
77650
  configVersion: 1,
77774
77651
  id: "pre-existing",
77775
77652
  displayName: "Pre-existing Worker (from Dashboard)",
@@ -77785,7 +77662,7 @@ var c3_default30 = {
77785
77662
  })
77786
77663
  };
77787
77664
  function buildConfigure(params) {
77788
- return async function configure21(ctx) {
77665
+ return async function configure22(ctx) {
77789
77666
  const loginSuccess = await params.login(ctx);
77790
77667
  if (!loginSuccess) {
77791
77668
  throw new Error("Failed to login to Cloudflare");
@@ -77797,7 +77674,7 @@ function buildConfigure(params) {
77797
77674
  }
77798
77675
 
77799
77676
  // templates/queues/c3.ts
77800
- var c3_default31 = {
77677
+ var c3_default32 = {
77801
77678
  configVersion: 1,
77802
77679
  id: "queues",
77803
77680
  displayName: "Queue consumer & producer Worker",
@@ -77826,13 +77703,13 @@ var c3_default31 = {
77826
77703
  };
77827
77704
 
77828
77705
  // templates/qwik/c3.ts
77829
- var recast11 = __toESM(require_main3());
77830
- var { npm: npm17, npx: npx5, name: name2 } = detectPackageManager();
77831
- var generate22 = async (ctx) => {
77706
+ var recast10 = __toESM(require_main3());
77707
+ var { npm: npm15, npx: npx5, name: name2 } = detectPackageManager();
77708
+ var generate20 = async (ctx) => {
77832
77709
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
77833
77710
  };
77834
- var configure16 = async (ctx) => {
77835
- const cmd = [name2 === "pnpm" ? npm17 : npx5, "qwik", "add", "cloudflare-pages"];
77711
+ var configure15 = async (ctx) => {
77712
+ const cmd = [name2 === "pnpm" ? npm15 : npx5, "qwik", "add", "cloudflare-pages"];
77836
77713
  endSection(`Running ${quoteShellArgs(cmd)}`);
77837
77714
  await runCommand(cmd);
77838
77715
  addBindingsProxy2(ctx);
@@ -77845,7 +77722,7 @@ var addBindingsProxy2 = (ctx) => {
77845
77722
  const s = spinner();
77846
77723
  s.start("Updating `vite.config.ts`");
77847
77724
  const snippets = loadTemplateSnippets(ctx);
77848
- const b3 = recast11.types.builders;
77725
+ const b3 = recast10.types.builders;
77849
77726
  transformFile("vite.config.ts", {
77850
77727
  // Insert the env declaration after the last import (but before the rest of the body)
77851
77728
  visitProgram: function(n) {
@@ -77887,7 +77764,7 @@ var populateCloudflareEnv2 = () => {
77887
77764
  s.start(`Updating \`${entrypointPath}\``);
77888
77765
  transformFile(entrypointPath, {
77889
77766
  visitTSInterfaceDeclaration: function(n) {
77890
- const b3 = recast11.types.builders;
77767
+ const b3 = recast10.types.builders;
77891
77768
  const id = n.node.id;
77892
77769
  if (id.name !== "QwikCityPlatform") {
77893
77770
  this.traverse(n);
@@ -77908,7 +77785,7 @@ var populateCloudflareEnv2 = () => {
77908
77785
  });
77909
77786
  s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
77910
77787
  };
77911
- var config23 = {
77788
+ var config24 = {
77912
77789
  configVersion: 1,
77913
77790
  id: "qwik",
77914
77791
  frameworkCli: "create-qwik",
@@ -77917,12 +77794,12 @@ var config23 = {
77917
77794
  copyFiles: {
77918
77795
  path: "./templates"
77919
77796
  },
77920
- generate: generate22,
77921
- configure: configure16,
77797
+ generate: generate20,
77798
+ configure: configure15,
77922
77799
  transformPackageJson: async () => ({
77923
77800
  scripts: {
77924
- deploy: `${npm17} run build && wrangler pages deploy`,
77925
- preview: `${npm17} run build && wrangler pages dev`,
77801
+ deploy: `${npm15} run build && wrangler pages deploy`,
77802
+ preview: `${npm15} run build && wrangler pages dev`,
77926
77803
  "cf-typegen": `wrangler types`
77927
77804
  }
77928
77805
  }),
@@ -77930,11 +77807,11 @@ var config23 = {
77930
77807
  deployScript: "deploy",
77931
77808
  previewScript: "preview"
77932
77809
  };
77933
- var c3_default32 = config23;
77810
+ var c3_default33 = config24;
77934
77811
 
77935
- // templates/react/c3.ts
77936
- var { npm: npm18 } = detectPackageManager();
77937
- var generate23 = async (ctx) => {
77812
+ // templates/react/pages/c3.ts
77813
+ var { npm: npm16 } = detectPackageManager();
77814
+ var generate21 = async (ctx) => {
77938
77815
  const variant = await inputPrompt({
77939
77816
  type: "select",
77940
77817
  question: "Select a variant:",
@@ -77963,29 +77840,175 @@ var variantsOptions = [
77963
77840
  label: "JavaScript + SWC"
77964
77841
  }
77965
77842
  ];
77966
- var config24 = {
77843
+ var config25 = {
77967
77844
  configVersion: 1,
77968
77845
  id: "react",
77969
77846
  // React's documentation now recommends using create-vite.
77970
77847
  frameworkCli: "create-vite",
77971
77848
  displayName: "React",
77972
77849
  platform: "pages",
77973
- generate: generate23,
77850
+ path: "templates/react/pages",
77851
+ generate: generate21,
77974
77852
  transformPackageJson: async () => ({
77975
77853
  scripts: {
77976
- deploy: `${npm18} run build && wrangler pages deploy ./dist`,
77977
- preview: `${npm18} run build && wrangler pages dev ./dist`
77854
+ deploy: `${npm16} run build && wrangler pages deploy ./dist`,
77855
+ preview: `${npm16} run build && wrangler pages dev ./dist`
77978
77856
  }
77979
77857
  }),
77980
77858
  devScript: "dev",
77981
77859
  deployScript: "deploy",
77982
77860
  previewScript: "preview"
77983
77861
  };
77984
- var c3_default33 = config24;
77862
+ var c3_default34 = config25;
77863
+
77864
+ // templates/react/workers/c3.ts
77865
+ var import_assert2 = __toESM(require("assert"));
77866
+ var recast11 = __toESM(require_main3());
77867
+ var b2 = recast11.types.builders;
77868
+ var t = recast11.types.namedTypes;
77869
+ var { npm: npm17 } = detectPackageManager();
77870
+ var generate22 = async (ctx) => {
77871
+ const variant = await getVariant();
77872
+ ctx.args.lang = variant.lang;
77873
+ await runFrameworkGenerator(ctx, [
77874
+ ctx.project.name,
77875
+ "--template",
77876
+ variant.value
77877
+ ]);
77878
+ logRaw("");
77879
+ };
77880
+ var configure16 = async (ctx) => {
77881
+ await installPackages(["@cloudflare/vite-plugin"], {
77882
+ dev: true,
77883
+ startText: "Installing the Cloudflare Vite plugin",
77884
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
77885
+ });
77886
+ await transformViteConfig(ctx);
77887
+ if (usesTypescript(ctx)) {
77888
+ updateTsconfigJson();
77889
+ }
77890
+ };
77891
+ function transformViteConfig(ctx) {
77892
+ const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
77893
+ transformFile(filePath, {
77894
+ visitProgram(n) {
77895
+ const lastImportIndex = n.node.body.findLastIndex(
77896
+ (statement) => statement.type === "ImportDeclaration"
77897
+ );
77898
+ const lastImport = n.get("body", lastImportIndex);
77899
+ const importAst = b2.importDeclaration(
77900
+ [b2.importSpecifier(b2.identifier("cloudflare"))],
77901
+ b2.stringLiteral("@cloudflare/vite-plugin")
77902
+ );
77903
+ lastImport.insertAfter(importAst);
77904
+ return this.traverse(n);
77905
+ },
77906
+ visitCallExpression: function(n) {
77907
+ const callee = n.node.callee;
77908
+ if (callee.name !== "defineConfig") {
77909
+ return this.traverse(n);
77910
+ }
77911
+ const config34 = n.node.arguments[0];
77912
+ (0, import_assert2.default)(t.ObjectExpression.check(config34));
77913
+ const pluginsProp = config34.properties.find((prop) => isPluginsProp(prop));
77914
+ (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
77915
+ pluginsProp.value.elements.push(
77916
+ b2.callExpression(b2.identifier("cloudflare"), [])
77917
+ );
77918
+ return false;
77919
+ }
77920
+ });
77921
+ }
77922
+ function isPluginsProp(prop) {
77923
+ return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
77924
+ }
77925
+ function updateTsconfigJson() {
77926
+ const s = spinner();
77927
+ s.start(`Updating tsconfig.json config`);
77928
+ const tsconfig = readJSON("tsconfig.json");
77929
+ if (tsconfig && typeof tsconfig === "object") {
77930
+ tsconfig.references ??= [];
77931
+ tsconfig.references.push({ path: "./tsconfig.worker.json" });
77932
+ }
77933
+ writeJSON("tsconfig.json", tsconfig);
77934
+ s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
77935
+ }
77936
+ async function getVariant() {
77937
+ const variantsOptions2 = [
77938
+ {
77939
+ value: "react-ts",
77940
+ lang: "ts",
77941
+ label: "TypeScript"
77942
+ },
77943
+ {
77944
+ value: "react-swc-ts",
77945
+ lang: "ts",
77946
+ label: "TypeScript + SWC"
77947
+ },
77948
+ {
77949
+ value: "react",
77950
+ lang: "js",
77951
+ label: "JavaScript"
77952
+ },
77953
+ {
77954
+ value: "react-swc",
77955
+ lang: "js",
77956
+ label: "JavaScript + SWC"
77957
+ }
77958
+ ];
77959
+ const value = await inputPrompt({
77960
+ type: "select",
77961
+ question: "Select a variant:",
77962
+ label: "variant",
77963
+ options: variantsOptions2,
77964
+ defaultValue: variantsOptions2[0].value
77965
+ });
77966
+ const selected = variantsOptions2.find((variant) => variant.value === value);
77967
+ (0, import_assert2.default)(selected, "Expected a variant to be selected");
77968
+ return selected;
77969
+ }
77970
+ var config26 = {
77971
+ configVersion: 1,
77972
+ id: "react",
77973
+ frameworkCli: "create-vite",
77974
+ displayName: "React",
77975
+ platform: "workers",
77976
+ path: "templates/react/workers",
77977
+ copyFiles: {
77978
+ variants: {
77979
+ ts: {
77980
+ path: "./ts"
77981
+ },
77982
+ js: {
77983
+ path: "./js"
77984
+ }
77985
+ }
77986
+ },
77987
+ generate: generate22,
77988
+ configure: configure16,
77989
+ transformPackageJson: async (_3, ctx) => ({
77990
+ scripts: {
77991
+ deploy: `${npm17} run build && wrangler deploy`,
77992
+ preview: `${npm17} run build && vite preview`,
77993
+ ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
77994
+ }
77995
+ }),
77996
+ devScript: "dev",
77997
+ deployScript: "deploy",
77998
+ previewScript: "preview"
77999
+ };
78000
+ var c3_default35 = config26;
78001
+
78002
+ // templates/react/c3.ts
78003
+ var config27 = {
78004
+ displayName: "React",
78005
+ platformVariants: { pages: c3_default34, workers: c3_default35 }
78006
+ };
78007
+ var c3_default36 = config27;
77985
78008
 
77986
78009
  // templates/remix/c3.ts
77987
- var { npm: npm19 } = detectPackageManager();
77988
- var generate24 = async (ctx) => {
78010
+ var { npm: npm18 } = detectPackageManager();
78011
+ var generate23 = async (ctx) => {
77989
78012
  await runFrameworkGenerator(ctx, [
77990
78013
  ctx.project.name,
77991
78014
  "--template",
@@ -78008,7 +78031,7 @@ var configure17 = async () => {
78008
78031
  });
78009
78032
  s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
78010
78033
  };
78011
- var config25 = {
78034
+ var config28 = {
78012
78035
  configVersion: 1,
78013
78036
  id: "remix",
78014
78037
  frameworkCli: "create-remix",
@@ -78017,12 +78040,12 @@ var config25 = {
78017
78040
  copyFiles: {
78018
78041
  path: "./templates"
78019
78042
  },
78020
- generate: generate24,
78043
+ generate: generate23,
78021
78044
  configure: configure17,
78022
78045
  transformPackageJson: async () => ({
78023
78046
  scripts: {
78024
- deploy: `${npm19} run build && wrangler pages deploy`,
78025
- preview: `${npm19} run build && wrangler pages dev`,
78047
+ deploy: `${npm18} run build && wrangler pages deploy`,
78048
+ preview: `${npm18} run build && wrangler pages dev`,
78026
78049
  "cf-typegen": `wrangler types`
78027
78050
  }
78028
78051
  }),
@@ -78030,10 +78053,10 @@ var config25 = {
78030
78053
  deployScript: "deploy",
78031
78054
  previewScript: "preview"
78032
78055
  };
78033
- var c3_default34 = config25;
78056
+ var c3_default37 = config28;
78034
78057
 
78035
78058
  // templates/scheduled/c3.ts
78036
- var c3_default35 = {
78059
+ var c3_default38 = {
78037
78060
  configVersion: 1,
78038
78061
  id: "scheduled",
78039
78062
  displayName: "Scheduled Worker (Cron Trigger)",
@@ -78053,8 +78076,8 @@ var c3_default35 = {
78053
78076
 
78054
78077
  // templates/solid/c3.ts
78055
78078
  var recast12 = __toESM(require_main3());
78056
- var { npm: npm20 } = detectPackageManager();
78057
- var generate25 = async (ctx) => {
78079
+ var { npm: npm19 } = detectPackageManager();
78080
+ var generate24 = async (ctx) => {
78058
78081
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
78059
78082
  logRaw("");
78060
78083
  };
@@ -78096,7 +78119,7 @@ var configure18 = async (ctx) => {
78096
78119
  }
78097
78120
  });
78098
78121
  };
78099
- var config26 = {
78122
+ var config29 = {
78100
78123
  configVersion: 1,
78101
78124
  id: "solid",
78102
78125
  frameworkCli: "create-solid",
@@ -78105,12 +78128,12 @@ var config26 = {
78105
78128
  copyFiles: {
78106
78129
  path: "./templates"
78107
78130
  },
78108
- generate: generate25,
78131
+ generate: generate24,
78109
78132
  configure: configure18,
78110
78133
  transformPackageJson: async () => ({
78111
78134
  scripts: {
78112
- preview: `${npm20} run build && npx wrangler pages dev`,
78113
- deploy: `${npm20} run build && wrangler pages deploy`
78135
+ preview: `${npm19} run build && npx wrangler pages dev`,
78136
+ deploy: `${npm19} run build && wrangler pages deploy`
78114
78137
  }
78115
78138
  }),
78116
78139
  compatibilityFlags: ["nodejs_compat"],
@@ -78118,14 +78141,14 @@ var config26 = {
78118
78141
  deployScript: "deploy",
78119
78142
  previewScript: "preview"
78120
78143
  };
78121
- var c3_default36 = config26;
78144
+ var c3_default39 = config29;
78122
78145
 
78123
78146
  // templates/svelte/c3.ts
78124
78147
  var import_node_fs3 = require("node:fs");
78125
78148
  var import_node_os4 = require("node:os");
78126
78149
  var recast13 = __toESM(require_main3());
78127
- var { npm: npm21 } = detectPackageManager();
78128
- var generate26 = async (ctx) => {
78150
+ var { npm: npm20 } = detectPackageManager();
78151
+ var generate25 = async (ctx) => {
78129
78152
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
78130
78153
  logRaw("");
78131
78154
  };
@@ -78211,7 +78234,7 @@ var updateTypeDefinitions2 = (ctx) => {
78211
78234
  }
78212
78235
  });
78213
78236
  };
78214
- var config27 = {
78237
+ var config30 = {
78215
78238
  configVersion: 1,
78216
78239
  id: "svelte",
78217
78240
  frameworkCli: "sv",
@@ -78220,12 +78243,12 @@ var config27 = {
78220
78243
  copyFiles: {
78221
78244
  path: "./templates"
78222
78245
  },
78223
- generate: generate26,
78246
+ generate: generate25,
78224
78247
  configure: configure19,
78225
78248
  transformPackageJson: async (original, ctx) => {
78226
78249
  let scripts = {
78227
- preview: `${npm21} run build && wrangler pages dev`,
78228
- deploy: `${npm21} run build && wrangler pages deploy`
78250
+ preview: `${npm20} run build && wrangler pages dev`,
78251
+ deploy: `${npm20} run build && wrangler pages deploy`
78229
78252
  };
78230
78253
  if (usesTypescript(ctx)) {
78231
78254
  const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
@@ -78240,37 +78263,120 @@ var config27 = {
78240
78263
  deployScript: "deploy",
78241
78264
  previewScript: "preview"
78242
78265
  };
78243
- var c3_default37 = config27;
78266
+ var c3_default40 = config30;
78244
78267
 
78245
- // templates/vue/c3.ts
78246
- var { npm: npm22 } = detectPackageManager();
78247
- var generate27 = async (ctx) => {
78268
+ // templates/vue/pages/c3.ts
78269
+ var { npm: npm21 } = detectPackageManager();
78270
+ var generate26 = async (ctx) => {
78248
78271
  await runFrameworkGenerator(ctx, [ctx.project.name]);
78249
78272
  };
78250
- var config28 = {
78273
+ var config31 = {
78251
78274
  configVersion: 1,
78252
78275
  id: "vue",
78253
78276
  frameworkCli: "create-vue",
78254
78277
  displayName: "Vue",
78255
78278
  platform: "pages",
78256
- generate: generate27,
78279
+ path: "templates/pages/vue",
78280
+ generate: generate26,
78257
78281
  transformPackageJson: async () => ({
78258
78282
  scripts: {
78259
- deploy: `${npm22} run build && wrangler pages deploy ./dist`,
78260
- preview: `${npm22} run build && wrangler pages dev ./dist`
78283
+ deploy: `${npm21} run build && wrangler pages deploy ./dist`,
78284
+ preview: `${npm21} run build && wrangler pages dev ./dist`
78285
+ }
78286
+ }),
78287
+ devScript: "dev",
78288
+ deployScript: "deploy",
78289
+ previewScript: "preview"
78290
+ };
78291
+ var c3_default41 = config31;
78292
+
78293
+ // templates/vue/workers/c3.ts
78294
+ var { npm: npm22 } = detectPackageManager();
78295
+ var generate27 = async (ctx) => {
78296
+ const lang = ctx.args.lang ?? await inputPrompt({
78297
+ type: "select",
78298
+ question: "Would you like to use TypeScript?",
78299
+ label: "Language",
78300
+ options: [
78301
+ { label: "TypeScript", value: "ts" },
78302
+ { label: "JavaScript", value: "js" }
78303
+ ]
78304
+ });
78305
+ await runFrameworkGenerator(ctx, [
78306
+ ctx.project.name,
78307
+ "--router",
78308
+ lang === "ts" ? "--ts" : ""
78309
+ ]);
78310
+ logRaw("");
78311
+ };
78312
+ var configure20 = async (ctx) => {
78313
+ await installPackages(["@cloudflare/vite-plugin"], {
78314
+ dev: true,
78315
+ startText: "Installing the Cloudflare Vite plugin",
78316
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
78317
+ });
78318
+ if (usesTypescript(ctx)) {
78319
+ updateTsconfigJson2();
78320
+ }
78321
+ };
78322
+ function updateTsconfigJson2() {
78323
+ const s = spinner();
78324
+ s.start(`Updating tsconfig.json config`);
78325
+ const tsconfig = readJSON("tsconfig.json");
78326
+ if (tsconfig && typeof tsconfig === "object") {
78327
+ tsconfig.references ??= [];
78328
+ tsconfig.references.push({ path: "./tsconfig.worker.json" });
78329
+ }
78330
+ writeJSON("tsconfig.json", tsconfig);
78331
+ s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
78332
+ }
78333
+ var config32 = {
78334
+ configVersion: 1,
78335
+ id: "vue",
78336
+ frameworkCli: "create-vue",
78337
+ platform: "workers",
78338
+ displayName: "Vue",
78339
+ path: "templates/vue/workers",
78340
+ copyFiles: {
78341
+ async selectVariant(ctx) {
78342
+ return usesTypescript(ctx) ? "ts" : "js";
78343
+ },
78344
+ variants: {
78345
+ ts: {
78346
+ path: "./ts"
78347
+ },
78348
+ js: {
78349
+ path: "./js"
78350
+ }
78351
+ }
78352
+ },
78353
+ configure: configure20,
78354
+ generate: generate27,
78355
+ transformPackageJson: async (_3, ctx) => ({
78356
+ scripts: {
78357
+ deploy: `${npm22} run build && wrangler deploy`,
78358
+ preview: `${npm22} run build && wrangler dev`,
78359
+ ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
78261
78360
  }
78262
78361
  }),
78263
78362
  devScript: "dev",
78264
78363
  deployScript: "deploy",
78265
78364
  previewScript: "preview"
78266
78365
  };
78267
- var c3_default38 = config28;
78366
+ var c3_default42 = config32;
78367
+
78368
+ // templates/vue/c3.ts
78369
+ var config33 = {
78370
+ displayName: "Vue",
78371
+ platformVariants: { pages: c3_default41, workers: c3_default42 }
78372
+ };
78373
+ var c3_default43 = config33;
78268
78374
 
78269
78375
  // src/git.ts
78270
78376
  var import_node_assert = __toESM(require("node:assert"));
78271
78377
 
78272
78378
  // ../wrangler/package.json
78273
- var version2 = "0.0.0-595f17092";
78379
+ var version2 = "0.0.0-597255fd3";
78274
78380
 
78275
78381
  // src/git.ts
78276
78382
  var offerGit = async (ctx) => {
@@ -78531,54 +78637,49 @@ var defaultSelectVariant = async (ctx) => {
78531
78637
  function getFrameworkMap({ experimental = false }) {
78532
78638
  if (experimental) {
78533
78639
  return {
78534
- angular: c3_default,
78535
- astro: c3_default2,
78536
- gatsby: c3_default3,
78537
- hono: c3_default7,
78538
- next: c3_default8,
78539
- nuxt: c3_default9,
78540
- qwik: c3_default10,
78541
- react: c3_default11,
78542
- remix: c3_default12,
78543
- solid: c3_default13,
78544
- svelte: c3_default14,
78545
- vue: c3_default15
78640
+ astro: c3_default,
78641
+ hono: c3_default5,
78642
+ next: c3_default6,
78643
+ qwik: c3_default7,
78644
+ remix: c3_default8,
78645
+ solid: c3_default9,
78646
+ svelte: c3_default10
78546
78647
  };
78547
78648
  } else {
78548
78649
  return {
78549
- analog: c3_default16,
78550
- angular: c3_default17,
78551
- astro: c3_default18,
78552
- docusaurus: c3_default22,
78553
- gatsby: c3_default23,
78554
- hono: c3_default26,
78555
- next: c3_default27,
78556
- nuxt: c3_default28,
78557
- qwik: c3_default32,
78558
- react: c3_default33,
78559
- remix: c3_default34,
78560
- solid: c3_default36,
78561
- svelte: c3_default37,
78562
- vue: c3_default38
78650
+ analog: c3_default11,
78651
+ angular: c3_default14,
78652
+ astro: c3_default15,
78653
+ docusaurus: c3_default19,
78654
+ gatsby: c3_default22,
78655
+ hono: c3_default25,
78656
+ next: c3_default26,
78657
+ nuxt: c3_default29,
78658
+ qwik: c3_default33,
78659
+ react: c3_default36,
78660
+ remix: c3_default37,
78661
+ solid: c3_default39,
78662
+ svelte: c3_default40,
78663
+ vue: c3_default43
78563
78664
  };
78564
78665
  }
78565
78666
  }
78566
78667
  function getTemplateMap({ experimental = false }) {
78567
78668
  if (experimental) {
78568
78669
  return {
78569
- "hello-world-assets-only": c3_default4,
78570
- "hello-world-with-assets": c3_default6,
78571
- "hello-world-durable-object-with-assets": c3_default5
78670
+ "hello-world-assets-only": c3_default2,
78671
+ "hello-world-with-assets": c3_default4,
78672
+ "hello-world-durable-object-with-assets": c3_default3
78572
78673
  };
78573
78674
  } else {
78574
78675
  return {
78575
- "hello-world": c3_default25,
78576
- common: c3_default19,
78577
- scheduled: c3_default35,
78578
- queues: c3_default31,
78579
- "hello-world-durable-object": c3_default24,
78580
- openapi: c3_default29,
78581
- "pre-existing": c3_default30
78676
+ "hello-world": c3_default24,
78677
+ common: c3_default16,
78678
+ scheduled: c3_default38,
78679
+ queues: c3_default32,
78680
+ "hello-world-durable-object": c3_default23,
78681
+ openapi: c3_default30,
78682
+ "pre-existing": c3_default31
78582
78683
  };
78583
78684
  }
78584
78685
  }
@@ -78726,8 +78827,8 @@ var createContext = async (args, prevArgs) => {
78726
78827
  experimental: args.experimental
78727
78828
  });
78728
78829
  const frameworkOptions = Object.entries(frameworkMap).map(
78729
- ([key, config29]) => ({
78730
- label: config29.displayName,
78830
+ ([key, config34]) => ({
78831
+ label: config34.displayName,
78731
78832
  value: key
78732
78833
  })
78733
78834
  );
@@ -78894,28 +78995,28 @@ var processRemoteTemplate = async (args) => {
78894
78995
  src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
78895
78996
  }
78896
78997
  const path6 = await downloadRemoteTemplate(src);
78897
- const config29 = inferTemplateConfig(path6);
78898
- validateTemplate(path6, config29);
78998
+ const config34 = inferTemplateConfig(path6);
78999
+ validateTemplate(path6, config34);
78899
79000
  updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
78900
79001
  return {
78901
79002
  path: path6,
78902
- ...config29
79003
+ ...config34
78903
79004
  };
78904
79005
  };
78905
- var validateTemplate = (path6, config29) => {
78906
- if (!config29.copyFiles) {
79006
+ var validateTemplate = (path6, config34) => {
79007
+ if (!config34.copyFiles) {
78907
79008
  return;
78908
79009
  }
78909
- if (isVariantInfo(config29.copyFiles)) {
78910
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config29.copyFiles.path), config29);
79010
+ if (isVariantInfo(config34.copyFiles)) {
79011
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config34.copyFiles.path), config34);
78911
79012
  } else {
78912
- for (const variant of Object.values(config29.copyFiles.variants)) {
78913
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config29);
79013
+ for (const variant of Object.values(config34.copyFiles.variants)) {
79014
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config34);
78914
79015
  }
78915
79016
  }
78916
79017
  };
78917
- var validateTemplateSrcDirectory = (path6, config29) => {
78918
- if (config29.platform === "workers") {
79018
+ var validateTemplateSrcDirectory = (path6, config34) => {
79019
+ if (config34.platform === "workers") {
78919
79020
  const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
78920
79021
  const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
78921
79022
  const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
@@ -80812,20 +80913,20 @@ function applyEdits(text, edits) {
80812
80913
  var import_fs12 = require("fs");
80813
80914
  var import_path14 = require("path");
80814
80915
  var import_toml2 = __toESM(require_toml());
80815
- function ensureNameExists(config29, projectName) {
80816
- config29["name"] = projectName;
80817
- return config29;
80916
+ function ensureNameExists(config34, projectName) {
80917
+ config34["name"] = projectName;
80918
+ return config34;
80818
80919
  }
80819
- async function ensureCompatDateExists(config29) {
80820
- if (typeof config29["compatibility_date"] === "string") {
80920
+ async function ensureCompatDateExists(config34) {
80921
+ if (typeof config34["compatibility_date"] === "string") {
80821
80922
  const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
80822
- if (!config29["compatibility_date"].match(validCompatDateRe)) {
80823
- config29["compatibility_date"] = await getWorkerdCompatibilityDate();
80923
+ if (!config34["compatibility_date"].match(validCompatDateRe)) {
80924
+ config34["compatibility_date"] = await getWorkerdCompatibilityDate();
80824
80925
  }
80825
80926
  } else {
80826
- config29["compatibility_date"] = await getWorkerdCompatibilityDate();
80927
+ config34["compatibility_date"] = await getWorkerdCompatibilityDate();
80827
80928
  }
80828
- return config29;
80929
+ return config34;
80829
80930
  }
80830
80931
  var updateWranglerConfig = async (ctx) => {
80831
80932
  if (wranglerJsonExists(ctx)) {
@@ -81539,8 +81640,8 @@ var renderValues = (values) => {
81539
81640
  };
81540
81641
 
81541
81642
  // src/helpers/retry.ts
81542
- var retry = async (config29, fn) => {
81543
- let { times } = config29;
81643
+ var retry = async (config34, fn) => {
81644
+ let { times } = config34;
81544
81645
  let error2 = null;
81545
81646
  while (times > 0) {
81546
81647
  try {
@@ -81548,10 +81649,10 @@ var retry = async (config29, fn) => {
81548
81649
  } catch (e) {
81549
81650
  error2 = e;
81550
81651
  times--;
81551
- if (config29.exitCondition?.(e)) {
81652
+ if (config34.exitCondition?.(e)) {
81552
81653
  break;
81553
81654
  }
81554
- await sleep(config29.sleepMs ?? 1e3);
81655
+ await sleep(config34.sleepMs ?? 1e3);
81555
81656
  }
81556
81657
  }
81557
81658
  throw error2;
@@ -81671,8 +81772,8 @@ async function addWorkersTypesToTsConfig(ctx) {
81671
81772
  }
81672
81773
  const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
81673
81774
  try {
81674
- const config29 = parse4(tsconfig);
81675
- const currentTypes = config29.compilerOptions?.types ?? [];
81775
+ const config34 = parse4(tsconfig);
81776
+ const currentTypes = config34.compilerOptions?.types ?? [];
81676
81777
  const explicitEntrypoint = currentTypes.some(
81677
81778
  (t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
81678
81779
  );
@@ -81747,7 +81848,7 @@ var runCli = async (args) => {
81747
81848
  printBanner(args);
81748
81849
  const ctx = await createContext(args);
81749
81850
  await create(ctx);
81750
- await configure20(ctx);
81851
+ await configure21(ctx);
81751
81852
  await deploy(ctx);
81752
81853
  printSummary(ctx);
81753
81854
  logRaw("");
@@ -81775,7 +81876,7 @@ var create = async (ctx) => {
81775
81876
  await rectifyPmMismatch(ctx);
81776
81877
  endSection(`Application created`);
81777
81878
  };
81778
- var configure20 = async (ctx) => {
81879
+ var configure21 = async (ctx) => {
81779
81880
  startSection("Configuring your application for Cloudflare", "Step 2 of 3");
81780
81881
  await installWrangler();
81781
81882
  await installWorkersTypes(ctx);