@wildo-ai/platform-config-lib 1.1.11 → 1.1.12

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 (389) hide show
  1. package/dist/esm/_unimplemented/soft-warn.d.ts +24 -49
  2. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
  3. package/dist/esm/_unimplemented/soft-warn.js +24 -49
  4. package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
  5. package/dist/esm/blueprint/anchored-region.d.ts.map +1 -1
  6. package/dist/esm/blueprint/anchored-region.js.map +1 -1
  7. package/dist/esm/blueprint/blueprint.schemas.d.ts +0 -89
  8. package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -1
  9. package/dist/esm/blueprint/blueprint.schemas.js.map +1 -1
  10. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  12. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
  13. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
  14. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  17. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  18. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +8 -1
  19. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/bootstrap.schemas.js +15 -1
  21. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  22. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +10 -2
  23. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +10 -2
  25. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  26. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +21 -0
  27. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/platform-store-preconnect.js +25 -0
  29. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
  30. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +80 -0
  31. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -0
  32. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +81 -0
  33. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -0
  34. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +41 -9
  35. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  36. package/dist/esm/bootstrap/runtime-backing-service-access.js +77 -28
  37. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  38. package/dist/esm/bootstrap/runtime-network-policy.d.ts +117 -12
  39. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  40. package/dist/esm/bootstrap/runtime-network-policy.js +222 -23
  41. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
  42. package/dist/esm/bootstrap/runtime-network-topology.d.ts +31 -4
  43. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  44. package/dist/esm/bootstrap/runtime-network-topology.js +43 -2
  45. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  46. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  47. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
  48. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +40 -2
  49. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  50. package/dist/esm/bootstrap/runtime-principal.contracts.js +66 -3
  51. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
  52. package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -1
  53. package/dist/esm/bootstrap/runtime-response-integrity.js +3 -3
  54. package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -1
  55. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -1
  56. package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -1
  57. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  58. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  59. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  60. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  61. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -1
  62. package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -1
  63. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  64. package/dist/esm/config-authoring.entry.js.map +1 -1
  65. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  66. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  67. package/dist/esm/index.d.ts +5 -1
  68. package/dist/esm/index.d.ts.map +1 -1
  69. package/dist/esm/index.js +5 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts +119 -0
  72. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts.map +1 -0
  73. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js +109 -0
  74. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js.map +1 -0
  75. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts +182 -0
  76. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts.map +1 -0
  77. package/dist/esm/key-management/application-signing-key-rotation.contracts.js +145 -0
  78. package/dist/esm/key-management/application-signing-key-rotation.contracts.js.map +1 -0
  79. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts +156 -0
  80. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts.map +1 -0
  81. package/dist/esm/key-management/approval-seal-manifested-copy.js +617 -0
  82. package/dist/esm/key-management/approval-seal-manifested-copy.js.map +1 -0
  83. package/dist/esm/key-management/approval-seal-verifier.d.ts +101 -39
  84. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -1
  85. package/dist/esm/key-management/approval-seal-verifier.js +134 -12
  86. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -1
  87. package/dist/esm/key-management/approval-seal.contracts.d.ts +12 -15
  88. package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -1
  89. package/dist/esm/key-management/approval-seal.contracts.js +20 -0
  90. package/dist/esm/key-management/approval-seal.contracts.js.map +1 -1
  91. package/dist/esm/key-management/data-key.contracts.d.ts +0 -2
  92. package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -1
  93. package/dist/esm/key-management/data-key.contracts.js.map +1 -1
  94. package/dist/esm/key-management/es256-jws.d.ts.map +1 -1
  95. package/dist/esm/key-management/es256-jws.js.map +1 -1
  96. package/dist/esm/key-management/key-provider.spi.d.ts +8 -1
  97. package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -1
  98. package/dist/esm/key-management/key-provider.spi.js.map +1 -1
  99. package/dist/esm/key-management/keyring-rotation.contracts.d.ts +2 -12
  100. package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -1
  101. package/dist/esm/key-management/keyring-rotation.contracts.js +3 -3
  102. package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -1
  103. package/dist/esm/key-management/keyring-status.contracts.d.ts +0 -7
  104. package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -1
  105. package/dist/esm/key-management/keyring-status.contracts.js.map +1 -1
  106. package/dist/esm/key-management/pdf-incremental-update.d.ts +158 -0
  107. package/dist/esm/key-management/pdf-incremental-update.d.ts.map +1 -0
  108. package/dist/esm/key-management/pdf-incremental-update.js +730 -0
  109. package/dist/esm/key-management/pdf-incremental-update.js.map +1 -0
  110. package/dist/esm/key-management/pdf-truetype-font.d.ts +35 -0
  111. package/dist/esm/key-management/pdf-truetype-font.d.ts.map +1 -0
  112. package/dist/esm/key-management/pdf-truetype-font.js +152 -0
  113. package/dist/esm/key-management/pdf-truetype-font.js.map +1 -0
  114. package/dist/esm/key-management/qr-code.d.ts +38 -0
  115. package/dist/esm/key-management/qr-code.d.ts.map +1 -0
  116. package/dist/esm/key-management/qr-code.js +325 -0
  117. package/dist/esm/key-management/qr-code.js.map +1 -0
  118. package/dist/esm/key-management/signature-request.contracts.d.ts +0 -4
  119. package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -1
  120. package/dist/esm/key-management/signature-request.contracts.js.map +1 -1
  121. package/dist/esm/key-management/signing-log-export.contracts.d.ts +0 -1
  122. package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -1
  123. package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -1
  124. package/dist/esm/key-management/vault-custody.contracts.d.ts +43 -0
  125. package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -1
  126. package/dist/esm/key-management/vault-custody.contracts.js +66 -0
  127. package/dist/esm/key-management/vault-custody.contracts.js.map +1 -1
  128. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
  129. package/dist/esm/lockfile/build-parallelism.js.map +1 -1
  130. package/dist/esm/lockfile/canonical-json.d.ts +1 -1
  131. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
  132. package/dist/esm/lockfile/canonical-json.js +1 -1
  133. package/dist/esm/lockfile/canonical-json.js.map +1 -1
  134. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
  135. package/dist/esm/lockfile/file-lock-hold.js +2 -1
  136. package/dist/esm/lockfile/file-lock-hold.js.map +1 -1
  137. package/dist/esm/lockfile/lockfile-io.d.ts +6 -8
  138. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  139. package/dist/esm/lockfile/lockfile-io.js +6 -8
  140. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  141. package/dist/esm/lockfile/materialize-infra-section.d.ts +5 -6
  142. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  143. package/dist/esm/lockfile/materialize-infra-section.js +4 -5
  144. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  145. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +1 -247
  146. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  147. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +1 -1
  148. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  149. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +146 -0
  150. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts.map +1 -0
  151. package/dist/esm/pnpm-settings/application-pnpm-settings.js +573 -0
  152. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -0
  153. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  154. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +15 -3
  155. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  156. package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -1
  157. package/dist/esm/project-config/application-served-public-documents.loader.js +16 -8
  158. package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -1
  159. package/dist/esm/project-config/backend-compliance-section.reader.d.ts +35 -0
  160. package/dist/esm/project-config/backend-compliance-section.reader.d.ts.map +1 -0
  161. package/dist/esm/project-config/backend-compliance-section.reader.js +123 -0
  162. package/dist/esm/project-config/backend-compliance-section.reader.js.map +1 -0
  163. package/dist/esm/project-config/backend-compliance-section.worker.d.ts +20 -0
  164. package/dist/esm/project-config/backend-compliance-section.worker.d.ts.map +1 -0
  165. package/dist/esm/project-config/backend-compliance-section.worker.js +78 -0
  166. package/dist/esm/project-config/backend-compliance-section.worker.js.map +1 -0
  167. package/dist/esm/project-config/config-module-resolution.d.ts +32 -0
  168. package/dist/esm/project-config/config-module-resolution.d.ts.map +1 -0
  169. package/dist/esm/project-config/config-module-resolution.js +33 -0
  170. package/dist/esm/project-config/config-module-resolution.js.map +1 -0
  171. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  172. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  173. package/dist/esm/project-config/define-infra-env-config.d.ts +109 -55
  174. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  175. package/dist/esm/project-config/define-infra-env-config.js +108 -70
  176. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  177. package/dist/esm/project-config/define-minion-config.d.ts +26 -36
  178. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  179. package/dist/esm/project-config/define-minion-config.js +64 -25
  180. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  181. package/dist/esm/project-config/define-saas-config.d.ts +41 -437
  182. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  183. package/dist/esm/project-config/define-saas-config.js +102 -94
  184. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  185. package/dist/esm/project-config/define-worker-config.d.ts +10 -20
  186. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  187. package/dist/esm/project-config/define-worker-config.js +10 -12
  188. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  189. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  190. package/dist/esm/project-config/hosted-infra-env-config.js +1 -1
  191. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  192. package/dist/esm/project-config/index.d.ts +2 -0
  193. package/dist/esm/project-config/index.d.ts.map +1 -1
  194. package/dist/esm/project-config/index.js +2 -0
  195. package/dist/esm/project-config/index.js.map +1 -1
  196. package/dist/esm/project-config/loader-instances-zod.d.ts +19 -0
  197. package/dist/esm/project-config/loader-instances-zod.d.ts.map +1 -0
  198. package/dist/esm/project-config/loader-instances-zod.js +40 -0
  199. package/dist/esm/project-config/loader-instances-zod.js.map +1 -0
  200. package/dist/esm/project-config/loader.d.ts +131 -14
  201. package/dist/esm/project-config/loader.d.ts.map +1 -1
  202. package/dist/esm/project-config/loader.js +226 -12
  203. package/dist/esm/project-config/loader.js.map +1 -1
  204. package/dist/esm/project-config/minion-liveness.contracts.d.ts +131 -0
  205. package/dist/esm/project-config/minion-liveness.contracts.d.ts.map +1 -0
  206. package/dist/esm/project-config/minion-liveness.contracts.js +167 -0
  207. package/dist/esm/project-config/minion-liveness.contracts.js.map +1 -0
  208. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
  209. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
  210. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  211. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  212. package/dist/esm/project-config/owning-package-tsconfig.d.ts +7 -7
  213. package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -1
  214. package/dist/esm/project-config/owning-package-tsconfig.js +7 -7
  215. package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -1
  216. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  217. package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
  218. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  219. package/dist/esm/project-config/provider-companion-discovery.js +3 -1
  220. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  221. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +71 -46
  222. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  223. package/dist/esm/project-config/provider-runtime-artifacts.js +150 -4
  224. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  225. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +0 -2
  226. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  227. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
  228. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  229. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  230. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  231. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  232. package/dist/esm/project-config/shared/auth.schemas.d.ts +0 -17
  233. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  234. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  235. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
  236. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  237. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +9 -10
  238. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  239. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -15
  240. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  241. package/dist/esm/project-config/shared/cdn.schemas.d.ts +0 -51
  242. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  243. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
  244. package/dist/esm/project-config/shared/csp-defaults.d.ts +34 -6
  245. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  246. package/dist/esm/project-config/shared/csp-defaults.js +52 -8
  247. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  248. package/dist/esm/project-config/shared/csp-emit.d.ts +60 -13
  249. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  250. package/dist/esm/project-config/shared/csp-emit.js +77 -24
  251. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  252. package/dist/esm/project-config/shared/csp.schemas.d.ts +72 -84
  253. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  254. package/dist/esm/project-config/shared/csp.schemas.js +40 -12
  255. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  256. package/dist/esm/project-config/shared/data-services.schemas.d.ts +0 -8
  257. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  258. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  259. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  260. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  261. package/dist/esm/project-config/shared/environment.schemas.d.ts +95 -8
  262. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  263. package/dist/esm/project-config/shared/environment.schemas.js +122 -10
  264. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  265. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +10 -4
  266. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  267. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  268. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  269. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
  270. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +1 -1
  271. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  272. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +1 -1
  273. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  274. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  275. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  276. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  277. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  278. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +20 -0
  279. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  280. package/dist/esm/project-config/shared/minion-resource-access.validation.js +21 -2
  281. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  282. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
  283. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
  284. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +62 -36
  285. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -1
  286. package/dist/esm/project-config/shared/platform-key-management.schemas.js +105 -3
  287. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -1
  288. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  289. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  290. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +2 -2
  291. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  292. package/dist/esm/project-config/shared/platform-storage.schemas.js +16 -2
  293. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  294. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +21 -23
  295. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  296. package/dist/esm/project-config/shared/service-definitions.schemas.js +4 -5
  297. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  298. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +0 -18
  299. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  300. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
  301. package/dist/esm/project-config/static-asset-import-noop.d.ts +20 -3
  302. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
  303. package/dist/esm/project-config/static-asset-import-noop.js +36 -20
  304. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
  305. package/dist/esm/registry/artifact-domain.schemas.d.ts +0 -5
  306. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  307. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
  308. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  309. package/dist/esm/registry/digest.schemas.js.map +1 -1
  310. package/dist/esm/registry/index.d.ts +2 -3
  311. package/dist/esm/registry/index.d.ts.map +1 -1
  312. package/dist/esm/registry/index.js +2 -3
  313. package/dist/esm/registry/index.js.map +1 -1
  314. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  315. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  316. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +1 -98
  317. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  318. package/dist/esm/registry/lockfile-modules-section.schemas.js +1 -2
  319. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  320. package/dist/esm/registry/module-artifact.schemas.d.ts +17 -17
  321. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  322. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  323. package/dist/esm/registry/module-manifest.schemas.d.ts +151 -219
  324. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  325. package/dist/esm/registry/module-manifest.schemas.js +145 -13
  326. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  327. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  328. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  329. package/dist/esm/registry/registry-config.schemas.d.ts +0 -18
  330. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  331. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  332. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
  333. package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
  334. package/dist/esm/registry/registry-errors.d.ts +81 -3
  335. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  336. package/dist/esm/registry/registry-errors.js +185 -4
  337. package/dist/esm/registry/registry-errors.js.map +1 -1
  338. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
  339. package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
  340. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  341. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
  342. package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -1
  343. package/dist/esm/registry/registry-url-resolution.js.map +1 -1
  344. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  345. package/dist/esm/release/framework-release.constants.js.map +1 -1
  346. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  347. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  348. package/dist/esm/schemas/framework-secrets.schemas.d.ts +0 -7
  349. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  350. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  351. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  352. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  353. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  354. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +1 -1
  355. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  356. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  357. package/dist/esm/schemas/platform-config.schemas.d.ts +2 -2
  358. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  359. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  360. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  361. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
  362. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  363. package/dist/esm/workspace-scope/index.js.map +1 -1
  364. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  365. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
  366. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  367. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  368. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  369. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  370. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  371. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  372. package/dist/tsconfig.build.tsbuildinfo +1 -1
  373. package/package.json +12 -12
  374. package/dist/esm/_unimplemented/index.d.ts +0 -3
  375. package/dist/esm/_unimplemented/index.d.ts.map +0 -1
  376. package/dist/esm/_unimplemented/index.js +0 -3
  377. package/dist/esm/_unimplemented/index.js.map +0 -1
  378. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +0 -137
  379. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +0 -1
  380. package/dist/esm/_unimplemented/unimplemented-field-warning.js +0 -153
  381. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +0 -1
  382. package/dist/esm/project-config/shared/cdn.example.d.ts +0 -14
  383. package/dist/esm/project-config/shared/cdn.example.d.ts.map +0 -1
  384. package/dist/esm/project-config/shared/cdn.example.js +0 -38
  385. package/dist/esm/project-config/shared/cdn.example.js.map +0 -1
  386. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +0 -15
  387. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +0 -1
  388. package/dist/esm/project-config/shared/schema-version.schemas.js +0 -40
  389. package/dist/esm/project-config/shared/schema-version.schemas.js.map +0 -1
