@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,25 +1,25 @@
|
|
|
1
1
|
import { n as __require, t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { n as gkmHome } from "./home-GI7pJl1M.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { E as TEST_STAGE, p as getPublicEnvPrefix, t as allConstructGlobs } from "./workspace-
|
|
3
|
+
import { h as confineCwd, m as assertSecretNames, p as activeSandbox, r as discover, s as nodeWithTsx, u as SECRETS_DIR_ENV, v as output } from "./discover-BaT6bpnA.mjs";
|
|
4
|
+
import { d as loadConfig, f as loadWorkspaceAppInfo, g as appKey, o as NotInAnApp, p as loadWorkspaceConfig, r as ConfigNotFound } from "./config-LKKCVCnC.mjs";
|
|
5
|
+
import { E as TEST_STAGE, p as getPublicEnvPrefix, t as allConstructGlobs } from "./workspace-Dh7rr7l4.mjs";
|
|
6
6
|
import { i as toEmbeddableSecrets } from "./storage-BzaUxmqe.mjs";
|
|
7
7
|
import { i as FileSecretsStore, n as secretsStoreFor } from "./store-BS8A7NcA.mjs";
|
|
8
|
+
import { r as runtimeOf } from "./runtime-DbakJS8u.mjs";
|
|
8
9
|
import { i as DEFAULT_STORAGE, n as DEFAULT_CACHE, r as DEFAULT_EVENTS$1, t as readFakes } from "./fakes-C9RiT6XG.mjs";
|
|
9
|
-
import { createRequire } from "node:module";
|
|
10
10
|
import { basename, dirname, join, parse, resolve } from "node:path";
|
|
11
11
|
import { stdin, stdout } from "node:process";
|
|
12
12
|
import * as readline from "node:readline/promises";
|
|
13
13
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, unlinkSync } from "node:fs";
|
|
14
|
-
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
15
|
-
import { hostname, networkInterfaces, userInfo } from "node:os";
|
|
14
|
+
import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
15
|
+
import { hostname, networkInterfaces, tmpdir, userInfo } from "node:os";
|
|
16
16
|
import { promisify } from "node:util";
|
|
17
17
|
import { DEFAULT_POSTGRES_VERSION, cacheTable, cookieDomain, dependenciesOf, dependentsOf, externalApiUrl, kebabCase, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase } from "@geekmidas/manifest";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
18
19
|
import { execFile, spawn } from "node:child_process";
|
|
19
20
|
import { createServer } from "node:net";
|
|
20
21
|
import { config } from "dotenv";
|
|
21
22
|
import { createCipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
|
|
22
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
23
23
|
import { formatKeyring, generateKeyring } from "@geekmidas/constructs/encryption";
|
|
24
24
|
import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
|
|
25
25
|
import * as snsUrl from "@geekmidas/events/sns/url";
|
|
@@ -584,45 +584,6 @@ function normalizeRoutes(routes) {
|
|
|
584
584
|
return Array.isArray(routes) ? routes : [routes];
|
|
585
585
|
}
|
|
586
586
|
//#endregion
|
|
587
|
-
//#region src/owningTsconfigJsx.ts
|
|
588
|
-
const REGISTER = "owning-tsconfig-jsx-register.mjs";
|
|
589
|
-
/** The CLI's `bin/` was not found above the module looking for it. */
|
|
590
|
-
var OwningTsconfigJsxHookMissing = class extends Error {
|
|
591
|
-
from;
|
|
592
|
-
constructor(from) {
|
|
593
|
-
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.`);
|
|
594
|
-
this.from = from;
|
|
595
|
-
this.name = "OwningTsconfigJsxHookMissing";
|
|
596
|
-
}
|
|
597
|
-
};
|
|
598
|
-
/**
|
|
599
|
-
* The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
|
|
600
|
-
* upward because this module runs from `src/` in the repo and from a chunk in
|
|
601
|
-
* `dist/` once built, and `bin/` sits beside both.
|
|
602
|
-
*/
|
|
603
|
-
function registerUrl() {
|
|
604
|
-
const from = dirname(fileURLToPath(import.meta.url));
|
|
605
|
-
for (let dir = from;; dir = dirname(dir)) {
|
|
606
|
-
const candidate = join(dir, "bin", REGISTER);
|
|
607
|
-
if (existsSync(candidate)) return pathToFileURL(candidate).href;
|
|
608
|
-
if (dirname(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
/**
|
|
612
|
-
* `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
|
|
613
|
-
* that compiles each `.tsx` with its own tsconfig's JSX settings (see
|
|
614
|
-
* `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
|
|
615
|
-
* is registered before tsx and reads the source on tsx's behalf.
|
|
616
|
-
*
|
|
617
|
-
* `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
|
|
618
|
-
* this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
|
|
619
|
-
* started with tsx already imported.
|
|
620
|
-
*/
|
|
621
|
-
function withOwningTsconfigJsx(nodeOptions = "") {
|
|
622
|
-
if (nodeOptions.includes(REGISTER)) return nodeOptions;
|
|
623
|
-
return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
|
|
624
|
-
}
|
|
625
|
-
//#endregion
|
|
626
587
|
//#region src/reconcile/containers.ts
|
|
627
588
|
/**
|
|
628
589
|
* What gkm knows about each container it can derive.
|
|
@@ -818,17 +779,19 @@ function volumeOf(container) {
|
|
|
818
779
|
* Which family of defaults a workspace's deploy target belongs to.
|
|
819
780
|
*
|
|
820
781
|
* One question, asked once: **does this target run containers the project
|
|
821
|
-
* controls?** Dokploy
|
|
822
|
-
*
|
|
823
|
-
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
782
|
+
* controls?** Dokploy does, so a bucket or a cache can live beside the app;
|
|
783
|
+
* AWS, Vercel and Cloudflare do not, so the default has to be something
|
|
784
|
+
* managed. That is the whole of the distinction, and it is why `MainProvider`
|
|
785
|
+
* is the right axis rather than the deploy target's own name — targets share
|
|
786
|
+
* answers.
|
|
826
787
|
*
|
|
827
|
-
*
|
|
788
|
+
* Each target declares its answer as its `runtime` — a target package in its
|
|
789
|
+
* `package.json`, so this never loads one. A workspace that names no target
|
|
790
|
+
* is on AWS: an SST project predates `deploy.default: 'sst'`.
|
|
828
791
|
*/
|
|
829
792
|
function providerOf(workspace) {
|
|
830
793
|
const target = workspace.deploy?.default;
|
|
831
|
-
return target
|
|
794
|
+
return target ? runtimeOf(target, workspace) : "aws";
|
|
832
795
|
}
|
|
833
796
|
/**
|
|
834
797
|
* The cache backend a target implies.
|
|
@@ -3530,7 +3493,7 @@ function localAddress(port) {
|
|
|
3530
3493
|
/** Long enough for a cold image build; short enough that a hung one ends. */
|
|
3531
3494
|
const DEFAULT_TIMEOUT_MS = 18e5;
|
|
3532
3495
|
/** How long a timed-out child has to exit on SIGTERM before it is killed. */
|
|
3533
|
-
const KILL_GRACE_MS = 5e3;
|
|
3496
|
+
const KILL_GRACE_MS$1 = 5e3;
|
|
3534
3497
|
/** The command line as a person would read it — for messages, never to run. */
|
|
3535
3498
|
function display(command, args) {
|
|
3536
3499
|
return [command, ...args].join(" ");
|
|
@@ -3603,7 +3566,7 @@ function spawnChild(command, args, options, capture) {
|
|
|
3603
3566
|
const timer = setTimeout(() => {
|
|
3604
3567
|
timedOut = true;
|
|
3605
3568
|
child.kill("SIGTERM");
|
|
3606
|
-
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
3569
|
+
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS$1);
|
|
3607
3570
|
killer.unref?.();
|
|
3608
3571
|
}, timeoutMs);
|
|
3609
3572
|
timer.unref?.();
|
|
@@ -3625,6 +3588,221 @@ function spawnChild(command, args, options, capture) {
|
|
|
3625
3588
|
});
|
|
3626
3589
|
}
|
|
3627
3590
|
//#endregion
|
|
3591
|
+
//#region src/sandbox/env.ts
|
|
3592
|
+
/**
|
|
3593
|
+
* What of the host's environment a local sandbox passes on.
|
|
3594
|
+
*
|
|
3595
|
+
* An allowlist, not a denylist: a credential's variable has any name its
|
|
3596
|
+
* owner chose (`DOKPLOY_TOKEN`, `AWS_SECRET_ACCESS_KEY`, `MY_VAULT_TOKEN`), so
|
|
3597
|
+
* the only safe default is to name what a program needs to *run* and pass
|
|
3598
|
+
* nothing else.
|
|
3599
|
+
*/
|
|
3600
|
+
/**
|
|
3601
|
+
* Variables a command needs to find programs, write temp files, print in the
|
|
3602
|
+
* user's locale and reach the network through the host's proxy — and nothing
|
|
3603
|
+
* that authenticates as anyone.
|
|
3604
|
+
*
|
|
3605
|
+
* Deliberately left out:
|
|
3606
|
+
* - `NODE_OPTIONS`: it can `--require` or `--import` code into every node
|
|
3607
|
+
* process, and CI often holds `--import tsx` there. A step that needs a
|
|
3608
|
+
* loader passes its own.
|
|
3609
|
+
* - `NODE_AUTH_TOKEN`, `NPM_TOKEN`, `npm_config_*`: registry tokens
|
|
3610
|
+
* (`actions/setup-node` writes `NODE_AUTH_TOKEN`), which is why there is no
|
|
3611
|
+
* `NODE_*` wildcard.
|
|
3612
|
+
* - `AWS_*`, `DOCKER_*`, `DOKPLOY_*`, `GITHUB_TOKEN`, `TURBO_TOKEN`, `GKM_*`:
|
|
3613
|
+
* credentials, or where the deploy keeps them.
|
|
3614
|
+
* - `SHELL`, `EDITOR` and the rest of a login session: nothing here starts a
|
|
3615
|
+
* shell.
|
|
3616
|
+
*
|
|
3617
|
+
* Proxies are passed: behind one, nothing installs or builds without it. A
|
|
3618
|
+
* proxy URL with a password in it reaches the command too — a host that keeps
|
|
3619
|
+
* one there and builds code it does not trust should pass a sandbox of its
|
|
3620
|
+
* own.
|
|
3621
|
+
*/
|
|
3622
|
+
const SANDBOX_ENV_ALLOWLIST = [
|
|
3623
|
+
"PATH",
|
|
3624
|
+
"HOME",
|
|
3625
|
+
"USER",
|
|
3626
|
+
"LOGNAME",
|
|
3627
|
+
"TMPDIR",
|
|
3628
|
+
"TMP",
|
|
3629
|
+
"TEMP",
|
|
3630
|
+
"LANG",
|
|
3631
|
+
"LANGUAGE",
|
|
3632
|
+
"TZ",
|
|
3633
|
+
/^LC_[A-Z]+$/,
|
|
3634
|
+
"TERM",
|
|
3635
|
+
"COLORTERM",
|
|
3636
|
+
"NO_COLOR",
|
|
3637
|
+
"FORCE_COLOR",
|
|
3638
|
+
"CI",
|
|
3639
|
+
"NODE_ENV",
|
|
3640
|
+
"NODE_EXTRA_CA_CERTS",
|
|
3641
|
+
"COREPACK_HOME",
|
|
3642
|
+
"PNPM_HOME",
|
|
3643
|
+
"XDG_CACHE_HOME",
|
|
3644
|
+
"XDG_DATA_HOME",
|
|
3645
|
+
"HTTP_PROXY",
|
|
3646
|
+
"HTTPS_PROXY",
|
|
3647
|
+
"NO_PROXY",
|
|
3648
|
+
"http_proxy",
|
|
3649
|
+
"https_proxy",
|
|
3650
|
+
"no_proxy",
|
|
3651
|
+
"SystemRoot",
|
|
3652
|
+
"SYSTEMROOT",
|
|
3653
|
+
"windir",
|
|
3654
|
+
"WINDIR",
|
|
3655
|
+
"ComSpec",
|
|
3656
|
+
"COMSPEC",
|
|
3657
|
+
"PATHEXT",
|
|
3658
|
+
"USERPROFILE",
|
|
3659
|
+
"APPDATA",
|
|
3660
|
+
"LOCALAPPDATA"
|
|
3661
|
+
];
|
|
3662
|
+
function allowed(name) {
|
|
3663
|
+
return SANDBOX_ENV_ALLOWLIST.some((entry) => typeof entry === "string" ? entry === name : entry.test(name));
|
|
3664
|
+
}
|
|
3665
|
+
/**
|
|
3666
|
+
* The allowlisted part of `source`, plus each of `extra` the host chose to
|
|
3667
|
+
* pass on by name.
|
|
3668
|
+
*/
|
|
3669
|
+
function allowlistedEnv(source = process.env, extra = []) {
|
|
3670
|
+
const env = {};
|
|
3671
|
+
for (const [name, value] of Object.entries(source)) {
|
|
3672
|
+
if (value === void 0) continue;
|
|
3673
|
+
if (allowed(name) || extra.includes(name)) env[name] = value;
|
|
3674
|
+
}
|
|
3675
|
+
return env;
|
|
3676
|
+
}
|
|
3677
|
+
//#endregion
|
|
3678
|
+
//#region src/sandbox/local.ts
|
|
3679
|
+
/** How long a timed-out command has to exit on SIGTERM before SIGKILL. */
|
|
3680
|
+
const KILL_GRACE_MS = 5e3;
|
|
3681
|
+
/** Where `output` sends a child's streams. */
|
|
3682
|
+
const STDIO = {
|
|
3683
|
+
capture: [
|
|
3684
|
+
"ignore",
|
|
3685
|
+
"pipe",
|
|
3686
|
+
"pipe"
|
|
3687
|
+
],
|
|
3688
|
+
inherit: "inherit",
|
|
3689
|
+
stderr: [
|
|
3690
|
+
"ignore",
|
|
3691
|
+
2,
|
|
3692
|
+
2
|
|
3693
|
+
],
|
|
3694
|
+
ignore: "ignore"
|
|
3695
|
+
};
|
|
3696
|
+
/**
|
|
3697
|
+
* A child process on this machine, as this user, with an allowlisted
|
|
3698
|
+
* environment.
|
|
3699
|
+
*
|
|
3700
|
+
* What it withholds from the command: the host's environment beyond
|
|
3701
|
+
* {@link SANDBOX_ENV_ALLOWLIST}, a shell, a working directory outside the
|
|
3702
|
+
* project, and any time past the timeout. What it does not: the host's
|
|
3703
|
+
* filesystem, which the command can read and write as the user running the
|
|
3704
|
+
* deploy. So it is not `isolating`, and it is the default for projects the
|
|
3705
|
+
* host already trusts — the developer's own, a team's own CI. Code nobody
|
|
3706
|
+
* vetted belongs in a sandbox that is.
|
|
3707
|
+
*
|
|
3708
|
+
* A timed-out command is sent SIGTERM, then SIGKILL; processes it started
|
|
3709
|
+
* itself are its to stop.
|
|
3710
|
+
*/
|
|
3711
|
+
var LocalSandbox = class {
|
|
3712
|
+
root;
|
|
3713
|
+
isolating = false;
|
|
3714
|
+
env;
|
|
3715
|
+
constructor(options) {
|
|
3716
|
+
this.root = resolve(options.root);
|
|
3717
|
+
this.env = {
|
|
3718
|
+
...allowlistedEnv(options.hostEnv ?? process.env, options.passEnv),
|
|
3719
|
+
...options.home ? {
|
|
3720
|
+
HOME: options.home,
|
|
3721
|
+
USERPROFILE: options.home
|
|
3722
|
+
} : {}
|
|
3723
|
+
};
|
|
3724
|
+
}
|
|
3725
|
+
async exec(command, args, options) {
|
|
3726
|
+
const cwd = confineCwd(this.root, options.cwd);
|
|
3727
|
+
assertSecretNames(options.secrets);
|
|
3728
|
+
options.signal?.throwIfAborted();
|
|
3729
|
+
const secretsDir = await mountSecrets(options.secrets);
|
|
3730
|
+
try {
|
|
3731
|
+
return await spawnConfined(command, args, {
|
|
3732
|
+
...options,
|
|
3733
|
+
cwd,
|
|
3734
|
+
env: secretsDir ? {
|
|
3735
|
+
...options.env,
|
|
3736
|
+
[SECRETS_DIR_ENV]: secretsDir
|
|
3737
|
+
} : options.env
|
|
3738
|
+
});
|
|
3739
|
+
} finally {
|
|
3740
|
+
if (secretsDir) await rm(secretsDir, {
|
|
3741
|
+
recursive: true,
|
|
3742
|
+
force: true
|
|
3743
|
+
});
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3747
|
+
/**
|
|
3748
|
+
* Each secret as a 0600 file in a fresh 0700 directory outside the project —
|
|
3749
|
+
* where nothing the build writes, packs or commits will pick it up.
|
|
3750
|
+
*/
|
|
3751
|
+
async function mountSecrets(secrets) {
|
|
3752
|
+
if (!secrets || Object.keys(secrets).length === 0) return void 0;
|
|
3753
|
+
const dir = await mkdtemp(join(tmpdir(), "gkm-secrets-"));
|
|
3754
|
+
for (const [name, value] of Object.entries(secrets)) await writeFile(join(dir, name), value, { mode: 384 });
|
|
3755
|
+
return dir;
|
|
3756
|
+
}
|
|
3757
|
+
function spawnConfined(command, args, options) {
|
|
3758
|
+
const { output = "capture", signal, timeoutMs } = options;
|
|
3759
|
+
return new Promise((resolvePromise, reject) => {
|
|
3760
|
+
const child = spawn(command, [...args], {
|
|
3761
|
+
cwd: options.cwd,
|
|
3762
|
+
env: { ...options.env },
|
|
3763
|
+
stdio: STDIO[output],
|
|
3764
|
+
shell: false,
|
|
3765
|
+
...signal ? { signal } : {}
|
|
3766
|
+
});
|
|
3767
|
+
let stdout = "";
|
|
3768
|
+
let stderr = "";
|
|
3769
|
+
child.stdout?.on("data", (chunk) => {
|
|
3770
|
+
stdout += chunk.toString();
|
|
3771
|
+
});
|
|
3772
|
+
child.stderr?.on("data", (chunk) => {
|
|
3773
|
+
stderr += chunk.toString();
|
|
3774
|
+
});
|
|
3775
|
+
let timedOut = false;
|
|
3776
|
+
let killer;
|
|
3777
|
+
const timer = setTimeout(() => {
|
|
3778
|
+
timedOut = true;
|
|
3779
|
+
child.kill("SIGTERM");
|
|
3780
|
+
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
3781
|
+
killer.unref?.();
|
|
3782
|
+
}, timeoutMs);
|
|
3783
|
+
timer.unref?.();
|
|
3784
|
+
const settle = () => {
|
|
3785
|
+
clearTimeout(timer);
|
|
3786
|
+
if (killer) clearTimeout(killer);
|
|
3787
|
+
};
|
|
3788
|
+
child.on("error", (error) => {
|
|
3789
|
+
settle();
|
|
3790
|
+
reject(signal?.aborted ? signal.reason : error);
|
|
3791
|
+
});
|
|
3792
|
+
child.on("close", (code, killedBy) => {
|
|
3793
|
+
settle();
|
|
3794
|
+
if (signal?.aborted) reject(signal.reason);
|
|
3795
|
+
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
3796
|
+
else resolvePromise({
|
|
3797
|
+
exitCode: code,
|
|
3798
|
+
signal: killedBy ?? null,
|
|
3799
|
+
stdout,
|
|
3800
|
+
stderr
|
|
3801
|
+
});
|
|
3802
|
+
});
|
|
3803
|
+
});
|
|
3804
|
+
}
|
|
3805
|
+
//#endregion
|
|
3628
3806
|
//#region src/secrets/encryption.ts
|
|
3629
3807
|
var encryption_exports = /* @__PURE__ */ __exportAll({
|
|
3630
3808
|
encryptSecrets: () => encryptSecrets,
|
|
@@ -4049,17 +4227,17 @@ function isStateStore(value) {
|
|
|
4049
4227
|
async function createStateStore(options) {
|
|
4050
4228
|
const { config, workspaceRoot, workspaceName } = options;
|
|
4051
4229
|
if (!config || config.provider === "local") {
|
|
4052
|
-
const { LocalStateStore } = await import("./LocalStateStore-
|
|
4230
|
+
const { LocalStateStore } = await import("./LocalStateStore-BGIXcrvX.mjs").then((n) => n.n);
|
|
4053
4231
|
return new LocalStateStore(workspaceRoot);
|
|
4054
4232
|
}
|
|
4055
4233
|
if (isStateStore(config.provider)) return config.provider;
|
|
4056
4234
|
if (isStateProvider(config.provider)) {
|
|
4057
|
-
const { LegacyStateStore } = await import("./LegacyStateStore-
|
|
4235
|
+
const { LegacyStateStore } = await import("./LegacyStateStore-Q3GmKOdw.mjs");
|
|
4058
4236
|
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
4059
4237
|
}
|
|
4060
4238
|
if (config.provider === "ssm") {
|
|
4061
4239
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
4062
|
-
const { SSMStateStore } = await import("./SSMStateStore-
|
|
4240
|
+
const { SSMStateStore } = await import("./SSMStateStore-CAQDVpoc.mjs");
|
|
4063
4241
|
const ssm = config;
|
|
4064
4242
|
return SSMStateStore.create({
|
|
4065
4243
|
workspaceName,
|
|
@@ -4069,7 +4247,7 @@ async function createStateStore(options) {
|
|
|
4069
4247
|
}
|
|
4070
4248
|
if (config.provider === "s3") {
|
|
4071
4249
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
4072
|
-
const { S3StateStore } = await import("./S3StateStore-
|
|
4250
|
+
const { S3StateStore } = await import("./S3StateStore-D7l_lWJ3.mjs");
|
|
4073
4251
|
const s3 = config;
|
|
4074
4252
|
return S3StateStore.create({
|
|
4075
4253
|
workspaceName,
|
|
@@ -6218,13 +6396,6 @@ var DokployApi = class {
|
|
|
6218
6396
|
const __filename = fileURLToPath(import.meta.url);
|
|
6219
6397
|
const __dirname = dirname(__filename);
|
|
6220
6398
|
/**
|
|
6221
|
-
* Resolve the tsx package path from the CLI package's dependencies.
|
|
6222
|
-
* This ensures tsx is available regardless of whether the target project has it installed.
|
|
6223
|
-
*/
|
|
6224
|
-
function resolveTsxPath() {
|
|
6225
|
-
return createRequire(import.meta.url).resolve("tsx");
|
|
6226
|
-
}
|
|
6227
|
-
/**
|
|
6228
6399
|
* Resolve the path to a sniffer helper file.
|
|
6229
6400
|
* Handles both dev (.ts with tsx) and production (.mjs from dist).
|
|
6230
6401
|
*
|
|
@@ -6243,6 +6414,39 @@ function resolveSnifferFile(baseName) {
|
|
|
6243
6414
|
return tsPath;
|
|
6244
6415
|
}
|
|
6245
6416
|
/**
|
|
6417
|
+
* Run a sniffer worker in the sandbox, with the sandbox's environment and
|
|
6418
|
+
* nothing of the deploy's: the deploy's Dokploy token, registry login and AWS
|
|
6419
|
+
* keys stay where they are. A worker that outlives the timeout is killed, and
|
|
6420
|
+
* comes back as the error the caller reports.
|
|
6421
|
+
*/
|
|
6422
|
+
async function runSniffer(run, workspacePath, cwd, nodeArgs) {
|
|
6423
|
+
const sandbox = run.sandbox ?? activeSandbox() ?? new LocalSandbox({ root: resolve(workspacePath) });
|
|
6424
|
+
try {
|
|
6425
|
+
const result = await sandbox.exec("node", nodeArgs, {
|
|
6426
|
+
cwd,
|
|
6427
|
+
env: { ...sandbox.env },
|
|
6428
|
+
timeoutMs: run.timeoutMs ?? 3e4,
|
|
6429
|
+
output: "capture"
|
|
6430
|
+
});
|
|
6431
|
+
return {
|
|
6432
|
+
stdout: result.stdout,
|
|
6433
|
+
stderr: result.stderr,
|
|
6434
|
+
code: result.exitCode
|
|
6435
|
+
};
|
|
6436
|
+
} catch (error) {
|
|
6437
|
+
return { error: error instanceof Error ? error : new Error(String(error)) };
|
|
6438
|
+
}
|
|
6439
|
+
}
|
|
6440
|
+
/** The worker's JSON answer: the last object on stdout naming `envVars`. */
|
|
6441
|
+
function snifferAnswer(stdout) {
|
|
6442
|
+
try {
|
|
6443
|
+
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6444
|
+
return jsonMatch ? JSON.parse(jsonMatch[0]) : void 0;
|
|
6445
|
+
} catch {
|
|
6446
|
+
return;
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
/**
|
|
6246
6450
|
* Get required environment variables for an app.
|
|
6247
6451
|
*
|
|
6248
6452
|
* Detection strategy (in order):
|
|
@@ -6264,6 +6468,10 @@ function resolveSnifferFile(baseName) {
|
|
|
6264
6468
|
*/
|
|
6265
6469
|
async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
6266
6470
|
const { logWarnings = true, markOptional = false } = options;
|
|
6471
|
+
const run = {
|
|
6472
|
+
...options.sandbox ? { sandbox: options.sandbox } : {},
|
|
6473
|
+
...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}
|
|
6474
|
+
};
|
|
6267
6475
|
if (app.type === "web" || app.type === "mobile") {
|
|
6268
6476
|
const publicPrefix = getPublicEnvPrefix(app.framework);
|
|
6269
6477
|
const depVars = publicPrefix ? (app.dependencies ?? []).map((dep) => `${publicPrefix}${dep.toUpperCase()}_URL`) : [];
|
|
@@ -6274,7 +6482,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6274
6482
|
if (app.config.client) configPaths.push(app.config.client);
|
|
6275
6483
|
if (app.config.server) configPaths.push(app.config.server);
|
|
6276
6484
|
for (const configPath of configPaths) {
|
|
6277
|
-
const result = await sniffEntryFile(configPath, app.path, workspacePath);
|
|
6485
|
+
const result = await sniffEntryFile(configPath, app.path, workspacePath, run);
|
|
6278
6486
|
if (logWarnings && result.error) output.warn(`[sniffer] ${appName}: Config file "${configPath}" threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6279
6487
|
sniffedVars.push(...result.envVars);
|
|
6280
6488
|
sniffedOptional.push(...result.optionalEnvVars);
|
|
@@ -6293,7 +6501,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6293
6501
|
};
|
|
6294
6502
|
}
|
|
6295
6503
|
if (app.entry) {
|
|
6296
|
-
const result = await sniffEntryFile(app.entry, app.path, workspacePath);
|
|
6504
|
+
const result = await sniffEntryFile(app.entry, app.path, workspacePath, run);
|
|
6297
6505
|
if (logWarnings && result.error) output.warn(`[sniffer] ${appName}: Entry file threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6298
6506
|
return {
|
|
6299
6507
|
appName,
|
|
@@ -6302,7 +6510,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6302
6510
|
};
|
|
6303
6511
|
}
|
|
6304
6512
|
if (app.routes) {
|
|
6305
|
-
const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath);
|
|
6513
|
+
const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath, run);
|
|
6306
6514
|
if (logWarnings && result.error) output.warn(`[sniffer] ${appName}: Route sniffing threw error (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.envParser) {
|
|
6314
|
-
const result = await sniffEnvParser(app.envParser, app.path, workspacePath);
|
|
6522
|
+
const result = await sniffEnvParser(app.envParser, app.path, workspacePath, run);
|
|
6315
6523
|
if (logWarnings) {
|
|
6316
6524
|
if (result.error) output.warn(`[sniffer] ${appName}: envParser threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6317
6525
|
if (result.unhandledRejections.length > 0) output.warn(`[sniffer] ${appName}: Fire-and-forget rejections during sniffing (suppressed): ${result.unhandledRejections.map((e) => e.message).join(", ")}`);
|
|
@@ -6356,63 +6564,27 @@ function applyMarkOptional(envVars, optionalEnvVars, markOptional) {
|
|
|
6356
6564
|
* @param workspacePath - Absolute path to workspace root
|
|
6357
6565
|
* @returns EntrySniffResult with env vars and optional error
|
|
6358
6566
|
*/
|
|
6359
|
-
async function sniffEntryFile(entryPath, appPath, workspacePath) {
|
|
6567
|
+
async function sniffEntryFile(entryPath, appPath, workspacePath, run = {}) {
|
|
6360
6568
|
const fullEntryPath = resolve(workspacePath, appPath, entryPath);
|
|
6361
6569
|
const loaderPath = resolveSnifferFile("sniffer-loader");
|
|
6362
6570
|
const workerPath = resolveSnifferFile("sniffer-worker");
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
});
|
|
6381
|
-
let stdout = "";
|
|
6382
|
-
let stderr = "";
|
|
6383
|
-
child.stdout.on("data", (data) => {
|
|
6384
|
-
stdout += data.toString();
|
|
6385
|
-
});
|
|
6386
|
-
child.stderr.on("data", (data) => {
|
|
6387
|
-
stderr += data.toString();
|
|
6388
|
-
});
|
|
6389
|
-
child.on("close", (code) => {
|
|
6390
|
-
try {
|
|
6391
|
-
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6392
|
-
if (jsonMatch) {
|
|
6393
|
-
const result = JSON.parse(jsonMatch[0]);
|
|
6394
|
-
resolvePromise({
|
|
6395
|
-
envVars: result.envVars || [],
|
|
6396
|
-
optionalEnvVars: result.optionalEnvVars || [],
|
|
6397
|
-
error: result.error ? new Error(result.error) : void 0
|
|
6398
|
-
});
|
|
6399
|
-
return;
|
|
6400
|
-
}
|
|
6401
|
-
} catch {}
|
|
6402
|
-
resolvePromise({
|
|
6403
|
-
envVars: [],
|
|
6404
|
-
optionalEnvVars: [],
|
|
6405
|
-
error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${code}): ${stderr || stdout || "No output"}`)
|
|
6406
|
-
});
|
|
6407
|
-
});
|
|
6408
|
-
child.on("error", (err) => {
|
|
6409
|
-
resolvePromise({
|
|
6410
|
-
envVars: [],
|
|
6411
|
-
optionalEnvVars: [],
|
|
6412
|
-
error: err
|
|
6413
|
-
});
|
|
6414
|
-
});
|
|
6415
|
-
});
|
|
6571
|
+
const ran = await runSniffer(run, workspacePath, resolve(workspacePath, appPath), nodeWithTsx(workerPath, [fullEntryPath], [loaderPath]));
|
|
6572
|
+
if ("error" in ran) return {
|
|
6573
|
+
envVars: [],
|
|
6574
|
+
optionalEnvVars: [],
|
|
6575
|
+
error: ran.error
|
|
6576
|
+
};
|
|
6577
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6578
|
+
if (answer) return {
|
|
6579
|
+
envVars: answer.envVars || [],
|
|
6580
|
+
optionalEnvVars: answer.optionalEnvVars || [],
|
|
6581
|
+
error: answer.error ? new Error(answer.error) : void 0
|
|
6582
|
+
};
|
|
6583
|
+
return {
|
|
6584
|
+
envVars: [],
|
|
6585
|
+
optionalEnvVars: [],
|
|
6586
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6587
|
+
};
|
|
6416
6588
|
}
|
|
6417
6589
|
/**
|
|
6418
6590
|
* Sniff route files by loading constructs and calling getEnvironment().
|
|
@@ -6428,116 +6600,79 @@ async function sniffEntryFile(entryPath, appPath, workspacePath) {
|
|
|
6428
6600
|
* @param workspacePath - Absolute path to workspace root
|
|
6429
6601
|
* @returns EntrySniffResult with env vars and optional error
|
|
6430
6602
|
*/
|
|
6431
|
-
async function sniffRouteFiles(routes, appPath, workspacePath) {
|
|
6603
|
+
async function sniffRouteFiles(routes, appPath, workspacePath, run = {}) {
|
|
6432
6604
|
const fullAppPath = resolve(workspacePath, appPath);
|
|
6433
6605
|
const workerPath = resolveSnifferFile("sniffer-routes-worker");
|
|
6434
|
-
const tsxPath = resolveTsxPath();
|
|
6435
6606
|
const pattern = (Array.isArray(routes) ? routes : [routes])[0];
|
|
6436
6607
|
if (!pattern) return {
|
|
6437
6608
|
envVars: [],
|
|
6438
6609
|
optionalEnvVars: [],
|
|
6439
6610
|
error: /* @__PURE__ */ new Error("No route patterns provided")
|
|
6440
6611
|
};
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
child.stdout.on("data", (data) => {
|
|
6460
|
-
stdout += data.toString();
|
|
6461
|
-
});
|
|
6462
|
-
child.stderr.on("data", (data) => {
|
|
6463
|
-
stderr += data.toString();
|
|
6464
|
-
});
|
|
6465
|
-
child.on("close", (code) => {
|
|
6466
|
-
if (stderr) stderr.split("\n").filter((line) => line.trim()).forEach((line) => output.warn(line));
|
|
6467
|
-
try {
|
|
6468
|
-
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6469
|
-
if (jsonMatch) {
|
|
6470
|
-
const result = JSON.parse(jsonMatch[0]);
|
|
6471
|
-
resolvePromise({
|
|
6472
|
-
envVars: result.envVars || [],
|
|
6473
|
-
optionalEnvVars: result.optionalEnvVars || [],
|
|
6474
|
-
error: result.error ? new Error(result.error) : void 0
|
|
6475
|
-
});
|
|
6476
|
-
return;
|
|
6477
|
-
}
|
|
6478
|
-
} catch {}
|
|
6479
|
-
resolvePromise({
|
|
6480
|
-
envVars: [],
|
|
6481
|
-
optionalEnvVars: [],
|
|
6482
|
-
error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${code}): ${stderr || stdout || "No output"}`)
|
|
6483
|
-
});
|
|
6484
|
-
});
|
|
6485
|
-
child.on("error", (err) => {
|
|
6486
|
-
resolvePromise({
|
|
6487
|
-
envVars: [],
|
|
6488
|
-
optionalEnvVars: [],
|
|
6489
|
-
error: err
|
|
6490
|
-
});
|
|
6491
|
-
});
|
|
6492
|
-
});
|
|
6612
|
+
const ran = await runSniffer(run, workspacePath, fullAppPath, nodeWithTsx(workerPath, [fullAppPath, pattern]));
|
|
6613
|
+
if ("error" in ran) return {
|
|
6614
|
+
envVars: [],
|
|
6615
|
+
optionalEnvVars: [],
|
|
6616
|
+
error: ran.error
|
|
6617
|
+
};
|
|
6618
|
+
if (ran.stderr) ran.stderr.split("\n").filter((line) => line.trim()).forEach((line) => output.warn(line));
|
|
6619
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6620
|
+
if (answer) return {
|
|
6621
|
+
envVars: answer.envVars || [],
|
|
6622
|
+
optionalEnvVars: answer.optionalEnvVars || [],
|
|
6623
|
+
error: answer.error ? new Error(answer.error) : void 0
|
|
6624
|
+
};
|
|
6625
|
+
return {
|
|
6626
|
+
envVars: [],
|
|
6627
|
+
optionalEnvVars: [],
|
|
6628
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6629
|
+
};
|
|
6493
6630
|
}
|
|
6494
6631
|
/**
|
|
6495
6632
|
* Run the SnifferEnvironmentParser on an envParser module to detect
|
|
6496
6633
|
* which environment variables it accesses.
|
|
6497
6634
|
*
|
|
6498
|
-
*
|
|
6499
|
-
* the
|
|
6635
|
+
* In a subprocess, like the entry and route sniffers: the module is the
|
|
6636
|
+
* project's code, and it was imported into the deploy itself before — with
|
|
6637
|
+
* every credential the deploy held in reach. Fire-and-forget rejections are
|
|
6638
|
+
* collected there with the shared `sniffWithFireAndForget`.
|
|
6500
6639
|
*
|
|
6501
6640
|
* @param envParserPath - The envParser config (e.g., './src/config/env#envParser')
|
|
6502
6641
|
* @param appPath - The app's path relative to workspace
|
|
6503
6642
|
* @param workspacePath - Absolute path to workspace root
|
|
6504
6643
|
* @returns SniffResult with env vars and any errors encountered
|
|
6505
6644
|
*/
|
|
6506
|
-
async function sniffEnvParser(envParserPath, appPath, workspacePath) {
|
|
6645
|
+
async function sniffEnvParser(envParserPath, appPath, workspacePath, run = {}) {
|
|
6507
6646
|
const [modulePath, exportName = "default"] = envParserPath.split("#");
|
|
6508
6647
|
if (!modulePath) return {
|
|
6509
6648
|
envVars: [],
|
|
6510
6649
|
optionalEnvVars: [],
|
|
6511
6650
|
unhandledRejections: []
|
|
6512
6651
|
};
|
|
6513
|
-
const
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
}
|
|
6536
|
-
|
|
6537
|
-
if (result && typeof result.parse === "function") try {
|
|
6538
|
-
result.parse();
|
|
6539
|
-
} catch {}
|
|
6540
|
-
});
|
|
6652
|
+
const appRoot = resolve(workspacePath, appPath);
|
|
6653
|
+
const fullPath = resolve(appRoot, modulePath);
|
|
6654
|
+
const workerPath = resolveSnifferFile("sniffer-envparser-worker");
|
|
6655
|
+
const ran = await runSniffer(run, workspacePath, appRoot, nodeWithTsx(workerPath, [fullPath, exportName]));
|
|
6656
|
+
if ("error" in ran) return {
|
|
6657
|
+
envVars: [],
|
|
6658
|
+
optionalEnvVars: [],
|
|
6659
|
+
unhandledRejections: [],
|
|
6660
|
+
error: ran.error
|
|
6661
|
+
};
|
|
6662
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6663
|
+
if (!answer) return {
|
|
6664
|
+
envVars: [],
|
|
6665
|
+
optionalEnvVars: [],
|
|
6666
|
+
unhandledRejections: [],
|
|
6667
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff envParser (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6668
|
+
};
|
|
6669
|
+
for (const warning of answer.warnings ?? []) output.warn(warning);
|
|
6670
|
+
return {
|
|
6671
|
+
envVars: answer.envVars ?? [],
|
|
6672
|
+
optionalEnvVars: answer.optionalEnvVars ?? [],
|
|
6673
|
+
unhandledRejections: (answer.unhandledRejections ?? []).map((message) => new Error(message)),
|
|
6674
|
+
...answer.error ? { error: new Error(answer.error) } : {}
|
|
6675
|
+
};
|
|
6541
6676
|
}
|
|
6542
6677
|
/**
|
|
6543
6678
|
* Sniff environment requirements for multiple apps.
|
|
@@ -6556,6 +6691,6 @@ async function sniffAllApps(apps, workspacePath, options = {}) {
|
|
|
6556
6691
|
return results;
|
|
6557
6692
|
}
|
|
6558
6693
|
//#endregion
|
|
6559
|
-
export {
|
|
6694
|
+
export { workspace_exports as $, StateStoreBusy as A, prepareEntryCredentials as At, LocalSandbox as B, storeDokployCredentials as Bt, setDnsRecord as C, primaryPortKey as Ct, DocumentStateStore as D, isPortAvailable as Dt, setPostgresBackupId as E, findAvailablePort as Et, newLockHolder as F, getDokployCredentials as Ft, DEFAULT_TIMEOUT_MS as G, allowlistedEnv as H, prompt as Ht, withGeneratedSecrets as I, getDokployRegistryId as It, FAKE_ENV as J, run as K, encryptSecrets as L, getDokployToken as Lt, StateVersionConflict as M, logoutCommand as Mt, contentVersion as N, validateDokployToken as Nt, StageStateMissing as O, loadEnvFiles as Ot, createStateStore as P, whoamiCommand as Pt, reconcileWorkspace as Q, encryption_exports as R, getHostingerToken as Rt, setDeployedImage as S, portKeys as St, setGeneratedSecret as T, createEntryWrapper as Tt, CommandFailed as U, SANDBOX_ENV_ALLOWLIST as V, canPrompt as Vt, CommandTimedOut as W, constructGlobs as X, backendsOf as Y, derivedContainers as Z, getBackupState as _, providerOf as _t, DockerBuildFailed as a, quoteIdentifier as at, setApplicationId as b, describeServices as bt, dockerCommand as c, appEnvKeys as ct, generateDockerignore as d, localRolePassword as dt, LOCAL_CA_PATH as et, generateSlimDockerfile as f, planFor as ft, createEmptyState as g, eventsBackendFor as gt, resolveHost as h, cacheBackendFor as ht, DokployApiError as i, postgresStatements as it, StateStoreWithoutLocking as j, loginCommand as jt, StateLocked as k, loadSecretsForApp as kt, siteDockerfile as l, networkEnv as lt, isMainFrontendApp as m, hostFor as mt, sniffAppEnvironment as n, applyPostgres as nt, DockerPushFailed as o, composeFor as ot, validateImageRef as p, resourceName as pt, runOutput as q, DokployApi as r, postgresDatabaseNames as rt, appPackageName as s, pgClient as st, sniffAllApps as t, forgetState as tt, detectPackageManager as u, envFor as ut, getGeneratedSecret as v, storageBackendFor as vt, setDnsVerification as w, createCredentialsPreload as wt, setBackupState as x, fakeKey as xt, isDnsVerified as y, DEFAULT_IMAGES as yt, keyFingerprint as z, readCredentials as zt };
|
|
6560
6695
|
|
|
6561
|
-
//# sourceMappingURL=sniffer-
|
|
6696
|
+
//# sourceMappingURL=sniffer-aO_-s5vq.mjs.map
|