@geekmidas/cli 10.0.0-alpha.62 → 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.
Files changed (170) hide show
  1. package/README.md +2 -0
  2. package/dist/{HostingerProvider-B92qH4dC.mjs → HostingerProvider-DBBwpDjn.mjs} +2 -2
  3. package/dist/{HostingerProvider-B92qH4dC.mjs.map → HostingerProvider-DBBwpDjn.mjs.map} +1 -1
  4. package/dist/{HostingerProvider-DyD1Hin8.cjs → HostingerProvider-mJ7YruxH.cjs} +2 -2
  5. package/dist/{HostingerProvider-DyD1Hin8.cjs.map → HostingerProvider-mJ7YruxH.cjs.map} +1 -1
  6. package/dist/{LegacyStateStore-UHJEBLdn.cjs → LegacyStateStore-CP7SZwTP.cjs} +2 -2
  7. package/dist/{LegacyStateStore-UHJEBLdn.cjs.map → LegacyStateStore-CP7SZwTP.cjs.map} +1 -1
  8. package/dist/{LegacyStateStore-A8d2GdT7.mjs → LegacyStateStore-Q3GmKOdw.mjs} +2 -2
  9. package/dist/{LegacyStateStore-A8d2GdT7.mjs.map → LegacyStateStore-Q3GmKOdw.mjs.map} +1 -1
  10. package/dist/{LocalStateStore-B51rnfgn.mjs → LocalStateStore-BGIXcrvX.mjs} +2 -2
  11. package/dist/{LocalStateStore-B51rnfgn.mjs.map → LocalStateStore-BGIXcrvX.mjs.map} +1 -1
  12. package/dist/{LocalStateStore-COW3Ldwa.cjs → LocalStateStore-sS8mvLeq.cjs} +2 -2
  13. package/dist/{LocalStateStore-COW3Ldwa.cjs.map → LocalStateStore-sS8mvLeq.cjs.map} +1 -1
  14. package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs → OpenApiTsGenerator-CjHWFRDd.cjs} +2 -2
  15. package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs.map → OpenApiTsGenerator-CjHWFRDd.cjs.map} +1 -1
  16. package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs → OpenApiTsGenerator-CnAwhGxi.mjs} +2 -2
  17. package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs.map → OpenApiTsGenerator-CnAwhGxi.mjs.map} +1 -1
  18. package/dist/{S3StateStore-WUJGdRNL.cjs → S3StateStore-6jqITH2F.cjs} +2 -2
  19. package/dist/{S3StateStore-WUJGdRNL.cjs.map → S3StateStore-6jqITH2F.cjs.map} +1 -1
  20. package/dist/{S3StateStore-CJewPhgz.mjs → S3StateStore-D7l_lWJ3.mjs} +2 -2
  21. package/dist/{S3StateStore-CJewPhgz.mjs.map → S3StateStore-D7l_lWJ3.mjs.map} +1 -1
  22. package/dist/{SSMStateStore-Zejt42V8.cjs → SSMStateStore-B__F7IJa.cjs} +2 -2
  23. package/dist/{SSMStateStore-Zejt42V8.cjs.map → SSMStateStore-B__F7IJa.cjs.map} +1 -1
  24. package/dist/{SSMStateStore-iK5UKp9d.mjs → SSMStateStore-CAQDVpoc.mjs} +2 -2
  25. package/dist/{SSMStateStore-iK5UKp9d.mjs.map → SSMStateStore-CAQDVpoc.mjs.map} +1 -1
  26. package/dist/{bundler-CfH9frOS.cjs → bundler-DLfOn0ls.cjs} +3 -3
  27. package/dist/{bundler-CfH9frOS.cjs.map → bundler-DLfOn0ls.cjs.map} +1 -1
  28. package/dist/{bundler-DN5r4x5b.mjs → bundler-DyWI41Iy.mjs} +2 -2
  29. package/dist/{bundler-DN5r4x5b.mjs.map → bundler-DyWI41Iy.mjs.map} +1 -1
  30. package/dist/{cli-DOAUp80L.cjs → cli-D-ZM-X2s.cjs} +4 -4
  31. package/dist/{cli-DOAUp80L.cjs.map → cli-D-ZM-X2s.cjs.map} +1 -1
  32. package/dist/{cli-DYwxmfsW.mjs → cli-PkVF28LM.mjs} +4 -4
  33. package/dist/{cli-DYwxmfsW.mjs.map → cli-PkVF28LM.mjs.map} +1 -1
  34. package/dist/{config-BYh9S0cZ.cjs → config-BEJYKd4s.cjs} +132 -18
  35. package/dist/config-BEJYKd4s.cjs.map +1 -0
  36. package/dist/config-C2BUosLm.d.mts +256 -0
  37. package/dist/config-C2BUosLm.d.mts.map +1 -0
  38. package/dist/config-CemHVcIr.d.cts +256 -0
  39. package/dist/config-CemHVcIr.d.cts.map +1 -0
  40. package/dist/{config-Bf4-bROQ.mjs → config-LKKCVCnC.mjs} +109 -19
  41. package/dist/config-LKKCVCnC.mjs.map +1 -0
  42. package/dist/config.cjs +6 -2
  43. package/dist/config.d.cts +3 -210
  44. package/dist/config.d.mts +3 -210
  45. package/dist/config.mjs +3 -3
  46. package/dist/deploy/public.cjs +151 -5
  47. package/dist/deploy/public.cjs.map +1 -0
  48. package/dist/deploy/public.d.cts +186 -1
  49. package/dist/deploy/public.d.cts.map +1 -1
  50. package/dist/deploy/public.d.mts +186 -1
  51. package/dist/deploy/public.d.mts.map +1 -1
  52. package/dist/deploy/public.mjs +134 -6
  53. package/dist/deploy/public.mjs.map +1 -0
  54. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  55. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  56. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  57. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  58. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  59. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  60. package/dist/{deploy-DSaCYvcO.cjs → deploy-ABBI0lf1.cjs} +7 -7
  61. package/dist/{deploy-DSaCYvcO.cjs.map → deploy-ABBI0lf1.cjs.map} +1 -1
  62. package/dist/{deploy-D8Qr-Xto.cjs → deploy-BiMrP9i7.cjs} +11 -9
  63. package/dist/deploy-BiMrP9i7.cjs.map +1 -0
  64. package/dist/{deploy-B7jvUORo.mjs → deploy-CG8bfFij.mjs} +7 -7
  65. package/dist/{deploy-B7jvUORo.mjs.map → deploy-CG8bfFij.mjs.map} +1 -1
  66. package/dist/{deploy-Cg9fae7a.mjs → deploy-CGW-QY9D.mjs} +11 -9
  67. package/dist/deploy-CGW-QY9D.mjs.map +1 -0
  68. package/dist/discover-B6yPpvRV.d.mts +99 -0
  69. package/dist/discover-B6yPpvRV.d.mts.map +1 -0
  70. package/dist/discover-B_IkPukx.d.cts +99 -0
  71. package/dist/discover-B_IkPukx.d.cts.map +1 -0
  72. package/dist/discover-BaT6bpnA.mjs +614 -0
  73. package/dist/discover-BaT6bpnA.mjs.map +1 -0
  74. package/dist/discover-C_6COHEv.cjs +729 -0
  75. package/dist/discover-C_6COHEv.cjs.map +1 -0
  76. package/dist/{dokploy-CD9PY-3D.mjs → dokploy-CwdmlyQL.mjs} +2 -2
  77. package/dist/{dokploy-CD9PY-3D.mjs.map → dokploy-CwdmlyQL.mjs.map} +1 -1
  78. package/dist/{dokploy-Ey2foJLv.cjs → dokploy-QJxMhxdf.cjs} +2 -2
  79. package/dist/{dokploy-Ey2foJLv.cjs.map → dokploy-QJxMhxdf.cjs.map} +1 -1
  80. package/dist/{encryption-CVwvGbsL.mjs → encryption-CbQG_ayW.mjs} +4 -4
  81. package/dist/{encryption-CVwvGbsL.mjs.map → encryption-CbQG_ayW.mjs.map} +1 -1
  82. package/dist/{encryption-ChBk3hTj.cjs → encryption-DXw3jj0c.cjs} +4 -4
  83. package/dist/{encryption-ChBk3hTj.cjs.map → encryption-DXw3jj0c.cjs.map} +1 -1
  84. package/dist/fakes-C9RiT6XG.mjs.map +1 -1
  85. package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
  86. package/dist/{github-OUgPDlqg.cjs → github-BH_mETav.cjs} +3 -3
  87. package/dist/{github-OUgPDlqg.cjs.map → github-BH_mETav.cjs.map} +1 -1
  88. package/dist/{github-BCB3_LBX.mjs → github-ciwbIwVa.mjs} +3 -3
  89. package/dist/{github-BCB3_LBX.mjs.map → github-ciwbIwVa.mjs.map} +1 -1
  90. package/dist/index.cjs +55 -48
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.mjs +52 -45
  93. package/dist/index.mjs.map +1 -1
  94. package/dist/{migrate-dnaFMvOm.cjs → migrate-6oa9y_f2.cjs} +5 -5
  95. package/dist/{migrate-dnaFMvOm.cjs.map → migrate-6oa9y_f2.cjs.map} +1 -1
  96. package/dist/{migrate-BoHMqdCu.mjs → migrate-ImBKTBcW.mjs} +5 -5
  97. package/dist/{migrate-BoHMqdCu.mjs.map → migrate-ImBKTBcW.mjs.map} +1 -1
  98. package/dist/openapi.cjs +3 -3
  99. package/dist/openapi.mjs +3 -3
  100. package/dist/{ready-XlNx-Gbo.cjs → ready-BiG0rt4h.cjs} +3 -3
  101. package/dist/{ready-XlNx-Gbo.cjs.map → ready-BiG0rt4h.cjs.map} +1 -1
  102. package/dist/{ready-DQIy21W5.mjs → ready-Bpdnn2ON.mjs} +3 -3
  103. package/dist/{ready-DQIy21W5.mjs.map → ready-Bpdnn2ON.mjs.map} +1 -1
  104. package/dist/reconcile/public.cjs +1 -1
  105. package/dist/reconcile/public.d.cts +3 -76
  106. package/dist/reconcile/public.d.cts.map +1 -1
  107. package/dist/reconcile/public.d.mts +3 -76
  108. package/dist/reconcile/public.d.mts.map +1 -1
  109. package/dist/reconcile/public.mjs +1 -1
  110. package/dist/{resolve-CFCIkm7m.mjs → resolve-B1T0hUaR.mjs} +2 -2
  111. package/dist/{resolve-CFCIkm7m.mjs.map → resolve-B1T0hUaR.mjs.map} +1 -1
  112. package/dist/{resolve-wbv66HjD.cjs → resolve-xytBTtG4.cjs} +2 -2
  113. package/dist/{resolve-wbv66HjD.cjs.map → resolve-xytBTtG4.cjs.map} +1 -1
  114. package/dist/sandbox/config-worker.cjs +43 -0
  115. package/dist/sandbox/config-worker.cjs.map +1 -0
  116. package/dist/sandbox/config-worker.d.cts +1 -0
  117. package/dist/sandbox/config-worker.d.mts +1 -0
  118. package/dist/sandbox/config-worker.mjs +44 -0
  119. package/dist/sandbox/config-worker.mjs.map +1 -0
  120. package/dist/sandbox/discover-worker.cjs +44 -0
  121. package/dist/sandbox/discover-worker.cjs.map +1 -0
  122. package/dist/sandbox/discover-worker.d.cts +1 -0
  123. package/dist/sandbox/discover-worker.d.mts +1 -0
  124. package/dist/sandbox/discover-worker.mjs +45 -0
  125. package/dist/sandbox/discover-worker.mjs.map +1 -0
  126. package/dist/sandbox-M8UnLhXE.d.cts +126 -0
  127. package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
  128. package/dist/sandbox-M8UnLhXE.d.mts +126 -0
  129. package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
  130. package/dist/{workspace-BFe57es7.mjs → schemas-Ckm_aBnF.cjs} +71 -982
  131. package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
  132. package/dist/{workspace-B6zQO6RY.cjs → schemas-D2LCF689.mjs} +2 -1168
  133. package/dist/schemas-D2LCF689.mjs.map +1 -0
  134. package/dist/{sniffer-BsfPa-GA.cjs → sniffer-D_SYc_pO.cjs} +369 -207
  135. package/dist/sniffer-D_SYc_pO.cjs.map +1 -0
  136. package/dist/{sniffer-DHE2Nafd.mjs → sniffer-aO_-s5vq.mjs} +336 -204
  137. package/dist/sniffer-aO_-s5vq.mjs.map +1 -0
  138. package/dist/target/public.cjs +1 -1
  139. package/dist/target/public.mjs +1 -1
  140. package/dist/{terminal-6oL0vANs.cjs → terminal-D0f1u0LG.cjs} +6 -6
  141. package/dist/{terminal-6oL0vANs.cjs.map → terminal-D0f1u0LG.cjs.map} +1 -1
  142. package/dist/{terminal-ByZNjuig.mjs → terminal-gMxAo9Dj.mjs} +6 -6
  143. package/dist/{terminal-ByZNjuig.mjs.map → terminal-gMxAo9Dj.mjs.map} +1 -1
  144. package/dist/vitest.cjs +2 -2
  145. package/dist/vitest.mjs +2 -2
  146. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  147. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  148. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  149. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  150. package/dist/workspace/index.cjs +1 -1
  151. package/dist/workspace/index.mjs +1 -1
  152. package/dist/workspace-Dh7rr7l4.mjs +1024 -0
  153. package/dist/workspace-Dh7rr7l4.mjs.map +1 -0
  154. package/dist/workspace-Kl4NG9IH.cjs +1196 -0
  155. package/dist/workspace-Kl4NG9IH.cjs.map +1 -0
  156. package/package.json +13 -13
  157. package/dist/config-BYh9S0cZ.cjs.map +0 -1
  158. package/dist/config-Bf4-bROQ.mjs.map +0 -1
  159. package/dist/config.d.cts.map +0 -1
  160. package/dist/config.d.mts.map +0 -1
  161. package/dist/deploy-Cg9fae7a.mjs.map +0 -1
  162. package/dist/deploy-D8Qr-Xto.cjs.map +0 -1
  163. package/dist/discover-Bc-4eA_p.cjs +0 -299
  164. package/dist/discover-Bc-4eA_p.cjs.map +0 -1
  165. package/dist/discover-FrYvzkeC.mjs +0 -262
  166. package/dist/discover-FrYvzkeC.mjs.map +0 -1
  167. package/dist/sniffer-BsfPa-GA.cjs.map +0 -1
  168. package/dist/sniffer-DHE2Nafd.mjs.map +0 -1
  169. package/dist/workspace-B6zQO6RY.cjs.map +0 -1
  170. package/dist/workspace-BFe57es7.mjs.map +0 -1
