@geekmidas/cli 10.0.0-alpha.61 → 10.0.0-alpha.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +2 -0
  2. package/dist/{HostingerProvider-DI_Pr2VE.mjs → HostingerProvider-DBBwpDjn.mjs} +2 -2
  3. package/dist/{HostingerProvider-DI_Pr2VE.mjs.map → HostingerProvider-DBBwpDjn.mjs.map} +1 -1
  4. package/dist/{HostingerProvider-CgDaD8VR.cjs → HostingerProvider-mJ7YruxH.cjs} +2 -2
  5. package/dist/{HostingerProvider-CgDaD8VR.cjs.map → HostingerProvider-mJ7YruxH.cjs.map} +1 -1
  6. package/dist/{LegacyStateStore-JbBVFp_2.cjs → LegacyStateStore-CP7SZwTP.cjs} +2 -2
  7. package/dist/{LegacyStateStore-JbBVFp_2.cjs.map → LegacyStateStore-CP7SZwTP.cjs.map} +1 -1
  8. package/dist/{LegacyStateStore-C7vFAxbu.mjs → LegacyStateStore-Q3GmKOdw.mjs} +2 -2
  9. package/dist/{LegacyStateStore-C7vFAxbu.mjs.map → LegacyStateStore-Q3GmKOdw.mjs.map} +1 -1
  10. package/dist/{LocalStateStore-DfUwQsL8.mjs → LocalStateStore-BGIXcrvX.mjs} +2 -2
  11. package/dist/{LocalStateStore-DfUwQsL8.mjs.map → LocalStateStore-BGIXcrvX.mjs.map} +1 -1
  12. package/dist/{LocalStateStore-DHj_-CQB.cjs → LocalStateStore-sS8mvLeq.cjs} +2 -2
  13. package/dist/{LocalStateStore-DHj_-CQB.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-xqnpUrzy.cjs → S3StateStore-6jqITH2F.cjs} +2 -2
  19. package/dist/{S3StateStore-xqnpUrzy.cjs.map → S3StateStore-6jqITH2F.cjs.map} +1 -1
  20. package/dist/{S3StateStore-Dq6hHtzY.mjs → S3StateStore-D7l_lWJ3.mjs} +2 -2
  21. package/dist/{S3StateStore-Dq6hHtzY.mjs.map → S3StateStore-D7l_lWJ3.mjs.map} +1 -1
  22. package/dist/{SSMStateStore-5dBRwVlJ.cjs → SSMStateStore-B__F7IJa.cjs} +2 -2
  23. package/dist/{SSMStateStore-5dBRwVlJ.cjs.map → SSMStateStore-B__F7IJa.cjs.map} +1 -1
  24. package/dist/{SSMStateStore-SUmvAbLi.mjs → SSMStateStore-CAQDVpoc.mjs} +2 -2
  25. package/dist/{SSMStateStore-SUmvAbLi.mjs.map → SSMStateStore-CAQDVpoc.mjs.map} +1 -1
  26. package/dist/{bundler-DXATpO1T.cjs → bundler-DLfOn0ls.cjs} +3 -3
  27. package/dist/{bundler-DXATpO1T.cjs.map → bundler-DLfOn0ls.cjs.map} +1 -1
  28. package/dist/{bundler-B5VsKW-_.mjs → bundler-DyWI41Iy.mjs} +2 -2
  29. package/dist/{bundler-B5VsKW-_.mjs.map → bundler-DyWI41Iy.mjs.map} +1 -1
  30. package/dist/{cli-DQdrVkj2.cjs → cli-D-ZM-X2s.cjs} +12 -16
  31. package/dist/cli-D-ZM-X2s.cjs.map +1 -0
  32. package/dist/{cli-DEA_J3Sa.mjs → cli-PkVF28LM.mjs} +10 -14
  33. package/dist/cli-PkVF28LM.mjs.map +1 -0
  34. package/dist/{config-DXnkCEq0.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-C5-EEdmr.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 +4 -211
  44. package/dist/config.d.mts +4 -211
  45. package/dist/config.mjs +3 -3
  46. package/dist/define-CHBIEc5j.mjs +94 -0
  47. package/dist/define-CHBIEc5j.mjs.map +1 -0
  48. package/dist/define-Cv_QvDrg.cjs +141 -0
  49. package/dist/define-Cv_QvDrg.cjs.map +1 -0
  50. package/dist/deploy/public.cjs +174 -13
  51. package/dist/deploy/public.cjs.map +1 -0
  52. package/dist/deploy/public.d.cts +200 -292
  53. package/dist/deploy/public.d.cts.map +1 -1
  54. package/dist/deploy/public.d.mts +200 -292
  55. package/dist/deploy/public.d.mts.map +1 -1
  56. package/dist/deploy/public.mjs +136 -3
  57. package/dist/deploy/public.mjs.map +1 -0
  58. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  59. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  60. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  61. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  62. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  63. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  64. package/dist/{deploy-BbJdgQ2b.cjs → deploy-ABBI0lf1.cjs} +169 -561
  65. package/dist/deploy-ABBI0lf1.cjs.map +1 -0
  66. package/dist/deploy-BiMrP9i7.cjs +140 -0
  67. package/dist/deploy-BiMrP9i7.cjs.map +1 -0
  68. package/dist/{deploy-BJcLmVTc.mjs → deploy-CG8bfFij.mjs} +152 -532
  69. package/dist/deploy-CG8bfFij.mjs.map +1 -0
  70. package/dist/deploy-CGW-QY9D.mjs +135 -0
  71. package/dist/deploy-CGW-QY9D.mjs.map +1 -0
  72. package/dist/discover-B6yPpvRV.d.mts +99 -0
  73. package/dist/discover-B6yPpvRV.d.mts.map +1 -0
  74. package/dist/discover-B_IkPukx.d.cts +99 -0
  75. package/dist/discover-B_IkPukx.d.cts.map +1 -0
  76. package/dist/discover-BaT6bpnA.mjs +614 -0
  77. package/dist/discover-BaT6bpnA.mjs.map +1 -0
  78. package/dist/discover-C_6COHEv.cjs +729 -0
  79. package/dist/discover-C_6COHEv.cjs.map +1 -0
  80. package/dist/dokploy-CwdmlyQL.mjs +32 -0
  81. package/dist/dokploy-CwdmlyQL.mjs.map +1 -0
  82. package/dist/dokploy-QJxMhxdf.cjs +32 -0
  83. package/dist/dokploy-QJxMhxdf.cjs.map +1 -0
  84. package/dist/{encryption-DaA9gRXr.mjs → encryption-CbQG_ayW.mjs} +4 -4
  85. package/dist/{encryption-DaA9gRXr.mjs.map → encryption-CbQG_ayW.mjs.map} +1 -1
  86. package/dist/{encryption-ojzUo7-z.cjs → encryption-DXw3jj0c.cjs} +4 -4
  87. package/dist/{encryption-ojzUo7-z.cjs.map → encryption-DXw3jj0c.cjs.map} +1 -1
  88. package/dist/fakes-C9RiT6XG.mjs.map +1 -1
  89. package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
  90. package/dist/{github-Cq57poPj.cjs → github-BH_mETav.cjs} +3 -3
  91. package/dist/{github-Cq57poPj.cjs.map → github-BH_mETav.cjs.map} +1 -1
  92. package/dist/{github-DmCj2u95.mjs → github-ciwbIwVa.mjs} +3 -3
  93. package/dist/{github-DmCj2u95.mjs.map → github-ciwbIwVa.mjs.map} +1 -1
  94. package/dist/{index-UiWCaGzU.d.cts → index-BtXDZQuF.d.cts} +2 -2
  95. package/dist/{index-Da1-oa9W.d.mts.map → index-BtXDZQuF.d.cts.map} +1 -1
  96. package/dist/{index-Da1-oa9W.d.mts → index-DrKzpHl-.d.mts} +2 -2
  97. package/dist/{index-UiWCaGzU.d.cts.map → index-DrKzpHl-.d.mts.map} +1 -1
  98. package/dist/index.cjs +60 -52
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.mjs +57 -49
  101. package/dist/index.mjs.map +1 -1
  102. package/dist/{migrate-BScRpCEx.cjs → migrate-6oa9y_f2.cjs} +5 -5
  103. package/dist/{migrate-BScRpCEx.cjs.map → migrate-6oa9y_f2.cjs.map} +1 -1
  104. package/dist/{migrate-5_J5JySj.mjs → migrate-ImBKTBcW.mjs} +5 -5
  105. package/dist/{migrate-5_J5JySj.mjs.map → migrate-ImBKTBcW.mjs.map} +1 -1
  106. package/dist/openapi.cjs +3 -3
  107. package/dist/openapi.d.cts +1 -1
  108. package/dist/openapi.d.mts +1 -1
  109. package/dist/openapi.mjs +3 -3
  110. package/dist/{ready-XlNx-Gbo.cjs → ready-BiG0rt4h.cjs} +3 -3
  111. package/dist/{ready-XlNx-Gbo.cjs.map → ready-BiG0rt4h.cjs.map} +1 -1
  112. package/dist/{ready-DQIy21W5.mjs → ready-Bpdnn2ON.mjs} +3 -3
  113. package/dist/{ready-DQIy21W5.mjs.map → ready-Bpdnn2ON.mjs.map} +1 -1
  114. package/dist/reconcile/public.cjs +1 -1
  115. package/dist/reconcile/public.d.cts +4 -77
  116. package/dist/reconcile/public.d.cts.map +1 -1
  117. package/dist/reconcile/public.d.mts +4 -77
  118. package/dist/reconcile/public.d.mts.map +1 -1
  119. package/dist/reconcile/public.mjs +1 -1
  120. package/dist/resolve-B1T0hUaR.mjs +170 -0
  121. package/dist/resolve-B1T0hUaR.mjs.map +1 -0
  122. package/dist/resolve-xytBTtG4.cjs +217 -0
  123. package/dist/resolve-xytBTtG4.cjs.map +1 -0
  124. package/dist/runtime-CMwtq0AL.cjs +163 -0
  125. package/dist/runtime-CMwtq0AL.cjs.map +1 -0
  126. package/dist/runtime-CXPlkZzs.d.mts +90 -0
  127. package/dist/runtime-CXPlkZzs.d.mts.map +1 -0
  128. package/dist/runtime-DbakJS8u.mjs +134 -0
  129. package/dist/runtime-DbakJS8u.mjs.map +1 -0
  130. package/dist/runtime-Dn_n-29S.d.cts +90 -0
  131. package/dist/runtime-Dn_n-29S.d.cts.map +1 -0
  132. package/dist/sandbox/config-worker.cjs +43 -0
  133. package/dist/sandbox/config-worker.cjs.map +1 -0
  134. package/dist/sandbox/config-worker.d.cts +1 -0
  135. package/dist/sandbox/config-worker.d.mts +1 -0
  136. package/dist/sandbox/config-worker.mjs +44 -0
  137. package/dist/sandbox/config-worker.mjs.map +1 -0
  138. package/dist/sandbox/discover-worker.cjs +44 -0
  139. package/dist/sandbox/discover-worker.cjs.map +1 -0
  140. package/dist/sandbox/discover-worker.d.cts +1 -0
  141. package/dist/sandbox/discover-worker.d.mts +1 -0
  142. package/dist/sandbox/discover-worker.mjs +45 -0
  143. package/dist/sandbox/discover-worker.mjs.map +1 -0
  144. package/dist/sandbox-M8UnLhXE.d.cts +126 -0
  145. package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
  146. package/dist/sandbox-M8UnLhXE.d.mts +126 -0
  147. package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
  148. package/dist/{workspace-Bp1xVaOz.mjs → schemas-Ckm_aBnF.cjs} +264 -969
  149. package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
  150. package/dist/{workspace-B64Xk1Mb.cjs → schemas-D2LCF689.mjs} +195 -1155
  151. package/dist/schemas-D2LCF689.mjs.map +1 -0
  152. package/dist/{sniffer-CQmJnNJM.cjs → sniffer-D_SYc_pO.cjs} +379 -214
  153. package/dist/sniffer-D_SYc_pO.cjs.map +1 -0
  154. package/dist/{sniffer-bdleks5l.mjs → sniffer-aO_-s5vq.mjs} +346 -211
  155. package/dist/sniffer-aO_-s5vq.mjs.map +1 -0
  156. package/dist/target/public.cjs +15 -0
  157. package/dist/target/public.d.cts +28 -0
  158. package/dist/target/public.d.cts.map +1 -0
  159. package/dist/target/public.d.mts +28 -0
  160. package/dist/target/public.d.mts.map +1 -0
  161. package/dist/target/public.mjs +4 -0
  162. package/dist/terminal-D0f1u0LG.cjs +576 -0
  163. package/dist/terminal-D0f1u0LG.cjs.map +1 -0
  164. package/dist/terminal-gMxAo9Dj.mjs +517 -0
  165. package/dist/terminal-gMxAo9Dj.mjs.map +1 -0
  166. package/dist/{types-efNLu9xu.d.cts → types-CfLKGfC_.d.mts} +624 -34
  167. package/dist/types-CfLKGfC_.d.mts.map +1 -0
  168. package/dist/{types-Bp1mVxG0.d.mts → types-DIA7Li-J.d.cts} +626 -34
  169. package/dist/types-DIA7Li-J.d.cts.map +1 -0
  170. package/dist/vitest.cjs +2 -2
  171. package/dist/vitest.mjs +2 -2
  172. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  173. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  174. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  175. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  176. package/dist/workspace/index.cjs +1 -1
  177. package/dist/workspace/index.d.cts +3 -3
  178. package/dist/workspace/index.d.mts +3 -3
  179. package/dist/workspace/index.mjs +1 -1
  180. package/dist/workspace-Dh7rr7l4.mjs +1024 -0
  181. package/dist/workspace-Dh7rr7l4.mjs.map +1 -0
  182. package/dist/workspace-Kl4NG9IH.cjs +1196 -0
  183. package/dist/workspace-Kl4NG9IH.cjs.map +1 -0
  184. package/package.json +23 -13
  185. package/dist/cli-DEA_J3Sa.mjs.map +0 -1
  186. package/dist/cli-DQdrVkj2.cjs.map +0 -1
  187. package/dist/config-C5-EEdmr.mjs.map +0 -1
  188. package/dist/config-DXnkCEq0.cjs.map +0 -1
  189. package/dist/config.d.cts.map +0 -1
  190. package/dist/config.d.mts.map +0 -1
  191. package/dist/deploy-BJcLmVTc.mjs.map +0 -1
  192. package/dist/deploy-BbJdgQ2b.cjs.map +0 -1
  193. package/dist/discover-Bc-4eA_p.cjs +0 -299
  194. package/dist/discover-Bc-4eA_p.cjs.map +0 -1
  195. package/dist/discover-FrYvzkeC.mjs +0 -262
  196. package/dist/discover-FrYvzkeC.mjs.map +0 -1
  197. package/dist/sniffer-CQmJnNJM.cjs.map +0 -1
  198. package/dist/sniffer-bdleks5l.mjs.map +0 -1
  199. package/dist/types-Bp1mVxG0.d.mts.map +0 -1
  200. package/dist/types-efNLu9xu.d.cts.map +0 -1
  201. package/dist/workspace-B64Xk1Mb.cjs.map +0 -1
  202. package/dist/workspace-Bp1xVaOz.mjs.map +0 -1
@@ -0,0 +1,256 @@
1
+ import { _ as LoadedConfig, b as NormalizedWorkspace, r as GkmConfig, y as NormalizedAppConfig } from "./types-DIA7Li-J.cjs";
2
+ import { n as Sandbox } from "./sandbox-M8UnLhXE.cjs";
3
+ import "./index-BtXDZQuF.cjs";
4
+ import { ConstructManifest } from "@geekmidas/manifest";
5
+ //#region src/dev/discovery.d.ts
6
+ /** Where an app is in its life. `stopped` is a server that exited on its own. */
7
+ type AppStatus = 'starting' | 'ready' | 'reloading' | 'stopped';
8
+ /** A JSON API an app serves about itself. */
9
+ type DataApiKind = 'telescope' | 'database' | 'openapi';
10
+ interface DiscoveredDataApi {
11
+ kind: DataApiKind;
12
+ /** Where the app serves it. */
13
+ path: string;
14
+ /** The app's own address for it — `http://localhost:<port><path>`. */
15
+ url: string;
16
+ /** The same API through this endpoint, relative to its origin. */
17
+ proxy: string;
18
+ }
19
+ interface DiscoveredApp {
20
+ name: string;
21
+ type: 'backend' | 'web' | 'mobile';
22
+ port: number;
23
+ /** `http://localhost:<port>`. */
24
+ url: string;
25
+ publicUrl: string | null;
26
+ status: AppStatus;
27
+ reloads: number;
28
+ /** The `gkm dev` running it, when it runs in one of its own. */
29
+ pid: number | null;
30
+ dataApis: DiscoveredDataApi[];
31
+ }
32
+ interface DiscoveredWorkspace {
33
+ /** Stable for a workspace's root: its name, and a hash of where it is. */
34
+ id: string;
35
+ name: string;
36
+ root: string;
37
+ stage: string;
38
+ manifest: ConstructManifest | null;
39
+ apps: DiscoveredApp[];
40
+ }
41
+ /** The body of `GET /__gkm`. */
42
+ interface DiscoveryResponse {
43
+ version: 1;
44
+ /** The `gkm dev` serving this endpoint, which may change while you watch. */
45
+ host: {
46
+ pid: number;
47
+ port: number;
48
+ };
49
+ /** Where the changes stream, as server-sent events. */
50
+ events: string;
51
+ workspaces: DiscoveredWorkspace[];
52
+ }
53
+ /** One message on `GET /__gkm/events`; its SSE `event:` is its `type`. */
54
+ type DiscoveryEvent = {
55
+ type: 'snapshot';
56
+ snapshot: DiscoveryResponse;
57
+ } | {
58
+ type: 'workspace.started' | 'workspace.stopped';
59
+ workspace: string;
60
+ } | {
61
+ type: 'app.started' | 'app.stopped' | 'app.reloaded' | 'app.status';
62
+ workspace: string;
63
+ app: DiscoveredApp;
64
+ };
65
+ //#endregion
66
+ //#region src/config.d.ts
67
+ /**
68
+ * Define GKM configuration with full TypeScript support.
69
+ * This is an identity function that provides type safety and autocomplete.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * // gkm.config.ts
74
+ * import { defineConfig } from '@geekmidas/cli/config';
75
+ *
76
+ * export default defineConfig({
77
+ * routes: './src/endpoints/**\/*.ts',
78
+ * envParser: './src/config/env',
79
+ * logger: './src/config/logger',
80
+ * telescope: true,
81
+ * });
82
+ * ```
83
+ */
84
+ declare function defineConfig(config: GkmConfig): GkmConfig;
85
+ interface ParsedModuleConfig {
86
+ path: string;
87
+ importPattern: string;
88
+ }
89
+ /**
90
+ * Parse a module config string into path and import pattern.
91
+ *
92
+ * @param configString - Config string in format "./path/to/module" or "./path/to/module#exportName"
93
+ * @param defaultAlias - The default alias name to use if no export name specified
94
+ * @returns Object with path and import pattern
95
+ *
96
+ * @example
97
+ * parseModuleConfig('./src/config/env', 'envParser')
98
+ * // { path: './src/config/env', importPattern: 'envParser' }
99
+ *
100
+ * parseModuleConfig('./src/config/env#envParser', 'envParser')
101
+ * // { path: './src/config/env', importPattern: '{ envParser }' }
102
+ *
103
+ * parseModuleConfig('./src/config/env#myEnv', 'envParser')
104
+ * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }
105
+ */
106
+ declare function parseModuleConfig(configString: string, defaultAlias: string): ParsedModuleConfig;
107
+ interface ConfigDiscoveryResult {
108
+ configPath: string;
109
+ workspaceRoot: string;
110
+ }
111
+ /**
112
+ * The directory holding the gkm config that `cwd` belongs to — the project a
113
+ * sandbox for it is confined to.
114
+ *
115
+ * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.
116
+ */
117
+ declare function findWorkspaceRoot(cwd: string): string;
118
+ /** No gkm config in a directory or any of its parents. */
119
+ declare class ConfigNotFound extends Error {
120
+ readonly cwd: string;
121
+ constructor(cwd: string);
122
+ }
123
+ interface LoadConfigOptions {
124
+ /**
125
+ * Load the config — and discover the constructs it names — in this
126
+ * sandbox rather than in this process. The config then arrives as data;
127
+ * see {@link Sandbox.isolating} for what happens to one holding live
128
+ * objects. Defaults to the run's own (`withSandbox`); with neither, the
129
+ * config is imported here, as `gkm` always has.
130
+ */
131
+ sandbox?: Sandbox;
132
+ /**
133
+ * How long the sandboxed config load may run. Defaults to
134
+ * {@link CONFIG_LOAD_TIMEOUT_MS}.
135
+ */
136
+ timeoutMs?: number;
137
+ }
138
+ /**
139
+ * How long loading a config, or discovering its constructs, may take in a
140
+ * sandbox: room for tsx to compile a large project cold, and not a deploy
141
+ * held open by a config that never finishes importing.
142
+ */
143
+ declare const CONFIG_LOAD_TIMEOUT_MS = 60000;
144
+ /** The config failed to import, or threw while it ran. */
145
+ declare class ConfigLoadFailed extends Error {
146
+ readonly configPath: string;
147
+ readonly detail: string;
148
+ constructor(configPath: string, detail: string);
149
+ }
150
+ /**
151
+ * The config holds something that is not data — a custom state store, an
152
+ * inline deploy target, a function — and the sandbox it was loaded in hands
153
+ * the deploy nothing but data.
154
+ */
155
+ declare class ConfigObjectNotSerializable extends Error {
156
+ readonly configPath: string;
157
+ readonly paths: readonly string[];
158
+ constructor(configPath: string, paths: readonly string[]);
159
+ }
160
+ /**
161
+ * Load configuration file (single-app format).
162
+ * For backwards compatibility with existing code.
163
+ *
164
+ * @deprecated Use loadWorkspaceConfig for new code
165
+ */
166
+ declare function loadConfig(cwd?: string): Promise<GkmConfig>;
167
+ /**
168
+ * Load configuration file and process it as a workspace.
169
+ * Works with both single-app and workspace configurations.
170
+ *
171
+ * Single-app configs are automatically wrapped as a workspace with one app.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const { type, workspace } = await loadWorkspaceConfig();
176
+ *
177
+ * if (type === 'workspace') {
178
+ * console.log('Multi-app workspace:', workspace.apps);
179
+ * } else {
180
+ * console.log('Single app wrapped as workspace');
181
+ * }
182
+ * ```
183
+ */
184
+ /**
185
+ * The workspace a directory belongs to, as its config states it — without
186
+ * discovering its constructs.
187
+ *
188
+ * For callers that need a fact the config holds (where a stage's secrets are
189
+ * stored) and nothing the graph adds. `loadWorkspaceConfig` imports every
190
+ * construct module to derive the apps, which is a cost a secrets read should
191
+ * not pay.
192
+ */
193
+ declare function loadWorkspaceSettings(cwd?: string, options?: LoadConfigOptions): Promise<LoadedConfig['workspace']>;
194
+ declare function loadWorkspaceConfig(cwd?: string, options?: LoadConfigOptions): Promise<LoadedConfig>;
195
+ /**
196
+ * A workspace with no `constructs` glob.
197
+ *
198
+ * In v10 every address, container and app comes from what the workspace
199
+ * declares — there is no second path that reads a hand-written compose file or
200
+ * an `apps` block's ports. A config that declares nothing has nothing to run.
201
+ */
202
+ declare class WorkspaceDeclaresNoConstructs extends Error {
203
+ readonly root: string;
204
+ constructor(root: string);
205
+ }
206
+ interface AppConfigResult {
207
+ appName: string;
208
+ app: NormalizedAppConfig;
209
+ gkmConfig: GkmConfig;
210
+ workspace: NormalizedWorkspace;
211
+ workspaceRoot: string;
212
+ appRoot: string;
213
+ }
214
+ /** A directory that no app in the workspace lives in. */
215
+ declare class NotInAnApp extends Error {
216
+ readonly cwd: string;
217
+ readonly apps: Readonly<Record<string, string>>;
218
+ constructor(cwd: string, apps: Readonly<Record<string, string>>);
219
+ }
220
+ /**
221
+ * The backend app a directory is part of, with its gkm config — found by the
222
+ * `path` its construct declares.
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * // From apps/api, where a construct declares `path: 'apps/api'`
227
+ * const { app, workspace, workspaceRoot } = await loadAppConfig();
228
+ * ```
229
+ *
230
+ * @throws {NotInAnApp} when no app's path contains the directory.
231
+ * @throws {NotABackendApp} when the app it is in has no gkm config to run.
232
+ */
233
+ declare function loadAppConfig(cwd?: string): Promise<AppConfigResult>;
234
+ /** The app a directory is in has no gkm config — a site, or an entry app. */
235
+ declare class NotABackendApp extends Error {
236
+ readonly appName: string;
237
+ constructor(appName: string);
238
+ }
239
+ interface WorkspaceAppInfo {
240
+ /** The app's key in the workspace. */
241
+ appName: string;
242
+ app: NormalizedAppConfig;
243
+ workspace: NormalizedWorkspace;
244
+ workspaceRoot: string;
245
+ }
246
+ /**
247
+ * The app a directory is part of, frontend or backend — found by the `path`
248
+ * its construct declares. Unlike `loadAppConfig`, the app need not have a
249
+ * gkm config, which is what `gkm exec` and `gkm test` from a site need.
250
+ *
251
+ * @throws {NotInAnApp} when no app's path contains the directory.
252
+ */
253
+ declare function loadWorkspaceAppInfo(cwd?: string): Promise<WorkspaceAppInfo>;
254
+ //#endregion
255
+ export { DiscoveredApp as C, DiscoveryResponse as D, DiscoveryEvent as E, DataApiKind as S, DiscoveredWorkspace as T, loadWorkspaceAppInfo as _, ConfigNotFound as a, parseModuleConfig as b, NotABackendApp as c, WorkspaceAppInfo as d, WorkspaceDeclaresNoConstructs as f, loadConfig as g, loadAppConfig as h, ConfigLoadFailed as i, NotInAnApp as l, findWorkspaceRoot as m, CONFIG_LOAD_TIMEOUT_MS as n, ConfigObjectNotSerializable as o, defineConfig as p, ConfigDiscoveryResult as r, LoadConfigOptions as s, AppConfigResult as t, ParsedModuleConfig as u, loadWorkspaceConfig as v, DiscoveredDataApi as w, AppStatus as x, loadWorkspaceSettings as y };
256
+ //# sourceMappingURL=config-CemHVcIr.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CemHVcIr.d.cts","names":[],"sources":["../src/dev/discovery.ts","../src/config.ts"],"mappings":";;;;;;KAoFY;;KAGA;UA6CK;EAChB,MAAM;;EAEN;;EAEA;;EAEA;;UAGgB;EAChB;EACA;EACA;;EAEA;EACA;EACA,QAAQ;EACR;;EAEA;EACA,UAAU;;UAGM;;EAEhB;EACA;EACA;EACA;EACA,UAAU;EACV,MAAM;;;UAIU;EAChB;;EAEA;IAAQ;IAAa;;;EAErB;EACA,YAAY;;;KAID;EACP;EAAkB,UAAU;;EAC5B;EAAiD;;EAEnD;EACA;EACA,KAAK;;;;;;;;;;;;;;;;;;;;;iBCpIQ,aAAa,QAAQ,YAAY;UAIhC;EAChB;EACA;;;;;;;;;;;;;;;;;;;iBAoBe,kBACf,sBACA,uBACE;UAac;EAChB;EACA;;;;;;;;iBAgDe,kBAAkB;;cAKrB,uBAAuB;WACd;EAArB,YAAqB;;UAaL;;;;;;;;EAQhB,UAAU;;;;;EAKV;;;;;;;cAQY;;cAGA,yBAAyB;WAE3B;WACA;EAFV,YACU,oBACA;;;;;;;cAYE,oCAAoC;WAEtC;WACA;EAFV,YACU,oBACA;;;;;;;;iBA0GW,WACrB,eACE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCW,sBACrB,cACA,UAAS,oBACP,QAAQ;iBAKW,oBACrB,cACA,UAAS,oBACP,QAAQ;;;;;;;;cAgEE,sCAAsC;WAC7B;EAArB,YAAqB;;UAWL;EAChB;EACA,KAAK;EACL,WAAW;EACX,WAAW;EACX;EACA;;;cAqCY,mBAAmB;WAErB;WACA,MAAM,SAAS;EAFzB,YACU,aACA,MAAM,SAAS;;;;;;;;;;;;;;;iBAoCJ,cACrB,eACE,QAAQ;;cAkBE,uBAAuB;WACd;EAArB,YAAqB;;UAQL;;EAEhB;EACA,KAAK;EACL,WAAW;EACX;;;;;;;;;iBAUqB,qBACrB,eACE,QAAQ"}
@@ -1,5 +1,6 @@
1
- import { a as output, t as discover } from "./discover-FrYvzkeC.mjs";
2
- import { h as isWorkspaceConfig, l as processConfig, o as getAppGkmConfig, t as allConstructGlobs } from "./workspace-Bp1xVaOz.mjs";
1
+ import { a as discriminatedUnion, c as object, l as record, n as array, o as literal, p as unknown, u as string } from "./schemas-D2LCF689.mjs";
2
+ import { c as runWorker, p as activeSandbox, r as discover, v as output } from "./discover-BaT6bpnA.mjs";
3
+ import { h as isWorkspaceConfig, l as processConfig, o as getAppGkmConfig, t as allConstructGlobs } from "./workspace-Dh7rr7l4.mjs";
3
4
  import { dirname, join, parse, resolve, sep } from "node:path";
4
5
  import { existsSync, realpathSync } from "node:fs";
5
6
  import { kebabCase } from "@geekmidas/manifest";
@@ -228,6 +229,15 @@ function findConfigPath(cwd) {
228
229
  }
229
230
  throw new ConfigNotFound(cwd);
230
231
  }
