@endora-commerce/cli 0.100.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 (356) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/bin/endora.d.ts +28 -0
  4. package/dist/bin/endora.d.ts.map +1 -0
  5. package/dist/bin/endora.js +926 -0
  6. package/dist/bin/endora.js.map +1 -0
  7. package/dist/check/estate.d.ts +189 -0
  8. package/dist/check/estate.d.ts.map +1 -0
  9. package/dist/check/estate.js +1037 -0
  10. package/dist/check/estate.js.map +1 -0
  11. package/dist/check/hosts.d.ts +25 -0
  12. package/dist/check/hosts.d.ts.map +1 -0
  13. package/dist/check/hosts.js +1347 -0
  14. package/dist/check/hosts.js.map +1 -0
  15. package/dist/check/index.d.ts +60 -0
  16. package/dist/check/index.d.ts.map +1 -0
  17. package/dist/check/index.js +111 -0
  18. package/dist/check/index.js.map +1 -0
  19. package/dist/check/layout.d.ts +136 -0
  20. package/dist/check/layout.d.ts.map +1 -0
  21. package/dist/check/layout.js +262 -0
  22. package/dist/check/layout.js.map +1 -0
  23. package/dist/check/ledger.d.ts +98 -0
  24. package/dist/check/ledger.d.ts.map +1 -0
  25. package/dist/check/ledger.js +173 -0
  26. package/dist/check/ledger.js.map +1 -0
  27. package/dist/check/peer-owners.d.ts +116 -0
  28. package/dist/check/peer-owners.d.ts.map +1 -0
  29. package/dist/check/peer-owners.js +225 -0
  30. package/dist/check/peer-owners.js.map +1 -0
  31. package/dist/check/report.d.ts +33 -0
  32. package/dist/check/report.d.ts.map +1 -0
  33. package/dist/check/report.js +107 -0
  34. package/dist/check/report.js.map +1 -0
  35. package/dist/check/run.d.ts +147 -0
  36. package/dist/check/run.d.ts.map +1 -0
  37. package/dist/check/run.js +111 -0
  38. package/dist/check/run.js.map +1 -0
  39. package/dist/checks.d.ts +17 -0
  40. package/dist/checks.d.ts.map +1 -0
  41. package/dist/checks.js +17 -0
  42. package/dist/checks.js.map +1 -0
  43. package/dist/dev/index.d.ts +83 -0
  44. package/dist/dev/index.d.ts.map +1 -0
  45. package/dist/dev/index.js +298 -0
  46. package/dist/dev/index.js.map +1 -0
  47. package/dist/generate/divergence.d.ts +38 -0
  48. package/dist/generate/divergence.d.ts.map +1 -0
  49. package/dist/generate/divergence.js +237 -0
  50. package/dist/generate/divergence.js.map +1 -0
  51. package/dist/generate/index.d.ts +90 -0
  52. package/dist/generate/index.d.ts.map +1 -0
  53. package/dist/generate/index.js +369 -0
  54. package/dist/generate/index.js.map +1 -0
  55. package/dist/index.d.ts +23 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +35 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/inputs/declaration.d.ts +18 -0
  60. package/dist/inputs/declaration.d.ts.map +1 -0
  61. package/dist/inputs/declaration.js +64 -0
  62. package/dist/inputs/declaration.js.map +1 -0
  63. package/dist/inputs/env-file.d.ts +73 -0
  64. package/dist/inputs/env-file.d.ts.map +1 -0
  65. package/dist/inputs/env-file.js +134 -0
  66. package/dist/inputs/env-file.js.map +1 -0
  67. package/dist/inputs/prompt.d.ts +21 -0
  68. package/dist/inputs/prompt.d.ts.map +1 -0
  69. package/dist/inputs/prompt.js +59 -0
  70. package/dist/inputs/prompt.js.map +1 -0
  71. package/dist/inputs/resolve.d.ts +163 -0
  72. package/dist/inputs/resolve.d.ts.map +1 -0
  73. package/dist/inputs/resolve.js +290 -0
  74. package/dist/inputs/resolve.js.map +1 -0
  75. package/dist/install/host.d.ts +27 -0
  76. package/dist/install/host.d.ts.map +1 -0
  77. package/dist/install/host.js +90 -0
  78. package/dist/install/host.js.map +1 -0
  79. package/dist/install/index.d.ts +173 -0
  80. package/dist/install/index.d.ts.map +1 -0
  81. package/dist/install/index.js +793 -0
  82. package/dist/install/index.js.map +1 -0
  83. package/dist/install/wizard.d.ts +144 -0
  84. package/dist/install/wizard.d.ts.map +1 -0
  85. package/dist/install/wizard.js +362 -0
  86. package/dist/install/wizard.js.map +1 -0
  87. package/dist/lib/admin-artefacts.d.ts +70 -0
  88. package/dist/lib/admin-artefacts.d.ts.map +1 -0
  89. package/dist/lib/admin-artefacts.js +354 -0
  90. package/dist/lib/admin-artefacts.js.map +1 -0
  91. package/dist/lib/admin-surfaces.d.ts +298 -0
  92. package/dist/lib/admin-surfaces.d.ts.map +1 -0
  93. package/dist/lib/admin-surfaces.js +669 -0
  94. package/dist/lib/admin-surfaces.js.map +1 -0
  95. package/dist/lib/delegated-composer.d.ts +85 -0
  96. package/dist/lib/delegated-composer.d.ts.map +1 -0
  97. package/dist/lib/delegated-composer.js +241 -0
  98. package/dist/lib/delegated-composer.js.map +1 -0
  99. package/dist/lib/divergence-artefacts.d.ts +305 -0
  100. package/dist/lib/divergence-artefacts.d.ts.map +1 -0
  101. package/dist/lib/divergence-artefacts.js +828 -0
  102. package/dist/lib/divergence-artefacts.js.map +1 -0
  103. package/dist/lib/divergence.d.ts +337 -0
  104. package/dist/lib/divergence.d.ts.map +1 -0
  105. package/dist/lib/divergence.js +1005 -0
  106. package/dist/lib/divergence.js.map +1 -0
  107. package/dist/lib/docs-artefacts.d.ts +395 -0
  108. package/dist/lib/docs-artefacts.d.ts.map +1 -0
  109. package/dist/lib/docs-artefacts.js +781 -0
  110. package/dist/lib/docs-artefacts.js.map +1 -0
  111. package/dist/lib/emitted-exports.d.ts +21 -0
  112. package/dist/lib/emitted-exports.d.ts.map +1 -0
  113. package/dist/lib/emitted-exports.js +96 -0
  114. package/dist/lib/emitted-exports.js.map +1 -0
  115. package/dist/lib/emitted-freshness.d.ts +112 -0
  116. package/dist/lib/emitted-freshness.d.ts.map +1 -0
  117. package/dist/lib/emitted-freshness.js +288 -0
  118. package/dist/lib/emitted-freshness.js.map +1 -0
  119. package/dist/lib/entity-index-artefact.d.ts +95 -0
  120. package/dist/lib/entity-index-artefact.d.ts.map +1 -0
  121. package/dist/lib/entity-index-artefact.js +210 -0
  122. package/dist/lib/entity-index-artefact.js.map +1 -0
  123. package/dist/lib/instance-build-inputs.d.ts +108 -0
  124. package/dist/lib/instance-build-inputs.d.ts.map +1 -0
  125. package/dist/lib/instance-build-inputs.js +165 -0
  126. package/dist/lib/instance-build-inputs.js.map +1 -0
  127. package/dist/lib/module-docs.d.ts +473 -0
  128. package/dist/lib/module-docs.d.ts.map +1 -0
  129. package/dist/lib/module-docs.js +711 -0
  130. package/dist/lib/module-docs.js.map +1 -0
  131. package/dist/lib/module-package-subpaths.d.ts +56 -0
  132. package/dist/lib/module-package-subpaths.d.ts.map +1 -0
  133. package/dist/lib/module-package-subpaths.js +223 -0
  134. package/dist/lib/module-package-subpaths.js.map +1 -0
  135. package/dist/lib/module-packages.d.ts +200 -0
  136. package/dist/lib/module-packages.d.ts.map +1 -0
  137. package/dist/lib/module-packages.js +580 -0
  138. package/dist/lib/module-packages.js.map +1 -0
  139. package/dist/lib/module-population.d.ts +129 -0
  140. package/dist/lib/module-population.d.ts.map +1 -0
  141. package/dist/lib/module-population.js +172 -0
  142. package/dist/lib/module-population.js.map +1 -0
  143. package/dist/lib/module-roots.d.ts +337 -0
  144. package/dist/lib/module-roots.d.ts.map +1 -0
  145. package/dist/lib/module-roots.js +586 -0
  146. package/dist/lib/module-roots.js.map +1 -0
  147. package/dist/lib/nested-checkouts.d.ts +33 -0
  148. package/dist/lib/nested-checkouts.d.ts.map +1 -0
  149. package/dist/lib/nested-checkouts.js +160 -0
  150. package/dist/lib/nested-checkouts.js.map +1 -0
  151. package/dist/lib/platform-root.d.ts +43 -0
  152. package/dist/lib/platform-root.d.ts.map +1 -0
  153. package/dist/lib/platform-root.js +134 -0
  154. package/dist/lib/platform-root.js.map +1 -0
  155. package/dist/lib/platform-surface.d.ts +235 -0
  156. package/dist/lib/platform-surface.d.ts.map +1 -0
  157. package/dist/lib/platform-surface.js +393 -0
  158. package/dist/lib/platform-surface.js.map +1 -0
  159. package/dist/lib/port-registrations.d.ts +223 -0
  160. package/dist/lib/port-registrations.d.ts.map +1 -0
  161. package/dist/lib/port-registrations.js +532 -0
  162. package/dist/lib/port-registrations.js.map +1 -0
  163. package/dist/lib/read-size.d.ts +154 -0
  164. package/dist/lib/read-size.d.ts.map +1 -0
  165. package/dist/lib/read-size.js +182 -0
  166. package/dist/lib/read-size.js.map +1 -0
  167. package/dist/lib/registration-owners.d.ts +79 -0
  168. package/dist/lib/registration-owners.d.ts.map +1 -0
  169. package/dist/lib/registration-owners.js +77 -0
  170. package/dist/lib/registration-owners.js.map +1 -0
  171. package/dist/lib/release-index.d.ts +53 -0
  172. package/dist/lib/release-index.d.ts.map +1 -0
  173. package/dist/lib/release-index.js +162 -0
  174. package/dist/lib/release-index.js.map +1 -0
  175. package/dist/lib/repeating-timers.d.ts +79 -0
  176. package/dist/lib/repeating-timers.d.ts.map +1 -0
  177. package/dist/lib/repeating-timers.js +189 -0
  178. package/dist/lib/repeating-timers.js.map +1 -0
  179. package/dist/lib/source-text.d.ts +34 -0
  180. package/dist/lib/source-text.d.ts.map +1 -0
  181. package/dist/lib/source-text.js +80 -0
  182. package/dist/lib/source-text.js.map +1 -0
  183. package/dist/lib/specifiers.d.ts +20 -0
  184. package/dist/lib/specifiers.d.ts.map +1 -0
  185. package/dist/lib/specifiers.js +130 -0
  186. package/dist/lib/specifiers.js.map +1 -0
  187. package/dist/lib/sql-tables.d.ts +166 -0
  188. package/dist/lib/sql-tables.d.ts.map +1 -0
  189. package/dist/lib/sql-tables.js +464 -0
  190. package/dist/lib/sql-tables.js.map +1 -0
  191. package/dist/lib/switchable-modules.d.ts +54 -0
  192. package/dist/lib/switchable-modules.d.ts.map +1 -0
  193. package/dist/lib/switchable-modules.js +104 -0
  194. package/dist/lib/switchable-modules.js.map +1 -0
  195. package/dist/lib/tailwind-sources.d.ts +136 -0
  196. package/dist/lib/tailwind-sources.d.ts.map +1 -0
  197. package/dist/lib/tailwind-sources.js +307 -0
  198. package/dist/lib/tailwind-sources.js.map +1 -0
  199. package/dist/lib/ui-layer.d.ts +54 -0
  200. package/dist/lib/ui-layer.d.ts.map +1 -0
  201. package/dist/lib/ui-layer.js +57 -0
  202. package/dist/lib/ui-layer.js.map +1 -0
  203. package/dist/lib/workspace-packages.d.ts +186 -0
  204. package/dist/lib/workspace-packages.d.ts.map +1 -0
  205. package/dist/lib/workspace-packages.js +351 -0
  206. package/dist/lib/workspace-packages.js.map +1 -0
  207. package/dist/new-instance/deploy.d.ts +211 -0
  208. package/dist/new-instance/deploy.d.ts.map +1 -0
  209. package/dist/new-instance/deploy.js +1381 -0
  210. package/dist/new-instance/deploy.js.map +1 -0
  211. package/dist/new-instance/docs-toolchain.d.ts +66 -0
  212. package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
  213. package/dist/new-instance/docs-toolchain.js +69 -0
  214. package/dist/new-instance/docs-toolchain.js.map +1 -0
  215. package/dist/new-instance/host.d.ts +124 -0
  216. package/dist/new-instance/host.d.ts.map +1 -0
  217. package/dist/new-instance/host.js +276 -0
  218. package/dist/new-instance/host.js.map +1 -0
  219. package/dist/new-instance/index.d.ts +118 -0
  220. package/dist/new-instance/index.d.ts.map +1 -0
  221. package/dist/new-instance/index.js +567 -0
  222. package/dist/new-instance/index.js.map +1 -0
  223. package/dist/new-instance/modules.d.ts +188 -0
  224. package/dist/new-instance/modules.d.ts.map +1 -0
  225. package/dist/new-instance/modules.js +392 -0
  226. package/dist/new-instance/modules.js.map +1 -0
  227. package/dist/new-instance/template.d.ts +505 -0
  228. package/dist/new-instance/template.d.ts.map +1 -0
  229. package/dist/new-instance/template.js +1886 -0
  230. package/dist/new-instance/template.js.map +1 -0
  231. package/dist/new-module/emit.d.ts +67 -0
  232. package/dist/new-module/emit.d.ts.map +1 -0
  233. package/dist/new-module/emit.js +1393 -0
  234. package/dist/new-module/emit.js.map +1 -0
  235. package/dist/new-module/host.d.ts +67 -0
  236. package/dist/new-module/host.d.ts.map +1 -0
  237. package/dist/new-module/host.js +224 -0
  238. package/dist/new-module/host.js.map +1 -0
  239. package/dist/new-module/index.d.ts +32 -0
  240. package/dist/new-module/index.d.ts.map +1 -0
  241. package/dist/new-module/index.js +193 -0
  242. package/dist/new-module/index.js.map +1 -0
  243. package/dist/new-module/spec.d.ts +188 -0
  244. package/dist/new-module/spec.d.ts.map +1 -0
  245. package/dist/new-module/spec.js +404 -0
  246. package/dist/new-module/spec.js.map +1 -0
  247. package/dist/new-module/text.d.ts +15 -0
  248. package/dist/new-module/text.d.ts.map +1 -0
  249. package/dist/new-module/text.js +22 -0
  250. package/dist/new-module/text.js.map +1 -0
  251. package/dist/new-storefront/dockerfile.d.ts +20 -0
  252. package/dist/new-storefront/dockerfile.d.ts.map +1 -0
  253. package/dist/new-storefront/dockerfile.js +131 -0
  254. package/dist/new-storefront/dockerfile.js.map +1 -0
  255. package/dist/new-storefront/gitignore.d.ts +23 -0
  256. package/dist/new-storefront/gitignore.d.ts.map +1 -0
  257. package/dist/new-storefront/gitignore.js +39 -0
  258. package/dist/new-storefront/gitignore.js.map +1 -0
  259. package/dist/new-storefront/index.d.ts +93 -0
  260. package/dist/new-storefront/index.d.ts.map +1 -0
  261. package/dist/new-storefront/index.js +329 -0
  262. package/dist/new-storefront/index.js.map +1 -0
  263. package/dist/new-storefront/npmrc.d.ts +98 -0
  264. package/dist/new-storefront/npmrc.d.ts.map +1 -0
  265. package/dist/new-storefront/npmrc.js +217 -0
  266. package/dist/new-storefront/npmrc.js.map +1 -0
  267. package/dist/new-storefront/reference.d.ts +189 -0
  268. package/dist/new-storefront/reference.d.ts.map +1 -0
  269. package/dist/new-storefront/reference.js +430 -0
  270. package/dist/new-storefront/reference.js.map +1 -0
  271. package/dist/new-storefront/rewrite.d.ts +171 -0
  272. package/dist/new-storefront/rewrite.d.ts.map +1 -0
  273. package/dist/new-storefront/rewrite.js +701 -0
  274. package/dist/new-storefront/rewrite.js.map +1 -0
  275. package/dist/release-index.json +284 -0
  276. package/dist/rules/action-route-permissions.d.ts +141 -0
  277. package/dist/rules/action-route-permissions.d.ts.map +1 -0
  278. package/dist/rules/action-route-permissions.js +556 -0
  279. package/dist/rules/action-route-permissions.js.map +1 -0
  280. package/dist/rules/bundle-pairing.d.ts +74 -0
  281. package/dist/rules/bundle-pairing.d.ts.map +1 -0
  282. package/dist/rules/bundle-pairing.js +281 -0
  283. package/dist/rules/bundle-pairing.js.map +1 -0
  284. package/dist/rules/channel-resolution.d.ts +17 -0
  285. package/dist/rules/channel-resolution.d.ts.map +1 -0
  286. package/dist/rules/channel-resolution.js +382 -0
  287. package/dist/rules/channel-resolution.js.map +1 -0
  288. package/dist/rules/command-coverage.d.ts +210 -0
  289. package/dist/rules/command-coverage.d.ts.map +1 -0
  290. package/dist/rules/command-coverage.js +714 -0
  291. package/dist/rules/command-coverage.js.map +1 -0
  292. package/dist/rules/container-imports.d.ts +60 -0
  293. package/dist/rules/container-imports.d.ts.map +1 -0
  294. package/dist/rules/container-imports.js +158 -0
  295. package/dist/rules/container-imports.js.map +1 -0
  296. package/dist/rules/default-language-prose.d.ts +212 -0
  297. package/dist/rules/default-language-prose.d.ts.map +1 -0
  298. package/dist/rules/default-language-prose.js +710 -0
  299. package/dist/rules/default-language-prose.js.map +1 -0
  300. package/dist/rules/diacritic-folds.d.ts +238 -0
  301. package/dist/rules/diacritic-folds.d.ts.map +1 -0
  302. package/dist/rules/diacritic-folds.js +681 -0
  303. package/dist/rules/diacritic-folds.js.map +1 -0
  304. package/dist/rules/entity-tenant-classification.d.ts +171 -0
  305. package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
  306. package/dist/rules/entity-tenant-classification.js +323 -0
  307. package/dist/rules/entity-tenant-classification.js.map +1 -0
  308. package/dist/rules/entry-presence.d.ts +142 -0
  309. package/dist/rules/entry-presence.d.ts.map +1 -0
  310. package/dist/rules/entry-presence.js +339 -0
  311. package/dist/rules/entry-presence.js.map +1 -0
  312. package/dist/rules/entry-scope.d.ts +91 -0
  313. package/dist/rules/entry-scope.d.ts.map +1 -0
  314. package/dist/rules/entry-scope.js +404 -0
  315. package/dist/rules/entry-scope.js.map +1 -0
  316. package/dist/rules/env-inputs.d.ts +222 -0
  317. package/dist/rules/env-inputs.d.ts.map +1 -0
  318. package/dist/rules/env-inputs.js +951 -0
  319. package/dist/rules/env-inputs.js.map +1 -0
  320. package/dist/rules/kernel-boundary.d.ts +37 -0
  321. package/dist/rules/kernel-boundary.d.ts.map +1 -0
  322. package/dist/rules/kernel-boundary.js +195 -0
  323. package/dist/rules/kernel-boundary.js.map +1 -0
  324. package/dist/rules/nul-bytes.d.ts +233 -0
  325. package/dist/rules/nul-bytes.d.ts.map +1 -0
  326. package/dist/rules/nul-bytes.js +332 -0
  327. package/dist/rules/nul-bytes.js.map +1 -0
  328. package/dist/rules/platform-surface.d.ts +479 -0
  329. package/dist/rules/platform-surface.d.ts.map +1 -0
  330. package/dist/rules/platform-surface.js +749 -0
  331. package/dist/rules/platform-surface.js.map +1 -0
  332. package/dist/rules/port-catches.d.ts +225 -0
  333. package/dist/rules/port-catches.d.ts.map +1 -0
  334. package/dist/rules/port-catches.js +1374 -0
  335. package/dist/rules/port-catches.js.map +1 -0
  336. package/dist/rules/port-shape.d.ts +213 -0
  337. package/dist/rules/port-shape.d.ts.map +1 -0
  338. package/dist/rules/port-shape.js +670 -0
  339. package/dist/rules/port-shape.js.map +1 -0
  340. package/dist/rules/queue-names.d.ts +108 -0
  341. package/dist/rules/queue-names.d.ts.map +1 -0
  342. package/dist/rules/queue-names.js +395 -0
  343. package/dist/rules/queue-names.js.map +1 -0
  344. package/dist/rules/singleton-identity.d.ts +205 -0
  345. package/dist/rules/singleton-identity.d.ts.map +1 -0
  346. package/dist/rules/singleton-identity.js +830 -0
  347. package/dist/rules/singleton-identity.js.map +1 -0
  348. package/dist/rules/subscribe-seam.d.ts +121 -0
  349. package/dist/rules/subscribe-seam.d.ts.map +1 -0
  350. package/dist/rules/subscribe-seam.js +594 -0
  351. package/dist/rules/subscribe-seam.js.map +1 -0
  352. package/dist/rules/transaction-context.d.ts +40 -0
  353. package/dist/rules/transaction-context.d.ts.map +1 -0
  354. package/dist/rules/transaction-context.js +294 -0
  355. package/dist/rules/transaction-context.js.map +1 -0
  356. package/package.json +59 -0