@@ -1,4 +1,7 @@
1
1
  import { $ as DeployEventError, Q as DeployEvent, _t as StateVersionConflict, at as DeployResult, bt as deployIdentity, ct as CredentialKinds, dt as MissingCredential, et as DeployEventType, ft as StoredCredentialsOptions, ht as StateLocked, it as AppDeployResult, lt as CredentialProvider, mt as storedCredentials, nt as ResourceChange, ot as Credential, pt as chainCredentials, rt as ResourceVia, st as CredentialKind, tt as DeployPhase, ut as CredentialRequest, yt as DeployIdentity, z as AnyDeployTarget } from "../types-DIA7Li-J.cjs";
2
+ import { a as SandboxOutput, c as confineCwd, i as SandboxExecOptions, n as Sandbox, o as SandboxResult, r as SandboxCwdEscape, s as SecretNameInvalid, t as SECRETS_DIR_ENV } from "../sandbox-M8UnLhXE.cjs";
3
+ import { i as ConfigLoadFailed, o as ConfigObjectNotSerializable } from "../config-CemHVcIr.cjs";
4
+ import { n as ConstructsNotSerializable, t as ConstructDiscoveryFailed } from "../discover-B_IkPukx.cjs";
2
5
  import { a as TargetRuntimeMismatch, c as DeployTargetNotYetSupported, i as TargetPackageInvalid, l as UnknownDeployTarget, n as InvalidTargetOptions, o as ProviderRemoved, r as TargetEntryInvalid, s as TargetPackageNotFound, t as TargetRuntimeUndeclared } from "../runtime-Dn_n-29S.cjs";
3
6
  import { ConstructManifest } from "@geekmidas/manifest";
4
7
  import "@geekmidas/envkit/sniffer";
@@ -16,6 +19,176 @@ export declare const GKM_HOME_ENV = "GKM_HOME";
16
19
  /** The CLI's home: `GKM_HOME` if set, else `~/.gkm`. */
17
20
  export declare function gkmHome(env?: NodeJS.ProcessEnv): string;
18
21
  //#endregion