232
+ /**
233
+ * The directory holding the gkm config that `cwd` belongs to — the project a
234
+ * sandbox for it is confined to.
235
+ *
236
+ * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.
237
+ */
238
+ function findWorkspaceRoot(cwd) {
239
+ return findConfigPath(cwd).workspaceRoot;
240
+ }
231
241
  /** No gkm config in a directory or any of its parents. */
232
242
  var ConfigNotFound = class extends Error {
233
243
  cwd;
@@ -238,20 +248,99 @@ var ConfigNotFound = class extends Error {
238
248
  }
239
249
  };
240
250
  /**
241
- * Load raw configuration from file.
251
+ * How long loading a config, or discovering its constructs, may take in a
252
+ * sandbox: room for tsx to compile a large project cold, and not a deploy
253
+ * held open by a config that never finishes importing.
242
254
  */
243
- async function loadRawConfig(cwd) {
244
- const { configPath, workspaceRoot } = findConfigPath(cwd);
255
+ const CONFIG_LOAD_TIMEOUT_MS = 6e4;
256
+ /** The config failed to import, or threw while it ran. */
257
+ var ConfigLoadFailed = class extends Error {
258
+ configPath;
259
+ detail;
260
+ constructor(configPath, detail) {
261
+ super(`Failed to load config: ${detail}`);
262
+ this.configPath = configPath;
263
+ this.detail = detail;
264
+ this.name = "ConfigLoadFailed";
265
+ }
266
+ };
267
+ /**
268
+ * The config holds something that is not data — a custom state store, an
269
+ * inline deploy target, a function — and the sandbox it was loaded in hands
270
+ * the deploy nothing but data.
271
+ */
272
+ var ConfigObjectNotSerializable = class extends Error {
273
+ configPath;
274
+ paths;
275
+ constructor(configPath, paths) {
276
+ super(`${configPath} holds values that are not plain data at: ${paths.join(", ")}. It was loaded in an isolating sandbox, which hands the deploy the config as JSON, so a live object — a custom store, an inline target, a function — cannot reach it. Configure these with plain values instead, or deploy this project with a sandbox that is not isolating (the default) if the host trusts it.`);
277
+ this.configPath = configPath;
278
+ this.paths = paths;
279
+ this.name = "ConfigObjectNotSerializable";
280
+ }
281
+ };
282
+ /** What the config worker answers. Checked: the worker ran project code. */
283
+ const ConfigAnswer = discriminatedUnion("reason", [
284
+ object({
285
+ reason: literal("loaded"),
286
+ config: record(string(), unknown())
287
+ }),
288
+ object({
289
+ reason: literal("live"),
290
+ paths: array(string())
291
+ }),
292
+ object({
293
+ reason: literal("failed"),
294
+ error: object({
295
+ name: string(),
296
+ message: string()
297
+ })
298
+ })
299
+ ]);
300
+ /** Import the config in this process — live objects and all. */
301
+ async function importConfig(configPath) {
245
302
  try {
246
- return {
247
- config: (await import(configPath)).default,
248
- workspaceRoot
249
- };
303
+ return (await import(configPath)).default;
250
304
  } catch (error) {
251
- throw new Error(`Failed to load config: ${error.message}`);
305
+ throw new ConfigLoadFailed(configPath, error.message);
306
+ }
307
+ }
308
+ /**
309
+ * The config, loaded in `sandbox` and handed back as JSON.
310
+ *
311
+ * A config holding live objects cannot come back that way. An isolating
312
+ * sandbox refuses it with {@link ConfigObjectNotSerializable}; any other
313
+ * imports it here as well, as before, since the host already runs this
314
+ * project's code as its own.
315
+ */
316
+ async function loadConfigInSandbox(sandbox, configPath, workspaceRoot, timeoutMs = CONFIG_LOAD_TIMEOUT_MS) {
317
+ const { value } = await runWorker(sandbox, "config load", {
318
+ name: "config-worker",
319
+ args: [configPath],
320
+ cwd: workspaceRoot,
321
+ timeoutMs,
322
+ schema: ConfigAnswer
323
+ });
324
+ switch (value.reason) {
325
+ case "loaded": return value.config;
326
+ case "failed": throw new ConfigLoadFailed(configPath, value.error.message);
327
+ case "live":
328
+ if (sandbox.isolating) throw new ConfigObjectNotSerializable(configPath, value.paths);
329
+ return importConfig(configPath);
252
330
  }
253
331
  }
254
332
  /**
333
+ * Load raw configuration from file.
334
+ */
335
+ async function loadRawConfig(cwd, options = {}) {
336
+ const { configPath, workspaceRoot } = findConfigPath(cwd);
337
+ const sandbox = options.sandbox ?? activeSandbox();
338
+ return {
339
+ config: sandbox ? await loadConfigInSandbox(sandbox, configPath, workspaceRoot, options.timeoutMs) : await importConfig(configPath),
340
+ workspaceRoot
341
+ };
342
+ }
343
+ /**
255
344
  * Load configuration file (single-app format).
256
345
  * For backwards compatibility with existing code.
257
346
  *
@@ -288,13 +377,13 @@ async function loadConfig(cwd = process.cwd()) {
288
377
  * construct module to derive the apps, which is a cost a secrets read should
289
378
  * not pay.
290
379
  */
291
- async function loadWorkspaceSettings(cwd = process.cwd()) {
292
- const { config, workspaceRoot } = await loadRawConfig(cwd);
380
+ async function loadWorkspaceSettings(cwd = process.cwd(), options = {}) {
381
+ const { config, workspaceRoot } = await loadRawConfig(cwd, options);
293
382
  return processConfig(config, workspaceRoot).workspace;
294
383
  }
295
- async function loadWorkspaceConfig(cwd = process.cwd()) {
296
- const { config, workspaceRoot } = await loadRawConfig(cwd);
297
- return withDerivedApps(processConfig(config, workspaceRoot));
384
+ async function loadWorkspaceConfig(cwd = process.cwd(), options = {}) {
385
+ const { config, workspaceRoot } = await loadRawConfig(cwd, options);
386
+ return withDerivedApps(processConfig(config, workspaceRoot), options.sandbox);
298
387
  }
299
388
  /**
300
389
  * The loaded config, with its apps read off the graph.
@@ -315,13 +404,14 @@ async function loadWorkspaceConfig(cwd = process.cwd()) {
315
404
  * cannot be imported is a worse failure than starting with the app it does not
316
405
  * describe yet.
317
406
  */
318
- async function withDerivedApps(loaded) {
407
+ async function withDerivedApps(loaded, sandbox) {
319
408
  const globs = allConstructGlobs(loaded.workspace);
320
409
  if (globs.length === 0) throw new WorkspaceDeclaresNoConstructs(loaded.workspace.root);
321
410
  try {
322
411
  const manifest = await discover({
323
412
  patterns: globs,
324
- cwd: loaded.workspace.root
413
+ cwd: loaded.workspace.root,
414
+ ...sandbox ? { sandbox } : {}
325
415
  });
326
416
  return {
327
417
  ...loaded,
@@ -452,6 +542,6 @@ async function loadWorkspaceAppInfo(cwd = process.cwd()) {
452
542
  };
453
543
  }
454
544
  //#endregion
455
- export { defineConfig as a, loadWorkspaceAppInfo as c, parseModuleConfig as d, appKey as f, WorkspaceDeclaresNoConstructs as i, loadWorkspaceConfig as l, NotABackendApp as n, loadAppConfig as o, derivedApps as p, NotInAnApp as r, loadConfig as s, ConfigNotFound as t, loadWorkspaceSettings as u };
545
+ export { derivedApps as _, NotABackendApp as a, defineConfig as c, loadConfig as d, loadWorkspaceAppInfo as f, appKey as g, parseModuleConfig as h, ConfigObjectNotSerializable as i, findWorkspaceRoot as l, loadWorkspaceSettings as m, ConfigLoadFailed as n, NotInAnApp as o, loadWorkspaceConfig as p, ConfigNotFound as r, WorkspaceDeclaresNoConstructs as s, CONFIG_LOAD_TIMEOUT_MS as t, loadAppConfig as u };
456
546
 
457
- //# sourceMappingURL=config-C5-EEdmr.mjs.map
547
+ //# sourceMappingURL=config-LKKCVCnC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-LKKCVCnC.mjs","names":["z.discriminatedUnion","z.object","z.literal","z.record","z.string","z.unknown","z.array"],"sources":["../src/workspace/derive.ts","../src/config.ts"],"sourcesContent":["/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app, and so is every\n * `rest-api` — one surface, one container, at the `path` it declared.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tkebabCase,\n} from '@geekmidas/manifest';\nimport type {\n\tAppDomainConfig,\n\tDeployTargetName,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (!declaration || declaration.kind !== 'rest-api') return undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\tconst sites = Object.entries(apps).filter(([, a]) => a.type === 'web');\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTargetName =\n\t\tworkspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, a mobile app and an HTTP surface. A worker\n\t\t// is not one — it names the process that runs a cron or a subscriber, and\n\t\t// that process is the app's server, which already exists. Everything else\n\t\t// is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. Each says where it lives.\n\t\tconst spec: AppSpec =\n\t\t\tdeclaration.kind === 'site' || declaration.kind === 'mobile-app'\n\t\t\t\t? declaration.app\n\t\t\t\t: {\n\t\t\t\t\t\tpath: declaration.path,\n\t\t\t\t\t\t...(declaration.telescope ? { telescope: true } : {}),\n\t\t\t\t\t};\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype:\n\t\t\t\tdeclaration.kind === 'site'\n\t\t\t\t\t? 'web'\n\t\t\t\t\t: declaration.kind === 'mobile-app'\n\t\t\t\t\t\t? 'mobile'\n\t\t\t\t\t\t: 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\t// The label it answers on, under a stage's domain and locally alike.\n\t\t\t...((declaration.kind === 'rest-api' || declaration.kind === 'site') &&\n\t\t\tdeclaration.subdomain\n\t\t\t\t? { subdomain: declaration.subdomain }\n\t\t\t\t: {}),\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(declaration.kind === 'mobile-app'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? declaration.variant,\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// A site names its edges `dependencies`; a surface names them `calls`.\n\t\tconst edges =\n\t\t\tdeclaration.kind === 'rest-api'\n\t\t\t\t? (declaration.calls ?? [])\n\t\t\t\t: (declaration.dependencies ?? []);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n","import { existsSync, realpathSync } from 'node:fs';\nimport { dirname, join, parse, resolve, sep } from 'node:path';\nimport { z } from 'zod';\nimport { output } from './output.js';\nimport { discover } from './reconcile/discover.js';\nimport { activeSandbox, type Sandbox } from './sandbox/sandbox.js';\nimport { runWorker } from './sandbox/worker.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\n// What `gkm dev`'s discovery endpoint answers, for the tools that read it.\nexport type {\n\tAppStatus,\n\tDataApiKind,\n\tDiscoveredApp,\n\tDiscoveredDataApi,\n\tDiscoveredWorkspace,\n\tDiscoveryEvent,\n\tDiscoveryResponse,\n} from './dev/discovery.js';\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\nexport type { DevConfig } from './workspace/types.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new ConfigNotFound(cwd);\n}\n\n/**\n * The directory holding the gkm config that `cwd` belongs to — the project a\n * sandbox for it is confined to.\n *\n * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.\n */\nexport function findWorkspaceRoot(cwd: string): string {\n\treturn findConfigPath(cwd).workspaceRoot;\n}\n\n/** No gkm config in a directory or any of its parents. */\nexport class ConfigNotFound extends Error {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t\t);\n\t\tthis.name = 'ConfigNotFound';\n\t}\n}\n\ninterface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\nexport interface LoadConfigOptions {\n\t/**\n\t * Load the config — and discover the constructs it names — in this\n\t * sandbox rather than in this process. The config then arrives as data;\n\t * see {@link Sandbox.isolating} for what happens to one holding live\n\t * objects. Defaults to the run's own (`withSandbox`); with neither, the\n\t * config is imported here, as `gkm` always has.\n\t */\n\tsandbox?: Sandbox;\n\t/**\n\t * How long the sandboxed config load may run. Defaults to\n\t * {@link CONFIG_LOAD_TIMEOUT_MS}.\n\t */\n\ttimeoutMs?: number;\n}\n\n/**\n * How long loading a config, or discovering its constructs, may take in a\n * sandbox: room for tsx to compile a large project cold, and not a deploy\n * held open by a config that never finishes importing.\n */\nexport const CONFIG_LOAD_TIMEOUT_MS = 60_000;\n\n/** The config failed to import, or threw while it ran. */\nexport class ConfigLoadFailed extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Failed to load config: ${detail}`);\n\t\tthis.name = 'ConfigLoadFailed';\n\t}\n}\n\n/**\n * The config holds something that is not data — a custom state store, an\n * inline deploy target, a function — and the sandbox it was loaded in hands\n * the deploy nothing but data.\n */\nexport class ConfigObjectNotSerializable extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly paths: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`${configPath} holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. It was loaded in an isolating sandbox, which ` +\n\t\t\t\t'hands the deploy the config as JSON, so a live object — a custom ' +\n\t\t\t\t'store, an inline target, a function — cannot reach it. Configure ' +\n\t\t\t\t'these with plain values instead, or deploy this project with a ' +\n\t\t\t\t'sandbox that is not isolating (the default) if the host trusts it.',\n\t\t);\n\t\tthis.name = 'ConfigObjectNotSerializable';\n\t}\n}\n\n/** What the config worker answers. Checked: the worker ran project code. */\nconst ConfigAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('loaded'),\n\t\tconfig: z.record(z.string(), z.unknown()),\n\t}),\n\tz.object({ reason: z.literal('live'), paths: z.array(z.string()) }),\n\tz.object({\n\t\treason: z.literal('failed'),\n\t\terror: z.object({ name: z.string(), message: z.string() }),\n\t}),\n]);\n\n/** Import the config in this process — live objects and all. */\nasync function importConfig(\n\tconfigPath: string,\n): Promise<GkmConfig | WorkspaceConfig> {\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn config.default;\n\t} catch (error) {\n\t\tthrow new ConfigLoadFailed(configPath, (error as Error).message);\n\t}\n}\n\n/**\n * The config, loaded in `sandbox` and handed back as JSON.\n *\n * A config holding live objects cannot come back that way. An isolating\n * sandbox refuses it with {@link ConfigObjectNotSerializable}; any other\n * imports it here as well, as before, since the host already runs this\n * project's code as its own.\n */\nasync function loadConfigInSandbox(\n\tsandbox: Sandbox,\n\tconfigPath: string,\n\tworkspaceRoot: string,\n\ttimeoutMs = CONFIG_LOAD_TIMEOUT_MS,\n): Promise<GkmConfig | WorkspaceConfig> {\n\tconst { value } = await runWorker(sandbox, 'config load', {\n\t\tname: 'config-worker',\n\t\targs: [configPath],\n\t\tcwd: workspaceRoot,\n\t\ttimeoutMs,\n\t\tschema: ConfigAnswer,\n\t});\n\n\tswitch (value.reason) {\n\t\tcase 'loaded':\n\t\t\t// Its shape is `processConfig`'s to check, against the workspace\n\t\t\t// schema, exactly as for a config imported here.\n\t\t\treturn value.config as unknown as GkmConfig | WorkspaceConfig;\n\t\tcase 'failed':\n\t\t\tthrow new ConfigLoadFailed(configPath, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) {\n\t\t\t\tthrow new ConfigObjectNotSerializable(configPath, value.paths);\n\t\t\t}\n\t\t\treturn importConfig(configPath);\n\t}\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(\n\tcwd: string,\n\toptions: LoadConfigOptions = {},\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\t// The run's own sandbox when none is given: a deploy reloads the config\n\t// deep in the engine (generating Dockerfiles), and that load is the\n\t// project's code as much as the first.\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tconst config = sandbox\n\t\t? await loadConfigInSandbox(\n\t\t\t\tsandbox,\n\t\t\t\tconfigPath,\n\t\t\t\tworkspaceRoot,\n\t\t\t\toptions.timeoutMs,\n\t\t\t)\n\t\t: await importConfig(configPath);\n\n\treturn { config, workspaceRoot };\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\n/**\n * The workspace a directory belongs to, as its config states it — without\n * discovering its constructs.\n *\n * For callers that need a fact the config holds (where a stage's secrets are\n * stored) and nothing the graph adds. `loadWorkspaceConfig` imports every\n * construct module to derive the apps, which is a cost a secrets read should\n * not pay.\n */\nexport async function loadWorkspaceSettings(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig['workspace']> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn processConfig(config, workspaceRoot).workspace;\n}\n\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn withDerivedApps(processConfig(config, workspaceRoot), options.sandbox);\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(\n\tloaded: LoadedConfig,\n\tsandbox?: Sandbox,\n): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) {\n\t\tthrow new WorkspaceDeclaresNoConstructs(loaded.workspace.root);\n\t}\n\n\ttry {\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t\t...(sandbox ? { sandbox } : {}),\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\toutput.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\n/**\n * A workspace with no `constructs` glob.\n *\n * In v10 every address, container and app comes from what the workspace\n * declares — there is no second path that reads a hand-written compose file or\n * an `apps` block's ports. A config that declares nothing has nothing to run.\n */\nexport class WorkspaceDeclaresNoConstructs extends Error {\n\tconstructor(readonly root: string) {\n\t\tsuper(\n\t\t\t`The workspace at ${root} declares no constructs. Every workspace names ` +\n\t\t\t\t\"where its constructs live — `constructs: ['./constructs/**/*.ts', \" +\n\t\t\t\t\"'./apps/*/endpoints/**/*.ts']` in gkm.config.ts — and its apps, \" +\n\t\t\t\t'containers and URLs are derived from them.',\n\t\t);\n\t\tthis.name = 'WorkspaceDeclaresNoConstructs';\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a directory is part of: the one whose `path` contains it.\n *\n * An app's path is the one its construct declares — `new RestApi('Api',\n * { path: 'apps/api' })` — read off the workspace the constructs were derived\n * into, never off the filesystem's package names. The deepest match wins, so\n * an app inside another app's folder is its own; the workspace root belongs to\n * no app unless one lives there.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tcwd: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst here = real(cwd);\n\tlet found: { key: string; app: NormalizedAppConfig; dir: string } | undefined;\n\n\tfor (const [key, app] of Object.entries(loadedConfig.workspace.apps)) {\n\t\tconst dir = real(join(loadedConfig.workspace.root, app.path));\n\t\tconst inside = here === dir || here.startsWith(`${dir}${sep}`);\n\t\tif (inside && (!found || dir.length > found.dir.length)) {\n\t\t\tfound = { key, app, dir };\n\t\t}\n\t}\n\n\treturn found && { key: found.key, app: found.app };\n}\n\n/** A path with its symlinks resolved, where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\tconst absolute = resolve(path);\n\treturn existsSync(absolute) ? realpathSync(absolute) : absolute;\n}\n\n/** A directory that no app in the workspace lives in. */\nexport class NotInAnApp extends Error {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly apps: Readonly<Record<string, string>>,\n\t) {\n\t\tsuper(\n\t\t\t`${cwd} is not inside any app's path. Apps: ` +\n\t\t\t\tObject.entries(apps)\n\t\t\t\t\t.map(([key, path]) => `${key} (${path})`)\n\t\t\t\t\t.join(', ') +\n\t\t\t\t'.',\n\t\t);\n\t\tthis.name = 'NotInAnApp';\n\t}\n}\n\n/** Every app's path, by key — what `NotInAnApp` lists. */\nfunction appPaths(loadedConfig: LoadedConfig): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(loadedConfig.workspace.apps).map(([key, app]) => [\n\t\t\tkey,\n\t\t\tapp.path,\n\t\t]),\n\t);\n}\n\n/**\n * The backend app a directory is part of, with its gkm config — found by the\n * `path` its construct declares.\n *\n * @example\n * ```ts\n * // From apps/api, where a construct declares `path: 'apps/api'`\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * ```\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n * @throws {NotABackendApp} when the app it is in has no gkm config to run.\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst { appName, app, workspace, workspaceRoot } =\n\t\tawait loadWorkspaceAppInfo(cwd);\n\n\tconst gkmConfig = getAppGkmConfig(workspace, appName);\n\tif (!gkmConfig) throw new NotABackendApp(appName);\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\n/** The app a directory is in has no gkm config — a site, or an entry app. */\nexport class NotABackendApp extends Error {\n\tconstructor(readonly appName: string) {\n\t\tsuper(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t\tthis.name = 'NotABackendApp';\n\t}\n}\n\nexport interface WorkspaceAppInfo {\n\t/** The app's key in the workspace. */\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * The app a directory is part of, frontend or backend — found by the `path`\n * its construct declares. Unlike `loadAppConfig`, the app need not have a\n * gkm config, which is what `gkm exec` and `gkm test` from a site need.\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, cwd);\n\tif (!resolved) throw new NotInAnApp(cwd, appPaths(loadedConfig));\n\n\treturn {\n\t\tappName: resolved.key,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,aAAwC;CAC7C,QAAQ;CACR,MAAM;CACN,UAAU;AACX;;;;;;;;AASA,SAAgB,OAAO,IAAoB;CAC1C,OAAO,UAAU,EAAE;AACpB;;;;;;;;;AAUA,SAAgB,OACf,UACA,IACqB;CACrB,MAAM,cAAc,SAAS;CAC7B,IAAI,CAAC,eAAe,YAAY,SAAS,YAAY,OAAO,KAAA;CAE5D,OAAO;AACR;;;;;;;;;;AAWA,SAAS,YAAY,MAAiD;CACrE,MAAM,QACL,MACA,QAC8B;EAC9B,IAAI,SAAS,YAAY,IAAI,IAAI,SAAS,QAAQ,IAAI;EACtD,IAAI,OAAO,IAAI;EACf;CACD;CAEA,MAAM,UAAU,OAAO,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,OAAO,OAAO;EACrE,MAAM,CAAC,IAAI,IAAI,MAAM,KAAK,OAAO,CAAC;EAClC,MAAM,CAAC,IAAI,IAAI,MAAM,KAAK,OAAO,CAAC;EAClC,OAAO,KAAK,MAAM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AAI,KAAK,EAAE,CAAC,CACxC,KAAK,IAAI,IACX,GACF;EATS,KAAA,MAAA;EACA,KAAA,OAAA;EAST,KAAK,OAAO;CACb;AACD;;AAGA,SAAS,SAAS,cAAoD;CACrE,OAAO,OAAO,YACb,OAAO,QAAQ,aAAa,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAC/D,KACA,IAAI,IACL,CAAC,CACF;AACD;;;;;;;;;;;;;;AAeA,eAAsB,cACrB,MAAc,QAAQ,IAAI,GACC;CAC3B,MAAM,EAAE,SAAS,KAAK,WAAW,kBAChC,MAAM,qBAAqB,GAAG;CAE/B,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAI,CAAC,WAAW,MAAM,IAAI,eAAe,OAAO;CAEhD,OAAO;EACN;EACA;EACA;EACA;EACA;EACA,SAAS,KAAK,eAAe,IAAI,IAAI;CACtC;AACD;;AAGA,IAAa,iBAAb,cAAoC,MAAM;CACpB;CAArB,YAAY,SAA0B;EACrC,MACC,QAAQ,QAAQ,uDACjB;EAHoB,KAAA,UAAA;EAIpB,KAAK,OAAO;CACb;AACD;;;;;;;;AAiBA,eAAsB,qBACrB,MAAc,QAAQ,IAAI,GACE;CAC5B,MAAM,EAAE,QAAQ,kBAAkB,MAAM,cAAc,GAAG;CACzD,MAAM,eAAe,MAAM,gBAC1B,cAAc,QAAQ,aAAa,CACpC;CAEA,MAAM,WAAW,oBAAoB,cAAc,GAAG;CACtD,IAAI,CAAC,UAAU,MAAM,IAAI,WAAW,KAAK,SAAS,YAAY,CAAC;CAE/D,OAAO;EACN,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACD;AACD"}
package/dist/config.cjs CHANGED
@@ -1,12 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_config = require("./config-DXnkCEq0.cjs");
3
- const require_workspace = require("./workspace-B64Xk1Mb.cjs");
2
+ const require_config = require("./config-BEJYKd4s.cjs");
3
+ const require_workspace = require("./workspace-Kl4NG9IH.cjs");
4
+ exports.CONFIG_LOAD_TIMEOUT_MS = require_config.CONFIG_LOAD_TIMEOUT_MS;
5
+ exports.ConfigLoadFailed = require_config.ConfigLoadFailed;
4
6
  exports.ConfigNotFound = require_config.ConfigNotFound;
7
+ exports.ConfigObjectNotSerializable = require_config.ConfigObjectNotSerializable;
5
8
  exports.NotABackendApp = require_config.NotABackendApp;
6
9
  exports.NotInAnApp = require_config.NotInAnApp;
7
10
  exports.WorkspaceDeclaresNoConstructs = require_config.WorkspaceDeclaresNoConstructs;
8
11
  exports.defineConfig = require_config.defineConfig;
9
12
  exports.defineWorkspace = require_workspace.defineWorkspace;
13
+ exports.findWorkspaceRoot = require_config.findWorkspaceRoot;
10
14
  exports.loadAppConfig = require_config.loadAppConfig;
11
15
  exports.loadConfig = require_config.loadConfig;
12
16
  exports.loadWorkspaceAppInfo = require_config.loadWorkspaceAppInfo;