@pasosdejesus/m 0.27.2 → 0.29.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 (323) hide show
  1. package/README.md +2 -2
  2. package/dist/CHANGELOG.md +147 -0
  3. package/dist/compose/data.d.ts +30 -0
  4. package/dist/compose/data.d.ts.map +1 -0
  5. package/dist/compose/data.js +46 -0
  6. package/dist/compose/data.js.map +1 -0
  7. package/dist/compose/derive.d.ts +59 -0
  8. package/dist/compose/derive.d.ts.map +1 -0
  9. package/dist/compose/derive.js +143 -0
  10. package/dist/compose/derive.js.map +1 -0
  11. package/dist/compose/discover.d.ts +32 -0
  12. package/dist/compose/discover.d.ts.map +1 -0
  13. package/dist/compose/discover.js +96 -0
  14. package/dist/compose/discover.js.map +1 -0
  15. package/dist/compose/git.d.ts +31 -0
  16. package/dist/compose/git.d.ts.map +1 -0
  17. package/dist/compose/git.js +71 -0
  18. package/dist/compose/git.js.map +1 -0
  19. package/dist/compose/index.d.ts +19 -0
  20. package/dist/compose/index.d.ts.map +1 -0
  21. package/dist/compose/index.js +18 -0
  22. package/dist/compose/index.js.map +1 -0
  23. package/dist/compose/manifest.d.ts +89 -0
  24. package/dist/compose/manifest.d.ts.map +1 -0
  25. package/dist/compose/manifest.js +16 -0
  26. package/dist/compose/manifest.js.map +1 -0
  27. package/dist/compose/sync.d.ts +12 -0
  28. package/dist/compose/sync.d.ts.map +1 -0
  29. package/dist/compose/sync.js +27 -0
  30. package/dist/compose/sync.js.map +1 -0
  31. package/dist/compose/usage.d.ts +54 -0
  32. package/dist/compose/usage.d.ts.map +1 -0
  33. package/dist/compose/usage.js +167 -0
  34. package/dist/compose/usage.js.map +1 -0
  35. package/dist/compose/vendor.d.ts +68 -0
  36. package/dist/compose/vendor.d.ts.map +1 -0
  37. package/dist/compose/vendor.js +166 -0
  38. package/dist/compose/vendor.js.map +1 -0
  39. package/dist/compose/verify.d.ts +11 -0
  40. package/dist/compose/verify.d.ts.map +1 -0
  41. package/dist/compose/verify.js +74 -0
  42. package/dist/compose/verify.js.map +1 -0
  43. package/dist/e2e/env.d.ts +1 -1
  44. package/dist/e2e/env.js +3 -3
  45. package/dist/e2e/env.js.map +1 -1
  46. package/dist/e2e/local-node.js +1 -1
  47. package/dist/e2e/local-node.js.map +1 -1
  48. package/dist/e2e/wallet-mock.js +1 -1
  49. package/dist/e2e/wallet-mock.js.map +1 -1
  50. package/dist/e2e/warmup.js +1 -1
  51. package/dist/e2e/warmup.js.map +1 -1
  52. package/dist/engine.d.ts +3 -16
  53. package/dist/engine.d.ts.map +1 -1
  54. package/dist/i18n/locales/cli.d.ts.map +1 -1
  55. package/dist/i18n/locales/cli.js +20 -10
  56. package/dist/i18n/locales/cli.js.map +1 -1
  57. package/dist/m.js +15 -10
  58. package/dist/m.js.map +1 -1
  59. package/dist/shadcn_components/ui/button.d.ts +1 -1
  60. package/dist/tasks/create.d.ts +1 -1
  61. package/dist/tasks/create.d.ts.map +1 -1
  62. package/dist/tasks/create.js +5 -13
  63. package/dist/tasks/create.js.map +1 -1
  64. package/dist/tasks/db.d.ts +2 -1
  65. package/dist/tasks/db.d.ts.map +1 -1
  66. package/dist/tasks/db.js +14 -11
  67. package/dist/tasks/db.js.map +1 -1
  68. package/dist/tasks/e2e-summary.js +1 -1
  69. package/dist/tasks/e2e-summary.js.map +1 -1
  70. package/dist/tasks/e2e.js +1 -1
  71. package/dist/tasks/e2e.js.map +1 -1
  72. package/dist/tasks/engine.d.ts.map +1 -1
  73. package/dist/tasks/engine.js +436 -17
  74. package/dist/tasks/engine.js.map +1 -1
  75. package/dist/tasks/msip.d.ts +11 -0
  76. package/dist/tasks/msip.d.ts.map +1 -0
  77. package/dist/tasks/{base-model.js → msip.js} +161 -25
  78. package/dist/tasks/msip.js.map +1 -0
  79. package/dist/tasks/warmup.js +1 -1
  80. package/dist/tasks/warmup.js.map +1 -1
  81. package/dist/templates/apps/hardhat/README.md +0 -8
  82. package/dist/templates/apps/nextjs/bin/m +3 -0
  83. package/dist/templates/apps/nextjs/tests/global-setup.ts +28 -0
  84. package/dist/templates/apps/nextjs/vitest.config.ts +3 -0
  85. package/dist/test-utils/console.d.ts +1 -1
  86. package/dist/test-utils/console.js +1 -1
  87. package/dist/test-utils/kysely-mocks.d.ts +1 -1
  88. package/dist/test-utils/kysely-mocks.js +1 -1
  89. package/dist/test-utils/wallet-mocks.js +1 -1
  90. package/dist/test-utils/wallet-setup.js +1 -1
  91. package/dist/util/engines.d.ts +4 -6
  92. package/dist/util/engines.d.ts.map +1 -1
  93. package/dist/util/engines.js +5 -38
  94. package/dist/util/engines.js.map +1 -1
  95. package/dist/util/msip.d.ts +17 -0
  96. package/dist/util/msip.d.ts.map +1 -0
  97. package/dist/util/msip.js +86 -0
  98. package/dist/util/msip.js.map +1 -0
  99. package/dist/wallet/index.js +1 -1
  100. package/dist/wallet/index.js.map +1 -1
  101. package/dist/wallet/next/i18n.d.ts +1 -1
  102. package/dist/wallet/next/i18n.js +1 -1
  103. package/dist/wallet/next/index.js +1 -1
  104. package/dist/wallet/next/index.js.map +1 -1
  105. package/dist/wallet/next/namespaces.d.ts +1 -1
  106. package/dist/wallet/next/namespaces.js +1 -1
  107. package/dist/wallet/storage/idb.d.ts +1 -1
  108. package/dist/wallet/storage/idb.js +1 -1
  109. package/package.json +4 -6
  110. package/src/e2e/README.md +6 -6
  111. package/src/tasks/README.md +3 -3
  112. package/src/test-utils/README.md +2 -2
  113. package/src/wallet/README.md +4 -4
  114. package/dist/base-model/baseline.generated.d.ts +0 -48
  115. package/dist/base-model/baseline.generated.d.ts.map +0 -1
  116. package/dist/base-model/baseline.generated.js +0 -930
  117. package/dist/base-model/baseline.generated.js.map +0 -1
  118. package/dist/base-model/check.d.ts +0 -6
  119. package/dist/base-model/check.d.ts.map +0 -1
  120. package/dist/base-model/check.js +0 -195
  121. package/dist/base-model/check.js.map +0 -1
  122. package/dist/base-model/forward/baseline_1_0_0.d.ts +0 -3
  123. package/dist/base-model/forward/baseline_1_0_0.d.ts.map +0 -1
  124. package/dist/base-model/forward/baseline_1_0_0.js +0 -23
  125. package/dist/base-model/forward/baseline_1_0_0.js.map +0 -1
  126. package/dist/base-model/forward/index.d.ts +0 -28
  127. package/dist/base-model/forward/index.d.ts.map +0 -1
  128. package/dist/base-model/forward/index.js +0 -126
  129. package/dist/base-model/forward/index.js.map +0 -1
  130. package/dist/base-model/forward/index.test.d.ts +0 -2
  131. package/dist/base-model/forward/index.test.d.ts.map +0 -1
  132. package/dist/base-model/forward/index.test.js +0 -65
  133. package/dist/base-model/forward/index.test.js.map +0 -1
  134. package/dist/base-model/forward/policy.d.ts +0 -16
  135. package/dist/base-model/forward/policy.d.ts.map +0 -1
  136. package/dist/base-model/forward/policy.js +0 -37
  137. package/dist/base-model/forward/policy.js.map +0 -1
  138. package/dist/base-model/forward/policy.test.d.ts +0 -2
  139. package/dist/base-model/forward/policy.test.d.ts.map +0 -1
  140. package/dist/base-model/forward/policy.test.js +0 -40
  141. package/dist/base-model/forward/policy.test.js.map +0 -1
  142. package/dist/base-model/forward/types.d.ts +0 -21
  143. package/dist/base-model/forward/types.d.ts.map +0 -1
  144. package/dist/base-model/forward/types.js +0 -2
  145. package/dist/base-model/forward/types.js.map +0 -1
  146. package/dist/base-model/generate.d.ts +0 -42
  147. package/dist/base-model/generate.d.ts.map +0 -1
  148. package/dist/base-model/generate.js +0 -241
  149. package/dist/base-model/generate.js.map +0 -1
  150. package/dist/base-model/guidelines.d.ts +0 -13
  151. package/dist/base-model/guidelines.d.ts.map +0 -1
  152. package/dist/base-model/guidelines.js +0 -61
  153. package/dist/base-model/guidelines.js.map +0 -1
  154. package/dist/base-model/index.d.ts +0 -24
  155. package/dist/base-model/index.d.ts.map +0 -1
  156. package/dist/base-model/index.js +0 -29
  157. package/dist/base-model/index.js.map +0 -1
  158. package/dist/base-model/parse-structure.d.ts +0 -4
  159. package/dist/base-model/parse-structure.d.ts.map +0 -1
  160. package/dist/base-model/parse-structure.js +0 -170
  161. package/dist/base-model/parse-structure.js.map +0 -1
  162. package/dist/base-model/queries.d.ts +0 -34
  163. package/dist/base-model/queries.d.ts.map +0 -1
  164. package/dist/base-model/queries.js +0 -118
  165. package/dist/base-model/queries.js.map +0 -1
  166. package/dist/base-model/references/learn-tg.d.ts +0 -21
  167. package/dist/base-model/references/learn-tg.d.ts.map +0 -1
  168. package/dist/base-model/references/learn-tg.js +0 -65
  169. package/dist/base-model/references/learn-tg.js.map +0 -1
  170. package/dist/base-model/references/msip.d.ts +0 -29
  171. package/dist/base-model/references/msip.d.ts.map +0 -1
  172. package/dist/base-model/references/msip.js +0 -33
  173. package/dist/base-model/references/msip.js.map +0 -1
  174. package/dist/base-model/types.d.ts +0 -207
  175. package/dist/base-model/types.d.ts.map +0 -1
  176. package/dist/base-model/types.js +0 -10
  177. package/dist/base-model/types.js.map +0 -1
  178. package/dist/base-model/version.d.ts +0 -19
  179. package/dist/base-model/version.d.ts.map +0 -1
  180. package/dist/base-model/version.js +0 -26
  181. package/dist/base-model/version.js.map +0 -1
  182. package/dist/base-model/wallet-link.d.ts +0 -69
  183. package/dist/base-model/wallet-link.d.ts.map +0 -1
  184. package/dist/base-model/wallet-link.js +0 -220
  185. package/dist/base-model/wallet-link.js.map +0 -1
  186. package/dist/base-model/wallet-link.test.d.ts +0 -2
  187. package/dist/base-model/wallet-link.test.d.ts.map +0 -1
  188. package/dist/base-model/wallet-link.test.js +0 -147
  189. package/dist/base-model/wallet-link.test.js.map +0 -1
  190. package/dist/e2e/env.test.d.ts +0 -2
  191. package/dist/e2e/env.test.d.ts.map +0 -1
  192. package/dist/e2e/env.test.js +0 -72
  193. package/dist/e2e/env.test.js.map +0 -1
  194. package/dist/e2e/full-wallet.test.d.ts +0 -2
  195. package/dist/e2e/full-wallet.test.d.ts.map +0 -1
  196. package/dist/e2e/full-wallet.test.js +0 -63
  197. package/dist/e2e/full-wallet.test.js.map +0 -1
  198. package/dist/e2e/in-app-wallet.test.d.ts +0 -2
  199. package/dist/e2e/in-app-wallet.test.d.ts.map +0 -1
  200. package/dist/e2e/in-app-wallet.test.js +0 -52
  201. package/dist/e2e/in-app-wallet.test.js.map +0 -1
  202. package/dist/e2e/local-node.test.d.ts +0 -2
  203. package/dist/e2e/local-node.test.d.ts.map +0 -1
  204. package/dist/e2e/local-node.test.js +0 -43
  205. package/dist/e2e/local-node.test.js.map +0 -1
  206. package/dist/e2e/retry.test.d.ts +0 -2
  207. package/dist/e2e/retry.test.d.ts.map +0 -1
  208. package/dist/e2e/retry.test.js +0 -43
  209. package/dist/e2e/retry.test.js.map +0 -1
  210. package/dist/e2e/signer.test.d.ts +0 -2
  211. package/dist/e2e/signer.test.d.ts.map +0 -1
  212. package/dist/e2e/signer.test.js +0 -57
  213. package/dist/e2e/signer.test.js.map +0 -1
  214. package/dist/e2e/siwe-optional.test.d.ts +0 -2
  215. package/dist/e2e/siwe-optional.test.d.ts.map +0 -1
  216. package/dist/e2e/siwe-optional.test.js +0 -13
  217. package/dist/e2e/siwe-optional.test.js.map +0 -1
  218. package/dist/e2e/wallet-mock.test.d.ts +0 -2
  219. package/dist/e2e/wallet-mock.test.d.ts.map +0 -1
  220. package/dist/e2e/wallet-mock.test.js +0 -28
  221. package/dist/e2e/wallet-mock.test.js.map +0 -1
  222. package/dist/e2e/warmup.test.d.ts +0 -2
  223. package/dist/e2e/warmup.test.d.ts.map +0 -1
  224. package/dist/e2e/warmup.test.js +0 -67
  225. package/dist/e2e/warmup.test.js.map +0 -1
  226. package/dist/engine.test.d.ts +0 -2
  227. package/dist/engine.test.d.ts.map +0 -1
  228. package/dist/engine.test.js +0 -35
  229. package/dist/engine.test.js.map +0 -1
  230. package/dist/index.test.d.ts +0 -2
  231. package/dist/index.test.d.ts.map +0 -1
  232. package/dist/index.test.js +0 -11
  233. package/dist/index.test.js.map +0 -1
  234. package/dist/tasks/base-model.d.ts +0 -5
  235. package/dist/tasks/base-model.d.ts.map +0 -1
  236. package/dist/tasks/base-model.js.map +0 -1
  237. package/dist/tasks/create.test.d.ts +0 -2
  238. package/dist/tasks/create.test.d.ts.map +0 -1
  239. package/dist/tasks/create.test.js +0 -41
  240. package/dist/tasks/create.test.js.map +0 -1
  241. package/dist/tasks/e2e.test.d.ts +0 -2
  242. package/dist/tasks/e2e.test.d.ts.map +0 -1
  243. package/dist/tasks/e2e.test.js +0 -108
  244. package/dist/tasks/e2e.test.js.map +0 -1
  245. package/dist/tasks/update.test.d.ts +0 -2
  246. package/dist/tasks/update.test.d.ts.map +0 -1
  247. package/dist/tasks/update.test.js +0 -79
  248. package/dist/tasks/update.test.js.map +0 -1
  249. package/dist/tasks/warmup.test.d.ts +0 -2
  250. package/dist/tasks/warmup.test.d.ts.map +0 -1
  251. package/dist/tasks/warmup.test.js +0 -40
  252. package/dist/tasks/warmup.test.js.map +0 -1
  253. package/dist/templates/apps/nextjs/tests/index.test.ts +0 -7
  254. package/dist/templates/apps/nextjs/tests/test-utils.example.test.ts +0 -169
  255. package/dist/templates/apps/nextjs/tsconfig.test.json +0 -38
  256. package/dist/test-utils/console.test.d.ts +0 -2
  257. package/dist/test-utils/console.test.d.ts.map +0 -1
  258. package/dist/test-utils/console.test.js +0 -70
  259. package/dist/test-utils/console.test.js.map +0 -1
  260. package/dist/test-utils/kysely-mocks.test.d.ts +0 -2
  261. package/dist/test-utils/kysely-mocks.test.d.ts.map +0 -1
  262. package/dist/test-utils/kysely-mocks.test.js +0 -126
  263. package/dist/test-utils/kysely-mocks.test.js.map +0 -1
  264. package/dist/test-utils/wallet-mocks.test.d.ts +0 -2
  265. package/dist/test-utils/wallet-mocks.test.d.ts.map +0 -1
  266. package/dist/test-utils/wallet-mocks.test.js +0 -55
  267. package/dist/test-utils/wallet-mocks.test.js.map +0 -1
  268. package/dist/test-utils/wallet-setup.test.d.ts +0 -2
  269. package/dist/test-utils/wallet-setup.test.d.ts.map +0 -1
  270. package/dist/test-utils/wallet-setup.test.js +0 -18
  271. package/dist/test-utils/wallet-setup.test.js.map +0 -1
  272. package/dist/util/engines.test.d.ts +0 -2
  273. package/dist/util/engines.test.d.ts.map +0 -1
  274. package/dist/util/engines.test.js +0 -79
  275. package/dist/util/engines.test.js.map +0 -1
  276. package/dist/wallet/biometric.test.d.ts +0 -2
  277. package/dist/wallet/biometric.test.d.ts.map +0 -1
  278. package/dist/wallet/biometric.test.js +0 -44
  279. package/dist/wallet/biometric.test.js.map +0 -1
  280. package/dist/wallet/crypto.test.d.ts +0 -2
  281. package/dist/wallet/crypto.test.d.ts.map +0 -1
  282. package/dist/wallet/crypto.test.js +0 -34
  283. package/dist/wallet/crypto.test.js.map +0 -1
  284. package/dist/wallet/destinations.test.d.ts +0 -2
  285. package/dist/wallet/destinations.test.d.ts.map +0 -1
  286. package/dist/wallet/destinations.test.js +0 -34
  287. package/dist/wallet/destinations.test.js.map +0 -1
  288. package/dist/wallet/external-provider.test.d.ts +0 -2
  289. package/dist/wallet/external-provider.test.d.ts.map +0 -1
  290. package/dist/wallet/external-provider.test.js +0 -44
  291. package/dist/wallet/external-provider.test.js.map +0 -1
  292. package/dist/wallet/indexeddb.test.d.ts +0 -2
  293. package/dist/wallet/indexeddb.test.d.ts.map +0 -1
  294. package/dist/wallet/indexeddb.test.js +0 -28
  295. package/dist/wallet/indexeddb.test.js.map +0 -1
  296. package/dist/wallet/kdf.test.d.ts +0 -2
  297. package/dist/wallet/kdf.test.d.ts.map +0 -1
  298. package/dist/wallet/kdf.test.js +0 -54
  299. package/dist/wallet/kdf.test.js.map +0 -1
  300. package/dist/wallet/next/components.test.d.ts +0 -2
  301. package/dist/wallet/next/components.test.d.ts.map +0 -1
  302. package/dist/wallet/next/components.test.js +0 -122
  303. package/dist/wallet/next/components.test.js.map +0 -1
  304. package/dist/wallet/next/useInAppWallet.test.d.ts +0 -2
  305. package/dist/wallet/next/useInAppWallet.test.d.ts.map +0 -1
  306. package/dist/wallet/next/useInAppWallet.test.js +0 -261
  307. package/dist/wallet/next/useInAppWallet.test.js.map +0 -1
  308. package/dist/wallet/provider.test.d.ts +0 -2
  309. package/dist/wallet/provider.test.d.ts.map +0 -1
  310. package/dist/wallet/provider.test.js +0 -170
  311. package/dist/wallet/provider.test.js.map +0 -1
  312. package/dist/wallet/signer.test.d.ts +0 -2
  313. package/dist/wallet/signer.test.d.ts.map +0 -1
  314. package/dist/wallet/signer.test.js +0 -62
  315. package/dist/wallet/signer.test.js.map +0 -1
  316. package/dist/wallet/storage.test.d.ts +0 -2
  317. package/dist/wallet/storage.test.d.ts.map +0 -1
  318. package/dist/wallet/storage.test.js +0 -103
  319. package/dist/wallet/storage.test.js.map +0 -1
  320. package/dist/wallet/wallet.test.d.ts +0 -2
  321. package/dist/wallet/wallet.test.d.ts.map +0 -1
  322. package/dist/wallet/wallet.test.js +0 -150
  323. package/dist/wallet/wallet.test.js.map +0 -1
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Fuentes git de un motor ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D4): `--from-git <url>#<ref>
3
+ * [--path <subdir>]`. Materializa (clona + checkout del ref) el repositorio en una
4
+ * caché por `url#ref` y devuelve la carpeta del motor, para poder vendorizarlo con
5
+ * procedencia trazable (`kind`, `origin`, `ref`, `version`, `sha256`).
6
+ *
7
+ * El registro de npm se evita a propósito: los motores viven en subárboles git (de
8
+ * pasosdejesus o de terceros) y `m` no declara dependencia de ninguno.
9
+ *
10
+ * "Porque ¿quién de vosotros, queriendo edificar una torre, no se sienta primero y calcula los gastos…?" (Lucas 14:28)
11
+ */
12
+ import type { GitOrigin } from './vendor.js';
13
+ /** Directorio raíz de la caché de checkouts (`<tmp>/m-engines/<url#ref>`). */
14
+ export declare function gitCacheRoot(): string;
15
+ /** `true` cuando `git` está disponible para materializar una fuente git. */
16
+ export declare function gitAvailable(): boolean;
17
+ /** Parsea `<url>#<ref>`; el `ref` es obligatorio. */
18
+ export declare function parseFromGit(spec: string): {
19
+ url: string;
20
+ ref: string;
21
+ };
22
+ /** Carpeta de checkout (en caché) para un `url#ref`. */
23
+ export declare function gitCheckoutDir(origin: Pick<GitOrigin, 'url' | 'ref'>, cacheRoot?: string): string;
24
+ /**
25
+ * Materializa (clona + `checkout <ref>`) el repositorio y devuelve la raíz del
26
+ * checkout. Es idempotente: un checkout ya presente se reutiliza.
27
+ */
28
+ export declare function materializeGit(origin: Pick<GitOrigin, 'url' | 'ref'>, cacheRoot?: string): string;
29
+ /** Carpeta del motor dentro de un checkout (`<checkout>` o `<checkout>/<path>`). */
30
+ export declare function motorInCheckout(origin: Pick<GitOrigin, 'url' | 'ref' | 'path'>, cacheRoot?: string): string;
31
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/compose/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,8EAA8E;AAC9E,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAMvE;AAeD,wDAAwD;AACxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAGjH;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAQjH;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAG3H"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Fuentes git de un motor ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D4): `--from-git <url>#<ref>
3
+ * [--path <subdir>]`. Materializa (clona + checkout del ref) el repositorio en una
4
+ * caché por `url#ref` y devuelve la carpeta del motor, para poder vendorizarlo con
5
+ * procedencia trazable (`kind`, `origin`, `ref`, `version`, `sha256`).
6
+ *
7
+ * El registro de npm se evita a propósito: los motores viven en subárboles git (de
8
+ * pasosdejesus o de terceros) y `m` no declara dependencia de ninguno.
9
+ *
10
+ * "Porque ¿quién de vosotros, queriendo edificar una torre, no se sienta primero y calcula los gastos…?" (Lucas 14:28)
11
+ */
12
+ import { existsSync, mkdirSync } from 'node:fs';
13
+ import { createHash } from 'node:crypto';
14
+ import { spawnSync } from 'node:child_process';
15
+ import { dirname, join } from 'node:path';
16
+ import { tmpdir } from 'node:os';
17
+ /** Directorio raíz de la caché de checkouts (`<tmp>/m-engines/<url#ref>`). */
18
+ export function gitCacheRoot() {
19
+ return join(tmpdir(), 'm-engines');
20
+ }
21
+ /** `true` cuando `git` está disponible para materializar una fuente git. */
22
+ export function gitAvailable() {
23
+ const probe = spawnSync('git', ['--version'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
24
+ return probe.status === 0;
25
+ }
26
+ /** Parsea `<url>#<ref>`; el `ref` es obligatorio. */
27
+ export function parseFromGit(spec) {
28
+ const hash = spec.lastIndexOf('#');
29
+ if (hash <= 0 || hash === spec.length - 1) {
30
+ throw new Error(`--from-git necesita <url>#<ref>: ${spec}`);
31
+ }
32
+ return { url: spec.slice(0, hash), ref: spec.slice(hash + 1) };
33
+ }
34
+ function runGit(args, cwd) {
35
+ const result = spawnSync('git', args, {
36
+ cwd,
37
+ encoding: 'utf-8',
38
+ stdio: ['ignore', 'pipe', 'pipe'],
39
+ env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
40
+ });
41
+ if (result.status !== 0) {
42
+ throw new Error(`git ${args.join(' ')} falló: ${(result.stderr ?? '').toString().trim()}`);
43
+ }
44
+ return result.stdout ?? '';
45
+ }
46
+ /** Carpeta de checkout (en caché) para un `url#ref`. */
47
+ export function gitCheckoutDir(origin, cacheRoot = gitCacheRoot()) {
48
+ const key = createHash('sha256').update(`${origin.url}#${origin.ref}`).digest('hex').slice(0, 16);
49
+ return join(cacheRoot, key);
50
+ }
51
+ /**
52
+ * Materializa (clona + `checkout <ref>`) el repositorio y devuelve la raíz del
53
+ * checkout. Es idempotente: un checkout ya presente se reutiliza.
54
+ */
55
+ export function materializeGit(origin, cacheRoot = gitCacheRoot()) {
56
+ if (!gitAvailable())
57
+ throw new Error('`git` no está disponible para --from-git');
58
+ const dir = gitCheckoutDir(origin, cacheRoot);
59
+ if (existsSync(join(dir, '.git')))
60
+ return dir;
61
+ mkdirSync(dirname(dir), { recursive: true });
62
+ runGit(['clone', '--quiet', origin.url, dir]);
63
+ runGit(['checkout', '--quiet', origin.ref], dir);
64
+ return dir;
65
+ }
66
+ /** Carpeta del motor dentro de un checkout (`<checkout>` o `<checkout>/<path>`). */
67
+ export function motorInCheckout(origin, cacheRoot = gitCacheRoot()) {
68
+ const root = materializeGit(origin, cacheRoot);
69
+ return origin.path ? join(root, origin.path) : root;
70
+ }
71
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/compose/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIhC,8EAA8E;AAC9E,MAAM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AAY,EAAE;IACjH,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Composición de motores (https://gitlab.com/pasosdeJesus/m/-/work_items/39) — módulo puro.
3
+ *
4
+ * `m` es un orquestador de motores: los **descubre** (por `m-engine.json`),
5
+ * compone, verifica y aplica. Este módulo reúne las funciones puras; el CLI
6
+ * (`src/tasks/engine.ts`) es sólo *glue*.
7
+ *
8
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
9
+ */
10
+ export type { Intention, Derived, DerivedModel, DerivedViews, EngineManifest, EngineMount, EngineRef, Finding, FindingCode, SyncResult, VerifyResult, } from './manifest.js';
11
+ export { deriveFrom, deriveTables, deriveMigrations, deriveContracts, deriveViews, deriveCommands, structureTables, renderGenerated, readGenerated, GENERATED_FILENAME, GENERATED_RELATIVE, GENERATED_HEADER, } from './derive.js';
12
+ export { discoverEngines, readEngineManifest, readIntention, readPackageJson, engineClosure, } from './discover.js';
13
+ export { sync } from './sync.js';
14
+ export { verify } from './verify.js';
15
+ export { vendor, unvendor, drift, readProvenance, structureSha, type Provenance, type DriftFinding, type DriftCode, type DriftReason, type GitOrigin, } from './vendor.js';
16
+ export { parseFromGit, materializeGit, motorInCheckout, gitCheckoutDir, gitAvailable, gitCacheRoot, } from './git.js';
17
+ export { motorMigrationDir, motorMigrationFiles, planMigrationCopy, motorSeedFile, type MigrationPlan, } from './data.js';
18
+ export { tablesUsed, declaredUsage, usageReport, projectSources, type DeclaredUsage, type UsageReport, } from './usage.js';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compose/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,SAAS,EACT,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EACrD,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,GACrF,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,GAC1F,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EACxE,KAAK,aAAa,GACnB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EACtD,KAAK,aAAa,EAAE,KAAK,WAAW,GACrC,MAAM,YAAY,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Composición de motores (https://gitlab.com/pasosdeJesus/m/-/work_items/39) — módulo puro.
3
+ *
4
+ * `m` es un orquestador de motores: los **descubre** (por `m-engine.json`),
5
+ * compone, verifica y aplica. Este módulo reúne las funciones puras; el CLI
6
+ * (`src/tasks/engine.ts`) es sólo *glue*.
7
+ *
8
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
9
+ */
10
+ export { deriveFrom, deriveTables, deriveMigrations, deriveContracts, deriveViews, deriveCommands, structureTables, renderGenerated, readGenerated, GENERATED_FILENAME, GENERATED_RELATIVE, GENERATED_HEADER, } from './derive.js';
11
+ export { discoverEngines, readEngineManifest, readIntention, readPackageJson, engineClosure, } from './discover.js';
12
+ export { sync } from './sync.js';
13
+ export { verify } from './verify.js';
14
+ export { vendor, unvendor, drift, readProvenance, structureSha, } from './vendor.js';
15
+ export { parseFromGit, materializeGit, motorInCheckout, gitCheckoutDir, gitAvailable, gitCacheRoot, } from './git.js';
16
+ export { motorMigrationDir, motorMigrationFiles, planMigrationCopy, motorSeedFile, } from './data.js';
17
+ export { tablesUsed, declaredUsage, usageReport, projectSources, } from './usage.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compose/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,GAEtD,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,GAC1F,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,GAEzE,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,GAEvD,MAAM,YAAY,CAAA"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Composición de motores (https://gitlab.com/pasosdeJesus/m/-/work_items/39) — tipos puros.
3
+ *
4
+ * Un motor se describe con **dos archivos**:
5
+ * - `m-engine.json` → **intención** (a mano): montaje, motores/tablas
6
+ * que usa, capacidades, futuros renombres.
7
+ * - `m-engine.generated.ts` → **hechos derivados** (generado por `eng:sync`):
8
+ * nombre/versión, modelo, contratos, vistas, comandos.
9
+ *
10
+ * Regla de oro: lo que se **deriva** no se escribe a mano; lo que es **intención**
11
+ * (y no se puede derivar) va en `m-engine.json`.
12
+ *
13
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
14
+ */
15
+ /** Puntos de montaje del motor: prefijos de API y de rutas. Intención pura. */
16
+ export interface EngineMount {
17
+ api?: string;
18
+ route?: string;
19
+ }
20
+ /** Referencia de un motor a otro: qué tablas (y columnas) usa de él. Intención pura. */
21
+ export interface EngineRef {
22
+ /** Paquete que provee el motor (si difiere del alias). */
23
+ package?: string;
24
+ /** Subpath del modelo dentro del paquete (por defecto `model`). */
25
+ subpath?: string;
26
+ /** Subconjunto de tablas propias del motor que se usan (si se omite, todas). */
27
+ tables?: string[];
28
+ /** Subconjunto de columnas por tabla (si falta, todas). */
29
+ columns?: Record<string, string[]>;
30
+ }
31
+ /**
32
+ * `m-engine.json` — intención del motor (a mano, mínima). No repite lo derivable
33
+ * (`name`/`version` salen del `package.json`).
34
+ */
35
+ export interface Intention {
36
+ mount?: EngineMount;
37
+ /** Capacidades que ofrece el motor (reemplazabilidad, D12 de https://gitlab.com/pasosdeJesus/m/-/work_items/39). */
38
+ provides?: string[];
39
+ /** Capacidades que necesita de otros motores. */
40
+ requires?: string[];
41
+ /** Motores de los que depende y qué tablas/columnas usa de cada uno. */
42
+ engines?: Record<string, EngineRef>;
43
+ }
44
+ /** Modelo del motor: sus tablas propias, migraciones y (a futuro) prefijo. */
45
+ export interface DerivedModel {
46
+ tablePrefix?: string;
47
+ tables: string[];
48
+ migrations?: string;
49
+ }
50
+ /** Vistas del motor: componentes y directorio de assets. */
51
+ export interface DerivedViews {
52
+ components?: string[];
53
+ assets?: string;
54
+ }
55
+ /**
56
+ * `m-engine.generated.ts` — hechos **derivados** de las fuentes del paquete
57
+ * (generado por `eng:sync`; verificado por `eng:verify`). Nunca se edita a mano.
58
+ */
59
+ export interface Derived {
60
+ name: string;
61
+ version: string;
62
+ model: DerivedModel;
63
+ contracts?: string[];
64
+ commands?: string[];
65
+ views?: DerivedViews;
66
+ }
67
+ /** Manifiesto resuelto de un motor: intención + hechos + su directorio. */
68
+ export interface EngineManifest extends Intention, Derived {
69
+ dir: string;
70
+ }
71
+ /** Grado de un hallazgo de verificación (análogo a los grados D6 de conformidad). */
72
+ export type FindingCode = 'GENERATED_MISSING' | 'GENERATED_STALE' | 'MISSING_ENGINE' | 'UNKNOWN_TABLE' | 'BROKEN_REFERENCE';
73
+ export interface Finding {
74
+ code: FindingCode;
75
+ message: string;
76
+ motor?: string;
77
+ table?: string;
78
+ }
79
+ /** Resultado de `eng:sync`. */
80
+ export interface SyncResult {
81
+ path: string;
82
+ changed: boolean;
83
+ }
84
+ /** Resultado de `eng:verify`. */
85
+ export interface VerifyResult {
86
+ ok: boolean;
87
+ findings: Finding[];
88
+ }
89
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/compose/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAE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AM,WAAW,cAAe,SAAQ,SAAS,EAAE,OAAO;IACxD,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,qFAAqF;AACrF,MAAM,MAAM,WAAW,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,CAAA;AAEtB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Composición de motores (https://gitlab.com/pasosdeJesus/m/-/work_items/39) — tipos puros.
3
+ *
4
+ * Un motor se describe con **dos archivos**:
5
+ * - `m-engine.json` → **intención** (a mano): montaje, motores/tablas
6
+ * que usa, capacidades, futuros renombres.
7
+ * - `m-engine.generated.ts` → **hechos derivados** (generado por `eng:sync`):
8
+ * nombre/versión, modelo, contratos, vistas, comandos.
9
+ *
10
+ * Regla de oro: lo que se **deriva** no se escribe a mano; lo que es **intención**
11
+ * (y no se puede derivar) va en `m-engine.json`.
12
+ *
13
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/compose/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `eng:sync [<motor>] [--check]` (https://gitlab.com/pasosdeJesus/m/-/work_items/39, D3) — **genera** `m-engine.generated.ts`
3
+ * from the motor's sources. Idempotent: re-running with no source change is a
4
+ * no-op. With `--check` it writes nothing and reports whether it is stale.
5
+ *
6
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
7
+ */
8
+ import type { SyncResult } from './manifest.js';
9
+ export declare function sync(dir: string, options?: {
10
+ check?: boolean;
11
+ }): SyncResult;
12
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/compose/sync.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,UAAU,CAa/E"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `eng:sync [<motor>] [--check]` (https://gitlab.com/pasosdeJesus/m/-/work_items/39, D3) — **genera** `m-engine.generated.ts`
3
+ * from the motor's sources. Idempotent: re-running with no source change is a
4
+ * no-op. With `--check` it writes nothing and reports whether it is stale.
5
+ *
6
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
7
+ */
8
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
9
+ import { basename, dirname, join } from 'node:path';
10
+ import { GENERATED_RELATIVE, deriveFrom, renderGenerated } from './derive.js';
11
+ import { readIntention, readPackageJson } from './discover.js';
12
+ export function sync(dir, options = {}) {
13
+ if (!readIntention(dir))
14
+ throw new Error(`not a motor (no m-engine.json): ${dir}`);
15
+ const pkg = readPackageJson(dir);
16
+ const derived = deriveFrom(dir, pkg?.name ?? basename(dir), pkg?.version ?? '0.0.0', pkg);
17
+ const contents = renderGenerated(derived);
18
+ const path = join(dir, GENERATED_RELATIVE);
19
+ const existing = existsSync(path) ? readFileSync(path, 'utf-8') : null;
20
+ const changed = existing !== contents;
21
+ if (!options.check && changed) {
22
+ mkdirSync(dirname(path), { recursive: true });
23
+ writeFileSync(path, contents, 'utf-8');
24
+ }
25
+ return { path, changed };
26
+ }
27
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/compose/sync.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEnD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG9D,MAAM,UAAU,IAAI,CAAC,GAAW,EAAE,UAA+B,EAAE;IACjE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAA;IAClF,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;IAChC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,IAAI,OAAO,EAAE,GAAG,CAAC,CAAA;IACzF,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;IAC1C,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACtE,MAAM,OAAO,GAAG,QAAQ,KAAK,QAAQ,CAAA;IACrC,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,EAAE,CAAC;QAC9B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC7C,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IACxC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Autocontención (https://gitlab.com/pasosdeJesus/m/-/work_items/39 D7/§4): "lo que el proyecto usa" se deriva de sus
3
+ * **`import`/código** —las tablas de los motores que referencia— y se compara con
4
+ * lo **declarado** en su `m-engine.json` (`engines.<motor>.tables`) para reportar
5
+ * `missing`/`extra`.
6
+ *
7
+ * Herramienta: la API **sintáctica** de `tsc` (`ts.createSourceFile`, sin
8
+ * `Program`); si `typescript` no está disponible, `grep`-like por nombre. Alcance:
9
+ * `src/**` y `app/**`; `node_modules` fuera.
10
+ *
11
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
12
+ */
13
+ import { type PackageJson } from './discover.js';
14
+ export interface DeclaredUsage {
15
+ /** Unión de las tablas declaradas (`engines.<motor>.tables`). */
16
+ all: string[];
17
+ byMotor: Record<string, string[]>;
18
+ }
19
+ export interface UsageReport {
20
+ used: string[];
21
+ missing: string[];
22
+ extra: string[];
23
+ }
24
+ /** Fuentes del proyecto (`src/**`, `app/**`). */
25
+ export declare function projectSources(rootDir: string): string[];
26
+ /**
27
+ * Tablas (de `tables`) que el código del proyecto referencia. Con `typescript`
28
+ * usa el parser sintáctico (identificadores y literales de cadena); si no, un
29
+ * chequeo por nombre con límites de palabra.
30
+ */
31
+ export declare function tablesUsed(rootDir: string, tables: readonly string[]): string[];
32
+ /** Tablas declaradas por un proyecto en su `m-engine.json` (`engines.<motor>.tables`). */
33
+ export declare function declaredUsage(projectDir: string): DeclaredUsage;
34
+ /** Compara lo usado contra lo declarado: `missing` (usado y no declarado) y `extra`. */
35
+ export declare function usageReport(used: readonly string[], declared: readonly string[]): UsageReport;
36
+ export interface ImportFinding {
37
+ /** Paquete externo importado. */
38
+ name: string;
39
+ /** Archivo donde se importa (el primero que se encuentra). */
40
+ file: string;
41
+ /** `true` cuando el import está sólo en pruebas (`*.test.ts`). */
42
+ dev: boolean;
43
+ }
44
+ /** Paquete de un especificador (`@alcance/pkg/sub` → `@alcance/pkg`); `null` si es relativo o `node:`. */
45
+ export declare function packageOf(specifier: string): string | null;
46
+ /** Paquetes externos que importa un motor (`src/**`), con el archivo y si es sólo de pruebas. */
47
+ export declare function importedPackages(motorDir: string): ImportFinding[];
48
+ /**
49
+ * "El motor declara lo que usa": imports externos de `src/**` que no están en las
50
+ * `dependencies`/`peerDependencies`/`optionalDependencies` del motor (para pruebas,
51
+ * vale también `devDependencies`).
52
+ */
53
+ export declare function undeclaredImports(motorDir: string, pkg: PackageJson | null): ImportFinding[];
54
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/compose/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAE/D,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAYD,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAIxD;AAUD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAyB/E;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAQ/D;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAQ7F;AAED,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,GAAG,EAAE,OAAO,CAAA;CACb;AAED,0GAA0G;AAC1G,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK1D;AA2BD,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAelE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,GAAG,aAAa,EAAE,CAQ5F"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Autocontención (https://gitlab.com/pasosdeJesus/m/-/work_items/39 D7/§4): "lo que el proyecto usa" se deriva de sus
3
+ * **`import`/código** —las tablas de los motores que referencia— y se compara con
4
+ * lo **declarado** en su `m-engine.json` (`engines.<motor>.tables`) para reportar
5
+ * `missing`/`extra`.
6
+ *
7
+ * Herramienta: la API **sintáctica** de `tsc` (`ts.createSourceFile`, sin
8
+ * `Program`); si `typescript` no está disponible, `grep`-like por nombre. Alcance:
9
+ * `src/**` y `app/**`; `node_modules` fuera.
10
+ *
11
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
12
+ */
13
+ import { existsSync, readFileSync, readdirSync } from 'node:fs';
14
+ import { createRequire } from 'node:module';
15
+ import { join } from 'node:path';
16
+ import { readIntention } from './discover.js';
17
+ function walk(dir, acc) {
18
+ if (!existsSync(dir))
19
+ return;
20
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
21
+ if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name.startsWith('.'))
22
+ continue;
23
+ const full = join(dir, entry.name);
24
+ if (entry.isDirectory())
25
+ walk(full, acc);
26
+ else if (/\.tsx?$/.test(entry.name) && !/\.d\.ts$/.test(entry.name))
27
+ acc.push(full);
28
+ }
29
+ }
30
+ /** Fuentes del proyecto (`src/**`, `app/**`). */
31
+ export function projectSources(rootDir) {
32
+ const files = [];
33
+ for (const base of ['src', 'app'])
34
+ walk(join(rootDir, base), files);
35
+ return files;
36
+ }
37
+ function tryLoadTypescript() {
38
+ try {
39
+ return createRequire(import.meta.url)('typescript');
40
+ }
41
+ catch {
42
+ return null;
43
+ }
44
+ }
45
+ /**
46
+ * Tablas (de `tables`) que el código del proyecto referencia. Con `typescript`
47
+ * usa el parser sintáctico (identificadores y literales de cadena); si no, un
48
+ * chequeo por nombre con límites de palabra.
49
+ */
50
+ export function tablesUsed(rootDir, tables) {
51
+ const names = new Set(tables);
52
+ if (names.size === 0)
53
+ return [];
54
+ const used = new Set();
55
+ const ts = tryLoadTypescript();
56
+ for (const file of projectSources(rootDir)) {
57
+ const text = readFileSync(file, 'utf-8');
58
+ if (!ts) {
59
+ for (const name of names) {
60
+ if (new RegExp(`\\b${name}\\b`).test(text))
61
+ used.add(name);
62
+ }
63
+ continue;
64
+ }
65
+ const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true);
66
+ const visit = (node) => {
67
+ const candidate = ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)
68
+ ? node.text
69
+ : undefined;
70
+ if (candidate !== undefined && names.has(candidate))
71
+ used.add(candidate);
72
+ ts.forEachChild(node, visit);
73
+ };
74
+ visit(source);
75
+ }
76
+ return [...used].sort();
77
+ }
78
+ /** Tablas declaradas por un proyecto en su `m-engine.json` (`engines.<motor>.tables`). */
79
+ export function declaredUsage(projectDir) {
80
+ const intention = readIntention(projectDir);
81
+ const byMotor = {};
82
+ for (const [motor, ref] of Object.entries(intention?.engines ?? {})) {
83
+ if (ref.tables && ref.tables.length > 0)
84
+ byMotor[motor] = [...ref.tables];
85
+ }
86
+ const all = [...new Set(Object.values(byMotor).flat())].sort();
87
+ return { all, byMotor };
88
+ }
89
+ /** Compara lo usado contra lo declarado: `missing` (usado y no declarado) y `extra`. */
90
+ export function usageReport(used, declared) {
91
+ const usedSet = new Set(used);
92
+ const declaredSet = new Set(declared);
93
+ return {
94
+ used: [...usedSet].sort(),
95
+ missing: [...usedSet].filter((table) => !declaredSet.has(table)).sort(),
96
+ extra: [...declaredSet].filter((table) => !usedSet.has(table)).sort(),
97
+ };
98
+ }
99
+ /** Paquete de un especificador (`@alcance/pkg/sub` → `@alcance/pkg`); `null` si es relativo o `node:`. */
100
+ export function packageOf(specifier) {
101
+ if (!specifier || specifier.startsWith('.') || specifier.startsWith('/') || specifier.startsWith('node:'))
102
+ return null;
103
+ const [first, second] = specifier.split('/');
104
+ if (specifier.startsWith('@'))
105
+ return second ? `${first}/${second}` : null;
106
+ return first || null;
107
+ }
108
+ /** Especificadores de módulo de unas fuentes (import/export … from/require). */
109
+ function moduleSpecifiers(file, text, ts) {
110
+ if (!ts) {
111
+ // Fallback sin `typescript`: cuenta también el texto emitido dentro de plantillas.
112
+ const found = [];
113
+ for (const re of [/from\s+['"]([^'"]+)['"]/g, /require\(\s*['"]([^'"]+)['"]\s*\)/g]) {
114
+ for (const match of text.matchAll(re))
115
+ found.push(match[1]);
116
+ }
117
+ return found;
118
+ }
119
+ const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true);
120
+ const found = [];
121
+ const visit = (node) => {
122
+ const specifier = (ts.isImportDeclaration(node) || ts.isExportDeclaration(node))
123
+ ? node.moduleSpecifier
124
+ : (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference))
125
+ ? node.moduleReference.expression
126
+ : undefined;
127
+ if (specifier && ts.isStringLiteralLike(specifier))
128
+ found.push(specifier.text);
129
+ ts.forEachChild(node, visit);
130
+ };
131
+ visit(source);
132
+ return found;
133
+ }
134
+ /** Paquetes externos que importa un motor (`src/**`), con el archivo y si es sólo de pruebas. */
135
+ export function importedPackages(motorDir) {
136
+ const ts = tryLoadTypescript();
137
+ const byName = new Map();
138
+ for (const file of projectSources(motorDir)) {
139
+ const text = readFileSync(file, 'utf-8');
140
+ for (const specifier of moduleSpecifiers(file, text, ts)) {
141
+ const name = packageOf(specifier);
142
+ if (!name)
143
+ continue;
144
+ const dev = /\.test\.tsx?$/.test(file);
145
+ const previous = byName.get(name);
146
+ if (previous && (!previous.dev || dev))
147
+ continue;
148
+ byName.set(name, { name, file, dev });
149
+ }
150
+ }
151
+ return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
152
+ }
153
+ /**
154
+ * "El motor declara lo que usa": imports externos de `src/**` que no están en las
155
+ * `dependencies`/`peerDependencies`/`optionalDependencies` del motor (para pruebas,
156
+ * vale también `devDependencies`).
157
+ */
158
+ export function undeclaredImports(motorDir, pkg) {
159
+ const declared = new Set([
160
+ ...Object.keys(pkg?.dependencies ?? {}),
161
+ ...Object.keys(pkg?.peerDependencies ?? {}),
162
+ ...Object.keys(pkg?.optionalDependencies ?? {}),
163
+ ]);
164
+ const devDeclared = new Set([...declared, ...Object.keys(pkg?.devDependencies ?? {})]);
165
+ return importedPackages(motorDir).filter((finding) => !(finding.dev ? devDeclared : declared).has(finding.name));
166
+ }
167
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/compose/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU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,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;AAClH,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Vendorización "etapa 0" (https://gitlab.com/pasosdeJesus/m/-/work_items/39 D17): copia trazable de un motor dentro del
3
+ * consumidor (`packages/generated/<motor>`), con **procedencia** (motor, versión,
4
+ * origen y `sha256`) para poder medir **drift** contra el original. Adoptar un
5
+ * cambio del motor = **regenerar** (`eng:sync --vendor`), no fusionar a mano.
6
+ *
7
+ * "Porque ¿quién de vosotros, queriendo edificar una torre, no se sienta primero y calcula los gastos…?" (Lucas 14:28)
8
+ */
9
+ import { type PackageJson } from './discover.js';
10
+ export interface Provenance {
11
+ motor: string;
12
+ version: string;
13
+ /** Ruta local del motor (`kind: 'local'`), o `<url>#<ref>` cuando viene de git. */
14
+ source: string;
15
+ sha256: string;
16
+ /** De dónde se tomó el motor. Por defecto `local`. */
17
+ kind?: 'local' | 'git';
18
+ /** URL del repositorio cuando `kind: 'git'`. */
19
+ origin?: string;
20
+ /** Ref (rama, tag o commit) cuando `kind: 'git'`. */
21
+ ref?: string;
22
+ /** Subdirectorio del motor dentro del repositorio, cuando aplica. */
23
+ path?: string;
24
+ }
25
+ /** Origen git de un motor, para dejar la procedencia trazable (`--from-git`). */
26
+ export interface GitOrigin {
27
+ url: string;
28
+ ref: string;
29
+ path?: string;
30
+ }
31
+ /** `sha256` del esquema de referencia del motor (`db/structure.sql`), o `null`. */
32
+ export declare function structureSha(dir: string): string | null;
33
+ /**
34
+ * `tsconfig.json` de la copia vendorizada: proyecto **autónomo** (no hereda de `m`),
35
+ * de modo que cada copia se compile por separado (`tsc -b`) y no pese en el
36
+ * consumidor (mismo criterio que sus paquetes de motor, p. ej. `gdcluster`).
37
+ */
38
+ export declare function vendoredTsconfig(): string;
39
+ /** `package.json` de la copia vendorizada: paquete propio, compilable por separado. */
40
+ export declare function vendoredPackageJson(motorDir: string, pkg: PackageJson | null): string;
41
+ /**
42
+ * Motor original con el que medir el drift de una copia vendorizada: el `--from`
43
+ * (la carpeta del motor, o un checkout donde vive en `packages/<motor>`), y si no
44
+ * la `source` de la procedencia.
45
+ */
46
+ export declare function resolveOrigin(from: string | null, motorName: string, provenanceSource?: string): string | null;
47
+ /** Copia un motor a `outDir` con procedencia. Regenera: borra `outDir` primero. */
48
+ export declare function vendor(motorDir: string, outDir: string, gitOrigin?: GitOrigin): Provenance;
49
+ /** Lee la procedencia de una copia vendorizada, o `null`. */
50
+ export declare function readProvenance(outDir: string): Provenance | null;
51
+ /** Quita una copia vendorizada. Devuelve `true` si existía. */
52
+ export declare function unvendor(outDir: string): boolean;
53
+ export type DriftCode = 'ok' | 'drift' | 'absent';
54
+ /** Qué cambió respecto de la procedencia: el esquema (`sha256`) o la versión del motor. */
55
+ export type DriftReason = 'schema' | 'version';
56
+ export interface DriftFinding {
57
+ code: DriftCode;
58
+ message: string;
59
+ reason?: DriftReason;
60
+ }
61
+ /**
62
+ * Mide el drift de una copia vendorizada contra el motor original: primero el
63
+ * esquema (`sha256` de `db/structure.sql`) y después la **versión** del motor
64
+ * ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D5). Así un cambio de versión sin cambio de
65
+ * esquema también marca drift.
66
+ */
67
+ export declare function drift(outDir: string, originalDir: string): DriftFinding;
68
+ //# sourceMappingURL=vendor.d.ts.map