create-cloudflare 2.41.2 → 2.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cli.js +876 -861
  2. package/package.json +5 -5
  3. package/templates/astro/c3.ts +5 -93
  4. package/templates/astro/pages/c3.ts +98 -0
  5. package/{templates-experimental/astro → templates/astro/workers}/c3.ts +2 -2
  6. package/templates/astro/workers/templates/js/public/.assetsignore +2 -0
  7. package/templates/astro/workers/templates/ts/public/.assetsignore +2 -0
  8. package/templates/hello-world-durable-object/js/src/index.js +10 -9
  9. package/templates/hello-world-durable-object/js/wrangler.jsonc +1 -1
  10. package/templates/hello-world-durable-object/ts/src/index.ts +10 -9
  11. package/templates/hello-world-durable-object/ts/wrangler.jsonc +1 -1
  12. package/templates/hono/c3.ts +5 -66
  13. package/templates/hono/pages/c3.ts +42 -0
  14. package/templates/hono/pages/templates/src/index.tsx +12 -0
  15. package/templates/hono/{templates → pages/templates}/wrangler.jsonc +2 -1
  16. package/{templates-experimental/hono → templates/hono/workers}/c3.ts +2 -4
  17. package/templates/qwik/c3.ts +5 -144
  18. package/templates/qwik/pages/c3.ts +149 -0
  19. package/{templates-experimental/qwik → templates/qwik/workers}/c3.ts +2 -2
  20. package/templates/remix/c3.ts +5 -63
  21. package/templates/remix/pages/c3.ts +68 -0
  22. package/{templates-experimental/remix → templates/remix/workers}/c3.ts +2 -2
  23. package/templates/svelte/c3.ts +5 -154
  24. package/templates/svelte/pages/c3.ts +159 -0
  25. package/{templates-experimental/svelte → templates/svelte/workers}/c3.ts +3 -3
  26. package/templates/svelte/workers/templates/static/.assetsignore +2 -0
  27. package/templates/hono/snippets/appDeclaration.ts +0 -1
  28. package/templates-experimental/astro/templates/ts/public/.assetsignore +0 -4
  29. package/templates-experimental/qwik/templates/public/.assetsignore +0 -4
  30. package/templates-experimental/svelte/templates/static/.assetsignore +0 -4
  31. /package/templates/astro/{templates → pages/templates}/js/wrangler.jsonc +0 -0
  32. /package/{templates-experimental/astro → templates/astro/pages}/templates/ts/src/env.d.ts +0 -0
  33. /package/{templates-experimental/astro → templates/astro/pages}/templates/ts/worker-configuration.d.ts +0 -0
  34. /package/templates/astro/{templates → pages/templates}/ts/wrangler.jsonc +0 -0
  35. /package/{templates-experimental/astro → templates/astro/workers}/templates/js/wrangler.jsonc +0 -0
  36. /package/templates/astro/{templates → workers/templates}/ts/src/env.d.ts +0 -0
  37. /package/{templates-experimental/qwik/templates → templates/astro/workers/templates/ts}/worker-configuration.d.ts +0 -0
  38. /package/{templates-experimental/astro → templates/astro/workers}/templates/ts/wrangler.jsonc +0 -0
  39. /package/{templates-experimental/hono → templates/hono/pages}/templates/worker-configuration.d.ts +0 -0
  40. /package/{templates-experimental/hono → templates/hono/workers}/templates/public/index.html +0 -0
  41. /package/{templates-experimental/hono → templates/hono/workers}/templates/src/index.ts +0 -0
  42. /package/templates/hono/{templates → workers/templates}/worker-configuration.d.ts +0 -0
  43. /package/{templates-experimental/hono → templates/hono/workers}/templates/wrangler.jsonc +0 -0
  44. /package/{templates-experimental/qwik → templates/qwik/pages}/snippets/getPlatformProxy.ts +0 -0
  45. /package/templates/{astro/templates/ts → qwik/pages/templates}/worker-configuration.d.ts +0 -0
  46. /package/templates/qwik/{templates → pages/templates}/wrangler.jsonc +0 -0
  47. /package/templates/qwik/{snippets → workers/snippets}/getPlatformProxy.ts +0 -0
  48. /package/{templates-experimental/astro/templates/js → templates/qwik/workers/templates}/public/.assetsignore +0 -0
  49. /package/templates/qwik/{templates → workers/templates}/worker-configuration.d.ts +0 -0
  50. /package/{templates-experimental/qwik → templates/qwik/workers}/templates/wrangler.jsonc +0 -0
  51. /package/templates/remix/{templates → pages/templates}/worker-configuration.d.ts +0 -0
  52. /package/templates/remix/{templates → pages/templates}/wrangler.jsonc +0 -0
  53. /package/{templates-experimental/remix → templates/remix/workers}/templates/public/.assetsignore +0 -0
  54. /package/{templates-experimental/remix → templates/remix/workers}/templates/worker-configuration.d.ts +0 -0
  55. /package/{templates-experimental/remix → templates/remix/workers}/templates/wrangler.toml +0 -0
  56. /package/templates/svelte/{templates → pages/templates}/wrangler.jsonc +0 -0
  57. /package/{templates-experimental/svelte → templates/svelte/workers}/templates/wrangler.jsonc +0 -0