@@ -0,0 +1,580 @@
1
+ /**
2
+ * "Which of this repository's workspace members is a module, and how does a
3
+ * generated artefact name a file inside one?" (feature 080, T041a; D-149.)
4
+ *
5
+ * `generate-composer.ts` had no notion of a module package at all. Every one of
6
+ * its four artefacts was rooted at `backend/src`: the two discovery walks listed
7
+ * `<src>/modules`, `readSourceTree` walked `<src>`, `MODULE_MIGRATION_RE` was
8
+ * anchored at `^modules/<id>/migrations/`, and `specifierFromDb` emitted `./…`
9
+ * or `../…` and nothing else. So the first module to become a package would have
10
+ * vanished from the composer, from the manifest index and — the one that is not
11
+ * recoverable by reading an error message — from the **migration registry**,
12
+ * where an absent entry is a migration that does not run, `migration:pending`
13
+ * reporting nothing pending, and a first symptom that is a query against a table
14
+ * nobody created.
15
+ *
16
+ * ## What a module package is, here
17
+ *
18
+ * A workspace member whose `package.json` declares `endora: { type: 'module',
19
+ * id }` — the package's own statement about itself, the same one
20
+ * `src/packages/installed-packages.ts` reads at boot and the same one
21
+ * `lib/module-roots.ts` keys its package roots on. It is **not** a path: nothing
22
+ * in this file knows or cares that D-141 puts them at `packages/modules/<id>/`,
23
+ * and `pnpm-workspace.yaml` remains the only authority for which directories are
24
+ * members (D-100).
25
+ *
26
+ * A consequence worth stating rather than discovering: a module package the
27
+ * workspace globs do **not** match is not a member and is not discovered here.
28
+ * That is the correct behaviour — the globs are the declaration — but it means
29
+ * moving a module into a directory no glob reaches removes it from every
30
+ * artefact, so the glob and the move belong in one merge request.
31
+ *
32
+ * ## How a file inside one is named
33
+ *
34
+ * By the package's **own `exports` map**, never by a subpath written down here.
35
+ * The rule is *the most specific declared subpath whose target covers the file*,
36
+ * where a target named `index.*` covers its directory recursively and any other
37
+ * target covers exactly itself. So a package declaring
38
+ * `"./migrations": "./src/migrations/index.ts"` has every file under
39
+ * `src/migrations/` named `@scope/mod-<id>/migrations`, and one declaring
40
+ * `"./entities"` instead gets that — both spellings appear in the F4 material
41
+ * (D-149 writes `/entities`, `module-package-layout.md` §2 folds entities into
42
+ * `./backend`), and reading the declaration is how a generator can be right
43
+ * under either without choosing between two documents.
44
+ *
45
+ * A file **no** declared subpath covers is refused, not skipped. It cannot be
46
+ * imported by a committed registry — that is what an `exports` map means — so
47
+ * emitting a specifier for it would produce an artefact that fails at its first
48
+ * import, and skipping it would reproduce the silent-loss failure above.
49
+ * Wildcard subpaths (`"./i18n/*"`) are outside the rule: a deep import through
50
+ * one is the shape `module-package-layout.md` R2 forbids, and it is the one
51
+ * consumer specifier that breaks when full F4 repoints `exports` at `dist`.
52
+ *
53
+ * ## The file the generator walked is not the file the subpath serves
54
+ *
55
+ * The paragraph above was written when D-140 ruled that a module package ships
56
+ * **source**, so an `exports` target named a `.ts` file the walk had just read
57
+ * and the two were the same path. **D-164 supersedes D-140**: a module package
58
+ * ships `dist`, because `tsx` applies one tsconfig per process and lowers a
59
+ * decorated file outside it with standard semantics, which kills every MikroORM
60
+ * entity a source package carries. So the map now names `./dist/backend/index.js`
61
+ * while the walk produces `src/backend/entities/blog-post.entity.ts`, and
62
+ * matching one against the other refuses **every** file of a package that
63
+ * follows the ruling — measured, before this paragraph existed: all four of
64
+ * `blog`'s shapes raised "no subpath of its exports map covers it".
65
+ *
66
+ * The missing step is the package's own **build declaration**, and it is read
67
+ * rather than assumed: `tsconfig.build.json`, following a relative `extends`
68
+ * exactly as `check-release-intent.ts` does, for its `rootDir` and `outDir`.
69
+ * A source file under `rootDir` is emitted at the same relative position under
70
+ * `outDir` with a `.js` extension, and *that* is the path matched against the
71
+ * `exports` targets. A package with **no** build configuration publishes what
72
+ * the walk read, so its paths match unchanged — which is what keeps the
73
+ * source-shipping regime working and is why this is a mapping rather than a
74
+ * `dist/` prefix written into the matcher.
75
+ *
76
+ * A `tsconfig.build.json` that exists and cannot be read or parsed is a
77
+ * **refusal**, never a fall back to "then it ships source": that reading would
78
+ * emit specifiers naming `.ts` files inside a package that publishes `.js`, and
79
+ * every one of them would fail at the artefact's first import.
80
+ */
81
+ import { existsSync, realpathSync } from 'node:fs';
82
+ import { basename, isAbsolute, join, relative, sep } from 'node:path';
83
+ import { nodeWorkspaceFs, workspaceMembers, } from './workspace-packages.js';
84
+ /** Raised when a package cannot be turned into artefact entries. Never skipped. */
85
+ export class ModulePackageError extends Error {
86
+ name = 'ModulePackageError';
87
+ }
88
+ /** The `endora` block a member declares about itself, if it is a module's. */
89
+ function declaredModuleId(manifest) {
90
+ const endora = manifest['endora'];
91
+ if (typeof endora !== 'object' || endora === null || Array.isArray(endora))
92
+ return null;
93
+ const block = endora;
94
+ if (block['type'] !== 'module')
95
+ return null;
96
+ const id = block['id'];
97
+ return typeof id === 'string' && id.length > 0 ? id : null;
98
+ }
99
+ /** `packages/modules/blog/src` → `src`; `./dist/` → `dist`; `.` → `''`. */
100
+ function normaliseRelativeDirectory(value) {
101
+ return value.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+$/, '').replace(/^\.$/, '');
102
+ }
103
+ /**
104
+ * `tsconfig.build.json`'s emit layout for one package, or `null` when it has no
105
+ * build configuration at all.
106
+ *
107
+ * Follows a relative `extends` for the same reason `check-release-intent.ts`
108
+ * does: !891's two-config split puts `rootDir` in the build file and everything
109
+ * else in the file it extends, so a reader of one alone finds half an answer.
110
+ * The **nearest** declaration of each key wins, which is what `tsc` itself does.
111
+ *
112
+ * A non-relative `extends` (`"@scope/tsconfig/base"`) is a refusal rather than a
113
+ * stop: this repository has none, and treating one as "no more to read" would
114
+ * silently answer with whatever half of the layout had been found so far.
115
+ */
116
+ export function readEmitLayout(packageDir, packageName, fs) {
117
+ const seen = new Set();
118
+ let current = join(packageDir, 'tsconfig.build.json');
119
+ let rootDir = null;
120
+ let outDir = null;
121
+ while (rootDir === null || outDir === null) {
122
+ if (seen.has(current)) {
123
+ throw new ModulePackageError(`[composer] ${packageName}: ${current} is part of an \`extends\` cycle, so where its ` +
124
+ `sources are emitted cannot be read.`);
125
+ }
126
+ seen.add(current);
127
+ const text = fs.readText(current);
128
+ if (text === null) {
129
+ // Only the first hop may be absent: a package with no build configuration
130
+ // publishes its sources where they are. A missing file *inside* an
131
+ // `extends` chain is a broken configuration and is refused below.
132
+ if (seen.size === 1)
133
+ return null;
134
+ throw new ModulePackageError(`[composer] ${packageName}: ${current} is named by an \`extends\` and could not be ` +
135
+ `read, so where its sources are emitted is unknown. A committed registry names ` +
136
+ `those emitted files by specifier; guessing one produces an artefact that fails ` +
137
+ `at its first import.`);
138
+ }
139
+ let config;
140
+ try {
141
+ config = JSON.parse(stripLineComments(text));
142
+ }
143
+ catch (error) {
144
+ throw new ModulePackageError(`[composer] ${packageName}: ${current} does not parse (${String(error)}), so where ` +
145
+ `its sources are emitted is unknown.`);
146
+ }
147
+ const options = (config['compilerOptions'] ?? {});
148
+ if (rootDir === null && typeof options['rootDir'] === 'string') {
149
+ rootDir = normaliseRelativeDirectory(options['rootDir']);
150
+ }
151
+ if (outDir === null && typeof options['outDir'] === 'string') {
152
+ outDir = normaliseRelativeDirectory(options['outDir']);
153
+ }
154
+ const parent = config['extends'];
155
+ if (parent === undefined)
156
+ break;
157
+ if (typeof parent !== 'string' || !parent.startsWith('.')) {
158
+ throw new ModulePackageError(`[composer] ${packageName}: ${current} extends '${String(parent)}', which is not a ` +
159
+ `relative path — this derivation cannot follow it, and stopping here would answer ` +
160
+ `with half of the emit layout.`);
161
+ }
162
+ current = join(current, '..', parent);
163
+ }
164
+ if (rootDir === null || outDir === null) {
165
+ throw new ModulePackageError(`[composer] ${packageName}: ${join(packageDir, 'tsconfig.build.json')} and its ` +
166
+ `\`extends\` chain declare ${rootDir === null ? '`rootDir`' : '`outDir`'} nowhere. A ` +
167
+ `package that emits needs both, because the specifier a committed registry carries ` +
168
+ `names the emitted file and not the source the walk read.`);
169
+ }
170
+ return { rootDir, outDir };
171
+ }
172
+ /** A tsconfig is JSON with comments; the same stripper the other readers use. */
173
+ function stripLineComments(text) {
174
+ return text
175
+ .split('\n')
176
+ .map((line) => (/^\s*\/\//.test(line) ? '' : line))
177
+ .join('\n');
178
+ }
179
+ /**
180
+ * Where a source file the walk read ends up in the published artefact.
181
+ *
182
+ * Package-relative in, package-relative out. Without a build layout the answer
183
+ * is the input — a source-shipping package publishes what was walked. With one,
184
+ * a file under `rootDir` moves to the same position under `outDir` and its
185
+ * TypeScript extension becomes the emitted `.js`; a file **outside** `rootDir`
186
+ * is returned unchanged, so it goes on to fail the `exports` match with the
187
+ * message that names the file, rather than being silently relocated to a path
188
+ * the build never writes.
189
+ */
190
+ export function emittedPathOf(pkg, packageRelativePath) {
191
+ if (pkg.emit === null)
192
+ return packageRelativePath;
193
+ const prefix = pkg.emit.rootDir === '' ? '' : `${pkg.emit.rootDir}/`;
194
+ if (prefix !== '' && !packageRelativePath.startsWith(prefix))
195
+ return packageRelativePath;
196
+ const withinRoot = packageRelativePath.slice(prefix.length);
197
+ const emitted = withinRoot
198
+ .replace(/\.mts$/, '.mjs')
199
+ .replace(/\.cts$/, '.cjs')
200
+ .replace(/\.tsx?$/, '.js');
201
+ return pkg.emit.outDir === '' ? emitted : `${pkg.emit.outDir}/${emitted}`;
202
+ }
203
+ /**
204
+ * The **runtime** string target under an `exports` value.
205
+ *
206
+ * A value is either a target string or a conditions object (`{ types, import,
207
+ * default }`). This used to take the first string it found, on the ground that
208
+ * "every condition of one subpath points into the same place in the source
209
+ * tree". That holds for a *directory* and not for a *file*, which is the
210
+ * granularity actually used: `{ types: './dist/backend/index.d.ts', default:
211
+ * './dist/backend/index.js' }` — the shape every package in this repository
212
+ * writes since !876 — answered `index.d.ts`, which is neither the file the
213
+ * registry imports nor a name the "a barrel covers its directory" rule
214
+ * recognises, so `./backend` covered nothing at all.
215
+ *
216
+ * `types` is therefore skipped while any other condition is present. It is the
217
+ * one condition that deliberately names a *different* file from the rest, and
218
+ * the question asked here — which subpath serves the file a committed artefact
219
+ * imports — is a runtime question.
220
+ */
221
+ function targetOf(value) {
222
+ if (typeof value === 'string')
223
+ return value;
224
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
225
+ return null;
226
+ const conditions = Object.entries(value);
227
+ for (const [condition, nested] of conditions) {
228
+ if (condition === 'types')
229
+ continue;
230
+ const found = targetOf(nested);
231
+ if (found !== null)
232
+ return found;
233
+ }
234
+ // Types-only is legal and is still an answer, if a narrower one.
235
+ for (const [, nested] of conditions) {
236
+ const found = targetOf(nested);
237
+ if (found !== null)
238
+ return found;
239
+ }
240
+ return null;
241
+ }
242
+ /** The declared, non-wildcard subpaths of a manifest's `exports` block. */
243
+ export function declaredExports(manifest) {
244
+ const block = manifest['exports'];
245
+ const found = new Map();
246
+ if (typeof block !== 'object' || block === null || Array.isArray(block))
247
+ return found;
248
+ for (const [subpath, value] of Object.entries(block)) {
249
+ if (subpath.includes('*'))
250
+ continue;
251
+ const target = targetOf(value);
252
+ if (target === null || !target.startsWith('./'))
253
+ continue;
254
+ found.set(subpath, target);
255
+ }
256
+ return found;
257
+ }
258
+ /**
259
+ * Every module package this repository declares, sorted by module id.
260
+ *
261
+ * Unlike `lib/module-roots.ts` this does **not** filter by the registered set:
262
+ * the generator is what *produces* the registered set, so filtering by it would
263
+ * make a newly packaged module invisible to the artefact that is supposed to
264
+ * register it — the instrument reading its own output.
265
+ */
266
+ export function discoverModulePackages(repoRoot, fs = nodeWorkspaceFs()) {
267
+ const found = [];
268
+ for (const member of workspaceMembers(repoRoot, fs)) {
269
+ const moduleId = declaredModuleId(member.manifest);
270
+ if (moduleId === null)
271
+ continue;
272
+ found.push({
273
+ moduleId,
274
+ name: member.name,
275
+ dir: member.dir,
276
+ exports: declaredExports(member.manifest),
277
+ emit: readEmitLayout(member.dir, member.name, fs),
278
+ });
279
+ }
280
+ const byId = new Map();
281
+ for (const pkg of found) {
282
+ const previous = byId.get(pkg.moduleId);
283
+ if (previous !== undefined) {
284
+ throw new ModulePackageError(`[composer] two workspace packages claim module id '${pkg.moduleId}': ` +
285
+ `${previous.name} (${previous.dir}) and ${pkg.name} (${pkg.dir}). One id is one ` +
286
+ `module's tables, settings and permissions; the artefacts cannot register both.`);
287
+ }
288
+ byId.set(pkg.moduleId, pkg);
289
+ }
290
+ return [...byId.values()].sort((a, b) => a.moduleId.localeCompare(b.moduleId));
291
+ }
292
+ /** `./src/backend/index.ts` → `src/backend`, recursively; anything else → itself. */
293
+ function coveredPathOf(target) {
294
+ const normalised = target.replace(/^\.\//, '');
295
+ const isBarrel = /(^|\/)index\.[cm]?[jt]sx?$/.test(normalised);
296
+ return isBarrel
297
+ ? { path: normalised.replace(/(^|\/)index\.[cm]?[jt]sx?$/, ''), recursive: true }
298
+ : { path: normalised, recursive: false };
299
+ }
300
+ /**
301
+ * How a committed artefact names one file of a module package (D-149).
302
+ *
303
+ * `packageRelativePath` is the file's path inside the package, `/`-separated.
304
+ * The answer is the **longest** covering target's subpath, so a package that
305
+ * declares both `./backend` and a narrower `./backend/entities` gets the
306
+ * narrower one — the same "most specific wins" rule Node's own resolver applies
307
+ * to an `exports` map.
308
+ */
309
+ export function packageSpecifierFor(pkg, packageRelativePath) {
310
+ const published = emittedPathOf(pkg, packageRelativePath);
311
+ let best = null;
312
+ for (const [subpath, target] of pkg.exports) {
313
+ if (subpath === './package.json')
314
+ continue;
315
+ const covered = coveredPathOf(target);
316
+ const matches = covered.recursive
317
+ ? covered.path === '' || published.startsWith(`${covered.path}/`)
318
+ : published === covered.path;
319
+ if (!matches)
320
+ continue;
321
+ if (best === null || covered.path.length > best.length) {
322
+ best = { subpath, length: covered.path.length };
323
+ }
324
+ }
325
+ if (best === null) {
326
+ const declared = [...pkg.exports.keys()].sort().join(', ') || '(none)';
327
+ const via = published === packageRelativePath ? '' : `, published at ${published}`;
328
+ throw new ModulePackageError(`[composer] ${pkg.name} owns ${packageRelativePath}${via}, and no subpath of its exports ` +
329
+ `map covers it (declared: ${declared}). A committed registry imports it by that ` +
330
+ `specifier, so an uncovered file would be registered under a specifier the package ` +
331
+ `refuses with ERR_PACKAGE_PATH_NOT_EXPORTED — and dropping it instead is how a ` +
332
+ `migration goes missing without a word. Declare a subpath for it, or move the file ` +
333
+ `under one that exists.`);
334
+ }
335
+ return best.subpath === '.' ? pkg.name : `${pkg.name}/${best.subpath.replace(/^\.\//, '')}`;
336
+ }
337
+ /**
338
+ * A **published** package's own entry point — the file `import '<name>'` loads.
339
+ *
340
+ * The source-tree locators search text for a marker, because a source tree
341
+ * declares nowhere which of its files is the manifest. A published package does
342
+ * declare it: the `.` subpath of its `exports` map is the package's statement
343
+ * about its own entry point, so the marker search is not merely unavailable
344
+ * here (there is no `.ts` to search), it is the wrong question. A third-party
345
+ * author's published manifest is a plain object literal and names
346
+ * `defineModuleManifest` nowhere.
347
+ *
348
+ * A package declaring no `.` subpath, or one whose target is not on disk, is a
349
+ * **refusal**: an artefact would name a specifier the package refuses with
350
+ * `ERR_PACKAGE_PATH_NOT_EXPORTED`, and skipping it is how a module drops out of
351
+ * a client's admin bundle or documentation with no error anywhere.
352
+ */
353
+ export function publishedManifestEntryOf(pkg) {
354
+ const target = pkg.exports.get('.');
355
+ if (target === undefined) {
356
+ const declared = [...pkg.exports.keys()].sort().join(', ') || '(none)';
357
+ throw new ModulePackageError(`[composer] ${pkg.name} declares module '${pkg.moduleId}', ships no sources, and its ` +
358
+ `exports map declares no '.' subpath (declared: ${declared}). That subpath is where a ` +
359
+ `published package states its own entry point, and it is the only thing an artefact ` +
360
+ `can name it by.`);
361
+ }
362
+ const relativePath = target.replace(/^\.\//, '');
363
+ const manifestPath = absolutePathInPackage(pkg, relativePath);
364
+ if (!existsSync(manifestPath)) {
365
+ throw new ModulePackageError(`[composer] ${pkg.name} exports '.' as ${target}, and that file is not in the package. ` +
366
+ `An artefact naming it would fail at its first import; a package whose own entry ` +
367
+ `point is missing is not one this run can register.`);
368
+ }
369
+ return { manifestPath, manifestSpecifier: packageSpecifierFor(pkg, relativePath) };
370
+ }
371
+ /**
372
+ * Is this source file the one a declared subpath points **at** — a barrel?
373
+ *
374
+ * `module-package-layout.md` §1 puts a module package's migrations under
375
+ * `src/migrations/`, and the `./migrations` subpath has to name a file, so the
376
+ * directory holds one that is not a migration: the barrel re-exporting the
377
+ * classes, which is what makes `import { Migration… } from
378
+ * '<pkg>/migrations'` resolve. `collectMigrations` refuses an unrecognised
379
+ * `.ts` in a migrations directory — correctly, because skipping one is how a
380
+ * migration goes missing without a word — so it needs to tell the barrel from
381
+ * a misnamed migration.
382
+ *
383
+ * It is answered from the **package's own `exports` map** rather than from
384
+ * `contracts/naming-convention.md` §4's allow-list, which is keyed on
385
+ * application paths and would have to grow an entry per package. A file a
386
+ * subpath points at is an entry point by declaration; a file that merely sits
387
+ * beside it is not.
388
+ */
389
+ export function isDeclaredEntryPoint(pkg, packageRelativePath) {
390
+ const published = emittedPathOf(pkg, packageRelativePath);
391
+ for (const [subpath, target] of pkg.exports) {
392
+ if (subpath === './package.json')
393
+ continue;
394
+ if (target.replace(/^\.\//, '') === published)
395
+ return true;
396
+ }
397
+ return false;
398
+ }
399
+ /** A file's path inside its package, `/`-separated. */
400
+ export function packageRelativePathOf(pkg, absolutePath) {
401
+ return relative(pkg.dir, absolutePath).split(sep).join('/');
402
+ }
403
+ /** The absolute path a package-relative path names. */
404
+ export function absolutePathInPackage(pkg, packageRelativePath) {
405
+ return join(pkg.dir, ...packageRelativePath.split('/'));
406
+ }
407
+ /** The real filesystem behind {@link InstanceFs}. Absence is `null`, never a throw. */
408
+ export function nodeInstanceFs() {
409
+ const base = nodeWorkspaceFs();
410
+ return {
411
+ ...base,
412
+ realPath(path) {
413
+ try {
414
+ return realpathSync(path);
415
+ }
416
+ catch {
417
+ return null;
418
+ }
419
+ },
420
+ };
421
+ }
422
+ /** Top-level candidate directories in one `node_modules`, `@scope/` expanded. */
423
+ function installedCandidates(root, fs) {
424
+ const found = [];
425
+ for (const name of [...fs.listDirectories(root)].sort()) {
426
+ // `.pnpm`, `.bin`: the store is reached through the top-level link, so
427
+ // descending would find every package a second time.
428
+ if (name.startsWith('.'))
429
+ continue;
430
+ const full = join(root, name);
431
+ if (!name.startsWith('@')) {
432
+ found.push(full);
433
+ continue;
434
+ }
435
+ for (const inner of [...fs.listDirectories(full)].sort()) {
436
+ if (inner.startsWith('.'))
437
+ continue;
438
+ found.push(join(full, inner));
439
+ }
440
+ }
441
+ return found;
442
+ }
443
+ /**
444
+ * Every module package an instance installed, with what was skipped and why.
445
+ *
446
+ * `instanceRoot` is the directory whose `node_modules` holds them — the client's
447
+ * repository root. A root with no `node_modules` reads as *nothing to read*
448
+ * (`root: null`) rather than as *no module installed*, so a caller can tell an
449
+ * uninstalled instance from a module-less one.
450
+ */
451
+ export function scanInstalledModulePackages(instanceRoot, fs = nodeInstanceFs()) {
452
+ const root = join(instanceRoot, 'node_modules');
453
+ const realRoot = fs.realPath(root);
454
+ if (realRoot === null)
455
+ return { packages: [], skipped: [], root: null };
456
+ const skipped = [];
457
+ const byId = new Map();
458
+ for (const directory of installedCandidates(root, fs)) {
459
+ const manifestPath = join(directory, 'package.json');
460
+ const text = fs.readText(manifestPath);
461
+ if (text === null)
462
+ continue;
463
+ let parsed;
464
+ try {
465
+ parsed = JSON.parse(text);
466
+ }
467
+ catch (error) {
468
+ // Reported, never thrown: one unreadable stranger in a `node_modules`
469
+ // must not stop a client's build, exactly as it must not stop their boot.
470
+ skipped.push({ kind: 'unreadable', at: manifestPath, reason: String(error) });
471
+ continue;
472
+ }
473
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
474
+ continue;
475
+ const manifest = parsed;
476
+ const moduleId = declaredModuleId(manifest);
477
+ if (moduleId === null)
478
+ continue;
479
+ const name = typeof manifest['name'] === 'string' ? manifest['name'] : basename(directory);
480
+ const real = fs.realPath(directory);
481
+ if (real === null) {
482
+ skipped.push({
483
+ kind: 'unreadable',
484
+ at: directory,
485
+ reason: 'its real path could not be resolved, so whether it is installed here or ' +
486
+ 'linked from somewhere else cannot be decided',
487
+ });
488
+ continue;
489
+ }
490
+ if (!isUnderDirectory(real, realRoot)) {
491
+ skipped.push({ kind: 'links-out-of-node-modules', name, at: directory, realPath: real });
492
+ continue;
493
+ }
494
+ const pkg = {
495
+ moduleId,
496
+ name,
497
+ dir: directory,
498
+ exports: declaredExports(manifest),
499
+ emit: readEmitLayout(directory, name, fs),
500
+ };
501
+ const previous = byId.get(moduleId);
502
+ if (previous !== undefined) {
503
+ throw new ModulePackageError(`[composer] two installed packages claim module id '${moduleId}': ${previous.name} ` +
504
+ `(${previous.dir}) and ${pkg.name} (${pkg.dir}). One id is one module's tables, ` +
505
+ `settings and permissions; the artefacts cannot register both.`);
506
+ }
507
+ byId.set(moduleId, pkg);
508
+ }
509
+ return {
510
+ packages: [...byId.values()].sort((a, b) => a.moduleId.localeCompare(b.moduleId)),
511
+ skipped,
512
+ root,
513
+ };
514
+ }
515
+ /** {@link scanInstalledModulePackages}' accepted half. */
516
+ export function installedModulePackages(instanceRoot, fs = nodeInstanceFs()) {
517
+ return scanInstalledModulePackages(instanceRoot, fs).packages;
518
+ }
519
+ /**
520
+ * The platform an instance installed, or `null` when none resolves.
521
+ *
522
+ * The same walk and the same three rules as {@link scanInstalledModulePackages},
523
+ * one `endora.type` value over: the discriminator is the package's own
524
+ * declaration and never its name, which is `platform-root.ts`' rule applied to
525
+ * an installed tree rather than to a workspace. The scope was `@b2b/` until
526
+ * D-161 and a name written into a tool is a rename away from a walk that
527
+ * silently sees nothing.
528
+ *
529
+ * Two installed packages declaring it is an error rather than a first-one-wins,
530
+ * for the reason `platform-root.ts` refuses the same state in a workspace: the
531
+ * walk would narrow to whichever sorted first and report on it as if it were the
532
+ * platform.
533
+ */
534
+ export function scanInstalledPlatformPackage(instanceRoot, fs = nodeInstanceFs()) {
535
+ const root = join(instanceRoot, 'node_modules');
536
+ const realRoot = fs.realPath(root);
537
+ if (realRoot === null)
538
+ return null;
539
+ const found = [];
540
+ for (const directory of installedCandidates(root, fs)) {
541
+ const text = fs.readText(join(directory, 'package.json'));
542
+ if (text === null)
543
+ continue;
544
+ let parsed;
545
+ try {
546
+ parsed = JSON.parse(text);
547
+ }
548
+ catch {
549
+ continue;
550
+ }
551
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
552
+ continue;
553
+ const manifest = parsed;
554
+ const endora = manifest['endora'];
555
+ if (typeof endora !== 'object' || endora === null || Array.isArray(endora))
556
+ continue;
557
+ if (endora['type'] !== 'platform')
558
+ continue;
559
+ const real = fs.realPath(directory);
560
+ if (real === null || !isUnderDirectory(real, realRoot))
561
+ continue;
562
+ found.push({
563
+ name: typeof manifest['name'] === 'string' ? manifest['name'] : basename(directory),
564
+ dir: directory,
565
+ exports: declaredExports(manifest),
566
+ });
567
+ }
568
+ if (found.length > 1) {
569
+ throw new ModulePackageError(`[composer] ${String(found.length)} installed packages declare ` +
570
+ `\`endora.type: "platform"\` (${found.map((pkg) => pkg.name).join(', ')}). A walk would ` +
571
+ 'narrow to whichever sorted first and report on it as if it were the platform.');
572
+ }
573
+ return found[0] ?? null;
574
+ }
575
+ /** `true` when `child` is inside `parent` and is not `parent` itself. */
576
+ function isUnderDirectory(child, parent) {
577
+ const rel = relative(parent, child);
578
+ return rel !== '' && rel !== '..' && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
579
+ }
580
+ //# sourceMappingURL=module-packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-packages.js","sourceRoot":"","sources":["../../src/lib/module-packages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EACL,eAAe,EACf,gBAAgB,GAEjB,MAAM,yBAAyB,CAAC;AA2BjC,mFAAmF;AACnF,M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