22
+ //#region src/run.d.ts
23
+ /** The program ran and exited unsuccessfully; its own output said why. */
24
+ export declare class CommandFailed extends Error {
25
+ readonly command: string;
26
+ readonly args: readonly string[];
27
+ readonly exitCode: number | null;
28
+ readonly signal: NodeJS.Signals | null;
29
+ constructor(command: string, args: readonly string[], exitCode: number | null, signal: NodeJS.Signals | null);
30
+ }
31
+ /** The program ran past its timeout and was killed. */
32
+ export declare class CommandTimedOut extends Error {
33
+ readonly command: string;
34
+ readonly args: readonly string[];
35
+ readonly timeoutMs: number;
36
+ constructor(command: string, args: readonly string[], timeoutMs: number);
37
+ }
38
+ //#endregion
39
+ //#region src/sandbox/env.d.ts
40
+ /**
41
+ * What of the host's environment a local sandbox passes on.
42
+ *
43
+ * An allowlist, not a denylist: a credential's variable has any name its
44
+ * owner chose (`DOKPLOY_TOKEN`, `AWS_SECRET_ACCESS_KEY`, `MY_VAULT_TOKEN`), so
45
+ * the only safe default is to name what a program needs to *run* and pass
46
+ * nothing else.
47
+ */
48
+ /**
49
+ * Variables a command needs to find programs, write temp files, print in the
50
+ * user's locale and reach the network through the host's proxy — and nothing
51
+ * that authenticates as anyone.
52
+ *
53
+ * Deliberately left out:
54
+ * - `NODE_OPTIONS`: it can `--require` or `--import` code into every node
55
+ * process, and CI often holds `--import tsx` there. A step that needs a
56
+ * loader passes its own.
57
+ * - `NODE_AUTH_TOKEN`, `NPM_TOKEN`, `npm_config_*`: registry tokens
58
+ * (`actions/setup-node` writes `NODE_AUTH_TOKEN`), which is why there is no
59
+ * `NODE_*` wildcard.
60
+ * - `AWS_*`, `DOCKER_*`, `DOKPLOY_*`, `GITHUB_TOKEN`, `TURBO_TOKEN`, `GKM_*`:
61
+ * credentials, or where the deploy keeps them.
62
+ * - `SHELL`, `EDITOR` and the rest of a login session: nothing here starts a
63
+ * shell.
64
+ *
65
+ * Proxies are passed: behind one, nothing installs or builds without it. A
66
+ * proxy URL with a password in it reaches the command too — a host that keeps
67
+ * one there and builds code it does not trust should pass a sandbox of its
68
+ * own.
69
+ */
70
+ export declare const SANDBOX_ENV_ALLOWLIST: readonly (string | RegExp)[];
71
+ /**
72
+ * The allowlisted part of `source`, plus each of `extra` the host chose to
73
+ * pass on by name.
74
+ */
75
+ export declare function allowlistedEnv(source?: NodeJS.ProcessEnv, extra?: readonly string[]): Record<string, string>;
76
+ //#endregion
77
+ //#region src/docker/templates.d.ts
78
+ type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun';
79
+ //#endregion
80
+ //#region src/sandbox/install.d.ts
81
+ /** Long enough for a cold install of a large monorepo. */
82
+ export declare const INSTALL_TIMEOUT_MS: number;
83
+ interface InstallOptions {
84
+ /** The directory to install in. Defaults to the sandbox's root. */
85
+ cwd?: string;
86
+ /** Defaults to the one the lockfile above `cwd` names. */
87
+ packageManager?: PackageManager;
88
+ /**
89
+ * Skip every lifecycle script — dependencies' and the project's own —
90
+ * except those of {@link allowScripts}. Defaults to false: scripts run as
91
+ * a plain install runs them, under the package manager's own policy —
92
+ * npm 12 and pnpm 10 skip dependencies' scripts nobody approved.
93
+ */
94
+ ignoreScripts?: boolean;
95
+ /**
96
+ * With `ignoreScripts`, the packages whose scripts still run: rebuilt by
97
+ * name once the install is done.
98
+ */
99
+ allowScripts?: readonly string[];
100
+ /** Variables the install needs beyond the sandbox's own. */
101
+ env?: Readonly<Record<string, string>>;
102
+ /** Defaults to {@link INSTALL_TIMEOUT_MS}, for each command. */
103
+ timeoutMs?: number;
104
+ /** Where the package manager's output goes. Defaults to `inherit`. */
105
+ output?: SandboxOutput;
106
+ signal?: AbortSignal;
107
+ }
108
+ /** A name in `allowScripts` that is not a package name. */
109
+ export declare class InstallAllowlistNameInvalid extends Error {
110
+ readonly packageName: string;
111
+ constructor(packageName: string);
112
+ }
113
+ /** The package manager has no way to run only some packages' scripts. */
114
+ export declare class InstallScriptsAllowlistUnsupported extends Error {
115
+ readonly packageManager: string;
116
+ readonly allowScripts: readonly string[];
117
+ constructor(packageManager: string, allowScripts: readonly string[]);
118
+ }
119
+ /**
120
+ * Install the project's dependencies in `sandbox`.
121
+ *
122
+ * ```ts
123
+ * // A checkout nobody has reviewed: no scripts but esbuild's.
124
+ * await installDependencies(sandbox, {
125
+ * ignoreScripts: true,
126
+ * allowScripts: ['esbuild'],
127
+ * });
128
+ * ```
129
+ *
130
+ * Resolves with each command's result, in order — with its output when
131
+ * `output` is `capture`.
132
+ *
133
+ * @throws {CommandFailed} when the package manager exits unsuccessfully.
134
+ * @throws {InstallScriptsAllowlistUnsupported} for an allowlist the package
135
+ * manager cannot honour, before anything is installed.
136
+ */
137
+ export declare function installDependencies(sandbox: Sandbox, options?: InstallOptions): Promise<SandboxResult[]>;
138
+ //#endregion
139
+ //#region src/sandbox/local.d.ts
140
+ interface LocalSandboxOptions {
141
+ /** The project. Every command runs at or below it. */
142
+ root: string;
143
+ /**
144
+ * `HOME` for every command. Defaults to the host's, because a build
145
+ * reuses the caches kept there — the pnpm store, corepack's package
146
+ * managers, turbo's cache — and a cold one re-downloads all of them.
147
+ * Point it at an empty directory to keep `~/.aws`, `~/.npmrc` and
148
+ * `~/.docker` out of reach of an SDK's default lookup — though, sharing
149
+ * the host's filesystem, a command that goes looking still finds them.
150
+ */
151
+ home?: string;
152
+ /**
153
+ * Host variables to pass on beyond the allowlist, by name — a remote
154
+ * cache's `TURBO_TOKEN`, for a build the host trusts with it.
155
+ */
156
+ passEnv?: readonly string[];
157
+ /** Where the allowlisted variables are read from. Defaults to `process.env`. */
158
+ hostEnv?: NodeJS.ProcessEnv;
159
+ }
160
+ /**
161
+ * A child process on this machine, as this user, with an allowlisted
162
+ * environment.
163
+ *
164
+ * What it withholds from the command: the host's environment beyond
165
+ * {@link SANDBOX_ENV_ALLOWLIST}, a shell, a working directory outside the
166
+ * project, and any time past the timeout. What it does not: the host's
167
+ * filesystem, which the command can read and write as the user running the
168
+ * deploy. So it is not `isolating`, and it is the default for projects the
169
+ * host already trusts — the developer's own, a team's own CI. Code nobody
170
+ * vetted belongs in a sandbox that is.
171
+ *
172
+ * A timed-out command is sent SIGTERM, then SIGKILL; processes it started
173
+ * itself are its to stop.
174
+ */
175
+ export declare class LocalSandbox implements Sandbox {
176
+ readonly root: string;
177
+ readonly isolating = false;
178
+ readonly env: Readonly<Record<string, string>>;
179
+ constructor(options: LocalSandboxOptions);
180
+ exec(command: string, args: readonly string[], options: SandboxExecOptions): Promise<SandboxResult>;
181
+ }
182
+ //#endregion
183
+ //#region src/sandbox/worker.d.ts
184
+ /** A worker ended without the answer it exists to give. */
185
+ export declare class SandboxWorkerFailed extends Error {
186
+ readonly step: string;
187
+ readonly exitCode: number | null;
188
+ readonly stderr: string;
189
+ constructor(step: string, exitCode: number | null, stderr: string);
190
+ }
191
+ //#endregion
19
192
  //#region src/deploy/deploy.d.ts
20
193
  /**
21
194
  * Where a run's progress lines go, besides its events. `@geekmidas/logger`'s
@@ -79,6 +252,18 @@ interface DeployInput {
79
252
  * default), its stderr, or nowhere.
80
253
  */
81
254
  childOutput?: 'inherit' | 'stderr' | 'ignore';