@@ -4,6 +4,7 @@ import { type WildoInfraEnvConfig } from './define-infra-env-config';
4
4
  import type { WildoMinionConfig } from './define-minion-config';
5
5
  import type { WildoWorkerConfig } from './define-worker-config';
6
6
  import { type ConfigArtifactsLocationOptions } from '../workspace-scope/workspace-scope.schemas';
7
+ import { ConfigModuleResolution } from './config-module-resolution';
7
8
  export interface LoadConfigOptions {
8
9
  /**
9
10
  * Optional explicit owner zone for generated loader artifacts.
@@ -13,20 +14,14 @@ export interface LoadConfigOptions {
13
14
  */
14
15
  artifactLocation?: ConfigArtifactsLocationOptions;
15
16
  /**
16
- * Module-resolution strategy for jiti while evaluating the config file.
17
+ * Module-resolution strategy for jiti while evaluating the config file. See {@link ConfigModuleResolution} for what
18
+ * each member means.
17
19
  *
18
- * - `package`: resolve `@wildo-ai/*` through installed package exports in
19
- * `node_modules`. This is the correct mode for normal app developers who
20
- * do not have framework sources checked out.
21
- * - `framework-source`: resolve framework-owned packages to monorepo source
22
- * files when the Wildo framework workspace is available. Intended only for
23
- * internal framework development and source-first companion discovery.
24
- *
25
- * When omitted, the loader auto-detects the mode: configs inside a Wildo
26
- * framework workspace use `framework-source`; external app repos use
27
- * `package`.
20
+ * When omitted, the loader auto-detects the mode: configs inside a Wildo framework workspace use
21
+ * {@link ConfigModuleResolution.FRAMEWORK_SOURCE}; external app repos use {@link ConfigModuleResolution.PACKAGE}.
22
+ * {@link ConfigModuleResolution.LOADER_INSTANCES} is only ever chosen explicitly.
28
23
  */
29
- moduleResolution?: 'package' | 'framework-source';
24
+ moduleResolution?: ConfigModuleResolution;
30
25
  /**
31
26
  * Package-owned module aliases the loaded source needs in order to resolve
32
27
  * its own internal specifiers.
@@ -65,7 +60,83 @@ export interface LoadConfigOptions {
65
60
  * a fresh read from the package's authored source, not its `dist`.
66
61
  */
67
62
  freshModuleCache?: boolean;
63
+ /**
64
+ * Compile JSX in the loaded graph, with the automatic runtime from `importSource` (`react` for a website). Off by
65
+ * default: an application's specifications and configs contain no JSX. A website source module that builds JSX at
66
+ * import time (an icon map) needs it, or it fails with "React is not defined".
67
+ */
68
+ jsx?: {
69
+ readonly runtime: 'automatic';
70
+ readonly importSource: string;
71
+ };
72
+ /**
73
+ * Give each transpiled module the loaded graph reaches its OWN evaluation boundary (#3258), so a module whose body
74
+ * throws is handed to {@link ModuleEvaluationBoundary.absorb} instead of failing the module that imported it — and,
75
+ * through it, the whole graph. Off by default: every config and every other reader keeps the ordinary all-or-nothing
76
+ * evaluation. See {@link ModuleEvaluationBoundary}.
77
+ */
78
+ moduleEvaluationBoundary?: ModuleEvaluationBoundary;
79
+ }
80
+ /**
81
+ * What a module boundary hands its handler when a bounded module fails: the module's file, what it threw (for a
82
+ * source that could not be transpiled, a `SyntaxError` naming the file, line and column), and its `exports` object —
83
+ * holding whatever it assigned before the throw, for the handler to keep or reset — and every bounded module it imports,
84
+ * directly or not, so a handler can tell a failure of its own from what a failed import did to it.
85
+ */
86
+ export interface ModuleEvaluationFailure {
87
+ readonly filename: string;
88
+ readonly error: unknown;
89
+ readonly moduleExports: Record<string, unknown>;
90
+ readonly importedFilenames: readonly string[];
91
+ }
92
+ /**
93
+ * A per-module evaluation boundary for one load (#3258).
94
+ *
95
+ * ## Why
96
+ *
97
+ * jiti evaluates a TypeScript graph as one chain of `require`/`import` calls, so a throw in any module body propagates
98
+ * through every importer up to the entry and the load fails as a whole. For a reader whose input is MANY independent
99
+ * authored declarations aggregated by one entry (an application's specifications package: `companion-exports.ts`
100
+ * imports every module), that turns one broken file into "nothing can be read".
101
+ *
102
+ * ## How
103
+ *
104
+ * Every module jiti TRANSPILES whose file `appliesTo` accepts has its transpiled body wrapped in a `try`: a throw — or
105
+ * a transpile failure, which jiti otherwise reports after the module returns — is given to `absorb`. When `absorb`
106
+ * returns `true` the module completes normally with whatever its `exports` hold, and its importers carry on. When it
107
+ * returns anything else, the error propagates exactly as it would have without a boundary. What absorbing MEANS (what
108
+ * to record, whether the module's partial exports are kept) is entirely the handler's: the loader has no opinion.
109
+ *
110
+ * - **The entry is never bounded.** Its failure leaves nothing to return, so it fails the load as before.
111
+ * - **Only transpiled modules are reached.** A module jiti hands to Node natively (an ESM `.js` file in a
112
+ * `"type": "module"` package — a sibling package's compiled build) is not; its throw reaches the bounded module that
113
+ * imported it, which is where it is absorbed.
114
+ * - **The handler is per load.** It travels on the jiti options of this load (`require.options` inside a module), so
115
+ * two overlapping loads with different handlers never reach each other's, and the wrapped code holds no reference
116
+ * to any one load — which is what lets jiti's on-disk transpile cache keep it. Wrapped output is cached in a cache
117
+ * directory of its own, so an unbounded load never reads a wrapped module and a bounded load never reads an
118
+ * unwrapped one. Run without the handler (it is absent from the options), a wrapped module rethrows: identical to
119
+ * no boundary.
120
+ * - **Semantics inside the module are unchanged.** The body runs as the body of an inner function (async when jiti
121
+ * evaluates the module asynchronously), so its `"use strict"` directive and its hoisting are what they were, and the
122
+ * wrapper sits on the body's first line so stack frames keep their line numbers. One difference, without effect: the
123
+ * directive no longer heads jiti's own wrapper, so the `this` handed to the body is `globalThis` rather than
124
+ * `undefined` — but an ES module's transpiled body never reads its top-level `this` (Babel rewrites it to
125
+ * `undefined`).
126
+ */
127
+ export interface ModuleEvaluationBoundary {
128
+ /** Whether the module at this absolute path gets a boundary. */
129
+ readonly appliesTo: (absolutePath: string) => boolean;
130
+ /** Handle a bounded module's failure. `true` absorbs it; anything else lets it propagate. */
131
+ readonly absorb: (failure: ModuleEvaluationFailure) => boolean;
68
132
  }
