create-cloudflare 0.0.0-fd9dff833 → 0.0.0-fdae3f766
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 +1314 -1185
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/templates/analog/c3.ts +0 -24
- package/templates/analog/templates/env.d.ts +1 -1
- package/templates/angular/pages/c3.ts +4 -3
- package/templates/angular/pages/templates/wrangler.jsonc +5 -0
- package/templates/angular/workers/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-experimental/astro/templates/ts → templates/astro/workers/templates/js}/wrangler.jsonc +2 -1
- package/templates/astro/workers/templates/ts/public/.assetsignore +2 -0
- package/{templates-experimental/astro/templates/js → templates/astro/workers/templates/ts}/wrangler.jsonc +3 -2
- package/templates/common/c3.ts +5 -1
- package/templates/common/ts/tsconfig.json +0 -3
- package/templates/docusaurus/pages/c3.ts +2 -0
- package/templates/docusaurus/workers/c3.ts +1 -0
- package/templates/gatsby/pages/c3.ts +2 -0
- package/templates/gatsby/workers/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/README.md +2 -2
- package/templates/hello-world/py/pyproject.toml +1 -1
- package/templates/hello-world/py/src/entry.py +3 -2
- 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/test/index.spec.ts +0 -1
- package/templates/hello-world/ts/test/tsconfig.json +1 -1
- package/templates/hello-world/ts/tsconfig.json +0 -2
- package/{templates-experimental → templates}/hello-world-assets-only/c3.ts +4 -3
- package/{templates-experimental → templates}/hello-world-assets-only/templates/public/index.html +1 -0
- package/{templates-experimental → templates}/hello-world-assets-only/templates/wrangler.jsonc +1 -0
- package/templates/hello-world-durable-object/c3.ts +9 -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/py/.python-version +1 -0
- package/templates/hello-world-durable-object/py/README.md +23 -0
- package/templates/hello-world-durable-object/py/__dot__gitignore +68 -0
- package/templates/hello-world-durable-object/py/package.json +13 -0
- package/templates/hello-world-durable-object/py/pyproject.toml +9 -0
- package/templates/hello-world-durable-object/py/src/entry.py +66 -0
- package/templates/hello-world-durable-object/py/uv.lock +22 -0
- package/templates/hello-world-durable-object/py/wrangler.jsonc +27 -0
- package/templates/hello-world-durable-object/ts/src/index.ts +10 -9
- package/templates/hello-world-durable-object/ts/tsconfig.json +0 -2
- package/templates/hello-world-durable-object/ts/wrangler.jsonc +1 -1
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/c3.ts +6 -3
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/js/public/index.html +1 -0
- 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 +3 -3
- package/templates/hello-world-durable-object-with-assets/py/.python-version +1 -0
- package/templates/hello-world-durable-object-with-assets/py/README.md +23 -0
- package/{templates-experimental/hello-world-durable-object-with-assets/ts → templates/hello-world-durable-object-with-assets/py}/public/index.html +1 -0
- package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +9 -0
- package/templates/hello-world-durable-object-with-assets/py/src/entry.py +66 -0
- package/templates/hello-world-durable-object-with-assets/py/uv.lock +22 -0
- package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +31 -0
- package/templates/hello-world-durable-object-with-assets/ts/public/index.html +20 -0
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/src/index.ts +10 -9
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/tsconfig.json +0 -2
- package/{templates-experimental → templates}/hello-world-durable-object-with-assets/ts/wrangler.jsonc +2 -2
- 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/hello-world-with-assets/py → templates/hello-world-with-assets/js}/public/index.html +3 -2
- package/{templates-experimental → templates}/hello-world-with-assets/js/wrangler.jsonc +3 -2
- package/templates/hello-world-with-assets/py/.python-version +1 -0
- package/templates/hello-world-with-assets/py/README.md +23 -0
- package/templates/hello-world-with-assets/py/__dot__gitignore +68 -0
- package/templates/hello-world-with-assets/py/package.json +13 -0
- package/{templates-experimental/hello-world-with-assets/ts → templates/hello-world-with-assets/py}/public/index.html +3 -2
- package/templates/hello-world-with-assets/py/pyproject.toml +9 -0
- package/templates/hello-world-with-assets/py/src/entry.py +11 -0
- package/templates/hello-world-with-assets/py/uv.lock +22 -0
- package/{templates-experimental → templates}/hello-world-with-assets/py/wrangler.jsonc +1 -1
- package/{templates-experimental → templates}/hello-world-with-assets/ts/package.json +1 -1
- package/{templates-experimental/hello-world-with-assets/js → templates/hello-world-with-assets/ts}/public/index.html +3 -2
- package/templates/hello-world-with-assets/ts/test/env.d.ts +3 -0
- package/templates/hello-world-with-assets/ts/test/tsconfig.json +8 -0
- package/{templates-experimental → templates}/hello-world-with-assets/ts/tsconfig.json +0 -2
- package/{templates-experimental → templates}/hello-world-with-assets/ts/wrangler.jsonc +2 -2
- package/templates/hono/c3.ts +5 -66
- package/templates/hono/pages/c3.ts +47 -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 +5 -5
- package/templates/next/c3.ts +7 -221
- package/templates/next/pages/c3.ts +221 -0
- package/{templates-experimental/next → templates/next/workers}/c3.ts +12 -16
- package/templates/next/workers/templates/open-next.config.ts +9 -0
- package/{templates-experimental/next → templates/next/workers}/templates/wrangler.jsonc +3 -2
- package/templates/nuxt/pages/c3.ts +4 -26
- package/templates/nuxt/pages/templates/env.d.ts +1 -1
- package/templates/nuxt/workers/c3.ts +3 -26
- package/templates/nuxt/workers/templates/env.d.ts +1 -1
- 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 -21
- package/templates/pre-existing/c3.ts +6 -2
- package/templates/queues/c3.ts +5 -1
- package/templates/queues/ts/tsconfig.json +0 -2
- package/templates/qwik/c3.ts +5 -144
- package/templates/qwik/pages/c3.ts +151 -0
- package/{templates-experimental/qwik → templates/qwik/workers}/c3.ts +5 -6
- package/{templates-experimental/qwik → templates/qwik/workers}/templates/wrangler.jsonc +2 -1
- package/templates/react/pages/c3.ts +5 -2
- package/templates/react/pages/templates/wrangler.jsonc +5 -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 +41 -0
- package/templates/remix/c3.ts +6 -63
- package/templates/remix/pages/c3.ts +70 -0
- package/{templates-experimental/remix → templates/remix/workers}/c3.ts +3 -2
- package/templates/remix/workers/templates/worker-configuration.d.ts +4 -0
- 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/scheduled/ts/tsconfig.json +0 -2
- package/templates/solid/c3.ts +1 -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 +6 -6
- package/templates/svelte/workers/templates/static/.assetsignore +2 -0
- package/templates/vue/pages/c3.ts +6 -3
- package/templates/vue/pages/templates/wrangler.jsonc +5 -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/tsconfig.worker.json +1 -1
- package/templates/vue/workers/ts/wrangler.jsonc +0 -1
- package/templates-experimental/solid/c3.ts +1 -1
- package/templates/analog/templates/worker-configuration.d.ts +0 -4
- package/templates/astro/templates/ts/worker-configuration.d.ts +0 -4
- package/templates/common/ts/worker-configuration.d.ts +0 -4
- package/templates/hello-world/ts/worker-configuration.d.ts +0 -4
- package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +0 -5
- package/templates/hono/snippets/appDeclaration.ts +0 -1
- package/templates/hono/templates/worker-configuration.d.ts +0 -4
- package/templates/next/env.d.ts +0 -5
- package/templates/nuxt/pages/templates/worker-configuration.d.ts +0 -4
- package/templates/nuxt/workers/templates/worker-configuration.d.ts +0 -4
- package/templates/openapi/ts/worker-configuration.d.ts +0 -4
- package/templates/queues/ts/worker-configuration.d.ts +0 -5
- package/templates/qwik/templates/worker-configuration.d.ts +0 -4
- package/templates/react/workers/ts/worker-configuration.d.ts +0 -5
- package/templates/remix/templates/worker-configuration.d.ts +0 -4
- package/templates/scheduled/ts/worker-configuration.d.ts +0 -4
- package/templates/vue/workers/ts/worker-configuration.d.ts +0 -6
- 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/hello-world-with-assets/py/src/entry.py +0 -9
- package/templates-experimental/hello-world-with-assets/ts/test/tsconfig.json +0 -8
- package/templates-experimental/hono/templates/worker-configuration.d.ts +0 -4
- package/templates-experimental/next/templates/cloudflare-env.d.ts +0 -5
- 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/astro/{templates → workers/templates}/ts/src/env.d.ts +0 -0
- /package/{templates-experimental → templates}/hello-world-assets-only/templates/package.json +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/hello-world-with-assets → templates/hello-world-durable-object-with-assets}/py/__dot__gitignore +0 -0
- /package/{templates-experimental/hello-world-with-assets → templates/hello-world-durable-object-with-assets}/py/package.json +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-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/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/vitest.config.mts +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-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/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/qwik → templates/qwik/pages}/snippets/getPlatformProxy.ts +0 -0
- /package/{templates-experimental/hello-world-with-assets/ts → 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-experimental/qwik → templates/qwik/workers}/templates/worker-configuration.d.ts +0 -0
- /package/{templates-experimental/remix → templates/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/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() {
|
|
@@ -3111,8 +3111,8 @@ var require_path_key = __commonJS({
|
|
|
3111
3111
|
"use strict";
|
|
3112
3112
|
var pathKey = (options = {}) => {
|
|
3113
3113
|
const environment = options.env || process.env;
|
|
3114
|
-
const
|
|
3115
|
-
if (
|
|
3114
|
+
const platform = options.platform || process.platform;
|
|
3115
|
+
if (platform !== "win32") {
|
|
3116
3116
|
return "PATH";
|
|
3117
3117
|
}
|
|
3118
3118
|
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
@@ -26411,7 +26411,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
26411
26411
|
}
|
|
26412
26412
|
var origCwd = process.cwd;
|
|
26413
26413
|
var cwd = null;
|
|
26414
|
-
var
|
|
26414
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
26415
26415
|
process.cwd = function() {
|
|
26416
26416
|
if (!cwd)
|
|
26417
26417
|
cwd = origCwd.call(process);
|
|
@@ -26466,7 +26466,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
26466
26466
|
fs4.lchownSync = function() {
|
|
26467
26467
|
};
|
|
26468
26468
|
}
|
|
26469
|
-
if (
|
|
26469
|
+
if (platform === "win32") {
|
|
26470
26470
|
fs4.rename = /* @__PURE__ */ function(fs$rename) {
|
|
26471
26471
|
return function(from, to, cb) {
|
|
26472
26472
|
var start = Date.now();
|
|
@@ -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
|
|
@@ -31639,7 +31639,7 @@ var require_open = __commonJS({
|
|
|
31639
31639
|
var isDocker = require_is_docker();
|
|
31640
31640
|
var defineLazyProperty = require_define_lazy_prop();
|
|
31641
31641
|
var localXdgOpenPath = path6.join(__dirname, "xdg-open");
|
|
31642
|
-
var { platform
|
|
31642
|
+
var { platform, arch } = process;
|
|
31643
31643
|
var getWslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
31644
31644
|
const defaultMountPoint = "/mnt/";
|
|
31645
31645
|
let mountPoint;
|
|
@@ -31706,7 +31706,7 @@ var require_open = __commonJS({
|
|
|
31706
31706
|
let command2;
|
|
31707
31707
|
const cliArguments = [];
|
|
31708
31708
|
const childProcessOptions = {};
|
|
31709
|
-
if (
|
|
31709
|
+
if (platform === "darwin") {
|
|
31710
31710
|
command2 = "open";
|
|
31711
31711
|
if (options.wait) {
|
|
31712
31712
|
cliArguments.push("--wait-apps");
|
|
@@ -31720,7 +31720,7 @@ var require_open = __commonJS({
|
|
|
31720
31720
|
if (app) {
|
|
31721
31721
|
cliArguments.push("-a", app);
|
|
31722
31722
|
}
|
|
31723
|
-
} else if (
|
|
31723
|
+
} else if (platform === "win32" || isWsl && !isDocker()) {
|
|
31724
31724
|
const mountPoint = await getWslDrivesMountPoint();
|
|
31725
31725
|
command2 = isWsl ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
|
|
31726
31726
|
cliArguments.push(
|
|
@@ -31761,7 +31761,7 @@ var require_open = __commonJS({
|
|
|
31761
31761
|
exeLocalXdgOpen = true;
|
|
31762
31762
|
} catch {
|
|
31763
31763
|
}
|
|
31764
|
-
const useSystemXdgOpen = process.versions.electron ||
|
|
31764
|
+
const useSystemXdgOpen = process.versions.electron || platform === "android" || isBundled || !exeLocalXdgOpen;
|
|
31765
31765
|
command2 = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
31766
31766
|
}
|
|
31767
31767
|
if (appArguments.length > 0) {
|
|
@@ -31775,7 +31775,7 @@ var require_open = __commonJS({
|
|
|
31775
31775
|
if (options.target) {
|
|
31776
31776
|
cliArguments.push(options.target);
|
|
31777
31777
|
}
|
|
31778
|
-
if (
|
|
31778
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
31779
31779
|
cliArguments.push("--args", ...appArguments);
|
|
31780
31780
|
}
|
|
31781
31781
|
const subprocess = childProcess.spawn(command2, cliArguments, childProcessOptions);
|
|
@@ -31829,12 +31829,12 @@ var require_open = __commonJS({
|
|
|
31829
31829
|
}
|
|
31830
31830
|
return archBinary;
|
|
31831
31831
|
}
|
|
31832
|
-
function detectPlatformBinary({ [
|
|
31832
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
31833
31833
|
if (wsl && isWsl) {
|
|
31834
31834
|
return detectArchBinary(wsl);
|
|
31835
31835
|
}
|
|
31836
31836
|
if (!platformBinary) {
|
|
31837
|
-
throw new Error(`${
|
|
31837
|
+
throw new Error(`${platform} is not supported`);
|
|
31838
31838
|
}
|
|
31839
31839
|
return detectArchBinary(platformBinary);
|
|
31840
31840
|
}
|
|
@@ -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-fdae3f766";
|
|
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":
|
|
@@ -74892,8 +74892,8 @@ function promiseWithResolvers() {
|
|
|
74892
74892
|
return { resolve: resolve12, reject, promise };
|
|
74893
74893
|
}
|
|
74894
74894
|
function getPlatform() {
|
|
74895
|
-
const
|
|
74896
|
-
switch (
|
|
74895
|
+
const platform = process.platform;
|
|
74896
|
+
switch (platform) {
|
|
74897
74897
|
case "win32":
|
|
74898
74898
|
return "Windows";
|
|
74899
74899
|
case "darwin":
|
|
@@ -74901,18 +74901,18 @@ function getPlatform() {
|
|
|
74901
74901
|
case "linux":
|
|
74902
74902
|
return "Linux";
|
|
74903
74903
|
default:
|
|
74904
|
-
return `Others: ${
|
|
74904
|
+
return `Others: ${platform}`;
|
|
74905
74905
|
}
|
|
74906
74906
|
}
|
|
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
|
-
const
|
|
74915
|
+
const platform = getPlatform();
|
|
74916
74916
|
const amplitude_session_id = Date.now();
|
|
74917
74917
|
const enableLog = process.env.CREATE_CLOUDFLARE_TELEMETRY_DEBUG === "1";
|
|
74918
74918
|
let amplitude_event_id = 0;
|
|
@@ -74928,7 +74928,7 @@ function createReporter() {
|
|
|
74928
74928
|
properties: {
|
|
74929
74929
|
amplitude_session_id,
|
|
74930
74930
|
amplitude_event_id: amplitude_event_id++,
|
|
74931
|
-
platform
|
|
74931
|
+
platform,
|
|
74932
74932
|
c3Version: version,
|
|
74933
74933
|
isFirstUsage,
|
|
74934
74934
|
packageManager: packageManager.name,
|
|
@@ -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.4",
|
|
75339
75339
|
"create-analog": "1.8.1",
|
|
75340
|
-
"@angular/create": "19.
|
|
75340
|
+
"@angular/create": "19.2.12",
|
|
75341
75341
|
"create-docusaurus": "3.7.0",
|
|
75342
|
-
"create-hono": "0.
|
|
75343
|
-
"create-next-app": "15.2
|
|
75344
|
-
"create-qwik": "1.
|
|
75345
|
-
"create-vite": "6.
|
|
75346
|
-
"create-remix": "2.
|
|
75347
|
-
"create-
|
|
75348
|
-
"create-
|
|
75349
|
-
|
|
75350
|
-
|
|
75351
|
-
|
|
75342
|
+
"create-hono": "0.19.1",
|
|
75343
|
+
"create-next-app": "15.3.2",
|
|
75344
|
+
"create-qwik": "1.13.0",
|
|
75345
|
+
"create-vite": "6.5.0",
|
|
75346
|
+
"create-remix": "2.16.6",
|
|
75347
|
+
"create-react-router": "7.6.0",
|
|
75348
|
+
"create-solid": "0.6.2",
|
|
75349
|
+
"create-vue": "3.16.4",
|
|
75350
|
+
gatsby: "5.14.3",
|
|
75351
|
+
sv: "0.8.6",
|
|
75352
|
+
nuxi: "3.25.1"
|
|
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");
|
|
@@ -75863,10 +75483,6 @@ async function getWorkerdCompatibilityDate() {
|
|
|
75863
75483
|
);
|
|
75864
75484
|
return fallbackDate;
|
|
75865
75485
|
}
|
|
75866
|
-
var compatDateFlag = async () => {
|
|
75867
|
-
const workerdCompatDate = await getWorkerdCompatibilityDate();
|
|
75868
|
-
return `--compatibility-date=${workerdCompatDate}`;
|
|
75869
|
-
};
|
|
75870
75486
|
function getLatestTypesEntrypoint(ctx) {
|
|
75871
75487
|
const workersTypesPath = (0, import_path9.resolve)(
|
|
75872
75488
|
ctx.project.path,
|
|
@@ -75887,18 +75503,18 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
75887
75503
|
}
|
|
75888
75504
|
|
|
75889
75505
|
// templates-experimental/solid/c3.ts
|
|
75890
|
-
var
|
|
75891
|
-
var { npm
|
|
75892
|
-
var
|
|
75506
|
+
var recast2 = __toESM(require_main3());
|
|
75507
|
+
var { npm } = detectPackageManager();
|
|
75508
|
+
var generate = async (ctx) => {
|
|
75893
75509
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
75894
75510
|
logRaw("");
|
|
75895
75511
|
};
|
|
75896
|
-
var
|
|
75512
|
+
var configure = async (ctx) => {
|
|
75897
75513
|
const packages = ["nitropack"];
|
|
75898
75514
|
await installPackages(packages, {
|
|
75899
75515
|
dev: true,
|
|
75900
75516
|
startText: "Installing nitro module `nitropack`",
|
|
75901
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75517
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
|
|
75902
75518
|
});
|
|
75903
75519
|
usesTypescript(ctx);
|
|
75904
75520
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -75910,7 +75526,7 @@ var configure5 = async (ctx) => {
|
|
|
75910
75526
|
if (callee.name !== "defineConfig") {
|
|
75911
75527
|
return this.traverse(n);
|
|
75912
75528
|
}
|
|
75913
|
-
const b3 =
|
|
75529
|
+
const b3 = recast2.types.builders;
|
|
75914
75530
|
mergeObjectProperties(
|
|
75915
75531
|
n.node.arguments[0],
|
|
75916
75532
|
[
|
|
@@ -75934,7 +75550,7 @@ var configure5 = async (ctx) => {
|
|
|
75934
75550
|
}
|
|
75935
75551
|
});
|
|
75936
75552
|
};
|
|
75937
|
-
var
|
|
75553
|
+
var config = {
|
|
75938
75554
|
configVersion: 1,
|
|
75939
75555
|
id: "solid",
|
|
75940
75556
|
frameworkCli: "create-solid",
|
|
@@ -75944,124 +75560,25 @@ var config7 = {
|
|
|
75944
75560
|
path: "./templates"
|
|
75945
75561
|
},
|
|
75946
75562
|
path: "templates-experimental/solid",
|
|
75947
|
-
generate
|
|
75948
|
-
configure
|
|
75563
|
+
generate,
|
|
75564
|
+
configure,
|
|
75949
75565
|
transformPackageJson: async () => ({
|
|
75950
75566
|
scripts: {
|
|
75951
|
-
preview: `${
|
|
75952
|
-
deploy: `${
|
|
75567
|
+
preview: `${npm} run build && npx wrangler dev`,
|
|
75568
|
+
deploy: `${npm} run build && wrangler deploy`,
|
|
75569
|
+
"cf-typegen": `wrangler types`
|
|
75953
75570
|
}
|
|
75954
75571
|
}),
|
|
75955
|
-
compatibilityFlags: ["nodejs_compat"],
|
|
75956
|
-
devScript: "dev",
|
|
75957
|
-
deployScript: "deploy",
|
|
75958
|
-
previewScript: "preview"
|
|
75959
|
-
};
|
|
75960
|
-
var c3_default9 = config7;
|
|
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
75572
|
devScript: "dev",
|
|
76056
75573
|
deployScript: "deploy",
|
|
76057
75574
|
previewScript: "preview"
|
|
76058
75575
|
};
|
|
76059
|
-
var
|
|
75576
|
+
var c3_default = config;
|
|
76060
75577
|
|
|
76061
75578
|
// templates/analog/c3.ts
|
|
76062
|
-
var
|
|
76063
|
-
var { npm:
|
|
76064
|
-
var
|
|
75579
|
+
var recast3 = __toESM(require_main3());
|
|
75580
|
+
var { npm: npm2, name: pm } = detectPackageManager();
|
|
75581
|
+
var generate2 = async (ctx) => {
|
|
76065
75582
|
await runFrameworkGenerator(ctx, [
|
|
76066
75583
|
ctx.project.name,
|
|
76067
75584
|
"--template",
|
|
@@ -76069,7 +75586,7 @@ var generate8 = async (ctx) => {
|
|
|
76069
75586
|
]);
|
|
76070
75587
|
logRaw("");
|
|
76071
75588
|
};
|
|
76072
|
-
var
|
|
75589
|
+
var configure2 = async (ctx) => {
|
|
76073
75590
|
if (pm === "pnpm" || pm === "yarn" || pm === "bun") {
|
|
76074
75591
|
const packages = [];
|
|
76075
75592
|
packages.push("nitropack");
|
|
@@ -76079,28 +75596,13 @@ var configure7 = async (ctx) => {
|
|
|
76079
75596
|
await installPackages(packages, {
|
|
76080
75597
|
dev: true,
|
|
76081
75598
|
startText: `Installing ${packages.join(", ")}`,
|
|
76082
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75599
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm2} install\``)}`
|
|
76083
75600
|
});
|
|
76084
75601
|
}
|
|
76085
75602
|
updateViteConfig(ctx);
|
|
76086
|
-
updateEnvTypes(ctx);
|
|
76087
|
-
};
|
|
76088
|
-
var updateEnvTypes = (ctx) => {
|
|
76089
|
-
const filepath = "env.d.ts";
|
|
76090
|
-
const s = spinner();
|
|
76091
|
-
s.start(`Updating ${filepath}`);
|
|
76092
|
-
let file = readFile(filepath);
|
|
76093
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
76094
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
76095
|
-
if (latestEntrypoint) {
|
|
76096
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
76097
|
-
}
|
|
76098
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
76099
|
-
writeFile2("env.d.ts", file);
|
|
76100
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76101
75603
|
};
|
|
76102
75604
|
var updateViteConfig = (ctx) => {
|
|
76103
|
-
const b3 =
|
|
75605
|
+
const b3 = recast3.types.builders;
|
|
76104
75606
|
const s = spinner();
|
|
76105
75607
|
const configFile = "vite.config.ts";
|
|
76106
75608
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76137,7 +75639,7 @@ var updateViteConfig = (ctx) => {
|
|
|
76137
75639
|
});
|
|
76138
75640
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76139
75641
|
};
|
|
76140
|
-
var
|
|
75642
|
+
var config2 = {
|
|
76141
75643
|
configVersion: 1,
|
|
76142
75644
|
id: "analog",
|
|
76143
75645
|
frameworkCli: "create-analog",
|
|
@@ -76146,12 +75648,12 @@ var config9 = {
|
|
|
76146
75648
|
copyFiles: {
|
|
76147
75649
|
path: "./templates"
|
|
76148
75650
|
},
|
|
76149
|
-
generate:
|
|
76150
|
-
configure:
|
|
75651
|
+
generate: generate2,
|
|
75652
|
+
configure: configure2,
|
|
76151
75653
|
transformPackageJson: async () => ({
|
|
76152
75654
|
scripts: {
|
|
76153
|
-
preview: `${
|
|
76154
|
-
deploy: `${
|
|
75655
|
+
preview: `${npm2} run build && wrangler pages dev`,
|
|
75656
|
+
deploy: `${npm2} run build && wrangler pages deploy`,
|
|
76155
75657
|
"cf-typegen": `wrangler types`
|
|
76156
75658
|
}
|
|
76157
75659
|
}),
|
|
@@ -76159,12 +75661,12 @@ var config9 = {
|
|
|
76159
75661
|
deployScript: "deploy",
|
|
76160
75662
|
previewScript: "preview"
|
|
76161
75663
|
};
|
|
76162
|
-
var
|
|
75664
|
+
var c3_default2 = config2;
|
|
76163
75665
|
|
|
76164
75666
|
// templates/angular/pages/c3.ts
|
|
76165
75667
|
var import_node_path3 = require("node:path");
|
|
76166
|
-
var { npm:
|
|
76167
|
-
var
|
|
75668
|
+
var { npm: npm3 } = detectPackageManager();
|
|
75669
|
+
var generate3 = async (ctx) => {
|
|
76168
75670
|
await runFrameworkGenerator(ctx, [
|
|
76169
75671
|
ctx.project.name,
|
|
76170
75672
|
"--ssr",
|
|
@@ -76172,7 +75674,7 @@ var generate9 = async (ctx) => {
|
|
|
76172
75674
|
]);
|
|
76173
75675
|
logRaw("");
|
|
76174
75676
|
};
|
|
76175
|
-
var
|
|
75677
|
+
var configure3 = async (ctx) => {
|
|
76176
75678
|
updateAngularJson(ctx);
|
|
76177
75679
|
await updateAppCode();
|
|
76178
75680
|
await installCFWorker();
|
|
@@ -76181,7 +75683,7 @@ async function installCFWorker() {
|
|
|
76181
75683
|
await installPackages(["xhr2"], {
|
|
76182
75684
|
dev: true,
|
|
76183
75685
|
startText: "Installing additional dependencies",
|
|
76184
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75686
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm3} install\``)}`
|
|
76185
75687
|
});
|
|
76186
75688
|
}
|
|
76187
75689
|
async function updateAppCode() {
|
|
@@ -76223,12 +75725,13 @@ function updateAngularJson(ctx) {
|
|
|
76223
75725
|
writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76224
75726
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76225
75727
|
}
|
|
76226
|
-
var
|
|
75728
|
+
var config3 = {
|
|
76227
75729
|
configVersion: 1,
|
|
76228
75730
|
id: "angular",
|
|
76229
75731
|
frameworkCli: "@angular/create",
|
|
76230
75732
|
displayName: "Angular",
|
|
76231
75733
|
platform: "pages",
|
|
75734
|
+
hidden: true,
|
|
76232
75735
|
copyFiles: {
|
|
76233
75736
|
path: "./templates"
|
|
76234
75737
|
},
|
|
@@ -76236,23 +75739,24 @@ var config10 = {
|
|
|
76236
75739
|
devScript: "start",
|
|
76237
75740
|
deployScript: "deploy",
|
|
76238
75741
|
previewScript: "start",
|
|
76239
|
-
generate:
|
|
76240
|
-
configure:
|
|
75742
|
+
generate: generate3,
|
|
75743
|
+
configure: configure3,
|
|
76241
75744
|
transformPackageJson: async () => ({
|
|
76242
75745
|
scripts: {
|
|
76243
|
-
start: `${
|
|
76244
|
-
build: `ng build && ${
|
|
75746
|
+
start: `${npm3} run build && wrangler pages dev`,
|
|
75747
|
+
build: `ng build && ${npm3} run process`,
|
|
76245
75748
|
process: "node ./tools/copy-files.mjs",
|
|
76246
|
-
deploy: `${
|
|
75749
|
+
deploy: `${npm3} run build && wrangler pages deploy`,
|
|
75750
|
+
"cf-typegen": `wrangler types`
|
|
76247
75751
|
}
|
|
76248
75752
|
})
|
|
76249
75753
|
};
|
|
76250
|
-
var
|
|
75754
|
+
var c3_default3 = config3;
|
|
76251
75755
|
|
|
76252
75756
|
// templates/angular/workers/c3.ts
|
|
76253
75757
|
var import_node_path4 = require("node:path");
|
|
76254
|
-
var { npm:
|
|
76255
|
-
var
|
|
75758
|
+
var { npm: npm4 } = detectPackageManager();
|
|
75759
|
+
var generate4 = async (ctx) => {
|
|
76256
75760
|
await runFrameworkGenerator(ctx, [
|
|
76257
75761
|
ctx.project.name,
|
|
76258
75762
|
"--ssr",
|
|
@@ -76260,7 +75764,7 @@ var generate10 = async (ctx) => {
|
|
|
76260
75764
|
]);
|
|
76261
75765
|
logRaw("");
|
|
76262
75766
|
};
|
|
76263
|
-
var
|
|
75767
|
+
var configure4 = async (ctx) => {
|
|
76264
75768
|
updateAngularJson2(ctx);
|
|
76265
75769
|
await updateAppCode2();
|
|
76266
75770
|
await installCFWorker2();
|
|
@@ -76269,7 +75773,7 @@ async function installCFWorker2() {
|
|
|
76269
75773
|
await installPackages(["xhr2"], {
|
|
76270
75774
|
dev: true,
|
|
76271
75775
|
startText: "Installing additional dependencies",
|
|
76272
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75776
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm4} install\``)}`
|
|
76273
75777
|
});
|
|
76274
75778
|
}
|
|
76275
75779
|
async function updateAppCode2() {
|
|
@@ -76310,7 +75814,7 @@ function updateAngularJson2(ctx) {
|
|
|
76310
75814
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
76311
75815
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
76312
75816
|
}
|
|
76313
|
-
var
|
|
75817
|
+
var config4 = {
|
|
76314
75818
|
configVersion: 1,
|
|
76315
75819
|
id: "angular",
|
|
76316
75820
|
frameworkCli: "@angular/create",
|
|
@@ -76323,43 +75827,44 @@ var config11 = {
|
|
|
76323
75827
|
devScript: "start",
|
|
76324
75828
|
deployScript: "deploy",
|
|
76325
75829
|
previewScript: "start",
|
|
76326
|
-
generate:
|
|
76327
|
-
configure:
|
|
75830
|
+
generate: generate4,
|
|
75831
|
+
configure: configure4,
|
|
76328
75832
|
transformPackageJson: async () => ({
|
|
76329
75833
|
scripts: {
|
|
76330
|
-
start: `${
|
|
75834
|
+
start: `${npm4} run build && wrangler dev`,
|
|
76331
75835
|
build: `ng build`,
|
|
76332
|
-
deploy: `${
|
|
75836
|
+
deploy: `${npm4} run build && wrangler deploy`,
|
|
75837
|
+
"cf-typegen": `wrangler types`
|
|
76333
75838
|
}
|
|
76334
75839
|
})
|
|
76335
75840
|
};
|
|
76336
|
-
var
|
|
75841
|
+
var c3_default4 = config4;
|
|
76337
75842
|
|
|
76338
75843
|
// templates/angular/c3.ts
|
|
76339
|
-
var
|
|
75844
|
+
var config5 = {
|
|
76340
75845
|
displayName: "Angular",
|
|
76341
|
-
platformVariants: { pages:
|
|
75846
|
+
platformVariants: { pages: c3_default3, workers: c3_default4 }
|
|
76342
75847
|
};
|
|
76343
|
-
var
|
|
75848
|
+
var c3_default5 = config5;
|
|
76344
75849
|
|
|
76345
|
-
// templates/astro/c3.ts
|
|
76346
|
-
var
|
|
76347
|
-
var { npx
|
|
76348
|
-
var
|
|
75850
|
+
// templates/astro/pages/c3.ts
|
|
75851
|
+
var recast4 = __toESM(require_main3());
|
|
75852
|
+
var { npx } = detectPackageManager();
|
|
75853
|
+
var generate5 = async (ctx) => {
|
|
76349
75854
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
76350
75855
|
logRaw("");
|
|
76351
75856
|
};
|
|
76352
|
-
var
|
|
76353
|
-
await runCommand([
|
|
75857
|
+
var configure5 = async () => {
|
|
75858
|
+
await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
|
|
76354
75859
|
silent: true,
|
|
76355
75860
|
startText: "Installing adapter",
|
|
76356
75861
|
doneText: `${brandColor("installed")} ${dim(
|
|
76357
|
-
`via \`${
|
|
75862
|
+
`via \`${npx} astro add cloudflare\``
|
|
76358
75863
|
)}`
|
|
76359
75864
|
});
|
|
76360
|
-
|
|
75865
|
+
updateAstroConfig();
|
|
76361
75866
|
};
|
|
76362
|
-
var
|
|
75867
|
+
var updateAstroConfig = () => {
|
|
76363
75868
|
const filePath = "astro.config.mjs";
|
|
76364
75869
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
76365
75870
|
transformFile(filePath, {
|
|
@@ -76368,7 +75873,7 @@ var updateAstroConfig2 = () => {
|
|
|
76368
75873
|
if (callee.name !== "cloudflare") {
|
|
76369
75874
|
return this.traverse(n);
|
|
76370
75875
|
}
|
|
76371
|
-
const b3 =
|
|
75876
|
+
const b3 = recast4.types.builders;
|
|
76372
75877
|
n.node.arguments = [
|
|
76373
75878
|
b3.objectExpression([
|
|
76374
75879
|
b3.objectProperty(
|
|
@@ -76383,12 +75888,14 @@ var updateAstroConfig2 = () => {
|
|
|
76383
75888
|
}
|
|
76384
75889
|
});
|
|
76385
75890
|
};
|
|
76386
|
-
var
|
|
75891
|
+
var config6 = {
|
|
76387
75892
|
configVersion: 1,
|
|
76388
75893
|
id: "astro",
|
|
76389
75894
|
frameworkCli: "create-astro",
|
|
76390
75895
|
platform: "pages",
|
|
75896
|
+
hidden: true,
|
|
76391
75897
|
displayName: "Astro",
|
|
75898
|
+
path: "templates/astro/pages",
|
|
76392
75899
|
copyFiles: {
|
|
76393
75900
|
async selectVariant(ctx) {
|
|
76394
75901
|
return usesTypescript(ctx) ? "ts" : "js";
|
|
@@ -76405,8 +75912,8 @@ var config13 = {
|
|
|
76405
75912
|
devScript: "dev",
|
|
76406
75913
|
deployScript: "deploy",
|
|
76407
75914
|
previewScript: "preview",
|
|
76408
|
-
generate:
|
|
76409
|
-
configure:
|
|
75915
|
+
generate: generate5,
|
|
75916
|
+
configure: configure5,
|
|
76410
75917
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
76411
75918
|
scripts: {
|
|
76412
75919
|
deploy: `astro build && wrangler pages deploy`,
|
|
@@ -76415,10 +75922,93 @@ var config13 = {
|
|
|
76415
75922
|
}
|
|
76416
75923
|
})
|
|
76417
75924
|
};
|
|
76418
|
-
var
|
|
75925
|
+
var c3_default6 = config6;
|
|
75926
|
+
|
|
75927
|
+
// templates/astro/workers/c3.ts
|
|
75928
|
+
var recast5 = __toESM(require_main3());
|
|
75929
|
+
var { npx: npx2 } = detectPackageManager();
|
|
75930
|
+
var generate6 = async (ctx) => {
|
|
75931
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
75932
|
+
logRaw("");
|
|
75933
|
+
};
|
|
75934
|
+
var configure6 = async () => {
|
|
75935
|
+
await runCommand([npx2, "astro", "add", "cloudflare", "-y"], {
|
|
75936
|
+
silent: true,
|
|
75937
|
+
startText: "Installing adapter",
|
|
75938
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
75939
|
+
`via \`${npx2} astro add cloudflare\``
|
|
75940
|
+
)}`
|
|
75941
|
+
});
|
|
75942
|
+
updateAstroConfig2();
|
|
75943
|
+
};
|
|
75944
|
+
var updateAstroConfig2 = () => {
|
|
75945
|
+
const filePath = "astro.config.mjs";
|
|
75946
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
75947
|
+
transformFile(filePath, {
|
|
75948
|
+
visitCallExpression: function(n) {
|
|
75949
|
+
const callee = n.node.callee;
|
|
75950
|
+
if (callee.name !== "cloudflare") {
|
|
75951
|
+
return this.traverse(n);
|
|
75952
|
+
}
|
|
75953
|
+
const b3 = recast5.types.builders;
|
|
75954
|
+
n.node.arguments = [
|
|
75955
|
+
b3.objectExpression([
|
|
75956
|
+
b3.objectProperty(
|
|
75957
|
+
b3.identifier("platformProxy"),
|
|
75958
|
+
b3.objectExpression([
|
|
75959
|
+
b3.objectProperty(b3.identifier("enabled"), b3.booleanLiteral(true))
|
|
75960
|
+
])
|
|
75961
|
+
)
|
|
75962
|
+
])
|
|
75963
|
+
];
|
|
75964
|
+
return false;
|
|
75965
|
+
}
|
|
75966
|
+
});
|
|
75967
|
+
};
|
|
75968
|
+
var config7 = {
|
|
75969
|
+
configVersion: 1,
|
|
75970
|
+
id: "astro",
|
|
75971
|
+
frameworkCli: "create-astro",
|
|
75972
|
+
platform: "workers",
|
|
75973
|
+
displayName: "Astro",
|
|
75974
|
+
copyFiles: {
|
|
75975
|
+
async selectVariant(ctx) {
|
|
75976
|
+
return usesTypescript(ctx) ? "ts" : "js";
|
|
75977
|
+
},
|
|
75978
|
+
variants: {
|
|
75979
|
+
js: {
|
|
75980
|
+
path: "./templates/js"
|
|
75981
|
+
},
|
|
75982
|
+
ts: {
|
|
75983
|
+
path: "./templates/ts"
|
|
75984
|
+
}
|
|
75985
|
+
}
|
|
75986
|
+
},
|
|
75987
|
+
devScript: "dev",
|
|
75988
|
+
deployScript: "deploy",
|
|
75989
|
+
previewScript: "preview",
|
|
75990
|
+
path: "templates/astro/workers",
|
|
75991
|
+
generate: generate6,
|
|
75992
|
+
configure: configure6,
|
|
75993
|
+
transformPackageJson: async (pkgJson, ctx) => ({
|
|
75994
|
+
scripts: {
|
|
75995
|
+
deploy: `astro build && wrangler deploy`,
|
|
75996
|
+
preview: `astro build && wrangler dev`,
|
|
75997
|
+
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
75998
|
+
}
|
|
75999
|
+
})
|
|
76000
|
+
};
|
|
76001
|
+
var c3_default7 = config7;
|
|
76002
|
+
|
|
76003
|
+
// templates/astro/c3.ts
|
|
76004
|
+
var config8 = {
|
|
76005
|
+
displayName: "Astro",
|
|
76006
|
+
platformVariants: { pages: c3_default6, workers: c3_default7 }
|
|
76007
|
+
};
|
|
76008
|
+
var c3_default8 = config8;
|
|
76419
76009
|
|
|
76420
76010
|
// templates/common/c3.ts
|
|
76421
|
-
var
|
|
76011
|
+
var config9 = {
|
|
76422
76012
|
configVersion: 1,
|
|
76423
76013
|
id: "common",
|
|
76424
76014
|
displayName: "Example router & proxy Worker",
|
|
@@ -76436,38 +76026,41 @@ var c3_default16 = {
|
|
|
76436
76026
|
}
|
|
76437
76027
|
}
|
|
76438
76028
|
};
|
|
76029
|
+
var c3_default9 = config9;
|
|
76439
76030
|
|
|
76440
76031
|
// templates/docusaurus/pages/c3.ts
|
|
76441
|
-
var { npm:
|
|
76442
|
-
var
|
|
76032
|
+
var { npm: npm5 } = detectPackageManager();
|
|
76033
|
+
var generate7 = async (ctx) => {
|
|
76443
76034
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76444
76035
|
};
|
|
76445
|
-
var
|
|
76036
|
+
var config10 = {
|
|
76446
76037
|
configVersion: 1,
|
|
76447
76038
|
id: "docusaurus",
|
|
76448
76039
|
frameworkCli: "create-docusaurus",
|
|
76449
76040
|
platform: "pages",
|
|
76041
|
+
hidden: true,
|
|
76450
76042
|
displayName: "Docusaurus",
|
|
76451
76043
|
path: "templates/docusaurus/pages",
|
|
76452
|
-
generate:
|
|
76044
|
+
generate: generate7,
|
|
76453
76045
|
transformPackageJson: async () => ({
|
|
76454
76046
|
scripts: {
|
|
76455
|
-
preview: `${
|
|
76456
|
-
deploy: `${
|
|
76047
|
+
preview: `${npm5} run build && wrangler pages dev ./build`,
|
|
76048
|
+
deploy: `${npm5} run build && wrangler pages deploy ./build`
|
|
76457
76049
|
}
|
|
76458
76050
|
}),
|
|
76459
76051
|
devScript: "preview",
|
|
76460
76052
|
deployScript: "deploy",
|
|
76461
|
-
previewScript: "preview"
|
|
76053
|
+
previewScript: "preview",
|
|
76054
|
+
workersTypes: "none"
|
|
76462
76055
|
};
|
|
76463
|
-
var
|
|
76056
|
+
var c3_default10 = config10;
|
|
76464
76057
|
|
|
76465
76058
|
// templates/docusaurus/workers/c3.ts
|
|
76466
|
-
var { npm:
|
|
76467
|
-
var
|
|
76059
|
+
var { npm: npm6 } = detectPackageManager();
|
|
76060
|
+
var generate8 = async (ctx) => {
|
|
76468
76061
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
76469
76062
|
};
|
|
76470
|
-
var
|
|
76063
|
+
var config11 = {
|
|
76471
76064
|
configVersion: 1,
|
|
76472
76065
|
id: "docusaurus",
|
|
76473
76066
|
frameworkCli: "create-docusaurus",
|
|
@@ -76477,29 +76070,30 @@ var config15 = {
|
|
|
76477
76070
|
path: "./templates"
|
|
76478
76071
|
},
|
|
76479
76072
|
path: "templates/docusaurus/workers",
|
|
76480
|
-
generate:
|
|
76073
|
+
generate: generate8,
|
|
76481
76074
|
transformPackageJson: async () => ({
|
|
76482
76075
|
scripts: {
|
|
76483
|
-
deploy: `${
|
|
76484
|
-
preview: `${
|
|
76076
|
+
deploy: `${npm6} run build && wrangler deploy`,
|
|
76077
|
+
preview: `${npm6} run build && wrangler dev`
|
|
76485
76078
|
}
|
|
76486
76079
|
}),
|
|
76487
76080
|
devScript: "start",
|
|
76488
76081
|
deployScript: "deploy",
|
|
76489
|
-
previewScript: "preview"
|
|
76082
|
+
previewScript: "preview",
|
|
76083
|
+
workersTypes: "none"
|
|
76490
76084
|
};
|
|
76491
|
-
var
|
|
76085
|
+
var c3_default11 = config11;
|
|
76492
76086
|
|
|
76493
76087
|
// templates/docusaurus/c3.ts
|
|
76494
|
-
var
|
|
76088
|
+
var config12 = {
|
|
76495
76089
|
displayName: "Docusaurus",
|
|
76496
|
-
platformVariants: { pages:
|
|
76090
|
+
platformVariants: { pages: c3_default10, workers: c3_default11 }
|
|
76497
76091
|
};
|
|
76498
|
-
var
|
|
76092
|
+
var c3_default12 = config12;
|
|
76499
76093
|
|
|
76500
76094
|
// templates/gatsby/pages/c3.ts
|
|
76501
|
-
var { npm:
|
|
76502
|
-
var
|
|
76095
|
+
var { npm: npm7 } = detectPackageManager();
|
|
76096
|
+
var generate9 = async (ctx) => {
|
|
76503
76097
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76504
76098
|
const useTemplate = await inputPrompt({
|
|
76505
76099
|
type: "confirm",
|
|
@@ -76518,29 +76112,31 @@ var generate14 = async (ctx) => {
|
|
|
76518
76112
|
}
|
|
76519
76113
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76520
76114
|
};
|
|
76521
|
-
var
|
|
76115
|
+
var config13 = {
|
|
76522
76116
|
configVersion: 1,
|
|
76523
76117
|
id: "gatsby",
|
|
76524
76118
|
frameworkCli: "gatsby",
|
|
76525
76119
|
platform: "pages",
|
|
76120
|
+
hidden: true,
|
|
76526
76121
|
displayName: "Gatsby",
|
|
76527
76122
|
path: "templates/gatsby/pages",
|
|
76528
|
-
generate:
|
|
76123
|
+
generate: generate9,
|
|
76529
76124
|
transformPackageJson: async () => ({
|
|
76530
76125
|
scripts: {
|
|
76531
|
-
deploy: `${
|
|
76532
|
-
preview: `${
|
|
76126
|
+
deploy: `${npm7} run build && wrangler pages deploy ./public`,
|
|
76127
|
+
preview: `${npm7} run build && wrangler pages dev ./public`
|
|
76533
76128
|
}
|
|
76534
76129
|
}),
|
|
76535
76130
|
devScript: "develop",
|
|
76536
76131
|
deployScript: "deploy",
|
|
76537
|
-
previewScript: "preview"
|
|
76132
|
+
previewScript: "preview",
|
|
76133
|
+
workersTypes: "none"
|
|
76538
76134
|
};
|
|
76539
|
-
var
|
|
76135
|
+
var c3_default13 = config13;
|
|
76540
76136
|
|
|
76541
76137
|
// templates/gatsby/workers/c3.ts
|
|
76542
|
-
var { npm:
|
|
76543
|
-
var
|
|
76138
|
+
var { npm: npm8 } = detectPackageManager();
|
|
76139
|
+
var generate10 = async (ctx) => {
|
|
76544
76140
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76545
76141
|
const useTemplate = await inputPrompt({
|
|
76546
76142
|
type: "confirm",
|
|
@@ -76559,7 +76155,7 @@ var generate15 = async (ctx) => {
|
|
|
76559
76155
|
}
|
|
76560
76156
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76561
76157
|
};
|
|
76562
|
-
var
|
|
76158
|
+
var config14 = {
|
|
76563
76159
|
configVersion: 1,
|
|
76564
76160
|
id: "gatsby",
|
|
76565
76161
|
frameworkCli: "gatsby",
|
|
@@ -76569,32 +76165,71 @@ var config18 = {
|
|
|
76569
76165
|
path: "./templates"
|
|
76570
76166
|
},
|
|
76571
76167
|
path: "templates/gatsby/workers",
|
|
76572
|
-
generate:
|
|
76168
|
+
generate: generate10,
|
|
76573
76169
|
transformPackageJson: async () => ({
|
|
76574
76170
|
scripts: {
|
|
76575
|
-
deploy: `${
|
|
76576
|
-
preview: `${
|
|
76171
|
+
deploy: `${npm8} run build && wrangler deploy`,
|
|
76172
|
+
preview: `${npm8} run build && wrangler dev`
|
|
76577
76173
|
}
|
|
76578
76174
|
}),
|
|
76579
76175
|
devScript: "develop",
|
|
76580
76176
|
deployScript: "deploy",
|
|
76581
|
-
previewScript: "preview"
|
|
76177
|
+
previewScript: "preview",
|
|
76178
|
+
workersTypes: "none"
|
|
76582
76179
|
};
|
|
76583
|
-
var
|
|
76180
|
+
var c3_default14 = config14;
|
|
76584
76181
|
|
|
76585
76182
|
// templates/gatsby/c3.ts
|
|
76586
|
-
var
|
|
76183
|
+
var config15 = {
|
|
76587
76184
|
displayName: "Gatsby",
|
|
76588
|
-
platformVariants: { pages:
|
|
76185
|
+
platformVariants: { pages: c3_default13, workers: c3_default14 }
|
|
76589
76186
|
};
|
|
76590
|
-
var
|
|
76187
|
+
var c3_default15 = config15;
|
|
76188
|
+
|
|
76189
|
+
// templates/hello-world-assets-only/c3.ts
|
|
76190
|
+
var config16 = {
|
|
76191
|
+
configVersion: 1,
|
|
76192
|
+
id: "hello-world-assets-only",
|
|
76193
|
+
path: "templates/hello-world-assets-only",
|
|
76194
|
+
displayName: "Static site",
|
|
76195
|
+
description: "For static sites or when using your own backend. Uses Workers Static Assets.",
|
|
76196
|
+
platform: "workers",
|
|
76197
|
+
copyFiles: {
|
|
76198
|
+
path: "./templates"
|
|
76199
|
+
}
|
|
76200
|
+
};
|
|
76201
|
+
var c3_default16 = config16;
|
|
76202
|
+
|
|
76203
|
+
// templates/hello-world-durable-object-with-assets/c3.ts
|
|
76204
|
+
var config17 = {
|
|
76205
|
+
configVersion: 1,
|
|
76206
|
+
id: "hello-world-durable-object-with-assets",
|
|
76207
|
+
path: "templates/hello-world-durable-object-with-assets",
|
|
76208
|
+
displayName: "Worker + Durable Objects + Assets",
|
|
76209
|
+
description: "For full-stack applications requiring static assets, an API, and real-time coordination",
|
|
76210
|
+
platform: "workers",
|
|
76211
|
+
copyFiles: {
|
|
76212
|
+
variants: {
|
|
76213
|
+
js: {
|
|
76214
|
+
path: "./js"
|
|
76215
|
+
},
|
|
76216
|
+
ts: {
|
|
76217
|
+
path: "./ts"
|
|
76218
|
+
},
|
|
76219
|
+
python: {
|
|
76220
|
+
path: "./py"
|
|
76221
|
+
}
|
|
76222
|
+
}
|
|
76223
|
+
}
|
|
76224
|
+
};
|
|
76225
|
+
var c3_default17 = config17;
|
|
76591
76226
|
|
|
76592
76227
|
// templates/hello-world-durable-object/c3.ts
|
|
76593
|
-
var
|
|
76228
|
+
var config18 = {
|
|
76594
76229
|
configVersion: 1,
|
|
76595
76230
|
id: "hello-world-durable-object",
|
|
76596
|
-
displayName: "
|
|
76597
|
-
description: "
|
|
76231
|
+
displayName: "Worker + Durable Objects",
|
|
76232
|
+
description: "For multiplayer apps using WebSockets, or when you need synchronization",
|
|
76598
76233
|
platform: "workers",
|
|
76599
76234
|
copyFiles: {
|
|
76600
76235
|
variants: {
|
|
@@ -76603,19 +76238,47 @@ var c3_default23 = {
|
|
|
76603
76238
|
},
|
|
76604
76239
|
ts: {
|
|
76605
76240
|
path: "./ts"
|
|
76241
|
+
},
|
|
76242
|
+
python: {
|
|
76243
|
+
path: "./py"
|
|
76606
76244
|
}
|
|
76607
76245
|
}
|
|
76608
76246
|
}
|
|
76609
76247
|
};
|
|
76248
|
+
var c3_default18 = config18;
|
|
76249
|
+
|
|
76250
|
+
// templates/hello-world-with-assets/c3.ts
|
|
76251
|
+
var config19 = {
|
|
76252
|
+
configVersion: 1,
|
|
76253
|
+
id: "hello-world-with-assets",
|
|
76254
|
+
path: "templates/hello-world-with-assets",
|
|
76255
|
+
displayName: "SSR / full-stack app",
|
|
76256
|
+
description: "For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
|
|
76257
|
+
platform: "workers",
|
|
76258
|
+
copyFiles: {
|
|
76259
|
+
variants: {
|
|
76260
|
+
js: {
|
|
76261
|
+
path: "./js"
|
|
76262
|
+
},
|
|
76263
|
+
ts: {
|
|
76264
|
+
path: "./ts"
|
|
76265
|
+
},
|
|
76266
|
+
python: {
|
|
76267
|
+
path: "./py"
|
|
76268
|
+
}
|
|
76269
|
+
}
|
|
76270
|
+
}
|
|
76271
|
+
};
|
|
76272
|
+
var c3_default19 = config19;
|
|
76610
76273
|
|
|
76611
76274
|
// templates/hello-world/c3.ts
|
|
76612
76275
|
var import_promises2 = require("node:fs/promises");
|
|
76613
76276
|
var import_node_path5 = require("node:path");
|
|
76614
|
-
var
|
|
76277
|
+
var c3_default20 = {
|
|
76615
76278
|
configVersion: 1,
|
|
76616
76279
|
id: "hello-world",
|
|
76617
|
-
displayName: "
|
|
76618
|
-
description: "
|
|
76280
|
+
displayName: "Worker only",
|
|
76281
|
+
description: "For processing requests, transforming responses, or API endpoints",
|
|
76619
76282
|
platform: "workers",
|
|
76620
76283
|
async configure(ctx) {
|
|
76621
76284
|
if (ctx.args.lang === "python") {
|
|
@@ -76644,35 +76307,60 @@ var c3_default24 = {
|
|
|
76644
76307
|
}
|
|
76645
76308
|
};
|
|
76646
76309
|
|
|
76647
|
-
// templates/hono/c3.ts
|
|
76648
|
-
var
|
|
76310
|
+
// templates/hono/pages/c3.ts
|
|
76311
|
+
var generate11 = async (ctx) => {
|
|
76649
76312
|
const { name: pm4 } = detectPackageManager();
|
|
76650
76313
|
await runFrameworkGenerator(ctx, [
|
|
76651
76314
|
ctx.project.name,
|
|
76652
76315
|
"--template",
|
|
76653
|
-
"cloudflare-
|
|
76316
|
+
"cloudflare-pages",
|
|
76654
76317
|
"--install",
|
|
76655
76318
|
"--pm",
|
|
76656
76319
|
pm4
|
|
76657
76320
|
]);
|
|
76658
76321
|
logRaw("");
|
|
76659
76322
|
};
|
|
76660
|
-
var
|
|
76661
|
-
|
|
76662
|
-
|
|
76663
|
-
|
|
76664
|
-
|
|
76665
|
-
|
|
76666
|
-
|
|
76667
|
-
|
|
76668
|
-
|
|
76669
|
-
|
|
76670
|
-
|
|
76323
|
+
var envInterfaceName = "CloudflareBindings";
|
|
76324
|
+
var config20 = {
|
|
76325
|
+
configVersion: 1,
|
|
76326
|
+
id: "hono",
|
|
76327
|
+
frameworkCli: "create-hono",
|
|
76328
|
+
displayName: "Hono",
|
|
76329
|
+
copyFiles: {
|
|
76330
|
+
path: "./templates"
|
|
76331
|
+
},
|
|
76332
|
+
path: "templates/hono/pages",
|
|
76333
|
+
platform: "pages",
|
|
76334
|
+
hidden: true,
|
|
76335
|
+
generate: generate11,
|
|
76336
|
+
transformPackageJson: async () => ({
|
|
76337
|
+
scripts: {
|
|
76338
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName}`,
|
|
76339
|
+
preview: "vite build && wrangler pages dev"
|
|
76671
76340
|
}
|
|
76672
|
-
})
|
|
76673
|
-
|
|
76341
|
+
}),
|
|
76342
|
+
devScript: "dev",
|
|
76343
|
+
deployScript: "deploy",
|
|
76344
|
+
previewScript: "preview",
|
|
76345
|
+
envInterfaceName
|
|
76674
76346
|
};
|
|
76675
|
-
var
|
|
76347
|
+
var c3_default21 = config20;
|
|
76348
|
+
|
|
76349
|
+
// templates/hono/workers/c3.ts
|
|
76350
|
+
var generate12 = async (ctx) => {
|
|
76351
|
+
const { name: pm4 } = detectPackageManager();
|
|
76352
|
+
await runFrameworkGenerator(ctx, [
|
|
76353
|
+
ctx.project.name,
|
|
76354
|
+
"--template",
|
|
76355
|
+
"cloudflare-workers",
|
|
76356
|
+
"--install",
|
|
76357
|
+
"--pm",
|
|
76358
|
+
pm4
|
|
76359
|
+
]);
|
|
76360
|
+
logRaw("");
|
|
76361
|
+
};
|
|
76362
|
+
var envInterfaceName2 = "CloudflareBindings";
|
|
76363
|
+
var config21 = {
|
|
76676
76364
|
configVersion: 1,
|
|
76677
76365
|
id: "hono",
|
|
76678
76366
|
frameworkCli: "create-hono",
|
|
@@ -76681,32 +76369,38 @@ var config20 = {
|
|
|
76681
76369
|
path: "./templates"
|
|
76682
76370
|
},
|
|
76683
76371
|
platform: "workers",
|
|
76684
|
-
|
|
76685
|
-
|
|
76372
|
+
path: "templates/hono/workers",
|
|
76373
|
+
generate: generate12,
|
|
76686
76374
|
transformPackageJson: async () => ({
|
|
76687
76375
|
scripts: {
|
|
76688
|
-
|
|
76689
|
-
deploy: "wrangler deploy --minify",
|
|
76690
|
-
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
76376
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName2}`
|
|
76691
76377
|
}
|
|
76692
76378
|
}),
|
|
76693
76379
|
devScript: "dev",
|
|
76694
76380
|
deployScript: "deploy",
|
|
76695
|
-
previewScript: "dev"
|
|
76381
|
+
previewScript: "dev",
|
|
76382
|
+
envInterfaceName: envInterfaceName2
|
|
76696
76383
|
};
|
|
76697
|
-
var
|
|
76384
|
+
var c3_default22 = config21;
|
|
76698
76385
|
|
|
76699
|
-
// templates/
|
|
76386
|
+
// templates/hono/c3.ts
|
|
76387
|
+
var config22 = {
|
|
76388
|
+
displayName: "Hono",
|
|
76389
|
+
platformVariants: { pages: c3_default21, workers: c3_default22 }
|
|
76390
|
+
};
|
|
76391
|
+
var c3_default23 = config22;
|
|
76392
|
+
|
|
76393
|
+
// templates/next/pages/c3.ts
|
|
76700
76394
|
var import_path10 = require("path");
|
|
76701
|
-
var { npm:
|
|
76702
|
-
var
|
|
76395
|
+
var { npm: npm9, npx: npx3 } = detectPackageManager();
|
|
76396
|
+
var generate13 = async (ctx) => {
|
|
76703
76397
|
const projectName = ctx.project.name;
|
|
76704
76398
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76705
76399
|
const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
76706
76400
|
writeFile2((0, import_path10.join)(ctx.project.path, "wrangler.jsonc"), wranglerConfig);
|
|
76707
76401
|
updateStatus("Created wrangler.jsonc file");
|
|
76708
76402
|
};
|
|
76709
|
-
var
|
|
76403
|
+
var updateNextConfig = (usesTs) => {
|
|
76710
76404
|
const s = spinner();
|
|
76711
76405
|
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
76712
76406
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76724,7 +76418,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76724
76418
|
writeFile2(configFile, updatedConfigFile);
|
|
76725
76419
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76726
76420
|
};
|
|
76727
|
-
var
|
|
76421
|
+
var configure7 = async (ctx) => {
|
|
76728
76422
|
const projectPath = ctx.project.path;
|
|
76729
76423
|
const path6 = probePaths([
|
|
76730
76424
|
`${projectPath}/pages/api`,
|
|
@@ -76738,18 +76432,11 @@ var configure12 = async (ctx) => {
|
|
|
76738
76432
|
throw new Error("Could not find the `/api` or `/app` directory");
|
|
76739
76433
|
}
|
|
76740
76434
|
const usesTs = usesTypescript(ctx);
|
|
76741
|
-
if (usesTs) {
|
|
76742
|
-
copyFile(
|
|
76743
|
-
(0, import_path10.join)(getTemplatePath(ctx), "env.d.ts"),
|
|
76744
|
-
(0, import_path10.join)(projectPath, "env.d.ts")
|
|
76745
|
-
);
|
|
76746
|
-
updateStatus("Created an env.d.ts file");
|
|
76747
|
-
}
|
|
76748
76435
|
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
76749
76436
|
if (installEslintPlugin) {
|
|
76750
76437
|
await writeEslintrc(ctx);
|
|
76751
76438
|
}
|
|
76752
|
-
|
|
76439
|
+
updateNextConfig(usesTs);
|
|
76753
76440
|
copyFile(
|
|
76754
76441
|
(0, import_path10.join)(getTemplatePath(ctx), "README.md"),
|
|
76755
76442
|
(0, import_path10.join)(projectPath, "README.md")
|
|
@@ -76789,7 +76476,6 @@ var writeEslintrc = async (ctx) => {
|
|
|
76789
76476
|
var addDevDependencies = async (installEslintPlugin) => {
|
|
76790
76477
|
const packages = [
|
|
76791
76478
|
"@cloudflare/next-on-pages@1",
|
|
76792
|
-
"@cloudflare/workers-types",
|
|
76793
76479
|
"vercel",
|
|
76794
76480
|
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
76795
76481
|
];
|
|
@@ -76799,14 +76485,18 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76799
76485
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76800
76486
|
});
|
|
76801
76487
|
};
|
|
76802
|
-
var
|
|
76488
|
+
var envInterfaceName3 = "CloudflareEnv";
|
|
76489
|
+
var typesPath = "./env.d.ts";
|
|
76490
|
+
var c3_default24 = {
|
|
76803
76491
|
configVersion: 1,
|
|
76804
76492
|
id: "next",
|
|
76805
76493
|
frameworkCli: "create-next-app",
|
|
76806
76494
|
platform: "pages",
|
|
76495
|
+
hidden: true,
|
|
76807
76496
|
displayName: "Next.js",
|
|
76808
|
-
|
|
76809
|
-
|
|
76497
|
+
path: "templates/next/pages",
|
|
76498
|
+
generate: generate13,
|
|
76499
|
+
configure: configure7,
|
|
76810
76500
|
copyFiles: {
|
|
76811
76501
|
async selectVariant(ctx) {
|
|
76812
76502
|
const isApp = probePaths([
|
|
@@ -76837,12 +76527,12 @@ var c3_default26 = {
|
|
|
76837
76527
|
}
|
|
76838
76528
|
},
|
|
76839
76529
|
transformPackageJson: async (_3, ctx) => {
|
|
76840
|
-
const isNpm =
|
|
76841
|
-
const isBun =
|
|
76530
|
+
const isNpm = npm9 === "npm";
|
|
76531
|
+
const isBun = npm9 === "bun";
|
|
76842
76532
|
const isNpmOrBun = isNpm || isBun;
|
|
76843
76533
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76844
76534
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76845
|
-
const pmCommand = isNpmOrBun ?
|
|
76535
|
+
const pmCommand = isNpmOrBun ? npx3 : npm9;
|
|
76846
76536
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76847
76537
|
return {
|
|
76848
76538
|
scripts: {
|
|
@@ -76850,7 +76540,7 @@ var c3_default26 = {
|
|
|
76850
76540
|
preview: `${pagesBuildRunCommand} && wrangler pages dev`,
|
|
76851
76541
|
deploy: `${pagesBuildRunCommand} && wrangler pages deploy`,
|
|
76852
76542
|
...usesTypescript(ctx) && {
|
|
76853
|
-
"cf-typegen": `wrangler types --env-interface
|
|
76543
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
76854
76544
|
}
|
|
76855
76545
|
}
|
|
76856
76546
|
};
|
|
@@ -76858,25 +76548,88 @@ var c3_default26 = {
|
|
|
76858
76548
|
devScript: "dev",
|
|
76859
76549
|
previewScript: "preview",
|
|
76860
76550
|
deployScript: "deploy",
|
|
76861
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
76551
|
+
compatibilityFlags: ["nodejs_compat"],
|
|
76552
|
+
typesPath,
|
|
76553
|
+
envInterfaceName: envInterfaceName3
|
|
76862
76554
|
};
|
|
76863
76555
|
|
|
76556
|
+
// templates/next/workers/c3.ts
|
|
76557
|
+
var generate14 = async (ctx) => {
|
|
76558
|
+
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76559
|
+
};
|
|
76560
|
+
var configure8 = async (ctx) => {
|
|
76561
|
+
await installPackages(["@opennextjs/cloudflare@^1.0.2"], {
|
|
76562
|
+
startText: "Adding the Cloudflare adapter",
|
|
76563
|
+
doneText: `${brandColor(`installed`)} @opennextjs/cloudflare)}`
|
|
76564
|
+
});
|
|
76565
|
+
const usesTs = usesTypescript(ctx);
|
|
76566
|
+
updateNextConfig2(usesTs);
|
|
76567
|
+
};
|
|
76568
|
+
var updateNextConfig2 = (usesTs) => {
|
|
76569
|
+
const s = spinner();
|
|
76570
|
+
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
76571
|
+
s.start(`Updating \`${configFile}\``);
|
|
76572
|
+
const configContent = readFile(configFile);
|
|
76573
|
+
const updatedConfigFile = configContent + `
|
|
76574
|
+
// added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
|
|
76575
|
+
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
76576
|
+
initOpenNextCloudflareForDev();
|
|
76577
|
+
`.replace(/\n\t*/g, "\n");
|
|
76578
|
+
writeFile2(configFile, updatedConfigFile);
|
|
76579
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76580
|
+
};
|
|
76581
|
+
var envInterfaceName4 = "CloudflareEnv";
|
|
76582
|
+
var typesPath2 = "./cloudflare-env.d.ts";
|
|
76583
|
+
var c3_default25 = {
|
|
76584
|
+
configVersion: 1,
|
|
76585
|
+
id: "next",
|
|
76586
|
+
frameworkCli: "create-next-app",
|
|
76587
|
+
platform: "workers",
|
|
76588
|
+
displayName: "Next.js",
|
|
76589
|
+
path: "templates/next/workers",
|
|
76590
|
+
copyFiles: {
|
|
76591
|
+
path: "./templates"
|
|
76592
|
+
},
|
|
76593
|
+
generate: generate14,
|
|
76594
|
+
configure: configure8,
|
|
76595
|
+
transformPackageJson: async () => ({
|
|
76596
|
+
scripts: {
|
|
76597
|
+
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
76598
|
+
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
76599
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName4} ${typesPath2}`
|
|
76600
|
+
}
|
|
76601
|
+
}),
|
|
76602
|
+
devScript: "dev",
|
|
76603
|
+
previewScript: "preview",
|
|
76604
|
+
deployScript: "deploy",
|
|
76605
|
+
typesPath: typesPath2,
|
|
76606
|
+
envInterfaceName: envInterfaceName4
|
|
76607
|
+
};
|
|
76608
|
+
|
|
76609
|
+
// templates/next/c3.ts
|
|
76610
|
+
var config23 = {
|
|
76611
|
+
displayName: "Next.js",
|
|
76612
|
+
platformVariants: { pages: c3_default24, workers: c3_default25 }
|
|
76613
|
+
};
|
|
76614
|
+
var c3_default26 = config23;
|
|
76615
|
+
|
|
76864
76616
|
// templates/nuxt/pages/c3.ts
|
|
76865
|
-
var
|
|
76866
|
-
var { npm:
|
|
76867
|
-
var
|
|
76617
|
+
var recast6 = __toESM(require_main3());
|
|
76618
|
+
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
76619
|
+
var generate15 = async (ctx) => {
|
|
76868
76620
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76869
76621
|
await runFrameworkGenerator(ctx, [
|
|
76870
76622
|
"init",
|
|
76871
76623
|
ctx.project.name,
|
|
76872
76624
|
"--packageManager",
|
|
76873
|
-
|
|
76625
|
+
npm10,
|
|
76626
|
+
"--no-install",
|
|
76874
76627
|
gitFlag
|
|
76875
76628
|
]);
|
|
76876
76629
|
writeFile2("./.node-version", "18");
|
|
76877
76630
|
logRaw("");
|
|
76878
76631
|
};
|
|
76879
|
-
var
|
|
76632
|
+
var configure9 = async () => {
|
|
76880
76633
|
const packages = ["nitro-cloudflare-dev"];
|
|
76881
76634
|
if (pm2 === "pnpm") {
|
|
76882
76635
|
packages.push("h3");
|
|
@@ -76884,30 +76637,15 @@ var configure13 = async (ctx) => {
|
|
|
76884
76637
|
await installPackages(packages, {
|
|
76885
76638
|
dev: true,
|
|
76886
76639
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76887
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76640
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
76888
76641
|
});
|
|
76889
76642
|
updateNuxtConfig();
|
|
76890
|
-
updateEnvTypes2(ctx);
|
|
76891
|
-
};
|
|
76892
|
-
var updateEnvTypes2 = (ctx) => {
|
|
76893
|
-
const filepath = "env.d.ts";
|
|
76894
|
-
const s = spinner();
|
|
76895
|
-
s.start(`Updating ${filepath}`);
|
|
76896
|
-
let file = readFile(filepath);
|
|
76897
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
76898
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
76899
|
-
if (latestEntrypoint) {
|
|
76900
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
76901
|
-
}
|
|
76902
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
76903
|
-
writeFile2("env.d.ts", file);
|
|
76904
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76905
76643
|
};
|
|
76906
76644
|
var updateNuxtConfig = () => {
|
|
76907
76645
|
const s = spinner();
|
|
76908
76646
|
const configFile = "nuxt.config.ts";
|
|
76909
76647
|
s.start(`Updating \`${configFile}\``);
|
|
76910
|
-
const b3 =
|
|
76648
|
+
const b3 = recast6.types.builders;
|
|
76911
76649
|
const presetDef = b3.objectProperty(
|
|
76912
76650
|
b3.identifier("nitro"),
|
|
76913
76651
|
b3.objectExpression([
|
|
@@ -76945,22 +76683,23 @@ var updateNuxtConfig = () => {
|
|
|
76945
76683
|
});
|
|
76946
76684
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76947
76685
|
};
|
|
76948
|
-
var
|
|
76686
|
+
var config24 = {
|
|
76949
76687
|
configVersion: 1,
|
|
76950
76688
|
id: "nuxt",
|
|
76951
76689
|
frameworkCli: "nuxi",
|
|
76952
76690
|
platform: "pages",
|
|
76691
|
+
hidden: true,
|
|
76953
76692
|
displayName: "Nuxt",
|
|
76954
76693
|
copyFiles: {
|
|
76955
76694
|
path: "./templates"
|
|
76956
76695
|
},
|
|
76957
76696
|
path: "templates/nuxt/pages",
|
|
76958
|
-
generate:
|
|
76959
|
-
configure:
|
|
76697
|
+
generate: generate15,
|
|
76698
|
+
configure: configure9,
|
|
76960
76699
|
transformPackageJson: async () => ({
|
|
76961
76700
|
scripts: {
|
|
76962
|
-
deploy: `${
|
|
76963
|
-
preview: `${
|
|
76701
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
76702
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
76964
76703
|
"cf-typegen": `wrangler types`
|
|
76965
76704
|
}
|
|
76966
76705
|
}),
|
|
@@ -76968,24 +76707,25 @@ var config21 = {
|
|
|
76968
76707
|
deployScript: "deploy",
|
|
76969
76708
|
previewScript: "preview"
|
|
76970
76709
|
};
|
|
76971
|
-
var c3_default27 =
|
|
76710
|
+
var c3_default27 = config24;
|
|
76972
76711
|
|
|
76973
76712
|
// templates/nuxt/workers/c3.ts
|
|
76974
|
-
var
|
|
76975
|
-
var { npm:
|
|
76976
|
-
var
|
|
76713
|
+
var recast7 = __toESM(require_main3());
|
|
76714
|
+
var { npm: npm11, name: pm3 } = detectPackageManager();
|
|
76715
|
+
var generate16 = async (ctx) => {
|
|
76977
76716
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76978
76717
|
await runFrameworkGenerator(ctx, [
|
|
76979
76718
|
"init",
|
|
76980
76719
|
ctx.project.name,
|
|
76981
76720
|
"--packageManager",
|
|
76982
|
-
|
|
76721
|
+
npm11,
|
|
76722
|
+
"--no-install",
|
|
76983
76723
|
gitFlag
|
|
76984
76724
|
]);
|
|
76985
76725
|
writeFile2("./.node-version", "18");
|
|
76986
76726
|
logRaw("");
|
|
76987
76727
|
};
|
|
76988
|
-
var
|
|
76728
|
+
var configure10 = async () => {
|
|
76989
76729
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
76990
76730
|
if (pm3 === "pnpm") {
|
|
76991
76731
|
packages.push("h3");
|
|
@@ -76993,30 +76733,15 @@ var configure14 = async (ctx) => {
|
|
|
76993
76733
|
await installPackages(packages, {
|
|
76994
76734
|
dev: true,
|
|
76995
76735
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76996
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76736
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
76997
76737
|
});
|
|
76998
76738
|
updateNuxtConfig2();
|
|
76999
|
-
updateEnvTypes3(ctx);
|
|
77000
|
-
};
|
|
77001
|
-
var updateEnvTypes3 = (ctx) => {
|
|
77002
|
-
const filepath = "env.d.ts";
|
|
77003
|
-
const s = spinner();
|
|
77004
|
-
s.start(`Updating ${filepath}`);
|
|
77005
|
-
let file = readFile(filepath);
|
|
77006
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
77007
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
77008
|
-
if (latestEntrypoint) {
|
|
77009
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
77010
|
-
}
|
|
77011
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
77012
|
-
writeFile2("env.d.ts", file);
|
|
77013
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
77014
76739
|
};
|
|
77015
76740
|
var updateNuxtConfig2 = () => {
|
|
77016
76741
|
const s = spinner();
|
|
77017
76742
|
const configFile = "nuxt.config.ts";
|
|
77018
76743
|
s.start(`Updating \`${configFile}\``);
|
|
77019
|
-
const b3 =
|
|
76744
|
+
const b3 = recast7.types.builders;
|
|
77020
76745
|
const presetDef = b3.objectProperty(
|
|
77021
76746
|
b3.identifier("nitro"),
|
|
77022
76747
|
b3.objectExpression([
|
|
@@ -77054,7 +76779,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77054
76779
|
});
|
|
77055
76780
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
77056
76781
|
};
|
|
77057
|
-
var
|
|
76782
|
+
var config25 = {
|
|
77058
76783
|
configVersion: 1,
|
|
77059
76784
|
id: "nuxt",
|
|
77060
76785
|
frameworkCli: "nuxi",
|
|
@@ -77064,12 +76789,12 @@ var config22 = {
|
|
|
77064
76789
|
path: "./templates"
|
|
77065
76790
|
},
|
|
77066
76791
|
path: "templates/nuxt/workers",
|
|
77067
|
-
generate:
|
|
77068
|
-
configure:
|
|
76792
|
+
generate: generate16,
|
|
76793
|
+
configure: configure10,
|
|
77069
76794
|
transformPackageJson: async () => ({
|
|
77070
76795
|
scripts: {
|
|
77071
|
-
deploy: `${
|
|
77072
|
-
preview: `${
|
|
76796
|
+
deploy: `${npm11} run build && wrangler deploy`,
|
|
76797
|
+
preview: `${npm11} run build && wrangler dev`,
|
|
77073
76798
|
"cf-typegen": `wrangler types`
|
|
77074
76799
|
}
|
|
77075
76800
|
}),
|
|
@@ -77077,17 +76802,17 @@ var config22 = {
|
|
|
77077
76802
|
deployScript: "deploy",
|
|
77078
76803
|
previewScript: "preview"
|
|
77079
76804
|
};
|
|
77080
|
-
var c3_default28 =
|
|
76805
|
+
var c3_default28 = config25;
|
|
77081
76806
|
|
|
77082
76807
|
// templates/nuxt/c3.ts
|
|
77083
|
-
var
|
|
76808
|
+
var config26 = {
|
|
77084
76809
|
displayName: "Nuxt",
|
|
77085
76810
|
platformVariants: { pages: c3_default27, workers: c3_default28 }
|
|
77086
76811
|
};
|
|
77087
|
-
var c3_default29 =
|
|
76812
|
+
var c3_default29 = config26;
|
|
77088
76813
|
|
|
77089
76814
|
// templates/openapi/c3.ts
|
|
77090
|
-
var
|
|
76815
|
+
var config27 = {
|
|
77091
76816
|
configVersion: 1,
|
|
77092
76817
|
id: "openapi",
|
|
77093
76818
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -77097,6 +76822,7 @@ var c3_default30 = {
|
|
|
77097
76822
|
path: "./ts"
|
|
77098
76823
|
}
|
|
77099
76824
|
};
|
|
76825
|
+
var c3_default30 = config27;
|
|
77100
76826
|
|
|
77101
76827
|
// templates/pre-existing/c3.ts
|
|
77102
76828
|
var import_promises3 = require("fs/promises");
|
|
@@ -77218,7 +76944,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77218
76944
|
await runCommand(
|
|
77219
76945
|
[
|
|
77220
76946
|
...dlx,
|
|
77221
|
-
"wrangler@
|
|
76947
|
+
"wrangler@latest",
|
|
77222
76948
|
"init",
|
|
77223
76949
|
"--from-dash",
|
|
77224
76950
|
ctx.args.existingScript,
|
|
@@ -77246,10 +76972,11 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77246
76972
|
(0, import_path11.join)(ctx.project.path, "wrangler.toml")
|
|
77247
76973
|
);
|
|
77248
76974
|
}
|
|
77249
|
-
var
|
|
76975
|
+
var config28 = {
|
|
77250
76976
|
configVersion: 1,
|
|
77251
76977
|
id: "pre-existing",
|
|
77252
76978
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
76979
|
+
description: "Fetch a Worker initialized from the Cloudflare dashboard.",
|
|
77253
76980
|
platform: "workers",
|
|
77254
76981
|
hidden: true,
|
|
77255
76982
|
copyFiles: {
|
|
@@ -77261,8 +76988,9 @@ var c3_default31 = {
|
|
|
77261
76988
|
copyFiles: copyExistingWorkerFiles
|
|
77262
76989
|
})
|
|
77263
76990
|
};
|
|
76991
|
+
var c3_default31 = config28;
|
|
77264
76992
|
function buildConfigure(params) {
|
|
77265
|
-
return async function
|
|
76993
|
+
return async function configure21(ctx) {
|
|
77266
76994
|
const loginSuccess = await params.login(ctx);
|
|
77267
76995
|
if (!loginSuccess) {
|
|
77268
76996
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -77274,7 +77002,7 @@ function buildConfigure(params) {
|
|
|
77274
77002
|
}
|
|
77275
77003
|
|
|
77276
77004
|
// templates/queues/c3.ts
|
|
77277
|
-
var
|
|
77005
|
+
var config29 = {
|
|
77278
77006
|
configVersion: 1,
|
|
77279
77007
|
id: "queues",
|
|
77280
77008
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -77301,17 +77029,129 @@ var c3_default32 = {
|
|
|
77301
77029
|
]
|
|
77302
77030
|
}
|
|
77303
77031
|
};
|
|
77032
|
+
var c3_default32 = config29;
|
|
77304
77033
|
|
|
77305
|
-
// templates/qwik/c3.ts
|
|
77306
|
-
var
|
|
77307
|
-
var { npm:
|
|
77308
|
-
var
|
|
77034
|
+
// templates/qwik/pages/c3.ts
|
|
77035
|
+
var recast8 = __toESM(require_main3());
|
|
77036
|
+
var { npm: npm12, npx: npx4, name } = detectPackageManager();
|
|
77037
|
+
var generate17 = async (ctx) => {
|
|
77309
77038
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77310
77039
|
};
|
|
77311
|
-
var
|
|
77312
|
-
const cmd = [
|
|
77040
|
+
var configure11 = async (ctx) => {
|
|
77041
|
+
const cmd = [name === "pnpm" ? npm12 : npx4, "qwik", "add", "cloudflare-pages"];
|
|
77042
|
+
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77043
|
+
await runCommand(cmd);
|
|
77044
|
+
addBindingsProxy(ctx);
|
|
77045
|
+
populateCloudflareEnv();
|
|
77046
|
+
};
|
|
77047
|
+
var addBindingsProxy = (ctx) => {
|
|
77048
|
+
if (!usesTypescript(ctx)) {
|
|
77049
|
+
return;
|
|
77050
|
+
}
|
|
77051
|
+
const s = spinner();
|
|
77052
|
+
s.start("Updating `vite.config.ts`");
|
|
77053
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
77054
|
+
const b3 = recast8.types.builders;
|
|
77055
|
+
transformFile("vite.config.ts", {
|
|
77056
|
+
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77057
|
+
visitProgram: function(n) {
|
|
77058
|
+
const lastImportIndex = n.node.body.findLastIndex(
|
|
77059
|
+
(t2) => t2.type === "ImportDeclaration"
|
|
77060
|
+
);
|
|
77061
|
+
const lastImport = n.get("body", lastImportIndex);
|
|
77062
|
+
lastImport.insertAfter(...snippets.getPlatformProxyTs);
|
|
77063
|
+
return this.traverse(n);
|
|
77064
|
+
},
|
|
77065
|
+
// Pass the `platform` object from the declaration to the `qwikCity` plugin
|
|
77066
|
+
visitCallExpression: function(n) {
|
|
77067
|
+
const callee = n.node.callee;
|
|
77068
|
+
if (callee.name !== "qwikCity") {
|
|
77069
|
+
return this.traverse(n);
|
|
77070
|
+
}
|
|
77071
|
+
const configArgument = n.node.arguments[0];
|
|
77072
|
+
const platformPropery = b3.objectProperty.from({
|
|
77073
|
+
key: b3.identifier("platform"),
|
|
77074
|
+
value: b3.identifier("platform"),
|
|
77075
|
+
shorthand: true
|
|
77076
|
+
});
|
|
77077
|
+
if (!configArgument) {
|
|
77078
|
+
n.node.arguments = [b3.objectExpression([platformPropery])];
|
|
77079
|
+
return false;
|
|
77080
|
+
}
|
|
77081
|
+
if (configArgument.type !== "ObjectExpression") {
|
|
77082
|
+
throw new Error("Failed to update `vite.config.ts`");
|
|
77083
|
+
}
|
|
77084
|
+
configArgument.properties.push(platformPropery);
|
|
77085
|
+
return false;
|
|
77086
|
+
}
|
|
77087
|
+
});
|
|
77088
|
+
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
77089
|
+
};
|
|
77090
|
+
var populateCloudflareEnv = () => {
|
|
77091
|
+
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
77092
|
+
const s = spinner();
|
|
77093
|
+
s.start(`Updating \`${entrypointPath}\``);
|
|
77094
|
+
transformFile(entrypointPath, {
|
|
77095
|
+
visitTSInterfaceDeclaration: function(n) {
|
|
77096
|
+
const b3 = recast8.types.builders;
|
|
77097
|
+
const id = n.node.id;
|
|
77098
|
+
if (id.name !== "QwikCityPlatform") {
|
|
77099
|
+
this.traverse(n);
|
|
77100
|
+
}
|
|
77101
|
+
const newBody = [
|
|
77102
|
+
["env", "Env"]
|
|
77103
|
+
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
77104
|
+
// ["cf", "CfProperties"],
|
|
77105
|
+
].map(
|
|
77106
|
+
([varName, type]) => b3.tsPropertySignature(
|
|
77107
|
+
b3.identifier(varName),
|
|
77108
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
|
|
77109
|
+
)
|
|
77110
|
+
);
|
|
77111
|
+
n.node.body.body = newBody;
|
|
77112
|
+
return false;
|
|
77113
|
+
}
|
|
77114
|
+
});
|
|
77115
|
+
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77116
|
+
};
|
|
77117
|
+
var config30 = {
|
|
77118
|
+
configVersion: 1,
|
|
77119
|
+
id: "qwik",
|
|
77120
|
+
frameworkCli: "create-qwik",
|
|
77121
|
+
displayName: "Qwik",
|
|
77122
|
+
platform: "pages",
|
|
77123
|
+
hidden: true,
|
|
77124
|
+
copyFiles: {
|
|
77125
|
+
path: "./templates"
|
|
77126
|
+
},
|
|
77127
|
+
path: "templates/qwik/pages",
|
|
77128
|
+
generate: generate17,
|
|
77129
|
+
configure: configure11,
|
|
77130
|
+
transformPackageJson: async () => ({
|
|
77131
|
+
scripts: {
|
|
77132
|
+
deploy: `${npm12} run build && wrangler pages deploy`,
|
|
77133
|
+
preview: `${npm12} run build && wrangler pages dev`,
|
|
77134
|
+
"cf-typegen": `wrangler types`
|
|
77135
|
+
}
|
|
77136
|
+
}),
|
|
77137
|
+
devScript: "dev",
|
|
77138
|
+
deployScript: "deploy",
|
|
77139
|
+
previewScript: "preview",
|
|
77140
|
+
workersTypes: "installed"
|
|
77141
|
+
};
|
|
77142
|
+
var c3_default33 = config30;
|
|
77143
|
+
|
|
77144
|
+
// templates/qwik/workers/c3.ts
|
|
77145
|
+
var recast9 = __toESM(require_main3());
|
|
77146
|
+
var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
|
|
77147
|
+
var generate18 = async (ctx) => {
|
|
77148
|
+
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77149
|
+
};
|
|
77150
|
+
var configure12 = async (ctx) => {
|
|
77151
|
+
const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77313
77152
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77314
77153
|
await runCommand(cmd);
|
|
77154
|
+
removeFile("./public/_routes.json");
|
|
77315
77155
|
addBindingsProxy2(ctx);
|
|
77316
77156
|
populateCloudflareEnv2();
|
|
77317
77157
|
};
|
|
@@ -77322,7 +77162,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77322
77162
|
const s = spinner();
|
|
77323
77163
|
s.start("Updating `vite.config.ts`");
|
|
77324
77164
|
const snippets = loadTemplateSnippets(ctx);
|
|
77325
|
-
const b3 =
|
|
77165
|
+
const b3 = recast9.types.builders;
|
|
77326
77166
|
transformFile("vite.config.ts", {
|
|
77327
77167
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77328
77168
|
visitProgram: function(n) {
|
|
@@ -77364,7 +77204,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77364
77204
|
s.start(`Updating \`${entrypointPath}\``);
|
|
77365
77205
|
transformFile(entrypointPath, {
|
|
77366
77206
|
visitTSInterfaceDeclaration: function(n) {
|
|
77367
|
-
const b3 =
|
|
77207
|
+
const b3 = recast9.types.builders;
|
|
77368
77208
|
const id = n.node.id;
|
|
77369
77209
|
if (id.name !== "QwikCityPlatform") {
|
|
77370
77210
|
this.traverse(n);
|
|
@@ -77385,21 +77225,64 @@ var populateCloudflareEnv2 = () => {
|
|
|
77385
77225
|
});
|
|
77386
77226
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77387
77227
|
};
|
|
77388
|
-
var
|
|
77228
|
+
var config31 = {
|
|
77389
77229
|
configVersion: 1,
|
|
77390
77230
|
id: "qwik",
|
|
77391
77231
|
frameworkCli: "create-qwik",
|
|
77392
77232
|
displayName: "Qwik",
|
|
77393
|
-
platform: "
|
|
77233
|
+
platform: "workers",
|
|
77394
77234
|
copyFiles: {
|
|
77395
77235
|
path: "./templates"
|
|
77396
77236
|
},
|
|
77397
|
-
|
|
77398
|
-
|
|
77237
|
+
path: "templates/qwik/workers",
|
|
77238
|
+
generate: generate18,
|
|
77239
|
+
configure: configure12,
|
|
77399
77240
|
transformPackageJson: async () => ({
|
|
77400
77241
|
scripts: {
|
|
77401
|
-
deploy: `${
|
|
77402
|
-
preview: `${
|
|
77242
|
+
deploy: `${npm13} run build && wrangler deploy`,
|
|
77243
|
+
preview: `${npm13} run build && wrangler dev`,
|
|
77244
|
+
"cf-typegen": `wrangler types`
|
|
77245
|
+
}
|
|
77246
|
+
}),
|
|
77247
|
+
devScript: "dev",
|
|
77248
|
+
deployScript: "deploy",
|
|
77249
|
+
previewScript: "preview",
|
|
77250
|
+
workersTypes: "installed"
|
|
77251
|
+
};
|
|
77252
|
+
var c3_default34 = config31;
|
|
77253
|
+
|
|
77254
|
+
// templates/qwik/c3.ts
|
|
77255
|
+
var config32 = {
|
|
77256
|
+
displayName: "Qwik",
|
|
77257
|
+
platformVariants: { pages: c3_default33, workers: c3_default34 }
|
|
77258
|
+
};
|
|
77259
|
+
var c3_default35 = config32;
|
|
77260
|
+
|
|
77261
|
+
// templates/react-router/c3.ts
|
|
77262
|
+
var { npm: npm14 } = detectPackageManager();
|
|
77263
|
+
var generate19 = async (ctx) => {
|
|
77264
|
+
await runFrameworkGenerator(ctx, [
|
|
77265
|
+
ctx.project.name,
|
|
77266
|
+
"--template",
|
|
77267
|
+
"https://github.com/remix-run/react-router-templates/tree/main/cloudflare",
|
|
77268
|
+
// to prevent asking about git twice, just let c3 do it
|
|
77269
|
+
"--no-git-init",
|
|
77270
|
+
"--no-install"
|
|
77271
|
+
]);
|
|
77272
|
+
logRaw("");
|
|
77273
|
+
};
|
|
77274
|
+
var config33 = {
|
|
77275
|
+
configVersion: 1,
|
|
77276
|
+
id: "react-router",
|
|
77277
|
+
platform: "workers",
|
|
77278
|
+
frameworkCli: "create-react-router",
|
|
77279
|
+
displayName: "React Router (formerly Remix)",
|
|
77280
|
+
generate: generate19,
|
|
77281
|
+
// configure,
|
|
77282
|
+
transformPackageJson: async () => ({
|
|
77283
|
+
scripts: {
|
|
77284
|
+
deploy: `${npm14} run build && wrangler deploy`,
|
|
77285
|
+
preview: `${npm14} run build && vite preview`,
|
|
77403
77286
|
"cf-typegen": `wrangler types`
|
|
77404
77287
|
}
|
|
77405
77288
|
}),
|
|
@@ -77407,11 +77290,11 @@ var config24 = {
|
|
|
77407
77290
|
deployScript: "deploy",
|
|
77408
77291
|
previewScript: "preview"
|
|
77409
77292
|
};
|
|
77410
|
-
var
|
|
77293
|
+
var c3_default36 = config33;
|
|
77411
77294
|
|
|
77412
77295
|
// templates/react/pages/c3.ts
|
|
77413
|
-
var { npm:
|
|
77414
|
-
var
|
|
77296
|
+
var { npm: npm15 } = detectPackageManager();
|
|
77297
|
+
var generate20 = async (ctx) => {
|
|
77415
77298
|
const variant = await inputPrompt({
|
|
77416
77299
|
type: "select",
|
|
77417
77300
|
question: "Select a variant:",
|
|
@@ -77440,34 +77323,37 @@ var variantsOptions = [
|
|
|
77440
77323
|
label: "JavaScript + SWC"
|
|
77441
77324
|
}
|
|
77442
77325
|
];
|
|
77443
|
-
var
|
|
77326
|
+
var config34 = {
|
|
77444
77327
|
configVersion: 1,
|
|
77445
77328
|
id: "react",
|
|
77446
77329
|
// React's documentation now recommends using create-vite.
|
|
77447
77330
|
frameworkCli: "create-vite",
|
|
77448
77331
|
displayName: "React",
|
|
77449
77332
|
platform: "pages",
|
|
77333
|
+
hidden: true,
|
|
77450
77334
|
path: "templates/react/pages",
|
|
77451
|
-
|
|
77335
|
+
copyFiles: { path: "./templates" },
|
|
77336
|
+
generate: generate20,
|
|
77452
77337
|
transformPackageJson: async () => ({
|
|
77453
77338
|
scripts: {
|
|
77454
|
-
deploy: `${
|
|
77455
|
-
preview: `${
|
|
77339
|
+
deploy: `${npm15} run build && wrangler pages deploy`,
|
|
77340
|
+
preview: `${npm15} run build && wrangler pages dev`,
|
|
77341
|
+
"cf-typegen": `wrangler types`
|
|
77456
77342
|
}
|
|
77457
77343
|
}),
|
|
77458
77344
|
devScript: "dev",
|
|
77459
77345
|
deployScript: "deploy",
|
|
77460
77346
|
previewScript: "preview"
|
|
77461
77347
|
};
|
|
77462
|
-
var
|
|
77348
|
+
var c3_default37 = config34;
|
|
77463
77349
|
|
|
77464
77350
|
// templates/react/workers/c3.ts
|
|
77465
77351
|
var import_assert2 = __toESM(require("assert"));
|
|
77466
|
-
var
|
|
77467
|
-
var b2 =
|
|
77468
|
-
var t =
|
|
77469
|
-
var { npm:
|
|
77470
|
-
var
|
|
77352
|
+
var recast10 = __toESM(require_main3());
|
|
77353
|
+
var b2 = recast10.types.builders;
|
|
77354
|
+
var t = recast10.types.namedTypes;
|
|
77355
|
+
var { npm: npm16 } = detectPackageManager();
|
|
77356
|
+
var generate21 = async (ctx) => {
|
|
77471
77357
|
const variant = await getVariant();
|
|
77472
77358
|
ctx.args.lang = variant.lang;
|
|
77473
77359
|
await runFrameworkGenerator(ctx, [
|
|
@@ -77477,13 +77363,13 @@ var generate22 = async (ctx) => {
|
|
|
77477
77363
|
]);
|
|
77478
77364
|
logRaw("");
|
|
77479
77365
|
};
|
|
77480
|
-
var
|
|
77366
|
+
var configure13 = async (ctx) => {
|
|
77481
77367
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77482
77368
|
dev: true,
|
|
77483
77369
|
startText: "Installing the Cloudflare Vite plugin",
|
|
77484
77370
|
doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
|
|
77485
77371
|
});
|
|
77486
|
-
|
|
77372
|
+
transformViteConfig(ctx);
|
|
77487
77373
|
if (usesTypescript(ctx)) {
|
|
77488
77374
|
updateTsconfigJson();
|
|
77489
77375
|
}
|
|
@@ -77508,9 +77394,9 @@ function transformViteConfig(ctx) {
|
|
|
77508
77394
|
if (callee.name !== "defineConfig") {
|
|
77509
77395
|
return this.traverse(n);
|
|
77510
77396
|
}
|
|
77511
|
-
const
|
|
77512
|
-
(0, import_assert2.default)(t.ObjectExpression.check(
|
|
77513
|
-
const pluginsProp =
|
|
77397
|
+
const config48 = n.node.arguments[0];
|
|
77398
|
+
(0, import_assert2.default)(t.ObjectExpression.check(config48));
|
|
77399
|
+
const pluginsProp = config48.properties.find((prop) => isPluginsProp(prop));
|
|
77514
77400
|
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77515
77401
|
pluginsProp.value.elements.push(
|
|
77516
77402
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -77567,7 +77453,7 @@ async function getVariant() {
|
|
|
77567
77453
|
(0, import_assert2.default)(selected, "Expected a variant to be selected");
|
|
77568
77454
|
return selected;
|
|
77569
77455
|
}
|
|
77570
|
-
var
|
|
77456
|
+
var config35 = {
|
|
77571
77457
|
configVersion: 1,
|
|
77572
77458
|
id: "react",
|
|
77573
77459
|
frameworkCli: "create-vite",
|
|
@@ -77584,12 +77470,12 @@ var config26 = {
|
|
|
77584
77470
|
}
|
|
77585
77471
|
}
|
|
77586
77472
|
},
|
|
77587
|
-
generate:
|
|
77588
|
-
configure:
|
|
77473
|
+
generate: generate21,
|
|
77474
|
+
configure: configure13,
|
|
77589
77475
|
transformPackageJson: async (_3, ctx) => ({
|
|
77590
77476
|
scripts: {
|
|
77591
|
-
deploy: `${
|
|
77592
|
-
preview: `${
|
|
77477
|
+
deploy: `${npm16} run build && wrangler deploy`,
|
|
77478
|
+
preview: `${npm16} run build && vite preview`,
|
|
77593
77479
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77594
77480
|
}
|
|
77595
77481
|
}),
|
|
@@ -77597,18 +77483,18 @@ var config26 = {
|
|
|
77597
77483
|
deployScript: "deploy",
|
|
77598
77484
|
previewScript: "preview"
|
|
77599
77485
|
};
|
|
77600
|
-
var
|
|
77486
|
+
var c3_default38 = config35;
|
|
77601
77487
|
|
|
77602
77488
|
// templates/react/c3.ts
|
|
77603
|
-
var
|
|
77489
|
+
var config36 = {
|
|
77604
77490
|
displayName: "React",
|
|
77605
|
-
platformVariants: { pages:
|
|
77491
|
+
platformVariants: { pages: c3_default37, workers: c3_default38 }
|
|
77606
77492
|
};
|
|
77607
|
-
var
|
|
77493
|
+
var c3_default39 = config36;
|
|
77608
77494
|
|
|
77609
|
-
// templates/remix/c3.ts
|
|
77610
|
-
var { npm:
|
|
77611
|
-
var
|
|
77495
|
+
// templates/remix/pages/c3.ts
|
|
77496
|
+
var { npm: npm17 } = detectPackageManager();
|
|
77497
|
+
var generate22 = async (ctx) => {
|
|
77612
77498
|
await runFrameworkGenerator(ctx, [
|
|
77613
77499
|
ctx.project.name,
|
|
77614
77500
|
"--template",
|
|
@@ -77616,7 +77502,7 @@ var generate23 = async (ctx) => {
|
|
|
77616
77502
|
]);
|
|
77617
77503
|
logRaw("");
|
|
77618
77504
|
};
|
|
77619
|
-
var
|
|
77505
|
+
var configure14 = async () => {
|
|
77620
77506
|
const typeDefsPath = "load-context.ts";
|
|
77621
77507
|
const s = spinner();
|
|
77622
77508
|
s.start(`Updating \`${typeDefsPath}\``);
|
|
@@ -77631,32 +77517,86 @@ var configure17 = async () => {
|
|
|
77631
77517
|
});
|
|
77632
77518
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
77633
77519
|
};
|
|
77634
|
-
var
|
|
77520
|
+
var config37 = {
|
|
77635
77521
|
configVersion: 1,
|
|
77636
77522
|
id: "remix",
|
|
77637
77523
|
frameworkCli: "create-remix",
|
|
77638
77524
|
platform: "pages",
|
|
77525
|
+
hidden: true,
|
|
77639
77526
|
displayName: "Remix",
|
|
77640
77527
|
copyFiles: {
|
|
77641
77528
|
path: "./templates"
|
|
77642
77529
|
},
|
|
77530
|
+
path: "templates/remix/pages",
|
|
77531
|
+
generate: generate22,
|
|
77532
|
+
configure: configure14,
|
|
77533
|
+
transformPackageJson: async () => ({
|
|
77534
|
+
scripts: {
|
|
77535
|
+
deploy: `${npm17} run build && wrangler pages deploy`,
|
|
77536
|
+
preview: `${npm17} run build && wrangler pages dev`,
|
|
77537
|
+
"cf-typegen": `wrangler types`
|
|
77538
|
+
}
|
|
77539
|
+
}),
|
|
77540
|
+
devScript: "dev",
|
|
77541
|
+
deployScript: "deploy",
|
|
77542
|
+
previewScript: "preview",
|
|
77543
|
+
workersTypes: "installed"
|
|
77544
|
+
};
|
|
77545
|
+
var c3_default40 = config37;
|
|
77546
|
+
|
|
77547
|
+
// templates/remix/workers/c3.ts
|
|
77548
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77549
|
+
var generate23 = async (ctx) => {
|
|
77550
|
+
await runFrameworkGenerator(ctx, [
|
|
77551
|
+
ctx.project.name,
|
|
77552
|
+
"--template",
|
|
77553
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
77554
|
+
]);
|
|
77555
|
+
logRaw("");
|
|
77556
|
+
};
|
|
77557
|
+
var configure15 = async () => {
|
|
77558
|
+
await installPackages(["wrangler@latest"], {
|
|
77559
|
+
dev: true,
|
|
77560
|
+
startText: "Updating the Wrangler version",
|
|
77561
|
+
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
77562
|
+
});
|
|
77563
|
+
};
|
|
77564
|
+
var config38 = {
|
|
77565
|
+
configVersion: 1,
|
|
77566
|
+
id: "remix",
|
|
77567
|
+
frameworkCli: "create-remix",
|
|
77568
|
+
platform: "workers",
|
|
77569
|
+
displayName: "Remix",
|
|
77570
|
+
copyFiles: {
|
|
77571
|
+
path: "./templates"
|
|
77572
|
+
},
|
|
77573
|
+
path: "templates/remix/workers",
|
|
77643
77574
|
generate: generate23,
|
|
77644
|
-
configure:
|
|
77575
|
+
configure: configure15,
|
|
77645
77576
|
transformPackageJson: async () => ({
|
|
77646
77577
|
scripts: {
|
|
77647
|
-
deploy: `${npm18} run build && wrangler
|
|
77648
|
-
preview: `${npm18} run build && wrangler
|
|
77578
|
+
deploy: `${npm18} run build && wrangler deploy`,
|
|
77579
|
+
preview: `${npm18} run build && wrangler dev`,
|
|
77649
77580
|
"cf-typegen": `wrangler types`
|
|
77650
77581
|
}
|
|
77651
77582
|
}),
|
|
77652
77583
|
devScript: "dev",
|
|
77653
77584
|
deployScript: "deploy",
|
|
77654
|
-
previewScript: "preview"
|
|
77585
|
+
previewScript: "preview",
|
|
77586
|
+
workersTypes: "installed"
|
|
77655
77587
|
};
|
|
77656
|
-
var
|
|
77588
|
+
var c3_default41 = config38;
|
|
77589
|
+
|
|
77590
|
+
// templates/remix/c3.ts
|
|
77591
|
+
var config39 = {
|
|
77592
|
+
displayName: "Remix",
|
|
77593
|
+
platformVariants: { pages: c3_default40, workers: c3_default41 },
|
|
77594
|
+
hidden: true
|
|
77595
|
+
};
|
|
77596
|
+
var c3_default42 = config39;
|
|
77657
77597
|
|
|
77658
77598
|
// templates/scheduled/c3.ts
|
|
77659
|
-
var
|
|
77599
|
+
var config40 = {
|
|
77660
77600
|
configVersion: 1,
|
|
77661
77601
|
id: "scheduled",
|
|
77662
77602
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -77673,15 +77613,16 @@ var c3_default38 = {
|
|
|
77673
77613
|
}
|
|
77674
77614
|
}
|
|
77675
77615
|
};
|
|
77616
|
+
var c3_default43 = config40;
|
|
77676
77617
|
|
|
77677
77618
|
// templates/solid/c3.ts
|
|
77678
|
-
var
|
|
77619
|
+
var recast11 = __toESM(require_main3());
|
|
77679
77620
|
var { npm: npm19 } = detectPackageManager();
|
|
77680
77621
|
var generate24 = async (ctx) => {
|
|
77681
77622
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
77682
77623
|
logRaw("");
|
|
77683
77624
|
};
|
|
77684
|
-
var
|
|
77625
|
+
var configure16 = async (ctx) => {
|
|
77685
77626
|
usesTypescript(ctx);
|
|
77686
77627
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
77687
77628
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
@@ -77691,7 +77632,7 @@ var configure18 = async (ctx) => {
|
|
|
77691
77632
|
if (callee.name !== "defineConfig") {
|
|
77692
77633
|
return this.traverse(n);
|
|
77693
77634
|
}
|
|
77694
|
-
const b3 =
|
|
77635
|
+
const b3 = recast11.types.builders;
|
|
77695
77636
|
mergeObjectProperties(
|
|
77696
77637
|
n.node.arguments[0],
|
|
77697
77638
|
[
|
|
@@ -77719,7 +77660,7 @@ var configure18 = async (ctx) => {
|
|
|
77719
77660
|
}
|
|
77720
77661
|
});
|
|
77721
77662
|
};
|
|
77722
|
-
var
|
|
77663
|
+
var config41 = {
|
|
77723
77664
|
configVersion: 1,
|
|
77724
77665
|
id: "solid",
|
|
77725
77666
|
frameworkCli: "create-solid",
|
|
@@ -77729,11 +77670,12 @@ var config29 = {
|
|
|
77729
77670
|
path: "./templates"
|
|
77730
77671
|
},
|
|
77731
77672
|
generate: generate24,
|
|
77732
|
-
configure:
|
|
77673
|
+
configure: configure16,
|
|
77733
77674
|
transformPackageJson: async () => ({
|
|
77734
77675
|
scripts: {
|
|
77735
77676
|
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
77736
|
-
deploy: `${npm19} run build && wrangler pages deploy
|
|
77677
|
+
deploy: `${npm19} run build && wrangler pages deploy`,
|
|
77678
|
+
"cf-typegen": `wrangler types`
|
|
77737
77679
|
}
|
|
77738
77680
|
}),
|
|
77739
77681
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -77741,29 +77683,28 @@ var config29 = {
|
|
|
77741
77683
|
deployScript: "deploy",
|
|
77742
77684
|
previewScript: "preview"
|
|
77743
77685
|
};
|
|
77744
|
-
var
|
|
77686
|
+
var c3_default44 = config41;
|
|
77745
77687
|
|
|
77746
|
-
// templates/svelte/c3.ts
|
|
77688
|
+
// templates/svelte/pages/c3.ts
|
|
77747
77689
|
var import_node_fs3 = require("node:fs");
|
|
77748
|
-
var
|
|
77749
|
-
var recast13 = __toESM(require_main3());
|
|
77690
|
+
var recast12 = __toESM(require_main3());
|
|
77750
77691
|
var { npm: npm20 } = detectPackageManager();
|
|
77751
77692
|
var generate25 = async (ctx) => {
|
|
77752
77693
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77753
77694
|
logRaw("");
|
|
77754
77695
|
};
|
|
77755
|
-
var
|
|
77696
|
+
var configure17 = async (ctx) => {
|
|
77756
77697
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77757
77698
|
await installPackages([pkg], {
|
|
77758
77699
|
dev: true,
|
|
77759
77700
|
startText: "Adding the Cloudflare Pages adapter",
|
|
77760
77701
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77761
77702
|
});
|
|
77762
|
-
|
|
77703
|
+
updateSvelteConfig();
|
|
77763
77704
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
77764
|
-
|
|
77705
|
+
updateTypeDefinitions(ctx);
|
|
77765
77706
|
};
|
|
77766
|
-
var
|
|
77707
|
+
var updateSvelteConfig = () => {
|
|
77767
77708
|
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77768
77709
|
transformFile("svelte.config.js", {
|
|
77769
77710
|
visitImportDeclaration: function(n) {
|
|
@@ -77797,12 +77738,12 @@ var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
|
77797
77738
|
}
|
|
77798
77739
|
});
|
|
77799
77740
|
};
|
|
77800
|
-
var
|
|
77741
|
+
var updateTypeDefinitions = (ctx) => {
|
|
77801
77742
|
if (!usesTypescript(ctx)) {
|
|
77802
77743
|
return;
|
|
77803
77744
|
}
|
|
77804
77745
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77805
|
-
const b3 =
|
|
77746
|
+
const b3 = recast12.types.builders;
|
|
77806
77747
|
transformFile("src/app.d.ts", {
|
|
77807
77748
|
visitTSModuleDeclaration(n) {
|
|
77808
77749
|
if (n.value.id.name === "App" && n.node.body) {
|
|
@@ -77834,65 +77775,177 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77834
77775
|
}
|
|
77835
77776
|
});
|
|
77836
77777
|
};
|
|
77837
|
-
var
|
|
77778
|
+
var typesPath3 = "src/worker-configuration.d.ts";
|
|
77779
|
+
var config42 = {
|
|
77838
77780
|
configVersion: 1,
|
|
77839
77781
|
id: "svelte",
|
|
77840
77782
|
frameworkCli: "sv",
|
|
77841
77783
|
displayName: "SvelteKit",
|
|
77842
77784
|
platform: "pages",
|
|
77785
|
+
hidden: true,
|
|
77843
77786
|
copyFiles: {
|
|
77844
77787
|
path: "./templates"
|
|
77845
77788
|
},
|
|
77789
|
+
path: "templates/svelte/pages",
|
|
77846
77790
|
generate: generate25,
|
|
77847
|
-
configure:
|
|
77791
|
+
configure: configure17,
|
|
77848
77792
|
transformPackageJson: async (original, ctx) => {
|
|
77849
77793
|
let scripts = {
|
|
77850
77794
|
preview: `${npm20} run build && wrangler pages dev`,
|
|
77851
77795
|
deploy: `${npm20} run build && wrangler pages deploy`
|
|
77852
77796
|
};
|
|
77853
77797
|
if (usesTypescript(ctx)) {
|
|
77854
|
-
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
77855
77798
|
scripts = {
|
|
77856
77799
|
...scripts,
|
|
77857
|
-
"cf-typegen": `wrangler types
|
|
77800
|
+
"cf-typegen": `wrangler types ${typesPath3}`
|
|
77858
77801
|
};
|
|
77859
77802
|
}
|
|
77860
77803
|
return { scripts };
|
|
77861
77804
|
},
|
|
77862
77805
|
devScript: "dev",
|
|
77863
77806
|
deployScript: "deploy",
|
|
77864
|
-
previewScript: "preview"
|
|
77807
|
+
previewScript: "preview",
|
|
77808
|
+
typesPath: typesPath3
|
|
77865
77809
|
};
|
|
77866
|
-
var
|
|
77810
|
+
var c3_default45 = config42;
|
|
77867
77811
|
|
|
77868
|
-
// templates/
|
|
77812
|
+
// templates/svelte/workers/c3.ts
|
|
77813
|
+
var recast13 = __toESM(require_main3());
|
|
77869
77814
|
var { npm: npm21 } = detectPackageManager();
|
|
77870
77815
|
var generate26 = async (ctx) => {
|
|
77816
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77817
|
+
logRaw("");
|
|
77818
|
+
};
|
|
77819
|
+
var configure18 = async (ctx) => {
|
|
77820
|
+
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77821
|
+
await installPackages([pkg], {
|
|
77822
|
+
dev: true,
|
|
77823
|
+
startText: "Adding the Cloudflare adapter",
|
|
77824
|
+
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77825
|
+
});
|
|
77826
|
+
updateSvelteConfig2();
|
|
77827
|
+
updateTypeDefinitions2(ctx);
|
|
77828
|
+
};
|
|
77829
|
+
var updateSvelteConfig2 = () => {
|
|
77830
|
+
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77831
|
+
transformFile("svelte.config.js", {
|
|
77832
|
+
visitImportDeclaration: function(n) {
|
|
77833
|
+
const importSource = n.value.source;
|
|
77834
|
+
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
77835
|
+
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
77836
|
+
}
|
|
77837
|
+
return false;
|
|
77838
|
+
}
|
|
77839
|
+
});
|
|
77840
|
+
};
|
|
77841
|
+
var updateTypeDefinitions2 = (ctx) => {
|
|
77842
|
+
if (!usesTypescript(ctx)) {
|
|
77843
|
+
return;
|
|
77844
|
+
}
|
|
77845
|
+
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77846
|
+
const b3 = recast13.types.builders;
|
|
77847
|
+
transformFile("src/app.d.ts", {
|
|
77848
|
+
visitTSModuleDeclaration(n) {
|
|
77849
|
+
if (n.value.id.name === "App" && n.node.body) {
|
|
77850
|
+
const moduleBlock = n.node.body;
|
|
77851
|
+
const platformInterface = b3.tsInterfaceDeclaration(
|
|
77852
|
+
b3.identifier("Platform"),
|
|
77853
|
+
b3.tsInterfaceBody([
|
|
77854
|
+
b3.tsPropertySignature(
|
|
77855
|
+
b3.identifier("env"),
|
|
77856
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
77857
|
+
),
|
|
77858
|
+
b3.tsPropertySignature(
|
|
77859
|
+
b3.identifier("cf"),
|
|
77860
|
+
b3.tsTypeAnnotation(
|
|
77861
|
+
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
77862
|
+
)
|
|
77863
|
+
),
|
|
77864
|
+
b3.tsPropertySignature(
|
|
77865
|
+
b3.identifier("ctx"),
|
|
77866
|
+
b3.tsTypeAnnotation(
|
|
77867
|
+
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
77868
|
+
)
|
|
77869
|
+
)
|
|
77870
|
+
])
|
|
77871
|
+
);
|
|
77872
|
+
moduleBlock.body.unshift(platformInterface);
|
|
77873
|
+
}
|
|
77874
|
+
this.traverse(n);
|
|
77875
|
+
}
|
|
77876
|
+
});
|
|
77877
|
+
};
|
|
77878
|
+
var typesPath4 = "./src/worker-configuration.d.ts";
|
|
77879
|
+
var config43 = {
|
|
77880
|
+
configVersion: 1,
|
|
77881
|
+
id: "svelte",
|
|
77882
|
+
frameworkCli: "sv",
|
|
77883
|
+
displayName: "SvelteKit",
|
|
77884
|
+
platform: "workers",
|
|
77885
|
+
copyFiles: {
|
|
77886
|
+
path: "./templates"
|
|
77887
|
+
},
|
|
77888
|
+
path: "templates/svelte/workers",
|
|
77889
|
+
generate: generate26,
|
|
77890
|
+
configure: configure18,
|
|
77891
|
+
transformPackageJson: async (original, ctx) => {
|
|
77892
|
+
let scripts = {
|
|
77893
|
+
preview: `${npm21} run build && wrangler dev`,
|
|
77894
|
+
deploy: `${npm21} run build && wrangler deploy`
|
|
77895
|
+
};
|
|
77896
|
+
if (usesTypescript(ctx)) {
|
|
77897
|
+
scripts = {
|
|
77898
|
+
...scripts,
|
|
77899
|
+
"cf-typegen": `wrangler types ${typesPath4}`
|
|
77900
|
+
};
|
|
77901
|
+
}
|
|
77902
|
+
return { scripts };
|
|
77903
|
+
},
|
|
77904
|
+
devScript: "dev",
|
|
77905
|
+
deployScript: "deploy",
|
|
77906
|
+
previewScript: "preview",
|
|
77907
|
+
typesPath: typesPath4
|
|
77908
|
+
};
|
|
77909
|
+
var c3_default46 = config43;
|
|
77910
|
+
|
|
77911
|
+
// templates/svelte/c3.ts
|
|
77912
|
+
var config44 = {
|
|
77913
|
+
displayName: "SvelteKit",
|
|
77914
|
+
platformVariants: { pages: c3_default45, workers: c3_default46 }
|
|
77915
|
+
};
|
|
77916
|
+
var c3_default47 = config44;
|
|
77917
|
+
|
|
77918
|
+
// templates/vue/pages/c3.ts
|
|
77919
|
+
var { npm: npm22 } = detectPackageManager();
|
|
77920
|
+
var generate27 = async (ctx) => {
|
|
77871
77921
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77872
77922
|
};
|
|
77873
|
-
var
|
|
77923
|
+
var config45 = {
|
|
77874
77924
|
configVersion: 1,
|
|
77875
77925
|
id: "vue",
|
|
77876
77926
|
frameworkCli: "create-vue",
|
|
77877
77927
|
displayName: "Vue",
|
|
77878
77928
|
platform: "pages",
|
|
77879
|
-
|
|
77880
|
-
|
|
77929
|
+
hidden: true,
|
|
77930
|
+
path: "templates/vue/pages",
|
|
77931
|
+
copyFiles: { path: "./templates" },
|
|
77932
|
+
generate: generate27,
|
|
77881
77933
|
transformPackageJson: async () => ({
|
|
77882
77934
|
scripts: {
|
|
77883
|
-
deploy: `${
|
|
77884
|
-
preview: `${
|
|
77935
|
+
deploy: `${npm22} run build && wrangler pages deploy`,
|
|
77936
|
+
preview: `${npm22} run build && wrangler pages dev`,
|
|
77937
|
+
"cf-typegen": `wrangler types`
|
|
77885
77938
|
}
|
|
77886
77939
|
}),
|
|
77887
77940
|
devScript: "dev",
|
|
77888
77941
|
deployScript: "deploy",
|
|
77889
77942
|
previewScript: "preview"
|
|
77890
77943
|
};
|
|
77891
|
-
var
|
|
77944
|
+
var c3_default48 = config45;
|
|
77892
77945
|
|
|
77893
77946
|
// templates/vue/workers/c3.ts
|
|
77894
|
-
var { npm:
|
|
77895
|
-
var
|
|
77947
|
+
var { npm: npm23 } = detectPackageManager();
|
|
77948
|
+
var generate28 = async (ctx) => {
|
|
77896
77949
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
77897
77950
|
type: "select",
|
|
77898
77951
|
question: "Would you like to use TypeScript?",
|
|
@@ -77909,7 +77962,7 @@ var generate27 = async (ctx) => {
|
|
|
77909
77962
|
]);
|
|
77910
77963
|
logRaw("");
|
|
77911
77964
|
};
|
|
77912
|
-
var
|
|
77965
|
+
var configure19 = async (ctx) => {
|
|
77913
77966
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77914
77967
|
dev: true,
|
|
77915
77968
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77930,7 +77983,7 @@ function updateTsconfigJson2() {
|
|
|
77930
77983
|
writeJSON("tsconfig.json", tsconfig);
|
|
77931
77984
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77932
77985
|
}
|
|
77933
|
-
var
|
|
77986
|
+
var config46 = {
|
|
77934
77987
|
configVersion: 1,
|
|
77935
77988
|
id: "vue",
|
|
77936
77989
|
frameworkCli: "create-vue",
|
|
@@ -77950,12 +78003,12 @@ var config32 = {
|
|
|
77950
78003
|
}
|
|
77951
78004
|
}
|
|
77952
78005
|
},
|
|
77953
|
-
configure:
|
|
77954
|
-
generate:
|
|
78006
|
+
configure: configure19,
|
|
78007
|
+
generate: generate28,
|
|
77955
78008
|
transformPackageJson: async (_3, ctx) => ({
|
|
77956
78009
|
scripts: {
|
|
77957
|
-
deploy: `${
|
|
77958
|
-
preview: `${
|
|
78010
|
+
deploy: `${npm23} run build && wrangler deploy`,
|
|
78011
|
+
preview: `${npm23} run build && wrangler dev`,
|
|
77959
78012
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77960
78013
|
}
|
|
77961
78014
|
}),
|
|
@@ -77963,20 +78016,20 @@ var config32 = {
|
|
|
77963
78016
|
deployScript: "deploy",
|
|
77964
78017
|
previewScript: "preview"
|
|
77965
78018
|
};
|
|
77966
|
-
var
|
|
78019
|
+
var c3_default49 = config46;
|
|
77967
78020
|
|
|
77968
78021
|
// templates/vue/c3.ts
|
|
77969
|
-
var
|
|
78022
|
+
var config47 = {
|
|
77970
78023
|
displayName: "Vue",
|
|
77971
|
-
platformVariants: { pages:
|
|
78024
|
+
platformVariants: { pages: c3_default48, workers: c3_default49 }
|
|
77972
78025
|
};
|
|
77973
|
-
var
|
|
78026
|
+
var c3_default50 = config47;
|
|
77974
78027
|
|
|
77975
78028
|
// src/git.ts
|
|
77976
78029
|
var import_node_assert = __toESM(require("node:assert"));
|
|
77977
78030
|
|
|
77978
78031
|
// ../wrangler/package.json
|
|
77979
|
-
var version2 = "0.0.0-
|
|
78032
|
+
var version2 = "0.0.0-fdae3f766";
|
|
77980
78033
|
|
|
77981
78034
|
// src/git.ts
|
|
77982
78035
|
var offerGit = async (ctx) => {
|
|
@@ -78237,47 +78290,58 @@ var defaultSelectVariant = async (ctx) => {
|
|
|
78237
78290
|
function getFrameworkMap({ experimental = false }) {
|
|
78238
78291
|
if (experimental) {
|
|
78239
78292
|
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
|
|
78293
|
+
solid: c3_default
|
|
78247
78294
|
};
|
|
78248
78295
|
} else {
|
|
78249
78296
|
return {
|
|
78250
|
-
analog:
|
|
78251
|
-
angular:
|
|
78252
|
-
astro:
|
|
78253
|
-
docusaurus:
|
|
78254
|
-
gatsby:
|
|
78255
|
-
hono:
|
|
78297
|
+
analog: c3_default2,
|
|
78298
|
+
angular: c3_default5,
|
|
78299
|
+
astro: c3_default8,
|
|
78300
|
+
docusaurus: c3_default12,
|
|
78301
|
+
gatsby: c3_default15,
|
|
78302
|
+
hono: c3_default23,
|
|
78256
78303
|
next: c3_default26,
|
|
78257
78304
|
nuxt: c3_default29,
|
|
78258
|
-
qwik:
|
|
78259
|
-
react:
|
|
78260
|
-
|
|
78261
|
-
|
|
78262
|
-
|
|
78263
|
-
|
|
78305
|
+
qwik: c3_default35,
|
|
78306
|
+
react: c3_default39,
|
|
78307
|
+
"react-router": c3_default36,
|
|
78308
|
+
remix: c3_default42,
|
|
78309
|
+
solid: c3_default44,
|
|
78310
|
+
svelte: c3_default47,
|
|
78311
|
+
vue: c3_default50
|
|
78264
78312
|
};
|
|
78265
78313
|
}
|
|
78266
78314
|
}
|
|
78267
|
-
function
|
|
78315
|
+
function getOtherTemplateMap({
|
|
78316
|
+
experimental = false
|
|
78317
|
+
}) {
|
|
78268
78318
|
if (experimental) {
|
|
78319
|
+
return {};
|
|
78320
|
+
} else {
|
|
78269
78321
|
return {
|
|
78270
|
-
|
|
78271
|
-
|
|
78272
|
-
|
|
78322
|
+
common: c3_default9,
|
|
78323
|
+
scheduled: c3_default43,
|
|
78324
|
+
queues: c3_default32,
|
|
78325
|
+
openapi: c3_default30,
|
|
78326
|
+
"pre-existing": c3_default31
|
|
78273
78327
|
};
|
|
78328
|
+
}
|
|
78329
|
+
}
|
|
78330
|
+
function getHelloWorldTemplateMap({
|
|
78331
|
+
experimental = false
|
|
78332
|
+
}) {
|
|
78333
|
+
if (experimental) {
|
|
78334
|
+
return {};
|
|
78274
78335
|
} else {
|
|
78275
78336
|
return {
|
|
78276
|
-
"hello-world":
|
|
78277
|
-
|
|
78278
|
-
|
|
78337
|
+
"hello-world": c3_default20,
|
|
78338
|
+
"hello-world-assets-only": c3_default16,
|
|
78339
|
+
"hello-world-with-assets": c3_default19,
|
|
78340
|
+
"hello-world-durable-object": c3_default18,
|
|
78341
|
+
"hello-world-durable-object-with-assets": c3_default17,
|
|
78342
|
+
common: c3_default9,
|
|
78343
|
+
scheduled: c3_default43,
|
|
78279
78344
|
queues: c3_default32,
|
|
78280
|
-
"hello-world-durable-object": c3_default23,
|
|
78281
78345
|
openapi: c3_default30,
|
|
78282
78346
|
"pre-existing": c3_default31
|
|
78283
78347
|
};
|
|
@@ -78339,6 +78403,12 @@ var deriveCorrelatedArgs = (args) => {
|
|
|
78339
78403
|
};
|
|
78340
78404
|
var createContext = async (args, prevArgs) => {
|
|
78341
78405
|
deriveCorrelatedArgs(args);
|
|
78406
|
+
const experimental = args.experimental;
|
|
78407
|
+
const frameworkMap = getFrameworkMap({ experimental });
|
|
78408
|
+
const helloWorldTemplateMap = getHelloWorldTemplateMap({
|
|
78409
|
+
experimental
|
|
78410
|
+
});
|
|
78411
|
+
const otherTemplateMap = getOtherTemplateMap({ experimental });
|
|
78342
78412
|
let linesPrinted = 0;
|
|
78343
78413
|
const goBack = async (from) => {
|
|
78344
78414
|
const currentArgs = { ...args };
|
|
@@ -78385,22 +78455,29 @@ var createContext = async (args, prevArgs) => {
|
|
|
78385
78455
|
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
|
|
78386
78456
|
format: (val) => `./${val}`
|
|
78387
78457
|
});
|
|
78388
|
-
const categoryOptions = [
|
|
78389
|
-
|
|
78458
|
+
const categoryOptions = [];
|
|
78459
|
+
if (Object.keys(helloWorldTemplateMap).length) {
|
|
78460
|
+
categoryOptions.push({
|
|
78390
78461
|
label: "Hello World example",
|
|
78391
78462
|
value: "hello-world",
|
|
78392
78463
|
description: "Select from barebones examples to get started with Workers"
|
|
78393
|
-
}
|
|
78394
|
-
|
|
78464
|
+
});
|
|
78465
|
+
}
|
|
78466
|
+
if (Object.keys(frameworkMap).length) {
|
|
78467
|
+
categoryOptions.push({
|
|
78395
78468
|
label: "Framework Starter",
|
|
78396
78469
|
value: "web-framework",
|
|
78397
78470
|
description: "Select from the most popular full-stack web frameworks"
|
|
78398
|
-
}
|
|
78399
|
-
|
|
78471
|
+
});
|
|
78472
|
+
}
|
|
78473
|
+
if (Object.keys(otherTemplateMap).length) {
|
|
78474
|
+
categoryOptions.push({
|
|
78400
78475
|
label: "Application Starter",
|
|
78401
78476
|
value: "demo",
|
|
78402
78477
|
description: "Select from a range of starter applications using various Cloudflare products"
|
|
78403
|
-
}
|
|
78478
|
+
});
|
|
78479
|
+
}
|
|
78480
|
+
categoryOptions.push(
|
|
78404
78481
|
{
|
|
78405
78482
|
label: "Template from a GitHub repo",
|
|
78406
78483
|
value: "remote-template",
|
|
@@ -78409,7 +78486,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
78409
78486
|
// This is used only if the type is `pre-existing`
|
|
78410
78487
|
{ label: "Others", value: "others", hidden: true },
|
|
78411
78488
|
backOption
|
|
78412
|
-
|
|
78489
|
+
);
|
|
78413
78490
|
const category = await processArgument(args, "category", {
|
|
78414
78491
|
type: "select",
|
|
78415
78492
|
question: "What would you like to start with?",
|
|
@@ -78423,14 +78500,17 @@ var createContext = async (args, prevArgs) => {
|
|
|
78423
78500
|
}
|
|
78424
78501
|
let template;
|
|
78425
78502
|
if (category === "web-framework") {
|
|
78426
|
-
const
|
|
78427
|
-
|
|
78428
|
-
|
|
78429
|
-
|
|
78430
|
-
|
|
78431
|
-
|
|
78432
|
-
|
|
78433
|
-
|
|
78503
|
+
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
78504
|
+
(acc, [key, config48]) => {
|
|
78505
|
+
if (!config48.hidden || args.framework) {
|
|
78506
|
+
acc.push({
|
|
78507
|
+
label: config48.displayName,
|
|
78508
|
+
value: key
|
|
78509
|
+
});
|
|
78510
|
+
}
|
|
78511
|
+
return acc;
|
|
78512
|
+
},
|
|
78513
|
+
[]
|
|
78434
78514
|
);
|
|
78435
78515
|
const framework = await processArgument(args, "framework", {
|
|
78436
78516
|
type: "select",
|
|
@@ -78448,30 +78528,40 @@ var createContext = async (args, prevArgs) => {
|
|
|
78448
78528
|
throw new Error(`Unsupported framework: ${framework}`);
|
|
78449
78529
|
}
|
|
78450
78530
|
if ("platformVariants" in frameworkConfig) {
|
|
78451
|
-
const
|
|
78531
|
+
const availableVariants = Object.entries(
|
|
78532
|
+
frameworkConfig.platformVariants
|
|
78533
|
+
).filter(([, config48]) => !config48.hidden);
|
|
78534
|
+
if (availableVariants.length === 1) {
|
|
78535
|
+
args.platform ??= availableVariants[0][0];
|
|
78536
|
+
}
|
|
78537
|
+
const platform = await processArgument(args, "platform", {
|
|
78452
78538
|
type: "select",
|
|
78453
78539
|
label: "platform",
|
|
78454
78540
|
question: "Select your deployment platform",
|
|
78455
78541
|
options: [
|
|
78456
|
-
|
|
78457
|
-
|
|
78458
|
-
|
|
78459
|
-
|
|
78460
|
-
|
|
78461
|
-
|
|
78462
|
-
|
|
78463
|
-
|
|
78464
|
-
|
|
78465
|
-
|
|
78542
|
+
...args.platform === "workers" || !frameworkConfig.platformVariants.workers.hidden ? [
|
|
78543
|
+
{
|
|
78544
|
+
label: "Workers with Assets",
|
|
78545
|
+
value: "workers",
|
|
78546
|
+
description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
|
|
78547
|
+
}
|
|
78548
|
+
] : [],
|
|
78549
|
+
...args.platform === "pages" || !frameworkConfig.platformVariants.pages.hidden ? [
|
|
78550
|
+
{
|
|
78551
|
+
label: "Pages",
|
|
78552
|
+
value: "pages",
|
|
78553
|
+
description: "Great for simple websites and applications."
|
|
78554
|
+
}
|
|
78555
|
+
] : [],
|
|
78466
78556
|
backOption
|
|
78467
78557
|
],
|
|
78468
78558
|
defaultValue: "workers"
|
|
78469
78559
|
});
|
|
78470
78560
|
linesPrinted += 3;
|
|
78471
|
-
if (
|
|
78561
|
+
if (platform === BACK_VALUE) {
|
|
78472
78562
|
return goBack("platform");
|
|
78473
78563
|
}
|
|
78474
|
-
frameworkConfig = frameworkConfig.platformVariants[
|
|
78564
|
+
frameworkConfig = frameworkConfig.platformVariants[platform];
|
|
78475
78565
|
}
|
|
78476
78566
|
template = {
|
|
78477
78567
|
deployScript: "pages:deploy",
|
|
@@ -78481,18 +78571,14 @@ var createContext = async (args, prevArgs) => {
|
|
|
78481
78571
|
} else if (category === "remote-template") {
|
|
78482
78572
|
template = await processRemoteTemplate(args);
|
|
78483
78573
|
} else {
|
|
78484
|
-
const templateMap =
|
|
78485
|
-
experimental: args.experimental
|
|
78486
|
-
});
|
|
78574
|
+
const templateMap = category === "hello-world" ? helloWorldTemplateMap : otherTemplateMap;
|
|
78487
78575
|
const templateOptions = Object.entries(templateMap).map(
|
|
78488
78576
|
([value, { displayName, description, hidden: hidden2 }]) => {
|
|
78489
|
-
const isHelloWorldExample = value.startsWith("hello-world");
|
|
78490
|
-
const isCategoryMatched = category === "hello-world" ? isHelloWorldExample : !isHelloWorldExample;
|
|
78491
78577
|
return {
|
|
78492
78578
|
value,
|
|
78493
78579
|
label: displayName,
|
|
78494
78580
|
description,
|
|
78495
|
-
hidden: hidden2
|
|
78581
|
+
hidden: hidden2
|
|
78496
78582
|
};
|
|
78497
78583
|
}
|
|
78498
78584
|
);
|
|
@@ -78512,6 +78598,12 @@ var createContext = async (args, prevArgs) => {
|
|
|
78512
78598
|
throw new Error(`Unknown application type provided: ${type}.`);
|
|
78513
78599
|
}
|
|
78514
78600
|
}
|
|
78601
|
+
template = {
|
|
78602
|
+
workersTypes: "generated",
|
|
78603
|
+
typesPath: "./worker-configuration.d.ts",
|
|
78604
|
+
envInterfaceName: "Env",
|
|
78605
|
+
...template
|
|
78606
|
+
};
|
|
78515
78607
|
const path6 = (0, import_path13.resolve)(projectName);
|
|
78516
78608
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
78517
78609
|
if (languageVariants.length > 0) {
|
|
@@ -78571,7 +78663,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
78571
78663
|
}
|
|
78572
78664
|
srcdir = (0, import_path13.join)(getTemplatePath(ctx), variantInfo.path);
|
|
78573
78665
|
}
|
|
78574
|
-
const copyDestDir =
|
|
78666
|
+
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
78575
78667
|
const destdir = (0, import_path13.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
78576
78668
|
const s = spinner();
|
|
78577
78669
|
s.start(`Copying template files`);
|
|
@@ -78594,29 +78686,29 @@ var processRemoteTemplate = async (args) => {
|
|
|
78594
78686
|
if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
|
|
78595
78687
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78596
78688
|
}
|
|
78597
|
-
const path6 = await downloadRemoteTemplate(src);
|
|
78598
|
-
const
|
|
78599
|
-
validateTemplate(path6,
|
|
78689
|
+
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
78690
|
+
const config48 = inferTemplateConfig(path6);
|
|
78691
|
+
validateTemplate(path6, config48);
|
|
78600
78692
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78601
78693
|
return {
|
|
78602
78694
|
path: path6,
|
|
78603
|
-
...
|
|
78695
|
+
...config48
|
|
78604
78696
|
};
|
|
78605
78697
|
};
|
|
78606
|
-
var validateTemplate = (path6,
|
|
78607
|
-
if (!
|
|
78698
|
+
var validateTemplate = (path6, config48) => {
|
|
78699
|
+
if (!config48.copyFiles) {
|
|
78608
78700
|
return;
|
|
78609
78701
|
}
|
|
78610
|
-
if (isVariantInfo(
|
|
78611
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78702
|
+
if (isVariantInfo(config48.copyFiles)) {
|
|
78703
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config48.copyFiles.path), config48);
|
|
78612
78704
|
} else {
|
|
78613
|
-
for (const variant of Object.values(
|
|
78614
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
78705
|
+
for (const variant of Object.values(config48.copyFiles.variants)) {
|
|
78706
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config48);
|
|
78615
78707
|
}
|
|
78616
78708
|
}
|
|
78617
78709
|
};
|
|
78618
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78619
|
-
if (
|
|
78710
|
+
var validateTemplateSrcDirectory = (path6, config48) => {
|
|
78711
|
+
if (config48.platform === "workers") {
|
|
78620
78712
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78621
78713
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78622
78714
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -78653,13 +78745,14 @@ var inferCopyFilesDefinition = (path6) => {
|
|
|
78653
78745
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
78654
78746
|
return copyFiles;
|
|
78655
78747
|
};
|
|
78656
|
-
var downloadRemoteTemplate = async (src) => {
|
|
78748
|
+
var downloadRemoteTemplate = async (src, mode) => {
|
|
78657
78749
|
try {
|
|
78658
78750
|
updateStatus(`Cloning template from: ${blue(src)}`);
|
|
78659
78751
|
const emitter = (0, import_degit.default)(src, {
|
|
78660
78752
|
cache: false,
|
|
78661
78753
|
verbose: false,
|
|
78662
|
-
force: true
|
|
78754
|
+
force: true,
|
|
78755
|
+
mode
|
|
78663
78756
|
});
|
|
78664
78757
|
const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path13.join)((0, import_os2.tmpdir)(), "c3-template"));
|
|
78665
78758
|
await emitter.clone(tmpDir);
|
|
@@ -78789,13 +78882,10 @@ var cliDefinition = {
|
|
|
78789
78882
|
values(args) {
|
|
78790
78883
|
const experimental = Boolean(args?.["experimental"]);
|
|
78791
78884
|
if (experimental) {
|
|
78792
|
-
return [
|
|
78793
|
-
{ name: "hello-world", description: "Hello World example" },
|
|
78794
|
-
{ name: "web-framework", description: "Framework Starter" }
|
|
78795
|
-
];
|
|
78885
|
+
return [{ name: "web-framework", description: "Framework Starter" }];
|
|
78796
78886
|
} else {
|
|
78797
78887
|
return [
|
|
78798
|
-
{ name: "hello-world", description: "Hello World
|
|
78888
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78799
78889
|
{ name: "web-framework", description: "Framework Starter" },
|
|
78800
78890
|
{ name: "demo", description: "Application Starter" },
|
|
78801
78891
|
{
|
|
@@ -78818,40 +78908,10 @@ var cliDefinition = {
|
|
|
78818
78908
|
`,
|
|
78819
78909
|
values(args) {
|
|
78820
78910
|
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
|
-
}
|
|
78911
|
+
return getNamesAndDescriptions({
|
|
78912
|
+
...getHelloWorldTemplateMap({ experimental }),
|
|
78913
|
+
...getOtherTemplateMap({ experimental })
|
|
78914
|
+
});
|
|
78855
78915
|
}
|
|
78856
78916
|
},
|
|
78857
78917
|
{
|
|
@@ -78866,7 +78926,7 @@ var cliDefinition = {
|
|
|
78866
78926
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
78867
78927
|
|
|
78868
78928
|
npm create cloudflare -- --framework next -- --ts
|
|
78869
|
-
pnpm create
|
|
78929
|
+
pnpm create cloudflare --framework next -- --ts
|
|
78870
78930
|
`,
|
|
78871
78931
|
values: (args) => getNamesAndDescriptions(
|
|
78872
78932
|
getFrameworkMap({
|
|
@@ -78880,12 +78940,12 @@ var cliDefinition = {
|
|
|
78880
78940
|
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
78941
|
values: [
|
|
78882
78942
|
{
|
|
78883
|
-
name: "
|
|
78884
|
-
description: "Create a web application that can be deployed to
|
|
78943
|
+
name: "workers",
|
|
78944
|
+
description: "Create a web application that can be deployed to Workers."
|
|
78885
78945
|
},
|
|
78886
78946
|
{
|
|
78887
|
-
name: "
|
|
78888
|
-
description: "Create a web application that can be deployed to
|
|
78947
|
+
name: "pages",
|
|
78948
|
+
description: "Create a web application that can be deployed to Pages."
|
|
78889
78949
|
}
|
|
78890
78950
|
],
|
|
78891
78951
|
requiresArg: true
|
|
@@ -78947,6 +79007,27 @@ var cliDefinition = {
|
|
|
78947
79007
|
npm create cloudflare -- --template https://github.com/cloudflare/workers-sdk/templates/worker-r2
|
|
78948
79008
|
`
|
|
78949
79009
|
},
|
|
79010
|
+
{
|
|
79011
|
+
name: "template-mode",
|
|
79012
|
+
type: "string",
|
|
79013
|
+
requiresArg: true,
|
|
79014
|
+
description: `The mechanism to use when fetching the template.
|
|
79015
|
+
|
|
79016
|
+
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
79017
|
+
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
79018
|
+
Otherwise, it will use "git".
|
|
79019
|
+
`,
|
|
79020
|
+
values: [
|
|
79021
|
+
{
|
|
79022
|
+
name: "git",
|
|
79023
|
+
description: "Use git to fetch the template. Supports private repositories."
|
|
79024
|
+
},
|
|
79025
|
+
{
|
|
79026
|
+
name: "tar",
|
|
79027
|
+
description: "Use tar to fetch the template. Only supported on public repositories hosted on GitHub, BitBucket, GitLab, or git.sr.ht."
|
|
79028
|
+
}
|
|
79029
|
+
]
|
|
79030
|
+
},
|
|
78950
79031
|
{
|
|
78951
79032
|
name: "accept-defaults",
|
|
78952
79033
|
alias: "y",
|
|
@@ -79111,7 +79192,7 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
79111
79192
|
|
|
79112
79193
|
// src/deploy.ts
|
|
79113
79194
|
var import_promises5 = require("node:fs/promises");
|
|
79114
|
-
var
|
|
79195
|
+
var import_node_os3 = require("node:os");
|
|
79115
79196
|
var import_node_path6 = require("node:path");
|
|
79116
79197
|
var import_toml3 = __toESM(require_toml());
|
|
79117
79198
|
|
|
@@ -80527,20 +80608,20 @@ function applyEdits(text, edits) {
|
|
|
80527
80608
|
var import_fs12 = require("fs");
|
|
80528
80609
|
var import_path14 = require("path");
|
|
80529
80610
|
var import_toml2 = __toESM(require_toml());
|
|
80530
|
-
function ensureNameExists(
|
|
80531
|
-
|
|
80532
|
-
return
|
|
80611
|
+
function ensureNameExists(config48, projectName) {
|
|
80612
|
+
config48["name"] = projectName;
|
|
80613
|
+
return config48;
|
|
80533
80614
|
}
|
|
80534
|
-
async function ensureCompatDateExists(
|
|
80535
|
-
if (typeof
|
|
80615
|
+
async function ensureCompatDateExists(config48) {
|
|
80616
|
+
if (typeof config48["compatibility_date"] === "string") {
|
|
80536
80617
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80537
|
-
if (!
|
|
80538
|
-
|
|
80618
|
+
if (!config48["compatibility_date"].match(validCompatDateRe)) {
|
|
80619
|
+
config48["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80539
80620
|
}
|
|
80540
80621
|
} else {
|
|
80541
|
-
|
|
80622
|
+
config48["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80542
80623
|
}
|
|
80543
|
-
return
|
|
80624
|
+
return config48;
|
|
80544
80625
|
}
|
|
80545
80626
|
var updateWranglerConfig = async (ctx) => {
|
|
80546
80627
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -80551,12 +80632,15 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
80551
80632
|
const modified = await ensureCompatDateExists(
|
|
80552
80633
|
ensureNameExists(parsed, ctx.project.name)
|
|
80553
80634
|
);
|
|
80554
|
-
|
|
80635
|
+
let comment = `/**
|
|
80555
80636
|
* For more details on how to configure Wrangler, refer to:
|
|
80556
80637
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
80557
80638
|
*/
|
|
80558
|
-
{
|
|
80639
|
+
{`;
|
|
80640
|
+
if (!modified["$schema"]) {
|
|
80641
|
+
comment += `
|
|
80559
80642
|
"$schema": "node_modules/wrangler/config-schema.json",`;
|
|
80643
|
+
}
|
|
80560
80644
|
if (!modified["observability"]) {
|
|
80561
80645
|
modified["observability"] = { enabled: true };
|
|
80562
80646
|
}
|
|
@@ -80711,7 +80795,7 @@ var addVscodeConfig = (ctx) => {
|
|
|
80711
80795
|
|
|
80712
80796
|
// src/deploy.ts
|
|
80713
80797
|
var offerToDeploy = async (ctx) => {
|
|
80714
|
-
const { npm:
|
|
80798
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80715
80799
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
80716
80800
|
if (!await isDeployable(ctx)) {
|
|
80717
80801
|
ctx.args.deploy = false;
|
|
@@ -80722,7 +80806,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
80722
80806
|
);
|
|
80723
80807
|
}
|
|
80724
80808
|
const label = `deploy via \`${quoteShellArgs([
|
|
80725
|
-
|
|
80809
|
+
npm25,
|
|
80726
80810
|
"run",
|
|
80727
80811
|
ctx.template.deployScript ?? "deploy"
|
|
80728
80812
|
])}\``;
|
|
@@ -80759,11 +80843,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
80759
80843
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
80760
80844
|
};
|
|
80761
80845
|
var runDeploy = async (ctx) => {
|
|
80762
|
-
const { npm:
|
|
80846
|
+
const { npm: npm25, name: pm4 } = detectPackageManager();
|
|
80763
80847
|
if (!ctx.account?.id) {
|
|
80764
80848
|
throw new Error("Failed to read Cloudflare account.");
|
|
80765
80849
|
}
|
|
80766
|
-
const baseDeployCmd = [
|
|
80850
|
+
const baseDeployCmd = [npm25, "run", ctx.template.deployScript ?? "deploy"];
|
|
80767
80851
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
80768
80852
|
const deployCmd = [
|
|
80769
80853
|
...baseDeployCmd,
|
|
@@ -80775,7 +80859,7 @@ var runDeploy = async (ctx) => {
|
|
|
80775
80859
|
] : []
|
|
80776
80860
|
];
|
|
80777
80861
|
const outputFile = (0, import_node_path6.join)(
|
|
80778
|
-
await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0,
|
|
80862
|
+
await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0, import_node_os3.tmpdir)(), "c3-wrangler-deploy-")),
|
|
80779
80863
|
"output.json"
|
|
80780
80864
|
);
|
|
80781
80865
|
await runCommand(deployCmd, {
|
|
@@ -80879,14 +80963,14 @@ var printSummary = (ctx) => {
|
|
|
80879
80963
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
80880
80964
|
const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
80881
80965
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
80882
|
-
const { npm:
|
|
80966
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80883
80967
|
const devServerCommand = quoteShellArgs([
|
|
80884
|
-
|
|
80968
|
+
npm25,
|
|
80885
80969
|
"run",
|
|
80886
80970
|
ctx.template.devScript ?? "start"
|
|
80887
80971
|
]);
|
|
80888
80972
|
const deployCommand = quoteShellArgs([
|
|
80889
|
-
|
|
80973
|
+
npm25,
|
|
80890
80974
|
"run",
|
|
80891
80975
|
ctx.template.deployScript ?? "deploy"
|
|
80892
80976
|
]);
|
|
@@ -81254,8 +81338,8 @@ var renderValues = (values) => {
|
|
|
81254
81338
|
};
|
|
81255
81339
|
|
|
81256
81340
|
// src/helpers/retry.ts
|
|
81257
|
-
var retry = async (
|
|
81258
|
-
let { times } =
|
|
81341
|
+
var retry = async (config48, fn) => {
|
|
81342
|
+
let { times } = config48;
|
|
81259
81343
|
let error2 = null;
|
|
81260
81344
|
while (times > 0) {
|
|
81261
81345
|
try {
|
|
@@ -81263,10 +81347,10 @@ var retry = async (config34, fn) => {
|
|
|
81263
81347
|
} catch (e) {
|
|
81264
81348
|
error2 = e;
|
|
81265
81349
|
times--;
|
|
81266
|
-
if (
|
|
81350
|
+
if (config48.exitCondition?.(e)) {
|
|
81267
81351
|
break;
|
|
81268
81352
|
}
|
|
81269
|
-
await sleep(
|
|
81353
|
+
await sleep(config48.sleepMs ?? 1e3);
|
|
81270
81354
|
}
|
|
81271
81355
|
}
|
|
81272
81356
|
throw error2;
|
|
@@ -81355,48 +81439,107 @@ var createProject = async (ctx) => {
|
|
|
81355
81439
|
// src/workers.ts
|
|
81356
81440
|
var import_fs13 = require("fs");
|
|
81357
81441
|
var import_path16 = require("path");
|
|
81358
|
-
|
|
81359
|
-
|
|
81360
|
-
if (!usesTypescript(ctx)) {
|
|
81442
|
+
var import_toml4 = __toESM(require_toml());
|
|
81443
|
+
async function addTypes(ctx) {
|
|
81444
|
+
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
81361
81445
|
return;
|
|
81362
81446
|
}
|
|
81363
|
-
|
|
81364
|
-
|
|
81365
|
-
|
|
81366
|
-
|
|
81447
|
+
const { npm: npm25 } = detectPackageManager();
|
|
81448
|
+
if (ctx.template.workersTypes === "installed") {
|
|
81449
|
+
await installWorkersTypes(npm25);
|
|
81450
|
+
} else if (ctx.template.workersTypes === "generated") {
|
|
81451
|
+
await generateWorkersTypes(ctx, npm25);
|
|
81452
|
+
}
|
|
81453
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm25);
|
|
81454
|
+
await updateTsConfig(ctx, { usesNodeCompat });
|
|
81455
|
+
}
|
|
81456
|
+
async function generateWorkersTypes(ctx, npm25) {
|
|
81457
|
+
const packageJsonPath = (0, import_path16.join)(ctx.project.path, "package.json");
|
|
81458
|
+
if (!(0, import_fs13.existsSync)(packageJsonPath)) {
|
|
81459
|
+
return;
|
|
81460
|
+
}
|
|
81461
|
+
const packageManifest = readJSON(packageJsonPath);
|
|
81462
|
+
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
81463
|
+
return;
|
|
81464
|
+
}
|
|
81465
|
+
const typesCmd = [npm25, "run", "cf-typegen"];
|
|
81466
|
+
await runCommand(typesCmd, {
|
|
81467
|
+
cwd: ctx.project.path,
|
|
81468
|
+
silent: true,
|
|
81469
|
+
startText: "Generating types for your application",
|
|
81470
|
+
doneText: `${brandColor("generated")} ${dim(`to \`${ctx.template.typesPath}\` via \`${typesCmd.join(" ")}\``)}`
|
|
81367
81471
|
});
|
|
81368
|
-
|
|
81472
|
+
if (packageManifest["devDependencies"]?.["@cloudflare/workers-types"]) {
|
|
81473
|
+
delete packageManifest["devDependencies"]?.["@cloudflare/workers-types"];
|
|
81474
|
+
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
81475
|
+
}
|
|
81369
81476
|
}
|
|
81370
|
-
async
|
|
81477
|
+
var maybeInstallNodeTypes = async (ctx, npm25) => {
|
|
81478
|
+
let parsedConfig = {};
|
|
81479
|
+
if (wranglerJsonExists(ctx)) {
|
|
81480
|
+
const wranglerJsonStr = readWranglerJson(ctx);
|
|
81481
|
+
parsedConfig = parse4(wranglerJsonStr, void 0, {
|
|
81482
|
+
allowTrailingComma: true
|
|
81483
|
+
});
|
|
81484
|
+
} else if (wranglerTomlExists(ctx)) {
|
|
81485
|
+
const wranglerTomlStr = readWranglerToml(ctx);
|
|
81486
|
+
parsedConfig = import_toml4.default.parse(wranglerTomlStr);
|
|
81487
|
+
}
|
|
81488
|
+
const compatibilityFlags = Array.isArray(parsedConfig["compatibility_flags"]) ? parsedConfig["compatibility_flags"] : [];
|
|
81489
|
+
if (compatibilityFlags.includes("nodejs_compat") || compatibilityFlags.includes("nodejs_compat_v2")) {
|
|
81490
|
+
await installPackages(["@types/node"], {
|
|
81491
|
+
dev: true,
|
|
81492
|
+
startText: "Installing @types/node",
|
|
81493
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81494
|
+
});
|
|
81495
|
+
return true;
|
|
81496
|
+
}
|
|
81497
|
+
return false;
|
|
81498
|
+
};
|
|
81499
|
+
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
81371
81500
|
const tsconfigPath = (0, import_path16.join)(ctx.project.path, "tsconfig.json");
|
|
81372
81501
|
if (!(0, import_fs13.existsSync)(tsconfigPath)) {
|
|
81373
81502
|
return;
|
|
81374
81503
|
}
|
|
81375
|
-
const s = spinner();
|
|
81376
|
-
s.start("Adding latest types to `tsconfig.json`");
|
|
81377
81504
|
const tsconfig = readFile(tsconfigPath);
|
|
81378
|
-
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
81379
|
-
if (entrypointVersion === null) {
|
|
81380
|
-
s.stop(
|
|
81381
|
-
`${brandColor(
|
|
81382
|
-
"skipped"
|
|
81383
|
-
)} couldn't find latest compatible version of @cloudflare/workers-types`
|
|
81384
|
-
);
|
|
81385
|
-
return;
|
|
81386
|
-
}
|
|
81387
|
-
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81388
81505
|
try {
|
|
81389
|
-
const
|
|
81390
|
-
const currentTypes =
|
|
81391
|
-
|
|
81392
|
-
|
|
81393
|
-
|
|
81394
|
-
|
|
81395
|
-
|
|
81396
|
-
|
|
81397
|
-
|
|
81398
|
-
|
|
81399
|
-
|
|
81506
|
+
const config48 = parse4(tsconfig);
|
|
81507
|
+
const currentTypes = config48.compilerOptions?.types ?? [];
|
|
81508
|
+
let newTypes = [...currentTypes];
|
|
81509
|
+
if (ctx.template.workersTypes === "installed") {
|
|
81510
|
+
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
81511
|
+
if (entrypointVersion === null) {
|
|
81512
|
+
return;
|
|
81513
|
+
}
|
|
81514
|
+
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81515
|
+
const explicitEntrypoint = currentTypes.some(
|
|
81516
|
+
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81517
|
+
);
|
|
81518
|
+
if (!explicitEntrypoint) {
|
|
81519
|
+
newTypes = newTypes.filter(
|
|
81520
|
+
(t2) => t2 !== "@cloudflare/workers-types"
|
|
81521
|
+
);
|
|
81522
|
+
newTypes.push(typesEntrypoint);
|
|
81523
|
+
}
|
|
81524
|
+
} else if (ctx.template.workersTypes === "generated") {
|
|
81525
|
+
newTypes.push(ctx.template.typesPath ?? "./worker-configuration.d.ts");
|
|
81526
|
+
const typegen = readFile(
|
|
81527
|
+
ctx.template.typesPath ?? "./worker-configuration.d.ts"
|
|
81528
|
+
).split("\n");
|
|
81529
|
+
if (typegen.some(
|
|
81530
|
+
(line) => line.includes("// Runtime types generated with workerd")
|
|
81531
|
+
)) {
|
|
81532
|
+
newTypes = newTypes.filter(
|
|
81533
|
+
(t2) => !t2.startsWith("@cloudflare/workers-types")
|
|
81534
|
+
);
|
|
81535
|
+
}
|
|
81536
|
+
}
|
|
81537
|
+
if (usesNodeCompat) {
|
|
81538
|
+
newTypes.push("node");
|
|
81539
|
+
}
|
|
81540
|
+
if (newTypes.sort() === currentTypes.sort()) {
|
|
81541
|
+
return;
|
|
81542
|
+
}
|
|
81400
81543
|
const useSpaces = !tsconfig.match(/\t/g);
|
|
81401
81544
|
const edits = modify(
|
|
81402
81545
|
tsconfig,
|
|
@@ -81409,15 +81552,19 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81409
81552
|
const updated = applyEdits(tsconfig, edits);
|
|
81410
81553
|
writeFile2(tsconfigPath, updated);
|
|
81411
81554
|
} catch (error2) {
|
|
81412
|
-
warn(
|
|
81413
|
-
"Failed to update `tsconfig.json` with latest `@cloudflare/workers-types` entrypoint."
|
|
81414
|
-
);
|
|
81555
|
+
warn("Failed to update `tsconfig.json`.");
|
|
81415
81556
|
}
|
|
81416
|
-
|
|
81557
|
+
}
|
|
81558
|
+
async function installWorkersTypes(npm25) {
|
|
81559
|
+
await installPackages(["@cloudflare/workers-types"], {
|
|
81560
|
+
dev: true,
|
|
81561
|
+
startText: "Installing @cloudflare/workers-types",
|
|
81562
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81563
|
+
});
|
|
81417
81564
|
}
|
|
81418
81565
|
|
|
81419
81566
|
// src/cli.ts
|
|
81420
|
-
var { npm:
|
|
81567
|
+
var { npm: npm24 } = detectPackageManager();
|
|
81421
81568
|
var main = async (argv) => {
|
|
81422
81569
|
const result = await parseArgs(argv);
|
|
81423
81570
|
if (result.type === "unknown") {
|
|
@@ -81453,16 +81600,16 @@ ${result.errorMessage}`);
|
|
|
81453
81600
|
};
|
|
81454
81601
|
var runLatest = async () => {
|
|
81455
81602
|
const args = process.argv.slice(2);
|
|
81456
|
-
if (
|
|
81603
|
+
if (npm24 === "npm") {
|
|
81457
81604
|
args.unshift("--");
|
|
81458
81605
|
}
|
|
81459
|
-
await runCommand([
|
|
81606
|
+
await runCommand([npm24, "create", "cloudflare@latest", ...args]);
|
|
81460
81607
|
};
|
|
81461
81608
|
var runCli = async (args) => {
|
|
81462
81609
|
printBanner(args);
|
|
81463
81610
|
const ctx = await createContext(args);
|
|
81464
81611
|
await create(ctx);
|
|
81465
|
-
await
|
|
81612
|
+
await configure20(ctx);
|
|
81466
81613
|
await deploy(ctx);
|
|
81467
81614
|
printSummary(ctx);
|
|
81468
81615
|
logRaw("");
|
|
@@ -81490,10 +81637,9 @@ var create = async (ctx) => {
|
|
|
81490
81637
|
await rectifyPmMismatch(ctx);
|
|
81491
81638
|
endSection(`Application created`);
|
|
81492
81639
|
};
|
|
81493
|
-
var
|
|
81640
|
+
var configure20 = async (ctx) => {
|
|
81494
81641
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
81495
81642
|
await installWrangler();
|
|
81496
|
-
await installWorkersTypes(ctx);
|
|
81497
81643
|
await updateWranglerConfig(ctx);
|
|
81498
81644
|
const { template } = ctx;
|
|
81499
81645
|
if (template.configure) {
|
|
@@ -81501,6 +81647,7 @@ var configure21 = async (ctx) => {
|
|
|
81501
81647
|
}
|
|
81502
81648
|
addWranglerToGitIgnore(ctx);
|
|
81503
81649
|
await updatePackageScripts(ctx);
|
|
81650
|
+
await addTypes(ctx);
|
|
81504
81651
|
await offerGit(ctx);
|
|
81505
81652
|
await gitCommit(ctx);
|
|
81506
81653
|
endSection(`Application configured`);
|
|
@@ -81551,26 +81698,8 @@ repeat-string/index.js:
|
|
|
81551
81698
|
*)
|
|
81552
81699
|
|
|
81553
81700
|
yargs-parser/build/lib/string-utils.js:
|
|
81554
|
-
(**
|
|
81555
|
-
* @license
|
|
81556
|
-
* Copyright (c) 2016, Contributors
|
|
81557
|
-
* SPDX-License-Identifier: ISC
|
|
81558
|
-
*)
|
|
81559
|
-
|
|
81560
81701
|
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
81561
|
-
(**
|
|
81562
|
-
* @license
|
|
81563
|
-
* Copyright (c) 2016, Contributors
|
|
81564
|
-
* SPDX-License-Identifier: ISC
|
|
81565
|
-
*)
|
|
81566
|
-
|
|
81567
81702
|
yargs-parser/build/lib/yargs-parser-types.js:
|
|
81568
|
-
(**
|
|
81569
|
-
* @license
|
|
81570
|
-
* Copyright (c) 2016, Contributors
|
|
81571
|
-
* SPDX-License-Identifier: ISC
|
|
81572
|
-
*)
|
|
81573
|
-
|
|
81574
81703
|
yargs-parser/build/lib/yargs-parser.js:
|
|
81575
81704
|
(**
|
|
81576
81705
|
* @license
|