@geekmidas/cli 10.0.0-alpha.99 → 10.0.0

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 (676) hide show
  1. package/CHANGELOG.md +667 -0
  2. package/FUNCTION_CRON_SUPPORT.md +266 -0
  3. package/README.md +533 -382
  4. package/bin/gkm.mjs +2 -16
  5. package/dist/CachedStateProvider-BdX7klRc.cjs +3 -0
  6. package/dist/CachedStateProvider-CzyFct42.mjs +54 -0
  7. package/dist/CachedStateProvider-CzyFct42.mjs.map +1 -0
  8. package/dist/CachedStateProvider-GcGziXh1.mjs +3 -0
  9. package/dist/CachedStateProvider-klLWZXWF.cjs +60 -0
  10. package/dist/CachedStateProvider-klLWZXWF.cjs.map +1 -0
  11. package/dist/{HostingerProvider-BNpS9aRJ.mjs → HostingerProvider-B2ZYz7Yc.mjs} +26 -31
  12. package/dist/HostingerProvider-B2ZYz7Yc.mjs.map +1 -0
  13. package/dist/{HostingerProvider-DR1iws1P.cjs → HostingerProvider-CrHfsgz9.cjs} +26 -31
  14. package/dist/HostingerProvider-CrHfsgz9.cjs.map +1 -0
  15. package/dist/LocalStateProvider-CP49rjzt.mjs +42 -0
  16. package/dist/LocalStateProvider-CP49rjzt.mjs.map +1 -0
  17. package/dist/LocalStateProvider-CalzNfNA.cjs +43 -0
  18. package/dist/LocalStateProvider-CalzNfNA.cjs.map +1 -0
  19. package/dist/{Route53Provider-Bllus2NR.cjs → Route53Provider-DwgXiLxt.cjs} +22 -21
  20. package/dist/Route53Provider-DwgXiLxt.cjs.map +1 -0
  21. package/dist/{Route53Provider-QXxjkZO1.mjs → Route53Provider-tlgBzrRQ.mjs} +13 -13
  22. package/dist/Route53Provider-tlgBzrRQ.mjs.map +1 -0
  23. package/dist/SSMStateProvider-BlrTiV5m.mjs +66 -0
  24. package/dist/SSMStateProvider-BlrTiV5m.mjs.map +1 -0
  25. package/dist/SSMStateProvider-Bt6r8CTL.cjs +66 -0
  26. package/dist/SSMStateProvider-Bt6r8CTL.cjs.map +1 -0
  27. package/dist/{backup-provisioner-oDEsPj02.cjs → backup-provisioner-B3HBN-2k.cjs} +20 -22
  28. package/dist/backup-provisioner-B3HBN-2k.cjs.map +1 -0
  29. package/dist/{backup-provisioner-C8DnCmxK.mjs → backup-provisioner-Xunq-p_8.mjs} +9 -12
  30. package/dist/backup-provisioner-Xunq-p_8.mjs.map +1 -0
  31. package/dist/bundler-DkA4qzUD.mjs +135 -0
  32. package/dist/bundler-DkA4qzUD.mjs.map +1 -0
  33. package/dist/bundler-Dufq3uvI.cjs +136 -0
  34. package/dist/bundler-Dufq3uvI.cjs.map +1 -0
  35. package/dist/{rolldown-runtime-C0BPl7ul.cjs → chunk-CUT6urMc.cjs} +10 -23
  36. package/dist/chunk-Duj1WY3L.mjs +7 -0
  37. package/dist/config-Bbu1JKvf.mjs +211 -0
  38. package/dist/config-Bbu1JKvf.mjs.map +1 -0
  39. package/dist/config-DujV8DbR.cjs +253 -0
  40. package/dist/config-DujV8DbR.cjs.map +1 -0
  41. package/dist/config.cjs +10 -421
  42. package/dist/config.d.cts +120 -4
  43. package/dist/config.d.cts.map +1 -0
  44. package/dist/config.d.mts +120 -4
  45. package/dist/config.d.mts.map +1 -0
  46. package/dist/config.mjs +3 -405
  47. package/dist/credentials-C8DWtnMY.cjs +174 -0
  48. package/dist/credentials-C8DWtnMY.cjs.map +1 -0
  49. package/dist/credentials-s1kLcIzK.mjs +126 -0
  50. package/dist/credentials-s1kLcIzK.mjs.map +1 -0
  51. package/dist/deploy/sniffer-envkit-patch.cjs +10 -18
  52. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  53. package/dist/deploy/sniffer-envkit-patch.d.cts +2 -0
  54. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  55. package/dist/deploy/sniffer-envkit-patch.d.mts +2 -0
  56. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  57. package/dist/deploy/sniffer-envkit-patch.mjs +2 -10
  58. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  59. package/dist/deploy/sniffer-hooks.cjs +7 -13
  60. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  61. package/dist/deploy/sniffer-hooks.d.cts +2 -1
  62. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  63. package/dist/deploy/sniffer-hooks.d.mts +2 -1
  64. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  65. package/dist/deploy/sniffer-hooks.mjs +3 -10
  66. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  67. package/dist/deploy/sniffer-loader.cjs +7 -16
  68. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  69. package/dist/deploy/sniffer-loader.d.cts +1 -1
  70. package/dist/deploy/sniffer-loader.d.mts +1 -1
  71. package/dist/deploy/sniffer-loader.mjs +3 -14
  72. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  73. package/dist/deploy/sniffer-routes-worker.cjs +13 -17
  74. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  75. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  76. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  77. package/dist/deploy/sniffer-routes-worker.mjs +6 -10
  78. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  79. package/dist/deploy/sniffer-worker.cjs +6 -15
  80. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  81. package/dist/deploy/sniffer-worker.d.cts +3 -1
  82. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  83. package/dist/deploy/sniffer-worker.d.mts +3 -1
  84. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  85. package/dist/deploy/sniffer-worker.mjs +4 -15
  86. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  87. package/dist/dokploy-api-BPYkG-ZZ.cjs +3 -0
  88. package/dist/dokploy-api-BiSzWM4v.mjs +3 -0
  89. package/dist/dokploy-api-CqOIKHme.cjs +609 -0
  90. package/dist/dokploy-api-CqOIKHme.cjs.map +1 -0
  91. package/dist/dokploy-api-sfZFlWuE.mjs +597 -0
  92. package/dist/dokploy-api-sfZFlWuE.mjs.map +1 -0
  93. package/dist/encryption-BVS7Vmzs.cjs +4 -0
  94. package/dist/encryption-Bd_m4q3g.mjs +3 -0
  95. package/dist/encryption-CO5Q4Bhf.mjs +42 -0
  96. package/dist/encryption-CO5Q4Bhf.mjs.map +1 -0
  97. package/dist/encryption-MfXAiFTm.cjs +54 -0
  98. package/dist/encryption-MfXAiFTm.cjs.map +1 -0
  99. package/dist/fullstack-secrets-BYzi6Hwl.cjs +402 -0
  100. package/dist/fullstack-secrets-BYzi6Hwl.cjs.map +1 -0
  101. package/dist/fullstack-secrets-l8s3II_H.mjs +336 -0
  102. package/dist/fullstack-secrets-l8s3II_H.mjs.map +1 -0
  103. package/dist/index-CoVW_fFS.d.cts +1737 -0
  104. package/dist/index-CoVW_fFS.d.cts.map +1 -0
  105. package/dist/index-oWibAYQY.d.mts +1737 -0
  106. package/dist/index-oWibAYQY.d.mts.map +1 -0
  107. package/dist/index.cjs +11324 -10240
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.d.cts +1 -1
  110. package/dist/index.d.mts +1 -1
  111. package/dist/index.mjs +11327 -10231
  112. package/dist/index.mjs.map +1 -1
  113. package/dist/openapi-BzNOC7_i.cjs +1931 -0
  114. package/dist/openapi-BzNOC7_i.cjs.map +1 -0
  115. package/dist/openapi-Cfwi0fqF.mjs +1883 -0
  116. package/dist/openapi-Cfwi0fqF.mjs.map +1 -0
  117. package/dist/openapi-react-query-C4iIvpPf.mjs +167 -0
  118. package/dist/openapi-react-query-C4iIvpPf.mjs.map +1 -0
  119. package/dist/openapi-react-query-CYWik72n.cjs +173 -0
  120. package/dist/openapi-react-query-CYWik72n.cjs.map +1 -0
  121. package/dist/openapi-react-query.cjs +4 -0
  122. package/dist/openapi-react-query.d.cts +11 -0
  123. package/dist/openapi-react-query.d.cts.map +1 -0
  124. package/dist/openapi-react-query.d.mts +11 -0
  125. package/dist/openapi-react-query.d.mts.map +1 -0
  126. package/dist/openapi-react-query.mjs +4 -0
  127. package/dist/openapi.cjs +7 -214
  128. package/dist/openapi.d.cts +15 -72
  129. package/dist/openapi.d.cts.map +1 -1
  130. package/dist/openapi.d.mts +15 -72
  131. package/dist/openapi.d.mts.map +1 -1
  132. package/dist/openapi.mjs +4 -208
  133. package/dist/{reconcile--I7V4Klj.mjs → reconcile-B2FoJE0a.mjs} +8 -6
  134. package/dist/reconcile-B2FoJE0a.mjs.map +1 -0
  135. package/dist/{reconcile-CuCQBa5-.cjs → reconcile-BzqKJ2Rt.cjs} +8 -6
  136. package/dist/reconcile-BzqKJ2Rt.cjs.map +1 -0
  137. package/dist/setup-DDXUXzzl.mjs +765 -0
  138. package/dist/setup-DDXUXzzl.mjs.map +1 -0
  139. package/dist/setup-DLwhfyt-.cjs +8 -0
  140. package/dist/setup-Dh-B7YTX.mjs +8 -0
  141. package/dist/setup-WZ-xqAQO.cjs +849 -0
  142. package/dist/setup-WZ-xqAQO.cjs.map +1 -0
  143. package/dist/storage-B1wvztiJ.cjs +363 -0
  144. package/dist/storage-B1wvztiJ.cjs.map +1 -0
  145. package/dist/storage-Cs4WBsc4.mjs +3 -0
  146. package/dist/storage-DOEtT2Hr.cjs +7 -0
  147. package/dist/storage-dbb9RyBl.mjs +297 -0
  148. package/dist/storage-dbb9RyBl.mjs.map +1 -0
  149. package/dist/sync-B5UHXwRM.mjs +3 -0
  150. package/dist/sync-BLA94rgC.cjs +4 -0
  151. package/dist/sync-CSooqRQ8.mjs +76 -0
  152. package/dist/sync-CSooqRQ8.mjs.map +1 -0
  153. package/dist/sync-o_CtEbvR.cjs +93 -0
  154. package/dist/sync-o_CtEbvR.cjs.map +1 -0
  155. package/dist/types-B3GQUg3k.d.mts +280 -0
  156. package/dist/types-B3GQUg3k.d.mts.map +1 -0
  157. package/dist/types-BWQDiooe.d.cts +280 -0
  158. package/dist/types-BWQDiooe.d.cts.map +1 -0
  159. package/dist/workspace/index.cjs +4 -12
  160. package/dist/workspace/index.d.cts +3 -3
  161. package/dist/workspace/index.d.mts +3 -3
  162. package/dist/workspace/index.mjs +3 -2
  163. package/dist/workspace-CQTT7HJQ.cjs +4361 -0
  164. package/dist/workspace-CQTT7HJQ.cjs.map +1 -0
  165. package/dist/workspace-D-37Ylqo.mjs +4236 -0
  166. package/dist/workspace-D-37Ylqo.mjs.map +1 -0
  167. package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +408 -0
  168. package/docs/dev-server-resilience-design.md +189 -0
  169. package/docs/manifest-refactor-design.md +287 -0
  170. package/examples/cron-example.ts +45 -0
  171. package/examples/env.ts +33 -0
  172. package/examples/function-example.ts +40 -0
  173. package/examples/gkm.config.json +22 -0
  174. package/examples/gkm.config.ts +14 -0
  175. package/examples/gkm.minimal.config.json +7 -0
  176. package/examples/gkm.production.config.json +27 -0
  177. package/examples/logger.ts +10 -0
  178. package/package.json +37 -87
  179. package/scripts/sync-versions.ts +108 -0
  180. package/src/__tests__/EndpointGenerator.hooks.spec.ts +204 -0
  181. package/src/__tests__/config.spec.ts +422 -0
  182. package/src/__tests__/loadEnvFiles.spec.ts +131 -0
  183. package/src/__tests__/normalizeHooksConfig.spec.ts +63 -0
  184. package/src/__tests__/openapi-react-query.spec.ts +506 -0
  185. package/src/__tests__/openapi.spec.ts +625 -0
  186. package/src/__tests__/test-helpers.ts +180 -0
  187. package/src/auth/__tests__/credentials.spec.ts +331 -0
  188. package/src/auth/__tests__/index.spec.ts +237 -0
  189. package/src/auth/credentials.ts +286 -0
  190. package/src/auth/index.ts +233 -0
  191. package/src/build/__tests__/bundler.spec.ts +446 -0
  192. package/src/build/__tests__/endpoint-analyzer.spec.ts +623 -0
  193. package/src/build/__tests__/handler-templates.spec.ts +1287 -0
  194. package/src/build/__tests__/index-new.spec.ts +550 -0
  195. package/src/build/__tests__/manifests.spec.ts +583 -0
  196. package/src/build/__tests__/partitions.spec.ts +110 -0
  197. package/src/build/__tests__/workspace-build.spec.ts +215 -0
  198. package/src/build/bundler.ts +256 -0
  199. package/src/build/endpoint-analyzer.ts +236 -0
  200. package/src/build/handler-templates.ts +1253 -0
  201. package/src/build/index.ts +616 -0
  202. package/src/build/manifests.ts +285 -0
  203. package/src/build/partitions.ts +58 -0
  204. package/src/build/providerResolver.ts +184 -0
  205. package/src/build/types.ts +104 -0
  206. package/src/config.ts +330 -0
  207. package/src/credentials/__tests__/fullDockerPorts.spec.ts +144 -0
  208. package/src/credentials/__tests__/helpers.ts +112 -0
  209. package/src/credentials/__tests__/prepareEntryCredentials.spec.ts +125 -0
  210. package/src/credentials/__tests__/readonlyDockerPorts.spec.ts +190 -0
  211. package/src/credentials/__tests__/workspaceCredentials.spec.ts +209 -0
  212. package/src/credentials/index.ts +843 -0
  213. package/src/debug.ts +68 -0
  214. package/src/deploy/CachedStateProvider.ts +86 -0
  215. package/src/deploy/LocalStateProvider.ts +57 -0
  216. package/src/deploy/SSMStateProvider.ts +117 -0
  217. package/src/deploy/StateProvider.ts +175 -0
  218. package/src/deploy/__tests__/CachedStateProvider.spec.ts +235 -0
  219. package/src/deploy/__tests__/HostingerProvider.spec.ts +347 -0
  220. package/src/deploy/__tests__/LocalStateProvider.spec.ts +130 -0
  221. package/src/deploy/__tests__/Route53Provider.spec.ts +425 -0
  222. package/src/deploy/__tests__/SSMStateProvider.spec.ts +201 -0
  223. package/src/deploy/__tests__/__fixtures__/entry-apps/async-entry.ts +24 -0
  224. package/src/deploy/__tests__/__fixtures__/entry-apps/nested-config-entry.ts +24 -0
  225. package/src/deploy/__tests__/__fixtures__/entry-apps/no-env-entry.ts +12 -0
  226. package/src/deploy/__tests__/__fixtures__/entry-apps/simple-entry.ts +14 -0
  227. package/src/deploy/__tests__/__fixtures__/entry-apps/throwing-entry.ts +16 -0
  228. package/src/deploy/__tests__/__fixtures__/env-parsers/non-function-export.ts +10 -0
  229. package/src/deploy/__tests__/__fixtures__/env-parsers/optional-env-parser.ts +21 -0
  230. package/src/deploy/__tests__/__fixtures__/env-parsers/parseable-env-parser.ts +18 -0
  231. package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +16 -0
  232. package/src/deploy/__tests__/__fixtures__/env-parsers/valid-env-parser.ts +16 -0
  233. package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/auth.ts +16 -0
  234. package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/health.ts +13 -0
  235. package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/users.ts +15 -0
  236. package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +55 -0
  237. package/src/deploy/__tests__/backup-provisioner.spec.ts +428 -0
  238. package/src/deploy/__tests__/createDnsProvider.spec.ts +195 -0
  239. package/src/deploy/__tests__/createStateProvider.spec.ts +126 -0
  240. package/src/deploy/__tests__/dns-orchestration.spec.ts +192 -0
  241. package/src/deploy/__tests__/dns-verification.spec.ts +229 -0
  242. package/src/deploy/__tests__/docker.spec.ts +149 -0
  243. package/src/deploy/__tests__/dokploy-api.spec.ts +697 -0
  244. package/src/deploy/__tests__/dokploy.spec.ts +435 -0
  245. package/src/deploy/__tests__/domain.spec.ts +235 -0
  246. package/src/deploy/__tests__/env-resolver.spec.ts +903 -0
  247. package/src/deploy/__tests__/index.spec.ts +1091 -0
  248. package/src/deploy/__tests__/init.spec.ts +793 -0
  249. package/src/deploy/__tests__/secrets.spec.ts +303 -0
  250. package/src/deploy/__tests__/sniffer.spec.ts +838 -0
  251. package/src/deploy/__tests__/state-e2e.spec.ts +387 -0
  252. package/src/deploy/__tests__/state.spec.ts +876 -0
  253. package/src/deploy/__tests__/undeploy.spec.ts +758 -0
  254. package/src/deploy/backup-provisioner.ts +316 -0
  255. package/src/deploy/dns/DnsProvider.ts +201 -0
  256. package/src/deploy/dns/HostingerProvider.ts +174 -0
  257. package/src/deploy/dns/Route53Provider.ts +340 -0
  258. package/src/deploy/dns/hostinger-api.ts +261 -0
  259. package/src/deploy/dns/index.ts +627 -0
  260. package/src/deploy/docker.ts +260 -0
  261. package/src/deploy/dokploy-api.ts +1101 -0
  262. package/src/deploy/dokploy.ts +177 -0
  263. package/src/deploy/domain.ts +134 -0
  264. package/src/deploy/env-resolver.ts +305 -0
  265. package/src/deploy/index.ts +2094 -0
  266. package/src/deploy/init.ts +427 -0
  267. package/src/deploy/secrets.ts +187 -0
  268. package/src/deploy/sniffer-envkit-patch.ts +61 -0
  269. package/src/deploy/sniffer-hooks.ts +57 -0
  270. package/src/deploy/sniffer-loader.ts +28 -0
  271. package/src/deploy/sniffer-routes-worker.ts +104 -0
  272. package/src/deploy/sniffer-worker.ts +75 -0
  273. package/src/deploy/sniffer.ts +578 -0
  274. package/src/deploy/state-commands.ts +274 -0
  275. package/src/deploy/state.ts +482 -0
  276. package/src/deploy/types.ts +102 -0
  277. package/src/deploy/undeploy.ts +407 -0
  278. package/src/dev/__tests__/entry-integration.spec.ts +347 -0
  279. package/src/dev/__tests__/entry.spec.ts +144 -0
  280. package/src/dev/__tests__/index.spec.ts +2084 -0
  281. package/src/dev/index.ts +1649 -0
  282. package/src/docker/__tests__/compose.spec.ts +1142 -0
  283. package/src/docker/__tests__/templates.spec.ts +694 -0
  284. package/src/docker/compose.ts +812 -0
  285. package/src/docker/index.ts +523 -0
  286. package/src/docker/templates.ts +1067 -0
  287. package/src/exec/index.ts +118 -0
  288. package/src/generators/CronGenerator.ts +105 -0
  289. package/src/generators/EndpointGenerator.ts +954 -0
  290. package/src/generators/FunctionGenerator.ts +117 -0
  291. package/src/generators/Generator.ts +147 -0
  292. package/src/generators/OpenApiTsGenerator.ts +821 -0
  293. package/src/generators/QueueGenerator.ts +245 -0
  294. package/src/generators/SubscriberGenerator.ts +282 -0
  295. package/src/generators/TopicGenerator.ts +45 -0
  296. package/src/generators/__tests__/CronGenerator.spec.ts +445 -0
  297. package/src/generators/__tests__/EndpointGenerator.spec.ts +544 -0
  298. package/src/generators/__tests__/FunctionGenerator.spec.ts +256 -0
  299. package/src/generators/__tests__/Generator.bustCache.spec.ts +72 -0
  300. package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +98 -0
  301. package/src/generators/__tests__/OpenApiTsGenerator.responseType.spec.ts +56 -0
  302. package/src/generators/__tests__/QueueGenerator.spec.ts +141 -0
  303. package/src/generators/__tests__/SubscriberGenerator.spec.ts +410 -0
  304. package/src/generators/index.ts +11 -0
  305. package/src/index.ts +972 -0
  306. package/src/init/__tests__/generators.spec.ts +1072 -0
  307. package/src/init/__tests__/init.spec.ts +577 -0
  308. package/src/init/__tests__/utils.spec.ts +104 -0
  309. package/src/init/generators/auth.ts +225 -0
  310. package/src/init/generators/config.ts +316 -0
  311. package/src/init/generators/docker.ts +388 -0
  312. package/src/init/generators/env.ts +62 -0
  313. package/src/init/generators/index.ts +6 -0
  314. package/src/init/generators/mobile-expo.ts +576 -0
  315. package/src/init/generators/models.ts +153 -0
  316. package/src/init/generators/monorepo.ts +475 -0
  317. package/src/init/generators/package.ts +95 -0
  318. package/src/init/generators/source.ts +15 -0
  319. package/src/init/generators/test.ts +178 -0
  320. package/src/init/generators/ui.ts +1473 -0
  321. package/src/init/generators/web-tanstack.ts +348 -0
  322. package/src/init/generators/web.ts +363 -0
  323. package/src/init/index.ts +542 -0
  324. package/src/init/templates/api.ts +404 -0
  325. package/src/init/templates/index.ts +342 -0
  326. package/src/init/templates/minimal.ts +207 -0
  327. package/src/init/templates/serverless.ts +148 -0
  328. package/src/init/templates/worker.ts +216 -0
  329. package/src/init/utils.ts +197 -0
  330. package/src/init/versions.ts +52 -0
  331. package/src/openapi-react-query.ts +288 -0
  332. package/src/openapi.ts +259 -0
  333. package/src/secrets/__tests__/encryption.spec.ts +226 -0
  334. package/src/secrets/__tests__/generator.spec.ts +575 -0
  335. package/src/secrets/__tests__/index.spec.ts +91 -0
  336. package/src/secrets/__tests__/reconcile.spec.ts +123 -0
  337. package/src/secrets/__tests__/storage.spec.ts +645 -0
  338. package/src/secrets/encryption.ts +91 -0
  339. package/src/secrets/generator.ts +329 -0
  340. package/src/secrets/index.ts +417 -0
  341. package/src/secrets/keystore.ts +144 -0
  342. package/src/secrets/reconcile.ts +53 -0
  343. package/src/secrets/storage.ts +337 -0
  344. package/src/secrets/sync.ts +136 -0
  345. package/src/secrets/types.ts +70 -0
  346. package/src/setup/__tests__/auto-setup.spec.ts +147 -0
  347. package/src/setup/__tests__/reconcile-secrets.spec.ts +439 -0
  348. package/src/setup/fullstack-secrets.ts +140 -0
  349. package/src/setup/index.ts +411 -0
  350. package/src/test/__tests__/__fixtures__/workspace.ts +104 -0
  351. package/src/test/__tests__/api.spec.ts +199 -0
  352. package/src/test/__tests__/auth.spec.ts +162 -0
  353. package/src/test/__tests__/index.spec.ts +502 -0
  354. package/src/test/__tests__/web.spec.ts +210 -0
  355. package/src/test/index.ts +198 -0
  356. package/src/types.ts +363 -0
  357. package/src/upgrade/__tests__/index.spec.ts +354 -0
  358. package/src/upgrade/index.ts +253 -0
  359. package/src/workspace/__tests__/client-generator.spec.ts +326 -0
  360. package/src/workspace/__tests__/index.spec.ts +766 -0
  361. package/src/workspace/__tests__/publicEnv.spec.ts +64 -0
  362. package/src/workspace/__tests__/schema.spec.ts +737 -0
  363. package/src/workspace/__tests__/type-inference.spec.ts +251 -0
  364. package/src/workspace/client-generator.ts +109 -0
  365. package/src/workspace/index.ts +433 -0
  366. package/src/workspace/publicEnv.ts +57 -0
  367. package/src/workspace/schema.ts +861 -0
  368. package/src/workspace/types.ts +943 -0
  369. package/tsconfig.json +9 -0
  370. package/tsdown.config.ts +22 -0
  371. package/bin/adjacent-tsconfig.mjs +0 -97
  372. package/bin/owning-tsconfig-jsx-register.mjs +0 -18
  373. package/bin/owning-tsconfig-jsx.mjs +0 -108
  374. package/dist/EndpointGenerator-Bor2tZCm.mjs +0 -1031
  375. package/dist/EndpointGenerator-Bor2tZCm.mjs.map +0 -1
  376. package/dist/EndpointGenerator-De03t1hd.cjs +0 -1090
  377. package/dist/EndpointGenerator-De03t1hd.cjs.map +0 -1
  378. package/dist/GoDaddyProvider-206NguW1.mjs +0 -388
  379. package/dist/GoDaddyProvider-206NguW1.mjs.map +0 -1
  380. package/dist/GoDaddyProvider-D1aQy2i1.cjs +0 -388
  381. package/dist/GoDaddyProvider-D1aQy2i1.cjs.map +0 -1
  382. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +0 -1
  383. package/dist/HostingerProvider-DR1iws1P.cjs.map +0 -1
  384. package/dist/LegacyStateStore-CgJEr1G7.cjs +0 -124
  385. package/dist/LegacyStateStore-CgJEr1G7.cjs.map +0 -1
  386. package/dist/LegacyStateStore-wmFfdzuh.mjs +0 -124
  387. package/dist/LegacyStateStore-wmFfdzuh.mjs.map +0 -1
  388. package/dist/LocalStateStore-BD14kra9.cjs +0 -178
  389. package/dist/LocalStateStore-BD14kra9.cjs.map +0 -1
  390. package/dist/LocalStateStore-C5mNp91D.mjs +0 -167
  391. package/dist/LocalStateStore-C5mNp91D.mjs.map +0 -1
  392. package/dist/OpenApiTsGenerator-CS_RtWOz.cjs +0 -541
  393. package/dist/OpenApiTsGenerator-CS_RtWOz.cjs.map +0 -1
  394. package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs +0 -536
  395. package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs.map +0 -1
  396. package/dist/Route53Provider-Bllus2NR.cjs.map +0 -1
  397. package/dist/Route53Provider-QXxjkZO1.mjs.map +0 -1
  398. package/dist/S3StateStore-CEGbsDHi.mjs +0 -223
  399. package/dist/S3StateStore-CEGbsDHi.mjs.map +0 -1
  400. package/dist/S3StateStore-Csu_kJCy.cjs +0 -222
  401. package/dist/S3StateStore-Csu_kJCy.cjs.map +0 -1
  402. package/dist/SSMStateStore-Bd62qwp4.mjs +0 -205
  403. package/dist/SSMStateStore-Bd62qwp4.mjs.map +0 -1
  404. package/dist/SSMStateStore-Rp21jtP5.cjs +0 -204
  405. package/dist/SSMStateStore-Rp21jtP5.cjs.map +0 -1
  406. package/dist/SubscriberGenerator-CyN2VF5X.mjs +0 -449
  407. package/dist/SubscriberGenerator-CyN2VF5X.mjs.map +0 -1
  408. package/dist/SubscriberGenerator-Dvz7EzqK.cjs +0 -490
  409. package/dist/SubscriberGenerator-Dvz7EzqK.cjs.map +0 -1
  410. package/dist/add-DyIEYI97.mjs +0 -718
  411. package/dist/add-DyIEYI97.mjs.map +0 -1
  412. package/dist/add-Iuo3ao5E.cjs +0 -720
  413. package/dist/add-Iuo3ao5E.cjs.map +0 -1
  414. package/dist/appPorts-C9z9Pzn9.mjs +0 -223
  415. package/dist/appPorts-C9z9Pzn9.mjs.map +0 -1
  416. package/dist/appPorts-Cu79hJF6.cjs +0 -264
  417. package/dist/appPorts-Cu79hJF6.cjs.map +0 -1
  418. package/dist/aws-8QQ8n-t6.mjs +0 -89
  419. package/dist/aws-8QQ8n-t6.mjs.map +0 -1
  420. package/dist/aws-DY9NqQIT.cjs +0 -100
  421. package/dist/aws-DY9NqQIT.cjs.map +0 -1
  422. package/dist/awsStore-Bx5nCFnS.mjs +0 -121
  423. package/dist/awsStore-Bx5nCFnS.mjs.map +0 -1
  424. package/dist/awsStore-u3ehhMoY.cjs +0 -138
  425. package/dist/awsStore-u3ehhMoY.cjs.map +0 -1
  426. package/dist/backup-provisioner-C8DnCmxK.mjs.map +0 -1
  427. package/dist/backup-provisioner-oDEsPj02.cjs.map +0 -1
  428. package/dist/bundler-Bgoq8IyR.cjs +0 -169
  429. package/dist/bundler-Bgoq8IyR.cjs.map +0 -1
  430. package/dist/bundler-Q6Kp8b0r.mjs +0 -169
  431. package/dist/bundler-Q6Kp8b0r.mjs.map +0 -1
  432. package/dist/cli-B9BudUV0.mjs +0 -71
  433. package/dist/cli-B9BudUV0.mjs.map +0 -1
  434. package/dist/cli-W2DMRIbP.cjs +0 -71
  435. package/dist/cli-W2DMRIbP.cjs.map +0 -1
  436. package/dist/compose-CIrFNWHb.cjs +0 -3147
  437. package/dist/compose-CIrFNWHb.cjs.map +0 -1
  438. package/dist/compose-CLsRcHkA.mjs +0 -3052
  439. package/dist/compose-CLsRcHkA.mjs.map +0 -1
  440. package/dist/config-BVdHfj8b.d.cts +0 -269
  441. package/dist/config-BVdHfj8b.d.cts.map +0 -1
  442. package/dist/config-D2OqCmAM.d.mts +0 -269
  443. package/dist/config-D2OqCmAM.d.mts.map +0 -1
  444. package/dist/config.cjs.map +0 -1
  445. package/dist/config.mjs.map +0 -1
  446. package/dist/credentialSchemas-BJFvfkaz.mjs +0 -237
  447. package/dist/credentialSchemas-BJFvfkaz.mjs.map +0 -1
  448. package/dist/credentialSchemas-CAPKFkrG.cjs +0 -272
  449. package/dist/credentialSchemas-CAPKFkrG.cjs.map +0 -1
  450. package/dist/credentials-B5N5yKk6.mjs +0 -267
  451. package/dist/credentials-B5N5yKk6.mjs.map +0 -1
  452. package/dist/credentials-Zqr3QQYB.cjs +0 -350
  453. package/dist/credentials-Zqr3QQYB.cjs.map +0 -1
  454. package/dist/databases-BeGP5eDh.mjs +0 -495
  455. package/dist/databases-BeGP5eDh.mjs.map +0 -1
  456. package/dist/databases-DGALFDG3.cjs +0 -598
  457. package/dist/databases-DGALFDG3.cjs.map +0 -1
  458. package/dist/define-6poNqm5O.mjs +0 -106
  459. package/dist/define-6poNqm5O.mjs.map +0 -1
  460. package/dist/define-crmMcXFS.cjs +0 -153
  461. package/dist/define-crmMcXFS.cjs.map +0 -1
  462. package/dist/deploy/public.cjs +0 -212
  463. package/dist/deploy/public.cjs.map +0 -1
  464. package/dist/deploy/public.d.cts +0 -653
  465. package/dist/deploy/public.d.cts.map +0 -1
  466. package/dist/deploy/public.d.mts +0 -653
  467. package/dist/deploy/public.d.mts.map +0 -1
  468. package/dist/deploy/public.mjs +0 -145
  469. package/dist/deploy/public.mjs.map +0 -1
  470. package/dist/deploy/sniffer-envparser-worker.cjs +0 -54
  471. package/dist/deploy/sniffer-envparser-worker.cjs.map +0 -1
  472. package/dist/deploy/sniffer-envparser-worker.d.cts +0 -1
  473. package/dist/deploy/sniffer-envparser-worker.d.mts +0 -1
  474. package/dist/deploy/sniffer-envparser-worker.mjs +0 -55
  475. package/dist/deploy/sniffer-envparser-worker.mjs.map +0 -1
  476. package/dist/deploy-CbJMJsgX.cjs +0 -2032
  477. package/dist/deploy-CbJMJsgX.cjs.map +0 -1
  478. package/dist/deploy-n_IB8r6H.mjs +0 -1977
  479. package/dist/deploy-n_IB8r6H.mjs.map +0 -1
  480. package/dist/derive-B4vDpzgP.mjs +0 -150
  481. package/dist/derive-B4vDpzgP.mjs.map +0 -1
  482. package/dist/derive-DAbo49sm.cjs +0 -161
  483. package/dist/derive-DAbo49sm.cjs.map +0 -1
  484. package/dist/discover-Caf6Hnv1.d.cts +0 -108
  485. package/dist/discover-Caf6Hnv1.d.cts.map +0 -1
  486. package/dist/discover-Cd5M2jPv.d.mts +0 -108
  487. package/dist/discover-Cd5M2jPv.d.mts.map +0 -1
  488. package/dist/discover-DPgu-ScS.cjs +0 -600
  489. package/dist/discover-DPgu-ScS.cjs.map +0 -1
  490. package/dist/discover-qjFapetL.mjs +0 -527
  491. package/dist/discover-qjFapetL.mjs.map +0 -1
  492. package/dist/dns-C_LPS3qV.mjs +0 -610
  493. package/dist/dns-C_LPS3qV.mjs.map +0 -1
  494. package/dist/dns-kp8To8Qj.cjs +0 -663
  495. package/dist/dns-kp8To8Qj.cjs.map +0 -1
  496. package/dist/dokploy-Dl_kNVeE.mjs +0 -38
  497. package/dist/dokploy-Dl_kNVeE.mjs.map +0 -1
  498. package/dist/dokploy-gRIae9Ht.cjs +0 -38
  499. package/dist/dokploy-gRIae9Ht.cjs.map +0 -1
  500. package/dist/drivers-CTaWrA_L.mjs +0 -177
  501. package/dist/drivers-CTaWrA_L.mjs.map +0 -1
  502. package/dist/drivers-DDojgzz0.cjs +0 -200
  503. package/dist/drivers-DDojgzz0.cjs.map +0 -1
  504. package/dist/emit-C1e8qD08.mjs +0 -193
  505. package/dist/emit-C1e8qD08.mjs.map +0 -1
  506. package/dist/emit-Dmc1nvdS.cjs +0 -210
  507. package/dist/emit-Dmc1nvdS.cjs.map +0 -1
  508. package/dist/encryption-C3DcVZQs.mjs +0 -89
  509. package/dist/encryption-C3DcVZQs.mjs.map +0 -1
  510. package/dist/encryption-CmQvQOSe.cjs +0 -90
  511. package/dist/encryption-CmQvQOSe.cjs.map +0 -1
  512. package/dist/engine-DBXuhHyf.mjs +0 -3081
  513. package/dist/engine-DBXuhHyf.mjs.map +0 -1
  514. package/dist/engine-Dk19Mxc4.cjs +0 -3194
  515. package/dist/engine-Dk19Mxc4.cjs.map +0 -1
  516. package/dist/errors-D8Gwp5kU.mjs +0 -23
  517. package/dist/errors-D8Gwp5kU.mjs.map +0 -1
  518. package/dist/errors-DMC4Umsb.cjs +0 -34
  519. package/dist/errors-DMC4Umsb.cjs.map +0 -1
  520. package/dist/github-Ds2RYnSU.cjs +0 -819
  521. package/dist/github-Ds2RYnSU.cjs.map +0 -1
  522. package/dist/github-RawRLERq.mjs +0 -819
  523. package/dist/github-RawRLERq.mjs.map +0 -1
  524. package/dist/identity-CBXr4wNi.mjs +0 -129
  525. package/dist/identity-CBXr4wNi.mjs.map +0 -1
  526. package/dist/identity-CbLfgQNT.cjs +0 -182
  527. package/dist/identity-CbLfgQNT.cjs.map +0 -1
  528. package/dist/index-BU4G20G6.d.cts +0 -190
  529. package/dist/index-BU4G20G6.d.cts.map +0 -1
  530. package/dist/index-yDbd1WcM.d.mts +0 -190
  531. package/dist/index-yDbd1WcM.d.mts.map +0 -1
  532. package/dist/local-BwC2v2Y8.mjs +0 -224
  533. package/dist/local-BwC2v2Y8.mjs.map +0 -1
  534. package/dist/local-DNhnkugT.cjs +0 -241
  535. package/dist/local-DNhnkugT.cjs.map +0 -1
  536. package/dist/migrate-CZIGT3kB.mjs +0 -266
  537. package/dist/migrate-CZIGT3kB.mjs.map +0 -1
  538. package/dist/migrate-CxZYzF_u.cjs +0 -181
  539. package/dist/migrate-CxZYzF_u.cjs.map +0 -1
  540. package/dist/migrate-DR1x96I4.mjs +0 -181
  541. package/dist/migrate-DR1x96I4.mjs.map +0 -1
  542. package/dist/migrate-DjrTwWJA.cjs +0 -271
  543. package/dist/migrate-DjrTwWJA.cjs.map +0 -1
  544. package/dist/openapi.cjs.map +0 -1
  545. package/dist/openapi.mjs.map +0 -1
  546. package/dist/projectBucket-BYOxRnHY.mjs +0 -177
  547. package/dist/projectBucket-BYOxRnHY.mjs.map +0 -1
  548. package/dist/projectBucket-CDu5rXjp.cjs +0 -206
  549. package/dist/projectBucket-CDu5rXjp.cjs.map +0 -1
  550. package/dist/provider-BqpjG9QM.cjs +0 -57
  551. package/dist/provider-BqpjG9QM.cjs.map +0 -1
  552. package/dist/provider-CEOKk8NS.mjs +0 -46
  553. package/dist/provider-CEOKk8NS.mjs.map +0 -1
  554. package/dist/ready-D3PIjx3S.cjs +0 -403
  555. package/dist/ready-D3PIjx3S.cjs.map +0 -1
  556. package/dist/ready-naOSJpeJ.mjs +0 -374
  557. package/dist/ready-naOSJpeJ.mjs.map +0 -1
  558. package/dist/reconcile/public.cjs +0 -7
  559. package/dist/reconcile/public.d.cts +0 -49
  560. package/dist/reconcile/public.d.cts.map +0 -1
  561. package/dist/reconcile/public.d.mts +0 -49
  562. package/dist/reconcile/public.d.mts.map +0 -1
  563. package/dist/reconcile/public.mjs +0 -3
  564. package/dist/reconcile--I7V4Klj.mjs.map +0 -1
  565. package/dist/reconcile-CuCQBa5-.cjs.map +0 -1
  566. package/dist/resolve-CNYbGH8g.mjs +0 -263
  567. package/dist/resolve-CNYbGH8g.mjs.map +0 -1
  568. package/dist/resolve-DC98Rl1t.cjs +0 -316
  569. package/dist/resolve-DC98Rl1t.cjs.map +0 -1
  570. package/dist/rollback-BkIkE8Qe.mjs +0 -136
  571. package/dist/rollback-BkIkE8Qe.mjs.map +0 -1
  572. package/dist/rollback-DBfLvC8k.cjs +0 -165
  573. package/dist/rollback-DBfLvC8k.cjs.map +0 -1
  574. package/dist/rolldown-runtime-BhDjJH2R.mjs +0 -15
  575. package/dist/run-BJLIerMM.mjs +0 -133
  576. package/dist/run-BJLIerMM.mjs.map +0 -1
  577. package/dist/run-fVZ-rLnc.cjs +0 -174
  578. package/dist/run-fVZ-rLnc.cjs.map +0 -1
  579. package/dist/runtime-CLz3bf07.d.mts +0 -82
  580. package/dist/runtime-CLz3bf07.d.mts.map +0 -1
  581. package/dist/runtime-CUWf0IUk.d.cts +0 -82
  582. package/dist/runtime-CUWf0IUk.d.cts.map +0 -1
  583. package/dist/s3-BwhQk3QM.mjs +0 -215
  584. package/dist/s3-BwhQk3QM.mjs.map +0 -1
  585. package/dist/s3-DLp0V-Ox.cjs +0 -215
  586. package/dist/s3-DLp0V-Ox.cjs.map +0 -1
  587. package/dist/sandbox/config-worker.cjs +0 -43
  588. package/dist/sandbox/config-worker.cjs.map +0 -1
  589. package/dist/sandbox/config-worker.d.cts +0 -1
  590. package/dist/sandbox/config-worker.d.mts +0 -1
  591. package/dist/sandbox/config-worker.mjs +0 -44
  592. package/dist/sandbox/config-worker.mjs.map +0 -1
  593. package/dist/sandbox/credentials-worker.cjs +0 -54
  594. package/dist/sandbox/credentials-worker.cjs.map +0 -1
  595. package/dist/sandbox/credentials-worker.d.cts +0 -1
  596. package/dist/sandbox/credentials-worker.d.mts +0 -1
  597. package/dist/sandbox/credentials-worker.mjs +0 -55
  598. package/dist/sandbox/credentials-worker.mjs.map +0 -1
  599. package/dist/sandbox/discover-worker.cjs +0 -47
  600. package/dist/sandbox/discover-worker.cjs.map +0 -1
  601. package/dist/sandbox/discover-worker.d.cts +0 -1
  602. package/dist/sandbox/discover-worker.d.mts +0 -1
  603. package/dist/sandbox/discover-worker.mjs +0 -48
  604. package/dist/sandbox/discover-worker.mjs.map +0 -1
  605. package/dist/sandbox/migrate-worker.cjs +0 -75
  606. package/dist/sandbox/migrate-worker.cjs.map +0 -1
  607. package/dist/sandbox/migrate-worker.d.cts +0 -1
  608. package/dist/sandbox/migrate-worker.d.mts +0 -1
  609. package/dist/sandbox/migrate-worker.mjs +0 -76
  610. package/dist/sandbox/migrate-worker.mjs.map +0 -1
  611. package/dist/sandbox-CHv3OYXg.cjs +0 -165
  612. package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
  613. package/dist/sandbox-CbVB7uOD.mjs +0 -118
  614. package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
  615. package/dist/sandbox-CfpLWTPP.d.mts +0 -104
  616. package/dist/sandbox-CfpLWTPP.d.mts.map +0 -1
  617. package/dist/sandbox-D1XeNEJ9.d.cts +0 -104
  618. package/dist/sandbox-D1XeNEJ9.d.cts.map +0 -1
  619. package/dist/schemas-BObwxB_t.cjs +0 -6017
  620. package/dist/schemas-BObwxB_t.cjs.map +0 -1
  621. package/dist/schemas-D-xeKJDD.mjs +0 -5916
  622. package/dist/schemas-D-xeKJDD.mjs.map +0 -1
  623. package/dist/secretsManager-CQORubp9.mjs +0 -97
  624. package/dist/secretsManager-CQORubp9.mjs.map +0 -1
  625. package/dist/secretsManager-RAGcEDX1.cjs +0 -108
  626. package/dist/secretsManager-RAGcEDX1.cjs.map +0 -1
  627. package/dist/seeds-BNHSpjNP.cjs +0 -9096
  628. package/dist/seeds-BNHSpjNP.cjs.map +0 -1
  629. package/dist/seeds-C4bZ8L-T.mjs +0 -8141
  630. package/dist/seeds-C4bZ8L-T.mjs.map +0 -1
  631. package/dist/sniffer-BIBm9dAb.mjs +0 -1825
  632. package/dist/sniffer-BIBm9dAb.mjs.map +0 -1
  633. package/dist/sniffer-Cylp9W2D.cjs +0 -1998
  634. package/dist/sniffer-Cylp9W2D.cjs.map +0 -1
  635. package/dist/sst-CGdjHn2A.mjs +0 -441
  636. package/dist/sst-CGdjHn2A.mjs.map +0 -1
  637. package/dist/sst-DGuHDxVU.cjs +0 -464
  638. package/dist/sst-DGuHDxVU.cjs.map +0 -1
  639. package/dist/stages-CcS9vnNu.mjs +0 -176
  640. package/dist/stages-CcS9vnNu.mjs.map +0 -1
  641. package/dist/stages-DdBV7msu.cjs +0 -176
  642. package/dist/stages-DdBV7msu.cjs.map +0 -1
  643. package/dist/target/public.cjs +0 -15
  644. package/dist/target/public.d.cts +0 -28
  645. package/dist/target/public.d.cts.map +0 -1
  646. package/dist/target/public.d.mts +0 -28
  647. package/dist/target/public.d.mts.map +0 -1
  648. package/dist/target/public.mjs +0 -4
  649. package/dist/terminal-CPHuH4S1.cjs +0 -85
  650. package/dist/terminal-CPHuH4S1.cjs.map +0 -1
  651. package/dist/terminal-iNmAXXjs.mjs +0 -85
  652. package/dist/terminal-iNmAXXjs.mjs.map +0 -1
  653. package/dist/types-BhThob0H.d.mts +0 -7621
  654. package/dist/types-BhThob0H.d.mts.map +0 -1
  655. package/dist/types-DwoLHelT.d.cts +0 -7622
  656. package/dist/types-DwoLHelT.d.cts.map +0 -1
  657. package/dist/utils-D2Nk1Nv2.cjs +0 -205
  658. package/dist/utils-D2Nk1Nv2.cjs.map +0 -1
  659. package/dist/utils-D_fxUqvU.mjs +0 -156
  660. package/dist/utils-D_fxUqvU.mjs.map +0 -1
  661. package/dist/vitest.cjs +0 -65
  662. package/dist/vitest.cjs.map +0 -1
  663. package/dist/vitest.d.cts +0 -29
  664. package/dist/vitest.d.cts.map +0 -1
  665. package/dist/vitest.d.mts +0 -29
  666. package/dist/vitest.d.mts.map +0 -1
  667. package/dist/vitest.mjs +0 -65
  668. package/dist/vitest.mjs.map +0 -1
  669. package/dist/workerRuntime-BXfhbe13.cjs +0 -108
  670. package/dist/workerRuntime-BXfhbe13.cjs.map +0 -1
  671. package/dist/workerRuntime-CsOyBRx2.mjs +0 -79
  672. package/dist/workerRuntime-CsOyBRx2.mjs.map +0 -1
  673. package/dist/workspace-D5CpOp1y.mjs +0 -2108
  674. package/dist/workspace-D5CpOp1y.mjs.map +0 -1
  675. package/dist/workspace-DRjdu1OY.cjs +0 -2514
  676. package/dist/workspace-DRjdu1OY.cjs.map +0 -1