133
+ /**
134
+ * Wrap one transpiled module body in its evaluation boundary (see {@link ModuleEvaluationBoundary}). Exported so the
135
+ * wrapper's shape can be pinned without a jiti instance.
136
+ */
137
+ export declare function wrapModuleInEvaluationBoundary(code: string, options: {
138
+ readonly async: boolean;
139
+ }): string;
69
140
  /**
70
141
  * Load and evaluate a TypeScript config file via jiti.
71
142
  * The file must `export default defineXxxConfig({...})`.
@@ -88,10 +159,19 @@ export declare function loadConfig<T>(filePath: string, options?: LoadConfigOpti
88
159
  * application authors. Returns `undefined` when the module does not export `exportName`.
89
160
  */
90
161
  export declare function loadConfigExport<T>(filePath: string, exportName: string, options?: LoadConfigOptions): Promise<T | undefined>;
162
+ /**
163
+ * Load EVERY export of an application-authored TypeScript module, through the same resolver `loadConfig`
164
+ * uses. For a reader that names the export it wants only after loading (a landed specification module).
165
+ *
166
+ * Exists so such a reader need not reach for `tsx`'s `tsImport`, which calls `module.register` on EVERY
167
+ * call: each call adds a loader-thread hook chain to the process for good, after which every module
168
+ * resolution in it is a synchronous round trip to that thread (#3208).
169
+ */
170
+ export declare function loadConfigModuleExports(filePath: string, options?: LoadConfigOptions): Promise<Record<string, unknown>>;
91
171
  /**
92
172
  * Which file a package's companion subpath resolves to.
93
173
  *
94
- * Authored source wins when either option asks for it: `moduleResolution: 'framework-source'` (a package inside the
174
+ * Authored source wins when either option asks for it: {@link ConfigModuleResolution.FRAMEWORK_SOURCE} (a package inside the
95
175
  * framework workspace), or `preferAuthoredSource` (a reader whose contract is the working tree, wherever the package
96
176
  * lives — see {@link loadPackageCompanionExport}). Otherwise the declared `exports` entry wins, and authored source
97
177
  * is only the fallback when nothing is built.
@@ -115,6 +195,40 @@ export declare function resolvePackageCompanionEntryPath(packageRoot: string, su
115
195
  */
