@geekmidas/cli 10.0.0-alpha.61 → 10.0.0-alpha.63
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/README.md +2 -0
- package/dist/{HostingerProvider-DI_Pr2VE.mjs → HostingerProvider-DBBwpDjn.mjs} +2 -2
- package/dist/{HostingerProvider-DI_Pr2VE.mjs.map → HostingerProvider-DBBwpDjn.mjs.map} +1 -1
- package/dist/{HostingerProvider-CgDaD8VR.cjs → HostingerProvider-mJ7YruxH.cjs} +2 -2
- package/dist/{HostingerProvider-CgDaD8VR.cjs.map → HostingerProvider-mJ7YruxH.cjs.map} +1 -1
- package/dist/{LegacyStateStore-JbBVFp_2.cjs → LegacyStateStore-CP7SZwTP.cjs} +2 -2
- package/dist/{LegacyStateStore-JbBVFp_2.cjs.map → LegacyStateStore-CP7SZwTP.cjs.map} +1 -1
- package/dist/{LegacyStateStore-C7vFAxbu.mjs → LegacyStateStore-Q3GmKOdw.mjs} +2 -2
- package/dist/{LegacyStateStore-C7vFAxbu.mjs.map → LegacyStateStore-Q3GmKOdw.mjs.map} +1 -1
- package/dist/{LocalStateStore-DfUwQsL8.mjs → LocalStateStore-BGIXcrvX.mjs} +2 -2
- package/dist/{LocalStateStore-DfUwQsL8.mjs.map → LocalStateStore-BGIXcrvX.mjs.map} +1 -1
- package/dist/{LocalStateStore-DHj_-CQB.cjs → LocalStateStore-sS8mvLeq.cjs} +2 -2
- package/dist/{LocalStateStore-DHj_-CQB.cjs.map → LocalStateStore-sS8mvLeq.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs → OpenApiTsGenerator-CjHWFRDd.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs.map → OpenApiTsGenerator-CjHWFRDd.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs → OpenApiTsGenerator-CnAwhGxi.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs.map → OpenApiTsGenerator-CnAwhGxi.mjs.map} +1 -1
- package/dist/{S3StateStore-xqnpUrzy.cjs → S3StateStore-6jqITH2F.cjs} +2 -2
- package/dist/{S3StateStore-xqnpUrzy.cjs.map → S3StateStore-6jqITH2F.cjs.map} +1 -1
- package/dist/{S3StateStore-Dq6hHtzY.mjs → S3StateStore-D7l_lWJ3.mjs} +2 -2
- package/dist/{S3StateStore-Dq6hHtzY.mjs.map → S3StateStore-D7l_lWJ3.mjs.map} +1 -1
- package/dist/{SSMStateStore-5dBRwVlJ.cjs → SSMStateStore-B__F7IJa.cjs} +2 -2
- package/dist/{SSMStateStore-5dBRwVlJ.cjs.map → SSMStateStore-B__F7IJa.cjs.map} +1 -1
- package/dist/{SSMStateStore-SUmvAbLi.mjs → SSMStateStore-CAQDVpoc.mjs} +2 -2
- package/dist/{SSMStateStore-SUmvAbLi.mjs.map → SSMStateStore-CAQDVpoc.mjs.map} +1 -1
- package/dist/{bundler-DXATpO1T.cjs → bundler-DLfOn0ls.cjs} +3 -3
- package/dist/{bundler-DXATpO1T.cjs.map → bundler-DLfOn0ls.cjs.map} +1 -1
- package/dist/{bundler-B5VsKW-_.mjs → bundler-DyWI41Iy.mjs} +2 -2
- package/dist/{bundler-B5VsKW-_.mjs.map → bundler-DyWI41Iy.mjs.map} +1 -1
- package/dist/{cli-DQdrVkj2.cjs → cli-D-ZM-X2s.cjs} +12 -16
- package/dist/cli-D-ZM-X2s.cjs.map +1 -0
- package/dist/{cli-DEA_J3Sa.mjs → cli-PkVF28LM.mjs} +10 -14
- package/dist/cli-PkVF28LM.mjs.map +1 -0
- package/dist/{config-DXnkCEq0.cjs → config-BEJYKd4s.cjs} +132 -18
- package/dist/config-BEJYKd4s.cjs.map +1 -0
- package/dist/config-C2BUosLm.d.mts +256 -0
- package/dist/config-C2BUosLm.d.mts.map +1 -0
- package/dist/config-CemHVcIr.d.cts +256 -0
- package/dist/config-CemHVcIr.d.cts.map +1 -0
- package/dist/{config-C5-EEdmr.mjs → config-LKKCVCnC.mjs} +109 -19
- package/dist/config-LKKCVCnC.mjs.map +1 -0
- package/dist/config.cjs +6 -2
- package/dist/config.d.cts +4 -211
- package/dist/config.d.mts +4 -211
- package/dist/config.mjs +3 -3
- package/dist/define-CHBIEc5j.mjs +94 -0
- package/dist/define-CHBIEc5j.mjs.map +1 -0
- package/dist/define-Cv_QvDrg.cjs +141 -0
- package/dist/define-Cv_QvDrg.cjs.map +1 -0
- package/dist/deploy/public.cjs +174 -13
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +200 -292
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +200 -292
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +136 -3
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
- package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
- package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
- package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
- package/dist/{deploy-BbJdgQ2b.cjs → deploy-ABBI0lf1.cjs} +169 -561
- package/dist/deploy-ABBI0lf1.cjs.map +1 -0
- package/dist/deploy-BiMrP9i7.cjs +140 -0
- package/dist/deploy-BiMrP9i7.cjs.map +1 -0
- package/dist/{deploy-BJcLmVTc.mjs → deploy-CG8bfFij.mjs} +152 -532
- package/dist/deploy-CG8bfFij.mjs.map +1 -0
- package/dist/deploy-CGW-QY9D.mjs +135 -0
- package/dist/deploy-CGW-QY9D.mjs.map +1 -0
- package/dist/discover-B6yPpvRV.d.mts +99 -0
- package/dist/discover-B6yPpvRV.d.mts.map +1 -0
- package/dist/discover-B_IkPukx.d.cts +99 -0
- package/dist/discover-B_IkPukx.d.cts.map +1 -0
- package/dist/discover-BaT6bpnA.mjs +614 -0
- package/dist/discover-BaT6bpnA.mjs.map +1 -0
- package/dist/discover-C_6COHEv.cjs +729 -0
- package/dist/discover-C_6COHEv.cjs.map +1 -0
- package/dist/dokploy-CwdmlyQL.mjs +32 -0
- package/dist/dokploy-CwdmlyQL.mjs.map +1 -0
- package/dist/dokploy-QJxMhxdf.cjs +32 -0
- package/dist/dokploy-QJxMhxdf.cjs.map +1 -0
- package/dist/{encryption-DaA9gRXr.mjs → encryption-CbQG_ayW.mjs} +4 -4
- package/dist/{encryption-DaA9gRXr.mjs.map → encryption-CbQG_ayW.mjs.map} +1 -1
- package/dist/{encryption-ojzUo7-z.cjs → encryption-DXw3jj0c.cjs} +4 -4
- package/dist/{encryption-ojzUo7-z.cjs.map → encryption-DXw3jj0c.cjs.map} +1 -1
- package/dist/fakes-C9RiT6XG.mjs.map +1 -1
- package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
- package/dist/{github-Cq57poPj.cjs → github-BH_mETav.cjs} +3 -3
- package/dist/{github-Cq57poPj.cjs.map → github-BH_mETav.cjs.map} +1 -1
- package/dist/{github-DmCj2u95.mjs → github-ciwbIwVa.mjs} +3 -3
- package/dist/{github-DmCj2u95.mjs.map → github-ciwbIwVa.mjs.map} +1 -1
- package/dist/{index-UiWCaGzU.d.cts → index-BtXDZQuF.d.cts} +2 -2
- package/dist/{index-Da1-oa9W.d.mts.map → index-BtXDZQuF.d.cts.map} +1 -1
- package/dist/{index-Da1-oa9W.d.mts → index-DrKzpHl-.d.mts} +2 -2
- package/dist/{index-UiWCaGzU.d.cts.map → index-DrKzpHl-.d.mts.map} +1 -1
- package/dist/index.cjs +60 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +57 -49
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-BScRpCEx.cjs → migrate-6oa9y_f2.cjs} +5 -5
- package/dist/{migrate-BScRpCEx.cjs.map → migrate-6oa9y_f2.cjs.map} +1 -1
- package/dist/{migrate-5_J5JySj.mjs → migrate-ImBKTBcW.mjs} +5 -5
- package/dist/{migrate-5_J5JySj.mjs.map → migrate-ImBKTBcW.mjs.map} +1 -1
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +3 -3
- package/dist/{ready-XlNx-Gbo.cjs → ready-BiG0rt4h.cjs} +3 -3
- package/dist/{ready-XlNx-Gbo.cjs.map → ready-BiG0rt4h.cjs.map} +1 -1
- package/dist/{ready-DQIy21W5.mjs → ready-Bpdnn2ON.mjs} +3 -3
- package/dist/{ready-DQIy21W5.mjs.map → ready-Bpdnn2ON.mjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +4 -77
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +4 -77
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/resolve-B1T0hUaR.mjs +170 -0
- package/dist/resolve-B1T0hUaR.mjs.map +1 -0
- package/dist/resolve-xytBTtG4.cjs +217 -0
- package/dist/resolve-xytBTtG4.cjs.map +1 -0
- package/dist/runtime-CMwtq0AL.cjs +163 -0
- package/dist/runtime-CMwtq0AL.cjs.map +1 -0
- package/dist/runtime-CXPlkZzs.d.mts +90 -0
- package/dist/runtime-CXPlkZzs.d.mts.map +1 -0
- package/dist/runtime-DbakJS8u.mjs +134 -0
- package/dist/runtime-DbakJS8u.mjs.map +1 -0
- package/dist/runtime-Dn_n-29S.d.cts +90 -0
- package/dist/runtime-Dn_n-29S.d.cts.map +1 -0
- package/dist/sandbox/config-worker.cjs +43 -0
- package/dist/sandbox/config-worker.cjs.map +1 -0
- package/dist/sandbox/config-worker.d.cts +1 -0
- package/dist/sandbox/config-worker.d.mts +1 -0
- package/dist/sandbox/config-worker.mjs +44 -0
- package/dist/sandbox/config-worker.mjs.map +1 -0
- package/dist/sandbox/discover-worker.cjs +44 -0
- package/dist/sandbox/discover-worker.cjs.map +1 -0
- package/dist/sandbox/discover-worker.d.cts +1 -0
- package/dist/sandbox/discover-worker.d.mts +1 -0
- package/dist/sandbox/discover-worker.mjs +45 -0
- package/dist/sandbox/discover-worker.mjs.map +1 -0
- package/dist/sandbox-M8UnLhXE.d.cts +126 -0
- package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
- package/dist/sandbox-M8UnLhXE.d.mts +126 -0
- package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
- package/dist/{workspace-Bp1xVaOz.mjs → schemas-Ckm_aBnF.cjs} +264 -969
- package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
- package/dist/{workspace-B64Xk1Mb.cjs → schemas-D2LCF689.mjs} +195 -1155
- package/dist/schemas-D2LCF689.mjs.map +1 -0
- package/dist/{sniffer-CQmJnNJM.cjs → sniffer-D_SYc_pO.cjs} +379 -214
- package/dist/sniffer-D_SYc_pO.cjs.map +1 -0
- package/dist/{sniffer-bdleks5l.mjs → sniffer-aO_-s5vq.mjs} +346 -211
- package/dist/sniffer-aO_-s5vq.mjs.map +1 -0
- package/dist/target/public.cjs +15 -0
- package/dist/target/public.d.cts +28 -0
- package/dist/target/public.d.cts.map +1 -0
- package/dist/target/public.d.mts +28 -0
- package/dist/target/public.d.mts.map +1 -0
- package/dist/target/public.mjs +4 -0
- package/dist/terminal-D0f1u0LG.cjs +576 -0
- package/dist/terminal-D0f1u0LG.cjs.map +1 -0
- package/dist/terminal-gMxAo9Dj.mjs +517 -0
- package/dist/terminal-gMxAo9Dj.mjs.map +1 -0
- package/dist/{types-efNLu9xu.d.cts → types-CfLKGfC_.d.mts} +624 -34
- package/dist/types-CfLKGfC_.d.mts.map +1 -0
- package/dist/{types-Bp1mVxG0.d.mts → types-DIA7Li-J.d.cts} +626 -34
- package/dist/types-DIA7Li-J.d.cts.map +1 -0
- package/dist/vitest.cjs +2 -2
- package/dist/vitest.mjs +2 -2
- package/dist/workerRuntime-BXfhbe13.cjs +108 -0
- package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
- package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
- package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +1 -1
- package/dist/workspace-Dh7rr7l4.mjs +1024 -0
- package/dist/workspace-Dh7rr7l4.mjs.map +1 -0
- package/dist/workspace-Kl4NG9IH.cjs +1196 -0
- package/dist/workspace-Kl4NG9IH.cjs.map +1 -0
- package/package.json +23 -13
- package/dist/cli-DEA_J3Sa.mjs.map +0 -1
- package/dist/cli-DQdrVkj2.cjs.map +0 -1
- package/dist/config-C5-EEdmr.mjs.map +0 -1
- package/dist/config-DXnkCEq0.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/deploy-BJcLmVTc.mjs.map +0 -1
- package/dist/deploy-BbJdgQ2b.cjs.map +0 -1
- package/dist/discover-Bc-4eA_p.cjs +0 -299
- package/dist/discover-Bc-4eA_p.cjs.map +0 -1
- package/dist/discover-FrYvzkeC.mjs +0 -262
- package/dist/discover-FrYvzkeC.mjs.map +0 -1
- package/dist/sniffer-CQmJnNJM.cjs.map +0 -1
- package/dist/sniffer-bdleks5l.mjs.map +0 -1
- package/dist/types-Bp1mVxG0.d.mts.map +0 -1
- package/dist/types-efNLu9xu.d.cts.map +0 -1
- package/dist/workspace-B64Xk1Mb.cjs.map +0 -1
- package/dist/workspace-Bp1xVaOz.mjs.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_home = require("./home-DOzBaWaL.cjs");
|
|
3
|
-
const require_discover = require("./discover-
|
|
4
|
-
const require_config = require("./config-
|
|
5
|
-
const require_workspace = require("./workspace-
|
|
3
|
+
const require_discover = require("./discover-C_6COHEv.cjs");
|
|
4
|
+
const require_config = require("./config-BEJYKd4s.cjs");
|
|
5
|
+
const require_workspace = require("./workspace-Kl4NG9IH.cjs");
|
|
6
6
|
const require_storage = require("./storage-CSGoC3bK.cjs");
|
|
7
7
|
const require_store = require("./store-KvNQwYaB.cjs");
|
|
8
|
+
const require_runtime = require("./runtime-CMwtq0AL.cjs");
|
|
8
9
|
const require_fakes = require("./fakes-zW-jNAbQ.cjs");
|
|
9
10
|
let node_path = require("node:path");
|
|
10
11
|
let node_process = require("node:process");
|
|
@@ -15,12 +16,11 @@ let node_fs_promises = require("node:fs/promises");
|
|
|
15
16
|
let node_os = require("node:os");
|
|
16
17
|
let node_util = require("node:util");
|
|
17
18
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
19
|
+
let node_url = require("node:url");
|
|
18
20
|
let node_child_process = require("node:child_process");
|
|
19
|
-
let node_module = require("node:module");
|
|
20
21
|
let node_net = require("node:net");
|
|
21
22
|
let dotenv = require("dotenv");
|
|
22
23
|
let node_crypto = require("node:crypto");
|
|
23
|
-
let node_url = require("node:url");
|
|
24
24
|
let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
|
|
25
25
|
let _geekmidas_db_pg_roles = require("@geekmidas/db/pg/roles");
|
|
26
26
|
let _geekmidas_events_sns_url = require("@geekmidas/events/sns/url");
|
|
@@ -587,45 +587,6 @@ function normalizeRoutes(routes) {
|
|
|
587
587
|
return Array.isArray(routes) ? routes : [routes];
|
|
588
588
|
}
|
|
589
589
|
//#endregion
|
|
590
|
-
//#region src/owningTsconfigJsx.ts
|
|
591
|
-
const REGISTER = "owning-tsconfig-jsx-register.mjs";
|
|
592
|
-
/** The CLI's `bin/` was not found above the module looking for it. */
|
|
593
|
-
var OwningTsconfigJsxHookMissing = class extends Error {
|
|
594
|
-
from;
|
|
595
|
-
constructor(from) {
|
|
596
|
-
super(`Could not find bin/${REGISTER} in any directory above '${from}'. It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the package if it is missing.`);
|
|
597
|
-
this.from = from;
|
|
598
|
-
this.name = "OwningTsconfigJsxHookMissing";
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
/**
|
|
602
|
-
* The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
|
|
603
|
-
* upward because this module runs from `src/` in the repo and from a chunk in
|
|
604
|
-
* `dist/` once built, and `bin/` sits beside both.
|
|
605
|
-
*/
|
|
606
|
-
function registerUrl() {
|
|
607
|
-
const from = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
608
|
-
for (let dir = from;; dir = (0, node_path.dirname)(dir)) {
|
|
609
|
-
const candidate = (0, node_path.join)(dir, "bin", REGISTER);
|
|
610
|
-
if ((0, node_fs.existsSync)(candidate)) return (0, node_url.pathToFileURL)(candidate).href;
|
|
611
|
-
if ((0, node_path.dirname)(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
|
|
616
|
-
* that compiles each `.tsx` with its own tsconfig's JSX settings (see
|
|
617
|
-
* `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
|
|
618
|
-
* is registered before tsx and reads the source on tsx's behalf.
|
|
619
|
-
*
|
|
620
|
-
* `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
|
|
621
|
-
* this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
|
|
622
|
-
* started with tsx already imported.
|
|
623
|
-
*/
|
|
624
|
-
function withOwningTsconfigJsx(nodeOptions = "") {
|
|
625
|
-
if (nodeOptions.includes(REGISTER)) return nodeOptions;
|
|
626
|
-
return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
|
|
627
|
-
}
|
|
628
|
-
//#endregion
|
|
629
590
|
//#region src/reconcile/containers.ts
|
|
630
591
|
/**
|
|
631
592
|
* What gkm knows about each container it can derive.
|
|
@@ -821,17 +782,19 @@ function volumeOf(container) {
|
|
|
821
782
|
* Which family of defaults a workspace's deploy target belongs to.
|
|
822
783
|
*
|
|
823
784
|
* One question, asked once: **does this target run containers the project
|
|
824
|
-
* controls?** Dokploy
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
785
|
+
* controls?** Dokploy does, so a bucket or a cache can live beside the app;
|
|
786
|
+
* AWS, Vercel and Cloudflare do not, so the default has to be something
|
|
787
|
+
* managed. That is the whole of the distinction, and it is why `MainProvider`
|
|
788
|
+
* is the right axis rather than the deploy target's own name — targets share
|
|
789
|
+
* answers.
|
|
829
790
|
*
|
|
830
|
-
*
|
|
791
|
+
* Each target declares its answer as its `runtime` — a target package in its
|
|
792
|
+
* `package.json`, so this never loads one. A workspace that names no target
|
|
793
|
+
* is on AWS: an SST project predates `deploy.default: 'sst'`.
|
|
831
794
|
*/
|
|
832
795
|
function providerOf(workspace) {
|
|
833
796
|
const target = workspace.deploy?.default;
|
|
834
|
-
return target
|
|
797
|
+
return target ? require_runtime.runtimeOf(target, workspace) : "aws";
|
|
835
798
|
}
|
|
836
799
|
/**
|
|
837
800
|
* The cache backend a target implies.
|
|
@@ -3533,7 +3496,7 @@ function localAddress(port) {
|
|
|
3533
3496
|
/** Long enough for a cold image build; short enough that a hung one ends. */
|
|
3534
3497
|
const DEFAULT_TIMEOUT_MS = 18e5;
|
|
3535
3498
|
/** How long a timed-out child has to exit on SIGTERM before it is killed. */
|
|
3536
|
-
const KILL_GRACE_MS = 5e3;
|
|
3499
|
+
const KILL_GRACE_MS$1 = 5e3;
|
|
3537
3500
|
/** The command line as a person would read it — for messages, never to run. */
|
|
3538
3501
|
function display(command, args) {
|
|
3539
3502
|
return [command, ...args].join(" ");
|
|
@@ -3606,7 +3569,7 @@ function spawnChild(command, args, options, capture) {
|
|
|
3606
3569
|
const timer = setTimeout(() => {
|
|
3607
3570
|
timedOut = true;
|
|
3608
3571
|
child.kill("SIGTERM");
|
|
3609
|
-
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
3572
|
+
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS$1);
|
|
3610
3573
|
killer.unref?.();
|
|
3611
3574
|
}, timeoutMs);
|
|
3612
3575
|
timer.unref?.();
|
|
@@ -3628,6 +3591,221 @@ function spawnChild(command, args, options, capture) {
|
|
|
3628
3591
|
});
|
|
3629
3592
|
}
|
|
3630
3593
|
//#endregion
|
|
3594
|
+
//#region src/sandbox/env.ts
|
|
3595
|
+
/**
|
|
3596
|
+
* What of the host's environment a local sandbox passes on.
|
|
3597
|
+
*
|
|
3598
|
+
* An allowlist, not a denylist: a credential's variable has any name its
|
|
3599
|
+
* owner chose (`DOKPLOY_TOKEN`, `AWS_SECRET_ACCESS_KEY`, `MY_VAULT_TOKEN`), so
|
|
3600
|
+
* the only safe default is to name what a program needs to *run* and pass
|
|
3601
|
+
* nothing else.
|
|
3602
|
+
*/
|
|
3603
|
+
/**
|
|
3604
|
+
* Variables a command needs to find programs, write temp files, print in the
|
|
3605
|
+
* user's locale and reach the network through the host's proxy — and nothing
|
|
3606
|
+
* that authenticates as anyone.
|
|
3607
|
+
*
|
|
3608
|
+
* Deliberately left out:
|
|
3609
|
+
* - `NODE_OPTIONS`: it can `--require` or `--import` code into every node
|
|
3610
|
+
* process, and CI often holds `--import tsx` there. A step that needs a
|
|
3611
|
+
* loader passes its own.
|
|
3612
|
+
* - `NODE_AUTH_TOKEN`, `NPM_TOKEN`, `npm_config_*`: registry tokens
|
|
3613
|
+
* (`actions/setup-node` writes `NODE_AUTH_TOKEN`), which is why there is no
|
|
3614
|
+
* `NODE_*` wildcard.
|
|
3615
|
+
* - `AWS_*`, `DOCKER_*`, `DOKPLOY_*`, `GITHUB_TOKEN`, `TURBO_TOKEN`, `GKM_*`:
|
|
3616
|
+
* credentials, or where the deploy keeps them.
|
|
3617
|
+
* - `SHELL`, `EDITOR` and the rest of a login session: nothing here starts a
|
|
3618
|
+
* shell.
|
|
3619
|
+
*
|
|
3620
|
+
* Proxies are passed: behind one, nothing installs or builds without it. A
|
|
3621
|
+
* proxy URL with a password in it reaches the command too — a host that keeps
|
|
3622
|
+
* one there and builds code it does not trust should pass a sandbox of its
|
|
3623
|
+
* own.
|
|
3624
|
+
*/
|
|
3625
|
+
const SANDBOX_ENV_ALLOWLIST = [
|
|
3626
|
+
"PATH",
|
|
3627
|
+
"HOME",
|
|
3628
|
+
"USER",
|
|
3629
|
+
"LOGNAME",
|
|
3630
|
+
"TMPDIR",
|
|
3631
|
+
"TMP",
|
|
3632
|
+
"TEMP",
|
|
3633
|
+
"LANG",
|
|
3634
|
+
"LANGUAGE",
|
|
3635
|
+
"TZ",
|
|
3636
|
+
/^LC_[A-Z]+$/,
|
|
3637
|
+
"TERM",
|
|
3638
|
+
"COLORTERM",
|
|
3639
|
+
"NO_COLOR",
|
|
3640
|
+
"FORCE_COLOR",
|
|
3641
|
+
"CI",
|
|
3642
|
+
"NODE_ENV",
|
|
3643
|
+
"NODE_EXTRA_CA_CERTS",
|
|
3644
|
+
"COREPACK_HOME",
|
|
3645
|
+
"PNPM_HOME",
|
|
3646
|
+
"XDG_CACHE_HOME",
|
|
3647
|
+
"XDG_DATA_HOME",
|
|
3648
|
+
"HTTP_PROXY",
|
|
3649
|
+
"HTTPS_PROXY",
|
|
3650
|
+
"NO_PROXY",
|
|
3651
|
+
"http_proxy",
|
|
3652
|
+
"https_proxy",
|
|
3653
|
+
"no_proxy",
|
|
3654
|
+
"SystemRoot",
|
|
3655
|
+
"SYSTEMROOT",
|
|
3656
|
+
"windir",
|
|
3657
|
+
"WINDIR",
|
|
3658
|
+
"ComSpec",
|
|
3659
|
+
"COMSPEC",
|
|
3660
|
+
"PATHEXT",
|
|
3661
|
+
"USERPROFILE",
|
|
3662
|
+
"APPDATA",
|
|
3663
|
+
"LOCALAPPDATA"
|
|
3664
|
+
];
|
|
3665
|
+
function allowed(name) {
|
|
3666
|
+
return SANDBOX_ENV_ALLOWLIST.some((entry) => typeof entry === "string" ? entry === name : entry.test(name));
|
|
3667
|
+
}
|
|
3668
|
+
/**
|
|
3669
|
+
* The allowlisted part of `source`, plus each of `extra` the host chose to
|
|
3670
|
+
* pass on by name.
|
|
3671
|
+
*/
|
|
3672
|
+
function allowlistedEnv(source = process.env, extra = []) {
|
|
3673
|
+
const env = {};
|
|
3674
|
+
for (const [name, value] of Object.entries(source)) {
|
|
3675
|
+
if (value === void 0) continue;
|
|
3676
|
+
if (allowed(name) || extra.includes(name)) env[name] = value;
|
|
3677
|
+
}
|
|
3678
|
+
return env;
|
|
3679
|
+
}
|
|
3680
|
+
//#endregion
|
|
3681
|
+
//#region src/sandbox/local.ts
|
|
3682
|
+
/** How long a timed-out command has to exit on SIGTERM before SIGKILL. */
|
|
3683
|
+
const KILL_GRACE_MS = 5e3;
|
|
3684
|
+
/** Where `output` sends a child's streams. */
|
|
3685
|
+
const STDIO = {
|
|
3686
|
+
capture: [
|
|
3687
|
+
"ignore",
|
|
3688
|
+
"pipe",
|
|
3689
|
+
"pipe"
|
|
3690
|
+
],
|
|
3691
|
+
inherit: "inherit",
|
|
3692
|
+
stderr: [
|
|
3693
|
+
"ignore",
|
|
3694
|
+
2,
|
|
3695
|
+
2
|
|
3696
|
+
],
|
|
3697
|
+
ignore: "ignore"
|
|
3698
|
+
};
|
|
3699
|
+
/**
|
|
3700
|
+
* A child process on this machine, as this user, with an allowlisted
|
|
3701
|
+
* environment.
|
|
3702
|
+
*
|
|
3703
|
+
* What it withholds from the command: the host's environment beyond
|
|
3704
|
+
* {@link SANDBOX_ENV_ALLOWLIST}, a shell, a working directory outside the
|
|
3705
|
+
* project, and any time past the timeout. What it does not: the host's
|
|
3706
|
+
* filesystem, which the command can read and write as the user running the
|
|
3707
|
+
* deploy. So it is not `isolating`, and it is the default for projects the
|
|
3708
|
+
* host already trusts — the developer's own, a team's own CI. Code nobody
|
|
3709
|
+
* vetted belongs in a sandbox that is.
|
|
3710
|
+
*
|
|
3711
|
+
* A timed-out command is sent SIGTERM, then SIGKILL; processes it started
|
|
3712
|
+
* itself are its to stop.
|
|
3713
|
+
*/
|
|
3714
|
+
var LocalSandbox = class {
|
|
3715
|
+
root;
|
|
3716
|
+
isolating = false;
|
|
3717
|
+
env;
|
|
3718
|
+
constructor(options) {
|
|
3719
|
+
this.root = (0, node_path.resolve)(options.root);
|
|
3720
|
+
this.env = {
|
|
3721
|
+
...allowlistedEnv(options.hostEnv ?? process.env, options.passEnv),
|
|
3722
|
+
...options.home ? {
|
|
3723
|
+
HOME: options.home,
|
|
3724
|
+
USERPROFILE: options.home
|
|
3725
|
+
} : {}
|
|
3726
|
+
};
|
|
3727
|
+
}
|
|
3728
|
+
async exec(command, args, options) {
|
|
3729
|
+
const cwd = require_discover.confineCwd(this.root, options.cwd);
|
|
3730
|
+
require_discover.assertSecretNames(options.secrets);
|
|
3731
|
+
options.signal?.throwIfAborted();
|
|
3732
|
+
const secretsDir = await mountSecrets(options.secrets);
|
|
3733
|
+
try {
|
|
3734
|
+
return await spawnConfined(command, args, {
|
|
3735
|
+
...options,
|
|
3736
|
+
cwd,
|
|
3737
|
+
env: secretsDir ? {
|
|
3738
|
+
...options.env,
|
|
3739
|
+
[require_discover.SECRETS_DIR_ENV]: secretsDir
|
|
3740
|
+
} : options.env
|
|
3741
|
+
});
|
|
3742
|
+
} finally {
|
|
3743
|
+
if (secretsDir) await (0, node_fs_promises.rm)(secretsDir, {
|
|
3744
|
+
recursive: true,
|
|
3745
|
+
force: true
|
|
3746
|
+
});
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
};
|
|
3750
|
+
/**
|
|
3751
|
+
* Each secret as a 0600 file in a fresh 0700 directory outside the project —
|
|
3752
|
+
* where nothing the build writes, packs or commits will pick it up.
|
|
3753
|
+
*/
|
|
3754
|
+
async function mountSecrets(secrets) {
|
|
3755
|
+
if (!secrets || Object.keys(secrets).length === 0) return void 0;
|
|
3756
|
+
const dir = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "gkm-secrets-"));
|
|
3757
|
+
for (const [name, value] of Object.entries(secrets)) await (0, node_fs_promises.writeFile)((0, node_path.join)(dir, name), value, { mode: 384 });
|
|
3758
|
+
return dir;
|
|
3759
|
+
}
|
|
3760
|
+
function spawnConfined(command, args, options) {
|
|
3761
|
+
const { output = "capture", signal, timeoutMs } = options;
|
|
3762
|
+
return new Promise((resolvePromise, reject) => {
|
|
3763
|
+
const child = (0, node_child_process.spawn)(command, [...args], {
|
|
3764
|
+
cwd: options.cwd,
|
|
3765
|
+
env: { ...options.env },
|
|
3766
|
+
stdio: STDIO[output],
|
|
3767
|
+
shell: false,
|
|
3768
|
+
...signal ? { signal } : {}
|
|
3769
|
+
});
|
|
3770
|
+
let stdout = "";
|
|
3771
|
+
let stderr = "";
|
|
3772
|
+
child.stdout?.on("data", (chunk) => {
|
|
3773
|
+
stdout += chunk.toString();
|
|
3774
|
+
});
|
|
3775
|
+
child.stderr?.on("data", (chunk) => {
|
|
3776
|
+
stderr += chunk.toString();
|
|
3777
|
+
});
|
|
3778
|
+
let timedOut = false;
|
|
3779
|
+
let killer;
|
|
3780
|
+
const timer = setTimeout(() => {
|
|
3781
|
+
timedOut = true;
|
|
3782
|
+
child.kill("SIGTERM");
|
|
3783
|
+
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
3784
|
+
killer.unref?.();
|
|
3785
|
+
}, timeoutMs);
|
|
3786
|
+
timer.unref?.();
|
|
3787
|
+
const settle = () => {
|
|
3788
|
+
clearTimeout(timer);
|
|
3789
|
+
if (killer) clearTimeout(killer);
|
|
3790
|
+
};
|
|
3791
|
+
child.on("error", (error) => {
|
|
3792
|
+
settle();
|
|
3793
|
+
reject(signal?.aborted ? signal.reason : error);
|
|
3794
|
+
});
|
|
3795
|
+
child.on("close", (code, killedBy) => {
|
|
3796
|
+
settle();
|
|
3797
|
+
if (signal?.aborted) reject(signal.reason);
|
|
3798
|
+
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
3799
|
+
else resolvePromise({
|
|
3800
|
+
exitCode: code,
|
|
3801
|
+
signal: killedBy ?? null,
|
|
3802
|
+
stdout,
|
|
3803
|
+
stderr
|
|
3804
|
+
});
|
|
3805
|
+
});
|
|
3806
|
+
});
|
|
3807
|
+
}
|
|
3808
|
+
//#endregion
|
|
3631
3809
|
//#region src/secrets/encryption.ts
|
|
3632
3810
|
var encryption_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
3633
3811
|
encryptSecrets: () => encryptSecrets,
|
|
@@ -4052,17 +4230,17 @@ function isStateStore(value) {
|
|
|
4052
4230
|
async function createStateStore(options) {
|
|
4053
4231
|
const { config, workspaceRoot, workspaceName } = options;
|
|
4054
4232
|
if (!config || config.provider === "local") {
|
|
4055
|
-
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-
|
|
4233
|
+
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-sS8mvLeq.cjs")).then((n) => n.LocalStateStore_exports);
|
|
4056
4234
|
return new LocalStateStore(workspaceRoot);
|
|
4057
4235
|
}
|
|
4058
4236
|
if (isStateStore(config.provider)) return config.provider;
|
|
4059
4237
|
if (isStateProvider(config.provider)) {
|
|
4060
|
-
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-
|
|
4238
|
+
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-CP7SZwTP.cjs"));
|
|
4061
4239
|
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
4062
4240
|
}
|
|
4063
4241
|
if (config.provider === "ssm") {
|
|
4064
4242
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
4065
|
-
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-
|
|
4243
|
+
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-B__F7IJa.cjs"));
|
|
4066
4244
|
const ssm = config;
|
|
4067
4245
|
return SSMStateStore.create({
|
|
4068
4246
|
workspaceName,
|
|
@@ -4072,7 +4250,7 @@ async function createStateStore(options) {
|
|
|
4072
4250
|
}
|
|
4073
4251
|
if (config.provider === "s3") {
|
|
4074
4252
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
4075
|
-
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-
|
|
4253
|
+
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-6jqITH2F.cjs"));
|
|
4076
4254
|
const s3 = config;
|
|
4077
4255
|
return S3StateStore.create({
|
|
4078
4256
|
workspaceName,
|
|
@@ -6227,13 +6405,6 @@ var DokployApi = class {
|
|
|
6227
6405
|
const __filename$1 = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
|
|
6228
6406
|
const __dirname$1 = (0, node_path.dirname)(__filename$1);
|
|
6229
6407
|
/**
|
|
6230
|
-
* Resolve the tsx package path from the CLI package's dependencies.
|
|
6231
|
-
* This ensures tsx is available regardless of whether the target project has it installed.
|
|
6232
|
-
*/
|
|
6233
|
-
function resolveTsxPath() {
|
|
6234
|
-
return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve("tsx");
|
|
6235
|
-
}
|
|
6236
|
-
/**
|
|
6237
6408
|
* Resolve the path to a sniffer helper file.
|
|
6238
6409
|
* Handles both dev (.ts with tsx) and production (.mjs from dist).
|
|
6239
6410
|
*
|
|
@@ -6252,6 +6423,39 @@ function resolveSnifferFile(baseName) {
|
|
|
6252
6423
|
return tsPath;
|
|
6253
6424
|
}
|
|
6254
6425
|
/**
|
|
6426
|
+
* Run a sniffer worker in the sandbox, with the sandbox's environment and
|
|
6427
|
+
* nothing of the deploy's: the deploy's Dokploy token, registry login and AWS
|
|
6428
|
+
* keys stay where they are. A worker that outlives the timeout is killed, and
|
|
6429
|
+
* comes back as the error the caller reports.
|
|
6430
|
+
*/
|
|
6431
|
+
async function runSniffer(run, workspacePath, cwd, nodeArgs) {
|
|
6432
|
+
const sandbox = run.sandbox ?? require_discover.activeSandbox() ?? new LocalSandbox({ root: (0, node_path.resolve)(workspacePath) });
|
|
6433
|
+
try {
|
|
6434
|
+
const result = await sandbox.exec("node", nodeArgs, {
|
|
6435
|
+
cwd,
|
|
6436
|
+
env: { ...sandbox.env },
|
|
6437
|
+
timeoutMs: run.timeoutMs ?? 3e4,
|
|
6438
|
+
output: "capture"
|
|
6439
|
+
});
|
|
6440
|
+
return {
|
|
6441
|
+
stdout: result.stdout,
|
|
6442
|
+
stderr: result.stderr,
|
|
6443
|
+
code: result.exitCode
|
|
6444
|
+
};
|
|
6445
|
+
} catch (error) {
|
|
6446
|
+
return { error: error instanceof Error ? error : new Error(String(error)) };
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
/** The worker's JSON answer: the last object on stdout naming `envVars`. */
|
|
6450
|
+
function snifferAnswer(stdout) {
|
|
6451
|
+
try {
|
|
6452
|
+
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6453
|
+
return jsonMatch ? JSON.parse(jsonMatch[0]) : void 0;
|
|
6454
|
+
} catch {
|
|
6455
|
+
return;
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
/**
|
|
6255
6459
|
* Get required environment variables for an app.
|
|
6256
6460
|
*
|
|
6257
6461
|
* Detection strategy (in order):
|
|
@@ -6273,6 +6477,10 @@ function resolveSnifferFile(baseName) {
|
|
|
6273
6477
|
*/
|
|
6274
6478
|
async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
6275
6479
|
const { logWarnings = true, markOptional = false } = options;
|
|
6480
|
+
const run = {
|
|
6481
|
+
...options.sandbox ? { sandbox: options.sandbox } : {},
|
|
6482
|
+
...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}
|
|
6483
|
+
};
|
|
6276
6484
|
if (app.type === "web" || app.type === "mobile") {
|
|
6277
6485
|
const publicPrefix = require_workspace.getPublicEnvPrefix(app.framework);
|
|
6278
6486
|
const depVars = publicPrefix ? (app.dependencies ?? []).map((dep) => `${publicPrefix}${dep.toUpperCase()}_URL`) : [];
|
|
@@ -6283,7 +6491,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6283
6491
|
if (app.config.client) configPaths.push(app.config.client);
|
|
6284
6492
|
if (app.config.server) configPaths.push(app.config.server);
|
|
6285
6493
|
for (const configPath of configPaths) {
|
|
6286
|
-
const result = await sniffEntryFile(configPath, app.path, workspacePath);
|
|
6494
|
+
const result = await sniffEntryFile(configPath, app.path, workspacePath, run);
|
|
6287
6495
|
if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Config file "${configPath}" threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6288
6496
|
sniffedVars.push(...result.envVars);
|
|
6289
6497
|
sniffedOptional.push(...result.optionalEnvVars);
|
|
@@ -6302,7 +6510,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6302
6510
|
};
|
|
6303
6511
|
}
|
|
6304
6512
|
if (app.entry) {
|
|
6305
|
-
const result = await sniffEntryFile(app.entry, app.path, workspacePath);
|
|
6513
|
+
const result = await sniffEntryFile(app.entry, app.path, workspacePath, run);
|
|
6306
6514
|
if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Entry file threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6307
6515
|
return {
|
|
6308
6516
|
appName,
|
|
@@ -6311,7 +6519,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6311
6519
|
};
|
|
6312
6520
|
}
|
|
6313
6521
|
if (app.routes) {
|
|
6314
|
-
const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath);
|
|
6522
|
+
const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath, run);
|
|
6315
6523
|
if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Route sniffing threw error (env vars still captured): ${result.error.message}`);
|
|
6316
6524
|
return {
|
|
6317
6525
|
appName,
|
|
@@ -6320,7 +6528,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6320
6528
|
};
|
|
6321
6529
|
}
|
|
6322
6530
|
if (app.envParser) {
|
|
6323
|
-
const result = await sniffEnvParser(app.envParser, app.path, workspacePath);
|
|
6531
|
+
const result = await sniffEnvParser(app.envParser, app.path, workspacePath, run);
|
|
6324
6532
|
if (logWarnings) {
|
|
6325
6533
|
if (result.error) require_discover.output.warn(`[sniffer] ${appName}: envParser threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6326
6534
|
if (result.unhandledRejections.length > 0) require_discover.output.warn(`[sniffer] ${appName}: Fire-and-forget rejections during sniffing (suppressed): ${result.unhandledRejections.map((e) => e.message).join(", ")}`);
|
|
@@ -6365,63 +6573,27 @@ function applyMarkOptional(envVars, optionalEnvVars, markOptional) {
|
|
|
6365
6573
|
* @param workspacePath - Absolute path to workspace root
|
|
6366
6574
|
* @returns EntrySniffResult with env vars and optional error
|
|
6367
6575
|
*/
|
|
6368
|
-
async function sniffEntryFile(entryPath, appPath, workspacePath) {
|
|
6576
|
+
async function sniffEntryFile(entryPath, appPath, workspacePath, run = {}) {
|
|
6369
6577
|
const fullEntryPath = (0, node_path.resolve)(workspacePath, appPath, entryPath);
|
|
6370
6578
|
const loaderPath = resolveSnifferFile("sniffer-loader");
|
|
6371
6579
|
const workerPath = resolveSnifferFile("sniffer-worker");
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
});
|
|
6390
|
-
let stdout = "";
|
|
6391
|
-
let stderr = "";
|
|
6392
|
-
child.stdout.on("data", (data) => {
|
|
6393
|
-
stdout += data.toString();
|
|
6394
|
-
});
|
|
6395
|
-
child.stderr.on("data", (data) => {
|
|
6396
|
-
stderr += data.toString();
|
|
6397
|
-
});
|
|
6398
|
-
child.on("close", (code) => {
|
|
6399
|
-
try {
|
|
6400
|
-
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6401
|
-
if (jsonMatch) {
|
|
6402
|
-
const result = JSON.parse(jsonMatch[0]);
|
|
6403
|
-
resolvePromise({
|
|
6404
|
-
envVars: result.envVars || [],
|
|
6405
|
-
optionalEnvVars: result.optionalEnvVars || [],
|
|
6406
|
-
error: result.error ? new Error(result.error) : void 0
|
|
6407
|
-
});
|
|
6408
|
-
return;
|
|
6409
|
-
}
|
|
6410
|
-
} catch {}
|
|
6411
|
-
resolvePromise({
|
|
6412
|
-
envVars: [],
|
|
6413
|
-
optionalEnvVars: [],
|
|
6414
|
-
error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${code}): ${stderr || stdout || "No output"}`)
|
|
6415
|
-
});
|
|
6416
|
-
});
|
|
6417
|
-
child.on("error", (err) => {
|
|
6418
|
-
resolvePromise({
|
|
6419
|
-
envVars: [],
|
|
6420
|
-
optionalEnvVars: [],
|
|
6421
|
-
error: err
|
|
6422
|
-
});
|
|
6423
|
-
});
|
|
6424
|
-
});
|
|
6580
|
+
const ran = await runSniffer(run, workspacePath, (0, node_path.resolve)(workspacePath, appPath), require_discover.nodeWithTsx(workerPath, [fullEntryPath], [loaderPath]));
|
|
6581
|
+
if ("error" in ran) return {
|
|
6582
|
+
envVars: [],
|
|
6583
|
+
optionalEnvVars: [],
|
|
6584
|
+
error: ran.error
|
|
6585
|
+
};
|
|
6586
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6587
|
+
if (answer) return {
|
|
6588
|
+
envVars: answer.envVars || [],
|
|
6589
|
+
optionalEnvVars: answer.optionalEnvVars || [],
|
|
6590
|
+
error: answer.error ? new Error(answer.error) : void 0
|
|
6591
|
+
};
|
|
6592
|
+
return {
|
|
6593
|
+
envVars: [],
|
|
6594
|
+
optionalEnvVars: [],
|
|
6595
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6596
|
+
};
|
|
6425
6597
|
}
|
|
6426
6598
|
/**
|
|
6427
6599
|
* Sniff route files by loading constructs and calling getEnvironment().
|
|
@@ -6437,116 +6609,79 @@ async function sniffEntryFile(entryPath, appPath, workspacePath) {
|
|
|
6437
6609
|
* @param workspacePath - Absolute path to workspace root
|
|
6438
6610
|
* @returns EntrySniffResult with env vars and optional error
|
|
6439
6611
|
*/
|
|
6440
|
-
async function sniffRouteFiles(routes, appPath, workspacePath) {
|
|
6612
|
+
async function sniffRouteFiles(routes, appPath, workspacePath, run = {}) {
|
|
6441
6613
|
const fullAppPath = (0, node_path.resolve)(workspacePath, appPath);
|
|
6442
6614
|
const workerPath = resolveSnifferFile("sniffer-routes-worker");
|
|
6443
|
-
const tsxPath = resolveTsxPath();
|
|
6444
6615
|
const pattern = (Array.isArray(routes) ? routes : [routes])[0];
|
|
6445
6616
|
if (!pattern) return {
|
|
6446
6617
|
envVars: [],
|
|
6447
6618
|
optionalEnvVars: [],
|
|
6448
6619
|
error: /* @__PURE__ */ new Error("No route patterns provided")
|
|
6449
6620
|
};
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
child.stdout.on("data", (data) => {
|
|
6469
|
-
stdout += data.toString();
|
|
6470
|
-
});
|
|
6471
|
-
child.stderr.on("data", (data) => {
|
|
6472
|
-
stderr += data.toString();
|
|
6473
|
-
});
|
|
6474
|
-
child.on("close", (code) => {
|
|
6475
|
-
if (stderr) stderr.split("\n").filter((line) => line.trim()).forEach((line) => require_discover.output.warn(line));
|
|
6476
|
-
try {
|
|
6477
|
-
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6478
|
-
if (jsonMatch) {
|
|
6479
|
-
const result = JSON.parse(jsonMatch[0]);
|
|
6480
|
-
resolvePromise({
|
|
6481
|
-
envVars: result.envVars || [],
|
|
6482
|
-
optionalEnvVars: result.optionalEnvVars || [],
|
|
6483
|
-
error: result.error ? new Error(result.error) : void 0
|
|
6484
|
-
});
|
|
6485
|
-
return;
|
|
6486
|
-
}
|
|
6487
|
-
} catch {}
|
|
6488
|
-
resolvePromise({
|
|
6489
|
-
envVars: [],
|
|
6490
|
-
optionalEnvVars: [],
|
|
6491
|
-
error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${code}): ${stderr || stdout || "No output"}`)
|
|
6492
|
-
});
|
|
6493
|
-
});
|
|
6494
|
-
child.on("error", (err) => {
|
|
6495
|
-
resolvePromise({
|
|
6496
|
-
envVars: [],
|
|
6497
|
-
optionalEnvVars: [],
|
|
6498
|
-
error: err
|
|
6499
|
-
});
|
|
6500
|
-
});
|
|
6501
|
-
});
|
|
6621
|
+
const ran = await runSniffer(run, workspacePath, fullAppPath, require_discover.nodeWithTsx(workerPath, [fullAppPath, pattern]));
|
|
6622
|
+
if ("error" in ran) return {
|
|
6623
|
+
envVars: [],
|
|
6624
|
+
optionalEnvVars: [],
|
|
6625
|
+
error: ran.error
|
|
6626
|
+
};
|
|
6627
|
+
if (ran.stderr) ran.stderr.split("\n").filter((line) => line.trim()).forEach((line) => require_discover.output.warn(line));
|
|
6628
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6629
|
+
if (answer) return {
|
|
6630
|
+
envVars: answer.envVars || [],
|
|
6631
|
+
optionalEnvVars: answer.optionalEnvVars || [],
|
|
6632
|
+
error: answer.error ? new Error(answer.error) : void 0
|
|
6633
|
+
};
|
|
6634
|
+
return {
|
|
6635
|
+
envVars: [],
|
|
6636
|
+
optionalEnvVars: [],
|
|
6637
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6638
|
+
};
|
|
6502
6639
|
}
|
|
6503
6640
|
/**
|
|
6504
6641
|
* Run the SnifferEnvironmentParser on an envParser module to detect
|
|
6505
6642
|
* which environment variables it accesses.
|
|
6506
6643
|
*
|
|
6507
|
-
*
|
|
6508
|
-
* the
|
|
6644
|
+
* In a subprocess, like the entry and route sniffers: the module is the
|
|
6645
|
+
* project's code, and it was imported into the deploy itself before — with
|
|
6646
|
+
* every credential the deploy held in reach. Fire-and-forget rejections are
|
|
6647
|
+
* collected there with the shared `sniffWithFireAndForget`.
|
|
6509
6648
|
*
|
|
6510
6649
|
* @param envParserPath - The envParser config (e.g., './src/config/env#envParser')
|
|
6511
6650
|
* @param appPath - The app's path relative to workspace
|
|
6512
6651
|
* @param workspacePath - Absolute path to workspace root
|
|
6513
6652
|
* @returns SniffResult with env vars and any errors encountered
|
|
6514
6653
|
*/
|
|
6515
|
-
async function sniffEnvParser(envParserPath, appPath, workspacePath) {
|
|
6654
|
+
async function sniffEnvParser(envParserPath, appPath, workspacePath, run = {}) {
|
|
6516
6655
|
const [modulePath, exportName = "default"] = envParserPath.split("#");
|
|
6517
6656
|
if (!modulePath) return {
|
|
6518
6657
|
envVars: [],
|
|
6519
6658
|
optionalEnvVars: [],
|
|
6520
6659
|
unhandledRejections: []
|
|
6521
6660
|
};
|
|
6522
|
-
const
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
}
|
|
6545
|
-
|
|
6546
|
-
if (result && typeof result.parse === "function") try {
|
|
6547
|
-
result.parse();
|
|
6548
|
-
} catch {}
|
|
6549
|
-
});
|
|
6661
|
+
const appRoot = (0, node_path.resolve)(workspacePath, appPath);
|
|
6662
|
+
const fullPath = (0, node_path.resolve)(appRoot, modulePath);
|
|
6663
|
+
const workerPath = resolveSnifferFile("sniffer-envparser-worker");
|
|
6664
|
+
const ran = await runSniffer(run, workspacePath, appRoot, require_discover.nodeWithTsx(workerPath, [fullPath, exportName]));
|
|
6665
|
+
if ("error" in ran) return {
|
|
6666
|
+
envVars: [],
|
|
6667
|
+
optionalEnvVars: [],
|
|
6668
|
+
unhandledRejections: [],
|
|
6669
|
+
error: ran.error
|
|
6670
|
+
};
|
|
6671
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6672
|
+
if (!answer) return {
|
|
6673
|
+
envVars: [],
|
|
6674
|
+
optionalEnvVars: [],
|
|
6675
|
+
unhandledRejections: [],
|
|
6676
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff envParser (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6677
|
+
};
|
|
6678
|
+
for (const warning of answer.warnings ?? []) require_discover.output.warn(warning);
|
|
6679
|
+
return {
|
|
6680
|
+
envVars: answer.envVars ?? [],
|
|
6681
|
+
optionalEnvVars: answer.optionalEnvVars ?? [],
|
|
6682
|
+
unhandledRejections: (answer.unhandledRejections ?? []).map((message) => new Error(message)),
|
|
6683
|
+
...answer.error ? { error: new Error(answer.error) } : {}
|
|
6684
|
+
};
|
|
6550
6685
|
}
|
|
6551
6686
|
/**
|
|
6552
6687
|
* Sniff environment requirements for multiple apps.
|
|
@@ -6565,12 +6700,30 @@ async function sniffAllApps(apps, workspacePath, options = {}) {
|
|
|
6565
6700
|
return results;
|
|
6566
6701
|
}
|
|
6567
6702
|
//#endregion
|
|
6703
|
+
Object.defineProperty(exports, "CommandFailed", {
|
|
6704
|
+
enumerable: true,
|
|
6705
|
+
get: function() {
|
|
6706
|
+
return CommandFailed;
|
|
6707
|
+
}
|
|
6708
|
+
});
|
|
6709
|
+
Object.defineProperty(exports, "CommandTimedOut", {
|
|
6710
|
+
enumerable: true,
|
|
6711
|
+
get: function() {
|
|
6712
|
+
return CommandTimedOut;
|
|
6713
|
+
}
|
|
6714
|
+
});
|
|
6568
6715
|
Object.defineProperty(exports, "DEFAULT_IMAGES", {
|
|
6569
6716
|
enumerable: true,
|
|
6570
6717
|
get: function() {
|
|
6571
6718
|
return DEFAULT_IMAGES;
|
|
6572
6719
|
}
|
|
6573
6720
|
});
|
|
6721
|
+
Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", {
|
|
6722
|
+
enumerable: true,
|
|
6723
|
+
get: function() {
|
|
6724
|
+
return DEFAULT_TIMEOUT_MS;
|
|
6725
|
+
}
|
|
6726
|
+
});
|
|
6574
6727
|
Object.defineProperty(exports, "DockerBuildFailed", {
|
|
6575
6728
|
enumerable: true,
|
|
6576
6729
|
get: function() {
|
|
@@ -6613,6 +6766,18 @@ Object.defineProperty(exports, "LOCAL_CA_PATH", {
|
|
|
6613
6766
|
return LOCAL_CA_PATH;
|
|
6614
6767
|
}
|
|
6615
6768
|
});
|
|
6769
|
+
Object.defineProperty(exports, "LocalSandbox", {
|
|
6770
|
+
enumerable: true,
|
|
6771
|
+
get: function() {
|
|
6772
|
+
return LocalSandbox;
|
|
6773
|
+
}
|
|
6774
|
+
});
|
|
6775
|
+
Object.defineProperty(exports, "SANDBOX_ENV_ALLOWLIST", {
|
|
6776
|
+
enumerable: true,
|
|
6777
|
+
get: function() {
|
|
6778
|
+
return SANDBOX_ENV_ALLOWLIST;
|
|
6779
|
+
}
|
|
6780
|
+
});
|
|
6616
6781
|
Object.defineProperty(exports, "StageStateMissing", {
|
|
6617
6782
|
enumerable: true,
|
|
6618
6783
|
get: function() {
|
|
@@ -6643,6 +6808,12 @@ Object.defineProperty(exports, "StateVersionConflict", {
|
|
|
6643
6808
|
return StateVersionConflict;
|
|
6644
6809
|
}
|
|
6645
6810
|
});
|
|
6811
|
+
Object.defineProperty(exports, "allowlistedEnv", {
|
|
6812
|
+
enumerable: true,
|
|
6813
|
+
get: function() {
|
|
6814
|
+
return allowlistedEnv;
|
|
6815
|
+
}
|
|
6816
|
+
});
|
|
6646
6817
|
Object.defineProperty(exports, "appEnvKeys", {
|
|
6647
6818
|
enumerable: true,
|
|
6648
6819
|
get: function() {
|
|
@@ -7099,12 +7270,6 @@ Object.defineProperty(exports, "withGeneratedSecrets", {
|
|
|
7099
7270
|
return withGeneratedSecrets;
|
|
7100
7271
|
}
|
|
7101
7272
|
});
|
|
7102
|
-
Object.defineProperty(exports, "withOwningTsconfigJsx", {
|
|
7103
|
-
enumerable: true,
|
|
7104
|
-
get: function() {
|
|
7105
|
-
return withOwningTsconfigJsx;
|
|
7106
|
-
}
|
|
7107
|
-
});
|
|
7108
7273
|
Object.defineProperty(exports, "workspace_exports", {
|
|
7109
7274
|
enumerable: true,
|
|
7110
7275
|
get: function() {
|
|
@@ -7112,4 +7277,4 @@ Object.defineProperty(exports, "workspace_exports", {
|
|
|
7112
7277
|
}
|
|
7113
7278
|
});
|
|
7114
7279
|
|
|
7115
|
-
//# sourceMappingURL=sniffer-
|
|
7280
|
+
//# sourceMappingURL=sniffer-D_SYc_pO.cjs.map
|