create-cloudflare 0.0.0-db0172707 → 0.0.0-db2cdc6b1
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 +1343 -1193
- 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/hello-world-workflows/c3.ts +20 -0
- package/templates/hello-world-workflows/js/package.json +13 -0
- package/templates/hello-world-workflows/js/src/index.js +129 -0
- package/templates/hello-world-workflows/js/wrangler.jsonc +17 -0
- package/templates/hello-world-workflows/ts/package.json +15 -0
- package/templates/hello-world-workflows/ts/src/index.ts +111 -0
- package/templates/hello-world-workflows/ts/tsconfig.json +40 -0
- package/templates/hello-world-workflows/ts/wrangler.jsonc +17 -0
- 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/next/workers/templates/public/_headers +3 -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-db2cdc6b1";
|
|
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":
|
|
@@ -74853,7 +74853,7 @@ var detectPmMismatch = (ctx) => {
|
|
|
74853
74853
|
|
|
74854
74854
|
// src/helpers/sparrow.ts
|
|
74855
74855
|
var import_undici = __toESM(require_undici());
|
|
74856
|
-
var SPARROW_SOURCE_KEY = "
|
|
74856
|
+
var SPARROW_SOURCE_KEY = "";
|
|
74857
74857
|
var SPARROW_URL = "https://sparrow.cloudflare.com";
|
|
74858
74858
|
function hasSparrowSourceKey() {
|
|
74859
74859
|
return SPARROW_SOURCE_KEY !== "";
|
|
@@ -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.
|
|
75338
|
+
"create-astro": "4.12.1",
|
|
75339
75339
|
"create-analog": "1.8.1",
|
|
75340
|
-
"@angular/create": "19.
|
|
75341
|
-
"create-docusaurus": "3.
|
|
75342
|
-
"create-hono": "0.
|
|
75343
|
-
"create-next-app": "15.
|
|
75344
|
-
"create-qwik": "1.
|
|
75345
|
-
"create-vite": "6.
|
|
75346
|
-
"create-remix": "2.
|
|
75347
|
-
"create-
|
|
75348
|
-
"create-
|
|
75349
|
-
|
|
75350
|
-
|
|
75351
|
-
|
|
75340
|
+
"@angular/create": "19.2.12",
|
|
75341
|
+
"create-docusaurus": "3.8.0",
|
|
75342
|
+
"create-hono": "0.19.1",
|
|
75343
|
+
"create-next-app": "15.3.3",
|
|
75344
|
+
"create-qwik": "1.14.1",
|
|
75345
|
+
"create-vite": "6.5.0",
|
|
75346
|
+
"create-remix": "2.16.6",
|
|
75347
|
+
"create-react-router": "7.6.1",
|
|
75348
|
+
"create-solid": "0.6.5",
|
|
75349
|
+
"create-vue": "3.16.4",
|
|
75350
|
+
gatsby: "5.14.3",
|
|
75351
|
+
sv: "0.8.7",
|
|
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
75572
|
devScript: "dev",
|
|
75957
75573
|
deployScript: "deploy",
|
|
75958
75574
|
previewScript: "preview"
|
|
75959
75575
|
};
|
|
75960
|
-
var
|
|
75961
|
-
|
|
75962
|
-
// templates-experimental/svelte/c3.ts
|
|
75963
|
-
var import_node_os3 = require("node:os");
|
|
75964
|
-
var recast5 = __toESM(require_main3());
|
|
75965
|
-
var { npm: npm4 } = detectPackageManager();
|
|
75966
|
-
var generate7 = async (ctx) => {
|
|
75967
|
-
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
75968
|
-
logRaw("");
|
|
75969
|
-
};
|
|
75970
|
-
var configure6 = async (ctx) => {
|
|
75971
|
-
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
75972
|
-
await installPackages([pkg], {
|
|
75973
|
-
dev: true,
|
|
75974
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
75975
|
-
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
75976
|
-
});
|
|
75977
|
-
updateSvelteConfig();
|
|
75978
|
-
updateTypeDefinitions(ctx);
|
|
75979
|
-
};
|
|
75980
|
-
var updateSvelteConfig = () => {
|
|
75981
|
-
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
75982
|
-
transformFile("svelte.config.js", {
|
|
75983
|
-
visitImportDeclaration: function(n) {
|
|
75984
|
-
const importSource = n.value.source;
|
|
75985
|
-
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
75986
|
-
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
75987
|
-
}
|
|
75988
|
-
return false;
|
|
75989
|
-
}
|
|
75990
|
-
});
|
|
75991
|
-
};
|
|
75992
|
-
var updateTypeDefinitions = (ctx) => {
|
|
75993
|
-
if (!usesTypescript(ctx)) {
|
|
75994
|
-
return;
|
|
75995
|
-
}
|
|
75996
|
-
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
75997
|
-
const b3 = recast5.types.builders;
|
|
75998
|
-
transformFile("src/app.d.ts", {
|
|
75999
|
-
visitTSModuleDeclaration(n) {
|
|
76000
|
-
if (n.value.id.name === "App" && n.node.body) {
|
|
76001
|
-
const moduleBlock = n.node.body;
|
|
76002
|
-
const platformInterface = b3.tsInterfaceDeclaration(
|
|
76003
|
-
b3.identifier("Platform"),
|
|
76004
|
-
b3.tsInterfaceBody([
|
|
76005
|
-
b3.tsPropertySignature(
|
|
76006
|
-
b3.identifier("env"),
|
|
76007
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
76008
|
-
),
|
|
76009
|
-
b3.tsPropertySignature(
|
|
76010
|
-
b3.identifier("cf"),
|
|
76011
|
-
b3.tsTypeAnnotation(
|
|
76012
|
-
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
76013
|
-
)
|
|
76014
|
-
),
|
|
76015
|
-
b3.tsPropertySignature(
|
|
76016
|
-
b3.identifier("ctx"),
|
|
76017
|
-
b3.tsTypeAnnotation(
|
|
76018
|
-
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
76019
|
-
)
|
|
76020
|
-
)
|
|
76021
|
-
])
|
|
76022
|
-
);
|
|
76023
|
-
moduleBlock.body.unshift(platformInterface);
|
|
76024
|
-
}
|
|
76025
|
-
this.traverse(n);
|
|
76026
|
-
}
|
|
76027
|
-
});
|
|
76028
|
-
};
|
|
76029
|
-
var config8 = {
|
|
76030
|
-
configVersion: 1,
|
|
76031
|
-
id: "svelte",
|
|
76032
|
-
frameworkCli: "sv",
|
|
76033
|
-
displayName: "SvelteKit",
|
|
76034
|
-
platform: "workers",
|
|
76035
|
-
copyFiles: {
|
|
76036
|
-
path: "./templates"
|
|
76037
|
-
},
|
|
76038
|
-
path: "templates-experimental/svelte",
|
|
76039
|
-
generate: generate7,
|
|
76040
|
-
configure: configure6,
|
|
76041
|
-
transformPackageJson: async (original, ctx) => {
|
|
76042
|
-
let scripts = {
|
|
76043
|
-
preview: `${npm4} run build && wrangler dev`,
|
|
76044
|
-
deploy: `${npm4} run build && wrangler deploy`
|
|
76045
|
-
};
|
|
76046
|
-
if (usesTypescript(ctx)) {
|
|
76047
|
-
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
76048
|
-
scripts = {
|
|
76049
|
-
...scripts,
|
|
76050
|
-
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`
|
|
76051
|
-
};
|
|
76052
|
-
}
|
|
76053
|
-
return { scripts };
|
|
76054
|
-
},
|
|
76055
|
-
devScript: "dev",
|
|
76056
|
-
deployScript: "deploy",
|
|
76057
|
-
previewScript: "preview"
|
|
76058
|
-
};
|
|
76059
|
-
var c3_default10 = config8;
|
|
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,118 @@ 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",
|
|
76233
|
+
platform: "workers",
|
|
76234
|
+
copyFiles: {
|
|
76235
|
+
variants: {
|
|
76236
|
+
js: {
|
|
76237
|
+
path: "./js"
|
|
76238
|
+
},
|
|
76239
|
+
ts: {
|
|
76240
|
+
path: "./ts"
|
|
76241
|
+
},
|
|
76242
|
+
python: {
|
|
76243
|
+
path: "./py"
|
|
76244
|
+
}
|
|
76245
|
+
}
|
|
76246
|
+
}
|
|
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;
|
|
76273
|
+
|
|
76274
|
+
// templates/hello-world-workflows/c3.ts
|
|
76275
|
+
var c3_default20 = {
|
|
76276
|
+
configVersion: 1,
|
|
76277
|
+
id: "hello-world-workflows",
|
|
76278
|
+
displayName: "Workflow",
|
|
76279
|
+
description: "For multi-step applications that automatically retry, persist state, and run for minutes, hours, days or weeks",
|
|
76598
76280
|
platform: "workers",
|
|
76599
76281
|
copyFiles: {
|
|
76600
76282
|
variants: {
|
|
@@ -76611,11 +76293,11 @@ var c3_default23 = {
|
|
|
76611
76293
|
// templates/hello-world/c3.ts
|
|
76612
76294
|
var import_promises2 = require("node:fs/promises");
|
|
76613
76295
|
var import_node_path5 = require("node:path");
|
|
76614
|
-
var
|
|
76296
|
+
var c3_default21 = {
|
|
76615
76297
|
configVersion: 1,
|
|
76616
76298
|
id: "hello-world",
|
|
76617
|
-
displayName: "
|
|
76618
|
-
description: "
|
|
76299
|
+
displayName: "Worker only",
|
|
76300
|
+
description: "For processing requests, transforming responses, or API endpoints",
|
|
76619
76301
|
platform: "workers",
|
|
76620
76302
|
async configure(ctx) {
|
|
76621
76303
|
if (ctx.args.lang === "python") {
|
|
@@ -76644,35 +76326,60 @@ var c3_default24 = {
|
|
|
76644
76326
|
}
|
|
76645
76327
|
};
|
|
76646
76328
|
|
|
76647
|
-
// templates/hono/c3.ts
|
|
76648
|
-
var
|
|
76329
|
+
// templates/hono/pages/c3.ts
|
|
76330
|
+
var generate11 = async (ctx) => {
|
|
76649
76331
|
const { name: pm4 } = detectPackageManager();
|
|
76650
76332
|
await runFrameworkGenerator(ctx, [
|
|
76651
76333
|
ctx.project.name,
|
|
76652
76334
|
"--template",
|
|
76653
|
-
"cloudflare-
|
|
76335
|
+
"cloudflare-pages",
|
|
76654
76336
|
"--install",
|
|
76655
76337
|
"--pm",
|
|
76656
76338
|
pm4
|
|
76657
76339
|
]);
|
|
76658
76340
|
logRaw("");
|
|
76659
76341
|
};
|
|
76660
|
-
var
|
|
76661
|
-
|
|
76662
|
-
|
|
76663
|
-
|
|
76664
|
-
|
|
76665
|
-
|
|
76666
|
-
|
|
76667
|
-
|
|
76668
|
-
|
|
76669
|
-
|
|
76670
|
-
|
|
76342
|
+
var envInterfaceName = "CloudflareBindings";
|
|
76343
|
+
var config20 = {
|
|
76344
|
+
configVersion: 1,
|
|
76345
|
+
id: "hono",
|
|
76346
|
+
frameworkCli: "create-hono",
|
|
76347
|
+
displayName: "Hono",
|
|
76348
|
+
copyFiles: {
|
|
76349
|
+
path: "./templates"
|
|
76350
|
+
},
|
|
76351
|
+
path: "templates/hono/pages",
|
|
76352
|
+
platform: "pages",
|
|
76353
|
+
hidden: true,
|
|
76354
|
+
generate: generate11,
|
|
76355
|
+
transformPackageJson: async () => ({
|
|
76356
|
+
scripts: {
|
|
76357
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName}`,
|
|
76358
|
+
preview: "vite build && wrangler pages dev"
|
|
76671
76359
|
}
|
|
76672
|
-
})
|
|
76673
|
-
|
|
76360
|
+
}),
|
|
76361
|
+
devScript: "dev",
|
|
76362
|
+
deployScript: "deploy",
|
|
76363
|
+
previewScript: "preview",
|
|
76364
|
+
envInterfaceName
|
|
76674
76365
|
};
|
|
76675
|
-
var
|
|
76366
|
+
var c3_default22 = config20;
|
|
76367
|
+
|
|
76368
|
+
// templates/hono/workers/c3.ts
|
|
76369
|
+
var generate12 = async (ctx) => {
|
|
76370
|
+
const { name: pm4 } = detectPackageManager();
|
|
76371
|
+
await runFrameworkGenerator(ctx, [
|
|
76372
|
+
ctx.project.name,
|
|
76373
|
+
"--template",
|
|
76374
|
+
"cloudflare-workers",
|
|
76375
|
+
"--install",
|
|
76376
|
+
"--pm",
|
|
76377
|
+
pm4
|
|
76378
|
+
]);
|
|
76379
|
+
logRaw("");
|
|
76380
|
+
};
|
|
76381
|
+
var envInterfaceName2 = "CloudflareBindings";
|
|
76382
|
+
var config21 = {
|
|
76676
76383
|
configVersion: 1,
|
|
76677
76384
|
id: "hono",
|
|
76678
76385
|
frameworkCli: "create-hono",
|
|
@@ -76681,32 +76388,38 @@ var config20 = {
|
|
|
76681
76388
|
path: "./templates"
|
|
76682
76389
|
},
|
|
76683
76390
|
platform: "workers",
|
|
76684
|
-
|
|
76685
|
-
|
|
76391
|
+
path: "templates/hono/workers",
|
|
76392
|
+
generate: generate12,
|
|
76686
76393
|
transformPackageJson: async () => ({
|
|
76687
76394
|
scripts: {
|
|
76688
|
-
|
|
76689
|
-
deploy: "wrangler deploy --minify",
|
|
76690
|
-
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
|
76395
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName2}`
|
|
76691
76396
|
}
|
|
76692
76397
|
}),
|
|
76693
76398
|
devScript: "dev",
|
|
76694
76399
|
deployScript: "deploy",
|
|
76695
|
-
previewScript: "dev"
|
|
76400
|
+
previewScript: "dev",
|
|
76401
|
+
envInterfaceName: envInterfaceName2
|
|
76696
76402
|
};
|
|
76697
|
-
var
|
|
76403
|
+
var c3_default23 = config21;
|
|
76698
76404
|
|
|
76699
|
-
// templates/
|
|
76405
|
+
// templates/hono/c3.ts
|
|
76406
|
+
var config22 = {
|
|
76407
|
+
displayName: "Hono",
|
|
76408
|
+
platformVariants: { pages: c3_default22, workers: c3_default23 }
|
|
76409
|
+
};
|
|
76410
|
+
var c3_default24 = config22;
|
|
76411
|
+
|
|
76412
|
+
// templates/next/pages/c3.ts
|
|
76700
76413
|
var import_path10 = require("path");
|
|
76701
|
-
var { npm:
|
|
76702
|
-
var
|
|
76414
|
+
var { npm: npm9, npx: npx3 } = detectPackageManager();
|
|
76415
|
+
var generate13 = async (ctx) => {
|
|
76703
76416
|
const projectName = ctx.project.name;
|
|
76704
76417
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76705
76418
|
const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
76706
76419
|
writeFile2((0, import_path10.join)(ctx.project.path, "wrangler.jsonc"), wranglerConfig);
|
|
76707
76420
|
updateStatus("Created wrangler.jsonc file");
|
|
76708
76421
|
};
|
|
76709
|
-
var
|
|
76422
|
+
var updateNextConfig = (usesTs) => {
|
|
76710
76423
|
const s = spinner();
|
|
76711
76424
|
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
76712
76425
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76724,7 +76437,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
76724
76437
|
writeFile2(configFile, updatedConfigFile);
|
|
76725
76438
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76726
76439
|
};
|
|
76727
|
-
var
|
|
76440
|
+
var configure7 = async (ctx) => {
|
|
76728
76441
|
const projectPath = ctx.project.path;
|
|
76729
76442
|
const path6 = probePaths([
|
|
76730
76443
|
`${projectPath}/pages/api`,
|
|
@@ -76738,18 +76451,11 @@ var configure12 = async (ctx) => {
|
|
|
76738
76451
|
throw new Error("Could not find the `/api` or `/app` directory");
|
|
76739
76452
|
}
|
|
76740
76453
|
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
76454
|
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
76749
76455
|
if (installEslintPlugin) {
|
|
76750
76456
|
await writeEslintrc(ctx);
|
|
76751
76457
|
}
|
|
76752
|
-
|
|
76458
|
+
updateNextConfig(usesTs);
|
|
76753
76459
|
copyFile(
|
|
76754
76460
|
(0, import_path10.join)(getTemplatePath(ctx), "README.md"),
|
|
76755
76461
|
(0, import_path10.join)(projectPath, "README.md")
|
|
@@ -76789,7 +76495,6 @@ var writeEslintrc = async (ctx) => {
|
|
|
76789
76495
|
var addDevDependencies = async (installEslintPlugin) => {
|
|
76790
76496
|
const packages = [
|
|
76791
76497
|
"@cloudflare/next-on-pages@1",
|
|
76792
|
-
"@cloudflare/workers-types",
|
|
76793
76498
|
"vercel",
|
|
76794
76499
|
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
76795
76500
|
];
|
|
@@ -76799,14 +76504,18 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76799
76504
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76800
76505
|
});
|
|
76801
76506
|
};
|
|
76802
|
-
var
|
|
76507
|
+
var envInterfaceName3 = "CloudflareEnv";
|
|
76508
|
+
var typesPath = "./env.d.ts";
|
|
76509
|
+
var c3_default25 = {
|
|
76803
76510
|
configVersion: 1,
|
|
76804
76511
|
id: "next",
|
|
76805
76512
|
frameworkCli: "create-next-app",
|
|
76806
76513
|
platform: "pages",
|
|
76514
|
+
hidden: true,
|
|
76807
76515
|
displayName: "Next.js",
|
|
76808
|
-
|
|
76809
|
-
|
|
76516
|
+
path: "templates/next/pages",
|
|
76517
|
+
generate: generate13,
|
|
76518
|
+
configure: configure7,
|
|
76810
76519
|
copyFiles: {
|
|
76811
76520
|
async selectVariant(ctx) {
|
|
76812
76521
|
const isApp = probePaths([
|
|
@@ -76837,12 +76546,12 @@ var c3_default26 = {
|
|
|
76837
76546
|
}
|
|
76838
76547
|
},
|
|
76839
76548
|
transformPackageJson: async (_3, ctx) => {
|
|
76840
|
-
const isNpm =
|
|
76841
|
-
const isBun =
|
|
76549
|
+
const isNpm = npm9 === "npm";
|
|
76550
|
+
const isBun = npm9 === "bun";
|
|
76842
76551
|
const isNpmOrBun = isNpm || isBun;
|
|
76843
76552
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76844
76553
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76845
|
-
const pmCommand = isNpmOrBun ?
|
|
76554
|
+
const pmCommand = isNpmOrBun ? npx3 : npm9;
|
|
76846
76555
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76847
76556
|
return {
|
|
76848
76557
|
scripts: {
|
|
@@ -76850,7 +76559,7 @@ var c3_default26 = {
|
|
|
76850
76559
|
preview: `${pagesBuildRunCommand} && wrangler pages dev`,
|
|
76851
76560
|
deploy: `${pagesBuildRunCommand} && wrangler pages deploy`,
|
|
76852
76561
|
...usesTypescript(ctx) && {
|
|
76853
|
-
"cf-typegen": `wrangler types --env-interface
|
|
76562
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
76854
76563
|
}
|
|
76855
76564
|
}
|
|
76856
76565
|
};
|
|
@@ -76858,25 +76567,88 @@ var c3_default26 = {
|
|
|
76858
76567
|
devScript: "dev",
|
|
76859
76568
|
previewScript: "preview",
|
|
76860
76569
|
deployScript: "deploy",
|
|
76861
|
-
compatibilityFlags: ["nodejs_compat"]
|
|
76570
|
+
compatibilityFlags: ["nodejs_compat"],
|
|
76571
|
+
typesPath,
|
|
76572
|
+
envInterfaceName: envInterfaceName3
|
|
76862
76573
|
};
|
|
76863
76574
|
|
|
76575
|
+
// templates/next/workers/c3.ts
|
|
76576
|
+
var generate14 = async (ctx) => {
|
|
76577
|
+
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76578
|
+
};
|
|
76579
|
+
var configure8 = async (ctx) => {
|
|
76580
|
+
await installPackages(["@opennextjs/cloudflare@^1.0.2"], {
|
|
76581
|
+
startText: "Adding the Cloudflare adapter",
|
|
76582
|
+
doneText: `${brandColor(`installed`)} @opennextjs/cloudflare)}`
|
|
76583
|
+
});
|
|
76584
|
+
const usesTs = usesTypescript(ctx);
|
|
76585
|
+
updateNextConfig2(usesTs);
|
|
76586
|
+
};
|
|
76587
|
+
var updateNextConfig2 = (usesTs) => {
|
|
76588
|
+
const s = spinner();
|
|
76589
|
+
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
76590
|
+
s.start(`Updating \`${configFile}\``);
|
|
76591
|
+
const configContent = readFile(configFile);
|
|
76592
|
+
const updatedConfigFile = configContent + `
|
|
76593
|
+
// added by create cloudflare to enable calling \`getCloudflareContext()\` in \`next dev\`
|
|
76594
|
+
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
|
|
76595
|
+
initOpenNextCloudflareForDev();
|
|
76596
|
+
`.replace(/\n\t*/g, "\n");
|
|
76597
|
+
writeFile2(configFile, updatedConfigFile);
|
|
76598
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76599
|
+
};
|
|
76600
|
+
var envInterfaceName4 = "CloudflareEnv";
|
|
76601
|
+
var typesPath2 = "./cloudflare-env.d.ts";
|
|
76602
|
+
var c3_default26 = {
|
|
76603
|
+
configVersion: 1,
|
|
76604
|
+
id: "next",
|
|
76605
|
+
frameworkCli: "create-next-app",
|
|
76606
|
+
platform: "workers",
|
|
76607
|
+
displayName: "Next.js",
|
|
76608
|
+
path: "templates/next/workers",
|
|
76609
|
+
copyFiles: {
|
|
76610
|
+
path: "./templates"
|
|
76611
|
+
},
|
|
76612
|
+
generate: generate14,
|
|
76613
|
+
configure: configure8,
|
|
76614
|
+
transformPackageJson: async () => ({
|
|
76615
|
+
scripts: {
|
|
76616
|
+
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
76617
|
+
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
76618
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName4} ${typesPath2}`
|
|
76619
|
+
}
|
|
76620
|
+
}),
|
|
76621
|
+
devScript: "dev",
|
|
76622
|
+
previewScript: "preview",
|
|
76623
|
+
deployScript: "deploy",
|
|
76624
|
+
typesPath: typesPath2,
|
|
76625
|
+
envInterfaceName: envInterfaceName4
|
|
76626
|
+
};
|
|
76627
|
+
|
|
76628
|
+
// templates/next/c3.ts
|
|
76629
|
+
var config23 = {
|
|
76630
|
+
displayName: "Next.js",
|
|
76631
|
+
platformVariants: { pages: c3_default25, workers: c3_default26 }
|
|
76632
|
+
};
|
|
76633
|
+
var c3_default27 = config23;
|
|
76634
|
+
|
|
76864
76635
|
// templates/nuxt/pages/c3.ts
|
|
76865
|
-
var
|
|
76866
|
-
var { npm:
|
|
76867
|
-
var
|
|
76636
|
+
var recast6 = __toESM(require_main3());
|
|
76637
|
+
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
76638
|
+
var generate15 = async (ctx) => {
|
|
76868
76639
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76869
76640
|
await runFrameworkGenerator(ctx, [
|
|
76870
76641
|
"init",
|
|
76871
76642
|
ctx.project.name,
|
|
76872
76643
|
"--packageManager",
|
|
76873
|
-
|
|
76644
|
+
npm10,
|
|
76645
|
+
"--no-install",
|
|
76874
76646
|
gitFlag
|
|
76875
76647
|
]);
|
|
76876
76648
|
writeFile2("./.node-version", "18");
|
|
76877
76649
|
logRaw("");
|
|
76878
76650
|
};
|
|
76879
|
-
var
|
|
76651
|
+
var configure9 = async () => {
|
|
76880
76652
|
const packages = ["nitro-cloudflare-dev"];
|
|
76881
76653
|
if (pm2 === "pnpm") {
|
|
76882
76654
|
packages.push("h3");
|
|
@@ -76884,30 +76656,15 @@ var configure13 = async (ctx) => {
|
|
|
76884
76656
|
await installPackages(packages, {
|
|
76885
76657
|
dev: true,
|
|
76886
76658
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76887
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76659
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
76888
76660
|
});
|
|
76889
76661
|
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
76662
|
};
|
|
76906
76663
|
var updateNuxtConfig = () => {
|
|
76907
76664
|
const s = spinner();
|
|
76908
76665
|
const configFile = "nuxt.config.ts";
|
|
76909
76666
|
s.start(`Updating \`${configFile}\``);
|
|
76910
|
-
const b3 =
|
|
76667
|
+
const b3 = recast6.types.builders;
|
|
76911
76668
|
const presetDef = b3.objectProperty(
|
|
76912
76669
|
b3.identifier("nitro"),
|
|
76913
76670
|
b3.objectExpression([
|
|
@@ -76945,22 +76702,23 @@ var updateNuxtConfig = () => {
|
|
|
76945
76702
|
});
|
|
76946
76703
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76947
76704
|
};
|
|
76948
|
-
var
|
|
76705
|
+
var config24 = {
|
|
76949
76706
|
configVersion: 1,
|
|
76950
76707
|
id: "nuxt",
|
|
76951
76708
|
frameworkCli: "nuxi",
|
|
76952
76709
|
platform: "pages",
|
|
76710
|
+
hidden: true,
|
|
76953
76711
|
displayName: "Nuxt",
|
|
76954
76712
|
copyFiles: {
|
|
76955
76713
|
path: "./templates"
|
|
76956
76714
|
},
|
|
76957
76715
|
path: "templates/nuxt/pages",
|
|
76958
|
-
generate:
|
|
76959
|
-
configure:
|
|
76716
|
+
generate: generate15,
|
|
76717
|
+
configure: configure9,
|
|
76960
76718
|
transformPackageJson: async () => ({
|
|
76961
76719
|
scripts: {
|
|
76962
|
-
deploy: `${
|
|
76963
|
-
preview: `${
|
|
76720
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
76721
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
76964
76722
|
"cf-typegen": `wrangler types`
|
|
76965
76723
|
}
|
|
76966
76724
|
}),
|
|
@@ -76968,24 +76726,25 @@ var config21 = {
|
|
|
76968
76726
|
deployScript: "deploy",
|
|
76969
76727
|
previewScript: "preview"
|
|
76970
76728
|
};
|
|
76971
|
-
var
|
|
76729
|
+
var c3_default28 = config24;
|
|
76972
76730
|
|
|
76973
76731
|
// templates/nuxt/workers/c3.ts
|
|
76974
|
-
var
|
|
76975
|
-
var { npm:
|
|
76976
|
-
var
|
|
76732
|
+
var recast7 = __toESM(require_main3());
|
|
76733
|
+
var { npm: npm11, name: pm3 } = detectPackageManager();
|
|
76734
|
+
var generate16 = async (ctx) => {
|
|
76977
76735
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76978
76736
|
await runFrameworkGenerator(ctx, [
|
|
76979
76737
|
"init",
|
|
76980
76738
|
ctx.project.name,
|
|
76981
76739
|
"--packageManager",
|
|
76982
|
-
|
|
76740
|
+
npm11,
|
|
76741
|
+
"--no-install",
|
|
76983
76742
|
gitFlag
|
|
76984
76743
|
]);
|
|
76985
76744
|
writeFile2("./.node-version", "18");
|
|
76986
76745
|
logRaw("");
|
|
76987
76746
|
};
|
|
76988
|
-
var
|
|
76747
|
+
var configure10 = async () => {
|
|
76989
76748
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
76990
76749
|
if (pm3 === "pnpm") {
|
|
76991
76750
|
packages.push("h3");
|
|
@@ -76993,30 +76752,15 @@ var configure14 = async (ctx) => {
|
|
|
76993
76752
|
await installPackages(packages, {
|
|
76994
76753
|
dev: true,
|
|
76995
76754
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76996
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76755
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
76997
76756
|
});
|
|
76998
76757
|
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
76758
|
};
|
|
77015
76759
|
var updateNuxtConfig2 = () => {
|
|
77016
76760
|
const s = spinner();
|
|
77017
76761
|
const configFile = "nuxt.config.ts";
|
|
77018
76762
|
s.start(`Updating \`${configFile}\``);
|
|
77019
|
-
const b3 =
|
|
76763
|
+
const b3 = recast7.types.builders;
|
|
77020
76764
|
const presetDef = b3.objectProperty(
|
|
77021
76765
|
b3.identifier("nitro"),
|
|
77022
76766
|
b3.objectExpression([
|
|
@@ -77054,7 +76798,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77054
76798
|
});
|
|
77055
76799
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
77056
76800
|
};
|
|
77057
|
-
var
|
|
76801
|
+
var config25 = {
|
|
77058
76802
|
configVersion: 1,
|
|
77059
76803
|
id: "nuxt",
|
|
77060
76804
|
frameworkCli: "nuxi",
|
|
@@ -77064,12 +76808,12 @@ var config22 = {
|
|
|
77064
76808
|
path: "./templates"
|
|
77065
76809
|
},
|
|
77066
76810
|
path: "templates/nuxt/workers",
|
|
77067
|
-
generate:
|
|
77068
|
-
configure:
|
|
76811
|
+
generate: generate16,
|
|
76812
|
+
configure: configure10,
|
|
77069
76813
|
transformPackageJson: async () => ({
|
|
77070
76814
|
scripts: {
|
|
77071
|
-
deploy: `${
|
|
77072
|
-
preview: `${
|
|
76815
|
+
deploy: `${npm11} run build && wrangler deploy`,
|
|
76816
|
+
preview: `${npm11} run build && wrangler dev`,
|
|
77073
76817
|
"cf-typegen": `wrangler types`
|
|
77074
76818
|
}
|
|
77075
76819
|
}),
|
|
@@ -77077,17 +76821,17 @@ var config22 = {
|
|
|
77077
76821
|
deployScript: "deploy",
|
|
77078
76822
|
previewScript: "preview"
|
|
77079
76823
|
};
|
|
77080
|
-
var
|
|
76824
|
+
var c3_default29 = config25;
|
|
77081
76825
|
|
|
77082
76826
|
// templates/nuxt/c3.ts
|
|
77083
|
-
var
|
|
76827
|
+
var config26 = {
|
|
77084
76828
|
displayName: "Nuxt",
|
|
77085
|
-
platformVariants: { pages:
|
|
76829
|
+
platformVariants: { pages: c3_default28, workers: c3_default29 }
|
|
77086
76830
|
};
|
|
77087
|
-
var
|
|
76831
|
+
var c3_default30 = config26;
|
|
77088
76832
|
|
|
77089
76833
|
// templates/openapi/c3.ts
|
|
77090
|
-
var
|
|
76834
|
+
var config27 = {
|
|
77091
76835
|
configVersion: 1,
|
|
77092
76836
|
id: "openapi",
|
|
77093
76837
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -77097,6 +76841,7 @@ var c3_default30 = {
|
|
|
77097
76841
|
path: "./ts"
|
|
77098
76842
|
}
|
|
77099
76843
|
};
|
|
76844
|
+
var c3_default31 = config27;
|
|
77100
76845
|
|
|
77101
76846
|
// templates/pre-existing/c3.ts
|
|
77102
76847
|
var import_promises3 = require("fs/promises");
|
|
@@ -77218,7 +76963,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77218
76963
|
await runCommand(
|
|
77219
76964
|
[
|
|
77220
76965
|
...dlx,
|
|
77221
|
-
"wrangler@
|
|
76966
|
+
"wrangler@latest",
|
|
77222
76967
|
"init",
|
|
77223
76968
|
"--from-dash",
|
|
77224
76969
|
ctx.args.existingScript,
|
|
@@ -77246,10 +76991,11 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77246
76991
|
(0, import_path11.join)(ctx.project.path, "wrangler.toml")
|
|
77247
76992
|
);
|
|
77248
76993
|
}
|
|
77249
|
-
var
|
|
76994
|
+
var config28 = {
|
|
77250
76995
|
configVersion: 1,
|
|
77251
76996
|
id: "pre-existing",
|
|
77252
76997
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
76998
|
+
description: "Fetch a Worker initialized from the Cloudflare dashboard.",
|
|
77253
76999
|
platform: "workers",
|
|
77254
77000
|
hidden: true,
|
|
77255
77001
|
copyFiles: {
|
|
@@ -77261,8 +77007,9 @@ var c3_default31 = {
|
|
|
77261
77007
|
copyFiles: copyExistingWorkerFiles
|
|
77262
77008
|
})
|
|
77263
77009
|
};
|
|
77010
|
+
var c3_default32 = config28;
|
|
77264
77011
|
function buildConfigure(params) {
|
|
77265
|
-
return async function
|
|
77012
|
+
return async function configure21(ctx) {
|
|
77266
77013
|
const loginSuccess = await params.login(ctx);
|
|
77267
77014
|
if (!loginSuccess) {
|
|
77268
77015
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -77274,7 +77021,7 @@ function buildConfigure(params) {
|
|
|
77274
77021
|
}
|
|
77275
77022
|
|
|
77276
77023
|
// templates/queues/c3.ts
|
|
77277
|
-
var
|
|
77024
|
+
var config29 = {
|
|
77278
77025
|
configVersion: 1,
|
|
77279
77026
|
id: "queues",
|
|
77280
77027
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -77301,17 +77048,129 @@ var c3_default32 = {
|
|
|
77301
77048
|
]
|
|
77302
77049
|
}
|
|
77303
77050
|
};
|
|
77051
|
+
var c3_default33 = config29;
|
|
77304
77052
|
|
|
77305
|
-
// templates/qwik/c3.ts
|
|
77306
|
-
var
|
|
77307
|
-
var { npm:
|
|
77308
|
-
var
|
|
77053
|
+
// templates/qwik/pages/c3.ts
|
|
77054
|
+
var recast8 = __toESM(require_main3());
|
|
77055
|
+
var { npm: npm12, npx: npx4, name } = detectPackageManager();
|
|
77056
|
+
var generate17 = async (ctx) => {
|
|
77057
|
+
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77058
|
+
};
|
|
77059
|
+
var configure11 = async (ctx) => {
|
|
77060
|
+
const cmd = [name === "pnpm" ? npm12 : npx4, "qwik", "add", "cloudflare-pages"];
|
|
77061
|
+
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77062
|
+
await runCommand(cmd);
|
|
77063
|
+
addBindingsProxy(ctx);
|
|
77064
|
+
populateCloudflareEnv();
|
|
77065
|
+
};
|
|
77066
|
+
var addBindingsProxy = (ctx) => {
|
|
77067
|
+
if (!usesTypescript(ctx)) {
|
|
77068
|
+
return;
|
|
77069
|
+
}
|
|
77070
|
+
const s = spinner();
|
|
77071
|
+
s.start("Updating `vite.config.ts`");
|
|
77072
|
+
const snippets = loadTemplateSnippets(ctx);
|
|
77073
|
+
const b3 = recast8.types.builders;
|
|
77074
|
+
transformFile("vite.config.ts", {
|
|
77075
|
+
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77076
|
+
visitProgram: function(n) {
|
|
77077
|
+
const lastImportIndex = n.node.body.findLastIndex(
|
|
77078
|
+
(t2) => t2.type === "ImportDeclaration"
|
|
77079
|
+
);
|
|
77080
|
+
const lastImport = n.get("body", lastImportIndex);
|
|
77081
|
+
lastImport.insertAfter(...snippets.getPlatformProxyTs);
|
|
77082
|
+
return this.traverse(n);
|
|
77083
|
+
},
|
|
77084
|
+
// Pass the `platform` object from the declaration to the `qwikCity` plugin
|
|
77085
|
+
visitCallExpression: function(n) {
|
|
77086
|
+
const callee = n.node.callee;
|
|
77087
|
+
if (callee.name !== "qwikCity") {
|
|
77088
|
+
return this.traverse(n);
|
|
77089
|
+
}
|
|
77090
|
+
const configArgument = n.node.arguments[0];
|
|
77091
|
+
const platformPropery = b3.objectProperty.from({
|
|
77092
|
+
key: b3.identifier("platform"),
|
|
77093
|
+
value: b3.identifier("platform"),
|
|
77094
|
+
shorthand: true
|
|
77095
|
+
});
|
|
77096
|
+
if (!configArgument) {
|
|
77097
|
+
n.node.arguments = [b3.objectExpression([platformPropery])];
|
|
77098
|
+
return false;
|
|
77099
|
+
}
|
|
77100
|
+
if (configArgument.type !== "ObjectExpression") {
|
|
77101
|
+
throw new Error("Failed to update `vite.config.ts`");
|
|
77102
|
+
}
|
|
77103
|
+
configArgument.properties.push(platformPropery);
|
|
77104
|
+
return false;
|
|
77105
|
+
}
|
|
77106
|
+
});
|
|
77107
|
+
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
77108
|
+
};
|
|
77109
|
+
var populateCloudflareEnv = () => {
|
|
77110
|
+
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
77111
|
+
const s = spinner();
|
|
77112
|
+
s.start(`Updating \`${entrypointPath}\``);
|
|
77113
|
+
transformFile(entrypointPath, {
|
|
77114
|
+
visitTSInterfaceDeclaration: function(n) {
|
|
77115
|
+
const b3 = recast8.types.builders;
|
|
77116
|
+
const id = n.node.id;
|
|
77117
|
+
if (id.name !== "QwikCityPlatform") {
|
|
77118
|
+
this.traverse(n);
|
|
77119
|
+
}
|
|
77120
|
+
const newBody = [
|
|
77121
|
+
["env", "Env"]
|
|
77122
|
+
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
77123
|
+
// ["cf", "CfProperties"],
|
|
77124
|
+
].map(
|
|
77125
|
+
([varName, type]) => b3.tsPropertySignature(
|
|
77126
|
+
b3.identifier(varName),
|
|
77127
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
|
|
77128
|
+
)
|
|
77129
|
+
);
|
|
77130
|
+
n.node.body.body = newBody;
|
|
77131
|
+
return false;
|
|
77132
|
+
}
|
|
77133
|
+
});
|
|
77134
|
+
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77135
|
+
};
|
|
77136
|
+
var config30 = {
|
|
77137
|
+
configVersion: 1,
|
|
77138
|
+
id: "qwik",
|
|
77139
|
+
frameworkCli: "create-qwik",
|
|
77140
|
+
displayName: "Qwik",
|
|
77141
|
+
platform: "pages",
|
|
77142
|
+
hidden: true,
|
|
77143
|
+
copyFiles: {
|
|
77144
|
+
path: "./templates"
|
|
77145
|
+
},
|
|
77146
|
+
path: "templates/qwik/pages",
|
|
77147
|
+
generate: generate17,
|
|
77148
|
+
configure: configure11,
|
|
77149
|
+
transformPackageJson: async () => ({
|
|
77150
|
+
scripts: {
|
|
77151
|
+
deploy: `${npm12} run build && wrangler pages deploy`,
|
|
77152
|
+
preview: `${npm12} run build && wrangler pages dev`,
|
|
77153
|
+
"cf-typegen": `wrangler types`
|
|
77154
|
+
}
|
|
77155
|
+
}),
|
|
77156
|
+
devScript: "dev",
|
|
77157
|
+
deployScript: "deploy",
|
|
77158
|
+
previewScript: "preview",
|
|
77159
|
+
workersTypes: "installed"
|
|
77160
|
+
};
|
|
77161
|
+
var c3_default34 = config30;
|
|
77162
|
+
|
|
77163
|
+
// templates/qwik/workers/c3.ts
|
|
77164
|
+
var recast9 = __toESM(require_main3());
|
|
77165
|
+
var { npm: npm13, npx: npx5, name: name2 } = detectPackageManager();
|
|
77166
|
+
var generate18 = async (ctx) => {
|
|
77309
77167
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77310
77168
|
};
|
|
77311
|
-
var
|
|
77312
|
-
const cmd = [name2 === "pnpm" ?
|
|
77169
|
+
var configure12 = async (ctx) => {
|
|
77170
|
+
const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77313
77171
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77314
77172
|
await runCommand(cmd);
|
|
77173
|
+
removeFile("./public/_routes.json");
|
|
77315
77174
|
addBindingsProxy2(ctx);
|
|
77316
77175
|
populateCloudflareEnv2();
|
|
77317
77176
|
};
|
|
@@ -77322,7 +77181,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77322
77181
|
const s = spinner();
|
|
77323
77182
|
s.start("Updating `vite.config.ts`");
|
|
77324
77183
|
const snippets = loadTemplateSnippets(ctx);
|
|
77325
|
-
const b3 =
|
|
77184
|
+
const b3 = recast9.types.builders;
|
|
77326
77185
|
transformFile("vite.config.ts", {
|
|
77327
77186
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77328
77187
|
visitProgram: function(n) {
|
|
@@ -77364,7 +77223,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77364
77223
|
s.start(`Updating \`${entrypointPath}\``);
|
|
77365
77224
|
transformFile(entrypointPath, {
|
|
77366
77225
|
visitTSInterfaceDeclaration: function(n) {
|
|
77367
|
-
const b3 =
|
|
77226
|
+
const b3 = recast9.types.builders;
|
|
77368
77227
|
const id = n.node.id;
|
|
77369
77228
|
if (id.name !== "QwikCityPlatform") {
|
|
77370
77229
|
this.traverse(n);
|
|
@@ -77385,21 +77244,64 @@ var populateCloudflareEnv2 = () => {
|
|
|
77385
77244
|
});
|
|
77386
77245
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77387
77246
|
};
|
|
77388
|
-
var
|
|
77247
|
+
var config31 = {
|
|
77389
77248
|
configVersion: 1,
|
|
77390
77249
|
id: "qwik",
|
|
77391
77250
|
frameworkCli: "create-qwik",
|
|
77392
77251
|
displayName: "Qwik",
|
|
77393
|
-
platform: "
|
|
77252
|
+
platform: "workers",
|
|
77394
77253
|
copyFiles: {
|
|
77395
77254
|
path: "./templates"
|
|
77396
77255
|
},
|
|
77397
|
-
|
|
77398
|
-
|
|
77256
|
+
path: "templates/qwik/workers",
|
|
77257
|
+
generate: generate18,
|
|
77258
|
+
configure: configure12,
|
|
77399
77259
|
transformPackageJson: async () => ({
|
|
77400
77260
|
scripts: {
|
|
77401
|
-
deploy: `${
|
|
77402
|
-
preview: `${
|
|
77261
|
+
deploy: `${npm13} run build && wrangler deploy`,
|
|
77262
|
+
preview: `${npm13} run build && wrangler dev`,
|
|
77263
|
+
"cf-typegen": `wrangler types`
|
|
77264
|
+
}
|
|
77265
|
+
}),
|
|
77266
|
+
devScript: "dev",
|
|
77267
|
+
deployScript: "deploy",
|
|
77268
|
+
previewScript: "preview",
|
|
77269
|
+
workersTypes: "installed"
|
|
77270
|
+
};
|
|
77271
|
+
var c3_default35 = config31;
|
|
77272
|
+
|
|
77273
|
+
// templates/qwik/c3.ts
|
|
77274
|
+
var config32 = {
|
|
77275
|
+
displayName: "Qwik",
|
|
77276
|
+
platformVariants: { pages: c3_default34, workers: c3_default35 }
|
|
77277
|
+
};
|
|
77278
|
+
var c3_default36 = config32;
|
|
77279
|
+
|
|
77280
|
+
// templates/react-router/c3.ts
|
|
77281
|
+
var { npm: npm14 } = detectPackageManager();
|
|
77282
|
+
var generate19 = async (ctx) => {
|
|
77283
|
+
await runFrameworkGenerator(ctx, [
|
|
77284
|
+
ctx.project.name,
|
|
77285
|
+
"--template",
|
|
77286
|
+
"https://github.com/remix-run/react-router-templates/tree/main/cloudflare",
|
|
77287
|
+
// to prevent asking about git twice, just let c3 do it
|
|
77288
|
+
"--no-git-init",
|
|
77289
|
+
"--no-install"
|
|
77290
|
+
]);
|
|
77291
|
+
logRaw("");
|
|
77292
|
+
};
|
|
77293
|
+
var config33 = {
|
|
77294
|
+
configVersion: 1,
|
|
77295
|
+
id: "react-router",
|
|
77296
|
+
platform: "workers",
|
|
77297
|
+
frameworkCli: "create-react-router",
|
|
77298
|
+
displayName: "React Router (formerly Remix)",
|
|
77299
|
+
generate: generate19,
|
|
77300
|
+
// configure,
|
|
77301
|
+
transformPackageJson: async () => ({
|
|
77302
|
+
scripts: {
|
|
77303
|
+
deploy: `${npm14} run build && wrangler deploy`,
|
|
77304
|
+
preview: `${npm14} run build && vite preview`,
|
|
77403
77305
|
"cf-typegen": `wrangler types`
|
|
77404
77306
|
}
|
|
77405
77307
|
}),
|
|
@@ -77407,11 +77309,11 @@ var config24 = {
|
|
|
77407
77309
|
deployScript: "deploy",
|
|
77408
77310
|
previewScript: "preview"
|
|
77409
77311
|
};
|
|
77410
|
-
var
|
|
77312
|
+
var c3_default37 = config33;
|
|
77411
77313
|
|
|
77412
77314
|
// templates/react/pages/c3.ts
|
|
77413
|
-
var { npm:
|
|
77414
|
-
var
|
|
77315
|
+
var { npm: npm15 } = detectPackageManager();
|
|
77316
|
+
var generate20 = async (ctx) => {
|
|
77415
77317
|
const variant = await inputPrompt({
|
|
77416
77318
|
type: "select",
|
|
77417
77319
|
question: "Select a variant:",
|
|
@@ -77440,34 +77342,37 @@ var variantsOptions = [
|
|
|
77440
77342
|
label: "JavaScript + SWC"
|
|
77441
77343
|
}
|
|
77442
77344
|
];
|
|
77443
|
-
var
|
|
77345
|
+
var config34 = {
|
|
77444
77346
|
configVersion: 1,
|
|
77445
77347
|
id: "react",
|
|
77446
77348
|
// React's documentation now recommends using create-vite.
|
|
77447
77349
|
frameworkCli: "create-vite",
|
|
77448
77350
|
displayName: "React",
|
|
77449
77351
|
platform: "pages",
|
|
77352
|
+
hidden: true,
|
|
77450
77353
|
path: "templates/react/pages",
|
|
77451
|
-
|
|
77354
|
+
copyFiles: { path: "./templates" },
|
|
77355
|
+
generate: generate20,
|
|
77452
77356
|
transformPackageJson: async () => ({
|
|
77453
77357
|
scripts: {
|
|
77454
|
-
deploy: `${
|
|
77455
|
-
preview: `${
|
|
77358
|
+
deploy: `${npm15} run build && wrangler pages deploy`,
|
|
77359
|
+
preview: `${npm15} run build && wrangler pages dev`,
|
|
77360
|
+
"cf-typegen": `wrangler types`
|
|
77456
77361
|
}
|
|
77457
77362
|
}),
|
|
77458
77363
|
devScript: "dev",
|
|
77459
77364
|
deployScript: "deploy",
|
|
77460
77365
|
previewScript: "preview"
|
|
77461
77366
|
};
|
|
77462
|
-
var
|
|
77367
|
+
var c3_default38 = config34;
|
|
77463
77368
|
|
|
77464
77369
|
// templates/react/workers/c3.ts
|
|
77465
77370
|
var import_assert2 = __toESM(require("assert"));
|
|
77466
|
-
var
|
|
77467
|
-
var b2 =
|
|
77468
|
-
var t =
|
|
77469
|
-
var { npm:
|
|
77470
|
-
var
|
|
77371
|
+
var recast10 = __toESM(require_main3());
|
|
77372
|
+
var b2 = recast10.types.builders;
|
|
77373
|
+
var t = recast10.types.namedTypes;
|
|
77374
|
+
var { npm: npm16 } = detectPackageManager();
|
|
77375
|
+
var generate21 = async (ctx) => {
|
|
77471
77376
|
const variant = await getVariant();
|
|
77472
77377
|
ctx.args.lang = variant.lang;
|
|
77473
77378
|
await runFrameworkGenerator(ctx, [
|
|
@@ -77477,13 +77382,13 @@ var generate22 = async (ctx) => {
|
|
|
77477
77382
|
]);
|
|
77478
77383
|
logRaw("");
|
|
77479
77384
|
};
|
|
77480
|
-
var
|
|
77385
|
+
var configure13 = async (ctx) => {
|
|
77481
77386
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77482
77387
|
dev: true,
|
|
77483
77388
|
startText: "Installing the Cloudflare Vite plugin",
|
|
77484
77389
|
doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
|
|
77485
77390
|
});
|
|
77486
|
-
|
|
77391
|
+
transformViteConfig(ctx);
|
|
77487
77392
|
if (usesTypescript(ctx)) {
|
|
77488
77393
|
updateTsconfigJson();
|
|
77489
77394
|
}
|
|
@@ -77508,9 +77413,9 @@ function transformViteConfig(ctx) {
|
|
|
77508
77413
|
if (callee.name !== "defineConfig") {
|
|
77509
77414
|
return this.traverse(n);
|
|
77510
77415
|
}
|
|
77511
|
-
const
|
|
77512
|
-
(0, import_assert2.default)(t.ObjectExpression.check(
|
|
77513
|
-
const pluginsProp =
|
|
77416
|
+
const config48 = n.node.arguments[0];
|
|
77417
|
+
(0, import_assert2.default)(t.ObjectExpression.check(config48));
|
|
77418
|
+
const pluginsProp = config48.properties.find((prop) => isPluginsProp(prop));
|
|
77514
77419
|
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77515
77420
|
pluginsProp.value.elements.push(
|
|
77516
77421
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -77567,7 +77472,7 @@ async function getVariant() {
|
|
|
77567
77472
|
(0, import_assert2.default)(selected, "Expected a variant to be selected");
|
|
77568
77473
|
return selected;
|
|
77569
77474
|
}
|
|
77570
|
-
var
|
|
77475
|
+
var config35 = {
|
|
77571
77476
|
configVersion: 1,
|
|
77572
77477
|
id: "react",
|
|
77573
77478
|
frameworkCli: "create-vite",
|
|
@@ -77584,12 +77489,12 @@ var config26 = {
|
|
|
77584
77489
|
}
|
|
77585
77490
|
}
|
|
77586
77491
|
},
|
|
77587
|
-
generate:
|
|
77588
|
-
configure:
|
|
77492
|
+
generate: generate21,
|
|
77493
|
+
configure: configure13,
|
|
77589
77494
|
transformPackageJson: async (_3, ctx) => ({
|
|
77590
77495
|
scripts: {
|
|
77591
|
-
deploy: `${
|
|
77592
|
-
preview: `${
|
|
77496
|
+
deploy: `${npm16} run build && wrangler deploy`,
|
|
77497
|
+
preview: `${npm16} run build && vite preview`,
|
|
77593
77498
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77594
77499
|
}
|
|
77595
77500
|
}),
|
|
@@ -77597,18 +77502,18 @@ var config26 = {
|
|
|
77597
77502
|
deployScript: "deploy",
|
|
77598
77503
|
previewScript: "preview"
|
|
77599
77504
|
};
|
|
77600
|
-
var
|
|
77505
|
+
var c3_default39 = config35;
|
|
77601
77506
|
|
|
77602
77507
|
// templates/react/c3.ts
|
|
77603
|
-
var
|
|
77508
|
+
var config36 = {
|
|
77604
77509
|
displayName: "React",
|
|
77605
|
-
platformVariants: { pages:
|
|
77510
|
+
platformVariants: { pages: c3_default38, workers: c3_default39 }
|
|
77606
77511
|
};
|
|
77607
|
-
var
|
|
77512
|
+
var c3_default40 = config36;
|
|
77608
77513
|
|
|
77609
|
-
// templates/remix/c3.ts
|
|
77610
|
-
var { npm:
|
|
77611
|
-
var
|
|
77514
|
+
// templates/remix/pages/c3.ts
|
|
77515
|
+
var { npm: npm17 } = detectPackageManager();
|
|
77516
|
+
var generate22 = async (ctx) => {
|
|
77612
77517
|
await runFrameworkGenerator(ctx, [
|
|
77613
77518
|
ctx.project.name,
|
|
77614
77519
|
"--template",
|
|
@@ -77616,7 +77521,7 @@ var generate23 = async (ctx) => {
|
|
|
77616
77521
|
]);
|
|
77617
77522
|
logRaw("");
|
|
77618
77523
|
};
|
|
77619
|
-
var
|
|
77524
|
+
var configure14 = async () => {
|
|
77620
77525
|
const typeDefsPath = "load-context.ts";
|
|
77621
77526
|
const s = spinner();
|
|
77622
77527
|
s.start(`Updating \`${typeDefsPath}\``);
|
|
@@ -77631,32 +77536,86 @@ var configure17 = async () => {
|
|
|
77631
77536
|
});
|
|
77632
77537
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
77633
77538
|
};
|
|
77634
|
-
var
|
|
77539
|
+
var config37 = {
|
|
77635
77540
|
configVersion: 1,
|
|
77636
77541
|
id: "remix",
|
|
77637
77542
|
frameworkCli: "create-remix",
|
|
77638
77543
|
platform: "pages",
|
|
77544
|
+
hidden: true,
|
|
77639
77545
|
displayName: "Remix",
|
|
77640
77546
|
copyFiles: {
|
|
77641
77547
|
path: "./templates"
|
|
77642
77548
|
},
|
|
77549
|
+
path: "templates/remix/pages",
|
|
77550
|
+
generate: generate22,
|
|
77551
|
+
configure: configure14,
|
|
77552
|
+
transformPackageJson: async () => ({
|
|
77553
|
+
scripts: {
|
|
77554
|
+
deploy: `${npm17} run build && wrangler pages deploy`,
|
|
77555
|
+
preview: `${npm17} run build && wrangler pages dev`,
|
|
77556
|
+
"cf-typegen": `wrangler types`
|
|
77557
|
+
}
|
|
77558
|
+
}),
|
|
77559
|
+
devScript: "dev",
|
|
77560
|
+
deployScript: "deploy",
|
|
77561
|
+
previewScript: "preview",
|
|
77562
|
+
workersTypes: "installed"
|
|
77563
|
+
};
|
|
77564
|
+
var c3_default41 = config37;
|
|
77565
|
+
|
|
77566
|
+
// templates/remix/workers/c3.ts
|
|
77567
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77568
|
+
var generate23 = async (ctx) => {
|
|
77569
|
+
await runFrameworkGenerator(ctx, [
|
|
77570
|
+
ctx.project.name,
|
|
77571
|
+
"--template",
|
|
77572
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
77573
|
+
]);
|
|
77574
|
+
logRaw("");
|
|
77575
|
+
};
|
|
77576
|
+
var configure15 = async () => {
|
|
77577
|
+
await installPackages(["wrangler@latest"], {
|
|
77578
|
+
dev: true,
|
|
77579
|
+
startText: "Updating the Wrangler version",
|
|
77580
|
+
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
77581
|
+
});
|
|
77582
|
+
};
|
|
77583
|
+
var config38 = {
|
|
77584
|
+
configVersion: 1,
|
|
77585
|
+
id: "remix",
|
|
77586
|
+
frameworkCli: "create-remix",
|
|
77587
|
+
platform: "workers",
|
|
77588
|
+
displayName: "Remix",
|
|
77589
|
+
copyFiles: {
|
|
77590
|
+
path: "./templates"
|
|
77591
|
+
},
|
|
77592
|
+
path: "templates/remix/workers",
|
|
77643
77593
|
generate: generate23,
|
|
77644
|
-
configure:
|
|
77594
|
+
configure: configure15,
|
|
77645
77595
|
transformPackageJson: async () => ({
|
|
77646
77596
|
scripts: {
|
|
77647
|
-
deploy: `${npm18} run build && wrangler
|
|
77648
|
-
preview: `${npm18} run build && wrangler
|
|
77597
|
+
deploy: `${npm18} run build && wrangler deploy`,
|
|
77598
|
+
preview: `${npm18} run build && wrangler dev`,
|
|
77649
77599
|
"cf-typegen": `wrangler types`
|
|
77650
77600
|
}
|
|
77651
77601
|
}),
|
|
77652
77602
|
devScript: "dev",
|
|
77653
77603
|
deployScript: "deploy",
|
|
77654
|
-
previewScript: "preview"
|
|
77604
|
+
previewScript: "preview",
|
|
77605
|
+
workersTypes: "installed"
|
|
77655
77606
|
};
|
|
77656
|
-
var
|
|
77607
|
+
var c3_default42 = config38;
|
|
77608
|
+
|
|
77609
|
+
// templates/remix/c3.ts
|
|
77610
|
+
var config39 = {
|
|
77611
|
+
displayName: "Remix",
|
|
77612
|
+
platformVariants: { pages: c3_default41, workers: c3_default42 },
|
|
77613
|
+
hidden: true
|
|
77614
|
+
};
|
|
77615
|
+
var c3_default43 = config39;
|
|
77657
77616
|
|
|
77658
77617
|
// templates/scheduled/c3.ts
|
|
77659
|
-
var
|
|
77618
|
+
var config40 = {
|
|
77660
77619
|
configVersion: 1,
|
|
77661
77620
|
id: "scheduled",
|
|
77662
77621
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -77673,15 +77632,16 @@ var c3_default38 = {
|
|
|
77673
77632
|
}
|
|
77674
77633
|
}
|
|
77675
77634
|
};
|
|
77635
|
+
var c3_default44 = config40;
|
|
77676
77636
|
|
|
77677
77637
|
// templates/solid/c3.ts
|
|
77678
|
-
var
|
|
77638
|
+
var recast11 = __toESM(require_main3());
|
|
77679
77639
|
var { npm: npm19 } = detectPackageManager();
|
|
77680
77640
|
var generate24 = async (ctx) => {
|
|
77681
77641
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
77682
77642
|
logRaw("");
|
|
77683
77643
|
};
|
|
77684
|
-
var
|
|
77644
|
+
var configure16 = async (ctx) => {
|
|
77685
77645
|
usesTypescript(ctx);
|
|
77686
77646
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
77687
77647
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
@@ -77691,7 +77651,7 @@ var configure18 = async (ctx) => {
|
|
|
77691
77651
|
if (callee.name !== "defineConfig") {
|
|
77692
77652
|
return this.traverse(n);
|
|
77693
77653
|
}
|
|
77694
|
-
const b3 =
|
|
77654
|
+
const b3 = recast11.types.builders;
|
|
77695
77655
|
mergeObjectProperties(
|
|
77696
77656
|
n.node.arguments[0],
|
|
77697
77657
|
[
|
|
@@ -77719,7 +77679,7 @@ var configure18 = async (ctx) => {
|
|
|
77719
77679
|
}
|
|
77720
77680
|
});
|
|
77721
77681
|
};
|
|
77722
|
-
var
|
|
77682
|
+
var config41 = {
|
|
77723
77683
|
configVersion: 1,
|
|
77724
77684
|
id: "solid",
|
|
77725
77685
|
frameworkCli: "create-solid",
|
|
@@ -77729,11 +77689,12 @@ var config29 = {
|
|
|
77729
77689
|
path: "./templates"
|
|
77730
77690
|
},
|
|
77731
77691
|
generate: generate24,
|
|
77732
|
-
configure:
|
|
77692
|
+
configure: configure16,
|
|
77733
77693
|
transformPackageJson: async () => ({
|
|
77734
77694
|
scripts: {
|
|
77735
77695
|
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
77736
|
-
deploy: `${npm19} run build && wrangler pages deploy
|
|
77696
|
+
deploy: `${npm19} run build && wrangler pages deploy`,
|
|
77697
|
+
"cf-typegen": `wrangler types`
|
|
77737
77698
|
}
|
|
77738
77699
|
}),
|
|
77739
77700
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -77741,29 +77702,28 @@ var config29 = {
|
|
|
77741
77702
|
deployScript: "deploy",
|
|
77742
77703
|
previewScript: "preview"
|
|
77743
77704
|
};
|
|
77744
|
-
var
|
|
77705
|
+
var c3_default45 = config41;
|
|
77745
77706
|
|
|
77746
|
-
// templates/svelte/c3.ts
|
|
77707
|
+
// templates/svelte/pages/c3.ts
|
|
77747
77708
|
var import_node_fs3 = require("node:fs");
|
|
77748
|
-
var
|
|
77749
|
-
var recast13 = __toESM(require_main3());
|
|
77709
|
+
var recast12 = __toESM(require_main3());
|
|
77750
77710
|
var { npm: npm20 } = detectPackageManager();
|
|
77751
77711
|
var generate25 = async (ctx) => {
|
|
77752
77712
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77753
77713
|
logRaw("");
|
|
77754
77714
|
};
|
|
77755
|
-
var
|
|
77715
|
+
var configure17 = async (ctx) => {
|
|
77756
77716
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77757
77717
|
await installPackages([pkg], {
|
|
77758
77718
|
dev: true,
|
|
77759
77719
|
startText: "Adding the Cloudflare Pages adapter",
|
|
77760
77720
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77761
77721
|
});
|
|
77762
|
-
|
|
77722
|
+
updateSvelteConfig();
|
|
77763
77723
|
updatePlaywrightConfig(usesTypescript(ctx));
|
|
77764
|
-
|
|
77724
|
+
updateTypeDefinitions(ctx);
|
|
77765
77725
|
};
|
|
77766
|
-
var
|
|
77726
|
+
var updateSvelteConfig = () => {
|
|
77767
77727
|
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77768
77728
|
transformFile("svelte.config.js", {
|
|
77769
77729
|
visitImportDeclaration: function(n) {
|
|
@@ -77797,12 +77757,12 @@ var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
|
77797
77757
|
}
|
|
77798
77758
|
});
|
|
77799
77759
|
};
|
|
77800
|
-
var
|
|
77760
|
+
var updateTypeDefinitions = (ctx) => {
|
|
77801
77761
|
if (!usesTypescript(ctx)) {
|
|
77802
77762
|
return;
|
|
77803
77763
|
}
|
|
77804
77764
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77805
|
-
const b3 =
|
|
77765
|
+
const b3 = recast12.types.builders;
|
|
77806
77766
|
transformFile("src/app.d.ts", {
|
|
77807
77767
|
visitTSModuleDeclaration(n) {
|
|
77808
77768
|
if (n.value.id.name === "App" && n.node.body) {
|
|
@@ -77834,65 +77794,177 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77834
77794
|
}
|
|
77835
77795
|
});
|
|
77836
77796
|
};
|
|
77837
|
-
var
|
|
77797
|
+
var typesPath3 = "src/worker-configuration.d.ts";
|
|
77798
|
+
var config42 = {
|
|
77838
77799
|
configVersion: 1,
|
|
77839
77800
|
id: "svelte",
|
|
77840
77801
|
frameworkCli: "sv",
|
|
77841
77802
|
displayName: "SvelteKit",
|
|
77842
77803
|
platform: "pages",
|
|
77804
|
+
hidden: true,
|
|
77843
77805
|
copyFiles: {
|
|
77844
77806
|
path: "./templates"
|
|
77845
77807
|
},
|
|
77808
|
+
path: "templates/svelte/pages",
|
|
77846
77809
|
generate: generate25,
|
|
77847
|
-
configure:
|
|
77810
|
+
configure: configure17,
|
|
77848
77811
|
transformPackageJson: async (original, ctx) => {
|
|
77849
77812
|
let scripts = {
|
|
77850
77813
|
preview: `${npm20} run build && wrangler pages dev`,
|
|
77851
77814
|
deploy: `${npm20} run build && wrangler pages deploy`
|
|
77852
77815
|
};
|
|
77853
77816
|
if (usesTypescript(ctx)) {
|
|
77854
|
-
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
77855
77817
|
scripts = {
|
|
77856
77818
|
...scripts,
|
|
77857
|
-
"cf-typegen": `wrangler types
|
|
77819
|
+
"cf-typegen": `wrangler types ${typesPath3}`
|
|
77858
77820
|
};
|
|
77859
77821
|
}
|
|
77860
77822
|
return { scripts };
|
|
77861
77823
|
},
|
|
77862
77824
|
devScript: "dev",
|
|
77863
77825
|
deployScript: "deploy",
|
|
77864
|
-
previewScript: "preview"
|
|
77826
|
+
previewScript: "preview",
|
|
77827
|
+
typesPath: typesPath3
|
|
77865
77828
|
};
|
|
77866
|
-
var
|
|
77829
|
+
var c3_default46 = config42;
|
|
77867
77830
|
|
|
77868
|
-
// templates/
|
|
77831
|
+
// templates/svelte/workers/c3.ts
|
|
77832
|
+
var recast13 = __toESM(require_main3());
|
|
77869
77833
|
var { npm: npm21 } = detectPackageManager();
|
|
77870
77834
|
var generate26 = async (ctx) => {
|
|
77835
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77836
|
+
logRaw("");
|
|
77837
|
+
};
|
|
77838
|
+
var configure18 = async (ctx) => {
|
|
77839
|
+
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
77840
|
+
await installPackages([pkg], {
|
|
77841
|
+
dev: true,
|
|
77842
|
+
startText: "Adding the Cloudflare adapter",
|
|
77843
|
+
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
77844
|
+
});
|
|
77845
|
+
updateSvelteConfig2();
|
|
77846
|
+
updateTypeDefinitions2(ctx);
|
|
77847
|
+
};
|
|
77848
|
+
var updateSvelteConfig2 = () => {
|
|
77849
|
+
updateStatus(`Changing adapter in ${blue("svelte.config.js")}`);
|
|
77850
|
+
transformFile("svelte.config.js", {
|
|
77851
|
+
visitImportDeclaration: function(n) {
|
|
77852
|
+
const importSource = n.value.source;
|
|
77853
|
+
if (importSource.value === "@sveltejs/adapter-auto") {
|
|
77854
|
+
importSource.value = "@sveltejs/adapter-cloudflare";
|
|
77855
|
+
}
|
|
77856
|
+
return false;
|
|
77857
|
+
}
|
|
77858
|
+
});
|
|
77859
|
+
};
|
|
77860
|
+
var updateTypeDefinitions2 = (ctx) => {
|
|
77861
|
+
if (!usesTypescript(ctx)) {
|
|
77862
|
+
return;
|
|
77863
|
+
}
|
|
77864
|
+
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
77865
|
+
const b3 = recast13.types.builders;
|
|
77866
|
+
transformFile("src/app.d.ts", {
|
|
77867
|
+
visitTSModuleDeclaration(n) {
|
|
77868
|
+
if (n.value.id.name === "App" && n.node.body) {
|
|
77869
|
+
const moduleBlock = n.node.body;
|
|
77870
|
+
const platformInterface = b3.tsInterfaceDeclaration(
|
|
77871
|
+
b3.identifier("Platform"),
|
|
77872
|
+
b3.tsInterfaceBody([
|
|
77873
|
+
b3.tsPropertySignature(
|
|
77874
|
+
b3.identifier("env"),
|
|
77875
|
+
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier("Env")))
|
|
77876
|
+
),
|
|
77877
|
+
b3.tsPropertySignature(
|
|
77878
|
+
b3.identifier("cf"),
|
|
77879
|
+
b3.tsTypeAnnotation(
|
|
77880
|
+
b3.tsTypeReference(b3.identifier("CfProperties"))
|
|
77881
|
+
)
|
|
77882
|
+
),
|
|
77883
|
+
b3.tsPropertySignature(
|
|
77884
|
+
b3.identifier("ctx"),
|
|
77885
|
+
b3.tsTypeAnnotation(
|
|
77886
|
+
b3.tsTypeReference(b3.identifier("ExecutionContext"))
|
|
77887
|
+
)
|
|
77888
|
+
)
|
|
77889
|
+
])
|
|
77890
|
+
);
|
|
77891
|
+
moduleBlock.body.unshift(platformInterface);
|
|
77892
|
+
}
|
|
77893
|
+
this.traverse(n);
|
|
77894
|
+
}
|
|
77895
|
+
});
|
|
77896
|
+
};
|
|
77897
|
+
var typesPath4 = "./src/worker-configuration.d.ts";
|
|
77898
|
+
var config43 = {
|
|
77899
|
+
configVersion: 1,
|
|
77900
|
+
id: "svelte",
|
|
77901
|
+
frameworkCli: "sv",
|
|
77902
|
+
displayName: "SvelteKit",
|
|
77903
|
+
platform: "workers",
|
|
77904
|
+
copyFiles: {
|
|
77905
|
+
path: "./templates"
|
|
77906
|
+
},
|
|
77907
|
+
path: "templates/svelte/workers",
|
|
77908
|
+
generate: generate26,
|
|
77909
|
+
configure: configure18,
|
|
77910
|
+
transformPackageJson: async (original, ctx) => {
|
|
77911
|
+
let scripts = {
|
|
77912
|
+
preview: `${npm21} run build && wrangler dev`,
|
|
77913
|
+
deploy: `${npm21} run build && wrangler deploy`
|
|
77914
|
+
};
|
|
77915
|
+
if (usesTypescript(ctx)) {
|
|
77916
|
+
scripts = {
|
|
77917
|
+
...scripts,
|
|
77918
|
+
"cf-typegen": `wrangler types ${typesPath4}`
|
|
77919
|
+
};
|
|
77920
|
+
}
|
|
77921
|
+
return { scripts };
|
|
77922
|
+
},
|
|
77923
|
+
devScript: "dev",
|
|
77924
|
+
deployScript: "deploy",
|
|
77925
|
+
previewScript: "preview",
|
|
77926
|
+
typesPath: typesPath4
|
|
77927
|
+
};
|
|
77928
|
+
var c3_default47 = config43;
|
|
77929
|
+
|
|
77930
|
+
// templates/svelte/c3.ts
|
|
77931
|
+
var config44 = {
|
|
77932
|
+
displayName: "SvelteKit",
|
|
77933
|
+
platformVariants: { pages: c3_default46, workers: c3_default47 }
|
|
77934
|
+
};
|
|
77935
|
+
var c3_default48 = config44;
|
|
77936
|
+
|
|
77937
|
+
// templates/vue/pages/c3.ts
|
|
77938
|
+
var { npm: npm22 } = detectPackageManager();
|
|
77939
|
+
var generate27 = async (ctx) => {
|
|
77871
77940
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77872
77941
|
};
|
|
77873
|
-
var
|
|
77942
|
+
var config45 = {
|
|
77874
77943
|
configVersion: 1,
|
|
77875
77944
|
id: "vue",
|
|
77876
77945
|
frameworkCli: "create-vue",
|
|
77877
77946
|
displayName: "Vue",
|
|
77878
77947
|
platform: "pages",
|
|
77879
|
-
|
|
77880
|
-
|
|
77948
|
+
hidden: true,
|
|
77949
|
+
path: "templates/vue/pages",
|
|
77950
|
+
copyFiles: { path: "./templates" },
|
|
77951
|
+
generate: generate27,
|
|
77881
77952
|
transformPackageJson: async () => ({
|
|
77882
77953
|
scripts: {
|
|
77883
|
-
deploy: `${
|
|
77884
|
-
preview: `${
|
|
77954
|
+
deploy: `${npm22} run build && wrangler pages deploy`,
|
|
77955
|
+
preview: `${npm22} run build && wrangler pages dev`,
|
|
77956
|
+
"cf-typegen": `wrangler types`
|
|
77885
77957
|
}
|
|
77886
77958
|
}),
|
|
77887
77959
|
devScript: "dev",
|
|
77888
77960
|
deployScript: "deploy",
|
|
77889
77961
|
previewScript: "preview"
|
|
77890
77962
|
};
|
|
77891
|
-
var
|
|
77963
|
+
var c3_default49 = config45;
|
|
77892
77964
|
|
|
77893
77965
|
// templates/vue/workers/c3.ts
|
|
77894
|
-
var { npm:
|
|
77895
|
-
var
|
|
77966
|
+
var { npm: npm23 } = detectPackageManager();
|
|
77967
|
+
var generate28 = async (ctx) => {
|
|
77896
77968
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
77897
77969
|
type: "select",
|
|
77898
77970
|
question: "Would you like to use TypeScript?",
|
|
@@ -77909,7 +77981,7 @@ var generate27 = async (ctx) => {
|
|
|
77909
77981
|
]);
|
|
77910
77982
|
logRaw("");
|
|
77911
77983
|
};
|
|
77912
|
-
var
|
|
77984
|
+
var configure19 = async (ctx) => {
|
|
77913
77985
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77914
77986
|
dev: true,
|
|
77915
77987
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -77930,7 +78002,7 @@ function updateTsconfigJson2() {
|
|
|
77930
78002
|
writeJSON("tsconfig.json", tsconfig);
|
|
77931
78003
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77932
78004
|
}
|
|
77933
|
-
var
|
|
78005
|
+
var config46 = {
|
|
77934
78006
|
configVersion: 1,
|
|
77935
78007
|
id: "vue",
|
|
77936
78008
|
frameworkCli: "create-vue",
|
|
@@ -77950,12 +78022,12 @@ var config32 = {
|
|
|
77950
78022
|
}
|
|
77951
78023
|
}
|
|
77952
78024
|
},
|
|
77953
|
-
configure:
|
|
77954
|
-
generate:
|
|
78025
|
+
configure: configure19,
|
|
78026
|
+
generate: generate28,
|
|
77955
78027
|
transformPackageJson: async (_3, ctx) => ({
|
|
77956
78028
|
scripts: {
|
|
77957
|
-
deploy: `${
|
|
77958
|
-
preview: `${
|
|
78029
|
+
deploy: `${npm23} run build && wrangler deploy`,
|
|
78030
|
+
preview: `${npm23} run build && wrangler dev`,
|
|
77959
78031
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77960
78032
|
}
|
|
77961
78033
|
}),
|
|
@@ -77963,20 +78035,20 @@ var config32 = {
|
|
|
77963
78035
|
deployScript: "deploy",
|
|
77964
78036
|
previewScript: "preview"
|
|
77965
78037
|
};
|
|
77966
|
-
var
|
|
78038
|
+
var c3_default50 = config46;
|
|
77967
78039
|
|
|
77968
78040
|
// templates/vue/c3.ts
|
|
77969
|
-
var
|
|
78041
|
+
var config47 = {
|
|
77970
78042
|
displayName: "Vue",
|
|
77971
|
-
platformVariants: { pages:
|
|
78043
|
+
platformVariants: { pages: c3_default49, workers: c3_default50 }
|
|
77972
78044
|
};
|
|
77973
|
-
var
|
|
78045
|
+
var c3_default51 = config47;
|
|
77974
78046
|
|
|
77975
78047
|
// src/git.ts
|
|
77976
78048
|
var import_node_assert = __toESM(require("node:assert"));
|
|
77977
78049
|
|
|
77978
78050
|
// ../wrangler/package.json
|
|
77979
|
-
var version2 = "0.0.0-
|
|
78051
|
+
var version2 = "0.0.0-db2cdc6b1";
|
|
77980
78052
|
|
|
77981
78053
|
// src/git.ts
|
|
77982
78054
|
var offerGit = async (ctx) => {
|
|
@@ -78237,49 +78309,61 @@ var defaultSelectVariant = async (ctx) => {
|
|
|
78237
78309
|
function getFrameworkMap({ experimental = false }) {
|
|
78238
78310
|
if (experimental) {
|
|
78239
78311
|
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
|
|
78312
|
+
solid: c3_default
|
|
78247
78313
|
};
|
|
78248
78314
|
} else {
|
|
78249
78315
|
return {
|
|
78250
|
-
analog:
|
|
78251
|
-
angular:
|
|
78252
|
-
astro:
|
|
78253
|
-
docusaurus:
|
|
78254
|
-
gatsby:
|
|
78255
|
-
hono:
|
|
78256
|
-
next:
|
|
78257
|
-
nuxt:
|
|
78258
|
-
qwik:
|
|
78259
|
-
react:
|
|
78260
|
-
|
|
78261
|
-
|
|
78262
|
-
|
|
78263
|
-
|
|
78316
|
+
analog: c3_default2,
|
|
78317
|
+
angular: c3_default5,
|
|
78318
|
+
astro: c3_default8,
|
|
78319
|
+
docusaurus: c3_default12,
|
|
78320
|
+
gatsby: c3_default15,
|
|
78321
|
+
hono: c3_default24,
|
|
78322
|
+
next: c3_default27,
|
|
78323
|
+
nuxt: c3_default30,
|
|
78324
|
+
qwik: c3_default36,
|
|
78325
|
+
react: c3_default40,
|
|
78326
|
+
"react-router": c3_default37,
|
|
78327
|
+
remix: c3_default43,
|
|
78328
|
+
solid: c3_default45,
|
|
78329
|
+
svelte: c3_default48,
|
|
78330
|
+
vue: c3_default51
|
|
78264
78331
|
};
|
|
78265
78332
|
}
|
|
78266
78333
|
}
|
|
78267
|
-
function
|
|
78334
|
+
function getOtherTemplateMap({
|
|
78335
|
+
experimental = false
|
|
78336
|
+
}) {
|
|
78268
78337
|
if (experimental) {
|
|
78338
|
+
return {};
|
|
78339
|
+
} else {
|
|
78269
78340
|
return {
|
|
78270
|
-
|
|
78271
|
-
|
|
78272
|
-
|
|
78341
|
+
common: c3_default9,
|
|
78342
|
+
scheduled: c3_default44,
|
|
78343
|
+
queues: c3_default33,
|
|
78344
|
+
openapi: c3_default31,
|
|
78345
|
+
"pre-existing": c3_default32
|
|
78273
78346
|
};
|
|
78347
|
+
}
|
|
78348
|
+
}
|
|
78349
|
+
function getHelloWorldTemplateMap({
|
|
78350
|
+
experimental = false
|
|
78351
|
+
}) {
|
|
78352
|
+
if (experimental) {
|
|
78353
|
+
return {};
|
|
78274
78354
|
} else {
|
|
78275
78355
|
return {
|
|
78276
|
-
"hello-world":
|
|
78277
|
-
|
|
78278
|
-
|
|
78279
|
-
|
|
78280
|
-
"hello-world-durable-object":
|
|
78281
|
-
|
|
78282
|
-
|
|
78356
|
+
"hello-world": c3_default21,
|
|
78357
|
+
"hello-world-assets-only": c3_default16,
|
|
78358
|
+
"hello-world-with-assets": c3_default19,
|
|
78359
|
+
"hello-world-durable-object": c3_default18,
|
|
78360
|
+
"hello-world-durable-object-with-assets": c3_default17,
|
|
78361
|
+
"hello-world-workflows": c3_default20,
|
|
78362
|
+
common: c3_default9,
|
|
78363
|
+
scheduled: c3_default44,
|
|
78364
|
+
queues: c3_default33,
|
|
78365
|
+
openapi: c3_default31,
|
|
78366
|
+
"pre-existing": c3_default32
|
|
78283
78367
|
};
|
|
78284
78368
|
}
|
|
78285
78369
|
}
|
|
@@ -78299,6 +78383,7 @@ var deriveCorrelatedArgs = (args) => {
|
|
|
78299
78383
|
switch (args.type) {
|
|
78300
78384
|
case "hello-world":
|
|
78301
78385
|
case "hello-world-durable-object":
|
|
78386
|
+
case "hello-world-workflows":
|
|
78302
78387
|
args.category ??= "hello-world";
|
|
78303
78388
|
break;
|
|
78304
78389
|
case "hello-world-python":
|
|
@@ -78339,6 +78424,12 @@ var deriveCorrelatedArgs = (args) => {
|
|
|
78339
78424
|
};
|
|
78340
78425
|
var createContext = async (args, prevArgs) => {
|
|
78341
78426
|
deriveCorrelatedArgs(args);
|
|
78427
|
+
const experimental = args.experimental;
|
|
78428
|
+
const frameworkMap = getFrameworkMap({ experimental });
|
|
78429
|
+
const helloWorldTemplateMap = getHelloWorldTemplateMap({
|
|
78430
|
+
experimental
|
|
78431
|
+
});
|
|
78432
|
+
const otherTemplateMap = getOtherTemplateMap({ experimental });
|
|
78342
78433
|
let linesPrinted = 0;
|
|
78343
78434
|
const goBack = async (from) => {
|
|
78344
78435
|
const currentArgs = { ...args };
|
|
@@ -78385,22 +78476,29 @@ var createContext = async (args, prevArgs) => {
|
|
|
78385
78476
|
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
|
|
78386
78477
|
format: (val) => `./${val}`
|
|
78387
78478
|
});
|
|
78388
|
-
const categoryOptions = [
|
|
78389
|
-
|
|
78479
|
+
const categoryOptions = [];
|
|
78480
|
+
if (Object.keys(helloWorldTemplateMap).length) {
|
|
78481
|
+
categoryOptions.push({
|
|
78390
78482
|
label: "Hello World example",
|
|
78391
78483
|
value: "hello-world",
|
|
78392
78484
|
description: "Select from barebones examples to get started with Workers"
|
|
78393
|
-
}
|
|
78394
|
-
|
|
78485
|
+
});
|
|
78486
|
+
}
|
|
78487
|
+
if (Object.keys(frameworkMap).length) {
|
|
78488
|
+
categoryOptions.push({
|
|
78395
78489
|
label: "Framework Starter",
|
|
78396
78490
|
value: "web-framework",
|
|
78397
78491
|
description: "Select from the most popular full-stack web frameworks"
|
|
78398
|
-
}
|
|
78399
|
-
|
|
78492
|
+
});
|
|
78493
|
+
}
|
|
78494
|
+
if (Object.keys(otherTemplateMap).length) {
|
|
78495
|
+
categoryOptions.push({
|
|
78400
78496
|
label: "Application Starter",
|
|
78401
78497
|
value: "demo",
|
|
78402
78498
|
description: "Select from a range of starter applications using various Cloudflare products"
|
|
78403
|
-
}
|
|
78499
|
+
});
|
|
78500
|
+
}
|
|
78501
|
+
categoryOptions.push(
|
|
78404
78502
|
{
|
|
78405
78503
|
label: "Template from a GitHub repo",
|
|
78406
78504
|
value: "remote-template",
|
|
@@ -78409,7 +78507,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
78409
78507
|
// This is used only if the type is `pre-existing`
|
|
78410
78508
|
{ label: "Others", value: "others", hidden: true },
|
|
78411
78509
|
backOption
|
|
78412
|
-
|
|
78510
|
+
);
|
|
78413
78511
|
const category = await processArgument(args, "category", {
|
|
78414
78512
|
type: "select",
|
|
78415
78513
|
question: "What would you like to start with?",
|
|
@@ -78423,14 +78521,17 @@ var createContext = async (args, prevArgs) => {
|
|
|
78423
78521
|
}
|
|
78424
78522
|
let template;
|
|
78425
78523
|
if (category === "web-framework") {
|
|
78426
|
-
const
|
|
78427
|
-
|
|
78428
|
-
|
|
78429
|
-
|
|
78430
|
-
|
|
78431
|
-
|
|
78432
|
-
|
|
78433
|
-
|
|
78524
|
+
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
78525
|
+
(acc, [key, config48]) => {
|
|
78526
|
+
if (!config48.hidden || args.framework) {
|
|
78527
|
+
acc.push({
|
|
78528
|
+
label: config48.displayName,
|
|
78529
|
+
value: key
|
|
78530
|
+
});
|
|
78531
|
+
}
|
|
78532
|
+
return acc;
|
|
78533
|
+
},
|
|
78534
|
+
[]
|
|
78434
78535
|
);
|
|
78435
78536
|
const framework = await processArgument(args, "framework", {
|
|
78436
78537
|
type: "select",
|
|
@@ -78448,30 +78549,40 @@ var createContext = async (args, prevArgs) => {
|
|
|
78448
78549
|
throw new Error(`Unsupported framework: ${framework}`);
|
|
78449
78550
|
}
|
|
78450
78551
|
if ("platformVariants" in frameworkConfig) {
|
|
78451
|
-
const
|
|
78552
|
+
const availableVariants = Object.entries(
|
|
78553
|
+
frameworkConfig.platformVariants
|
|
78554
|
+
).filter(([, config48]) => !config48.hidden);
|
|
78555
|
+
if (availableVariants.length === 1) {
|
|
78556
|
+
args.platform ??= availableVariants[0][0];
|
|
78557
|
+
}
|
|
78558
|
+
const platform = await processArgument(args, "platform", {
|
|
78452
78559
|
type: "select",
|
|
78453
78560
|
label: "platform",
|
|
78454
78561
|
question: "Select your deployment platform",
|
|
78455
78562
|
options: [
|
|
78456
|
-
|
|
78457
|
-
|
|
78458
|
-
|
|
78459
|
-
|
|
78460
|
-
|
|
78461
|
-
|
|
78462
|
-
|
|
78463
|
-
|
|
78464
|
-
|
|
78465
|
-
|
|
78563
|
+
...args.platform === "workers" || !frameworkConfig.platformVariants.workers.hidden ? [
|
|
78564
|
+
{
|
|
78565
|
+
label: "Workers with Assets",
|
|
78566
|
+
value: "workers",
|
|
78567
|
+
description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
|
|
78568
|
+
}
|
|
78569
|
+
] : [],
|
|
78570
|
+
...args.platform === "pages" || !frameworkConfig.platformVariants.pages.hidden ? [
|
|
78571
|
+
{
|
|
78572
|
+
label: "Pages",
|
|
78573
|
+
value: "pages",
|
|
78574
|
+
description: "Great for simple websites and applications."
|
|
78575
|
+
}
|
|
78576
|
+
] : [],
|
|
78466
78577
|
backOption
|
|
78467
78578
|
],
|
|
78468
78579
|
defaultValue: "workers"
|
|
78469
78580
|
});
|
|
78470
78581
|
linesPrinted += 3;
|
|
78471
|
-
if (
|
|
78582
|
+
if (platform === BACK_VALUE) {
|
|
78472
78583
|
return goBack("platform");
|
|
78473
78584
|
}
|
|
78474
|
-
frameworkConfig = frameworkConfig.platformVariants[
|
|
78585
|
+
frameworkConfig = frameworkConfig.platformVariants[platform];
|
|
78475
78586
|
}
|
|
78476
78587
|
template = {
|
|
78477
78588
|
deployScript: "pages:deploy",
|
|
@@ -78481,18 +78592,14 @@ var createContext = async (args, prevArgs) => {
|
|
|
78481
78592
|
} else if (category === "remote-template") {
|
|
78482
78593
|
template = await processRemoteTemplate(args);
|
|
78483
78594
|
} else {
|
|
78484
|
-
const templateMap =
|
|
78485
|
-
experimental: args.experimental
|
|
78486
|
-
});
|
|
78595
|
+
const templateMap = category === "hello-world" ? helloWorldTemplateMap : otherTemplateMap;
|
|
78487
78596
|
const templateOptions = Object.entries(templateMap).map(
|
|
78488
78597
|
([value, { displayName, description, hidden: hidden2 }]) => {
|
|
78489
|
-
const isHelloWorldExample = value.startsWith("hello-world");
|
|
78490
|
-
const isCategoryMatched = category === "hello-world" ? isHelloWorldExample : !isHelloWorldExample;
|
|
78491
78598
|
return {
|
|
78492
78599
|
value,
|
|
78493
78600
|
label: displayName,
|
|
78494
78601
|
description,
|
|
78495
|
-
hidden: hidden2
|
|
78602
|
+
hidden: hidden2
|
|
78496
78603
|
};
|
|
78497
78604
|
}
|
|
78498
78605
|
);
|
|
@@ -78512,6 +78619,12 @@ var createContext = async (args, prevArgs) => {
|
|
|
78512
78619
|
throw new Error(`Unknown application type provided: ${type}.`);
|
|
78513
78620
|
}
|
|
78514
78621
|
}
|
|
78622
|
+
template = {
|
|
78623
|
+
workersTypes: "generated",
|
|
78624
|
+
typesPath: "./worker-configuration.d.ts",
|
|
78625
|
+
envInterfaceName: "Env",
|
|
78626
|
+
...template
|
|
78627
|
+
};
|
|
78515
78628
|
const path6 = (0, import_path13.resolve)(projectName);
|
|
78516
78629
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
78517
78630
|
if (languageVariants.length > 0) {
|
|
@@ -78571,7 +78684,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
78571
78684
|
}
|
|
78572
78685
|
srcdir = (0, import_path13.join)(getTemplatePath(ctx), variantInfo.path);
|
|
78573
78686
|
}
|
|
78574
|
-
const copyDestDir =
|
|
78687
|
+
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
78575
78688
|
const destdir = (0, import_path13.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
78576
78689
|
const s = spinner();
|
|
78577
78690
|
s.start(`Copying template files`);
|
|
@@ -78594,29 +78707,29 @@ var processRemoteTemplate = async (args) => {
|
|
|
78594
78707
|
if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
|
|
78595
78708
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78596
78709
|
}
|
|
78597
|
-
const path6 = await downloadRemoteTemplate(src);
|
|
78598
|
-
const
|
|
78599
|
-
validateTemplate(path6,
|
|
78710
|
+
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
78711
|
+
const config48 = inferTemplateConfig(path6);
|
|
78712
|
+
validateTemplate(path6, config48);
|
|
78600
78713
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78601
78714
|
return {
|
|
78602
78715
|
path: path6,
|
|
78603
|
-
...
|
|
78716
|
+
...config48
|
|
78604
78717
|
};
|
|
78605
78718
|
};
|
|
78606
|
-
var validateTemplate = (path6,
|
|
78607
|
-
if (!
|
|
78719
|
+
var validateTemplate = (path6, config48) => {
|
|
78720
|
+
if (!config48.copyFiles) {
|
|
78608
78721
|
return;
|
|
78609
78722
|
}
|
|
78610
|
-
if (isVariantInfo(
|
|
78611
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78723
|
+
if (isVariantInfo(config48.copyFiles)) {
|
|
78724
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config48.copyFiles.path), config48);
|
|
78612
78725
|
} else {
|
|
78613
|
-
for (const variant of Object.values(
|
|
78614
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
78726
|
+
for (const variant of Object.values(config48.copyFiles.variants)) {
|
|
78727
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config48);
|
|
78615
78728
|
}
|
|
78616
78729
|
}
|
|
78617
78730
|
};
|
|
78618
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78619
|
-
if (
|
|
78731
|
+
var validateTemplateSrcDirectory = (path6, config48) => {
|
|
78732
|
+
if (config48.platform === "workers") {
|
|
78620
78733
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78621
78734
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78622
78735
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -78653,13 +78766,14 @@ var inferCopyFilesDefinition = (path6) => {
|
|
|
78653
78766
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
78654
78767
|
return copyFiles;
|
|
78655
78768
|
};
|
|
78656
|
-
var downloadRemoteTemplate = async (src) => {
|
|
78769
|
+
var downloadRemoteTemplate = async (src, mode) => {
|
|
78657
78770
|
try {
|
|
78658
78771
|
updateStatus(`Cloning template from: ${blue(src)}`);
|
|
78659
78772
|
const emitter = (0, import_degit.default)(src, {
|
|
78660
78773
|
cache: false,
|
|
78661
78774
|
verbose: false,
|
|
78662
|
-
force: true
|
|
78775
|
+
force: true,
|
|
78776
|
+
mode
|
|
78663
78777
|
});
|
|
78664
78778
|
const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path13.join)((0, import_os2.tmpdir)(), "c3-template"));
|
|
78665
78779
|
await emitter.clone(tmpDir);
|
|
@@ -78789,13 +78903,10 @@ var cliDefinition = {
|
|
|
78789
78903
|
values(args) {
|
|
78790
78904
|
const experimental = Boolean(args?.["experimental"]);
|
|
78791
78905
|
if (experimental) {
|
|
78792
|
-
return [
|
|
78793
|
-
{ name: "hello-world", description: "Hello World example" },
|
|
78794
|
-
{ name: "web-framework", description: "Framework Starter" }
|
|
78795
|
-
];
|
|
78906
|
+
return [{ name: "web-framework", description: "Framework Starter" }];
|
|
78796
78907
|
} else {
|
|
78797
78908
|
return [
|
|
78798
|
-
{ name: "hello-world", description: "Hello World
|
|
78909
|
+
{ name: "hello-world", description: "Hello World Starter" },
|
|
78799
78910
|
{ name: "web-framework", description: "Framework Starter" },
|
|
78800
78911
|
{ name: "demo", description: "Application Starter" },
|
|
78801
78912
|
{
|
|
@@ -78818,40 +78929,10 @@ var cliDefinition = {
|
|
|
78818
78929
|
`,
|
|
78819
78930
|
values(args) {
|
|
78820
78931
|
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
|
-
}
|
|
78932
|
+
return getNamesAndDescriptions({
|
|
78933
|
+
...getHelloWorldTemplateMap({ experimental }),
|
|
78934
|
+
...getOtherTemplateMap({ experimental })
|
|
78935
|
+
});
|
|
78855
78936
|
}
|
|
78856
78937
|
},
|
|
78857
78938
|
{
|
|
@@ -78866,7 +78947,7 @@ var cliDefinition = {
|
|
|
78866
78947
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
78867
78948
|
|
|
78868
78949
|
npm create cloudflare -- --framework next -- --ts
|
|
78869
|
-
pnpm create
|
|
78950
|
+
pnpm create cloudflare --framework next -- --ts
|
|
78870
78951
|
`,
|
|
78871
78952
|
values: (args) => getNamesAndDescriptions(
|
|
78872
78953
|
getFrameworkMap({
|
|
@@ -78880,12 +78961,12 @@ var cliDefinition = {
|
|
|
78880
78961
|
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
78962
|
values: [
|
|
78882
78963
|
{
|
|
78883
|
-
name: "
|
|
78884
|
-
description: "Create a web application that can be deployed to
|
|
78964
|
+
name: "workers",
|
|
78965
|
+
description: "Create a web application that can be deployed to Workers."
|
|
78885
78966
|
},
|
|
78886
78967
|
{
|
|
78887
|
-
name: "
|
|
78888
|
-
description: "Create a web application that can be deployed to
|
|
78968
|
+
name: "pages",
|
|
78969
|
+
description: "Create a web application that can be deployed to Pages."
|
|
78889
78970
|
}
|
|
78890
78971
|
],
|
|
78891
78972
|
requiresArg: true
|
|
@@ -78947,6 +79028,27 @@ var cliDefinition = {
|
|
|
78947
79028
|
npm create cloudflare -- --template https://github.com/cloudflare/workers-sdk/templates/worker-r2
|
|
78948
79029
|
`
|
|
78949
79030
|
},
|
|
79031
|
+
{
|
|
79032
|
+
name: "template-mode",
|
|
79033
|
+
type: "string",
|
|
79034
|
+
requiresArg: true,
|
|
79035
|
+
description: `The mechanism to use when fetching the template.
|
|
79036
|
+
|
|
79037
|
+
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
79038
|
+
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
79039
|
+
Otherwise, it will use "git".
|
|
79040
|
+
`,
|
|
79041
|
+
values: [
|
|
79042
|
+
{
|
|
79043
|
+
name: "git",
|
|
79044
|
+
description: "Use git to fetch the template. Supports private repositories."
|
|
79045
|
+
},
|
|
79046
|
+
{
|
|
79047
|
+
name: "tar",
|
|
79048
|
+
description: "Use tar to fetch the template. Only supported on public repositories hosted on GitHub, BitBucket, GitLab, or git.sr.ht."
|
|
79049
|
+
}
|
|
79050
|
+
]
|
|
79051
|
+
},
|
|
78950
79052
|
{
|
|
78951
79053
|
name: "accept-defaults",
|
|
78952
79054
|
alias: "y",
|
|
@@ -79111,7 +79213,7 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
79111
79213
|
|
|
79112
79214
|
// src/deploy.ts
|
|
79113
79215
|
var import_promises5 = require("node:fs/promises");
|
|
79114
|
-
var
|
|
79216
|
+
var import_node_os3 = require("node:os");
|
|
79115
79217
|
var import_node_path6 = require("node:path");
|
|
79116
79218
|
var import_toml3 = __toESM(require_toml());
|
|
79117
79219
|
|
|
@@ -80527,20 +80629,20 @@ function applyEdits(text, edits) {
|
|
|
80527
80629
|
var import_fs12 = require("fs");
|
|
80528
80630
|
var import_path14 = require("path");
|
|
80529
80631
|
var import_toml2 = __toESM(require_toml());
|
|
80530
|
-
function ensureNameExists(
|
|
80531
|
-
|
|
80532
|
-
return
|
|
80632
|
+
function ensureNameExists(config48, projectName) {
|
|
80633
|
+
config48["name"] = projectName;
|
|
80634
|
+
return config48;
|
|
80533
80635
|
}
|
|
80534
|
-
async function ensureCompatDateExists(
|
|
80535
|
-
if (typeof
|
|
80636
|
+
async function ensureCompatDateExists(config48) {
|
|
80637
|
+
if (typeof config48["compatibility_date"] === "string") {
|
|
80536
80638
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80537
|
-
if (!
|
|
80538
|
-
|
|
80639
|
+
if (!config48["compatibility_date"].match(validCompatDateRe)) {
|
|
80640
|
+
config48["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80539
80641
|
}
|
|
80540
80642
|
} else {
|
|
80541
|
-
|
|
80643
|
+
config48["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80542
80644
|
}
|
|
80543
|
-
return
|
|
80645
|
+
return config48;
|
|
80544
80646
|
}
|
|
80545
80647
|
var updateWranglerConfig = async (ctx) => {
|
|
80546
80648
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -80551,12 +80653,15 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
80551
80653
|
const modified = await ensureCompatDateExists(
|
|
80552
80654
|
ensureNameExists(parsed, ctx.project.name)
|
|
80553
80655
|
);
|
|
80554
|
-
|
|
80656
|
+
let comment = `/**
|
|
80555
80657
|
* For more details on how to configure Wrangler, refer to:
|
|
80556
80658
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
80557
80659
|
*/
|
|
80558
|
-
{
|
|
80660
|
+
{`;
|
|
80661
|
+
if (!modified["$schema"]) {
|
|
80662
|
+
comment += `
|
|
80559
80663
|
"$schema": "node_modules/wrangler/config-schema.json",`;
|
|
80664
|
+
}
|
|
80560
80665
|
if (!modified["observability"]) {
|
|
80561
80666
|
modified["observability"] = { enabled: true };
|
|
80562
80667
|
}
|
|
@@ -80711,7 +80816,7 @@ var addVscodeConfig = (ctx) => {
|
|
|
80711
80816
|
|
|
80712
80817
|
// src/deploy.ts
|
|
80713
80818
|
var offerToDeploy = async (ctx) => {
|
|
80714
|
-
const { npm:
|
|
80819
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80715
80820
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
80716
80821
|
if (!await isDeployable(ctx)) {
|
|
80717
80822
|
ctx.args.deploy = false;
|
|
@@ -80722,7 +80827,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
80722
80827
|
);
|
|
80723
80828
|
}
|
|
80724
80829
|
const label = `deploy via \`${quoteShellArgs([
|
|
80725
|
-
|
|
80830
|
+
npm25,
|
|
80726
80831
|
"run",
|
|
80727
80832
|
ctx.template.deployScript ?? "deploy"
|
|
80728
80833
|
])}\``;
|
|
@@ -80759,11 +80864,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
80759
80864
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
80760
80865
|
};
|
|
80761
80866
|
var runDeploy = async (ctx) => {
|
|
80762
|
-
const { npm:
|
|
80867
|
+
const { npm: npm25, name: pm4 } = detectPackageManager();
|
|
80763
80868
|
if (!ctx.account?.id) {
|
|
80764
80869
|
throw new Error("Failed to read Cloudflare account.");
|
|
80765
80870
|
}
|
|
80766
|
-
const baseDeployCmd = [
|
|
80871
|
+
const baseDeployCmd = [npm25, "run", ctx.template.deployScript ?? "deploy"];
|
|
80767
80872
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
80768
80873
|
const deployCmd = [
|
|
80769
80874
|
...baseDeployCmd,
|
|
@@ -80775,7 +80880,7 @@ var runDeploy = async (ctx) => {
|
|
|
80775
80880
|
] : []
|
|
80776
80881
|
];
|
|
80777
80882
|
const outputFile = (0, import_node_path6.join)(
|
|
80778
|
-
await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0,
|
|
80883
|
+
await (0, import_promises5.mkdtemp)((0, import_node_path6.join)((0, import_node_os3.tmpdir)(), "c3-wrangler-deploy-")),
|
|
80779
80884
|
"output.json"
|
|
80780
80885
|
);
|
|
80781
80886
|
await runCommand(deployCmd, {
|
|
@@ -80879,14 +80984,14 @@ var printSummary = (ctx) => {
|
|
|
80879
80984
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
80880
80985
|
const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
80881
80986
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
80882
|
-
const { npm:
|
|
80987
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80883
80988
|
const devServerCommand = quoteShellArgs([
|
|
80884
|
-
|
|
80989
|
+
npm25,
|
|
80885
80990
|
"run",
|
|
80886
80991
|
ctx.template.devScript ?? "start"
|
|
80887
80992
|
]);
|
|
80888
80993
|
const deployCommand = quoteShellArgs([
|
|
80889
|
-
|
|
80994
|
+
npm25,
|
|
80890
80995
|
"run",
|
|
80891
80996
|
ctx.template.deployScript ?? "deploy"
|
|
80892
80997
|
]);
|
|
@@ -81254,8 +81359,8 @@ var renderValues = (values) => {
|
|
|
81254
81359
|
};
|
|
81255
81360
|
|
|
81256
81361
|
// src/helpers/retry.ts
|
|
81257
|
-
var retry = async (
|
|
81258
|
-
let { times } =
|
|
81362
|
+
var retry = async (config48, fn) => {
|
|
81363
|
+
let { times } = config48;
|
|
81259
81364
|
let error2 = null;
|
|
81260
81365
|
while (times > 0) {
|
|
81261
81366
|
try {
|
|
@@ -81263,10 +81368,10 @@ var retry = async (config34, fn) => {
|
|
|
81263
81368
|
} catch (e) {
|
|
81264
81369
|
error2 = e;
|
|
81265
81370
|
times--;
|
|
81266
|
-
if (
|
|
81371
|
+
if (config48.exitCondition?.(e)) {
|
|
81267
81372
|
break;
|
|
81268
81373
|
}
|
|
81269
|
-
await sleep(
|
|
81374
|
+
await sleep(config48.sleepMs ?? 1e3);
|
|
81270
81375
|
}
|
|
81271
81376
|
}
|
|
81272
81377
|
throw error2;
|
|
@@ -81355,48 +81460,107 @@ var createProject = async (ctx) => {
|
|
|
81355
81460
|
// src/workers.ts
|
|
81356
81461
|
var import_fs13 = require("fs");
|
|
81357
81462
|
var import_path16 = require("path");
|
|
81358
|
-
|
|
81359
|
-
|
|
81360
|
-
if (!usesTypescript(ctx)) {
|
|
81463
|
+
var import_toml4 = __toESM(require_toml());
|
|
81464
|
+
async function addTypes(ctx) {
|
|
81465
|
+
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
81361
81466
|
return;
|
|
81362
81467
|
}
|
|
81363
|
-
|
|
81364
|
-
|
|
81365
|
-
|
|
81366
|
-
|
|
81468
|
+
const { npm: npm25 } = detectPackageManager();
|
|
81469
|
+
if (ctx.template.workersTypes === "installed") {
|
|
81470
|
+
await installWorkersTypes(npm25);
|
|
81471
|
+
} else if (ctx.template.workersTypes === "generated") {
|
|
81472
|
+
await generateWorkersTypes(ctx, npm25);
|
|
81473
|
+
}
|
|
81474
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm25);
|
|
81475
|
+
await updateTsConfig(ctx, { usesNodeCompat });
|
|
81476
|
+
}
|
|
81477
|
+
async function generateWorkersTypes(ctx, npm25) {
|
|
81478
|
+
const packageJsonPath = (0, import_path16.join)(ctx.project.path, "package.json");
|
|
81479
|
+
if (!(0, import_fs13.existsSync)(packageJsonPath)) {
|
|
81480
|
+
return;
|
|
81481
|
+
}
|
|
81482
|
+
const packageManifest = readJSON(packageJsonPath);
|
|
81483
|
+
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
81484
|
+
return;
|
|
81485
|
+
}
|
|
81486
|
+
const typesCmd = [npm25, "run", "cf-typegen"];
|
|
81487
|
+
await runCommand(typesCmd, {
|
|
81488
|
+
cwd: ctx.project.path,
|
|
81489
|
+
silent: true,
|
|
81490
|
+
startText: "Generating types for your application",
|
|
81491
|
+
doneText: `${brandColor("generated")} ${dim(`to \`${ctx.template.typesPath}\` via \`${typesCmd.join(" ")}\``)}`
|
|
81367
81492
|
});
|
|
81368
|
-
|
|
81493
|
+
if (packageManifest["devDependencies"]?.["@cloudflare/workers-types"]) {
|
|
81494
|
+
delete packageManifest["devDependencies"]?.["@cloudflare/workers-types"];
|
|
81495
|
+
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
81496
|
+
}
|
|
81369
81497
|
}
|
|
81370
|
-
async
|
|
81498
|
+
var maybeInstallNodeTypes = async (ctx, npm25) => {
|
|
81499
|
+
let parsedConfig = {};
|
|
81500
|
+
if (wranglerJsonExists(ctx)) {
|
|
81501
|
+
const wranglerJsonStr = readWranglerJson(ctx);
|
|
81502
|
+
parsedConfig = parse4(wranglerJsonStr, void 0, {
|
|
81503
|
+
allowTrailingComma: true
|
|
81504
|
+
});
|
|
81505
|
+
} else if (wranglerTomlExists(ctx)) {
|
|
81506
|
+
const wranglerTomlStr = readWranglerToml(ctx);
|
|
81507
|
+
parsedConfig = import_toml4.default.parse(wranglerTomlStr);
|
|
81508
|
+
}
|
|
81509
|
+
const compatibilityFlags = Array.isArray(parsedConfig["compatibility_flags"]) ? parsedConfig["compatibility_flags"] : [];
|
|
81510
|
+
if (compatibilityFlags.includes("nodejs_compat") || compatibilityFlags.includes("nodejs_compat_v2")) {
|
|
81511
|
+
await installPackages(["@types/node"], {
|
|
81512
|
+
dev: true,
|
|
81513
|
+
startText: "Installing @types/node",
|
|
81514
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81515
|
+
});
|
|
81516
|
+
return true;
|
|
81517
|
+
}
|
|
81518
|
+
return false;
|
|
81519
|
+
};
|
|
81520
|
+
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
81371
81521
|
const tsconfigPath = (0, import_path16.join)(ctx.project.path, "tsconfig.json");
|
|
81372
81522
|
if (!(0, import_fs13.existsSync)(tsconfigPath)) {
|
|
81373
81523
|
return;
|
|
81374
81524
|
}
|
|
81375
|
-
const s = spinner();
|
|
81376
|
-
s.start("Adding latest types to `tsconfig.json`");
|
|
81377
81525
|
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
81526
|
try {
|
|
81389
|
-
const
|
|
81390
|
-
const currentTypes =
|
|
81391
|
-
|
|
81392
|
-
|
|
81393
|
-
|
|
81394
|
-
|
|
81395
|
-
|
|
81396
|
-
|
|
81397
|
-
|
|
81398
|
-
|
|
81399
|
-
|
|
81527
|
+
const config48 = parse4(tsconfig);
|
|
81528
|
+
const currentTypes = config48.compilerOptions?.types ?? [];
|
|
81529
|
+
let newTypes = [...currentTypes];
|
|
81530
|
+
if (ctx.template.workersTypes === "installed") {
|
|
81531
|
+
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
81532
|
+
if (entrypointVersion === null) {
|
|
81533
|
+
return;
|
|
81534
|
+
}
|
|
81535
|
+
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81536
|
+
const explicitEntrypoint = currentTypes.some(
|
|
81537
|
+
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81538
|
+
);
|
|
81539
|
+
if (!explicitEntrypoint) {
|
|
81540
|
+
newTypes = newTypes.filter(
|
|
81541
|
+
(t2) => t2 !== "@cloudflare/workers-types"
|
|
81542
|
+
);
|
|
81543
|
+
newTypes.push(typesEntrypoint);
|
|
81544
|
+
}
|
|
81545
|
+
} else if (ctx.template.workersTypes === "generated") {
|
|
81546
|
+
newTypes.push(ctx.template.typesPath ?? "./worker-configuration.d.ts");
|
|
81547
|
+
const typegen = readFile(
|
|
81548
|
+
ctx.template.typesPath ?? "./worker-configuration.d.ts"
|
|
81549
|
+
).split("\n");
|
|
81550
|
+
if (typegen.some(
|
|
81551
|
+
(line) => line.includes("// Runtime types generated with workerd")
|
|
81552
|
+
)) {
|
|
81553
|
+
newTypes = newTypes.filter(
|
|
81554
|
+
(t2) => !t2.startsWith("@cloudflare/workers-types")
|
|
81555
|
+
);
|
|
81556
|
+
}
|
|
81557
|
+
}
|
|
81558
|
+
if (usesNodeCompat) {
|
|
81559
|
+
newTypes.push("node");
|
|
81560
|
+
}
|
|
81561
|
+
if (newTypes.sort() === currentTypes.sort()) {
|
|
81562
|
+
return;
|
|
81563
|
+
}
|
|
81400
81564
|
const useSpaces = !tsconfig.match(/\t/g);
|
|
81401
81565
|
const edits = modify(
|
|
81402
81566
|
tsconfig,
|
|
@@ -81409,15 +81573,19 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81409
81573
|
const updated = applyEdits(tsconfig, edits);
|
|
81410
81574
|
writeFile2(tsconfigPath, updated);
|
|
81411
81575
|
} catch (error2) {
|
|
81412
|
-
warn(
|
|
81413
|
-
"Failed to update `tsconfig.json` with latest `@cloudflare/workers-types` entrypoint."
|
|
81414
|
-
);
|
|
81576
|
+
warn("Failed to update `tsconfig.json`.");
|
|
81415
81577
|
}
|
|
81416
|
-
|
|
81578
|
+
}
|
|
81579
|
+
async function installWorkersTypes(npm25) {
|
|
81580
|
+
await installPackages(["@cloudflare/workers-types"], {
|
|
81581
|
+
dev: true,
|
|
81582
|
+
startText: "Installing @cloudflare/workers-types",
|
|
81583
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81584
|
+
});
|
|
81417
81585
|
}
|
|
81418
81586
|
|
|
81419
81587
|
// src/cli.ts
|
|
81420
|
-
var { npm:
|
|
81588
|
+
var { npm: npm24 } = detectPackageManager();
|
|
81421
81589
|
var main = async (argv) => {
|
|
81422
81590
|
const result = await parseArgs(argv);
|
|
81423
81591
|
if (result.type === "unknown") {
|
|
@@ -81453,16 +81621,16 @@ ${result.errorMessage}`);
|
|
|
81453
81621
|
};
|
|
81454
81622
|
var runLatest = async () => {
|
|
81455
81623
|
const args = process.argv.slice(2);
|
|
81456
|
-
if (
|
|
81624
|
+
if (npm24 === "npm") {
|
|
81457
81625
|
args.unshift("--");
|
|
81458
81626
|
}
|
|
81459
|
-
await runCommand([
|
|
81627
|
+
await runCommand([npm24, "create", "cloudflare@latest", ...args]);
|
|
81460
81628
|
};
|
|
81461
81629
|
var runCli = async (args) => {
|
|
81462
81630
|
printBanner(args);
|
|
81463
81631
|
const ctx = await createContext(args);
|
|
81464
81632
|
await create(ctx);
|
|
81465
|
-
await
|
|
81633
|
+
await configure20(ctx);
|
|
81466
81634
|
await deploy(ctx);
|
|
81467
81635
|
printSummary(ctx);
|
|
81468
81636
|
logRaw("");
|
|
@@ -81490,10 +81658,9 @@ var create = async (ctx) => {
|
|
|
81490
81658
|
await rectifyPmMismatch(ctx);
|
|
81491
81659
|
endSection(`Application created`);
|
|
81492
81660
|
};
|
|
81493
|
-
var
|
|
81661
|
+
var configure20 = async (ctx) => {
|
|
81494
81662
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
81495
81663
|
await installWrangler();
|
|
81496
|
-
await installWorkersTypes(ctx);
|
|
81497
81664
|
await updateWranglerConfig(ctx);
|
|
81498
81665
|
const { template } = ctx;
|
|
81499
81666
|
if (template.configure) {
|
|
@@ -81501,6 +81668,7 @@ var configure21 = async (ctx) => {
|
|
|
81501
81668
|
}
|
|
81502
81669
|
addWranglerToGitIgnore(ctx);
|
|
81503
81670
|
await updatePackageScripts(ctx);
|
|
81671
|
+
await addTypes(ctx);
|
|
81504
81672
|
await offerGit(ctx);
|
|
81505
81673
|
await gitCommit(ctx);
|
|
81506
81674
|
endSection(`Application configured`);
|
|
@@ -81551,26 +81719,8 @@ repeat-string/index.js:
|
|
|
81551
81719
|
*)
|
|
81552
81720
|
|
|
81553
81721
|
yargs-parser/build/lib/string-utils.js:
|
|
81554
|
-
(**
|
|
81555
|
-
* @license
|
|
81556
|
-
* Copyright (c) 2016, Contributors
|
|
81557
|
-
* SPDX-License-Identifier: ISC
|
|
81558
|
-
*)
|
|
81559
|
-
|
|
81560
81722
|
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
81561
|
-
(**
|
|
81562
|
-
* @license
|
|
81563
|
-
* Copyright (c) 2016, Contributors
|
|
81564
|
-
* SPDX-License-Identifier: ISC
|
|
81565
|
-
*)
|
|
81566
|
-
|
|
81567
81723
|
yargs-parser/build/lib/yargs-parser-types.js:
|
|
81568
|
-
(**
|
|
81569
|
-
* @license
|
|
81570
|
-
* Copyright (c) 2016, Contributors
|
|
81571
|
-
* SPDX-License-Identifier: ISC
|
|
81572
|
-
*)
|
|
81573
|
-
|
|
81574
81724
|
yargs-parser/build/lib/yargs-parser.js:
|
|
81575
81725
|
(**
|
|
81576
81726
|
* @license
|