create-cloudflare 2.41.1 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +797 -790
- package/package.json +5 -5
- package/templates/astro/c3.ts +5 -93
- package/templates/astro/pages/c3.ts +98 -0
- package/{templates-experimental/astro → templates/astro/workers}/c3.ts +2 -2
- package/templates/astro/workers/templates/js/public/.assetsignore +2 -0
- package/templates/astro/workers/templates/ts/public/.assetsignore +2 -0
- package/templates/hello-world/c3.ts +3 -2
- package/{templates-experimental → templates}/hello-world-assets-only/c3.ts +4 -3
- package/templates/hello-world-durable-object/c3.ts +2 -2
- package/templates/hello-world-durable-object/js/src/index.js +10 -9
- package/templates/hello-world-durable-object/js/wrangler.jsonc +1 -1
- package/templates/hello-world-durable-object/ts/src/index.ts +10 -9
- package/templates/hello-world-durable-object/ts/wrangler.jsonc +1 -1
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/c3.ts +3 -3
- package/{templates-experimental → templates}/hello-world-with-assets/c3.ts +3 -4
- package/templates/hono/c3.ts +5 -66
- package/templates/hono/pages/c3.ts +42 -0
- package/templates/hono/pages/templates/src/index.tsx +12 -0
- package/templates/hono/{templates → pages/templates}/wrangler.jsonc +2 -1
- package/{templates-experimental/hono → templates/hono/workers}/c3.ts +2 -4
- package/templates/react/workers/js/src/assets/Cloudflare_Logo.svg +7 -5
- package/templates/remix/c3.ts +5 -63
- package/templates/remix/pages/c3.ts +68 -0
- package/{templates-experimental/remix → templates/remix/workers}/c3.ts +2 -2
- package/templates/svelte/c3.ts +5 -154
- package/templates/svelte/pages/c3.ts +159 -0
- package/{templates-experimental/svelte → templates/svelte/workers}/c3.ts +3 -3
- package/templates/svelte/workers/templates/static/.assetsignore +2 -0
- package/templates/hono/snippets/appDeclaration.ts +0 -1
- package/templates-experimental/astro/templates/js/public/.assetsignore +0 -4
- package/templates-experimental/astro/templates/ts/public/.assetsignore +0 -4
- package/templates-experimental/svelte/templates/static/.assetsignore +0 -4
- /package/templates/astro/{templates → pages/templates}/js/wrangler.jsonc +0 -0
- /package/{templates-experimental/astro → templates/astro/pages}/templates/ts/src/env.d.ts +0 -0
- /package/{templates-experimental/astro → templates/astro/pages}/templates/ts/worker-configuration.d.ts +0 -0
- /package/templates/astro/{templates → pages/templates}/ts/wrangler.jsonc +0 -0
- /package/{templates-experimental/astro → templates/astro/workers}/templates/js/wrangler.jsonc +0 -0
- /package/templates/astro/{templates → workers/templates}/ts/src/env.d.ts +0 -0
- /package/{templates-experimental/hello-world-with-assets → templates/astro/workers/templates}/ts/worker-configuration.d.ts +0 -0
- /package/{templates-experimental/astro → templates/astro/workers}/templates/ts/wrangler.jsonc +0 -0
- /package/{templates-experimental → templates}/hello-world-assets-only/templates/package.json +0 -0
- /package/{templates-experimental → templates}/hello-world-assets-only/templates/public/index.html +0 -0
- /package/{templates-experimental → templates}/hello-world-assets-only/templates/wrangler.jsonc +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/.editorconfig +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/.prettierrc +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/__dot__gitignore +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/package.json +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/public/index.html +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/src/index.js +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/wrangler.jsonc +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/.editorconfig +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/.prettierrc +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/__dot__gitignore +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/package.json +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/public/index.html +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/src/index.ts +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/tsconfig.json +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +0 -0
- /package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/wrangler.jsonc +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/.editorconfig +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/.prettierrc +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/__dot__gitignore +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/package.json +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/public/index.html +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/src/index.js +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/test/index.spec.js +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/vitest.config.js +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/js/wrangler.jsonc +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/py/__dot__gitignore +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/py/package.json +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/py/public/index.html +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/py/src/entry.py +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/py/wrangler.jsonc +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/.editorconfig +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/.prettierrc +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/__dot__gitignore +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/package.json +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/public/index.html +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/src/index.ts +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/test/index.spec.ts +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/test/tsconfig.json +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/tsconfig.json +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/vitest.config.mts +0 -0
- /package/templates/{astro/templates → hello-world-with-assets}/ts/worker-configuration.d.ts +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/wrangler.jsonc +0 -0
- /package/{templates-experimental/hono → templates/hono/pages}/templates/worker-configuration.d.ts +0 -0
- /package/{templates-experimental/hono → templates/hono/workers}/templates/public/index.html +0 -0
- /package/{templates-experimental/hono → templates/hono/workers}/templates/src/index.ts +0 -0
- /package/templates/hono/{templates → workers/templates}/worker-configuration.d.ts +0 -0
- /package/{templates-experimental/hono → templates/hono/workers}/templates/wrangler.jsonc +0 -0
- /package/templates/remix/{templates → pages/templates}/worker-configuration.d.ts +0 -0
- /package/templates/remix/{templates → pages/templates}/wrangler.jsonc +0 -0
- /package/{templates-experimental/remix → templates/remix/workers}/templates/public/.assetsignore +0 -0
- /package/{templates-experimental/remix → templates/remix/workers}/templates/worker-configuration.d.ts +0 -0
- /package/{templates-experimental/remix → templates/remix/workers}/templates/wrangler.toml +0 -0
- /package/templates/svelte/{templates → pages/templates}/wrangler.jsonc +0 -0
- /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
|
|
571
|
+
XDGAppPaths.config = function config38(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
|
|
628
|
+
var config38 = 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:
|
|
640
|
+
return { cache, config: config38, 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
|
|
646
|
+
var config38 = 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:
|
|
658
|
+
return { cache, config: config38, 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
|
|
670
|
+
var config38 = 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:
|
|
682
|
+
return { cache, config: config38, 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
|
|
31513
|
-
if (
|
|
31514
|
-
|
|
31512
|
+
var config38 = (0, _lodash["default"])(options, this.config);
|
|
31513
|
+
if (config38.tokenHex === true) {
|
|
31514
|
+
config38.tokenChars = "0123456789abcdef";
|
|
31515
31515
|
}
|
|
31516
31516
|
var adjective = this._randomElement(this.adjectives);
|
|
31517
31517
|
var noun = this._randomElement(this.nouns);
|
|
31518
|
-
if (!
|
|
31518
|
+
if (!config38.tokenLength) config38.tokenLength = 0;
|
|
31519
31519
|
var token = "";
|
|
31520
|
-
for (var i = 0; i <
|
|
31521
|
-
token += this._randomElement(
|
|
31520
|
+
for (var i = 0; i < config38.tokenLength; i++) {
|
|
31521
|
+
token += this._randomElement(config38.tokenChars);
|
|
31522
31522
|
}
|
|
31523
31523
|
var sections = [adjective, noun, token];
|
|
31524
31524
|
return sections.filter(function(e) {
|
|
31525
31525
|
return !!e;
|
|
31526
|
-
}).join(
|
|
31526
|
+
}).join(config38.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,
|
|
40039
|
+
function Tokenizer2(code, config38) {
|
|
40040
40040
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
40041
|
-
this.errorHandler.tolerant =
|
|
40041
|
+
this.errorHandler.tolerant = config38 ? typeof config38.tolerant === "boolean" && config38.tolerant : false;
|
|
40042
40042
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
40043
|
-
this.scanner.trackComment =
|
|
40044
|
-
this.trackRange =
|
|
40045
|
-
this.trackLoc =
|
|
40043
|
+
this.scanner.trackComment = config38 ? typeof config38.comment === "boolean" && config38.comment : false;
|
|
40044
|
+
this.trackRange = config38 ? typeof config38.range === "boolean" && config38.range : false;
|
|
40045
|
+
this.trackLoc = config38 ? typeof config38.loc === "boolean" && config38.loc : false;
|
|
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(
|
|
49806
|
+
var Printer = function Printer2(config38) {
|
|
49807
49807
|
assert_1.default.ok(this instanceof Printer2);
|
|
49808
|
-
var explicitTabWidth =
|
|
49809
|
-
|
|
49810
|
-
|
|
49808
|
+
var explicitTabWidth = config38 && config38.tabWidth;
|
|
49809
|
+
config38 = options_1.normalize(config38);
|
|
49810
|
+
config38.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 =
|
|
49825
|
+
var oldTabWidth = config38.tabWidth;
|
|
49826
49826
|
if (!explicitTabWidth) {
|
|
49827
49827
|
var loc = path6.getNode().loc;
|
|
49828
49828
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
49829
|
-
|
|
49829
|
+
config38.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,
|
|
49843
|
+
) : genericPrint(path6, config38, options, makePrintFunctionWith(options, {
|
|
49844
49844
|
includeComments: true,
|
|
49845
49845
|
avoidRootParens: false
|
|
49846
49846
|
}));
|
|
49847
|
-
|
|
49847
|
+
config38.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(
|
|
49858
|
+
return new PrintResult(lines.toString(config38), util.composeSourceMaps(config38.inputSourceMap, lines.getSourceMap(config38.sourceMapName, config38.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,
|
|
49866
|
+
return genericPrint(path8, config38, {
|
|
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 =
|
|
49874
|
-
|
|
49875
|
-
var pr = new PrintResult(printGenerically(path6).toString(
|
|
49876
|
-
|
|
49873
|
+
var oldReuseWhitespace = config38.reuseWhitespace;
|
|
49874
|
+
config38.reuseWhitespace = false;
|
|
49875
|
+
var pr = new PrintResult(printGenerically(path6).toString(config38));
|
|
49876
|
+
config38.reuseWhitespace = oldReuseWhitespace;
|
|
49877
49877
|
return pr;
|
|
49878
49878
|
};
|
|
49879
49879
|
};
|
|
49880
49880
|
exports2.Printer = Printer;
|
|
49881
|
-
function genericPrint(path6,
|
|
49881
|
+
function genericPrint(path6, config38, 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,
|
|
49885
|
+
var linesWithoutParens = genericPrintNoParens(path6, config38, 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 = (
|
|
69384
|
-
const { question, label } =
|
|
69385
|
-
if (
|
|
69383
|
+
var renderSubmit = (config38, value) => {
|
|
69384
|
+
const { question, label } = config38;
|
|
69385
|
+
if (config38.type !== "confirm" && !value) {
|
|
69386
69386
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
69387
69387
|
}
|
|
69388
|
-
const content =
|
|
69388
|
+
const content = config38.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
69389
69389
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
69390
69390
|
};
|
|
69391
|
-
var getRenderers = (
|
|
69392
|
-
switch (
|
|
69391
|
+
var getRenderers = (config38) => {
|
|
69392
|
+
switch (config38.type) {
|
|
69393
69393
|
case "select":
|
|
69394
|
-
return getSelectRenderers(
|
|
69394
|
+
return getSelectRenderers(config38);
|
|
69395
69395
|
case "confirm":
|
|
69396
|
-
return getConfirmRenderers(
|
|
69396
|
+
return getConfirmRenderers(config38);
|
|
69397
69397
|
case "text":
|
|
69398
|
-
return getTextRenderers(
|
|
69398
|
+
return getTextRenderers(config38);
|
|
69399
69399
|
case "multiselect":
|
|
69400
|
-
return getSelectRenderers(
|
|
69400
|
+
return getSelectRenderers(config38);
|
|
69401
69401
|
case "list":
|
|
69402
|
-
return getSelectListRenderers(
|
|
69402
|
+
return getSelectListRenderers(config38);
|
|
69403
69403
|
}
|
|
69404
69404
|
};
|
|
69405
|
-
var getTextRenderers = (
|
|
69406
|
-
const { question } =
|
|
69407
|
-
const helpText =
|
|
69408
|
-
const format5 =
|
|
69409
|
-
const defaultValue =
|
|
69405
|
+
var getTextRenderers = (config38) => {
|
|
69406
|
+
const { question } = config38;
|
|
69407
|
+
const helpText = config38.helpText ?? "";
|
|
69408
|
+
const format5 = config38.format ?? ((val) => String(val));
|
|
69409
|
+
const defaultValue = config38.defaultValue?.toString() ?? "";
|
|
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(
|
|
69432
|
+
submit: ({ value }) => renderSubmit(config38, format5(value ?? "")),
|
|
69433
69433
|
cancel: activeRenderer
|
|
69434
69434
|
};
|
|
69435
69435
|
};
|
|
69436
|
-
var getSelectRenderers = (
|
|
69437
|
-
const { options, question, helpText: _helpText } =
|
|
69436
|
+
var getSelectRenderers = (config38) => {
|
|
69437
|
+
const { options, question, helpText: _helpText } = config38;
|
|
69438
69438
|
const helpText = _helpText ?? "";
|
|
69439
|
-
const maxItemsPerPage =
|
|
69439
|
+
const maxItemsPerPage = config38.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
|
-
|
|
69514
|
+
config38,
|
|
69515
69515
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
69516
69516
|
);
|
|
69517
69517
|
}
|
|
69518
69518
|
return renderSubmit(
|
|
69519
|
-
|
|
69519
|
+
config38,
|
|
69520
69520
|
options.find((o) => o.value === value)?.label
|
|
69521
69521
|
);
|
|
69522
69522
|
},
|
|
69523
69523
|
cancel: defaultRenderer
|
|
69524
69524
|
};
|
|
69525
69525
|
};
|
|
69526
|
-
var getSelectListRenderers = (
|
|
69527
|
-
const { question, helpText: _helpText } =
|
|
69528
|
-
let options =
|
|
69526
|
+
var getSelectListRenderers = (config38) => {
|
|
69527
|
+
const { question, helpText: _helpText } = config38;
|
|
69528
|
+
let options = config38.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
|
-
|
|
69609
|
+
config38,
|
|
69610
69610
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
69611
69611
|
);
|
|
69612
69612
|
}
|
|
69613
69613
|
return renderSubmit(
|
|
69614
|
-
|
|
69614
|
+
config38,
|
|
69615
69615
|
options.find((o) => o.value === value)?.value
|
|
69616
69616
|
);
|
|
69617
69617
|
},
|
|
69618
69618
|
cancel: defaultRenderer
|
|
69619
69619
|
};
|
|
69620
69620
|
};
|
|
69621
|
-
var getConfirmRenderers = (
|
|
69622
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
69621
|
+
var getConfirmRenderers = (config38) => {
|
|
69622
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config38;
|
|
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(
|
|
69639
|
+
submit: ({ value }) => renderSubmit(config38, 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
|
|
70607
|
+
let config38 = 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
|
-
|
|
70612
|
+
config38 = resolveConfig(resolvedConfigPath);
|
|
70613
70613
|
} catch (e) {
|
|
70614
|
-
|
|
70614
|
+
config38 = e;
|
|
70615
70615
|
}
|
|
70616
|
-
if (
|
|
70617
|
-
error2 =
|
|
70616
|
+
if (config38 instanceof Error) {
|
|
70617
|
+
error2 = config38;
|
|
70618
70618
|
return;
|
|
70619
70619
|
}
|
|
70620
70620
|
} else {
|
|
70621
|
-
|
|
70621
|
+
config38 = mixin2.require(resolvedConfigPath);
|
|
70622
70622
|
}
|
|
70623
|
-
setConfigObject(
|
|
70623
|
+
setConfigObject(config38);
|
|
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(
|
|
70634
|
-
Object.keys(
|
|
70635
|
-
const value =
|
|
70633
|
+
function setConfigObject(config38, prev) {
|
|
70634
|
+
Object.keys(config38).forEach(function(key) {
|
|
70635
|
+
const value = config38[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
|
|
71787
|
+
const config38 = Object.assign({}, options.configuration, {
|
|
71788
71788
|
"populate--": false
|
|
71789
71789
|
});
|
|
71790
71790
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
71791
|
-
configuration:
|
|
71791
|
+
configuration: config38
|
|
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(
|
|
73014
|
+
function applyExtends(config38, cwd, mergeExtends, _shim) {
|
|
73015
73015
|
shim2 = _shim;
|
|
73016
73016
|
let defaultConfig = {};
|
|
73017
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
73018
|
-
if (typeof
|
|
73017
|
+
if (Object.prototype.hasOwnProperty.call(config38, "extends")) {
|
|
73018
|
+
if (typeof config38.extends !== "string")
|
|
73019
73019
|
return defaultConfig;
|
|
73020
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
73020
|
+
const isPath = /\.json|\..*rc$/.test(config38.extends);
|
|
73021
73021
|
let pathToDefault = null;
|
|
73022
73022
|
if (!isPath) {
|
|
73023
73023
|
try {
|
|
73024
|
-
pathToDefault = require.resolve(
|
|
73024
|
+
pathToDefault = require.resolve(config38.extends);
|
|
73025
73025
|
} catch (_err) {
|
|
73026
|
-
return
|
|
73026
|
+
return config38;
|
|
73027
73027
|
}
|
|
73028
73028
|
} else {
|
|
73029
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
73029
|
+
pathToDefault = getPathToDefaultConfig(cwd, config38.extends);
|
|
73030
73030
|
}
|
|
73031
73031
|
checkForCircularExtends(pathToDefault);
|
|
73032
73032
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
73033
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
73034
|
-
delete
|
|
73033
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config38.extends);
|
|
73034
|
+
delete config38.extends;
|
|
73035
73035
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
73036
73036
|
}
|
|
73037
73037
|
previouslyVisitedConfigs = [];
|
|
73038
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
73038
|
+
return mergeExtends ? mergeDeep(defaultConfig, config38) : Object.assign({}, defaultConfig, config38);
|
|
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(
|
|
73815
|
-
argsert("<object>", [
|
|
73816
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
73814
|
+
parserConfiguration(config38) {
|
|
73815
|
+
argsert("<object>", [config38], arguments.length);
|
|
73816
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config38, "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(
|
|
73989
|
-
argsert("<object>", [
|
|
73990
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
73988
|
+
usageConfiguration(config38) {
|
|
73989
|
+
argsert("<object>", [config38], arguments.length);
|
|
73990
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config38, "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
|
|
74396
|
+
const config38 = 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, ...
|
|
74400
|
+
configuration: { "parse-positional-numbers": false, ...config38 }
|
|
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.
|
|
74563
|
+
var version = "2.42.0";
|
|
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(
|
|
74607
|
+
function writeMetricsConfig(config38) {
|
|
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
|
-
|
|
74612
|
+
config38,
|
|
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
|
|
74620
|
+
const config38 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
74621
74621
|
return JSON.parse(
|
|
74622
|
-
|
|
74622
|
+
config38,
|
|
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(
|
|
74633
|
-
const deviceId =
|
|
74634
|
-
if (
|
|
74635
|
-
writeMetricsConfig({ ...
|
|
74632
|
+
function getDeviceId(config38) {
|
|
74633
|
+
const deviceId = config38.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
74634
|
+
if (config38.deviceId === void 0) {
|
|
74635
|
+
writeMetricsConfig({ ...config38, 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
|
|
74911
|
-
const isFirstUsage =
|
|
74910
|
+
const config38 = readMetricsConfig() ?? {};
|
|
74911
|
+
const isFirstUsage = config38.c3permission === void 0;
|
|
74912
74912
|
const isEnabled = isTelemetryEnabled();
|
|
74913
|
-
const deviceId = getDeviceId(
|
|
74913
|
+
const deviceId = getDeviceId(config38);
|
|
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(
|
|
74946
|
+
return hasSparrowSourceKey() && getC3Permission(config38).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(
|
|
75053
|
-
if (!
|
|
75054
|
-
|
|
75055
|
-
writeMetricsConfig(
|
|
75052
|
+
function getC3Permission(config38 = readMetricsConfig() ?? {}) {
|
|
75053
|
+
if (!config38.c3permission) {
|
|
75054
|
+
config38.c3permission = initializeC3Permission();
|
|
75055
|
+
writeMetricsConfig(config38);
|
|
75056
75056
|
}
|
|
75057
|
-
return
|
|
75057
|
+
return config38.c3permission;
|
|
75058
75058
|
}
|
|
75059
75059
|
function updateC3Pemission(enabled) {
|
|
75060
|
-
const
|
|
75061
|
-
if (
|
|
75060
|
+
const config38 = readMetricsConfig();
|
|
75061
|
+
if (config38.c3permission?.enabled === enabled) {
|
|
75062
75062
|
return;
|
|
75063
75063
|
}
|
|
75064
|
-
|
|
75065
|
-
writeMetricsConfig(
|
|
75064
|
+
config38.c3permission = initializeC3Permission(enabled);
|
|
75065
|
+
writeMetricsConfig(config38);
|
|
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,
|
|
75110
|
+
var installPackages = async (packages, config38 = {}) => {
|
|
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 =
|
|
75117
|
+
saveFlag = config38.dev ? "-D" : "";
|
|
75118
75118
|
break;
|
|
75119
75119
|
case "bun":
|
|
75120
75120
|
cmd = "add";
|
|
75121
|
-
saveFlag =
|
|
75121
|
+
saveFlag = config38.dev ? "-d" : "";
|
|
75122
75122
|
break;
|
|
75123
75123
|
case "npm":
|
|
75124
75124
|
case "pnpm":
|
|
75125
75125
|
default:
|
|
75126
75126
|
cmd = "install";
|
|
75127
|
-
saveFlag =
|
|
75127
|
+
saveFlag = config38.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
|
-
...
|
|
75142
|
+
...config38,
|
|
75143
75143
|
silent: true
|
|
75144
75144
|
}
|
|
75145
75145
|
);
|
|
@@ -75209,7 +75209,7 @@ var isUpdateAvailable = async () => {
|
|
|
75209
75209
|
var C3_DEFAULTS = {
|
|
75210
75210
|
projectName: new import_haikunator.default().haikunate({ tokenHex: true }),
|
|
75211
75211
|
category: "hello-world",
|
|
75212
|
-
type: "hello-world",
|
|
75212
|
+
type: "hello-world-with-assets",
|
|
75213
75213
|
framework: "analog",
|
|
75214
75214
|
experimental: false,
|
|
75215
75215
|
autoUpdate: true,
|
|
@@ -75217,11 +75217,11 @@ var C3_DEFAULTS = {
|
|
|
75217
75217
|
git: true,
|
|
75218
75218
|
open: true,
|
|
75219
75219
|
lang: "ts",
|
|
75220
|
-
template: "cloudflare/workers-sdk/packages/create-cloudflare/templates/hello-world"
|
|
75220
|
+
template: "cloudflare/workers-sdk/packages/create-cloudflare/templates/hello-world-with-assets"
|
|
75221
75221
|
};
|
|
75222
75222
|
var WRANGLER_DEFAULTS = {
|
|
75223
75223
|
...C3_DEFAULTS,
|
|
75224
|
-
type: "hello-world",
|
|
75224
|
+
type: "hello-world-with-assets",
|
|
75225
75225
|
deploy: false
|
|
75226
75226
|
};
|
|
75227
75227
|
|
|
@@ -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,242 +75510,14 @@ 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/
|
|
75513
|
+
// templates-experimental/qwik/c3.ts
|
|
75457
75514
|
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/hello-world-assets-only/c3.ts
|
|
75533
|
-
var config2 = {
|
|
75534
|
-
configVersion: 1,
|
|
75535
|
-
id: "hello-world-assets-only",
|
|
75536
|
-
path: "templates-experimental/hello-world-assets-only",
|
|
75537
|
-
displayName: "Hello World - Assets-only",
|
|
75538
|
-
description: "Get started with a basic Worker that only serves static assets",
|
|
75539
|
-
platform: "workers",
|
|
75540
|
-
copyFiles: {
|
|
75541
|
-
path: "./templates"
|
|
75542
|
-
}
|
|
75543
|
-
};
|
|
75544
|
-
var c3_default2 = config2;
|
|
75545
|
-
|
|
75546
|
-
// templates-experimental/hello-world-durable-object-with-assets/c3.ts
|
|
75547
|
-
var config3 = {
|
|
75548
|
-
configVersion: 1,
|
|
75549
|
-
id: "hello-world-durable-object-with-assets",
|
|
75550
|
-
path: "templates-experimental/hello-world-durable-object-with-assets",
|
|
75551
|
-
displayName: "Hello World - Worker Using Durable Objects with Assets",
|
|
75552
|
-
description: "Get started with a basic stateful app to build projects like real-time chats, collaborative apps, and multiplayer games, which hosts assets",
|
|
75553
|
-
platform: "workers",
|
|
75554
|
-
copyFiles: {
|
|
75555
|
-
variants: {
|
|
75556
|
-
js: {
|
|
75557
|
-
path: "./js"
|
|
75558
|
-
},
|
|
75559
|
-
ts: {
|
|
75560
|
-
path: "./ts"
|
|
75561
|
-
}
|
|
75562
|
-
}
|
|
75563
|
-
}
|
|
75564
|
-
};
|
|
75565
|
-
var c3_default3 = config3;
|
|
75566
|
-
|
|
75567
|
-
// templates-experimental/hello-world-with-assets/c3.ts
|
|
75568
|
-
var c3_default4 = {
|
|
75569
|
-
configVersion: 1,
|
|
75570
|
-
id: "hello-world-with-assets",
|
|
75571
|
-
path: "templates-experimental/hello-world-with-assets",
|
|
75572
|
-
displayName: "Hello World - Worker with Assets",
|
|
75573
|
-
description: "Get started with a basic Worker that also serves static assets, in the language of your choice",
|
|
75574
|
-
platform: "workers",
|
|
75575
|
-
copyFiles: {
|
|
75576
|
-
variants: {
|
|
75577
|
-
js: {
|
|
75578
|
-
path: "./js"
|
|
75579
|
-
},
|
|
75580
|
-
ts: {
|
|
75581
|
-
path: "./ts"
|
|
75582
|
-
},
|
|
75583
|
-
python: {
|
|
75584
|
-
path: "./py"
|
|
75585
|
-
}
|
|
75586
|
-
}
|
|
75587
|
-
}
|
|
75588
|
-
};
|
|
75589
|
-
|
|
75590
|
-
// templates-experimental/hono/c3.ts
|
|
75515
|
+
var { npm, npx, name } = detectPackageManager();
|
|
75591
75516
|
var generate2 = async (ctx) => {
|
|
75592
|
-
const { name: pm4 } = detectPackageManager();
|
|
75593
|
-
await runFrameworkGenerator(ctx, [
|
|
75594
|
-
ctx.project.name,
|
|
75595
|
-
"--template",
|
|
75596
|
-
"cloudflare-workers",
|
|
75597
|
-
"--install",
|
|
75598
|
-
"--pm",
|
|
75599
|
-
pm4
|
|
75600
|
-
]);
|
|
75601
|
-
logRaw("");
|
|
75602
|
-
};
|
|
75603
|
-
var config4 = {
|
|
75604
|
-
configVersion: 1,
|
|
75605
|
-
id: "hono",
|
|
75606
|
-
frameworkCli: "create-hono",
|
|
75607
|
-
displayName: "Hono",
|
|
75608
|
-
copyFiles: {
|
|
75609
|
-
path: "./templates"
|
|
75610
|
-
},
|
|
75611
|
-
platform: "workers",
|
|
75612
|
-
path: "templates-experimental/hono",
|
|
75613
|
-
generate: generate2,
|
|
75614
|
-
transformPackageJson: async () => ({
|
|
75615
|
-
scripts: {
|
|
75616
|
-
dev: "wrangler dev",
|
|
75617
|
-
deploy: "wrangler deploy --minify",
|
|
75618
|
-
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
75619
|
-
}
|
|
75620
|
-
}),
|
|
75621
|
-
devScript: "dev",
|
|
75622
|
-
deployScript: "deploy",
|
|
75623
|
-
previewScript: "dev"
|
|
75624
|
-
};
|
|
75625
|
-
var c3_default5 = config4;
|
|
75626
|
-
|
|
75627
|
-
// templates-experimental/next/c3.ts
|
|
75628
|
-
var generate3 = async (ctx) => {
|
|
75629
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
75630
|
-
};
|
|
75631
|
-
var configure2 = async (ctx) => {
|
|
75632
|
-
const packages = [
|
|
75633
|
-
"@opennextjs/cloudflare@0.5.x",
|
|
75634
|
-
"@cloudflare/workers-types"
|
|
75635
|
-
];
|
|
75636
|
-
await installPackages(packages, {
|
|
75637
|
-
dev: true,
|
|
75638
|
-
startText: "Adding the Cloudflare adapter",
|
|
75639
|
-
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
75640
|
-
});
|
|
75641
|
-
const usesTs = usesTypescript(ctx);
|
|
75642
|
-
updateNextConfig(usesTs);
|
|
75643
|
-
};
|
|
75644
|
-
var updateNextConfig = (usesTs) => {
|
|
75645
|
-
const s = spinner();
|
|
75646
|
-
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
75647
|
-
s.start(`Updating \`${configFile}\``);
|
|
75648
|
-
const configContent = readFile(configFile);
|
|
75649
|
-
const updatedConfigFile = configContent + `
|
|
75650
|
-
// added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
|
|
75651
|
-
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
75652
|
-
initOpenNextCloudflareForDev();
|
|
75653
|
-
`.replace(/\n\t*/g, "\n");
|
|
75654
|
-
writeFile2(configFile, updatedConfigFile);
|
|
75655
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
75656
|
-
};
|
|
75657
|
-
var c3_default6 = {
|
|
75658
|
-
configVersion: 1,
|
|
75659
|
-
id: "next",
|
|
75660
|
-
frameworkCli: "create-next-app",
|
|
75661
|
-
// TODO: Stop using a pinned version when the template graduates.
|
|
75662
|
-
frameworkCliPinnedVersion: "~15.2.2",
|
|
75663
|
-
platform: "workers",
|
|
75664
|
-
displayName: "Next.js (using Node.js compat + Workers Assets)",
|
|
75665
|
-
path: "templates-experimental/next",
|
|
75666
|
-
copyFiles: {
|
|
75667
|
-
path: "./templates"
|
|
75668
|
-
},
|
|
75669
|
-
generate: generate3,
|
|
75670
|
-
configure: configure2,
|
|
75671
|
-
transformPackageJson: async () => ({
|
|
75672
|
-
scripts: {
|
|
75673
|
-
deploy: `opennextjs-cloudflare && wrangler deploy`,
|
|
75674
|
-
preview: `opennextjs-cloudflare && wrangler dev`,
|
|
75675
|
-
"cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
|
|
75676
|
-
}
|
|
75677
|
-
}),
|
|
75678
|
-
devScript: "dev",
|
|
75679
|
-
previewScript: "preview",
|
|
75680
|
-
deployScript: "deploy",
|
|
75681
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
75682
|
-
};
|
|
75683
|
-
|
|
75684
|
-
// templates-experimental/qwik/c3.ts
|
|
75685
|
-
var recast3 = __toESM(require_main3());
|
|
75686
|
-
var { npm, npx: npx2, name } = detectPackageManager();
|
|
75687
|
-
var generate4 = async (ctx) => {
|
|
75688
75517
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
75689
75518
|
};
|
|
75690
|
-
var
|
|
75691
|
-
const cmd = [name === "pnpm" ? npm :
|
|
75519
|
+
var configure2 = async (ctx) => {
|
|
75520
|
+
const cmd = [name === "pnpm" ? npm : npx, "qwik", "add", "cloudflare-pages"];
|
|
75692
75521
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
75693
75522
|
await runCommand(cmd);
|
|
75694
75523
|
removeFile("./public/_headers");
|
|
@@ -75704,7 +75533,7 @@ var addBindingsProxy = (ctx) => {
|
|
|
75704
75533
|
const s = spinner();
|
|
75705
75534
|
s.start("Updating `vite.config.ts`");
|
|
75706
75535
|
const snippets = loadTemplateSnippets(ctx);
|
|
75707
|
-
const b3 =
|
|
75536
|
+
const b3 = recast2.types.builders;
|
|
75708
75537
|
transformFile("vite.config.ts", {
|
|
75709
75538
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
75710
75539
|
visitProgram: function(n) {
|
|
@@ -75746,7 +75575,7 @@ var populateCloudflareEnv = () => {
|
|
|
75746
75575
|
s.start(`Updating \`${entrypointPath}\``);
|
|
75747
75576
|
transformFile(entrypointPath, {
|
|
75748
75577
|
visitTSInterfaceDeclaration: function(n) {
|
|
75749
|
-
const b3 =
|
|
75578
|
+
const b3 = recast2.types.builders;
|
|
75750
75579
|
const id = n.node.id;
|
|
75751
75580
|
if (id.name !== "QwikCityPlatform") {
|
|
75752
75581
|
this.traverse(n);
|
|
@@ -75767,7 +75596,7 @@ var populateCloudflareEnv = () => {
|
|
|
75767
75596
|
});
|
|
75768
75597
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
75769
75598
|
};
|
|
75770
|
-
var
|
|
75599
|
+
var config = {
|
|
75771
75600
|
configVersion: 1,
|
|
75772
75601
|
id: "qwik",
|
|
75773
75602
|
frameworkCli: "create-qwik",
|
|
@@ -75777,8 +75606,8 @@ var config5 = {
|
|
|
75777
75606
|
path: "./templates"
|
|
75778
75607
|
},
|
|
75779
75608
|
path: "templates-experimental/qwik",
|
|
75780
|
-
generate:
|
|
75781
|
-
configure:
|
|
75609
|
+
generate: generate2,
|
|
75610
|
+
configure: configure2,
|
|
75782
75611
|
transformPackageJson: async () => ({
|
|
75783
75612
|
scripts: {
|
|
75784
75613
|
deploy: `${npm} run build && wrangler deploy`,
|
|
@@ -75790,49 +75619,7 @@ var config5 = {
|
|
|
75790
75619
|
deployScript: "deploy",
|
|
75791
75620
|
previewScript: "preview"
|
|
75792
75621
|
};
|
|
75793
|
-
var
|
|
75794
|
-
|
|
75795
|
-
// templates-experimental/remix/c3.ts
|
|
75796
|
-
var { npm: npm2 } = detectPackageManager();
|
|
75797
|
-
var generate5 = async (ctx) => {
|
|
75798
|
-
await runFrameworkGenerator(ctx, [
|
|
75799
|
-
ctx.project.name,
|
|
75800
|
-
"--template",
|
|
75801
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
75802
|
-
]);
|
|
75803
|
-
logRaw("");
|
|
75804
|
-
};
|
|
75805
|
-
var configure4 = async () => {
|
|
75806
|
-
await installPackages(["wrangler@latest"], {
|
|
75807
|
-
dev: true,
|
|
75808
|
-
startText: "Updating the Wrangler version",
|
|
75809
|
-
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
75810
|
-
});
|
|
75811
|
-
};
|
|
75812
|
-
var config6 = {
|
|
75813
|
-
configVersion: 1,
|
|
75814
|
-
id: "remix",
|
|
75815
|
-
frameworkCli: "create-remix",
|
|
75816
|
-
platform: "workers",
|
|
75817
|
-
displayName: "Remix",
|
|
75818
|
-
copyFiles: {
|
|
75819
|
-
path: "./templates"
|
|
75820
|
-
},
|
|
75821
|
-
path: "templates-experimental/remix",
|
|
75822
|
-
generate: generate5,
|
|
75823
|
-
configure: configure4,
|
|
75824
|
-
transformPackageJson: async () => ({
|
|
75825
|
-
scripts: {
|
|
75826
|
-
deploy: `${npm2} run build && wrangler deploy`,
|
|
75827
|
-
preview: `${npm2} run build && wrangler dev`,
|
|
75828
|
-
"cf-typegen": `wrangler types`
|
|
75829
|
-
}
|
|
75830
|
-
}),
|
|
75831
|
-
devScript: "dev",
|
|
75832
|
-
deployScript: "deploy",
|
|
75833
|
-
previewScript: "preview"
|
|
75834
|
-
};
|
|
75835
|
-
var c3_default8 = config6;
|
|
75622
|
+
var c3_default2 = config;
|
|
75836
75623
|
|
|
75837
75624
|
// src/helpers/compatDate.ts
|
|
75838
75625
|
var import_fs9 = require("fs");
|
|
@@ -75887,18 +75674,18 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
75887
75674
|
}
|
|
75888
75675
|
|
|
75889
75676
|
// templates-experimental/solid/c3.ts
|
|
75890
|
-
var
|
|
75891
|
-
var { npm:
|
|
75892
|
-
var
|
|
75677
|
+
var recast3 = __toESM(require_main3());
|
|
75678
|
+
var { npm: npm2 } = detectPackageManager();
|
|
75679
|
+
var generate3 = async (ctx) => {
|
|
75893
75680
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
75894
75681
|
logRaw("");
|
|
75895
75682
|
};
|
|
75896
|
-
var
|
|
75683
|
+
var configure3 = async (ctx) => {
|
|
75897
75684
|
const packages = ["nitropack"];
|
|
75898
75685
|
await installPackages(packages, {
|
|
75899
75686
|
dev: true,
|
|
75900
75687
|
startText: "Installing nitro module `nitropack`",
|
|
75901
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75688
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
|
|
75902
75689
|
});
|
|
75903
75690
|
usesTypescript(ctx);
|
|
75904
75691
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -75910,7 +75697,7 @@ var configure5 = async (ctx) => {
|
|
|
75910
75697
|
if (callee.name !== "defineConfig") {
|
|
75911
75698
|
return this.traverse(n);
|
|
75912
75699
|
}
|
|
75913
|
-
const b3 =
|
|
75700
|
+
const b3 = recast3.types.builders;
|
|
75914
75701
|
mergeObjectProperties(
|
|
75915
75702
|
n.node.arguments[0],
|
|
75916
75703
|
[
|
|
@@ -75934,7 +75721,7 @@ var configure5 = async (ctx) => {
|
|
|
75934
75721
|
}
|
|
75935
75722
|
});
|
|
75936
75723
|
};
|
|
75937
|
-
var
|
|
75724
|
+
var config2 = {
|
|
75938
75725
|
configVersion: 1,
|
|
75939
75726
|
id: "solid",
|
|
75940
75727
|
frameworkCli: "create-solid",
|
|
@@ -75944,12 +75731,12 @@ var config7 = {
|
|
|
75944
75731
|
path: "./templates"
|
|
75945
75732
|
},
|
|
75946
75733
|
path: "templates-experimental/solid",
|
|
75947
|
-
generate:
|
|
75948
|
-
configure:
|
|
75734
|
+
generate: generate3,
|
|
75735
|
+
configure: configure3,
|
|
75949
75736
|
transformPackageJson: async () => ({
|
|
75950
75737
|
scripts: {
|
|
75951
|
-
preview: `${
|
|
75952
|
-
deploy: `${
|
|
75738
|
+
preview: `${npm2} run build && npx wrangler dev`,
|
|
75739
|
+
deploy: `${npm2} run build && wrangler deploy`
|
|
75953
75740
|
}
|
|
75954
75741
|
}),
|
|
75955
75742
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -75957,111 +75744,12 @@ var config7 = {
|
|
|
75957
75744
|
deployScript: "deploy",
|
|
75958
75745
|
previewScript: "preview"
|
|
75959
75746
|
};
|
|
75960
|
-
var
|
|
75961
|
-
|
|
75962
|
-
// templates-experimental/svelte/c3.ts
|
|
75963
|
-
var import_node_os3 = require("node:os");
|
|
75964
|
-
var recast5 = __toESM(require_main3());
|
|
75965
|
-
var { npm: npm4 } = detectPackageManager();
|
|
75966
|
-
var generate7 = async (ctx) => {
|
|
75967
|
-
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
75968
|
-
logRaw("");
|
|
75969
|
-
};
|
|
75970
|
-
var configure6 = async (ctx) => {
|
|
75971
|
-
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
75972
|
-
await installPackages([pkg], {
|
|
75973
|
-
dev: true,
|
|
75974
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
75975
|
-
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
75976
|
-
});
|
|
75977
|
-
updateSvelteConfig();
|
|
75978
|
-
updateTypeDefinitions(ctx);
|
|
75979
|
-
};
|
|
75980
|
-
var updateSvelteConfig = () => {
|
|
75981
|
-
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
75982
|
-
transformFile("svelte.config.js", {
|
|
75983
|
-
visitImportDeclaration: function(n) {
|
|
75984
|
-
const importSource = n.value.source;
|
|
75985
|
-
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
75986
|
-
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
75987
|
-
}
|
|
75988
|
-
return false;
|
|
75989
|
-
}
|
|
75990
|
-
});
|
|
75991
|
-
};
|
|
75992
|
-
var updateTypeDefinitions = (ctx) => {
|
|
75993
|
-
if (!usesTypescript(ctx)) {
|
|
75994
|
-
return;
|
|
75995
|
-
}
|
|
75996
|
-
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
75997
|
-
const b3 = recast5.types.builders;
|
|
75998
|
-
transformFile("src/app.d.ts", {
|
|
75999
|
-
visitTSModuleDeclaration(n) {
|
|
76000
|
-
if (n.value.id.name === "App" && n.node.body) {
|
|
76001
|
-
const moduleBlock = n.node.body;
|
|
76002
|
-
const platformInterface = b3.tsInterfaceDeclaration(
|
|
76003
|
-
b3.identifier("Platform"),
|
|
76004
|
-
b3.tsInterfaceBody([
|
|
76005
|
-
b3.tsPropertySignature(
|
|
76006
|
-
b3.identifier("env"),
|
|
76007
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
76008
|
-
),
|
|
76009
|
-
b3.tsPropertySignature(
|
|
76010
|
-
b3.identifier("cf"),
|
|
76011
|
-
b3.tsTypeAnnotation(
|
|
76012
|
-
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
76013
|
-
)
|
|
76014
|
-
),
|
|
76015
|
-
b3.tsPropertySignature(
|
|
76016
|
-
b3.identifier("ctx"),
|
|
76017
|
-
b3.tsTypeAnnotation(
|
|
76018
|
-
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
76019
|
-
)
|
|
76020
|
-
)
|
|
76021
|
-
])
|
|
76022
|
-
);
|
|
76023
|
-
moduleBlock.body.unshift(platformInterface);
|
|
76024
|
-
}
|
|
76025
|
-
this.traverse(n);
|
|
76026
|
-
}
|
|
76027
|
-
});
|
|
76028
|
-
};
|
|
76029
|
-
var config8 = {
|
|
76030
|
-
configVersion: 1,
|
|
76031
|
-
id: "svelte",
|
|
76032
|
-
frameworkCli: "sv",
|
|
76033
|
-
displayName: "SvelteKit",
|
|
76034
|
-
platform: "workers",
|
|
76035
|
-
copyFiles: {
|
|
76036
|
-
path: "./templates"
|
|
76037
|
-
},
|
|
76038
|
-
path: "templates-experimental/svelte",
|
|
76039
|
-
generate: generate7,
|
|
76040
|
-
configure: configure6,
|
|
76041
|
-
transformPackageJson: async (original, ctx) => {
|
|
76042
|
-
let scripts = {
|
|
76043
|
-
preview: `${npm4} run build && wrangler dev`,
|
|
76044
|
-
deploy: `${npm4} run build && wrangler deploy`
|
|
76045
|
-
};
|
|
76046
|
-
if (usesTypescript(ctx)) {
|
|
76047
|
-
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
76048
|
-
scripts = {
|
|
76049
|
-
...scripts,
|
|
76050
|
-
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
76051
|
-
};
|
|
76052
|
-
}
|
|
76053
|
-
return { scripts };
|
|
76054
|
-
},
|
|
76055
|
-
devScript: "dev",
|
|
76056
|
-
deployScript: "deploy",
|
|
76057
|
-
previewScript: "preview"
|
|
76058
|
-
};
|
|
76059
|
-
var c3_default10 = config8;
|
|
75747
|
+
var c3_default3 = config2;
|
|
76060
75748
|
|
|
76061
75749
|
// templates/analog/c3.ts
|
|
76062
|
-
var
|
|
76063
|
-
var { npm:
|
|
76064
|
-
var
|
|
75750
|
+
var recast4 = __toESM(require_main3());
|
|
75751
|
+
var { npm: npm3, name: pm } = detectPackageManager();
|
|
75752
|
+
var generate4 = async (ctx) => {
|
|
76065
75753
|
await runFrameworkGenerator(ctx, [
|
|
76066
75754
|
ctx.project.name,
|
|
76067
75755
|
"--template",
|
|
@@ -76069,7 +75757,7 @@ var generate8 = async (ctx) => {
|
|
|
76069
75757
|
]);
|
|
76070
75758
|
logRaw("");
|
|
76071
75759
|
};
|
|
76072
|
-
var
|
|
75760
|
+
var configure4 = async (ctx) => {
|
|
76073
75761
|
if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
|
|
76074
75762
|
const packages = [];
|
|
76075
75763
|
packages.push("nitropack");
|
|
@@ -76079,7 +75767,7 @@ var configure7 = async (ctx) => {
|
|
|
76079
75767
|
await installPackages(packages, {
|
|
76080
75768
|
dev: true,
|
|
76081
75769
|
startText: `Installing ${packages.join(", ")}`,
|
|
76082
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75770
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
|
|
76083
75771
|
});
|
|
76084
75772
|
}
|
|
76085
75773
|
updateViteConfig(ctx);
|
|
@@ -76100,7 +75788,7 @@ var updateEnvTypes = (ctx) => {
|
|
|
76100
75788
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76101
75789
|
};
|
|
76102
75790
|
var updateViteConfig = (ctx) => {
|
|
76103
|
-
const b3 =
|
|
75791
|
+
const b3 = recast4.types.builders;
|
|
76104
75792
|
const s = spinner();
|
|
76105
75793
|
const configFile = "vite.config.ts";
|
|
76106
75794
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76137,7 +75825,7 @@ var updateViteConfig = (ctx) => {
|
|
|
76137
75825
|
});
|
|
76138
75826
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76139
75827
|
};
|
|
76140
|
-
var
|
|
75828
|
+
var config3 = {
|
|
76141
75829
|
configVersion: 1,
|
|
76142
75830
|
id: "analog",
|
|
76143
75831
|
frameworkCli: "create-analog",
|
|
@@ -76146,12 +75834,12 @@ var config9 = {
|
|
|
76146
75834
|
copyFiles: {
|
|
76147
75835
|
path: "./templates"
|
|
76148
75836
|
},
|
|
76149
|
-
generate:
|
|
76150
|
-
configure:
|
|
75837
|
+
generate: generate4,
|
|
75838
|
+
configure: configure4,
|
|
76151
75839
|
transformPackageJson: async () => ({
|
|
76152
75840
|
scripts: {
|
|
76153
|
-
preview: `${
|
|
76154
|
-
deploy: `${
|
|
75841
|
+
preview: `${npm3} run build && wrangler pages dev`,
|
|
75842
|
+
deploy: `${npm3} run build && wrangler pages deploy`,
|
|
76155
75843
|
"cf-typegen": `wrangler types`
|
|
76156
75844
|
}
|
|
76157
75845
|
}),
|
|
@@ -76159,12 +75847,12 @@ var config9 = {
|
|
|
76159
75847
|
deployScript: "deploy",
|
|
76160
75848
|
previewScript: "preview"
|
|
76161
75849
|
};
|
|
76162
|
-
var
|
|
75850
|
+
var c3_default4 = config3;
|
|
76163
75851
|
|
|
76164
75852
|
// templates/angular/pages/c3.ts
|
|
76165
75853
|
var import_node_path3 = require("node:path");
|
|
76166
|
-
var { npm:
|
|
76167
|
-
var
|
|
75854
|
+
var { npm: npm4 } = detectPackageManager();
|
|
75855
|
+
var generate5 = async (ctx) => {
|
|
76168
75856
|
await runFrameworkGenerator(ctx, [
|
|
76169
75857
|
ctx.project.name,
|
|
76170
75858
|
"--ssr",
|
|
@@ -76172,7 +75860,7 @@ var generate9 = async (ctx) => {
|
|
|
76172
75860
|
]);
|
|
76173
75861
|
logRaw("");
|
|
76174
75862
|
};
|
|
76175
|
-
var
|
|
75863
|
+
var configure5 = async (ctx) => {
|
|
76176
75864
|
updateAngularJson(ctx);
|
|
76177
75865
|
await updateAppCode();
|
|
76178
75866
|
await installCFWorker();
|
|
@@ -76181,7 +75869,7 @@ async function installCFWorker() {
|
|
|
76181
75869
|
await installPackages(["xhr2"], {
|
|
76182
75870
|
dev: true,
|
|
76183
75871
|
startText: "Installing additional dependencies",
|
|
76184
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75872
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
|
|
76185
75873
|
});
|
|
76186
75874
|
}
|
|
76187
75875
|
async function updateAppCode() {
|
|
@@ -76223,7 +75911,7 @@ function updateAngularJson(ctx) {
|
|
|
76223
75911
|
writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76224
75912
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76225
75913
|
}
|
|
76226
|
-
var
|
|
75914
|
+
var config4 = {
|
|
76227
75915
|
configVersion: 1,
|
|
76228
75916
|
id: "angular",
|
|
76229
75917
|
frameworkCli: "@angular/create",
|
|
@@ -76236,23 +75924,23 @@ var config10 = {
|
|
|
76236
75924
|
devScript: "start",
|
|
76237
75925
|
deployScript: "deploy",
|
|
76238
75926
|
previewScript: "start",
|
|
76239
|
-
generate:
|
|
76240
|
-
configure:
|
|
75927
|
+
generate: generate5,
|
|
75928
|
+
configure: configure5,
|
|
76241
75929
|
transformPackageJson: async () => ({
|
|
76242
75930
|
scripts: {
|
|
76243
|
-
start: `${
|
|
76244
|
-
build: `ng build && ${
|
|
75931
|
+
start: `${npm4} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
75932
|
+
build: `ng build && ${npm4} run process`,
|
|
76245
75933
|
process: "node ./tools/copy-files.mjs",
|
|
76246
|
-
deploy: `${
|
|
75934
|
+
deploy: `${npm4} run build && wrangler pages deploy dist/cloudflare`
|
|
76247
75935
|
}
|
|
76248
75936
|
})
|
|
76249
75937
|
};
|
|
76250
|
-
var
|
|
75938
|
+
var c3_default5 = config4;
|
|
76251
75939
|
|
|
76252
75940
|
// templates/angular/workers/c3.ts
|
|
76253
75941
|
var import_node_path4 = require("node:path");
|
|
76254
|
-
var { npm:
|
|
76255
|
-
var
|
|
75942
|
+
var { npm: npm5 } = detectPackageManager();
|
|
75943
|
+
var generate6 = async (ctx) => {
|
|
76256
75944
|
await runFrameworkGenerator(ctx, [
|
|
76257
75945
|
ctx.project.name,
|
|
76258
75946
|
"--ssr",
|
|
@@ -76260,7 +75948,7 @@ var generate10 = async (ctx) => {
|
|
|
76260
75948
|
]);
|
|
76261
75949
|
logRaw("");
|
|
76262
75950
|
};
|
|
76263
|
-
var
|
|
75951
|
+
var configure6 = async (ctx) => {
|
|
76264
75952
|
updateAngularJson2(ctx);
|
|
76265
75953
|
await updateAppCode2();
|
|
76266
75954
|
await installCFWorker2();
|
|
@@ -76269,7 +75957,7 @@ async function installCFWorker2() {
|
|
|
76269
75957
|
await installPackages(["xhr2"], {
|
|
76270
75958
|
dev: true,
|
|
76271
75959
|
startText: "Installing additional dependencies",
|
|
76272
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75960
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm5} install\``)}`
|
|
76273
75961
|
});
|
|
76274
75962
|
}
|
|
76275
75963
|
async function updateAppCode2() {
|
|
@@ -76310,7 +75998,7 @@ function updateAngularJson2(ctx) {
|
|
|
76310
75998
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76311
75999
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76312
76000
|
}
|
|
76313
|
-
var
|
|
76001
|
+
var config5 = {
|
|
76314
76002
|
configVersion: 1,
|
|
76315
76003
|
id: "angular",
|
|
76316
76004
|
frameworkCli: "@angular/create",
|
|
@@ -76323,33 +76011,109 @@ var config11 = {
|
|
|
76323
76011
|
devScript: "start",
|
|
76324
76012
|
deployScript: "deploy",
|
|
76325
76013
|
previewScript: "start",
|
|
76326
|
-
generate:
|
|
76327
|
-
configure:
|
|
76014
|
+
generate: generate6,
|
|
76015
|
+
configure: configure6,
|
|
76328
76016
|
transformPackageJson: async () => ({
|
|
76329
76017
|
scripts: {
|
|
76330
|
-
start: `${
|
|
76018
|
+
start: `${npm5} run build && wrangler dev`,
|
|
76331
76019
|
build: `ng build`,
|
|
76332
|
-
deploy: `${
|
|
76020
|
+
deploy: `${npm5} run build && wrangler deploy`
|
|
76333
76021
|
}
|
|
76334
76022
|
})
|
|
76335
76023
|
};
|
|
76336
|
-
var
|
|
76024
|
+
var c3_default6 = config5;
|
|
76337
76025
|
|
|
76338
76026
|
// templates/angular/c3.ts
|
|
76339
|
-
var
|
|
76027
|
+
var config6 = {
|
|
76340
76028
|
displayName: "Angular",
|
|
76341
|
-
platformVariants: { pages:
|
|
76029
|
+
platformVariants: { pages: c3_default5, workers: c3_default6 }
|
|
76342
76030
|
};
|
|
76343
|
-
var
|
|
76031
|
+
var c3_default7 = config6;
|
|
76344
76032
|
|
|
76345
|
-
// templates/astro/c3.ts
|
|
76346
|
-
var
|
|
76033
|
+
// templates/astro/pages/c3.ts
|
|
76034
|
+
var recast5 = __toESM(require_main3());
|
|
76035
|
+
var { npx: npx2 } = detectPackageManager();
|
|
76036
|
+
var generate7 = async (ctx) => {
|
|
76037
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
76038
|
+
logRaw("");
|
|
76039
|
+
};
|
|
76040
|
+
var configure7 = async () => {
|
|
76041
|
+
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
76042
|
+
silent: true,
|
|
76043
|
+
startText: "Installing adapter",
|
|
76044
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
76045
|
+
`via \`${npx2} astro add cloudflare\``
|
|
76046
|
+
)}`
|
|
76047
|
+
});
|
|
76048
|
+
updateAstroConfig();
|
|
76049
|
+
};
|
|
76050
|
+
var updateAstroConfig = () => {
|
|
76051
|
+
const filePath = "astro.config.mjs";
|
|
76052
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
76053
|
+
transformFile(filePath, {
|
|
76054
|
+
visitCallExpression: function(n) {
|
|
76055
|
+
const callee = n.node.callee;
|
|
76056
|
+
if (callee.name !== "cloudflare") {
|
|
76057
|
+
return this.traverse(n);
|
|
76058
|
+
}
|
|
76059
|
+
const b3 = recast5.types.builders;
|
|
76060
|
+
n.node.arguments = [
|
|
76061
|
+
b3.objectExpression([
|
|
76062
|
+
b3.objectProperty(
|
|
76063
|
+
b3.identifier("platformProxy"),
|
|
76064
|
+
b3.objectExpression([
|
|
76065
|
+
b3.objectProperty(b3.identifier("enabled"), b3.booleanLiteral(true))
|
|
76066
|
+
])
|
|
76067
|
+
)
|
|
76068
|
+
])
|
|
76069
|
+
];
|
|
76070
|
+
return false;
|
|
76071
|
+
}
|
|
76072
|
+
});
|
|
76073
|
+
};
|
|
76074
|
+
var config7 = {
|
|
76075
|
+
configVersion: 1,
|
|
76076
|
+
id: "astro",
|
|
76077
|
+
frameworkCli: "create-astro",
|
|
76078
|
+
platform: "pages",
|
|
76079
|
+
displayName: "Astro",
|
|
76080
|
+
path: "templates/astro/pages",
|
|
76081
|
+
copyFiles: {
|
|
76082
|
+
async selectVariant(ctx) {
|
|
76083
|
+
return usesTypescript(ctx) ? "ts" : "js";
|
|
76084
|
+
},
|
|
76085
|
+
variants: {
|
|
76086
|
+
js: {
|
|
76087
|
+
path: "./templates/js"
|
|
76088
|
+
},
|
|
76089
|
+
ts: {
|
|
76090
|
+
path: "./templates/ts"
|
|
76091
|
+
}
|
|
76092
|
+
}
|
|
76093
|
+
},
|
|
76094
|
+
devScript: "dev",
|
|
76095
|
+
deployScript: "deploy",
|
|
76096
|
+
previewScript: "preview",
|
|
76097
|
+
generate: generate7,
|
|
76098
|
+
configure: configure7,
|
|
76099
|
+
transformPackageJson: async (pkgJson, ctx) => ({
|
|
76100
|
+
scripts: {
|
|
76101
|
+
deploy: `astro build && wrangler pages deploy`,
|
|
76102
|
+
preview: `astro build && wrangler pages dev`,
|
|
76103
|
+
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
76104
|
+
}
|
|
76105
|
+
})
|
|
76106
|
+
};
|
|
76107
|
+
var c3_default8 = config7;
|
|
76108
|
+
|
|
76109
|
+
// templates/astro/workers/c3.ts
|
|
76110
|
+
var recast6 = __toESM(require_main3());
|
|
76347
76111
|
var { npx: npx3 } = detectPackageManager();
|
|
76348
|
-
var
|
|
76112
|
+
var generate8 = async (ctx) => {
|
|
76349
76113
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
76350
76114
|
logRaw("");
|
|
76351
76115
|
};
|
|
76352
|
-
var
|
|
76116
|
+
var configure8 = async () => {
|
|
76353
76117
|
await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
|
|
76354
76118
|
silent: true,
|
|
76355
76119
|
startText: "Installing adapter",
|
|
@@ -76368,7 +76132,7 @@ var updateAstroConfig2 = () => {
|
|
|
76368
76132
|
if (callee.name !== "cloudflare") {
|
|
76369
76133
|
return this.traverse(n);
|
|
76370
76134
|
}
|
|
76371
|
-
const b3 =
|
|
76135
|
+
const b3 = recast6.types.builders;
|
|
76372
76136
|
n.node.arguments = [
|
|
76373
76137
|
b3.objectExpression([
|
|
76374
76138
|
b3.objectProperty(
|
|
@@ -76383,11 +76147,11 @@ var updateAstroConfig2 = () => {
|
|
|
76383
76147
|
}
|
|
76384
76148
|
});
|
|
76385
76149
|
};
|
|
76386
|
-
var
|
|
76150
|
+
var config8 = {
|
|
76387
76151
|
configVersion: 1,
|
|
76388
76152
|
id: "astro",
|
|
76389
76153
|
frameworkCli: "create-astro",
|
|
76390
|
-
platform: "
|
|
76154
|
+
platform: "workers",
|
|
76391
76155
|
displayName: "Astro",
|
|
76392
76156
|
copyFiles: {
|
|
76393
76157
|
async selectVariant(ctx) {
|
|
@@ -76405,20 +76169,28 @@ var config13 = {
|
|
|
76405
76169
|
devScript: "dev",
|
|
76406
76170
|
deployScript: "deploy",
|
|
76407
76171
|
previewScript: "preview",
|
|
76408
|
-
|
|
76409
|
-
|
|
76172
|
+
path: "templates/astro/workers",
|
|
76173
|
+
generate: generate8,
|
|
76174
|
+
configure: configure8,
|
|
76410
76175
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
76411
76176
|
scripts: {
|
|
76412
|
-
deploy: `astro build && wrangler
|
|
76413
|
-
preview: `astro build && wrangler
|
|
76177
|
+
deploy: `astro build && wrangler deploy`,
|
|
76178
|
+
preview: `astro build && wrangler dev`,
|
|
76414
76179
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
76415
76180
|
}
|
|
76416
76181
|
})
|
|
76417
76182
|
};
|
|
76418
|
-
var
|
|
76183
|
+
var c3_default9 = config8;
|
|
76184
|
+
|
|
76185
|
+
// templates/astro/c3.ts
|
|
76186
|
+
var config9 = {
|
|
76187
|
+
displayName: "Astro",
|
|
76188
|
+
platformVariants: { pages: c3_default8, workers: c3_default9 }
|
|
76189
|
+
};
|
|
76190
|
+
var c3_default10 = config9;
|
|
76419
76191
|
|
|
76420
76192
|
// templates/common/c3.ts
|
|
76421
|
-
var
|
|
76193
|
+
var c3_default11 = {
|
|
76422
76194
|
configVersion: 1,
|
|
76423
76195
|
id: "common",
|
|
76424
76196
|
displayName: "Example router & proxy Worker",
|
|
@@ -76438,36 +76210,36 @@ var c3_default16 = {
|
|
|
76438
76210
|
};
|
|
76439
76211
|
|
|
76440
76212
|
// templates/docusaurus/pages/c3.ts
|
|
76441
|
-
var { npm:
|
|
76442
|
-
var
|
|
76213
|
+
var { npm: npm6 } = detectPackageManager();
|
|
76214
|
+
var generate9 = async (ctx) => {
|
|
76443
76215
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76444
76216
|
};
|
|
76445
|
-
var
|
|
76217
|
+
var config10 = {
|
|
76446
76218
|
configVersion: 1,
|
|
76447
76219
|
id: "docusaurus",
|
|
76448
76220
|
frameworkCli: "create-docusaurus",
|
|
76449
76221
|
platform: "pages",
|
|
76450
76222
|
displayName: "Docusaurus",
|
|
76451
76223
|
path: "templates/docusaurus/pages",
|
|
76452
|
-
generate:
|
|
76224
|
+
generate: generate9,
|
|
76453
76225
|
transformPackageJson: async () => ({
|
|
76454
76226
|
scripts: {
|
|
76455
|
-
preview: `${
|
|
76456
|
-
deploy: `${
|
|
76227
|
+
preview: `${npm6} run build && wrangler pages dev ./build`,
|
|
76228
|
+
deploy: `${npm6} run build && wrangler pages deploy ./build`
|
|
76457
76229
|
}
|
|
76458
76230
|
}),
|
|
76459
76231
|
devScript: "preview",
|
|
76460
76232
|
deployScript: "deploy",
|
|
76461
76233
|
previewScript: "preview"
|
|
76462
76234
|
};
|
|
76463
|
-
var
|
|
76235
|
+
var c3_default12 = config10;
|
|
76464
76236
|
|
|
76465
76237
|
// templates/docusaurus/workers/c3.ts
|
|
76466
|
-
var { npm:
|
|
76467
|
-
var
|
|
76238
|
+
var { npm: npm7 } = detectPackageManager();
|
|
76239
|
+
var generate10 = async (ctx) => {
|
|
76468
76240
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76469
76241
|
};
|
|
76470
|
-
var
|
|
76242
|
+
var config11 = {
|
|
76471
76243
|
configVersion: 1,
|
|
76472
76244
|
id: "docusaurus",
|
|
76473
76245
|
frameworkCli: "create-docusaurus",
|
|
@@ -76477,29 +76249,29 @@ var config15 = {
|
|
|
76477
76249
|
path: "./templates"
|
|
76478
76250
|
},
|
|
76479
76251
|
path: "templates/docusaurus/workers",
|
|
76480
|
-
generate:
|
|
76252
|
+
generate: generate10,
|
|
76481
76253
|
transformPackageJson: async () => ({
|
|
76482
76254
|
scripts: {
|
|
76483
|
-
deploy: `${
|
|
76484
|
-
preview: `${
|
|
76255
|
+
deploy: `${npm7} run build && wrangler deploy`,
|
|
76256
|
+
preview: `${npm7} run build && wrangler dev`
|
|
76485
76257
|
}
|
|
76486
76258
|
}),
|
|
76487
76259
|
devScript: "start",
|
|
76488
76260
|
deployScript: "deploy",
|
|
76489
76261
|
previewScript: "preview"
|
|
76490
76262
|
};
|
|
76491
|
-
var
|
|
76263
|
+
var c3_default13 = config11;
|
|
76492
76264
|
|
|
76493
76265
|
// templates/docusaurus/c3.ts
|
|
76494
|
-
var
|
|
76266
|
+
var config12 = {
|
|
76495
76267
|
displayName: "Docusaurus",
|
|
76496
|
-
platformVariants: { pages:
|
|
76268
|
+
platformVariants: { pages: c3_default12, workers: c3_default13 }
|
|
76497
76269
|
};
|
|
76498
|
-
var
|
|
76270
|
+
var c3_default14 = config12;
|
|
76499
76271
|
|
|
76500
76272
|
// templates/gatsby/pages/c3.ts
|
|
76501
|
-
var { npm:
|
|
76502
|
-
var
|
|
76273
|
+
var { npm: npm8 } = detectPackageManager();
|
|
76274
|
+
var generate11 = async (ctx) => {
|
|
76503
76275
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76504
76276
|
const useTemplate = await inputPrompt({
|
|
76505
76277
|
type: "confirm",
|
|
@@ -76518,29 +76290,29 @@ var generate14 = async (ctx) => {
|
|
|
76518
76290
|
}
|
|
76519
76291
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76520
76292
|
};
|
|
76521
|
-
var
|
|
76293
|
+
var config13 = {
|
|
76522
76294
|
configVersion: 1,
|
|
76523
76295
|
id: "gatsby",
|
|
76524
76296
|
frameworkCli: "gatsby",
|
|
76525
76297
|
platform: "pages",
|
|
76526
76298
|
displayName: "Gatsby",
|
|
76527
76299
|
path: "templates/gatsby/pages",
|
|
76528
|
-
generate:
|
|
76300
|
+
generate: generate11,
|
|
76529
76301
|
transformPackageJson: async () => ({
|
|
76530
76302
|
scripts: {
|
|
76531
|
-
deploy: `${
|
|
76532
|
-
preview: `${
|
|
76303
|
+
deploy: `${npm8} run build && wrangler pages deploy ./public`,
|
|
76304
|
+
preview: `${npm8} run build && wrangler pages dev ./public`
|
|
76533
76305
|
}
|
|
76534
76306
|
}),
|
|
76535
76307
|
devScript: "develop",
|
|
76536
76308
|
deployScript: "deploy",
|
|
76537
76309
|
previewScript: "preview"
|
|
76538
76310
|
};
|
|
76539
|
-
var
|
|
76311
|
+
var c3_default15 = config13;
|
|
76540
76312
|
|
|
76541
76313
|
// templates/gatsby/workers/c3.ts
|
|
76542
|
-
var { npm:
|
|
76543
|
-
var
|
|
76314
|
+
var { npm: npm9 } = detectPackageManager();
|
|
76315
|
+
var generate12 = async (ctx) => {
|
|
76544
76316
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76545
76317
|
const useTemplate = await inputPrompt({
|
|
76546
76318
|
type: "confirm",
|
|
@@ -76559,7 +76331,7 @@ var generate15 = async (ctx) => {
|
|
|
76559
76331
|
}
|
|
76560
76332
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76561
76333
|
};
|
|
76562
|
-
var
|
|
76334
|
+
var config14 = {
|
|
76563
76335
|
configVersion: 1,
|
|
76564
76336
|
id: "gatsby",
|
|
76565
76337
|
frameworkCli: "gatsby",
|
|
@@ -76569,32 +76341,67 @@ var config18 = {
|
|
|
76569
76341
|
path: "./templates"
|
|
76570
76342
|
},
|
|
76571
76343
|
path: "templates/gatsby/workers",
|
|
76572
|
-
generate:
|
|
76344
|
+
generate: generate12,
|
|
76573
76345
|
transformPackageJson: async () => ({
|
|
76574
76346
|
scripts: {
|
|
76575
|
-
deploy: `${
|
|
76576
|
-
preview: `${
|
|
76347
|
+
deploy: `${npm9} run build && wrangler deploy`,
|
|
76348
|
+
preview: `${npm9} run build && wrangler dev`
|
|
76577
76349
|
}
|
|
76578
76350
|
}),
|
|
76579
76351
|
devScript: "develop",
|
|
76580
76352
|
deployScript: "deploy",
|
|
76581
76353
|
previewScript: "preview"
|
|
76582
76354
|
};
|
|
76583
|
-
var
|
|
76355
|
+
var c3_default16 = config14;
|
|
76584
76356
|
|
|
76585
76357
|
// templates/gatsby/c3.ts
|
|
76586
|
-
var
|
|
76358
|
+
var config15 = {
|
|
76587
76359
|
displayName: "Gatsby",
|
|
76588
|
-
platformVariants: { pages:
|
|
76360
|
+
platformVariants: { pages: c3_default15, workers: c3_default16 }
|
|
76589
76361
|
};
|
|
76590
|
-
var
|
|
76362
|
+
var c3_default17 = config15;
|
|
76363
|
+
|
|
76364
|
+
// templates/hello-world-assets-only/c3.ts
|
|
76365
|
+
var config16 = {
|
|
76366
|
+
configVersion: 1,
|
|
76367
|
+
id: "hello-world-assets-only",
|
|
76368
|
+
path: "templates/hello-world-assets-only",
|
|
76369
|
+
displayName: "Assets only",
|
|
76370
|
+
description: "For static sites (including SPAs) or when using your own backend",
|
|
76371
|
+
platform: "workers",
|
|
76372
|
+
copyFiles: {
|
|
76373
|
+
path: "./templates"
|
|
76374
|
+
}
|
|
76375
|
+
};
|
|
76376
|
+
var c3_default18 = config16;
|
|
76377
|
+
|
|
76378
|
+
// templates/hello-world-durable-object-with-assets/c3.ts
|
|
76379
|
+
var config17 = {
|
|
76380
|
+
configVersion: 1,
|
|
76381
|
+
id: "hello-world-durable-object-with-assets",
|
|
76382
|
+
path: "templates/hello-world-durable-object-with-assets",
|
|
76383
|
+
displayName: "Worker + Durable Objects + Assets",
|
|
76384
|
+
description: "For full-stack applications requiring static assets, an API, and real-time coordination",
|
|
76385
|
+
platform: "workers",
|
|
76386
|
+
copyFiles: {
|
|
76387
|
+
variants: {
|
|
76388
|
+
js: {
|
|
76389
|
+
path: "./js"
|
|
76390
|
+
},
|
|
76391
|
+
ts: {
|
|
76392
|
+
path: "./ts"
|
|
76393
|
+
}
|
|
76394
|
+
}
|
|
76395
|
+
}
|
|
76396
|
+
};
|
|
76397
|
+
var c3_default19 = config17;
|
|
76591
76398
|
|
|
76592
76399
|
// templates/hello-world-durable-object/c3.ts
|
|
76593
|
-
var
|
|
76400
|
+
var c3_default20 = {
|
|
76594
76401
|
configVersion: 1,
|
|
76595
76402
|
id: "hello-world-durable-object",
|
|
76596
|
-
displayName: "
|
|
76597
|
-
description: "
|
|
76403
|
+
displayName: "Worker + Durable Objects",
|
|
76404
|
+
description: "For multiplayer apps using WebSockets, or when you need synchronization",
|
|
76598
76405
|
platform: "workers",
|
|
76599
76406
|
copyFiles: {
|
|
76600
76407
|
variants: {
|
|
@@ -76608,14 +76415,37 @@ var c3_default23 = {
|
|
|
76608
76415
|
}
|
|
76609
76416
|
};
|
|
76610
76417
|
|
|
76418
|
+
// templates/hello-world-with-assets/c3.ts
|
|
76419
|
+
var c3_default21 = {
|
|
76420
|
+
configVersion: 1,
|
|
76421
|
+
id: "hello-world-with-assets",
|
|
76422
|
+
path: "templates/hello-world-with-assets",
|
|
76423
|
+
displayName: "Worker + Assets",
|
|
76424
|
+
description: "For static sites with an API or server-side rendering (SSR)",
|
|
76425
|
+
platform: "workers",
|
|
76426
|
+
copyFiles: {
|
|
76427
|
+
variants: {
|
|
76428
|
+
js: {
|
|
76429
|
+
path: "./js"
|
|
76430
|
+
},
|
|
76431
|
+
ts: {
|
|
76432
|
+
path: "./ts"
|
|
76433
|
+
},
|
|
76434
|
+
python: {
|
|
76435
|
+
path: "./py"
|
|
76436
|
+
}
|
|
76437
|
+
}
|
|
76438
|
+
}
|
|
76439
|
+
};
|
|
76440
|
+
|
|
76611
76441
|
// templates/hello-world/c3.ts
|
|
76612
76442
|
var import_promises2 = require("node:fs/promises");
|
|
76613
76443
|
var import_node_path5 = require("node:path");
|
|
76614
|
-
var
|
|
76444
|
+
var c3_default22 = {
|
|
76615
76445
|
configVersion: 1,
|
|
76616
76446
|
id: "hello-world",
|
|
76617
|
-
displayName: "
|
|
76618
|
-
description: "
|
|
76447
|
+
displayName: "Worker only",
|
|
76448
|
+
description: "For processing requests, transforming responses, or API endpoints",
|
|
76619
76449
|
platform: "workers",
|
|
76620
76450
|
async configure(ctx) {
|
|
76621
76451
|
if (ctx.args.lang === "python") {
|
|
@@ -76644,35 +76474,55 @@ var c3_default24 = {
|
|
|
76644
76474
|
}
|
|
76645
76475
|
};
|
|
76646
76476
|
|
|
76647
|
-
// templates/hono/c3.ts
|
|
76648
|
-
var
|
|
76477
|
+
// templates/hono/pages/c3.ts
|
|
76478
|
+
var generate13 = async (ctx) => {
|
|
76649
76479
|
const { name: pm4 } = detectPackageManager();
|
|
76650
76480
|
await runFrameworkGenerator(ctx, [
|
|
76651
76481
|
ctx.project.name,
|
|
76652
76482
|
"--template",
|
|
76653
|
-
"cloudflare-
|
|
76483
|
+
"cloudflare-pages",
|
|
76654
76484
|
"--install",
|
|
76655
76485
|
"--pm",
|
|
76656
76486
|
pm4
|
|
76657
76487
|
]);
|
|
76658
76488
|
logRaw("");
|
|
76659
76489
|
};
|
|
76660
|
-
var
|
|
76661
|
-
|
|
76662
|
-
|
|
76663
|
-
|
|
76664
|
-
|
|
76665
|
-
|
|
76666
|
-
|
|
76667
|
-
|
|
76668
|
-
|
|
76669
|
-
|
|
76670
|
-
|
|
76490
|
+
var config18 = {
|
|
76491
|
+
configVersion: 1,
|
|
76492
|
+
id: "hono",
|
|
76493
|
+
frameworkCli: "create-hono",
|
|
76494
|
+
displayName: "Hono",
|
|
76495
|
+
copyFiles: {
|
|
76496
|
+
path: "./templates"
|
|
76497
|
+
},
|
|
76498
|
+
path: "templates/hono/pages",
|
|
76499
|
+
platform: "pages",
|
|
76500
|
+
generate: generate13,
|
|
76501
|
+
transformPackageJson: async () => ({
|
|
76502
|
+
scripts: {
|
|
76503
|
+
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
76671
76504
|
}
|
|
76672
|
-
})
|
|
76673
|
-
|
|
76505
|
+
}),
|
|
76506
|
+
devScript: "dev",
|
|
76507
|
+
deployScript: "deploy",
|
|
76508
|
+
previewScript: "dev"
|
|
76674
76509
|
};
|
|
76675
|
-
var
|
|
76510
|
+
var c3_default23 = config18;
|
|
76511
|
+
|
|
76512
|
+
// templates/hono/workers/c3.ts
|
|
76513
|
+
var generate14 = async (ctx) => {
|
|
76514
|
+
const { name: pm4 } = detectPackageManager();
|
|
76515
|
+
await runFrameworkGenerator(ctx, [
|
|
76516
|
+
ctx.project.name,
|
|
76517
|
+
"--template",
|
|
76518
|
+
"cloudflare-workers",
|
|
76519
|
+
"--install",
|
|
76520
|
+
"--pm",
|
|
76521
|
+
pm4
|
|
76522
|
+
]);
|
|
76523
|
+
logRaw("");
|
|
76524
|
+
};
|
|
76525
|
+
var config19 = {
|
|
76676
76526
|
configVersion: 1,
|
|
76677
76527
|
id: "hono",
|
|
76678
76528
|
frameworkCli: "create-hono",
|
|
@@ -76681,12 +76531,10 @@ var config20 = {
|
|
|
76681
76531
|
path: "./templates"
|
|
76682
76532
|
},
|
|
76683
76533
|
platform: "workers",
|
|
76684
|
-
|
|
76685
|
-
|
|
76534
|
+
path: "templates/hono/workers",
|
|
76535
|
+
generate: generate14,
|
|
76686
76536
|
transformPackageJson: async () => ({
|
|
76687
76537
|
scripts: {
|
|
76688
|
-
dev: "wrangler dev",
|
|
76689
|
-
deploy: "wrangler deploy --minify",
|
|
76690
76538
|
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
76691
76539
|
}
|
|
76692
76540
|
}),
|
|
@@ -76694,12 +76542,19 @@ var config20 = {
|
|
|
76694
76542
|
deployScript: "deploy",
|
|
76695
76543
|
previewScript: "dev"
|
|
76696
76544
|
};
|
|
76545
|
+
var c3_default24 = config19;
|
|
76546
|
+
|
|
76547
|
+
// templates/hono/c3.ts
|
|
76548
|
+
var config20 = {
|
|
76549
|
+
displayName: "Hono",
|
|
76550
|
+
platformVariants: { pages: c3_default23, workers: c3_default24 }
|
|
76551
|
+
};
|
|
76697
76552
|
var c3_default25 = config20;
|
|
76698
76553
|
|
|
76699
76554
|
// templates/next/c3.ts
|
|
76700
76555
|
var import_path10 = require("path");
|
|
76701
|
-
var { npm:
|
|
76702
|
-
var
|
|
76556
|
+
var { npm: npm10, npx: npx4 } = detectPackageManager();
|
|
76557
|
+
var generate15 = async (ctx) => {
|
|
76703
76558
|
const projectName = ctx.project.name;
|
|
76704
76559
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76705
76560
|
const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
@@ -76724,7 +76579,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76724
76579
|
writeFile2(configFile, updatedConfigFile);
|
|
76725
76580
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76726
76581
|
};
|
|
76727
|
-
var
|
|
76582
|
+
var configure9 = async (ctx) => {
|
|
76728
76583
|
const projectPath = ctx.project.path;
|
|
76729
76584
|
const path6 = probePaths([
|
|
76730
76585
|
`${projectPath}/pages/api`,
|
|
@@ -76805,8 +76660,8 @@ var c3_default26 = {
|
|
|
76805
76660
|
frameworkCli: "create-next-app",
|
|
76806
76661
|
platform: "pages",
|
|
76807
76662
|
displayName: "Next.js",
|
|
76808
|
-
generate:
|
|
76809
|
-
configure:
|
|
76663
|
+
generate: generate15,
|
|
76664
|
+
configure: configure9,
|
|
76810
76665
|
copyFiles: {
|
|
76811
76666
|
async selectVariant(ctx) {
|
|
76812
76667
|
const isApp = probePaths([
|
|
@@ -76837,12 +76692,12 @@ var c3_default26 = {
|
|
|
76837
76692
|
}
|
|
76838
76693
|
},
|
|
76839
76694
|
transformPackageJson: async (_3, ctx) => {
|
|
76840
|
-
const isNpm =
|
|
76841
|
-
const isBun =
|
|
76695
|
+
const isNpm = npm10 === "npm";
|
|
76696
|
+
const isBun = npm10 === "bun";
|
|
76842
76697
|
const isNpmOrBun = isNpm || isBun;
|
|
76843
76698
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76844
76699
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76845
|
-
const pmCommand = isNpmOrBun ? npx4 :
|
|
76700
|
+
const pmCommand = isNpmOrBun ? npx4 : npm10;
|
|
76846
76701
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76847
76702
|
return {
|
|
76848
76703
|
scripts: {
|
|
@@ -76862,21 +76717,21 @@ var c3_default26 = {
|
|
|
76862
76717
|
};
|
|
76863
76718
|
|
|
76864
76719
|
// templates/nuxt/pages/c3.ts
|
|
76865
|
-
var
|
|
76866
|
-
var { npm:
|
|
76867
|
-
var
|
|
76720
|
+
var recast7 = __toESM(require_main3());
|
|
76721
|
+
var { npm: npm11, name: pm2 } = detectPackageManager();
|
|
76722
|
+
var generate16 = async (ctx) => {
|
|
76868
76723
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76869
76724
|
await runFrameworkGenerator(ctx, [
|
|
76870
76725
|
"init",
|
|
76871
76726
|
ctx.project.name,
|
|
76872
76727
|
"--packageManager",
|
|
76873
|
-
|
|
76728
|
+
npm11,
|
|
76874
76729
|
gitFlag
|
|
76875
76730
|
]);
|
|
76876
76731
|
writeFile2("./.node-version", "18");
|
|
76877
76732
|
logRaw("");
|
|
76878
76733
|
};
|
|
76879
|
-
var
|
|
76734
|
+
var configure10 = async (ctx) => {
|
|
76880
76735
|
const packages = ["nitro-cloudflare-dev"];
|
|
76881
76736
|
if (pm2 === "pnpm") {
|
|
76882
76737
|
packages.push("h3");
|
|
@@ -76884,7 +76739,7 @@ var configure13 = async (ctx) => {
|
|
|
76884
76739
|
await installPackages(packages, {
|
|
76885
76740
|
dev: true,
|
|
76886
76741
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76887
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76742
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
76888
76743
|
});
|
|
76889
76744
|
updateNuxtConfig();
|
|
76890
76745
|
updateEnvTypes2(ctx);
|
|
@@ -76907,7 +76762,7 @@ var updateNuxtConfig = () => {
|
|
|
76907
76762
|
const s = spinner();
|
|
76908
76763
|
const configFile = "nuxt.config.ts";
|
|
76909
76764
|
s.start(`Updating \`${configFile}\``);
|
|
76910
|
-
const b3 =
|
|
76765
|
+
const b3 = recast7.types.builders;
|
|
76911
76766
|
const presetDef = b3.objectProperty(
|
|
76912
76767
|
b3.identifier("nitro"),
|
|
76913
76768
|
b3.objectExpression([
|
|
@@ -76955,12 +76810,12 @@ var config21 = {
|
|
|
76955
76810
|
path: "./templates"
|
|
76956
76811
|
},
|
|
76957
76812
|
path: "templates/nuxt/pages",
|
|
76958
|
-
generate:
|
|
76959
|
-
configure:
|
|
76813
|
+
generate: generate16,
|
|
76814
|
+
configure: configure10,
|
|
76960
76815
|
transformPackageJson: async () => ({
|
|
76961
76816
|
scripts: {
|
|
76962
|
-
deploy: `${
|
|
76963
|
-
preview: `${
|
|
76817
|
+
deploy: `${npm11} run build && wrangler pages deploy`,
|
|
76818
|
+
preview: `${npm11} run build && wrangler pages dev`,
|
|
76964
76819
|
"cf-typegen": `wrangler types`
|
|
76965
76820
|
}
|
|
76966
76821
|
}),
|
|
@@ -76971,21 +76826,21 @@ var config21 = {
|
|
|
76971
76826
|
var c3_default27 = config21;
|
|
76972
76827
|
|
|
76973
76828
|
// templates/nuxt/workers/c3.ts
|
|
76974
|
-
var
|
|
76975
|
-
var { npm:
|
|
76976
|
-
var
|
|
76829
|
+
var recast8 = __toESM(require_main3());
|
|
76830
|
+
var { npm: npm12, name: pm3 } = detectPackageManager();
|
|
76831
|
+
var generate17 = async (ctx) => {
|
|
76977
76832
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76978
76833
|
await runFrameworkGenerator(ctx, [
|
|
76979
76834
|
"init",
|
|
76980
76835
|
ctx.project.name,
|
|
76981
76836
|
"--packageManager",
|
|
76982
|
-
|
|
76837
|
+
npm12,
|
|
76983
76838
|
gitFlag
|
|
76984
76839
|
]);
|
|
76985
76840
|
writeFile2("./.node-version", "18");
|
|
76986
76841
|
logRaw("");
|
|
76987
76842
|
};
|
|
76988
|
-
var
|
|
76843
|
+
var configure11 = async (ctx) => {
|
|
76989
76844
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
76990
76845
|
if (pm3 === "pnpm") {
|
|
76991
76846
|
packages.push("h3");
|
|
@@ -76993,7 +76848,7 @@ var configure14 = async (ctx) => {
|
|
|
76993
76848
|
await installPackages(packages, {
|
|
76994
76849
|
dev: true,
|
|
76995
76850
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76996
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76851
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm12} install\``)}`
|
|
76997
76852
|
});
|
|
76998
76853
|
updateNuxtConfig2();
|
|
76999
76854
|
updateEnvTypes3(ctx);
|
|
@@ -77016,7 +76871,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77016
76871
|
const s = spinner();
|
|
77017
76872
|
const configFile = "nuxt.config.ts";
|
|
77018
76873
|
s.start(`Updating \`${configFile}\``);
|
|
77019
|
-
const b3 =
|
|
76874
|
+
const b3 = recast8.types.builders;
|
|
77020
76875
|
const presetDef = b3.objectProperty(
|
|
77021
76876
|
b3.identifier("nitro"),
|
|
77022
76877
|
b3.objectExpression([
|
|
@@ -77064,12 +76919,12 @@ var config22 = {
|
|
|
77064
76919
|
path: "./templates"
|
|
77065
76920
|
},
|
|
77066
76921
|
path: "templates/nuxt/workers",
|
|
77067
|
-
generate:
|
|
77068
|
-
configure:
|
|
76922
|
+
generate: generate17,
|
|
76923
|
+
configure: configure11,
|
|
77069
76924
|
transformPackageJson: async () => ({
|
|
77070
76925
|
scripts: {
|
|
77071
|
-
deploy: `${
|
|
77072
|
-
preview: `${
|
|
76926
|
+
deploy: `${npm12} run build && wrangler deploy`,
|
|
76927
|
+
preview: `${npm12} run build && wrangler dev`,
|
|
77073
76928
|
"cf-typegen": `wrangler types`
|
|
77074
76929
|
}
|
|
77075
76930
|
}),
|
|
@@ -77262,7 +77117,7 @@ var c3_default31 = {
|
|
|
77262
77117
|
})
|
|
77263
77118
|
};
|
|
77264
77119
|
function buildConfigure(params) {
|
|
77265
|
-
return async function
|
|
77120
|
+
return async function configure21(ctx) {
|
|
77266
77121
|
const loginSuccess = await params.login(ctx);
|
|
77267
77122
|
if (!loginSuccess) {
|
|
77268
77123
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -77303,13 +77158,13 @@ var c3_default32 = {
|
|
|
77303
77158
|
};
|
|
77304
77159
|
|
|
77305
77160
|
// templates/qwik/c3.ts
|
|
77306
|
-
var
|
|
77307
|
-
var { npm:
|
|
77308
|
-
var
|
|
77161
|
+
var recast9 = __toESM(require_main3());
|
|
77162
|
+
var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
|
|
77163
|
+
var generate18 = async (ctx) => {
|
|
77309
77164
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77310
77165
|
};
|
|
77311
|
-
var
|
|
77312
|
-
const cmd = [name2 === "pnpm" ?
|
|
77166
|
+
var configure12 = async (ctx) => {
|
|
77167
|
+
const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77313
77168
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77314
77169
|
await runCommand(cmd);
|
|
77315
77170
|
addBindingsProxy2(ctx);
|
|
@@ -77322,7 +77177,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77322
77177
|
const s = spinner();
|
|
77323
77178
|
s.start("Updating `vite.config.ts`");
|
|
77324
77179
|
const snippets = loadTemplateSnippets(ctx);
|
|
77325
|
-
const b3 =
|
|
77180
|
+
const b3 = recast9.types.builders;
|
|
77326
77181
|
transformFile("vite.config.ts", {
|
|
77327
77182
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77328
77183
|
visitProgram: function(n) {
|
|
@@ -77364,7 +77219,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77364
77219
|
s.start(`Updating \`${entrypointPath}\``);
|
|
77365
77220
|
transformFile(entrypointPath, {
|
|
77366
77221
|
visitTSInterfaceDeclaration: function(n) {
|
|
77367
|
-
const b3 =
|
|
77222
|
+
const b3 = recast9.types.builders;
|
|
77368
77223
|
const id = n.node.id;
|
|
77369
77224
|
if (id.name !== "QwikCityPlatform") {
|
|
77370
77225
|
this.traverse(n);
|
|
@@ -77394,12 +77249,12 @@ var config24 = {
|
|
|
77394
77249
|
copyFiles: {
|
|
77395
77250
|
path: "./templates"
|
|
77396
77251
|
},
|
|
77397
|
-
generate:
|
|
77398
|
-
configure:
|
|
77252
|
+
generate: generate18,
|
|
77253
|
+
configure: configure12,
|
|
77399
77254
|
transformPackageJson: async () => ({
|
|
77400
77255
|
scripts: {
|
|
77401
|
-
deploy: `${
|
|
77402
|
-
preview: `${
|
|
77256
|
+
deploy: `${npm13} run build && wrangler pages deploy`,
|
|
77257
|
+
preview: `${npm13} run build && wrangler pages dev`,
|
|
77403
77258
|
"cf-typegen": `wrangler types`
|
|
77404
77259
|
}
|
|
77405
77260
|
}),
|
|
@@ -77410,8 +77265,8 @@ var config24 = {
|
|
|
77410
77265
|
var c3_default33 = config24;
|
|
77411
77266
|
|
|
77412
77267
|
// templates/react/pages/c3.ts
|
|
77413
|
-
var { npm:
|
|
77414
|
-
var
|
|
77268
|
+
var { npm: npm14 } = detectPackageManager();
|
|
77269
|
+
var generate19 = async (ctx) => {
|
|
77415
77270
|
const variant = await inputPrompt({
|
|
77416
77271
|
type: "select",
|
|
77417
77272
|
question: "Select a variant:",
|
|
@@ -77448,11 +77303,11 @@ var config25 = {
|
|
|
77448
77303
|
displayName: "React",
|
|
77449
77304
|
platform: "pages",
|
|
77450
77305
|
path: "templates/react/pages",
|
|
77451
|
-
generate:
|
|
77306
|
+
generate: generate19,
|
|
77452
77307
|
transformPackageJson: async () => ({
|
|
77453
77308
|
scripts: {
|
|
77454
|
-
deploy: `${
|
|
77455
|
-
preview: `${
|
|
77309
|
+
deploy: `${npm14} run build && wrangler pages deploy ./dist`,
|
|
77310
|
+
preview: `${npm14} run build && wrangler pages dev ./dist`
|
|
77456
77311
|
}
|
|
77457
77312
|
}),
|
|
77458
77313
|
devScript: "dev",
|
|
@@ -77463,11 +77318,11 @@ var c3_default34 = config25;
|
|
|
77463
77318
|
|
|
77464
77319
|
// templates/react/workers/c3.ts
|
|
77465
77320
|
var import_assert2 = __toESM(require("assert"));
|
|
77466
|
-
var
|
|
77467
|
-
var b2 =
|
|
77468
|
-
var t =
|
|
77469
|
-
var { npm:
|
|
77470
|
-
var
|
|
77321
|
+
var recast10 = __toESM(require_main3());
|
|
77322
|
+
var b2 = recast10.types.builders;
|
|
77323
|
+
var t = recast10.types.namedTypes;
|
|
77324
|
+
var { npm: npm15 } = detectPackageManager();
|
|
77325
|
+
var generate20 = async (ctx) => {
|
|
77471
77326
|
const variant = await getVariant();
|
|
77472
77327
|
ctx.args.lang = variant.lang;
|
|
77473
77328
|
await runFrameworkGenerator(ctx, [
|
|
@@ -77477,7 +77332,7 @@ var generate22 = async (ctx) => {
|
|
|
77477
77332
|
]);
|
|
77478
77333
|
logRaw("");
|
|
77479
77334
|
};
|
|
77480
|
-
var
|
|
77335
|
+
var configure13 = async (ctx) => {
|
|
77481
77336
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77482
77337
|
dev: true,
|
|
77483
77338
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77508,9 +77363,9 @@ function transformViteConfig(ctx) {
|
|
|
77508
77363
|
if (callee.name !== "defineConfig") {
|
|
77509
77364
|
return this.traverse(n);
|
|
77510
77365
|
}
|
|
77511
|
-
const
|
|
77512
|
-
(0, import_assert2.default)(t.ObjectExpression.check(
|
|
77513
|
-
const pluginsProp =
|
|
77366
|
+
const config38 = n.node.arguments[0];
|
|
77367
|
+
(0, import_assert2.default)(t.ObjectExpression.check(config38));
|
|
77368
|
+
const pluginsProp = config38.properties.find((prop) => isPluginsProp(prop));
|
|
77514
77369
|
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77515
77370
|
pluginsProp.value.elements.push(
|
|
77516
77371
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -77584,12 +77439,12 @@ var config26 = {
|
|
|
77584
77439
|
}
|
|
77585
77440
|
}
|
|
77586
77441
|
},
|
|
77587
|
-
generate:
|
|
77588
|
-
configure:
|
|
77442
|
+
generate: generate20,
|
|
77443
|
+
configure: configure13,
|
|
77589
77444
|
transformPackageJson: async (_3, ctx) => ({
|
|
77590
77445
|
scripts: {
|
|
77591
|
-
deploy: `${
|
|
77592
|
-
preview: `${
|
|
77446
|
+
deploy: `${npm15} run build && wrangler deploy`,
|
|
77447
|
+
preview: `${npm15} run build && vite preview`,
|
|
77593
77448
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77594
77449
|
}
|
|
77595
77450
|
}),
|
|
@@ -77606,9 +77461,9 @@ var config27 = {
|
|
|
77606
77461
|
};
|
|
77607
77462
|
var c3_default36 = config27;
|
|
77608
77463
|
|
|
77609
|
-
// templates/remix/c3.ts
|
|
77610
|
-
var { npm:
|
|
77611
|
-
var
|
|
77464
|
+
// templates/remix/pages/c3.ts
|
|
77465
|
+
var { npm: npm16 } = detectPackageManager();
|
|
77466
|
+
var generate21 = async (ctx) => {
|
|
77612
77467
|
await runFrameworkGenerator(ctx, [
|
|
77613
77468
|
ctx.project.name,
|
|
77614
77469
|
"--template",
|
|
@@ -77616,7 +77471,7 @@ var generate23 = async (ctx) => {
|
|
|
77616
77471
|
]);
|
|
77617
77472
|
logRaw("");
|
|
77618
77473
|
};
|
|
77619
|
-
var
|
|
77474
|
+
var configure14 = async () => {
|
|
77620
77475
|
const typeDefsPath = "load-context.ts";
|
|
77621
77476
|
const s = spinner();
|
|
77622
77477
|
s.start(`Updating \`${typeDefsPath}\``);
|
|
@@ -77640,12 +77495,13 @@ var config28 = {
|
|
|
77640
77495
|
copyFiles: {
|
|
77641
77496
|
path: "./templates"
|
|
77642
77497
|
},
|
|
77643
|
-
|
|
77644
|
-
|
|
77498
|
+
path: "templates/remix/pages",
|
|
77499
|
+
generate: generate21,
|
|
77500
|
+
configure: configure14,
|
|
77645
77501
|
transformPackageJson: async () => ({
|
|
77646
77502
|
scripts: {
|
|
77647
|
-
deploy: `${
|
|
77648
|
-
preview: `${
|
|
77503
|
+
deploy: `${npm16} run build && wrangler pages deploy`,
|
|
77504
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
77649
77505
|
"cf-typegen": `wrangler types`
|
|
77650
77506
|
}
|
|
77651
77507
|
}),
|
|
@@ -77655,8 +77511,57 @@ var config28 = {
|
|
|
77655
77511
|
};
|
|
77656
77512
|
var c3_default37 = config28;
|
|
77657
77513
|
|
|
77514
|
+
// templates/remix/workers/c3.ts
|
|
77515
|
+
var { npm: npm17 } = detectPackageManager();
|
|
77516
|
+
var generate22 = async (ctx) => {
|
|
77517
|
+
await runFrameworkGenerator(ctx, [
|
|
77518
|
+
ctx.project.name,
|
|
77519
|
+
"--template",
|
|
77520
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
77521
|
+
]);
|
|
77522
|
+
logRaw("");
|
|
77523
|
+
};
|
|
77524
|
+
var configure15 = async () => {
|
|
77525
|
+
await installPackages(["wrangler@latest"], {
|
|
77526
|
+
dev: true,
|
|
77527
|
+
startText: "Updating the Wrangler version",
|
|
77528
|
+
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
77529
|
+
});
|
|
77530
|
+
};
|
|
77531
|
+
var config29 = {
|
|
77532
|
+
configVersion: 1,
|
|
77533
|
+
id: "remix",
|
|
77534
|
+
frameworkCli: "create-remix",
|
|
77535
|
+
platform: "workers",
|
|
77536
|
+
displayName: "Remix",
|
|
77537
|
+
copyFiles: {
|
|
77538
|
+
path: "./templates"
|
|
77539
|
+
},
|
|
77540
|
+
path: "templates/remix/workers",
|
|
77541
|
+
generate: generate22,
|
|
77542
|
+
configure: configure15,
|
|
77543
|
+
transformPackageJson: async () => ({
|
|
77544
|
+
scripts: {
|
|
77545
|
+
deploy: `${npm17} run build && wrangler deploy`,
|
|
77546
|
+
preview: `${npm17} run build && wrangler dev`,
|
|
77547
|
+
"cf-typegen": `wrangler types`
|
|
77548
|
+
}
|
|
77549
|
+
}),
|
|
77550
|
+
devScript: "dev",
|
|
77551
|
+
deployScript: "deploy",
|
|
77552
|
+
previewScript: "preview"
|
|
77553
|
+
};
|
|
77554
|
+
var c3_default38 = config29;
|
|
77555
|
+
|
|
77556
|
+
// templates/remix/c3.ts
|
|
77557
|
+
var config30 = {
|
|
77558
|
+
displayName: "Remix",
|
|
77559
|
+
platformVariants: { pages: c3_default37, workers: c3_default38 }
|
|
77560
|
+
};
|
|
77561
|
+
var c3_default39 = config30;
|
|
77562
|
+
|
|
77658
77563
|
// templates/scheduled/c3.ts
|
|
77659
|
-
var
|
|
77564
|
+
var c3_default40 = {
|
|
77660
77565
|
configVersion: 1,
|
|
77661
77566
|
id: "scheduled",
|
|
77662
77567
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -77675,13 +77580,13 @@ var c3_default38 = {
|
|
|
77675
77580
|
};
|
|
77676
77581
|
|
|
77677
77582
|
// templates/solid/c3.ts
|
|
77678
|
-
var
|
|
77679
|
-
var { npm:
|
|
77680
|
-
var
|
|
77583
|
+
var recast11 = __toESM(require_main3());
|
|
77584
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77585
|
+
var generate23 = async (ctx) => {
|
|
77681
77586
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
77682
77587
|
logRaw("");
|
|
77683
77588
|
};
|
|
77684
|
-
var
|
|
77589
|
+
var configure16 = async (ctx) => {
|
|
77685
77590
|
usesTypescript(ctx);
|
|
77686
77591
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
77687
77592
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
@@ -77691,7 +77596,7 @@ var configure18 = async (ctx) => {
|
|
|
77691
77596
|
if (callee.name !== "defineConfig") {
|
|
77692
77597
|
return this.traverse(n);
|
|
77693
77598
|
}
|
|
77694
|
-
const b3 =
|
|
77599
|
+
const b3 = recast11.types.builders;
|
|
77695
77600
|
mergeObjectProperties(
|
|
77696
77601
|
n.node.arguments[0],
|
|
77697
77602
|
[
|
|
@@ -77719,7 +77624,7 @@ var configure18 = async (ctx) => {
|
|
|
77719
77624
|
}
|
|
77720
77625
|
});
|
|
77721
77626
|
};
|
|
77722
|
-
var
|
|
77627
|
+
var config31 = {
|
|
77723
77628
|
configVersion: 1,
|
|
77724
77629
|
id: "solid",
|
|
77725
77630
|
frameworkCli: "create-solid",
|
|
@@ -77728,12 +77633,12 @@ var config29 = {
|
|
|
77728
77633
|
copyFiles: {
|
|
77729
77634
|
path: "./templates"
|
|
77730
77635
|
},
|
|
77731
|
-
generate:
|
|
77732
|
-
configure:
|
|
77636
|
+
generate: generate23,
|
|
77637
|
+
configure: configure16,
|
|
77733
77638
|
transformPackageJson: async () => ({
|
|
77734
77639
|
scripts: {
|
|
77735
|
-
preview: `${
|
|
77736
|
-
deploy: `${
|
|
77640
|
+
preview: `${npm18} run build && npx wrangler pages dev`,
|
|
77641
|
+
deploy: `${npm18} run build && wrangler pages deploy`
|
|
77737
77642
|
}
|
|
77738
77643
|
}),
|
|
77739
77644
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -77741,29 +77646,29 @@ var config29 = {
|
|
|
77741
77646
|
deployScript: "deploy",
|
|
77742
77647
|
previewScript: "preview"
|
|
77743
77648
|
};
|
|
77744
|
-
var
|
|
77649
|
+
var c3_default41 = config31;
|
|
77745
77650
|
|
|
77746
|
-
// templates/svelte/c3.ts
|
|
77651
|
+
// templates/svelte/pages/c3.ts
|
|
77747
77652
|
var import_node_fs3 = require("node:fs");
|
|
77748
|
-
var
|
|
77749
|
-
var
|
|
77750
|
-
var { npm:
|
|
77751
|
-
var
|
|
77653
|
+
var import_node_os3 = require("node:os");
|
|
77654
|
+
var recast12 = __toESM(require_main3());
|
|
77655
|
+
var { npm: npm19 } = detectPackageManager();
|
|
77656
|
+
var generate24 = async (ctx) => {
|
|
77752
77657
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77753
77658
|
logRaw("");
|
|
77754
77659
|
};
|
|
77755
|
-
var
|
|
77660
|
+
var configure17 = async (ctx) => {
|
|
77756
77661
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77757
77662
|
await installPackages([pkg], {
|
|
77758
77663
|
dev: true,
|
|
77759
77664
|
startText: "Adding the Cloudflare Pages adapter",
|
|
77760
77665
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77761
77666
|
});
|
|
77762
|
-
|
|
77667
|
+
updateSvelteConfig();
|
|
77763
77668
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
77764
|
-
|
|
77669
|
+
updateTypeDefinitions(ctx);
|
|
77765
77670
|
};
|
|
77766
|
-
var
|
|
77671
|
+
var updateSvelteConfig = () => {
|
|
77767
77672
|
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77768
77673
|
transformFile("svelte.config.js", {
|
|
77769
77674
|
visitImportDeclaration: function(n) {
|
|
@@ -77797,6 +77702,105 @@ var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
|
77797
77702
|
}
|
|
77798
77703
|
});
|
|
77799
77704
|
};
|
|
77705
|
+
var updateTypeDefinitions = (ctx) => {
|
|
77706
|
+
if (!usesTypescript(ctx)) {
|
|
77707
|
+
return;
|
|
77708
|
+
}
|
|
77709
|
+
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77710
|
+
const b3 = recast12.types.builders;
|
|
77711
|
+
transformFile("src/app.d.ts", {
|
|
77712
|
+
visitTSModuleDeclaration(n) {
|
|
77713
|
+
if (n.value.id.name === "App" && n.node.body) {
|
|
77714
|
+
const moduleBlock = n.node.body;
|
|
77715
|
+
const platformInterface = b3.tsInterfaceDeclaration(
|
|
77716
|
+
b3.identifier("Platform"),
|
|
77717
|
+
b3.tsInterfaceBody([
|
|
77718
|
+
b3.tsPropertySignature(
|
|
77719
|
+
b3.identifier("env"),
|
|
77720
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
77721
|
+
),
|
|
77722
|
+
b3.tsPropertySignature(
|
|
77723
|
+
b3.identifier("cf"),
|
|
77724
|
+
b3.tsTypeAnnotation(
|
|
77725
|
+
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
77726
|
+
)
|
|
77727
|
+
),
|
|
77728
|
+
b3.tsPropertySignature(
|
|
77729
|
+
b3.identifier("ctx"),
|
|
77730
|
+
b3.tsTypeAnnotation(
|
|
77731
|
+
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
77732
|
+
)
|
|
77733
|
+
)
|
|
77734
|
+
])
|
|
77735
|
+
);
|
|
77736
|
+
moduleBlock.body.unshift(platformInterface);
|
|
77737
|
+
}
|
|
77738
|
+
this.traverse(n);
|
|
77739
|
+
}
|
|
77740
|
+
});
|
|
77741
|
+
};
|
|
77742
|
+
var config32 = {
|
|
77743
|
+
configVersion: 1,
|
|
77744
|
+
id: "svelte",
|
|
77745
|
+
frameworkCli: "sv",
|
|
77746
|
+
displayName: "SvelteKit",
|
|
77747
|
+
platform: "pages",
|
|
77748
|
+
copyFiles: {
|
|
77749
|
+
path: "./templates"
|
|
77750
|
+
},
|
|
77751
|
+
path: "templates/svelte/pages",
|
|
77752
|
+
generate: generate24,
|
|
77753
|
+
configure: configure17,
|
|
77754
|
+
transformPackageJson: async (original, ctx) => {
|
|
77755
|
+
let scripts = {
|
|
77756
|
+
preview: `${npm19} run build && wrangler pages dev`,
|
|
77757
|
+
deploy: `${npm19} run build && wrangler pages deploy`
|
|
77758
|
+
};
|
|
77759
|
+
if (usesTypescript(ctx)) {
|
|
77760
|
+
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
77761
|
+
scripts = {
|
|
77762
|
+
...scripts,
|
|
77763
|
+
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
77764
|
+
};
|
|
77765
|
+
}
|
|
77766
|
+
return { scripts };
|
|
77767
|
+
},
|
|
77768
|
+
devScript: "dev",
|
|
77769
|
+
deployScript: "deploy",
|
|
77770
|
+
previewScript: "preview"
|
|
77771
|
+
};
|
|
77772
|
+
var c3_default42 = config32;
|
|
77773
|
+
|
|
77774
|
+
// templates/svelte/workers/c3.ts
|
|
77775
|
+
var import_node_os4 = require("node:os");
|
|
77776
|
+
var recast13 = __toESM(require_main3());
|
|
77777
|
+
var { npm: npm20 } = detectPackageManager();
|
|
77778
|
+
var generate25 = async (ctx) => {
|
|
77779
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77780
|
+
logRaw("");
|
|
77781
|
+
};
|
|
77782
|
+
var configure18 = async (ctx) => {
|
|
77783
|
+
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77784
|
+
await installPackages([pkg], {
|
|
77785
|
+
dev: true,
|
|
77786
|
+
startText: "Adding the Cloudflare adapter",
|
|
77787
|
+
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77788
|
+
});
|
|
77789
|
+
updateSvelteConfig2();
|
|
77790
|
+
updateTypeDefinitions2(ctx);
|
|
77791
|
+
};
|
|
77792
|
+
var updateSvelteConfig2 = () => {
|
|
77793
|
+
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77794
|
+
transformFile("svelte.config.js", {
|
|
77795
|
+
visitImportDeclaration: function(n) {
|
|
77796
|
+
const importSource = n.value.source;
|
|
77797
|
+
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
77798
|
+
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
77799
|
+
}
|
|
77800
|
+
return false;
|
|
77801
|
+
}
|
|
77802
|
+
});
|
|
77803
|
+
};
|
|
77800
77804
|
var updateTypeDefinitions2 = (ctx) => {
|
|
77801
77805
|
if (!usesTypescript(ctx)) {
|
|
77802
77806
|
return;
|
|
@@ -77834,21 +77838,22 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77834
77838
|
}
|
|
77835
77839
|
});
|
|
77836
77840
|
};
|
|
77837
|
-
var
|
|
77841
|
+
var config33 = {
|
|
77838
77842
|
configVersion: 1,
|
|
77839
77843
|
id: "svelte",
|
|
77840
77844
|
frameworkCli: "sv",
|
|
77841
77845
|
displayName: "SvelteKit",
|
|
77842
|
-
platform: "
|
|
77846
|
+
platform: "workers",
|
|
77843
77847
|
copyFiles: {
|
|
77844
77848
|
path: "./templates"
|
|
77845
77849
|
},
|
|
77850
|
+
path: "templates/svelte/workers",
|
|
77846
77851
|
generate: generate25,
|
|
77847
|
-
configure:
|
|
77852
|
+
configure: configure18,
|
|
77848
77853
|
transformPackageJson: async (original, ctx) => {
|
|
77849
77854
|
let scripts = {
|
|
77850
|
-
preview: `${npm20} run build && wrangler
|
|
77851
|
-
deploy: `${npm20} run build && wrangler
|
|
77855
|
+
preview: `${npm20} run build && wrangler dev`,
|
|
77856
|
+
deploy: `${npm20} run build && wrangler deploy`
|
|
77852
77857
|
};
|
|
77853
77858
|
if (usesTypescript(ctx)) {
|
|
77854
77859
|
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
@@ -77863,14 +77868,21 @@ var config30 = {
|
|
|
77863
77868
|
deployScript: "deploy",
|
|
77864
77869
|
previewScript: "preview"
|
|
77865
77870
|
};
|
|
77866
|
-
var
|
|
77871
|
+
var c3_default43 = config33;
|
|
77872
|
+
|
|
77873
|
+
// templates/svelte/c3.ts
|
|
77874
|
+
var config34 = {
|
|
77875
|
+
displayName: "SvelteKit",
|
|
77876
|
+
platformVariants: { pages: c3_default42, workers: c3_default43 }
|
|
77877
|
+
};
|
|
77878
|
+
var c3_default44 = config34;
|
|
77867
77879
|
|
|
77868
77880
|
// templates/vue/pages/c3.ts
|
|
77869
77881
|
var { npm: npm21 } = detectPackageManager();
|
|
77870
77882
|
var generate26 = async (ctx) => {
|
|
77871
77883
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77872
77884
|
};
|
|
77873
|
-
var
|
|
77885
|
+
var config35 = {
|
|
77874
77886
|
configVersion: 1,
|
|
77875
77887
|
id: "vue",
|
|
77876
77888
|
frameworkCli: "create-vue",
|
|
@@ -77888,7 +77900,7 @@ var config31 = {
|
|
|
77888
77900
|
deployScript: "deploy",
|
|
77889
77901
|
previewScript: "preview"
|
|
77890
77902
|
};
|
|
77891
|
-
var
|
|
77903
|
+
var c3_default45 = config35;
|
|
77892
77904
|
|
|
77893
77905
|
// templates/vue/workers/c3.ts
|
|
77894
77906
|
var { npm: npm22 } = detectPackageManager();
|
|
@@ -77909,7 +77921,7 @@ var generate27 = async (ctx) => {
|
|
|
77909
77921
|
]);
|
|
77910
77922
|
logRaw("");
|
|
77911
77923
|
};
|
|
77912
|
-
var
|
|
77924
|
+
var configure19 = async (ctx) => {
|
|
77913
77925
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77914
77926
|
dev: true,
|
|
77915
77927
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77930,7 +77942,7 @@ function updateTsconfigJson2() {
|
|
|
77930
77942
|
writeJSON("tsconfig.json", tsconfig);
|
|
77931
77943
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77932
77944
|
}
|
|
77933
|
-
var
|
|
77945
|
+
var config36 = {
|
|
77934
77946
|
configVersion: 1,
|
|
77935
77947
|
id: "vue",
|
|
77936
77948
|
frameworkCli: "create-vue",
|
|
@@ -77950,7 +77962,7 @@ var config32 = {
|
|
|
77950
77962
|
}
|
|
77951
77963
|
}
|
|
77952
77964
|
},
|
|
77953
|
-
configure:
|
|
77965
|
+
configure: configure19,
|
|
77954
77966
|
generate: generate27,
|
|
77955
77967
|
transformPackageJson: async (_3, ctx) => ({
|
|
77956
77968
|
scripts: {
|
|
@@ -77963,20 +77975,20 @@ var config32 = {
|
|
|
77963
77975
|
deployScript: "deploy",
|
|
77964
77976
|
previewScript: "preview"
|
|
77965
77977
|
};
|
|
77966
|
-
var
|
|
77978
|
+
var c3_default46 = config36;
|
|
77967
77979
|
|
|
77968
77980
|
// templates/vue/c3.ts
|
|
77969
|
-
var
|
|
77981
|
+
var config37 = {
|
|
77970
77982
|
displayName: "Vue",
|
|
77971
|
-
platformVariants: { pages:
|
|
77983
|
+
platformVariants: { pages: c3_default45, workers: c3_default46 }
|
|
77972
77984
|
};
|
|
77973
|
-
var
|
|
77985
|
+
var c3_default47 = config37;
|
|
77974
77986
|
|
|
77975
77987
|
// src/git.ts
|
|
77976
77988
|
var import_node_assert = __toESM(require("node:assert"));
|
|
77977
77989
|
|
|
77978
77990
|
// ../wrangler/package.json
|
|
77979
|
-
var version2 = "4.
|
|
77991
|
+
var version2 = "4.3.0";
|
|
77980
77992
|
|
|
77981
77993
|
// src/git.ts
|
|
77982
77994
|
var offerGit = async (ctx) => {
|
|
@@ -78237,47 +78249,42 @@ var defaultSelectVariant = async (ctx) => {
|
|
|
78237
78249
|
function getFrameworkMap({ experimental = false }) {
|
|
78238
78250
|
if (experimental) {
|
|
78239
78251
|
return {
|
|
78240
|
-
|
|
78241
|
-
|
|
78242
|
-
|
|
78243
|
-
qwik: c3_default7,
|
|
78244
|
-
remix: c3_default8,
|
|
78245
|
-
solid: c3_default9,
|
|
78246
|
-
svelte: c3_default10
|
|
78252
|
+
next: c3_default,
|
|
78253
|
+
qwik: c3_default2,
|
|
78254
|
+
solid: c3_default3
|
|
78247
78255
|
};
|
|
78248
78256
|
} else {
|
|
78249
78257
|
return {
|
|
78250
|
-
analog:
|
|
78251
|
-
angular:
|
|
78252
|
-
astro:
|
|
78253
|
-
docusaurus:
|
|
78254
|
-
gatsby:
|
|
78258
|
+
analog: c3_default4,
|
|
78259
|
+
angular: c3_default7,
|
|
78260
|
+
astro: c3_default10,
|
|
78261
|
+
docusaurus: c3_default14,
|
|
78262
|
+
gatsby: c3_default17,
|
|
78255
78263
|
hono: c3_default25,
|
|
78256
78264
|
next: c3_default26,
|
|
78257
78265
|
nuxt: c3_default29,
|
|
78258
78266
|
qwik: c3_default33,
|
|
78259
78267
|
react: c3_default36,
|
|
78260
|
-
remix:
|
|
78261
|
-
solid:
|
|
78262
|
-
svelte:
|
|
78263
|
-
vue:
|
|
78268
|
+
remix: c3_default39,
|
|
78269
|
+
solid: c3_default41,
|
|
78270
|
+
svelte: c3_default44,
|
|
78271
|
+
vue: c3_default47
|
|
78264
78272
|
};
|
|
78265
78273
|
}
|
|
78266
78274
|
}
|
|
78267
78275
|
function getTemplateMap({ experimental = false }) {
|
|
78268
78276
|
if (experimental) {
|
|
78269
|
-
return {
|
|
78270
|
-
"hello-world-assets-only": c3_default2,
|
|
78271
|
-
"hello-world-with-assets": c3_default4,
|
|
78272
|
-
"hello-world-durable-object-with-assets": c3_default3
|
|
78273
|
-
};
|
|
78277
|
+
return {};
|
|
78274
78278
|
} else {
|
|
78275
78279
|
return {
|
|
78276
|
-
"hello-world":
|
|
78277
|
-
|
|
78278
|
-
|
|
78280
|
+
"hello-world": c3_default22,
|
|
78281
|
+
"hello-world-assets-only": c3_default18,
|
|
78282
|
+
"hello-world-with-assets": c3_default21,
|
|
78283
|
+
"hello-world-durable-object": c3_default20,
|
|
78284
|
+
"hello-world-durable-object-with-assets": c3_default19,
|
|
78285
|
+
common: c3_default11,
|
|
78286
|
+
scheduled: c3_default40,
|
|
78279
78287
|
queues: c3_default32,
|
|
78280
|
-
"hello-world-durable-object": c3_default23,
|
|
78281
78288
|
openapi: c3_default30,
|
|
78282
78289
|
"pre-existing": c3_default31
|
|
78283
78290
|
};
|
|
@@ -78387,9 +78394,9 @@ var createContext = async (args, prevArgs) => {
|
|
|
78387
78394
|
});
|
|
78388
78395
|
const categoryOptions = [
|
|
78389
78396
|
{
|
|
78390
|
-
label: "Hello World
|
|
78397
|
+
label: "Hello World Starter",
|
|
78391
78398
|
value: "hello-world",
|
|
78392
|
-
description: "Select from
|
|
78399
|
+
description: "Select from basic scaffolds to get started with Workers, Assets and Durable Objects"
|
|
78393
78400
|
},
|
|
78394
78401
|
{
|
|
78395
78402
|
label: "Framework Starter",
|
|
@@ -78427,8 +78434,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
78427
78434
|
experimental: args.experimental
|
|
78428
78435
|
});
|
|
78429
78436
|
const frameworkOptions = Object.entries(frameworkMap).map(
|
|
78430
|
-
([key,
|
|
78431
|
-
label:
|
|
78437
|
+
([key, config38]) => ({
|
|
78438
|
+
label: config38.displayName,
|
|
78432
78439
|
value: key
|
|
78433
78440
|
})
|
|
78434
78441
|
);
|
|
@@ -78595,28 +78602,28 @@ var processRemoteTemplate = async (args) => {
|
|
|
78595
78602
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78596
78603
|
}
|
|
78597
78604
|
const path6 = await downloadRemoteTemplate(src);
|
|
78598
|
-
const
|
|
78599
|
-
validateTemplate(path6,
|
|
78605
|
+
const config38 = inferTemplateConfig(path6);
|
|
78606
|
+
validateTemplate(path6, config38);
|
|
78600
78607
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78601
78608
|
return {
|
|
78602
78609
|
path: path6,
|
|
78603
|
-
...
|
|
78610
|
+
...config38
|
|
78604
78611
|
};
|
|
78605
78612
|
};
|
|
78606
|
-
var validateTemplate = (path6,
|
|
78607
|
-
if (!
|
|
78613
|
+
var validateTemplate = (path6, config38) => {
|
|
78614
|
+
if (!config38.copyFiles) {
|
|
78608
78615
|
return;
|
|
78609
78616
|
}
|
|
78610
|
-
if (isVariantInfo(
|
|
78611
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78617
|
+
if (isVariantInfo(config38.copyFiles)) {
|
|
78618
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config38.copyFiles.path), config38);
|
|
78612
78619
|
} else {
|
|
78613
|
-
for (const variant of Object.values(
|
|
78614
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
78620
|
+
for (const variant of Object.values(config38.copyFiles.variants)) {
|
|
78621
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config38);
|
|
78615
78622
|
}
|
|
78616
78623
|
}
|
|
78617
78624
|
};
|
|
78618
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78619
|
-
if (
|
|
78625
|
+
var validateTemplateSrcDirectory = (path6, config38) => {
|
|
78626
|
+
if (config38.platform === "workers") {
|
|
78620
78627
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78621
78628
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78622
78629
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -78790,12 +78797,12 @@ var cliDefinition = {
|
|
|
78790
78797
|
const experimental = Boolean(args?.["experimental"]);
|
|
78791
78798
|
if (experimental) {
|
|
78792
78799
|
return [
|
|
78793
|
-
{ name: "hello-world", description: "Hello World
|
|
78800
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78794
78801
|
{ name: "web-framework", description: "Framework Starter" }
|
|
78795
78802
|
];
|
|
78796
78803
|
} else {
|
|
78797
78804
|
return [
|
|
78798
|
-
{ name: "hello-world", description: "Hello World
|
|
78805
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78799
78806
|
{ name: "web-framework", description: "Framework Starter" },
|
|
78800
78807
|
{ name: "demo", description: "Application Starter" },
|
|
78801
78808
|
{
|
|
@@ -80527,20 +80534,20 @@ function applyEdits(text, edits) {
|
|
|
80527
80534
|
var import_fs12 = require("fs");
|
|
80528
80535
|
var import_path14 = require("path");
|
|
80529
80536
|
var import_toml2 = __toESM(require_toml());
|
|
80530
|
-
function ensureNameExists(
|
|
80531
|
-
|
|
80532
|
-
return
|
|
80537
|
+
function ensureNameExists(config38, projectName) {
|
|
80538
|
+
config38["name"] = projectName;
|
|
80539
|
+
return config38;
|
|
80533
80540
|
}
|
|
80534
|
-
async function ensureCompatDateExists(
|
|
80535
|
-
if (typeof
|
|
80541
|
+
async function ensureCompatDateExists(config38) {
|
|
80542
|
+
if (typeof config38["compatibility_date"] === "string") {
|
|
80536
80543
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80537
|
-
if (!
|
|
80538
|
-
|
|
80544
|
+
if (!config38["compatibility_date"].match(validCompatDateRe)) {
|
|
80545
|
+
config38["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80539
80546
|
}
|
|
80540
80547
|
} else {
|
|
80541
|
-
|
|
80548
|
+
config38["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80542
80549
|
}
|
|
80543
|
-
return
|
|
80550
|
+
return config38;
|
|
80544
80551
|
}
|
|
80545
80552
|
var updateWranglerConfig = async (ctx) => {
|
|
80546
80553
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -81254,8 +81261,8 @@ var renderValues = (values) => {
|
|
|
81254
81261
|
};
|
|
81255
81262
|
|
|
81256
81263
|
// src/helpers/retry.ts
|
|
81257
|
-
var retry = async (
|
|
81258
|
-
let { times } =
|
|
81264
|
+
var retry = async (config38, fn) => {
|
|
81265
|
+
let { times } = config38;
|
|
81259
81266
|
let error2 = null;
|
|
81260
81267
|
while (times > 0) {
|
|
81261
81268
|
try {
|
|
@@ -81263,10 +81270,10 @@ var retry = async (config34, fn) => {
|
|
|
81263
81270
|
} catch (e) {
|
|
81264
81271
|
error2 = e;
|
|
81265
81272
|
times--;
|
|
81266
|
-
if (
|
|
81273
|
+
if (config38.exitCondition?.(e)) {
|
|
81267
81274
|
break;
|
|
81268
81275
|
}
|
|
81269
|
-
await sleep(
|
|
81276
|
+
await sleep(config38.sleepMs ?? 1e3);
|
|
81270
81277
|
}
|
|
81271
81278
|
}
|
|
81272
81279
|
throw error2;
|
|
@@ -81386,8 +81393,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81386
81393
|
}
|
|
81387
81394
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81388
81395
|
try {
|
|
81389
|
-
const
|
|
81390
|
-
const currentTypes =
|
|
81396
|
+
const config38 = parse4(tsconfig);
|
|
81397
|
+
const currentTypes = config38.compilerOptions?.types ?? [];
|
|
81391
81398
|
const explicitEntrypoint = currentTypes.some(
|
|
81392
81399
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81393
81400
|
);
|
|
@@ -81462,7 +81469,7 @@ var runCli = async (args) => {
|
|
|
81462
81469
|
printBanner(args);
|
|
81463
81470
|
const ctx = await createContext(args);
|
|
81464
81471
|
await create(ctx);
|
|
81465
|
-
await
|
|
81472
|
+
await configure20(ctx);
|
|
81466
81473
|
await deploy(ctx);
|
|
81467
81474
|
printSummary(ctx);
|
|
81468
81475
|
logRaw("");
|
|
@@ -81490,7 +81497,7 @@ var create = async (ctx) => {
|
|
|
81490
81497
|
await rectifyPmMismatch(ctx);
|
|
81491
81498
|
endSection(`Application created`);
|
|
81492
81499
|
};
|
|
81493
|
-
var
|
|
81500
|
+
var configure20 = async (ctx) => {
|
|
81494
81501
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
81495
81502
|
await installWrangler();
|
|
81496
81503
|
await installWorkersTypes(ctx);
|