create-cloudflare 2.40.3 → 2.41.0

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 (38) hide show
  1. package/dist/cli.js +830 -778
  2. package/package.json +6 -6
  3. package/templates/angular/c3.ts +5 -129
  4. package/templates/angular/pages/c3.ts +134 -0
  5. package/{templates-experimental/angular → templates/angular/workers}/c3.ts +2 -2
  6. package/templates/gatsby/c3.ts +5 -45
  7. package/templates/gatsby/pages/c3.ts +50 -0
  8. package/{templates-experimental/gatsby → templates/gatsby/workers}/c3.ts +2 -2
  9. package/templates/nuxt/c3.ts +5 -130
  10. package/templates/nuxt/pages/c3.ts +145 -0
  11. package/templates/nuxt/{templates → pages/templates}/wrangler.jsonc +0 -3
  12. package/{templates-experimental/nuxt → templates/nuxt/workers}/c3.ts +12 -2
  13. package/templates/vue/c3.ts +5 -25
  14. package/templates/vue/pages/c3.ts +30 -0
  15. package/{templates-experimental/vue → templates/vue/workers}/c3.ts +2 -2
  16. /package/templates/angular/{templates → pages/templates}/src/_routes.json +0 -0
  17. /package/{templates-experimental/angular → templates/angular/pages}/templates/src/server.ts +0 -0
  18. /package/templates/angular/{templates → pages/templates}/tools/copy-files.mjs +0 -0
  19. /package/templates/angular/{templates → workers/templates}/src/server.ts +0 -0
  20. /package/{templates-experimental/angular → templates/angular/workers}/templates/wrangler.jsonc +0 -0
  21. /package/{templates-experimental/gatsby → templates/gatsby/workers}/templates/wrangler.jsonc +0 -0
  22. /package/{templates-experimental/nuxt → templates/nuxt/pages}/templates/env.d.ts +0 -0
  23. /package/{templates-experimental/nuxt → templates/nuxt/pages}/templates/worker-configuration.d.ts +0 -0
  24. /package/templates/nuxt/{templates → workers/templates}/env.d.ts +0 -0
  25. /package/templates/nuxt/{templates → workers/templates}/worker-configuration.d.ts +0 -0
  26. /package/{templates-experimental/nuxt → templates/nuxt/workers}/templates/wrangler.jsonc +0 -0
  27. /package/{templates-experimental/vue → templates/vue/workers}/js/server/index.js +0 -0
  28. /package/{templates-experimental/vue → templates/vue/workers}/js/src/App.vue +0 -0
  29. /package/{templates-experimental/vue → templates/vue/workers}/js/src/components/HelloWorld.vue +0 -0
  30. /package/{templates-experimental/vue → templates/vue/workers}/js/vite.config.js +0 -0
  31. /package/{templates-experimental/vue → templates/vue/workers}/js/wrangler.jsonc +0 -0
  32. /package/{templates-experimental/vue → templates/vue/workers}/ts/server/index.ts +0 -0
  33. /package/{templates-experimental/vue → templates/vue/workers}/ts/src/App.vue +0 -0
  34. /package/{templates-experimental/vue → templates/vue/workers}/ts/src/components/HelloWorld.vue +0 -0
  35. /package/{templates-experimental/vue → templates/vue/workers}/ts/tsconfig.worker.json +0 -0
  36. /package/{templates-experimental/vue → templates/vue/workers}/ts/vite.config.ts +0 -0
  37. /package/{templates-experimental/vue → templates/vue/workers}/ts/worker-configuration.d.ts +0 -0
  38. /package/{templates-experimental/vue → templates/vue/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 config30(dirOptions) {
576
+ XDGAppPaths.config = function config34(dirOptions) {
577
577
  return path6.join(xdg.config(), finalPathSegment(dirOptions));
578
578
  };
579
579
  XDGAppPaths.data = function data(dirOptions) {
@@ -630,7 +630,7 @@ var require_XDG = __commonJS({
630
630
  var cache = function() {
631
631
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
632
632
  };
633
- var config30 = function() {
633
+ var config34 = function() {
634
634
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
635
635
  };
636
636
  var data = function() {
@@ -642,13 +642,13 @@ var require_XDG = __commonJS({
642
642
  var state = function() {
643
643
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
644
644
  };
645
- return { cache, config: config30, data, runtime, state };
645
+ return { cache, config: config34, data, runtime, state };
646
646
  };
647
647
  var macos = function() {
648
648
  var cache = function() {
649
649
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
650
650
  };
651
- var config30 = function() {
651
+ var config34 = function() {
652
652
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
653
653
  };
654
654
  var data = function() {
@@ -660,7 +660,7 @@ var require_XDG = __commonJS({
660
660
  var state = function() {
661
661
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
662
662
  };
663
- return { cache, config: config30, data, runtime, state };
663
+ return { cache, config: config34, data, runtime, state };
664
664
  };
665
665
  var windows = function() {
666
666
  function appData() {
@@ -672,7 +672,7 @@ var require_XDG = __commonJS({
672
672
  var cache = function() {
673
673
  return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
674
674
  };
675
- var config30 = function() {
675
+ var config34 = function() {
676
676
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
677
677
  };
678
678
  var data = function() {
@@ -684,7 +684,7 @@ var require_XDG = __commonJS({
684
684
  var state = function() {
685
685
  return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
686
686
  };
687
- return { cache, config: config30, data, runtime, state };
687
+ return { cache, config: config34, data, runtime, state };
688
688
  };
689
689
  var XDG_ = function() {
690
690
  function XDG_2() {
@@ -31619,22 +31619,22 @@ var require_dist_web = __commonJS({
31619
31619
  _createClass(Haikunator3, [{
31620
31620
  key: "haikunate",
31621
31621
  value: function haikunate(options) {
31622
- var config30 = (0, _lodash["default"])(options, this.config);
31623
- if (config30.tokenHex === true) {
31624
- config30.tokenChars = "0123456789abcdef";
31622
+ var config34 = (0, _lodash["default"])(options, this.config);
31623
+ if (config34.tokenHex === true) {
31624
+ config34.tokenChars = "0123456789abcdef";
31625
31625
  }
31626
31626
  var adjective = this._randomElement(this.adjectives);
31627
31627
  var noun = this._randomElement(this.nouns);
31628
- if (!config30.tokenLength)
31629
- config30.tokenLength = 0;
31628
+ if (!config34.tokenLength)
31629
+ config34.tokenLength = 0;
31630
31630
  var token = "";
31631
- for (var i = 0; i < config30.tokenLength; i++) {
31632
- token += this._randomElement(config30.tokenChars);
31631
+ for (var i = 0; i < config34.tokenLength; i++) {
31632
+ token += this._randomElement(config34.tokenChars);
31633
31633
  }
31634
31634
  var sections = [adjective, noun, token];
31635
31635
  return sections.filter(function(e) {
31636
31636
  return !!e;
31637
- }).join(config30.delimiter);
31637
+ }).join(config34.delimiter);
31638
31638
  }
31639
31639
  /**
31640
31640
  * Get a random element from an array/string
@@ -40191,13 +40191,13 @@ var require_esprima = __commonJS({
40191
40191
  return Reader2;
40192
40192
  }();
40193
40193
  var Tokenizer = function() {
40194
- function Tokenizer2(code, config30) {
40194
+ function Tokenizer2(code, config34) {
40195
40195
  this.errorHandler = new error_handler_1.ErrorHandler();
40196
- this.errorHandler.tolerant = config30 ? typeof config30.tolerant === "boolean" && config30.tolerant : false;
40196
+ this.errorHandler.tolerant = config34 ? typeof config34.tolerant === "boolean" && config34.tolerant : false;
40197
40197
  this.scanner = new scanner_1.Scanner(code, this.errorHandler);
40198
- this.scanner.trackComment = 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;
40198
+ this.scanner.trackComment = config34 ? typeof config34.comment === "boolean" && config34.comment : false;
40199
+ this.trackRange = config34 ? typeof config34.range === "boolean" && config34.range : false;
40200
+ this.trackLoc = config34 ? typeof config34.loc === "boolean" && config34.loc : false;
40201
40201
  this.buffer = [];
40202
40202
  this.reader = new Reader();
40203
40203
  }
@@ -50020,11 +50020,11 @@ var require_printer = __commonJS({
50020
50020
  return this.code;
50021
50021
  };
50022
50022
  var emptyPrintResult = new PrintResult("");
50023
- var Printer = function Printer2(config30) {
50023
+ var Printer = function Printer2(config34) {
50024
50024
  assert_1.default.ok(this instanceof Printer2);
50025
- var explicitTabWidth = config30 && config30.tabWidth;
50026
- config30 = options_1.normalize(config30);
50027
- config30.sourceFileName = null;
50025
+ var explicitTabWidth = config34 && config34.tabWidth;
50026
+ config34 = options_1.normalize(config34);
50027
+ config34.sourceFileName = null;
50028
50028
  function makePrintFunctionWith(options, overrides) {
50029
50029
  options = Object.assign({}, options, overrides);
50030
50030
  return function(path6) {
@@ -50039,11 +50039,11 @@ var require_printer = __commonJS({
50039
50039
  includeComments: false
50040
50040
  }));
50041
50041
  }
50042
- var oldTabWidth = config30.tabWidth;
50042
+ var oldTabWidth = config34.tabWidth;
50043
50043
  if (!explicitTabWidth) {
50044
50044
  var loc = path6.getNode().loc;
50045
50045
  if (loc && loc.lines && loc.lines.guessTabWidth) {
50046
- config30.tabWidth = loc.lines.guessTabWidth();
50046
+ config34.tabWidth = loc.lines.guessTabWidth();
50047
50047
  }
50048
50048
  }
50049
50049
  var reprinter = patcher_1.getReprinter(path6);
@@ -50057,11 +50057,11 @@ var require_printer = __commonJS({
50057
50057
  // right choice because it gives us the opportunity to reprint
50058
50058
  // such nodes using their original source.
50059
50059
  reprinter(print2)
50060
- ) : genericPrint(path6, config30, options, makePrintFunctionWith(options, {
50060
+ ) : genericPrint(path6, config34, options, makePrintFunctionWith(options, {
50061
50061
  includeComments: true,
50062
50062
  avoidRootParens: false
50063
50063
  }));
50064
- config30.tabWidth = oldTabWidth;
50064
+ config34.tabWidth = oldTabWidth;
50065
50065
  return lines;
50066
50066
  }
50067
50067
  this.print = function(ast) {
@@ -50072,7 +50072,7 @@ var require_printer = __commonJS({
50072
50072
  includeComments: true,
50073
50073
  avoidRootParens: false
50074
50074
  });
50075
- return new PrintResult(lines.toString(config30), util.composeSourceMaps(config30.inputSourceMap, lines.getSourceMap(config30.sourceMapName, config30.sourceRoot)));
50075
+ return new PrintResult(lines.toString(config34), util.composeSourceMaps(config34.inputSourceMap, lines.getSourceMap(config34.sourceMapName, config34.sourceRoot)));
50076
50076
  };
50077
50077
  this.printGenerically = function(ast) {
50078
50078
  if (!ast) {
@@ -50080,26 +50080,26 @@ var require_printer = __commonJS({
50080
50080
  }
50081
50081
  function printGenerically(path7) {
50082
50082
  return comments_1.printComments(path7, function(path8) {
50083
- return genericPrint(path8, config30, {
50083
+ return genericPrint(path8, config34, {
50084
50084
  includeComments: true,
50085
50085
  avoidRootParens: false
50086
50086
  }, printGenerically);
50087
50087
  });
50088
50088
  }
50089
50089
  var path6 = fast_path_1.default.from(ast);
50090
- var oldReuseWhitespace = config30.reuseWhitespace;
50091
- config30.reuseWhitespace = false;
50092
- var pr = new PrintResult(printGenerically(path6).toString(config30));
50093
- config30.reuseWhitespace = oldReuseWhitespace;
50090
+ var oldReuseWhitespace = config34.reuseWhitespace;
50091
+ config34.reuseWhitespace = false;
50092
+ var pr = new PrintResult(printGenerically(path6).toString(config34));
50093
+ config34.reuseWhitespace = oldReuseWhitespace;
50094
50094
  return pr;
50095
50095
  };
50096
50096
  };
50097
50097
  exports2.Printer = Printer;
50098
- function genericPrint(path6, config30, options, printPath) {
50098
+ function genericPrint(path6, config34, options, printPath) {
50099
50099
  assert_1.default.ok(path6 instanceof fast_path_1.default);
50100
50100
  var node = path6.getValue();
50101
50101
  var parts = [];
50102
- var linesWithoutParens = genericPrintNoParens(path6, config30, printPath);
50102
+ var linesWithoutParens = genericPrintNoParens(path6, config34, printPath);
50103
50103
  if (!node || linesWithoutParens.isEmpty()) {
50104
50104
  return linesWithoutParens;
50105
50105
  }
@@ -69790,33 +69790,33 @@ var inputPrompt = async (promptConfig) => {
69790
69790
  }
69791
69791
  return input;
69792
69792
  };
69793
- var renderSubmit = (config30, value) => {
69794
- const { question, label } = config30;
69795
- if (config30.type !== "confirm" && !value) {
69793
+ var renderSubmit = (config34, value) => {
69794
+ const { question, label } = config34;
69795
+ if (config34.type !== "confirm" && !value) {
69796
69796
  return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
69797
69797
  }
69798
- const content = config30.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69798
+ const content = config34.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69799
69799
  return [`${leftT} ${question}`, content, `${grayBar}`];
69800
69800
  };
69801
- var getRenderers = (config30) => {
69802
- switch (config30.type) {
69801
+ var getRenderers = (config34) => {
69802
+ switch (config34.type) {
69803
69803
  case "select":
69804
- return getSelectRenderers(config30);
69804
+ return getSelectRenderers(config34);
69805
69805
  case "confirm":
69806
- return getConfirmRenderers(config30);
69806
+ return getConfirmRenderers(config34);
69807
69807
  case "text":
69808
- return getTextRenderers(config30);
69808
+ return getTextRenderers(config34);
69809
69809
  case "multiselect":
69810
- return getSelectRenderers(config30);
69810
+ return getSelectRenderers(config34);
69811
69811
  case "list":
69812
- return getSelectListRenderers(config30);
69812
+ return getSelectListRenderers(config34);
69813
69813
  }
69814
69814
  };
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() ?? "";
69815
+ var getTextRenderers = (config34) => {
69816
+ const { question } = config34;
69817
+ const helpText = config34.helpText ?? "";
69818
+ const format5 = config34.format ?? ((val) => String(val));
69819
+ const defaultValue = config34.defaultValue?.toString() ?? "";
69820
69820
  const activeRenderer = ({ value }) => [
69821
69821
  `${blCorner} ${bold(question)} ${dim(helpText)}`,
69822
69822
  `${space(2)}${format5(value || dim(defaultValue))}`,
@@ -69839,14 +69839,14 @@ var getTextRenderers = (config30) => {
69839
69839
  ``
69840
69840
  // extra line for readability
69841
69841
  ],
69842
- submit: ({ value }) => renderSubmit(config30, format5(value ?? "")),
69842
+ submit: ({ value }) => renderSubmit(config34, format5(value ?? "")),
69843
69843
  cancel: activeRenderer
69844
69844
  };
69845
69845
  };
69846
- var getSelectRenderers = (config30) => {
69847
- const { options, question, helpText: _helpText } = config30;
69846
+ var getSelectRenderers = (config34) => {
69847
+ const { options, question, helpText: _helpText } = config34;
69848
69848
  const helpText = _helpText ?? "";
69849
- const maxItemsPerPage = config30.maxItemsPerPage ?? 32;
69849
+ const maxItemsPerPage = config34.maxItemsPerPage ?? 32;
69850
69850
  const defaultRenderer = ({ cursor = 0, value }) => {
69851
69851
  const renderOption = (opt, i) => {
69852
69852
  const { label: optionLabel, value: optionValue } = opt;
@@ -69921,21 +69921,21 @@ ${space(2)}${dim("...")}` : ""}`,
69921
69921
  submit: ({ value }) => {
69922
69922
  if (Array.isArray(value)) {
69923
69923
  return renderSubmit(
69924
- config30,
69924
+ config34,
69925
69925
  options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
69926
69926
  );
69927
69927
  }
69928
69928
  return renderSubmit(
69929
- config30,
69929
+ config34,
69930
69930
  options.find((o) => o.value === value)?.label
69931
69931
  );
69932
69932
  },
69933
69933
  cancel: defaultRenderer
69934
69934
  };
69935
69935
  };
69936
- var getSelectListRenderers = (config30) => {
69937
- const { question, helpText: _helpText } = config30;
69938
- let options = config30.options;
69936
+ var getSelectListRenderers = (config34) => {
69937
+ const { question, helpText: _helpText } = config34;
69938
+ let options = config34.options;
69939
69939
  const helpText = _helpText ?? "";
69940
69940
  const { rows } = stdout;
69941
69941
  const defaultRenderer = ({ cursor, value }, prompt) => {
@@ -70016,20 +70016,20 @@ var getSelectListRenderers = (config30) => {
70016
70016
  submit: ({ value }) => {
70017
70017
  if (Array.isArray(value)) {
70018
70018
  return renderSubmit(
70019
- config30,
70019
+ config34,
70020
70020
  options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
70021
70021
  );
70022
70022
  }
70023
70023
  return renderSubmit(
70024
- config30,
70024
+ config34,
70025
70025
  options.find((o) => o.value === value)?.value
70026
70026
  );
70027
70027
  },
70028
70028
  cancel: defaultRenderer
70029
70029
  };
70030
70030
  };
70031
- var getConfirmRenderers = (config30) => {
70032
- const { activeText, inactiveText, question, helpText: _helpText } = config30;
70031
+ var getConfirmRenderers = (config34) => {
70032
+ const { activeText, inactiveText, question, helpText: _helpText } = config34;
70033
70033
  const helpText = _helpText ?? "";
70034
70034
  const active = activeText || "Yes";
70035
70035
  const inactive = inactiveText || "No";
@@ -70046,7 +70046,7 @@ var getConfirmRenderers = (config30) => {
70046
70046
  active: defaultRenderer,
70047
70047
  confirm: defaultRenderer,
70048
70048
  error: defaultRenderer,
70049
- submit: ({ value }) => renderSubmit(config30, value ? "yes" : "no"),
70049
+ submit: ({ value }) => renderSubmit(config34, value ? "yes" : "no"),
70050
70050
  cancel: defaultRenderer
70051
70051
  };
70052
70052
  };
@@ -71016,23 +71016,23 @@ var YargsParser = class {
71016
71016
  const configPath = argv2[configKey] || configLookup[configKey];
71017
71017
  if (configPath) {
71018
71018
  try {
71019
- let config30 = null;
71019
+ let config34 = null;
71020
71020
  const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
71021
71021
  const resolveConfig = flags.configs[configKey];
71022
71022
  if (typeof resolveConfig === "function") {
71023
71023
  try {
71024
- config30 = resolveConfig(resolvedConfigPath);
71024
+ config34 = resolveConfig(resolvedConfigPath);
71025
71025
  } catch (e) {
71026
- config30 = e;
71026
+ config34 = e;
71027
71027
  }
71028
- if (config30 instanceof Error) {
71029
- error2 = config30;
71028
+ if (config34 instanceof Error) {
71029
+ error2 = config34;
71030
71030
  return;
71031
71031
  }
71032
71032
  } else {
71033
- config30 = mixin2.require(resolvedConfigPath);
71033
+ config34 = mixin2.require(resolvedConfigPath);
71034
71034
  }
71035
- setConfigObject(config30);
71035
+ setConfigObject(config34);
71036
71036
  } catch (ex) {
71037
71037
  if (ex.name === "PermissionDenied")
71038
71038
  error2 = ex;
@@ -71042,9 +71042,9 @@ var YargsParser = class {
71042
71042
  }
71043
71043
  });
71044
71044
  }
71045
- function setConfigObject(config30, prev) {
71046
- Object.keys(config30).forEach(function(key) {
71047
- const value = config30[key];
71045
+ function setConfigObject(config34, prev) {
71046
+ Object.keys(config34).forEach(function(key) {
71047
+ const value = config34[key];
71048
71048
  const fullKey = prev ? prev + "." + key : key;
71049
71049
  if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
71050
71050
  setConfigObject(value, fullKey);
@@ -72196,11 +72196,11 @@ var CommandInstance = class {
72196
72196
  });
72197
72197
  if (!unparsed.length)
72198
72198
  return;
72199
- const config30 = Object.assign({}, options.configuration, {
72199
+ const config34 = Object.assign({}, options.configuration, {
72200
72200
  "populate--": false
72201
72201
  });
72202
72202
  const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
72203
- configuration: config30
72203
+ configuration: config34
72204
72204
  }));
72205
72205
  if (parsed.error) {
72206
72206
  yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
@@ -73423,31 +73423,31 @@ ${customMsgs.join("\n")}` : "";
73423
73423
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
73424
73424
  var previouslyVisitedConfigs = [];
73425
73425
  var shim2;
73426
- function applyExtends(config30, cwd, mergeExtends, _shim) {
73426
+ function applyExtends(config34, cwd, mergeExtends, _shim) {
73427
73427
  shim2 = _shim;
73428
73428
  let defaultConfig = {};
73429
- if (Object.prototype.hasOwnProperty.call(config30, "extends")) {
73430
- if (typeof config30.extends !== "string")
73429
+ if (Object.prototype.hasOwnProperty.call(config34, "extends")) {
73430
+ if (typeof config34.extends !== "string")
73431
73431
  return defaultConfig;
73432
- const isPath = /\.json|\..*rc$/.test(config30.extends);
73432
+ const isPath = /\.json|\..*rc$/.test(config34.extends);
73433
73433
  let pathToDefault = null;
73434
73434
  if (!isPath) {
73435
73435
  try {
73436
- pathToDefault = require.resolve(config30.extends);
73436
+ pathToDefault = require.resolve(config34.extends);
73437
73437
  } catch (_err) {
73438
- return config30;
73438
+ return config34;
73439
73439
  }
73440
73440
  } else {
73441
- pathToDefault = getPathToDefaultConfig(cwd, config30.extends);
73441
+ pathToDefault = getPathToDefaultConfig(cwd, config34.extends);
73442
73442
  }
73443
73443
  checkForCircularExtends(pathToDefault);
73444
73444
  previouslyVisitedConfigs.push(pathToDefault);
73445
- defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config30.extends);
73446
- delete config30.extends;
73445
+ defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config34.extends);
73446
+ delete config34.extends;
73447
73447
  defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
73448
73448
  }
73449
73449
  previouslyVisitedConfigs = [];
73450
- return mergeExtends ? mergeDeep(defaultConfig, config30) : Object.assign({}, defaultConfig, config30);
73450
+ return mergeExtends ? mergeDeep(defaultConfig, config34) : Object.assign({}, defaultConfig, config34);
73451
73451
  }
73452
73452
  function checkForCircularExtends(cfgPath) {
73453
73453
  if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
@@ -74228,9 +74228,9 @@ var YargsInstance = class {
74228
74228
  }
74229
74229
  return maybePromise;
74230
74230
  }
74231
- parserConfiguration(config30) {
74232
- argsert("<object>", [config30], arguments.length);
74233
- __classPrivateFieldSet(this, _YargsInstance_parserConfig, config30, "f");
74231
+ parserConfiguration(config34) {
74232
+ argsert("<object>", [config34], arguments.length);
74233
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config34, "f");
74234
74234
  return this;
74235
74235
  }
74236
74236
  pkgConf(key, rootPath) {
@@ -74402,9 +74402,9 @@ var YargsInstance = class {
74402
74402
  return this;
74403
74403
  }
74404
74404
  }
74405
- usageConfiguration(config30) {
74406
- argsert("<object>", [config30], arguments.length);
74407
- __classPrivateFieldSet(this, _YargsInstance_usageConfig, config30, "f");
74405
+ usageConfiguration(config34) {
74406
+ argsert("<object>", [config34], arguments.length);
74407
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config34, "f");
74408
74408
  return this;
74409
74409
  }
74410
74410
  version(opt, msg, ver) {
@@ -74810,11 +74810,11 @@ var YargsInstance = class {
74810
74810
  __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
74811
74811
  __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
74812
74812
  const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
74813
- const config30 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74813
+ const config34 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74814
74814
  "populate--": true
74815
74815
  });
74816
74816
  const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
74817
- configuration: { "parse-positional-numbers": false, ...config30 }
74817
+ configuration: { "parse-positional-numbers": false, ...config34 }
74818
74818
  }));
74819
74819
  const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
74820
74820
  let argvPromise = void 0;
@@ -74977,7 +74977,7 @@ var Yargs = YargsFactory(esm_default);
74977
74977
  var yargs_default = Yargs;
74978
74978
 
74979
74979
  // package.json
74980
- var version = "2.40.3";
74980
+ var version = "2.41.0";
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(config30) {
75024
+ function writeMetricsConfig(config34) {
75025
75025
  (0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
75026
75026
  (0, import_node_fs2.writeFileSync)(
75027
75027
  getMetricsConfigPath(),
75028
75028
  JSON.stringify(
75029
- config30,
75029
+ config34,
75030
75030
  (_key, value) => value instanceof Date ? value.toISOString() : value,
75031
75031
  " "
75032
75032
  )
@@ -75034,9 +75034,9 @@ function writeMetricsConfig(config30) {
75034
75034
  }
75035
75035
  function readMetricsConfig() {
75036
75036
  try {
75037
- const config30 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
75037
+ const config34 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
75038
75038
  return JSON.parse(
75039
- config30,
75039
+ config34,
75040
75040
  (key, value) => key === "date" ? new Date(value) : value
75041
75041
  );
75042
75042
  } catch {
@@ -75046,10 +75046,10 @@ function readMetricsConfig() {
75046
75046
  function getMetricsConfigPath() {
75047
75047
  return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
75048
75048
  }
75049
- function getDeviceId(config30) {
75050
- const deviceId = config30.deviceId ?? (0, import_node_crypto.randomUUID)();
75051
- if (config30.deviceId === void 0) {
75052
- writeMetricsConfig({ ...config30, deviceId });
75049
+ function getDeviceId(config34) {
75050
+ const deviceId = config34.deviceId ?? (0, import_node_crypto.randomUUID)();
75051
+ if (config34.deviceId === void 0) {
75052
+ writeMetricsConfig({ ...config34, deviceId });
75053
75053
  }
75054
75054
  return deviceId;
75055
75055
  }
@@ -75324,10 +75324,10 @@ function getPlatform() {
75324
75324
  function createReporter() {
75325
75325
  const events = [];
75326
75326
  const als = new import_node_async_hooks.AsyncLocalStorage();
75327
- const config30 = readMetricsConfig() ?? {};
75328
- const isFirstUsage = config30.c3permission === void 0;
75327
+ const config34 = readMetricsConfig() ?? {};
75328
+ const isFirstUsage = config34.c3permission === void 0;
75329
75329
  const isEnabled = isTelemetryEnabled();
75330
- const deviceId = getDeviceId(config30);
75330
+ const deviceId = getDeviceId(config34);
75331
75331
  const packageManager = detectPackageManager();
75332
75332
  const platform3 = getPlatform();
75333
75333
  const amplitude_session_id = Date.now();
@@ -75360,7 +75360,7 @@ function createReporter() {
75360
75360
  if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
75361
75361
  return false;
75362
75362
  }
75363
- return hasSparrowSourceKey() && getC3Permission(config30).enabled;
75363
+ return hasSparrowSourceKey() && getC3Permission(config34).enabled;
75364
75364
  }
75365
75365
  async function waitForAllEventsSettled() {
75366
75366
  await Promise.allSettled(events);
@@ -75466,20 +75466,20 @@ function initializeC3Permission(enabled = true) {
75466
75466
  date: /* @__PURE__ */ new Date()
75467
75467
  };
75468
75468
  }
75469
- function getC3Permission(config30 = readMetricsConfig() ?? {}) {
75470
- if (!config30.c3permission) {
75471
- config30.c3permission = initializeC3Permission();
75472
- writeMetricsConfig(config30);
75469
+ function getC3Permission(config34 = readMetricsConfig() ?? {}) {
75470
+ if (!config34.c3permission) {
75471
+ config34.c3permission = initializeC3Permission();
75472
+ writeMetricsConfig(config34);
75473
75473
  }
75474
- return config30.c3permission;
75474
+ return config34.c3permission;
75475
75475
  }
75476
75476
  function updateC3Pemission(enabled) {
75477
- const config30 = readMetricsConfig();
75478
- if (config30.c3permission?.enabled === enabled) {
75477
+ const config34 = readMetricsConfig();
75478
+ if (config34.c3permission?.enabled === enabled) {
75479
75479
  return;
75480
75480
  }
75481
- config30.c3permission = initializeC3Permission(enabled);
75482
- writeMetricsConfig(config30);
75481
+ config34.c3permission = initializeC3Permission(enabled);
75482
+ writeMetricsConfig(config34);
75483
75483
  }
75484
75484
  var runTelemetryCommand = (action) => {
75485
75485
  const logTelemetryStatus = (enabled) => {
@@ -75524,28 +75524,28 @@ var import_haikunator = __toESM(require_dist_web());
75524
75524
  var import_fs6 = require("fs");
75525
75525
  var import_path6 = __toESM(require("path"));
75526
75526
  var import_undici2 = __toESM(require_undici());
75527
- var installPackages = async (packages, config30 = {}) => {
75527
+ var installPackages = async (packages, config34 = {}) => {
75528
75528
  const { npm: npm24 } = detectPackageManager();
75529
75529
  let saveFlag;
75530
75530
  let cmd;
75531
75531
  switch (npm24) {
75532
75532
  case "yarn":
75533
75533
  cmd = "add";
75534
- saveFlag = config30.dev ? "-D" : "";
75534
+ saveFlag = config34.dev ? "-D" : "";
75535
75535
  break;
75536
75536
  case "bun":
75537
75537
  cmd = "add";
75538
- saveFlag = config30.dev ? "-d" : "";
75538
+ saveFlag = config34.dev ? "-d" : "";
75539
75539
  break;
75540
75540
  case "npm":
75541
75541
  case "pnpm":
75542
75542
  default:
75543
75543
  cmd = "install";
75544
- saveFlag = config30.dev ? "--save-dev" : "";
75544
+ saveFlag = config34.dev ? "--save-dev" : "";
75545
75545
  break;
75546
75546
  }
75547
75547
  await runCommand([npm24, cmd, ...saveFlag ? [saveFlag] : [], ...packages], {
75548
- ...config30,
75548
+ ...config34,
75549
75549
  silent: true
75550
75550
  });
75551
75551
  };
@@ -75726,9 +75726,6 @@ var usesEslint = (ctx) => {
75726
75726
  return { used: false };
75727
75727
  };
75728
75728
 
75729
- // templates-experimental/angular/c3.ts
75730
- var import_node_path3 = require("node:path");
75731
-
75732
75729
  // src/frameworks/package.json
75733
75730
  var package_default = {
75734
75731
  name: "frameworks_clis_info",
@@ -75780,91 +75777,6 @@ var runFrameworkGenerator = async (ctx, args) => {
75780
75777
  await runCommand(cmd, { env: env3 });
75781
75778
  };
75782
75779
 
75783
- // templates-experimental/angular/c3.ts
75784
- var { npm } = detectPackageManager();
75785
- var generate = async (ctx) => {
75786
- await runFrameworkGenerator(ctx, [
75787
- ctx.project.name,
75788
- "--ssr",
75789
- "--server-routing"
75790
- ]);
75791
- logRaw("");
75792
- };
75793
- var configure = async (ctx) => {
75794
- updateAngularJson(ctx);
75795
- await updateAppCode();
75796
- await installCFWorker();
75797
- };
75798
- async function installCFWorker() {
75799
- await installPackages(["xhr2"], {
75800
- dev: true,
75801
- startText: "Installing additional dependencies",
75802
- doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
75803
- });
75804
- }
75805
- async function updateAppCode() {
75806
- const s = spinner();
75807
- s.start(`Updating application code`);
75808
- const appConfigPath = "src/app/app.config.ts";
75809
- const appConfig = readFile((0, import_node_path3.resolve)(appConfigPath));
75810
- const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
75811
- "providers: [",
75812
- "providers: [provideHttpClient(withFetch()), "
75813
- );
75814
- writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
75815
- s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
75816
- const appServerRoutesPath = "src/app/app.routes.server.ts";
75817
- const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
75818
- const newAppRoutes = appRoutes.replace(
75819
- "RenderMode.Prerender",
75820
- "RenderMode.Server"
75821
- );
75822
- writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
75823
- s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
75824
- s.start(`Updating package.json`);
75825
- const packageJsonPath = (0, import_node_path3.resolve)("package.json");
75826
- const packageManifest = readJSON(packageJsonPath);
75827
- delete packageManifest["dependencies"]?.["express"];
75828
- delete packageManifest["devDependencies"]?.["@types/express"];
75829
- writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
75830
- s.stop(`${brandColor(`updated`)} ${dim(`\`package.json\``)}`);
75831
- }
75832
- function updateAngularJson(ctx) {
75833
- const s = spinner();
75834
- s.start(`Updating angular.json config`);
75835
- const angularJson = readJSON((0, import_node_path3.resolve)("angular.json"));
75836
- const architectSection = angularJson.projects[ctx.project.name].architect;
75837
- architectSection.build.options.outputPath = "dist";
75838
- architectSection.build.options.outputMode = "server";
75839
- architectSection.build.options.ssr.experimentalPlatform = "neutral";
75840
- writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
75841
- s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
75842
- }
75843
- var config = {
75844
- configVersion: 1,
75845
- id: "angular",
75846
- frameworkCli: "@angular/create",
75847
- displayName: "Angular",
75848
- platform: "workers",
75849
- copyFiles: {
75850
- path: "./templates"
75851
- },
75852
- path: "templates-experimental/angular",
75853
- devScript: "start",
75854
- deployScript: "deploy",
75855
- previewScript: "start",
75856
- generate,
75857
- configure,
75858
- transformPackageJson: async () => ({
75859
- scripts: {
75860
- start: `${npm} run build && wrangler dev`,
75861
- build: `ng build`,
75862
- deploy: `${npm} run build && wrangler deploy`
75863
- }
75864
- })
75865
- };
75866
- var c3_default = config;
75867
-
75868
75780
  // src/helpers/codemod.ts
75869
75781
  var import_fs8 = require("fs");
75870
75782
  var import_path8 = __toESM(require("path"));
@@ -75943,11 +75855,11 @@ var getPropertyName = (newProp) => {
75943
75855
  // templates-experimental/astro/c3.ts
75944
75856
  var recast2 = __toESM(require_main3());
75945
75857
  var { npx } = detectPackageManager();
75946
- var generate2 = async (ctx) => {
75858
+ var generate = async (ctx) => {
75947
75859
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
75948
75860
  logRaw("");
75949
75861
  };
75950
- var configure2 = async () => {
75862
+ var configure = async () => {
75951
75863
  await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
75952
75864
  silent: true,
75953
75865
  startText: "Installing adapter",
@@ -75981,7 +75893,7 @@ var updateAstroConfig = () => {
75981
75893
  }
75982
75894
  });
75983
75895
  };
75984
- var config2 = {
75896
+ var config = {
75985
75897
  configVersion: 1,
75986
75898
  id: "astro",
75987
75899
  frameworkCli: "create-astro",
@@ -76004,8 +75916,8 @@ var config2 = {
76004
75916
  deployScript: "deploy",
76005
75917
  previewScript: "preview",
76006
75918
  path: "templates-experimental/astro",
76007
- generate: generate2,
76008
- configure: configure2,
75919
+ generate,
75920
+ configure,
76009
75921
  transformPackageJson: async (pkgJson, ctx) => ({
76010
75922
  scripts: {
76011
75923
  deploy: `astro build && wrangler deploy`,
@@ -76014,54 +75926,10 @@ var config2 = {
76014
75926
  }
76015
75927
  })
76016
75928
  };
76017
- var c3_default2 = config2;
76018
-
76019
- // templates-experimental/gatsby/c3.ts
76020
- var { npm: npm2 } = detectPackageManager();
76021
- var generate3 = async (ctx) => {
76022
- const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76023
- const useTemplate = await inputPrompt({
76024
- type: "confirm",
76025
- question: "Would you like to use a template?",
76026
- label: "template",
76027
- defaultValue: true
76028
- });
76029
- let templateUrl = "";
76030
- if (useTemplate) {
76031
- templateUrl = await inputPrompt({
76032
- type: "text",
76033
- question: `Please specify the url of the template you'd like to use`,
76034
- label: "template",
76035
- defaultValue: defaultTemplate
76036
- });
76037
- }
76038
- await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76039
- };
76040
- var config3 = {
76041
- configVersion: 1,
76042
- id: "gatsby",
76043
- frameworkCli: "gatsby",
76044
- platform: "workers",
76045
- displayName: "Gatsby",
76046
- copyFiles: {
76047
- path: "./templates"
76048
- },
76049
- path: "templates-experimental/gatsby",
76050
- generate: generate3,
76051
- transformPackageJson: async () => ({
76052
- scripts: {
76053
- deploy: `${npm2} run build && wrangler deploy`,
76054
- preview: `${npm2} run build && wrangler dev`
76055
- }
76056
- }),
76057
- devScript: "develop",
76058
- deployScript: "deploy",
76059
- previewScript: "preview"
76060
- };
76061
- var c3_default3 = config3;
75929
+ var c3_default = config;
76062
75930
 
76063
75931
  // templates-experimental/hello-world-assets-only/c3.ts
76064
- var config4 = {
75932
+ var config2 = {
76065
75933
  configVersion: 1,
76066
75934
  id: "hello-world-assets-only",
76067
75935
  path: "templates-experimental/hello-world-assets-only",
@@ -76072,10 +75940,10 @@ var config4 = {
76072
75940
  path: "./templates"
76073
75941
  }
76074
75942
  };
76075
- var c3_default4 = config4;
75943
+ var c3_default2 = config2;
76076
75944
 
76077
75945
  // templates-experimental/hello-world-durable-object-with-assets/c3.ts
76078
- var config5 = {
75946
+ var config3 = {
76079
75947
  configVersion: 1,
76080
75948
  id: "hello-world-durable-object-with-assets",
76081
75949
  path: "templates-experimental/hello-world-durable-object-with-assets",
@@ -76093,10 +75961,10 @@ var config5 = {
76093
75961
  }
76094
75962
  }
76095
75963
  };
76096
- var c3_default5 = config5;
75964
+ var c3_default3 = config3;
76097
75965
 
76098
75966
  // templates-experimental/hello-world-with-assets/c3.ts
76099
- var c3_default6 = {
75967
+ var c3_default4 = {
76100
75968
  configVersion: 1,
76101
75969
  id: "hello-world-with-assets",
76102
75970
  path: "templates-experimental/hello-world-with-assets",
@@ -76119,7 +75987,7 @@ var c3_default6 = {
76119
75987
  };
76120
75988
 
76121
75989
  // templates-experimental/hono/c3.ts
76122
- var generate4 = async (ctx) => {
75990
+ var generate2 = async (ctx) => {
76123
75991
  const { name: pm4 } = detectPackageManager();
76124
75992
  await runFrameworkGenerator(ctx, [
76125
75993
  ctx.project.name,
@@ -76131,7 +75999,7 @@ var generate4 = async (ctx) => {
76131
75999
  ]);
76132
76000
  logRaw("");
76133
76001
  };
76134
- var config6 = {
76002
+ var config4 = {
76135
76003
  configVersion: 1,
76136
76004
  id: "hono",
76137
76005
  frameworkCli: "create-hono",
@@ -76141,7 +76009,7 @@ var config6 = {
76141
76009
  },
76142
76010
  platform: "workers",
76143
76011
  path: "templates-experimental/hono",
76144
- generate: generate4,
76012
+ generate: generate2,
76145
76013
  transformPackageJson: async () => ({
76146
76014
  scripts: {
76147
76015
  dev: "wrangler dev",
@@ -76153,13 +76021,13 @@ var config6 = {
76153
76021
  deployScript: "deploy",
76154
76022
  previewScript: "dev"
76155
76023
  };
76156
- var c3_default7 = config6;
76024
+ var c3_default5 = config4;
76157
76025
 
76158
76026
  // templates-experimental/next/c3.ts
76159
- var generate5 = async (ctx) => {
76027
+ var generate3 = async (ctx) => {
76160
76028
  await runFrameworkGenerator(ctx, [ctx.project.name]);
76161
76029
  };
76162
- var configure3 = async () => {
76030
+ var configure2 = async () => {
76163
76031
  const packages = [
76164
76032
  "@opennextjs/cloudflare@0.5.x",
76165
76033
  "@cloudflare/workers-types"
@@ -76184,7 +76052,7 @@ var updateNextConfig = () => {
76184
76052
  writeFile2(configFile, updatedConfigFile);
76185
76053
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76186
76054
  };
76187
- var c3_default8 = {
76055
+ var c3_default6 = {
76188
76056
  configVersion: 1,
76189
76057
  id: "next",
76190
76058
  frameworkCli: "create-next-app",
@@ -76198,8 +76066,8 @@ var c3_default8 = {
76198
76066
  copyFiles: {
76199
76067
  path: "./templates"
76200
76068
  },
76201
- generate: generate5,
76202
- configure: configure3,
76069
+ generate: generate3,
76070
+ configure: configure2,
76203
76071
  transformPackageJson: async () => ({
76204
76072
  scripts: {
76205
76073
  deploy: `opennextjs-cloudflare && wrangler deploy`,
@@ -76213,165 +76081,14 @@ var c3_default8 = {
76213
76081
  compatibilityFlags: ["nodejs_compat"]
76214
76082
  };
76215
76083
 
76216
- // src/helpers/compatDate.ts
76217
- var import_fs9 = require("fs");
76218
- var import_path9 = require("path");
76219
- async function getWorkerdCompatibilityDate() {
76220
- const s = spinner();
76221
- s.start("Retrieving current workerd compatibility date");
76222
- try {
76223
- const latestWorkerdVersion = await getLatestPackageVersion("workerd");
76224
- const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
76225
- if (match) {
76226
- const [, year, month, date] = match;
76227
- let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
76228
- if (compatDate.getTime() > Date.now()) {
76229
- compatDate = new Date(Date.now());
76230
- }
76231
- const compatDateString = compatDate.toISOString().slice(0, 10);
76232
- s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
76233
- return compatDateString;
76234
- }
76235
- } catch {
76236
- }
76237
- const fallbackDate = "2024-11-11";
76238
- s.stop(
76239
- `${brandColor("compatibility date")} ${dim(
76240
- ` Could not find workerd date, falling back to ${fallbackDate}`
76241
- )}`
76242
- );
76243
- return fallbackDate;
76244
- }
76245
- var compatDateFlag = async () => {
76246
- const workerdCompatDate = await getWorkerdCompatibilityDate();
76247
- return `--compatibility-date=${workerdCompatDate}`;
76248
- };
76249
- function getLatestTypesEntrypoint(ctx) {
76250
- const workersTypesPath = (0, import_path9.resolve)(
76251
- ctx.project.path,
76252
- "node_modules",
76253
- "@cloudflare",
76254
- "workers-types"
76255
- );
76256
- try {
76257
- const entrypoints = (0, import_fs9.readdirSync)(workersTypesPath);
76258
- const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
76259
- if (sorted.length === 0) {
76260
- return null;
76261
- }
76262
- return sorted[0];
76263
- } catch (error2) {
76264
- return null;
76265
- }
76266
- }
76267
-
76268
- // templates-experimental/nuxt/c3.ts
76269
- var recast3 = __toESM(require_main3());
76270
- var { npm: npm3, name: pm } = detectPackageManager();
76271
- var generate6 = async (ctx) => {
76272
- const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76273
- await runFrameworkGenerator(ctx, [
76274
- "init",
76275
- ctx.project.name,
76276
- "--packageManager",
76277
- npm3,
76278
- gitFlag
76279
- ]);
76280
- writeFile2("./.node-version", "18");
76281
- logRaw("");
76282
- };
76283
- var configure4 = async (ctx) => {
76284
- const packages = ["nitro-cloudflare-dev", "nitropack"];
76285
- if (pm === "pnpm") {
76286
- packages.push("h3");
76287
- }
76288
- await installPackages(packages, {
76289
- dev: true,
76290
- startText: "Installing nitro module `nitro-cloudflare-dev`",
76291
- doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
76292
- });
76293
- updateNuxtConfig();
76294
- updateEnvTypes(ctx);
76295
- };
76296
- var updateEnvTypes = (ctx) => {
76297
- const filepath = "env.d.ts";
76298
- const s = spinner();
76299
- s.start(`Updating ${filepath}`);
76300
- let file = readFile(filepath);
76301
- let typesEntrypoint = `@cloudflare/workers-types`;
76302
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
76303
- if (latestEntrypoint) {
76304
- typesEntrypoint += `/${latestEntrypoint}`;
76305
- }
76306
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
76307
- writeFile2("env.d.ts", file);
76308
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76309
- };
76310
- var updateNuxtConfig = () => {
76311
- const s = spinner();
76312
- const configFile = "nuxt.config.ts";
76313
- s.start(`Updating \`${configFile}\``);
76314
- const b3 = recast3.types.builders;
76315
- const presetDef = b3.objectProperty(
76316
- b3.identifier("nitro"),
76317
- b3.objectExpression([
76318
- b3.objectProperty(
76319
- b3.identifier("preset"),
76320
- b3.stringLiteral("cloudflare_module")
76321
- )
76322
- ])
76323
- );
76324
- const moduleDef = b3.objectProperty(
76325
- b3.identifier("modules"),
76326
- b3.arrayExpression([b3.stringLiteral("nitro-cloudflare-dev")])
76327
- );
76328
- transformFile(configFile, {
76329
- visitCallExpression: function(n) {
76330
- const callee = n.node.callee;
76331
- if (callee.name === "defineNuxtConfig") {
76332
- mergeObjectProperties(
76333
- n.node.arguments[0],
76334
- [presetDef, moduleDef]
76335
- );
76336
- }
76337
- return this.traverse(n);
76338
- }
76339
- });
76340
- s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76341
- };
76342
- var config7 = {
76343
- configVersion: 1,
76344
- id: "nuxt",
76345
- frameworkCli: "nuxi",
76346
- platform: "workers",
76347
- displayName: "Nuxt",
76348
- copyFiles: {
76349
- path: "./templates"
76350
- },
76351
- path: "templates-experimental/nuxt",
76352
- generate: generate6,
76353
- configure: configure4,
76354
- transformPackageJson: async () => ({
76355
- scripts: {
76356
- deploy: `${npm3} run build && wrangler deploy`,
76357
- preview: `${npm3} run build && wrangler dev`,
76358
- "cf-typegen": `wrangler types`
76359
- }
76360
- }),
76361
- devScript: "dev",
76362
- deployScript: "deploy",
76363
- previewScript: "preview"
76364
- };
76365
- var c3_default9 = config7;
76366
-
76367
76084
  // templates-experimental/qwik/c3.ts
76368
- var recast4 = __toESM(require_main3());
76369
- var { npm: npm4, npx: npx2, name } = detectPackageManager();
76370
- var generate7 = async (ctx) => {
76085
+ var recast3 = __toESM(require_main3());
76086
+ var { npm, npx: npx2, name } = detectPackageManager();
76087
+ var generate4 = async (ctx) => {
76371
76088
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
76372
76089
  };
76373
- var configure5 = async (ctx) => {
76374
- const cmd = [name === "pnpm" ? npm4 : npx2, "qwik", "add", "cloudflare-pages"];
76090
+ var configure3 = async (ctx) => {
76091
+ const cmd = [name === "pnpm" ? npm : npx2, "qwik", "add", "cloudflare-pages"];
76375
76092
  endSection(`Running ${quoteShellArgs(cmd)}`);
76376
76093
  await runCommand(cmd);
76377
76094
  removeFile("./public/_headers");
@@ -76387,7 +76104,7 @@ var addBindingsProxy = (ctx) => {
76387
76104
  const s = spinner();
76388
76105
  s.start("Updating `vite.config.ts`");
76389
76106
  const snippets = loadTemplateSnippets(ctx);
76390
- const b3 = recast4.types.builders;
76107
+ const b3 = recast3.types.builders;
76391
76108
  transformFile("vite.config.ts", {
76392
76109
  // Insert the env declaration after the last import (but before the rest of the body)
76393
76110
  visitProgram: function(n) {
@@ -76429,7 +76146,7 @@ var populateCloudflareEnv = () => {
76429
76146
  s.start(`Updating \`${entrypointPath}\``);
76430
76147
  transformFile(entrypointPath, {
76431
76148
  visitTSInterfaceDeclaration: function(n) {
76432
- const b3 = recast4.types.builders;
76149
+ const b3 = recast3.types.builders;
76433
76150
  const id = n.node.id;
76434
76151
  if (id.name !== "QwikCityPlatform") {
76435
76152
  this.traverse(n);
@@ -76450,7 +76167,7 @@ var populateCloudflareEnv = () => {
76450
76167
  });
76451
76168
  s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
76452
76169
  };
76453
- var config8 = {
76170
+ var config5 = {
76454
76171
  configVersion: 1,
76455
76172
  id: "qwik",
76456
76173
  frameworkCli: "create-qwik",
@@ -76460,12 +76177,12 @@ var config8 = {
76460
76177
  path: "./templates"
76461
76178
  },
76462
76179
  path: "templates-experimental/qwik",
76463
- generate: generate7,
76464
- configure: configure5,
76180
+ generate: generate4,
76181
+ configure: configure3,
76465
76182
  transformPackageJson: async () => ({
76466
76183
  scripts: {
76467
- deploy: `${npm4} run build && wrangler deploy`,
76468
- preview: `${npm4} run build && wrangler dev`,
76184
+ deploy: `${npm} run build && wrangler deploy`,
76185
+ preview: `${npm} run build && wrangler dev`,
76469
76186
  "cf-typegen": `wrangler types`
76470
76187
  }
76471
76188
  }),
@@ -76473,11 +76190,11 @@ var config8 = {
76473
76190
  deployScript: "deploy",
76474
76191
  previewScript: "preview"
76475
76192
  };
76476
- var c3_default10 = config8;
76193
+ var c3_default7 = config5;
76477
76194
 
76478
76195
  // templates-experimental/remix/c3.ts
76479
- var { npm: npm5 } = detectPackageManager();
76480
- var generate8 = async (ctx) => {
76196
+ var { npm: npm2 } = detectPackageManager();
76197
+ var generate5 = async (ctx) => {
76481
76198
  await runFrameworkGenerator(ctx, [
76482
76199
  ctx.project.name,
76483
76200
  "--template",
@@ -76485,14 +76202,14 @@ var generate8 = async (ctx) => {
76485
76202
  ]);
76486
76203
  logRaw("");
76487
76204
  };
76488
- var configure6 = async () => {
76205
+ var configure4 = async () => {
76489
76206
  await installPackages(["wrangler@latest"], {
76490
76207
  dev: true,
76491
76208
  startText: "Updating the Wrangler version",
76492
76209
  doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
76493
76210
  });
76494
76211
  };
76495
- var config9 = {
76212
+ var config6 = {
76496
76213
  configVersion: 1,
76497
76214
  id: "remix",
76498
76215
  frameworkCli: "create-remix",
@@ -76502,12 +76219,12 @@ var config9 = {
76502
76219
  path: "./templates"
76503
76220
  },
76504
76221
  path: "templates-experimental/remix",
76505
- generate: generate8,
76506
- configure: configure6,
76222
+ generate: generate5,
76223
+ configure: configure4,
76507
76224
  transformPackageJson: async () => ({
76508
76225
  scripts: {
76509
- deploy: `${npm5} run build && wrangler deploy`,
76510
- preview: `${npm5} run build && wrangler dev`,
76226
+ deploy: `${npm2} run build && wrangler deploy`,
76227
+ preview: `${npm2} run build && wrangler dev`,
76511
76228
  "cf-typegen": `wrangler types`
76512
76229
  }
76513
76230
  }),
@@ -76515,21 +76232,73 @@ var config9 = {
76515
76232
  deployScript: "deploy",
76516
76233
  previewScript: "preview"
76517
76234
  };
76518
- var c3_default11 = config9;
76235
+ var c3_default8 = config6;
76236
+
76237
+ // src/helpers/compatDate.ts
76238
+ var import_fs9 = require("fs");
76239
+ var import_path9 = require("path");
76240
+ async function getWorkerdCompatibilityDate() {
76241
+ const s = spinner();
76242
+ s.start("Retrieving current workerd compatibility date");
76243
+ try {
76244
+ const latestWorkerdVersion = await getLatestPackageVersion("workerd");
76245
+ const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
76246
+ if (match) {
76247
+ const [, year, month, date] = match;
76248
+ let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
76249
+ if (compatDate.getTime() > Date.now()) {
76250
+ compatDate = new Date(Date.now());
76251
+ }
76252
+ const compatDateString = compatDate.toISOString().slice(0, 10);
76253
+ s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
76254
+ return compatDateString;
76255
+ }
76256
+ } catch {
76257
+ }
76258
+ const fallbackDate = "2024-11-11";
76259
+ s.stop(
76260
+ `${brandColor("compatibility date")} ${dim(
76261
+ ` Could not find workerd date, falling back to ${fallbackDate}`
76262
+ )}`
76263
+ );
76264
+ return fallbackDate;
76265
+ }
76266
+ var compatDateFlag = async () => {
76267
+ const workerdCompatDate = await getWorkerdCompatibilityDate();
76268
+ return `--compatibility-date=${workerdCompatDate}`;
76269
+ };
76270
+ function getLatestTypesEntrypoint(ctx) {
76271
+ const workersTypesPath = (0, import_path9.resolve)(
76272
+ ctx.project.path,
76273
+ "node_modules",
76274
+ "@cloudflare",
76275
+ "workers-types"
76276
+ );
76277
+ try {
76278
+ const entrypoints = (0, import_fs9.readdirSync)(workersTypesPath);
76279
+ const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
76280
+ if (sorted.length === 0) {
76281
+ return null;
76282
+ }
76283
+ return sorted[0];
76284
+ } catch (error2) {
76285
+ return null;
76286
+ }
76287
+ }
76519
76288
 
76520
76289
  // templates-experimental/solid/c3.ts
76521
- var recast5 = __toESM(require_main3());
76522
- var { npm: npm6 } = detectPackageManager();
76523
- var generate9 = async (ctx) => {
76290
+ var recast4 = __toESM(require_main3());
76291
+ var { npm: npm3 } = detectPackageManager();
76292
+ var generate6 = async (ctx) => {
76524
76293
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
76525
76294
  logRaw("");
76526
76295
  };
76527
- var configure7 = async (ctx) => {
76296
+ var configure5 = async (ctx) => {
76528
76297
  const packages = ["nitropack"];
76529
76298
  await installPackages(packages, {
76530
76299
  dev: true,
76531
76300
  startText: "Installing nitro module `nitropack`",
76532
- doneText: `${brandColor("installed")} ${dim(`via \`${npm6} install\``)}`
76301
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
76533
76302
  });
76534
76303
  usesTypescript(ctx);
76535
76304
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
@@ -76541,7 +76310,7 @@ var configure7 = async (ctx) => {
76541
76310
  if (callee.name !== "defineConfig") {
76542
76311
  return this.traverse(n);
76543
76312
  }
76544
- const b3 = recast5.types.builders;
76313
+ const b3 = recast4.types.builders;
76545
76314
  mergeObjectProperties(
76546
76315
  n.node.arguments[0],
76547
76316
  [
@@ -76565,7 +76334,7 @@ var configure7 = async (ctx) => {
76565
76334
  }
76566
76335
  });
76567
76336
  };
76568
- var config10 = {
76337
+ var config7 = {
76569
76338
  configVersion: 1,
76570
76339
  id: "solid",
76571
76340
  frameworkCli: "create-solid",
@@ -76575,12 +76344,12 @@ var config10 = {
76575
76344
  path: "./templates"
76576
76345
  },
76577
76346
  path: "templates-experimental/solid",
76578
- generate: generate9,
76579
- configure: configure7,
76347
+ generate: generate6,
76348
+ configure: configure5,
76580
76349
  transformPackageJson: async () => ({
76581
76350
  scripts: {
76582
- preview: `${npm6} run build && npx wrangler dev`,
76583
- deploy: `${npm6} run build && wrangler deploy`
76351
+ preview: `${npm3} run build && npx wrangler dev`,
76352
+ deploy: `${npm3} run build && wrangler deploy`
76584
76353
  }
76585
76354
  }),
76586
76355
  compatibilityFlags: ["nodejs_compat"],
@@ -76588,17 +76357,17 @@ var config10 = {
76588
76357
  deployScript: "deploy",
76589
76358
  previewScript: "preview"
76590
76359
  };
76591
- var c3_default12 = config10;
76360
+ var c3_default9 = config7;
76592
76361
 
76593
76362
  // templates-experimental/svelte/c3.ts
76594
76363
  var import_node_os3 = require("node:os");
76595
- var recast6 = __toESM(require_main3());
76596
- var { npm: npm7 } = detectPackageManager();
76597
- var generate10 = async (ctx) => {
76364
+ var recast5 = __toESM(require_main3());
76365
+ var { npm: npm4 } = detectPackageManager();
76366
+ var generate7 = async (ctx) => {
76598
76367
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
76599
76368
  logRaw("");
76600
76369
  };
76601
- var configure8 = async (ctx) => {
76370
+ var configure6 = async (ctx) => {
76602
76371
  const pkg = `@sveltejs/adapter-cloudflare`;
76603
76372
  await installPackages([pkg], {
76604
76373
  dev: true,
@@ -76625,7 +76394,7 @@ var updateTypeDefinitions = (ctx) => {
76625
76394
  return;
76626
76395
  }
76627
76396
  updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
76628
- const b3 = recast6.types.builders;
76397
+ const b3 = recast5.types.builders;
76629
76398
  transformFile("src/app.d.ts", {
76630
76399
  visitTSModuleDeclaration(n) {
76631
76400
  if (n.value.id.name === "App" && n.node.body) {
@@ -76657,7 +76426,7 @@ var updateTypeDefinitions = (ctx) => {
76657
76426
  }
76658
76427
  });
76659
76428
  };
76660
- var config11 = {
76429
+ var config8 = {
76661
76430
  configVersion: 1,
76662
76431
  id: "svelte",
76663
76432
  frameworkCli: "sv",
@@ -76667,12 +76436,12 @@ var config11 = {
76667
76436
  path: "./templates"
76668
76437
  },
76669
76438
  path: "templates-experimental/svelte",
76670
- generate: generate10,
76671
- configure: configure8,
76439
+ generate: generate7,
76440
+ configure: configure6,
76672
76441
  transformPackageJson: async (original, ctx) => {
76673
76442
  let scripts = {
76674
- preview: `${npm7} run build && wrangler dev`,
76675
- deploy: `${npm7} run build && wrangler deploy`
76443
+ preview: `${npm4} run build && wrangler dev`,
76444
+ deploy: `${npm4} run build && wrangler deploy`
76676
76445
  };
76677
76446
  if (usesTypescript(ctx)) {
76678
76447
  const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
@@ -76687,87 +76456,12 @@ var config11 = {
76687
76456
  deployScript: "deploy",
76688
76457
  previewScript: "preview"
76689
76458
  };
76690
- var c3_default13 = config11;
76691
-
76692
- // templates-experimental/vue/c3.ts
76693
- var { npm: npm8 } = detectPackageManager();
76694
- var generate11 = async (ctx) => {
76695
- const lang = ctx.args.lang ?? await inputPrompt({
76696
- type: "select",
76697
- question: "Would you like to use TypeScript?",
76698
- label: "Language",
76699
- options: [
76700
- { label: "TypeScript", value: "ts" },
76701
- { label: "JavaScript", value: "js" }
76702
- ]
76703
- });
76704
- await runFrameworkGenerator(ctx, [
76705
- ctx.project.name,
76706
- "--router",
76707
- lang === "ts" ? "--ts" : ""
76708
- ]);
76709
- logRaw("");
76710
- };
76711
- var configure9 = async (ctx) => {
76712
- await installPackages(["@cloudflare/vite-plugin"], {
76713
- dev: true,
76714
- startText: "Installing the Cloudflare Vite plugin",
76715
- doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
76716
- });
76717
- if (usesTypescript(ctx)) {
76718
- updateTsconfigJson();
76719
- }
76720
- };
76721
- function updateTsconfigJson() {
76722
- const s = spinner();
76723
- s.start(`Updating tsconfig.json config`);
76724
- const tsconfig = readJSON("tsconfig.json");
76725
- if (tsconfig && typeof tsconfig === "object") {
76726
- tsconfig.references ??= [];
76727
- tsconfig.references.push({ path: "./tsconfig.worker.json" });
76728
- }
76729
- writeJSON("tsconfig.json", tsconfig);
76730
- s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
76731
- }
76732
- var config12 = {
76733
- configVersion: 1,
76734
- id: "vue",
76735
- frameworkCli: "create-vue",
76736
- platform: "workers",
76737
- displayName: "Vue",
76738
- path: "templates-experimental/vue",
76739
- copyFiles: {
76740
- async selectVariant(ctx) {
76741
- return usesTypescript(ctx) ? "ts" : "js";
76742
- },
76743
- variants: {
76744
- ts: {
76745
- path: "./ts"
76746
- },
76747
- js: {
76748
- path: "./js"
76749
- }
76750
- }
76751
- },
76752
- configure: configure9,
76753
- generate: generate11,
76754
- transformPackageJson: async (_3, ctx) => ({
76755
- scripts: {
76756
- deploy: `${npm8} run build && wrangler deploy`,
76757
- preview: `${npm8} run build && wrangler dev`,
76758
- ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
76759
- }
76760
- }),
76761
- devScript: "dev",
76762
- deployScript: "deploy",
76763
- previewScript: "preview"
76764
- };
76765
- var c3_default14 = config12;
76459
+ var c3_default10 = config8;
76766
76460
 
76767
76461
  // templates/analog/c3.ts
76768
- var recast7 = __toESM(require_main3());
76769
- var { npm: npm9, name: pm2 } = detectPackageManager();
76770
- var generate12 = async (ctx) => {
76462
+ var recast6 = __toESM(require_main3());
76463
+ var { npm: npm5, name: pm } = detectPackageManager();
76464
+ var generate8 = async (ctx) => {
76771
76465
  await runFrameworkGenerator(ctx, [
76772
76466
  ctx.project.name,
76773
76467
  "--template",
@@ -76775,8 +76469,8 @@ var generate12 = async (ctx) => {
76775
76469
  ]);
76776
76470
  logRaw("");
76777
76471
  };
76778
- var configure10 = async (ctx) => {
76779
- if (pm2 === "pnpm" || pm2 === "yarn" || pm2 === "bun") {
76472
+ var configure7 = async (ctx) => {
76473
+ if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
76780
76474
  const packages = [];
76781
76475
  packages.push("nitropack");
76782
76476
  packages.push("h3");
@@ -76785,13 +76479,13 @@ var configure10 = async (ctx) => {
76785
76479
  await installPackages(packages, {
76786
76480
  dev: true,
76787
76481
  startText: `Installing ${packages.join(", ")}`,
76788
- doneText: `${brandColor("installed")} ${dim(`via \`${npm9} install\``)}`
76482
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm5} install\``)}`
76789
76483
  });
76790
76484
  }
76791
76485
  updateViteConfig(ctx);
76792
- updateEnvTypes2(ctx);
76486
+ updateEnvTypes(ctx);
76793
76487
  };
76794
- var updateEnvTypes2 = (ctx) => {
76488
+ var updateEnvTypes = (ctx) => {
76795
76489
  const filepath = "env.d.ts";
76796
76490
  const s = spinner();
76797
76491
  s.start(`Updating ${filepath}`);
@@ -76806,7 +76500,7 @@ var updateEnvTypes2 = (ctx) => {
76806
76500
  s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76807
76501
  };
76808
76502
  var updateViteConfig = (ctx) => {
76809
- const b3 = recast7.types.builders;
76503
+ const b3 = recast6.types.builders;
76810
76504
  const s = spinner();
76811
76505
  const configFile = "vite.config.ts";
76812
76506
  s.start(`Updating \`${configFile}\``);
@@ -76843,7 +76537,7 @@ var updateViteConfig = (ctx) => {
76843
76537
  });
76844
76538
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76845
76539
  };
76846
- var config13 = {
76540
+ var config9 = {
76847
76541
  configVersion: 1,
76848
76542
  id: "analog",
76849
76543
  frameworkCli: "create-analog",
@@ -76852,12 +76546,12 @@ var config13 = {
76852
76546
  copyFiles: {
76853
76547
  path: "./templates"
76854
76548
  },
76855
- generate: generate12,
76856
- configure: configure10,
76549
+ generate: generate8,
76550
+ configure: configure7,
76857
76551
  transformPackageJson: async () => ({
76858
76552
  scripts: {
76859
- preview: `${npm9} run build && wrangler pages dev`,
76860
- deploy: `${npm9} run build && wrangler pages deploy`,
76553
+ preview: `${npm5} run build && wrangler pages dev`,
76554
+ deploy: `${npm5} run build && wrangler pages deploy`,
76861
76555
  "cf-typegen": `wrangler types`
76862
76556
  }
76863
76557
  }),
@@ -76865,12 +76559,100 @@ var config13 = {
76865
76559
  deployScript: "deploy",
76866
76560
  previewScript: "preview"
76867
76561
  };
76868
- var c3_default15 = config13;
76562
+ var c3_default11 = config9;
76869
76563
 
76870
- // templates/angular/c3.ts
76564
+ // templates/angular/pages/c3.ts
76565
+ var import_node_path3 = require("node:path");
76566
+ var { npm: npm6 } = detectPackageManager();
76567
+ var generate9 = async (ctx) => {
76568
+ await runFrameworkGenerator(ctx, [
76569
+ ctx.project.name,
76570
+ "--ssr",
76571
+ "--server-routing"
76572
+ ]);
76573
+ logRaw("");
76574
+ };
76575
+ var configure8 = async (ctx) => {
76576
+ updateAngularJson(ctx);
76577
+ await updateAppCode();
76578
+ await installCFWorker();
76579
+ };
76580
+ async function installCFWorker() {
76581
+ await installPackages(["xhr2"], {
76582
+ dev: true,
76583
+ startText: "Installing additional dependencies",
76584
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm6} install\``)}`
76585
+ });
76586
+ }
76587
+ async function updateAppCode() {
76588
+ const s = spinner();
76589
+ s.start(`Updating application code`);
76590
+ const appConfigPath = "src/app/app.config.ts";
76591
+ const appConfig = readFile((0, import_node_path3.resolve)(appConfigPath));
76592
+ const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
76593
+ "providers: [",
76594
+ "providers: [provideHttpClient(withFetch()), "
76595
+ );
76596
+ writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
76597
+ s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
76598
+ const appServerRoutesPath = "src/app/app.routes.server.ts";
76599
+ const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
76600
+ const newAppRoutes = appRoutes.replace(
76601
+ "RenderMode.Prerender",
76602
+ "RenderMode.Server"
76603
+ );
76604
+ writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
76605
+ s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
76606
+ s.start(`Updating package.json`);
76607
+ const packageJsonPath = (0, import_node_path3.resolve)("package.json");
76608
+ const packageManifest = readJSON(packageJsonPath);
76609
+ delete packageManifest["dependencies"]?.["express"];
76610
+ delete packageManifest["devDependencies"]?.["@types/express"];
76611
+ writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
76612
+ s.stop(`${brandColor(`updated`)} ${dim(`\`package.json\``)}`);
76613
+ }
76614
+ function updateAngularJson(ctx) {
76615
+ const s = spinner();
76616
+ s.start(`Updating angular.json config`);
76617
+ const angularJson = readJSON("angular.json");
76618
+ const architectSection = angularJson.projects[ctx.project.name].architect;
76619
+ architectSection.build.options.outputPath = "dist";
76620
+ architectSection.build.options.outputMode = "server";
76621
+ architectSection.build.options.ssr.experimentalPlatform = "neutral";
76622
+ architectSection.build.options.assets.push("src/_routes.json");
76623
+ writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
76624
+ s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
76625
+ }
76626
+ var config10 = {
76627
+ configVersion: 1,
76628
+ id: "angular",
76629
+ frameworkCli: "@angular/create",
76630
+ displayName: "Angular",
76631
+ platform: "pages",
76632
+ copyFiles: {
76633
+ path: "./templates"
76634
+ },
76635
+ path: "templates/angular/pages",
76636
+ devScript: "start",
76637
+ deployScript: "deploy",
76638
+ previewScript: "start",
76639
+ generate: generate9,
76640
+ configure: configure8,
76641
+ transformPackageJson: async () => ({
76642
+ scripts: {
76643
+ start: `${npm6} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
76644
+ build: `ng build && ${npm6} run process`,
76645
+ process: "node ./tools/copy-files.mjs",
76646
+ deploy: `${npm6} run build && wrangler pages deploy dist/cloudflare`
76647
+ }
76648
+ })
76649
+ };
76650
+ var c3_default12 = config10;
76651
+
76652
+ // templates/angular/workers/c3.ts
76871
76653
  var import_node_path4 = require("node:path");
76872
- var { npm: npm10 } = detectPackageManager();
76873
- var generate13 = async (ctx) => {
76654
+ var { npm: npm7 } = detectPackageManager();
76655
+ var generate10 = async (ctx) => {
76874
76656
  await runFrameworkGenerator(ctx, [
76875
76657
  ctx.project.name,
76876
76658
  "--ssr",
@@ -76878,7 +76660,7 @@ var generate13 = async (ctx) => {
76878
76660
  ]);
76879
76661
  logRaw("");
76880
76662
  };
76881
- var configure11 = async (ctx) => {
76663
+ var configure9 = async (ctx) => {
76882
76664
  updateAngularJson2(ctx);
76883
76665
  await updateAppCode2();
76884
76666
  await installCFWorker2();
@@ -76887,7 +76669,7 @@ async function installCFWorker2() {
76887
76669
  await installPackages(["xhr2"], {
76888
76670
  dev: true,
76889
76671
  startText: "Installing additional dependencies",
76890
- doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
76672
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm7} install\``)}`
76891
76673
  });
76892
76674
  }
76893
76675
  async function updateAppCode2() {
@@ -76920,48 +76702,54 @@ async function updateAppCode2() {
76920
76702
  function updateAngularJson2(ctx) {
76921
76703
  const s = spinner();
76922
76704
  s.start(`Updating angular.json config`);
76923
- const angularJson = readJSON("angular.json");
76705
+ const angularJson = readJSON((0, import_node_path4.resolve)("angular.json"));
76924
76706
  const architectSection = angularJson.projects[ctx.project.name].architect;
76925
76707
  architectSection.build.options.outputPath = "dist";
76926
76708
  architectSection.build.options.outputMode = "server";
76927
76709
  architectSection.build.options.ssr.experimentalPlatform = "neutral";
76928
- architectSection.build.options.assets.push("src/_routes.json");
76929
76710
  writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
76930
76711
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
76931
76712
  }
76932
- var config14 = {
76713
+ var config11 = {
76933
76714
  configVersion: 1,
76934
76715
  id: "angular",
76935
76716
  frameworkCli: "@angular/create",
76936
76717
  displayName: "Angular",
76937
- platform: "pages",
76718
+ platform: "workers",
76938
76719
  copyFiles: {
76939
76720
  path: "./templates"
76940
76721
  },
76722
+ path: "templates/angular/workers",
76941
76723
  devScript: "start",
76942
76724
  deployScript: "deploy",
76943
76725
  previewScript: "start",
76944
- generate: generate13,
76945
- configure: configure11,
76726
+ generate: generate10,
76727
+ configure: configure9,
76946
76728
  transformPackageJson: async () => ({
76947
76729
  scripts: {
76948
- start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
76949
- build: `ng build && ${npm10} run process`,
76950
- process: "node ./tools/copy-files.mjs",
76951
- deploy: `${npm10} run build && wrangler pages deploy dist/cloudflare`
76730
+ start: `${npm7} run build && wrangler dev`,
76731
+ build: `ng build`,
76732
+ deploy: `${npm7} run build && wrangler deploy`
76952
76733
  }
76953
76734
  })
76954
76735
  };
76955
- var c3_default16 = config14;
76736
+ var c3_default13 = config11;
76737
+
76738
+ // templates/angular/c3.ts
76739
+ var config12 = {
76740
+ displayName: "Angular",
76741
+ platformVariants: { pages: c3_default12, workers: c3_default13 }
76742
+ };
76743
+ var c3_default14 = config12;
76956
76744
 
76957
76745
  // templates/astro/c3.ts
76958
- var recast8 = __toESM(require_main3());
76746
+ var recast7 = __toESM(require_main3());
76959
76747
  var { npx: npx3 } = detectPackageManager();
76960
- var generate14 = async (ctx) => {
76748
+ var generate11 = async (ctx) => {
76961
76749
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
76962
76750
  logRaw("");
76963
76751
  };
76964
- var configure12 = async () => {
76752
+ var configure10 = async () => {
76965
76753
  await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
76966
76754
  silent: true,
76967
76755
  startText: "Installing adapter",
@@ -76980,7 +76768,7 @@ var updateAstroConfig2 = () => {
76980
76768
  if (callee.name !== "cloudflare") {
76981
76769
  return this.traverse(n);
76982
76770
  }
76983
- const b3 = recast8.types.builders;
76771
+ const b3 = recast7.types.builders;
76984
76772
  n.node.arguments = [
76985
76773
  b3.objectExpression([
76986
76774
  b3.objectProperty(
@@ -76995,7 +76783,7 @@ var updateAstroConfig2 = () => {
76995
76783
  }
76996
76784
  });
76997
76785
  };
76998
- var config15 = {
76786
+ var config13 = {
76999
76787
  configVersion: 1,
77000
76788
  id: "astro",
77001
76789
  frameworkCli: "create-astro",
@@ -77017,8 +76805,8 @@ var config15 = {
77017
76805
  devScript: "dev",
77018
76806
  deployScript: "deploy",
77019
76807
  previewScript: "preview",
77020
- generate: generate14,
77021
- configure: configure12,
76808
+ generate: generate11,
76809
+ configure: configure10,
77022
76810
  transformPackageJson: async (pkgJson, ctx) => ({
77023
76811
  scripts: {
77024
76812
  deploy: `astro build && wrangler pages deploy`,
@@ -77027,10 +76815,10 @@ var config15 = {
77027
76815
  }
77028
76816
  })
77029
76817
  };
77030
- var c3_default17 = config15;
76818
+ var c3_default15 = config13;
77031
76819
 
77032
76820
  // templates/common/c3.ts
77033
- var c3_default18 = {
76821
+ var c3_default16 = {
77034
76822
  configVersion: 1,
77035
76823
  id: "common",
77036
76824
  displayName: "Example router & proxy Worker",
@@ -77050,36 +76838,36 @@ var c3_default18 = {
77050
76838
  };
77051
76839
 
77052
76840
  // templates/docusaurus/pages/c3.ts
77053
- var { npm: npm11 } = detectPackageManager();
77054
- var generate15 = async (ctx) => {
76841
+ var { npm: npm8 } = detectPackageManager();
76842
+ var generate12 = async (ctx) => {
77055
76843
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
77056
76844
  };
77057
- var config16 = {
76845
+ var config14 = {
77058
76846
  configVersion: 1,
77059
76847
  id: "docusaurus",
77060
76848
  frameworkCli: "create-docusaurus",
77061
76849
  platform: "pages",
77062
76850
  displayName: "Docusaurus",
77063
76851
  path: "templates/docusaurus/pages",
77064
- generate: generate15,
76852
+ generate: generate12,
77065
76853
  transformPackageJson: async () => ({
77066
76854
  scripts: {
77067
- preview: `${npm11} run build && wrangler pages dev ./build`,
77068
- deploy: `${npm11} run build && wrangler pages deploy ./build`
76855
+ preview: `${npm8} run build && wrangler pages dev ./build`,
76856
+ deploy: `${npm8} run build && wrangler pages deploy ./build`
77069
76857
  }
77070
76858
  }),
77071
76859
  devScript: "preview",
77072
76860
  deployScript: "deploy",
77073
76861
  previewScript: "preview"
77074
76862
  };
77075
- var c3_default19 = config16;
76863
+ var c3_default17 = config14;
77076
76864
 
77077
76865
  // templates/docusaurus/workers/c3.ts
77078
- var { npm: npm12 } = detectPackageManager();
77079
- var generate16 = async (ctx) => {
76866
+ var { npm: npm9 } = detectPackageManager();
76867
+ var generate13 = async (ctx) => {
77080
76868
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
77081
76869
  };
77082
- var config17 = {
76870
+ var config15 = {
77083
76871
  configVersion: 1,
77084
76872
  id: "docusaurus",
77085
76873
  frameworkCli: "create-docusaurus",
@@ -77089,29 +76877,29 @@ var config17 = {
77089
76877
  path: "./templates"
77090
76878
  },
77091
76879
  path: "templates/docusaurus/workers",
77092
- generate: generate16,
76880
+ generate: generate13,
77093
76881
  transformPackageJson: async () => ({
77094
76882
  scripts: {
77095
- deploy: `${npm12} run build && wrangler deploy`,
77096
- preview: `${npm12} run build && wrangler dev`
76883
+ deploy: `${npm9} run build && wrangler deploy`,
76884
+ preview: `${npm9} run build && wrangler dev`
77097
76885
  }
77098
76886
  }),
77099
76887
  devScript: "start",
77100
76888
  deployScript: "deploy",
77101
76889
  previewScript: "preview"
77102
76890
  };
77103
- var c3_default20 = config17;
76891
+ var c3_default18 = config15;
77104
76892
 
77105
76893
  // templates/docusaurus/c3.ts
77106
- var config18 = {
76894
+ var config16 = {
77107
76895
  displayName: "Docusaurus",
77108
- platformVariants: { pages: c3_default19, workers: c3_default20 }
76896
+ platformVariants: { pages: c3_default17, workers: c3_default18 }
77109
76897
  };
77110
- var c3_default21 = config18;
76898
+ var c3_default19 = config16;
77111
76899
 
77112
- // templates/gatsby/c3.ts
77113
- var { npm: npm13 } = detectPackageManager();
77114
- var generate17 = async (ctx) => {
76900
+ // templates/gatsby/pages/c3.ts
76901
+ var { npm: npm10 } = detectPackageManager();
76902
+ var generate14 = async (ctx) => {
77115
76903
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
77116
76904
  const useTemplate = await inputPrompt({
77117
76905
  type: "confirm",
@@ -77130,23 +76918,75 @@ var generate17 = async (ctx) => {
77130
76918
  }
77131
76919
  await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
77132
76920
  };
77133
- var config19 = {
76921
+ var config17 = {
77134
76922
  configVersion: 1,
77135
76923
  id: "gatsby",
77136
76924
  frameworkCli: "gatsby",
77137
76925
  platform: "pages",
77138
76926
  displayName: "Gatsby",
77139
- generate: generate17,
76927
+ path: "templates/gatsby/pages",
76928
+ generate: generate14,
77140
76929
  transformPackageJson: async () => ({
77141
76930
  scripts: {
77142
- deploy: `${npm13} run build && wrangler pages deploy ./public`,
77143
- preview: `${npm13} run build && wrangler pages dev ./public`
76931
+ deploy: `${npm10} run build && wrangler pages deploy ./public`,
76932
+ preview: `${npm10} run build && wrangler pages dev ./public`
77144
76933
  }
77145
76934
  }),
77146
76935
  devScript: "develop",
77147
76936
  deployScript: "deploy",
77148
76937
  previewScript: "preview"
77149
76938
  };
76939
+ var c3_default20 = config17;
76940
+
76941
+ // templates/gatsby/workers/c3.ts
76942
+ var { npm: npm11 } = detectPackageManager();
76943
+ var generate15 = async (ctx) => {
76944
+ const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76945
+ const useTemplate = await inputPrompt({
76946
+ type: "confirm",
76947
+ question: "Would you like to use a template?",
76948
+ label: "template",
76949
+ defaultValue: true
76950
+ });
76951
+ let templateUrl = "";
76952
+ if (useTemplate) {
76953
+ templateUrl = await inputPrompt({
76954
+ type: "text",
76955
+ question: `Please specify the url of the template you'd like to use`,
76956
+ label: "template",
76957
+ defaultValue: defaultTemplate
76958
+ });
76959
+ }
76960
+ await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76961
+ };
76962
+ var config18 = {
76963
+ configVersion: 1,
76964
+ id: "gatsby",
76965
+ frameworkCli: "gatsby",
76966
+ platform: "workers",
76967
+ displayName: "Gatsby",
76968
+ copyFiles: {
76969
+ path: "./templates"
76970
+ },
76971
+ path: "templates/gatsby/workers",
76972
+ generate: generate15,
76973
+ transformPackageJson: async () => ({
76974
+ scripts: {
76975
+ deploy: `${npm11} run build && wrangler deploy`,
76976
+ preview: `${npm11} run build && wrangler dev`
76977
+ }
76978
+ }),
76979
+ devScript: "develop",
76980
+ deployScript: "deploy",
76981
+ previewScript: "preview"
76982
+ };
76983
+ var c3_default21 = config18;
76984
+
76985
+ // templates/gatsby/c3.ts
76986
+ var config19 = {
76987
+ displayName: "Gatsby",
76988
+ platformVariants: { pages: c3_default20, workers: c3_default21 }
76989
+ };
77150
76990
  var c3_default22 = config19;
77151
76991
 
77152
76992
  // templates/hello-world-durable-object/c3.ts
@@ -77205,7 +77045,7 @@ var c3_default24 = {
77205
77045
  };
77206
77046
 
77207
77047
  // templates/hono/c3.ts
77208
- var generate18 = async (ctx) => {
77048
+ var generate16 = async (ctx) => {
77209
77049
  const { name: pm4 } = detectPackageManager();
77210
77050
  await runFrameworkGenerator(ctx, [
77211
77051
  ctx.project.name,
@@ -77217,7 +77057,7 @@ var generate18 = async (ctx) => {
77217
77057
  ]);
77218
77058
  logRaw("");
77219
77059
  };
77220
- var configure13 = async (ctx) => {
77060
+ var configure11 = async (ctx) => {
77221
77061
  const indexFile = "src/index.ts";
77222
77062
  const s = spinner();
77223
77063
  s.start(`Updating \`${indexFile}\``);
@@ -77241,8 +77081,8 @@ var config20 = {
77241
77081
  path: "./templates"
77242
77082
  },
77243
77083
  platform: "workers",
77244
- generate: generate18,
77245
- configure: configure13,
77084
+ generate: generate16,
77085
+ configure: configure11,
77246
77086
  transformPackageJson: async () => ({
77247
77087
  scripts: {
77248
77088
  dev: "wrangler dev",
@@ -77258,8 +77098,8 @@ var c3_default25 = config20;
77258
77098
 
77259
77099
  // templates/next/c3.ts
77260
77100
  var import_path10 = require("path");
77261
- var { npm: npm14, npx: npx4 } = detectPackageManager();
77262
- var generate19 = async (ctx) => {
77101
+ var { npm: npm12, npx: npx4 } = detectPackageManager();
77102
+ var generate17 = async (ctx) => {
77263
77103
  const projectName = ctx.project.name;
77264
77104
  await runFrameworkGenerator(ctx, [projectName]);
77265
77105
  const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
@@ -77284,7 +77124,7 @@ var updateNextConfig2 = (usesTs) => {
77284
77124
  writeFile2(configFile, updatedConfigFile);
77285
77125
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
77286
77126
  };
77287
- var configure14 = async (ctx) => {
77127
+ var configure12 = async (ctx) => {
77288
77128
  const projectPath = ctx.project.path;
77289
77129
  const path6 = probePaths([
77290
77130
  `${projectPath}/pages/api`,
@@ -77365,8 +77205,8 @@ var c3_default26 = {
77365
77205
  frameworkCli: "create-next-app",
77366
77206
  platform: "pages",
77367
77207
  displayName: "Next.js",
77368
- generate: generate19,
77369
- configure: configure14,
77208
+ generate: generate17,
77209
+ configure: configure12,
77370
77210
  copyFiles: {
77371
77211
  async selectVariant(ctx) {
77372
77212
  const isApp = probePaths([
@@ -77397,12 +77237,12 @@ var c3_default26 = {
77397
77237
  }
77398
77238
  },
77399
77239
  transformPackageJson: async (_3, ctx) => {
77400
- const isNpm = npm14 === "npm";
77401
- const isBun = npm14 === "bun";
77240
+ const isNpm = npm12 === "npm";
77241
+ const isBun = npm12 === "bun";
77402
77242
  const isNpmOrBun = isNpm || isBun;
77403
77243
  const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
77404
77244
  const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
77405
- const pmCommand = isNpmOrBun ? npx4 : npm14;
77245
+ const pmCommand = isNpmOrBun ? npx4 : npm12;
77406
77246
  const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
77407
77247
  return {
77408
77248
  scripts: {
@@ -77421,35 +77261,35 @@ var c3_default26 = {
77421
77261
  compatibilityFlags: ["nodejs_compat"]
77422
77262
  };
77423
77263
 
77424
- // templates/nuxt/c3.ts
77425
- var recast9 = __toESM(require_main3());
77426
- var { npm: npm15, name: pm3 } = detectPackageManager();
77427
- var generate20 = async (ctx) => {
77264
+ // templates/nuxt/pages/c3.ts
77265
+ var recast8 = __toESM(require_main3());
77266
+ var { npm: npm13, name: pm2 } = detectPackageManager();
77267
+ var generate18 = async (ctx) => {
77428
77268
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
77429
77269
  await runFrameworkGenerator(ctx, [
77430
77270
  "init",
77431
77271
  ctx.project.name,
77432
77272
  "--packageManager",
77433
- npm15,
77273
+ npm13,
77434
77274
  gitFlag
77435
77275
  ]);
77436
77276
  writeFile2("./.node-version", "18");
77437
77277
  logRaw("");
77438
77278
  };
77439
- var configure15 = async (ctx) => {
77279
+ var configure13 = async (ctx) => {
77440
77280
  const packages = ["nitro-cloudflare-dev"];
77441
- if (pm3 === "pnpm") {
77281
+ if (pm2 === "pnpm") {
77442
77282
  packages.push("h3");
77443
77283
  }
77444
77284
  await installPackages(packages, {
77445
77285
  dev: true,
77446
77286
  startText: "Installing nitro module `nitro-cloudflare-dev`",
77447
- doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
77287
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm13} install\``)}`
77448
77288
  });
77449
- updateNuxtConfig2();
77450
- updateEnvTypes3(ctx);
77289
+ updateNuxtConfig();
77290
+ updateEnvTypes2(ctx);
77451
77291
  };
77452
- var updateEnvTypes3 = (ctx) => {
77292
+ var updateEnvTypes2 = (ctx) => {
77453
77293
  const filepath = "env.d.ts";
77454
77294
  const s = spinner();
77455
77295
  s.start(`Updating ${filepath}`);
@@ -77463,17 +77303,27 @@ var updateEnvTypes3 = (ctx) => {
77463
77303
  writeFile2("env.d.ts", file);
77464
77304
  s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
77465
77305
  };
77466
- var updateNuxtConfig2 = () => {
77306
+ var updateNuxtConfig = () => {
77467
77307
  const s = spinner();
77468
77308
  const configFile = "nuxt.config.ts";
77469
77309
  s.start(`Updating \`${configFile}\``);
77470
- const b3 = recast9.types.builders;
77310
+ const b3 = recast8.types.builders;
77471
77311
  const presetDef = b3.objectProperty(
77472
77312
  b3.identifier("nitro"),
77473
77313
  b3.objectExpression([
77474
77314
  b3.objectProperty(
77475
77315
  b3.identifier("preset"),
77476
77316
  b3.stringLiteral("cloudflare-pages")
77317
+ ),
77318
+ b3.objectProperty(
77319
+ b3.identifier("cloudflare"),
77320
+ b3.objectExpression([
77321
+ b3.objectProperty(
77322
+ b3.identifier("deployConfig"),
77323
+ b3.booleanLiteral(true)
77324
+ ),
77325
+ b3.objectProperty(b3.identifier("nodeCompat"), b3.booleanLiteral(true))
77326
+ ])
77477
77327
  )
77478
77328
  ])
77479
77329
  );
@@ -77504,12 +77354,13 @@ var config21 = {
77504
77354
  copyFiles: {
77505
77355
  path: "./templates"
77506
77356
  },
77507
- generate: generate20,
77508
- configure: configure15,
77357
+ path: "templates/nuxt/pages",
77358
+ generate: generate18,
77359
+ configure: configure13,
77509
77360
  transformPackageJson: async () => ({
77510
77361
  scripts: {
77511
- deploy: `${npm15} run build && wrangler pages deploy`,
77512
- preview: `${npm15} run build && wrangler pages dev`,
77362
+ deploy: `${npm13} run build && wrangler pages deploy`,
77363
+ preview: `${npm13} run build && wrangler pages dev`,
77513
77364
  "cf-typegen": `wrangler types`
77514
77365
  }
77515
77366
  }),
@@ -77519,8 +77370,124 @@ var config21 = {
77519
77370
  };
77520
77371
  var c3_default27 = config21;
77521
77372
 
77373
+ // templates/nuxt/workers/c3.ts
77374
+ var recast9 = __toESM(require_main3());
77375
+ var { npm: npm14, name: pm3 } = detectPackageManager();
77376
+ var generate19 = async (ctx) => {
77377
+ const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
77378
+ await runFrameworkGenerator(ctx, [
77379
+ "init",
77380
+ ctx.project.name,
77381
+ "--packageManager",
77382
+ npm14,
77383
+ gitFlag
77384
+ ]);
77385
+ writeFile2("./.node-version", "18");
77386
+ logRaw("");
77387
+ };
77388
+ var configure14 = async (ctx) => {
77389
+ const packages = ["nitro-cloudflare-dev", "nitropack"];
77390
+ if (pm3 === "pnpm") {
77391
+ packages.push("h3");
77392
+ }
77393
+ await installPackages(packages, {
77394
+ dev: true,
77395
+ startText: "Installing nitro module `nitro-cloudflare-dev`",
77396
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm14} install\``)}`
77397
+ });
77398
+ updateNuxtConfig2();
77399
+ updateEnvTypes3(ctx);
77400
+ };
77401
+ var updateEnvTypes3 = (ctx) => {
77402
+ const filepath = "env.d.ts";
77403
+ const s = spinner();
77404
+ s.start(`Updating ${filepath}`);
77405
+ let file = readFile(filepath);
77406
+ let typesEntrypoint = `@cloudflare/workers-types`;
77407
+ const latestEntrypoint = getLatestTypesEntrypoint(ctx);
77408
+ if (latestEntrypoint) {
77409
+ typesEntrypoint += `/${latestEntrypoint}`;
77410
+ }
77411
+ file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
77412
+ writeFile2("env.d.ts", file);
77413
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
77414
+ };
77415
+ var updateNuxtConfig2 = () => {
77416
+ const s = spinner();
77417
+ const configFile = "nuxt.config.ts";
77418
+ s.start(`Updating \`${configFile}\``);
77419
+ const b3 = recast9.types.builders;
77420
+ const presetDef = b3.objectProperty(
77421
+ b3.identifier("nitro"),
77422
+ b3.objectExpression([
77423
+ b3.objectProperty(
77424
+ b3.identifier("preset"),
77425
+ b3.stringLiteral("cloudflare_module")
77426
+ ),
77427
+ b3.objectProperty(
77428
+ b3.identifier("cloudflare"),
77429
+ b3.objectExpression([
77430
+ b3.objectProperty(
77431
+ b3.identifier("deployConfig"),
77432
+ b3.booleanLiteral(true)
77433
+ ),
77434
+ b3.objectProperty(b3.identifier("nodeCompat"), b3.booleanLiteral(true))
77435
+ ])
77436
+ )
77437
+ ])
77438
+ );
77439
+ const moduleDef = b3.objectProperty(
77440
+ b3.identifier("modules"),
77441
+ b3.arrayExpression([b3.stringLiteral("nitro-cloudflare-dev")])
77442
+ );
77443
+ transformFile(configFile, {
77444
+ visitCallExpression: function(n) {
77445
+ const callee = n.node.callee;
77446
+ if (callee.name === "defineNuxtConfig") {
77447
+ mergeObjectProperties(
77448
+ n.node.arguments[0],
77449
+ [presetDef, moduleDef]
77450
+ );
77451
+ }
77452
+ return this.traverse(n);
77453
+ }
77454
+ });
77455
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
77456
+ };
77457
+ var config22 = {
77458
+ configVersion: 1,
77459
+ id: "nuxt",
77460
+ frameworkCli: "nuxi",
77461
+ platform: "workers",
77462
+ displayName: "Nuxt",
77463
+ copyFiles: {
77464
+ path: "./templates"
77465
+ },
77466
+ path: "templates/nuxt/workers",
77467
+ generate: generate19,
77468
+ configure: configure14,
77469
+ transformPackageJson: async () => ({
77470
+ scripts: {
77471
+ deploy: `${npm14} run build && wrangler deploy`,
77472
+ preview: `${npm14} run build && wrangler dev`,
77473
+ "cf-typegen": `wrangler types`
77474
+ }
77475
+ }),
77476
+ devScript: "dev",
77477
+ deployScript: "deploy",
77478
+ previewScript: "preview"
77479
+ };
77480
+ var c3_default28 = config22;
77481
+
77482
+ // templates/nuxt/c3.ts
77483
+ var config23 = {
77484
+ displayName: "Nuxt",
77485
+ platformVariants: { pages: c3_default27, workers: c3_default28 }
77486
+ };
77487
+ var c3_default29 = config23;
77488
+
77522
77489
  // templates/openapi/c3.ts
77523
- var c3_default28 = {
77490
+ var c3_default30 = {
77524
77491
  configVersion: 1,
77525
77492
  id: "openapi",
77526
77493
  displayName: "API starter (OpenAPI compliant)",
@@ -77679,7 +77646,7 @@ async function copyExistingWorkerFiles(ctx) {
77679
77646
  (0, import_path11.join)(ctx.project.path, "wrangler.toml")
77680
77647
  );
77681
77648
  }
77682
- var c3_default29 = {
77649
+ var c3_default31 = {
77683
77650
  configVersion: 1,
77684
77651
  id: "pre-existing",
77685
77652
  displayName: "Pre-existing Worker (from Dashboard)",
@@ -77707,7 +77674,7 @@ function buildConfigure(params) {
77707
77674
  }
77708
77675
 
77709
77676
  // templates/queues/c3.ts
77710
- var c3_default30 = {
77677
+ var c3_default32 = {
77711
77678
  configVersion: 1,
77712
77679
  id: "queues",
77713
77680
  displayName: "Queue consumer & producer Worker",
@@ -77737,12 +77704,12 @@ var c3_default30 = {
77737
77704
 
77738
77705
  // templates/qwik/c3.ts
77739
77706
  var recast10 = __toESM(require_main3());
77740
- var { npm: npm16, npx: npx5, name: name2 } = detectPackageManager();
77741
- var generate21 = async (ctx) => {
77707
+ var { npm: npm15, npx: npx5, name: name2 } = detectPackageManager();
77708
+ var generate20 = async (ctx) => {
77742
77709
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
77743
77710
  };
77744
- var configure16 = async (ctx) => {
77745
- const cmd = [name2 === "pnpm" ? npm16 : npx5, "qwik", "add", "cloudflare-pages"];
77711
+ var configure15 = async (ctx) => {
77712
+ const cmd = [name2 === "pnpm" ? npm15 : npx5, "qwik", "add", "cloudflare-pages"];
77746
77713
  endSection(`Running ${quoteShellArgs(cmd)}`);
77747
77714
  await runCommand(cmd);
77748
77715
  addBindingsProxy2(ctx);
@@ -77818,7 +77785,7 @@ var populateCloudflareEnv2 = () => {
77818
77785
  });
77819
77786
  s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
77820
77787
  };
77821
- var config22 = {
77788
+ var config24 = {
77822
77789
  configVersion: 1,
77823
77790
  id: "qwik",
77824
77791
  frameworkCli: "create-qwik",
@@ -77827,12 +77794,12 @@ var config22 = {
77827
77794
  copyFiles: {
77828
77795
  path: "./templates"
77829
77796
  },
77830
- generate: generate21,
77831
- configure: configure16,
77797
+ generate: generate20,
77798
+ configure: configure15,
77832
77799
  transformPackageJson: async () => ({
77833
77800
  scripts: {
77834
- deploy: `${npm16} run build && wrangler pages deploy`,
77835
- preview: `${npm16} run build && wrangler pages dev`,
77801
+ deploy: `${npm15} run build && wrangler pages deploy`,
77802
+ preview: `${npm15} run build && wrangler pages dev`,
77836
77803
  "cf-typegen": `wrangler types`
77837
77804
  }
77838
77805
  }),
@@ -77840,11 +77807,11 @@ var config22 = {
77840
77807
  deployScript: "deploy",
77841
77808
  previewScript: "preview"
77842
77809
  };
77843
- var c3_default31 = config22;
77810
+ var c3_default33 = config24;
77844
77811
 
77845
77812
  // templates/react/pages/c3.ts
77846
- var { npm: npm17 } = detectPackageManager();
77847
- var generate22 = async (ctx) => {
77813
+ var { npm: npm16 } = detectPackageManager();
77814
+ var generate21 = async (ctx) => {
77848
77815
  const variant = await inputPrompt({
77849
77816
  type: "select",
77850
77817
  question: "Select a variant:",
@@ -77873,7 +77840,7 @@ var variantsOptions = [
77873
77840
  label: "JavaScript + SWC"
77874
77841
  }
77875
77842
  ];
77876
- var config23 = {
77843
+ var config25 = {
77877
77844
  configVersion: 1,
77878
77845
  id: "react",
77879
77846
  // React's documentation now recommends using create-vite.
@@ -77881,26 +77848,26 @@ var config23 = {
77881
77848
  displayName: "React",
77882
77849
  platform: "pages",
77883
77850
  path: "templates/react/pages",
77884
- generate: generate22,
77851
+ generate: generate21,
77885
77852
  transformPackageJson: async () => ({
77886
77853
  scripts: {
77887
- deploy: `${npm17} run build && wrangler pages deploy ./dist`,
77888
- preview: `${npm17} run build && wrangler pages dev ./dist`
77854
+ deploy: `${npm16} run build && wrangler pages deploy ./dist`,
77855
+ preview: `${npm16} run build && wrangler pages dev ./dist`
77889
77856
  }
77890
77857
  }),
77891
77858
  devScript: "dev",
77892
77859
  deployScript: "deploy",
77893
77860
  previewScript: "preview"
77894
77861
  };
77895
- var c3_default32 = config23;
77862
+ var c3_default34 = config25;
77896
77863
 
77897
77864
  // templates/react/workers/c3.ts
77898
77865
  var import_assert2 = __toESM(require("assert"));
77899
77866
  var recast11 = __toESM(require_main3());
77900
77867
  var b2 = recast11.types.builders;
77901
77868
  var t = recast11.types.namedTypes;
77902
- var { npm: npm18 } = detectPackageManager();
77903
- var generate23 = async (ctx) => {
77869
+ var { npm: npm17 } = detectPackageManager();
77870
+ var generate22 = async (ctx) => {
77904
77871
  const variant = await getVariant();
77905
77872
  ctx.args.lang = variant.lang;
77906
77873
  await runFrameworkGenerator(ctx, [
@@ -77910,7 +77877,7 @@ var generate23 = async (ctx) => {
77910
77877
  ]);
77911
77878
  logRaw("");
77912
77879
  };
77913
- var configure17 = async (ctx) => {
77880
+ var configure16 = async (ctx) => {
77914
77881
  await installPackages(["@cloudflare/vite-plugin"], {
77915
77882
  dev: true,
77916
77883
  startText: "Installing the Cloudflare Vite plugin",
@@ -77918,7 +77885,7 @@ var configure17 = async (ctx) => {
77918
77885
  });
77919
77886
  await transformViteConfig(ctx);
77920
77887
  if (usesTypescript(ctx)) {
77921
- updateTsconfigJson2();
77888
+ updateTsconfigJson();
77922
77889
  }
77923
77890
  };
77924
77891
  function transformViteConfig(ctx) {
@@ -77941,9 +77908,9 @@ function transformViteConfig(ctx) {
77941
77908
  if (callee.name !== "defineConfig") {
77942
77909
  return this.traverse(n);
77943
77910
  }
77944
- const config30 = n.node.arguments[0];
77945
- (0, import_assert2.default)(t.ObjectExpression.check(config30));
77946
- const pluginsProp = config30.properties.find((prop) => isPluginsProp(prop));
77911
+ const config34 = n.node.arguments[0];
77912
+ (0, import_assert2.default)(t.ObjectExpression.check(config34));
77913
+ const pluginsProp = config34.properties.find((prop) => isPluginsProp(prop));
77947
77914
  (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
77948
77915
  pluginsProp.value.elements.push(
77949
77916
  b2.callExpression(b2.identifier("cloudflare"), [])
@@ -77955,7 +77922,7 @@ function transformViteConfig(ctx) {
77955
77922
  function isPluginsProp(prop) {
77956
77923
  return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
77957
77924
  }
77958
- function updateTsconfigJson2() {
77925
+ function updateTsconfigJson() {
77959
77926
  const s = spinner();
77960
77927
  s.start(`Updating tsconfig.json config`);
77961
77928
  const tsconfig = readJSON("tsconfig.json");
@@ -78000,7 +77967,7 @@ async function getVariant() {
78000
77967
  (0, import_assert2.default)(selected, "Expected a variant to be selected");
78001
77968
  return selected;
78002
77969
  }
78003
- var config24 = {
77970
+ var config26 = {
78004
77971
  configVersion: 1,
78005
77972
  id: "react",
78006
77973
  frameworkCli: "create-vite",
@@ -78017,12 +77984,12 @@ var config24 = {
78017
77984
  }
78018
77985
  }
78019
77986
  },
78020
- generate: generate23,
78021
- configure: configure17,
77987
+ generate: generate22,
77988
+ configure: configure16,
78022
77989
  transformPackageJson: async (_3, ctx) => ({
78023
77990
  scripts: {
78024
- deploy: `${npm18} run build && wrangler deploy`,
78025
- preview: `${npm18} run build && vite preview`,
77991
+ deploy: `${npm17} run build && wrangler deploy`,
77992
+ preview: `${npm17} run build && vite preview`,
78026
77993
  ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
78027
77994
  }
78028
77995
  }),
@@ -78030,18 +77997,18 @@ var config24 = {
78030
77997
  deployScript: "deploy",
78031
77998
  previewScript: "preview"
78032
77999
  };
78033
- var c3_default33 = config24;
78000
+ var c3_default35 = config26;
78034
78001
 
78035
78002
  // templates/react/c3.ts
78036
- var config25 = {
78003
+ var config27 = {
78037
78004
  displayName: "React",
78038
- platformVariants: { pages: c3_default32, workers: c3_default33 }
78005
+ platformVariants: { pages: c3_default34, workers: c3_default35 }
78039
78006
  };
78040
- var c3_default34 = config25;
78007
+ var c3_default36 = config27;
78041
78008
 
78042
78009
  // templates/remix/c3.ts
78043
- var { npm: npm19 } = detectPackageManager();
78044
- var generate24 = async (ctx) => {
78010
+ var { npm: npm18 } = detectPackageManager();
78011
+ var generate23 = async (ctx) => {
78045
78012
  await runFrameworkGenerator(ctx, [
78046
78013
  ctx.project.name,
78047
78014
  "--template",
@@ -78049,7 +78016,7 @@ var generate24 = async (ctx) => {
78049
78016
  ]);
78050
78017
  logRaw("");
78051
78018
  };
78052
- var configure18 = async () => {
78019
+ var configure17 = async () => {
78053
78020
  const typeDefsPath = "load-context.ts";
78054
78021
  const s = spinner();
78055
78022
  s.start(`Updating \`${typeDefsPath}\``);
@@ -78064,7 +78031,7 @@ var configure18 = async () => {
78064
78031
  });
78065
78032
  s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
78066
78033
  };
78067
- var config26 = {
78034
+ var config28 = {
78068
78035
  configVersion: 1,
78069
78036
  id: "remix",
78070
78037
  frameworkCli: "create-remix",
@@ -78073,12 +78040,12 @@ var config26 = {
78073
78040
  copyFiles: {
78074
78041
  path: "./templates"
78075
78042
  },
78076
- generate: generate24,
78077
- configure: configure18,
78043
+ generate: generate23,
78044
+ configure: configure17,
78078
78045
  transformPackageJson: async () => ({
78079
78046
  scripts: {
78080
- deploy: `${npm19} run build && wrangler pages deploy`,
78081
- preview: `${npm19} run build && wrangler pages dev`,
78047
+ deploy: `${npm18} run build && wrangler pages deploy`,
78048
+ preview: `${npm18} run build && wrangler pages dev`,
78082
78049
  "cf-typegen": `wrangler types`
78083
78050
  }
78084
78051
  }),
@@ -78086,10 +78053,10 @@ var config26 = {
78086
78053
  deployScript: "deploy",
78087
78054
  previewScript: "preview"
78088
78055
  };
78089
- var c3_default35 = config26;
78056
+ var c3_default37 = config28;
78090
78057
 
78091
78058
  // templates/scheduled/c3.ts
78092
- var c3_default36 = {
78059
+ var c3_default38 = {
78093
78060
  configVersion: 1,
78094
78061
  id: "scheduled",
78095
78062
  displayName: "Scheduled Worker (Cron Trigger)",
@@ -78109,12 +78076,12 @@ var c3_default36 = {
78109
78076
 
78110
78077
  // templates/solid/c3.ts
78111
78078
  var recast12 = __toESM(require_main3());
78112
- var { npm: npm20 } = detectPackageManager();
78113
- var generate25 = async (ctx) => {
78079
+ var { npm: npm19 } = detectPackageManager();
78080
+ var generate24 = async (ctx) => {
78114
78081
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
78115
78082
  logRaw("");
78116
78083
  };
78117
- var configure19 = async (ctx) => {
78084
+ var configure18 = async (ctx) => {
78118
78085
  usesTypescript(ctx);
78119
78086
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
78120
78087
  updateStatus(`Updating configuration in ${blue(filePath)}`);
@@ -78152,7 +78119,7 @@ var configure19 = async (ctx) => {
78152
78119
  }
78153
78120
  });
78154
78121
  };
78155
- var config27 = {
78122
+ var config29 = {
78156
78123
  configVersion: 1,
78157
78124
  id: "solid",
78158
78125
  frameworkCli: "create-solid",
@@ -78161,12 +78128,12 @@ var config27 = {
78161
78128
  copyFiles: {
78162
78129
  path: "./templates"
78163
78130
  },
78164
- generate: generate25,
78165
- configure: configure19,
78131
+ generate: generate24,
78132
+ configure: configure18,
78166
78133
  transformPackageJson: async () => ({
78167
78134
  scripts: {
78168
- preview: `${npm20} run build && npx wrangler pages dev`,
78169
- deploy: `${npm20} run build && wrangler pages deploy`
78135
+ preview: `${npm19} run build && npx wrangler pages dev`,
78136
+ deploy: `${npm19} run build && wrangler pages deploy`
78170
78137
  }
78171
78138
  }),
78172
78139
  compatibilityFlags: ["nodejs_compat"],
@@ -78174,18 +78141,18 @@ var config27 = {
78174
78141
  deployScript: "deploy",
78175
78142
  previewScript: "preview"
78176
78143
  };
78177
- var c3_default37 = config27;
78144
+ var c3_default39 = config29;
78178
78145
 
78179
78146
  // templates/svelte/c3.ts
78180
78147
  var import_node_fs3 = require("node:fs");
78181
78148
  var import_node_os4 = require("node:os");
78182
78149
  var recast13 = __toESM(require_main3());
78183
- var { npm: npm21 } = detectPackageManager();
78184
- var generate26 = async (ctx) => {
78150
+ var { npm: npm20 } = detectPackageManager();
78151
+ var generate25 = async (ctx) => {
78185
78152
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
78186
78153
  logRaw("");
78187
78154
  };
78188
- var configure20 = async (ctx) => {
78155
+ var configure19 = async (ctx) => {
78189
78156
  const pkg = `@sveltejs/adapter-cloudflare`;
78190
78157
  await installPackages([pkg], {
78191
78158
  dev: true,
@@ -78267,7 +78234,7 @@ var updateTypeDefinitions2 = (ctx) => {
78267
78234
  }
78268
78235
  });
78269
78236
  };
78270
- var config28 = {
78237
+ var config30 = {
78271
78238
  configVersion: 1,
78272
78239
  id: "svelte",
78273
78240
  frameworkCli: "sv",
@@ -78276,12 +78243,12 @@ var config28 = {
78276
78243
  copyFiles: {
78277
78244
  path: "./templates"
78278
78245
  },
78279
- generate: generate26,
78280
- configure: configure20,
78246
+ generate: generate25,
78247
+ configure: configure19,
78281
78248
  transformPackageJson: async (original, ctx) => {
78282
78249
  let scripts = {
78283
- preview: `${npm21} run build && wrangler pages dev`,
78284
- deploy: `${npm21} run build && wrangler pages deploy`
78250
+ preview: `${npm20} run build && wrangler pages dev`,
78251
+ deploy: `${npm20} run build && wrangler pages deploy`
78285
78252
  };
78286
78253
  if (usesTypescript(ctx)) {
78287
78254
  const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
@@ -78296,37 +78263,120 @@ var config28 = {
78296
78263
  deployScript: "deploy",
78297
78264
  previewScript: "preview"
78298
78265
  };
78299
- var c3_default38 = config28;
78266
+ var c3_default40 = config30;
78300
78267
 
78301
- // templates/vue/c3.ts
78302
- var { npm: npm22 } = detectPackageManager();
78303
- var generate27 = async (ctx) => {
78268
+ // templates/vue/pages/c3.ts
78269
+ var { npm: npm21 } = detectPackageManager();
78270
+ var generate26 = async (ctx) => {
78304
78271
  await runFrameworkGenerator(ctx, [ctx.project.name]);
78305
78272
  };
78306
- var config29 = {
78273
+ var config31 = {
78307
78274
  configVersion: 1,
78308
78275
  id: "vue",
78309
78276
  frameworkCli: "create-vue",
78310
78277
  displayName: "Vue",
78311
78278
  platform: "pages",
78312
- generate: generate27,
78279
+ path: "templates/pages/vue",
78280
+ generate: generate26,
78313
78281
  transformPackageJson: async () => ({
78314
78282
  scripts: {
78315
- deploy: `${npm22} run build && wrangler pages deploy ./dist`,
78316
- preview: `${npm22} run build && wrangler pages dev ./dist`
78283
+ deploy: `${npm21} run build && wrangler pages deploy ./dist`,
78284
+ preview: `${npm21} run build && wrangler pages dev ./dist`
78317
78285
  }
78318
78286
  }),
78319
78287
  devScript: "dev",
78320
78288
  deployScript: "deploy",
78321
78289
  previewScript: "preview"
78322
78290
  };
78323
- var c3_default39 = config29;
78291
+ var c3_default41 = config31;
78292
+
78293
+ // templates/vue/workers/c3.ts
78294
+ var { npm: npm22 } = detectPackageManager();
78295
+ var generate27 = async (ctx) => {
78296
+ const lang = ctx.args.lang ?? await inputPrompt({
78297
+ type: "select",
78298
+ question: "Would you like to use TypeScript?",
78299
+ label: "Language",
78300
+ options: [
78301
+ { label: "TypeScript", value: "ts" },
78302
+ { label: "JavaScript", value: "js" }
78303
+ ]
78304
+ });
78305
+ await runFrameworkGenerator(ctx, [
78306
+ ctx.project.name,
78307
+ "--router",
78308
+ lang === "ts" ? "--ts" : ""
78309
+ ]);
78310
+ logRaw("");
78311
+ };
78312
+ var configure20 = async (ctx) => {
78313
+ await installPackages(["@cloudflare/vite-plugin"], {
78314
+ dev: true,
78315
+ startText: "Installing the Cloudflare Vite plugin",
78316
+ doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
78317
+ });
78318
+ if (usesTypescript(ctx)) {
78319
+ updateTsconfigJson2();
78320
+ }
78321
+ };
78322
+ function updateTsconfigJson2() {
78323
+ const s = spinner();
78324
+ s.start(`Updating tsconfig.json config`);
78325
+ const tsconfig = readJSON("tsconfig.json");
78326
+ if (tsconfig && typeof tsconfig === "object") {
78327
+ tsconfig.references ??= [];
78328
+ tsconfig.references.push({ path: "./tsconfig.worker.json" });
78329
+ }
78330
+ writeJSON("tsconfig.json", tsconfig);
78331
+ s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
78332
+ }
78333
+ var config32 = {
78334
+ configVersion: 1,
78335
+ id: "vue",
78336
+ frameworkCli: "create-vue",
78337
+ platform: "workers",
78338
+ displayName: "Vue",
78339
+ path: "templates/vue/workers",
78340
+ copyFiles: {
78341
+ async selectVariant(ctx) {
78342
+ return usesTypescript(ctx) ? "ts" : "js";
78343
+ },
78344
+ variants: {
78345
+ ts: {
78346
+ path: "./ts"
78347
+ },
78348
+ js: {
78349
+ path: "./js"
78350
+ }
78351
+ }
78352
+ },
78353
+ configure: configure20,
78354
+ generate: generate27,
78355
+ transformPackageJson: async (_3, ctx) => ({
78356
+ scripts: {
78357
+ deploy: `${npm22} run build && wrangler deploy`,
78358
+ preview: `${npm22} run build && wrangler dev`,
78359
+ ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
78360
+ }
78361
+ }),
78362
+ devScript: "dev",
78363
+ deployScript: "deploy",
78364
+ previewScript: "preview"
78365
+ };
78366
+ var c3_default42 = config32;
78367
+
78368
+ // templates/vue/c3.ts
78369
+ var config33 = {
78370
+ displayName: "Vue",
78371
+ platformVariants: { pages: c3_default41, workers: c3_default42 }
78372
+ };
78373
+ var c3_default43 = config33;
78324
78374
 
78325
78375
  // src/git.ts
78326
78376
  var import_node_assert = __toESM(require("node:assert"));
78327
78377
 
78328
78378
  // ../wrangler/package.json
78329
- var version2 = "3.114.0";
78379
+ var version2 = "3.114.1";
78330
78380
 
78331
78381
  // src/git.ts
78332
78382
  var offerGit = async (ctx) => {
@@ -78587,53 +78637,49 @@ var defaultSelectVariant = async (ctx) => {
78587
78637
  function getFrameworkMap({ experimental = false }) {
78588
78638
  if (experimental) {
78589
78639
  return {
78590
- angular: c3_default,
78591
- astro: c3_default2,
78592
- gatsby: c3_default3,
78593
- hono: c3_default7,
78594
- next: c3_default8,
78595
- nuxt: c3_default9,
78596
- qwik: c3_default10,
78597
- remix: c3_default11,
78598
- solid: c3_default12,
78599
- svelte: c3_default13,
78600
- vue: c3_default14
78640
+ astro: c3_default,
78641
+ hono: c3_default5,
78642
+ next: c3_default6,
78643
+ qwik: c3_default7,
78644
+ remix: c3_default8,
78645
+ solid: c3_default9,
78646
+ svelte: c3_default10
78601
78647
  };
78602
78648
  } else {
78603
78649
  return {
78604
- analog: c3_default15,
78605
- angular: c3_default16,
78606
- astro: c3_default17,
78607
- docusaurus: c3_default21,
78650
+ analog: c3_default11,
78651
+ angular: c3_default14,
78652
+ astro: c3_default15,
78653
+ docusaurus: c3_default19,
78608
78654
  gatsby: c3_default22,
78609
78655
  hono: c3_default25,
78610
78656
  next: c3_default26,
78611
- nuxt: c3_default27,
78612
- qwik: c3_default31,
78613
- react: c3_default34,
78614
- remix: c3_default35,
78615
- solid: c3_default37,
78616
- svelte: c3_default38,
78617
- vue: c3_default39
78657
+ nuxt: c3_default29,
78658
+ qwik: c3_default33,
78659
+ react: c3_default36,
78660
+ remix: c3_default37,
78661
+ solid: c3_default39,
78662
+ svelte: c3_default40,
78663
+ vue: c3_default43
78618
78664
  };
78619
78665
  }
78620
78666
  }
78621
78667
  function getTemplateMap({ experimental = false }) {
78622
78668
  if (experimental) {
78623
78669
  return {
78624
- "hello-world-assets-only": c3_default4,
78625
- "hello-world-with-assets": c3_default6,
78626
- "hello-world-durable-object-with-assets": c3_default5
78670
+ "hello-world-assets-only": c3_default2,
78671
+ "hello-world-with-assets": c3_default4,
78672
+ "hello-world-durable-object-with-assets": c3_default3
78627
78673
  };
78628
78674
  } else {
78629
78675
  return {
78630
78676
  "hello-world": c3_default24,
78631
- common: c3_default18,
78632
- scheduled: c3_default36,
78633
- queues: c3_default30,
78677
+ common: c3_default16,
78678
+ scheduled: c3_default38,
78679
+ queues: c3_default32,
78634
78680
  "hello-world-durable-object": c3_default23,
78635
- openapi: c3_default28,
78636
- "pre-existing": c3_default29
78681
+ openapi: c3_default30,
78682
+ "pre-existing": c3_default31
78637
78683
  };
78638
78684
  }
78639
78685
  }
@@ -78781,8 +78827,8 @@ var createContext = async (args, prevArgs) => {
78781
78827
  experimental: args.experimental
78782
78828
  });
78783
78829
  const frameworkOptions = Object.entries(frameworkMap).map(
78784
- ([key, config30]) => ({
78785
- label: config30.displayName,
78830
+ ([key, config34]) => ({
78831
+ label: config34.displayName,
78786
78832
  value: key
78787
78833
  })
78788
78834
  );
@@ -78949,28 +78995,28 @@ var processRemoteTemplate = async (args) => {
78949
78995
  src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
78950
78996
  }
78951
78997
  const path6 = await downloadRemoteTemplate(src);
78952
- const config30 = inferTemplateConfig(path6);
78953
- validateTemplate(path6, config30);
78998
+ const config34 = inferTemplateConfig(path6);
78999
+ validateTemplate(path6, config34);
78954
79000
  updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
78955
79001
  return {
78956
79002
  path: path6,
78957
- ...config30
79003
+ ...config34
78958
79004
  };
78959
79005
  };
78960
- var validateTemplate = (path6, config30) => {
78961
- if (!config30.copyFiles) {
79006
+ var validateTemplate = (path6, config34) => {
79007
+ if (!config34.copyFiles) {
78962
79008
  return;
78963
79009
  }
78964
- if (isVariantInfo(config30.copyFiles)) {
78965
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config30.copyFiles.path), config30);
79010
+ if (isVariantInfo(config34.copyFiles)) {
79011
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config34.copyFiles.path), config34);
78966
79012
  } else {
78967
- for (const variant of Object.values(config30.copyFiles.variants)) {
78968
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config30);
79013
+ for (const variant of Object.values(config34.copyFiles.variants)) {
79014
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config34);
78969
79015
  }
78970
79016
  }
78971
79017
  };
78972
- var validateTemplateSrcDirectory = (path6, config30) => {
78973
- if (config30.platform === "workers") {
79018
+ var validateTemplateSrcDirectory = (path6, config34) => {
79019
+ if (config34.platform === "workers") {
78974
79020
  const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
78975
79021
  const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
78976
79022
  const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
@@ -79079,13 +79125,19 @@ var addWranglerToGitIgnore = (ctx) => {
79079
79125
  writeFile2(gitIgnorePath, "");
79080
79126
  }
79081
79127
  const existingGitIgnoreContent = readFile(gitIgnorePath);
79082
- const wranglerGitIgnoreFiles = [".wrangler", ".dev.vars"];
79083
- const wranglerGitIgnoreFilesToAdd = wranglerGitIgnoreFiles.filter(
79084
- (file) => !existingGitIgnoreContent.match(
79085
- new RegExp(`
79086
- ${file}${file === ".wrangler" ? "/?" : ""}\\s+(#'*)?`)
79087
- )
79128
+ const wranglerGitIgnoreFilesToAdd = [];
79129
+ const hasDotWrangler = existingGitIgnoreContent.match(
79130
+ /^\/?\.wrangler(\/|\s|$)/m
79131
+ );
79132
+ if (!hasDotWrangler) {
79133
+ wranglerGitIgnoreFilesToAdd.push(".wrangler");
79134
+ }
79135
+ const hasDotDevDotVars = existingGitIgnoreContent.match(
79136
+ /^\/?\.dev\.vars(\.?\*)?(\s|$)/m
79088
79137
  );
79138
+ if (!hasDotDevDotVars) {
79139
+ wranglerGitIgnoreFilesToAdd.push(".dev.vars*");
79140
+ }
79089
79141
  if (wranglerGitIgnoreFilesToAdd.length === 0) {
79090
79142
  return;
79091
79143
  }
@@ -79095,7 +79147,7 @@ ${file}${file === ".wrangler" ? "/?" : ""}\\s+(#'*)?`)
79095
79147
  "",
79096
79148
  ...!existingGitIgnoreContent.match(/\n\s*$/) ? [""] : []
79097
79149
  ];
79098
- if (wranglerGitIgnoreFilesToAdd.length === wranglerGitIgnoreFiles.length) {
79150
+ if (wranglerGitIgnoreFilesToAdd.length > 1) {
79099
79151
  linesToAppend.push("# wrangler files");
79100
79152
  }
79101
79153
  wranglerGitIgnoreFilesToAdd.forEach((line) => linesToAppend.push(line));
@@ -80867,20 +80919,20 @@ function applyEdits(text, edits) {
80867
80919
  var import_fs12 = require("fs");
80868
80920
  var import_path14 = require("path");
80869
80921
  var import_toml2 = __toESM(require_toml());
80870
- function ensureNameExists(config30, projectName) {
80871
- config30["name"] = projectName;
80872
- return config30;
80922
+ function ensureNameExists(config34, projectName) {
80923
+ config34["name"] = projectName;
80924
+ return config34;
80873
80925
  }
80874
- async function ensureCompatDateExists(config30) {
80875
- if (typeof config30["compatibility_date"] === "string") {
80926
+ async function ensureCompatDateExists(config34) {
80927
+ if (typeof config34["compatibility_date"] === "string") {
80876
80928
  const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
80877
- if (!config30["compatibility_date"].match(validCompatDateRe)) {
80878
- config30["compatibility_date"] = await getWorkerdCompatibilityDate();
80929
+ if (!config34["compatibility_date"].match(validCompatDateRe)) {
80930
+ config34["compatibility_date"] = await getWorkerdCompatibilityDate();
80879
80931
  }
80880
80932
  } else {
80881
- config30["compatibility_date"] = await getWorkerdCompatibilityDate();
80933
+ config34["compatibility_date"] = await getWorkerdCompatibilityDate();
80882
80934
  }
80883
- return config30;
80935
+ return config34;
80884
80936
  }
80885
80937
  var updateWranglerConfig = async (ctx) => {
80886
80938
  if (wranglerJsonExists(ctx)) {
@@ -81594,8 +81646,8 @@ var renderValues = (values) => {
81594
81646
  };
81595
81647
 
81596
81648
  // src/helpers/retry.ts
81597
- var retry = async (config30, fn) => {
81598
- let { times } = config30;
81649
+ var retry = async (config34, fn) => {
81650
+ let { times } = config34;
81599
81651
  let error2 = null;
81600
81652
  while (times > 0) {
81601
81653
  try {
@@ -81603,10 +81655,10 @@ var retry = async (config30, fn) => {
81603
81655
  } catch (e) {
81604
81656
  error2 = e;
81605
81657
  times--;
81606
- if (config30.exitCondition?.(e)) {
81658
+ if (config34.exitCondition?.(e)) {
81607
81659
  break;
81608
81660
  }
81609
- await sleep(config30.sleepMs ?? 1e3);
81661
+ await sleep(config34.sleepMs ?? 1e3);
81610
81662
  }
81611
81663
  }
81612
81664
  throw error2;
@@ -81726,8 +81778,8 @@ async function addWorkersTypesToTsConfig(ctx) {
81726
81778
  }
81727
81779
  const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
81728
81780
  try {
81729
- const config30 = parse4(tsconfig);
81730
- const currentTypes = config30.compilerOptions?.types ?? [];
81781
+ const config34 = parse4(tsconfig);
81782
+ const currentTypes = config34.compilerOptions?.types ?? [];
81731
81783
  const explicitEntrypoint = currentTypes.some(
81732
81784
  (t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
81733
81785
  );