create-cloudflare 2.40.0 → 2.40.2

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 (20) hide show
  1. package/dist/cli.js +610 -549
  2. package/package.json +6 -5
  3. package/templates/docusaurus/c3.ts +5 -25
  4. package/templates/docusaurus/pages/c3.ts +30 -0
  5. package/{templates-experimental/docusaurus → templates/docusaurus/workers}/c3.ts +2 -2
  6. package/templates/hello-world/py/README.md +8 -3
  7. package/templates/react/c3.ts +5 -57
  8. package/templates/react/pages/c3.ts +62 -0
  9. package/{templates-experimental/react → templates/react/workers}/c3.ts +4 -3
  10. package/{templates-experimental/react → templates/react/workers}/ts/api/index.ts +0 -4
  11. package/{templates-experimental/react → templates/react/workers}/ts/tsconfig.worker.json +1 -1
  12. package/templates/react/workers/ts/worker-configuration.d.ts +5 -0
  13. /package/{templates-experimental/docusaurus → templates/docusaurus/workers}/templates/wrangler.jsonc +0 -0
  14. /package/{templates-experimental/react → templates/react/workers}/js/api/index.js +0 -0
  15. /package/{templates-experimental/react → templates/react/workers}/js/src/App.jsx +0 -0
  16. /package/{templates-experimental/react → templates/react/workers}/js/src/assets/Cloudflare_Logo.svg +0 -0
  17. /package/{templates-experimental/react/js/wrangler.json → templates/react/workers/js/wrangler.jsonc} +0 -0
  18. /package/{templates-experimental/react → templates/react/workers}/ts/src/App.tsx +0 -0
  19. /package/{templates-experimental/react → templates/react/workers}/ts/src/assets/Cloudflare_Logo.svg +0 -0
  20. /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 config28(dirOptions) {
576
+ XDGAppPaths.config = function config30(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 config28 = function() {
633
+ var config30 = 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: config28, data, runtime, state };
645
+ return { cache, config: config30, 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 config28 = function() {
651
+ var config30 = 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: config28, data, runtime, state };
663
+ return { cache, config: config30, 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 config28 = function() {
675
+ var config30 = 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: config28, data, runtime, state };
687
+ return { cache, config: config30, 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 config28 = (0, _lodash["default"])(options, this.config);
31623
- if (config28.tokenHex === true) {
31624
- config28.tokenChars = "0123456789abcdef";
31622
+ var config30 = (0, _lodash["default"])(options, this.config);
31623
+ if (config30.tokenHex === true) {
31624
+ config30.tokenChars = "0123456789abcdef";
31625
31625
  }
31626
31626
  var adjective = this._randomElement(this.adjectives);
31627
31627
  var noun = this._randomElement(this.nouns);
31628
- if (!config28.tokenLength)
31629
- config28.tokenLength = 0;
31628
+ if (!config30.tokenLength)
31629
+ config30.tokenLength = 0;
31630
31630
  var token = "";
31631
- for (var i = 0; i < config28.tokenLength; i++) {
31632
- token += this._randomElement(config28.tokenChars);
31631
+ for (var i = 0; i < config30.tokenLength; i++) {
31632
+ token += this._randomElement(config30.tokenChars);
31633
31633
  }
31634
31634
  var sections = [adjective, noun, token];
31635
31635
  return sections.filter(function(e) {
31636
31636
  return !!e;
31637
- }).join(config28.delimiter);
31637
+ }).join(config30.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, config28) {
40194
+ function Tokenizer2(code, config30) {
40195
40195
  this.errorHandler = new error_handler_1.ErrorHandler();
40196
- this.errorHandler.tolerant = config28 ? typeof config28.tolerant === "boolean" && config28.tolerant : false;
40196
+ this.errorHandler.tolerant = config30 ? typeof config30.tolerant === "boolean" && config30.tolerant : false;
40197
40197
  this.scanner = new scanner_1.Scanner(code, this.errorHandler);
40198
- this.scanner.trackComment = config28 ? typeof config28.comment === "boolean" && config28.comment : false;
40199
- this.trackRange = config28 ? typeof config28.range === "boolean" && config28.range : false;
40200
- this.trackLoc = config28 ? typeof config28.loc === "boolean" && config28.loc : false;
40198
+ this.scanner.trackComment = config30 ? typeof config30.comment === "boolean" && config30.comment : false;
40199
+ this.trackRange = config30 ? typeof config30.range === "boolean" && config30.range : false;
40200
+ this.trackLoc = config30 ? typeof config30.loc === "boolean" && config30.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(config28) {
50023
+ var Printer = function Printer2(config30) {
50024
50024
  assert_1.default.ok(this instanceof Printer2);
50025
- var explicitTabWidth = config28 && config28.tabWidth;
50026
- config28 = options_1.normalize(config28);
50027
- config28.sourceFileName = null;
50025
+ var explicitTabWidth = config30 && config30.tabWidth;
50026
+ config30 = options_1.normalize(config30);
50027
+ config30.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 = config28.tabWidth;
50042
+ var oldTabWidth = config30.tabWidth;
50043
50043
  if (!explicitTabWidth) {
50044
50044
  var loc = path6.getNode().loc;
50045
50045
  if (loc && loc.lines && loc.lines.guessTabWidth) {
50046
- config28.tabWidth = loc.lines.guessTabWidth();
50046
+ config30.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, config28, options, makePrintFunctionWith(options, {
50060
+ ) : genericPrint(path6, config30, options, makePrintFunctionWith(options, {
50061
50061
  includeComments: true,
50062
50062
  avoidRootParens: false
50063
50063
  }));
50064
- config28.tabWidth = oldTabWidth;
50064
+ config30.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(config28), util.composeSourceMaps(config28.inputSourceMap, lines.getSourceMap(config28.sourceMapName, config28.sourceRoot)));
50075
+ return new PrintResult(lines.toString(config30), util.composeSourceMaps(config30.inputSourceMap, lines.getSourceMap(config30.sourceMapName, config30.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, config28, {
50083
+ return genericPrint(path8, config30, {
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 = config28.reuseWhitespace;
50091
- config28.reuseWhitespace = false;
50092
- var pr = new PrintResult(printGenerically(path6).toString(config28));
50093
- config28.reuseWhitespace = oldReuseWhitespace;
50090
+ var oldReuseWhitespace = config30.reuseWhitespace;
50091
+ config30.reuseWhitespace = false;
50092
+ var pr = new PrintResult(printGenerically(path6).toString(config30));
50093
+ config30.reuseWhitespace = oldReuseWhitespace;
50094
50094
  return pr;
50095
50095
  };
50096
50096
  };
50097
50097
  exports2.Printer = Printer;
50098
- function genericPrint(path6, config28, options, printPath) {
50098
+ function genericPrint(path6, config30, 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, config28, printPath);
50102
+ var linesWithoutParens = genericPrintNoParens(path6, config30, 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 = (config28, value) => {
69794
- const { question, label } = config28;
69795
- if (config28.type !== "confirm" && !value) {
69793
+ var renderSubmit = (config30, value) => {
69794
+ const { question, label } = config30;
69795
+ if (config30.type !== "confirm" && !value) {
69796
69796
  return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
69797
69797
  }
69798
- const content = config28.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69798
+ const content = config30.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69799
69799
  return [`${leftT} ${question}`, content, `${grayBar}`];
69800
69800
  };
69801
- var getRenderers = (config28) => {
69802
- switch (config28.type) {
69801
+ var getRenderers = (config30) => {
69802
+ switch (config30.type) {
69803
69803
  case "select":
69804
- return getSelectRenderers(config28);
69804
+ return getSelectRenderers(config30);
69805
69805
  case "confirm":
69806
- return getConfirmRenderers(config28);
69806
+ return getConfirmRenderers(config30);
69807
69807
  case "text":
69808
- return getTextRenderers(config28);
69808
+ return getTextRenderers(config30);
69809
69809
  case "multiselect":
69810
- return getSelectRenderers(config28);
69810
+ return getSelectRenderers(config30);
69811
69811
  case "list":
69812
- return getSelectListRenderers(config28);
69812
+ return getSelectListRenderers(config30);
69813
69813
  }
69814
69814
  };
69815
- var getTextRenderers = (config28) => {
69816
- const { question } = config28;
69817
- const helpText = config28.helpText ?? "";
69818
- const format5 = config28.format ?? ((val) => String(val));
69819
- const defaultValue = config28.defaultValue?.toString() ?? "";
69815
+ var getTextRenderers = (config30) => {
69816
+ const { question } = config30;
69817
+ const helpText = config30.helpText ?? "";
69818
+ const format5 = config30.format ?? ((val) => String(val));
69819
+ const defaultValue = config30.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 = (config28) => {
69839
69839
  ``
69840
69840
  // extra line for readability
69841
69841
  ],
69842
- submit: ({ value }) => renderSubmit(config28, format5(value ?? "")),
69842
+ submit: ({ value }) => renderSubmit(config30, format5(value ?? "")),
69843
69843
  cancel: activeRenderer
69844
69844
  };
69845
69845
  };
69846
- var getSelectRenderers = (config28) => {
69847
- const { options, question, helpText: _helpText } = config28;
69846
+ var getSelectRenderers = (config30) => {
69847
+ const { options, question, helpText: _helpText } = config30;
69848
69848
  const helpText = _helpText ?? "";
69849
- const maxItemsPerPage = config28.maxItemsPerPage ?? 32;
69849
+ const maxItemsPerPage = config30.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
- config28,
69924
+ config30,
69925
69925
  options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
69926
69926
  );
69927
69927
  }
69928
69928
  return renderSubmit(
69929
- config28,
69929
+ config30,
69930
69930
  options.find((o) => o.value === value)?.label
69931
69931
  );
69932
69932
  },
69933
69933
  cancel: defaultRenderer
69934
69934
  };
69935
69935
  };
69936
- var getSelectListRenderers = (config28) => {
69937
- const { question, helpText: _helpText } = config28;
69938
- let options = config28.options;
69936
+ var getSelectListRenderers = (config30) => {
69937
+ const { question, helpText: _helpText } = config30;
69938
+ let options = config30.options;
69939
69939
  const helpText = _helpText ?? "";
69940
69940
  const { rows } = stdout;
69941
69941
  const defaultRenderer = ({ cursor, value }, prompt) => {
@@ -70016,20 +70016,20 @@ var getSelectListRenderers = (config28) => {
70016
70016
  submit: ({ value }) => {
70017
70017
  if (Array.isArray(value)) {
70018
70018
  return renderSubmit(
70019
- config28,
70019
+ config30,
70020
70020
  options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
70021
70021
  );
70022
70022
  }
70023
70023
  return renderSubmit(
70024
- config28,
70024
+ config30,
70025
70025
  options.find((o) => o.value === value)?.value
70026
70026
  );
70027
70027
  },
70028
70028
  cancel: defaultRenderer
70029
70029
  };
70030
70030
  };
70031
- var getConfirmRenderers = (config28) => {
70032
- const { activeText, inactiveText, question, helpText: _helpText } = config28;
70031
+ var getConfirmRenderers = (config30) => {
70032
+ const { activeText, inactiveText, question, helpText: _helpText } = config30;
70033
70033
  const helpText = _helpText ?? "";
70034
70034
  const active = activeText || "Yes";
70035
70035
  const inactive = inactiveText || "No";
@@ -70046,7 +70046,7 @@ var getConfirmRenderers = (config28) => {
70046
70046
  active: defaultRenderer,
70047
70047
  confirm: defaultRenderer,
70048
70048
  error: defaultRenderer,
70049
- submit: ({ value }) => renderSubmit(config28, value ? "yes" : "no"),
70049
+ submit: ({ value }) => renderSubmit(config30, 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 config28 = null;
71019
+ let config30 = 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
- config28 = resolveConfig(resolvedConfigPath);
71024
+ config30 = resolveConfig(resolvedConfigPath);
71025
71025
  } catch (e) {
71026
- config28 = e;
71026
+ config30 = e;
71027
71027
  }
71028
- if (config28 instanceof Error) {
71029
- error2 = config28;
71028
+ if (config30 instanceof Error) {
71029
+ error2 = config30;
71030
71030
  return;
71031
71031
  }
71032
71032
  } else {
71033
- config28 = mixin2.require(resolvedConfigPath);
71033
+ config30 = mixin2.require(resolvedConfigPath);
71034
71034
  }
71035
- setConfigObject(config28);
71035
+ setConfigObject(config30);
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(config28, prev) {
71046
- Object.keys(config28).forEach(function(key) {
71047
- const value = config28[key];
71045
+ function setConfigObject(config30, prev) {
71046
+ Object.keys(config30).forEach(function(key) {
71047
+ const value = config30[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 config28 = Object.assign({}, options.configuration, {
72199
+ const config30 = Object.assign({}, options.configuration, {
72200
72200
  "populate--": false
72201
72201
  });
72202
72202
  const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
72203
- configuration: config28
72203
+ configuration: config30
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(config28, cwd, mergeExtends, _shim) {
73426
+ function applyExtends(config30, cwd, mergeExtends, _shim) {
73427
73427
  shim2 = _shim;
73428
73428
  let defaultConfig = {};
73429
- if (Object.prototype.hasOwnProperty.call(config28, "extends")) {
73430
- if (typeof config28.extends !== "string")
73429
+ if (Object.prototype.hasOwnProperty.call(config30, "extends")) {
73430
+ if (typeof config30.extends !== "string")
73431
73431
  return defaultConfig;
73432
- const isPath = /\.json|\..*rc$/.test(config28.extends);
73432
+ const isPath = /\.json|\..*rc$/.test(config30.extends);
73433
73433
  let pathToDefault = null;
73434
73434
  if (!isPath) {
73435
73435
  try {
73436
- pathToDefault = require.resolve(config28.extends);
73436
+ pathToDefault = require.resolve(config30.extends);
73437
73437
  } catch (_err) {
73438
- return config28;
73438
+ return config30;
73439
73439
  }
73440
73440
  } else {
73441
- pathToDefault = getPathToDefaultConfig(cwd, config28.extends);
73441
+ pathToDefault = getPathToDefaultConfig(cwd, config30.extends);
73442
73442
  }
73443
73443
  checkForCircularExtends(pathToDefault);
73444
73444
  previouslyVisitedConfigs.push(pathToDefault);
73445
- defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config28.extends);
73446
- delete config28.extends;
73445
+ defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config30.extends);
73446
+ delete config30.extends;
73447
73447
  defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
73448
73448
  }
73449
73449
  previouslyVisitedConfigs = [];
73450
- return mergeExtends ? mergeDeep(defaultConfig, config28) : Object.assign({}, defaultConfig, config28);
73450
+ return mergeExtends ? mergeDeep(defaultConfig, config30) : Object.assign({}, defaultConfig, config30);
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, config28) {
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(config28)) {
73467
- if (isObject(config28[key]) && isObject(target[key])) {
73468
- target[key] = mergeDeep(config1[key], config28[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] = config28[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(config28) {
74232
- argsert("<object>", [config28], arguments.length);
74233
- __classPrivateFieldSet(this, _YargsInstance_parserConfig, config28, "f");
74231
+ parserConfiguration(config30) {
74232
+ argsert("<object>", [config30], arguments.length);
74233
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config30, "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(config28) {
74406
- argsert("<object>", [config28], arguments.length);
74407
- __classPrivateFieldSet(this, _YargsInstance_usageConfig, config28, "f");
74405
+ usageConfiguration(config30) {
74406
+ argsert("<object>", [config30], arguments.length);
74407
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config30, "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 config28 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74813
+ const config30 = 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, ...config28 }
74817
+ configuration: { "parse-positional-numbers": false, ...config30 }
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 = "2.40.0";
74980
+ var version = "2.40.2";
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(config28) {
75024
+ function writeMetricsConfig(config30) {
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
- config28,
75029
+ config30,
75030
75030
  (_key, value) => value instanceof Date ? value.toISOString() : value,
75031
75031
  " "
75032
75032
  )
@@ -75034,9 +75034,9 @@ function writeMetricsConfig(config28) {
75034
75034
  }
75035
75035
  function readMetricsConfig() {
75036
75036
  try {
75037
- const config28 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
75037
+ const config30 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
75038
75038
  return JSON.parse(
75039
- config28,
75039
+ config30,
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(config28) {
75050
- const deviceId = config28.deviceId ?? (0, import_node_crypto.randomUUID)();
75051
- if (config28.deviceId === void 0) {
75052
- writeMetricsConfig({ ...config28, deviceId });
75049
+ function getDeviceId(config30) {
75050
+ const deviceId = config30.deviceId ?? (0, import_node_crypto.randomUUID)();
75051
+ if (config30.deviceId === void 0) {
75052
+ writeMetricsConfig({ ...config30, 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 config28 = readMetricsConfig() ?? {};
75328
- const isFirstUsage = config28.c3permission === void 0;
75327
+ const config30 = readMetricsConfig() ?? {};
75328
+ const isFirstUsage = config30.c3permission === void 0;
75329
75329
  const isEnabled = isTelemetryEnabled();
75330
- const deviceId = getDeviceId(config28);
75330
+ const deviceId = getDeviceId(config30);
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(config28).enabled;
75363
+ return hasSparrowSourceKey() && getC3Permission(config30).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(config28 = readMetricsConfig() ?? {}) {
75470
- if (!config28.c3permission) {
75471
- config28.c3permission = initializeC3Permission();
75472
- writeMetricsConfig(config28);
75469
+ function getC3Permission(config30 = readMetricsConfig() ?? {}) {
75470
+ if (!config30.c3permission) {
75471
+ config30.c3permission = initializeC3Permission();
75472
+ writeMetricsConfig(config30);
75473
75473
  }
75474
- return config28.c3permission;
75474
+ return config30.c3permission;
75475
75475
  }
75476
75476
  function updateC3Pemission(enabled) {
75477
- const config28 = readMetricsConfig();
75478
- if (config28.c3permission?.enabled === enabled) {
75477
+ const config30 = readMetricsConfig();
75478
+ if (config30.c3permission?.enabled === enabled) {
75479
75479
  return;
75480
75480
  }
75481
- config28.c3permission = initializeC3Permission(enabled);
75482
- writeMetricsConfig(config28);
75481
+ config30.c3permission = initializeC3Permission(enabled);
75482
+ writeMetricsConfig(config30);
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, config28 = {}) => {
75527
+ var installPackages = async (packages, config30 = {}) => {
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 = config28.dev ? "-D" : "";
75534
+ saveFlag = config30.dev ? "-D" : "";
75535
75535
  break;
75536
75536
  case "bun":
75537
75537
  cmd = "add";
75538
- saveFlag = config28.dev ? "-d" : "";
75538
+ saveFlag = config30.dev ? "-d" : "";
75539
75539
  break;
75540
75540
  case "npm":
75541
75541
  case "pnpm":
75542
75542
  default:
75543
75543
  cmd = "install";
75544
- saveFlag = config28.dev ? "--save-dev" : "";
75544
+ saveFlag = config30.dev ? "--save-dev" : "";
75545
75545
  break;
75546
75546
  }
75547
75547
  await runCommand([npm24, cmd, ...saveFlag ? [saveFlag] : [], ...packages], {
75548
- ...config28,
75548
+ ...config30,
75549
75549
  silent: true
75550
75550
  });
75551
75551
  };
@@ -76016,37 +76016,9 @@ var config2 = {
76016
76016
  };
76017
76017
  var c3_default2 = config2;
76018
76018
 
76019
- // templates-experimental/docusaurus/c3.ts
76019
+ // templates-experimental/gatsby/c3.ts
76020
76020
  var { npm: npm2 } = detectPackageManager();
76021
76021
  var generate3 = async (ctx) => {
76022
- await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
76023
- };
76024
- var config3 = {
76025
- configVersion: 1,
76026
- id: "docusaurus",
76027
- frameworkCli: "create-docusaurus",
76028
- platform: "workers",
76029
- displayName: "Docusaurus",
76030
- copyFiles: {
76031
- path: "./templates"
76032
- },
76033
- path: "templates-experimental/docusaurus",
76034
- generate: generate3,
76035
- transformPackageJson: async () => ({
76036
- scripts: {
76037
- deploy: `${npm2} run build && wrangler deploy`,
76038
- preview: `${npm2} run build && wrangler dev`
76039
- }
76040
- }),
76041
- devScript: "start",
76042
- deployScript: "deploy",
76043
- previewScript: "preview"
76044
- };
76045
- var c3_default3 = config3;
76046
-
76047
- // templates-experimental/gatsby/c3.ts
76048
- var { npm: npm3 } = detectPackageManager();
76049
- var generate4 = async (ctx) => {
76050
76022
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76051
76023
  const useTemplate = await inputPrompt({
76052
76024
  type: "confirm",
@@ -76065,7 +76037,7 @@ var generate4 = async (ctx) => {
76065
76037
  }
76066
76038
  await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76067
76039
  };
76068
- var config4 = {
76040
+ var config3 = {
76069
76041
  configVersion: 1,
76070
76042
  id: "gatsby",
76071
76043
  frameworkCli: "gatsby",
@@ -76075,21 +76047,21 @@ var config4 = {
76075
76047
  path: "./templates"
76076
76048
  },
76077
76049
  path: "templates-experimental/gatsby",
76078
- generate: generate4,
76050
+ generate: generate3,
76079
76051
  transformPackageJson: async () => ({
76080
76052
  scripts: {
76081
- deploy: `${npm3} run build && wrangler deploy`,
76082
- preview: `${npm3} run build && wrangler dev`
76053
+ deploy: `${npm2} run build && wrangler deploy`,
76054
+ preview: `${npm2} run build && wrangler dev`
76083
76055
  }
76084
76056
  }),
76085
76057
  devScript: "develop",
76086
76058
  deployScript: "deploy",
76087
76059
  previewScript: "preview"
76088
76060
  };
76089
- var c3_default4 = config4;
76061
+ var c3_default3 = config3;
76090
76062
 
76091
76063
  // templates-experimental/hello-world-assets-only/c3.ts
76092
- var config5 = {
76064
+ var config4 = {
76093
76065
  configVersion: 1,
76094
76066
  id: "hello-world-assets-only",
76095
76067
  path: "templates-experimental/hello-world-assets-only",
@@ -76100,10 +76072,10 @@ var config5 = {
76100
76072
  path: "./templates"
76101
76073
  }
76102
76074
  };
76103
- var c3_default5 = config5;
76075
+ var c3_default4 = config4;
76104
76076
 
76105
76077
  // templates-experimental/hello-world-durable-object-with-assets/c3.ts
76106
- var config6 = {
76078
+ var config5 = {
76107
76079
  configVersion: 1,
76108
76080
  id: "hello-world-durable-object-with-assets",
76109
76081
  path: "templates-experimental/hello-world-durable-object-with-assets",
@@ -76121,10 +76093,10 @@ var config6 = {
76121
76093
  }
76122
76094
  }
76123
76095
  };
76124
- var c3_default6 = config6;
76096
+ var c3_default5 = config5;
76125
76097
 
76126
76098
  // templates-experimental/hello-world-with-assets/c3.ts
76127
- var c3_default7 = {
76099
+ var c3_default6 = {
76128
76100
  configVersion: 1,
76129
76101
  id: "hello-world-with-assets",
76130
76102
  path: "templates-experimental/hello-world-with-assets",
@@ -76147,7 +76119,7 @@ var c3_default7 = {
76147
76119
  };
76148
76120
 
76149
76121
  // templates-experimental/hono/c3.ts
76150
- var generate5 = async (ctx) => {
76122
+ var generate4 = async (ctx) => {
76151
76123
  const { name: pm4 } = detectPackageManager();
76152
76124
  await runFrameworkGenerator(ctx, [
76153
76125
  ctx.project.name,
@@ -76159,7 +76131,7 @@ var generate5 = async (ctx) => {
76159
76131
  ]);
76160
76132
  logRaw("");
76161
76133
  };
76162
- var config7 = {
76134
+ var config6 = {
76163
76135
  configVersion: 1,
76164
76136
  id: "hono",
76165
76137
  frameworkCli: "create-hono",
@@ -76169,7 +76141,7 @@ var config7 = {
76169
76141
  },
76170
76142
  platform: "workers",
76171
76143
  path: "templates-experimental/hono",
76172
- generate: generate5,
76144
+ generate: generate4,
76173
76145
  transformPackageJson: async () => ({
76174
76146
  scripts: {
76175
76147
  dev: "wrangler dev",
@@ -76181,10 +76153,10 @@ var config7 = {
76181
76153
  deployScript: "deploy",
76182
76154
  previewScript: "dev"
76183
76155
  };
76184
- var c3_default8 = config7;
76156
+ var c3_default7 = config6;
76185
76157
 
76186
76158
  // templates-experimental/next/c3.ts
76187
- var generate6 = async (ctx) => {
76159
+ var generate5 = async (ctx) => {
76188
76160
  await runFrameworkGenerator(ctx, [ctx.project.name]);
76189
76161
  };
76190
76162
  var configure3 = async () => {
@@ -76212,7 +76184,7 @@ var updateNextConfig = () => {
76212
76184
  writeFile2(configFile, updatedConfigFile);
76213
76185
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76214
76186
  };
76215
- var c3_default9 = {
76187
+ var c3_default8 = {
76216
76188
  configVersion: 1,
76217
76189
  id: "next",
76218
76190
  frameworkCli: "create-next-app",
@@ -76226,7 +76198,7 @@ var c3_default9 = {
76226
76198
  copyFiles: {
76227
76199
  path: "./templates"
76228
76200
  },
76229
- generate: generate6,
76201
+ generate: generate5,
76230
76202
  configure: configure3,
76231
76203
  transformPackageJson: async () => ({
76232
76204
  scripts: {
@@ -76295,14 +76267,14 @@ function getLatestTypesEntrypoint(ctx) {
76295
76267
 
76296
76268
  // templates-experimental/nuxt/c3.ts
76297
76269
  var recast3 = __toESM(require_main3());
76298
- var { npm: npm4, name: pm } = detectPackageManager();
76299
- var generate7 = async (ctx) => {
76270
+ var { npm: npm3, name: pm } = detectPackageManager();
76271
+ var generate6 = async (ctx) => {
76300
76272
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76301
76273
  await runFrameworkGenerator(ctx, [
76302
76274
  "init",
76303
76275
  ctx.project.name,
76304
76276
  "--packageManager",
76305
- npm4,
76277
+ npm3,
76306
76278
  gitFlag
76307
76279
  ]);
76308
76280
  writeFile2("./.node-version", "18");
@@ -76316,7 +76288,7 @@ var configure4 = async (ctx) => {
76316
76288
  await installPackages(packages, {
76317
76289
  dev: true,
76318
76290
  startText: "Installing nitro module `nitro-cloudflare-dev`",
76319
- doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
76291
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
76320
76292
  });
76321
76293
  updateNuxtConfig();
76322
76294
  updateEnvTypes(ctx);
@@ -76367,7 +76339,7 @@ var updateNuxtConfig = () => {
76367
76339
  });
76368
76340
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76369
76341
  };
76370
- var config8 = {
76342
+ var config7 = {
76371
76343
  configVersion: 1,
76372
76344
  id: "nuxt",
76373
76345
  frameworkCli: "nuxi",
@@ -76377,12 +76349,12 @@ var config8 = {
76377
76349
  path: "./templates"
76378
76350
  },
76379
76351
  path: "templates-experimental/nuxt",
76380
- generate: generate7,
76352
+ generate: generate6,
76381
76353
  configure: configure4,
76382
76354
  transformPackageJson: async () => ({
76383
76355
  scripts: {
76384
- deploy: `${npm4} run build && wrangler deploy`,
76385
- preview: `${npm4} run build && wrangler dev`,
76356
+ deploy: `${npm3} run build && wrangler deploy`,
76357
+ preview: `${npm3} run build && wrangler dev`,
76386
76358
  "cf-typegen": `wrangler types`
76387
76359
  }
76388
76360
  }),
@@ -76390,16 +76362,16 @@ var config8 = {
76390
76362
  deployScript: "deploy",
76391
76363
  previewScript: "preview"
76392
76364
  };
76393
- var c3_default10 = config8;
76365
+ var c3_default9 = config7;
76394
76366
 
76395
76367
  // templates-experimental/qwik/c3.ts
76396
76368
  var recast4 = __toESM(require_main3());
76397
- var { npm: npm5, npx: npx2, name } = detectPackageManager();
76398
- var generate8 = async (ctx) => {
76369
+ var { npm: npm4, npx: npx2, name } = detectPackageManager();
76370
+ var generate7 = async (ctx) => {
76399
76371
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
76400
76372
  };
76401
76373
  var configure5 = async (ctx) => {
76402
- const cmd = [name === "pnpm" ? npm5 : npx2, "qwik", "add", "cloudflare-pages"];
76374
+ const cmd = [name === "pnpm" ? npm4 : npx2, "qwik", "add", "cloudflare-pages"];
76403
76375
  endSection(`Running ${quoteShellArgs(cmd)}`);
76404
76376
  await runCommand(cmd);
76405
76377
  removeFile("./public/_headers");
@@ -76478,7 +76450,7 @@ var populateCloudflareEnv = () => {
76478
76450
  });
76479
76451
  s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
76480
76452
  };
76481
- var config9 = {
76453
+ var config8 = {
76482
76454
  configVersion: 1,
76483
76455
  id: "qwik",
76484
76456
  frameworkCli: "create-qwik",
@@ -76488,12 +76460,12 @@ var config9 = {
76488
76460
  path: "./templates"
76489
76461
  },
76490
76462
  path: "templates-experimental/qwik",
76491
- generate: generate8,
76463
+ generate: generate7,
76492
76464
  configure: configure5,
76493
76465
  transformPackageJson: async () => ({
76494
76466
  scripts: {
76495
- deploy: `${npm5} run build && wrangler deploy`,
76496
- preview: `${npm5} run build && wrangler dev`,
76467
+ deploy: `${npm4} run build && wrangler deploy`,
76468
+ preview: `${npm4} run build && wrangler dev`,
76497
76469
  "cf-typegen": `wrangler types`
76498
76470
  }
76499
76471
  }),
@@ -76501,148 +76473,11 @@ var config9 = {
76501
76473
  deployScript: "deploy",
76502
76474
  previewScript: "preview"
76503
76475
  };
76504
- var c3_default11 = config9;
76505
-
76506
- // templates-experimental/react/c3.ts
76507
- var import_assert2 = __toESM(require("assert"));
76508
- var recast5 = __toESM(require_main3());
76509
- var b2 = recast5.types.builders;
76510
- var t = recast5.types.namedTypes;
76511
- var { npm: npm6 } = detectPackageManager();
76512
- var generate9 = async (ctx) => {
76513
- const variant = await getVariant();
76514
- ctx.args.lang = variant.lang;
76515
- await runFrameworkGenerator(ctx, [
76516
- ctx.project.name,
76517
- "--template",
76518
- variant.value
76519
- ]);
76520
- logRaw("");
76521
- };
76522
- var configure6 = async (ctx) => {
76523
- await installPackages(["@cloudflare/vite-plugin"], {
76524
- dev: true,
76525
- startText: "Installing the Cloudflare Vite plugin",
76526
- doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
76527
- });
76528
- await transformViteConfig(ctx);
76529
- if (usesTypescript(ctx)) {
76530
- updateTsconfigJson();
76531
- }
76532
- };
76533
- function transformViteConfig(ctx) {
76534
- const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
76535
- transformFile(filePath, {
76536
- visitProgram(n) {
76537
- const lastImportIndex = n.node.body.findLastIndex(
76538
- (statement) => statement.type === "ImportDeclaration"
76539
- );
76540
- const lastImport = n.get("body", lastImportIndex);
76541
- const importAst = b2.importDeclaration(
76542
- [b2.importSpecifier(b2.identifier("cloudflare"))],
76543
- b2.stringLiteral("@cloudflare/vite-plugin")
76544
- );
76545
- lastImport.insertAfter(importAst);
76546
- return this.traverse(n);
76547
- },
76548
- visitCallExpression: function(n) {
76549
- const callee = n.node.callee;
76550
- if (callee.name !== "defineConfig") {
76551
- return this.traverse(n);
76552
- }
76553
- const config28 = n.node.arguments[0];
76554
- (0, import_assert2.default)(t.ObjectExpression.check(config28));
76555
- const pluginsProp = config28.properties.find((prop) => isPluginsProp(prop));
76556
- (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
76557
- pluginsProp.value.elements.push(
76558
- b2.callExpression(b2.identifier("cloudflare"), [])
76559
- );
76560
- return false;
76561
- }
76562
- });
76563
- }
76564
- function isPluginsProp(prop) {
76565
- return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
76566
- }
76567
- function updateTsconfigJson() {
76568
- const s = spinner();
76569
- s.start(`Updating tsconfig.json config`);
76570
- const tsconfig = readJSON("tsconfig.json");
76571
- if (tsconfig && typeof tsconfig === "object") {
76572
- tsconfig.references ??= [];
76573
- tsconfig.references.push({ path: "./tsconfig.worker.json" });
76574
- }
76575
- writeJSON("tsconfig.json", tsconfig);
76576
- s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
76577
- }
76578
- async function getVariant() {
76579
- const variantsOptions2 = [
76580
- {
76581
- value: "react-ts",
76582
- lang: "ts",
76583
- label: "TypeScript"
76584
- },
76585
- {
76586
- value: "react-swc-ts",
76587
- lang: "ts",
76588
- label: "TypeScript + SWC"
76589
- },
76590
- {
76591
- value: "react",
76592
- lang: "js",
76593
- label: "JavaScript"
76594
- },
76595
- {
76596
- value: "react-swc",
76597
- lang: "js",
76598
- label: "JavaScript + SWC"
76599
- }
76600
- ];
76601
- const value = await inputPrompt({
76602
- type: "select",
76603
- question: "Select a variant:",
76604
- label: "variant",
76605
- options: variantsOptions2,
76606
- defaultValue: variantsOptions2[0].value
76607
- });
76608
- const selected = variantsOptions2.find((variant) => variant.value === value);
76609
- (0, import_assert2.default)(selected, "Expected a variant to be selected");
76610
- return selected;
76611
- }
76612
- var config10 = {
76613
- configVersion: 1,
76614
- id: "react",
76615
- frameworkCli: "create-vite",
76616
- displayName: "React",
76617
- platform: "workers",
76618
- path: "templates-experimental/react",
76619
- copyFiles: {
76620
- variants: {
76621
- ts: {
76622
- path: "./ts"
76623
- },
76624
- js: {
76625
- path: "./js"
76626
- }
76627
- }
76628
- },
76629
- generate: generate9,
76630
- configure: configure6,
76631
- transformPackageJson: async () => ({
76632
- scripts: {
76633
- deploy: `${npm6} run build && wrangler deploy`,
76634
- preview: `${npm6} run build && vite preview`
76635
- }
76636
- }),
76637
- devScript: "dev",
76638
- deployScript: "deploy",
76639
- previewScript: "preview"
76640
- };
76641
- var c3_default12 = config10;
76476
+ var c3_default10 = config8;
76642
76477
 
76643
76478
  // templates-experimental/remix/c3.ts
76644
- var { npm: npm7 } = detectPackageManager();
76645
- var generate10 = async (ctx) => {
76479
+ var { npm: npm5 } = detectPackageManager();
76480
+ var generate8 = async (ctx) => {
76646
76481
  await runFrameworkGenerator(ctx, [
76647
76482
  ctx.project.name,
76648
76483
  "--template",
@@ -76650,14 +76485,14 @@ var generate10 = async (ctx) => {
76650
76485
  ]);
76651
76486
  logRaw("");
76652
76487
  };
76653
- var configure7 = async () => {
76488
+ var configure6 = async () => {
76654
76489
  await installPackages(["wrangler@latest"], {
76655
76490
  dev: true,
76656
76491
  startText: "Updating the Wrangler version",
76657
76492
  doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
76658
76493
  });
76659
76494
  };
76660
- var config11 = {
76495
+ var config9 = {
76661
76496
  configVersion: 1,
76662
76497
  id: "remix",
76663
76498
  frameworkCli: "create-remix",
@@ -76667,12 +76502,12 @@ var config11 = {
76667
76502
  path: "./templates"
76668
76503
  },
76669
76504
  path: "templates-experimental/remix",
76670
- generate: generate10,
76671
- configure: configure7,
76505
+ generate: generate8,
76506
+ configure: configure6,
76672
76507
  transformPackageJson: async () => ({
76673
76508
  scripts: {
76674
- deploy: `${npm7} run build && wrangler deploy`,
76675
- preview: `${npm7} run build && wrangler dev`,
76509
+ deploy: `${npm5} run build && wrangler deploy`,
76510
+ preview: `${npm5} run build && wrangler dev`,
76676
76511
  "cf-typegen": `wrangler types`
76677
76512
  }
76678
76513
  }),
@@ -76680,21 +76515,21 @@ var config11 = {
76680
76515
  deployScript: "deploy",
76681
76516
  previewScript: "preview"
76682
76517
  };
76683
- var c3_default13 = config11;
76518
+ var c3_default11 = config9;
76684
76519
 
76685
76520
  // templates-experimental/solid/c3.ts
76686
- var recast6 = __toESM(require_main3());
76687
- var { npm: npm8 } = detectPackageManager();
76688
- var generate11 = async (ctx) => {
76521
+ var recast5 = __toESM(require_main3());
76522
+ var { npm: npm6 } = detectPackageManager();
76523
+ var generate9 = async (ctx) => {
76689
76524
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
76690
76525
  logRaw("");
76691
76526
  };
76692
- var configure8 = async (ctx) => {
76527
+ var configure7 = async (ctx) => {
76693
76528
  const packages = ["nitropack"];
76694
76529
  await installPackages(packages, {
76695
76530
  dev: true,
76696
76531
  startText: "Installing nitro module `nitropack`",
76697
- doneText: `${brandColor("installed")} ${dim(`via \`${npm8} install\``)}`
76532
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm6} install\``)}`
76698
76533
  });
76699
76534
  usesTypescript(ctx);
76700
76535
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
@@ -76706,7 +76541,7 @@ var configure8 = async (ctx) => {
76706
76541
  if (callee.name !== "defineConfig") {
76707
76542
  return this.traverse(n);
76708
76543
  }
76709
- const b3 = recast6.types.builders;
76544
+ const b3 = recast5.types.builders;
76710
76545
  mergeObjectProperties(
76711
76546
  n.node.arguments[0],
76712
76547
  [
@@ -76730,7 +76565,7 @@ var configure8 = async (ctx) => {
76730
76565
  }
76731
76566
  });
76732
76567
  };
76733
- var config12 = {
76568
+ var config10 = {
76734
76569
  configVersion: 1,
76735
76570
  id: "solid",
76736
76571
  frameworkCli: "create-solid",
@@ -76740,12 +76575,12 @@ var config12 = {
76740
76575
  path: "./templates"
76741
76576
  },
76742
76577
  path: "templates-experimental/solid",
76743
- generate: generate11,
76744
- configure: configure8,
76578
+ generate: generate9,
76579
+ configure: configure7,
76745
76580
  transformPackageJson: async () => ({
76746
76581
  scripts: {
76747
- preview: `${npm8} run build && npx wrangler dev`,
76748
- deploy: `${npm8} run build && wrangler deploy`
76582
+ preview: `${npm6} run build && npx wrangler dev`,
76583
+ deploy: `${npm6} run build && wrangler deploy`
76749
76584
  }
76750
76585
  }),
76751
76586
  compatibilityFlags: ["nodejs_compat"],
@@ -76753,17 +76588,17 @@ var config12 = {
76753
76588
  deployScript: "deploy",
76754
76589
  previewScript: "preview"
76755
76590
  };
76756
- var c3_default14 = config12;
76591
+ var c3_default12 = config10;
76757
76592
 
76758
76593
  // templates-experimental/svelte/c3.ts
76759
76594
  var import_node_os3 = require("node:os");
76760
- var recast7 = __toESM(require_main3());
76761
- var { npm: npm9 } = detectPackageManager();
76762
- var generate12 = async (ctx) => {
76595
+ var recast6 = __toESM(require_main3());
76596
+ var { npm: npm7 } = detectPackageManager();
76597
+ var generate10 = async (ctx) => {
76763
76598
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
76764
76599
  logRaw("");
76765
76600
  };
76766
- var configure9 = async (ctx) => {
76601
+ var configure8 = async (ctx) => {
76767
76602
  const pkg = `@sveltejs/adapter-cloudflare`;
76768
76603
  await installPackages([pkg], {
76769
76604
  dev: true,
@@ -76790,7 +76625,7 @@ var updateTypeDefinitions = (ctx) => {
76790
76625
  return;
76791
76626
  }
76792
76627
  updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
76793
- const b3 = recast7.types.builders;
76628
+ const b3 = recast6.types.builders;
76794
76629
  transformFile("src/app.d.ts", {
76795
76630
  visitTSModuleDeclaration(n) {
76796
76631
  if (n.value.id.name === "App" && n.node.body) {
@@ -76822,7 +76657,7 @@ var updateTypeDefinitions = (ctx) => {
76822
76657
  }
76823
76658
  });
76824
76659
  };
76825
- var config13 = {
76660
+ var config11 = {
76826
76661
  configVersion: 1,
76827
76662
  id: "svelte",
76828
76663
  frameworkCli: "sv",
@@ -76832,12 +76667,12 @@ var config13 = {
76832
76667
  path: "./templates"
76833
76668
  },
76834
76669
  path: "templates-experimental/svelte",
76835
- generate: generate12,
76836
- configure: configure9,
76670
+ generate: generate10,
76671
+ configure: configure8,
76837
76672
  transformPackageJson: async (original, ctx) => {
76838
76673
  let scripts = {
76839
- preview: `${npm9} run build && wrangler dev`,
76840
- deploy: `${npm9} run build && wrangler deploy`
76674
+ preview: `${npm7} run build && wrangler dev`,
76675
+ deploy: `${npm7} run build && wrangler deploy`
76841
76676
  };
76842
76677
  if (usesTypescript(ctx)) {
76843
76678
  const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
@@ -76852,14 +76687,14 @@ var config13 = {
76852
76687
  deployScript: "deploy",
76853
76688
  previewScript: "preview"
76854
76689
  };
76855
- var c3_default15 = config13;
76690
+ var c3_default13 = config11;
76856
76691
 
76857
76692
  // templates-experimental/vue/c3.ts
76858
- var { npm: npm10 } = detectPackageManager();
76859
- var generate13 = async (ctx) => {
76693
+ var { npm: npm8 } = detectPackageManager();
76694
+ var generate11 = async (ctx) => {
76860
76695
  await runFrameworkGenerator(ctx, [ctx.project.name]);
76861
76696
  };
76862
- var config14 = {
76697
+ var config12 = {
76863
76698
  configVersion: 1,
76864
76699
  id: "vue",
76865
76700
  frameworkCli: "create-vue",
@@ -76869,23 +76704,23 @@ var config14 = {
76869
76704
  path: "./templates"
76870
76705
  },
76871
76706
  path: "templates-experimental/vue",
76872
- generate: generate13,
76707
+ generate: generate11,
76873
76708
  transformPackageJson: async () => ({
76874
76709
  scripts: {
76875
- deploy: `${npm10} run build && wrangler deploy`,
76876
- preview: `${npm10} run build && wrangler dev`
76710
+ deploy: `${npm8} run build && wrangler deploy`,
76711
+ preview: `${npm8} run build && wrangler dev`
76877
76712
  }
76878
76713
  }),
76879
76714
  devScript: "dev",
76880
76715
  deployScript: "deploy",
76881
76716
  previewScript: "preview"
76882
76717
  };
76883
- var c3_default16 = config14;
76718
+ var c3_default14 = config12;
76884
76719
 
76885
76720
  // templates/analog/c3.ts
76886
- var recast8 = __toESM(require_main3());
76887
- var { npm: npm11, name: pm2 } = detectPackageManager();
76888
- var generate14 = async (ctx) => {
76721
+ var recast7 = __toESM(require_main3());
76722
+ var { npm: npm9, name: pm2 } = detectPackageManager();
76723
+ var generate12 = async (ctx) => {
76889
76724
  await runFrameworkGenerator(ctx, [
76890
76725
  ctx.project.name,
76891
76726
  "--template",
@@ -76893,7 +76728,7 @@ var generate14 = async (ctx) => {
76893
76728
  ]);
76894
76729
  logRaw("");
76895
76730
  };
76896
- var configure10 = async (ctx) => {
76731
+ var configure9 = async (ctx) => {
76897
76732
  if (pm2 === "pnpm" || pm2 === "yarn" || pm2 === "bun") {
76898
76733
  const packages = [];
76899
76734
  packages.push("nitropack");
@@ -76903,7 +76738,7 @@ var configure10 = async (ctx) => {
76903
76738
  await installPackages(packages, {
76904
76739
  dev: true,
76905
76740
  startText: `Installing ${packages.join(", ")}`,
76906
- doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
76741
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm9} install\``)}`
76907
76742
  });
76908
76743
  }
76909
76744
  updateViteConfig(ctx);
@@ -76924,7 +76759,7 @@ var updateEnvTypes2 = (ctx) => {
76924
76759
  s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76925
76760
  };
76926
76761
  var updateViteConfig = (ctx) => {
76927
- const b3 = recast8.types.builders;
76762
+ const b3 = recast7.types.builders;
76928
76763
  const s = spinner();
76929
76764
  const configFile = "vite.config.ts";
76930
76765
  s.start(`Updating \`${configFile}\``);
@@ -76961,7 +76796,7 @@ var updateViteConfig = (ctx) => {
76961
76796
  });
76962
76797
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76963
76798
  };
76964
- var config15 = {
76799
+ var config13 = {
76965
76800
  configVersion: 1,
76966
76801
  id: "analog",
76967
76802
  frameworkCli: "create-analog",
@@ -76970,12 +76805,12 @@ var config15 = {
76970
76805
  copyFiles: {
76971
76806
  path: "./templates"
76972
76807
  },
76973
- generate: generate14,
76974
- configure: configure10,
76808
+ generate: generate12,
76809
+ configure: configure9,
76975
76810
  transformPackageJson: async () => ({
76976
76811
  scripts: {
76977
- preview: `${npm11} run build && wrangler pages dev`,
76978
- deploy: `${npm11} run build && wrangler pages deploy`,
76812
+ preview: `${npm9} run build && wrangler pages dev`,
76813
+ deploy: `${npm9} run build && wrangler pages deploy`,
76979
76814
  "cf-typegen": `wrangler types`
76980
76815
  }
76981
76816
  }),
@@ -76983,12 +76818,12 @@ var config15 = {
76983
76818
  deployScript: "deploy",
76984
76819
  previewScript: "preview"
76985
76820
  };
76986
- var c3_default17 = config15;
76821
+ var c3_default15 = config13;
76987
76822
 
76988
76823
  // templates/angular/c3.ts
76989
76824
  var import_node_path4 = require("node:path");
76990
- var { npm: npm12 } = detectPackageManager();
76991
- var generate15 = async (ctx) => {
76825
+ var { npm: npm10 } = detectPackageManager();
76826
+ var generate13 = async (ctx) => {
76992
76827
  await runFrameworkGenerator(ctx, [
76993
76828
  ctx.project.name,
76994
76829
  "--ssr",
@@ -76996,7 +76831,7 @@ var generate15 = async (ctx) => {
76996
76831
  ]);
76997
76832
  logRaw("");
76998
76833
  };
76999
- var configure11 = async (ctx) => {
76834
+ var configure10 = async (ctx) => {
77000
76835
  updateAngularJson2(ctx);
77001
76836
  await updateAppCode2();
77002
76837
  await installCFWorker2();
@@ -77005,7 +76840,7 @@ async function installCFWorker2() {
77005
76840
  await installPackages(["xhr2"], {
77006
76841
  dev: true,
77007
76842
  startText: "Installing additional dependencies",
77008
- doneText: `${brandColor("installed")} ${dim(`via \`${npm12} install\``)}`
76843
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
77009
76844
  });
77010
76845
  }
77011
76846
  async function updateAppCode2() {
@@ -77047,7 +76882,7 @@ function updateAngularJson2(ctx) {
77047
76882
  writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
77048
76883
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
77049
76884
  }
77050
- var config16 = {
76885
+ var config14 = {
77051
76886
  configVersion: 1,
77052
76887
  id: "angular",
77053
76888
  frameworkCli: "@angular/create",
@@ -77059,27 +76894,27 @@ var config16 = {
77059
76894
  devScript: "start",
77060
76895
  deployScript: "deploy",
77061
76896
  previewScript: "start",
77062
- generate: generate15,
77063
- configure: configure11,
76897
+ generate: generate13,
76898
+ configure: configure10,
77064
76899
  transformPackageJson: async () => ({
77065
76900
  scripts: {
77066
- start: `${npm12} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
77067
- build: `ng build && ${npm12} run process`,
76901
+ start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
76902
+ build: `ng build && ${npm10} run process`,
77068
76903
  process: "node ./tools/copy-files.mjs",
77069
- deploy: `${npm12} run build && wrangler pages deploy dist/cloudflare`
76904
+ deploy: `${npm10} run build && wrangler pages deploy dist/cloudflare`
77070
76905
  }
77071
76906
  })
77072
76907
  };
77073
- var c3_default18 = config16;
76908
+ var c3_default16 = config14;
77074
76909
 
77075
76910
  // templates/astro/c3.ts
77076
- var recast9 = __toESM(require_main3());
76911
+ var recast8 = __toESM(require_main3());
77077
76912
  var { npx: npx3 } = detectPackageManager();
77078
- var generate16 = async (ctx) => {
76913
+ var generate14 = async (ctx) => {
77079
76914
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
77080
76915
  logRaw("");
77081
76916
  };
77082
- var configure12 = async () => {
76917
+ var configure11 = async () => {
77083
76918
  await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
77084
76919
  silent: true,
77085
76920
  startText: "Installing adapter",
@@ -77098,7 +76933,7 @@ var updateAstroConfig2 = () => {
77098
76933
  if (callee.name !== "cloudflare") {
77099
76934
  return this.traverse(n);
77100
76935
  }
77101
- const b3 = recast9.types.builders;
76936
+ const b3 = recast8.types.builders;
77102
76937
  n.node.arguments = [
77103
76938
  b3.objectExpression([
77104
76939
  b3.objectProperty(
@@ -77113,7 +76948,7 @@ var updateAstroConfig2 = () => {
77113
76948
  }
77114
76949
  });
77115
76950
  };
77116
- var config17 = {
76951
+ var config15 = {
77117
76952
  configVersion: 1,
77118
76953
  id: "astro",
77119
76954
  frameworkCli: "create-astro",
@@ -77135,8 +76970,8 @@ var config17 = {
77135
76970
  devScript: "dev",
77136
76971
  deployScript: "deploy",
77137
76972
  previewScript: "preview",
77138
- generate: generate16,
77139
- configure: configure12,
76973
+ generate: generate14,
76974
+ configure: configure11,
77140
76975
  transformPackageJson: async (pkgJson, ctx) => ({
77141
76976
  scripts: {
77142
76977
  deploy: `astro build && wrangler pages deploy`,
@@ -77145,10 +76980,10 @@ var config17 = {
77145
76980
  }
77146
76981
  })
77147
76982
  };
77148
- var c3_default19 = config17;
76983
+ var c3_default17 = config15;
77149
76984
 
77150
76985
  // templates/common/c3.ts
77151
- var c3_default20 = {
76986
+ var c3_default18 = {
77152
76987
  configVersion: 1,
77153
76988
  id: "common",
77154
76989
  displayName: "Example router & proxy Worker",
@@ -77167,33 +77002,69 @@ var c3_default20 = {
77167
77002
  }
77168
77003
  };
77169
77004
 
77170
- // templates/docusaurus/c3.ts
77171
- var { npm: npm13 } = detectPackageManager();
77172
- var generate17 = async (ctx) => {
77005
+ // templates/docusaurus/pages/c3.ts
77006
+ var { npm: npm11 } = detectPackageManager();
77007
+ var generate15 = async (ctx) => {
77173
77008
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
77174
77009
  };
77175
- var config18 = {
77010
+ var config16 = {
77176
77011
  configVersion: 1,
77177
77012
  id: "docusaurus",
77178
77013
  frameworkCli: "create-docusaurus",
77179
77014
  platform: "pages",
77180
77015
  displayName: "Docusaurus",
77181
- generate: generate17,
77016
+ path: "templates/docusaurus/pages",
77017
+ generate: generate15,
77182
77018
  transformPackageJson: async () => ({
77183
77019
  scripts: {
77184
- preview: `${npm13} run build && wrangler pages dev ./build`,
77185
- deploy: `${npm13} run build && wrangler pages deploy ./build`
77020
+ preview: `${npm11} run build && wrangler pages dev ./build`,
77021
+ deploy: `${npm11} run build && wrangler pages deploy ./build`
77186
77022
  }
77187
77023
  }),
77188
77024
  devScript: "preview",
77189
77025
  deployScript: "deploy",
77190
77026
  previewScript: "preview"
77191
77027
  };
77028
+ var c3_default19 = config16;
77029
+
77030
+ // templates/docusaurus/workers/c3.ts
77031
+ var { npm: npm12 } = detectPackageManager();
77032
+ var generate16 = async (ctx) => {
77033
+ await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
77034
+ };
77035
+ var config17 = {
77036
+ configVersion: 1,
77037
+ id: "docusaurus",
77038
+ frameworkCli: "create-docusaurus",
77039
+ platform: "workers",
77040
+ displayName: "Docusaurus",
77041
+ copyFiles: {
77042
+ path: "./templates"
77043
+ },
77044
+ path: "templates/docusaurus/workers",
77045
+ generate: generate16,
77046
+ transformPackageJson: async () => ({
77047
+ scripts: {
77048
+ deploy: `${npm12} run build && wrangler deploy`,
77049
+ preview: `${npm12} run build && wrangler dev`
77050
+ }
77051
+ }),
77052
+ devScript: "start",
77053
+ deployScript: "deploy",
77054
+ previewScript: "preview"
77055
+ };
77056
+ var c3_default20 = config17;
77057
+
77058
+ // templates/docusaurus/c3.ts
77059
+ var config18 = {
77060
+ displayName: "Docusaurus",
77061
+ platformVariants: { pages: c3_default19, workers: c3_default20 }
77062
+ };
77192
77063
  var c3_default21 = config18;
77193
77064
 
77194
77065
  // templates/gatsby/c3.ts
77195
- var { npm: npm14 } = detectPackageManager();
77196
- var generate18 = async (ctx) => {
77066
+ var { npm: npm13 } = detectPackageManager();
77067
+ var generate17 = async (ctx) => {
77197
77068
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
77198
77069
  const useTemplate = await inputPrompt({
77199
77070
  type: "confirm",
@@ -77218,11 +77089,11 @@ var config19 = {
77218
77089
  frameworkCli: "gatsby",
77219
77090
  platform: "pages",
77220
77091
  displayName: "Gatsby",
77221
- generate: generate18,
77092
+ generate: generate17,
77222
77093
  transformPackageJson: async () => ({
77223
77094
  scripts: {
77224
- deploy: `${npm14} run build && wrangler pages deploy ./public`,
77225
- preview: `${npm14} run build && wrangler pages dev ./public`
77095
+ deploy: `${npm13} run build && wrangler pages deploy ./public`,
77096
+ preview: `${npm13} run build && wrangler pages dev ./public`
77226
77097
  }
77227
77098
  }),
77228
77099
  devScript: "develop",
@@ -77287,7 +77158,7 @@ var c3_default24 = {
77287
77158
  };
77288
77159
 
77289
77160
  // templates/hono/c3.ts
77290
- var generate19 = async (ctx) => {
77161
+ var generate18 = async (ctx) => {
77291
77162
  const { name: pm4 } = detectPackageManager();
77292
77163
  await runFrameworkGenerator(ctx, [
77293
77164
  ctx.project.name,
@@ -77299,7 +77170,7 @@ var generate19 = async (ctx) => {
77299
77170
  ]);
77300
77171
  logRaw("");
77301
77172
  };
77302
- var configure13 = async (ctx) => {
77173
+ var configure12 = async (ctx) => {
77303
77174
  const indexFile = "src/index.ts";
77304
77175
  const s = spinner();
77305
77176
  s.start(`Updating \`${indexFile}\``);
@@ -77323,8 +77194,8 @@ var config20 = {
77323
77194
  path: "./templates"
77324
77195
  },
77325
77196
  platform: "workers",
77326
- generate: generate19,
77327
- configure: configure13,
77197
+ generate: generate18,
77198
+ configure: configure12,
77328
77199
  transformPackageJson: async () => ({
77329
77200
  scripts: {
77330
77201
  dev: "wrangler dev",
@@ -77340,8 +77211,8 @@ var c3_default25 = config20;
77340
77211
 
77341
77212
  // templates/next/c3.ts
77342
77213
  var import_path10 = require("path");
77343
- var { npm: npm15, npx: npx4 } = detectPackageManager();
77344
- var generate20 = async (ctx) => {
77214
+ var { npm: npm14, npx: npx4 } = detectPackageManager();
77215
+ var generate19 = async (ctx) => {
77345
77216
  const projectName = ctx.project.name;
77346
77217
  await runFrameworkGenerator(ctx, [projectName]);
77347
77218
  const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
@@ -77366,7 +77237,7 @@ var updateNextConfig2 = (usesTs) => {
77366
77237
  writeFile2(configFile, updatedConfigFile);
77367
77238
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
77368
77239
  };
77369
- var configure14 = async (ctx) => {
77240
+ var configure13 = async (ctx) => {
77370
77241
  const projectPath = ctx.project.path;
77371
77242
  const path6 = probePaths([
77372
77243
  `${projectPath}/pages/api`,
@@ -77447,8 +77318,8 @@ var c3_default26 = {
77447
77318
  frameworkCli: "create-next-app",
77448
77319
  platform: "pages",
77449
77320
  displayName: "Next.js",
77450
- generate: generate20,
77451
- configure: configure14,
77321
+ generate: generate19,
77322
+ configure: configure13,
77452
77323
  copyFiles: {
77453
77324
  async selectVariant(ctx) {
77454
77325
  const isApp = probePaths([
@@ -77479,12 +77350,12 @@ var c3_default26 = {
77479
77350
  }
77480
77351
  },
77481
77352
  transformPackageJson: async (_3, ctx) => {
77482
- const isNpm = npm15 === "npm";
77483
- const isBun = npm15 === "bun";
77353
+ const isNpm = npm14 === "npm";
77354
+ const isBun = npm14 === "bun";
77484
77355
  const isNpmOrBun = isNpm || isBun;
77485
77356
  const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
77486
77357
  const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
77487
- const pmCommand = isNpmOrBun ? npx4 : npm15;
77358
+ const pmCommand = isNpmOrBun ? npx4 : npm14;
77488
77359
  const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
77489
77360
  return {
77490
77361
  scripts: {
@@ -77504,21 +77375,21 @@ var c3_default26 = {
77504
77375
  };
77505
77376
 
77506
77377
  // templates/nuxt/c3.ts
77507
- var recast10 = __toESM(require_main3());
77508
- var { npm: npm16, name: pm3 } = detectPackageManager();
77509
- var generate21 = async (ctx) => {
77378
+ var recast9 = __toESM(require_main3());
77379
+ var { npm: npm15, name: pm3 } = detectPackageManager();
77380
+ var generate20 = async (ctx) => {
77510
77381
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
77511
77382
  await runFrameworkGenerator(ctx, [
77512
77383
  "init",
77513
77384
  ctx.project.name,
77514
77385
  "--packageManager",
77515
- npm16,
77386
+ npm15,
77516
77387
  gitFlag
77517
77388
  ]);
77518
77389
  writeFile2("./.node-version", "18");
77519
77390
  logRaw("");
77520
77391
  };
77521
- var configure15 = async (ctx) => {
77392
+ var configure14 = async (ctx) => {
77522
77393
  const packages = ["nitro-cloudflare-dev"];
77523
77394
  if (pm3 === "pnpm") {
77524
77395
  packages.push("h3");
@@ -77526,7 +77397,7 @@ var configure15 = async (ctx) => {
77526
77397
  await installPackages(packages, {
77527
77398
  dev: true,
77528
77399
  startText: "Installing nitro module `nitro-cloudflare-dev`",
77529
- doneText: `${brandColor("installed")} ${dim(`via \`${npm16} install\``)}`
77400
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
77530
77401
  });
77531
77402
  updateNuxtConfig2();
77532
77403
  updateEnvTypes3(ctx);
@@ -77549,7 +77420,7 @@ var updateNuxtConfig2 = () => {
77549
77420
  const s = spinner();
77550
77421
  const configFile = "nuxt.config.ts";
77551
77422
  s.start(`Updating \`${configFile}\``);
77552
- const b3 = recast10.types.builders;
77423
+ const b3 = recast9.types.builders;
77553
77424
  const presetDef = b3.objectProperty(
77554
77425
  b3.identifier("nitro"),
77555
77426
  b3.objectExpression([
@@ -77586,12 +77457,12 @@ var config21 = {
77586
77457
  copyFiles: {
77587
77458
  path: "./templates"
77588
77459
  },
77589
- generate: generate21,
77590
- configure: configure15,
77460
+ generate: generate20,
77461
+ configure: configure14,
77591
77462
  transformPackageJson: async () => ({
77592
77463
  scripts: {
77593
- deploy: `${npm16} run build && wrangler pages deploy`,
77594
- preview: `${npm16} run build && wrangler pages dev`,
77464
+ deploy: `${npm15} run build && wrangler pages deploy`,
77465
+ preview: `${npm15} run build && wrangler pages dev`,
77595
77466
  "cf-typegen": `wrangler types`
77596
77467
  }
77597
77468
  }),
@@ -77818,13 +77689,13 @@ var c3_default30 = {
77818
77689
  };
77819
77690
 
77820
77691
  // templates/qwik/c3.ts
77821
- var recast11 = __toESM(require_main3());
77822
- var { npm: npm17, npx: npx5, name: name2 } = detectPackageManager();
77823
- var generate22 = async (ctx) => {
77692
+ var recast10 = __toESM(require_main3());
77693
+ var { npm: npm16, npx: npx5, name: name2 } = detectPackageManager();
77694
+ var generate21 = async (ctx) => {
77824
77695
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
77825
77696
  };
77826
- var configure16 = async (ctx) => {
77827
- const cmd = [name2 === "pnpm" ? npm17 : npx5, "qwik", "add", "cloudflare-pages"];
77697
+ var configure15 = async (ctx) => {
77698
+ const cmd = [name2 === "pnpm" ? npm16 : npx5, "qwik", "add", "cloudflare-pages"];
77828
77699
  endSection(`Running ${quoteShellArgs(cmd)}`);
77829
77700
  await runCommand(cmd);
77830
77701
  addBindingsProxy2(ctx);
@@ -77837,7 +77708,7 @@ var addBindingsProxy2 = (ctx) => {
77837
77708
  const s = spinner();
77838
77709
  s.start("Updating `vite.config.ts`");
77839
77710
  const snippets = loadTemplateSnippets(ctx);
77840
- const b3 = recast11.types.builders;
77711
+ const b3 = recast10.types.builders;
77841
77712
  transformFile("vite.config.ts", {
77842
77713
  // Insert the env declaration after the last import (but before the rest of the body)
77843
77714
  visitProgram: function(n) {
@@ -77879,7 +77750,7 @@ var populateCloudflareEnv2 = () => {
77879
77750
  s.start(`Updating \`${entrypointPath}\``);
77880
77751
  transformFile(entrypointPath, {
77881
77752
  visitTSInterfaceDeclaration: function(n) {
77882
- const b3 = recast11.types.builders;
77753
+ const b3 = recast10.types.builders;
77883
77754
  const id = n.node.id;
77884
77755
  if (id.name !== "QwikCityPlatform") {
77885
77756
  this.traverse(n);
@@ -77909,12 +77780,12 @@ var config22 = {
77909
77780
  copyFiles: {
77910
77781
  path: "./templates"
77911
77782
  },
77912
- generate: generate22,
77913
- configure: configure16,
77783
+ generate: generate21,
77784
+ configure: configure15,
77914
77785
  transformPackageJson: async () => ({
77915
77786
  scripts: {
77916
- deploy: `${npm17} run build && wrangler pages deploy`,
77917
- preview: `${npm17} run build && wrangler pages dev`,
77787
+ deploy: `${npm16} run build && wrangler pages deploy`,
77788
+ preview: `${npm16} run build && wrangler pages dev`,
77918
77789
  "cf-typegen": `wrangler types`
77919
77790
  }
77920
77791
  }),
@@ -77924,9 +77795,9 @@ var config22 = {
77924
77795
  };
77925
77796
  var c3_default31 = config22;
77926
77797
 
77927
- // templates/react/c3.ts
77928
- var { npm: npm18 } = detectPackageManager();
77929
- var generate23 = async (ctx) => {
77798
+ // templates/react/pages/c3.ts
77799
+ var { npm: npm17 } = detectPackageManager();
77800
+ var generate22 = async (ctx) => {
77930
77801
  const variant = await inputPrompt({
77931
77802
  type: "select",
77932
77803
  question: "Select a variant:",
@@ -77962,11 +77833,12 @@ var config23 = {
77962
77833
  frameworkCli: "create-vite",
77963
77834
  displayName: "React",
77964
77835
  platform: "pages",
77965
- generate: generate23,
77836
+ path: "templates/react/pages",
77837
+ generate: generate22,
77966
77838
  transformPackageJson: async () => ({
77967
77839
  scripts: {
77968
- deploy: `${npm18} run build && wrangler pages deploy ./dist`,
77969
- preview: `${npm18} run build && wrangler pages dev ./dist`
77840
+ deploy: `${npm17} run build && wrangler pages deploy ./dist`,
77841
+ preview: `${npm17} run build && wrangler pages dev ./dist`
77970
77842
  }
77971
77843
  }),
77972
77844
  devScript: "dev",
@@ -77975,6 +77847,151 @@ var config23 = {
77975
77847
  };
77976
77848
  var c3_default32 = config23;
77977
77849
 
77850
+ // templates/react/workers/c3.ts
77851
+ var import_assert2 = __toESM(require("assert"));
77852
+ var recast11 = __toESM(require_main3());
77853
+ var b2 = recast11.types.builders;
77854
+ var t = recast11.types.namedTypes;
77855
+ var { npm: npm18 } = detectPackageManager();
77856
+ var generate23 = async (ctx) => {
77857
+ const variant = await getVariant();
77858
+ ctx.args.lang = variant.lang;
77859
+ await runFrameworkGenerator(ctx, [
77860
+ ctx.project.name,
77861
+ "--template",
77862
+ variant.value
77863
+ ]);
77864
+ logRaw("");
77865
+ };
77866
+ var configure16 = async (ctx) => {
77867
+ await installPackages(["@cloudflare/vite-plugin"], {
77868
+ dev: true,
77869
+ startText: "Installing the Cloudflare Vite plugin",
77870
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
77871
+ });
77872
+ await transformViteConfig(ctx);
77873
+ if (usesTypescript(ctx)) {
77874
+ updateTsconfigJson();
77875
+ }
77876
+ };
77877
+ function transformViteConfig(ctx) {
77878
+ const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
77879
+ transformFile(filePath, {
77880
+ visitProgram(n) {
77881
+ const lastImportIndex = n.node.body.findLastIndex(
77882
+ (statement) => statement.type === "ImportDeclaration"
77883
+ );
77884
+ const lastImport = n.get("body", lastImportIndex);
77885
+ const importAst = b2.importDeclaration(
77886
+ [b2.importSpecifier(b2.identifier("cloudflare"))],
77887
+ b2.stringLiteral("@cloudflare/vite-plugin")
77888
+ );
77889
+ lastImport.insertAfter(importAst);
77890
+ return this.traverse(n);
77891
+ },
77892
+ visitCallExpression: function(n) {
77893
+ const callee = n.node.callee;
77894
+ if (callee.name !== "defineConfig") {
77895
+ return this.traverse(n);
77896
+ }
77897
+ const config30 = n.node.arguments[0];
77898
+ (0, import_assert2.default)(t.ObjectExpression.check(config30));
77899
+ const pluginsProp = config30.properties.find((prop) => isPluginsProp(prop));
77900
+ (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
77901
+ pluginsProp.value.elements.push(
77902
+ b2.callExpression(b2.identifier("cloudflare"), [])
77903
+ );
77904
+ return false;
77905
+ }
77906
+ });
77907
+ }
77908
+ function isPluginsProp(prop) {
77909
+ return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
77910
+ }
77911
+ function updateTsconfigJson() {
77912
+ const s = spinner();
77913
+ s.start(`Updating tsconfig.json config`);
77914
+ const tsconfig = readJSON("tsconfig.json");
77915
+ if (tsconfig && typeof tsconfig === "object") {
77916
+ tsconfig.references ??= [];
77917
+ tsconfig.references.push({ path: "./tsconfig.worker.json" });
77918
+ }
77919
+ writeJSON("tsconfig.json", tsconfig);
77920
+ s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
77921
+ }
77922
+ async function getVariant() {
77923
+ const variantsOptions2 = [
77924
+ {
77925
+ value: "react-ts",
77926
+ lang: "ts",
77927
+ label: "TypeScript"
77928
+ },
77929
+ {
77930
+ value: "react-swc-ts",
77931
+ lang: "ts",
77932
+ label: "TypeScript + SWC"
77933
+ },
77934
+ {
77935
+ value: "react",
77936
+ lang: "js",
77937
+ label: "JavaScript"
77938
+ },
77939
+ {
77940
+ value: "react-swc",
77941
+ lang: "js",
77942
+ label: "JavaScript + SWC"
77943
+ }
77944
+ ];
77945
+ const value = await inputPrompt({
77946
+ type: "select",
77947
+ question: "Select a variant:",
77948
+ label: "variant",
77949
+ options: variantsOptions2,
77950
+ defaultValue: variantsOptions2[0].value
77951
+ });
77952
+ const selected = variantsOptions2.find((variant) => variant.value === value);
77953
+ (0, import_assert2.default)(selected, "Expected a variant to be selected");
77954
+ return selected;
77955
+ }
77956
+ var config24 = {
77957
+ configVersion: 1,
77958
+ id: "react",
77959
+ frameworkCli: "create-vite",
77960
+ displayName: "React",
77961
+ platform: "workers",
77962
+ path: "templates/react/workers",
77963
+ copyFiles: {
77964
+ variants: {
77965
+ ts: {
77966
+ path: "./ts"
77967
+ },
77968
+ js: {
77969
+ path: "./js"
77970
+ }
77971
+ }
77972
+ },
77973
+ generate: generate23,
77974
+ configure: configure16,
77975
+ transformPackageJson: async (_3, ctx) => ({
77976
+ scripts: {
77977
+ deploy: `${npm18} run build && wrangler deploy`,
77978
+ preview: `${npm18} run build && vite preview`,
77979
+ ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
77980
+ }
77981
+ }),
77982
+ devScript: "dev",
77983
+ deployScript: "deploy",
77984
+ previewScript: "preview"
77985
+ };
77986
+ var c3_default33 = config24;
77987
+
77988
+ // templates/react/c3.ts
77989
+ var config25 = {
77990
+ displayName: "React",
77991
+ platformVariants: { pages: c3_default32, workers: c3_default33 }
77992
+ };
77993
+ var c3_default34 = config25;
77994
+
77978
77995
  // templates/remix/c3.ts
77979
77996
  var { npm: npm19 } = detectPackageManager();
77980
77997
  var generate24 = async (ctx) => {
@@ -78000,7 +78017,7 @@ var configure17 = async () => {
78000
78017
  });
78001
78018
  s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
78002
78019
  };
78003
- var config24 = {
78020
+ var config26 = {
78004
78021
  configVersion: 1,
78005
78022
  id: "remix",
78006
78023
  frameworkCli: "create-remix",
@@ -78022,10 +78039,10 @@ var config24 = {
78022
78039
  deployScript: "deploy",
78023
78040
  previewScript: "preview"
78024
78041
  };
78025
- var c3_default33 = config24;
78042
+ var c3_default35 = config26;
78026
78043
 
78027
78044
  // templates/scheduled/c3.ts
78028
- var c3_default34 = {
78045
+ var c3_default36 = {
78029
78046
  configVersion: 1,
78030
78047
  id: "scheduled",
78031
78048
  displayName: "Scheduled Worker (Cron Trigger)",
@@ -78088,7 +78105,7 @@ var configure18 = async (ctx) => {
78088
78105
  }
78089
78106
  });
78090
78107
  };
78091
- var config25 = {
78108
+ var config27 = {
78092
78109
  configVersion: 1,
78093
78110
  id: "solid",
78094
78111
  frameworkCli: "create-solid",
@@ -78110,7 +78127,7 @@ var config25 = {
78110
78127
  deployScript: "deploy",
78111
78128
  previewScript: "preview"
78112
78129
  };
78113
- var c3_default35 = config25;
78130
+ var c3_default37 = config27;
78114
78131
 
78115
78132
  // templates/svelte/c3.ts
78116
78133
  var import_node_fs3 = require("node:fs");
@@ -78203,7 +78220,7 @@ var updateTypeDefinitions2 = (ctx) => {
78203
78220
  }
78204
78221
  });
78205
78222
  };
78206
- var config26 = {
78223
+ var config28 = {
78207
78224
  configVersion: 1,
78208
78225
  id: "svelte",
78209
78226
  frameworkCli: "sv",
@@ -78232,14 +78249,14 @@ var config26 = {
78232
78249
  deployScript: "deploy",
78233
78250
  previewScript: "preview"
78234
78251
  };
78235
- var c3_default36 = config26;
78252
+ var c3_default38 = config28;
78236
78253
 
78237
78254
  // templates/vue/c3.ts
78238
78255
  var { npm: npm22 } = detectPackageManager();
78239
78256
  var generate27 = async (ctx) => {
78240
78257
  await runFrameworkGenerator(ctx, [ctx.project.name]);
78241
78258
  };
78242
- var config27 = {
78259
+ var config29 = {
78243
78260
  configVersion: 1,
78244
78261
  id: "vue",
78245
78262
  frameworkCli: "create-vue",
@@ -78256,13 +78273,13 @@ var config27 = {
78256
78273
  deployScript: "deploy",
78257
78274
  previewScript: "preview"
78258
78275
  };
78259
- var c3_default37 = config27;
78276
+ var c3_default39 = config29;
78260
78277
 
78261
78278
  // src/git.ts
78262
78279
  var import_node_assert = __toESM(require("node:assert"));
78263
78280
 
78264
78281
  // ../wrangler/package.json
78265
- var version2 = "3.112.0";
78282
+ var version2 = "3.113.0";
78266
78283
 
78267
78284
  // src/git.ts
78268
78285
  var offerGit = async (ctx) => {
@@ -78525,49 +78542,47 @@ function getFrameworkMap({ experimental = false }) {
78525
78542
  return {
78526
78543
  angular: c3_default,
78527
78544
  astro: c3_default2,
78528
- docusaurus: c3_default3,
78529
- gatsby: c3_default4,
78530
- hono: c3_default8,
78531
- next: c3_default9,
78532
- nuxt: c3_default10,
78533
- qwik: c3_default11,
78534
- react: c3_default12,
78535
- remix: c3_default13,
78536
- solid: c3_default14,
78537
- svelte: c3_default15,
78538
- vue: c3_default16
78545
+ gatsby: c3_default3,
78546
+ hono: c3_default7,
78547
+ next: c3_default8,
78548
+ nuxt: c3_default9,
78549
+ qwik: c3_default10,
78550
+ remix: c3_default11,
78551
+ solid: c3_default12,
78552
+ svelte: c3_default13,
78553
+ vue: c3_default14
78539
78554
  };
78540
78555
  } else {
78541
78556
  return {
78542
- analog: c3_default17,
78543
- angular: c3_default18,
78544
- astro: c3_default19,
78557
+ analog: c3_default15,
78558
+ angular: c3_default16,
78559
+ astro: c3_default17,
78545
78560
  docusaurus: c3_default21,
78546
78561
  gatsby: c3_default22,
78547
78562
  hono: c3_default25,
78548
78563
  next: c3_default26,
78549
78564
  nuxt: c3_default27,
78550
78565
  qwik: c3_default31,
78551
- react: c3_default32,
78552
- remix: c3_default33,
78553
- solid: c3_default35,
78554
- svelte: c3_default36,
78555
- vue: c3_default37
78566
+ react: c3_default34,
78567
+ remix: c3_default35,
78568
+ solid: c3_default37,
78569
+ svelte: c3_default38,
78570
+ vue: c3_default39
78556
78571
  };
78557
78572
  }
78558
78573
  }
78559
78574
  function getTemplateMap({ experimental = false }) {
78560
78575
  if (experimental) {
78561
78576
  return {
78562
- "hello-world-assets-only": c3_default5,
78563
- "hello-world-with-assets": c3_default7,
78564
- "hello-world-durable-object-with-assets": c3_default6
78577
+ "hello-world-assets-only": c3_default4,
78578
+ "hello-world-with-assets": c3_default6,
78579
+ "hello-world-durable-object-with-assets": c3_default5
78565
78580
  };
78566
78581
  } else {
78567
78582
  return {
78568
78583
  "hello-world": c3_default24,
78569
- common: c3_default20,
78570
- scheduled: c3_default34,
78584
+ common: c3_default18,
78585
+ scheduled: c3_default36,
78571
78586
  queues: c3_default30,
78572
78587
  "hello-world-durable-object": c3_default23,
78573
78588
  openapi: c3_default28,
@@ -78631,25 +78646,25 @@ var deriveCorrelatedArgs = (args) => {
78631
78646
  };
78632
78647
  var createContext = async (args, prevArgs) => {
78633
78648
  deriveCorrelatedArgs(args);
78649
+ let linesPrinted = 0;
78634
78650
  const goBack = async (from) => {
78635
78651
  const currentArgs = { ...args };
78636
- let linesPrinted = 0;
78637
78652
  switch (from) {
78638
78653
  case "category":
78639
- linesPrinted = 6;
78640
78654
  args.projectName = void 0;
78641
78655
  break;
78642
78656
  case "type":
78643
- linesPrinted = 9;
78644
78657
  args.category = void 0;
78645
78658
  break;
78646
78659
  case "framework":
78647
- linesPrinted = 9;
78648
78660
  args.category = void 0;
78649
78661
  break;
78662
+ case "platform":
78663
+ args.framework = void 0;
78664
+ break;
78650
78665
  case "lang":
78651
- linesPrinted = 12;
78652
78666
  args.type = void 0;
78667
+ args.framework = void 0;
78653
78668
  break;
78654
78669
  }
78655
78670
  currentArgs[from] = void 0;
@@ -78709,6 +78724,7 @@ var createContext = async (args, prevArgs) => {
78709
78724
  options: categoryOptions,
78710
78725
  defaultValue: prevArgs?.category ?? C3_DEFAULTS.category
78711
78726
  });
78727
+ linesPrinted += 6;
78712
78728
  if (category === BACK_VALUE) {
78713
78729
  return goBack("category");
78714
78730
  }
@@ -78718,8 +78734,8 @@ var createContext = async (args, prevArgs) => {
78718
78734
  experimental: args.experimental
78719
78735
  });
78720
78736
  const frameworkOptions = Object.entries(frameworkMap).map(
78721
- ([key, config28]) => ({
78722
- label: config28.displayName,
78737
+ ([key, config30]) => ({
78738
+ label: config30.displayName,
78723
78739
  value: key
78724
78740
  })
78725
78741
  );
@@ -78730,13 +78746,40 @@ var createContext = async (args, prevArgs) => {
78730
78746
  options: frameworkOptions.concat(backOption),
78731
78747
  defaultValue: prevArgs?.framework ?? C3_DEFAULTS.framework
78732
78748
  });
78749
+ linesPrinted += 3;
78733
78750
  if (framework === BACK_VALUE) {
78734
78751
  return goBack("framework");
78735
78752
  }
78736
- const frameworkConfig = frameworkMap[framework];
78753
+ let frameworkConfig = frameworkMap[framework];
78737
78754
  if (!frameworkConfig) {
78738
78755
  throw new Error(`Unsupported framework: ${framework}`);
78739
78756
  }
78757
+ if ("platformVariants" in frameworkConfig) {
78758
+ const platform3 = await processArgument(args, "platform", {
78759
+ type: "select",
78760
+ label: "platform",
78761
+ question: "Select your deployment platform",
78762
+ options: [
78763
+ {
78764
+ label: "Workers with Assets (BETA)",
78765
+ value: "workers",
78766
+ description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
78767
+ },
78768
+ {
78769
+ label: "Pages",
78770
+ value: "pages",
78771
+ description: "Great for simple websites and applications."
78772
+ },
78773
+ backOption
78774
+ ],
78775
+ defaultValue: "workers"
78776
+ });
78777
+ linesPrinted += 3;
78778
+ if (platform3 === BACK_VALUE) {
78779
+ return goBack("platform");
78780
+ }
78781
+ frameworkConfig = frameworkConfig.platformVariants[platform3];
78782
+ }
78740
78783
  template = {
78741
78784
  deployScript: "pages:deploy",
78742
78785
  devScript: "pages:dev",
@@ -78767,6 +78810,7 @@ var createContext = async (args, prevArgs) => {
78767
78810
  options: templateOptions.concat(backOption),
78768
78811
  defaultValue: prevArgs?.type ?? C3_DEFAULTS.type
78769
78812
  });
78813
+ linesPrinted += 3;
78770
78814
  if (type === BACK_VALUE) {
78771
78815
  return goBack("type");
78772
78816
  }
@@ -78795,6 +78839,7 @@ var createContext = async (args, prevArgs) => {
78795
78839
  options: languageOptions.filter((option) => languageVariants.includes(option.value)).concat(args.template ? [] : backOption),
78796
78840
  defaultValue: C3_DEFAULTS.lang
78797
78841
  });
78842
+ linesPrinted += 3;
78798
78843
  if (lang === BACK_VALUE) {
78799
78844
  return goBack("lang");
78800
78845
  }
@@ -78857,28 +78902,28 @@ var processRemoteTemplate = async (args) => {
78857
78902
  src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
78858
78903
  }
78859
78904
  const path6 = await downloadRemoteTemplate(src);
78860
- const config28 = inferTemplateConfig(path6);
78861
- validateTemplate(path6, config28);
78905
+ const config30 = inferTemplateConfig(path6);
78906
+ validateTemplate(path6, config30);
78862
78907
  updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
78863
78908
  return {
78864
78909
  path: path6,
78865
- ...config28
78910
+ ...config30
78866
78911
  };
78867
78912
  };
78868
- var validateTemplate = (path6, config28) => {
78869
- if (!config28.copyFiles) {
78913
+ var validateTemplate = (path6, config30) => {
78914
+ if (!config30.copyFiles) {
78870
78915
  return;
78871
78916
  }
78872
- if (isVariantInfo(config28.copyFiles)) {
78873
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config28.copyFiles.path), config28);
78917
+ if (isVariantInfo(config30.copyFiles)) {
78918
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config30.copyFiles.path), config30);
78874
78919
  } else {
78875
- for (const variant of Object.values(config28.copyFiles.variants)) {
78876
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config28);
78920
+ for (const variant of Object.values(config30.copyFiles.variants)) {
78921
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config30);
78877
78922
  }
78878
78923
  }
78879
78924
  };
78880
- var validateTemplateSrcDirectory = (path6, config28) => {
78881
- if (config28.platform === "workers") {
78925
+ var validateTemplateSrcDirectory = (path6, config30) => {
78926
+ if (config30.platform === "workers") {
78882
78927
  const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
78883
78928
  const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
78884
78929
  const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
@@ -79130,6 +79175,22 @@ var cliDefinition = {
79130
79175
  })
79131
79176
  )
79132
79177
  },
79178
+ {
79179
+ name: "platform",
79180
+ type: "string",
79181
+ description: `Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.`,
79182
+ values: [
79183
+ {
79184
+ name: "pages",
79185
+ description: "Create a web application that can be deployed to Pages."
79186
+ },
79187
+ {
79188
+ name: "workers",
79189
+ description: "Create a web application that can be deployed to Workers (BETA)."
79190
+ }
79191
+ ],
79192
+ requiresArg: true
79193
+ },
79133
79194
  {
79134
79195
  name: "lang",
79135
79196
  type: "string",
@@ -80759,20 +80820,20 @@ function applyEdits(text, edits) {
80759
80820
  var import_fs12 = require("fs");
80760
80821
  var import_path14 = require("path");
80761
80822
  var import_toml2 = __toESM(require_toml());
80762
- function ensureNameExists(config28, projectName) {
80763
- config28["name"] = projectName;
80764
- return config28;
80823
+ function ensureNameExists(config30, projectName) {
80824
+ config30["name"] = projectName;
80825
+ return config30;
80765
80826
  }
80766
- async function ensureCompatDateExists(config28) {
80767
- if (typeof config28["compatibility_date"] === "string") {
80827
+ async function ensureCompatDateExists(config30) {
80828
+ if (typeof config30["compatibility_date"] === "string") {
80768
80829
  const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
80769
- if (!config28["compatibility_date"].match(validCompatDateRe)) {
80770
- config28["compatibility_date"] = await getWorkerdCompatibilityDate();
80830
+ if (!config30["compatibility_date"].match(validCompatDateRe)) {
80831
+ config30["compatibility_date"] = await getWorkerdCompatibilityDate();
80771
80832
  }
80772
80833
  } else {
80773
- config28["compatibility_date"] = await getWorkerdCompatibilityDate();
80834
+ config30["compatibility_date"] = await getWorkerdCompatibilityDate();
80774
80835
  }
80775
- return config28;
80836
+ return config30;
80776
80837
  }
80777
80838
  var updateWranglerConfig = async (ctx) => {
80778
80839
  if (wranglerJsonExists(ctx)) {
@@ -80796,40 +80857,40 @@ var updateWranglerConfig = async (ctx) => {
80796
80857
  writeWranglerJson(
80797
80858
  ctx,
80798
80859
  stringified.slice(0, -2) + `
80799
- /**
80800
- * Smart Placement
80801
- * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
80802
- */
80803
- // "placement": { "mode": "smart" },
80860
+ /**
80861
+ * Smart Placement
80862
+ * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
80863
+ */
80864
+ // "placement": { "mode": "smart" },
80804
80865
 
80805
- /**
80806
- * Bindings
80807
- * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
80808
- * databases, object storage, AI inference, real-time communication and more.
80809
- * https://developers.cloudflare.com/workers/runtime-apis/bindings/
80810
- */
80866
+ /**
80867
+ * Bindings
80868
+ * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
80869
+ * databases, object storage, AI inference, real-time communication and more.
80870
+ * https://developers.cloudflare.com/workers/runtime-apis/bindings/
80871
+ */
80811
80872
 
80812
- /**
80813
- * Environment Variables
80814
- * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
80815
- */
80816
- // "vars": { "MY_VARIABLE": "production_value" },
80817
- /**
80818
- * Note: Use secrets to store sensitive data.
80819
- * https://developers.cloudflare.com/workers/configuration/secrets/
80820
- */
80873
+ /**
80874
+ * Environment Variables
80875
+ * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
80876
+ */
80877
+ // "vars": { "MY_VARIABLE": "production_value" },
80878
+ /**
80879
+ * Note: Use secrets to store sensitive data.
80880
+ * https://developers.cloudflare.com/workers/configuration/secrets/
80881
+ */
80821
80882
 
80822
- /**
80823
- * Static Assets
80824
- * https://developers.cloudflare.com/workers/static-assets/binding/
80825
- */
80826
- // "assets": { "directory": "./public/", "binding": "ASSETS" },
80883
+ /**
80884
+ * Static Assets
80885
+ * https://developers.cloudflare.com/workers/static-assets/binding/
80886
+ */
80887
+ // "assets": { "directory": "./public/", "binding": "ASSETS" },
80827
80888
 
80828
- /**
80829
- * Service Bindings (communicate between multiple Workers)
80830
- * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
80831
- */
80832
- // "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
80889
+ /**
80890
+ * Service Bindings (communicate between multiple Workers)
80891
+ * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
80892
+ */
80893
+ // "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
80833
80894
  }
80834
80895
  `
80835
80896
  );
@@ -81486,8 +81547,8 @@ var renderValues = (values) => {
81486
81547
  };
81487
81548
 
81488
81549
  // src/helpers/retry.ts
81489
- var retry = async (config28, fn) => {
81490
- let { times } = config28;
81550
+ var retry = async (config30, fn) => {
81551
+ let { times } = config30;
81491
81552
  let error2 = null;
81492
81553
  while (times > 0) {
81493
81554
  try {
@@ -81495,10 +81556,10 @@ var retry = async (config28, fn) => {
81495
81556
  } catch (e) {
81496
81557
  error2 = e;
81497
81558
  times--;
81498
- if (config28.exitCondition?.(e)) {
81559
+ if (config30.exitCondition?.(e)) {
81499
81560
  break;
81500
81561
  }
81501
- await sleep(config28.sleepMs ?? 1e3);
81562
+ await sleep(config30.sleepMs ?? 1e3);
81502
81563
  }
81503
81564
  }
81504
81565
  throw error2;
@@ -81618,8 +81679,8 @@ async function addWorkersTypesToTsConfig(ctx) {
81618
81679
  }
81619
81680
  const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
81620
81681
  try {
81621
- const config28 = parse4(tsconfig);
81622
- const currentTypes = config28.compilerOptions?.types ?? [];
81682
+ const config30 = parse4(tsconfig);
81683
+ const currentTypes = config30.compilerOptions?.types ?? [];
81623
81684
  const explicitEntrypoint = currentTypes.some(
81624
81685
  (t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
81625
81686
  );