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