package/dist/cli.js CHANGED
@@ -568,7 +568,7 @@ var require_XDGAppPaths = __commonJS({
568
568
  XDGAppPaths.cache = function cache(dirOptions) {
569
569
  return path6.join(xdg.cache(), finalPathSegment(dirOptions));
570
570
  };
571
- XDGAppPaths.config = function config34(dirOptions) {
571
+ XDGAppPaths.config = function config39(dirOptions) {
572
572
  return path6.join(xdg.config(), finalPathSegment(dirOptions));
573
573
  };
574
574
  XDGAppPaths.data = function data(dirOptions) {
@@ -625,7 +625,7 @@ var require_XDG = __commonJS({
625
625
  var cache = function() {
626
626
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
627
627
  };
628
- var config34 = function() {
628
+ var config39 = function() {
629
629
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
630
630
  };
631
631
  var data = function() {
@@ -637,13 +637,13 @@ var require_XDG = __commonJS({
637
637
  var state = function() {
638
638
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
639
639
  };
640
- return { cache, config: config34, data, runtime, state };
640
+ return { cache, config: config39, data, runtime, state };
641
641
  };
642
642
  var macos = function() {
643
643
  var cache = function() {
644
644
  return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
645
645
  };
646
- var config34 = function() {
646
+ var config39 = function() {
647
647
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
648
648
  };
649
649
  var data = function() {
@@ -655,7 +655,7 @@ var require_XDG = __commonJS({
655
655
  var state = function() {
656
656
  return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
657
657
  };
658
- return { cache, config: config34, data, runtime, state };
658
+ return { cache, config: config39, data, runtime, state };
659
659
  };
660
660
  var windows = function() {
661
661
  function appData() {
@@ -667,7 +667,7 @@ var require_XDG = __commonJS({
667
667
  var cache = function() {
668
668
  return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
669
669
  };
670
- var config34 = function() {
670
+ var config39 = function() {
671
671
  return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
672
672
  };
673
673
  var data = function() {
@@ -679,7 +679,7 @@ var require_XDG = __commonJS({
679
679
  var state = function() {
680
680
  return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
681
681
  };
682
- return { cache, config: config34, data, runtime, state };
682
+ return { cache, config: config39, data, runtime, state };
683
683
  };
684
684
  var XDG_ = /* @__PURE__ */ function() {
685
685
  function XDG_2() {
@@ -31509,21 +31509,21 @@ var require_dist_web = __commonJS({
31509
31509
  _createClass(Haikunator3, [{
31510
31510
  key: "haikunate",
31511
31511
  value: function haikunate(options) {
31512
- var config34 = (0, _lodash["default"])(options, this.config);
31513
- if (config34.tokenHex === true) {
31514
- config34.tokenChars = "0123456789abcdef";
31512
+ var config39 = (0, _lodash["default"])(options, this.config);
31513
+ if (config39.tokenHex === true) {
31514
+ config39.tokenChars = "0123456789abcdef";
31515
31515
  }
31516
31516
  var adjective = this._randomElement(this.adjectives);
31517
31517
  var noun = this._randomElement(this.nouns);
31518
- if (!config34.tokenLength) config34.tokenLength = 0;
31518
+ if (!config39.tokenLength) config39.tokenLength = 0;
31519
31519
  var token = "";
31520
- for (var i = 0; i < config34.tokenLength; i++) {
31521
- token += this._randomElement(config34.tokenChars);
31520
+ for (var i = 0; i < config39.tokenLength; i++) {
31521
+ token += this._randomElement(config39.tokenChars);
31522
31522
  }
31523
31523
  var sections = [adjective, noun, token];
31524
31524
  return sections.filter(function(e) {
31525
31525
  return !!e;
31526
- }).join(config34.delimiter);
31526
+ }).join(config39.delimiter);
31527
31527
  }
31528
31528
  /**
31529
31529
  * Get a random element from an array/string
@@ -40036,13 +40036,13 @@ var require_esprima = __commonJS({
40036
40036
  return Reader2;
40037
40037
  }();
40038
40038
  var Tokenizer = function() {
40039
- function Tokenizer2(code, config34) {
40039
+ function Tokenizer2(code, config39) {
40040
40040
  this.errorHandler = new error_handler_1.ErrorHandler();
40041
- this.errorHandler.tolerant = config34 ? typeof config34.tolerant === "boolean" && config34.tolerant : false;
40041
+ this.errorHandler.tolerant = config39 ? typeof config39.tolerant === "boolean" && config39.tolerant : false;
40042
40042
  this.scanner = new scanner_1.Scanner(code, this.errorHandler);
40043
- this.scanner.trackComment = config34 ? typeof config34.comment === "boolean" && config34.comment : false;
40044
- this.trackRange = config34 ? typeof config34.range === "boolean" && config34.range : false;
40045
- this.trackLoc = config34 ? typeof config34.loc === "boolean" && config34.loc : false;
40043
+ this.scanner.trackComment = config39 ? typeof config39.comment === "boolean" && config39.comment : false;
40044
+ this.trackRange = config39 ? typeof config39.range === "boolean" && config39.range : false;
40045
+ this.trackLoc = config39 ? typeof config39.loc === "boolean" && config39.loc : false;
40046
40046
  this.buffer = [];
40047
40047
  this.reader = new Reader();
40048
40048
  }
@@ -49803,11 +49803,11 @@ var require_printer = __commonJS({
49803
49803
  return this.code;
49804
49804
  };
49805
49805
  var emptyPrintResult = new PrintResult("");
49806
- var Printer = function Printer2(config34) {
49806
+ var Printer = function Printer2(config39) {
49807
49807
  assert_1.default.ok(this instanceof Printer2);
49808
- var explicitTabWidth = config34 && config34.tabWidth;
49809
- config34 = options_1.normalize(config34);
49810
- config34.sourceFileName = null;
49808
+ var explicitTabWidth = config39 && config39.tabWidth;
49809
+ config39 = options_1.normalize(config39);
49810
+ config39.sourceFileName = null;
49811
49811
  function makePrintFunctionWith(options, overrides) {
49812
49812
  options = Object.assign({}, options, overrides);
49813
49813
  return function(path6) {
@@ -49822,11 +49822,11 @@ var require_printer = __commonJS({
49822
49822
  includeComments: false
49823
49823
  }));
49824
49824
  }
49825
- var oldTabWidth = config34.tabWidth;
49825
+ var oldTabWidth = config39.tabWidth;
49826
49826
  if (!explicitTabWidth) {
49827
49827
  var loc = path6.getNode().loc;
49828
49828
  if (loc && loc.lines && loc.lines.guessTabWidth) {
49829
- config34.tabWidth = loc.lines.guessTabWidth();
49829
+ config39.tabWidth = loc.lines.guessTabWidth();
49830
49830
  }
49831
49831
  }
49832
49832
  var reprinter = patcher_1.getReprinter(path6);
@@ -49840,11 +49840,11 @@ var require_printer = __commonJS({
49840
49840
  // right choice because it gives us the opportunity to reprint
49841
49841
  // such nodes using their original source.
49842
49842
  reprinter(print2)
49843
- ) : genericPrint(path6, config34, options, makePrintFunctionWith(options, {
49843
+ ) : genericPrint(path6, config39, options, makePrintFunctionWith(options, {
49844
49844
  includeComments: true,
49845
49845
  avoidRootParens: false
49846
49846
  }));
49847
- config34.tabWidth = oldTabWidth;
49847
+ config39.tabWidth = oldTabWidth;
49848
49848
  return lines;
49849
49849
  }
49850
49850
  this.print = function(ast) {
@@ -49855,7 +49855,7 @@ var require_printer = __commonJS({
49855
49855
  includeComments: true,
49856
49856
  avoidRootParens: false
49857
49857
  });
49858
- return new PrintResult(lines.toString(config34), util.composeSourceMaps(config34.inputSourceMap, lines.getSourceMap(config34.sourceMapName, config34.sourceRoot)));
49858
+ return new PrintResult(lines.toString(config39), util.composeSourceMaps(config39.inputSourceMap, lines.getSourceMap(config39.sourceMapName, config39.sourceRoot)));
49859
49859
  };
49860
49860
  this.printGenerically = function(ast) {
49861
49861
  if (!ast) {
@@ -49863,26 +49863,26 @@ var require_printer = __commonJS({
49863
49863
  }
49864
49864
  function printGenerically(path7) {
49865
49865
  return comments_1.printComments(path7, function(path8) {
49866
- return genericPrint(path8, config34, {
49866
+ return genericPrint(path8, config39, {
49867
49867
  includeComments: true,
49868
49868
  avoidRootParens: false
49869
49869
  }, printGenerically);
49870
49870
  });
49871
49871
  }
49872
49872
  var path6 = fast_path_1.default.from(ast);
49873
- var oldReuseWhitespace = config34.reuseWhitespace;
49874
- config34.reuseWhitespace = false;
49875
- var pr = new PrintResult(printGenerically(path6).toString(config34));
49876
- config34.reuseWhitespace = oldReuseWhitespace;
49873
+ var oldReuseWhitespace = config39.reuseWhitespace;
49874
+ config39.reuseWhitespace = false;
49875
+ var pr = new PrintResult(printGenerically(path6).toString(config39));
49876
+ config39.reuseWhitespace = oldReuseWhitespace;
49877
49877
  return pr;
49878
49878
  };
49879
49879
  };
49880
49880
  exports2.Printer = Printer;
49881
- function genericPrint(path6, config34, options, printPath) {
49881
+ function genericPrint(path6, config39, options, printPath) {
49882
49882
  assert_1.default.ok(path6 instanceof fast_path_1.default);
49883
49883
  var node = path6.getValue();
49884
49884
  var parts = [];
49885
- var linesWithoutParens = genericPrintNoParens(path6, config34, printPath);
49885
+ var linesWithoutParens = genericPrintNoParens(path6, config39, printPath);
49886
49886
  if (!node || linesWithoutParens.isEmpty()) {
49887
49887
  return linesWithoutParens;
49888
49888
  }
@@ -69380,33 +69380,33 @@ var inputPrompt = async (promptConfig) => {
69380
69380
  }
69381
69381
  return input;
69382
69382
  };
69383
- var renderSubmit = (config34, value) => {
69384
- const { question, label } = config34;
69385
- if (config34.type !== "confirm" && !value) {
69383
+ var renderSubmit = (config39, value) => {
69384
+ const { question, label } = config39;
69385
+ if (config39.type !== "confirm" && !value) {
69386
69386
  return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
69387
69387
  }
69388
- const content = config34.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69388
+ const content = config39.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
69389
69389
  return [`${leftT} ${question}`, content, `${grayBar}`];
69390
69390
  };
69391
- var getRenderers = (config34) => {
69392
- switch (config34.type) {
69391
+ var getRenderers = (config39) => {
69392
+ switch (config39.type) {
69393
69393
  case "select":
69394
- return getSelectRenderers(config34);
69394
+ return getSelectRenderers(config39);
69395
69395
  case "confirm":
69396
- return getConfirmRenderers(config34);
69396
+ return getConfirmRenderers(config39);
69397
69397
  case "text":
69398
- return getTextRenderers(config34);
69398
+ return getTextRenderers(config39);
69399
69399
  case "multiselect":
69400
- return getSelectRenderers(config34);
69400
+ return getSelectRenderers(config39);
69401
69401
  case "list":
69402
- return getSelectListRenderers(config34);
69402
+ return getSelectListRenderers(config39);
69403
69403
  }
69404
69404
  };
69405
- var getTextRenderers = (config34) => {
69406
- const { question } = config34;
69407
- const helpText = config34.helpText ?? "";
69408
- const format5 = config34.format ?? ((val) => String(val));
69409
- const defaultValue = config34.defaultValue?.toString() ?? "";
69405
+ var getTextRenderers = (config39) => {
69406
+ const { question } = config39;
69407
+ const helpText = config39.helpText ?? "";
69408
+ const format5 = config39.format ?? ((val) => String(val));
69409
+ const defaultValue = config39.defaultValue?.toString() ?? "";
69410
69410
  const activeRenderer = ({ value }) => [
69411
69411
  `${blCorner} ${bold(question)} ${dim(helpText)}`,
69412
69412
  `${space(2)}${format5(value || dim(defaultValue))}`,
@@ -69429,14 +69429,14 @@ var getTextRenderers = (config34) => {
69429
69429
  ``
69430
69430
  // extra line for readability
69431
69431
  ],
69432
- submit: ({ value }) => renderSubmit(config34, format5(value ?? "")),
69432
+ submit: ({ value }) => renderSubmit(config39, format5(value ?? "")),
69433
69433
  cancel: activeRenderer
69434
69434
  };
69435
69435
  };
69436
- var getSelectRenderers = (config34) => {
69437
- const { options, question, helpText: _helpText } = config34;
69436
+ var getSelectRenderers = (config39) => {
69437
+ const { options, question, helpText: _helpText } = config39;
69438
69438
  const helpText = _helpText ?? "";
69439
- const maxItemsPerPage = config34.maxItemsPerPage ?? 32;
69439
+ const maxItemsPerPage = config39.maxItemsPerPage ?? 32;
69440
69440
  const defaultRenderer = ({ cursor = 0, value }) => {
69441
69441
  const renderOption = (opt, i) => {
69442
69442
  const { label: optionLabel, value: optionValue } = opt;
@@ -69511,21 +69511,21 @@ ${space(2)}${dim("...")}` : ""}`,
69511
69511
  submit: ({ value }) => {
69512
69512
  if (Array.isArray(value)) {
69513
69513
  return renderSubmit(
69514
- config34,
69514
+ config39,
69515
69515
  options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
69516
69516
  );
69517
69517
  }
69518
69518
  return renderSubmit(
69519
- config34,
69519
+ config39,
69520
69520
  options.find((o) => o.value === value)?.label
69521
69521
  );
69522
69522
  },
69523
69523
  cancel: defaultRenderer
69524
69524
  };
69525
69525
  };
69526
- var getSelectListRenderers = (config34) => {
69527
- const { question, helpText: _helpText } = config34;
69528
- let options = config34.options;
69526
+ var getSelectListRenderers = (config39) => {
69527
+ const { question, helpText: _helpText } = config39;
69528
+ let options = config39.options;
69529
69529
  const helpText = _helpText ?? "";
69530
69530
  const { rows } = stdout;
69531
69531
  const defaultRenderer = ({ cursor, value }, prompt) => {
@@ -69606,20 +69606,20 @@ var getSelectListRenderers = (config34) => {
69606
69606
  submit: ({ value }) => {
69607
69607
  if (Array.isArray(value)) {
69608
69608
  return renderSubmit(
69609
- config34,
69609
+ config39,
69610
69610
  options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
69611
69611
  );
69612
69612
  }
69613
69613
  return renderSubmit(
69614
- config34,
69614
+ config39,
69615
69615
  options.find((o) => o.value === value)?.value
69616
69616
  );
69617
69617
  },
69618
69618
  cancel: defaultRenderer
69619
69619
  };
69620
69620
  };
69621
- var getConfirmRenderers = (config34) => {
69622
- const { activeText, inactiveText, question, helpText: _helpText } = config34;
69621
+ var getConfirmRenderers = (config39) => {
69622
+ const { activeText, inactiveText, question, helpText: _helpText } = config39;
69623
69623
  const helpText = _helpText ?? "";
69624
69624
  const active = activeText || "Yes";
69625
69625
  const inactive = inactiveText || "No";
@@ -69636,7 +69636,7 @@ var getConfirmRenderers = (config34) => {
69636
69636
  active: defaultRenderer,
69637
69637
  confirm: defaultRenderer,
69638
69638
  error: defaultRenderer,
69639
- submit: ({ value }) => renderSubmit(config34, value ? "yes" : "no"),
69639
+ submit: ({ value }) => renderSubmit(config39, value ? "yes" : "no"),
69640
69640
  cancel: defaultRenderer
69641
69641
  };
69642
69642
  };
@@ -70604,23 +70604,23 @@ var YargsParser = class {
70604
70604
  const configPath = argv2[configKey] || configLookup[configKey];
70605
70605
  if (configPath) {
70606
70606
  try {
70607
- let config34 = null;
70607
+ let config39 = null;
70608
70608
  const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
70609
70609
  const resolveConfig = flags.configs[configKey];
70610
70610
  if (typeof resolveConfig === "function") {
70611
70611
  try {
70612
- config34 = resolveConfig(resolvedConfigPath);
70612
+ config39 = resolveConfig(resolvedConfigPath);
70613
70613
  } catch (e) {
70614
- config34 = e;
70614
+ config39 = e;
70615
70615
  }
70616
- if (config34 instanceof Error) {
70617
- error2 = config34;
70616
+ if (config39 instanceof Error) {
70617
+ error2 = config39;
70618
70618
  return;
70619
70619
  }
70620
70620
  } else {
70621
- config34 = mixin2.require(resolvedConfigPath);
70621
+ config39 = mixin2.require(resolvedConfigPath);
70622
70622
  }
70623
- setConfigObject(config34);
70623
+ setConfigObject(config39);
70624
70624
  } catch (ex) {
70625
70625
  if (ex.name === "PermissionDenied")
70626
70626
  error2 = ex;
@@ -70630,9 +70630,9 @@ var YargsParser = class {
70630
70630
  }
70631
70631
  });
70632
70632
  }
70633
- function setConfigObject(config34, prev) {
70634
- Object.keys(config34).forEach(function(key) {
70635
- const value = config34[key];
70633
+ function setConfigObject(config39, prev) {
70634
+ Object.keys(config39).forEach(function(key) {
70635
+ const value = config39[key];
70636
70636
  const fullKey = prev ? prev + "." + key : key;
70637
70637
  if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
70638
70638
  setConfigObject(value, fullKey);
@@ -71784,11 +71784,11 @@ var CommandInstance = class {
71784
71784
  });
71785
71785
  if (!unparsed.length)
71786
71786
  return;
71787
- const config34 = Object.assign({}, options.configuration, {
71787
+ const config39 = Object.assign({}, options.configuration, {
71788
71788
  "populate--": false
71789
71789
  });
71790
71790
  const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
71791
- configuration: config34
71791
+ configuration: config39
71792
71792
  }));
71793
71793
  if (parsed.error) {
71794
71794
  yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
@@ -73011,31 +73011,31 @@ ${customMsgs.join("\n")}` : "";
73011
73011
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
73012
73012
  var previouslyVisitedConfigs = [];
73013
73013
  var shim2;
73014
- function applyExtends(config34, cwd, mergeExtends, _shim) {
73014
+ function applyExtends(config39, cwd, mergeExtends, _shim) {
73015
73015
  shim2 = _shim;
73016
73016
  let defaultConfig = {};
73017
- if (Object.prototype.hasOwnProperty.call(config34, "extends")) {
73018
- if (typeof config34.extends !== "string")
73017
+ if (Object.prototype.hasOwnProperty.call(config39, "extends")) {
73018
+ if (typeof config39.extends !== "string")
73019
73019
  return defaultConfig;
73020
- const isPath = /\.json|\..*rc$/.test(config34.extends);
73020
+ const isPath = /\.json|\..*rc$/.test(config39.extends);
73021
73021
  let pathToDefault = null;
73022
73022
  if (!isPath) {
73023
73023
  try {
73024
- pathToDefault = require.resolve(config34.extends);
73024
+ pathToDefault = require.resolve(config39.extends);
73025
73025
  } catch (_err) {
73026
- return config34;
73026
+ return config39;
73027
73027
  }
73028
73028
  } else {
73029
- pathToDefault = getPathToDefaultConfig(cwd, config34.extends);
73029
+ pathToDefault = getPathToDefaultConfig(cwd, config39.extends);
73030
73030
  }
73031
73031
  checkForCircularExtends(pathToDefault);
73032
73032
  previouslyVisitedConfigs.push(pathToDefault);
73033
- defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config34.extends);
73034
- delete config34.extends;
73033
+ defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config39.extends);
73034
+ delete config39.extends;
73035
73035
  defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
73036
73036
  }
73037
73037
  previouslyVisitedConfigs = [];
73038
- return mergeExtends ? mergeDeep(defaultConfig, config34) : Object.assign({}, defaultConfig, config34);
73038
+ return mergeExtends ? mergeDeep(defaultConfig, config39) : Object.assign({}, defaultConfig, config39);
73039
73039
  }
73040
73040
  function checkForCircularExtends(cfgPath) {
73041
73041
  if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
@@ -73811,9 +73811,9 @@ var YargsInstance = class {
73811
73811
  }
73812
73812
  return maybePromise;
73813
73813
  }
73814
- parserConfiguration(config34) {
73815
- argsert("<object>", [config34], arguments.length);
73816
- __classPrivateFieldSet(this, _YargsInstance_parserConfig, config34, "f");
73814
+ parserConfiguration(config39) {
73815
+ argsert("<object>", [config39], arguments.length);
73816
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config39, "f");
73817
73817
  return this;
73818
73818
  }
73819
73819
  pkgConf(key, rootPath) {
@@ -73985,9 +73985,9 @@ var YargsInstance = class {
73985
73985
  return this;
73986
73986
  }
73987
73987
  }
73988
- usageConfiguration(config34) {
73989
- argsert("<object>", [config34], arguments.length);
73990
- __classPrivateFieldSet(this, _YargsInstance_usageConfig, config34, "f");
73988
+ usageConfiguration(config39) {
73989
+ argsert("<object>", [config39], arguments.length);
73990
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config39, "f");
73991
73991
  return this;
73992
73992
  }
73993
73993
  version(opt, msg, ver) {
@@ -74393,11 +74393,11 @@ var YargsInstance = class {
74393
74393
  __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
74394
74394
  __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
74395
74395
  const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
74396
- const config34 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74396
+ const config39 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
74397
74397
  "populate--": true
74398
74398
  });
74399
74399
  const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
74400
- configuration: { "parse-positional-numbers": false, ...config34 }
74400
+ configuration: { "parse-positional-numbers": false, ...config39 }
74401
74401
  }));
74402
74402
  const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
74403
74403
  let argvPromise = void 0;
@@ -74560,7 +74560,7 @@ var Yargs = YargsFactory(esm_default);
74560
74560
  var yargs_default = Yargs;
74561
74561
 
74562
74562
  // package.json
74563
- var version = "2.41.2";
74563
+ var version = "2.42.1";
74564
74564
 
74565
74565
  // src/metrics.ts
74566
74566
  var import_node_async_hooks = require("node:async_hooks");
@@ -74604,12 +74604,12 @@ function getGlobalWranglerConfigPath() {
74604
74604
  }
74605
74605
 
74606
74606
  // src/helpers/metrics-config.ts
74607
- function writeMetricsConfig(config34) {
74607
+ function writeMetricsConfig(config39) {
74608
74608
  (0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
74609
74609
  (0, import_node_fs2.writeFileSync)(
74610
74610
  getMetricsConfigPath(),
74611
74611
  JSON.stringify(
74612
- config34,
74612
+ config39,
74613
74613
  (_key, value) => value instanceof Date ? value.toISOString() : value,
74614
74614
  " "
74615
74615
  )
@@ -74617,9 +74617,9 @@ function writeMetricsConfig(config34) {
74617
74617
  }
74618
74618
  function readMetricsConfig() {
74619
74619
  try {
74620
- const config34 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
74620
+ const config39 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
74621
74621
  return JSON.parse(
74622
- config34,
74622
+ config39,
74623
74623
  (key, value) => key === "date" ? new Date(value) : value
74624
74624
  );
74625
74625
  } catch {
@@ -74629,10 +74629,10 @@ function readMetricsConfig() {
74629
74629
  function getMetricsConfigPath() {
74630
74630
  return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
74631
74631
  }
74632
- function getDeviceId(config34) {
74633
- const deviceId = config34.deviceId ?? (0, import_node_crypto.randomUUID)();
74634
- if (config34.deviceId === void 0) {
74635
- writeMetricsConfig({ ...config34, deviceId });
74632
+ function getDeviceId(config39) {
74633
+ const deviceId = config39.deviceId ?? (0, import_node_crypto.randomUUID)();
74634
+ if (config39.deviceId === void 0) {
74635
+ writeMetricsConfig({ ...config39, deviceId });
74636
74636
  }
74637
74637
  return deviceId;
74638
74638
  }
@@ -74907,10 +74907,10 @@ function getPlatform() {
74907
74907
  function createReporter() {
74908
74908
  const events = [];
74909
74909
  const als = new import_node_async_hooks.AsyncLocalStorage();
74910
- const config34 = readMetricsConfig() ?? {};
74911
- const isFirstUsage = config34.c3permission === void 0;
74910
+ const config39 = readMetricsConfig() ?? {};
74911
+ const isFirstUsage = config39.c3permission === void 0;
74912
74912
  const isEnabled = isTelemetryEnabled();
74913
- const deviceId = getDeviceId(config34);
74913
+ const deviceId = getDeviceId(config39);
74914
74914
  const packageManager = detectPackageManager();
74915
74915
  const platform3 = getPlatform();
74916
74916
  const amplitude_session_id = Date.now();
@@ -74943,7 +74943,7 @@ function createReporter() {
74943
74943
  if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
74944
74944
  return false;
74945
74945
  }
74946
- return hasSparrowSourceKey() && getC3Permission(config34).enabled;
74946
+ return hasSparrowSourceKey() && getC3Permission(config39).enabled;
74947
74947
  }
74948
74948
  async function waitForAllEventsSettled() {
74949
74949
  await Promise.allSettled(events);
@@ -75049,20 +75049,20 @@ function initializeC3Permission(enabled = true) {
75049
75049
  date: /* @__PURE__ */ new Date()
75050
75050
  };
75051
75051
  }
75052
- function getC3Permission(config34 = readMetricsConfig() ?? {}) {
75053
- if (!config34.c3permission) {
75054
- config34.c3permission = initializeC3Permission();
75055
- writeMetricsConfig(config34);
75052
+ function getC3Permission(config39 = readMetricsConfig() ?? {}) {
75053
+ if (!config39.c3permission) {
75054
+ config39.c3permission = initializeC3Permission();
75055
+ writeMetricsConfig(config39);
75056
75056
  }
75057
- return config34.c3permission;
75057
+ return config39.c3permission;
75058
75058
  }
75059
75059
  function updateC3Pemission(enabled) {
75060
- const config34 = readMetricsConfig();
75061
- if (config34.c3permission?.enabled === enabled) {
75060
+ const config39 = readMetricsConfig();
75061
+ if (config39.c3permission?.enabled === enabled) {
75062
75062
  return;
75063
75063
  }
75064
- config34.c3permission = initializeC3Permission(enabled);
75065
- writeMetricsConfig(config34);
75064
+ config39.c3permission = initializeC3Permission(enabled);
75065
+ writeMetricsConfig(config39);
75066
75066
  }
75067
75067
  var runTelemetryCommand = (action) => {
75068
75068
  const logTelemetryStatus = (enabled) => {
@@ -75107,24 +75107,24 @@ var import_haikunator = __toESM(require_dist_web());
75107
75107
  var import_fs6 = require("fs");
75108
75108
  var import_path6 = __toESM(require("path"));
75109
75109
  var import_undici2 = __toESM(require_undici());
75110
- var installPackages = async (packages, config34 = {}) => {
75110
+ var installPackages = async (packages, config39 = {}) => {
75111
75111
  const { npm: npm24 } = detectPackageManager();
75112
75112
  let saveFlag;
75113
75113
  let cmd;
75114
75114
  switch (npm24) {
75115
75115
  case "yarn":
75116
75116
  cmd = "add";
75117
- saveFlag = config34.dev ? "-D" : "";
75117
+ saveFlag = config39.dev ? "-D" : "";
75118
75118
  break;
75119
75119
  case "bun":
75120
75120
  cmd = "add";
75121
- saveFlag = config34.dev ? "-d" : "";
75121
+ saveFlag = config39.dev ? "-d" : "";
75122
75122
  break;
75123
75123
  case "npm":
75124
75124
  case "pnpm":
75125
75125
  default:
75126
75126
  cmd = "install";
75127
- saveFlag = config34.dev ? "--save-dev" : "";
75127
+ saveFlag = config39.dev ? "--save-dev" : "";
75128
75128
  break;
75129
75129
  }
75130
75130
  await runCommand(
@@ -75139,7 +75139,7 @@ var installPackages = async (packages, config34 = {}) => {
75139
75139
  ...npm24 === "npm" ? ["--legacy-peer-deps"] : []
75140
75140
  ],
75141
75141
  {
75142
- ...config34,
75142
+ ...config39,
75143
75143
  silent: true
75144
75144
  }
75145
75145
  );
@@ -75378,6 +75378,63 @@ var runFrameworkGenerator = async (ctx, args) => {
75378
75378
  await runCommand(cmd, { env: env3 });
75379
75379
  };
75380
75380
 
75381
+ // templates-experimental/next/c3.ts
75382
+ var generate = async (ctx) => {
75383
+ await runFrameworkGenerator(ctx, [ctx.project.name]);
75384
+ };
75385
+ var configure = async (ctx) => {
75386
+ const packages = [
75387
+ "@opennextjs/cloudflare@0.5.x",
75388
+ "@cloudflare/workers-types"
75389
+ ];
75390
+ await installPackages(packages, {
75391
+ dev: true,
75392
+ startText: "Adding the Cloudflare adapter",
75393
+ doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
75394
+ });
75395
+ const usesTs = usesTypescript(ctx);
75396
+ updateNextConfig(usesTs);
75397
+ };
75398
+ var updateNextConfig = (usesTs) => {
75399
+ const s = spinner();
75400
+ const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
75401
+ s.start(`Updating \`${configFile}\``);
75402
+ const configContent = readFile(configFile);
75403
+ const updatedConfigFile = configContent + `
75404
+ // added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
75405
+ import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
75406
+ initOpenNextCloudflareForDev();
75407
+ `.replace(/\n\t*/g, "\n");
75408
+ writeFile2(configFile, updatedConfigFile);
75409
+ s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
75410
+ };
75411
+ var c3_default = {
75412
+ configVersion: 1,
75413
+ id: "next",
75414
+ frameworkCli: "create-next-app",
75415
+ // TODO: Stop using a pinned version when the template graduates.
75416
+ frameworkCliPinnedVersion: "~15.2.2",
75417
+ platform: "workers",
75418
+ displayName: "Next.js (using Node.js compat + Workers Assets)",
75419
+ path: "templates-experimental/next",
75420
+ copyFiles: {
75421
+ path: "./templates"
75422
+ },
75423
+ generate,
75424
+ configure,
75425
+ transformPackageJson: async () => ({
75426
+ scripts: {
75427
+ deploy: `opennextjs-cloudflare && wrangler deploy`,
75428
+ preview: `opennextjs-cloudflare && wrangler dev`,
75429
+ "cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
75430
+ }
75431
+ }),
75432
+ devScript: "dev",
75433
+ previewScript: "preview",
75434
+ deployScript: "deploy",
75435
+ compatibilityFlags: ["nodejs_compat"]
75436
+ };
75437
+
75381
75438
  // src/helpers/codemod.ts
75382
75439
  var import_fs8 = require("fs");
75383
75440
  var import_path8 = __toESM(require("path"));
@@ -75453,329 +75510,6 @@ var getPropertyName = (newProp) => {
75453
75510
  return newProp.key.type === "Identifier" ? newProp.key.name : newProp.key.type === "StringLiteral" ? newProp.key.value : null;
75454
75511
  };
75455
75512
 
75456
- // templates-experimental/astro/c3.ts
75457
- var recast2 = __toESM(require_main3());
75458
- var { npx } = detectPackageManager();
75459
- var generate = async (ctx) => {
75460
- await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
75461
- logRaw("");
75462
- };
75463
- var configure = async () => {
75464
- await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
75465
- silent: true,
75466
- startText: "Installing adapter",
75467
- doneText: `${brandColor("installed")} ${dim(
75468
- `via \`${npx} astro add cloudflare\``
75469
- )}`
75470
- });
75471
- updateAstroConfig();
75472
- };
75473
- var updateAstroConfig = () => {
75474
- const filePath = "astro.config.mjs";
75475
- updateStatus(`Updating configuration in ${blue(filePath)}`);
75476
- transformFile(filePath, {
75477
- visitCallExpression: function(n) {
75478
- const callee = n.node.callee;
75479
- if (callee.name !== "cloudflare") {
75480
- return this.traverse(n);
75481
- }
75482
- const b3 = recast2.types.builders;
75483
- n.node.arguments = [
75484
- b3.objectExpression([
75485
- b3.objectProperty(
75486
- b3.identifier("platformProxy"),
75487
- b3.objectExpression([
75488
- b3.objectProperty(b3.identifier("enabled"), b3.booleanLiteral(true))
75489
- ])
75490
- )
75491
- ])
75492
- ];
75493
- return false;
75494
- }
75495
- });
75496
- };
75497
- var config = {
75498
- configVersion: 1,
75499
- id: "astro",
75500
- frameworkCli: "create-astro",
75501
- platform: "workers",
75502
- displayName: "Astro",
75503
- copyFiles: {
75504
- async selectVariant(ctx) {
75505
- return usesTypescript(ctx) ? "ts" : "js";
75506
- },
75507
- variants: {
75508
- js: {
75509
- path: "./templates/js"
75510
- },
75511
- ts: {
75512
- path: "./templates/ts"
75513
- }
75514
- }
75515
- },
75516
- devScript: "dev",
75517
- deployScript: "deploy",
75518
- previewScript: "preview",
75519
- path: "templates-experimental/astro",
75520
- generate,
75521
- configure,
75522
- transformPackageJson: async (pkgJson, ctx) => ({
75523
- scripts: {
75524
- deploy: `astro build && wrangler deploy`,
75525
- preview: `astro build && wrangler dev`,
75526
- ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
75527
- }
75528
- })
75529
- };
75530
- var c3_default = config;
75531
-
75532
- // templates-experimental/hono/c3.ts
75533
- var generate2 = async (ctx) => {
75534
- const { name: pm4 } = detectPackageManager();
75535
- await runFrameworkGenerator(ctx, [
75536
- ctx.project.name,
75537
- "--template",
75538
- "cloudflare-workers",
75539
- "--install",
75540
- "--pm",
75541
- pm4
75542
- ]);
75543
- logRaw("");
75544
- };
75545
- var config2 = {
75546
- configVersion: 1,
75547
- id: "hono",
75548
- frameworkCli: "create-hono",
75549
- displayName: "Hono",
75550
- copyFiles: {
75551
- path: "./templates"
75552
- },
75553
- platform: "workers",
75554
- path: "templates-experimental/hono",
75555
- generate: generate2,
75556
- transformPackageJson: async () => ({
75557
- scripts: {
75558
- dev: "wrangler dev",
75559
- deploy: "wrangler deploy --minify",
75560
- "cf-typegen": "wrangler types --env-interface CloudflareBindings"
75561
- }
75562
- }),
75563
- devScript: "dev",
75564
- deployScript: "deploy",
75565
- previewScript: "dev"
75566
- };
75567
- var c3_default2 = config2;
75568
-
75569
- // templates-experimental/next/c3.ts
75570
- var generate3 = async (ctx) => {
75571
- await runFrameworkGenerator(ctx, [ctx.project.name]);
75572
- };
75573
- var configure2 = async (ctx) => {
75574
- const packages = [
75575
- "@opennextjs/cloudflare@0.5.x",
75576
- "@cloudflare/workers-types"
75577
- ];
75578
- await installPackages(packages, {
75579
- dev: true,
75580
- startText: "Adding the Cloudflare adapter",
75581
- doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
75582
- });
75583
- const usesTs = usesTypescript(ctx);
75584
- updateNextConfig(usesTs);
75585
- };
75586
- var updateNextConfig = (usesTs) => {
75587
- const s = spinner();
75588
- const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
75589
- s.start(`Updating \`${configFile}\``);
75590
- const configContent = readFile(configFile);
75591
- const updatedConfigFile = configContent + `
75592
- // added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
75593
- import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
75594
- initOpenNextCloudflareForDev();
75595
- `.replace(/\n\t*/g, "\n");
75596
- writeFile2(configFile, updatedConfigFile);
75597
- s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
75598
- };
75599
- var c3_default3 = {
75600
- configVersion: 1,
75601
- id: "next",
75602
- frameworkCli: "create-next-app",
75603
- // TODO: Stop using a pinned version when the template graduates.
75604
- frameworkCliPinnedVersion: "~15.2.2",
75605
- platform: "workers",
75606
- displayName: "Next.js (using Node.js compat + Workers Assets)",
75607
- path: "templates-experimental/next",
75608
- copyFiles: {
75609
- path: "./templates"
75610
- },
75611
- generate: generate3,
75612
- configure: configure2,
75613
- transformPackageJson: async () => ({
75614
- scripts: {
75615
- deploy: `opennextjs-cloudflare && wrangler deploy`,
75616
- preview: `opennextjs-cloudflare && wrangler dev`,
75617
- "cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
75618
- }
75619
- }),
75620
- devScript: "dev",
75621
- previewScript: "preview",
75622
- deployScript: "deploy",
75623
- compatibilityFlags: ["nodejs_compat"]
75624
- };
75625
-
75626
- // templates-experimental/qwik/c3.ts
75627
- var recast3 = __toESM(require_main3());
75628
- var { npm, npx: npx2, name } = detectPackageManager();
75629
- var generate4 = async (ctx) => {
75630
- await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
75631
- };
75632
- var configure3 = async (ctx) => {
75633
- const cmd = [name === "pnpm" ? npm : npx2, "qwik", "add", "cloudflare-pages"];
75634
- endSection(`Running ${quoteShellArgs(cmd)}`);
75635
- await runCommand(cmd);
75636
- removeFile("./public/_headers");
75637
- removeFile("./public/_redirects");
75638
- removeFile("./public/_routes.json");
75639
- addBindingsProxy(ctx);
75640
- populateCloudflareEnv();
75641
- };
75642
- var addBindingsProxy = (ctx) => {
75643
- if (!usesTypescript(ctx)) {
75644
- return;
75645
- }
75646
- const s = spinner();
75647
- s.start("Updating `vite.config.ts`");
75648
- const snippets = loadTemplateSnippets(ctx);
75649
- const b3 = recast3.types.builders;
75650
- transformFile("vite.config.ts", {
75651
- // Insert the env declaration after the last import (but before the rest of the body)
75652
- visitProgram: function(n) {
75653
- const lastImportIndex = n.node.body.findLastIndex(
75654
- (t2) => t2.type === "ImportDeclaration"
75655
- );
75656
- const lastImport = n.get("body", lastImportIndex);
75657
- lastImport.insertAfter(...snippets.getPlatformProxyTs);
75658
- return this.traverse(n);
75659
- },
75660
- // Pass the `platform` object from the declaration to the `qwikCity` plugin
75661
- visitCallExpression: function(n) {
75662
- const callee = n.node.callee;
75663
- if (callee.name !== "qwikCity") {
75664
- return this.traverse(n);
75665
- }
75666
- const configArgument = n.node.arguments[0];
75667
- const platformPropery = b3.objectProperty.from({
75668
- key: b3.identifier("platform"),
75669
- value: b3.identifier("platform"),
75670
- shorthand: true
75671
- });
75672
- if (!configArgument) {
75673
- n.node.arguments = [b3.objectExpression([platformPropery])];
75674
- return false;
75675
- }
75676
- if (configArgument.type !== "ObjectExpression") {
75677
- crash("Failed to update `vite.config.ts`");
75678
- }
75679
- configArgument.properties.push(platformPropery);
75680
- return false;
75681
- }
75682
- });
75683
- s.stop(`${brandColor("updated")} \`vite.config.ts\``);
75684
- };
75685
- var populateCloudflareEnv = () => {
75686
- const entrypointPath = "src/entry.cloudflare-pages.tsx";
75687
- const s = spinner();
75688
- s.start(`Updating \`${entrypointPath}\``);
75689
- transformFile(entrypointPath, {
75690
- visitTSInterfaceDeclaration: function(n) {
75691
- const b3 = recast3.types.builders;
75692
- const id = n.node.id;
75693
- if (id.name !== "QwikCityPlatform") {
75694
- this.traverse(n);
75695
- }
75696
- const newBody = [
75697
- ["env", "Env"]
75698
- // Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
75699
- // ["cf", "CfProperties"],
75700
- ].map(
75701
- ([varName, type]) => b3.tsPropertySignature(
75702
- b3.identifier(varName),
75703
- b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
75704
- )
75705
- );
75706
- n.node.body.body = newBody;
75707
- return false;
75708
- }
75709
- });
75710
- s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
75711
- };
75712
- var config3 = {
75713
- configVersion: 1,
75714
- id: "qwik",
75715
- frameworkCli: "create-qwik",
75716
- displayName: "Qwik",
75717
- platform: "workers",
75718
- copyFiles: {
75719
- path: "./templates"
75720
- },
75721
- path: "templates-experimental/qwik",
75722
- generate: generate4,
75723
- configure: configure3,
75724
- transformPackageJson: async () => ({
75725
- scripts: {
75726
- deploy: `${npm} run build && wrangler deploy`,
75727
- preview: `${npm} run build && wrangler dev`,
75728
- "cf-typegen": `wrangler types`
75729
- }
75730
- }),
75731
- devScript: "dev",
75732
- deployScript: "deploy",
75733
- previewScript: "preview"
75734
- };
75735
- var c3_default4 = config3;
75736
-
75737
- // templates-experimental/remix/c3.ts
75738
- var { npm: npm2 } = detectPackageManager();
75739
- var generate5 = async (ctx) => {
75740
- await runFrameworkGenerator(ctx, [
75741
- ctx.project.name,
75742
- "--template",
75743
- "https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
75744
- ]);
75745
- logRaw("");
75746
- };
75747
- var configure4 = async () => {
75748
- await installPackages(["wrangler@latest"], {
75749
- dev: true,
75750
- startText: "Updating the Wrangler version",
75751
- doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
75752
- });
75753
- };
75754
- var config4 = {
75755
- configVersion: 1,
75756
- id: "remix",
75757
- frameworkCli: "create-remix",
75758
- platform: "workers",
75759
- displayName: "Remix",
75760
- copyFiles: {
75761
- path: "./templates"
75762
- },
75763
- path: "templates-experimental/remix",
75764
- generate: generate5,
75765
- configure: configure4,
75766
- transformPackageJson: async () => ({
75767
- scripts: {
75768
- deploy: `${npm2} run build && wrangler deploy`,
75769
- preview: `${npm2} run build && wrangler dev`,
75770
- "cf-typegen": `wrangler types`
75771
- }
75772
- }),
75773
- devScript: "dev",
75774
- deployScript: "deploy",
75775
- previewScript: "preview"
75776
- };
75777
- var c3_default5 = config4;
75778
-
75779
75513
  // src/helpers/compatDate.ts
75780
75514
  var import_fs9 = require("fs");
75781
75515
  var import_path9 = require("path");
@@ -75829,18 +75563,18 @@ function getLatestTypesEntrypoint(ctx) {
75829
75563
  }
75830
75564
 
75831
75565
  // templates-experimental/solid/c3.ts
75832
- var recast4 = __toESM(require_main3());
75833
- var { npm: npm3 } = detectPackageManager();
75834
- var generate6 = async (ctx) => {
75566
+ var recast2 = __toESM(require_main3());
75567
+ var { npm } = detectPackageManager();
75568
+ var generate2 = async (ctx) => {
75835
75569
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
75836
75570
  logRaw("");
75837
75571
  };
75838
- var configure5 = async (ctx) => {
75572
+ var configure2 = async (ctx) => {
75839
75573
  const packages = ["nitropack"];
75840
75574
  await installPackages(packages, {
75841
75575
  dev: true,
75842
75576
  startText: "Installing nitro module `nitropack`",
75843
- doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
75577
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
75844
75578
  });
75845
75579
  usesTypescript(ctx);
75846
75580
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
@@ -75852,7 +75586,7 @@ var configure5 = async (ctx) => {
75852
75586
  if (callee.name !== "defineConfig") {
75853
75587
  return this.traverse(n);
75854
75588
  }
75855
- const b3 = recast4.types.builders;
75589
+ const b3 = recast2.types.builders;
75856
75590
  mergeObjectProperties(
75857
75591
  n.node.arguments[0],
75858
75592
  [
@@ -75876,7 +75610,7 @@ var configure5 = async (ctx) => {
75876
75610
  }
75877
75611
  });
75878
75612
  };
75879
- var config5 = {
75613
+ var config = {
75880
75614
  configVersion: 1,
75881
75615
  id: "solid",
75882
75616
  frameworkCli: "create-solid",
@@ -75886,12 +75620,12 @@ var config5 = {
75886
75620
  path: "./templates"
75887
75621
  },
75888
75622
  path: "templates-experimental/solid",
75889
- generate: generate6,
75890
- configure: configure5,
75623
+ generate: generate2,
75624
+ configure: configure2,
75891
75625
  transformPackageJson: async () => ({
75892
75626
  scripts: {
75893
- preview: `${npm3} run build && npx wrangler dev`,
75894
- deploy: `${npm3} run build && wrangler deploy`
75627
+ preview: `${npm} run build && npx wrangler dev`,
75628
+ deploy: `${npm} run build && wrangler deploy`
75895
75629
  }
75896
75630
  }),
75897
75631
  compatibilityFlags: ["nodejs_compat"],
@@ -75899,111 +75633,12 @@ var config5 = {
75899
75633
  deployScript: "deploy",
75900
75634
  previewScript: "preview"
75901
75635
  };
75902
- var c3_default6 = config5;
75903
-
75904
- // templates-experimental/svelte/c3.ts
75905
- var import_node_os3 = require("node:os");
75906
- var recast5 = __toESM(require_main3());
75907
- var { npm: npm4 } = detectPackageManager();
75908
- var generate7 = async (ctx) => {
75909
- await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
75910
- logRaw("");
75911
- };
75912
- var configure6 = async (ctx) => {
75913
- const pkg = `@sveltejs/adapter-cloudflare`;
75914
- await installPackages([pkg], {
75915
- dev: true,
75916
- startText: "Adding the Cloudflare Pages adapter",
75917
- doneText: `${brandColor(`installed`)} ${dim(pkg)}`
75918
- });
75919
- updateSvelteConfig();
75920
- updateTypeDefinitions(ctx);
75921
- };
75922
- var updateSvelteConfig = () => {
75923
- updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
75924
- transformFile("svelte.config.js", {
75925
- visitImportDeclaration: function(n) {
75926
- const importSource = n.value.source;
75927
- if (importSource.value === "@sveltejs/adapter-auto") {
75928
- importSource.value = "@sveltejs/adapter-cloudflare";
75929
- }
75930
- return false;
75931
- }
75932
- });
75933
- };
75934
- var updateTypeDefinitions = (ctx) => {
75935
- if (!usesTypescript(ctx)) {
75936
- return;
75937
- }
75938
- updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
75939
- const b3 = recast5.types.builders;
75940
- transformFile("src/app.d.ts", {
75941
- visitTSModuleDeclaration(n) {
75942
- if (n.value.id.name === "App" && n.node.body) {
75943
- const moduleBlock = n.node.body;
75944
- const platformInterface = b3.tsInterfaceDeclaration(
75945
- b3.identifier("Platform"),
75946
- b3.tsInterfaceBody([
75947
- b3.tsPropertySignature(
75948
- b3.identifier("env"),
75949
- b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
75950
- ),
75951
- b3.tsPropertySignature(
75952
- b3.identifier("cf"),
75953
- b3.tsTypeAnnotation(
75954
- b3.tsTypeReference(b3.identifier("CfProperties"))
75955
- )
75956
- ),
75957
- b3.tsPropertySignature(
75958
- b3.identifier("ctx"),
75959
- b3.tsTypeAnnotation(
75960
- b3.tsTypeReference(b3.identifier("ExecutionContext"))
75961
- )
75962
- )
75963
- ])
75964
- );
75965
- moduleBlock.body.unshift(platformInterface);
75966
- }
75967
- this.traverse(n);
75968
- }
75969
- });
75970
- };
75971
- var config6 = {
75972
- configVersion: 1,
75973
- id: "svelte",
75974
- frameworkCli: "sv",
75975
- displayName: "SvelteKit",
75976
- platform: "workers",
75977
- copyFiles: {
75978
- path: "./templates"
75979
- },
75980
- path: "templates-experimental/svelte",
75981
- generate: generate7,
75982
- configure: configure6,
75983
- transformPackageJson: async (original, ctx) => {
75984
- let scripts = {
75985
- preview: `${npm4} run build && wrangler dev`,
75986
- deploy: `${npm4} run build && wrangler deploy`
75987
- };
75988
- if (usesTypescript(ctx)) {
75989
- const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
75990
- scripts = {
75991
- ...scripts,
75992
- "cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
75993
- };
75994
- }
75995
- return { scripts };
75996
- },
75997
- devScript: "dev",
75998
- deployScript: "deploy",
75999
- previewScript: "preview"
76000
- };
76001
- var c3_default7 = config6;
75636
+ var c3_default2 = config;
76002
75637
 
76003
75638
  // templates/analog/c3.ts
76004
- var recast6 = __toESM(require_main3());
76005
- var { npm: npm5, name: pm } = detectPackageManager();
76006
- var generate8 = async (ctx) => {
75639
+ var recast3 = __toESM(require_main3());
75640
+ var { npm: npm2, name: pm } = detectPackageManager();
75641
+ var generate3 = async (ctx) => {
76007
75642
  await runFrameworkGenerator(ctx, [
76008
75643
  ctx.project.name,
76009
75644
  "--template",
@@ -76011,7 +75646,7 @@ var generate8 = async (ctx) => {
76011
75646
  ]);
76012
75647
  logRaw("");
76013
75648
  };
76014
- var configure7 = async (ctx) => {
75649
+ var configure3 = async (ctx) => {
76015
75650
  if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
76016
75651
  const packages = [];
76017
75652
  packages.push("nitropack");
@@ -76021,7 +75656,7 @@ var configure7 = async (ctx) => {
76021
75656
  await installPackages(packages, {
76022
75657
  dev: true,
76023
75658
  startText: `Installing ${packages.join(", ")}`,
76024
- doneText: `${brandColor("installed")} ${dim(`via \`${npm5} install\``)}`
75659
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
76025
75660
  });
76026
75661
  }
76027
75662
  updateViteConfig(ctx);
@@ -76042,7 +75677,7 @@ var updateEnvTypes = (ctx) => {
76042
75677
  s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
76043
75678
  };
76044
75679
  var updateViteConfig = (ctx) => {
76045
- const b3 = recast6.types.builders;
75680
+ const b3 = recast3.types.builders;
76046
75681
  const s = spinner();
76047
75682
  const configFile = "vite.config.ts";
76048
75683
  s.start(`Updating \`${configFile}\``);
@@ -76079,7 +75714,7 @@ var updateViteConfig = (ctx) => {
76079
75714
  });
76080
75715
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76081
75716
  };
76082
- var config7 = {
75717
+ var config2 = {
76083
75718
  configVersion: 1,
76084
75719
  id: "analog",
76085
75720
  frameworkCli: "create-analog",
@@ -76088,12 +75723,12 @@ var config7 = {
76088
75723
  copyFiles: {
76089
75724
  path: "./templates"
76090
75725
  },
76091
- generate: generate8,
76092
- configure: configure7,
75726
+ generate: generate3,
75727
+ configure: configure3,
76093
75728
  transformPackageJson: async () => ({
76094
75729
  scripts: {
76095
- preview: `${npm5} run build && wrangler pages dev`,
76096
- deploy: `${npm5} run build && wrangler pages deploy`,
75730
+ preview: `${npm2} run build && wrangler pages dev`,
75731
+ deploy: `${npm2} run build && wrangler pages deploy`,
76097
75732
  "cf-typegen": `wrangler types`
76098
75733
  }
76099
75734
  }),
@@ -76101,12 +75736,12 @@ var config7 = {
76101
75736
  deployScript: "deploy",
76102
75737
  previewScript: "preview"
76103
75738
  };
76104
- var c3_default8 = config7;
75739
+ var c3_default3 = config2;
76105
75740
 
76106
75741
  // templates/angular/pages/c3.ts
76107
75742
  var import_node_path3 = require("node:path");
76108
- var { npm: npm6 } = detectPackageManager();
76109
- var generate9 = async (ctx) => {
75743
+ var { npm: npm3 } = detectPackageManager();
75744
+ var generate4 = async (ctx) => {
76110
75745
  await runFrameworkGenerator(ctx, [
76111
75746
  ctx.project.name,
76112
75747
  "--ssr",
@@ -76114,7 +75749,7 @@ var generate9 = async (ctx) => {
76114
75749
  ]);
76115
75750
  logRaw("");
76116
75751
  };
76117
- var configure8 = async (ctx) => {
75752
+ var configure4 = async (ctx) => {
76118
75753
  updateAngularJson(ctx);
76119
75754
  await updateAppCode();
76120
75755
  await installCFWorker();
@@ -76123,7 +75758,7 @@ async function installCFWorker() {
76123
75758
  await installPackages(["xhr2"], {
76124
75759
  dev: true,
76125
75760
  startText: "Installing additional dependencies",
76126
- doneText: `${brandColor("installed")} ${dim(`via \`${npm6} install\``)}`
75761
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
76127
75762
  });
76128
75763
  }
76129
75764
  async function updateAppCode() {
@@ -76165,7 +75800,7 @@ function updateAngularJson(ctx) {
76165
75800
  writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
76166
75801
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
76167
75802
  }
76168
- var config8 = {
75803
+ var config3 = {
76169
75804
  configVersion: 1,
76170
75805
  id: "angular",
76171
75806
  frameworkCli: "@angular/create",
@@ -76178,23 +75813,23 @@ var config8 = {
76178
75813
  devScript: "start",
76179
75814
  deployScript: "deploy",
76180
75815
  previewScript: "start",
76181
- generate: generate9,
76182
- configure: configure8,
75816
+ generate: generate4,
75817
+ configure: configure4,
76183
75818
  transformPackageJson: async () => ({
76184
75819
  scripts: {
76185
- start: `${npm6} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
76186
- build: `ng build && ${npm6} run process`,
75820
+ start: `${npm3} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
75821
+ build: `ng build && ${npm3} run process`,
76187
75822
  process: "node ./tools/copy-files.mjs",
76188
- deploy: `${npm6} run build && wrangler pages deploy dist/cloudflare`
75823
+ deploy: `${npm3} run build && wrangler pages deploy dist/cloudflare`
76189
75824
  }
76190
75825
  })
76191
75826
  };
76192
- var c3_default9 = config8;
75827
+ var c3_default4 = config3;
76193
75828
 
76194
75829
  // templates/angular/workers/c3.ts
76195
75830
  var import_node_path4 = require("node:path");
76196
- var { npm: npm7 } = detectPackageManager();
76197
- var generate10 = async (ctx) => {
75831
+ var { npm: npm4 } = detectPackageManager();
75832
+ var generate5 = async (ctx) => {
76198
75833
  await runFrameworkGenerator(ctx, [
76199
75834
  ctx.project.name,
76200
75835
  "--ssr",
@@ -76202,7 +75837,7 @@ var generate10 = async (ctx) => {
76202
75837
  ]);
76203
75838
  logRaw("");
76204
75839
  };
76205
- var configure9 = async (ctx) => {
75840
+ var configure5 = async (ctx) => {
76206
75841
  updateAngularJson2(ctx);
76207
75842
  await updateAppCode2();
76208
75843
  await installCFWorker2();
@@ -76211,7 +75846,7 @@ async function installCFWorker2() {
76211
75846
  await installPackages(["xhr2"], {
76212
75847
  dev: true,
76213
75848
  startText: "Installing additional dependencies",
76214
- doneText: `${brandColor("installed")} ${dim(`via \`${npm7} install\``)}`
75849
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
76215
75850
  });
76216
75851
  }
76217
75852
  async function updateAppCode2() {
@@ -76252,7 +75887,7 @@ function updateAngularJson2(ctx) {
76252
75887
  writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
76253
75888
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
76254
75889
  }
76255
- var config9 = {
75890
+ var config4 = {
76256
75891
  configVersion: 1,
76257
75892
  id: "angular",
76258
75893
  frameworkCli: "@angular/create",
@@ -76265,43 +75900,43 @@ var config9 = {
76265
75900
  devScript: "start",
76266
75901
  deployScript: "deploy",
76267
75902
  previewScript: "start",
76268
- generate: generate10,
76269
- configure: configure9,
75903
+ generate: generate5,
75904
+ configure: configure5,
76270
75905
  transformPackageJson: async () => ({
76271
75906
  scripts: {
76272
- start: `${npm7} run build && wrangler dev`,
75907
+ start: `${npm4} run build && wrangler dev`,
76273
75908
  build: `ng build`,
76274
- deploy: `${npm7} run build && wrangler deploy`
75909
+ deploy: `${npm4} run build && wrangler deploy`
76275
75910
  }
76276
75911
  })
76277
75912
  };
76278
- var c3_default10 = config9;
75913
+ var c3_default5 = config4;
76279
75914
 
76280
75915
  // templates/angular/c3.ts
76281
- var config10 = {
75916
+ var config5 = {
76282
75917
  displayName: "Angular",
76283
- platformVariants: { pages: c3_default9, workers: c3_default10 }
75918
+ platformVariants: { pages: c3_default4, workers: c3_default5 }
76284
75919
  };
76285
- var c3_default11 = config10;
75920
+ var c3_default6 = config5;
76286
75921
 
76287
- // templates/astro/c3.ts
76288
- var recast7 = __toESM(require_main3());
76289
- var { npx: npx3 } = detectPackageManager();
76290
- var generate11 = async (ctx) => {
75922
+ // templates/astro/pages/c3.ts
75923
+ var recast4 = __toESM(require_main3());
75924
+ var { npx } = detectPackageManager();
75925
+ var generate6 = async (ctx) => {
76291
75926
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
76292
75927
  logRaw("");
76293
75928
  };
76294
- var configure10 = async () => {
76295
- await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
75929
+ var configure6 = async () => {
75930
+ await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
76296
75931
  silent: true,
76297
75932
  startText: "Installing adapter",
76298
75933
  doneText: `${brandColor("installed")} ${dim(
76299
- `via \`${npx3} astro add cloudflare\``
75934
+ `via \`${npx} astro add cloudflare\``
76300
75935
  )}`
76301
75936
  });
76302
- updateAstroConfig2();
75937
+ updateAstroConfig();
76303
75938
  };
76304
- var updateAstroConfig2 = () => {
75939
+ var updateAstroConfig = () => {
76305
75940
  const filePath = "astro.config.mjs";
76306
75941
  updateStatus(`Updating configuration in ${blue(filePath)}`);
76307
75942
  transformFile(filePath, {
@@ -76310,7 +75945,7 @@ var updateAstroConfig2 = () => {
76310
75945
  if (callee.name !== "cloudflare") {
76311
75946
  return this.traverse(n);
76312
75947
  }
76313
- const b3 = recast7.types.builders;
75948
+ const b3 = recast4.types.builders;
76314
75949
  n.node.arguments = [
76315
75950
  b3.objectExpression([
76316
75951
  b3.objectProperty(
@@ -76325,12 +75960,13 @@ var updateAstroConfig2 = () => {
76325
75960
  }
76326
75961
  });
76327
75962
  };
76328
- var config11 = {
75963
+ var config6 = {
76329
75964
  configVersion: 1,
76330
75965
  id: "astro",
76331
75966
  frameworkCli: "create-astro",
76332
75967
  platform: "pages",
76333
75968
  displayName: "Astro",
75969
+ path: "templates/astro/pages",
76334
75970
  copyFiles: {
76335
75971
  async selectVariant(ctx) {
76336
75972
  return usesTypescript(ctx) ? "ts" : "js";
@@ -76347,8 +75983,8 @@ var config11 = {
76347
75983
  devScript: "dev",
76348
75984
  deployScript: "deploy",
76349
75985
  previewScript: "preview",
76350
- generate: generate11,
76351
- configure: configure10,
75986
+ generate: generate6,
75987
+ configure: configure6,
76352
75988
  transformPackageJson: async (pkgJson, ctx) => ({
76353
75989
  scripts: {
76354
75990
  deploy: `astro build && wrangler pages deploy`,
@@ -76357,10 +75993,93 @@ var config11 = {
76357
75993
  }
76358
75994
  })
76359
75995
  };
76360
- var c3_default12 = config11;
75996
+ var c3_default7 = config6;
75997
+
75998
+ // templates/astro/workers/c3.ts
75999
+ var recast5 = __toESM(require_main3());
76000
+ var { npx: npx2 } = detectPackageManager();
76001
+ var generate7 = async (ctx) => {
76002
+ await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
76003
+ logRaw("");
76004
+ };
76005
+ var configure7 = async () => {
76006
+ await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
76007
+ silent: true,
76008
+ startText: "Installing adapter",
76009
+ doneText: `${brandColor("installed")} ${dim(
76010
+ `via \`${npx2} astro add cloudflare\``
76011
+ )}`
76012
+ });
76013
+ updateAstroConfig2();
76014
+ };
76015
+ var updateAstroConfig2 = () => {
76016
+ const filePath = "astro.config.mjs";
76017
+ updateStatus(`Updating configuration in ${blue(filePath)}`);
76018
+ transformFile(filePath, {
76019
+ visitCallExpression: function(n) {
76020
+ const callee = n.node.callee;
76021
+ if (callee.name !== "cloudflare") {
76022
+ return this.traverse(n);
76023
+ }
76024
+ const b3 = recast5.types.builders;
76025
+ n.node.arguments = [
76026
+ b3.objectExpression([
76027
+ b3.objectProperty(
76028
+ b3.identifier("platformProxy"),
76029
+ b3.objectExpression([
76030
+ b3.objectProperty(b3.identifier("enabled"), b3.booleanLiteral(true))
76031
+ ])
76032
+ )
76033
+ ])
76034
+ ];
76035
+ return false;
76036
+ }
76037
+ });
76038
+ };
76039
+ var config7 = {
76040
+ configVersion: 1,
76041
+ id: "astro",
76042
+ frameworkCli: "create-astro",
76043
+ platform: "workers",
76044
+ displayName: "Astro",
76045
+ copyFiles: {
76046
+ async selectVariant(ctx) {
76047
+ return usesTypescript(ctx) ? "ts" : "js";
76048
+ },
76049
+ variants: {
76050
+ js: {
76051
+ path: "./templates/js"
76052
+ },
76053
+ ts: {
76054
+ path: "./templates/ts"
76055
+ }
76056
+ }
76057
+ },
76058
+ devScript: "dev",
76059
+ deployScript: "deploy",
76060
+ previewScript: "preview",
76061
+ path: "templates/astro/workers",
76062
+ generate: generate7,
76063
+ configure: configure7,
76064
+ transformPackageJson: async (pkgJson, ctx) => ({
76065
+ scripts: {
76066
+ deploy: `astro build && wrangler deploy`,
76067
+ preview: `astro build && wrangler dev`,
76068
+ ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
76069
+ }
76070
+ })
76071
+ };
76072
+ var c3_default8 = config7;
76073
+
76074
+ // templates/astro/c3.ts
76075
+ var config8 = {
76076
+ displayName: "Astro",
76077
+ platformVariants: { pages: c3_default7, workers: c3_default8 }
76078
+ };
76079
+ var c3_default9 = config8;
76361
76080
 
76362
76081
  // templates/common/c3.ts
76363
- var c3_default13 = {
76082
+ var c3_default10 = {
76364
76083
  configVersion: 1,
76365
76084
  id: "common",
76366
76085
  displayName: "Example router & proxy Worker",
@@ -76380,36 +76099,36 @@ var c3_default13 = {
76380
76099
  };
76381
76100
 
76382
76101
  // templates/docusaurus/pages/c3.ts
76383
- var { npm: npm8 } = detectPackageManager();
76384
- var generate12 = async (ctx) => {
76102
+ var { npm: npm5 } = detectPackageManager();
76103
+ var generate8 = async (ctx) => {
76385
76104
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
76386
76105
  };
76387
- var config12 = {
76106
+ var config9 = {
76388
76107
  configVersion: 1,
76389
76108
  id: "docusaurus",
76390
76109
  frameworkCli: "create-docusaurus",
76391
76110
  platform: "pages",
76392
76111
  displayName: "Docusaurus",
76393
76112
  path: "templates/docusaurus/pages",
76394
- generate: generate12,
76113
+ generate: generate8,
76395
76114
  transformPackageJson: async () => ({
76396
76115
  scripts: {
76397
- preview: `${npm8} run build && wrangler pages dev ./build`,
76398
- deploy: `${npm8} run build && wrangler pages deploy ./build`
76116
+ preview: `${npm5} run build && wrangler pages dev ./build`,
76117
+ deploy: `${npm5} run build && wrangler pages deploy ./build`
76399
76118
  }
76400
76119
  }),
76401
76120
  devScript: "preview",
76402
76121
  deployScript: "deploy",
76403
76122
  previewScript: "preview"
76404
76123
  };
76405
- var c3_default14 = config12;
76124
+ var c3_default11 = config9;
76406
76125
 
76407
76126
  // templates/docusaurus/workers/c3.ts
76408
- var { npm: npm9 } = detectPackageManager();
76409
- var generate13 = async (ctx) => {
76127
+ var { npm: npm6 } = detectPackageManager();
76128
+ var generate9 = async (ctx) => {
76410
76129
  await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
76411
76130
  };
76412
- var config13 = {
76131
+ var config10 = {
76413
76132
  configVersion: 1,
76414
76133
  id: "docusaurus",
76415
76134
  frameworkCli: "create-docusaurus",
@@ -76419,29 +76138,29 @@ var config13 = {
76419
76138
  path: "./templates"
76420
76139
  },
76421
76140
  path: "templates/docusaurus/workers",
76422
- generate: generate13,
76141
+ generate: generate9,
76423
76142
  transformPackageJson: async () => ({
76424
76143
  scripts: {
76425
- deploy: `${npm9} run build && wrangler deploy`,
76426
- preview: `${npm9} run build && wrangler dev`
76144
+ deploy: `${npm6} run build && wrangler deploy`,
76145
+ preview: `${npm6} run build && wrangler dev`
76427
76146
  }
76428
76147
  }),
76429
76148
  devScript: "start",
76430
76149
  deployScript: "deploy",
76431
76150
  previewScript: "preview"
76432
76151
  };
76433
- var c3_default15 = config13;
76152
+ var c3_default12 = config10;
76434
76153
 
76435
76154
  // templates/docusaurus/c3.ts
76436
- var config14 = {
76155
+ var config11 = {
76437
76156
  displayName: "Docusaurus",
76438
- platformVariants: { pages: c3_default14, workers: c3_default15 }
76157
+ platformVariants: { pages: c3_default11, workers: c3_default12 }
76439
76158
  };
76440
- var c3_default16 = config14;
76159
+ var c3_default13 = config11;
76441
76160
 
76442
76161
  // templates/gatsby/pages/c3.ts
76443
- var { npm: npm10 } = detectPackageManager();
76444
- var generate14 = async (ctx) => {
76162
+ var { npm: npm7 } = detectPackageManager();
76163
+ var generate10 = async (ctx) => {
76445
76164
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76446
76165
  const useTemplate = await inputPrompt({
76447
76166
  type: "confirm",
@@ -76460,29 +76179,29 @@ var generate14 = async (ctx) => {
76460
76179
  }
76461
76180
  await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76462
76181
  };
76463
- var config15 = {
76182
+ var config12 = {
76464
76183
  configVersion: 1,
76465
76184
  id: "gatsby",
76466
76185
  frameworkCli: "gatsby",
76467
76186
  platform: "pages",
76468
76187
  displayName: "Gatsby",
76469
76188
  path: "templates/gatsby/pages",
76470
- generate: generate14,
76189
+ generate: generate10,
76471
76190
  transformPackageJson: async () => ({
76472
76191
  scripts: {
76473
- deploy: `${npm10} run build && wrangler pages deploy ./public`,
76474
- preview: `${npm10} run build && wrangler pages dev ./public`
76192
+ deploy: `${npm7} run build && wrangler pages deploy ./public`,
76193
+ preview: `${npm7} run build && wrangler pages dev ./public`
76475
76194
  }
76476
76195
  }),
76477
76196
  devScript: "develop",
76478
76197
  deployScript: "deploy",
76479
76198
  previewScript: "preview"
76480
76199
  };
76481
- var c3_default17 = config15;
76200
+ var c3_default14 = config12;
76482
76201
 
76483
76202
  // templates/gatsby/workers/c3.ts
76484
- var { npm: npm11 } = detectPackageManager();
76485
- var generate15 = async (ctx) => {
76203
+ var { npm: npm8 } = detectPackageManager();
76204
+ var generate11 = async (ctx) => {
76486
76205
  const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
76487
76206
  const useTemplate = await inputPrompt({
76488
76207
  type: "confirm",
@@ -76501,7 +76220,7 @@ var generate15 = async (ctx) => {
76501
76220
  }
76502
76221
  await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
76503
76222
  };
76504
- var config16 = {
76223
+ var config13 = {
76505
76224
  configVersion: 1,
76506
76225
  id: "gatsby",
76507
76226
  frameworkCli: "gatsby",
@@ -76511,28 +76230,28 @@ var config16 = {
76511
76230
  path: "./templates"
76512
76231
  },
76513
76232
  path: "templates/gatsby/workers",
76514
- generate: generate15,
76233
+ generate: generate11,
76515
76234
  transformPackageJson: async () => ({
76516
76235
  scripts: {
76517
- deploy: `${npm11} run build && wrangler deploy`,
76518
- preview: `${npm11} run build && wrangler dev`
76236
+ deploy: `${npm8} run build && wrangler deploy`,
76237
+ preview: `${npm8} run build && wrangler dev`
76519
76238
  }
76520
76239
  }),
76521
76240
  devScript: "develop",
76522
76241
  deployScript: "deploy",
76523
76242
  previewScript: "preview"
76524
76243
  };
76525
- var c3_default18 = config16;
76244
+ var c3_default15 = config13;
76526
76245
 
76527
76246
  // templates/gatsby/c3.ts
76528
- var config17 = {
76247
+ var config14 = {
76529
76248
  displayName: "Gatsby",
76530
- platformVariants: { pages: c3_default17, workers: c3_default18 }
76249
+ platformVariants: { pages: c3_default14, workers: c3_default15 }
76531
76250
  };
76532
- var c3_default19 = config17;
76251
+ var c3_default16 = config14;
76533
76252
 
76534
76253
  // templates/hello-world-assets-only/c3.ts
76535
- var config18 = {
76254
+ var config15 = {
76536
76255
  configVersion: 1,
76537
76256
  id: "hello-world-assets-only",
76538
76257
  path: "templates/hello-world-assets-only",
@@ -76543,10 +76262,10 @@ var config18 = {
76543
76262
  path: "./templates"
76544
76263
  }
76545
76264
  };
76546
- var c3_default20 = config18;
76265
+ var c3_default17 = config15;
76547
76266
 
76548
76267
  // templates/hello-world-durable-object-with-assets/c3.ts
76549
- var config19 = {
76268
+ var config16 = {
76550
76269
  configVersion: 1,
76551
76270
  id: "hello-world-durable-object-with-assets",
76552
76271
  path: "templates/hello-world-durable-object-with-assets",
@@ -76564,10 +76283,10 @@ var config19 = {
76564
76283
  }
76565
76284
  }
76566
76285
  };
76567
- var c3_default21 = config19;
76286
+ var c3_default18 = config16;
76568
76287
 
76569
76288
  // templates/hello-world-durable-object/c3.ts
76570
- var c3_default22 = {
76289
+ var c3_default19 = {
76571
76290
  configVersion: 1,
76572
76291
  id: "hello-world-durable-object",
76573
76292
  displayName: "Worker + Durable Objects",
@@ -76586,7 +76305,7 @@ var c3_default22 = {
76586
76305
  };
76587
76306
 
76588
76307
  // templates/hello-world-with-assets/c3.ts
76589
- var c3_default23 = {
76308
+ var c3_default20 = {
76590
76309
  configVersion: 1,
76591
76310
  id: "hello-world-with-assets",
76592
76311
  path: "templates/hello-world-with-assets",
@@ -76611,7 +76330,7 @@ var c3_default23 = {
76611
76330
  // templates/hello-world/c3.ts
76612
76331
  var import_promises2 = require("node:fs/promises");
76613
76332
  var import_node_path5 = require("node:path");
76614
- var c3_default24 = {
76333
+ var c3_default21 = {
76615
76334
  configVersion: 1,
76616
76335
  id: "hello-world",
76617
76336
  displayName: "Worker only",
@@ -76644,35 +76363,55 @@ var c3_default24 = {
76644
76363
  }
76645
76364
  };
76646
76365
 
76647
- // templates/hono/c3.ts
76648
- var generate16 = async (ctx) => {
76366
+ // templates/hono/pages/c3.ts
76367
+ var generate12 = async (ctx) => {
76649
76368
  const { name: pm4 } = detectPackageManager();
76650
76369
  await runFrameworkGenerator(ctx, [
76651
76370
  ctx.project.name,
76652
76371
  "--template",
76653
- "cloudflare-workers",
76372
+ "cloudflare-pages",
76654
76373
  "--install",
76655
76374
  "--pm",
76656
76375
  pm4
76657
76376
  ]);
76658
76377
  logRaw("");
76659
76378
  };
76660
- var configure11 = async (ctx) => {
76661
- const indexFile = "src/index.ts";
76662
- const s = spinner();
76663
- s.start(`Updating \`${indexFile}\``);
76664
- const snippets = loadTemplateSnippets(ctx);
76665
- transformFile(indexFile, {
76666
- visitVariableDeclarator(n) {
76667
- if (n.node.id.type === "Identifier" && n.node.id.name === "app") {
76668
- n.node.init = snippets.appDeclarationTs[0];
76669
- return false;
76670
- }
76379
+ var config17 = {
76380
+ configVersion: 1,
76381
+ id: "hono",
76382
+ frameworkCli: "create-hono",
76383
+ displayName: "Hono",
76384
+ copyFiles: {
76385
+ path: "./templates"
76386
+ },
76387
+ path: "templates/hono/pages",
76388
+ platform: "pages",
76389
+ generate: generate12,
76390
+ transformPackageJson: async () => ({
76391
+ scripts: {
76392
+ "cf-typegen": "wrangler types --env-interface CloudflareBindings"
76671
76393
  }
76672
- });
76673
- s.stop(`${brandColor("updated")} \`${dim(indexFile)}\``);
76394
+ }),
76395
+ devScript: "dev",
76396
+ deployScript: "deploy",
76397
+ previewScript: "dev"
76674
76398
  };
76675
- var config20 = {
76399
+ var c3_default22 = config17;
76400
+
76401
+ // templates/hono/workers/c3.ts
76402
+ var generate13 = async (ctx) => {
76403
+ const { name: pm4 } = detectPackageManager();
76404
+ await runFrameworkGenerator(ctx, [
76405
+ ctx.project.name,
76406
+ "--template",
76407
+ "cloudflare-workers",
76408
+ "--install",
76409
+ "--pm",
76410
+ pm4
76411
+ ]);
76412
+ logRaw("");
76413
+ };
76414
+ var config18 = {
76676
76415
  configVersion: 1,
76677
76416
  id: "hono",
76678
76417
  frameworkCli: "create-hono",
@@ -76681,12 +76420,10 @@ var config20 = {
76681
76420
  path: "./templates"
76682
76421
  },
76683
76422
  platform: "workers",
76684
- generate: generate16,
76685
- configure: configure11,
76423
+ path: "templates/hono/workers",
76424
+ generate: generate13,
76686
76425
  transformPackageJson: async () => ({
76687
76426
  scripts: {
76688
- dev: "wrangler dev",
76689
- deploy: "wrangler deploy --minify",
76690
76427
  "cf-typegen": "wrangler types --env-interface CloudflareBindings"
76691
76428
  }
76692
76429
  }),
@@ -76694,12 +76431,19 @@ var config20 = {
76694
76431
  deployScript: "deploy",
76695
76432
  previewScript: "dev"
76696
76433
  };
76697
- var c3_default25 = config20;
76434
+ var c3_default23 = config18;
76435
+
76436
+ // templates/hono/c3.ts
76437
+ var config19 = {
76438
+ displayName: "Hono",
76439
+ platformVariants: { pages: c3_default22, workers: c3_default23 }
76440
+ };
76441
+ var c3_default24 = config19;
76698
76442
 
76699
76443
  // templates/next/c3.ts
76700
76444
  var import_path10 = require("path");
76701
- var { npm: npm12, npx: npx4 } = detectPackageManager();
76702
- var generate17 = async (ctx) => {
76445
+ var { npm: npm9, npx: npx3 } = detectPackageManager();
76446
+ var generate14 = async (ctx) => {
76703
76447
  const projectName = ctx.project.name;
76704
76448
  await runFrameworkGenerator(ctx, [projectName]);
76705
76449
  const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
@@ -76724,7 +76468,7 @@ var updateNextConfig2 = (usesTs) => {
76724
76468
  writeFile2(configFile, updatedConfigFile);
76725
76469
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76726
76470
  };
76727
- var configure12 = async (ctx) => {
76471
+ var configure8 = async (ctx) => {
76728
76472
  const projectPath = ctx.project.path;
76729
76473
  const path6 = probePaths([
76730
76474
  `${projectPath}/pages/api`,
@@ -76799,14 +76543,14 @@ var addDevDependencies = async (installEslintPlugin) => {
76799
76543
  doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
76800
76544
  });
76801
76545
  };
76802
- var c3_default26 = {
76546
+ var c3_default25 = {
76803
76547
  configVersion: 1,
76804
76548
  id: "next",
76805
76549
  frameworkCli: "create-next-app",
76806
76550
  platform: "pages",
76807
76551
  displayName: "Next.js",
76808
- generate: generate17,
76809
- configure: configure12,
76552
+ generate: generate14,
76553
+ configure: configure8,
76810
76554
  copyFiles: {
76811
76555
  async selectVariant(ctx) {
76812
76556
  const isApp = probePaths([
@@ -76837,12 +76581,12 @@ var c3_default26 = {
76837
76581
  }
76838
76582
  },
76839
76583
  transformPackageJson: async (_3, ctx) => {
76840
- const isNpm = npm12 === "npm";
76841
- const isBun = npm12 === "bun";
76584
+ const isNpm = npm9 === "npm";
76585
+ const isBun = npm9 === "bun";
76842
76586
  const isNpmOrBun = isNpm || isBun;
76843
76587
  const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
76844
76588
  const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
76845
- const pmCommand = isNpmOrBun ? npx4 : npm12;
76589
+ const pmCommand = isNpmOrBun ? npx3 : npm9;
76846
76590
  const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
76847
76591
  return {
76848
76592
  scripts: {
@@ -76862,21 +76606,21 @@ var c3_default26 = {
76862
76606
  };
76863
76607
 
76864
76608
  // templates/nuxt/pages/c3.ts
76865
- var recast8 = __toESM(require_main3());
76866
- var { npm: npm13, name: pm2 } = detectPackageManager();
76867
- var generate18 = async (ctx) => {
76609
+ var recast6 = __toESM(require_main3());
76610
+ var { npm: npm10, name: pm2 } = detectPackageManager();
76611
+ var generate15 = async (ctx) => {
76868
76612
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76869
76613
  await runFrameworkGenerator(ctx, [
76870
76614
  "init",
76871
76615
  ctx.project.name,
76872
76616
  "--packageManager",
76873
- npm13,
76617
+ npm10,
76874
76618
  gitFlag
76875
76619
  ]);
76876
76620
  writeFile2("./.node-version", "18");
76877
76621
  logRaw("");
76878
76622
  };
76879
- var configure13 = async (ctx) => {
76623
+ var configure9 = async (ctx) => {
76880
76624
  const packages = ["nitro-cloudflare-dev"];
76881
76625
  if (pm2 === "pnpm") {
76882
76626
  packages.push("h3");
@@ -76884,7 +76628,7 @@ var configure13 = async (ctx) => {
76884
76628
  await installPackages(packages, {
76885
76629
  dev: true,
76886
76630
  startText: "Installing nitro module `nitro-cloudflare-dev`",
76887
- doneText: `${brandColor("installed")} ${dim(`via \`${npm13} install\``)}`
76631
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
76888
76632
  });
76889
76633
  updateNuxtConfig();
76890
76634
  updateEnvTypes2(ctx);
@@ -76907,7 +76651,7 @@ var updateNuxtConfig = () => {
76907
76651
  const s = spinner();
76908
76652
  const configFile = "nuxt.config.ts";
76909
76653
  s.start(`Updating \`${configFile}\``);
76910
- const b3 = recast8.types.builders;
76654
+ const b3 = recast6.types.builders;
76911
76655
  const presetDef = b3.objectProperty(
76912
76656
  b3.identifier("nitro"),
76913
76657
  b3.objectExpression([
@@ -76945,7 +76689,7 @@ var updateNuxtConfig = () => {
76945
76689
  });
76946
76690
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
76947
76691
  };
76948
- var config21 = {
76692
+ var config20 = {
76949
76693
  configVersion: 1,
76950
76694
  id: "nuxt",
76951
76695
  frameworkCli: "nuxi",
@@ -76955,12 +76699,12 @@ var config21 = {
76955
76699
  path: "./templates"
76956
76700
  },
76957
76701
  path: "templates/nuxt/pages",
76958
- generate: generate18,
76959
- configure: configure13,
76702
+ generate: generate15,
76703
+ configure: configure9,
76960
76704
  transformPackageJson: async () => ({
76961
76705
  scripts: {
76962
- deploy: `${npm13} run build && wrangler pages deploy`,
76963
- preview: `${npm13} run build && wrangler pages dev`,
76706
+ deploy: `${npm10} run build && wrangler pages deploy`,
76707
+ preview: `${npm10} run build && wrangler pages dev`,
76964
76708
  "cf-typegen": `wrangler types`
76965
76709
  }
76966
76710
  }),
@@ -76968,24 +76712,24 @@ var config21 = {
76968
76712
  deployScript: "deploy",
76969
76713
  previewScript: "preview"
76970
76714
  };
76971
- var c3_default27 = config21;
76715
+ var c3_default26 = config20;
76972
76716
 
76973
76717
  // templates/nuxt/workers/c3.ts
76974
- var recast9 = __toESM(require_main3());
76975
- var { npm: npm14, name: pm3 } = detectPackageManager();
76976
- var generate19 = async (ctx) => {
76718
+ var recast7 = __toESM(require_main3());
76719
+ var { npm: npm11, name: pm3 } = detectPackageManager();
76720
+ var generate16 = async (ctx) => {
76977
76721
  const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
76978
76722
  await runFrameworkGenerator(ctx, [
76979
76723
  "init",
76980
76724
  ctx.project.name,
76981
76725
  "--packageManager",
76982
- npm14,
76726
+ npm11,
76983
76727
  gitFlag
76984
76728
  ]);
76985
76729
  writeFile2("./.node-version", "18");
76986
76730
  logRaw("");
76987
76731
  };
76988
- var configure14 = async (ctx) => {
76732
+ var configure10 = async (ctx) => {
76989
76733
  const packages = ["nitro-cloudflare-dev", "nitropack"];
76990
76734
  if (pm3 === "pnpm") {
76991
76735
  packages.push("h3");
@@ -76993,7 +76737,7 @@ var configure14 = async (ctx) => {
76993
76737
  await installPackages(packages, {
76994
76738
  dev: true,
76995
76739
  startText: "Installing nitro module `nitro-cloudflare-dev`",
76996
- doneText: `${brandColor("installed")} ${dim(`via \`${npm14} install\``)}`
76740
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
76997
76741
  });
76998
76742
  updateNuxtConfig2();
76999
76743
  updateEnvTypes3(ctx);
@@ -77016,7 +76760,7 @@ var updateNuxtConfig2 = () => {
77016
76760
  const s = spinner();
77017
76761
  const configFile = "nuxt.config.ts";
77018
76762
  s.start(`Updating \`${configFile}\``);
77019
- const b3 = recast9.types.builders;
76763
+ const b3 = recast7.types.builders;
77020
76764
  const presetDef = b3.objectProperty(
77021
76765
  b3.identifier("nitro"),
77022
76766
  b3.objectExpression([
@@ -77054,7 +76798,7 @@ var updateNuxtConfig2 = () => {
77054
76798
  });
77055
76799
  s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
77056
76800
  };
77057
- var config22 = {
76801
+ var config21 = {
77058
76802
  configVersion: 1,
77059
76803
  id: "nuxt",
77060
76804
  frameworkCli: "nuxi",
@@ -77064,12 +76808,12 @@ var config22 = {
77064
76808
  path: "./templates"
77065
76809
  },
77066
76810
  path: "templates/nuxt/workers",
77067
- generate: generate19,
77068
- configure: configure14,
76811
+ generate: generate16,
76812
+ configure: configure10,
77069
76813
  transformPackageJson: async () => ({
77070
76814
  scripts: {
77071
- deploy: `${npm14} run build && wrangler deploy`,
77072
- preview: `${npm14} run build && wrangler dev`,
76815
+ deploy: `${npm11} run build && wrangler deploy`,
76816
+ preview: `${npm11} run build && wrangler dev`,
77073
76817
  "cf-typegen": `wrangler types`
77074
76818
  }
77075
76819
  }),
@@ -77077,17 +76821,17 @@ var config22 = {
77077
76821
  deployScript: "deploy",
77078
76822
  previewScript: "preview"
77079
76823
  };
77080
- var c3_default28 = config22;
76824
+ var c3_default27 = config21;
77081
76825
 
77082
76826
  // templates/nuxt/c3.ts
77083
- var config23 = {
76827
+ var config22 = {
77084
76828
  displayName: "Nuxt",
77085
- platformVariants: { pages: c3_default27, workers: c3_default28 }
76829
+ platformVariants: { pages: c3_default26, workers: c3_default27 }
77086
76830
  };
77087
- var c3_default29 = config23;
76831
+ var c3_default28 = config22;
77088
76832
 
77089
76833
  // templates/openapi/c3.ts
77090
- var c3_default30 = {
76834
+ var c3_default29 = {
77091
76835
  configVersion: 1,
77092
76836
  id: "openapi",
77093
76837
  displayName: "API starter (OpenAPI compliant)",
@@ -77246,7 +76990,7 @@ async function copyExistingWorkerFiles(ctx) {
77246
76990
  (0, import_path11.join)(ctx.project.path, "wrangler.toml")
77247
76991
  );
77248
76992
  }
77249
- var c3_default31 = {
76993
+ var c3_default30 = {
77250
76994
  configVersion: 1,
77251
76995
  id: "pre-existing",
77252
76996
  displayName: "Pre-existing Worker (from Dashboard)",
@@ -77262,7 +77006,7 @@ var c3_default31 = {
77262
77006
  })
77263
77007
  };
77264
77008
  function buildConfigure(params) {
77265
- return async function configure22(ctx) {
77009
+ return async function configure21(ctx) {
77266
77010
  const loginSuccess = await params.login(ctx);
77267
77011
  if (!loginSuccess) {
77268
77012
  throw new Error("Failed to login to Cloudflare");
@@ -77274,7 +77018,7 @@ function buildConfigure(params) {
77274
77018
  }
77275
77019
 
77276
77020
  // templates/queues/c3.ts
77277
- var c3_default32 = {
77021
+ var c3_default31 = {
77278
77022
  configVersion: 1,
77279
77023
  id: "queues",
77280
77024
  displayName: "Queue consumer & producer Worker",
@@ -77302,27 +77046,27 @@ var c3_default32 = {
77302
77046
  }
77303
77047
  };
77304
77048
 
77305
- // templates/qwik/c3.ts
77306
- var recast10 = __toESM(require_main3());
77307
- var { npm: npm15, npx: npx5, name: name2 } = detectPackageManager();
77308
- var generate20 = async (ctx) => {
77049
+ // templates/qwik/pages/c3.ts
77050
+ var recast8 = __toESM(require_main3());
77051
+ var { npm: npm12, npx: npx4, name } = detectPackageManager();
77052
+ var generate17 = async (ctx) => {
77309
77053
  await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
77310
77054
  };
77311
- var configure15 = async (ctx) => {
77312
- const cmd = [name2 === "pnpm" ? npm15 : npx5, "qwik", "add", "cloudflare-pages"];
77055
+ var configure11 = async (ctx) => {
77056
+ const cmd = [name === "pnpm" ? npm12 : npx4, "qwik", "add", "cloudflare-pages"];
77313
77057
  endSection(`Running ${quoteShellArgs(cmd)}`);
77314
77058
  await runCommand(cmd);
77315
- addBindingsProxy2(ctx);
77316
- populateCloudflareEnv2();
77059
+ addBindingsProxy(ctx);
77060
+ populateCloudflareEnv();
77317
77061
  };
77318
- var addBindingsProxy2 = (ctx) => {
77062
+ var addBindingsProxy = (ctx) => {
77319
77063
  if (!usesTypescript(ctx)) {
77320
77064
  return;
77321
77065
  }
77322
77066
  const s = spinner();
77323
77067
  s.start("Updating `vite.config.ts`");
77324
77068
  const snippets = loadTemplateSnippets(ctx);
77325
- const b3 = recast10.types.builders;
77069
+ const b3 = recast8.types.builders;
77326
77070
  transformFile("vite.config.ts", {
77327
77071
  // Insert the env declaration after the last import (but before the rest of the body)
77328
77072
  visitProgram: function(n) {
@@ -77358,13 +77102,124 @@ var addBindingsProxy2 = (ctx) => {
77358
77102
  });
77359
77103
  s.stop(`${brandColor("updated")} \`vite.config.ts\``);
77360
77104
  };
77105
+ var populateCloudflareEnv = () => {
77106
+ const entrypointPath = "src/entry.cloudflare-pages.tsx";
77107
+ const s = spinner();
77108
+ s.start(`Updating \`${entrypointPath}\``);
77109
+ transformFile(entrypointPath, {
77110
+ visitTSInterfaceDeclaration: function(n) {
77111
+ const b3 = recast8.types.builders;
77112
+ const id = n.node.id;
77113
+ if (id.name !== "QwikCityPlatform") {
77114
+ this.traverse(n);
77115
+ }
77116
+ const newBody = [
77117
+ ["env", "Env"]
77118
+ // Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
77119
+ // ["cf", "CfProperties"],
77120
+ ].map(
77121
+ ([varName, type]) => b3.tsPropertySignature(
77122
+ b3.identifier(varName),
77123
+ b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
77124
+ )
77125
+ );
77126
+ n.node.body.body = newBody;
77127
+ return false;
77128
+ }
77129
+ });
77130
+ s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
77131
+ };
77132
+ var config23 = {
77133
+ configVersion: 1,
77134
+ id: "qwik",
77135
+ frameworkCli: "create-qwik",
77136
+ displayName: "Qwik",
77137
+ platform: "pages",
77138
+ copyFiles: {
77139
+ path: "./templates"
77140
+ },
77141
+ path: "templates/qwik/pages",
77142
+ generate: generate17,
77143
+ configure: configure11,
77144
+ transformPackageJson: async () => ({
77145
+ scripts: {
77146
+ deploy: `${npm12} run build && wrangler pages deploy`,
77147
+ preview: `${npm12} run build && wrangler pages dev`,
77148
+ "cf-typegen": `wrangler types`
77149
+ }
77150
+ }),
77151
+ devScript: "dev",
77152
+ deployScript: "deploy",
77153
+ previewScript: "preview"
77154
+ };
77155
+ var c3_default32 = config23;
77156
+
77157
+ // templates/qwik/workers/c3.ts
77158
+ var recast9 = __toESM(require_main3());
77159
+ var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
77160
+ var generate18 = async (ctx) => {
77161
+ await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
77162
+ };
77163
+ var configure12 = async (ctx) => {
77164
+ const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
77165
+ endSection(`Running ${quoteShellArgs(cmd)}`);
77166
+ await runCommand(cmd);
77167
+ removeFile("./public/_headers");
77168
+ removeFile("./public/_redirects");
77169
+ removeFile("./public/_routes.json");
77170
+ addBindingsProxy2(ctx);
77171
+ populateCloudflareEnv2();
77172
+ };
77173
+ var addBindingsProxy2 = (ctx) => {
77174
+ if (!usesTypescript(ctx)) {
77175
+ return;
77176
+ }
77177
+ const s = spinner();
77178
+ s.start("Updating `vite.config.ts`");
77179
+ const snippets = loadTemplateSnippets(ctx);
77180
+ const b3 = recast9.types.builders;
77181
+ transformFile("vite.config.ts", {
77182
+ // Insert the env declaration after the last import (but before the rest of the body)
77183
+ visitProgram: function(n) {
77184
+ const lastImportIndex = n.node.body.findLastIndex(
77185
+ (t2) => t2.type === "ImportDeclaration"
77186
+ );
77187
+ const lastImport = n.get("body", lastImportIndex);
77188
+ lastImport.insertAfter(...snippets.getPlatformProxyTs);
77189
+ return this.traverse(n);
77190
+ },
77191
+ // Pass the `platform` object from the declaration to the `qwikCity` plugin
77192
+ visitCallExpression: function(n) {
77193
+ const callee = n.node.callee;
77194
+ if (callee.name !== "qwikCity") {
77195
+ return this.traverse(n);
77196
+ }
77197
+ const configArgument = n.node.arguments[0];
77198
+ const platformPropery = b3.objectProperty.from({
77199
+ key: b3.identifier("platform"),
77200
+ value: b3.identifier("platform"),
77201
+ shorthand: true
77202
+ });
77203
+ if (!configArgument) {
77204
+ n.node.arguments = [b3.objectExpression([platformPropery])];
77205
+ return false;
77206
+ }
77207
+ if (configArgument.type !== "ObjectExpression") {
77208
+ crash("Failed to update `vite.config.ts`");
77209
+ }
77210
+ configArgument.properties.push(platformPropery);
77211
+ return false;
77212
+ }
77213
+ });
77214
+ s.stop(`${brandColor("updated")} \`vite.config.ts\``);
77215
+ };
77361
77216
  var populateCloudflareEnv2 = () => {
77362
77217
  const entrypointPath = "src/entry.cloudflare-pages.tsx";
77363
77218
  const s = spinner();
77364
77219
  s.start(`Updating \`${entrypointPath}\``);
77365
77220
  transformFile(entrypointPath, {
77366
77221
  visitTSInterfaceDeclaration: function(n) {
77367
- const b3 = recast10.types.builders;
77222
+ const b3 = recast9.types.builders;
77368
77223
  const id = n.node.id;
77369
77224
  if (id.name !== "QwikCityPlatform") {
77370
77225
  this.traverse(n);
@@ -77390,16 +77245,17 @@ var config24 = {
77390
77245
  id: "qwik",
77391
77246
  frameworkCli: "create-qwik",
77392
77247
  displayName: "Qwik",
77393
- platform: "pages",
77248
+ platform: "workers",
77394
77249
  copyFiles: {
77395
77250
  path: "./templates"
77396
77251
  },
77397
- generate: generate20,
77398
- configure: configure15,
77252
+ path: "templates/qwik/workers",
77253
+ generate: generate18,
77254
+ configure: configure12,
77399
77255
  transformPackageJson: async () => ({
77400
77256
  scripts: {
77401
- deploy: `${npm15} run build && wrangler pages deploy`,
77402
- preview: `${npm15} run build && wrangler pages dev`,
77257
+ deploy: `${npm13} run build && wrangler deploy`,
77258
+ preview: `${npm13} run build && wrangler dev`,
77403
77259
  "cf-typegen": `wrangler types`
77404
77260
  }
77405
77261
  }),
@@ -77409,9 +77265,16 @@ var config24 = {
77409
77265
  };
77410
77266
  var c3_default33 = config24;
77411
77267
 
77268
+ // templates/qwik/c3.ts
77269
+ var config25 = {
77270
+ displayName: "Qwik",
77271
+ platformVariants: { pages: c3_default32, workers: c3_default33 }
77272
+ };
77273
+ var c3_default34 = config25;
77274
+
77412
77275
  // templates/react/pages/c3.ts
77413
- var { npm: npm16 } = detectPackageManager();
77414
- var generate21 = async (ctx) => {
77276
+ var { npm: npm14 } = detectPackageManager();
77277
+ var generate19 = async (ctx) => {
77415
77278
  const variant = await inputPrompt({
77416
77279
  type: "select",
77417
77280
  question: "Select a variant:",
@@ -77440,7 +77303,7 @@ var variantsOptions = [
77440
77303
  label: "JavaScript + SWC"
77441
77304
  }
77442
77305
  ];
77443
- var config25 = {
77306
+ var config26 = {
77444
77307
  configVersion: 1,
77445
77308
  id: "react",
77446
77309
  // React's documentation now recommends using create-vite.
@@ -77448,26 +77311,26 @@ var config25 = {
77448
77311
  displayName: "React",
77449
77312
  platform: "pages",
77450
77313
  path: "templates/react/pages",
77451
- generate: generate21,
77314
+ generate: generate19,
77452
77315
  transformPackageJson: async () => ({
77453
77316
  scripts: {
77454
- deploy: `${npm16} run build && wrangler pages deploy ./dist`,
77455
- preview: `${npm16} run build && wrangler pages dev ./dist`
77317
+ deploy: `${npm14} run build && wrangler pages deploy ./dist`,
77318
+ preview: `${npm14} run build && wrangler pages dev ./dist`
77456
77319
  }
77457
77320
  }),
77458
77321
  devScript: "dev",
77459
77322
  deployScript: "deploy",
77460
77323
  previewScript: "preview"
77461
77324
  };
77462
- var c3_default34 = config25;
77325
+ var c3_default35 = config26;
77463
77326
 
77464
77327
  // templates/react/workers/c3.ts
77465
77328
  var import_assert2 = __toESM(require("assert"));
77466
- var recast11 = __toESM(require_main3());
77467
- var b2 = recast11.types.builders;
77468
- var t = recast11.types.namedTypes;
77469
- var { npm: npm17 } = detectPackageManager();
77470
- var generate22 = async (ctx) => {
77329
+ var recast10 = __toESM(require_main3());
77330
+ var b2 = recast10.types.builders;
77331
+ var t = recast10.types.namedTypes;
77332
+ var { npm: npm15 } = detectPackageManager();
77333
+ var generate20 = async (ctx) => {
77471
77334
  const variant = await getVariant();
77472
77335
  ctx.args.lang = variant.lang;
77473
77336
  await runFrameworkGenerator(ctx, [
@@ -77477,7 +77340,7 @@ var generate22 = async (ctx) => {
77477
77340
  ]);
77478
77341
  logRaw("");
77479
77342
  };
77480
- var configure16 = async (ctx) => {
77343
+ var configure13 = async (ctx) => {
77481
77344
  await installPackages(["@cloudflare/vite-plugin"], {
77482
77345
  dev: true,
77483
77346
  startText: "Installing the Cloudflare Vite plugin",
@@ -77508,9 +77371,9 @@ function transformViteConfig(ctx) {
77508
77371
  if (callee.name !== "defineConfig") {
77509
77372
  return this.traverse(n);
77510
77373
  }
77511
- const config34 = n.node.arguments[0];
77512
- (0, import_assert2.default)(t.ObjectExpression.check(config34));
77513
- const pluginsProp = config34.properties.find((prop) => isPluginsProp(prop));
77374
+ const config39 = n.node.arguments[0];
77375
+ (0, import_assert2.default)(t.ObjectExpression.check(config39));
77376
+ const pluginsProp = config39.properties.find((prop) => isPluginsProp(prop));
77514
77377
  (0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
77515
77378
  pluginsProp.value.elements.push(
77516
77379
  b2.callExpression(b2.identifier("cloudflare"), [])
@@ -77567,7 +77430,7 @@ async function getVariant() {
77567
77430
  (0, import_assert2.default)(selected, "Expected a variant to be selected");
77568
77431
  return selected;
77569
77432
  }
77570
- var config26 = {
77433
+ var config27 = {
77571
77434
  configVersion: 1,
77572
77435
  id: "react",
77573
77436
  frameworkCli: "create-vite",
@@ -77584,12 +77447,12 @@ var config26 = {
77584
77447
  }
77585
77448
  }
77586
77449
  },
77587
- generate: generate22,
77588
- configure: configure16,
77450
+ generate: generate20,
77451
+ configure: configure13,
77589
77452
  transformPackageJson: async (_3, ctx) => ({
77590
77453
  scripts: {
77591
- deploy: `${npm17} run build && wrangler deploy`,
77592
- preview: `${npm17} run build && vite preview`,
77454
+ deploy: `${npm15} run build && wrangler deploy`,
77455
+ preview: `${npm15} run build && vite preview`,
77593
77456
  ...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
77594
77457
  }
77595
77458
  }),
@@ -77597,18 +77460,18 @@ var config26 = {
77597
77460
  deployScript: "deploy",
77598
77461
  previewScript: "preview"
77599
77462
  };
77600
- var c3_default35 = config26;
77463
+ var c3_default36 = config27;
77601
77464
 
77602
77465
  // templates/react/c3.ts
77603
- var config27 = {
77466
+ var config28 = {
77604
77467
  displayName: "React",
77605
- platformVariants: { pages: c3_default34, workers: c3_default35 }
77468
+ platformVariants: { pages: c3_default35, workers: c3_default36 }
77606
77469
  };
77607
- var c3_default36 = config27;
77470
+ var c3_default37 = config28;
77608
77471
 
77609
- // templates/remix/c3.ts
77610
- var { npm: npm18 } = detectPackageManager();
77611
- var generate23 = async (ctx) => {
77472
+ // templates/remix/pages/c3.ts
77473
+ var { npm: npm16 } = detectPackageManager();
77474
+ var generate21 = async (ctx) => {
77612
77475
  await runFrameworkGenerator(ctx, [
77613
77476
  ctx.project.name,
77614
77477
  "--template",
@@ -77616,7 +77479,7 @@ var generate23 = async (ctx) => {
77616
77479
  ]);
77617
77480
  logRaw("");
77618
77481
  };
77619
- var configure17 = async () => {
77482
+ var configure14 = async () => {
77620
77483
  const typeDefsPath = "load-context.ts";
77621
77484
  const s = spinner();
77622
77485
  s.start(`Updating \`${typeDefsPath}\``);
@@ -77631,7 +77494,7 @@ var configure17 = async () => {
77631
77494
  });
77632
77495
  s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
77633
77496
  };
77634
- var config28 = {
77497
+ var config29 = {
77635
77498
  configVersion: 1,
77636
77499
  id: "remix",
77637
77500
  frameworkCli: "create-remix",
@@ -77640,12 +77503,13 @@ var config28 = {
77640
77503
  copyFiles: {
77641
77504
  path: "./templates"
77642
77505
  },
77643
- generate: generate23,
77644
- configure: configure17,
77506
+ path: "templates/remix/pages",
77507
+ generate: generate21,
77508
+ configure: configure14,
77645
77509
  transformPackageJson: async () => ({
77646
77510
  scripts: {
77647
- deploy: `${npm18} run build && wrangler pages deploy`,
77648
- preview: `${npm18} run build && wrangler pages dev`,
77511
+ deploy: `${npm16} run build && wrangler pages deploy`,
77512
+ preview: `${npm16} run build && wrangler pages dev`,
77649
77513
  "cf-typegen": `wrangler types`
77650
77514
  }
77651
77515
  }),
@@ -77653,10 +77517,59 @@ var config28 = {
77653
77517
  deployScript: "deploy",
77654
77518
  previewScript: "preview"
77655
77519
  };
77656
- var c3_default37 = config28;
77520
+ var c3_default38 = config29;
77521
+
77522
+ // templates/remix/workers/c3.ts
77523
+ var { npm: npm17 } = detectPackageManager();
77524
+ var generate22 = async (ctx) => {
77525
+ await runFrameworkGenerator(ctx, [
77526
+ ctx.project.name,
77527
+ "--template",
77528
+ "https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
77529
+ ]);
77530
+ logRaw("");
77531
+ };
77532
+ var configure15 = async () => {
77533
+ await installPackages(["wrangler@latest"], {
77534
+ dev: true,
77535
+ startText: "Updating the Wrangler version",
77536
+ doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
77537
+ });
77538
+ };
77539
+ var config30 = {
77540
+ configVersion: 1,
77541
+ id: "remix",
77542
+ frameworkCli: "create-remix",
77543
+ platform: "workers",
77544
+ displayName: "Remix",
77545
+ copyFiles: {
77546
+ path: "./templates"
77547
+ },
77548
+ path: "templates/remix/workers",
77549
+ generate: generate22,
77550
+ configure: configure15,
77551
+ transformPackageJson: async () => ({
77552
+ scripts: {
77553
+ deploy: `${npm17} run build && wrangler deploy`,
77554
+ preview: `${npm17} run build && wrangler dev`,
77555
+ "cf-typegen": `wrangler types`
77556
+ }
77557
+ }),
77558
+ devScript: "dev",
77559
+ deployScript: "deploy",
77560
+ previewScript: "preview"
77561
+ };
77562
+ var c3_default39 = config30;
77563
+
77564
+ // templates/remix/c3.ts
77565
+ var config31 = {
77566
+ displayName: "Remix",
77567
+ platformVariants: { pages: c3_default38, workers: c3_default39 }
77568
+ };
77569
+ var c3_default40 = config31;
77657
77570
 
77658
77571
  // templates/scheduled/c3.ts
77659
- var c3_default38 = {
77572
+ var c3_default41 = {
77660
77573
  configVersion: 1,
77661
77574
  id: "scheduled",
77662
77575
  displayName: "Scheduled Worker (Cron Trigger)",
@@ -77675,13 +77588,13 @@ var c3_default38 = {
77675
77588
  };
77676
77589
 
77677
77590
  // templates/solid/c3.ts
77678
- var recast12 = __toESM(require_main3());
77679
- var { npm: npm19 } = detectPackageManager();
77680
- var generate24 = async (ctx) => {
77591
+ var recast11 = __toESM(require_main3());
77592
+ var { npm: npm18 } = detectPackageManager();
77593
+ var generate23 = async (ctx) => {
77681
77594
  await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
77682
77595
  logRaw("");
77683
77596
  };
77684
- var configure18 = async (ctx) => {
77597
+ var configure16 = async (ctx) => {
77685
77598
  usesTypescript(ctx);
77686
77599
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
77687
77600
  updateStatus(`Updating configuration in ${blue(filePath)}`);
@@ -77691,7 +77604,7 @@ var configure18 = async (ctx) => {
77691
77604
  if (callee.name !== "defineConfig") {
77692
77605
  return this.traverse(n);
77693
77606
  }
77694
- const b3 = recast12.types.builders;
77607
+ const b3 = recast11.types.builders;
77695
77608
  mergeObjectProperties(
77696
77609
  n.node.arguments[0],
77697
77610
  [
@@ -77719,7 +77632,7 @@ var configure18 = async (ctx) => {
77719
77632
  }
77720
77633
  });
77721
77634
  };
77722
- var config29 = {
77635
+ var config32 = {
77723
77636
  configVersion: 1,
77724
77637
  id: "solid",
77725
77638
  frameworkCli: "create-solid",
@@ -77728,12 +77641,12 @@ var config29 = {
77728
77641
  copyFiles: {
77729
77642
  path: "./templates"
77730
77643
  },
77731
- generate: generate24,
77732
- configure: configure18,
77644
+ generate: generate23,
77645
+ configure: configure16,
77733
77646
  transformPackageJson: async () => ({
77734
77647
  scripts: {
77735
- preview: `${npm19} run build && npx wrangler pages dev`,
77736
- deploy: `${npm19} run build && wrangler pages deploy`
77648
+ preview: `${npm18} run build && npx wrangler pages dev`,
77649
+ deploy: `${npm18} run build && wrangler pages deploy`
77737
77650
  }
77738
77651
  }),
77739
77652
  compatibilityFlags: ["nodejs_compat"],
@@ -77741,29 +77654,29 @@ var config29 = {
77741
77654
  deployScript: "deploy",
77742
77655
  previewScript: "preview"
77743
77656
  };
77744
- var c3_default39 = config29;
77657
+ var c3_default42 = config32;
77745
77658
 
77746
- // templates/svelte/c3.ts
77659
+ // templates/svelte/pages/c3.ts
77747
77660
  var import_node_fs3 = require("node:fs");
77748
- var import_node_os4 = require("node:os");
77749
- var recast13 = __toESM(require_main3());
77750
- var { npm: npm20 } = detectPackageManager();
77751
- var generate25 = async (ctx) => {
77661
+ var import_node_os3 = require("node:os");
77662
+ var recast12 = __toESM(require_main3());
77663
+ var { npm: npm19 } = detectPackageManager();
77664
+ var generate24 = async (ctx) => {
77752
77665
  await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
77753
77666
  logRaw("");
77754
77667
  };
77755
- var configure19 = async (ctx) => {
77668
+ var configure17 = async (ctx) => {
77756
77669
  const pkg = `@sveltejs/adapter-cloudflare`;
77757
77670
  await installPackages([pkg], {
77758
77671
  dev: true,
77759
77672
  startText: "Adding the Cloudflare Pages adapter",
77760
77673
  doneText: `${brandColor(`installed`)} ${dim(pkg)}`
77761
77674
  });
77762
- updateSvelteConfig2();
77675
+ updateSvelteConfig();
77763
77676
  updatePlaywrightConfig(usesTypescript(ctx));
77764
- updateTypeDefinitions2(ctx);
77677
+ updateTypeDefinitions(ctx);
77765
77678
  };
77766
- var updateSvelteConfig2 = () => {
77679
+ var updateSvelteConfig = () => {
77767
77680
  updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
77768
77681
  transformFile("svelte.config.js", {
77769
77682
  visitImportDeclaration: function(n) {
@@ -77797,6 +77710,105 @@ var updatePlaywrightConfig = (shouldUseTypescript) => {
77797
77710
  }
77798
77711
  });
77799
77712
  };
77713
+ var updateTypeDefinitions = (ctx) => {
77714
+ if (!usesTypescript(ctx)) {
77715
+ return;
77716
+ }
77717
+ updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
77718
+ const b3 = recast12.types.builders;
77719
+ transformFile("src/app.d.ts", {
77720
+ visitTSModuleDeclaration(n) {
77721
+ if (n.value.id.name === "App" && n.node.body) {
77722
+ const moduleBlock = n.node.body;
77723
+ const platformInterface = b3.tsInterfaceDeclaration(
77724
+ b3.identifier("Platform"),
77725
+ b3.tsInterfaceBody([
77726
+ b3.tsPropertySignature(
77727
+ b3.identifier("env"),
77728
+ b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
77729
+ ),
77730
+ b3.tsPropertySignature(
77731
+ b3.identifier("cf"),
77732
+ b3.tsTypeAnnotation(
77733
+ b3.tsTypeReference(b3.identifier("CfProperties"))
77734
+ )
77735
+ ),
77736
+ b3.tsPropertySignature(
77737
+ b3.identifier("ctx"),
77738
+ b3.tsTypeAnnotation(
77739
+ b3.tsTypeReference(b3.identifier("ExecutionContext"))
77740
+ )
77741
+ )
77742
+ ])
77743
+ );
77744
+ moduleBlock.body.unshift(platformInterface);
77745
+ }
77746
+ this.traverse(n);
77747
+ }
77748
+ });
77749
+ };
77750
+ var config33 = {
77751
+ configVersion: 1,
77752
+ id: "svelte",
77753
+ frameworkCli: "sv",
77754
+ displayName: "SvelteKit",
77755
+ platform: "pages",
77756
+ copyFiles: {
77757
+ path: "./templates"
77758
+ },
77759
+ path: "templates/svelte/pages",
77760
+ generate: generate24,
77761
+ configure: configure17,
77762
+ transformPackageJson: async (original, ctx) => {
77763
+ let scripts = {
77764
+ preview: `${npm19} run build && wrangler pages dev`,
77765
+ deploy: `${npm19} run build && wrangler pages deploy`
77766
+ };
77767
+ if (usesTypescript(ctx)) {
77768
+ const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
77769
+ scripts = {
77770
+ ...scripts,
77771
+ "cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
77772
+ };
77773
+ }
77774
+ return { scripts };
77775
+ },
77776
+ devScript: "dev",
77777
+ deployScript: "deploy",
77778
+ previewScript: "preview"
77779
+ };
77780
+ var c3_default43 = config33;
77781
+
77782
+ // templates/svelte/workers/c3.ts
77783
+ var import_node_os4 = require("node:os");
77784
+ var recast13 = __toESM(require_main3());
77785
+ var { npm: npm20 } = detectPackageManager();
77786
+ var generate25 = async (ctx) => {
77787
+ await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
77788
+ logRaw("");
77789
+ };
77790
+ var configure18 = async (ctx) => {
77791
+ const pkg = `@sveltejs/adapter-cloudflare`;
77792
+ await installPackages([pkg], {
77793
+ dev: true,
77794
+ startText: "Adding the Cloudflare adapter",
77795
+ doneText: `${brandColor(`installed`)} ${dim(pkg)}`
77796
+ });
77797
+ updateSvelteConfig2();
77798
+ updateTypeDefinitions2(ctx);
77799
+ };
77800
+ var updateSvelteConfig2 = () => {
77801
+ updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
77802
+ transformFile("svelte.config.js", {
77803
+ visitImportDeclaration: function(n) {
77804
+ const importSource = n.value.source;
77805
+ if (importSource.value === "@sveltejs/adapter-auto") {
77806
+ importSource.value = "@sveltejs/adapter-cloudflare";
77807
+ }
77808
+ return false;
77809
+ }
77810
+ });
77811
+ };
77800
77812
  var updateTypeDefinitions2 = (ctx) => {
77801
77813
  if (!usesTypescript(ctx)) {
77802
77814
  return;
@@ -77834,21 +77846,22 @@ var updateTypeDefinitions2 = (ctx) => {
77834
77846
  }
77835
77847
  });
77836
77848
  };
77837
- var config30 = {
77849
+ var config34 = {
77838
77850
  configVersion: 1,
77839
77851
  id: "svelte",
77840
77852
  frameworkCli: "sv",
77841
77853
  displayName: "SvelteKit",
77842
- platform: "pages",
77854
+ platform: "workers",
77843
77855
  copyFiles: {
77844
77856
  path: "./templates"
77845
77857
  },
77858
+ path: "templates/svelte/workers",
77846
77859
  generate: generate25,
77847
- configure: configure19,
77860
+ configure: configure18,
77848
77861
  transformPackageJson: async (original, ctx) => {
77849
77862
  let scripts = {
77850
- preview: `${npm20} run build && wrangler pages dev`,
77851
- deploy: `${npm20} run build && wrangler pages deploy`
77863
+ preview: `${npm20} run build && wrangler dev`,
77864
+ deploy: `${npm20} run build && wrangler deploy`
77852
77865
  };
77853
77866
  if (usesTypescript(ctx)) {
77854
77867
  const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
@@ -77863,14 +77876,21 @@ var config30 = {
77863
77876
  deployScript: "deploy",
77864
77877
  previewScript: "preview"
77865
77878
  };
77866
- var c3_default40 = config30;
77879
+ var c3_default44 = config34;
77880
+
77881
+ // templates/svelte/c3.ts
77882
+ var config35 = {
77883
+ displayName: "SvelteKit",
77884
+ platformVariants: { pages: c3_default43, workers: c3_default44 }
77885
+ };
77886
+ var c3_default45 = config35;
77867
77887
 
77868
77888
  // templates/vue/pages/c3.ts
77869
77889
  var { npm: npm21 } = detectPackageManager();
77870
77890
  var generate26 = async (ctx) => {
77871
77891
  await runFrameworkGenerator(ctx, [ctx.project.name]);
77872
77892
  };
77873
- var config31 = {
77893
+ var config36 = {
77874
77894
  configVersion: 1,
77875
77895
  id: "vue",
77876
77896
  frameworkCli: "create-vue",
@@ -77888,7 +77908,7 @@ var config31 = {
77888
77908
  deployScript: "deploy",
77889
77909
  previewScript: "preview"
77890
77910
  };
77891
- var c3_default41 = config31;
77911
+ var c3_default46 = config36;
77892
77912
 
77893
77913
  // templates/vue/workers/c3.ts
77894
77914
  var { npm: npm22 } = detectPackageManager();
@@ -77909,7 +77929,7 @@ var generate27 = async (ctx) => {
77909
77929
  ]);
77910
77930
  logRaw("");
77911
77931
  };
77912
- var configure20 = async (ctx) => {
77932
+ var configure19 = async (ctx) => {
77913
77933
  await installPackages(["@cloudflare/vite-plugin"], {
77914
77934
  dev: true,
77915
77935
  startText: "Installing the Cloudflare Vite plugin",
@@ -77930,7 +77950,7 @@ function updateTsconfigJson2() {
77930
77950
  writeJSON("tsconfig.json", tsconfig);
77931
77951
  s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
77932
77952
  }
77933
- var config32 = {
77953
+ var config37 = {
77934
77954
  configVersion: 1,
77935
77955
  id: "vue",
77936
77956
  frameworkCli: "create-vue",
@@ -77950,7 +77970,7 @@ var config32 = {
77950
77970
  }
77951
77971
  }
77952
77972
  },
77953
- configure: configure20,
77973
+ configure: configure19,
77954
77974
  generate: generate27,
77955
77975
  transformPackageJson: async (_3, ctx) => ({
77956
77976
  scripts: {
@@ -77963,20 +77983,20 @@ var config32 = {
77963
77983
  deployScript: "deploy",
77964
77984
  previewScript: "preview"
77965
77985
  };
77966
- var c3_default42 = config32;
77986
+ var c3_default47 = config37;
77967
77987
 
77968
77988
  // templates/vue/c3.ts
77969
- var config33 = {
77989
+ var config38 = {
77970
77990
  displayName: "Vue",
77971
- platformVariants: { pages: c3_default41, workers: c3_default42 }
77991
+ platformVariants: { pages: c3_default46, workers: c3_default47 }
77972
77992
  };
77973
- var c3_default43 = config33;
77993
+ var c3_default48 = config38;
77974
77994
 
77975
77995
  // src/git.ts
77976
77996
  var import_node_assert = __toESM(require("node:assert"));
77977
77997
 
77978
77998
  // ../wrangler/package.json
77979
- var version2 = "4.2.0";
77999
+ var version2 = "4.4.0";
77980
78000
 
77981
78001
  // src/git.ts
77982
78002
  var offerGit = async (ctx) => {
@@ -78237,30 +78257,25 @@ var defaultSelectVariant = async (ctx) => {
78237
78257
  function getFrameworkMap({ experimental = false }) {
78238
78258
  if (experimental) {
78239
78259
  return {
78240
- astro: c3_default,
78241
- hono: c3_default2,
78242
- next: c3_default3,
78243
- qwik: c3_default4,
78244
- remix: c3_default5,
78245
- solid: c3_default6,
78246
- svelte: c3_default7
78260
+ next: c3_default,
78261
+ solid: c3_default2
78247
78262
  };
78248
78263
  } else {
78249
78264
  return {
78250
- analog: c3_default8,
78251
- angular: c3_default11,
78252
- astro: c3_default12,
78253
- docusaurus: c3_default16,
78254
- gatsby: c3_default19,
78255
- hono: c3_default25,
78256
- next: c3_default26,
78257
- nuxt: c3_default29,
78258
- qwik: c3_default33,
78259
- react: c3_default36,
78260
- remix: c3_default37,
78261
- solid: c3_default39,
78262
- svelte: c3_default40,
78263
- vue: c3_default43
78265
+ analog: c3_default3,
78266
+ angular: c3_default6,
78267
+ astro: c3_default9,
78268
+ docusaurus: c3_default13,
78269
+ gatsby: c3_default16,
78270
+ hono: c3_default24,
78271
+ next: c3_default25,
78272
+ nuxt: c3_default28,
78273
+ qwik: c3_default34,
78274
+ react: c3_default37,
78275
+ remix: c3_default40,
78276
+ solid: c3_default42,
78277
+ svelte: c3_default45,
78278
+ vue: c3_default48
78264
78279
  };
78265
78280
  }
78266
78281
  }
@@ -78269,16 +78284,16 @@ function getTemplateMap({ experimental = false }) {
78269
78284
  return {};
78270
78285
  } else {
78271
78286
  return {
78272
- "hello-world": c3_default24,
78273
- "hello-world-assets-only": c3_default20,
78274
- "hello-world-with-assets": c3_default23,
78275
- "hello-world-durable-object": c3_default22,
78276
- "hello-world-durable-object-with-assets": c3_default21,
78277
- common: c3_default13,
78278
- scheduled: c3_default38,
78279
- queues: c3_default32,
78280
- openapi: c3_default30,
78281
- "pre-existing": c3_default31
78287
+ "hello-world": c3_default21,
78288
+ "hello-world-assets-only": c3_default17,
78289
+ "hello-world-with-assets": c3_default20,
78290
+ "hello-world-durable-object": c3_default19,
78291
+ "hello-world-durable-object-with-assets": c3_default18,
78292
+ common: c3_default10,
78293
+ scheduled: c3_default41,
78294
+ queues: c3_default31,
78295
+ openapi: c3_default29,
78296
+ "pre-existing": c3_default30
78282
78297
  };
78283
78298
  }
78284
78299
  }
@@ -78426,8 +78441,8 @@ var createContext = async (args, prevArgs) => {
78426
78441
  experimental: args.experimental
78427
78442
  });
78428
78443
  const frameworkOptions = Object.entries(frameworkMap).map(
78429
- ([key, config34]) => ({
78430
- label: config34.displayName,
78444
+ ([key, config39]) => ({
78445
+ label: config39.displayName,
78431
78446
  value: key
78432
78447
  })
78433
78448
  );
@@ -78594,28 +78609,28 @@ var processRemoteTemplate = async (args) => {
78594
78609
  src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
78595
78610
  }
78596
78611
  const path6 = await downloadRemoteTemplate(src);
78597
- const config34 = inferTemplateConfig(path6);
78598
- validateTemplate(path6, config34);
78612
+ const config39 = inferTemplateConfig(path6);
78613
+ validateTemplate(path6, config39);
78599
78614
  updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
78600
78615
  return {
78601
78616
  path: path6,
78602
- ...config34
78617
+ ...config39
78603
78618
  };
78604
78619
  };
78605
- var validateTemplate = (path6, config34) => {
78606
- if (!config34.copyFiles) {
78620
+ var validateTemplate = (path6, config39) => {
78621
+ if (!config39.copyFiles) {
78607
78622
  return;
78608
78623
  }
78609
- if (isVariantInfo(config34.copyFiles)) {
78610
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config34.copyFiles.path), config34);
78624
+ if (isVariantInfo(config39.copyFiles)) {
78625
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config39.copyFiles.path), config39);
78611
78626
  } else {
78612
- for (const variant of Object.values(config34.copyFiles.variants)) {
78613
- validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config34);
78627
+ for (const variant of Object.values(config39.copyFiles.variants)) {
78628
+ validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config39);
78614
78629
  }
78615
78630
  }
78616
78631
  };
78617
- var validateTemplateSrcDirectory = (path6, config34) => {
78618
- if (config34.platform === "workers") {
78632
+ var validateTemplateSrcDirectory = (path6, config39) => {
78633
+ if (config39.platform === "workers") {
78619
78634
  const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
78620
78635
  const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
78621
78636
  const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
@@ -80526,20 +80541,20 @@ function applyEdits(text, edits) {
80526
80541
  var import_fs12 = require("fs");
80527
80542
  var import_path14 = require("path");
80528
80543
  var import_toml2 = __toESM(require_toml());
80529
- function ensureNameExists(config34, projectName) {
80530
- config34["name"] = projectName;
80531
- return config34;
80544
+ function ensureNameExists(config39, projectName) {
80545
+ config39["name"] = projectName;
80546
+ return config39;
80532
80547
  }
80533
- async function ensureCompatDateExists(config34) {
80534
- if (typeof config34["compatibility_date"] === "string") {
80548
+ async function ensureCompatDateExists(config39) {
80549
+ if (typeof config39["compatibility_date"] === "string") {
80535
80550
  const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
80536
- if (!config34["compatibility_date"].match(validCompatDateRe)) {
80537
- config34["compatibility_date"] = await getWorkerdCompatibilityDate();
80551
+ if (!config39["compatibility_date"].match(validCompatDateRe)) {
80552
+ config39["compatibility_date"] = await getWorkerdCompatibilityDate();
80538
80553
  }
80539
80554
  } else {
80540
- config34["compatibility_date"] = await getWorkerdCompatibilityDate();
80555
+ config39["compatibility_date"] = await getWorkerdCompatibilityDate();
80541
80556
  }
80542
- return config34;
80557
+ return config39;
80543
80558
  }
80544
80559
  var updateWranglerConfig = async (ctx) => {
80545
80560
  if (wranglerJsonExists(ctx)) {
@@ -81253,8 +81268,8 @@ var renderValues = (values) => {
81253
81268
  };
81254
81269
 
81255
81270
  // src/helpers/retry.ts
81256
- var retry = async (config34, fn) => {
81257
- let { times } = config34;
81271
+ var retry = async (config39, fn) => {
81272
+ let { times } = config39;
81258
81273
  let error2 = null;
81259
81274
  while (times > 0) {
81260
81275
  try {
@@ -81262,10 +81277,10 @@ var retry = async (config34, fn) => {
81262
81277
  } catch (e) {
81263
81278
  error2 = e;
81264
81279
  times--;
81265
- if (config34.exitCondition?.(e)) {
81280
+ if (config39.exitCondition?.(e)) {
81266
81281
  break;
81267
81282
  }
81268
- await sleep(config34.sleepMs ?? 1e3);
81283
+ await sleep(config39.sleepMs ?? 1e3);
81269
81284
  }
81270
81285
  }
81271
81286
  throw error2;
@@ -81385,8 +81400,8 @@ async function addWorkersTypesToTsConfig(ctx) {
81385
81400
  }
81386
81401
  const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
81387
81402
  try {
81388
- const config34 = parse4(tsconfig);
81389
- const currentTypes = config34.compilerOptions?.types ?? [];
81403
+ const config39 = parse4(tsconfig);
81404
+ const currentTypes = config39.compilerOptions?.types ?? [];
81390
81405
  const explicitEntrypoint = currentTypes.some(
81391
81406
  (t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
81392
81407
  );
@@ -81461,7 +81476,7 @@ var runCli = async (args) => {
81461
81476
  printBanner(args);
81462
81477
  const ctx = await createContext(args);
81463
81478
  await create(ctx);
81464
- await configure21(ctx);
81479
+ await configure20(ctx);
81465
81480
  await deploy(ctx);
81466
81481
  printSummary(ctx);
81467
81482
  logRaw("");
@@ -81489,7 +81504,7 @@ var create = async (ctx) => {
81489
81504
  await rectifyPmMismatch(ctx);
81490
81505
  endSection(`Application created`);
81491
81506
  };
81492
- var configure21 = async (ctx) => {
81507
+ var configure20 = async (ctx) => {
81493
81508
  startSection("Configuring your application for Cloudflare", "Step 2 of 3");
81494
81509
  await installWrangler();
81495
81510
  await installWorkersTypes(ctx);