create-cloudflare 0.0.0-db0172707 → 0.0.0-db300ef98
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 +1154 -1042
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/templates/angular/pages/c3.ts +1 -0
- package/templates/astro/c3.ts +5 -93
- package/templates/astro/pages/c3.ts +99 -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-experimental/astro → templates/astro/workers}/templates/ts/wrangler.jsonc +1 -1
- package/templates/common/c3.ts +5 -1
- package/templates/docusaurus/pages/c3.ts +1 -0
- package/templates/gatsby/pages/c3.ts +1 -0
- package/templates/hello-world/c3.ts +3 -2
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/py/pyproject.toml +1 -1
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/test/env.d.ts +3 -0
- package/templates/hello-world/ts/worker-configuration.d.ts +6 -2
- package/{templates-experimental → templates}/hello-world-assets-only/c3.ts +4 -3
- package/templates/hello-world-durable-object/c3.ts +6 -3
- 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/worker-configuration.d.ts +6 -4
- 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-durable-object-with-assets/js/src/index.js +11 -10
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/wrangler.jsonc +2 -2
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/src/index.ts +10 -9
- package/templates/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +8 -0
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/c3.ts +25 -0
- package/{templates-experimental → templates}/hello-world-with-assets/js/package.json +1 -1
- package/{templates-experimental → templates}/hello-world-with-assets/js/public/index.html +2 -2
- package/{templates-experimental/hello-world-with-assets/ts → templates/hello-world-with-assets/py}/public/index.html +2 -2
- package/{templates-experimental → templates}/hello-world-with-assets/ts/package.json +1 -1
- package/{templates-experimental/hello-world-with-assets/py → templates/hello-world-with-assets/ts}/public/index.html +2 -2
- package/templates/hello-world-with-assets/ts/test/env.d.ts +3 -0
- package/{templates-experimental → templates}/hello-world-with-assets/ts/test/tsconfig.json +1 -1
- package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +7 -0
- package/templates/hono/c3.ts +5 -66
- package/templates/hono/pages/c3.ts +44 -0
- package/templates/hono/pages/templates/src/index.tsx +12 -0
- package/templates/hono/{templates → pages/templates}/wrangler.jsonc +1 -1
- package/{templates-experimental/hono → templates/hono/workers}/c3.ts +2 -4
- package/templates/next/c3.ts +7 -221
- package/templates/next/pages/c3.ts +225 -0
- package/{templates-experimental/next → templates/next/workers}/c3.ts +6 -7
- package/templates/next/workers/templates/open-next.config.ts +9 -0
- package/{templates-experimental/next → templates/next/workers}/templates/wrangler.jsonc +1 -1
- package/templates/nuxt/pages/c3.ts +2 -0
- package/templates/nuxt/workers/c3.ts +1 -0
- package/templates/openapi/c3.ts +5 -1
- package/templates/openapi/ts/__dot__gitignore +1 -0
- package/templates/openapi/ts/package.json +7 -6
- package/templates/openapi/ts/src/endpoints/taskCreate.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskDelete.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskFetch.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskList.ts +2 -2
- package/templates/openapi/ts/src/index.ts +4 -1
- package/templates/openapi/ts/src/types.ts +3 -0
- package/templates/openapi/ts/tsconfig.json +18 -20
- package/templates/pre-existing/c3.ts +6 -2
- package/templates/queues/c3.ts +5 -1
- package/templates/qwik/c3.ts +5 -144
- package/templates/qwik/pages/c3.ts +150 -0
- package/{templates-experimental/qwik → templates/qwik/workers}/c3.ts +4 -6
- package/templates/react/pages/c3.ts +1 -0
- package/templates/react/workers/c3.ts +1 -1
- package/templates/react/workers/js/src/App.jsx +1 -1
- package/templates/react/workers/js/src/assets/Cloudflare_Logo.svg +7 -5
- package/templates/react/workers/js/{api → worker}/index.js +1 -1
- package/templates/react/workers/js/wrangler.jsonc +2 -2
- package/templates/react/workers/ts/src/App.tsx +1 -1
- package/templates/react/workers/ts/tsconfig.worker.json +2 -2
- package/templates/react/workers/ts/{api → worker}/index.ts +2 -3
- package/templates/react/workers/ts/wrangler.jsonc +2 -2
- package/templates/react-router/c3.ts +53 -0
- package/templates/react-router/templates/worker-configuration.d.ts +8 -0
- package/templates/remix/c3.ts +6 -63
- package/templates/remix/pages/c3.ts +69 -0
- package/{templates-experimental/remix → templates/remix/workers}/c3.ts +2 -2
- package/{templates-experimental/remix → templates/remix/workers}/templates/wrangler.toml +1 -1
- package/templates/scheduled/c3.ts +5 -1
- package/templates/scheduled/ts/src/index.ts +7 -0
- package/templates/svelte/c3.ts +5 -154
- package/templates/svelte/pages/c3.ts +160 -0
- package/{templates-experimental/svelte → templates/svelte/workers}/c3.ts +3 -3
- package/templates/svelte/workers/templates/static/.assetsignore +2 -0
- package/templates/vue/pages/c3.ts +1 -0
- package/templates/vue/workers/js/server/index.js +2 -2
- package/templates/vue/workers/js/wrangler.jsonc +0 -1
- package/templates/vue/workers/ts/server/index.ts +2 -3
- package/templates/vue/workers/ts/wrangler.jsonc +0 -1
- package/templates/hono/snippets/appDeclaration.ts +0 -1
- package/templates/remix/templates/worker-configuration.d.ts +0 -4
- package/templates-experimental/astro/templates/ts/public/.assetsignore +0 -4
- package/templates-experimental/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +0 -5
- package/templates-experimental/hello-world-with-assets/c3.ts +0 -22
- package/templates-experimental/next/templates/open-next.config.ts +0 -6
- package/templates-experimental/qwik/templates/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 → 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/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/tsconfig.json +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/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/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/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/tsconfig.json +0 -0
- /package/{templates-experimental → templates}/hello-world-with-assets/ts/vitest.config.mts +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/next/{README.md → pages/README.md} +0 -0
- /package/templates/next/{app → pages/app}/js/app/api/hello/route.js +0 -0
- /package/templates/next/{app → pages/app}/js/app/not-found.js +0 -0
- /package/templates/next/{app → pages/app}/ts/app/api/hello/route.ts +0 -0
- /package/templates/next/{app → pages/app}/ts/app/not-found.tsx +0 -0
- /package/templates/next/{env.d.ts → pages/env.d.ts} +0 -0
- /package/templates/next/pages/{js → pages/js}/pages/api/hello.js +0 -0
- /package/templates/next/pages/{ts → pages/ts}/pages/api/hello.ts +0 -0
- /package/templates/next/{wrangler.jsonc → pages/wrangler.jsonc} +0 -0
- /package/{templates-experimental/next → templates/next/workers}/templates/.dev.vars +0 -0
- /package/{templates-experimental/next → templates/next/workers}/templates/__dot__gitignore +0 -0
- /package/{templates-experimental/next → templates/next/workers}/templates/cloudflare-env.d.ts +0 -0
- /package/{templates-experimental/qwik → templates/qwik/pages}/snippets/getPlatformProxy.ts +0 -0
- /package/{templates-experimental/qwik → templates/qwik/pages}/templates/worker-configuration.d.ts +0 -0
- /package/templates/qwik/{templates → pages/templates}/wrangler.jsonc +0 -0
- /package/templates/qwik/{snippets → workers/snippets}/getPlatformProxy.ts +0 -0
- /package/{templates-experimental/astro/templates/js → templates/qwik/workers/templates}/public/.assetsignore +0 -0
- /package/templates/{astro/templates/ts → qwik/workers/templates}/worker-configuration.d.ts +0 -0
- /package/{templates-experimental/qwik → templates/qwik/workers}/templates/wrangler.jsonc +0 -0
- /package/templates/{qwik → remix/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/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 config48(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 config48 = 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: config48, 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 config48 = 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: config48, 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 config48 = 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: config48, 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 config48 = (0, _lodash["default"])(options, this.config);
|
|
31513
|
+
if (config48.tokenHex === true) {
|
|
31514
|
+
config48.tokenChars = "0123456789abcdef";
|
|
31515
31515
|
}
|
|
31516
31516
|
var adjective = this._randomElement(this.adjectives);
|
|
31517
31517
|
var noun = this._randomElement(this.nouns);
|
|
31518
|
-
if (!
|
|
31518
|
+
if (!config48.tokenLength) config48.tokenLength = 0;
|
|
31519
31519
|
var token = "";
|
|
31520
|
-
for (var i = 0; i <
|
|
31521
|
-
token += this._randomElement(
|
|
31520
|
+
for (var i = 0; i < config48.tokenLength; i++) {
|
|
31521
|
+
token += this._randomElement(config48.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(config48.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, config48) {
|
|
40040
40040
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
40041
|
-
this.errorHandler.tolerant =
|
|
40041
|
+
this.errorHandler.tolerant = config48 ? typeof config48.tolerant === "boolean" && config48.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 = config48 ? typeof config48.comment === "boolean" && config48.comment : false;
|
|
40044
|
+
this.trackRange = config48 ? typeof config48.range === "boolean" && config48.range : false;
|
|
40045
|
+
this.trackLoc = config48 ? typeof config48.loc === "boolean" && config48.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(config48) {
|
|
49807
49807
|
assert_1.default.ok(this instanceof Printer2);
|
|
49808
|
-
var explicitTabWidth =
|
|
49809
|
-
|
|
49810
|
-
|
|
49808
|
+
var explicitTabWidth = config48 && config48.tabWidth;
|
|
49809
|
+
config48 = options_1.normalize(config48);
|
|
49810
|
+
config48.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 = config48.tabWidth;
|
|
49826
49826
|
if (!explicitTabWidth) {
|
|
49827
49827
|
var loc = path6.getNode().loc;
|
|
49828
49828
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
49829
|
-
|
|
49829
|
+
config48.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, config48, options, makePrintFunctionWith(options, {
|
|
49844
49844
|
includeComments: true,
|
|
49845
49845
|
avoidRootParens: false
|
|
49846
49846
|
}));
|
|
49847
|
-
|
|
49847
|
+
config48.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(config48), util.composeSourceMaps(config48.inputSourceMap, lines.getSourceMap(config48.sourceMapName, config48.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, config48, {
|
|
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 = config48.reuseWhitespace;
|
|
49874
|
+
config48.reuseWhitespace = false;
|
|
49875
|
+
var pr = new PrintResult(printGenerically(path6).toString(config48));
|
|
49876
|
+
config48.reuseWhitespace = oldReuseWhitespace;
|
|
49877
49877
|
return pr;
|
|
49878
49878
|
};
|
|
49879
49879
|
};
|
|
49880
49880
|
exports2.Printer = Printer;
|
|
49881
|
-
function genericPrint(path6,
|
|
49881
|
+
function genericPrint(path6, config48, 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, config48, 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 = (config48, value) => {
|
|
69384
|
+
const { question, label } = config48;
|
|
69385
|
+
if (config48.type !== "confirm" && !value) {
|
|
69386
69386
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
69387
69387
|
}
|
|
69388
|
-
const content =
|
|
69388
|
+
const content = config48.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 = (config48) => {
|
|
69392
|
+
switch (config48.type) {
|
|
69393
69393
|
case "select":
|
|
69394
|
-
return getSelectRenderers(
|
|
69394
|
+
return getSelectRenderers(config48);
|
|
69395
69395
|
case "confirm":
|
|
69396
|
-
return getConfirmRenderers(
|
|
69396
|
+
return getConfirmRenderers(config48);
|
|
69397
69397
|
case "text":
|
|
69398
|
-
return getTextRenderers(
|
|
69398
|
+
return getTextRenderers(config48);
|
|
69399
69399
|
case "multiselect":
|
|
69400
|
-
return getSelectRenderers(
|
|
69400
|
+
return getSelectRenderers(config48);
|
|
69401
69401
|
case "list":
|
|
69402
|
-
return getSelectListRenderers(
|
|
69402
|
+
return getSelectListRenderers(config48);
|
|
69403
69403
|
}
|
|
69404
69404
|
};
|
|
69405
|
-
var getTextRenderers = (
|
|
69406
|
-
const { question } =
|
|
69407
|
-
const helpText =
|
|
69408
|
-
const format5 =
|
|
69409
|
-
const defaultValue =
|
|
69405
|
+
var getTextRenderers = (config48) => {
|
|
69406
|
+
const { question } = config48;
|
|
69407
|
+
const helpText = config48.helpText ?? "";
|
|
69408
|
+
const format5 = config48.format ?? ((val) => String(val));
|
|
69409
|
+
const defaultValue = config48.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(config48, format5(value ?? "")),
|
|
69433
69433
|
cancel: activeRenderer
|
|
69434
69434
|
};
|
|
69435
69435
|
};
|
|
69436
|
-
var getSelectRenderers = (
|
|
69437
|
-
const { options, question, helpText: _helpText } =
|
|
69436
|
+
var getSelectRenderers = (config48) => {
|
|
69437
|
+
const { options, question, helpText: _helpText } = config48;
|
|
69438
69438
|
const helpText = _helpText ?? "";
|
|
69439
|
-
const maxItemsPerPage =
|
|
69439
|
+
const maxItemsPerPage = config48.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
|
+
config48,
|
|
69515
69515
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
69516
69516
|
);
|
|
69517
69517
|
}
|
|
69518
69518
|
return renderSubmit(
|
|
69519
|
-
|
|
69519
|
+
config48,
|
|
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 = (config48) => {
|
|
69527
|
+
const { question, helpText: _helpText } = config48;
|
|
69528
|
+
let options = config48.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
|
+
config48,
|
|
69610
69610
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
69611
69611
|
);
|
|
69612
69612
|
}
|
|
69613
69613
|
return renderSubmit(
|
|
69614
|
-
|
|
69614
|
+
config48,
|
|
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 = (config48) => {
|
|
69622
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config48;
|
|
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(config48, 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 config48 = 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
|
+
config48 = resolveConfig(resolvedConfigPath);
|
|
70613
70613
|
} catch (e) {
|
|
70614
|
-
|
|
70614
|
+
config48 = e;
|
|
70615
70615
|
}
|
|
70616
|
-
if (
|
|
70617
|
-
error2 =
|
|
70616
|
+
if (config48 instanceof Error) {
|
|
70617
|
+
error2 = config48;
|
|
70618
70618
|
return;
|
|
70619
70619
|
}
|
|
70620
70620
|
} else {
|
|
70621
|
-
|
|
70621
|
+
config48 = mixin2.require(resolvedConfigPath);
|
|
70622
70622
|
}
|
|
70623
|
-
setConfigObject(
|
|
70623
|
+
setConfigObject(config48);
|
|
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(config48, prev) {
|
|
70634
|
+
Object.keys(config48).forEach(function(key) {
|
|
70635
|
+
const value = config48[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 config48 = 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: config48
|
|
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(config48, 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(config48, "extends")) {
|
|
73018
|
+
if (typeof config48.extends !== "string")
|
|
73019
73019
|
return defaultConfig;
|
|
73020
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
73020
|
+
const isPath = /\.json|\..*rc$/.test(config48.extends);
|
|
73021
73021
|
let pathToDefault = null;
|
|
73022
73022
|
if (!isPath) {
|
|
73023
73023
|
try {
|
|
73024
|
-
pathToDefault = require.resolve(
|
|
73024
|
+
pathToDefault = require.resolve(config48.extends);
|
|
73025
73025
|
} catch (_err) {
|
|
73026
|
-
return
|
|
73026
|
+
return config48;
|
|
73027
73027
|
}
|
|
73028
73028
|
} else {
|
|
73029
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
73029
|
+
pathToDefault = getPathToDefaultConfig(cwd, config48.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(config48.extends);
|
|
73034
|
+
delete config48.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, config48) : Object.assign({}, defaultConfig, config48);
|
|
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(config48) {
|
|
73815
|
+
argsert("<object>", [config48], arguments.length);
|
|
73816
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config48, "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(config48) {
|
|
73989
|
+
argsert("<object>", [config48], arguments.length);
|
|
73990
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config48, "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 config48 = 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, ...config48 }
|
|
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-db300ef98";
|
|
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(config48) {
|
|
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
|
+
config48,
|
|
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 config48 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
74621
74621
|
return JSON.parse(
|
|
74622
|
-
|
|
74622
|
+
config48,
|
|
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(config48) {
|
|
74633
|
+
const deviceId = config48.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
74634
|
+
if (config48.deviceId === void 0) {
|
|
74635
|
+
writeMetricsConfig({ ...config48, deviceId });
|
|
74636
74636
|
}
|
|
74637
74637
|
return deviceId;
|
|
74638
74638
|
}
|
|
@@ -74817,7 +74817,7 @@ var detectPackageManager = () => {
|
|
|
74817
74817
|
}
|
|
74818
74818
|
};
|
|
74819
74819
|
var rectifyPmMismatch = async (ctx) => {
|
|
74820
|
-
const { npm:
|
|
74820
|
+
const { npm: npm25 } = detectPackageManager();
|
|
74821
74821
|
if (!detectPmMismatch(ctx)) {
|
|
74822
74822
|
return;
|
|
74823
74823
|
}
|
|
@@ -74829,17 +74829,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
74829
74829
|
if ((0, import_fs5.existsSync)(lockfilePath)) {
|
|
74830
74830
|
(0, import_fs5.rmSync)(lockfilePath);
|
|
74831
74831
|
}
|
|
74832
|
-
await runCommand([
|
|
74832
|
+
await runCommand([npm25, "install"], {
|
|
74833
74833
|
silent: true,
|
|
74834
74834
|
cwd: ctx.project.path,
|
|
74835
74835
|
startText: "Installing dependencies",
|
|
74836
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
74836
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
74837
74837
|
});
|
|
74838
74838
|
};
|
|
74839
74839
|
var detectPmMismatch = (ctx) => {
|
|
74840
|
-
const { npm:
|
|
74840
|
+
const { npm: npm25 } = detectPackageManager();
|
|
74841
74841
|
const projectPath = ctx.project.path;
|
|
74842
|
-
switch (
|
|
74842
|
+
switch (npm25) {
|
|
74843
74843
|
case "npm":
|
|
74844
74844
|
return false;
|
|
74845
74845
|
case "yarn":
|
|
@@ -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 config48 = readMetricsConfig() ?? {};
|
|
74911
|
+
const isFirstUsage = config48.c3permission === void 0;
|
|
74912
74912
|
const isEnabled = isTelemetryEnabled();
|
|
74913
|
-
const deviceId = getDeviceId(
|
|
74913
|
+
const deviceId = getDeviceId(config48);
|
|
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(config48).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(config48 = readMetricsConfig() ?? {}) {
|
|
75053
|
+
if (!config48.c3permission) {
|
|
75054
|
+
config48.c3permission = initializeC3Permission();
|
|
75055
|
+
writeMetricsConfig(config48);
|
|
75056
75056
|
}
|
|
75057
|
-
return
|
|
75057
|
+
return config48.c3permission;
|
|
75058
75058
|
}
|
|
75059
75059
|
function updateC3Pemission(enabled) {
|
|
75060
|
-
const
|
|
75061
|
-
if (
|
|
75060
|
+
const config48 = readMetricsConfig();
|
|
75061
|
+
if (config48.c3permission?.enabled === enabled) {
|
|
75062
75062
|
return;
|
|
75063
75063
|
}
|
|
75064
|
-
|
|
75065
|
-
writeMetricsConfig(
|
|
75064
|
+
config48.c3permission = initializeC3Permission(enabled);
|
|
75065
|
+
writeMetricsConfig(config48);
|
|
75066
75066
|
}
|
|
75067
75067
|
var runTelemetryCommand = (action) => {
|
|
75068
75068
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -75107,39 +75107,39 @@ 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,
|
|
75111
|
-
const { npm:
|
|
75110
|
+
var installPackages = async (packages, config48 = {}) => {
|
|
75111
|
+
const { npm: npm25 } = detectPackageManager();
|
|
75112
75112
|
let saveFlag;
|
|
75113
75113
|
let cmd;
|
|
75114
|
-
switch (
|
|
75114
|
+
switch (npm25) {
|
|
75115
75115
|
case "yarn":
|
|
75116
75116
|
cmd = "add";
|
|
75117
|
-
saveFlag =
|
|
75117
|
+
saveFlag = config48.dev ? "-D" : "";
|
|
75118
75118
|
break;
|
|
75119
75119
|
case "bun":
|
|
75120
75120
|
cmd = "add";
|
|
75121
|
-
saveFlag =
|
|
75121
|
+
saveFlag = config48.dev ? "-d" : "";
|
|
75122
75122
|
break;
|
|
75123
75123
|
case "npm":
|
|
75124
75124
|
case "pnpm":
|
|
75125
75125
|
default:
|
|
75126
75126
|
cmd = "install";
|
|
75127
|
-
saveFlag =
|
|
75127
|
+
saveFlag = config48.dev ? "--save-dev" : "";
|
|
75128
75128
|
break;
|
|
75129
75129
|
}
|
|
75130
75130
|
await runCommand(
|
|
75131
75131
|
[
|
|
75132
|
-
|
|
75132
|
+
npm25,
|
|
75133
75133
|
cmd,
|
|
75134
75134
|
...saveFlag ? [saveFlag] : [],
|
|
75135
75135
|
...packages,
|
|
75136
75136
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
75137
75137
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
75138
75138
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
75139
|
-
...
|
|
75139
|
+
...npm25 === "npm" ? ["--legacy-peer-deps"] : []
|
|
75140
75140
|
],
|
|
75141
75141
|
{
|
|
75142
|
-
...
|
|
75142
|
+
...config48,
|
|
75143
75143
|
silent: true
|
|
75144
75144
|
}
|
|
75145
75145
|
);
|
|
@@ -75149,16 +75149,16 @@ var npmInstall = async (ctx) => {
|
|
|
75149
75149
|
if ((0, import_fs6.existsSync)(nodeModulesPath)) {
|
|
75150
75150
|
return;
|
|
75151
75151
|
}
|
|
75152
|
-
const { npm:
|
|
75152
|
+
const { npm: npm25 } = detectPackageManager();
|
|
75153
75153
|
await runCommand(
|
|
75154
75154
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
75155
75155
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
75156
75156
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
75157
|
-
[
|
|
75157
|
+
[npm25, "install", ...npm25 === "npm" ? ["--legacy-peer-deps"] : []],
|
|
75158
75158
|
{
|
|
75159
75159
|
silent: true,
|
|
75160
75160
|
startText: "Installing dependencies",
|
|
75161
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75161
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
75162
75162
|
}
|
|
75163
75163
|
);
|
|
75164
75164
|
};
|
|
@@ -75168,14 +75168,14 @@ async function getLatestPackageVersion(packageSpecifier) {
|
|
|
75168
75168
|
return npmInfo["dist-tags"].latest;
|
|
75169
75169
|
}
|
|
75170
75170
|
var installWrangler = async () => {
|
|
75171
|
-
const { npm:
|
|
75171
|
+
const { npm: npm25 } = detectPackageManager();
|
|
75172
75172
|
await installPackages([`wrangler@latest`], {
|
|
75173
75173
|
dev: true,
|
|
75174
75174
|
startText: `Installing wrangler ${dim(
|
|
75175
75175
|
"A command line tool for building Cloudflare Workers"
|
|
75176
75176
|
)}`,
|
|
75177
75177
|
doneText: `${brandColor("installed")} ${dim(
|
|
75178
|
-
`via \`${
|
|
75178
|
+
`via \`${npm25} install wrangler --save-dev\``
|
|
75179
75179
|
)}`
|
|
75180
75180
|
});
|
|
75181
75181
|
};
|
|
@@ -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
|
|
|
@@ -75335,20 +75335,21 @@ var package_default = {
|
|
|
75335
75335
|
"so that we can use dependabot to update these dependencies automatically."
|
|
75336
75336
|
],
|
|
75337
75337
|
dependencies: {
|
|
75338
|
-
"create-astro": "4.11.
|
|
75338
|
+
"create-astro": "4.11.3",
|
|
75339
75339
|
"create-analog": "1.8.1",
|
|
75340
|
-
"@angular/create": "19.
|
|
75340
|
+
"@angular/create": "19.2.9",
|
|
75341
75341
|
"create-docusaurus": "3.7.0",
|
|
75342
|
-
"create-hono": "0.
|
|
75343
|
-
"create-next-app": "15.
|
|
75344
|
-
"create-qwik": "1.
|
|
75345
|
-
"create-vite": "6.
|
|
75346
|
-
"create-remix": "2.
|
|
75347
|
-
"create-
|
|
75348
|
-
"create-
|
|
75349
|
-
|
|
75350
|
-
|
|
75351
|
-
|
|
75342
|
+
"create-hono": "0.18.0",
|
|
75343
|
+
"create-next-app": "15.3.1",
|
|
75344
|
+
"create-qwik": "1.13.0",
|
|
75345
|
+
"create-vite": "6.4.1",
|
|
75346
|
+
"create-remix": "2.16.5",
|
|
75347
|
+
"create-react-router": "7.5.2",
|
|
75348
|
+
"create-solid": "0.6.2",
|
|
75349
|
+
"create-vue": "3.16.4",
|
|
75350
|
+
gatsby: "5.14.3",
|
|
75351
|
+
sv: "0.8.1",
|
|
75352
|
+
nuxi: "3.25.0"
|
|
75352
75353
|
}
|
|
75353
75354
|
};
|
|
75354
75355
|
|
|
@@ -75363,9 +75364,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
75363
75364
|
};
|
|
75364
75365
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
75365
75366
|
const cli = getFrameworkCli(ctx, true);
|
|
75366
|
-
const { npm:
|
|
75367
|
-
const cmd = [...
|
|
75368
|
-
const env3 =
|
|
75367
|
+
const { npm: npm25, dlx } = detectPackageManager();
|
|
75368
|
+
const cmd = [...npm25 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
75369
|
+
const env3 = npm25 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
75369
75370
|
if (ctx.args.additionalArgs?.length) {
|
|
75370
75371
|
cmd.push(...ctx.args.additionalArgs);
|
|
75371
75372
|
}
|
|
@@ -75453,387 +75454,6 @@ var getPropertyName = (newProp) => {
|
|
|
75453
75454
|
return newProp.key.type === "Identifier" ? newProp.key.name : newProp.key.type === "StringLiteral" ? newProp.key.value : null;
|
|
75454
75455
|
};
|
|
75455
75456
|
|
|
75456
|
-
// templates-experimental/astro/c3.ts
|
|
75457
|
-
var recast2 = __toESM(require_main3());
|
|
75458
|
-
var { npx } = detectPackageManager();
|
|
75459
|
-
var generate = async (ctx) => {
|
|
75460
|
-
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
75461
|
-
logRaw("");
|
|
75462
|
-
};
|
|
75463
|
-
var configure = async () => {
|
|
75464
|
-
await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
|
|
75465
|
-
silent: true,
|
|
75466
|
-
startText: "Installing adapter",
|
|
75467
|
-
doneText: `${brandColor("installed")} ${dim(
|
|
75468
|
-
`via \`${npx} astro add cloudflare\``
|
|
75469
|
-
)}`
|
|
75470
|
-
});
|
|
75471
|
-
updateAstroConfig();
|
|
75472
|
-
};
|
|
75473
|
-
var updateAstroConfig = () => {
|
|
75474
|
-
const filePath = "astro.config.mjs";
|
|
75475
|
-
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
75476
|
-
transformFile(filePath, {
|
|
75477
|
-
visitCallExpression: function(n) {
|
|
75478
|
-
const callee = n.node.callee;
|
|
75479
|
-
if (callee.name !== "cloudflare") {
|
|
75480
|
-
return this.traverse(n);
|
|
75481
|
-
}
|
|
75482
|
-
const b3 = recast2.types.builders;
|
|
75483
|
-
n.node.arguments = [
|
|
75484
|
-
b3.objectExpression([
|
|
75485
|
-
b3.objectProperty(
|
|
75486
|
-
b3.identifier("platformProxy"),
|
|
75487
|
-
b3.objectExpression([
|
|
75488
|
-
b3.objectProperty(b3.identifier("enabled"), b3.booleanLiteral(true))
|
|
75489
|
-
])
|
|
75490
|
-
)
|
|
75491
|
-
])
|
|
75492
|
-
];
|
|
75493
|
-
return false;
|
|
75494
|
-
}
|
|
75495
|
-
});
|
|
75496
|
-
};
|
|
75497
|
-
var config = {
|
|
75498
|
-
configVersion: 1,
|
|
75499
|
-
id: "astro",
|
|
75500
|
-
frameworkCli: "create-astro",
|
|
75501
|
-
platform: "workers",
|
|
75502
|
-
displayName: "Astro",
|
|
75503
|
-
copyFiles: {
|
|
75504
|
-
async selectVariant(ctx) {
|
|
75505
|
-
return usesTypescript(ctx) ? "ts" : "js";
|
|
75506
|
-
},
|
|
75507
|
-
variants: {
|
|
75508
|
-
js: {
|
|
75509
|
-
path: "./templates/js"
|
|
75510
|
-
},
|
|
75511
|
-
ts: {
|
|
75512
|
-
path: "./templates/ts"
|
|
75513
|
-
}
|
|
75514
|
-
}
|
|
75515
|
-
},
|
|
75516
|
-
devScript: "dev",
|
|
75517
|
-
deployScript: "deploy",
|
|
75518
|
-
previewScript: "preview",
|
|
75519
|
-
path: "templates-experimental/astro",
|
|
75520
|
-
generate,
|
|
75521
|
-
configure,
|
|
75522
|
-
transformPackageJson: async (pkgJson, ctx) => ({
|
|
75523
|
-
scripts: {
|
|
75524
|
-
deploy: `astro build && wrangler deploy`,
|
|
75525
|
-
preview: `astro build && wrangler dev`,
|
|
75526
|
-
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
75527
|
-
}
|
|
75528
|
-
})
|
|
75529
|
-
};
|
|
75530
|
-
var c3_default = config;
|
|
75531
|
-
|
|
75532
|
-
// templates-experimental/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
|
|
75591
|
-
var generate2 = async (ctx) => {
|
|
75592
|
-
const { name: pm4 } = detectPackageManager();
|
|
75593
|
-
await runFrameworkGenerator(ctx, [
|
|
75594
|
-
ctx.project.name,
|
|
75595
|
-
"--template",
|
|
75596
|
-
"cloudflare-workers",
|
|
75597
|
-
"--install",
|
|
75598
|
-
"--pm",
|
|
75599
|
-
pm4
|
|
75600
|
-
]);
|
|
75601
|
-
logRaw("");
|
|
75602
|
-
};
|
|
75603
|
-
var config4 = {
|
|
75604
|
-
configVersion: 1,
|
|
75605
|
-
id: "hono",
|
|
75606
|
-
frameworkCli: "create-hono",
|
|
75607
|
-
displayName: "Hono",
|
|
75608
|
-
copyFiles: {
|
|
75609
|
-
path: "./templates"
|
|
75610
|
-
},
|
|
75611
|
-
platform: "workers",
|
|
75612
|
-
path: "templates-experimental/hono",
|
|
75613
|
-
generate: generate2,
|
|
75614
|
-
transformPackageJson: async () => ({
|
|
75615
|
-
scripts: {
|
|
75616
|
-
dev: "wrangler dev",
|
|
75617
|
-
deploy: "wrangler deploy --minify",
|
|
75618
|
-
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
75619
|
-
}
|
|
75620
|
-
}),
|
|
75621
|
-
devScript: "dev",
|
|
75622
|
-
deployScript: "deploy",
|
|
75623
|
-
previewScript: "dev"
|
|
75624
|
-
};
|
|
75625
|
-
var c3_default5 = config4;
|
|
75626
|
-
|
|
75627
|
-
// templates-experimental/next/c3.ts
|
|
75628
|
-
var generate3 = async (ctx) => {
|
|
75629
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
75630
|
-
};
|
|
75631
|
-
var configure2 = async (ctx) => {
|
|
75632
|
-
const packages = [
|
|
75633
|
-
"@opennextjs/cloudflare@0.5.x",
|
|
75634
|
-
"@cloudflare/workers-types"
|
|
75635
|
-
];
|
|
75636
|
-
await installPackages(packages, {
|
|
75637
|
-
dev: true,
|
|
75638
|
-
startText: "Adding the Cloudflare adapter",
|
|
75639
|
-
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
75640
|
-
});
|
|
75641
|
-
const usesTs = usesTypescript(ctx);
|
|
75642
|
-
updateNextConfig(usesTs);
|
|
75643
|
-
};
|
|
75644
|
-
var updateNextConfig = (usesTs) => {
|
|
75645
|
-
const s = spinner();
|
|
75646
|
-
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
75647
|
-
s.start(`Updating \`${configFile}\``);
|
|
75648
|
-
const configContent = readFile(configFile);
|
|
75649
|
-
const updatedConfigFile = configContent + `
|
|
75650
|
-
// added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
|
|
75651
|
-
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
75652
|
-
initOpenNextCloudflareForDev();
|
|
75653
|
-
`.replace(/\n\t*/g, "\n");
|
|
75654
|
-
writeFile2(configFile, updatedConfigFile);
|
|
75655
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
75656
|
-
};
|
|
75657
|
-
var c3_default6 = {
|
|
75658
|
-
configVersion: 1,
|
|
75659
|
-
id: "next",
|
|
75660
|
-
frameworkCli: "create-next-app",
|
|
75661
|
-
// TODO: Stop using a pinned version when the template graduates.
|
|
75662
|
-
frameworkCliPinnedVersion: "~15.2.2",
|
|
75663
|
-
platform: "workers",
|
|
75664
|
-
displayName: "Next.js (using Node.js compat + Workers Assets)",
|
|
75665
|
-
path: "templates-experimental/next",
|
|
75666
|
-
copyFiles: {
|
|
75667
|
-
path: "./templates"
|
|
75668
|
-
},
|
|
75669
|
-
generate: generate3,
|
|
75670
|
-
configure: configure2,
|
|
75671
|
-
transformPackageJson: async () => ({
|
|
75672
|
-
scripts: {
|
|
75673
|
-
deploy: `opennextjs-cloudflare && wrangler deploy`,
|
|
75674
|
-
preview: `opennextjs-cloudflare && wrangler dev`,
|
|
75675
|
-
"cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
|
|
75676
|
-
}
|
|
75677
|
-
}),
|
|
75678
|
-
devScript: "dev",
|
|
75679
|
-
previewScript: "preview",
|
|
75680
|
-
deployScript: "deploy",
|
|
75681
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
75682
|
-
};
|
|
75683
|
-
|
|
75684
|
-
// templates-experimental/qwik/c3.ts
|
|
75685
|
-
var recast3 = __toESM(require_main3());
|
|
75686
|
-
var { npm, npx: npx2, name } = detectPackageManager();
|
|
75687
|
-
var generate4 = async (ctx) => {
|
|
75688
|
-
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
75689
|
-
};
|
|
75690
|
-
var configure3 = async (ctx) => {
|
|
75691
|
-
const cmd = [name === "pnpm" ? npm : npx2, "qwik", "add", "cloudflare-pages"];
|
|
75692
|
-
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
75693
|
-
await runCommand(cmd);
|
|
75694
|
-
removeFile("./public/_headers");
|
|
75695
|
-
removeFile("./public/_redirects");
|
|
75696
|
-
removeFile("./public/_routes.json");
|
|
75697
|
-
addBindingsProxy(ctx);
|
|
75698
|
-
populateCloudflareEnv();
|
|
75699
|
-
};
|
|
75700
|
-
var addBindingsProxy = (ctx) => {
|
|
75701
|
-
if (!usesTypescript(ctx)) {
|
|
75702
|
-
return;
|
|
75703
|
-
}
|
|
75704
|
-
const s = spinner();
|
|
75705
|
-
s.start("Updating `vite.config.ts`");
|
|
75706
|
-
const snippets = loadTemplateSnippets(ctx);
|
|
75707
|
-
const b3 = recast3.types.builders;
|
|
75708
|
-
transformFile("vite.config.ts", {
|
|
75709
|
-
// Insert the env declaration after the last import (but before the rest of the body)
|
|
75710
|
-
visitProgram: function(n) {
|
|
75711
|
-
const lastImportIndex = n.node.body.findLastIndex(
|
|
75712
|
-
(t2) => t2.type === "ImportDeclaration"
|
|
75713
|
-
);
|
|
75714
|
-
const lastImport = n.get("body", lastImportIndex);
|
|
75715
|
-
lastImport.insertAfter(...snippets.getPlatformProxyTs);
|
|
75716
|
-
return this.traverse(n);
|
|
75717
|
-
},
|
|
75718
|
-
// Pass the `platform` object from the declaration to the `qwikCity` plugin
|
|
75719
|
-
visitCallExpression: function(n) {
|
|
75720
|
-
const callee = n.node.callee;
|
|
75721
|
-
if (callee.name !== "qwikCity") {
|
|
75722
|
-
return this.traverse(n);
|
|
75723
|
-
}
|
|
75724
|
-
const configArgument = n.node.arguments[0];
|
|
75725
|
-
const platformPropery = b3.objectProperty.from({
|
|
75726
|
-
key: b3.identifier("platform"),
|
|
75727
|
-
value: b3.identifier("platform"),
|
|
75728
|
-
shorthand: true
|
|
75729
|
-
});
|
|
75730
|
-
if (!configArgument) {
|
|
75731
|
-
n.node.arguments = [b3.objectExpression([platformPropery])];
|
|
75732
|
-
return false;
|
|
75733
|
-
}
|
|
75734
|
-
if (configArgument.type !== "ObjectExpression") {
|
|
75735
|
-
crash("Failed to update `vite.config.ts`");
|
|
75736
|
-
}
|
|
75737
|
-
configArgument.properties.push(platformPropery);
|
|
75738
|
-
return false;
|
|
75739
|
-
}
|
|
75740
|
-
});
|
|
75741
|
-
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
75742
|
-
};
|
|
75743
|
-
var populateCloudflareEnv = () => {
|
|
75744
|
-
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
75745
|
-
const s = spinner();
|
|
75746
|
-
s.start(`Updating \`${entrypointPath}\``);
|
|
75747
|
-
transformFile(entrypointPath, {
|
|
75748
|
-
visitTSInterfaceDeclaration: function(n) {
|
|
75749
|
-
const b3 = recast3.types.builders;
|
|
75750
|
-
const id = n.node.id;
|
|
75751
|
-
if (id.name !== "QwikCityPlatform") {
|
|
75752
|
-
this.traverse(n);
|
|
75753
|
-
}
|
|
75754
|
-
const newBody = [
|
|
75755
|
-
["env", "Env"]
|
|
75756
|
-
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
75757
|
-
// ["cf", "CfProperties"],
|
|
75758
|
-
].map(
|
|
75759
|
-
([varName, type]) => b3.tsPropertySignature(
|
|
75760
|
-
b3.identifier(varName),
|
|
75761
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
|
|
75762
|
-
)
|
|
75763
|
-
);
|
|
75764
|
-
n.node.body.body = newBody;
|
|
75765
|
-
return false;
|
|
75766
|
-
}
|
|
75767
|
-
});
|
|
75768
|
-
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
75769
|
-
};
|
|
75770
|
-
var config5 = {
|
|
75771
|
-
configVersion: 1,
|
|
75772
|
-
id: "qwik",
|
|
75773
|
-
frameworkCli: "create-qwik",
|
|
75774
|
-
displayName: "Qwik",
|
|
75775
|
-
platform: "workers",
|
|
75776
|
-
copyFiles: {
|
|
75777
|
-
path: "./templates"
|
|
75778
|
-
},
|
|
75779
|
-
path: "templates-experimental/qwik",
|
|
75780
|
-
generate: generate4,
|
|
75781
|
-
configure: configure3,
|
|
75782
|
-
transformPackageJson: async () => ({
|
|
75783
|
-
scripts: {
|
|
75784
|
-
deploy: `${npm} run build && wrangler deploy`,
|
|
75785
|
-
preview: `${npm} run build && wrangler dev`,
|
|
75786
|
-
"cf-typegen": `wrangler types`
|
|
75787
|
-
}
|
|
75788
|
-
}),
|
|
75789
|
-
devScript: "dev",
|
|
75790
|
-
deployScript: "deploy",
|
|
75791
|
-
previewScript: "preview"
|
|
75792
|
-
};
|
|
75793
|
-
var c3_default7 = config5;
|
|
75794
|
-
|
|
75795
|
-
// templates-experimental/remix/c3.ts
|
|
75796
|
-
var { npm: npm2 } = detectPackageManager();
|
|
75797
|
-
var generate5 = async (ctx) => {
|
|
75798
|
-
await runFrameworkGenerator(ctx, [
|
|
75799
|
-
ctx.project.name,
|
|
75800
|
-
"--template",
|
|
75801
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
75802
|
-
]);
|
|
75803
|
-
logRaw("");
|
|
75804
|
-
};
|
|
75805
|
-
var configure4 = async () => {
|
|
75806
|
-
await installPackages(["wrangler@latest"], {
|
|
75807
|
-
dev: true,
|
|
75808
|
-
startText: "Updating the Wrangler version",
|
|
75809
|
-
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
75810
|
-
});
|
|
75811
|
-
};
|
|
75812
|
-
var config6 = {
|
|
75813
|
-
configVersion: 1,
|
|
75814
|
-
id: "remix",
|
|
75815
|
-
frameworkCli: "create-remix",
|
|
75816
|
-
platform: "workers",
|
|
75817
|
-
displayName: "Remix",
|
|
75818
|
-
copyFiles: {
|
|
75819
|
-
path: "./templates"
|
|
75820
|
-
},
|
|
75821
|
-
path: "templates-experimental/remix",
|
|
75822
|
-
generate: generate5,
|
|
75823
|
-
configure: configure4,
|
|
75824
|
-
transformPackageJson: async () => ({
|
|
75825
|
-
scripts: {
|
|
75826
|
-
deploy: `${npm2} run build && wrangler deploy`,
|
|
75827
|
-
preview: `${npm2} run build && wrangler dev`,
|
|
75828
|
-
"cf-typegen": `wrangler types`
|
|
75829
|
-
}
|
|
75830
|
-
}),
|
|
75831
|
-
devScript: "dev",
|
|
75832
|
-
deployScript: "deploy",
|
|
75833
|
-
previewScript: "preview"
|
|
75834
|
-
};
|
|
75835
|
-
var c3_default8 = config6;
|
|
75836
|
-
|
|
75837
75457
|
// src/helpers/compatDate.ts
|
|
75838
75458
|
var import_fs9 = require("fs");
|
|
75839
75459
|
var import_path9 = require("path");
|
|
@@ -75887,18 +75507,18 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
75887
75507
|
}
|
|
75888
75508
|
|
|
75889
75509
|
// templates-experimental/solid/c3.ts
|
|
75890
|
-
var
|
|
75891
|
-
var { npm
|
|
75892
|
-
var
|
|
75510
|
+
var recast2 = __toESM(require_main3());
|
|
75511
|
+
var { npm } = detectPackageManager();
|
|
75512
|
+
var generate = async (ctx) => {
|
|
75893
75513
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
75894
75514
|
logRaw("");
|
|
75895
75515
|
};
|
|
75896
|
-
var
|
|
75516
|
+
var configure = async (ctx) => {
|
|
75897
75517
|
const packages = ["nitropack"];
|
|
75898
75518
|
await installPackages(packages, {
|
|
75899
75519
|
dev: true,
|
|
75900
75520
|
startText: "Installing nitro module `nitropack`",
|
|
75901
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75521
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
|
|
75902
75522
|
});
|
|
75903
75523
|
usesTypescript(ctx);
|
|
75904
75524
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -75910,7 +75530,7 @@ var configure5 = async (ctx) => {
|
|
|
75910
75530
|
if (callee.name !== "defineConfig") {
|
|
75911
75531
|
return this.traverse(n);
|
|
75912
75532
|
}
|
|
75913
|
-
const b3 =
|
|
75533
|
+
const b3 = recast2.types.builders;
|
|
75914
75534
|
mergeObjectProperties(
|
|
75915
75535
|
n.node.arguments[0],
|
|
75916
75536
|
[
|
|
@@ -75934,7 +75554,7 @@ var configure5 = async (ctx) => {
|
|
|
75934
75554
|
}
|
|
75935
75555
|
});
|
|
75936
75556
|
};
|
|
75937
|
-
var
|
|
75557
|
+
var config = {
|
|
75938
75558
|
configVersion: 1,
|
|
75939
75559
|
id: "solid",
|
|
75940
75560
|
frameworkCli: "create-solid",
|
|
@@ -75944,12 +75564,12 @@ var config7 = {
|
|
|
75944
75564
|
path: "./templates"
|
|
75945
75565
|
},
|
|
75946
75566
|
path: "templates-experimental/solid",
|
|
75947
|
-
generate
|
|
75948
|
-
configure
|
|
75567
|
+
generate,
|
|
75568
|
+
configure,
|
|
75949
75569
|
transformPackageJson: async () => ({
|
|
75950
75570
|
scripts: {
|
|
75951
|
-
preview: `${
|
|
75952
|
-
deploy: `${
|
|
75571
|
+
preview: `${npm} run build && npx wrangler dev`,
|
|
75572
|
+
deploy: `${npm} run build && wrangler deploy`
|
|
75953
75573
|
}
|
|
75954
75574
|
}),
|
|
75955
75575
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -75957,111 +75577,12 @@ var config7 = {
|
|
|
75957
75577
|
deployScript: "deploy",
|
|
75958
75578
|
previewScript: "preview"
|
|
75959
75579
|
};
|
|
75960
|
-
var
|
|
75961
|
-
|
|
75962
|
-
// templates-experimental/svelte/c3.ts
|
|
75963
|
-
var import_node_os3 = require("node:os");
|
|
75964
|
-
var recast5 = __toESM(require_main3());
|
|
75965
|
-
var { npm: npm4 } = detectPackageManager();
|
|
75966
|
-
var generate7 = async (ctx) => {
|
|
75967
|
-
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
75968
|
-
logRaw("");
|
|
75969
|
-
};
|
|
75970
|
-
var configure6 = async (ctx) => {
|
|
75971
|
-
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
75972
|
-
await installPackages([pkg], {
|
|
75973
|
-
dev: true,
|
|
75974
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
75975
|
-
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
75976
|
-
});
|
|
75977
|
-
updateSvelteConfig();
|
|
75978
|
-
updateTypeDefinitions(ctx);
|
|
75979
|
-
};
|
|
75980
|
-
var updateSvelteConfig = () => {
|
|
75981
|
-
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
75982
|
-
transformFile("svelte.config.js", {
|
|
75983
|
-
visitImportDeclaration: function(n) {
|
|
75984
|
-
const importSource = n.value.source;
|
|
75985
|
-
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
75986
|
-
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
75987
|
-
}
|
|
75988
|
-
return false;
|
|
75989
|
-
}
|
|
75990
|
-
});
|
|
75991
|
-
};
|
|
75992
|
-
var updateTypeDefinitions = (ctx) => {
|
|
75993
|
-
if (!usesTypescript(ctx)) {
|
|
75994
|
-
return;
|
|
75995
|
-
}
|
|
75996
|
-
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
75997
|
-
const b3 = recast5.types.builders;
|
|
75998
|
-
transformFile("src/app.d.ts", {
|
|
75999
|
-
visitTSModuleDeclaration(n) {
|
|
76000
|
-
if (n.value.id.name === "App" && n.node.body) {
|
|
76001
|
-
const moduleBlock = n.node.body;
|
|
76002
|
-
const platformInterface = b3.tsInterfaceDeclaration(
|
|
76003
|
-
b3.identifier("Platform"),
|
|
76004
|
-
b3.tsInterfaceBody([
|
|
76005
|
-
b3.tsPropertySignature(
|
|
76006
|
-
b3.identifier("env"),
|
|
76007
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
76008
|
-
),
|
|
76009
|
-
b3.tsPropertySignature(
|
|
76010
|
-
b3.identifier("cf"),
|
|
76011
|
-
b3.tsTypeAnnotation(
|
|
76012
|
-
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
76013
|
-
)
|
|
76014
|
-
),
|
|
76015
|
-
b3.tsPropertySignature(
|
|
76016
|
-
b3.identifier("ctx"),
|
|
76017
|
-
b3.tsTypeAnnotation(
|
|
76018
|
-
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
76019
|
-
)
|
|
76020
|
-
)
|
|
76021
|
-
])
|
|
76022
|
-
);
|
|
76023
|
-
moduleBlock.body.unshift(platformInterface);
|
|
76024
|
-
}
|
|
76025
|
-
this.traverse(n);
|
|
76026
|
-
}
|
|
76027
|
-
});
|
|
76028
|
-
};
|
|
76029
|
-
var config8 = {
|
|
76030
|
-
configVersion: 1,
|
|
76031
|
-
id: "svelte",
|
|
76032
|
-
frameworkCli: "sv",
|
|
76033
|
-
displayName: "SvelteKit",
|
|
76034
|
-
platform: "workers",
|
|
76035
|
-
copyFiles: {
|
|
76036
|
-
path: "./templates"
|
|
76037
|
-
},
|
|
76038
|
-
path: "templates-experimental/svelte",
|
|
76039
|
-
generate: generate7,
|
|
76040
|
-
configure: configure6,
|
|
76041
|
-
transformPackageJson: async (original, ctx) => {
|
|
76042
|
-
let scripts = {
|
|
76043
|
-
preview: `${npm4} run build && wrangler dev`,
|
|
76044
|
-
deploy: `${npm4} run build && wrangler deploy`
|
|
76045
|
-
};
|
|
76046
|
-
if (usesTypescript(ctx)) {
|
|
76047
|
-
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
76048
|
-
scripts = {
|
|
76049
|
-
...scripts,
|
|
76050
|
-
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
76051
|
-
};
|
|
76052
|
-
}
|
|
76053
|
-
return { scripts };
|
|
76054
|
-
},
|
|
76055
|
-
devScript: "dev",
|
|
76056
|
-
deployScript: "deploy",
|
|
76057
|
-
previewScript: "preview"
|
|
76058
|
-
};
|
|
76059
|
-
var c3_default10 = config8;
|
|
75580
|
+
var c3_default = config;
|
|
76060
75581
|
|
|
76061
75582
|
// templates/analog/c3.ts
|
|
76062
|
-
var
|
|
76063
|
-
var { npm:
|
|
76064
|
-
var
|
|
75583
|
+
var recast3 = __toESM(require_main3());
|
|
75584
|
+
var { npm: npm2, name: pm } = detectPackageManager();
|
|
75585
|
+
var generate2 = async (ctx) => {
|
|
76065
75586
|
await runFrameworkGenerator(ctx, [
|
|
76066
75587
|
ctx.project.name,
|
|
76067
75588
|
"--template",
|
|
@@ -76069,7 +75590,7 @@ var generate8 = async (ctx) => {
|
|
|
76069
75590
|
]);
|
|
76070
75591
|
logRaw("");
|
|
76071
75592
|
};
|
|
76072
|
-
var
|
|
75593
|
+
var configure2 = async (ctx) => {
|
|
76073
75594
|
if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
|
|
76074
75595
|
const packages = [];
|
|
76075
75596
|
packages.push("nitropack");
|
|
@@ -76079,7 +75600,7 @@ var configure7 = async (ctx) => {
|
|
|
76079
75600
|
await installPackages(packages, {
|
|
76080
75601
|
dev: true,
|
|
76081
75602
|
startText: `Installing ${packages.join(", ")}`,
|
|
76082
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75603
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
|
|
76083
75604
|
});
|
|
76084
75605
|
}
|
|
76085
75606
|
updateViteConfig(ctx);
|
|
@@ -76100,7 +75621,7 @@ var updateEnvTypes = (ctx) => {
|
|
|
76100
75621
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76101
75622
|
};
|
|
76102
75623
|
var updateViteConfig = (ctx) => {
|
|
76103
|
-
const b3 =
|
|
75624
|
+
const b3 = recast3.types.builders;
|
|
76104
75625
|
const s = spinner();
|
|
76105
75626
|
const configFile = "vite.config.ts";
|
|
76106
75627
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76137,7 +75658,7 @@ var updateViteConfig = (ctx) => {
|
|
|
76137
75658
|
});
|
|
76138
75659
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76139
75660
|
};
|
|
76140
|
-
var
|
|
75661
|
+
var config2 = {
|
|
76141
75662
|
configVersion: 1,
|
|
76142
75663
|
id: "analog",
|
|
76143
75664
|
frameworkCli: "create-analog",
|
|
@@ -76146,12 +75667,12 @@ var config9 = {
|
|
|
76146
75667
|
copyFiles: {
|
|
76147
75668
|
path: "./templates"
|
|
76148
75669
|
},
|
|
76149
|
-
generate:
|
|
76150
|
-
configure:
|
|
75670
|
+
generate: generate2,
|
|
75671
|
+
configure: configure2,
|
|
76151
75672
|
transformPackageJson: async () => ({
|
|
76152
75673
|
scripts: {
|
|
76153
|
-
preview: `${
|
|
76154
|
-
deploy: `${
|
|
75674
|
+
preview: `${npm2} run build && wrangler pages dev`,
|
|
75675
|
+
deploy: `${npm2} run build && wrangler pages deploy`,
|
|
76155
75676
|
"cf-typegen": `wrangler types`
|
|
76156
75677
|
}
|
|
76157
75678
|
}),
|
|
@@ -76159,12 +75680,12 @@ var config9 = {
|
|
|
76159
75680
|
deployScript: "deploy",
|
|
76160
75681
|
previewScript: "preview"
|
|
76161
75682
|
};
|
|
76162
|
-
var
|
|
75683
|
+
var c3_default2 = config2;
|
|
76163
75684
|
|
|
76164
75685
|
// templates/angular/pages/c3.ts
|
|
76165
75686
|
var import_node_path3 = require("node:path");
|
|
76166
|
-
var { npm:
|
|
76167
|
-
var
|
|
75687
|
+
var { npm: npm3 } = detectPackageManager();
|
|
75688
|
+
var generate3 = async (ctx) => {
|
|
76168
75689
|
await runFrameworkGenerator(ctx, [
|
|
76169
75690
|
ctx.project.name,
|
|
76170
75691
|
"--ssr",
|
|
@@ -76172,7 +75693,7 @@ var generate9 = async (ctx) => {
|
|
|
76172
75693
|
]);
|
|
76173
75694
|
logRaw("");
|
|
76174
75695
|
};
|
|
76175
|
-
var
|
|
75696
|
+
var configure3 = async (ctx) => {
|
|
76176
75697
|
updateAngularJson(ctx);
|
|
76177
75698
|
await updateAppCode();
|
|
76178
75699
|
await installCFWorker();
|
|
@@ -76181,7 +75702,7 @@ async function installCFWorker() {
|
|
|
76181
75702
|
await installPackages(["xhr2"], {
|
|
76182
75703
|
dev: true,
|
|
76183
75704
|
startText: "Installing additional dependencies",
|
|
76184
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75705
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
|
|
76185
75706
|
});
|
|
76186
75707
|
}
|
|
76187
75708
|
async function updateAppCode() {
|
|
@@ -76223,12 +75744,13 @@ function updateAngularJson(ctx) {
|
|
|
76223
75744
|
writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76224
75745
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76225
75746
|
}
|
|
76226
|
-
var
|
|
75747
|
+
var config3 = {
|
|
76227
75748
|
configVersion: 1,
|
|
76228
75749
|
id: "angular",
|
|
76229
75750
|
frameworkCli: "@angular/create",
|
|
76230
75751
|
displayName: "Angular",
|
|
76231
75752
|
platform: "pages",
|
|
75753
|
+
hidden: true,
|
|
76232
75754
|
copyFiles: {
|
|
76233
75755
|
path: "./templates"
|
|
76234
75756
|
},
|
|
@@ -76236,23 +75758,23 @@ var config10 = {
|
|
|
76236
75758
|
devScript: "start",
|
|
76237
75759
|
deployScript: "deploy",
|
|
76238
75760
|
previewScript: "start",
|
|
76239
|
-
generate:
|
|
76240
|
-
configure:
|
|
75761
|
+
generate: generate3,
|
|
75762
|
+
configure: configure3,
|
|
76241
75763
|
transformPackageJson: async () => ({
|
|
76242
75764
|
scripts: {
|
|
76243
|
-
start: `${
|
|
76244
|
-
build: `ng build && ${
|
|
75765
|
+
start: `${npm3} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
75766
|
+
build: `ng build && ${npm3} run process`,
|
|
76245
75767
|
process: "node ./tools/copy-files.mjs",
|
|
76246
|
-
deploy: `${
|
|
75768
|
+
deploy: `${npm3} run build && wrangler pages deploy dist/cloudflare`
|
|
76247
75769
|
}
|
|
76248
75770
|
})
|
|
76249
75771
|
};
|
|
76250
|
-
var
|
|
75772
|
+
var c3_default3 = config3;
|
|
76251
75773
|
|
|
76252
75774
|
// templates/angular/workers/c3.ts
|
|
76253
75775
|
var import_node_path4 = require("node:path");
|
|
76254
|
-
var { npm:
|
|
76255
|
-
var
|
|
75776
|
+
var { npm: npm4 } = detectPackageManager();
|
|
75777
|
+
var generate4 = async (ctx) => {
|
|
76256
75778
|
await runFrameworkGenerator(ctx, [
|
|
76257
75779
|
ctx.project.name,
|
|
76258
75780
|
"--ssr",
|
|
@@ -76260,7 +75782,7 @@ var generate10 = async (ctx) => {
|
|
|
76260
75782
|
]);
|
|
76261
75783
|
logRaw("");
|
|
76262
75784
|
};
|
|
76263
|
-
var
|
|
75785
|
+
var configure4 = async (ctx) => {
|
|
76264
75786
|
updateAngularJson2(ctx);
|
|
76265
75787
|
await updateAppCode2();
|
|
76266
75788
|
await installCFWorker2();
|
|
@@ -76269,7 +75791,7 @@ async function installCFWorker2() {
|
|
|
76269
75791
|
await installPackages(["xhr2"], {
|
|
76270
75792
|
dev: true,
|
|
76271
75793
|
startText: "Installing additional dependencies",
|
|
76272
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75794
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
|
|
76273
75795
|
});
|
|
76274
75796
|
}
|
|
76275
75797
|
async function updateAppCode2() {
|
|
@@ -76310,7 +75832,7 @@ function updateAngularJson2(ctx) {
|
|
|
76310
75832
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76311
75833
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76312
75834
|
}
|
|
76313
|
-
var
|
|
75835
|
+
var config4 = {
|
|
76314
75836
|
configVersion: 1,
|
|
76315
75837
|
id: "angular",
|
|
76316
75838
|
frameworkCli: "@angular/create",
|
|
@@ -76323,43 +75845,43 @@ var config11 = {
|
|
|
76323
75845
|
devScript: "start",
|
|
76324
75846
|
deployScript: "deploy",
|
|
76325
75847
|
previewScript: "start",
|
|
76326
|
-
generate:
|
|
76327
|
-
configure:
|
|
75848
|
+
generate: generate4,
|
|
75849
|
+
configure: configure4,
|
|
76328
75850
|
transformPackageJson: async () => ({
|
|
76329
75851
|
scripts: {
|
|
76330
|
-
start: `${
|
|
75852
|
+
start: `${npm4} run build && wrangler dev`,
|
|
76331
75853
|
build: `ng build`,
|
|
76332
|
-
deploy: `${
|
|
75854
|
+
deploy: `${npm4} run build && wrangler deploy`
|
|
76333
75855
|
}
|
|
76334
75856
|
})
|
|
76335
75857
|
};
|
|
76336
|
-
var
|
|
75858
|
+
var c3_default4 = config4;
|
|
76337
75859
|
|
|
76338
75860
|
// templates/angular/c3.ts
|
|
76339
|
-
var
|
|
75861
|
+
var config5 = {
|
|
76340
75862
|
displayName: "Angular",
|
|
76341
|
-
platformVariants: { pages:
|
|
75863
|
+
platformVariants: { pages: c3_default3, workers: c3_default4 }
|
|
76342
75864
|
};
|
|
76343
|
-
var
|
|
75865
|
+
var c3_default5 = config5;
|
|
76344
75866
|
|
|
76345
|
-
// templates/astro/c3.ts
|
|
76346
|
-
var
|
|
76347
|
-
var { npx
|
|
76348
|
-
var
|
|
75867
|
+
// templates/astro/pages/c3.ts
|
|
75868
|
+
var recast4 = __toESM(require_main3());
|
|
75869
|
+
var { npx } = detectPackageManager();
|
|
75870
|
+
var generate5 = async (ctx) => {
|
|
76349
75871
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
76350
75872
|
logRaw("");
|
|
76351
75873
|
};
|
|
76352
|
-
var
|
|
76353
|
-
await runCommand([
|
|
75874
|
+
var configure5 = async () => {
|
|
75875
|
+
await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
|
|
76354
75876
|
silent: true,
|
|
76355
75877
|
startText: "Installing adapter",
|
|
76356
75878
|
doneText: `${brandColor("installed")} ${dim(
|
|
76357
|
-
`via \`${
|
|
75879
|
+
`via \`${npx} astro add cloudflare\``
|
|
76358
75880
|
)}`
|
|
76359
75881
|
});
|
|
76360
|
-
|
|
75882
|
+
updateAstroConfig();
|
|
76361
75883
|
};
|
|
76362
|
-
var
|
|
75884
|
+
var updateAstroConfig = () => {
|
|
76363
75885
|
const filePath = "astro.config.mjs";
|
|
76364
75886
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
76365
75887
|
transformFile(filePath, {
|
|
@@ -76368,7 +75890,7 @@ var updateAstroConfig2 = () => {
|
|
|
76368
75890
|
if (callee.name !== "cloudflare") {
|
|
76369
75891
|
return this.traverse(n);
|
|
76370
75892
|
}
|
|
76371
|
-
const b3 =
|
|
75893
|
+
const b3 = recast4.types.builders;
|
|
76372
75894
|
n.node.arguments = [
|
|
76373
75895
|
b3.objectExpression([
|
|
76374
75896
|
b3.objectProperty(
|
|
@@ -76383,12 +75905,14 @@ var updateAstroConfig2 = () => {
|
|
|
76383
75905
|
}
|
|
76384
75906
|
});
|
|
76385
75907
|
};
|
|
76386
|
-
var
|
|
75908
|
+
var config6 = {
|
|
76387
75909
|
configVersion: 1,
|
|
76388
75910
|
id: "astro",
|
|
76389
75911
|
frameworkCli: "create-astro",
|
|
76390
75912
|
platform: "pages",
|
|
75913
|
+
hidden: true,
|
|
76391
75914
|
displayName: "Astro",
|
|
75915
|
+
path: "templates/astro/pages",
|
|
76392
75916
|
copyFiles: {
|
|
76393
75917
|
async selectVariant(ctx) {
|
|
76394
75918
|
return usesTypescript(ctx) ? "ts" : "js";
|
|
@@ -76405,8 +75929,8 @@ var config13 = {
|
|
|
76405
75929
|
devScript: "dev",
|
|
76406
75930
|
deployScript: "deploy",
|
|
76407
75931
|
previewScript: "preview",
|
|
76408
|
-
generate:
|
|
76409
|
-
configure:
|
|
75932
|
+
generate: generate5,
|
|
75933
|
+
configure: configure5,
|
|
76410
75934
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
76411
75935
|
scripts: {
|
|
76412
75936
|
deploy: `astro build && wrangler pages deploy`,
|
|
@@ -76415,10 +75939,93 @@ var config13 = {
|
|
|
76415
75939
|
}
|
|
76416
75940
|
})
|
|
76417
75941
|
};
|
|
76418
|
-
var
|
|
75942
|
+
var c3_default6 = config6;
|
|
75943
|
+
|
|
75944
|
+
// templates/astro/workers/c3.ts
|
|
75945
|
+
var recast5 = __toESM(require_main3());
|
|
75946
|
+
var { npx: npx2 } = detectPackageManager();
|
|
75947
|
+
var generate6 = async (ctx) => {
|
|
75948
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
75949
|
+
logRaw("");
|
|
75950
|
+
};
|
|
75951
|
+
var configure6 = async () => {
|
|
75952
|
+
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
75953
|
+
silent: true,
|
|
75954
|
+
startText: "Installing adapter",
|
|
75955
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
75956
|
+
`via \`${npx2} astro add cloudflare\``
|
|
75957
|
+
)}`
|
|
75958
|
+
});
|
|
75959
|
+
updateAstroConfig2();
|
|
75960
|
+
};
|
|
75961
|
+
var updateAstroConfig2 = () => {
|
|
75962
|
+
const filePath = "astro.config.mjs";
|
|
75963
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
75964
|
+
transformFile(filePath, {
|
|
75965
|
+
visitCallExpression: function(n) {
|
|
75966
|
+
const callee = n.node.callee;
|
|
75967
|
+
if (callee.name !== "cloudflare") {
|
|
75968
|
+
return this.traverse(n);
|
|
75969
|
+
}
|
|
75970
|
+
const b3 = recast5.types.builders;
|
|
75971
|
+
n.node.arguments = [
|
|
75972
|
+
b3.objectExpression([
|
|
75973
|
+
b3.objectProperty(
|
|
75974
|
+
b3.identifier("platformProxy"),
|
|
75975
|
+
b3.objectExpression([
|
|
75976
|
+
b3.objectProperty(b3.identifier("enabled"), b3.booleanLiteral(true))
|
|
75977
|
+
])
|
|
75978
|
+
)
|
|
75979
|
+
])
|
|
75980
|
+
];
|
|
75981
|
+
return false;
|
|
75982
|
+
}
|
|
75983
|
+
});
|
|
75984
|
+
};
|
|
75985
|
+
var config7 = {
|
|
75986
|
+
configVersion: 1,
|
|
75987
|
+
id: "astro",
|
|
75988
|
+
frameworkCli: "create-astro",
|
|
75989
|
+
platform: "workers",
|
|
75990
|
+
displayName: "Astro",
|
|
75991
|
+
copyFiles: {
|
|
75992
|
+
async selectVariant(ctx) {
|
|
75993
|
+
return usesTypescript(ctx) ? "ts" : "js";
|
|
75994
|
+
},
|
|
75995
|
+
variants: {
|
|
75996
|
+
js: {
|
|
75997
|
+
path: "./templates/js"
|
|
75998
|
+
},
|
|
75999
|
+
ts: {
|
|
76000
|
+
path: "./templates/ts"
|
|
76001
|
+
}
|
|
76002
|
+
}
|
|
76003
|
+
},
|
|
76004
|
+
devScript: "dev",
|
|
76005
|
+
deployScript: "deploy",
|
|
76006
|
+
previewScript: "preview",
|
|
76007
|
+
path: "templates/astro/workers",
|
|
76008
|
+
generate: generate6,
|
|
76009
|
+
configure: configure6,
|
|
76010
|
+
transformPackageJson: async (pkgJson, ctx) => ({
|
|
76011
|
+
scripts: {
|
|
76012
|
+
deploy: `astro build && wrangler deploy`,
|
|
76013
|
+
preview: `astro build && wrangler dev`,
|
|
76014
|
+
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
76015
|
+
}
|
|
76016
|
+
})
|
|
76017
|
+
};
|
|
76018
|
+
var c3_default7 = config7;
|
|
76019
|
+
|
|
76020
|
+
// templates/astro/c3.ts
|
|
76021
|
+
var config8 = {
|
|
76022
|
+
displayName: "Astro",
|
|
76023
|
+
platformVariants: { pages: c3_default6, workers: c3_default7 }
|
|
76024
|
+
};
|
|
76025
|
+
var c3_default8 = config8;
|
|
76419
76026
|
|
|
76420
76027
|
// templates/common/c3.ts
|
|
76421
|
-
var
|
|
76028
|
+
var config9 = {
|
|
76422
76029
|
configVersion: 1,
|
|
76423
76030
|
id: "common",
|
|
76424
76031
|
displayName: "Example router & proxy Worker",
|
|
@@ -76436,38 +76043,40 @@ var c3_default16 = {
|
|
|
76436
76043
|
}
|
|
76437
76044
|
}
|
|
76438
76045
|
};
|
|
76046
|
+
var c3_default9 = config9;
|
|
76439
76047
|
|
|
76440
76048
|
// templates/docusaurus/pages/c3.ts
|
|
76441
|
-
var { npm:
|
|
76442
|
-
var
|
|
76049
|
+
var { npm: npm5 } = detectPackageManager();
|
|
76050
|
+
var generate7 = async (ctx) => {
|
|
76443
76051
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76444
76052
|
};
|
|
76445
|
-
var
|
|
76053
|
+
var config10 = {
|
|
76446
76054
|
configVersion: 1,
|
|
76447
76055
|
id: "docusaurus",
|
|
76448
76056
|
frameworkCli: "create-docusaurus",
|
|
76449
76057
|
platform: "pages",
|
|
76058
|
+
hidden: true,
|
|
76450
76059
|
displayName: "Docusaurus",
|
|
76451
76060
|
path: "templates/docusaurus/pages",
|
|
76452
|
-
generate:
|
|
76061
|
+
generate: generate7,
|
|
76453
76062
|
transformPackageJson: async () => ({
|
|
76454
76063
|
scripts: {
|
|
76455
|
-
preview: `${
|
|
76456
|
-
deploy: `${
|
|
76064
|
+
preview: `${npm5} run build && wrangler pages dev ./build`,
|
|
76065
|
+
deploy: `${npm5} run build && wrangler pages deploy ./build`
|
|
76457
76066
|
}
|
|
76458
76067
|
}),
|
|
76459
76068
|
devScript: "preview",
|
|
76460
76069
|
deployScript: "deploy",
|
|
76461
76070
|
previewScript: "preview"
|
|
76462
76071
|
};
|
|
76463
|
-
var
|
|
76072
|
+
var c3_default10 = config10;
|
|
76464
76073
|
|
|
76465
76074
|
// templates/docusaurus/workers/c3.ts
|
|
76466
|
-
var { npm:
|
|
76467
|
-
var
|
|
76075
|
+
var { npm: npm6 } = detectPackageManager();
|
|
76076
|
+
var generate8 = async (ctx) => {
|
|
76468
76077
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76469
76078
|
};
|
|
76470
|
-
var
|
|
76079
|
+
var config11 = {
|
|
76471
76080
|
configVersion: 1,
|
|
76472
76081
|
id: "docusaurus",
|
|
76473
76082
|
frameworkCli: "create-docusaurus",
|
|
@@ -76477,29 +76086,29 @@ var config15 = {
|
|
|
76477
76086
|
path: "./templates"
|
|
76478
76087
|
},
|
|
76479
76088
|
path: "templates/docusaurus/workers",
|
|
76480
|
-
generate:
|
|
76089
|
+
generate: generate8,
|
|
76481
76090
|
transformPackageJson: async () => ({
|
|
76482
76091
|
scripts: {
|
|
76483
|
-
deploy: `${
|
|
76484
|
-
preview: `${
|
|
76092
|
+
deploy: `${npm6} run build && wrangler deploy`,
|
|
76093
|
+
preview: `${npm6} run build && wrangler dev`
|
|
76485
76094
|
}
|
|
76486
76095
|
}),
|
|
76487
76096
|
devScript: "start",
|
|
76488
76097
|
deployScript: "deploy",
|
|
76489
76098
|
previewScript: "preview"
|
|
76490
76099
|
};
|
|
76491
|
-
var
|
|
76100
|
+
var c3_default11 = config11;
|
|
76492
76101
|
|
|
76493
76102
|
// templates/docusaurus/c3.ts
|
|
76494
|
-
var
|
|
76103
|
+
var config12 = {
|
|
76495
76104
|
displayName: "Docusaurus",
|
|
76496
|
-
platformVariants: { pages:
|
|
76105
|
+
platformVariants: { pages: c3_default10, workers: c3_default11 }
|
|
76497
76106
|
};
|
|
76498
|
-
var
|
|
76107
|
+
var c3_default12 = config12;
|
|
76499
76108
|
|
|
76500
76109
|
// templates/gatsby/pages/c3.ts
|
|
76501
|
-
var { npm:
|
|
76502
|
-
var
|
|
76110
|
+
var { npm: npm7 } = detectPackageManager();
|
|
76111
|
+
var generate9 = async (ctx) => {
|
|
76503
76112
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76504
76113
|
const useTemplate = await inputPrompt({
|
|
76505
76114
|
type: "confirm",
|
|
@@ -76518,29 +76127,30 @@ var generate14 = async (ctx) => {
|
|
|
76518
76127
|
}
|
|
76519
76128
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76520
76129
|
};
|
|
76521
|
-
var
|
|
76130
|
+
var config13 = {
|
|
76522
76131
|
configVersion: 1,
|
|
76523
76132
|
id: "gatsby",
|
|
76524
76133
|
frameworkCli: "gatsby",
|
|
76525
76134
|
platform: "pages",
|
|
76135
|
+
hidden: true,
|
|
76526
76136
|
displayName: "Gatsby",
|
|
76527
76137
|
path: "templates/gatsby/pages",
|
|
76528
|
-
generate:
|
|
76138
|
+
generate: generate9,
|
|
76529
76139
|
transformPackageJson: async () => ({
|
|
76530
76140
|
scripts: {
|
|
76531
|
-
deploy: `${
|
|
76532
|
-
preview: `${
|
|
76141
|
+
deploy: `${npm7} run build && wrangler pages deploy ./public`,
|
|
76142
|
+
preview: `${npm7} run build && wrangler pages dev ./public`
|
|
76533
76143
|
}
|
|
76534
76144
|
}),
|
|
76535
76145
|
devScript: "develop",
|
|
76536
76146
|
deployScript: "deploy",
|
|
76537
76147
|
previewScript: "preview"
|
|
76538
76148
|
};
|
|
76539
|
-
var
|
|
76149
|
+
var c3_default13 = config13;
|
|
76540
76150
|
|
|
76541
76151
|
// templates/gatsby/workers/c3.ts
|
|
76542
|
-
var { npm:
|
|
76543
|
-
var
|
|
76152
|
+
var { npm: npm8 } = detectPackageManager();
|
|
76153
|
+
var generate10 = async (ctx) => {
|
|
76544
76154
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76545
76155
|
const useTemplate = await inputPrompt({
|
|
76546
76156
|
type: "confirm",
|
|
@@ -76559,7 +76169,7 @@ var generate15 = async (ctx) => {
|
|
|
76559
76169
|
}
|
|
76560
76170
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76561
76171
|
};
|
|
76562
|
-
var
|
|
76172
|
+
var config14 = {
|
|
76563
76173
|
configVersion: 1,
|
|
76564
76174
|
id: "gatsby",
|
|
76565
76175
|
frameworkCli: "gatsby",
|
|
@@ -76569,32 +76179,67 @@ var config18 = {
|
|
|
76569
76179
|
path: "./templates"
|
|
76570
76180
|
},
|
|
76571
76181
|
path: "templates/gatsby/workers",
|
|
76572
|
-
generate:
|
|
76182
|
+
generate: generate10,
|
|
76573
76183
|
transformPackageJson: async () => ({
|
|
76574
76184
|
scripts: {
|
|
76575
|
-
deploy: `${
|
|
76576
|
-
preview: `${
|
|
76185
|
+
deploy: `${npm8} run build && wrangler deploy`,
|
|
76186
|
+
preview: `${npm8} run build && wrangler dev`
|
|
76577
76187
|
}
|
|
76578
76188
|
}),
|
|
76579
76189
|
devScript: "develop",
|
|
76580
76190
|
deployScript: "deploy",
|
|
76581
76191
|
previewScript: "preview"
|
|
76582
76192
|
};
|
|
76583
|
-
var
|
|
76193
|
+
var c3_default14 = config14;
|
|
76584
76194
|
|
|
76585
76195
|
// templates/gatsby/c3.ts
|
|
76586
|
-
var
|
|
76196
|
+
var config15 = {
|
|
76587
76197
|
displayName: "Gatsby",
|
|
76588
|
-
platformVariants: { pages:
|
|
76198
|
+
platformVariants: { pages: c3_default13, workers: c3_default14 }
|
|
76199
|
+
};
|
|
76200
|
+
var c3_default15 = config15;
|
|
76201
|
+
|
|
76202
|
+
// templates/hello-world-assets-only/c3.ts
|
|
76203
|
+
var config16 = {
|
|
76204
|
+
configVersion: 1,
|
|
76205
|
+
id: "hello-world-assets-only",
|
|
76206
|
+
path: "templates/hello-world-assets-only",
|
|
76207
|
+
displayName: "Static site",
|
|
76208
|
+
description: "For static sites or when using your own backend. Uses Workers Static Assets.",
|
|
76209
|
+
platform: "workers",
|
|
76210
|
+
copyFiles: {
|
|
76211
|
+
path: "./templates"
|
|
76212
|
+
}
|
|
76213
|
+
};
|
|
76214
|
+
var c3_default16 = config16;
|
|
76215
|
+
|
|
76216
|
+
// templates/hello-world-durable-object-with-assets/c3.ts
|
|
76217
|
+
var config17 = {
|
|
76218
|
+
configVersion: 1,
|
|
76219
|
+
id: "hello-world-durable-object-with-assets",
|
|
76220
|
+
path: "templates/hello-world-durable-object-with-assets",
|
|
76221
|
+
displayName: "Worker + Durable Objects + Assets",
|
|
76222
|
+
description: "For full-stack applications requiring static assets, an API, and real-time coordination",
|
|
76223
|
+
platform: "workers",
|
|
76224
|
+
copyFiles: {
|
|
76225
|
+
variants: {
|
|
76226
|
+
js: {
|
|
76227
|
+
path: "./js"
|
|
76228
|
+
},
|
|
76229
|
+
ts: {
|
|
76230
|
+
path: "./ts"
|
|
76231
|
+
}
|
|
76232
|
+
}
|
|
76233
|
+
}
|
|
76589
76234
|
};
|
|
76590
|
-
var
|
|
76235
|
+
var c3_default17 = config17;
|
|
76591
76236
|
|
|
76592
76237
|
// templates/hello-world-durable-object/c3.ts
|
|
76593
|
-
var
|
|
76238
|
+
var config18 = {
|
|
76594
76239
|
configVersion: 1,
|
|
76595
76240
|
id: "hello-world-durable-object",
|
|
76596
|
-
displayName: "
|
|
76597
|
-
description: "
|
|
76241
|
+
displayName: "Worker + Durable Objects",
|
|
76242
|
+
description: "For multiplayer apps using WebSockets, or when you need synchronization",
|
|
76598
76243
|
platform: "workers",
|
|
76599
76244
|
copyFiles: {
|
|
76600
76245
|
variants: {
|
|
@@ -76607,15 +76252,40 @@ var c3_default23 = {
|
|
|
76607
76252
|
}
|
|
76608
76253
|
}
|
|
76609
76254
|
};
|
|
76255
|
+
var c3_default18 = config18;
|
|
76256
|
+
|
|
76257
|
+
// templates/hello-world-with-assets/c3.ts
|
|
76258
|
+
var config19 = {
|
|
76259
|
+
configVersion: 1,
|
|
76260
|
+
id: "hello-world-with-assets",
|
|
76261
|
+
path: "templates/hello-world-with-assets",
|
|
76262
|
+
displayName: "SSR / full-stack app",
|
|
76263
|
+
description: "For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
|
|
76264
|
+
platform: "workers",
|
|
76265
|
+
copyFiles: {
|
|
76266
|
+
variants: {
|
|
76267
|
+
js: {
|
|
76268
|
+
path: "./js"
|
|
76269
|
+
},
|
|
76270
|
+
ts: {
|
|
76271
|
+
path: "./ts"
|
|
76272
|
+
},
|
|
76273
|
+
python: {
|
|
76274
|
+
path: "./py"
|
|
76275
|
+
}
|
|
76276
|
+
}
|
|
76277
|
+
}
|
|
76278
|
+
};
|
|
76279
|
+
var c3_default19 = config19;
|
|
76610
76280
|
|
|
76611
76281
|
// templates/hello-world/c3.ts
|
|
76612
76282
|
var import_promises2 = require("node:fs/promises");
|
|
76613
76283
|
var import_node_path5 = require("node:path");
|
|
76614
|
-
var
|
|
76284
|
+
var c3_default20 = {
|
|
76615
76285
|
configVersion: 1,
|
|
76616
76286
|
id: "hello-world",
|
|
76617
|
-
displayName: "
|
|
76618
|
-
description: "
|
|
76287
|
+
displayName: "Worker only",
|
|
76288
|
+
description: "For processing requests, transforming responses, or API endpoints",
|
|
76619
76289
|
platform: "workers",
|
|
76620
76290
|
async configure(ctx) {
|
|
76621
76291
|
if (ctx.args.lang === "python") {
|
|
@@ -76644,35 +76314,57 @@ var c3_default24 = {
|
|
|
76644
76314
|
}
|
|
76645
76315
|
};
|
|
76646
76316
|
|
|
76647
|
-
// templates/hono/c3.ts
|
|
76648
|
-
var
|
|
76317
|
+
// templates/hono/pages/c3.ts
|
|
76318
|
+
var generate11 = async (ctx) => {
|
|
76649
76319
|
const { name: pm4 } = detectPackageManager();
|
|
76650
76320
|
await runFrameworkGenerator(ctx, [
|
|
76651
76321
|
ctx.project.name,
|
|
76652
76322
|
"--template",
|
|
76653
|
-
"cloudflare-
|
|
76323
|
+
"cloudflare-pages",
|
|
76654
76324
|
"--install",
|
|
76655
76325
|
"--pm",
|
|
76656
76326
|
pm4
|
|
76657
76327
|
]);
|
|
76658
76328
|
logRaw("");
|
|
76659
76329
|
};
|
|
76660
|
-
var
|
|
76661
|
-
|
|
76662
|
-
|
|
76663
|
-
|
|
76664
|
-
|
|
76665
|
-
|
|
76666
|
-
|
|
76667
|
-
|
|
76668
|
-
|
|
76669
|
-
|
|
76670
|
-
|
|
76330
|
+
var config20 = {
|
|
76331
|
+
configVersion: 1,
|
|
76332
|
+
id: "hono",
|
|
76333
|
+
frameworkCli: "create-hono",
|
|
76334
|
+
displayName: "Hono",
|
|
76335
|
+
copyFiles: {
|
|
76336
|
+
path: "./templates"
|
|
76337
|
+
},
|
|
76338
|
+
path: "templates/hono/pages",
|
|
76339
|
+
platform: "pages",
|
|
76340
|
+
hidden: true,
|
|
76341
|
+
generate: generate11,
|
|
76342
|
+
transformPackageJson: async () => ({
|
|
76343
|
+
scripts: {
|
|
76344
|
+
"cf-typegen": "wrangler types --env-interface CloudflareBindings",
|
|
76345
|
+
preview: "vite build && wrangler pages dev"
|
|
76671
76346
|
}
|
|
76672
|
-
})
|
|
76673
|
-
|
|
76347
|
+
}),
|
|
76348
|
+
devScript: "dev",
|
|
76349
|
+
deployScript: "deploy",
|
|
76350
|
+
previewScript: "preview"
|
|
76674
76351
|
};
|
|
76675
|
-
var
|
|
76352
|
+
var c3_default21 = config20;
|
|
76353
|
+
|
|
76354
|
+
// templates/hono/workers/c3.ts
|
|
76355
|
+
var generate12 = async (ctx) => {
|
|
76356
|
+
const { name: pm4 } = detectPackageManager();
|
|
76357
|
+
await runFrameworkGenerator(ctx, [
|
|
76358
|
+
ctx.project.name,
|
|
76359
|
+
"--template",
|
|
76360
|
+
"cloudflare-workers",
|
|
76361
|
+
"--install",
|
|
76362
|
+
"--pm",
|
|
76363
|
+
pm4
|
|
76364
|
+
]);
|
|
76365
|
+
logRaw("");
|
|
76366
|
+
};
|
|
76367
|
+
var config21 = {
|
|
76676
76368
|
configVersion: 1,
|
|
76677
76369
|
id: "hono",
|
|
76678
76370
|
frameworkCli: "create-hono",
|
|
@@ -76681,12 +76373,10 @@ var config20 = {
|
|
|
76681
76373
|
path: "./templates"
|
|
76682
76374
|
},
|
|
76683
76375
|
platform: "workers",
|
|
76684
|
-
|
|
76685
|
-
|
|
76376
|
+
path: "templates/hono/workers",
|
|
76377
|
+
generate: generate12,
|
|
76686
76378
|
transformPackageJson: async () => ({
|
|
76687
76379
|
scripts: {
|
|
76688
|
-
dev: "wrangler dev",
|
|
76689
|
-
deploy: "wrangler deploy --minify",
|
|
76690
76380
|
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
76691
76381
|
}
|
|
76692
76382
|
}),
|
|
@@ -76694,19 +76384,26 @@ var config20 = {
|
|
|
76694
76384
|
deployScript: "deploy",
|
|
76695
76385
|
previewScript: "dev"
|
|
76696
76386
|
};
|
|
76697
|
-
var
|
|
76387
|
+
var c3_default22 = config21;
|
|
76698
76388
|
|
|
76699
|
-
// templates/
|
|
76389
|
+
// templates/hono/c3.ts
|
|
76390
|
+
var config22 = {
|
|
76391
|
+
displayName: "Hono",
|
|
76392
|
+
platformVariants: { pages: c3_default21, workers: c3_default22 }
|
|
76393
|
+
};
|
|
76394
|
+
var c3_default23 = config22;
|
|
76395
|
+
|
|
76396
|
+
// templates/next/pages/c3.ts
|
|
76700
76397
|
var import_path10 = require("path");
|
|
76701
|
-
var { npm:
|
|
76702
|
-
var
|
|
76398
|
+
var { npm: npm9, npx: npx3 } = detectPackageManager();
|
|
76399
|
+
var generate13 = async (ctx) => {
|
|
76703
76400
|
const projectName = ctx.project.name;
|
|
76704
76401
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76705
76402
|
const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
76706
76403
|
writeFile2((0, import_path10.join)(ctx.project.path, "wrangler.jsonc"), wranglerConfig);
|
|
76707
76404
|
updateStatus("Created wrangler.jsonc file");
|
|
76708
76405
|
};
|
|
76709
|
-
var
|
|
76406
|
+
var updateNextConfig = (usesTs) => {
|
|
76710
76407
|
const s = spinner();
|
|
76711
76408
|
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
76712
76409
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76724,7 +76421,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76724
76421
|
writeFile2(configFile, updatedConfigFile);
|
|
76725
76422
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76726
76423
|
};
|
|
76727
|
-
var
|
|
76424
|
+
var configure7 = async (ctx) => {
|
|
76728
76425
|
const projectPath = ctx.project.path;
|
|
76729
76426
|
const path6 = probePaths([
|
|
76730
76427
|
`${projectPath}/pages/api`,
|
|
@@ -76749,7 +76446,7 @@ var configure12 = async (ctx) => {
|
|
|
76749
76446
|
if (installEslintPlugin) {
|
|
76750
76447
|
await writeEslintrc(ctx);
|
|
76751
76448
|
}
|
|
76752
|
-
|
|
76449
|
+
updateNextConfig(usesTs);
|
|
76753
76450
|
copyFile(
|
|
76754
76451
|
(0, import_path10.join)(getTemplatePath(ctx), "README.md"),
|
|
76755
76452
|
(0, import_path10.join)(projectPath, "README.md")
|
|
@@ -76799,14 +76496,16 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76799
76496
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76800
76497
|
});
|
|
76801
76498
|
};
|
|
76802
|
-
var
|
|
76499
|
+
var c3_default24 = {
|
|
76803
76500
|
configVersion: 1,
|
|
76804
76501
|
id: "next",
|
|
76805
76502
|
frameworkCli: "create-next-app",
|
|
76806
76503
|
platform: "pages",
|
|
76504
|
+
hidden: true,
|
|
76807
76505
|
displayName: "Next.js",
|
|
76808
|
-
|
|
76809
|
-
|
|
76506
|
+
path: "templates/next/pages",
|
|
76507
|
+
generate: generate13,
|
|
76508
|
+
configure: configure7,
|
|
76810
76509
|
copyFiles: {
|
|
76811
76510
|
async selectVariant(ctx) {
|
|
76812
76511
|
const isApp = probePaths([
|
|
@@ -76837,12 +76536,12 @@ var c3_default26 = {
|
|
|
76837
76536
|
}
|
|
76838
76537
|
},
|
|
76839
76538
|
transformPackageJson: async (_3, ctx) => {
|
|
76840
|
-
const isNpm =
|
|
76841
|
-
const isBun =
|
|
76539
|
+
const isNpm = npm9 === "npm";
|
|
76540
|
+
const isBun = npm9 === "bun";
|
|
76842
76541
|
const isNpmOrBun = isNpm || isBun;
|
|
76843
76542
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76844
76543
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76845
|
-
const pmCommand = isNpmOrBun ?
|
|
76544
|
+
const pmCommand = isNpmOrBun ? npx3 : npm9;
|
|
76846
76545
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76847
76546
|
return {
|
|
76848
76547
|
scripts: {
|
|
@@ -76861,22 +76560,86 @@ var c3_default26 = {
|
|
|
76861
76560
|
compatibilityFlags: ["nodejs_compat"]
|
|
76862
76561
|
};
|
|
76863
76562
|
|
|
76563
|
+
// templates/next/workers/c3.ts
|
|
76564
|
+
var generate14 = async (ctx) => {
|
|
76565
|
+
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76566
|
+
};
|
|
76567
|
+
var configure8 = async (ctx) => {
|
|
76568
|
+
const packages = [
|
|
76569
|
+
"@opennextjs/cloudflare@~1.0.0-beta.0 || ^1.0.0",
|
|
76570
|
+
"@cloudflare/workers-types"
|
|
76571
|
+
];
|
|
76572
|
+
await installPackages(packages, {
|
|
76573
|
+
dev: true,
|
|
76574
|
+
startText: "Adding the Cloudflare adapter",
|
|
76575
|
+
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76576
|
+
});
|
|
76577
|
+
const usesTs = usesTypescript(ctx);
|
|
76578
|
+
updateNextConfig2(usesTs);
|
|
76579
|
+
};
|
|
76580
|
+
var updateNextConfig2 = (usesTs) => {
|
|
76581
|
+
const s = spinner();
|
|
76582
|
+
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
76583
|
+
s.start(`Updating \`${configFile}\``);
|
|
76584
|
+
const configContent = readFile(configFile);
|
|
76585
|
+
const updatedConfigFile = configContent + `
|
|
76586
|
+
// added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
|
|
76587
|
+
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
76588
|
+
initOpenNextCloudflareForDev();
|
|
76589
|
+
`.replace(/\n\t*/g, "\n");
|
|
76590
|
+
writeFile2(configFile, updatedConfigFile);
|
|
76591
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76592
|
+
};
|
|
76593
|
+
var c3_default25 = {
|
|
76594
|
+
configVersion: 1,
|
|
76595
|
+
id: "next",
|
|
76596
|
+
frameworkCli: "create-next-app",
|
|
76597
|
+
frameworkCliPinnedVersion: "~15.3.0",
|
|
76598
|
+
platform: "workers",
|
|
76599
|
+
displayName: "Next.js (using Node.js compat + Workers Assets)",
|
|
76600
|
+
path: "templates/next/workers",
|
|
76601
|
+
copyFiles: {
|
|
76602
|
+
path: "./templates"
|
|
76603
|
+
},
|
|
76604
|
+
generate: generate14,
|
|
76605
|
+
configure: configure8,
|
|
76606
|
+
transformPackageJson: async () => ({
|
|
76607
|
+
scripts: {
|
|
76608
|
+
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
76609
|
+
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
76610
|
+
"cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
|
|
76611
|
+
}
|
|
76612
|
+
}),
|
|
76613
|
+
devScript: "dev",
|
|
76614
|
+
previewScript: "preview",
|
|
76615
|
+
deployScript: "deploy",
|
|
76616
|
+
compatibilityFlags: ["nodejs_compat"]
|
|
76617
|
+
};
|
|
76618
|
+
|
|
76619
|
+
// templates/next/c3.ts
|
|
76620
|
+
var config23 = {
|
|
76621
|
+
displayName: "Next.js",
|
|
76622
|
+
platformVariants: { pages: c3_default24, workers: c3_default25 }
|
|
76623
|
+
};
|
|
76624
|
+
var c3_default26 = config23;
|
|
76625
|
+
|
|
76864
76626
|
// templates/nuxt/pages/c3.ts
|
|
76865
|
-
var
|
|
76866
|
-
var { npm:
|
|
76867
|
-
var
|
|
76627
|
+
var recast6 = __toESM(require_main3());
|
|
76628
|
+
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
76629
|
+
var generate15 = async (ctx) => {
|
|
76868
76630
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76869
76631
|
await runFrameworkGenerator(ctx, [
|
|
76870
76632
|
"init",
|
|
76871
76633
|
ctx.project.name,
|
|
76872
76634
|
"--packageManager",
|
|
76873
|
-
|
|
76635
|
+
npm10,
|
|
76636
|
+
"--no-install",
|
|
76874
76637
|
gitFlag
|
|
76875
76638
|
]);
|
|
76876
76639
|
writeFile2("./.node-version", "18");
|
|
76877
76640
|
logRaw("");
|
|
76878
76641
|
};
|
|
76879
|
-
var
|
|
76642
|
+
var configure9 = async (ctx) => {
|
|
76880
76643
|
const packages = ["nitro-cloudflare-dev"];
|
|
76881
76644
|
if (pm2 === "pnpm") {
|
|
76882
76645
|
packages.push("h3");
|
|
@@ -76884,7 +76647,7 @@ var configure13 = async (ctx) => {
|
|
|
76884
76647
|
await installPackages(packages, {
|
|
76885
76648
|
dev: true,
|
|
76886
76649
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76887
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76650
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
76888
76651
|
});
|
|
76889
76652
|
updateNuxtConfig();
|
|
76890
76653
|
updateEnvTypes2(ctx);
|
|
@@ -76907,7 +76670,7 @@ var updateNuxtConfig = () => {
|
|
|
76907
76670
|
const s = spinner();
|
|
76908
76671
|
const configFile = "nuxt.config.ts";
|
|
76909
76672
|
s.start(`Updating \`${configFile}\``);
|
|
76910
|
-
const b3 =
|
|
76673
|
+
const b3 = recast6.types.builders;
|
|
76911
76674
|
const presetDef = b3.objectProperty(
|
|
76912
76675
|
b3.identifier("nitro"),
|
|
76913
76676
|
b3.objectExpression([
|
|
@@ -76945,22 +76708,23 @@ var updateNuxtConfig = () => {
|
|
|
76945
76708
|
});
|
|
76946
76709
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76947
76710
|
};
|
|
76948
|
-
var
|
|
76711
|
+
var config24 = {
|
|
76949
76712
|
configVersion: 1,
|
|
76950
76713
|
id: "nuxt",
|
|
76951
76714
|
frameworkCli: "nuxi",
|
|
76952
76715
|
platform: "pages",
|
|
76716
|
+
hidden: true,
|
|
76953
76717
|
displayName: "Nuxt",
|
|
76954
76718
|
copyFiles: {
|
|
76955
76719
|
path: "./templates"
|
|
76956
76720
|
},
|
|
76957
76721
|
path: "templates/nuxt/pages",
|
|
76958
|
-
generate:
|
|
76959
|
-
configure:
|
|
76722
|
+
generate: generate15,
|
|
76723
|
+
configure: configure9,
|
|
76960
76724
|
transformPackageJson: async () => ({
|
|
76961
76725
|
scripts: {
|
|
76962
|
-
deploy: `${
|
|
76963
|
-
preview: `${
|
|
76726
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
76727
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
76964
76728
|
"cf-typegen": `wrangler types`
|
|
76965
76729
|
}
|
|
76966
76730
|
}),
|
|
@@ -76968,24 +76732,25 @@ var config21 = {
|
|
|
76968
76732
|
deployScript: "deploy",
|
|
76969
76733
|
previewScript: "preview"
|
|
76970
76734
|
};
|
|
76971
|
-
var c3_default27 =
|
|
76735
|
+
var c3_default27 = config24;
|
|
76972
76736
|
|
|
76973
76737
|
// templates/nuxt/workers/c3.ts
|
|
76974
|
-
var
|
|
76975
|
-
var { npm:
|
|
76976
|
-
var
|
|
76738
|
+
var recast7 = __toESM(require_main3());
|
|
76739
|
+
var { npm: npm11, name: pm3 } = detectPackageManager();
|
|
76740
|
+
var generate16 = async (ctx) => {
|
|
76977
76741
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76978
76742
|
await runFrameworkGenerator(ctx, [
|
|
76979
76743
|
"init",
|
|
76980
76744
|
ctx.project.name,
|
|
76981
76745
|
"--packageManager",
|
|
76982
|
-
|
|
76746
|
+
npm11,
|
|
76747
|
+
"--no-install",
|
|
76983
76748
|
gitFlag
|
|
76984
76749
|
]);
|
|
76985
76750
|
writeFile2("./.node-version", "18");
|
|
76986
76751
|
logRaw("");
|
|
76987
76752
|
};
|
|
76988
|
-
var
|
|
76753
|
+
var configure10 = async (ctx) => {
|
|
76989
76754
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
76990
76755
|
if (pm3 === "pnpm") {
|
|
76991
76756
|
packages.push("h3");
|
|
@@ -76993,7 +76758,7 @@ var configure14 = async (ctx) => {
|
|
|
76993
76758
|
await installPackages(packages, {
|
|
76994
76759
|
dev: true,
|
|
76995
76760
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76996
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76761
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
76997
76762
|
});
|
|
76998
76763
|
updateNuxtConfig2();
|
|
76999
76764
|
updateEnvTypes3(ctx);
|
|
@@ -77016,7 +76781,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77016
76781
|
const s = spinner();
|
|
77017
76782
|
const configFile = "nuxt.config.ts";
|
|
77018
76783
|
s.start(`Updating \`${configFile}\``);
|
|
77019
|
-
const b3 =
|
|
76784
|
+
const b3 = recast7.types.builders;
|
|
77020
76785
|
const presetDef = b3.objectProperty(
|
|
77021
76786
|
b3.identifier("nitro"),
|
|
77022
76787
|
b3.objectExpression([
|
|
@@ -77054,7 +76819,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77054
76819
|
});
|
|
77055
76820
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
77056
76821
|
};
|
|
77057
|
-
var
|
|
76822
|
+
var config25 = {
|
|
77058
76823
|
configVersion: 1,
|
|
77059
76824
|
id: "nuxt",
|
|
77060
76825
|
frameworkCli: "nuxi",
|
|
@@ -77064,12 +76829,12 @@ var config22 = {
|
|
|
77064
76829
|
path: "./templates"
|
|
77065
76830
|
},
|
|
77066
76831
|
path: "templates/nuxt/workers",
|
|
77067
|
-
generate:
|
|
77068
|
-
configure:
|
|
76832
|
+
generate: generate16,
|
|
76833
|
+
configure: configure10,
|
|
77069
76834
|
transformPackageJson: async () => ({
|
|
77070
76835
|
scripts: {
|
|
77071
|
-
deploy: `${
|
|
77072
|
-
preview: `${
|
|
76836
|
+
deploy: `${npm11} run build && wrangler deploy`,
|
|
76837
|
+
preview: `${npm11} run build && wrangler dev`,
|
|
77073
76838
|
"cf-typegen": `wrangler types`
|
|
77074
76839
|
}
|
|
77075
76840
|
}),
|
|
@@ -77077,17 +76842,17 @@ var config22 = {
|
|
|
77077
76842
|
deployScript: "deploy",
|
|
77078
76843
|
previewScript: "preview"
|
|
77079
76844
|
};
|
|
77080
|
-
var c3_default28 =
|
|
76845
|
+
var c3_default28 = config25;
|
|
77081
76846
|
|
|
77082
76847
|
// templates/nuxt/c3.ts
|
|
77083
|
-
var
|
|
76848
|
+
var config26 = {
|
|
77084
76849
|
displayName: "Nuxt",
|
|
77085
76850
|
platformVariants: { pages: c3_default27, workers: c3_default28 }
|
|
77086
76851
|
};
|
|
77087
|
-
var c3_default29 =
|
|
76852
|
+
var c3_default29 = config26;
|
|
77088
76853
|
|
|
77089
76854
|
// templates/openapi/c3.ts
|
|
77090
|
-
var
|
|
76855
|
+
var config27 = {
|
|
77091
76856
|
configVersion: 1,
|
|
77092
76857
|
id: "openapi",
|
|
77093
76858
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -77097,6 +76862,7 @@ var c3_default30 = {
|
|
|
77097
76862
|
path: "./ts"
|
|
77098
76863
|
}
|
|
77099
76864
|
};
|
|
76865
|
+
var c3_default30 = config27;
|
|
77100
76866
|
|
|
77101
76867
|
// templates/pre-existing/c3.ts
|
|
77102
76868
|
var import_promises3 = require("fs/promises");
|
|
@@ -77218,7 +76984,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77218
76984
|
await runCommand(
|
|
77219
76985
|
[
|
|
77220
76986
|
...dlx,
|
|
77221
|
-
"wrangler@
|
|
76987
|
+
"wrangler@latest",
|
|
77222
76988
|
"init",
|
|
77223
76989
|
"--from-dash",
|
|
77224
76990
|
ctx.args.existingScript,
|
|
@@ -77246,10 +77012,11 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77246
77012
|
(0, import_path11.join)(ctx.project.path, "wrangler.toml")
|
|
77247
77013
|
);
|
|
77248
77014
|
}
|
|
77249
|
-
var
|
|
77015
|
+
var config28 = {
|
|
77250
77016
|
configVersion: 1,
|
|
77251
77017
|
id: "pre-existing",
|
|
77252
77018
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
77019
|
+
description: "Fetch a Worker initialized from the Cloudflare dashboard.",
|
|
77253
77020
|
platform: "workers",
|
|
77254
77021
|
hidden: true,
|
|
77255
77022
|
copyFiles: {
|
|
@@ -77261,8 +77028,9 @@ var c3_default31 = {
|
|
|
77261
77028
|
copyFiles: copyExistingWorkerFiles
|
|
77262
77029
|
})
|
|
77263
77030
|
};
|
|
77031
|
+
var c3_default31 = config28;
|
|
77264
77032
|
function buildConfigure(params) {
|
|
77265
|
-
return async function
|
|
77033
|
+
return async function configure21(ctx) {
|
|
77266
77034
|
const loginSuccess = await params.login(ctx);
|
|
77267
77035
|
if (!loginSuccess) {
|
|
77268
77036
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -77274,7 +77042,7 @@ function buildConfigure(params) {
|
|
|
77274
77042
|
}
|
|
77275
77043
|
|
|
77276
77044
|
// templates/queues/c3.ts
|
|
77277
|
-
var
|
|
77045
|
+
var config29 = {
|
|
77278
77046
|
configVersion: 1,
|
|
77279
77047
|
id: "queues",
|
|
77280
77048
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -77301,17 +77069,128 @@ var c3_default32 = {
|
|
|
77301
77069
|
]
|
|
77302
77070
|
}
|
|
77303
77071
|
};
|
|
77072
|
+
var c3_default32 = config29;
|
|
77304
77073
|
|
|
77305
|
-
// templates/qwik/c3.ts
|
|
77306
|
-
var
|
|
77307
|
-
var { npm:
|
|
77308
|
-
var
|
|
77074
|
+
// templates/qwik/pages/c3.ts
|
|
77075
|
+
var recast8 = __toESM(require_main3());
|
|
77076
|
+
var { npm: npm12, npx: npx4, name } = detectPackageManager();
|
|
77077
|
+
var generate17 = async (ctx) => {
|
|
77078
|
+
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77079
|
+
};
|
|
77080
|
+
var configure11 = async (ctx) => {
|
|
77081
|
+
const cmd = [name === "pnpm" ? npm12 : npx4, "qwik", "add", "cloudflare-pages"];
|
|
77082
|
+
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77083
|
+
await runCommand(cmd);
|
|
77084
|
+
addBindingsProxy(ctx);
|
|
77085
|
+
populateCloudflareEnv();
|
|
77086
|
+
};
|
|
77087
|
+
var addBindingsProxy = (ctx) => {
|
|
77088
|
+
if (!usesTypescript(ctx)) {
|
|
77089
|
+
return;
|
|
77090
|
+
}
|
|
77091
|
+
const s = spinner();
|
|
77092
|
+
s.start("Updating `vite.config.ts`");
|
|
77093
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
77094
|
+
const b3 = recast8.types.builders;
|
|
77095
|
+
transformFile("vite.config.ts", {
|
|
77096
|
+
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77097
|
+
visitProgram: function(n) {
|
|
77098
|
+
const lastImportIndex = n.node.body.findLastIndex(
|
|
77099
|
+
(t2) => t2.type === "ImportDeclaration"
|
|
77100
|
+
);
|
|
77101
|
+
const lastImport = n.get("body", lastImportIndex);
|
|
77102
|
+
lastImport.insertAfter(...snippets.getPlatformProxyTs);
|
|
77103
|
+
return this.traverse(n);
|
|
77104
|
+
},
|
|
77105
|
+
// Pass the `platform` object from the declaration to the `qwikCity` plugin
|
|
77106
|
+
visitCallExpression: function(n) {
|
|
77107
|
+
const callee = n.node.callee;
|
|
77108
|
+
if (callee.name !== "qwikCity") {
|
|
77109
|
+
return this.traverse(n);
|
|
77110
|
+
}
|
|
77111
|
+
const configArgument = n.node.arguments[0];
|
|
77112
|
+
const platformPropery = b3.objectProperty.from({
|
|
77113
|
+
key: b3.identifier("platform"),
|
|
77114
|
+
value: b3.identifier("platform"),
|
|
77115
|
+
shorthand: true
|
|
77116
|
+
});
|
|
77117
|
+
if (!configArgument) {
|
|
77118
|
+
n.node.arguments = [b3.objectExpression([platformPropery])];
|
|
77119
|
+
return false;
|
|
77120
|
+
}
|
|
77121
|
+
if (configArgument.type !== "ObjectExpression") {
|
|
77122
|
+
throw new Error("Failed to update `vite.config.ts`");
|
|
77123
|
+
}
|
|
77124
|
+
configArgument.properties.push(platformPropery);
|
|
77125
|
+
return false;
|
|
77126
|
+
}
|
|
77127
|
+
});
|
|
77128
|
+
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
77129
|
+
};
|
|
77130
|
+
var populateCloudflareEnv = () => {
|
|
77131
|
+
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
77132
|
+
const s = spinner();
|
|
77133
|
+
s.start(`Updating \`${entrypointPath}\``);
|
|
77134
|
+
transformFile(entrypointPath, {
|
|
77135
|
+
visitTSInterfaceDeclaration: function(n) {
|
|
77136
|
+
const b3 = recast8.types.builders;
|
|
77137
|
+
const id = n.node.id;
|
|
77138
|
+
if (id.name !== "QwikCityPlatform") {
|
|
77139
|
+
this.traverse(n);
|
|
77140
|
+
}
|
|
77141
|
+
const newBody = [
|
|
77142
|
+
["env", "Env"]
|
|
77143
|
+
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
77144
|
+
// ["cf", "CfProperties"],
|
|
77145
|
+
].map(
|
|
77146
|
+
([varName, type]) => b3.tsPropertySignature(
|
|
77147
|
+
b3.identifier(varName),
|
|
77148
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
|
|
77149
|
+
)
|
|
77150
|
+
);
|
|
77151
|
+
n.node.body.body = newBody;
|
|
77152
|
+
return false;
|
|
77153
|
+
}
|
|
77154
|
+
});
|
|
77155
|
+
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77156
|
+
};
|
|
77157
|
+
var config30 = {
|
|
77158
|
+
configVersion: 1,
|
|
77159
|
+
id: "qwik",
|
|
77160
|
+
frameworkCli: "create-qwik",
|
|
77161
|
+
displayName: "Qwik",
|
|
77162
|
+
platform: "pages",
|
|
77163
|
+
hidden: true,
|
|
77164
|
+
copyFiles: {
|
|
77165
|
+
path: "./templates"
|
|
77166
|
+
},
|
|
77167
|
+
path: "templates/qwik/pages",
|
|
77168
|
+
generate: generate17,
|
|
77169
|
+
configure: configure11,
|
|
77170
|
+
transformPackageJson: async () => ({
|
|
77171
|
+
scripts: {
|
|
77172
|
+
deploy: `${npm12} run build && wrangler pages deploy`,
|
|
77173
|
+
preview: `${npm12} run build && wrangler pages dev`,
|
|
77174
|
+
"cf-typegen": `wrangler types`
|
|
77175
|
+
}
|
|
77176
|
+
}),
|
|
77177
|
+
devScript: "dev",
|
|
77178
|
+
deployScript: "deploy",
|
|
77179
|
+
previewScript: "preview"
|
|
77180
|
+
};
|
|
77181
|
+
var c3_default33 = config30;
|
|
77182
|
+
|
|
77183
|
+
// templates/qwik/workers/c3.ts
|
|
77184
|
+
var recast9 = __toESM(require_main3());
|
|
77185
|
+
var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
|
|
77186
|
+
var generate18 = async (ctx) => {
|
|
77309
77187
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77310
77188
|
};
|
|
77311
|
-
var
|
|
77312
|
-
const cmd = [name2 === "pnpm" ?
|
|
77189
|
+
var configure12 = async (ctx) => {
|
|
77190
|
+
const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77313
77191
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77314
77192
|
await runCommand(cmd);
|
|
77193
|
+
removeFile("./public/_routes.json");
|
|
77315
77194
|
addBindingsProxy2(ctx);
|
|
77316
77195
|
populateCloudflareEnv2();
|
|
77317
77196
|
};
|
|
@@ -77322,7 +77201,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77322
77201
|
const s = spinner();
|
|
77323
77202
|
s.start("Updating `vite.config.ts`");
|
|
77324
77203
|
const snippets = loadTemplateSnippets(ctx);
|
|
77325
|
-
const b3 =
|
|
77204
|
+
const b3 = recast9.types.builders;
|
|
77326
77205
|
transformFile("vite.config.ts", {
|
|
77327
77206
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77328
77207
|
visitProgram: function(n) {
|
|
@@ -77364,7 +77243,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77364
77243
|
s.start(`Updating \`${entrypointPath}\``);
|
|
77365
77244
|
transformFile(entrypointPath, {
|
|
77366
77245
|
visitTSInterfaceDeclaration: function(n) {
|
|
77367
|
-
const b3 =
|
|
77246
|
+
const b3 = recast9.types.builders;
|
|
77368
77247
|
const id = n.node.id;
|
|
77369
77248
|
if (id.name !== "QwikCityPlatform") {
|
|
77370
77249
|
this.traverse(n);
|
|
@@ -77385,21 +77264,22 @@ var populateCloudflareEnv2 = () => {
|
|
|
77385
77264
|
});
|
|
77386
77265
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77387
77266
|
};
|
|
77388
|
-
var
|
|
77267
|
+
var config31 = {
|
|
77389
77268
|
configVersion: 1,
|
|
77390
77269
|
id: "qwik",
|
|
77391
77270
|
frameworkCli: "create-qwik",
|
|
77392
77271
|
displayName: "Qwik",
|
|
77393
|
-
platform: "
|
|
77272
|
+
platform: "workers",
|
|
77394
77273
|
copyFiles: {
|
|
77395
77274
|
path: "./templates"
|
|
77396
77275
|
},
|
|
77397
|
-
|
|
77398
|
-
|
|
77276
|
+
path: "templates/qwik/workers",
|
|
77277
|
+
generate: generate18,
|
|
77278
|
+
configure: configure12,
|
|
77399
77279
|
transformPackageJson: async () => ({
|
|
77400
77280
|
scripts: {
|
|
77401
|
-
deploy: `${
|
|
77402
|
-
preview: `${
|
|
77281
|
+
deploy: `${npm13} run build && wrangler deploy`,
|
|
77282
|
+
preview: `${npm13} run build && wrangler dev`,
|
|
77403
77283
|
"cf-typegen": `wrangler types`
|
|
77404
77284
|
}
|
|
77405
77285
|
}),
|
|
@@ -77407,11 +77287,55 @@ var config24 = {
|
|
|
77407
77287
|
deployScript: "deploy",
|
|
77408
77288
|
previewScript: "preview"
|
|
77409
77289
|
};
|
|
77410
|
-
var
|
|
77290
|
+
var c3_default34 = config31;
|
|
77291
|
+
|
|
77292
|
+
// templates/qwik/c3.ts
|
|
77293
|
+
var config32 = {
|
|
77294
|
+
displayName: "Qwik",
|
|
77295
|
+
platformVariants: { pages: c3_default33, workers: c3_default34 }
|
|
77296
|
+
};
|
|
77297
|
+
var c3_default35 = config32;
|
|
77298
|
+
|
|
77299
|
+
// templates/react-router/c3.ts
|
|
77300
|
+
var { npm: npm14 } = detectPackageManager();
|
|
77301
|
+
var generate19 = async (ctx) => {
|
|
77302
|
+
await runFrameworkGenerator(ctx, [
|
|
77303
|
+
ctx.project.name,
|
|
77304
|
+
"--template",
|
|
77305
|
+
"https://github.com/remix-run/react-router-templates/tree/main/cloudflare",
|
|
77306
|
+
// to prevent asking about git twice, just let c3 do it
|
|
77307
|
+
"--no-git-init",
|
|
77308
|
+
"--no-install"
|
|
77309
|
+
]);
|
|
77310
|
+
logRaw("");
|
|
77311
|
+
};
|
|
77312
|
+
var config33 = {
|
|
77313
|
+
configVersion: 1,
|
|
77314
|
+
id: "react-router",
|
|
77315
|
+
platform: "workers",
|
|
77316
|
+
frameworkCli: "create-react-router",
|
|
77317
|
+
displayName: "React Router (formerly Remix)",
|
|
77318
|
+
copyFiles: {
|
|
77319
|
+
path: "./templates"
|
|
77320
|
+
},
|
|
77321
|
+
generate: generate19,
|
|
77322
|
+
// configure,
|
|
77323
|
+
transformPackageJson: async () => ({
|
|
77324
|
+
scripts: {
|
|
77325
|
+
deploy: `${npm14} run build && wrangler deploy`,
|
|
77326
|
+
preview: `${npm14} run build && vite preview`,
|
|
77327
|
+
"cf-typegen": `wrangler types`
|
|
77328
|
+
}
|
|
77329
|
+
}),
|
|
77330
|
+
devScript: "dev",
|
|
77331
|
+
deployScript: "deploy",
|
|
77332
|
+
previewScript: "preview"
|
|
77333
|
+
};
|
|
77334
|
+
var c3_default36 = config33;
|
|
77411
77335
|
|
|
77412
77336
|
// templates/react/pages/c3.ts
|
|
77413
|
-
var { npm:
|
|
77414
|
-
var
|
|
77337
|
+
var { npm: npm15 } = detectPackageManager();
|
|
77338
|
+
var generate20 = async (ctx) => {
|
|
77415
77339
|
const variant = await inputPrompt({
|
|
77416
77340
|
type: "select",
|
|
77417
77341
|
question: "Select a variant:",
|
|
@@ -77440,34 +77364,35 @@ var variantsOptions = [
|
|
|
77440
77364
|
label: "JavaScript + SWC"
|
|
77441
77365
|
}
|
|
77442
77366
|
];
|
|
77443
|
-
var
|
|
77367
|
+
var config34 = {
|
|
77444
77368
|
configVersion: 1,
|
|
77445
77369
|
id: "react",
|
|
77446
77370
|
// React's documentation now recommends using create-vite.
|
|
77447
77371
|
frameworkCli: "create-vite",
|
|
77448
77372
|
displayName: "React",
|
|
77449
77373
|
platform: "pages",
|
|
77374
|
+
hidden: true,
|
|
77450
77375
|
path: "templates/react/pages",
|
|
77451
|
-
generate:
|
|
77376
|
+
generate: generate20,
|
|
77452
77377
|
transformPackageJson: async () => ({
|
|
77453
77378
|
scripts: {
|
|
77454
|
-
deploy: `${
|
|
77455
|
-
preview: `${
|
|
77379
|
+
deploy: `${npm15} run build && wrangler pages deploy ./dist`,
|
|
77380
|
+
preview: `${npm15} run build && wrangler pages dev ./dist`
|
|
77456
77381
|
}
|
|
77457
77382
|
}),
|
|
77458
77383
|
devScript: "dev",
|
|
77459
77384
|
deployScript: "deploy",
|
|
77460
77385
|
previewScript: "preview"
|
|
77461
77386
|
};
|
|
77462
|
-
var
|
|
77387
|
+
var c3_default37 = config34;
|
|
77463
77388
|
|
|
77464
77389
|
// templates/react/workers/c3.ts
|
|
77465
77390
|
var import_assert2 = __toESM(require("assert"));
|
|
77466
|
-
var
|
|
77467
|
-
var b2 =
|
|
77468
|
-
var t =
|
|
77469
|
-
var { npm:
|
|
77470
|
-
var
|
|
77391
|
+
var recast10 = __toESM(require_main3());
|
|
77392
|
+
var b2 = recast10.types.builders;
|
|
77393
|
+
var t = recast10.types.namedTypes;
|
|
77394
|
+
var { npm: npm16 } = detectPackageManager();
|
|
77395
|
+
var generate21 = async (ctx) => {
|
|
77471
77396
|
const variant = await getVariant();
|
|
77472
77397
|
ctx.args.lang = variant.lang;
|
|
77473
77398
|
await runFrameworkGenerator(ctx, [
|
|
@@ -77477,13 +77402,13 @@ var generate22 = async (ctx) => {
|
|
|
77477
77402
|
]);
|
|
77478
77403
|
logRaw("");
|
|
77479
77404
|
};
|
|
77480
|
-
var
|
|
77405
|
+
var configure13 = async (ctx) => {
|
|
77481
77406
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77482
77407
|
dev: true,
|
|
77483
77408
|
startText: "Installing the Cloudflare Vite plugin",
|
|
77484
77409
|
doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
|
|
77485
77410
|
});
|
|
77486
|
-
|
|
77411
|
+
transformViteConfig(ctx);
|
|
77487
77412
|
if (usesTypescript(ctx)) {
|
|
77488
77413
|
updateTsconfigJson();
|
|
77489
77414
|
}
|
|
@@ -77508,9 +77433,9 @@ function transformViteConfig(ctx) {
|
|
|
77508
77433
|
if (callee.name !== "defineConfig") {
|
|
77509
77434
|
return this.traverse(n);
|
|
77510
77435
|
}
|
|
77511
|
-
const
|
|
77512
|
-
(0, import_assert2.default)(t.ObjectExpression.check(
|
|
77513
|
-
const pluginsProp =
|
|
77436
|
+
const config48 = n.node.arguments[0];
|
|
77437
|
+
(0, import_assert2.default)(t.ObjectExpression.check(config48));
|
|
77438
|
+
const pluginsProp = config48.properties.find((prop) => isPluginsProp(prop));
|
|
77514
77439
|
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77515
77440
|
pluginsProp.value.elements.push(
|
|
77516
77441
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -77567,7 +77492,7 @@ async function getVariant() {
|
|
|
77567
77492
|
(0, import_assert2.default)(selected, "Expected a variant to be selected");
|
|
77568
77493
|
return selected;
|
|
77569
77494
|
}
|
|
77570
|
-
var
|
|
77495
|
+
var config35 = {
|
|
77571
77496
|
configVersion: 1,
|
|
77572
77497
|
id: "react",
|
|
77573
77498
|
frameworkCli: "create-vite",
|
|
@@ -77584,12 +77509,12 @@ var config26 = {
|
|
|
77584
77509
|
}
|
|
77585
77510
|
}
|
|
77586
77511
|
},
|
|
77587
|
-
generate:
|
|
77588
|
-
configure:
|
|
77512
|
+
generate: generate21,
|
|
77513
|
+
configure: configure13,
|
|
77589
77514
|
transformPackageJson: async (_3, ctx) => ({
|
|
77590
77515
|
scripts: {
|
|
77591
|
-
deploy: `${
|
|
77592
|
-
preview: `${
|
|
77516
|
+
deploy: `${npm16} run build && wrangler deploy`,
|
|
77517
|
+
preview: `${npm16} run build && vite preview`,
|
|
77593
77518
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77594
77519
|
}
|
|
77595
77520
|
}),
|
|
@@ -77597,18 +77522,18 @@ var config26 = {
|
|
|
77597
77522
|
deployScript: "deploy",
|
|
77598
77523
|
previewScript: "preview"
|
|
77599
77524
|
};
|
|
77600
|
-
var
|
|
77525
|
+
var c3_default38 = config35;
|
|
77601
77526
|
|
|
77602
77527
|
// templates/react/c3.ts
|
|
77603
|
-
var
|
|
77528
|
+
var config36 = {
|
|
77604
77529
|
displayName: "React",
|
|
77605
|
-
platformVariants: { pages:
|
|
77530
|
+
platformVariants: { pages: c3_default37, workers: c3_default38 }
|
|
77606
77531
|
};
|
|
77607
|
-
var
|
|
77532
|
+
var c3_default39 = config36;
|
|
77608
77533
|
|
|
77609
|
-
// templates/remix/c3.ts
|
|
77610
|
-
var { npm:
|
|
77611
|
-
var
|
|
77534
|
+
// templates/remix/pages/c3.ts
|
|
77535
|
+
var { npm: npm17 } = detectPackageManager();
|
|
77536
|
+
var generate22 = async (ctx) => {
|
|
77612
77537
|
await runFrameworkGenerator(ctx, [
|
|
77613
77538
|
ctx.project.name,
|
|
77614
77539
|
"--template",
|
|
@@ -77616,7 +77541,7 @@ var generate23 = async (ctx) => {
|
|
|
77616
77541
|
]);
|
|
77617
77542
|
logRaw("");
|
|
77618
77543
|
};
|
|
77619
|
-
var
|
|
77544
|
+
var configure14 = async () => {
|
|
77620
77545
|
const typeDefsPath = "load-context.ts";
|
|
77621
77546
|
const s = spinner();
|
|
77622
77547
|
s.start(`Updating \`${typeDefsPath}\``);
|
|
@@ -77631,21 +77556,65 @@ var configure17 = async () => {
|
|
|
77631
77556
|
});
|
|
77632
77557
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
77633
77558
|
};
|
|
77634
|
-
var
|
|
77559
|
+
var config37 = {
|
|
77635
77560
|
configVersion: 1,
|
|
77636
77561
|
id: "remix",
|
|
77637
77562
|
frameworkCli: "create-remix",
|
|
77638
77563
|
platform: "pages",
|
|
77564
|
+
hidden: true,
|
|
77639
77565
|
displayName: "Remix",
|
|
77640
77566
|
copyFiles: {
|
|
77641
77567
|
path: "./templates"
|
|
77642
77568
|
},
|
|
77569
|
+
path: "templates/remix/pages",
|
|
77570
|
+
generate: generate22,
|
|
77571
|
+
configure: configure14,
|
|
77572
|
+
transformPackageJson: async () => ({
|
|
77573
|
+
scripts: {
|
|
77574
|
+
deploy: `${npm17} run build && wrangler pages deploy`,
|
|
77575
|
+
preview: `${npm17} run build && wrangler pages dev`,
|
|
77576
|
+
"cf-typegen": `wrangler types`
|
|
77577
|
+
}
|
|
77578
|
+
}),
|
|
77579
|
+
devScript: "dev",
|
|
77580
|
+
deployScript: "deploy",
|
|
77581
|
+
previewScript: "preview"
|
|
77582
|
+
};
|
|
77583
|
+
var c3_default40 = config37;
|
|
77584
|
+
|
|
77585
|
+
// templates/remix/workers/c3.ts
|
|
77586
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77587
|
+
var generate23 = async (ctx) => {
|
|
77588
|
+
await runFrameworkGenerator(ctx, [
|
|
77589
|
+
ctx.project.name,
|
|
77590
|
+
"--template",
|
|
77591
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
77592
|
+
]);
|
|
77593
|
+
logRaw("");
|
|
77594
|
+
};
|
|
77595
|
+
var configure15 = async () => {
|
|
77596
|
+
await installPackages(["wrangler@latest"], {
|
|
77597
|
+
dev: true,
|
|
77598
|
+
startText: "Updating the Wrangler version",
|
|
77599
|
+
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
77600
|
+
});
|
|
77601
|
+
};
|
|
77602
|
+
var config38 = {
|
|
77603
|
+
configVersion: 1,
|
|
77604
|
+
id: "remix",
|
|
77605
|
+
frameworkCli: "create-remix",
|
|
77606
|
+
platform: "workers",
|
|
77607
|
+
displayName: "Remix",
|
|
77608
|
+
copyFiles: {
|
|
77609
|
+
path: "./templates"
|
|
77610
|
+
},
|
|
77611
|
+
path: "templates/remix/workers",
|
|
77643
77612
|
generate: generate23,
|
|
77644
|
-
configure:
|
|
77613
|
+
configure: configure15,
|
|
77645
77614
|
transformPackageJson: async () => ({
|
|
77646
77615
|
scripts: {
|
|
77647
|
-
deploy: `${npm18} run build && wrangler
|
|
77648
|
-
preview: `${npm18} run build && wrangler
|
|
77616
|
+
deploy: `${npm18} run build && wrangler deploy`,
|
|
77617
|
+
preview: `${npm18} run build && wrangler dev`,
|
|
77649
77618
|
"cf-typegen": `wrangler types`
|
|
77650
77619
|
}
|
|
77651
77620
|
}),
|
|
@@ -77653,10 +77622,18 @@ var config28 = {
|
|
|
77653
77622
|
deployScript: "deploy",
|
|
77654
77623
|
previewScript: "preview"
|
|
77655
77624
|
};
|
|
77656
|
-
var
|
|
77625
|
+
var c3_default41 = config38;
|
|
77626
|
+
|
|
77627
|
+
// templates/remix/c3.ts
|
|
77628
|
+
var config39 = {
|
|
77629
|
+
displayName: "Remix",
|
|
77630
|
+
platformVariants: { pages: c3_default40, workers: c3_default41 },
|
|
77631
|
+
hidden: true
|
|
77632
|
+
};
|
|
77633
|
+
var c3_default42 = config39;
|
|
77657
77634
|
|
|
77658
77635
|
// templates/scheduled/c3.ts
|
|
77659
|
-
var
|
|
77636
|
+
var config40 = {
|
|
77660
77637
|
configVersion: 1,
|
|
77661
77638
|
id: "scheduled",
|
|
77662
77639
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -77673,15 +77650,16 @@ var c3_default38 = {
|
|
|
77673
77650
|
}
|
|
77674
77651
|
}
|
|
77675
77652
|
};
|
|
77653
|
+
var c3_default43 = config40;
|
|
77676
77654
|
|
|
77677
77655
|
// templates/solid/c3.ts
|
|
77678
|
-
var
|
|
77656
|
+
var recast11 = __toESM(require_main3());
|
|
77679
77657
|
var { npm: npm19 } = detectPackageManager();
|
|
77680
77658
|
var generate24 = async (ctx) => {
|
|
77681
77659
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
77682
77660
|
logRaw("");
|
|
77683
77661
|
};
|
|
77684
|
-
var
|
|
77662
|
+
var configure16 = async (ctx) => {
|
|
77685
77663
|
usesTypescript(ctx);
|
|
77686
77664
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
77687
77665
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
@@ -77691,7 +77669,7 @@ var configure18 = async (ctx) => {
|
|
|
77691
77669
|
if (callee.name !== "defineConfig") {
|
|
77692
77670
|
return this.traverse(n);
|
|
77693
77671
|
}
|
|
77694
|
-
const b3 =
|
|
77672
|
+
const b3 = recast11.types.builders;
|
|
77695
77673
|
mergeObjectProperties(
|
|
77696
77674
|
n.node.arguments[0],
|
|
77697
77675
|
[
|
|
@@ -77719,7 +77697,7 @@ var configure18 = async (ctx) => {
|
|
|
77719
77697
|
}
|
|
77720
77698
|
});
|
|
77721
77699
|
};
|
|
77722
|
-
var
|
|
77700
|
+
var config41 = {
|
|
77723
77701
|
configVersion: 1,
|
|
77724
77702
|
id: "solid",
|
|
77725
77703
|
frameworkCli: "create-solid",
|
|
@@ -77729,7 +77707,7 @@ var config29 = {
|
|
|
77729
77707
|
path: "./templates"
|
|
77730
77708
|
},
|
|
77731
77709
|
generate: generate24,
|
|
77732
|
-
configure:
|
|
77710
|
+
configure: configure16,
|
|
77733
77711
|
transformPackageJson: async () => ({
|
|
77734
77712
|
scripts: {
|
|
77735
77713
|
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
@@ -77741,29 +77719,29 @@ var config29 = {
|
|
|
77741
77719
|
deployScript: "deploy",
|
|
77742
77720
|
previewScript: "preview"
|
|
77743
77721
|
};
|
|
77744
|
-
var
|
|
77722
|
+
var c3_default44 = config41;
|
|
77745
77723
|
|
|
77746
|
-
// templates/svelte/c3.ts
|
|
77724
|
+
// templates/svelte/pages/c3.ts
|
|
77747
77725
|
var import_node_fs3 = require("node:fs");
|
|
77748
|
-
var
|
|
77749
|
-
var
|
|
77726
|
+
var import_node_os3 = require("node:os");
|
|
77727
|
+
var recast12 = __toESM(require_main3());
|
|
77750
77728
|
var { npm: npm20 } = detectPackageManager();
|
|
77751
77729
|
var generate25 = async (ctx) => {
|
|
77752
77730
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77753
77731
|
logRaw("");
|
|
77754
77732
|
};
|
|
77755
|
-
var
|
|
77733
|
+
var configure17 = async (ctx) => {
|
|
77756
77734
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77757
77735
|
await installPackages([pkg], {
|
|
77758
77736
|
dev: true,
|
|
77759
77737
|
startText: "Adding the Cloudflare Pages adapter",
|
|
77760
77738
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77761
77739
|
});
|
|
77762
|
-
|
|
77740
|
+
updateSvelteConfig();
|
|
77763
77741
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
77764
|
-
|
|
77742
|
+
updateTypeDefinitions(ctx);
|
|
77765
77743
|
};
|
|
77766
|
-
var
|
|
77744
|
+
var updateSvelteConfig = () => {
|
|
77767
77745
|
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77768
77746
|
transformFile("svelte.config.js", {
|
|
77769
77747
|
visitImportDeclaration: function(n) {
|
|
@@ -77797,12 +77775,12 @@ var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
|
77797
77775
|
}
|
|
77798
77776
|
});
|
|
77799
77777
|
};
|
|
77800
|
-
var
|
|
77778
|
+
var updateTypeDefinitions = (ctx) => {
|
|
77801
77779
|
if (!usesTypescript(ctx)) {
|
|
77802
77780
|
return;
|
|
77803
77781
|
}
|
|
77804
77782
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77805
|
-
const b3 =
|
|
77783
|
+
const b3 = recast12.types.builders;
|
|
77806
77784
|
transformFile("src/app.d.ts", {
|
|
77807
77785
|
visitTSModuleDeclaration(n) {
|
|
77808
77786
|
if (n.value.id.name === "App" && n.node.body) {
|
|
@@ -77834,24 +77812,26 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77834
77812
|
}
|
|
77835
77813
|
});
|
|
77836
77814
|
};
|
|
77837
|
-
var
|
|
77815
|
+
var config42 = {
|
|
77838
77816
|
configVersion: 1,
|
|
77839
77817
|
id: "svelte",
|
|
77840
77818
|
frameworkCli: "sv",
|
|
77841
77819
|
displayName: "SvelteKit",
|
|
77842
77820
|
platform: "pages",
|
|
77821
|
+
hidden: true,
|
|
77843
77822
|
copyFiles: {
|
|
77844
77823
|
path: "./templates"
|
|
77845
77824
|
},
|
|
77825
|
+
path: "templates/svelte/pages",
|
|
77846
77826
|
generate: generate25,
|
|
77847
|
-
configure:
|
|
77827
|
+
configure: configure17,
|
|
77848
77828
|
transformPackageJson: async (original, ctx) => {
|
|
77849
77829
|
let scripts = {
|
|
77850
77830
|
preview: `${npm20} run build && wrangler pages dev`,
|
|
77851
77831
|
deploy: `${npm20} run build && wrangler pages deploy`
|
|
77852
77832
|
};
|
|
77853
77833
|
if (usesTypescript(ctx)) {
|
|
77854
|
-
const mv = (0,
|
|
77834
|
+
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
77855
77835
|
scripts = {
|
|
77856
77836
|
...scripts,
|
|
77857
77837
|
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
@@ -77863,36 +77843,143 @@ var config30 = {
|
|
|
77863
77843
|
deployScript: "deploy",
|
|
77864
77844
|
previewScript: "preview"
|
|
77865
77845
|
};
|
|
77866
|
-
var
|
|
77846
|
+
var c3_default45 = config42;
|
|
77867
77847
|
|
|
77868
|
-
// templates/
|
|
77848
|
+
// templates/svelte/workers/c3.ts
|
|
77849
|
+
var import_node_os4 = require("node:os");
|
|
77850
|
+
var recast13 = __toESM(require_main3());
|
|
77869
77851
|
var { npm: npm21 } = detectPackageManager();
|
|
77870
77852
|
var generate26 = async (ctx) => {
|
|
77853
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77854
|
+
logRaw("");
|
|
77855
|
+
};
|
|
77856
|
+
var configure18 = async (ctx) => {
|
|
77857
|
+
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77858
|
+
await installPackages([pkg], {
|
|
77859
|
+
dev: true,
|
|
77860
|
+
startText: "Adding the Cloudflare adapter",
|
|
77861
|
+
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77862
|
+
});
|
|
77863
|
+
updateSvelteConfig2();
|
|
77864
|
+
updateTypeDefinitions2(ctx);
|
|
77865
|
+
};
|
|
77866
|
+
var updateSvelteConfig2 = () => {
|
|
77867
|
+
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77868
|
+
transformFile("svelte.config.js", {
|
|
77869
|
+
visitImportDeclaration: function(n) {
|
|
77870
|
+
const importSource = n.value.source;
|
|
77871
|
+
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
77872
|
+
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
77873
|
+
}
|
|
77874
|
+
return false;
|
|
77875
|
+
}
|
|
77876
|
+
});
|
|
77877
|
+
};
|
|
77878
|
+
var updateTypeDefinitions2 = (ctx) => {
|
|
77879
|
+
if (!usesTypescript(ctx)) {
|
|
77880
|
+
return;
|
|
77881
|
+
}
|
|
77882
|
+
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77883
|
+
const b3 = recast13.types.builders;
|
|
77884
|
+
transformFile("src/app.d.ts", {
|
|
77885
|
+
visitTSModuleDeclaration(n) {
|
|
77886
|
+
if (n.value.id.name === "App" && n.node.body) {
|
|
77887
|
+
const moduleBlock = n.node.body;
|
|
77888
|
+
const platformInterface = b3.tsInterfaceDeclaration(
|
|
77889
|
+
b3.identifier("Platform"),
|
|
77890
|
+
b3.tsInterfaceBody([
|
|
77891
|
+
b3.tsPropertySignature(
|
|
77892
|
+
b3.identifier("env"),
|
|
77893
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
77894
|
+
),
|
|
77895
|
+
b3.tsPropertySignature(
|
|
77896
|
+
b3.identifier("cf"),
|
|
77897
|
+
b3.tsTypeAnnotation(
|
|
77898
|
+
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
77899
|
+
)
|
|
77900
|
+
),
|
|
77901
|
+
b3.tsPropertySignature(
|
|
77902
|
+
b3.identifier("ctx"),
|
|
77903
|
+
b3.tsTypeAnnotation(
|
|
77904
|
+
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
77905
|
+
)
|
|
77906
|
+
)
|
|
77907
|
+
])
|
|
77908
|
+
);
|
|
77909
|
+
moduleBlock.body.unshift(platformInterface);
|
|
77910
|
+
}
|
|
77911
|
+
this.traverse(n);
|
|
77912
|
+
}
|
|
77913
|
+
});
|
|
77914
|
+
};
|
|
77915
|
+
var config43 = {
|
|
77916
|
+
configVersion: 1,
|
|
77917
|
+
id: "svelte",
|
|
77918
|
+
frameworkCli: "sv",
|
|
77919
|
+
displayName: "SvelteKit",
|
|
77920
|
+
platform: "workers",
|
|
77921
|
+
copyFiles: {
|
|
77922
|
+
path: "./templates"
|
|
77923
|
+
},
|
|
77924
|
+
path: "templates/svelte/workers",
|
|
77925
|
+
generate: generate26,
|
|
77926
|
+
configure: configure18,
|
|
77927
|
+
transformPackageJson: async (original, ctx) => {
|
|
77928
|
+
let scripts = {
|
|
77929
|
+
preview: `${npm21} run build && wrangler dev`,
|
|
77930
|
+
deploy: `${npm21} run build && wrangler deploy`
|
|
77931
|
+
};
|
|
77932
|
+
if (usesTypescript(ctx)) {
|
|
77933
|
+
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
77934
|
+
scripts = {
|
|
77935
|
+
...scripts,
|
|
77936
|
+
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
77937
|
+
};
|
|
77938
|
+
}
|
|
77939
|
+
return { scripts };
|
|
77940
|
+
},
|
|
77941
|
+
devScript: "dev",
|
|
77942
|
+
deployScript: "deploy",
|
|
77943
|
+
previewScript: "preview"
|
|
77944
|
+
};
|
|
77945
|
+
var c3_default46 = config43;
|
|
77946
|
+
|
|
77947
|
+
// templates/svelte/c3.ts
|
|
77948
|
+
var config44 = {
|
|
77949
|
+
displayName: "SvelteKit",
|
|
77950
|
+
platformVariants: { pages: c3_default45, workers: c3_default46 }
|
|
77951
|
+
};
|
|
77952
|
+
var c3_default47 = config44;
|
|
77953
|
+
|
|
77954
|
+
// templates/vue/pages/c3.ts
|
|
77955
|
+
var { npm: npm22 } = detectPackageManager();
|
|
77956
|
+
var generate27 = async (ctx) => {
|
|
77871
77957
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77872
77958
|
};
|
|
77873
|
-
var
|
|
77959
|
+
var config45 = {
|
|
77874
77960
|
configVersion: 1,
|
|
77875
77961
|
id: "vue",
|
|
77876
77962
|
frameworkCli: "create-vue",
|
|
77877
77963
|
displayName: "Vue",
|
|
77878
77964
|
platform: "pages",
|
|
77965
|
+
hidden: true,
|
|
77879
77966
|
path: "templates/pages/vue",
|
|
77880
|
-
generate:
|
|
77967
|
+
generate: generate27,
|
|
77881
77968
|
transformPackageJson: async () => ({
|
|
77882
77969
|
scripts: {
|
|
77883
|
-
deploy: `${
|
|
77884
|
-
preview: `${
|
|
77970
|
+
deploy: `${npm22} run build && wrangler pages deploy ./dist`,
|
|
77971
|
+
preview: `${npm22} run build && wrangler pages dev ./dist`
|
|
77885
77972
|
}
|
|
77886
77973
|
}),
|
|
77887
77974
|
devScript: "dev",
|
|
77888
77975
|
deployScript: "deploy",
|
|
77889
77976
|
previewScript: "preview"
|
|
77890
77977
|
};
|
|
77891
|
-
var
|
|
77978
|
+
var c3_default48 = config45;
|
|
77892
77979
|
|
|
77893
77980
|
// templates/vue/workers/c3.ts
|
|
77894
|
-
var { npm:
|
|
77895
|
-
var
|
|
77981
|
+
var { npm: npm23 } = detectPackageManager();
|
|
77982
|
+
var generate28 = async (ctx) => {
|
|
77896
77983
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
77897
77984
|
type: "select",
|
|
77898
77985
|
question: "Would you like to use TypeScript?",
|
|
@@ -77909,7 +77996,7 @@ var generate27 = async (ctx) => {
|
|
|
77909
77996
|
]);
|
|
77910
77997
|
logRaw("");
|
|
77911
77998
|
};
|
|
77912
|
-
var
|
|
77999
|
+
var configure19 = async (ctx) => {
|
|
77913
78000
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77914
78001
|
dev: true,
|
|
77915
78002
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77930,7 +78017,7 @@ function updateTsconfigJson2() {
|
|
|
77930
78017
|
writeJSON("tsconfig.json", tsconfig);
|
|
77931
78018
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77932
78019
|
}
|
|
77933
|
-
var
|
|
78020
|
+
var config46 = {
|
|
77934
78021
|
configVersion: 1,
|
|
77935
78022
|
id: "vue",
|
|
77936
78023
|
frameworkCli: "create-vue",
|
|
@@ -77950,12 +78037,12 @@ var config32 = {
|
|
|
77950
78037
|
}
|
|
77951
78038
|
}
|
|
77952
78039
|
},
|
|
77953
|
-
configure:
|
|
77954
|
-
generate:
|
|
78040
|
+
configure: configure19,
|
|
78041
|
+
generate: generate28,
|
|
77955
78042
|
transformPackageJson: async (_3, ctx) => ({
|
|
77956
78043
|
scripts: {
|
|
77957
|
-
deploy: `${
|
|
77958
|
-
preview: `${
|
|
78044
|
+
deploy: `${npm23} run build && wrangler deploy`,
|
|
78045
|
+
preview: `${npm23} run build && wrangler dev`,
|
|
77959
78046
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77960
78047
|
}
|
|
77961
78048
|
}),
|
|
@@ -77963,20 +78050,20 @@ var config32 = {
|
|
|
77963
78050
|
deployScript: "deploy",
|
|
77964
78051
|
previewScript: "preview"
|
|
77965
78052
|
};
|
|
77966
|
-
var
|
|
78053
|
+
var c3_default49 = config46;
|
|
77967
78054
|
|
|
77968
78055
|
// templates/vue/c3.ts
|
|
77969
|
-
var
|
|
78056
|
+
var config47 = {
|
|
77970
78057
|
displayName: "Vue",
|
|
77971
|
-
platformVariants: { pages:
|
|
78058
|
+
platformVariants: { pages: c3_default48, workers: c3_default49 }
|
|
77972
78059
|
};
|
|
77973
|
-
var
|
|
78060
|
+
var c3_default50 = config47;
|
|
77974
78061
|
|
|
77975
78062
|
// src/git.ts
|
|
77976
78063
|
var import_node_assert = __toESM(require("node:assert"));
|
|
77977
78064
|
|
|
77978
78065
|
// ../wrangler/package.json
|
|
77979
|
-
var version2 = "0.0.0-
|
|
78066
|
+
var version2 = "0.0.0-db300ef98";
|
|
77980
78067
|
|
|
77981
78068
|
// src/git.ts
|
|
77982
78069
|
var offerGit = async (ctx) => {
|
|
@@ -78237,47 +78324,58 @@ var defaultSelectVariant = async (ctx) => {
|
|
|
78237
78324
|
function getFrameworkMap({ experimental = false }) {
|
|
78238
78325
|
if (experimental) {
|
|
78239
78326
|
return {
|
|
78240
|
-
|
|
78241
|
-
hono: c3_default5,
|
|
78242
|
-
next: c3_default6,
|
|
78243
|
-
qwik: c3_default7,
|
|
78244
|
-
remix: c3_default8,
|
|
78245
|
-
solid: c3_default9,
|
|
78246
|
-
svelte: c3_default10
|
|
78327
|
+
solid: c3_default
|
|
78247
78328
|
};
|
|
78248
78329
|
} else {
|
|
78249
78330
|
return {
|
|
78250
|
-
analog:
|
|
78251
|
-
angular:
|
|
78252
|
-
astro:
|
|
78253
|
-
docusaurus:
|
|
78254
|
-
gatsby:
|
|
78255
|
-
hono:
|
|
78331
|
+
analog: c3_default2,
|
|
78332
|
+
angular: c3_default5,
|
|
78333
|
+
astro: c3_default8,
|
|
78334
|
+
docusaurus: c3_default12,
|
|
78335
|
+
gatsby: c3_default15,
|
|
78336
|
+
hono: c3_default23,
|
|
78256
78337
|
next: c3_default26,
|
|
78257
78338
|
nuxt: c3_default29,
|
|
78258
|
-
qwik:
|
|
78259
|
-
react:
|
|
78260
|
-
|
|
78261
|
-
|
|
78262
|
-
|
|
78263
|
-
|
|
78339
|
+
qwik: c3_default35,
|
|
78340
|
+
react: c3_default39,
|
|
78341
|
+
"react-router": c3_default36,
|
|
78342
|
+
remix: c3_default42,
|
|
78343
|
+
solid: c3_default44,
|
|
78344
|
+
svelte: c3_default47,
|
|
78345
|
+
vue: c3_default50
|
|
78264
78346
|
};
|
|
78265
78347
|
}
|
|
78266
78348
|
}
|
|
78267
|
-
function
|
|
78349
|
+
function getOtherTemplateMap({
|
|
78350
|
+
experimental = false
|
|
78351
|
+
}) {
|
|
78268
78352
|
if (experimental) {
|
|
78353
|
+
return {};
|
|
78354
|
+
} else {
|
|
78269
78355
|
return {
|
|
78270
|
-
|
|
78271
|
-
|
|
78272
|
-
|
|
78356
|
+
common: c3_default9,
|
|
78357
|
+
scheduled: c3_default43,
|
|
78358
|
+
queues: c3_default32,
|
|
78359
|
+
openapi: c3_default30,
|
|
78360
|
+
"pre-existing": c3_default31
|
|
78273
78361
|
};
|
|
78362
|
+
}
|
|
78363
|
+
}
|
|
78364
|
+
function getHelloWorldTemplateMap({
|
|
78365
|
+
experimental = false
|
|
78366
|
+
}) {
|
|
78367
|
+
if (experimental) {
|
|
78368
|
+
return {};
|
|
78274
78369
|
} else {
|
|
78275
78370
|
return {
|
|
78276
|
-
"hello-world":
|
|
78277
|
-
|
|
78278
|
-
|
|
78371
|
+
"hello-world": c3_default20,
|
|
78372
|
+
"hello-world-assets-only": c3_default16,
|
|
78373
|
+
"hello-world-with-assets": c3_default19,
|
|
78374
|
+
"hello-world-durable-object": c3_default18,
|
|
78375
|
+
"hello-world-durable-object-with-assets": c3_default17,
|
|
78376
|
+
common: c3_default9,
|
|
78377
|
+
scheduled: c3_default43,
|
|
78279
78378
|
queues: c3_default32,
|
|
78280
|
-
"hello-world-durable-object": c3_default23,
|
|
78281
78379
|
openapi: c3_default30,
|
|
78282
78380
|
"pre-existing": c3_default31
|
|
78283
78381
|
};
|
|
@@ -78339,6 +78437,12 @@ var deriveCorrelatedArgs = (args) => {
|
|
|
78339
78437
|
};
|
|
78340
78438
|
var createContext = async (args, prevArgs) => {
|
|
78341
78439
|
deriveCorrelatedArgs(args);
|
|
78440
|
+
const experimental = args.experimental;
|
|
78441
|
+
const frameworkMap = getFrameworkMap({ experimental });
|
|
78442
|
+
const helloWorldTemplateMap = getHelloWorldTemplateMap({
|
|
78443
|
+
experimental
|
|
78444
|
+
});
|
|
78445
|
+
const otherTemplateMap = getOtherTemplateMap({ experimental });
|
|
78342
78446
|
let linesPrinted = 0;
|
|
78343
78447
|
const goBack = async (from) => {
|
|
78344
78448
|
const currentArgs = { ...args };
|
|
@@ -78385,22 +78489,29 @@ var createContext = async (args, prevArgs) => {
|
|
|
78385
78489
|
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
|
|
78386
78490
|
format: (val) => `./${val}`
|
|
78387
78491
|
});
|
|
78388
|
-
const categoryOptions = [
|
|
78389
|
-
|
|
78492
|
+
const categoryOptions = [];
|
|
78493
|
+
if (Object.keys(helloWorldTemplateMap).length) {
|
|
78494
|
+
categoryOptions.push({
|
|
78390
78495
|
label: "Hello World example",
|
|
78391
78496
|
value: "hello-world",
|
|
78392
78497
|
description: "Select from barebones examples to get started with Workers"
|
|
78393
|
-
}
|
|
78394
|
-
|
|
78498
|
+
});
|
|
78499
|
+
}
|
|
78500
|
+
if (Object.keys(frameworkMap).length) {
|
|
78501
|
+
categoryOptions.push({
|
|
78395
78502
|
label: "Framework Starter",
|
|
78396
78503
|
value: "web-framework",
|
|
78397
78504
|
description: "Select from the most popular full-stack web frameworks"
|
|
78398
|
-
}
|
|
78399
|
-
|
|
78505
|
+
});
|
|
78506
|
+
}
|
|
78507
|
+
if (Object.keys(otherTemplateMap).length) {
|
|
78508
|
+
categoryOptions.push({
|
|
78400
78509
|
label: "Application Starter",
|
|
78401
78510
|
value: "demo",
|
|
78402
78511
|
description: "Select from a range of starter applications using various Cloudflare products"
|
|
78403
|
-
}
|
|
78512
|
+
});
|
|
78513
|
+
}
|
|
78514
|
+
categoryOptions.push(
|
|
78404
78515
|
{
|
|
78405
78516
|
label: "Template from a GitHub repo",
|
|
78406
78517
|
value: "remote-template",
|
|
@@ -78409,7 +78520,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
78409
78520
|
// This is used only if the type is `pre-existing`
|
|
78410
78521
|
{ label: "Others", value: "others", hidden: true },
|
|
78411
78522
|
backOption
|
|
78412
|
-
|
|
78523
|
+
);
|
|
78413
78524
|
const category = await processArgument(args, "category", {
|
|
78414
78525
|
type: "select",
|
|
78415
78526
|
question: "What would you like to start with?",
|
|
@@ -78423,14 +78534,17 @@ var createContext = async (args, prevArgs) => {
|
|
|
78423
78534
|
}
|
|
78424
78535
|
let template;
|
|
78425
78536
|
if (category === "web-framework") {
|
|
78426
|
-
const
|
|
78427
|
-
|
|
78428
|
-
|
|
78429
|
-
|
|
78430
|
-
|
|
78431
|
-
|
|
78432
|
-
|
|
78433
|
-
|
|
78537
|
+
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
78538
|
+
(acc, [key, config48]) => {
|
|
78539
|
+
if (!config48.hidden || args.framework) {
|
|
78540
|
+
acc.push({
|
|
78541
|
+
label: config48.displayName,
|
|
78542
|
+
value: key
|
|
78543
|
+
});
|
|
78544
|
+
}
|
|
78545
|
+
return acc;
|
|
78546
|
+
},
|
|
78547
|
+
[]
|
|
78434
78548
|
);
|
|
78435
78549
|
const framework = await processArgument(args, "framework", {
|
|
78436
78550
|
type: "select",
|
|
@@ -78448,21 +78562,31 @@ var createContext = async (args, prevArgs) => {
|
|
|
78448
78562
|
throw new Error(`Unsupported framework: ${framework}`);
|
|
78449
78563
|
}
|
|
78450
78564
|
if ("platformVariants" in frameworkConfig) {
|
|
78565
|
+
const availableVariants = Object.entries(
|
|
78566
|
+
frameworkConfig.platformVariants
|
|
78567
|
+
).filter(([, config48]) => !config48.hidden);
|
|
78568
|
+
if (availableVariants.length === 1) {
|
|
78569
|
+
args.platform ??= availableVariants[0][0];
|
|
78570
|
+
}
|
|
78451
78571
|
const platform3 = await processArgument(args, "platform", {
|
|
78452
78572
|
type: "select",
|
|
78453
78573
|
label: "platform",
|
|
78454
78574
|
question: "Select your deployment platform",
|
|
78455
78575
|
options: [
|
|
78456
|
-
|
|
78457
|
-
|
|
78458
|
-
|
|
78459
|
-
|
|
78460
|
-
|
|
78461
|
-
|
|
78462
|
-
|
|
78463
|
-
|
|
78464
|
-
|
|
78465
|
-
|
|
78576
|
+
...args.platform === "workers" || !frameworkConfig.platformVariants.workers.hidden ? [
|
|
78577
|
+
{
|
|
78578
|
+
label: "Workers with Assets",
|
|
78579
|
+
value: "workers",
|
|
78580
|
+
description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
|
|
78581
|
+
}
|
|
78582
|
+
] : [],
|
|
78583
|
+
...args.platform === "pages" || !frameworkConfig.platformVariants.pages.hidden ? [
|
|
78584
|
+
{
|
|
78585
|
+
label: "Pages",
|
|
78586
|
+
value: "pages",
|
|
78587
|
+
description: "Great for simple websites and applications."
|
|
78588
|
+
}
|
|
78589
|
+
] : [],
|
|
78466
78590
|
backOption
|
|
78467
78591
|
],
|
|
78468
78592
|
defaultValue: "workers"
|
|
@@ -78481,18 +78605,14 @@ var createContext = async (args, prevArgs) => {
|
|
|
78481
78605
|
} else if (category === "remote-template") {
|
|
78482
78606
|
template = await processRemoteTemplate(args);
|
|
78483
78607
|
} else {
|
|
78484
|
-
const templateMap =
|
|
78485
|
-
experimental: args.experimental
|
|
78486
|
-
});
|
|
78608
|
+
const templateMap = category === "hello-world" ? helloWorldTemplateMap : otherTemplateMap;
|
|
78487
78609
|
const templateOptions = Object.entries(templateMap).map(
|
|
78488
78610
|
([value, { displayName, description, hidden: hidden2 }]) => {
|
|
78489
|
-
const isHelloWorldExample = value.startsWith("hello-world");
|
|
78490
|
-
const isCategoryMatched = category === "hello-world" ? isHelloWorldExample : !isHelloWorldExample;
|
|
78491
78611
|
return {
|
|
78492
78612
|
value,
|
|
78493
78613
|
label: displayName,
|
|
78494
78614
|
description,
|
|
78495
|
-
hidden: hidden2
|
|
78615
|
+
hidden: hidden2
|
|
78496
78616
|
};
|
|
78497
78617
|
}
|
|
78498
78618
|
);
|
|
@@ -78571,7 +78691,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
78571
78691
|
}
|
|
78572
78692
|
srcdir = (0, import_path13.join)(getTemplatePath(ctx), variantInfo.path);
|
|
78573
78693
|
}
|
|
78574
|
-
const copyDestDir =
|
|
78694
|
+
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
78575
78695
|
const destdir = (0, import_path13.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
78576
78696
|
const s = spinner();
|
|
78577
78697
|
s.start(`Copying template files`);
|
|
@@ -78594,29 +78714,29 @@ var processRemoteTemplate = async (args) => {
|
|
|
78594
78714
|
if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
|
|
78595
78715
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78596
78716
|
}
|
|
78597
|
-
const path6 = await downloadRemoteTemplate(src);
|
|
78598
|
-
const
|
|
78599
|
-
validateTemplate(path6,
|
|
78717
|
+
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
78718
|
+
const config48 = inferTemplateConfig(path6);
|
|
78719
|
+
validateTemplate(path6, config48);
|
|
78600
78720
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78601
78721
|
return {
|
|
78602
78722
|
path: path6,
|
|
78603
|
-
...
|
|
78723
|
+
...config48
|
|
78604
78724
|
};
|
|
78605
78725
|
};
|
|
78606
|
-
var validateTemplate = (path6,
|
|
78607
|
-
if (!
|
|
78726
|
+
var validateTemplate = (path6, config48) => {
|
|
78727
|
+
if (!config48.copyFiles) {
|
|
78608
78728
|
return;
|
|
78609
78729
|
}
|
|
78610
|
-
if (isVariantInfo(
|
|
78611
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78730
|
+
if (isVariantInfo(config48.copyFiles)) {
|
|
78731
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config48.copyFiles.path), config48);
|
|
78612
78732
|
} else {
|
|
78613
|
-
for (const variant of Object.values(
|
|
78614
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
78733
|
+
for (const variant of Object.values(config48.copyFiles.variants)) {
|
|
78734
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config48);
|
|
78615
78735
|
}
|
|
78616
78736
|
}
|
|
78617
78737
|
};
|
|
78618
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78619
|
-
if (
|
|
78738
|
+
var validateTemplateSrcDirectory = (path6, config48) => {
|
|
78739
|
+
if (config48.platform === "workers") {
|
|
78620
78740
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78621
78741
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78622
78742
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -78653,13 +78773,14 @@ var inferCopyFilesDefinition = (path6) => {
|
|
|
78653
78773
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
78654
78774
|
return copyFiles;
|
|
78655
78775
|
};
|
|
78656
|
-
var downloadRemoteTemplate = async (src) => {
|
|
78776
|
+
var downloadRemoteTemplate = async (src, mode) => {
|
|
78657
78777
|
try {
|
|
78658
78778
|
updateStatus(`Cloning template from: ${blue(src)}`);
|
|
78659
78779
|
const emitter = (0, import_degit.default)(src, {
|
|
78660
78780
|
cache: false,
|
|
78661
78781
|
verbose: false,
|
|
78662
|
-
force: true
|
|
78782
|
+
force: true,
|
|
78783
|
+
mode
|
|
78663
78784
|
});
|
|
78664
78785
|
const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path13.join)((0, import_os2.tmpdir)(), "c3-template"));
|
|
78665
78786
|
await emitter.clone(tmpDir);
|
|
@@ -78789,13 +78910,10 @@ var cliDefinition = {
|
|
|
78789
78910
|
values(args) {
|
|
78790
78911
|
const experimental = Boolean(args?.["experimental"]);
|
|
78791
78912
|
if (experimental) {
|
|
78792
|
-
return [
|
|
78793
|
-
{ name: "hello-world", description: "Hello World example" },
|
|
78794
|
-
{ name: "web-framework", description: "Framework Starter" }
|
|
78795
|
-
];
|
|
78913
|
+
return [{ name: "web-framework", description: "Framework Starter" }];
|
|
78796
78914
|
} else {
|
|
78797
78915
|
return [
|
|
78798
|
-
{ name: "hello-world", description: "Hello World
|
|
78916
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78799
78917
|
{ name: "web-framework", description: "Framework Starter" },
|
|
78800
78918
|
{ name: "demo", description: "Application Starter" },
|
|
78801
78919
|
{
|
|
@@ -78818,40 +78936,10 @@ var cliDefinition = {
|
|
|
78818
78936
|
`,
|
|
78819
78937
|
values(args) {
|
|
78820
78938
|
const experimental = Boolean(args?.["experimental"]);
|
|
78821
|
-
|
|
78822
|
-
|
|
78823
|
-
|
|
78824
|
-
|
|
78825
|
-
{
|
|
78826
|
-
name: "hello-world",
|
|
78827
|
-
description: "A basic \u201CHello World\u201D Cloudflare Worker."
|
|
78828
|
-
},
|
|
78829
|
-
{
|
|
78830
|
-
name: "hello-world-durable-object",
|
|
78831
|
-
description: "A basic \u201CHello World\u201D Cloudflare Worker with a Durable Worker."
|
|
78832
|
-
},
|
|
78833
|
-
{
|
|
78834
|
-
name: "common",
|
|
78835
|
-
description: "A Cloudflare Worker which implements a common example of routing/proxying functionalities."
|
|
78836
|
-
},
|
|
78837
|
-
{
|
|
78838
|
-
name: "scheduled",
|
|
78839
|
-
description: "A scheduled Cloudflare Worker (triggered via Cron Triggers)."
|
|
78840
|
-
},
|
|
78841
|
-
{
|
|
78842
|
-
name: "queues",
|
|
78843
|
-
description: "A Cloudflare Worker which is both a consumer and produced of Queues."
|
|
78844
|
-
},
|
|
78845
|
-
{
|
|
78846
|
-
name: "openapi",
|
|
78847
|
-
description: "A Worker implementing an OpenAPI REST endpoint."
|
|
78848
|
-
},
|
|
78849
|
-
{
|
|
78850
|
-
name: "pre-existing",
|
|
78851
|
-
description: "Fetch a Worker initialized from the Cloudflare dashboard."
|
|
78852
|
-
}
|
|
78853
|
-
];
|
|
78854
|
-
}
|
|
78939
|
+
return getNamesAndDescriptions({
|
|
78940
|
+
...getHelloWorldTemplateMap({ experimental }),
|
|
78941
|
+
...getOtherTemplateMap({ experimental })
|
|
78942
|
+
});
|
|
78855
78943
|
}
|
|
78856
78944
|
},
|
|
78857
78945
|
{
|
|
@@ -78866,7 +78954,7 @@ var cliDefinition = {
|
|
|
78866
78954
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
78867
78955
|
|
|
78868
78956
|
npm create cloudflare -- --framework next -- --ts
|
|
78869
|
-
pnpm create
|
|
78957
|
+
pnpm create cloudflare --framework next -- --ts
|
|
78870
78958
|
`,
|
|
78871
78959
|
values: (args) => getNamesAndDescriptions(
|
|
78872
78960
|
getFrameworkMap({
|
|
@@ -78880,12 +78968,12 @@ var cliDefinition = {
|
|
|
78880
78968
|
description: `Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.`,
|
|
78881
78969
|
values: [
|
|
78882
78970
|
{
|
|
78883
|
-
name: "
|
|
78884
|
-
description: "Create a web application that can be deployed to
|
|
78971
|
+
name: "workers",
|
|
78972
|
+
description: "Create a web application that can be deployed to Workers."
|
|
78885
78973
|
},
|
|
78886
78974
|
{
|
|
78887
|
-
name: "
|
|
78888
|
-
description: "Create a web application that can be deployed to
|
|
78975
|
+
name: "pages",
|
|
78976
|
+
description: "Create a web application that can be deployed to Pages."
|
|
78889
78977
|
}
|
|
78890
78978
|
],
|
|
78891
78979
|
requiresArg: true
|
|
@@ -78947,6 +79035,27 @@ var cliDefinition = {
|
|
|
78947
79035
|
npm create cloudflare -- --template https://github.com/cloudflare/workers-sdk/templates/worker-r2
|
|
78948
79036
|
`
|
|
78949
79037
|
},
|
|
79038
|
+
{
|
|
79039
|
+
name: "template-mode",
|
|
79040
|
+
type: "string",
|
|
79041
|
+
requiresArg: true,
|
|
79042
|
+
description: `The mechanism to use when fetching the template.
|
|
79043
|
+
|
|
79044
|
+
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
79045
|
+
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
79046
|
+
Otherwise, it will use "git".
|
|
79047
|
+
`,
|
|
79048
|
+
values: [
|
|
79049
|
+
{
|
|
79050
|
+
name: "git",
|
|
79051
|
+
description: "Use git to fetch the template. Supports private repositories."
|
|
79052
|
+
},
|
|
79053
|
+
{
|
|
79054
|
+
name: "tar",
|
|
79055
|
+
description: "Use tar to fetch the template. Only supported on public repositories hosted on GitHub, BitBucket, GitLab, or git.sr.ht."
|
|
79056
|
+
}
|
|
79057
|
+
]
|
|
79058
|
+
},
|
|
78950
79059
|
{
|
|
78951
79060
|
name: "accept-defaults",
|
|
78952
79061
|
alias: "y",
|
|
@@ -80527,20 +80636,20 @@ function applyEdits(text, edits) {
|
|
|
80527
80636
|
var import_fs12 = require("fs");
|
|
80528
80637
|
var import_path14 = require("path");
|
|
80529
80638
|
var import_toml2 = __toESM(require_toml());
|
|
80530
|
-
function ensureNameExists(
|
|
80531
|
-
|
|
80532
|
-
return
|
|
80639
|
+
function ensureNameExists(config48, projectName) {
|
|
80640
|
+
config48["name"] = projectName;
|
|
80641
|
+
return config48;
|
|
80533
80642
|
}
|
|
80534
|
-
async function ensureCompatDateExists(
|
|
80535
|
-
if (typeof
|
|
80643
|
+
async function ensureCompatDateExists(config48) {
|
|
80644
|
+
if (typeof config48["compatibility_date"] === "string") {
|
|
80536
80645
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80537
|
-
if (!
|
|
80538
|
-
|
|
80646
|
+
if (!config48["compatibility_date"].match(validCompatDateRe)) {
|
|
80647
|
+
config48["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80539
80648
|
}
|
|
80540
80649
|
} else {
|
|
80541
|
-
|
|
80650
|
+
config48["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80542
80651
|
}
|
|
80543
|
-
return
|
|
80652
|
+
return config48;
|
|
80544
80653
|
}
|
|
80545
80654
|
var updateWranglerConfig = async (ctx) => {
|
|
80546
80655
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -80551,12 +80660,15 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
80551
80660
|
const modified = await ensureCompatDateExists(
|
|
80552
80661
|
ensureNameExists(parsed, ctx.project.name)
|
|
80553
80662
|
);
|
|
80554
|
-
|
|
80663
|
+
let comment = `/**
|
|
80555
80664
|
* For more details on how to configure Wrangler, refer to:
|
|
80556
80665
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
80557
80666
|
*/
|
|
80558
|
-
{
|
|
80667
|
+
{`;
|
|
80668
|
+
if (!modified["$schema"]) {
|
|
80669
|
+
comment += `
|
|
80559
80670
|
"$schema": "node_modules/wrangler/config-schema.json",`;
|
|
80671
|
+
}
|
|
80560
80672
|
if (!modified["observability"]) {
|
|
80561
80673
|
modified["observability"] = { enabled: true };
|
|
80562
80674
|
}
|
|
@@ -80711,7 +80823,7 @@ var addVscodeConfig = (ctx) => {
|
|
|
80711
80823
|
|
|
80712
80824
|
// src/deploy.ts
|
|
80713
80825
|
var offerToDeploy = async (ctx) => {
|
|
80714
|
-
const { npm:
|
|
80826
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80715
80827
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
80716
80828
|
if (!await isDeployable(ctx)) {
|
|
80717
80829
|
ctx.args.deploy = false;
|
|
@@ -80722,7 +80834,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
80722
80834
|
);
|
|
80723
80835
|
}
|
|
80724
80836
|
const label = `deploy via \`${quoteShellArgs([
|
|
80725
|
-
|
|
80837
|
+
npm25,
|
|
80726
80838
|
"run",
|
|
80727
80839
|
ctx.template.deployScript ?? "deploy"
|
|
80728
80840
|
])}\``;
|
|
@@ -80759,11 +80871,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
80759
80871
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
80760
80872
|
};
|
|
80761
80873
|
var runDeploy = async (ctx) => {
|
|
80762
|
-
const { npm:
|
|
80874
|
+
const { npm: npm25, name: pm4 } = detectPackageManager();
|
|
80763
80875
|
if (!ctx.account?.id) {
|
|
80764
80876
|
throw new Error("Failed to read Cloudflare account.");
|
|
80765
80877
|
}
|
|
80766
|
-
const baseDeployCmd = [
|
|
80878
|
+
const baseDeployCmd = [npm25, "run", ctx.template.deployScript ?? "deploy"];
|
|
80767
80879
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
80768
80880
|
const deployCmd = [
|
|
80769
80881
|
...baseDeployCmd,
|
|
@@ -80879,14 +80991,14 @@ var printSummary = (ctx) => {
|
|
|
80879
80991
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
80880
80992
|
const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
80881
80993
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
80882
|
-
const { npm:
|
|
80994
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80883
80995
|
const devServerCommand = quoteShellArgs([
|
|
80884
|
-
|
|
80996
|
+
npm25,
|
|
80885
80997
|
"run",
|
|
80886
80998
|
ctx.template.devScript ?? "start"
|
|
80887
80999
|
]);
|
|
80888
81000
|
const deployCommand = quoteShellArgs([
|
|
80889
|
-
|
|
81001
|
+
npm25,
|
|
80890
81002
|
"run",
|
|
80891
81003
|
ctx.template.deployScript ?? "deploy"
|
|
80892
81004
|
]);
|
|
@@ -81254,8 +81366,8 @@ var renderValues = (values) => {
|
|
|
81254
81366
|
};
|
|
81255
81367
|
|
|
81256
81368
|
// src/helpers/retry.ts
|
|
81257
|
-
var retry = async (
|
|
81258
|
-
let { times } =
|
|
81369
|
+
var retry = async (config48, fn) => {
|
|
81370
|
+
let { times } = config48;
|
|
81259
81371
|
let error2 = null;
|
|
81260
81372
|
while (times > 0) {
|
|
81261
81373
|
try {
|
|
@@ -81263,10 +81375,10 @@ var retry = async (config34, fn) => {
|
|
|
81263
81375
|
} catch (e) {
|
|
81264
81376
|
error2 = e;
|
|
81265
81377
|
times--;
|
|
81266
|
-
if (
|
|
81378
|
+
if (config48.exitCondition?.(e)) {
|
|
81267
81379
|
break;
|
|
81268
81380
|
}
|
|
81269
|
-
await sleep(
|
|
81381
|
+
await sleep(config48.sleepMs ?? 1e3);
|
|
81270
81382
|
}
|
|
81271
81383
|
}
|
|
81272
81384
|
throw error2;
|
|
@@ -81356,14 +81468,14 @@ var createProject = async (ctx) => {
|
|
|
81356
81468
|
var import_fs13 = require("fs");
|
|
81357
81469
|
var import_path16 = require("path");
|
|
81358
81470
|
async function installWorkersTypes(ctx) {
|
|
81359
|
-
const { npm:
|
|
81471
|
+
const { npm: npm25 } = detectPackageManager();
|
|
81360
81472
|
if (!usesTypescript(ctx)) {
|
|
81361
81473
|
return;
|
|
81362
81474
|
}
|
|
81363
81475
|
await installPackages(["@cloudflare/workers-types"], {
|
|
81364
81476
|
dev: true,
|
|
81365
81477
|
startText: "Installing @cloudflare/workers-types",
|
|
81366
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
81478
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81367
81479
|
});
|
|
81368
81480
|
await addWorkersTypesToTsConfig(ctx);
|
|
81369
81481
|
}
|
|
@@ -81386,8 +81498,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81386
81498
|
}
|
|
81387
81499
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81388
81500
|
try {
|
|
81389
|
-
const
|
|
81390
|
-
const currentTypes =
|
|
81501
|
+
const config48 = parse4(tsconfig);
|
|
81502
|
+
const currentTypes = config48.compilerOptions?.types ?? [];
|
|
81391
81503
|
const explicitEntrypoint = currentTypes.some(
|
|
81392
81504
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81393
81505
|
);
|
|
@@ -81417,7 +81529,7 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81417
81529
|
}
|
|
81418
81530
|
|
|
81419
81531
|
// src/cli.ts
|
|
81420
|
-
var { npm:
|
|
81532
|
+
var { npm: npm24 } = detectPackageManager();
|
|
81421
81533
|
var main = async (argv) => {
|
|
81422
81534
|
const result = await parseArgs(argv);
|
|
81423
81535
|
if (result.type === "unknown") {
|
|
@@ -81453,16 +81565,16 @@ ${result.errorMessage}`);
|
|
|
81453
81565
|
};
|
|
81454
81566
|
var runLatest = async () => {
|
|
81455
81567
|
const args = process.argv.slice(2);
|
|
81456
|
-
if (
|
|
81568
|
+
if (npm24 === "npm") {
|
|
81457
81569
|
args.unshift("--");
|
|
81458
81570
|
}
|
|
81459
|
-
await runCommand([
|
|
81571
|
+
await runCommand([npm24, "create", "cloudflare@latest", ...args]);
|
|
81460
81572
|
};
|
|
81461
81573
|
var runCli = async (args) => {
|
|
81462
81574
|
printBanner(args);
|
|
81463
81575
|
const ctx = await createContext(args);
|
|
81464
81576
|
await create(ctx);
|
|
81465
|
-
await
|
|
81577
|
+
await configure20(ctx);
|
|
81466
81578
|
await deploy(ctx);
|
|
81467
81579
|
printSummary(ctx);
|
|
81468
81580
|
logRaw("");
|
|
@@ -81490,7 +81602,7 @@ var create = async (ctx) => {
|
|
|
81490
81602
|
await rectifyPmMismatch(ctx);
|
|
81491
81603
|
endSection(`Application created`);
|
|
81492
81604
|
};
|
|
81493
|
-
var
|
|
81605
|
+
var configure20 = async (ctx) => {
|
|
81494
81606
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
81495
81607
|
await installWrangler();
|
|
81496
81608
|
await installWorkersTypes(ctx);
|