116
196
  export declare function normalizeCompilerPathAliasesForLoader(packageRoot: string, compilerPathAliases: Readonly<Record<string, readonly string[]>>): Record<string, string>;
117
197
  export declare function loadPackageCompanionExport<T>(packageRoot: string, subpath?: string, options?: LoadConfigOptions): Promise<T>;
198
+ /**
199
+ * The aliases of {@link ConfigModuleResolution.LOADER_INSTANCES} (#3440): this package, and every `@wildo-ai/*` package it
200
+ * depends on, mapped subpath by subpath to the built file its `import` condition names, in the copy THIS package
201
+ * resolves. Those files are plain ES modules, which jiti hands to Node's own `import` rather than transpiling, so a
202
+ * process that already runs this package (the CLI does) gets back the modules it holds: evaluating a configuration
203
+ * costs only the configuration's own modules.
204
+ *
205
+ * ## Why it exists
206
+ *
207
+ * In a framework checkout `framework-source` evaluates every framework package a configuration imports from SOURCE,
208
+ * through jiti, beside the built copy the calling process already runs. Measured on Wonder Todos (2026-11-06):
209
+ * `wildo.saas.config.ts` imports enums from `@wildo-ai/saas-models` and `@wildo-ai/external-connectors-models`, and
210
+ * that evaluation transpiled 533 `saas-models` modules and kept 351 MB of heap, 1.9 s, to answer which services the
211
+ * application declares. With these aliases the same read keeps 7 MB, 0.1 s. One copy of each framework package per
212
+ * thread is also what keeps a caller's own `instanceof` and zod schemas meeting the configuration's (#2598).
213
+ *
214
+ * ## What it does not cover
215
+ *
216
+ * - A framework package this package does not depend on (`@wildo-ai/saas-backend-lib`, imported by a backend
217
+ * configuration) resolves from the configuration's own location, as in `package` mode: its installed build.
218
+ * - A package with ANY declared built file absent (an unbuilt checkout, or a watcher mid-emit that has written the root
219
+ * but not a new subpath yet) gets no alias at all, so the whole package resolves as in `package` mode. Aliasing only
220
+ * the files that exist would be worse than none: jiti matches an alias key as a prefix at a `/`, so a missing
221
+ * subpath would be rewritten onto the root's FILE (`…/index.js/<subpath>`) and fail as a module that does not exist.
222
+ * - A process running this package from SOURCE (a test runner) holds the source modules, not the build these aliases
223
+ * name, so there the configuration gets one more copy: correct, just not shared.
224
+ *
225
+ * Rejected: making this the default for one-shot readers. A reader that relies on `framework-source` to see a framework
226
+ * edit before its watcher has rebuilt (the dev companion's source-first discovery) would silently read the build.
227
+ * Choosing it is the caller's statement that the build its own process runs is the framework it means.
228
+ *
229
+ * Exported so the aliases can be pinned against a fixture package; nothing else should call it.
230
+ */
231
+ export declare function buildLoaderInstanceAliases(loaderPackageRoot: string): Record<string, string>;
118
232
  /**
119
233
  * Load a `wildo.saas.config.ts` file.
120
234
  * Returns `null` if the file doesn't exist (non-throwing variant for optional loading).
@@ -138,8 +252,11 @@ export declare function resolveInfraEnvConfigPath(saasRoot: string, envName: str
138
252
  * does not need it; a long-lived reader whose question is "what does the file say NOW" does — the dev companion
139
253
  * reads the application's declared store through here, and a cached evaluation would keep answering with the
140
254
  * store the file declared when the process first read it (see {@link LoadConfigOptions.freshModuleCache}).
255
+ *
256
+ * `moduleResolution` decides how the file's own imports are evaluated (see {@link LoadConfigOptions.moduleResolution}),
257
+ * for the application's descriptor and, when it is hosted, for its host's alike. Omitted, the loader infers it.
141
258
  */
