create-cloudflare 0.0.0-869ec7b91 → 0.0.0-86ab0ca52
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 +799 -793
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- 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/App.css +45 -0
- package/templates/react/workers/js/src/assets/Cloudflare_Logo.svg +53 -26
- package/templates/react/workers/ts/src/App.css +45 -0
- package/templates/react/workers/ts/src/assets/Cloudflare_Logo.svg +51 -26
- 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-experimental/next/c3.ts +9 -9
- package/templates-experimental/next/templates/open-next.config.ts +5 -27
- package/templates-experimental/next/templates/wrangler.jsonc +0 -1
- 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 = "0.0.0-
|
|
74563
|
+
var version = "0.0.0-86ab0ca52";
|
|
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
|
|
|
@@ -75340,11 +75340,11 @@ var package_default = {
|
|
|
75340
75340
|
"@angular/create": "19.1.6",
|
|
75341
75341
|
"create-docusaurus": "3.7.0",
|
|
75342
75342
|
"create-hono": "0.15.3",
|
|
75343
|
-
"create-next-app": "15.1
|
|
75343
|
+
"create-next-app": "15.2.1",
|
|
75344
75344
|
"create-qwik": "1.12.0",
|
|
75345
75345
|
"create-vite": "6.1.1",
|
|
75346
75346
|
"create-remix": "2.15.3",
|
|
75347
|
-
"create-solid": "0.
|
|
75347
|
+
"create-solid": "0.6.1",
|
|
75348
75348
|
"create-vue": "3.14.2",
|
|
75349
75349
|
gatsby: "5.14.1",
|
|
75350
75350
|
sv: "0.6.23",
|
|
@@ -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,243 +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 () => {
|
|
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
|
-
updateNextConfig();
|
|
75642
|
-
};
|
|
75643
|
-
var updateNextConfig = () => {
|
|
75644
|
-
const s = spinner();
|
|
75645
|
-
const configFile = "next.config.mjs";
|
|
75646
|
-
s.start(`Updating \`${configFile}\``);
|
|
75647
|
-
const configContent = readFile(configFile);
|
|
75648
|
-
const updatedConfigFile = configContent + `
|
|
75649
|
-
// added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
|
|
75650
|
-
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
75651
|
-
initOpenNextCloudflareForDev();
|
|
75652
|
-
`.replace(/\n\t*/g, "\n");
|
|
75653
|
-
writeFile2(configFile, updatedConfigFile);
|
|
75654
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
75655
|
-
};
|
|
75656
|
-
var c3_default6 = {
|
|
75657
|
-
configVersion: 1,
|
|
75658
|
-
id: "next",
|
|
75659
|
-
frameworkCli: "create-next-app",
|
|
75660
|
-
// TODO: here we need to specify a version of create-next-app which is different from the
|
|
75661
|
-
// standard one used in the stable Next.js template, that's because our open-next adapter
|
|
75662
|
-
// is not yet fully ready for Next.js 15, once it is we should remove the following
|
|
75663
|
-
frameworkCliPinnedVersion: "^14.2.23",
|
|
75664
|
-
platform: "workers",
|
|
75665
|
-
displayName: "Next.js (using Node.js compat + Workers Assets)",
|
|
75666
|
-
path: "templates-experimental/next",
|
|
75667
|
-
copyFiles: {
|
|
75668
|
-
path: "./templates"
|
|
75669
|
-
},
|
|
75670
|
-
generate: generate3,
|
|
75671
|
-
configure: configure2,
|
|
75672
|
-
transformPackageJson: async () => ({
|
|
75673
|
-
scripts: {
|
|
75674
|
-
deploy: `opennextjs-cloudflare && wrangler deploy`,
|
|
75675
|
-
preview: `opennextjs-cloudflare && wrangler dev`,
|
|
75676
|
-
"cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
|
|
75677
|
-
}
|
|
75678
|
-
}),
|
|
75679
|
-
devScript: "dev",
|
|
75680
|
-
previewScript: "preview",
|
|
75681
|
-
deployScript: "deploy",
|
|
75682
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
75683
|
-
};
|
|
75684
|
-
|
|
75685
|
-
// templates-experimental/qwik/c3.ts
|
|
75686
|
-
var recast3 = __toESM(require_main3());
|
|
75687
|
-
var { npm, npx: npx2, name } = detectPackageManager();
|
|
75688
|
-
var generate4 = async (ctx) => {
|
|
75689
75517
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
75690
75518
|
};
|
|
75691
|
-
var
|
|
75692
|
-
const cmd = [name === "pnpm" ? npm :
|
|
75519
|
+
var configure2 = async (ctx) => {
|
|
75520
|
+
const cmd = [name === "pnpm" ? npm : npx, "qwik", "add", "cloudflare-pages"];
|
|
75693
75521
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
75694
75522
|
await runCommand(cmd);
|
|
75695
75523
|
removeFile("./public/_headers");
|
|
@@ -75705,7 +75533,7 @@ var addBindingsProxy = (ctx) => {
|
|
|
75705
75533
|
const s = spinner();
|
|
75706
75534
|
s.start("Updating `vite.config.ts`");
|
|
75707
75535
|
const snippets = loadTemplateSnippets(ctx);
|
|
75708
|
-
const b3 =
|
|
75536
|
+
const b3 = recast2.types.builders;
|
|
75709
75537
|
transformFile("vite.config.ts", {
|
|
75710
75538
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
75711
75539
|
visitProgram: function(n) {
|
|
@@ -75747,7 +75575,7 @@ var populateCloudflareEnv = () => {
|
|
|
75747
75575
|
s.start(`Updating \`${entrypointPath}\``);
|
|
75748
75576
|
transformFile(entrypointPath, {
|
|
75749
75577
|
visitTSInterfaceDeclaration: function(n) {
|
|
75750
|
-
const b3 =
|
|
75578
|
+
const b3 = recast2.types.builders;
|
|
75751
75579
|
const id = n.node.id;
|
|
75752
75580
|
if (id.name !== "QwikCityPlatform") {
|
|
75753
75581
|
this.traverse(n);
|
|
@@ -75768,7 +75596,7 @@ var populateCloudflareEnv = () => {
|
|
|
75768
75596
|
});
|
|
75769
75597
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
75770
75598
|
};
|
|
75771
|
-
var
|
|
75599
|
+
var config = {
|
|
75772
75600
|
configVersion: 1,
|
|
75773
75601
|
id: "qwik",
|
|
75774
75602
|
frameworkCli: "create-qwik",
|
|
@@ -75778,8 +75606,8 @@ var config5 = {
|
|
|
75778
75606
|
path: "./templates"
|
|
75779
75607
|
},
|
|
75780
75608
|
path: "templates-experimental/qwik",
|
|
75781
|
-
generate:
|
|
75782
|
-
configure:
|
|
75609
|
+
generate: generate2,
|
|
75610
|
+
configure: configure2,
|
|
75783
75611
|
transformPackageJson: async () => ({
|
|
75784
75612
|
scripts: {
|
|
75785
75613
|
deploy: `${npm} run build && wrangler deploy`,
|
|
@@ -75791,49 +75619,7 @@ var config5 = {
|
|
|
75791
75619
|
deployScript: "deploy",
|
|
75792
75620
|
previewScript: "preview"
|
|
75793
75621
|
};
|
|
75794
|
-
var
|
|
75795
|
-
|
|
75796
|
-
// templates-experimental/remix/c3.ts
|
|
75797
|
-
var { npm: npm2 } = detectPackageManager();
|
|
75798
|
-
var generate5 = async (ctx) => {
|
|
75799
|
-
await runFrameworkGenerator(ctx, [
|
|
75800
|
-
ctx.project.name,
|
|
75801
|
-
"--template",
|
|
75802
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
75803
|
-
]);
|
|
75804
|
-
logRaw("");
|
|
75805
|
-
};
|
|
75806
|
-
var configure4 = async () => {
|
|
75807
|
-
await installPackages(["wrangler@latest"], {
|
|
75808
|
-
dev: true,
|
|
75809
|
-
startText: "Updating the Wrangler version",
|
|
75810
|
-
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
75811
|
-
});
|
|
75812
|
-
};
|
|
75813
|
-
var config6 = {
|
|
75814
|
-
configVersion: 1,
|
|
75815
|
-
id: "remix",
|
|
75816
|
-
frameworkCli: "create-remix",
|
|
75817
|
-
platform: "workers",
|
|
75818
|
-
displayName: "Remix",
|
|
75819
|
-
copyFiles: {
|
|
75820
|
-
path: "./templates"
|
|
75821
|
-
},
|
|
75822
|
-
path: "templates-experimental/remix",
|
|
75823
|
-
generate: generate5,
|
|
75824
|
-
configure: configure4,
|
|
75825
|
-
transformPackageJson: async () => ({
|
|
75826
|
-
scripts: {
|
|
75827
|
-
deploy: `${npm2} run build && wrangler deploy`,
|
|
75828
|
-
preview: `${npm2} run build && wrangler dev`,
|
|
75829
|
-
"cf-typegen": `wrangler types`
|
|
75830
|
-
}
|
|
75831
|
-
}),
|
|
75832
|
-
devScript: "dev",
|
|
75833
|
-
deployScript: "deploy",
|
|
75834
|
-
previewScript: "preview"
|
|
75835
|
-
};
|
|
75836
|
-
var c3_default8 = config6;
|
|
75622
|
+
var c3_default2 = config;
|
|
75837
75623
|
|
|
75838
75624
|
// src/helpers/compatDate.ts
|
|
75839
75625
|
var import_fs9 = require("fs");
|
|
@@ -75888,18 +75674,18 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
75888
75674
|
}
|
|
75889
75675
|
|
|
75890
75676
|
// templates-experimental/solid/c3.ts
|
|
75891
|
-
var
|
|
75892
|
-
var { npm:
|
|
75893
|
-
var
|
|
75677
|
+
var recast3 = __toESM(require_main3());
|
|
75678
|
+
var { npm: npm2 } = detectPackageManager();
|
|
75679
|
+
var generate3 = async (ctx) => {
|
|
75894
75680
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
75895
75681
|
logRaw("");
|
|
75896
75682
|
};
|
|
75897
|
-
var
|
|
75683
|
+
var configure3 = async (ctx) => {
|
|
75898
75684
|
const packages = ["nitropack"];
|
|
75899
75685
|
await installPackages(packages, {
|
|
75900
75686
|
dev: true,
|
|
75901
75687
|
startText: "Installing nitro module `nitropack`",
|
|
75902
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75688
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
|
|
75903
75689
|
});
|
|
75904
75690
|
usesTypescript(ctx);
|
|
75905
75691
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -75911,7 +75697,7 @@ var configure5 = async (ctx) => {
|
|
|
75911
75697
|
if (callee.name !== "defineConfig") {
|
|
75912
75698
|
return this.traverse(n);
|
|
75913
75699
|
}
|
|
75914
|
-
const b3 =
|
|
75700
|
+
const b3 = recast3.types.builders;
|
|
75915
75701
|
mergeObjectProperties(
|
|
75916
75702
|
n.node.arguments[0],
|
|
75917
75703
|
[
|
|
@@ -75935,7 +75721,7 @@ var configure5 = async (ctx) => {
|
|
|
75935
75721
|
}
|
|
75936
75722
|
});
|
|
75937
75723
|
};
|
|
75938
|
-
var
|
|
75724
|
+
var config2 = {
|
|
75939
75725
|
configVersion: 1,
|
|
75940
75726
|
id: "solid",
|
|
75941
75727
|
frameworkCli: "create-solid",
|
|
@@ -75945,12 +75731,12 @@ var config7 = {
|
|
|
75945
75731
|
path: "./templates"
|
|
75946
75732
|
},
|
|
75947
75733
|
path: "templates-experimental/solid",
|
|
75948
|
-
generate:
|
|
75949
|
-
configure:
|
|
75734
|
+
generate: generate3,
|
|
75735
|
+
configure: configure3,
|
|
75950
75736
|
transformPackageJson: async () => ({
|
|
75951
75737
|
scripts: {
|
|
75952
|
-
preview: `${
|
|
75953
|
-
deploy: `${
|
|
75738
|
+
preview: `${npm2} run build && npx wrangler dev`,
|
|
75739
|
+
deploy: `${npm2} run build && wrangler deploy`
|
|
75954
75740
|
}
|
|
75955
75741
|
}),
|
|
75956
75742
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -75958,111 +75744,12 @@ var config7 = {
|
|
|
75958
75744
|
deployScript: "deploy",
|
|
75959
75745
|
previewScript: "preview"
|
|
75960
75746
|
};
|
|
75961
|
-
var
|
|
75962
|
-
|
|
75963
|
-
// templates-experimental/svelte/c3.ts
|
|
75964
|
-
var import_node_os3 = require("node:os");
|
|
75965
|
-
var recast5 = __toESM(require_main3());
|
|
75966
|
-
var { npm: npm4 } = detectPackageManager();
|
|
75967
|
-
var generate7 = async (ctx) => {
|
|
75968
|
-
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
75969
|
-
logRaw("");
|
|
75970
|
-
};
|
|
75971
|
-
var configure6 = async (ctx) => {
|
|
75972
|
-
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
75973
|
-
await installPackages([pkg], {
|
|
75974
|
-
dev: true,
|
|
75975
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
75976
|
-
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
75977
|
-
});
|
|
75978
|
-
updateSvelteConfig();
|
|
75979
|
-
updateTypeDefinitions(ctx);
|
|
75980
|
-
};
|
|
75981
|
-
var updateSvelteConfig = () => {
|
|
75982
|
-
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
75983
|
-
transformFile("svelte.config.js", {
|
|
75984
|
-
visitImportDeclaration: function(n) {
|
|
75985
|
-
const importSource = n.value.source;
|
|
75986
|
-
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
75987
|
-
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
75988
|
-
}
|
|
75989
|
-
return false;
|
|
75990
|
-
}
|
|
75991
|
-
});
|
|
75992
|
-
};
|
|
75993
|
-
var updateTypeDefinitions = (ctx) => {
|
|
75994
|
-
if (!usesTypescript(ctx)) {
|
|
75995
|
-
return;
|
|
75996
|
-
}
|
|
75997
|
-
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
75998
|
-
const b3 = recast5.types.builders;
|
|
75999
|
-
transformFile("src/app.d.ts", {
|
|
76000
|
-
visitTSModuleDeclaration(n) {
|
|
76001
|
-
if (n.value.id.name === "App" && n.node.body) {
|
|
76002
|
-
const moduleBlock = n.node.body;
|
|
76003
|
-
const platformInterface = b3.tsInterfaceDeclaration(
|
|
76004
|
-
b3.identifier("Platform"),
|
|
76005
|
-
b3.tsInterfaceBody([
|
|
76006
|
-
b3.tsPropertySignature(
|
|
76007
|
-
b3.identifier("env"),
|
|
76008
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
76009
|
-
),
|
|
76010
|
-
b3.tsPropertySignature(
|
|
76011
|
-
b3.identifier("cf"),
|
|
76012
|
-
b3.tsTypeAnnotation(
|
|
76013
|
-
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
76014
|
-
)
|
|
76015
|
-
),
|
|
76016
|
-
b3.tsPropertySignature(
|
|
76017
|
-
b3.identifier("ctx"),
|
|
76018
|
-
b3.tsTypeAnnotation(
|
|
76019
|
-
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
76020
|
-
)
|
|
76021
|
-
)
|
|
76022
|
-
])
|
|
76023
|
-
);
|
|
76024
|
-
moduleBlock.body.unshift(platformInterface);
|
|
76025
|
-
}
|
|
76026
|
-
this.traverse(n);
|
|
76027
|
-
}
|
|
76028
|
-
});
|
|
76029
|
-
};
|
|
76030
|
-
var config8 = {
|
|
76031
|
-
configVersion: 1,
|
|
76032
|
-
id: "svelte",
|
|
76033
|
-
frameworkCli: "sv",
|
|
76034
|
-
displayName: "SvelteKit",
|
|
76035
|
-
platform: "workers",
|
|
76036
|
-
copyFiles: {
|
|
76037
|
-
path: "./templates"
|
|
76038
|
-
},
|
|
76039
|
-
path: "templates-experimental/svelte",
|
|
76040
|
-
generate: generate7,
|
|
76041
|
-
configure: configure6,
|
|
76042
|
-
transformPackageJson: async (original, ctx) => {
|
|
76043
|
-
let scripts = {
|
|
76044
|
-
preview: `${npm4} run build && wrangler dev`,
|
|
76045
|
-
deploy: `${npm4} run build && wrangler deploy`
|
|
76046
|
-
};
|
|
76047
|
-
if (usesTypescript(ctx)) {
|
|
76048
|
-
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
76049
|
-
scripts = {
|
|
76050
|
-
...scripts,
|
|
76051
|
-
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
76052
|
-
};
|
|
76053
|
-
}
|
|
76054
|
-
return { scripts };
|
|
76055
|
-
},
|
|
76056
|
-
devScript: "dev",
|
|
76057
|
-
deployScript: "deploy",
|
|
76058
|
-
previewScript: "preview"
|
|
76059
|
-
};
|
|
76060
|
-
var c3_default10 = config8;
|
|
75747
|
+
var c3_default3 = config2;
|
|
76061
75748
|
|
|
76062
75749
|
// templates/analog/c3.ts
|
|
76063
|
-
var
|
|
76064
|
-
var { npm:
|
|
76065
|
-
var
|
|
75750
|
+
var recast4 = __toESM(require_main3());
|
|
75751
|
+
var { npm: npm3, name: pm } = detectPackageManager();
|
|
75752
|
+
var generate4 = async (ctx) => {
|
|
76066
75753
|
await runFrameworkGenerator(ctx, [
|
|
76067
75754
|
ctx.project.name,
|
|
76068
75755
|
"--template",
|
|
@@ -76070,7 +75757,7 @@ var generate8 = async (ctx) => {
|
|
|
76070
75757
|
]);
|
|
76071
75758
|
logRaw("");
|
|
76072
75759
|
};
|
|
76073
|
-
var
|
|
75760
|
+
var configure4 = async (ctx) => {
|
|
76074
75761
|
if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
|
|
76075
75762
|
const packages = [];
|
|
76076
75763
|
packages.push("nitropack");
|
|
@@ -76080,7 +75767,7 @@ var configure7 = async (ctx) => {
|
|
|
76080
75767
|
await installPackages(packages, {
|
|
76081
75768
|
dev: true,
|
|
76082
75769
|
startText: `Installing ${packages.join(", ")}`,
|
|
76083
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75770
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
|
|
76084
75771
|
});
|
|
76085
75772
|
}
|
|
76086
75773
|
updateViteConfig(ctx);
|
|
@@ -76101,7 +75788,7 @@ var updateEnvTypes = (ctx) => {
|
|
|
76101
75788
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76102
75789
|
};
|
|
76103
75790
|
var updateViteConfig = (ctx) => {
|
|
76104
|
-
const b3 =
|
|
75791
|
+
const b3 = recast4.types.builders;
|
|
76105
75792
|
const s = spinner();
|
|
76106
75793
|
const configFile = "vite.config.ts";
|
|
76107
75794
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76138,7 +75825,7 @@ var updateViteConfig = (ctx) => {
|
|
|
76138
75825
|
});
|
|
76139
75826
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76140
75827
|
};
|
|
76141
|
-
var
|
|
75828
|
+
var config3 = {
|
|
76142
75829
|
configVersion: 1,
|
|
76143
75830
|
id: "analog",
|
|
76144
75831
|
frameworkCli: "create-analog",
|
|
@@ -76147,12 +75834,12 @@ var config9 = {
|
|
|
76147
75834
|
copyFiles: {
|
|
76148
75835
|
path: "./templates"
|
|
76149
75836
|
},
|
|
76150
|
-
generate:
|
|
76151
|
-
configure:
|
|
75837
|
+
generate: generate4,
|
|
75838
|
+
configure: configure4,
|
|
76152
75839
|
transformPackageJson: async () => ({
|
|
76153
75840
|
scripts: {
|
|
76154
|
-
preview: `${
|
|
76155
|
-
deploy: `${
|
|
75841
|
+
preview: `${npm3} run build && wrangler pages dev`,
|
|
75842
|
+
deploy: `${npm3} run build && wrangler pages deploy`,
|
|
76156
75843
|
"cf-typegen": `wrangler types`
|
|
76157
75844
|
}
|
|
76158
75845
|
}),
|
|
@@ -76160,12 +75847,12 @@ var config9 = {
|
|
|
76160
75847
|
deployScript: "deploy",
|
|
76161
75848
|
previewScript: "preview"
|
|
76162
75849
|
};
|
|
76163
|
-
var
|
|
75850
|
+
var c3_default4 = config3;
|
|
76164
75851
|
|
|
76165
75852
|
// templates/angular/pages/c3.ts
|
|
76166
75853
|
var import_node_path3 = require("node:path");
|
|
76167
|
-
var { npm:
|
|
76168
|
-
var
|
|
75854
|
+
var { npm: npm4 } = detectPackageManager();
|
|
75855
|
+
var generate5 = async (ctx) => {
|
|
76169
75856
|
await runFrameworkGenerator(ctx, [
|
|
76170
75857
|
ctx.project.name,
|
|
76171
75858
|
"--ssr",
|
|
@@ -76173,7 +75860,7 @@ var generate9 = async (ctx) => {
|
|
|
76173
75860
|
]);
|
|
76174
75861
|
logRaw("");
|
|
76175
75862
|
};
|
|
76176
|
-
var
|
|
75863
|
+
var configure5 = async (ctx) => {
|
|
76177
75864
|
updateAngularJson(ctx);
|
|
76178
75865
|
await updateAppCode();
|
|
76179
75866
|
await installCFWorker();
|
|
@@ -76182,7 +75869,7 @@ async function installCFWorker() {
|
|
|
76182
75869
|
await installPackages(["xhr2"], {
|
|
76183
75870
|
dev: true,
|
|
76184
75871
|
startText: "Installing additional dependencies",
|
|
76185
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75872
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
|
|
76186
75873
|
});
|
|
76187
75874
|
}
|
|
76188
75875
|
async function updateAppCode() {
|
|
@@ -76224,7 +75911,7 @@ function updateAngularJson(ctx) {
|
|
|
76224
75911
|
writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76225
75912
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76226
75913
|
}
|
|
76227
|
-
var
|
|
75914
|
+
var config4 = {
|
|
76228
75915
|
configVersion: 1,
|
|
76229
75916
|
id: "angular",
|
|
76230
75917
|
frameworkCli: "@angular/create",
|
|
@@ -76237,23 +75924,23 @@ var config10 = {
|
|
|
76237
75924
|
devScript: "start",
|
|
76238
75925
|
deployScript: "deploy",
|
|
76239
75926
|
previewScript: "start",
|
|
76240
|
-
generate:
|
|
76241
|
-
configure:
|
|
75927
|
+
generate: generate5,
|
|
75928
|
+
configure: configure5,
|
|
76242
75929
|
transformPackageJson: async () => ({
|
|
76243
75930
|
scripts: {
|
|
76244
|
-
start: `${
|
|
76245
|
-
build: `ng build && ${
|
|
75931
|
+
start: `${npm4} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
75932
|
+
build: `ng build && ${npm4} run process`,
|
|
76246
75933
|
process: "node ./tools/copy-files.mjs",
|
|
76247
|
-
deploy: `${
|
|
75934
|
+
deploy: `${npm4} run build && wrangler pages deploy dist/cloudflare`
|
|
76248
75935
|
}
|
|
76249
75936
|
})
|
|
76250
75937
|
};
|
|
76251
|
-
var
|
|
75938
|
+
var c3_default5 = config4;
|
|
76252
75939
|
|
|
76253
75940
|
// templates/angular/workers/c3.ts
|
|
76254
75941
|
var import_node_path4 = require("node:path");
|
|
76255
|
-
var { npm:
|
|
76256
|
-
var
|
|
75942
|
+
var { npm: npm5 } = detectPackageManager();
|
|
75943
|
+
var generate6 = async (ctx) => {
|
|
76257
75944
|
await runFrameworkGenerator(ctx, [
|
|
76258
75945
|
ctx.project.name,
|
|
76259
75946
|
"--ssr",
|
|
@@ -76261,7 +75948,7 @@ var generate10 = async (ctx) => {
|
|
|
76261
75948
|
]);
|
|
76262
75949
|
logRaw("");
|
|
76263
75950
|
};
|
|
76264
|
-
var
|
|
75951
|
+
var configure6 = async (ctx) => {
|
|
76265
75952
|
updateAngularJson2(ctx);
|
|
76266
75953
|
await updateAppCode2();
|
|
76267
75954
|
await installCFWorker2();
|
|
@@ -76270,7 +75957,7 @@ async function installCFWorker2() {
|
|
|
76270
75957
|
await installPackages(["xhr2"], {
|
|
76271
75958
|
dev: true,
|
|
76272
75959
|
startText: "Installing additional dependencies",
|
|
76273
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75960
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm5} install\``)}`
|
|
76274
75961
|
});
|
|
76275
75962
|
}
|
|
76276
75963
|
async function updateAppCode2() {
|
|
@@ -76311,7 +75998,7 @@ function updateAngularJson2(ctx) {
|
|
|
76311
75998
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76312
75999
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76313
76000
|
}
|
|
76314
|
-
var
|
|
76001
|
+
var config5 = {
|
|
76315
76002
|
configVersion: 1,
|
|
76316
76003
|
id: "angular",
|
|
76317
76004
|
frameworkCli: "@angular/create",
|
|
@@ -76324,33 +76011,109 @@ var config11 = {
|
|
|
76324
76011
|
devScript: "start",
|
|
76325
76012
|
deployScript: "deploy",
|
|
76326
76013
|
previewScript: "start",
|
|
76327
|
-
generate:
|
|
76328
|
-
configure:
|
|
76014
|
+
generate: generate6,
|
|
76015
|
+
configure: configure6,
|
|
76329
76016
|
transformPackageJson: async () => ({
|
|
76330
76017
|
scripts: {
|
|
76331
|
-
start: `${
|
|
76018
|
+
start: `${npm5} run build && wrangler dev`,
|
|
76332
76019
|
build: `ng build`,
|
|
76333
|
-
deploy: `${
|
|
76020
|
+
deploy: `${npm5} run build && wrangler deploy`
|
|
76334
76021
|
}
|
|
76335
76022
|
})
|
|
76336
76023
|
};
|
|
76337
|
-
var
|
|
76024
|
+
var c3_default6 = config5;
|
|
76338
76025
|
|
|
76339
76026
|
// templates/angular/c3.ts
|
|
76340
|
-
var
|
|
76027
|
+
var config6 = {
|
|
76341
76028
|
displayName: "Angular",
|
|
76342
|
-
platformVariants: { pages:
|
|
76029
|
+
platformVariants: { pages: c3_default5, workers: c3_default6 }
|
|
76343
76030
|
};
|
|
76344
|
-
var
|
|
76031
|
+
var c3_default7 = config6;
|
|
76345
76032
|
|
|
76346
|
-
// templates/astro/c3.ts
|
|
76347
|
-
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());
|
|
76348
76111
|
var { npx: npx3 } = detectPackageManager();
|
|
76349
|
-
var
|
|
76112
|
+
var generate8 = async (ctx) => {
|
|
76350
76113
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
76351
76114
|
logRaw("");
|
|
76352
76115
|
};
|
|
76353
|
-
var
|
|
76116
|
+
var configure8 = async () => {
|
|
76354
76117
|
await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
|
|
76355
76118
|
silent: true,
|
|
76356
76119
|
startText: "Installing adapter",
|
|
@@ -76369,7 +76132,7 @@ var updateAstroConfig2 = () => {
|
|
|
76369
76132
|
if (callee.name !== "cloudflare") {
|
|
76370
76133
|
return this.traverse(n);
|
|
76371
76134
|
}
|
|
76372
|
-
const b3 =
|
|
76135
|
+
const b3 = recast6.types.builders;
|
|
76373
76136
|
n.node.arguments = [
|
|
76374
76137
|
b3.objectExpression([
|
|
76375
76138
|
b3.objectProperty(
|
|
@@ -76384,11 +76147,11 @@ var updateAstroConfig2 = () => {
|
|
|
76384
76147
|
}
|
|
76385
76148
|
});
|
|
76386
76149
|
};
|
|
76387
|
-
var
|
|
76150
|
+
var config8 = {
|
|
76388
76151
|
configVersion: 1,
|
|
76389
76152
|
id: "astro",
|
|
76390
76153
|
frameworkCli: "create-astro",
|
|
76391
|
-
platform: "
|
|
76154
|
+
platform: "workers",
|
|
76392
76155
|
displayName: "Astro",
|
|
76393
76156
|
copyFiles: {
|
|
76394
76157
|
async selectVariant(ctx) {
|
|
@@ -76406,20 +76169,28 @@ var config13 = {
|
|
|
76406
76169
|
devScript: "dev",
|
|
76407
76170
|
deployScript: "deploy",
|
|
76408
76171
|
previewScript: "preview",
|
|
76409
|
-
|
|
76410
|
-
|
|
76172
|
+
path: "templates/astro/workers",
|
|
76173
|
+
generate: generate8,
|
|
76174
|
+
configure: configure8,
|
|
76411
76175
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
76412
76176
|
scripts: {
|
|
76413
|
-
deploy: `astro build && wrangler
|
|
76414
|
-
preview: `astro build && wrangler
|
|
76177
|
+
deploy: `astro build && wrangler deploy`,
|
|
76178
|
+
preview: `astro build && wrangler dev`,
|
|
76415
76179
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
76416
76180
|
}
|
|
76417
76181
|
})
|
|
76418
76182
|
};
|
|
76419
|
-
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;
|
|
76420
76191
|
|
|
76421
76192
|
// templates/common/c3.ts
|
|
76422
|
-
var
|
|
76193
|
+
var c3_default11 = {
|
|
76423
76194
|
configVersion: 1,
|
|
76424
76195
|
id: "common",
|
|
76425
76196
|
displayName: "Example router & proxy Worker",
|
|
@@ -76439,36 +76210,36 @@ var c3_default16 = {
|
|
|
76439
76210
|
};
|
|
76440
76211
|
|
|
76441
76212
|
// templates/docusaurus/pages/c3.ts
|
|
76442
|
-
var { npm:
|
|
76443
|
-
var
|
|
76213
|
+
var { npm: npm6 } = detectPackageManager();
|
|
76214
|
+
var generate9 = async (ctx) => {
|
|
76444
76215
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76445
76216
|
};
|
|
76446
|
-
var
|
|
76217
|
+
var config10 = {
|
|
76447
76218
|
configVersion: 1,
|
|
76448
76219
|
id: "docusaurus",
|
|
76449
76220
|
frameworkCli: "create-docusaurus",
|
|
76450
76221
|
platform: "pages",
|
|
76451
76222
|
displayName: "Docusaurus",
|
|
76452
76223
|
path: "templates/docusaurus/pages",
|
|
76453
|
-
generate:
|
|
76224
|
+
generate: generate9,
|
|
76454
76225
|
transformPackageJson: async () => ({
|
|
76455
76226
|
scripts: {
|
|
76456
|
-
preview: `${
|
|
76457
|
-
deploy: `${
|
|
76227
|
+
preview: `${npm6} run build && wrangler pages dev ./build`,
|
|
76228
|
+
deploy: `${npm6} run build && wrangler pages deploy ./build`
|
|
76458
76229
|
}
|
|
76459
76230
|
}),
|
|
76460
76231
|
devScript: "preview",
|
|
76461
76232
|
deployScript: "deploy",
|
|
76462
76233
|
previewScript: "preview"
|
|
76463
76234
|
};
|
|
76464
|
-
var
|
|
76235
|
+
var c3_default12 = config10;
|
|
76465
76236
|
|
|
76466
76237
|
// templates/docusaurus/workers/c3.ts
|
|
76467
|
-
var { npm:
|
|
76468
|
-
var
|
|
76238
|
+
var { npm: npm7 } = detectPackageManager();
|
|
76239
|
+
var generate10 = async (ctx) => {
|
|
76469
76240
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76470
76241
|
};
|
|
76471
|
-
var
|
|
76242
|
+
var config11 = {
|
|
76472
76243
|
configVersion: 1,
|
|
76473
76244
|
id: "docusaurus",
|
|
76474
76245
|
frameworkCli: "create-docusaurus",
|
|
@@ -76478,29 +76249,29 @@ var config15 = {
|
|
|
76478
76249
|
path: "./templates"
|
|
76479
76250
|
},
|
|
76480
76251
|
path: "templates/docusaurus/workers",
|
|
76481
|
-
generate:
|
|
76252
|
+
generate: generate10,
|
|
76482
76253
|
transformPackageJson: async () => ({
|
|
76483
76254
|
scripts: {
|
|
76484
|
-
deploy: `${
|
|
76485
|
-
preview: `${
|
|
76255
|
+
deploy: `${npm7} run build && wrangler deploy`,
|
|
76256
|
+
preview: `${npm7} run build && wrangler dev`
|
|
76486
76257
|
}
|
|
76487
76258
|
}),
|
|
76488
76259
|
devScript: "start",
|
|
76489
76260
|
deployScript: "deploy",
|
|
76490
76261
|
previewScript: "preview"
|
|
76491
76262
|
};
|
|
76492
|
-
var
|
|
76263
|
+
var c3_default13 = config11;
|
|
76493
76264
|
|
|
76494
76265
|
// templates/docusaurus/c3.ts
|
|
76495
|
-
var
|
|
76266
|
+
var config12 = {
|
|
76496
76267
|
displayName: "Docusaurus",
|
|
76497
|
-
platformVariants: { pages:
|
|
76268
|
+
platformVariants: { pages: c3_default12, workers: c3_default13 }
|
|
76498
76269
|
};
|
|
76499
|
-
var
|
|
76270
|
+
var c3_default14 = config12;
|
|
76500
76271
|
|
|
76501
76272
|
// templates/gatsby/pages/c3.ts
|
|
76502
|
-
var { npm:
|
|
76503
|
-
var
|
|
76273
|
+
var { npm: npm8 } = detectPackageManager();
|
|
76274
|
+
var generate11 = async (ctx) => {
|
|
76504
76275
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76505
76276
|
const useTemplate = await inputPrompt({
|
|
76506
76277
|
type: "confirm",
|
|
@@ -76519,29 +76290,29 @@ var generate14 = async (ctx) => {
|
|
|
76519
76290
|
}
|
|
76520
76291
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76521
76292
|
};
|
|
76522
|
-
var
|
|
76293
|
+
var config13 = {
|
|
76523
76294
|
configVersion: 1,
|
|
76524
76295
|
id: "gatsby",
|
|
76525
76296
|
frameworkCli: "gatsby",
|
|
76526
76297
|
platform: "pages",
|
|
76527
76298
|
displayName: "Gatsby",
|
|
76528
76299
|
path: "templates/gatsby/pages",
|
|
76529
|
-
generate:
|
|
76300
|
+
generate: generate11,
|
|
76530
76301
|
transformPackageJson: async () => ({
|
|
76531
76302
|
scripts: {
|
|
76532
|
-
deploy: `${
|
|
76533
|
-
preview: `${
|
|
76303
|
+
deploy: `${npm8} run build && wrangler pages deploy ./public`,
|
|
76304
|
+
preview: `${npm8} run build && wrangler pages dev ./public`
|
|
76534
76305
|
}
|
|
76535
76306
|
}),
|
|
76536
76307
|
devScript: "develop",
|
|
76537
76308
|
deployScript: "deploy",
|
|
76538
76309
|
previewScript: "preview"
|
|
76539
76310
|
};
|
|
76540
|
-
var
|
|
76311
|
+
var c3_default15 = config13;
|
|
76541
76312
|
|
|
76542
76313
|
// templates/gatsby/workers/c3.ts
|
|
76543
|
-
var { npm:
|
|
76544
|
-
var
|
|
76314
|
+
var { npm: npm9 } = detectPackageManager();
|
|
76315
|
+
var generate12 = async (ctx) => {
|
|
76545
76316
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76546
76317
|
const useTemplate = await inputPrompt({
|
|
76547
76318
|
type: "confirm",
|
|
@@ -76560,7 +76331,7 @@ var generate15 = async (ctx) => {
|
|
|
76560
76331
|
}
|
|
76561
76332
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76562
76333
|
};
|
|
76563
|
-
var
|
|
76334
|
+
var config14 = {
|
|
76564
76335
|
configVersion: 1,
|
|
76565
76336
|
id: "gatsby",
|
|
76566
76337
|
frameworkCli: "gatsby",
|
|
@@ -76570,32 +76341,67 @@ var config18 = {
|
|
|
76570
76341
|
path: "./templates"
|
|
76571
76342
|
},
|
|
76572
76343
|
path: "templates/gatsby/workers",
|
|
76573
|
-
generate:
|
|
76344
|
+
generate: generate12,
|
|
76574
76345
|
transformPackageJson: async () => ({
|
|
76575
76346
|
scripts: {
|
|
76576
|
-
deploy: `${
|
|
76577
|
-
preview: `${
|
|
76347
|
+
deploy: `${npm9} run build && wrangler deploy`,
|
|
76348
|
+
preview: `${npm9} run build && wrangler dev`
|
|
76578
76349
|
}
|
|
76579
76350
|
}),
|
|
76580
76351
|
devScript: "develop",
|
|
76581
76352
|
deployScript: "deploy",
|
|
76582
76353
|
previewScript: "preview"
|
|
76583
76354
|
};
|
|
76584
|
-
var
|
|
76355
|
+
var c3_default16 = config14;
|
|
76585
76356
|
|
|
76586
76357
|
// templates/gatsby/c3.ts
|
|
76587
|
-
var
|
|
76358
|
+
var config15 = {
|
|
76588
76359
|
displayName: "Gatsby",
|
|
76589
|
-
platformVariants: { pages:
|
|
76360
|
+
platformVariants: { pages: c3_default15, workers: c3_default16 }
|
|
76590
76361
|
};
|
|
76591
|
-
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;
|
|
76592
76398
|
|
|
76593
76399
|
// templates/hello-world-durable-object/c3.ts
|
|
76594
|
-
var
|
|
76400
|
+
var c3_default20 = {
|
|
76595
76401
|
configVersion: 1,
|
|
76596
76402
|
id: "hello-world-durable-object",
|
|
76597
|
-
displayName: "
|
|
76598
|
-
description: "
|
|
76403
|
+
displayName: "Worker + Durable Objects",
|
|
76404
|
+
description: "For multiplayer apps using WebSockets, or when you need synchronization",
|
|
76599
76405
|
platform: "workers",
|
|
76600
76406
|
copyFiles: {
|
|
76601
76407
|
variants: {
|
|
@@ -76609,14 +76415,37 @@ var c3_default23 = {
|
|
|
76609
76415
|
}
|
|
76610
76416
|
};
|
|
76611
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
|
+
|
|
76612
76441
|
// templates/hello-world/c3.ts
|
|
76613
76442
|
var import_promises2 = require("node:fs/promises");
|
|
76614
76443
|
var import_node_path5 = require("node:path");
|
|
76615
|
-
var
|
|
76444
|
+
var c3_default22 = {
|
|
76616
76445
|
configVersion: 1,
|
|
76617
76446
|
id: "hello-world",
|
|
76618
|
-
displayName: "
|
|
76619
|
-
description: "
|
|
76447
|
+
displayName: "Worker only",
|
|
76448
|
+
description: "For processing requests, transforming responses, or API endpoints",
|
|
76620
76449
|
platform: "workers",
|
|
76621
76450
|
async configure(ctx) {
|
|
76622
76451
|
if (ctx.args.lang === "python") {
|
|
@@ -76645,35 +76474,55 @@ var c3_default24 = {
|
|
|
76645
76474
|
}
|
|
76646
76475
|
};
|
|
76647
76476
|
|
|
76648
|
-
// templates/hono/c3.ts
|
|
76649
|
-
var
|
|
76477
|
+
// templates/hono/pages/c3.ts
|
|
76478
|
+
var generate13 = async (ctx) => {
|
|
76650
76479
|
const { name: pm4 } = detectPackageManager();
|
|
76651
76480
|
await runFrameworkGenerator(ctx, [
|
|
76652
76481
|
ctx.project.name,
|
|
76653
76482
|
"--template",
|
|
76654
|
-
"cloudflare-
|
|
76483
|
+
"cloudflare-pages",
|
|
76655
76484
|
"--install",
|
|
76656
76485
|
"--pm",
|
|
76657
76486
|
pm4
|
|
76658
76487
|
]);
|
|
76659
76488
|
logRaw("");
|
|
76660
76489
|
};
|
|
76661
|
-
var
|
|
76662
|
-
|
|
76663
|
-
|
|
76664
|
-
|
|
76665
|
-
|
|
76666
|
-
|
|
76667
|
-
|
|
76668
|
-
|
|
76669
|
-
|
|
76670
|
-
|
|
76671
|
-
|
|
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"
|
|
76672
76504
|
}
|
|
76673
|
-
})
|
|
76674
|
-
|
|
76505
|
+
}),
|
|
76506
|
+
devScript: "dev",
|
|
76507
|
+
deployScript: "deploy",
|
|
76508
|
+
previewScript: "dev"
|
|
76675
76509
|
};
|
|
76676
|
-
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 = {
|
|
76677
76526
|
configVersion: 1,
|
|
76678
76527
|
id: "hono",
|
|
76679
76528
|
frameworkCli: "create-hono",
|
|
@@ -76682,12 +76531,10 @@ var config20 = {
|
|
|
76682
76531
|
path: "./templates"
|
|
76683
76532
|
},
|
|
76684
76533
|
platform: "workers",
|
|
76685
|
-
|
|
76686
|
-
|
|
76534
|
+
path: "templates/hono/workers",
|
|
76535
|
+
generate: generate14,
|
|
76687
76536
|
transformPackageJson: async () => ({
|
|
76688
76537
|
scripts: {
|
|
76689
|
-
dev: "wrangler dev",
|
|
76690
|
-
deploy: "wrangler deploy --minify",
|
|
76691
76538
|
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
76692
76539
|
}
|
|
76693
76540
|
}),
|
|
@@ -76695,12 +76542,19 @@ var config20 = {
|
|
|
76695
76542
|
deployScript: "deploy",
|
|
76696
76543
|
previewScript: "dev"
|
|
76697
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
|
+
};
|
|
76698
76552
|
var c3_default25 = config20;
|
|
76699
76553
|
|
|
76700
76554
|
// templates/next/c3.ts
|
|
76701
76555
|
var import_path10 = require("path");
|
|
76702
|
-
var { npm:
|
|
76703
|
-
var
|
|
76556
|
+
var { npm: npm10, npx: npx4 } = detectPackageManager();
|
|
76557
|
+
var generate15 = async (ctx) => {
|
|
76704
76558
|
const projectName = ctx.project.name;
|
|
76705
76559
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76706
76560
|
const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
@@ -76725,7 +76579,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76725
76579
|
writeFile2(configFile, updatedConfigFile);
|
|
76726
76580
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76727
76581
|
};
|
|
76728
|
-
var
|
|
76582
|
+
var configure9 = async (ctx) => {
|
|
76729
76583
|
const projectPath = ctx.project.path;
|
|
76730
76584
|
const path6 = probePaths([
|
|
76731
76585
|
`${projectPath}/pages/api`,
|
|
@@ -76806,8 +76660,8 @@ var c3_default26 = {
|
|
|
76806
76660
|
frameworkCli: "create-next-app",
|
|
76807
76661
|
platform: "pages",
|
|
76808
76662
|
displayName: "Next.js",
|
|
76809
|
-
generate:
|
|
76810
|
-
configure:
|
|
76663
|
+
generate: generate15,
|
|
76664
|
+
configure: configure9,
|
|
76811
76665
|
copyFiles: {
|
|
76812
76666
|
async selectVariant(ctx) {
|
|
76813
76667
|
const isApp = probePaths([
|
|
@@ -76838,12 +76692,12 @@ var c3_default26 = {
|
|
|
76838
76692
|
}
|
|
76839
76693
|
},
|
|
76840
76694
|
transformPackageJson: async (_3, ctx) => {
|
|
76841
|
-
const isNpm =
|
|
76842
|
-
const isBun =
|
|
76695
|
+
const isNpm = npm10 === "npm";
|
|
76696
|
+
const isBun = npm10 === "bun";
|
|
76843
76697
|
const isNpmOrBun = isNpm || isBun;
|
|
76844
76698
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76845
76699
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76846
|
-
const pmCommand = isNpmOrBun ? npx4 :
|
|
76700
|
+
const pmCommand = isNpmOrBun ? npx4 : npm10;
|
|
76847
76701
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76848
76702
|
return {
|
|
76849
76703
|
scripts: {
|
|
@@ -76863,21 +76717,21 @@ var c3_default26 = {
|
|
|
76863
76717
|
};
|
|
76864
76718
|
|
|
76865
76719
|
// templates/nuxt/pages/c3.ts
|
|
76866
|
-
var
|
|
76867
|
-
var { npm:
|
|
76868
|
-
var
|
|
76720
|
+
var recast7 = __toESM(require_main3());
|
|
76721
|
+
var { npm: npm11, name: pm2 } = detectPackageManager();
|
|
76722
|
+
var generate16 = async (ctx) => {
|
|
76869
76723
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76870
76724
|
await runFrameworkGenerator(ctx, [
|
|
76871
76725
|
"init",
|
|
76872
76726
|
ctx.project.name,
|
|
76873
76727
|
"--packageManager",
|
|
76874
|
-
|
|
76728
|
+
npm11,
|
|
76875
76729
|
gitFlag
|
|
76876
76730
|
]);
|
|
76877
76731
|
writeFile2("./.node-version", "18");
|
|
76878
76732
|
logRaw("");
|
|
76879
76733
|
};
|
|
76880
|
-
var
|
|
76734
|
+
var configure10 = async (ctx) => {
|
|
76881
76735
|
const packages = ["nitro-cloudflare-dev"];
|
|
76882
76736
|
if (pm2 === "pnpm") {
|
|
76883
76737
|
packages.push("h3");
|
|
@@ -76885,7 +76739,7 @@ var configure13 = async (ctx) => {
|
|
|
76885
76739
|
await installPackages(packages, {
|
|
76886
76740
|
dev: true,
|
|
76887
76741
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76888
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76742
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
76889
76743
|
});
|
|
76890
76744
|
updateNuxtConfig();
|
|
76891
76745
|
updateEnvTypes2(ctx);
|
|
@@ -76908,7 +76762,7 @@ var updateNuxtConfig = () => {
|
|
|
76908
76762
|
const s = spinner();
|
|
76909
76763
|
const configFile = "nuxt.config.ts";
|
|
76910
76764
|
s.start(`Updating \`${configFile}\``);
|
|
76911
|
-
const b3 =
|
|
76765
|
+
const b3 = recast7.types.builders;
|
|
76912
76766
|
const presetDef = b3.objectProperty(
|
|
76913
76767
|
b3.identifier("nitro"),
|
|
76914
76768
|
b3.objectExpression([
|
|
@@ -76956,12 +76810,12 @@ var config21 = {
|
|
|
76956
76810
|
path: "./templates"
|
|
76957
76811
|
},
|
|
76958
76812
|
path: "templates/nuxt/pages",
|
|
76959
|
-
generate:
|
|
76960
|
-
configure:
|
|
76813
|
+
generate: generate16,
|
|
76814
|
+
configure: configure10,
|
|
76961
76815
|
transformPackageJson: async () => ({
|
|
76962
76816
|
scripts: {
|
|
76963
|
-
deploy: `${
|
|
76964
|
-
preview: `${
|
|
76817
|
+
deploy: `${npm11} run build && wrangler pages deploy`,
|
|
76818
|
+
preview: `${npm11} run build && wrangler pages dev`,
|
|
76965
76819
|
"cf-typegen": `wrangler types`
|
|
76966
76820
|
}
|
|
76967
76821
|
}),
|
|
@@ -76972,21 +76826,21 @@ var config21 = {
|
|
|
76972
76826
|
var c3_default27 = config21;
|
|
76973
76827
|
|
|
76974
76828
|
// templates/nuxt/workers/c3.ts
|
|
76975
|
-
var
|
|
76976
|
-
var { npm:
|
|
76977
|
-
var
|
|
76829
|
+
var recast8 = __toESM(require_main3());
|
|
76830
|
+
var { npm: npm12, name: pm3 } = detectPackageManager();
|
|
76831
|
+
var generate17 = async (ctx) => {
|
|
76978
76832
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76979
76833
|
await runFrameworkGenerator(ctx, [
|
|
76980
76834
|
"init",
|
|
76981
76835
|
ctx.project.name,
|
|
76982
76836
|
"--packageManager",
|
|
76983
|
-
|
|
76837
|
+
npm12,
|
|
76984
76838
|
gitFlag
|
|
76985
76839
|
]);
|
|
76986
76840
|
writeFile2("./.node-version", "18");
|
|
76987
76841
|
logRaw("");
|
|
76988
76842
|
};
|
|
76989
|
-
var
|
|
76843
|
+
var configure11 = async (ctx) => {
|
|
76990
76844
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
76991
76845
|
if (pm3 === "pnpm") {
|
|
76992
76846
|
packages.push("h3");
|
|
@@ -76994,7 +76848,7 @@ var configure14 = async (ctx) => {
|
|
|
76994
76848
|
await installPackages(packages, {
|
|
76995
76849
|
dev: true,
|
|
76996
76850
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76997
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76851
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm12} install\``)}`
|
|
76998
76852
|
});
|
|
76999
76853
|
updateNuxtConfig2();
|
|
77000
76854
|
updateEnvTypes3(ctx);
|
|
@@ -77017,7 +76871,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77017
76871
|
const s = spinner();
|
|
77018
76872
|
const configFile = "nuxt.config.ts";
|
|
77019
76873
|
s.start(`Updating \`${configFile}\``);
|
|
77020
|
-
const b3 =
|
|
76874
|
+
const b3 = recast8.types.builders;
|
|
77021
76875
|
const presetDef = b3.objectProperty(
|
|
77022
76876
|
b3.identifier("nitro"),
|
|
77023
76877
|
b3.objectExpression([
|
|
@@ -77065,12 +76919,12 @@ var config22 = {
|
|
|
77065
76919
|
path: "./templates"
|
|
77066
76920
|
},
|
|
77067
76921
|
path: "templates/nuxt/workers",
|
|
77068
|
-
generate:
|
|
77069
|
-
configure:
|
|
76922
|
+
generate: generate17,
|
|
76923
|
+
configure: configure11,
|
|
77070
76924
|
transformPackageJson: async () => ({
|
|
77071
76925
|
scripts: {
|
|
77072
|
-
deploy: `${
|
|
77073
|
-
preview: `${
|
|
76926
|
+
deploy: `${npm12} run build && wrangler deploy`,
|
|
76927
|
+
preview: `${npm12} run build && wrangler dev`,
|
|
77074
76928
|
"cf-typegen": `wrangler types`
|
|
77075
76929
|
}
|
|
77076
76930
|
}),
|
|
@@ -77263,7 +77117,7 @@ var c3_default31 = {
|
|
|
77263
77117
|
})
|
|
77264
77118
|
};
|
|
77265
77119
|
function buildConfigure(params) {
|
|
77266
|
-
return async function
|
|
77120
|
+
return async function configure21(ctx) {
|
|
77267
77121
|
const loginSuccess = await params.login(ctx);
|
|
77268
77122
|
if (!loginSuccess) {
|
|
77269
77123
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -77304,13 +77158,13 @@ var c3_default32 = {
|
|
|
77304
77158
|
};
|
|
77305
77159
|
|
|
77306
77160
|
// templates/qwik/c3.ts
|
|
77307
|
-
var
|
|
77308
|
-
var { npm:
|
|
77309
|
-
var
|
|
77161
|
+
var recast9 = __toESM(require_main3());
|
|
77162
|
+
var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
|
|
77163
|
+
var generate18 = async (ctx) => {
|
|
77310
77164
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77311
77165
|
};
|
|
77312
|
-
var
|
|
77313
|
-
const cmd = [name2 === "pnpm" ?
|
|
77166
|
+
var configure12 = async (ctx) => {
|
|
77167
|
+
const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77314
77168
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77315
77169
|
await runCommand(cmd);
|
|
77316
77170
|
addBindingsProxy2(ctx);
|
|
@@ -77323,7 +77177,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77323
77177
|
const s = spinner();
|
|
77324
77178
|
s.start("Updating `vite.config.ts`");
|
|
77325
77179
|
const snippets = loadTemplateSnippets(ctx);
|
|
77326
|
-
const b3 =
|
|
77180
|
+
const b3 = recast9.types.builders;
|
|
77327
77181
|
transformFile("vite.config.ts", {
|
|
77328
77182
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77329
77183
|
visitProgram: function(n) {
|
|
@@ -77365,7 +77219,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77365
77219
|
s.start(`Updating \`${entrypointPath}\``);
|
|
77366
77220
|
transformFile(entrypointPath, {
|
|
77367
77221
|
visitTSInterfaceDeclaration: function(n) {
|
|
77368
|
-
const b3 =
|
|
77222
|
+
const b3 = recast9.types.builders;
|
|
77369
77223
|
const id = n.node.id;
|
|
77370
77224
|
if (id.name !== "QwikCityPlatform") {
|
|
77371
77225
|
this.traverse(n);
|
|
@@ -77395,12 +77249,12 @@ var config24 = {
|
|
|
77395
77249
|
copyFiles: {
|
|
77396
77250
|
path: "./templates"
|
|
77397
77251
|
},
|
|
77398
|
-
generate:
|
|
77399
|
-
configure:
|
|
77252
|
+
generate: generate18,
|
|
77253
|
+
configure: configure12,
|
|
77400
77254
|
transformPackageJson: async () => ({
|
|
77401
77255
|
scripts: {
|
|
77402
|
-
deploy: `${
|
|
77403
|
-
preview: `${
|
|
77256
|
+
deploy: `${npm13} run build && wrangler pages deploy`,
|
|
77257
|
+
preview: `${npm13} run build && wrangler pages dev`,
|
|
77404
77258
|
"cf-typegen": `wrangler types`
|
|
77405
77259
|
}
|
|
77406
77260
|
}),
|
|
@@ -77411,8 +77265,8 @@ var config24 = {
|
|
|
77411
77265
|
var c3_default33 = config24;
|
|
77412
77266
|
|
|
77413
77267
|
// templates/react/pages/c3.ts
|
|
77414
|
-
var { npm:
|
|
77415
|
-
var
|
|
77268
|
+
var { npm: npm14 } = detectPackageManager();
|
|
77269
|
+
var generate19 = async (ctx) => {
|
|
77416
77270
|
const variant = await inputPrompt({
|
|
77417
77271
|
type: "select",
|
|
77418
77272
|
question: "Select a variant:",
|
|
@@ -77449,11 +77303,11 @@ var config25 = {
|
|
|
77449
77303
|
displayName: "React",
|
|
77450
77304
|
platform: "pages",
|
|
77451
77305
|
path: "templates/react/pages",
|
|
77452
|
-
generate:
|
|
77306
|
+
generate: generate19,
|
|
77453
77307
|
transformPackageJson: async () => ({
|
|
77454
77308
|
scripts: {
|
|
77455
|
-
deploy: `${
|
|
77456
|
-
preview: `${
|
|
77309
|
+
deploy: `${npm14} run build && wrangler pages deploy ./dist`,
|
|
77310
|
+
preview: `${npm14} run build && wrangler pages dev ./dist`
|
|
77457
77311
|
}
|
|
77458
77312
|
}),
|
|
77459
77313
|
devScript: "dev",
|
|
@@ -77464,11 +77318,11 @@ var c3_default34 = config25;
|
|
|
77464
77318
|
|
|
77465
77319
|
// templates/react/workers/c3.ts
|
|
77466
77320
|
var import_assert2 = __toESM(require("assert"));
|
|
77467
|
-
var
|
|
77468
|
-
var b2 =
|
|
77469
|
-
var t =
|
|
77470
|
-
var { npm:
|
|
77471
|
-
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) => {
|
|
77472
77326
|
const variant = await getVariant();
|
|
77473
77327
|
ctx.args.lang = variant.lang;
|
|
77474
77328
|
await runFrameworkGenerator(ctx, [
|
|
@@ -77478,7 +77332,7 @@ var generate22 = async (ctx) => {
|
|
|
77478
77332
|
]);
|
|
77479
77333
|
logRaw("");
|
|
77480
77334
|
};
|
|
77481
|
-
var
|
|
77335
|
+
var configure13 = async (ctx) => {
|
|
77482
77336
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77483
77337
|
dev: true,
|
|
77484
77338
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77509,9 +77363,9 @@ function transformViteConfig(ctx) {
|
|
|
77509
77363
|
if (callee.name !== "defineConfig") {
|
|
77510
77364
|
return this.traverse(n);
|
|
77511
77365
|
}
|
|
77512
|
-
const
|
|
77513
|
-
(0, import_assert2.default)(t.ObjectExpression.check(
|
|
77514
|
-
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));
|
|
77515
77369
|
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77516
77370
|
pluginsProp.value.elements.push(
|
|
77517
77371
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -77585,12 +77439,12 @@ var config26 = {
|
|
|
77585
77439
|
}
|
|
77586
77440
|
}
|
|
77587
77441
|
},
|
|
77588
|
-
generate:
|
|
77589
|
-
configure:
|
|
77442
|
+
generate: generate20,
|
|
77443
|
+
configure: configure13,
|
|
77590
77444
|
transformPackageJson: async (_3, ctx) => ({
|
|
77591
77445
|
scripts: {
|
|
77592
|
-
deploy: `${
|
|
77593
|
-
preview: `${
|
|
77446
|
+
deploy: `${npm15} run build && wrangler deploy`,
|
|
77447
|
+
preview: `${npm15} run build && vite preview`,
|
|
77594
77448
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77595
77449
|
}
|
|
77596
77450
|
}),
|
|
@@ -77607,9 +77461,9 @@ var config27 = {
|
|
|
77607
77461
|
};
|
|
77608
77462
|
var c3_default36 = config27;
|
|
77609
77463
|
|
|
77610
|
-
// templates/remix/c3.ts
|
|
77611
|
-
var { npm:
|
|
77612
|
-
var
|
|
77464
|
+
// templates/remix/pages/c3.ts
|
|
77465
|
+
var { npm: npm16 } = detectPackageManager();
|
|
77466
|
+
var generate21 = async (ctx) => {
|
|
77613
77467
|
await runFrameworkGenerator(ctx, [
|
|
77614
77468
|
ctx.project.name,
|
|
77615
77469
|
"--template",
|
|
@@ -77617,7 +77471,7 @@ var generate23 = async (ctx) => {
|
|
|
77617
77471
|
]);
|
|
77618
77472
|
logRaw("");
|
|
77619
77473
|
};
|
|
77620
|
-
var
|
|
77474
|
+
var configure14 = async () => {
|
|
77621
77475
|
const typeDefsPath = "load-context.ts";
|
|
77622
77476
|
const s = spinner();
|
|
77623
77477
|
s.start(`Updating \`${typeDefsPath}\``);
|
|
@@ -77641,12 +77495,13 @@ var config28 = {
|
|
|
77641
77495
|
copyFiles: {
|
|
77642
77496
|
path: "./templates"
|
|
77643
77497
|
},
|
|
77644
|
-
|
|
77645
|
-
|
|
77498
|
+
path: "templates/remix/pages",
|
|
77499
|
+
generate: generate21,
|
|
77500
|
+
configure: configure14,
|
|
77646
77501
|
transformPackageJson: async () => ({
|
|
77647
77502
|
scripts: {
|
|
77648
|
-
deploy: `${
|
|
77649
|
-
preview: `${
|
|
77503
|
+
deploy: `${npm16} run build && wrangler pages deploy`,
|
|
77504
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
77650
77505
|
"cf-typegen": `wrangler types`
|
|
77651
77506
|
}
|
|
77652
77507
|
}),
|
|
@@ -77656,8 +77511,57 @@ var config28 = {
|
|
|
77656
77511
|
};
|
|
77657
77512
|
var c3_default37 = config28;
|
|
77658
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
|
+
|
|
77659
77563
|
// templates/scheduled/c3.ts
|
|
77660
|
-
var
|
|
77564
|
+
var c3_default40 = {
|
|
77661
77565
|
configVersion: 1,
|
|
77662
77566
|
id: "scheduled",
|
|
77663
77567
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -77676,13 +77580,13 @@ var c3_default38 = {
|
|
|
77676
77580
|
};
|
|
77677
77581
|
|
|
77678
77582
|
// templates/solid/c3.ts
|
|
77679
|
-
var
|
|
77680
|
-
var { npm:
|
|
77681
|
-
var
|
|
77583
|
+
var recast11 = __toESM(require_main3());
|
|
77584
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77585
|
+
var generate23 = async (ctx) => {
|
|
77682
77586
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
77683
77587
|
logRaw("");
|
|
77684
77588
|
};
|
|
77685
|
-
var
|
|
77589
|
+
var configure16 = async (ctx) => {
|
|
77686
77590
|
usesTypescript(ctx);
|
|
77687
77591
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
77688
77592
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
@@ -77692,7 +77596,7 @@ var configure18 = async (ctx) => {
|
|
|
77692
77596
|
if (callee.name !== "defineConfig") {
|
|
77693
77597
|
return this.traverse(n);
|
|
77694
77598
|
}
|
|
77695
|
-
const b3 =
|
|
77599
|
+
const b3 = recast11.types.builders;
|
|
77696
77600
|
mergeObjectProperties(
|
|
77697
77601
|
n.node.arguments[0],
|
|
77698
77602
|
[
|
|
@@ -77720,7 +77624,7 @@ var configure18 = async (ctx) => {
|
|
|
77720
77624
|
}
|
|
77721
77625
|
});
|
|
77722
77626
|
};
|
|
77723
|
-
var
|
|
77627
|
+
var config31 = {
|
|
77724
77628
|
configVersion: 1,
|
|
77725
77629
|
id: "solid",
|
|
77726
77630
|
frameworkCli: "create-solid",
|
|
@@ -77729,12 +77633,12 @@ var config29 = {
|
|
|
77729
77633
|
copyFiles: {
|
|
77730
77634
|
path: "./templates"
|
|
77731
77635
|
},
|
|
77732
|
-
generate:
|
|
77733
|
-
configure:
|
|
77636
|
+
generate: generate23,
|
|
77637
|
+
configure: configure16,
|
|
77734
77638
|
transformPackageJson: async () => ({
|
|
77735
77639
|
scripts: {
|
|
77736
|
-
preview: `${
|
|
77737
|
-
deploy: `${
|
|
77640
|
+
preview: `${npm18} run build && npx wrangler pages dev`,
|
|
77641
|
+
deploy: `${npm18} run build && wrangler pages deploy`
|
|
77738
77642
|
}
|
|
77739
77643
|
}),
|
|
77740
77644
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -77742,29 +77646,29 @@ var config29 = {
|
|
|
77742
77646
|
deployScript: "deploy",
|
|
77743
77647
|
previewScript: "preview"
|
|
77744
77648
|
};
|
|
77745
|
-
var
|
|
77649
|
+
var c3_default41 = config31;
|
|
77746
77650
|
|
|
77747
|
-
// templates/svelte/c3.ts
|
|
77651
|
+
// templates/svelte/pages/c3.ts
|
|
77748
77652
|
var import_node_fs3 = require("node:fs");
|
|
77749
|
-
var
|
|
77750
|
-
var
|
|
77751
|
-
var { npm:
|
|
77752
|
-
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) => {
|
|
77753
77657
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77754
77658
|
logRaw("");
|
|
77755
77659
|
};
|
|
77756
|
-
var
|
|
77660
|
+
var configure17 = async (ctx) => {
|
|
77757
77661
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77758
77662
|
await installPackages([pkg], {
|
|
77759
77663
|
dev: true,
|
|
77760
77664
|
startText: "Adding the Cloudflare Pages adapter",
|
|
77761
77665
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77762
77666
|
});
|
|
77763
|
-
|
|
77667
|
+
updateSvelteConfig();
|
|
77764
77668
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
77765
|
-
|
|
77669
|
+
updateTypeDefinitions(ctx);
|
|
77766
77670
|
};
|
|
77767
|
-
var
|
|
77671
|
+
var updateSvelteConfig = () => {
|
|
77768
77672
|
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77769
77673
|
transformFile("svelte.config.js", {
|
|
77770
77674
|
visitImportDeclaration: function(n) {
|
|
@@ -77798,6 +77702,105 @@ var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
|
77798
77702
|
}
|
|
77799
77703
|
});
|
|
77800
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
|
+
};
|
|
77801
77804
|
var updateTypeDefinitions2 = (ctx) => {
|
|
77802
77805
|
if (!usesTypescript(ctx)) {
|
|
77803
77806
|
return;
|
|
@@ -77835,21 +77838,22 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77835
77838
|
}
|
|
77836
77839
|
});
|
|
77837
77840
|
};
|
|
77838
|
-
var
|
|
77841
|
+
var config33 = {
|
|
77839
77842
|
configVersion: 1,
|
|
77840
77843
|
id: "svelte",
|
|
77841
77844
|
frameworkCli: "sv",
|
|
77842
77845
|
displayName: "SvelteKit",
|
|
77843
|
-
platform: "
|
|
77846
|
+
platform: "workers",
|
|
77844
77847
|
copyFiles: {
|
|
77845
77848
|
path: "./templates"
|
|
77846
77849
|
},
|
|
77850
|
+
path: "templates/svelte/workers",
|
|
77847
77851
|
generate: generate25,
|
|
77848
|
-
configure:
|
|
77852
|
+
configure: configure18,
|
|
77849
77853
|
transformPackageJson: async (original, ctx) => {
|
|
77850
77854
|
let scripts = {
|
|
77851
|
-
preview: `${npm20} run build && wrangler
|
|
77852
|
-
deploy: `${npm20} run build && wrangler
|
|
77855
|
+
preview: `${npm20} run build && wrangler dev`,
|
|
77856
|
+
deploy: `${npm20} run build && wrangler deploy`
|
|
77853
77857
|
};
|
|
77854
77858
|
if (usesTypescript(ctx)) {
|
|
77855
77859
|
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
@@ -77864,14 +77868,21 @@ var config30 = {
|
|
|
77864
77868
|
deployScript: "deploy",
|
|
77865
77869
|
previewScript: "preview"
|
|
77866
77870
|
};
|
|
77867
|
-
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;
|
|
77868
77879
|
|
|
77869
77880
|
// templates/vue/pages/c3.ts
|
|
77870
77881
|
var { npm: npm21 } = detectPackageManager();
|
|
77871
77882
|
var generate26 = async (ctx) => {
|
|
77872
77883
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77873
77884
|
};
|
|
77874
|
-
var
|
|
77885
|
+
var config35 = {
|
|
77875
77886
|
configVersion: 1,
|
|
77876
77887
|
id: "vue",
|
|
77877
77888
|
frameworkCli: "create-vue",
|
|
@@ -77889,7 +77900,7 @@ var config31 = {
|
|
|
77889
77900
|
deployScript: "deploy",
|
|
77890
77901
|
previewScript: "preview"
|
|
77891
77902
|
};
|
|
77892
|
-
var
|
|
77903
|
+
var c3_default45 = config35;
|
|
77893
77904
|
|
|
77894
77905
|
// templates/vue/workers/c3.ts
|
|
77895
77906
|
var { npm: npm22 } = detectPackageManager();
|
|
@@ -77910,7 +77921,7 @@ var generate27 = async (ctx) => {
|
|
|
77910
77921
|
]);
|
|
77911
77922
|
logRaw("");
|
|
77912
77923
|
};
|
|
77913
|
-
var
|
|
77924
|
+
var configure19 = async (ctx) => {
|
|
77914
77925
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77915
77926
|
dev: true,
|
|
77916
77927
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77931,7 +77942,7 @@ function updateTsconfigJson2() {
|
|
|
77931
77942
|
writeJSON("tsconfig.json", tsconfig);
|
|
77932
77943
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77933
77944
|
}
|
|
77934
|
-
var
|
|
77945
|
+
var config36 = {
|
|
77935
77946
|
configVersion: 1,
|
|
77936
77947
|
id: "vue",
|
|
77937
77948
|
frameworkCli: "create-vue",
|
|
@@ -77951,7 +77962,7 @@ var config32 = {
|
|
|
77951
77962
|
}
|
|
77952
77963
|
}
|
|
77953
77964
|
},
|
|
77954
|
-
configure:
|
|
77965
|
+
configure: configure19,
|
|
77955
77966
|
generate: generate27,
|
|
77956
77967
|
transformPackageJson: async (_3, ctx) => ({
|
|
77957
77968
|
scripts: {
|
|
@@ -77964,20 +77975,20 @@ var config32 = {
|
|
|
77964
77975
|
deployScript: "deploy",
|
|
77965
77976
|
previewScript: "preview"
|
|
77966
77977
|
};
|
|
77967
|
-
var
|
|
77978
|
+
var c3_default46 = config36;
|
|
77968
77979
|
|
|
77969
77980
|
// templates/vue/c3.ts
|
|
77970
|
-
var
|
|
77981
|
+
var config37 = {
|
|
77971
77982
|
displayName: "Vue",
|
|
77972
|
-
platformVariants: { pages:
|
|
77983
|
+
platformVariants: { pages: c3_default45, workers: c3_default46 }
|
|
77973
77984
|
};
|
|
77974
|
-
var
|
|
77985
|
+
var c3_default47 = config37;
|
|
77975
77986
|
|
|
77976
77987
|
// src/git.ts
|
|
77977
77988
|
var import_node_assert = __toESM(require("node:assert"));
|
|
77978
77989
|
|
|
77979
77990
|
// ../wrangler/package.json
|
|
77980
|
-
var version2 = "0.0.0-
|
|
77991
|
+
var version2 = "0.0.0-86ab0ca52";
|
|
77981
77992
|
|
|
77982
77993
|
// src/git.ts
|
|
77983
77994
|
var offerGit = async (ctx) => {
|
|
@@ -78238,47 +78249,42 @@ var defaultSelectVariant = async (ctx) => {
|
|
|
78238
78249
|
function getFrameworkMap({ experimental = false }) {
|
|
78239
78250
|
if (experimental) {
|
|
78240
78251
|
return {
|
|
78241
|
-
|
|
78242
|
-
|
|
78243
|
-
|
|
78244
|
-
qwik: c3_default7,
|
|
78245
|
-
remix: c3_default8,
|
|
78246
|
-
solid: c3_default9,
|
|
78247
|
-
svelte: c3_default10
|
|
78252
|
+
next: c3_default,
|
|
78253
|
+
qwik: c3_default2,
|
|
78254
|
+
solid: c3_default3
|
|
78248
78255
|
};
|
|
78249
78256
|
} else {
|
|
78250
78257
|
return {
|
|
78251
|
-
analog:
|
|
78252
|
-
angular:
|
|
78253
|
-
astro:
|
|
78254
|
-
docusaurus:
|
|
78255
|
-
gatsby:
|
|
78258
|
+
analog: c3_default4,
|
|
78259
|
+
angular: c3_default7,
|
|
78260
|
+
astro: c3_default10,
|
|
78261
|
+
docusaurus: c3_default14,
|
|
78262
|
+
gatsby: c3_default17,
|
|
78256
78263
|
hono: c3_default25,
|
|
78257
78264
|
next: c3_default26,
|
|
78258
78265
|
nuxt: c3_default29,
|
|
78259
78266
|
qwik: c3_default33,
|
|
78260
78267
|
react: c3_default36,
|
|
78261
|
-
remix:
|
|
78262
|
-
solid:
|
|
78263
|
-
svelte:
|
|
78264
|
-
vue:
|
|
78268
|
+
remix: c3_default39,
|
|
78269
|
+
solid: c3_default41,
|
|
78270
|
+
svelte: c3_default44,
|
|
78271
|
+
vue: c3_default47
|
|
78265
78272
|
};
|
|
78266
78273
|
}
|
|
78267
78274
|
}
|
|
78268
78275
|
function getTemplateMap({ experimental = false }) {
|
|
78269
78276
|
if (experimental) {
|
|
78270
|
-
return {
|
|
78271
|
-
"hello-world-assets-only": c3_default2,
|
|
78272
|
-
"hello-world-with-assets": c3_default4,
|
|
78273
|
-
"hello-world-durable-object-with-assets": c3_default3
|
|
78274
|
-
};
|
|
78277
|
+
return {};
|
|
78275
78278
|
} else {
|
|
78276
78279
|
return {
|
|
78277
|
-
"hello-world":
|
|
78278
|
-
|
|
78279
|
-
|
|
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,
|
|
78280
78287
|
queues: c3_default32,
|
|
78281
|
-
"hello-world-durable-object": c3_default23,
|
|
78282
78288
|
openapi: c3_default30,
|
|
78283
78289
|
"pre-existing": c3_default31
|
|
78284
78290
|
};
|
|
@@ -78388,9 +78394,9 @@ var createContext = async (args, prevArgs) => {
|
|
|
78388
78394
|
});
|
|
78389
78395
|
const categoryOptions = [
|
|
78390
78396
|
{
|
|
78391
|
-
label: "Hello World
|
|
78397
|
+
label: "Hello World Starter",
|
|
78392
78398
|
value: "hello-world",
|
|
78393
|
-
description: "Select from
|
|
78399
|
+
description: "Select from basic scaffolds to get started with Workers, Assets and Durable Objects"
|
|
78394
78400
|
},
|
|
78395
78401
|
{
|
|
78396
78402
|
label: "Framework Starter",
|
|
@@ -78428,8 +78434,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
78428
78434
|
experimental: args.experimental
|
|
78429
78435
|
});
|
|
78430
78436
|
const frameworkOptions = Object.entries(frameworkMap).map(
|
|
78431
|
-
([key,
|
|
78432
|
-
label:
|
|
78437
|
+
([key, config38]) => ({
|
|
78438
|
+
label: config38.displayName,
|
|
78433
78439
|
value: key
|
|
78434
78440
|
})
|
|
78435
78441
|
);
|
|
@@ -78596,28 +78602,28 @@ var processRemoteTemplate = async (args) => {
|
|
|
78596
78602
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78597
78603
|
}
|
|
78598
78604
|
const path6 = await downloadRemoteTemplate(src);
|
|
78599
|
-
const
|
|
78600
|
-
validateTemplate(path6,
|
|
78605
|
+
const config38 = inferTemplateConfig(path6);
|
|
78606
|
+
validateTemplate(path6, config38);
|
|
78601
78607
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78602
78608
|
return {
|
|
78603
78609
|
path: path6,
|
|
78604
|
-
...
|
|
78610
|
+
...config38
|
|
78605
78611
|
};
|
|
78606
78612
|
};
|
|
78607
|
-
var validateTemplate = (path6,
|
|
78608
|
-
if (!
|
|
78613
|
+
var validateTemplate = (path6, config38) => {
|
|
78614
|
+
if (!config38.copyFiles) {
|
|
78609
78615
|
return;
|
|
78610
78616
|
}
|
|
78611
|
-
if (isVariantInfo(
|
|
78612
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78617
|
+
if (isVariantInfo(config38.copyFiles)) {
|
|
78618
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config38.copyFiles.path), config38);
|
|
78613
78619
|
} else {
|
|
78614
|
-
for (const variant of Object.values(
|
|
78615
|
-
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);
|
|
78616
78622
|
}
|
|
78617
78623
|
}
|
|
78618
78624
|
};
|
|
78619
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78620
|
-
if (
|
|
78625
|
+
var validateTemplateSrcDirectory = (path6, config38) => {
|
|
78626
|
+
if (config38.platform === "workers") {
|
|
78621
78627
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78622
78628
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78623
78629
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -78791,12 +78797,12 @@ var cliDefinition = {
|
|
|
78791
78797
|
const experimental = Boolean(args?.["experimental"]);
|
|
78792
78798
|
if (experimental) {
|
|
78793
78799
|
return [
|
|
78794
|
-
{ name: "hello-world", description: "Hello World
|
|
78800
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78795
78801
|
{ name: "web-framework", description: "Framework Starter" }
|
|
78796
78802
|
];
|
|
78797
78803
|
} else {
|
|
78798
78804
|
return [
|
|
78799
|
-
{ name: "hello-world", description: "Hello World
|
|
78805
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78800
78806
|
{ name: "web-framework", description: "Framework Starter" },
|
|
78801
78807
|
{ name: "demo", description: "Application Starter" },
|
|
78802
78808
|
{
|
|
@@ -80528,20 +80534,20 @@ function applyEdits(text, edits) {
|
|
|
80528
80534
|
var import_fs12 = require("fs");
|
|
80529
80535
|
var import_path14 = require("path");
|
|
80530
80536
|
var import_toml2 = __toESM(require_toml());
|
|
80531
|
-
function ensureNameExists(
|
|
80532
|
-
|
|
80533
|
-
return
|
|
80537
|
+
function ensureNameExists(config38, projectName) {
|
|
80538
|
+
config38["name"] = projectName;
|
|
80539
|
+
return config38;
|
|
80534
80540
|
}
|
|
80535
|
-
async function ensureCompatDateExists(
|
|
80536
|
-
if (typeof
|
|
80541
|
+
async function ensureCompatDateExists(config38) {
|
|
80542
|
+
if (typeof config38["compatibility_date"] === "string") {
|
|
80537
80543
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80538
|
-
if (!
|
|
80539
|
-
|
|
80544
|
+
if (!config38["compatibility_date"].match(validCompatDateRe)) {
|
|
80545
|
+
config38["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80540
80546
|
}
|
|
80541
80547
|
} else {
|
|
80542
|
-
|
|
80548
|
+
config38["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80543
80549
|
}
|
|
80544
|
-
return
|
|
80550
|
+
return config38;
|
|
80545
80551
|
}
|
|
80546
80552
|
var updateWranglerConfig = async (ctx) => {
|
|
80547
80553
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -81255,8 +81261,8 @@ var renderValues = (values) => {
|
|
|
81255
81261
|
};
|
|
81256
81262
|
|
|
81257
81263
|
// src/helpers/retry.ts
|
|
81258
|
-
var retry = async (
|
|
81259
|
-
let { times } =
|
|
81264
|
+
var retry = async (config38, fn) => {
|
|
81265
|
+
let { times } = config38;
|
|
81260
81266
|
let error2 = null;
|
|
81261
81267
|
while (times > 0) {
|
|
81262
81268
|
try {
|
|
@@ -81264,10 +81270,10 @@ var retry = async (config34, fn) => {
|
|
|
81264
81270
|
} catch (e) {
|
|
81265
81271
|
error2 = e;
|
|
81266
81272
|
times--;
|
|
81267
|
-
if (
|
|
81273
|
+
if (config38.exitCondition?.(e)) {
|
|
81268
81274
|
break;
|
|
81269
81275
|
}
|
|
81270
|
-
await sleep(
|
|
81276
|
+
await sleep(config38.sleepMs ?? 1e3);
|
|
81271
81277
|
}
|
|
81272
81278
|
}
|
|
81273
81279
|
throw error2;
|
|
@@ -81387,8 +81393,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81387
81393
|
}
|
|
81388
81394
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81389
81395
|
try {
|
|
81390
|
-
const
|
|
81391
|
-
const currentTypes =
|
|
81396
|
+
const config38 = parse4(tsconfig);
|
|
81397
|
+
const currentTypes = config38.compilerOptions?.types ?? [];
|
|
81392
81398
|
const explicitEntrypoint = currentTypes.some(
|
|
81393
81399
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81394
81400
|
);
|
|
@@ -81463,7 +81469,7 @@ var runCli = async (args) => {
|
|
|
81463
81469
|
printBanner(args);
|
|
81464
81470
|
const ctx = await createContext(args);
|
|
81465
81471
|
await create(ctx);
|
|
81466
|
-
await
|
|
81472
|
+
await configure20(ctx);
|
|
81467
81473
|
await deploy(ctx);
|
|
81468
81474
|
printSummary(ctx);
|
|
81469
81475
|
logRaw("");
|
|
@@ -81491,7 +81497,7 @@ var create = async (ctx) => {
|
|
|
81491
81497
|
await rectifyPmMismatch(ctx);
|
|
81492
81498
|
endSection(`Application created`);
|
|
81493
81499
|
};
|
|
81494
|
-
var
|
|
81500
|
+
var configure20 = async (ctx) => {
|
|
81495
81501
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
81496
81502
|
await installWrangler();
|
|
81497
81503
|
await installWorkersTypes(ctx);
|