@@ -1,156 +0,0 @@
1
- import { dirname, join, parse } from "node:path";
2
- import { existsSync, readFileSync } from "node:fs";
3
- import fg from "fast-glob";
4
- import { parse as parse$1 } from "yaml";
5
- //#region src/init/utils.ts
6
- /**
7
- * Detect the package manager being used based on lockfiles or npm_config_user_agent
8
- */
9
- function detectPackageManager(cwd = process.cwd()) {
10
- if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
11
- if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
12
- if (existsSync(join(cwd, "bun.lockb"))) return "bun";
13
- if (existsSync(join(cwd, "package-lock.json"))) return "npm";
14
- const userAgent = process.env.npm_config_user_agent || "";
15
- if (userAgent.includes("pnpm")) return "pnpm";
16
- if (userAgent.includes("yarn")) return "yarn";
17
- if (userAgent.includes("bun")) return "bun";
18
- return "npm";
19
- }
20
- /** `gkm init`'s flags, which a name can swallow when a space goes missing. */
21
- const INIT_FLAGS = [
22
- "yes",
23
- "name",
24
- "template",
25
- "monorepo",
26
- "api-path",
27
- "pm",
28
- "skip-install"
29
- ];
30
- /**
31
- * Validate project name for npm package naming conventions
32
- */
33
- function validateProjectName(name) {
34
- if (!name) return "Project name is required";
35
- if (!/^[a-z0-9-_@/.]+$/i.test(name)) return "Project name can only contain letters, numbers, hyphens, underscores, @, /, and .";
36
- const flag = name.match(/--(\w[\w-]*)$/)?.[1];
37
- if (flag && INIT_FLAGS.includes(flag)) return `"${name}" ends in the --${flag} flag. Did you mean \`${name.slice(0, -(flag.length + 2))} --${flag}\`?`;
38
- if ([
39
- "node_modules",
40
- ".git",
41
- "package.json",
42
- "src"
43
- ].includes(name.toLowerCase())) return `"${name}" is a reserved name`;
44
- return true;
45
- }
46
- /**
47
- * Check if a directory already exists at the target path
48
- */
49
- function checkDirectoryExists(name, cwd = process.cwd()) {
50
- const targetPath = join(cwd, name);
51
- if (existsSync(targetPath)) return `Directory "${name}" already exists`;
52
- return true;
53
- }
54
- /**
55
- * Get the install command for a package manager
56
- */
57
- function getInstallCommand(pkgManager) {
58
- switch (pkgManager) {
59
- case "pnpm": return "pnpm install";
60
- case "yarn": return "yarn";
61
- case "bun": return "bun install";
62
- default: return "npm install";
63
- }
64
- }
65
- /**
66
- * Get the dev command for a package manager
67
- */
68
- function getRunCommand(pkgManager, script) {
69
- switch (pkgManager) {
70
- case "pnpm": return `pnpm ${script}`;
71
- case "yarn": return `yarn ${script}`;
72
- case "bun": return `bun run ${script}`;
73
- default: return `npm run ${script}`;
74
- }
75
- }
76
- /**
77
- * Run a binary the project installed, through its package manager — so it is
78
- * the project's own version, not whatever \`npx\` would fetch.
79
- */
80
- function getExecCommand(pkgManager, command) {
81
- switch (pkgManager) {
82
- case "pnpm": return `pnpm exec ${command}`;
83
- case "yarn": return `yarn ${command}`;
84
- case "bun": return `bunx ${command}`;
85
- default: return `npx --no-install ${command}`;
86
- }
87
- }
88
- const lockfileByPm = {
89
- pnpm: "pnpm-lock.yaml",
90
- yarn: "yarn.lock",
91
- npm: "package-lock.json",
92
- bun: "bun.lockb"
93
- };
94
- /**
95
- * Find the workspace/project root by walking up from cwd.
96
- * Checks for PM-specific workspace config, package.json#workspaces,
97
- * and lockfiles.
98
- */
99
- function findWorkspaceRoot(cwd, pm) {
100
- let dir = cwd;
101
- const root = parse(dir).root;
102
- const lockfile = lockfileByPm[pm];
103
- while (dir !== root) {
104
- if (pm === "pnpm" && existsSync(join(dir, "pnpm-workspace.yaml"))) return dir;
105
- const pkgJsonPath = join(dir, "package.json");
106
- if (existsSync(pkgJsonPath)) try {
107
- if (JSON.parse(readFileSync(pkgJsonPath, "utf-8")).workspaces) return dir;
108
- } catch {}
109
- if (existsSync(join(dir, lockfile))) return dir;
110
- dir = dirname(dir);
111
- }
112
- return cwd;
113
- }
114
- /**
115
- * Get workspace package glob patterns from pnpm-workspace.yaml
116
- * or package.json#workspaces.
117
- */
118
- function getWorkspaceGlobs(root) {
119
- const pnpmWorkspacePath = join(root, "pnpm-workspace.yaml");
120
- if (existsSync(pnpmWorkspacePath)) {
121
- const content = readFileSync(pnpmWorkspacePath, "utf-8");
122
- return parse$1(content)?.packages ?? [];
123
- }
124
- const rootPkgJsonPath = join(root, "package.json");
125
- if (existsSync(rootPkgJsonPath)) {
126
- const pkg = JSON.parse(readFileSync(rootPkgJsonPath, "utf-8"));
127
- if (Array.isArray(pkg.workspaces)) return pkg.workspaces;
128
- if (pkg.workspaces?.packages) return pkg.workspaces.packages;
129
- }
130
- return [];
131
- }
132
- /**
133
- * Find all package.json files across a workspace.
134
- * Returns the root package.json plus all workspace member package.json paths.
135
- */
136
- function findWorkspacePackages(cwd, pm) {
137
- const workspaceRoot = findWorkspaceRoot(cwd, pm);
138
- const results = [];
139
- const rootPkgJson = join(workspaceRoot, "package.json");
140
- if (existsSync(rootPkgJson)) results.push(rootPkgJson);
141
- const globs = getWorkspaceGlobs(workspaceRoot);
142
- for (const glob of globs) {
143
- const pattern = `${glob}/package.json`;
144
- const matches = fg.sync(pattern, {
145
- cwd: workspaceRoot,
146
- absolute: true,
147
- ignore: ["**/node_modules/**"]
148
- });
149
- results.push(...matches);
150
- }
151
- return [...new Set(results)];
152
- }
153
- //#endregion
154
- export { getExecCommand as a, validateProjectName as c, findWorkspaceRoot as i, detectPackageManager as n, getInstallCommand as o, findWorkspacePackages as r, getRunCommand as s, checkDirectoryExists as t };
155
-
156
- //# sourceMappingURL=utils-D_fxUqvU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-D_fxUqvU.mjs","names":["parseYaml"],"sources":["../src/init/utils.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, parse } from 'node:path';\nimport fg from 'fast-glob';\nimport { parse as parseYaml } from 'yaml';\n\nexport type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun';\n\n/**\n * Detect the package manager being used based on lockfiles or npm_config_user_agent\n */\nexport function detectPackageManager(\n\tcwd: string = process.cwd(),\n): PackageManager {\n\t// Check for lockfiles in cwd\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm';\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn';\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun';\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm';\n\n\t// Check npm_config_user_agent (set when running via npx/pnpm dlx/etc)\n\tconst userAgent = process.env.npm_config_user_agent || '';\n\tif (userAgent.includes('pnpm')) return 'pnpm';\n\tif (userAgent.includes('yarn')) return 'yarn';\n\tif (userAgent.includes('bun')) return 'bun';\n\n\treturn 'npm';\n}\n\n/** `gkm init`'s flags, which a name can swallow when a space goes missing. */\nconst INIT_FLAGS = [\n\t'yes',\n\t'name',\n\t'template',\n\t'monorepo',\n\t'api-path',\n\t'pm',\n\t'skip-install',\n];\n\n/**\n * Validate project name for npm package naming conventions\n */\nexport function validateProjectName(name: string): boolean | string {\n\tif (!name) {\n\t\treturn 'Project name is required';\n\t}\n\n\t// Check for valid npm package name characters\n\tif (!/^[a-z0-9-_@/.]+$/i.test(name)) {\n\t\treturn 'Project name can only contain letters, numbers, hyphens, underscores, @, /, and .';\n\t}\n\n\t// `init shop--monorepo` is `init shop --monorepo` with the space\n\t// lost, and the flag then ends up in every package scope and physical name.\n\tconst flag = name.match(/--(\\w[\\w-]*)$/)?.[1];\n\tif (flag && INIT_FLAGS.includes(flag)) {\n\t\tconst intended = name.slice(0, -(flag.length + 2));\n\t\treturn `\"${name}\" ends in the --${flag} flag. Did you mean \\`${intended} --${flag}\\`?`;\n\t}\n\n\t// Check for reserved names\n\tconst reserved = ['node_modules', '.git', 'package.json', 'src'];\n\tif (reserved.includes(name.toLowerCase())) {\n\t\treturn `\"${name}\" is a reserved name`;\n\t}\n\n\treturn true;\n}\n\n/**\n * Check if a directory already exists at the target path\n */\nexport function checkDirectoryExists(\n\tname: string,\n\tcwd: string = process.cwd(),\n): boolean | string {\n\tconst targetPath = join(cwd, name);\n\tif (existsSync(targetPath)) {\n\t\treturn `Directory \"${name}\" already exists`;\n\t}\n\treturn true;\n}\n\n/**\n * Get the install command for a package manager\n */\nexport function getInstallCommand(pkgManager: PackageManager): string {\n\tswitch (pkgManager) {\n\t\tcase 'pnpm':\n\t\t\treturn 'pnpm install';\n\t\tcase 'yarn':\n\t\t\treturn 'yarn';\n\t\tcase 'bun':\n\t\t\treturn 'bun install';\n\t\tdefault:\n\t\t\treturn 'npm install';\n\t}\n}\n\n/**\n * Get the dev command for a package manager\n */\nexport function getRunCommand(\n\tpkgManager: PackageManager,\n\tscript: string,\n): string {\n\tswitch (pkgManager) {\n\t\tcase 'pnpm':\n\t\t\treturn `pnpm ${script}`;\n\t\tcase 'yarn':\n\t\t\treturn `yarn ${script}`;\n\t\tcase 'bun':\n\t\t\treturn `bun run ${script}`;\n\t\tdefault:\n\t\t\treturn `npm run ${script}`;\n\t}\n}\n\n/**\n * Run a binary the project installed, through its package manager — so it is\n * the project's own version, not whatever \\`npx\\` would fetch.\n */\nexport function getExecCommand(\n\tpkgManager: PackageManager,\n\tcommand: string,\n): string {\n\tswitch (pkgManager) {\n\t\tcase 'pnpm':\n\t\t\treturn `pnpm exec ${command}`;\n\t\tcase 'yarn':\n\t\t\treturn `yarn ${command}`;\n\t\tcase 'bun':\n\t\t\treturn `bunx ${command}`;\n\t\tdefault:\n\t\t\treturn `npx --no-install ${command}`;\n\t}\n}\n\nconst lockfileByPm: Record<PackageManager, string> = {\n\tpnpm: 'pnpm-lock.yaml',\n\tyarn: 'yarn.lock',\n\tnpm: 'package-lock.json',\n\tbun: 'bun.lockb',\n};\n\n/**\n * Find the workspace/project root by walking up from cwd.\n * Checks for PM-specific workspace config, package.json#workspaces,\n * and lockfiles.\n */\nexport function findWorkspaceRoot(cwd: string, pm: PackageManager): string {\n\tlet dir = cwd;\n\tconst root = parse(dir).root;\n\tconst lockfile = lockfileByPm[pm];\n\n\twhile (dir !== root) {\n\t\tif (pm === 'pnpm' && existsSync(join(dir, 'pnpm-workspace.yaml'))) {\n\t\t\treturn dir;\n\t\t}\n\n\t\tconst pkgJsonPath = join(dir, 'package.json');\n\t\tif (existsSync(pkgJsonPath)) {\n\t\t\ttry {\n\t\t\t\tconst pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));\n\t\t\t\tif (pkg.workspaces) return dir;\n\t\t\t} catch {\n\t\t\t\t// ignore malformed package.json\n\t\t\t}\n\t\t}\n\n\t\tif (existsSync(join(dir, lockfile))) {\n\t\t\treturn dir;\n\t\t}\n\n\t\tdir = dirname(dir);\n\t}\n\n\treturn cwd;\n}\n\n/**\n * Get workspace package glob patterns from pnpm-workspace.yaml\n * or package.json#workspaces.\n */\nexport function getWorkspaceGlobs(root: string): string[] {\n\tconst pnpmWorkspacePath = join(root, 'pnpm-workspace.yaml');\n\tif (existsSync(pnpmWorkspacePath)) {\n\t\tconst content = readFileSync(pnpmWorkspacePath, 'utf-8');\n\t\tconst parsed = parseYaml(content);\n\t\treturn parsed?.packages ?? [];\n\t}\n\n\tconst rootPkgJsonPath = join(root, 'package.json');\n\tif (existsSync(rootPkgJsonPath)) {\n\t\tconst pkg = JSON.parse(readFileSync(rootPkgJsonPath, 'utf-8'));\n\t\tif (Array.isArray(pkg.workspaces)) {\n\t\t\treturn pkg.workspaces;\n\t\t}\n\t\tif (pkg.workspaces?.packages) {\n\t\t\treturn pkg.workspaces.packages;\n\t\t}\n\t}\n\n\treturn [];\n}\n\n/**\n * Find all package.json files across a workspace.\n * Returns the root package.json plus all workspace member package.json paths.\n */\nexport function findWorkspacePackages(\n\tcwd: string,\n\tpm: PackageManager,\n): string[] {\n\tconst workspaceRoot = findWorkspaceRoot(cwd, pm);\n\tconst results: string[] = [];\n\n\tconst rootPkgJson = join(workspaceRoot, 'package.json');\n\tif (existsSync(rootPkgJson)) {\n\t\tresults.push(rootPkgJson);\n\t}\n\n\tconst globs = getWorkspaceGlobs(workspaceRoot);\n\n\tfor (const glob of globs) {\n\t\tconst pattern = `${glob}/package.json`;\n\t\tconst matches = fg.sync(pattern, {\n\t\t\tcwd: workspaceRoot,\n\t\t\tabsolute: true,\n\t\t\tignore: ['**/node_modules/**'],\n\t\t});\n\t\tresults.push(...matches);\n\t}\n\n\treturn [...new Set(results)];\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,qBACf,MAAc,QAAQ,IAAI,GACT;CAEjB,IAAI,WAAW,KAAK,KAAK,gBAAgB,CAAC,GAAG,OAAO;CACpD,IAAI,WAAW,KAAK,KAAK,WAAW,CAAC,GAAG,OAAO;CAC/C,IAAI,WAAW,KAAK,KAAK,WAAW,CAAC,GAAG,OAAO;CAC/C,IAAI,WAAW,KAAK,KAAK,mBAAmB,CAAC,GAAG,OAAO;CAGvD,MAAM,YAAY,QAAQ,IAAI,yBAAyB;CACvD,IAAI,UAAU,SAAS,MAAM,GAAG,OAAO;CACvC,IAAI,UAAU,SAAS,MAAM,GAAG,OAAO;CACvC,IAAI,UAAU,SAAS,KAAK,GAAG,OAAO;CAEtC,OAAO;AACR;;AAGA,MAAM,aAAa;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;AAKA,SAAgB,oBAAoB,MAAgC;CACnE,IAAI,CAAC,MACJ,OAAO;CAIR,IAAI,CAAC,oBAAoB,KAAK,IAAI,GACjC,OAAO;CAKR,MAAM,OAAO,KAAK,MAAM,eAAe,CAAC,GAAG;CAC3C,IAAI,QAAQ,WAAW,SAAS,IAAI,GAEnC,OAAO,IAAI,KAAK,kBAAkB,KAAK,wBADtB,KAAK,MAAM,GAAG,EAAE,KAAK,SAAS,EACuB,EAAE,KAAK,KAAK;CAKnF,IAAI;EADc;EAAgB;EAAQ;EAAgB;CAC/C,CAAC,CAAC,SAAS,KAAK,YAAY,CAAC,GACvC,OAAO,IAAI,KAAK;CAGjB,OAAO;AACR;;;;AAKA,SAAgB,qBACf,MACA,MAAc,QAAQ,IAAI,GACP;CACnB,MAAM,aAAa,KAAK,KAAK,IAAI;CACjC,IAAI,WAAW,UAAU,GACxB,OAAO,cAAc,KAAK;CAE3B,OAAO;AACR;;;;AAKA,SAAgB,kBAAkB,YAAoC;CACrE,QAAQ,YAAR;EACC,KAAK,QACJ,OAAO;EACR,KAAK,QACJ,OAAO;EACR,KAAK,OACJ,OAAO;EACR,SACC,OAAO;CACT;AACD;;;;AAKA,SAAgB,cACf,YACA,QACS;CACT,QAAQ,YAAR;EACC,KAAK,QACJ,OAAO,QAAQ;EAChB,KAAK,QACJ,OAAO,QAAQ;EAChB,KAAK,OACJ,OAAO,WAAW;EACnB,SACC,OAAO,WAAW;CACpB;AACD;;;;;AAMA,SAAgB,eACf,YACA,SACS;CACT,QAAQ,YAAR;EACC,KAAK,QACJ,OAAO,aAAa;EACrB,KAAK,QACJ,OAAO,QAAQ;EAChB,KAAK,OACJ,OAAO,QAAQ;EAChB,SACC,OAAO,oBAAoB;CAC7B;AACD;AAEA,MAAM,eAA+C;CACpD,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;AACN;;;;;;AAOA,SAAgB,kBAAkB,KAAa,IAA4B;CAC1E,IAAI,MAAM;CACV,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC;CACxB,MAAM,WAAW,aAAa;CAE9B,OAAO,QAAQ,MAAM;EACpB,IAAI,OAAO,UAAU,WAAW,KAAK,KAAK,qBAAqB,CAAC,GAC/D,OAAO;EAGR,MAAM,cAAc,KAAK,KAAK,cAAc;EAC5C,IAAI,WAAW,WAAW,GACzB,IAAI;GAEH,IADY,KAAK,MAAM,aAAa,aAAa,OAAO,CAClD,CAAC,CAAC,YAAY,OAAO;EAC5B,QAAQ,CAER;EAGD,IAAI,WAAW,KAAK,KAAK,QAAQ,CAAC,GACjC,OAAO;EAGR,MAAM,QAAQ,GAAG;CAClB;CAEA,OAAO;AACR;;;;;AAMA,SAAgB,kBAAkB,MAAwB;CACzD,MAAM,oBAAoB,KAAK,MAAM,qBAAqB;CAC1D,IAAI,WAAW,iBAAiB,GAAG;EAClC,MAAM,UAAU,aAAa,mBAAmB,OAAO;EAEvD,OADeA,QAAU,OACb,CAAC,EAAE,YAAY,CAAC;CAC7B;CAEA,MAAM,kBAAkB,KAAK,MAAM,cAAc;CACjD,IAAI,WAAW,eAAe,GAAG;EAChC,MAAM,MAAM,KAAK,MAAM,aAAa,iBAAiB,OAAO,CAAC;EAC7D,IAAI,MAAM,QAAQ,IAAI,UAAU,GAC/B,OAAO,IAAI;EAEZ,IAAI,IAAI,YAAY,UACnB,OAAO,IAAI,WAAW;CAExB;CAEA,OAAO,CAAC;AACT;;;;;AAMA,SAAgB,sBACf,KACA,IACW;CACX,MAAM,gBAAgB,kBAAkB,KAAK,EAAE;CAC/C,MAAM,UAAoB,CAAC;CAE3B,MAAM,cAAc,KAAK,eAAe,cAAc;CACtD,IAAI,WAAW,WAAW,GACzB,QAAQ,KAAK,WAAW;CAGzB,MAAM,QAAQ,kBAAkB,aAAa;CAE7C,KAAK,MAAM,QAAQ,OAAO;EACzB,MAAM,UAAU,GAAG,KAAK;EACxB,MAAM,UAAU,GAAG,KAAK,SAAS;GAChC,KAAK;GACL,UAAU;GACV,QAAQ,CAAC,oBAAoB;EAC9B,CAAC;EACD,QAAQ,KAAK,GAAG,OAAO;CACxB;CAEA,OAAO,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC;AAC5B"}
package/dist/vitest.cjs DELETED
@@ -1,65 +0,0 @@
1
- const require_ready = require("./ready-D3PIjx3S.cjs");
2
- let node_path = require("node:path");
3
- let node_fs = require("node:fs");
4
- let node_url = require("node:url");
5
- let node_child_process = require("node:child_process");
6
- //#region src/vitest.ts
7
- /**
8
- * The Vitest global setup for a gkm project: the test stage, reconciled,
9
- * migrated and seeded, before any test runs.
10
- *
11
- * ```ts
12
- * // vitest.config.ts — the only one
13
- * export default defineConfig({
14
- * test: { globalSetup: ['@geekmidas/cli/vitest'] },
15
- * });
16
- * ```
17
- *
18
- * Declared once, at the root, it runs however the suite starts — `gkm test`,
19
- * plain `vitest`, an editor's runner, a filtered run of one project. Its
20
- * databases are created, migrated and seeded for every construct at once, so
21
- * there is no per-project setup to be skipped by a filter — and dropped by the
22
- * teardown it returns when the suite ends, once, so the next run starts from
23
- * its migrations rather than from whatever the last one left.
24
- */
25
- /** This package's `gkm`, whichever install of it loaded this file. */
26
- const GKM = (0, node_path.join)((0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)), "..", "bin", "gkm.mjs");
27
- function setup(project) {
28
- const cwd = process.cwd();
29
- const readyPath = process.env["GKM_TEST_READY"] ?? prepare(cwd);
30
- const ready = JSON.parse((0, node_fs.readFileSync)(readyPath, "utf-8"));
31
- const env = JSON.parse((0, node_fs.readFileSync)(ready.env, "utf-8"));
32
- Object.assign(process.env, env);
33
- if (ready.manifest) process.env[require_ready.TEST_MANIFEST_ENV] = ready.manifest;
34
- project?.onTestsRerun(() => {
35
- gkm([
36
- "seed",
37
- "--stage",
38
- "test"
39
- ], cwd);
40
- });
41
- return () => {
42
- gkm(["test", "--teardown"], cwd);
43
- };
44
- }
45
- function prepare(cwd) {
46
- gkm(["test", "--setup"], cwd);
47
- return (0, node_path.join)(cwd, require_ready.TEST_READY_FILE);
48
- }
49
- /**
50
- * Run `gkm` as its own process.
51
- *
52
- * Not in this one: discovery imports the project's constructs, with its path
53
- * aliases, through the loader `gkm` registers for itself — which a module
54
- * Vite loaded into Vitest does not have.
55
- */
56
- function gkm(args, cwd) {
57
- (0, node_child_process.execFileSync)(process.execPath, [GKM, ...args], {
58
- cwd,
59
- stdio: "inherit"
60
- });
61
- }
62
- //#endregion
63
- module.exports = setup;
64
-
65
- //# sourceMappingURL=vitest.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.cjs","names":["join","dirname","fileURLToPath","readFileSync","TEST_MANIFEST_ENV","TEST_READY_FILE"],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * The Vitest global setup for a gkm project: the test stage, reconciled,\n * migrated and seeded, before any test runs.\n *\n * ```ts\n * // vitest.config.ts — the only one\n * export default defineConfig({\n * test: { globalSetup: ['@geekmidas/cli/vitest'] },\n * });\n * ```\n *\n * Declared once, at the root, it runs however the suite starts — `gkm test`,\n * plain `vitest`, an editor's runner, a filtered run of one project. Its\n * databases are created, migrated and seeded for every construct at once, so\n * there is no per-project setup to be skipped by a filter — and dropped by the\n * teardown it returns when the suite ends, once, so the next run starts from\n * its migrations rather than from whatever the last one left.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { TEST_MANIFEST_ENV } from './test/harness';\nimport { TEST_READY_ENV, TEST_READY_FILE, type TestReady } from './test/ready';\n\n/** This package's `gkm`, whichever install of it loaded this file. */\nconst GKM = join(\n\tdirname(fileURLToPath(import.meta.url)),\n\t'..',\n\t'bin',\n\t'gkm.mjs',\n);\n\n/**\n * What this setup uses of Vitest's `TestProject` — written out rather than\n * imported, so declaring it does not drag Vite's types into this package's.\n */\nexport interface RerunningProject {\n\tonTestsRerun(callback: () => void | Promise<void>): void;\n}\n\nexport default function setup(project?: RerunningProject): () => void {\n\tconst cwd = process.cwd();\n\n\t// `gkm test` did the work before starting Vitest; anything else — plain\n\t// `vitest`, an editor — has it done now, the same way.\n\tconst readyPath = process.env[TEST_READY_ENV] ?? prepare(cwd);\n\tconst ready = JSON.parse(readFileSync(readyPath, 'utf-8')) as TestReady;\n\n\t// Into this process's environment, which every worker Vitest starts after\n\t// this inherits — the URLs an app reads, and where the harness is.\n\tconst env = JSON.parse(readFileSync(ready.env, 'utf-8')) as Record<\n\t\tstring,\n\t\tstring\n\t>;\n\tObject.assign(process.env, env);\n\tif (ready.manifest) process.env[TEST_MANIFEST_ENV] = ready.manifest;\n\n\t// A migration or seed written while watching is applied on the next run,\n\t// rather than waiting for Vitest to be restarted.\n\tproject?.onTestsRerun(() => {\n\t\tgkm(['seed', '--stage', 'test'], cwd);\n\t});\n\n\t// When the suite ends — once, after the last run in watch mode. Every test\n\t// rolled back, so nothing in the databases is anyone's.\n\treturn () => {\n\t\tgkm(['test', '--teardown'], cwd);\n\t};\n}\n\nfunction prepare(cwd: string): string {\n\tgkm(['test', '--setup'], cwd);\n\treturn join(cwd, TEST_READY_FILE);\n}\n\n/**\n * Run `gkm` as its own process.\n *\n * Not in this one: discovery imports the project's constructs, with its path\n * aliases, through the loader `gkm` registers for itself — which a module\n * Vite loaded into Vitest does not have.\n */\nfunction gkm(args: string[], cwd: string): void {\n\texecFileSync(process.execPath, [GKM, ...args], { cwd, stdio: 'inherit' });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,OAAA,GAAMA,UAAAA,KAAAA,EAAAA,GACXC,UAAAA,QAAAA,EAAAA,GAAQC,SAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B,CAAC,GACtC,MACA,OACA,SACD;AAUA,SAAwB,MAAM,SAAwC;CACrE,MAAM,MAAM,QAAQ,IAAI;CAIxB,MAAM,YAAY,QAAQ,IAAA,qBAAuB,QAAQ,GAAG;CAC5D,MAAM,QAAQ,KAAK,OAAA,GAAMC,QAAAA,aAAAA,CAAa,WAAW,OAAO,CAAC;CAIzD,MAAM,MAAM,KAAK,OAAA,GAAMA,QAAAA,aAAAA,CAAa,MAAM,KAAK,OAAO,CAAC;CAIvD,OAAO,OAAO,QAAQ,KAAK,GAAG;CAC9B,IAAI,MAAM,UAAU,QAAQ,IAAIC,cAAAA,qBAAqB,MAAM;CAI3D,SAAS,mBAAmB;EAC3B,IAAI;GAAC;GAAQ;GAAW;EAAM,GAAG,GAAG;CACrC,CAAC;CAID,aAAa;EACZ,IAAI,CAAC,QAAQ,YAAY,GAAG,GAAG;CAChC;AACD;AAEA,SAAS,QAAQ,KAAqB;CACrC,IAAI,CAAC,QAAQ,SAAS,GAAG,GAAG;CAC5B,QAAA,GAAOJ,UAAAA,KAAAA,CAAK,KAAKK,cAAAA,eAAe;AACjC;;;;;;;;AASA,SAAS,IAAI,MAAgB,KAAmB;CAC/C,CAAA,GAAA,mBAAA,aAAA,CAAa,QAAQ,UAAU,CAAC,KAAK,GAAG,IAAI,GAAG;EAAE;EAAK,OAAO;CAAU,CAAC;AACzE"}
package/dist/vitest.d.cts DELETED
@@ -1,29 +0,0 @@
1
- //#region src/vitest.d.ts
2
- /**
3
- * The Vitest global setup for a gkm project: the test stage, reconciled,
4
- * migrated and seeded, before any test runs.
5
- *
6
- * ```ts
7
- * // vitest.config.ts — the only one
8
- * export default defineConfig({
9
- * test: { globalSetup: ['@geekmidas/cli/vitest'] },
10
- * });
11
- * ```
12
- *
13
- * Declared once, at the root, it runs however the suite starts — `gkm test`,
14
- * plain `vitest`, an editor's runner, a filtered run of one project. Its
15
- * databases are created, migrated and seeded for every construct at once, so
16
- * there is no per-project setup to be skipped by a filter — and dropped by the
17
- * teardown it returns when the suite ends, once, so the next run starts from
18
- * its migrations rather than from whatever the last one left.
19
- */
20
- /**
21
- * What this setup uses of Vitest's `TestProject` — written out rather than
22
- * imported, so declaring it does not drag Vite's types into this package's.
23
- */
24
- export interface RerunningProject {
25
- onTestsRerun(callback: () => void | Promise<void>): void;
26
- }
27
- export default function setup(project?: RerunningProject): () => void;
28
- //#endregion
29
- //# sourceMappingURL=vitest.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.d.cts","names":[],"sources":["../src/vitest.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAsCiB;EAChB,aAAa,uBAAuB;;wBAGb,MAAM,UAAU"}
package/dist/vitest.d.mts DELETED
@@ -1,29 +0,0 @@
1
- //#region src/vitest.d.ts
2
- /**
3
- * The Vitest global setup for a gkm project: the test stage, reconciled,
4
- * migrated and seeded, before any test runs.
5
- *
6
- * ```ts
7
- * // vitest.config.ts — the only one
8
- * export default defineConfig({
9
- * test: { globalSetup: ['@geekmidas/cli/vitest'] },
10
- * });
11
- * ```
12
- *
13
- * Declared once, at the root, it runs however the suite starts — `gkm test`,
14
- * plain `vitest`, an editor's runner, a filtered run of one project. Its
15
- * databases are created, migrated and seeded for every construct at once, so
16
- * there is no per-project setup to be skipped by a filter — and dropped by the
17
- * teardown it returns when the suite ends, once, so the next run starts from
18
- * its migrations rather than from whatever the last one left.
19
- */
20
- /**
21
- * What this setup uses of Vitest's `TestProject` — written out rather than
22
- * imported, so declaring it does not drag Vite's types into this package's.
23
- */
24
- export interface RerunningProject {
25
- onTestsRerun(callback: () => void | Promise<void>): void;
26
- }
27
- export default function setup(project?: RerunningProject): () => void;
28
- //#endregion
29
- //# sourceMappingURL=vitest.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.d.mts","names":[],"sources":["../src/vitest.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAsCiB;EAChB,aAAa,uBAAuB;;wBAGb,MAAM,UAAU"}
package/dist/vitest.mjs DELETED
@@ -1,65 +0,0 @@
1
- import { i as TEST_MANIFEST_ENV, n as TEST_READY_FILE } from "./ready-naOSJpeJ.mjs";
2
- import { dirname, join } from "node:path";
3
- import { readFileSync } from "node:fs";
4
- import { fileURLToPath } from "node:url";
5
- import { execFileSync } from "node:child_process";
6
- //#region src/vitest.ts
7
- /**
8
- * The Vitest global setup for a gkm project: the test stage, reconciled,
9
- * migrated and seeded, before any test runs.
10
- *
11
- * ```ts
12
- * // vitest.config.ts — the only one
13
- * export default defineConfig({
14
- * test: { globalSetup: ['@geekmidas/cli/vitest'] },
15
- * });
16
- * ```
17
- *
18
- * Declared once, at the root, it runs however the suite starts — `gkm test`,
19
- * plain `vitest`, an editor's runner, a filtered run of one project. Its
20
- * databases are created, migrated and seeded for every construct at once, so
21
- * there is no per-project setup to be skipped by a filter — and dropped by the
22
- * teardown it returns when the suite ends, once, so the next run starts from
23
- * its migrations rather than from whatever the last one left.
24
- */
25
- /** This package's `gkm`, whichever install of it loaded this file. */
26
- const GKM = join(dirname(fileURLToPath(import.meta.url)), "..", "bin", "gkm.mjs");
27
- function setup(project) {
28
- const cwd = process.cwd();
29
- const readyPath = process.env["GKM_TEST_READY"] ?? prepare(cwd);
30
- const ready = JSON.parse(readFileSync(readyPath, "utf-8"));
31
- const env = JSON.parse(readFileSync(ready.env, "utf-8"));
32
- Object.assign(process.env, env);
33
- if (ready.manifest) process.env[TEST_MANIFEST_ENV] = ready.manifest;
34
- project?.onTestsRerun(() => {
35
- gkm([
36
- "seed",
37
- "--stage",
38
- "test"
39
- ], cwd);
40
- });
41
- return () => {
42
- gkm(["test", "--teardown"], cwd);
43
- };
44
- }
45
- function prepare(cwd) {
46
- gkm(["test", "--setup"], cwd);
47
- return join(cwd, TEST_READY_FILE);
48
- }
49
- /**
50
- * Run `gkm` as its own process.
51
- *
52
- * Not in this one: discovery imports the project's constructs, with its path
53
- * aliases, through the loader `gkm` registers for itself — which a module
54
- * Vite loaded into Vitest does not have.
55
- */
56
- function gkm(args, cwd) {
57
- execFileSync(process.execPath, [GKM, ...args], {
58
- cwd,
59
- stdio: "inherit"
60
- });
61
- }
62
- //#endregion
63
- export { setup as default };
64
-
65
- //# sourceMappingURL=vitest.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.mjs","names":[],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * The Vitest global setup for a gkm project: the test stage, reconciled,\n * migrated and seeded, before any test runs.\n *\n * ```ts\n * // vitest.config.ts — the only one\n * export default defineConfig({\n * test: { globalSetup: ['@geekmidas/cli/vitest'] },\n * });\n * ```\n *\n * Declared once, at the root, it runs however the suite starts — `gkm test`,\n * plain `vitest`, an editor's runner, a filtered run of one project. Its\n * databases are created, migrated and seeded for every construct at once, so\n * there is no per-project setup to be skipped by a filter — and dropped by the\n * teardown it returns when the suite ends, once, so the next run starts from\n * its migrations rather than from whatever the last one left.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { TEST_MANIFEST_ENV } from './test/harness';\nimport { TEST_READY_ENV, TEST_READY_FILE, type TestReady } from './test/ready';\n\n/** This package's `gkm`, whichever install of it loaded this file. */\nconst GKM = join(\n\tdirname(fileURLToPath(import.meta.url)),\n\t'..',\n\t'bin',\n\t'gkm.mjs',\n);\n\n/**\n * What this setup uses of Vitest's `TestProject` — written out rather than\n * imported, so declaring it does not drag Vite's types into this package's.\n */\nexport interface RerunningProject {\n\tonTestsRerun(callback: () => void | Promise<void>): void;\n}\n\nexport default function setup(project?: RerunningProject): () => void {\n\tconst cwd = process.cwd();\n\n\t// `gkm test` did the work before starting Vitest; anything else — plain\n\t// `vitest`, an editor — has it done now, the same way.\n\tconst readyPath = process.env[TEST_READY_ENV] ?? prepare(cwd);\n\tconst ready = JSON.parse(readFileSync(readyPath, 'utf-8')) as TestReady;\n\n\t// Into this process's environment, which every worker Vitest starts after\n\t// this inherits — the URLs an app reads, and where the harness is.\n\tconst env = JSON.parse(readFileSync(ready.env, 'utf-8')) as Record<\n\t\tstring,\n\t\tstring\n\t>;\n\tObject.assign(process.env, env);\n\tif (ready.manifest) process.env[TEST_MANIFEST_ENV] = ready.manifest;\n\n\t// A migration or seed written while watching is applied on the next run,\n\t// rather than waiting for Vitest to be restarted.\n\tproject?.onTestsRerun(() => {\n\t\tgkm(['seed', '--stage', 'test'], cwd);\n\t});\n\n\t// When the suite ends — once, after the last run in watch mode. Every test\n\t// rolled back, so nothing in the databases is anyone's.\n\treturn () => {\n\t\tgkm(['test', '--teardown'], cwd);\n\t};\n}\n\nfunction prepare(cwd: string): string {\n\tgkm(['test', '--setup'], cwd);\n\treturn join(cwd, TEST_READY_FILE);\n}\n\n/**\n * Run `gkm` as its own process.\n *\n * Not in this one: discovery imports the project's constructs, with its path\n * aliases, through the loader `gkm` registers for itself — which a module\n * Vite loaded into Vitest does not have.\n */\nfunction gkm(args: string[], cwd: string): void {\n\texecFileSync(process.execPath, [GKM, ...args], { cwd, stdio: 'inherit' });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,MAAM,KACX,QAAQ,cAAc,YAAY,GAAG,CAAC,GACtC,MACA,OACA,SACD;AAUA,SAAwB,MAAM,SAAwC;CACrE,MAAM,MAAM,QAAQ,IAAI;CAIxB,MAAM,YAAY,QAAQ,IAAA,qBAAuB,QAAQ,GAAG;CAC5D,MAAM,QAAQ,KAAK,MAAM,aAAa,WAAW,OAAO,CAAC;CAIzD,MAAM,MAAM,KAAK,MAAM,aAAa,MAAM,KAAK,OAAO,CAAC;CAIvD,OAAO,OAAO,QAAQ,KAAK,GAAG;CAC9B,IAAI,MAAM,UAAU,QAAQ,IAAI,qBAAqB,MAAM;CAI3D,SAAS,mBAAmB;EAC3B,IAAI;GAAC;GAAQ;GAAW;EAAM,GAAG,GAAG;CACrC,CAAC;CAID,aAAa;EACZ,IAAI,CAAC,QAAQ,YAAY,GAAG,GAAG;CAChC;AACD;AAEA,SAAS,QAAQ,KAAqB;CACrC,IAAI,CAAC,QAAQ,SAAS,GAAG,GAAG;CAC5B,OAAO,KAAK,KAAK,eAAe;AACjC;;;;;;;;AASA,SAAS,IAAI,MAAgB,KAAmB;CAC/C,aAAa,QAAQ,UAAU,CAAC,KAAK,GAAG,IAAI,GAAG;EAAE;EAAK,OAAO;CAAU,CAAC;AACzE"}
@@ -1,108 +0,0 @@
1
- let node_path = require("node:path");
2
- let node_fs = require("node:fs");
3
- let node_url = require("node:url");
4
- //#region src/sandbox/workerRuntime.ts
5
- /**
6
- * What a worker script needs on its side of the sandbox: to answer, to say
7
- * what would not cross as data, and to resolve the project's path aliases the
8
- * way `gkm` does.
9
- *
10
- * Kept apart from `worker.ts`, which the host runs, so a worker loads nothing
11
- * of the host's side.
12
- */
13
- /** The line prefix a worker's answer is written after, on stdout. */
14
- const WORKER_RESULT_MARKER = "@@gkm-worker-result@@";
15
- /**
16
- * Write a worker's answer, and end the worker once it is out.
17
- *
18
- * Exiting rather than returning: the project's code may have left a server, a
19
- * timer or a connection open, and the answer is all the deploy waits for. The
20
- * callback, because a pipe on macOS is written asynchronously and an exit
21
- * before it drains would cut the answer short.
22
- */
23
- function answer(value) {
24
- process.stdout.write(`${WORKER_RESULT_MARKER}${JSON.stringify(value)}\n`, () => process.exit(0));
25
- }
26
- /**
27
- * Where in `value` something is that JSON cannot carry faithfully: a
28
- * function, a class instance, a symbol, a bigint, a `Date`, a `Map` — as
29
- * paths like `state.provider` or `apps.api.hooks[0]`.
30
- *
31
- * `JSON.stringify` drops a function silently and turns a store into `{}`, so a
32
- * config that crossed it would arrive *different* rather than refused.
33
- */
34
- function liveValuePaths(value, path = "") {
35
- if (value === null) return [];
36
- switch (typeof value) {
37
- case "string":
38
- case "boolean":
39
- case "undefined": return [];
40
- case "number": return Number.isFinite(value) ? [] : [path || "(root)"];
41
- case "object": break;
42
- default: return [path || "(root)"];
43
- }
44
- if (Array.isArray(value)) return value.flatMap((item, index) => liveValuePaths(item, `${path}[${index}]`));
45
- const proto = Object.getPrototypeOf(value);
46
- if (proto !== Object.prototype && proto !== null) return [path || "(root)"];
47
- return Object.entries(value).flatMap(([key, item]) => liveValuePaths(item, path ? `${path}.${key}` : key));
48
- }
49
- /** An error, as plain data a host can rebuild a message from. */
50
- function errorData(error) {
51
- if (!(error instanceof Error)) return {
52
- name: "Error",
53
- message: String(error)
54
- };
55
- return {
56
- ...Object.fromEntries(Object.entries(error).filter(([, v]) => liveValuePaths(v).length === 0)),
57
- name: error.name,
58
- message: error.message
59
- };
60
- }
61
- /**
62
- * Resolve each module's path aliases through its own tsconfig, as `gkm` does
63
- * — the hook ships beside `bin/gkm.mjs`. Without it a construct importing
64
- * `~/db` resolves in `gkm dev` and not in a deploy.
65
- */
66
- async function registerAdjacentTsconfig() {
67
- for (let dir = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)); (0, node_path.dirname)(dir) !== dir; dir = (0, node_path.dirname)(dir)) {
68
- const hook = (0, node_path.join)(dir, "bin", "adjacent-tsconfig.mjs");
69
- if ((0, node_fs.existsSync)(hook)) {
70
- const { registerAdjacentTsconfig: register } = await import((0, node_url.pathToFileURL)(hook).href);
71
- await register();
72
- return;
73
- }
74
- }
75
- }
76
- //#endregion
77
- Object.defineProperty(exports, "WORKER_RESULT_MARKER", {
78
- enumerable: true,
79
- get: function() {
80
- return WORKER_RESULT_MARKER;
81
- }
82
- });
83
- Object.defineProperty(exports, "answer", {
84
- enumerable: true,
85
- get: function() {
86
- return answer;
87
- }
88
- });
89
- Object.defineProperty(exports, "errorData", {
90
- enumerable: true,
91
- get: function() {
92
- return errorData;
93
- }
94
- });
95
- Object.defineProperty(exports, "liveValuePaths", {
96
- enumerable: true,
97
- get: function() {
98
- return liveValuePaths;
99
- }
100
- });
101
- Object.defineProperty(exports, "registerAdjacentTsconfig", {
102
- enumerable: true,
103
- get: function() {
104
- return registerAdjacentTsconfig;
105
- }
106
- });
107
-
108
- //# sourceMappingURL=workerRuntime-BXfhbe13.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workerRuntime-BXfhbe13.cjs","names":["dirname","fileURLToPath","join","existsSync","pathToFileURL"],"sources":["../src/sandbox/workerRuntime.ts"],"sourcesContent":["/**\n * What a worker script needs on its side of the sandbox: to answer, to say\n * what would not cross as data, and to resolve the project's path aliases the\n * way `gkm` does.\n *\n * Kept apart from `worker.ts`, which the host runs, so a worker loads nothing\n * of the host's side.\n */\n\nimport { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\n/** The line prefix a worker's answer is written after, on stdout. */\nexport const WORKER_RESULT_MARKER = '@@gkm-worker-result@@';\n\n/**\n * Write a worker's answer, and end the worker once it is out.\n *\n * Exiting rather than returning: the project's code may have left a server, a\n * timer or a connection open, and the answer is all the deploy waits for. The\n * callback, because a pipe on macOS is written asynchronously and an exit\n * before it drains would cut the answer short.\n */\nexport function answer(value: unknown): void {\n\tprocess.stdout.write(\n\t\t`${WORKER_RESULT_MARKER}${JSON.stringify(value)}\\n`,\n\t\t() => process.exit(0),\n\t);\n}\n\n/**\n * Where in `value` something is that JSON cannot carry faithfully: a\n * function, a class instance, a symbol, a bigint, a `Date`, a `Map` — as\n * paths like `state.provider` or `apps.api.hooks[0]`.\n *\n * `JSON.stringify` drops a function silently and turns a store into `{}`, so a\n * config that crossed it would arrive *different* rather than refused.\n */\nexport function liveValuePaths(value: unknown, path = ''): string[] {\n\tif (value === null) return [];\n\tswitch (typeof value) {\n\t\tcase 'string':\n\t\tcase 'boolean':\n\t\tcase 'undefined':\n\t\t\treturn [];\n\t\tcase 'number':\n\t\t\treturn Number.isFinite(value) ? [] : [path || '(root)'];\n\t\tcase 'object':\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn [path || '(root)'];\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn value.flatMap((item, index) =>\n\t\t\tliveValuePaths(item, `${path}[${index}]`),\n\t\t);\n\t}\n\n\tconst proto = Object.getPrototypeOf(value);\n\tif (proto !== Object.prototype && proto !== null) return [path || '(root)'];\n\n\treturn Object.entries(value as Record<string, unknown>).flatMap(\n\t\t([key, item]) => liveValuePaths(item, path ? `${path}.${key}` : key),\n\t);\n}\n\n/** An error, as plain data a host can rebuild a message from. */\nexport function errorData(error: unknown): {\n\tname: string;\n\tmessage: string;\n\t[field: string]: unknown;\n} {\n\tif (!(error instanceof Error))\n\t\treturn { name: 'Error', message: String(error) };\n\tconst fields = Object.fromEntries(\n\t\tObject.entries(error).filter(([, v]) => liveValuePaths(v).length === 0),\n\t);\n\treturn { ...fields, name: error.name, message: error.message };\n}\n\n/**\n * Resolve each module's path aliases through its own tsconfig, as `gkm` does\n * — the hook ships beside `bin/gkm.mjs`. Without it a construct importing\n * `~/db` resolves in `gkm dev` and not in a deploy.\n */\nexport async function registerAdjacentTsconfig(): Promise<void> {\n\tfor (\n\t\tlet dir = dirname(fileURLToPath(import.meta.url));\n\t\tdirname(dir) !== dir;\n\t\tdir = dirname(dir)\n\t) {\n\t\tconst hook = join(dir, 'bin', 'adjacent-tsconfig.mjs');\n\t\tif (existsSync(hook)) {\n\t\t\tconst { registerAdjacentTsconfig: register } = await import(\n\t\t\t\tpathToFileURL(hook).href\n\t\t\t);\n\t\t\tawait register();\n\t\t\treturn;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,uBAAuB;;;;;;;;;AAUpC,SAAgB,OAAO,OAAsB;CAC5C,QAAQ,OAAO,MACd,GAAG,uBAAuB,KAAK,UAAU,KAAK,EAAE,WAC1C,QAAQ,KAAK,CAAC,CACrB;AACD;;;;;;;;;AAUA,SAAgB,eAAe,OAAgB,OAAO,IAAc;CACnE,IAAI,UAAU,MAAM,OAAO,CAAC;CAC5B,QAAQ,OAAO,OAAf;EACC,KAAK;EACL,KAAK;EACL,KAAK,aACJ,OAAO,CAAC;EACT,KAAK,UACJ,OAAO,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,QAAQ;EACvD,KAAK,UACJ;EACD,SACC,OAAO,CAAC,QAAQ,QAAQ;CAC1B;CAEA,IAAI,MAAM,QAAQ,KAAK,GACtB,OAAO,MAAM,SAAS,MAAM,UAC3B,eAAe,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE,CACzC;CAGD,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,IAAI,UAAU,OAAO,aAAa,UAAU,MAAM,OAAO,CAAC,QAAQ,QAAQ;CAE1E,OAAO,OAAO,QAAQ,KAAgC,CAAC,CAAC,SACtD,CAAC,KAAK,UAAU,eAAe,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,CACpE;AACD;;AAGA,SAAgB,UAAU,OAIxB;CACD,IAAI,EAAE,iBAAiB,QACtB,OAAO;EAAE,MAAM;EAAS,SAAS,OAAO,KAAK;CAAE;CAIhD,OAAO;EAAE,GAHM,OAAO,YACrB,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,GAAG,OAAO,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAEtD;EAAG,MAAM,MAAM;EAAM,SAAS,MAAM;CAAQ;AAC9D;;;;;;AAOA,eAAsB,2BAA0C;CAC/D,KACC,IAAI,OAAA,GAAMA,UAAAA,QAAAA,EAAAA,GAAQC,SAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B,CAAC,IAAA,GAChDD,UAAAA,QAAAA,CAAQ,GAAG,MAAM,KACjB,OAAA,GAAMA,UAAAA,QAAAA,CAAQ,GAAG,GAChB;EACD,MAAM,QAAA,GAAOE,UAAAA,KAAAA,CAAK,KAAK,OAAO,uBAAuB;EACrD,KAAA,GAAIC,QAAAA,WAAAA,CAAW,IAAI,GAAG;GACrB,MAAM,EAAE,0BAA0B,aAAa,MAAM,QAAA,GACpDC,SAAAA,cAAAA,CAAc,IAAI,CAAC,CAAC;GAErB,MAAM,SAAS;GACf;EACD;CACD;AACD"}
@@ -1,79 +0,0 @@
1
- import { dirname, join } from "node:path";
2
- import { existsSync } from "node:fs";
3
- import { fileURLToPath, pathToFileURL } from "node:url";
4
- //#region src/sandbox/workerRuntime.ts
5
- /**
6
- * What a worker script needs on its side of the sandbox: to answer, to say
7
- * what would not cross as data, and to resolve the project's path aliases the
8
- * way `gkm` does.
9
- *
10
- * Kept apart from `worker.ts`, which the host runs, so a worker loads nothing
11
- * of the host's side.
12
- */
13
- /** The line prefix a worker's answer is written after, on stdout. */
14
- const WORKER_RESULT_MARKER = "@@gkm-worker-result@@";
15
- /**
16
- * Write a worker's answer, and end the worker once it is out.
17
- *
18
- * Exiting rather than returning: the project's code may have left a server, a
19
- * timer or a connection open, and the answer is all the deploy waits for. The
20
- * callback, because a pipe on macOS is written asynchronously and an exit
21
- * before it drains would cut the answer short.
22
- */
23
- function answer(value) {
24
- process.stdout.write(`${WORKER_RESULT_MARKER}${JSON.stringify(value)}\n`, () => process.exit(0));
25
- }
26
- /**
27
- * Where in `value` something is that JSON cannot carry faithfully: a
28
- * function, a class instance, a symbol, a bigint, a `Date`, a `Map` — as
29
- * paths like `state.provider` or `apps.api.hooks[0]`.
30
- *
31
- * `JSON.stringify` drops a function silently and turns a store into `{}`, so a
32
- * config that crossed it would arrive *different* rather than refused.
33
- */
34
- function liveValuePaths(value, path = "") {
35
- if (value === null) return [];
36
- switch (typeof value) {
37
- case "string":
38
- case "boolean":
39
- case "undefined": return [];
40
- case "number": return Number.isFinite(value) ? [] : [path || "(root)"];
41
- case "object": break;
42
- default: return [path || "(root)"];
43
- }
44
- if (Array.isArray(value)) return value.flatMap((item, index) => liveValuePaths(item, `${path}[${index}]`));
45
- const proto = Object.getPrototypeOf(value);
46
- if (proto !== Object.prototype && proto !== null) return [path || "(root)"];
47
- return Object.entries(value).flatMap(([key, item]) => liveValuePaths(item, path ? `${path}.${key}` : key));
48
- }
49
- /** An error, as plain data a host can rebuild a message from. */
50
- function errorData(error) {
51
- if (!(error instanceof Error)) return {
52
- name: "Error",
53
- message: String(error)
54
- };
55
- return {
56
- ...Object.fromEntries(Object.entries(error).filter(([, v]) => liveValuePaths(v).length === 0)),
57
- name: error.name,
58
- message: error.message
59
- };
60
- }
61
- /**
62
- * Resolve each module's path aliases through its own tsconfig, as `gkm` does
63
- * — the hook ships beside `bin/gkm.mjs`. Without it a construct importing
64
- * `~/db` resolves in `gkm dev` and not in a deploy.
65
- */
66
- async function registerAdjacentTsconfig() {
67
- for (let dir = dirname(fileURLToPath(import.meta.url)); dirname(dir) !== dir; dir = dirname(dir)) {
68
- const hook = join(dir, "bin", "adjacent-tsconfig.mjs");
69
- if (existsSync(hook)) {
70
- const { registerAdjacentTsconfig: register } = await import(pathToFileURL(hook).href);
71
- await register();
72
- return;
73
- }
74
- }
75
- }
76
- //#endregion
77
- export { registerAdjacentTsconfig as a, liveValuePaths as i, answer as n, errorData as r, WORKER_RESULT_MARKER as t };
78
-
79
- //# sourceMappingURL=workerRuntime-CsOyBRx2.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workerRuntime-CsOyBRx2.mjs","names":[],"sources":["../src/sandbox/workerRuntime.ts"],"sourcesContent":["/**\n * What a worker script needs on its side of the sandbox: to answer, to say\n * what would not cross as data, and to resolve the project's path aliases the\n * way `gkm` does.\n *\n * Kept apart from `worker.ts`, which the host runs, so a worker loads nothing\n * of the host's side.\n */\n\nimport { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\n/** The line prefix a worker's answer is written after, on stdout. */\nexport const WORKER_RESULT_MARKER = '@@gkm-worker-result@@';\n\n/**\n * Write a worker's answer, and end the worker once it is out.\n *\n * Exiting rather than returning: the project's code may have left a server, a\n * timer or a connection open, and the answer is all the deploy waits for. The\n * callback, because a pipe on macOS is written asynchronously and an exit\n * before it drains would cut the answer short.\n */\nexport function answer(value: unknown): void {\n\tprocess.stdout.write(\n\t\t`${WORKER_RESULT_MARKER}${JSON.stringify(value)}\\n`,\n\t\t() => process.exit(0),\n\t);\n}\n\n/**\n * Where in `value` something is that JSON cannot carry faithfully: a\n * function, a class instance, a symbol, a bigint, a `Date`, a `Map` — as\n * paths like `state.provider` or `apps.api.hooks[0]`.\n *\n * `JSON.stringify` drops a function silently and turns a store into `{}`, so a\n * config that crossed it would arrive *different* rather than refused.\n */\nexport function liveValuePaths(value: unknown, path = ''): string[] {\n\tif (value === null) return [];\n\tswitch (typeof value) {\n\t\tcase 'string':\n\t\tcase 'boolean':\n\t\tcase 'undefined':\n\t\t\treturn [];\n\t\tcase 'number':\n\t\t\treturn Number.isFinite(value) ? [] : [path || '(root)'];\n\t\tcase 'object':\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn [path || '(root)'];\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn value.flatMap((item, index) =>\n\t\t\tliveValuePaths(item, `${path}[${index}]`),\n\t\t);\n\t}\n\n\tconst proto = Object.getPrototypeOf(value);\n\tif (proto !== Object.prototype && proto !== null) return [path || '(root)'];\n\n\treturn Object.entries(value as Record<string, unknown>).flatMap(\n\t\t([key, item]) => liveValuePaths(item, path ? `${path}.${key}` : key),\n\t);\n}\n\n/** An error, as plain data a host can rebuild a message from. */\nexport function errorData(error: unknown): {\n\tname: string;\n\tmessage: string;\n\t[field: string]: unknown;\n} {\n\tif (!(error instanceof Error))\n\t\treturn { name: 'Error', message: String(error) };\n\tconst fields = Object.fromEntries(\n\t\tObject.entries(error).filter(([, v]) => liveValuePaths(v).length === 0),\n\t);\n\treturn { ...fields, name: error.name, message: error.message };\n}\n\n/**\n * Resolve each module's path aliases through its own tsconfig, as `gkm` does\n * — the hook ships beside `bin/gkm.mjs`. Without it a construct importing\n * `~/db` resolves in `gkm dev` and not in a deploy.\n */\nexport async function registerAdjacentTsconfig(): Promise<void> {\n\tfor (\n\t\tlet dir = dirname(fileURLToPath(import.meta.url));\n\t\tdirname(dir) !== dir;\n\t\tdir = dirname(dir)\n\t) {\n\t\tconst hook = join(dir, 'bin', 'adjacent-tsconfig.mjs');\n\t\tif (existsSync(hook)) {\n\t\t\tconst { registerAdjacentTsconfig: register } = await import(\n\t\t\t\tpathToFileURL(hook).href\n\t\t\t);\n\t\t\tawait register();\n\t\t\treturn;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,uBAAuB;;;;;;;;;AAUpC,SAAgB,OAAO,OAAsB;CAC5C,QAAQ,OAAO,MACd,GAAG,uBAAuB,KAAK,UAAU,KAAK,EAAE,WAC1C,QAAQ,KAAK,CAAC,CACrB;AACD;;;;;;;;;AAUA,SAAgB,eAAe,OAAgB,OAAO,IAAc;CACnE,IAAI,UAAU,MAAM,OAAO,CAAC;CAC5B,QAAQ,OAAO,OAAf;EACC,KAAK;EACL,KAAK;EACL,KAAK,aACJ,OAAO,CAAC;EACT,KAAK,UACJ,OAAO,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,QAAQ;EACvD,KAAK,UACJ;EACD,SACC,OAAO,CAAC,QAAQ,QAAQ;CAC1B;CAEA,IAAI,MAAM,QAAQ,KAAK,GACtB,OAAO,MAAM,SAAS,MAAM,UAC3B,eAAe,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE,CACzC;CAGD,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,IAAI,UAAU,OAAO,aAAa,UAAU,MAAM,OAAO,CAAC,QAAQ,QAAQ;CAE1E,OAAO,OAAO,QAAQ,KAAgC,CAAC,CAAC,SACtD,CAAC,KAAK,UAAU,eAAe,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,CACpE;AACD;;AAGA,SAAgB,UAAU,OAIxB;CACD,IAAI,EAAE,iBAAiB,QACtB,OAAO;EAAE,MAAM;EAAS,SAAS,OAAO,KAAK;CAAE;CAIhD,OAAO;EAAE,GAHM,OAAO,YACrB,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,GAAG,OAAO,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAEtD;EAAG,MAAM,MAAM;EAAM,SAAS,MAAM;CAAQ;AAC9D;;;;;;AAOA,eAAsB,2BAA0C;CAC/D,KACC,IAAI,MAAM,QAAQ,cAAc,YAAY,GAAG,CAAC,GAChD,QAAQ,GAAG,MAAM,KACjB,MAAM,QAAQ,GAAG,GAChB;EACD,MAAM,OAAO,KAAK,KAAK,OAAO,uBAAuB;EACrD,IAAI,WAAW,IAAI,GAAG;GACrB,MAAM,EAAE,0BAA0B,aAAa,MAAM,OACpD,cAAc,IAAI,CAAC,CAAC;GAErB,MAAM,SAAS;GACf;EACD;CACD;AACD"}