142
- export declare function loadInfraEnvConfig(saasRoot: string, envName: string, options?: Pick<LoadConfigOptions, 'freshModuleCache'>): Promise<{
259
+ export declare function loadInfraEnvConfig(saasRoot: string, envName: string, options?: Pick<LoadConfigOptions, 'freshModuleCache' | 'moduleResolution'>): Promise<{
143
260
  path: string;
144
261
  config: WildoInfraEnvConfig;
145
262
  } | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/project-config/loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CA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AAM,EACf,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,kBAAkB,CAAC,GACzE,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GAAG,IAAI,CAAC,CAwD/D;AAwCD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC;CACX;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,EAC3B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAQpD;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,EAC3B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAQpD;AA6BD;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,GACpD,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAYtC"}
@@ -1,7 +1,8 @@
1
1
  import { createHash } from 'crypto';
2
2
  import { existsSync, mkdirSync, readFileSync } from 'fs';
3
3
  import { dirname, join, relative, resolve } from 'path';
4
- import { fileURLToPath } from 'url';
4
+ import { findPackageJSON } from 'module';
5
+ import { fileURLToPath, pathToFileURL } from 'url';
5
6
  import { createJiti } from 'jiti';
6
7
  import { resolveAppLayout, resolveFrameworkLayout } from '../workspace-scope/workspace-homes.schemas.js';
7
8
  import { isHostedInfraEnvConfig, WildoHostedInfraEnvConfigSchema, } from './define-infra-env-config.js';
@@ -9,6 +10,104 @@ import { realpathSync } from 'fs';
9
10
  import { resolveHostedInfraEnvConfig } from './hosted-infra-env-config.js';
10
11
  import { AUTHORED_CONFIG_FILE_NAMES } from '../workspace-scope/workspace-scope.schemas.js';
11
12
  import { ConfigArtifactsZone, FRAMEWORK_WORKSPACE_MARKER_FILE, resolveConfigArtifactsBaseDir, } from '../workspace-scope/workspace-scope.schemas.js';
13
+ import { ConfigModuleResolution } from './config-module-resolution.js';
14
+ /**
15
+ * The jiti option key the boundary's handler travels under. jiti keeps unknown option keys on the options object it
16
+ * shares with every child instance of one load, which a transpiled module reaches as `require.options`.
17
+ */
18
+ const MODULE_EVALUATION_BOUNDARY_OPTION = 'wildoModuleEvaluationBoundary';
19
+ /** The marker jiti's default transform leaves in place of a module it could not transpile (read by jiti after the module returns). */
20
+ const JITI_TRANSFORM_ERROR_EXPORT = '__JITI_ERROR__';
21
+ /**
22
+ * The wrapper's version, part of a bounded load's transpile-cache directory. jiti's cache entry is valid while the
23
+ * module's SOURCE is unchanged and knows nothing of the wrapper, so a change to {@link wrapModuleInEvaluationBoundary}
24
+ * must bump this, or modules wrapped the old way keep being served from the cache.
25
+ */
26
+ const MODULE_EVALUATION_BOUNDARY_WRAPPER_VERSION = 2;
27
+ /** The jiti option key the import observer travels under, the way {@link MODULE_EVALUATION_BOUNDARY_OPTION} does. */
28
+ const MODULE_IMPORT_OBSERVER_OPTION = 'wildoModuleImportObserver';
29
+ /**
30
+ * One load's import graph over its bounded modules. Recorded at the import, because jiti's module tree cannot answer:
31
+ * a module already evaluated in this load is served from its cache and never becomes a child of a second importer.
32
+ */
33
+ function createModuleImportGraph() {
34
+ const imports = new Map();
35
+ return {
36
+ observe: (filename, specifier, resolver) => {
37
+ if (typeof specifier !== 'string')
38
+ return;
39
+ try {
40
+ const known = imports.get(filename) ?? new Set();
41
+ known.add(resolver.resolve(specifier));
42
+ imports.set(filename, known);
43
+ }
44
+ catch {
45
+ // A specifier that cannot be resolved is the import's own failure, which the import itself is about to raise.
46
+ }
47
+ },
48
+ importedBy: (filename) => {
49
+ const seen = new Set([filename]);
50
+ const pending = [...(imports.get(filename) ?? [])];
51
+ for (let next = pending.pop(); next !== undefined; next = pending.pop()) {
52
+ if (seen.has(next))
53
+ continue;
54
+ seen.add(next);
55
+ pending.push(...(imports.get(next) ?? []));
56
+ }
57
+ seen.delete(filename);
58
+ return [...seen];
59
+ },
60
+ };
61
+ }
62
+ /**
63
+ * Wrap one transpiled module body in its evaluation boundary (see {@link ModuleEvaluationBoundary}). Exported so the
64
+ * wrapper's shape can be pinned without a jiti instance.
65
+ */
66
+ export function wrapModuleInEvaluationBoundary(code, options) {
67
+ // An inline source map must stay the LAST line to be honoured, so it moves after the wrapper.
68
+ const sourceMapMatch = /\n(\/\/# sourceMappingURL=[^\n]*)\s*$/u.exec(code);
69
+ const body = sourceMapMatch === null ? code : code.slice(0, sourceMapMatch.index);
70
+ const handler = `(require.options&&require.options[${JSON.stringify(MODULE_EVALUATION_BOUNDARY_OPTION)}])`;
71
+ const absorbed = (error) => `(typeof ${handler}==="function"&&${handler}({error:${error},filename:__filename,moduleExports:exports})===true)`;
72
+ const observer = `(require.options&&require.options[${JSON.stringify(MODULE_IMPORT_OBSERVER_OPTION)}])`;
73
+ // The body's own `require` and `jitiImport` are these: same functions, and each import is reported on the way through.
74
+ const observed = (load) => `(typeof ${observer}==="function"?new Proxy(${load},{apply:(target,self,args)=>{${observer}(__filename,args[0],require);return Reflect.apply(target,self,args);}}):${load})`;
75
+ const invoke = options.async ? 'await (async function(jitiImport,require){' : '(function(jitiImport,require){';
76
+ /*
77
+ * A module jiti could not transpile is not a throw: its body is one assignment of the error to `exports`, which jiti
78
+ * turns into a throw after the module returns. The boundary turns it into a SyntaxError here, so the handler sees it
79
+ * as the failure of THIS module rather than of its importer, and removes the marker when the handler absorbs it.
80
+ */
81
+ const transformFailure = body.includes(JITI_TRANSFORM_ERROR_EXPORT)
82
+ ? `\nif(exports.${JITI_TRANSFORM_ERROR_EXPORT}){const __wildoTransform=exports.${JITI_TRANSFORM_ERROR_EXPORT};`
83
+ + 'const __wildoTransformError=new SyntaxError(`${__wildoTransform.code}: ${__wildoTransform.message} (${__wildoTransform.filename}:${__wildoTransform.line}:${__wildoTransform.column})`);'
84
+ + `if(${absorbed('__wildoTransformError')})delete exports.${JITI_TRANSFORM_ERROR_EXPORT};}`
85
+ : '';
86
+ return `try{${invoke}${body}\n}).call(this,${observed('jitiImport')},${observed('require')});}catch(__wildoModuleError){if(!${absorbed('__wildoModuleError')})throw __wildoModuleError;}`
87
+ + transformFailure
88
+ + (sourceMapMatch === null ? '' : `\n${sourceMapMatch[1]}`);
89
+ }
90
+ /**
91
+ * jiti options that put every transpiled module `boundary` applies to (except the entry) behind its evaluation
92
+ * boundary. The default transform comes from a second jiti instance with the same options and no on-disk cache: the
93
+ * wrapping instance's own cache already stores the wrapped output, so caching the unwrapped one too would only double
94
+ * the transpile cache for no read.
95
+ */
96
+ function buildModuleEvaluationBoundaryJitiOptions(boundary, entryPath, baseOptions) {
97
+ const defaultTransformer = createJiti(import.meta.url, { ...baseOptions, fsCache: false });
98
+ const imports = createModuleImportGraph();
99
+ return {
100
+ [MODULE_EVALUATION_BOUNDARY_OPTION]: (failure) => boundary.absorb({ ...failure, importedFilenames: imports.importedBy(failure.filename) }),
101
+ [MODULE_IMPORT_OBSERVER_OPTION]: imports.observe,
102
+ transform: (transformOptions) => {
103
+ const code = defaultTransformer.transform(transformOptions);
104
+ const filename = transformOptions.filename;
105
+ if (filename === undefined || resolve(filename) === entryPath || !boundary.appliesTo(resolve(filename)))
106
+ return { code };
107
+ return { code: wrapModuleInEvaluationBoundary(code, { async: transformOptions.async === true }) };
108
+ },
109
+ };
110
+ }
12
111
  const PACKAGE_COMPANION_SUBPATH = './companion';
13
112
  /**
14
113
  * Load and evaluate a TypeScript config file via jiti.
@@ -41,6 +140,18 @@ export async function loadConfigExport(filePath, exportName, options) {
41
140
  const { module } = await importConfigModule(filePath, options);
42
141
  return module[exportName];
43
142
  }
143
+ /**
144
+ * Load EVERY export of an application-authored TypeScript module, through the same resolver `loadConfig`
145
+ * uses. For a reader that names the export it wants only after loading (a landed specification module).
146
+ *
147
+ * Exists so such a reader need not reach for `tsx`'s `tsImport`, which calls `module.register` on EVERY
148
+ * call: each call adds a loader-thread hook chain to the process for good, after which every module
149
+ * resolution in it is a synchronous round trip to that thread (#3208).
150
+ */
151
+ export async function loadConfigModuleExports(filePath, options) {
152
+ const { module } = await importConfigModule(filePath, options);
153
+ return module;
154
+ }
44
155
  async function importConfigModule(filePath, options) {
45
156
  const absolutePath = resolve(filePath);
46
157
  if (!existsSync(absolutePath)) {
@@ -49,20 +160,28 @@ async function importConfigModule(filePath, options) {
49
160
  const cacheBaseDir = options?.artifactLocation
50
161
  ? resolveConfigArtifactsBaseDir(options.artifactLocation)
51
162
  : resolveConfigArtifactsBaseDir(absolutePath);
52
- const cacheDir = join(cacheBaseDir, createHash('sha1').update(absolutePath).digest('hex'));
163
+ // A bounded load caches WRAPPED modules, so it keeps them apart from an unbounded load of the same entry.
164
+ const cacheDir = join(cacheBaseDir, createHash('sha1').update(absolutePath).digest('hex')
165
+ + (options?.moduleEvaluationBoundary === undefined ? '' : `-bounded-v${MODULE_EVALUATION_BOUNDARY_WRAPPER_VERSION}`));
53
166
  mkdirSync(cacheDir, { recursive: true });
54
167
  const currentModuleDirectory = dirname(fileURLToPath(import.meta.url));
55
168
  const platformConfigLibEntry = resolvePlatformConfigLibEntry(currentModuleDirectory);
56
169
  const moduleResolution = options?.moduleResolution
57
170
  ?? inferConfigModuleResolution(absolutePath, currentModuleDirectory);
58
- const frameworkWorkspaceRoot = moduleResolution === 'framework-source'
171
+ const frameworkWorkspaceRoot = moduleResolution === ConfigModuleResolution.FRAMEWORK_SOURCE
59
172
  ? resolveLoaderWorkspaceRoot(currentModuleDirectory)
60
173
  : tryResolveLoaderWorkspaceRoot(currentModuleDirectory);
61
- const jiti = createJiti(import.meta.url, {
174
+ const jitiOptions = {
62
175
  fsCache: cacheDir,
63
176
  // `moduleCache: false` forces re-evaluation of the whole loaded graph — see
64
177
  // `LoadConfigOptions.freshModuleCache` for why a fresh createJiti alone is not enough.
65
- ...(options?.freshModuleCache === true ? { moduleCache: false } : {}),
178
+ /*
179
+ * A bounded load never shares jiti's module cache either, whatever `freshModuleCache` says: a module whose failure
180
+ * the handler absorbed would otherwise sit in the process-global CommonJS registry with whatever the handler left in
181
+ * its exports, and a later unbounded load would be served that instead of the throw it expects.
182
+ */
183
+ ...(options?.freshModuleCache === true || options?.moduleEvaluationBoundary !== undefined ? { moduleCache: false } : {}),
184
+ ...(options?.jsx !== undefined ? { jsx: { runtime: options.jsx.runtime, importSource: options.jsx.importSource } } : {}),
66
185
  alias: {
67
186
  // Package-owned aliases first so framework-owned entries always win a
68
187
  // collision: a package may extend its own resolution, never redirect a
@@ -74,13 +193,16 @@ async function importConfigModule(filePath, options) {
74
193
  platformConfigLibEntry,
75
194
  }),
76
195
  },
77
- });
196
+ };
197
+ const jiti = createJiti(import.meta.url, options?.moduleEvaluationBoundary === undefined
198
+ ? jitiOptions
199
+ : { ...jitiOptions, ...buildModuleEvaluationBoundaryJitiOptions(options.moduleEvaluationBoundary, absolutePath, jitiOptions) });
78
200
  return { absolutePath, module: await jiti.import(absolutePath) };
79
201
  }
80
202
  /**
81
203
  * Which file a package's companion subpath resolves to.
82
204
  *
83
- * Authored source wins when either option asks for it: `moduleResolution: 'framework-source'` (a package inside the
205
+ * Authored source wins when either option asks for it: {@link ConfigModuleResolution.FRAMEWORK_SOURCE} (a package inside the
84
206
  * framework workspace), or `preferAuthoredSource` (a reader whose contract is the working tree, wherever the package
85
207
  * lives — see {@link loadPackageCompanionExport}). Otherwise the declared `exports` entry wins, and authored source
86
208
  * is only the fallback when nothing is built.
@@ -107,7 +229,7 @@ export function resolvePackageCompanionEntryPath(packageRoot, subpath = PACKAGE_
107
229
  ]
108
230
  : [];
109
231
  const preferredSourceCandidate = sourceCandidates.find((candidate) => existsSync(candidate));
110
- if ((options?.moduleResolution === 'framework-source' || options?.preferAuthoredSource === true) && preferredSourceCandidate) {
232
+ if ((options?.moduleResolution === ConfigModuleResolution.FRAMEWORK_SOURCE || options?.preferAuthoredSource === true) && preferredSourceCandidate) {
111
233
  return preferredSourceCandidate;
112
234
  }
113
235
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
@@ -298,8 +420,11 @@ function resolveLoaderWorkspaceRoot(startDirectory) {
298
420
  }
299
421
  function buildLoaderAliases(input) {
300
422
  const platformConfigLibPackageRoot = resolveCurrentPackageRoot(dirname(input.platformConfigLibEntry));
423
+ if (input.moduleResolution === ConfigModuleResolution.LOADER_INSTANCES) {
424
+ return buildLoaderInstanceAliases(platformConfigLibPackageRoot);
425
+ }
301
426
  const aliases = buildDeclaredPackageSourceAliases(platformConfigLibPackageRoot, '.', input.platformConfigLibEntry);
302
- if (input.moduleResolution !== 'framework-source' || !input.frameworkWorkspaceRoot) {
427
+ if (input.moduleResolution !== ConfigModuleResolution.FRAMEWORK_SOURCE || !input.frameworkWorkspaceRoot) {
303
428
  return aliases;
304
429
  }
305
430
  const workspaceRoot = input.frameworkWorkspaceRoot;
@@ -377,17 +502,102 @@ function buildDeclaredPackageSourceAliases(workspaceRoot, packageRelativeRoot, r
377
502
  entries.sort(([left], [right]) => right.length - left.length || left.localeCompare(right));
378
503
  return Object.fromEntries(entries);
379
504
  }
505
+ /**
506
+ * The aliases of {@link ConfigModuleResolution.LOADER_INSTANCES} (#3440): this package, and every `@wildo-ai/*` package it
507
+ * depends on, mapped subpath by subpath to the built file its `import` condition names, in the copy THIS package
508
+ * resolves. Those files are plain ES modules, which jiti hands to Node's own `import` rather than transpiling, so a
509
+ * process that already runs this package (the CLI does) gets back the modules it holds: evaluating a configuration
510
+ * costs only the configuration's own modules.
511
+ *
512
+ * ## Why it exists
513
+ *
514
+ * In a framework checkout `framework-source` evaluates every framework package a configuration imports from SOURCE,
515
+ * through jiti, beside the built copy the calling process already runs. Measured on Wonder Todos (2026-11-06):
516
+ * `wildo.saas.config.ts` imports enums from `@wildo-ai/saas-models` and `@wildo-ai/external-connectors-models`, and
517
+ * that evaluation transpiled 533 `saas-models` modules and kept 351 MB of heap, 1.9 s, to answer which services the
518
+ * application declares. With these aliases the same read keeps 7 MB, 0.1 s. One copy of each framework package per
519
+ * thread is also what keeps a caller's own `instanceof` and zod schemas meeting the configuration's (#2598).
520
+ *
521
+ * ## What it does not cover
522
+ *
523
+ * - A framework package this package does not depend on (`@wildo-ai/saas-backend-lib`, imported by a backend
524
+ * configuration) resolves from the configuration's own location, as in `package` mode: its installed build.
525
+ * - A package with ANY declared built file absent (an unbuilt checkout, or a watcher mid-emit that has written the root
526
+ * but not a new subpath yet) gets no alias at all, so the whole package resolves as in `package` mode. Aliasing only
527
+ * the files that exist would be worse than none: jiti matches an alias key as a prefix at a `/`, so a missing
528
+ * subpath would be rewritten onto the root's FILE (`…/index.js/<subpath>`) and fail as a module that does not exist.
529
+ * - A process running this package from SOURCE (a test runner) holds the source modules, not the build these aliases
530
+ * name, so there the configuration gets one more copy: correct, just not shared.
531
+ *
532
+ * Rejected: making this the default for one-shot readers. A reader that relies on `framework-source` to see a framework
533
+ * edit before its watcher has rebuilt (the dev companion's source-first discovery) would silently read the build.
534
+ * Choosing it is the caller's statement that the build its own process runs is the framework it means.
535
+ *
536
+ * Exported so the aliases can be pinned against a fixture package; nothing else should call it.
537
+ */
538
+ export function buildLoaderInstanceAliases(loaderPackageRoot) {
539
+ const loaderPackageJsonPath = join(loaderPackageRoot, 'package.json');
540
+ const loaderPackageJson = JSON.parse(readFileSync(loaderPackageJsonPath, 'utf8'));
541
+ const packageRoots = new Map();
542
+ if (loaderPackageJson.name)
543
+ packageRoots.set(loaderPackageJson.name, loaderPackageRoot);
544
+ for (const dependency of Object.keys({ ...loaderPackageJson.peerDependencies, ...loaderPackageJson.dependencies })) {
545
+ if (!dependency.startsWith(FRAMEWORK_PACKAGE_SCOPE) || packageRoots.has(dependency))
546
+ continue;
547
+ let dependencyPackageJsonPath;
548
+ try {
549
+ // ESM resolution from this package, as its own `import` statements resolve the dependency.
550
+ dependencyPackageJsonPath = findPackageJSON(dependency, pathToFileURL(loaderPackageJsonPath));
551
+ }
552
+ catch {
553
+ dependencyPackageJsonPath = undefined;
554
+ }
555
+ if (dependencyPackageJsonPath !== undefined)
556
+ packageRoots.set(dependency, dirname(dependencyPackageJsonPath));
557
+ }
558
+ const entries = [];
559
+ for (const [packageName, packageRoot] of packageRoots) {
560
+ const packageJson = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
561
+ const packageEntries = [];
562
+ let everyBuiltFileExists = true;
563
+ for (const [exportKey, exportValue] of Object.entries(packageJson.exports ?? {})) {
564
+ const builtFile = typeof exportValue === 'string'
565
+ ? exportValue
566
+ : typeof exportValue?.import === 'string'
567
+ ? exportValue.import
568
+ : typeof exportValue?.default === 'string' ? exportValue.default : undefined;
569
+ if (builtFile === undefined || !builtFile.startsWith('./'))
570
+ continue;
571
+ const builtPath = resolve(packageRoot, builtFile);
572
+ if (!isPathInsideRoot(builtPath, packageRoot)) {
573
+ throw new Error(`Framework package export "${exportKey}" of "${packageName}" escapes "${packageRoot}".`);
574
+ }
575
+ if (!existsSync(builtPath)) {
576
+ everyBuiltFileExists = false;
577
+ break;
578
+ }
579
+ packageEntries.push([exportKey === '.' ? packageName : `${packageName}/${exportKey.slice(2)}`, builtPath]);
580
+ }
581
+ if (everyBuiltFileExists)
582
+ entries.push(...packageEntries);
583
+ }
584
+ // jiti matches alias keys as prefixes, so a subpath must be tried before its package root.
585
+ entries.sort(([left], [right]) => right.length - left.length || left.localeCompare(right));
586
+ return Object.fromEntries(entries);
587
+ }
588
+ /** The scope every framework package is published under. */
589
+ const FRAMEWORK_PACKAGE_SCOPE = '@wildo-ai/';
380
590
  function inferPackageCompanionModuleResolution(packageRoot) {
381
591
  return inferConfigModuleResolution(packageRoot, dirname(fileURLToPath(import.meta.url)));
382
592
  }
383
593
  function inferConfigModuleResolution(targetPath, loaderModuleDirectory) {
384
594
  const frameworkWorkspaceRoot = tryResolveLoaderWorkspaceRoot(loaderModuleDirectory);
385
595
  if (!frameworkWorkspaceRoot) {
386
- return 'package';
596
+ return ConfigModuleResolution.PACKAGE;
387
597
  }
388
598
  return isPathInsideRoot(targetPath, frameworkWorkspaceRoot)
389
- ? 'framework-source'
390
- : 'package';
599
+ ? ConfigModuleResolution.FRAMEWORK_SOURCE
600
+ : ConfigModuleResolution.PACKAGE;
391
601
  }
392
602
  function isPathInsideRoot(pathToCheck, root) {
393
603
  const relativePath = relative(resolve(root), resolve(pathToCheck));
@@ -427,6 +637,9 @@ export function resolveInfraEnvConfigPath(saasRoot, envName) {
427
637
  * does not need it; a long-lived reader whose question is "what does the file say NOW" does — the dev companion
428
638
  * reads the application's declared store through here, and a cached evaluation would keep answering with the
429
639
  * store the file declared when the process first read it (see {@link LoadConfigOptions.freshModuleCache}).
640
+ *
641
+ * `moduleResolution` decides how the file's own imports are evaluated (see {@link LoadConfigOptions.moduleResolution}),
642
+ * for the application's descriptor and, when it is hosted, for its host's alike. Omitted, the loader infers it.
430
643
  */
431
644
  export async function loadInfraEnvConfig(saasRoot, envName, options) {
432
645
  const authored = await loadAuthoredInfraEnvConfigFile(saasRoot, envName, options);
@@ -510,6 +723,7 @@ async function loadAuthoredInfraEnvConfigFile(saasRoot, envName, options) {
510
723
  const config = await loadConfig(resolve(path), {
511
724
  artifactLocation: { zone: ConfigArtifactsZone.SAAS, ownerRoot: saasRoot },
512
725
  ...(options?.freshModuleCache === true ? { freshModuleCache: true } : {}),
726
+ ...(options?.moduleResolution === undefined ? {} : { moduleResolution: options.moduleResolution }),
513
727
  });
514
728
  if (config.environment !== envName) {
515
729
  throw new Error(`Authored env descriptor mismatch: directory '${envName}' does not match authored environment '${config.environment}'.`);