255
+ /**
256
+ * Where the project's own code runs: loading `gkm.config.ts`, discovering
257
+ * its constructs, sniffing each app's environment. Defaults to a
258
+ * `LocalSandbox` on the project — a child process here with an
259
+ * allowlisted environment, for a project the host trusts.
260
+ *
261
+ * A host deploying repositories it does not trust passes one that
262
+ * isolates — a container per build — and the config then reaches the
263
+ * deploy only as data. Credentials never enter a sandbox: they go from
264
+ * `credentials` to the steps that provision, push and release.
265
+ */
266
+ sandbox?: Sandbox;
82
267
  }
83
268
  /** A deploy in progress. */
84
269
  interface DeployRun extends AsyncIterable<DeployEvent> {
@@ -178,5 +363,5 @@ export declare class RegistryAmbiguous extends Error {
178
363
  constructor(registry: string, registryIds: readonly string[]);
179
364
  }
180
365
  //#endregion
181
- export { type AppDeployResult, type Credential, type CredentialKind, type CredentialKinds, type CredentialProvider, type CredentialRequest, type DeployEvent, type DeployEventError, type DeployEventType, type DeployIdentity, type DeployInput, type DeployLogger, type DeployPhase, type DeployResult, type DeployRun, DeployTargetNotYetSupported, InvalidTargetOptions, MissingCredential, ProviderRemoved, type ResourceChange, type ResourceVia, StateLocked, StateVersionConflict, type StoredCredentialsOptions, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget, chainCredentials, deployIdentity, storedCredentials };
366
+ export { type AppDeployResult, ConfigLoadFailed, ConfigObjectNotSerializable, ConstructDiscoveryFailed, ConstructsNotSerializable, type Credential, type CredentialKind, type CredentialKinds, type CredentialProvider, type CredentialRequest, type DeployEvent, type DeployEventError, type DeployEventType, type DeployIdentity, type DeployInput, type DeployLogger, type DeployPhase, type DeployResult, type DeployRun, DeployTargetNotYetSupported, type InstallOptions, InvalidTargetOptions, type LocalSandboxOptions, MissingCredential, ProviderRemoved, type ResourceChange, type ResourceVia, SECRETS_DIR_ENV, type Sandbox, SandboxCwdEscape, type SandboxExecOptions, type SandboxOutput, type SandboxResult, SecretNameInvalid, StateLocked, StateVersionConflict, type StoredCredentialsOptions, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget, chainCredentials, confineCwd, deployIdentity, storedCredentials };
182
367
  //# sourceMappingURL=public.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.cts","names":[],"sources":["../../src/home.ts","../../src/deploy/deploy.ts","../../src/deploy/index.ts","../../src/deploy/orchestrate.ts","../../src/deploy/ownership.ts","../../src/deploy/registry.ts"],"mappings":";;;;;;;;;;;;;;qBAaa;;wBAGG,QAAQ,MAAK,OAAO;;;;;;;UCanB;EAChB,KAAK;EACL,KAAK;EACL,OAAO;;UAGS;;;;;EAKhB;;EAEA;;;;;EAKA;;;;;;EAMA,UAAU,eAAe;;EAEzB;;EAEA;;;;;;EAMA;;;;;;EAMA,cAAc;;EAEd,SAAS;;;;;;EAMT,SAAS;;;;;EAKT;;;;;EAKA;;;UAIgB,kBAAkB,cAAc;;;;;;WAMvC,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;wBAqEV,OAAO,OAAO,cAAc;;;;qBCqV/B,4BAA4B;WAE9B;EADV,YACU,aACT;;;qBAWW,uBAAuB;WAEzB;WACA;WACA;EAHV,YACU,aACA,4BACA;;;;;qBCvcE,0BAA0B;WAE5B;WACA;EAFV,YACU,yBACA;;;qBAWE,yBAAyB;WAE3B;WACA;EAFV,YACU,eACA;;;qBAUE,uBAAuB;WAEzB;;WAEA;EAHV,YACU,gBAEA;;EAAA,kBACT;;;;;;;;qBC1EW,wBAAwB;WAE1B;WACA;WACA;;WAEA;EALV,YACU,qBACA,mBACA,kBAEA;;EAAA;;;;;qBChBE,8BAA8B;WACrB;EAArB,YAAqB;;;qBAUT,yBAAyB;WAChB;EAArB,YAAqB;;;qBAUT,0BAA0B;WAE5B;WACA;EAFV,YACU,kBACA"}
1
+ {"version":3,"file":"public.d.cts","names":[],"sources":["../../src/home.ts","../../src/run.ts","../../src/sandbox/env.ts","../../src/docker/templates.ts","../../src/sandbox/install.ts","../../src/sandbox/local.ts","../../src/sandbox/worker.ts","../../src/deploy/deploy.ts","../../src/deploy/index.ts","../../src/deploy/orchestrate.ts","../../src/deploy/ownership.ts","../../src/deploy/registry.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAaa;;wBAGG,QAA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;;;;;qBCvcE,0BAA0B;WAE5B;WACA;EAFV,YACU,yBACA;;;qBAWE,yBAAyB;WAE3B;WACA;EAFV,YACU,eACA;;;qBAUE,uBAAuB;WAEzB;;WAEA;EAHV,YACU,gBAEA;;EAAA,kBACT;;;;;;;;qBC1EW,wBAAwB;WAE1B;WACA;WACA;;WAEA;EALV,YACU,qBACA,mBACA,kBAEA;;EAAA;;;;;qBChBE,8BAA8B;WACrB;EAArB,YAAqB;;;qBAUT,yBAAyB;WAChB;EAArB,YAAqB;;;qBAUT,0BAA0B;WAE5B;WACA;EAFV,YACU,kBACA"}
@@ -1,4 +1,7 @@
1
+ import { a as SandboxOutput, c as confineCwd, i as SandboxExecOptions, n as Sandbox, o as SandboxResult, r as SandboxCwdEscape, s as SecretNameInvalid, t as SECRETS_DIR_ENV } from "../sandbox-M8UnLhXE.mjs";
1
2
  import { $ as DeployEventError, Q as DeployEvent, _t as StateVersionConflict, at as DeployResult, bt as deployIdentity, ct as CredentialKinds, dt as MissingCredential, et as DeployEventType, ft as StoredCredentialsOptions, ht as StateLocked, it as AppDeployResult, lt as CredentialProvider, mt as storedCredentials, nt as ResourceChange, ot as Credential, pt as chainCredentials, rt as ResourceVia, st as CredentialKind, tt as DeployPhase, ut as CredentialRequest, yt as DeployIdentity, z as AnyDeployTarget } from "../types-CfLKGfC_.mjs";
3
+ import { i as ConfigLoadFailed, o as ConfigObjectNotSerializable } from "../config-C2BUosLm.mjs";
4
+ import { n as ConstructsNotSerializable, t as ConstructDiscoveryFailed } from "../discover-B6yPpvRV.mjs";
2
5
  import { a as TargetRuntimeMismatch, c as DeployTargetNotYetSupported, i as TargetPackageInvalid, l as UnknownDeployTarget, n as InvalidTargetOptions, o as ProviderRemoved, r as TargetEntryInvalid, s as TargetPackageNotFound, t as TargetRuntimeUndeclared } from "../runtime-CXPlkZzs.mjs";
3
6
  import { ConstructManifest } from "@geekmidas/manifest";
4
7
  import "@geekmidas/envkit/sniffer";
@@ -16,6 +19,176 @@ export declare const GKM_HOME_ENV = "GKM_HOME";
16
19
  /** The CLI's home: `GKM_HOME` if set, else `~/.gkm`. */
17
20
  export declare function gkmHome(env?: NodeJS.ProcessEnv): string;
18
21
  //#endregion
22
+ //#region src/run.d.ts
23
+ /** The program ran and exited unsuccessfully; its own output said why. */
24
+ export declare class CommandFailed extends Error {
25
+ readonly command: string;
26
+ readonly args: readonly string[];
27
+ readonly exitCode: number | null;
28
+ readonly signal: NodeJS.Signals | null;
29
+ constructor(command: string, args: readonly string[], exitCode: number | null, signal: NodeJS.Signals | null);
30
+ }
31
+ /** The program ran past its timeout and was killed. */
32
+ export declare class CommandTimedOut extends Error {
33
+ readonly command: string;
34
+ readonly args: readonly string[];
35
+ readonly timeoutMs: number;
36
+ constructor(command: string, args: readonly string[], timeoutMs: number);
37
+ }
38
+ //#endregion
39
+ //#region src/sandbox/env.d.ts
40
+ /**
41
+ * What of the host's environment a local sandbox passes on.
42
+ *
43
+ * An allowlist, not a denylist: a credential's variable has any name its
44
+ * owner chose (`DOKPLOY_TOKEN`, `AWS_SECRET_ACCESS_KEY`, `MY_VAULT_TOKEN`), so
45
+ * the only safe default is to name what a program needs to *run* and pass
46
+ * nothing else.
47
+ */
48
+ /**
49
+ * Variables a command needs to find programs, write temp files, print in the
50
+ * user's locale and reach the network through the host's proxy — and nothing
51
+ * that authenticates as anyone.
52
+ *
53
+ * Deliberately left out:
54
+ * - `NODE_OPTIONS`: it can `--require` or `--import` code into every node
55
+ * process, and CI often holds `--import tsx` there. A step that needs a
56
+ * loader passes its own.
57
+ * - `NODE_AUTH_TOKEN`, `NPM_TOKEN`, `npm_config_*`: registry tokens
58
+ * (`actions/setup-node` writes `NODE_AUTH_TOKEN`), which is why there is no
59
+ * `NODE_*` wildcard.
60
+ * - `AWS_*`, `DOCKER_*`, `DOKPLOY_*`, `GITHUB_TOKEN`, `TURBO_TOKEN`, `GKM_*`:
61
+ * credentials, or where the deploy keeps them.
62
+ * - `SHELL`, `EDITOR` and the rest of a login session: nothing here starts a
63
+ * shell.
64
+ *
65
+ * Proxies are passed: behind one, nothing installs or builds without it. A
66
+ * proxy URL with a password in it reaches the command too — a host that keeps
67
+ * one there and builds code it does not trust should pass a sandbox of its
68
+ * own.
69
+ */
70
+ export declare const SANDBOX_ENV_ALLOWLIST: readonly (string | RegExp)[];
71
+ /**
72
+ * The allowlisted part of `source`, plus each of `extra` the host chose to
73
+ * pass on by name.
74
+ */
75
+ export declare function allowlistedEnv(source?: NodeJS.ProcessEnv, extra?: readonly string[]): Record<string, string>;
76
+ //#endregion
77
+ //#region src/docker/templates.d.ts
78
+ type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun';
79
+ //#endregion
80
+ //#region src/sandbox/install.d.ts
81
+ /** Long enough for a cold install of a large monorepo. */
82
+ export declare const INSTALL_TIMEOUT_MS: number;
83
+ interface InstallOptions {
84
+ /** The directory to install in. Defaults to the sandbox's root. */
85
+ cwd?: string;
86
+ /** Defaults to the one the lockfile above `cwd` names. */
87
+ packageManager?: PackageManager;
88
+ /**
89
+ * Skip every lifecycle script — dependencies' and the project's own —
90
+ * except those of {@link allowScripts}. Defaults to false: scripts run as
91
+ * a plain install runs them, under the package manager's own policy —
92
+ * npm 12 and pnpm 10 skip dependencies' scripts nobody approved.
93
+ */
94
+ ignoreScripts?: boolean;
95
+ /**
96
+ * With `ignoreScripts`, the packages whose scripts still run: rebuilt by
97
+ * name once the install is done.
98
+ */
99
+ allowScripts?: readonly string[];
100
+ /** Variables the install needs beyond the sandbox's own. */
101
+ env?: Readonly<Record<string, string>>;
102
+ /** Defaults to {@link INSTALL_TIMEOUT_MS}, for each command. */
103
+ timeoutMs?: number;
104
+ /** Where the package manager's output goes. Defaults to `inherit`. */
105
+ output?: SandboxOutput;
106
+ signal?: AbortSignal;
107
+ }
108
+ /** A name in `allowScripts` that is not a package name. */
109
+ export declare class InstallAllowlistNameInvalid extends Error {
110
+ readonly packageName: string;
111
+ constructor(packageName: string);
112
+ }
113
+ /** The package manager has no way to run only some packages' scripts. */
114
+ export declare class InstallScriptsAllowlistUnsupported extends Error {
115
+ readonly packageManager: string;
116
+ readonly allowScripts: readonly string[];
117
+ constructor(packageManager: string, allowScripts: readonly string[]);
118
+ }
119
+ /**
120
+ * Install the project's dependencies in `sandbox`.
121
+ *
122
+ * ```ts
123
+ * // A checkout nobody has reviewed: no scripts but esbuild's.
124
+ * await installDependencies(sandbox, {
125
+ * ignoreScripts: true,
126
+ * allowScripts: ['esbuild'],
127
+ * });
128
+ * ```
129
+ *
130
+ * Resolves with each command's result, in order — with its output when
131
+ * `output` is `capture`.
132
+ *
133
+ * @throws {CommandFailed} when the package manager exits unsuccessfully.
134
+ * @throws {InstallScriptsAllowlistUnsupported} for an allowlist the package
135
+ * manager cannot honour, before anything is installed.
136
+ */
137
+ export declare function installDependencies(sandbox: Sandbox, options?: InstallOptions): Promise<SandboxResult[]>;
138
+ //#endregion
139
+ //#region src/sandbox/local.d.ts
140
+ interface LocalSandboxOptions {
141
+ /** The project. Every command runs at or below it. */
142
+ root: string;
143
+ /**
144
+ * `HOME` for every command. Defaults to the host's, because a build
145
+ * reuses the caches kept there — the pnpm store, corepack's package
146
+ * managers, turbo's cache — and a cold one re-downloads all of them.
147
+ * Point it at an empty directory to keep `~/.aws`, `~/.npmrc` and
148
+ * `~/.docker` out of reach of an SDK's default lookup — though, sharing
149
+ * the host's filesystem, a command that goes looking still finds them.
150
+ */
151
+ home?: string;
152
+ /**
153
+ * Host variables to pass on beyond the allowlist, by name — a remote
154
+ * cache's `TURBO_TOKEN`, for a build the host trusts with it.
155
+ */
156
+ passEnv?: readonly string[];
157
+ /** Where the allowlisted variables are read from. Defaults to `process.env`. */
158
+ hostEnv?: NodeJS.ProcessEnv;
159
+ }
160
+ /**
161
+ * A child process on this machine, as this user, with an allowlisted
162
+ * environment.
163
+ *
164
+ * What it withholds from the command: the host's environment beyond
165
+ * {@link SANDBOX_ENV_ALLOWLIST}, a shell, a working directory outside the
166
+ * project, and any time past the timeout. What it does not: the host's
167
+ * filesystem, which the command can read and write as the user running the
168
+ * deploy. So it is not `isolating`, and it is the default for projects the
169
+ * host already trusts — the developer's own, a team's own CI. Code nobody
170
+ * vetted belongs in a sandbox that is.
171
+ *
172
+ * A timed-out command is sent SIGTERM, then SIGKILL; processes it started
173
+ * itself are its to stop.
174
+ */
175
+ export declare class LocalSandbox implements Sandbox {
176
+ readonly root: string;
177
+ readonly isolating = false;
178
+ readonly env: Readonly<Record<string, string>>;
179
+ constructor(options: LocalSandboxOptions);
180
+ exec(command: string, args: readonly string[], options: SandboxExecOptions): Promise<SandboxResult>;
181
+ }
182
+ //#endregion
183
+ //#region src/sandbox/worker.d.ts
184
+ /** A worker ended without the answer it exists to give. */
185
+ export declare class SandboxWorkerFailed extends Error {
186
+ readonly step: string;
187
+ readonly exitCode: number | null;
188
+ readonly stderr: string;
189
+ constructor(step: string, exitCode: number | null, stderr: string);
190
+ }
191
+ //#endregion
19
192
  //#region src/deploy/deploy.d.ts
20
193
  /**
21
194
  * Where a run's progress lines go, besides its events. `@geekmidas/logger`'s
@@ -79,6 +252,18 @@ interface DeployInput {
79
252
  * default), its stderr, or nowhere.
80
253
  */
81
254
  childOutput?: 'inherit' | 'stderr' | 'ignore';
255
+ /**
256
+ * Where the project's own code runs: loading `gkm.config.ts`, discovering
257
+ * its constructs, sniffing each app's environment. Defaults to a
258
+ * `LocalSandbox` on the project — a child process here with an
259
+ * allowlisted environment, for a project the host trusts.
260
+ *
261
+ * A host deploying repositories it does not trust passes one that
262
+ * isolates — a container per build — and the config then reaches the
263
+ * deploy only as data. Credentials never enter a sandbox: they go from
264
+ * `credentials` to the steps that provision, push and release.
265
+ */
266
+ sandbox?: Sandbox;
82
267
  }
83
268
  /** A deploy in progress. */
84
269
  interface DeployRun extends AsyncIterable<DeployEvent> {
@@ -178,5 +363,5 @@ export declare class RegistryAmbiguous extends Error {
178
363
  constructor(registry: string, registryIds: readonly string[]);
179
364
  }
180
365
  //#endregion
181
- export { type AppDeployResult, type Credential, type CredentialKind, type CredentialKinds, type CredentialProvider, type CredentialRequest, type DeployEvent, type DeployEventError, type DeployEventType, type DeployIdentity, type DeployInput, type DeployLogger, type DeployPhase, type DeployResult, type DeployRun, DeployTargetNotYetSupported, InvalidTargetOptions, MissingCredential, ProviderRemoved, type ResourceChange, type ResourceVia, StateLocked, StateVersionConflict, type StoredCredentialsOptions, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget, chainCredentials, deployIdentity, storedCredentials };
366
+ export { type AppDeployResult, ConfigLoadFailed, ConfigObjectNotSerializable, ConstructDiscoveryFailed, ConstructsNotSerializable, type Credential, type CredentialKind, type CredentialKinds, type CredentialProvider, type CredentialRequest, type DeployEvent, type DeployEventError, type DeployEventType, type DeployIdentity, type DeployInput, type DeployLogger, type DeployPhase, type DeployResult, type DeployRun, DeployTargetNotYetSupported, type InstallOptions, InvalidTargetOptions, type LocalSandboxOptions, MissingCredential, ProviderRemoved, type ResourceChange, type ResourceVia, SECRETS_DIR_ENV, type Sandbox, SandboxCwdEscape, type SandboxExecOptions, type SandboxOutput, type SandboxResult, SecretNameInvalid, StateLocked, StateVersionConflict, type StoredCredentialsOptions, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget, chainCredentials, confineCwd, deployIdentity, storedCredentials };
182
367
  //# sourceMappingURL=public.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.mts","names":[],"sources":["../../src/home.ts","../../src/deploy/deploy.ts","../../src/deploy/index.ts","../../src/deploy/orchestrate.ts","../../src/deploy/ownership.ts","../../src/deploy/registry.ts"],"mappings":";;;;;;;;;;;;;;qBAaa;;wBAGG,QAAQ,MAAK,OAAO;;;;;;;UCanB;EAChB,KAAK;EACL,KAAK;EACL,OAAO;;UAGS;;;;;EAKhB;;EAEA;;;;;EAKA;;;;;;EAMA,UAAU,eAAe;;EAEzB;;EAEA;;;;;;EAMA;;;;;;EAMA,cAAc;;EAEd,SAAS;;;;;;EAMT,SAAS;;;;;EAKT;;;;;EAKA;;;UAIgB,kBAAkB,cAAc;;;;;;WAMvC,QAAQ,QAAQ;;;;;;;;;;;;;;;;;;wBAqEV,OAAO,OAAO,cAAc;;;;qBCqV/B,4BAA4B;WAE9B;EADV,YACU,aACT;;;qBAWW,uBAAuB;WAEzB;WACA;WACA;EAHV,YACU,aACA,4BACA;;;;;qBCvcE,0BAA0B;WAE5B;WACA;EAFV,YACU,yBACA;;;qBAWE,yBAAyB;WAE3B;WACA;EAFV,YACU,eACA;;;qBAUE,uBAAuB;WAEzB;;WAEA;EAHV,YACU,gBAEA;;EAAA,kBACT;;;;;;;;qBC1EW,wBAAwB;WAE1B;WACA;WACA;;WAEA;EALV,YACU,qBACA,mBACA,kBAEA;;EAAA;;;;;qBChBE,8BAA8B;WACrB;EAArB,YAAqB;;;qBAUT,yBAAyB;WAChB;EAArB,YAAqB;;;qBAUT,0BAA0B;WAE5B;WACA;EAFV,YACU,kBACA"}
1
+ {"version":3,"file":"public.d.mts","names":[],"sources":["../../src/home.ts","../../src/run.ts","../../src/sandbox/env.ts","../../src/docker/templates.ts","../../src/sandbox/install.ts","../../src/sandbox/local.ts","../../src/sandbox/worker.ts","../../src/deploy/deploy.ts","../../src/deploy/index.ts","../../src/deploy/orchestrate.ts","../../src/deploy/ownership.ts","../../src/deploy/registry.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAaa;;wBAGG,QAAQ,MAAK,OAAO;;;;qBCuBvB,sBAAsB;WAExB;WACA;WACA;WACA,QAAQ,OAAO;EAJzB,YACU,iBACA,yBACA,yBACA,QAAQ,OAAO;;;qBAUb,wBAAwB;WAE1B;WACA;WACA;EAHV,YACU,iBACA,yBACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBC3BE,0CAA0C;;;;;wBAyDvC,eACf,SAAQ,OAAO,YACf,4BACE;;;KCvFS;;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qB;;;qBAUT,yBAAyB;WAChB;EAArB,YAAqB;;;qBAUT,0BAA0B;WAE5B;WACA;EAFV,YACU,kBACA"}
@@ -1,10 +1,138 @@
1
- import { M as StateVersionConflict, k as StateLocked } from "../sniffer-DHE2Nafd.mjs";
1
+ import { B as LocalSandbox, H as allowlistedEnv, M as StateVersionConflict, U as CommandFailed, V as SANDBOX_ENV_ALLOWLIST, W as CommandTimedOut, k as StateLocked, u as detectPackageManager } from "../sniffer-aO_-s5vq.mjs";
2
2
  import { n as gkmHome, t as GKM_HOME_ENV } from "../home-GI7pJl1M.mjs";
3
+ import { d as SandboxCwdEscape, f as SecretNameInvalid, h as confineCwd, n as ConstructsNotSerializable, o as SandboxWorkerFailed, t as ConstructDiscoveryFailed, u as SECRETS_DIR_ENV } from "../discover-BaT6bpnA.mjs";
4
+ import { i as ConfigObjectNotSerializable, n as ConfigLoadFailed } from "../config-LKKCVCnC.mjs";
3
5
  import { a as UnknownDeployTarget, i as DeployTargetNotYetSupported } from "../define-CHBIEc5j.mjs";
4
6
  import { u as deployIdentity } from "../store-BS8A7NcA.mjs";
5
7
  import { i as TargetPackageNotFound, t as TargetRuntimeUndeclared } from "../runtime-DbakJS8u.mjs";
6
- import { i as TargetRuntimeMismatch, n as TargetEntryInvalid, r as TargetPackageInvalid, s as ProviderRemoved, t as InvalidTargetOptions } from "../resolve-CFCIkm7m.mjs";
7
- import { c as MissingCredential, i as UnknownDeployApps, l as chainCredentials, n as NoDeployableApps, r as RollbackFailed, u as storedCredentials } from "../terminal-ByZNjuig.mjs";
8
- import { t as deploy } from "../deploy-Cg9fae7a.mjs";
9
- import { d as RegistryNotFound, f as ProjectNotOwned, l as RegistryAmbiguous, n as MissingEnvVars, t as BackendDeployFailed, u as RegistryNotConfigured } from "../deploy-B7jvUORo.mjs";
10
- export { BackendDeployFailed, DeployTargetNotYetSupported, GKM_HOME_ENV, InvalidTargetOptions, MissingCredential, MissingEnvVars, NoDeployableApps, ProjectNotOwned, ProviderRemoved, RegistryAmbiguous, RegistryNotConfigured, RegistryNotFound, RollbackFailed, StateLocked, StateVersionConflict, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployApps, UnknownDeployTarget, chainCredentials, deploy, deployIdentity, gkmHome, storedCredentials };
8
+ import { i as TargetRuntimeMismatch, n as TargetEntryInvalid, r as TargetPackageInvalid, s as ProviderRemoved, t as InvalidTargetOptions } from "../resolve-B1T0hUaR.mjs";
9
+ import { c as MissingCredential, i as UnknownDeployApps, l as chainCredentials, n as NoDeployableApps, r as RollbackFailed, u as storedCredentials } from "../terminal-gMxAo9Dj.mjs";
10
+ import { t as deploy } from "../deploy-CGW-QY9D.mjs";
11
+ import { d as RegistryNotFound, f as ProjectNotOwned, l as RegistryAmbiguous, n as MissingEnvVars, t as BackendDeployFailed, u as RegistryNotConfigured } from "../deploy-CG8bfFij.mjs";
12
+ import { join, resolve } from "node:path";
13
+ import { existsSync } from "node:fs";
14
+ //#region src/sandbox/install.ts
15
+ /**
16
+ * Installing a project's dependencies in a sandbox, with or without their
17
+ * lifecycle scripts.
18
+ *
19
+ * `postinstall` is the oldest way into a build machine: any package in the
20
+ * lockfile — a dependency of a dependency — runs whatever it likes the moment
21
+ * it is installed. For a build the host trusts that is how native modules get
22
+ * built. For one it does not, the scripts are skipped, and the few packages
23
+ * that genuinely need theirs (esbuild's binary, a database driver) are named
24
+ * and rebuilt — with nothing but the sandbox's environment either way.
25
+ */
26
+ /** Long enough for a cold install of a large monorepo. */
27
+ const INSTALL_TIMEOUT_MS = 9e5;
28
+ /** A name in `allowScripts` that is not a package name. */
29
+ var InstallAllowlistNameInvalid = class extends Error {
30
+ packageName;
31
+ constructor(packageName) {
32
+ super(`'${packageName}' is not a package name, so its scripts cannot be allowed. Name the package as it appears in package.json — 'esbuild', '@prisma/client'.`);
33
+ this.packageName = packageName;
34
+ this.name = "InstallAllowlistNameInvalid";
35
+ }
36
+ };
37
+ /** The package manager has no way to run only some packages' scripts. */
38
+ var InstallScriptsAllowlistUnsupported = class extends Error {
39
+ packageManager;
40
+ allowScripts;
41
+ constructor(packageManager, allowScripts) {
42
+ super(`${packageManager} cannot rebuild named packages after an install without scripts, so ${allowScripts.join(", ")} cannot be allowed theirs. Use pnpm, npm or Yarn 2+, or install with every script skipped.`);
43
+ this.packageManager = packageManager;
44
+ this.allowScripts = allowScripts;
45
+ this.name = "InstallScriptsAllowlistUnsupported";
46
+ }
47
+ };
48
+ /**
49
+ * npm's package-name grammar, less a leading `-`: each name is an argument to
50
+ * `rebuild`, and must never be read as a flag.
51
+ */
52
+ const PACKAGE_NAME = /^(?:@[a-z0-9~][a-z0-9._~-]*\/)?[a-z0-9~][a-z0-9._~-]*$/;
53
+ /**
54
+ * The commands an install runs, in order. Exported for the tests, which
55
+ * check each package manager's flags without installing with all four.
56
+ */
57
+ function installCommands(packageManager, cwd, options = {}) {
58
+ const ignore = options.ignoreScripts ?? false;
59
+ const allow = ignore ? [...options.allowScripts ?? []] : [];
60
+ for (const name of allow) if (!PACKAGE_NAME.test(name)) throw new InstallAllowlistNameInvalid(name);
61
+ switch (packageManager) {
62
+ case "pnpm": return [["pnpm", [
63
+ "install",
64
+ "--frozen-lockfile",
65
+ ...ignore ? ["--ignore-scripts"] : []
66
+ ]], ...allow.length > 0 ? [["pnpm", [
67
+ "rebuild",
68
+ "--config.dangerouslyAllowAllBuilds=true",
69
+ ...allow
70
+ ]]] : []];
71
+ case "npm": return [["npm", [existsSync(join(cwd, "package-lock.json")) ? "ci" : "install", ...ignore ? ["--ignore-scripts"] : []]], ...allow.length > 0 ? [["npm", [
72
+ "rebuild",
73
+ "--dangerously-allow-all-scripts",
74
+ ...allow
75
+ ]]] : []];
76
+ case "yarn":
77
+ if (existsSync(join(cwd, ".yarnrc.yml"))) return [["yarn", [
78
+ "install",
79
+ "--immutable",
80
+ ...ignore ? ["--mode=skip-build"] : []
81
+ ]], ...allow.length > 0 ? [["yarn", ["rebuild", ...allow]]] : []];
82
+ if (allow.length > 0) throw new InstallScriptsAllowlistUnsupported("Yarn 1", allow);
83
+ return [["yarn", [
84
+ "install",
85
+ "--frozen-lockfile",
86
+ ...ignore ? ["--ignore-scripts"] : []
87
+ ]]];
88
+ case "bun":
89
+ if (allow.length > 0) throw new InstallScriptsAllowlistUnsupported("bun", allow);
90
+ return [["bun", [
91
+ "install",
92
+ "--frozen-lockfile",
93
+ ...ignore ? ["--ignore-scripts"] : []
94
+ ]]];
95
+ }
96
+ }
97
+ /**
98
+ * Install the project's dependencies in `sandbox`.
99
+ *
100
+ * ```ts
101
+ * // A checkout nobody has reviewed: no scripts but esbuild's.
102
+ * await installDependencies(sandbox, {
103
+ * ignoreScripts: true,
104
+ * allowScripts: ['esbuild'],
105
+ * });
106
+ * ```
107
+ *
108
+ * Resolves with each command's result, in order — with its output when
109
+ * `output` is `capture`.
110
+ *
111
+ * @throws {CommandFailed} when the package manager exits unsuccessfully.
112
+ * @throws {InstallScriptsAllowlistUnsupported} for an allowlist the package
113
+ * manager cannot honour, before anything is installed.
114
+ */
115
+ async function installDependencies(sandbox, options = {}) {
116
+ const cwd = options.cwd ?? sandbox.root;
117
+ const results = [];
118
+ const packageManager = options.packageManager ?? detectPackageManager(resolve(sandbox.root, cwd));
119
+ for (const [command, args] of installCommands(packageManager, resolve(sandbox.root, cwd), options)) {
120
+ const result = await sandbox.exec(command, args, {
121
+ cwd,
122
+ env: {
123
+ ...sandbox.env,
124
+ ...options.env
125
+ },
126
+ timeoutMs: options.timeoutMs ?? 9e5,
127
+ output: options.output ?? "inherit",
128
+ ...options.signal ? { signal: options.signal } : {}
129
+ });
130
+ results.push(result);
131
+ if (result.exitCode !== 0) throw new CommandFailed(command, args, result.exitCode, result.signal);
132
+ }
133
+ return results;
134
+ }
135
+ //#endregion
136
+ export { BackendDeployFailed, CommandFailed, CommandTimedOut, ConfigLoadFailed, ConfigObjectNotSerializable, ConstructDiscoveryFailed, ConstructsNotSerializable, DeployTargetNotYetSupported, GKM_HOME_ENV, INSTALL_TIMEOUT_MS, InstallAllowlistNameInvalid, InstallScriptsAllowlistUnsupported, InvalidTargetOptions, LocalSandbox, MissingCredential, MissingEnvVars, NoDeployableApps, ProjectNotOwned, ProviderRemoved, RegistryAmbiguous, RegistryNotConfigured, RegistryNotFound, RollbackFailed, SANDBOX_ENV_ALLOWLIST, SECRETS_DIR_ENV, SandboxCwdEscape, SandboxWorkerFailed, SecretNameInvalid, StateLocked, StateVersionConflict, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployApps, UnknownDeployTarget, allowlistedEnv, chainCredentials, confineCwd, deploy, deployIdentity, gkmHome, installDependencies, storedCredentials };
137
+
138
+ //# sourceMappingURL=public.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.mjs","names":[],"sources":["../../src/sandbox/install.ts"],"sourcesContent":["/**\n * Installing a project's dependencies in a sandbox, with or without their\n * lifecycle scripts.\n *\n * `postinstall` is the oldest way into a build machine: any package in the\n * lockfile — a dependency of a dependency — runs whatever it likes the moment\n * it is installed. For a build the host trusts that is how native modules get\n * built. For one it does not, the scripts are skipped, and the few packages\n * that genuinely need theirs (esbuild's binary, a database driver) are named\n * and rebuilt — with nothing but the sandbox's environment either way.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { detectPackageManager, type PackageManager } from '../docker/templates';\nimport { CommandFailed } from '../run';\nimport type { Sandbox, SandboxOutput, SandboxResult } from './sandbox';\n\n/** Long enough for a cold install of a large monorepo. */\nexport const INSTALL_TIMEOUT_MS = 15 * 60_000;\n\nexport interface InstallOptions {\n\t/** The directory to install in. Defaults to the sandbox's root. */\n\tcwd?: string;\n\t/** Defaults to the one the lockfile above `cwd` names. */\n\tpackageManager?: PackageManager;\n\t/**\n\t * Skip every lifecycle script — dependencies' and the project's own —\n\t * except those of {@link allowScripts}. Defaults to false: scripts run as\n\t * a plain install runs them, under the package manager's own policy —\n\t * npm 12 and pnpm 10 skip dependencies' scripts nobody approved.\n\t */\n\tignoreScripts?: boolean;\n\t/**\n\t * With `ignoreScripts`, the packages whose scripts still run: rebuilt by\n\t * name once the install is done.\n\t */\n\tallowScripts?: readonly string[];\n\t/** Variables the install needs beyond the sandbox's own. */\n\tenv?: Readonly<Record<string, string>>;\n\t/** Defaults to {@link INSTALL_TIMEOUT_MS}, for each command. */\n\ttimeoutMs?: number;\n\t/** Where the package manager's output goes. Defaults to `inherit`. */\n\toutput?: SandboxOutput;\n\tsignal?: AbortSignal;\n}\n\n/** A name in `allowScripts` that is not a package name. */\nexport class InstallAllowlistNameInvalid extends Error {\n\tconstructor(readonly packageName: string) {\n\t\tsuper(\n\t\t\t`'${packageName}' is not a package name, so its scripts cannot be ` +\n\t\t\t\t'allowed. Name the package as it appears in package.json — ' +\n\t\t\t\t\"'esbuild', '@prisma/client'.\",\n\t\t);\n\t\tthis.name = 'InstallAllowlistNameInvalid';\n\t}\n}\n\n/** The package manager has no way to run only some packages' scripts. */\nexport class InstallScriptsAllowlistUnsupported extends Error {\n\tconstructor(\n\t\treadonly packageManager: string,\n\t\treadonly allowScripts: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`${packageManager} cannot rebuild named packages after an install ` +\n\t\t\t\t`without scripts, so ${allowScripts.join(', ')} cannot be allowed ` +\n\t\t\t\t'theirs. Use pnpm, npm or Yarn 2+, or install with every script ' +\n\t\t\t\t'skipped.',\n\t\t);\n\t\tthis.name = 'InstallScriptsAllowlistUnsupported';\n\t}\n}\n\n/**\n * npm's package-name grammar, less a leading `-`: each name is an argument to\n * `rebuild`, and must never be read as a flag.\n */\nconst PACKAGE_NAME = /^(?:@[a-z0-9~][a-z0-9._~-]*\\/)?[a-z0-9~][a-z0-9._~-]*$/;\n\n/**\n * The commands an install runs, in order. Exported for the tests, which\n * check each package manager's flags without installing with all four.\n */\nexport function installCommands(\n\tpackageManager: PackageManager,\n\tcwd: string,\n\toptions: Pick<InstallOptions, 'ignoreScripts' | 'allowScripts'> = {},\n): [string, string[]][] {\n\tconst ignore = options.ignoreScripts ?? false;\n\tconst allow = ignore ? [...(options.allowScripts ?? [])] : [];\n\tfor (const name of allow) {\n\t\tif (!PACKAGE_NAME.test(name)) throw new InstallAllowlistNameInvalid(name);\n\t}\n\n\tswitch (packageManager) {\n\t\tcase 'pnpm':\n\t\t\treturn [\n\t\t\t\t[\n\t\t\t\t\t'pnpm',\n\t\t\t\t\t[\n\t\t\t\t\t\t'install',\n\t\t\t\t\t\t'--frozen-lockfile',\n\t\t\t\t\t\t...(ignore ? ['--ignore-scripts'] : []),\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t\t// pnpm 10 builds no dependency it was not told to, even by name;\n\t\t\t\t// this command names exactly the ones allowed, so it may build\n\t\t\t\t// what it names.\n\t\t\t\t...(allow.length > 0\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'pnpm',\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t'rebuild',\n\t\t\t\t\t\t\t\t\t'--config.dangerouslyAllowAllBuilds=true',\n\t\t\t\t\t\t\t\t\t...allow,\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t] as [string, string[]],\n\t\t\t\t\t\t]\n\t\t\t\t\t: []),\n\t\t\t];\n\t\tcase 'npm': {\n\t\t\tconst locked = existsSync(join(cwd, 'package-lock.json'));\n\t\t\treturn [\n\t\t\t\t[\n\t\t\t\t\t'npm',\n\t\t\t\t\t[locked ? 'ci' : 'install', ...(ignore ? ['--ignore-scripts'] : [])],\n\t\t\t\t],\n\t\t\t\t// npm 12 runs no dependency's install script its `allowScripts`\n\t\t\t\t// policy does not approve, rebuilt by name or not, and refuses\n\t\t\t\t// `--allow-scripts` on a project's command line. This command\n\t\t\t\t// names exactly the packages allowed, so it may run what it names.\n\t\t\t\t...(allow.length > 0\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'npm',\n\t\t\t\t\t\t\t\t['rebuild', '--dangerously-allow-all-scripts', ...allow],\n\t\t\t\t\t\t\t] as [string, string[]],\n\t\t\t\t\t\t]\n\t\t\t\t\t: []),\n\t\t\t];\n\t\t}\n\t\tcase 'yarn': {\n\t\t\t// Yarn 2+ keeps a `.yarnrc.yml`; it skips builds by mode and can\n\t\t\t// rebuild by name. Yarn 1 can only skip them all.\n\t\t\tconst berry = existsSync(join(cwd, '.yarnrc.yml'));\n\t\t\tif (berry) {\n\t\t\t\treturn [\n\t\t\t\t\t[\n\t\t\t\t\t\t'yarn',\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t'install',\n\t\t\t\t\t\t\t'--immutable',\n\t\t\t\t\t\t\t...(ignore ? ['--mode=skip-build'] : []),\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\t...(allow.length > 0\n\t\t\t\t\t\t? [['yarn', ['rebuild', ...allow]] as [string, string[]]]\n\t\t\t\t\t\t: []),\n\t\t\t\t];\n\t\t\t}\n\t\t\tif (allow.length > 0) {\n\t\t\t\tthrow new InstallScriptsAllowlistUnsupported('Yarn 1', allow);\n\t\t\t}\n\t\t\treturn [\n\t\t\t\t[\n\t\t\t\t\t'yarn',\n\t\t\t\t\t[\n\t\t\t\t\t\t'install',\n\t\t\t\t\t\t'--frozen-lockfile',\n\t\t\t\t\t\t...(ignore ? ['--ignore-scripts'] : []),\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t];\n\t\t}\n\t\tcase 'bun':\n\t\t\tif (allow.length > 0) {\n\t\t\t\tthrow new InstallScriptsAllowlistUnsupported('bun', allow);\n\t\t\t}\n\t\t\treturn [\n\t\t\t\t[\n\t\t\t\t\t'bun',\n\t\t\t\t\t[\n\t\t\t\t\t\t'install',\n\t\t\t\t\t\t'--frozen-lockfile',\n\t\t\t\t\t\t...(ignore ? ['--ignore-scripts'] : []),\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t];\n\t}\n}\n\n/**\n * Install the project's dependencies in `sandbox`.\n *\n * ```ts\n * // A checkout nobody has reviewed: no scripts but esbuild's.\n * await installDependencies(sandbox, {\n * ignoreScripts: true,\n * allowScripts: ['esbuild'],\n * });\n * ```\n *\n * Resolves with each command's result, in order — with its output when\n * `output` is `capture`.\n *\n * @throws {CommandFailed} when the package manager exits unsuccessfully.\n * @throws {InstallScriptsAllowlistUnsupported} for an allowlist the package\n * manager cannot honour, before anything is installed.\n */\nexport async function installDependencies(\n\tsandbox: Sandbox,\n\toptions: InstallOptions = {},\n): Promise<SandboxResult[]> {\n\tconst cwd = options.cwd ?? sandbox.root;\n\tconst results: SandboxResult[] = [];\n\tconst packageManager =\n\t\toptions.packageManager ?? detectPackageManager(resolve(sandbox.root, cwd));\n\n\tfor (const [command, args] of installCommands(\n\t\tpackageManager,\n\t\tresolve(sandbox.root, cwd),\n\t\toptions,\n\t)) {\n\t\tconst result = await sandbox.exec(command, args, {\n\t\t\tcwd,\n\t\t\tenv: { ...sandbox.env, ...options.env },\n\t\t\ttimeoutMs: options.timeoutMs ?? INSTALL_TIMEOUT_MS,\n\t\t\toutput: options.output ?? 'inherit',\n\t\t\t...(options.signal ? { signal: options.signal } : {}),\n\t\t});\n\t\tresults.push(result);\n\t\tif (result.exitCode !== 0) {\n\t\t\tthrow new CommandFailed(\n\t\t\t\tcommand,\n\t\t\t\targs,\n\t\t\t\tresult.exitCode,\n\t\t\t\tresult.signal as NodeJS.Signals | null,\n\t\t\t);\n\t\t}\n\t}\n\treturn results;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,qBAAqB;;AA6BlC,IAAa,8BAAb,cAAiD,MAAM;CACjC;CAArB,YAAY,aAA8B;EACzC,MACC,IAAI,YAAY,yIAGjB;EALoB,KAAA,cAAA;EAMpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qCAAb,cAAwD,MAAM;CAEnD;CACA;CAFV,YACC,gBACA,cACC;EACD,MACC,G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