ddd-ts-kit 0.1.1 → 0.2.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 (609) hide show
  1. package/README.md +81 -21
  2. package/dist/alias/compiler-resolution-of.d.ts +10 -0
  3. package/dist/alias/compiler-resolution-of.d.ts.map +1 -0
  4. package/dist/alias/compiler-resolution-of.js +13 -0
  5. package/dist/alias/compiler-resolution-of.js.map +1 -0
  6. package/dist/alias/compiler-resolution.d.ts +8 -0
  7. package/dist/alias/compiler-resolution.d.ts.map +1 -0
  8. package/dist/alias/compiler-resolution.js +2 -0
  9. package/dist/alias/compiler-resolution.js.map +1 -0
  10. package/dist/alias/index.d.ts +3 -1
  11. package/dist/alias/index.d.ts.map +1 -1
  12. package/dist/alias/index.js +3 -1
  13. package/dist/alias/index.js.map +1 -1
  14. package/dist/alias/module-name-mapper.d.ts +4 -3
  15. package/dist/alias/module-name-mapper.d.ts.map +1 -1
  16. package/dist/alias/module-name-mapper.js +6 -4
  17. package/dist/alias/module-name-mapper.js.map +1 -1
  18. package/dist/alias/specifier-of.d.ts +7 -0
  19. package/dist/alias/specifier-of.d.ts.map +1 -0
  20. package/dist/alias/specifier-of.js +17 -0
  21. package/dist/alias/specifier-of.js.map +1 -0
  22. package/dist/alias/specifier-suffix.d.ts +6 -0
  23. package/dist/alias/specifier-suffix.d.ts.map +1 -0
  24. package/dist/alias/specifier-suffix.js +8 -0
  25. package/dist/alias/specifier-suffix.js.map +1 -0
  26. package/dist/alias/to-alias.d.ts +3 -2
  27. package/dist/alias/to-alias.d.ts.map +1 -1
  28. package/dist/alias/to-alias.js +4 -3
  29. package/dist/alias/to-alias.js.map +1 -1
  30. package/dist/build/emitted-place.d.ts +2 -0
  31. package/dist/build/emitted-place.d.ts.map +1 -1
  32. package/dist/build/emitted-specifier.d.ts +3 -2
  33. package/dist/build/emitted-specifier.d.ts.map +1 -1
  34. package/dist/build/emitted-specifier.js +6 -12
  35. package/dist/build/emitted-specifier.js.map +1 -1
  36. package/dist/build/emitted-target.d.ts +9 -0
  37. package/dist/build/emitted-target.d.ts.map +1 -0
  38. package/dist/build/emitted-target.js +18 -0
  39. package/dist/build/emitted-target.js.map +1 -0
  40. package/dist/build/rewrite-aliases.d.ts +5 -3
  41. package/dist/build/rewrite-aliases.d.ts.map +1 -1
  42. package/dist/build/rewrite-aliases.js +12 -7
  43. package/dist/build/rewrite-aliases.js.map +1 -1
  44. package/dist/build/rewrite-specifiers.d.ts +3 -1
  45. package/dist/build/rewrite-specifiers.d.ts.map +1 -1
  46. package/dist/build/rewrite-specifiers.js +2 -2
  47. package/dist/build/rewrite-specifiers.js.map +1 -1
  48. package/dist/build/unresolved-problem.d.ts +4 -0
  49. package/dist/build/unresolved-problem.d.ts.map +1 -0
  50. package/dist/build/unresolved-problem.js +16 -0
  51. package/dist/build/unresolved-problem.js.map +1 -0
  52. package/dist/check/alias/compiler-resolution.d.ts +10 -0
  53. package/dist/check/alias/compiler-resolution.d.ts.map +1 -0
  54. package/dist/check/alias/compiler-resolution.js +47 -0
  55. package/dist/check/alias/compiler-resolution.js.map +1 -0
  56. package/dist/check/alias/test-runners.js +4 -4
  57. package/dist/check/alias/test-runners.js.map +1 -1
  58. package/dist/check/canonical/roles.d.ts.map +1 -1
  59. package/dist/check/canonical/roles.js +6 -0
  60. package/dist/check/canonical/roles.js.map +1 -1
  61. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  62. package/dist/check/catalogue/architecture-rules.js +4 -0
  63. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  64. package/dist/check/configuration/config-inspection.d.ts +2 -0
  65. package/dist/check/configuration/config-inspection.d.ts.map +1 -1
  66. package/dist/check/configuration/config-inspection.js +11 -1
  67. package/dist/check/configuration/config-inspection.js.map +1 -1
  68. package/dist/check/declarations/classes-of.js +1 -1
  69. package/dist/check/declarations/classes-of.js.map +1 -1
  70. package/dist/check/explain/context-docs.js +7 -7
  71. package/dist/check/explain/context-docs.js.map +1 -1
  72. package/dist/check/explain/imports-docs.d.ts.map +1 -1
  73. package/dist/check/explain/imports-docs.js +24 -9
  74. package/dist/check/explain/imports-docs.js.map +1 -1
  75. package/dist/check/explain/layer-docs.js +7 -7
  76. package/dist/check/explain/layer-docs.js.map +1 -1
  77. package/dist/check/explain/ports-docs.d.ts.map +1 -1
  78. package/dist/check/explain/ports-docs.js +15 -7
  79. package/dist/check/explain/ports-docs.js.map +1 -1
  80. package/dist/check/explain/scheduling-docs.js +1 -1
  81. package/dist/check/explain/wiring-docs.d.ts.map +1 -1
  82. package/dist/check/explain/wiring-docs.js +35 -10
  83. package/dist/check/explain/wiring-docs.js.map +1 -1
  84. package/dist/check/fixtures/alias-declared-fixtures.d.ts.map +1 -1
  85. package/dist/check/fixtures/alias-declared-fixtures.js +32 -1
  86. package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
  87. package/dist/check/fixtures/config-fixtures.d.ts.map +1 -1
  88. package/dist/check/fixtures/config-fixtures.js +6 -0
  89. package/dist/check/fixtures/config-fixtures.js.map +1 -1
  90. package/dist/check/fixtures/constructor-injection-fixtures.d.ts +3 -0
  91. package/dist/check/fixtures/constructor-injection-fixtures.d.ts.map +1 -0
  92. package/dist/check/fixtures/constructor-injection-fixtures.js +111 -0
  93. package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -0
  94. package/dist/check/fixtures/declared-project.d.ts.map +1 -1
  95. package/dist/check/fixtures/declared-project.js +4 -1
  96. package/dist/check/fixtures/declared-project.js.map +1 -1
  97. package/dist/check/fixtures/extension-fixtures.d.ts +3 -0
  98. package/dist/check/fixtures/extension-fixtures.d.ts.map +1 -0
  99. package/dist/check/fixtures/extension-fixtures.js +77 -0
  100. package/dist/check/fixtures/extension-fixtures.js.map +1 -0
  101. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  102. package/dist/check/fixtures/fixtures.js +4 -0
  103. package/dist/check/fixtures/fixtures.js.map +1 -1
  104. package/dist/check/fixtures/signature-project.d.ts +11 -0
  105. package/dist/check/fixtures/signature-project.d.ts.map +1 -0
  106. package/dist/check/fixtures/signature-project.js +21 -0
  107. package/dist/check/fixtures/signature-project.js.map +1 -0
  108. package/dist/check/fixtures/signature.d.ts +13 -0
  109. package/dist/check/fixtures/signature.d.ts.map +1 -0
  110. package/dist/check/fixtures/signature.js +24 -0
  111. package/dist/check/fixtures/signature.js.map +1 -0
  112. package/dist/check/project/beside-the-sources.d.ts +5 -0
  113. package/dist/check/project/beside-the-sources.d.ts.map +1 -0
  114. package/dist/check/project/beside-the-sources.js +21 -0
  115. package/dist/check/project/beside-the-sources.js.map +1 -0
  116. package/dist/check/project/resolve-import.d.ts.map +1 -1
  117. package/dist/check/project/resolve-import.js +4 -1
  118. package/dist/check/project/resolve-import.js.map +1 -1
  119. package/dist/check/rules/clean-one-export-per-file.d.ts.map +1 -1
  120. package/dist/check/rules/clean-one-export-per-file.js +14 -8
  121. package/dist/check/rules/clean-one-export-per-file.js.map +1 -1
  122. package/dist/check/rules/config-valid.d.ts.map +1 -1
  123. package/dist/check/rules/config-valid.js +2 -1
  124. package/dist/check/rules/config-valid.js.map +1 -1
  125. package/dist/check/rules/declarations-barrel-current.d.ts.map +1 -1
  126. package/dist/check/rules/declarations-barrel-current.js +34 -32
  127. package/dist/check/rules/declarations-barrel-current.js.map +1 -1
  128. package/dist/check/rules/declarations-constructor-injection.d.ts +3 -0
  129. package/dist/check/rules/declarations-constructor-injection.d.ts.map +1 -0
  130. package/dist/check/rules/declarations-constructor-injection.js +58 -0
  131. package/dist/check/rules/declarations-constructor-injection.js.map +1 -0
  132. package/dist/check/rules/imports-alias-declared.d.ts.map +1 -1
  133. package/dist/check/rules/imports-alias-declared.js +3 -1
  134. package/dist/check/rules/imports-alias-declared.js.map +1 -1
  135. package/dist/check/rules/imports-alias-only.d.ts.map +1 -1
  136. package/dist/check/rules/imports-alias-only.js +16 -29
  137. package/dist/check/rules/imports-alias-only.js.map +1 -1
  138. package/dist/check/rules/imports-extension.d.ts +3 -0
  139. package/dist/check/rules/imports-extension.d.ts.map +1 -0
  140. package/dist/check/rules/imports-extension.js +65 -0
  141. package/dist/check/rules/imports-extension.js.map +1 -0
  142. package/dist/check/rules/ports-no-concrete-dependency.d.ts.map +1 -1
  143. package/dist/check/rules/ports-no-concrete-dependency.js +43 -15
  144. package/dist/check/rules/ports-no-concrete-dependency.js.map +1 -1
  145. package/dist/check/rules/tree-closed.js +6 -4
  146. package/dist/check/rules/tree-closed.js.map +1 -1
  147. package/dist/commands/build-aliases.d.ts.map +1 -1
  148. package/dist/commands/build-aliases.js +5 -3
  149. package/dist/commands/build-aliases.js.map +1 -1
  150. package/dist/commands/docs.d.ts.map +1 -1
  151. package/dist/commands/docs.js +17 -2
  152. package/dist/commands/docs.js.map +1 -1
  153. package/dist/commands/init.d.ts.map +1 -1
  154. package/dist/commands/init.js +5 -4
  155. package/dist/commands/init.js.map +1 -1
  156. package/dist/commit/is-derived.d.ts.map +1 -1
  157. package/dist/commit/is-derived.js +5 -2
  158. package/dist/commit/is-derived.js.map +1 -1
  159. package/dist/config/config.d.ts +2 -0
  160. package/dist/config/config.d.ts.map +1 -1
  161. package/dist/config/default-import-extension.d.ts +3 -0
  162. package/dist/config/default-import-extension.d.ts.map +1 -0
  163. package/dist/config/default-import-extension.js +3 -0
  164. package/dist/config/default-import-extension.js.map +1 -0
  165. package/dist/config/import-extensions.d.ts +3 -0
  166. package/dist/config/import-extensions.d.ts.map +1 -0
  167. package/dist/config/import-extensions.js +3 -0
  168. package/dist/config/import-extensions.js.map +1 -0
  169. package/dist/config/index.d.ts +4 -1
  170. package/dist/config/index.d.ts.map +1 -1
  171. package/dist/config/index.js +4 -1
  172. package/dist/config/index.js.map +1 -1
  173. package/dist/config/parse-config.d.ts.map +1 -1
  174. package/dist/config/parse-config.js +2 -0
  175. package/dist/config/parse-config.js.map +1 -1
  176. package/dist/config/parse-stack.d.ts.map +1 -1
  177. package/dist/config/parse-stack.js +2 -1
  178. package/dist/config/parse-stack.js.map +1 -1
  179. package/dist/config/restack-config-text.d.ts +11 -0
  180. package/dist/config/restack-config-text.d.ts.map +1 -0
  181. package/dist/config/restack-config-text.js +31 -0
  182. package/dist/config/restack-config-text.js.map +1 -0
  183. package/dist/config/serialize-config.d.ts.map +1 -1
  184. package/dist/config/serialize-config.js +3 -6
  185. package/dist/config/serialize-config.js.map +1 -1
  186. package/dist/config/stack.d.ts +8 -0
  187. package/dist/config/stack.d.ts.map +1 -1
  188. package/dist/config/stack.js +1 -0
  189. package/dist/config/stack.js.map +1 -1
  190. package/dist/config/unwritten-import-extension.d.ts +3 -0
  191. package/dist/config/unwritten-import-extension.d.ts.map +1 -0
  192. package/dist/config/unwritten-import-extension.js +3 -0
  193. package/dist/config/unwritten-import-extension.js.map +1 -0
  194. package/dist/config/written-stack.d.ts +8 -0
  195. package/dist/config/written-stack.d.ts.map +1 -0
  196. package/dist/config/written-stack.js +10 -0
  197. package/dist/config/written-stack.js.map +1 -0
  198. package/dist/declared/declared-role.d.ts.map +1 -1
  199. package/dist/declared/declared-role.js +1 -0
  200. package/dist/declared/declared-role.js.map +1 -1
  201. package/dist/declared/dependencies-file.d.ts +7 -0
  202. package/dist/declared/dependencies-file.d.ts.map +1 -0
  203. package/dist/declared/dependencies-file.js +9 -0
  204. package/dist/declared/dependencies-file.js.map +1 -0
  205. package/dist/declared/generated-drift.d.ts +7 -0
  206. package/dist/declared/generated-drift.d.ts.map +1 -0
  207. package/dist/declared/generated-drift.js +47 -0
  208. package/dist/declared/generated-drift.js.map +1 -0
  209. package/dist/declared/index.d.ts +8 -1
  210. package/dist/declared/index.d.ts.map +1 -1
  211. package/dist/declared/index.js +6 -1
  212. package/dist/declared/index.js.map +1 -1
  213. package/dist/declared/injection/class-injection.d.ts +19 -0
  214. package/dist/declared/injection/class-injection.d.ts.map +1 -0
  215. package/dist/declared/injection/class-injection.js +2 -0
  216. package/dist/declared/injection/class-injection.js.map +1 -0
  217. package/dist/declared/injection/constructor-of.d.ts +16 -0
  218. package/dist/declared/injection/constructor-of.d.ts.map +1 -0
  219. package/dist/declared/injection/constructor-of.js +33 -0
  220. package/dist/declared/injection/constructor-of.js.map +1 -0
  221. package/dist/declared/injection/context-injections.d.ts +8 -0
  222. package/dist/declared/injection/context-injections.d.ts.map +1 -0
  223. package/dist/declared/injection/context-injections.js +14 -0
  224. package/dist/declared/injection/context-injections.js.map +1 -0
  225. package/dist/declared/injection/declared-kind-of.d.ts +8 -0
  226. package/dist/declared/injection/declared-kind-of.d.ts.map +1 -0
  227. package/dist/declared/injection/declared-kind-of.js +12 -0
  228. package/dist/declared/injection/declared-kind-of.js.map +1 -0
  229. package/dist/declared/injection/exported-name-of.d.ts +4 -0
  230. package/dist/declared/injection/exported-name-of.d.ts.map +1 -0
  231. package/dist/declared/injection/exported-name-of.js +17 -0
  232. package/dist/declared/injection/exported-name-of.js.map +1 -0
  233. package/dist/declared/injection/language-types.d.ts +3 -0
  234. package/dist/declared/injection/language-types.d.ts.map +1 -0
  235. package/dist/declared/injection/language-types.js +32 -0
  236. package/dist/declared/injection/language-types.js.map +1 -0
  237. package/dist/declared/injection/local-names.d.ts +17 -0
  238. package/dist/declared/injection/local-names.d.ts.map +1 -0
  239. package/dist/declared/injection/local-names.js +41 -0
  240. package/dist/declared/injection/local-names.js.map +1 -0
  241. package/dist/declared/injection/parameter-shape.d.ts +11 -0
  242. package/dist/declared/injection/parameter-shape.d.ts.map +1 -0
  243. package/dist/declared/injection/parameter-shape.js +58 -0
  244. package/dist/declared/injection/parameter-shape.js.map +1 -0
  245. package/dist/declared/injection/raw-class-name.d.ts +7 -0
  246. package/dist/declared/injection/raw-class-name.d.ts.map +1 -0
  247. package/dist/declared/injection/raw-class-name.js +28 -0
  248. package/dist/declared/injection/raw-class-name.js.map +1 -0
  249. package/dist/declared/injection/read-constructor.d.ts +10 -0
  250. package/dist/declared/injection/read-constructor.d.ts.map +1 -0
  251. package/dist/declared/injection/read-constructor.js +2 -0
  252. package/dist/declared/injection/read-constructor.js.map +1 -0
  253. package/dist/declared/injection/read-injections.d.ts +6 -0
  254. package/dist/declared/injection/read-injections.d.ts.map +1 -0
  255. package/dist/declared/injection/read-injections.js +75 -0
  256. package/dist/declared/injection/read-injections.js.map +1 -0
  257. package/dist/declared/injection/render-injections.d.ts +11 -0
  258. package/dist/declared/injection/render-injections.d.ts.map +1 -0
  259. package/dist/declared/injection/render-injections.js +51 -0
  260. package/dist/declared/injection/render-injections.js.map +1 -0
  261. package/dist/declared/injection/rendered-injections.d.ts +8 -0
  262. package/dist/declared/injection/rendered-injections.d.ts.map +1 -0
  263. package/dist/declared/injection/rendered-injections.js +2 -0
  264. package/dist/declared/injection/rendered-injections.js.map +1 -0
  265. package/dist/declared/injection/resolve-token.d.ts +18 -0
  266. package/dist/declared/injection/resolve-token.d.ts.map +1 -0
  267. package/dist/declared/injection/resolve-token.js +46 -0
  268. package/dist/declared/injection/resolve-token.js.map +1 -0
  269. package/dist/declared/injection/resolved-token.d.ts +10 -0
  270. package/dist/declared/injection/resolved-token.d.ts.map +1 -0
  271. package/dist/declared/injection/resolved-token.js +2 -0
  272. package/dist/declared/injection/resolved-token.js.map +1 -0
  273. package/dist/declared/injection/sources.d.ts +4 -0
  274. package/dist/declared/injection/sources.d.ts.map +1 -0
  275. package/dist/declared/injection/sources.js +2 -0
  276. package/dist/declared/injection/sources.js.map +1 -0
  277. package/dist/declared/injection/token-reference.d.ts +14 -0
  278. package/dist/declared/injection/token-reference.d.ts.map +1 -0
  279. package/dist/declared/injection/token-reference.js +2 -0
  280. package/dist/declared/injection/token-reference.js.map +1 -0
  281. package/dist/declared/render-barrel.d.ts +8 -5
  282. package/dist/declared/render-barrel.d.ts.map +1 -1
  283. package/dist/declared/render-barrel.js +13 -6
  284. package/dist/declared/render-barrel.js.map +1 -1
  285. package/dist/declared/render-dependencies-file.d.ts +8 -0
  286. package/dist/declared/render-dependencies-file.d.ts.map +1 -0
  287. package/dist/declared/render-dependencies-file.js +12 -0
  288. package/dist/declared/render-dependencies-file.js.map +1 -0
  289. package/dist/depcruise/hygiene-rules.js +2 -1
  290. package/dist/depcruise/hygiene-rules.js.map +1 -1
  291. package/dist/describe/context-description.d.ts +10 -0
  292. package/dist/describe/context-description.d.ts.map +1 -1
  293. package/dist/describe/describe-context.d.ts.map +1 -1
  294. package/dist/describe/describe-context.js +2 -0
  295. package/dist/describe/describe-context.js.map +1 -1
  296. package/dist/describe/format-description.d.ts.map +1 -1
  297. package/dist/describe/format-description.js +4 -0
  298. package/dist/describe/format-description.js.map +1 -1
  299. package/dist/describe/read-projections.d.ts +5 -0
  300. package/dist/describe/read-projections.d.ts.map +1 -0
  301. package/dist/describe/read-projections.js +19 -0
  302. package/dist/describe/read-projections.js.map +1 -0
  303. package/dist/describe/reference-lines.js +9 -0
  304. package/dist/describe/reference-lines.js.map +1 -1
  305. package/dist/dev/refresh-declarations.d.ts +9 -0
  306. package/dist/dev/refresh-declarations.d.ts.map +1 -0
  307. package/dist/dev/refresh-declarations.js +28 -0
  308. package/dist/dev/refresh-declarations.js.map +1 -0
  309. package/dist/generate/access-vars.js +3 -3
  310. package/dist/generate/access-vars.js.map +1 -1
  311. package/dist/generate/kinds/context-plan.d.ts +10 -0
  312. package/dist/generate/kinds/context-plan.d.ts.map +1 -0
  313. package/dist/generate/kinds/context-plan.js +2 -0
  314. package/dist/generate/kinds/context-plan.js.map +1 -0
  315. package/dist/generate/kinds/declare-context-entries.d.ts +3 -1
  316. package/dist/generate/kinds/declare-context-entries.d.ts.map +1 -1
  317. package/dist/generate/kinds/declare-context-entries.js +4 -2
  318. package/dist/generate/kinds/declare-context-entries.js.map +1 -1
  319. package/dist/generate/kinds/extraction/service-selection.js +8 -11
  320. package/dist/generate/kinds/extraction/service-selection.js.map +1 -1
  321. package/dist/generate/kinds/job/job-vars.d.ts.map +1 -1
  322. package/dist/generate/kinds/job/job-vars.js +5 -3
  323. package/dist/generate/kinds/job/job-vars.js.map +1 -1
  324. package/dist/generate/kinds/plan-vars.d.ts +5 -0
  325. package/dist/generate/kinds/plan-vars.d.ts.map +1 -0
  326. package/dist/generate/kinds/plan-vars.js +24 -0
  327. package/dist/generate/kinds/plan-vars.js.map +1 -0
  328. package/dist/generate/kinds/projection-kind.d.ts +3 -0
  329. package/dist/generate/kinds/projection-kind.d.ts.map +1 -0
  330. package/dist/generate/kinds/projection-kind.js +72 -0
  331. package/dist/generate/kinds/projection-kind.js.map +1 -0
  332. package/dist/generate/kinds/publish-in-index.js +2 -2
  333. package/dist/generate/kinds/publish-in-index.js.map +1 -1
  334. package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
  335. package/dist/generate/kinds/route/route-vars.js +7 -6
  336. package/dist/generate/kinds/route/route-vars.js.map +1 -1
  337. package/dist/generate/kinds/wire-context.d.ts +10 -0
  338. package/dist/generate/kinds/wire-context.d.ts.map +1 -0
  339. package/dist/generate/kinds/wire-context.js +36 -0
  340. package/dist/generate/kinds/wire-context.js.map +1 -0
  341. package/dist/generate/kinds/write-context-files.d.ts +1 -8
  342. package/dist/generate/kinds/write-context-files.d.ts.map +1 -1
  343. package/dist/generate/kinds/write-context-files.js +3 -40
  344. package/dist/generate/kinds/write-context-files.js.map +1 -1
  345. package/dist/generate/kinds.d.ts.map +1 -1
  346. package/dist/generate/kinds.js +2 -0
  347. package/dist/generate/kinds.js.map +1 -1
  348. package/dist/generate/refresh-barrels.d.ts +4 -3
  349. package/dist/generate/refresh-barrels.d.ts.map +1 -1
  350. package/dist/generate/refresh-barrels.js +41 -16
  351. package/dist/generate/refresh-barrels.js.map +1 -1
  352. package/dist/generate/spec-vars.js +4 -4
  353. package/dist/generate/spec-vars.js.map +1 -1
  354. package/dist/generate/storage-vars.d.ts +2 -2
  355. package/dist/generate/storage-vars.d.ts.map +1 -1
  356. package/dist/generate/storage-vars.js +6 -10
  357. package/dist/generate/storage-vars.js.map +1 -1
  358. package/dist/generate/workspace-sources.d.ts +6 -0
  359. package/dist/generate/workspace-sources.d.ts.map +1 -0
  360. package/dist/generate/workspace-sources.js +13 -0
  361. package/dist/generate/workspace-sources.js.map +1 -0
  362. package/dist/init/manifest/scripts-for.js +6 -1
  363. package/dist/init/manifest/scripts-for.js.map +1 -1
  364. package/dist/init/manifest/versions.js +23 -23
  365. package/dist/init/run-init.d.ts.map +1 -1
  366. package/dist/init/run-init.js +32 -3
  367. package/dist/init/run-init.js.map +1 -1
  368. package/dist/init/stack/recorded-options.d.ts +11 -0
  369. package/dist/init/stack/recorded-options.d.ts.map +1 -0
  370. package/dist/init/stack/recorded-options.js +19 -0
  371. package/dist/init/stack/recorded-options.js.map +1 -0
  372. package/dist/init/stack/resolve-stack.d.ts +6 -1
  373. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  374. package/dist/init/stack/resolve-stack.js +46 -9
  375. package/dist/init/stack/resolve-stack.js.map +1 -1
  376. package/dist/init/stack/resolve-style.d.ts +3 -5
  377. package/dist/init/stack/resolve-style.d.ts.map +1 -1
  378. package/dist/init/stack/resolve-style.js +11 -3
  379. package/dist/init/stack/resolve-style.js.map +1 -1
  380. package/dist/init/stack/stack-options.d.ts +3 -0
  381. package/dist/init/stack/stack-options.d.ts.map +1 -1
  382. package/dist/init/write-agent-settings.js +4 -3
  383. package/dist/init/write-agent-settings.js.map +1 -1
  384. package/dist/init/write-type-script-configs.d.ts +2 -1
  385. package/dist/init/write-type-script-configs.d.ts.map +1 -1
  386. package/dist/init/write-type-script-configs.js +4 -4
  387. package/dist/init/write-type-script-configs.js.map +1 -1
  388. package/dist/refresh-declarations.d.ts +3 -0
  389. package/dist/refresh-declarations.d.ts.map +1 -0
  390. package/dist/refresh-declarations.js +4 -0
  391. package/dist/refresh-declarations.js.map +1 -0
  392. package/dist/run.d.ts.map +1 -1
  393. package/dist/run.js +2 -0
  394. package/dist/run.js.map +1 -1
  395. package/dist/stack/alias-vars.d.ts +2 -1
  396. package/dist/stack/alias-vars.d.ts.map +1 -1
  397. package/dist/stack/alias-vars.js +6 -3
  398. package/dist/stack/alias-vars.js.map +1 -1
  399. package/dist/version.d.ts +1 -1
  400. package/dist/version.js +1 -1
  401. package/package.json +4 -3
  402. package/templates/acl/translator.spec.ts.tpl +1 -1
  403. package/templates/adapter/adapter.declared.ts.tpl +3 -3
  404. package/templates/adapter/adapter.spec.ts.tpl +1 -1
  405. package/templates/adapter/adapter.ts.tpl +1 -1
  406. package/templates/adapter/wiring.tsyringe.tpl +3 -3
  407. package/templates/aggregate/aggregate.spec.ts.tpl +2 -2
  408. package/templates/architecture/extractable.declared.spec.ts.tpl +1 -1
  409. package/templates/architecture/extractable.manual.spec.ts.tpl +4 -4
  410. package/templates/architecture/extractable.tsyringe.spec.ts.tpl +1 -1
  411. package/templates/architecture/wiring.declared.tpl +1 -1
  412. package/templates/architecture/wiring.manual.tpl +1 -1
  413. package/templates/architecture/wiring.tsyringe.tpl +1 -1
  414. package/templates/builder/builder.ts.tpl +1 -1
  415. package/templates/command/handler.declared.ts.tpl +7 -7
  416. package/templates/command/handler.spec.buses.ts.tpl +4 -4
  417. package/templates/command/handler.spec.tsyringe.ts.tpl +5 -5
  418. package/templates/command/handler.ts.tpl +4 -4
  419. package/templates/command/wiring.manual.tpl +2 -2
  420. package/templates/command/wiring.tsyringe.tpl +3 -3
  421. package/templates/context/module.manual.ts.tpl +1 -1
  422. package/templates/context/permission-set.tpl +1 -1
  423. package/templates/context/permissions.spec.ts.tpl +1 -1
  424. package/templates/context/routes.spec.ts.tpl +1 -1
  425. package/templates/context/wiring.declared.tpl +2 -2
  426. package/templates/context/wiring.manual.tpl +1 -1
  427. package/templates/context/wiring.tsyringe.tpl +2 -2
  428. package/templates/domain-error/domain-error.spec.ts.tpl +1 -1
  429. package/templates/domain-event/domain-event.spec.ts.tpl +1 -1
  430. package/templates/domain-service/domain-service.spec.ts.tpl +1 -1
  431. package/templates/e2e/e2e.spec.ts.tpl +2 -2
  432. package/templates/entity/entity.spec.ts.tpl +1 -1
  433. package/templates/event-handler/event-handler.declared.ts.tpl +3 -3
  434. package/templates/event-handler/event-handler.spec.ts.tpl +2 -2
  435. package/templates/event-handler/event-handler.ts.tpl +1 -1
  436. package/templates/event-handler/wiring.manual.tpl +2 -2
  437. package/templates/event-handler/wiring.tsyringe.tpl +2 -2
  438. package/templates/gateway/adapter.declared.ts.tpl +3 -3
  439. package/templates/gateway/adapter.ts.tpl +2 -2
  440. package/templates/gateway/contract.spec.ts.tpl +3 -3
  441. package/templates/gateway/fake.ts.tpl +1 -1
  442. package/templates/gateway/platform-test.declared.tpl +1 -1
  443. package/templates/gateway/platform.declared.tpl +1 -1
  444. package/templates/gateway/wiring.tsyringe.tpl +3 -3
  445. package/templates/init/CLAUDE.md.tpl +5 -2
  446. package/templates/init/README.md.tpl +15 -10
  447. package/templates/init/e2e/create-credentials.jwt.ts.tpl +1 -1
  448. package/templates/init/e2e/create-credentials.keycloak.ts.tpl +1 -1
  449. package/templates/init/e2e/create-credentials.none.ts.tpl +2 -2
  450. package/templates/init/e2e/start-application.database.ts.tpl +16 -16
  451. package/templates/init/e2e/start-application.memory.ts.tpl +16 -16
  452. package/templates/init/e2e/test-environment.ts.tpl +1 -1
  453. package/templates/init/main.ts.tpl +11 -11
  454. package/templates/init/platform/audit/audit.module.manual.ts.tpl +5 -5
  455. package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +4 -4
  456. package/templates/init/platform/audit/create-audit.ts.tpl +5 -5
  457. package/templates/init/platform/audit/search-audit-entries.handler.ts.tpl +1 -1
  458. package/templates/init/platform/audit/search-audit-entries.route.ts.tpl +1 -1
  459. package/templates/init/platform/auth/authorization.tsyringe.ts.tpl +2 -2
  460. package/templates/init/platform/auth/create-authenticator.jwt.ts.tpl +1 -1
  461. package/templates/init/platform/auth/create-authenticator.keycloak.ts.tpl +1 -1
  462. package/templates/init/platform/auth/create-authenticator.none.ts.tpl +2 -2
  463. package/templates/init/platform/auth/create-authorizer.abac.ts.tpl +1 -1
  464. package/templates/init/platform/auth/create-authorizer.custom.ts.tpl +2 -2
  465. package/templates/init/platform/auth/create-authorizer.rbac.ts.tpl +1 -1
  466. package/templates/init/platform/auth/create-authorizer.rebac.ts.tpl +3 -3
  467. package/templates/init/platform/auth/create-tuple-store.contract.spec.ts.tpl +1 -1
  468. package/templates/init/platform/auth/custom-authorizer.contract.spec.ts.tpl +1 -1
  469. package/templates/init/platform/auth/http-boundary.ts.tpl +1 -1
  470. package/templates/init/platform/auth/permission-mapping.ts.tpl +1 -1
  471. package/templates/init/platform/auth/permissions.ts.tpl +1 -1
  472. package/templates/init/platform/auth/principal-of.none.ts.tpl +1 -1
  473. package/templates/init/platform/auth/relate-system-actors.ts.tpl +1 -1
  474. package/templates/init/platform/auth/relation-tuples.ts.tpl +2 -2
  475. package/templates/init/platform/auth/security-schemes.none.ts.tpl +1 -1
  476. package/templates/init/platform/buses/create-command-bus.ts.tpl +2 -2
  477. package/templates/init/platform/buses/create-query-bus.ts.tpl +1 -1
  478. package/templates/init/platform/compose-application.manual.ts.tpl +6 -6
  479. package/templates/init/platform/compose-application.tsyringe.ts.tpl +10 -10
  480. package/templates/init/platform/config/app-config.ts.tpl +2 -2
  481. package/templates/init/platform/config/load-config.ts.tpl +3 -3
  482. package/templates/init/platform/create-platform.manual.ts.tpl +16 -16
  483. package/templates/init/platform/database/create-client.prisma.ts.tpl +1 -1
  484. package/templates/init/platform/database/create-data-source.typeorm.ts.tpl +1 -1
  485. package/templates/init/platform/database/data-source.typeorm.ts.tpl +1 -1
  486. package/templates/init/platform/database/database.drizzle.ts.tpl +1 -1
  487. package/templates/init/platform/database/database.prisma.ts.tpl +2 -2
  488. package/templates/init/platform/database/inert-persistence.memory.ts.tpl +2 -2
  489. package/templates/init/platform/database/inert-persistence.pooled.ts.tpl +2 -2
  490. package/templates/init/platform/database/inert-persistence.prisma.ts.tpl +3 -3
  491. package/templates/init/platform/database/inert-persistence.typeorm.ts.tpl +3 -3
  492. package/templates/init/platform/database/open-persistence.contract.spec.ts.tpl +1 -1
  493. package/templates/init/platform/database/open-persistence.memory.ts.tpl +1 -1
  494. package/templates/init/platform/database/open-persistence.pooled.ts.tpl +3 -3
  495. package/templates/init/platform/database/open-persistence.prisma.ts.tpl +3 -3
  496. package/templates/init/platform/database/open-persistence.typeorm.ts.tpl +3 -3
  497. package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +4 -4
  498. package/templates/init/platform/database/open-test-database.knex.ts.tpl +5 -5
  499. package/templates/init/platform/database/open-test-database.prisma.ts.tpl +4 -4
  500. package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +3 -3
  501. package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +2 -2
  502. package/templates/init/platform/database/persistence-over.knex.ts.tpl +2 -2
  503. package/templates/init/platform/database/persistence-over.prisma.ts.tpl +2 -2
  504. package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +2 -2
  505. package/templates/init/platform/database/persistence.orm.ts.tpl +1 -1
  506. package/templates/init/platform/errors.ts.tpl +1 -1
  507. package/templates/init/platform/events/create-event-provider.custom.ts.tpl +2 -2
  508. package/templates/init/platform/events/create-event-provider.kafka.ts.tpl +3 -3
  509. package/templates/init/platform/events/create-event-provider.nats.ts.tpl +2 -2
  510. package/templates/init/platform/events/create-event-provider.rabbitmq.ts.tpl +2 -2
  511. package/templates/init/platform/events/create-event-provider.redis.ts.tpl +2 -2
  512. package/templates/init/platform/events/custom-event-bus.contract.spec.ts.tpl +1 -1
  513. package/templates/init/platform/events/in-process-events.ts.tpl +1 -1
  514. package/templates/init/platform/events/start-outbox-relay.ts.tpl +1 -1
  515. package/templates/init/platform/http/create-app-module.ts.tpl +1 -1
  516. package/templates/init/platform/http/start-http-server.express.ts.tpl +4 -4
  517. package/templates/init/platform/http/start-http-server.fastify.ts.tpl +4 -4
  518. package/templates/init/platform/http/start-http-server.nest.ts.tpl +5 -5
  519. package/templates/init/platform/http/with-documentation.ts.tpl +2 -2
  520. package/templates/init/platform/lay-foundations.tsyringe.ts.tpl +5 -5
  521. package/templates/init/platform/platform-test.module.tsyringe.ts.tpl +1 -1
  522. package/templates/init/platform/platform.manual.ts.tpl +3 -3
  523. package/templates/init/platform/platform.module.tsyringe.ts.tpl +8 -8
  524. package/templates/init/platform/resilience/adapter-aspects.ts.tpl +2 -2
  525. package/templates/init/platform/resilience/default-resilience.ts.tpl +1 -1
  526. package/templates/init/platform/resilience/own-policy.ts.tpl +1 -1
  527. package/templates/init/platform/tracing.ts.tpl +2 -2
  528. package/templates/init/rules/application.md.tpl +8 -2
  529. package/templates/init/rules/infrastructure.md.tpl +3 -3
  530. package/templates/init/scripts/openapi.ts.tpl +5 -5
  531. package/templates/integration-event/audited.tpl +1 -1
  532. package/templates/integration-event/integration-event.class-validator.ts.tpl +1 -1
  533. package/templates/integration-event/integration-event.custom.ts.tpl +1 -1
  534. package/templates/integration-event/publisher.declared.ts.tpl +4 -4
  535. package/templates/integration-event/publisher.spec.ts.tpl +2 -2
  536. package/templates/integration-event/publisher.ts.tpl +2 -2
  537. package/templates/integration-event/wiring.manual.tpl +2 -2
  538. package/templates/integration-event/wiring.tsyringe.tpl +2 -2
  539. package/templates/integration-handler/integration-handler.declared.ts.tpl +3 -3
  540. package/templates/integration-handler/integration-handler.spec.ts.tpl +2 -2
  541. package/templates/integration-handler/integration-handler.ts.tpl +1 -1
  542. package/templates/integration-handler/wiring.manual.tpl +3 -3
  543. package/templates/integration-handler/wiring.tsyringe.tpl +2 -2
  544. package/templates/job/job.declared.ts.tpl +3 -3
  545. package/templates/job/job.spec.buses.ts.tpl +2 -2
  546. package/templates/job/job.spec.tsyringe.ts.tpl +2 -2
  547. package/templates/job/job.ts.tpl +1 -1
  548. package/templates/job/wiring.manual.tpl +1 -1
  549. package/templates/job/wiring.tsyringe.tpl +1 -1
  550. package/templates/pipeline/package-scripts.json +1 -1
  551. package/templates/policy/policy.declared.ts.tpl +1 -1
  552. package/templates/policy/policy.spec.declared.ts.tpl +1 -1
  553. package/templates/policy/policy.spec.ts.tpl +1 -1
  554. package/templates/policy/policy.ts.tpl +1 -1
  555. package/templates/policy/registration.tpl +1 -1
  556. package/templates/port/fake.ts.tpl +1 -1
  557. package/templates/projection/projection.spec.ts.tpl +17 -0
  558. package/templates/projection/projection.ts.tpl +11 -0
  559. package/templates/query/handler.declared.ts.tpl +4 -4
  560. package/templates/query/handler.spec.buses.ts.tpl +5 -5
  561. package/templates/query/handler.spec.tsyringe.ts.tpl +6 -6
  562. package/templates/query/handler.ts.tpl +3 -3
  563. package/templates/query/query.ts.tpl +1 -1
  564. package/templates/query/reader.fake.ts.tpl +2 -2
  565. package/templates/query/reader.in-memory.ts.tpl +4 -4
  566. package/templates/query/reader.port.ts.tpl +2 -2
  567. package/templates/query/search.handler.declared.ts.tpl +6 -6
  568. package/templates/query/search.handler.spec.buses.ts.tpl +5 -5
  569. package/templates/query/search.handler.spec.tsyringe.ts.tpl +6 -6
  570. package/templates/query/search.handler.ts.tpl +4 -4
  571. package/templates/query/search.query.ts.tpl +1 -1
  572. package/templates/query/search.reader.fake.ts.tpl +2 -2
  573. package/templates/query/search.reader.in-memory.ts.tpl +3 -3
  574. package/templates/query/search.reader.port.ts.tpl +1 -1
  575. package/templates/query/search.reader.spec.ts.tpl +2 -2
  576. package/templates/query/search.wiring.manual.tpl +3 -3
  577. package/templates/query/search.wiring.tsyringe.tpl +4 -4
  578. package/templates/query/wiring.manual.tpl +3 -3
  579. package/templates/query/wiring.tsyringe.tpl +4 -4
  580. package/templates/repository/contract.spec.ts.tpl +5 -5
  581. package/templates/repository/drizzle/mapper.ts.tpl +2 -2
  582. package/templates/repository/drizzle/repository.ts.tpl +9 -17
  583. package/templates/repository/drizzle/schema-export.tpl +1 -1
  584. package/templates/repository/fake.ts.tpl +2 -2
  585. package/templates/repository/knex/mapper.ts.tpl +2 -2
  586. package/templates/repository/knex/repository.ts.tpl +10 -30
  587. package/templates/repository/knex/schema-export.tpl +1 -1
  588. package/templates/repository/knex/tables.ts.tpl +1 -1
  589. package/templates/repository/none/repository.ts.tpl +3 -3
  590. package/templates/repository/prisma/mapper.ts.tpl +2 -2
  591. package/templates/repository/prisma/repository.ts.tpl +6 -9
  592. package/templates/repository/repository.ts.tpl +1 -1
  593. package/templates/repository/typeorm/mapper.ts.tpl +2 -2
  594. package/templates/repository/typeorm/repository.ts.tpl +9 -12
  595. package/templates/repository/typeorm/schema-export.tpl +1 -1
  596. package/templates/repository/typeorm/table.tpl +1 -1
  597. package/templates/repository/wiring.manual.tpl +1 -1
  598. package/templates/repository/wiring.tsyringe.tpl +2 -2
  599. package/templates/route/route.search.ts.tpl +1 -1
  600. package/templates/route/route.spec.ts.tpl +1 -1
  601. package/templates/route/routes.on-tsyringe.tpl +1 -1
  602. package/templates/route/wiring.manual.tpl +1 -1
  603. package/templates/service/main.ts.tpl +11 -11
  604. package/templates/value-object/value-object.spec.ts.tpl +1 -1
  605. package/templates/worker/main.ts.tpl +9 -9
  606. package/dist/alias/platform-alias.d.ts +0 -4
  607. package/dist/alias/platform-alias.d.ts.map +0 -1
  608. package/dist/alias/platform-alias.js +0 -7
  609. package/dist/alias/platform-alias.js.map +0 -1
package/README.md CHANGED
@@ -49,6 +49,7 @@ ddd-ts-kit init [--http express|fastify|nest|none]
49
49
  [--style declared|explicit] [--assembly barrel|discovery]
50
50
  [--package-manager npm|pnpm]
51
51
  [--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
52
+ [--import-extension none|js]
52
53
  [--context <name>:<core|supporting|generic>]...
53
54
  [--dry-run] [--force]
54
55
  ```
@@ -62,6 +63,22 @@ left alone, `--force` included. An existing `package.json` is merged: missing sc
62
63
  dependencies are added, yours are kept and mentioned in the notes. Run again later, `init` keeps
63
64
  the stack recorded in the config.
64
65
 
66
+ `init --force` on a project that is already initialised rewrites the files `init` owns and keeps
67
+ the config: the contexts and their upstreams, the rules, the limits, the deviations and every
68
+ other key stay as written, and the stack changes only where a flag names a choice
69
+ (`init --force --logger pino` changes the logger; a combination the recorded stack cannot take
70
+ is refused as for a new project). The composition root, the proof that each context wires alone
71
+ and the registry of permissions are rewritten from their templates, then the declared contexts
72
+ are wired into them again; what another generator had added to a file of the platform (the
73
+ value of a gateway, the settings of a job) is not, and a note says so. A config that cannot be
74
+ read is replaced.
75
+
76
+ An import of a file of the project is written without an extension
77
+ (`@/contexts/billing/domain/aggregates/invoice.aggregate`): `init` records
78
+ `"importExtension": "none"`, and `--import-extension js` asks for the `.js` of the emitted file
79
+ instead. A config without the key is read as `js`, so a project generated before the key
80
+ existed keeps its spelling. See [docs/CONFIG.md](../../docs/CONFIG.md).
81
+
65
82
  Defaults: `express`, `zod`, `tsyringe` (`nest` with `--http nest`, and only then), `vitest`,
66
83
  `drizzle` on `postgres`, `outbox` when there is an ORM, `swagger`, `github`, `jwt`, `rbac`, no broker,
67
84
  the cache in the process, the audit trail `on` when there is an ORM, unexpected failures reported
@@ -101,9 +118,23 @@ A config written before `stack.style` existed is explicit.
101
118
  **A port is an abstract class and its own injection token.** `application/ports/<name>.port.ts`
102
119
  and `domain/repositories/<name>.repository.ts` hold one abstract class each. Generated code holds
103
120
  no `token()`, no UPPER_SNAKE injection constant, no `<context>.ports.ts` and no
104
- `platform/tokens.ts`: a dependency list names port classes (`[InvoiceRepository, IdGenerator, Clock]`),
105
- kernel ports are value imports wherever they are named in a list or a binding, an adapter
106
- `implements` its port. Every generated file exports one class, interface or function and is named
121
+ `platform/tokens.ts`: a constructor parameter typed by a port class names what is injected
122
+ (`private readonly clock: Clock`), kernel ports are value imports wherever they are named in a
123
+ list or a binding and type imports where they only type a parameter, an adapter `implements`
124
+ its port.
125
+
126
+ **The constructor states the dependencies.** In the declared style a generated class lists
127
+ nothing in its decorator (`@CommandHandler(IssueInvoiceCommand)`): each constructor parameter
128
+ is typed by one class, its token (`declarations/constructor-injection`). `generate`, `docs` and
129
+ the `dev` script read the signatures, with the zero-dependency scanner of the checker and no
130
+ compiler, and write `injected(Class, [Tokens])` statements in the generated file of each
131
+ context: the barrel `<context>.declarations.ts`, or `<context>.dependencies.ts` under
132
+ discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
133
+ is absent with standard decorators and under `tsx`. `init` writes
134
+ `"stack.dependencies": "signature"`; a config without the key is `listed`, the 0.1 form
135
+ (`@CommandHandler(M, [Ports])`), which keeps working untouched, and
136
+ `--dependencies listed` asks for it. The explicit style stays explicit: its module file lists
137
+ what each class is given. Every generated file exports one class, interface or function and is named
107
138
  after it.
108
139
 
109
140
  **Domain events leave with the save.** A generated command handler builds or loads its aggregate,
@@ -164,7 +195,7 @@ to its lists, everything else is kept, and the notes of the command list what wa
164
195
  denied and `Read(!./.env.example)`, a negation placed after it in the same list, takes the
165
196
  example file back out.
166
197
 
167
- Every `.ts` file `init` and `generate` write imports by the alias (`@/platform/errors.js`),
198
+ Every `.ts` file `init` and `generate` write imports by the alias (`@/platform/errors`),
168
199
  never by a relative path; the barrel and a published-language index re-export by it too.
169
200
 
170
201
  Scripts: `dev` (`tsx watch`, which resolves an alias from the `paths` of `tsconfig.json`,
@@ -210,6 +241,7 @@ ddd-ts-kit generate --help --json
210
241
  | `integration-event` | `<context> <Aggregate> <Fact> [--version n]` | `defineIntegrationEvent` declaration in the published language (its payload in `<event>.v<n>.payload.ts` with class-validator or a schema of your own), index export, the publisher `application/integration/publishers/<event>.publisher.ts`, spec, registration, a line of `platform/audit/audited-events.ts` |
211
242
  | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>` | `application/integration/handlers/<name>.integration-handler.ts`, a class `<Name>IntegrationHandler` depending on `CommandBus`, its spec, its idempotent subscription under the consumer name `<context>.<name>`; refused unless the upstream is declared |
212
243
  | `event-handler` | `<context> <Aggregate> <Fact> [--phase after-commit]` | reaction to a domain event of the context, spec, subscription; before the commit of the unit of work by default, after it with `--phase after-commit` (an effect no transaction covers, at most once), and the spec runs the reaction in that phase |
244
+ | `projection` (`projector`) | `<context> <Name> <event-type>` | a projector in `application/projections/<name>.projection.ts`, declared with `@Projection('<context>.<name>')` and one `@On(definition)` method for the integration event, which the context itself or a declared upstream publishes, and its spec; declared style only. It keeps one read model: its port is received in the constructor |
213
245
  | `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, a class `<Name>Job implements ScheduledJob` that sends the command, as `systemActor('<context>.<name>')` when it is protected, with `execution.scheduledAt` when the command takes it; `test/unit/<name>.job.spec.ts`, which runs the job (by name on tsyringe, `application.jobs.runNow`; `job.run(occurrence)` with hand wiring) and asserts the command it sent; its registration; its switch in `platform/job-settings.ts`; the grant of its system actor (below) |
214
246
  | `acl` | `<context> <upstreamOrSystemName>` | translator in `infrastructure/anti-corruption/`, spec |
215
247
  | `e2e` | `<context> <UseCaseName>` | `test/e2e/<use-case>.e2e.spec.ts` driving the route of the use case: 401 without a credential, 403 without the permission, the documented status with it; for a command, one more test asserts the trace of the request, exact on names and structure, with `installTestTracing()` and `expectSpanTree(storyOf(trace), [...])` of `@ddd-ts-kit/tracing/testing` (`POST /invoices`, then `command IssueInvoiceCommand`, then `repository InvoiceRepository.save`); needs the route |
@@ -222,17 +254,17 @@ ddd-ts-kit generate --help --json
222
254
 
223
255
  - **The declared style, kind by kind.** No token anywhere: a list names port classes. `command`
224
256
  and `query` put `@Requires(<permissions>[...])` or `@Public()` on the message and
225
- `@CommandHandler(Message, [InvoiceRepository, IdGenerator, Clock])` or
257
+ `@CommandHandler(Message)` or
226
258
  `@QueryHandler(Message, [<UseCase>Reader])` on the handler; `repository` writes
227
259
  `@Repository(InvoiceRepository, [<storage>, ExecutionScope, Clock])`, the storage being
228
260
  `Database` of the platform (drizzle, prisma), `KnexContext` or `TypeOrmContext`; the in-memory
229
261
  adapter of a read port is `in-memory-<name>-reader.repository.ts`, a role file with
230
262
  `@Repository(<UseCase>Reader)`; `integration-handler` writes
231
- `@IntegrationEventHandler(definition, { consumer }, [CommandBus])` and is refused when the
263
+ `@IntegrationEventHandler(definition, { consumer })` and is refused when the
232
264
  upstream does not declare the event; `event-handler` and the publisher of `integration-event`
233
265
  write `@DomainEventHandler(Event, { name })` (the publisher with
234
266
  `[IntegrationEventPublisher, IdGenerator]`), and both are found like any role file: the
235
- composition root lists no publisher; `job` writes `@Scheduled('<context>.<name>', schedule, [CommandBus])`;
267
+ composition root lists no publisher; `job` writes `@Scheduled('<context>.<name>', schedule)`;
236
268
  `policy` writes a class with `@Policy(permission, { name })` and registers nothing; `gateway`
237
269
  writes `@Gateway(<Name>Gateway, [<Name>Contract])` and binds the upstream value in the marker
238
270
  regions of `platform/platform.module.ts` and `platform/platform-test.module.ts`: a value or a
@@ -271,8 +303,16 @@ ddd-ts-kit generate --help --json
271
303
  relationship schema or a permission the generator cannot read, nothing is written and the job
272
304
  file carries the `TODO(domain)` naming the actor and the permission.
273
305
  - **The barrel is derived.** `<context>.declarations.ts` holds one `export *` per role file, sorted
274
- by path. Every `generate`, and `docs`, rewrite it; `docs --check` and `check`
275
- (`declarations/barrel-current`) report one that a role file written by hand left behind.
306
+ by path, then one `injected(Class, [Tokens])` per class whose constructor takes something,
307
+ read from its signature, with the imports they need. Every `generate`, and `docs`, rewrite it;
308
+ `docs --check` and `check` (`declarations/barrel-current`) report one that a role file written
309
+ by hand left behind or whose constructor changed since, naming the class
310
+ (`stale src/contexts/billing/billing.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
311
+ The `dev` script loads `ddd-ts-kit/dist/refresh-declarations.js` before the application, on
312
+ every start and reload of `tsx watch`: a port added to a constructor is injected on the
313
+ reload that follows the save. The same module is the binary `ddd-ts-kit-refresh-declarations`.
314
+ It is laid out as Biome lays it out at a line width of 120; a project that formats at another
315
+ width leaves `**/*.declarations.ts` and `**/*.dependencies.ts` out of its formatter.
276
316
  - **Deny by default.** `command` and `query` are refused without `--permission` or `--public`. A new
277
317
  permission joins `<context>.permissions.ts`; its words are checked against the glossary like any
278
318
  other name. With `--authz rebac` the requirement names the context as its resource, a starting
@@ -349,7 +389,9 @@ Regenerates what is derived from the config and the code, and nothing else:
349
389
  kept; on first creation the four written sections are laid out with hints.
350
390
  - the generated lists of every `CONTEXT.md` (aggregates, published events, permissions, scheduled
351
391
  jobs as a table of name, schedule and command, relationships);
352
- - the barrel of every declared context, `<context>.declarations.ts`;
392
+ - the generated file of every declared context: the barrel `<context>.declarations.ts`, with
393
+ what each constructor is injected, read from its signature, or under discovery
394
+ `<context>.dependencies.ts`, which holds that alone;
353
395
  - the reference of every `CONTEXT.md`: the facts of `describe`, as tables under `## Reference`,
354
396
  between `ddd-ts-kit:reference` markers; a `CONTEXT.md` that has no such section gets it after its
355
397
  last generated list;
@@ -378,10 +420,14 @@ ddd-ts-kit build-aliases [--project <tsconfig>]
378
420
  ```
379
421
 
380
422
  The second step of `npm run build`, after the compiler. The compiler emits an import alias as
381
- it was written (`@/platform/errors.js`), and Node resolves no alias: this command rewrites, in
382
- every `.js`, `.mjs`, `.cjs`, `.d.ts`, `.d.mts` and `.d.cts` under the output directory of the
383
- tsconfig (`tsconfig.build.json` by default), each alias specifier into the relative path of the
384
- emitted file it names, so that `node dist/src/main.js` runs with no loader and no flag.
423
+ it was written (`@/platform/errors`), and Node resolves no alias and completes no extension:
424
+ this command rewrites, in every `.js`, `.mjs`, `.cjs`, `.d.ts`, `.d.mts` and `.d.cts` under the
425
+ output directory of the tsconfig (`tsconfig.build.json` by default), each alias specifier into
426
+ the relative path of the emitted file it names, with its `.js` extension
427
+ (`../../platform/errors.js`), so that `node dist/src/main.js` runs with no loader and no flag.
428
+ It reads `importAlias` and `importExtension` of the config: `@/platform/errors` names
429
+ `platform/errors.js` under `none`, `@/platform/errors.js` names it under `js`, and no other
430
+ spelling is guessed.
385
431
 
386
432
  - Rewritten: the specifier of `import ... from`, `export ... from`, a bare `import`,
387
433
  `import('...')` and `require('...')` with a string literal, `import.meta.resolve('...')`, and
@@ -390,9 +436,13 @@ emitted file it names, so that `node dist/src/main.js` runs with no loader and n
390
436
  code, a comment, a template or a regular expression, is left alone. Lines never move and the
391
437
  source maps are not touched.
392
438
  - Idempotent: a second run rewrites nothing.
393
- - It exits 2 and writes nothing when an alias names no emitted file, when `import()` is given
394
- an alias completed at run time (a template with an interpolation, a concatenation), or when
395
- the output directory does not exist.
439
+ - It exits 2 and writes nothing when an alias names no emitted file, when it names a directory
440
+ (an alias names one file: `.../published-language/index`), when it is written in the spelling
441
+ the config does not ask for, when `import()` is given an alias completed at run time (a
442
+ template with an interpolation, a concatenation), or when the output directory does not
443
+ exist. Each refusal says the file, the line and what to write instead.
444
+ - A package is never touched, whatever its subpath ends with (`zod/v4/core.js`,
445
+ `@scope/package/file.js`, `node:fs`).
396
446
 
397
447
  `--json` answers `{ outDir, files, changed, specifiers }`. `ddd-ts-kit check` reports a script
398
448
  that compiles without this step (`imports/alias-declared`). The whole mechanism:
@@ -559,8 +609,9 @@ saying what to do instead. Exit code 1 when there is at least one error.
559
609
  | `clean/file-size` | a file of more than 350 lines, sources and tests; a path with a segment `generated` and declaration files are exempt |
560
610
  | `composition/only-in-module` | `new X`, or `bind(..).toClass(X, ..)` and `rebind(..).toClass(X, ..)`, of a class imported from `infrastructure/`, outside the module file, `main.ts`, the platform and tests; in a file importing `@ddd-ts-kit/di`, a call of `contextModule`, `discoverContext` or `.include(` outside those places and `apps/<context>/main.ts` |
561
611
  | `imports/alias-only` | under the source root, `test/` and `scripts/`: an `import`, `export ... from` or `import()` with a relative specifier, the same directory included (the fix names the alias to write; `eslint --fix` writes it); an alias specifier with a `.` or `..` segment |
562
- | `imports/alias-declared` | an `importAlias` that is not `@/` or `$<name>/`, or that is `$test/`, `$scripts/`, `$generated/`; a `paths` entry of `tsconfig.json` missing or different from what `importAlias` gives (the fix gives the entry); another `paths` entry under an alias; a `baseUrl`; a `tsconfig.build.json` whose `paths` differ; `paths` of `knip.json` mapping an alias; a script that compiles (`tsc` without `--noEmit`) and does not run `ddd-ts-kit build-aliases` afterwards; a script running `tsx --tsconfig` on another file; a `vitest` config at the root without `tsconfigPaths: true`, a `jest` config without the derived `moduleNameMapper` entries, or `.dependency-cruiser.cjs` without `tsConfig`. A project without `package.json` is not judged |
563
- | `config/valid` | unknown upstream, classification, relationship, rule id or `guard` mode; a context missing on disk or in the config; a `commit` limit that is not a positive integer |
612
+ | `imports/extension` | under the source root, `test/` and `scripts/`: with `importExtension` `none`, an alias specifier that ends with `.js`, `.mjs`, `.cjs`, `.ts`, `.mts` or `.cts`, or that names a directory holding an `index.ts`; with `js` (or no key), an alias specifier that does not end with `.js` (the fix names the specifier to write; `eslint --fix` writes it). A package subpath is never judged |
613
+ | `imports/alias-declared` | an `importAlias` that is not `@/` or `$<name>/`, or that is `$test/`, `$scripts/`, `$generated/`; a `paths` entry of `tsconfig.json` missing or different from what `importAlias` gives (the fix gives the entry); another `paths` entry under an alias; a `baseUrl`; a `tsconfig.build.json` whose `paths` differ; `paths` of `knip.json` mapping an alias; a script that compiles (`tsc` without `--noEmit`) and does not run `ddd-ts-kit build-aliases` afterwards; a script running `tsx --tsconfig` on another file; a `vitest` config at the root without `tsconfigPaths: true`, a `jest` config without the derived `moduleNameMapper` entries, or `.dependency-cruiser.cjs` without `tsConfig`; `module` and `moduleResolution` of `tsconfig.json` (or of a `tsconfig.build.json` that sets its own) that are not what `importExtension` gives: `ESNext`, `Bundler` and `customConditions` holding `node` under `none`, and under `js` a written value that is not a Node resolution; a jest mapping whose pattern does not end as the imports do. A project without `package.json` is not judged |
614
+ | `config/valid` | unknown upstream, classification, relationship, rule id, `guard` mode or `importExtension`; a context missing on disk or in the config; a `commit` limit that is not a positive integer |
564
615
  | `config/suppression-needs-reason` | a suppression without a rule id or a reason (kept as an alias next to `governance/recorded-deviation`, which judges the reason) |
565
616
  | `authz/declared` | in a module file, `builder.command(X)` or `builder.query(X)` without `.requires(` or `.public(` in its chain, unless the message class carries `@Requires` or `@Public` of `@ddd-ts-kit/kernel/declarations`; with manual or nest wiring, a command or query class absent from every `requires(X, ...)` and `publicUseCase(X)` of the module file and of `application/authorization/`; a `defineRoute` without `security` (the route type refuses it already, and an empty list too: this is the text-level net for a definition built loosely); in the declared style, the exported class of a `*.command.ts` or `*.query.ts` file carrying neither `@Requires` nor `@Public` |
566
617
  | `authz/in-application` | `presentation/`: a test on roles, `isAdmin`, the import of an authorizer or of `Access`; `infrastructure/`: `authorize(` or `check(` on an authorizer or access, `ForbiddenError`; `domain/`: any import of `@ddd-ts-kit/auth`, of the actor types of the kernel (`Actor`, `ActorContext`, `Session`, `ExecutionContext`, the authorized messages), a read of `.roles` or `.permissions` on an actor. The request glue of `@ddd-ts-kit/auth` (`actorOf`, `sessionOf`, `resolveSession`, `SessionAuthenticator`) is free in `presentation/`. `presentation/` and `infrastructure/`: the import of `Requires`, `Public` or `Policy` from `@ddd-ts-kit/kernel/declarations`, or of the ports `Access` and `PolicyAccess` from `@ddd-ts-kit/auth`; they are free in `application/` |
@@ -575,11 +626,12 @@ saying what to do instead. Exit code 1 when there is at least one error.
575
626
  | `context/extractable` | a module file importing another context outside its published language; persistence importing another context's infrastructure or naming its schema; a handler importing another context's repository; `export let` or an exported `new Map`, `Set`, `WeakMap` at module level; `deployable: true` without `apps/<context>/main.ts`; in the declared style, a role file importing anything of a port file of another context |
576
627
  | `governance/recorded-deviation` | a `ddd-ts-kit-disable` or `eslint-disable` comment whose reason names no `ADR-<number>` with a file `docs/adr/<number>-*.md`; a rule set to `off` (or to `warn` below its default), an extra directory, an extra allowed package, a `guard` other than `enforce` or `stack.events` off the outbox, without a `deviations` entry `{ what, adr, reason }` pointing to an existing record |
577
628
  | `declarations/role-declared` | declared style only: a role file (other than `*.command.ts` and `*.query.ts`, held by `authz/declared`; `*.job.ts` under `application/scheduling/` with `@Scheduled` and `*.publisher.ts` with `@DomainEventHandler` are roles) exporting no class with the decorator of its suffix and folder, or one carrying another declaration; a declared class in a file that is not a role file; a `consumer` or `name` option that is missing, empty, a variable, a concatenation or a template with a substitution; a `@DomainEventHandler` name that differs from the `name` literal of the imported event class; any declaration decorator on a class under `domain/` |
578
- | `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<context>.declarations.ts` or one that differs from one `export *` per role file sorted by path; with `discovery`, a barrel that still exists. It needs the tree, so `check-file` does not run it |
629
+ | `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<context>.declarations.ts` or one that differs from one `export *` per role file sorted by path followed by one `injected(Class, [Tokens])` per class whose constructor takes something (read from the signatures, with their imports); with `discovery`, a barrel that still exists, and a `<context>.dependencies.ts` that differs from those `injected` statements (absent is accepted while it would hold none). The message names the missing role file or the class whose list is stale. It needs the tree, so `check-file` does not run it |
630
+ | `declarations/constructor-injection` | declared style only, in a role file: on a class whose decorator lists nothing, a constructor parameter that is optional, has a default value, is a rest parameter or is destructured, has no type, or is typed by anything but one class name (type arguments aside): a union, an intersection, an array, a qualified name, a type of the language, an interface, a type alias, an enum or an unexported class of the file or of the file of the project it is imported from; a class that inherits its constructor from a class the project cannot read. Under `stack.dependencies: signature`, a decorator that carries a list although the constructor can be read: one that repeats it, one that differs |
579
631
  | `ports/abstract-class` | in a port file (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`): a class that is not `abstract`; a member that is not an abstract method or property (`static readonly tokenKey = '<text>'` apart): a constructor, a body, an initializer, a `private`, `protected` or `#` member; an exported `interface` (a `type` alias, a data shape, is not reported) |
580
632
  | `ports/implements-never-extends` | a class carrying `@Repository(P)`, `@Gateway(P)` or `@Adapter(P)`, or given to `bind(P).toClass(C)` or `rebind(P).toClass(C)`, without `implements P` or with `extends P`; under `infrastructure/`, a class extending a class imported from a port file |
581
633
  | `ports/no-token-constant` | a call of `token` imported from a `@ddd-ts-kit/*` package; `Symbol(..)`, `Symbol.for(..)` or a string literal as the first argument of `bind`, `rebind`, `resolve`, `fake` or `override` in a file importing `@ddd-ts-kit/di`; an UPPER_SNAKE_CASE name in a dependency list; a file named `*.ports.ts` or `tokens.ts` |
582
- | `ports/no-concrete-dependency` | a dependency list naming a class imported from `infrastructure/` or from `test/fakes/` of a context |
634
+ | `ports/no-concrete-dependency` | a dependency list naming a class imported from `infrastructure/` or from `test/fakes/` of a context; in the declared style, a constructor parameter of a declared class that lists nothing, typed by such a class |
583
635
  | `ports/value-import` | a class named in a dependency list, or given to `bind` or `rebind`, imported with `import type` or `import { type X }` |
584
636
  | `scheduling/job-triggers-use-case` | in `application/scheduling/*.job.ts`: an exported class that does not implement `ScheduledJob`; a `run` that sends no command (no `.execute(` call); a repository in the dependency list or the constructor; an import from `domain/aggregates/`, `domain/entities/`, `domain/services/` or `infrastructure/`. A `builder.job(..)` registration of a class that lives elsewhere |
585
637
  | `scheduling/job-name` | the first argument of `@Scheduled(..)` or `.job(..)` that is not a string literal `<context>.<job-name>` in lower-case kebab-case with the context of its file; a `systemActor(..)` of a job file passing another name; one job name used twice in the project |
@@ -692,6 +744,14 @@ import is judged by every boundary rule exactly as the relative path to the same
692
744
  `override` are binding calls only in a file that imports `@ddd-ts-kit/di`.
693
745
  `ports/implements-never-extends` reads the bound class through one direct relative or alias
694
746
  import; a class of a package or behind a barrel is not judged.
747
+ - The constructor of a declared class is read as text, by the scanner of the checker: the
748
+ constructor of the exported class that carries the decorator of its role file, its own or
749
+ the nearest one it inherits through imports of the project. A type imported from a package
750
+ is trusted to be a class (the compiler judges the generated file, which imports it as a
751
+ value); a type reached through a barrel is trusted too. A constructor overloaded by
752
+ signatures without a body, or built by a mixin, is not read: write one plain constructor.
753
+ `declarations/barrel-current` compares text exactly, so the generated file is never
754
+ reformatted by hand.
695
755
  - `scheduling/job-triggers-use-case` takes any `.execute(` call in `run` for a command sent; a job
696
756
  that executes something else, or sends its command from a helper, is misjudged.
697
757
  `scheduling/job-name` compares literal names: a job registered under a computed name is reported
@@ -0,0 +1,10 @@
1
+ import type { CompilerResolution } from './compiler-resolution.js';
2
+ /**
3
+ * What `init` writes in tsconfig.json for "importExtension". `Bundler` resolves a specifier
4
+ * without its extension and still reports one that names no file; it reads the `exports` of a
5
+ * package without the `node` condition, which is given back to it so that the compiler and Node
6
+ * take the same entry. `NodeNext` resolves as Node does and requires the extension. Both emit
7
+ * ECMAScript modules, which `build-aliases` completes.
8
+ */
9
+ export declare function compilerResolutionOf(importExtension: string): CompilerResolution;
10
+ //# sourceMappingURL=compiler-resolution-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-resolution-of.d.ts","sourceRoot":"","sources":["../../src/alias/compiler-resolution-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,kBAAkB,CAIhF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * What `init` writes in tsconfig.json for "importExtension". `Bundler` resolves a specifier
3
+ * without its extension and still reports one that names no file; it reads the `exports` of a
4
+ * package without the `node` condition, which is given back to it so that the compiler and Node
5
+ * take the same entry. `NodeNext` resolves as Node does and requires the extension. Both emit
6
+ * ECMAScript modules, which `build-aliases` completes.
7
+ */
8
+ export function compilerResolutionOf(importExtension) {
9
+ return importExtension === 'none'
10
+ ? { module: 'ESNext', moduleResolution: 'Bundler', customConditions: ['node'] }
11
+ : { module: 'NodeNext', moduleResolution: 'NodeNext' };
12
+ }
13
+ //# sourceMappingURL=compiler-resolution-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-resolution-of.js","sourceRoot":"","sources":["../../src/alias/compiler-resolution-of.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,eAAuB;IAC1D,OAAO,eAAe,KAAK,MAAM;QAC/B,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE;QAC/E,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** The compiler options that decide how a specifier is resolved and what the compiler emits for it. */
2
+ export interface CompilerResolution {
3
+ readonly module: string;
4
+ readonly moduleResolution: string;
5
+ /** The conditions added to the ones the resolution reads in the `exports` of a package. */
6
+ readonly customConditions?: readonly string[];
7
+ }
8
+ //# sourceMappingURL=compiler-resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-resolution.d.ts","sourceRoot":"","sources":["../../src/alias/compiler-resolution.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,2FAA2F;IAC3F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=compiler-resolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-resolution.js","sourceRoot":"","sources":["../../src/alias/compiler-resolution.ts"],"names":[],"mappings":""}
@@ -2,12 +2,14 @@ export { aliasProblem } from './alias-problem.js';
2
2
  export type { AliasRoot } from './alias-root.js';
3
3
  export { aliasRoots } from './alias-roots.js';
4
4
  export { compilerPaths } from './compiler-paths.js';
5
+ export { compilerResolutionOf } from './compiler-resolution-of.js';
5
6
  export { contextAlias } from './context-alias.js';
6
7
  export type { BuildLayout } from './build-layout.js';
7
8
  export { DEFAULT_BUILD_LAYOUT } from './default-build-layout.js';
8
9
  export { directoryAlias } from './directory-alias.js';
9
10
  export { FIXED_ALIAS_ROOTS } from './fixed-alias-roots.js';
10
11
  export { moduleNameMapper } from './module-name-mapper.js';
11
- export { platformAlias } from './platform-alias.js';
12
+ export { specifierOf } from './specifier-of.js';
13
+ export { specifierSuffix } from './specifier-suffix.js';
12
14
  export { toAlias } from './to-alias.js';
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
@@ -1,11 +1,13 @@
1
1
  export { aliasProblem } from './alias-problem.js';
2
2
  export { aliasRoots } from './alias-roots.js';
3
3
  export { compilerPaths } from './compiler-paths.js';
4
+ export { compilerResolutionOf } from './compiler-resolution-of.js';
4
5
  export { contextAlias } from './context-alias.js';
5
6
  export { DEFAULT_BUILD_LAYOUT } from './default-build-layout.js';
6
7
  export { directoryAlias } from './directory-alias.js';
7
8
  export { FIXED_ALIAS_ROOTS } from './fixed-alias-roots.js';
8
9
  export { moduleNameMapper } from './module-name-mapper.js';
9
- export { platformAlias } from './platform-alias.js';
10
+ export { specifierOf } from './specifier-of.js';
11
+ export { specifierSuffix } from './specifier-suffix.js';
10
12
  export { toAlias } from './to-alias.js';
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import type { AliasRoot } from './alias-root.js';
2
2
  /**
3
- * The `moduleNameMapper` of jest for these roots, which does not read tsconfig: an alias specifier,
4
- * written with the `.js` extension of the compiled file, answers the TypeScript source.
3
+ * The `moduleNameMapper` of jest for these roots, which does not read tsconfig: an alias
4
+ * specifier, written with `suffix` (the `.js` of the compiled file, or nothing), answers the
5
+ * TypeScript source and nothing else.
5
6
  */
6
- export declare function moduleNameMapper(roots: readonly AliasRoot[]): Record<string, string>;
7
+ export declare function moduleNameMapper(roots: readonly AliasRoot[], suffix: string): Record<string, string>;
7
8
  //# sourceMappingURL=module-name-mapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-name-mapper.d.ts","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOpF"}
1
+ {"version":3,"file":"module-name-mapper.d.ts","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASpG"}
@@ -1,11 +1,13 @@
1
1
  const SPECIAL = /[.*+?^${}()|[\]\\]/g;
2
2
  /**
3
- * The `moduleNameMapper` of jest for these roots, which does not read tsconfig: an alias specifier,
4
- * written with the `.js` extension of the compiled file, answers the TypeScript source.
3
+ * The `moduleNameMapper` of jest for these roots, which does not read tsconfig: an alias
4
+ * specifier, written with `suffix` (the `.js` of the compiled file, or nothing), answers the
5
+ * TypeScript source and nothing else.
5
6
  */
6
- export function moduleNameMapper(roots) {
7
+ export function moduleNameMapper(roots, suffix) {
8
+ const ending = suffix.replace(SPECIAL, String.raw `\$&`);
7
9
  return Object.fromEntries(roots.map(({ prefix, directory }) => [
8
- String.raw `^${prefix.replace(SPECIAL, String.raw `\$&`)}(.*)\.js$`,
10
+ `^${prefix.replace(SPECIAL, String.raw `\$&`)}(.*)${ending}$`,
9
11
  `<rootDir>/${directory}/$1.ts`,
10
12
  ]));
11
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"module-name-mapper.js","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA2B;IAC1D,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,CAAA,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,WAAW;QACjE,aAAa,SAAS,QAAQ;KAC/B,CAAC,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"module-name-mapper.js","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA2B,EAAE,MAAc;IAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,OAAO,MAAM,GAAG;QAC5D,aAAa,SAAS,QAAQ;KAC/B,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Config } from '../config/index.js';
2
+ /**
3
+ * How a generated import names a file of the project, given from the project root with or
4
+ * without its extension: by its alias, ending as "importExtension" says.
5
+ */
6
+ export declare function specifierOf(config: Config, file: string): string;
7
+ //# sourceMappingURL=specifier-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specifier-of.d.ts","sourceRoot":"","sources":["../../src/alias/specifier-of.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAK9D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAWhE"}
@@ -0,0 +1,17 @@
1
+ import { CliError } from '../cli-error.js';
2
+ import { CONFIG_FILE } from '../config/index.js';
3
+ import { aliasRoots } from './alias-roots.js';
4
+ import { specifierSuffix } from './specifier-suffix.js';
5
+ import { toAlias } from './to-alias.js';
6
+ /**
7
+ * How a generated import names a file of the project, given from the project root with or
8
+ * without its extension: by its alias, ending as "importExtension" says.
9
+ */
10
+ export function specifierOf(config, file) {
11
+ const specifier = toAlias(aliasRoots(config), file, specifierSuffix(config.importExtension));
12
+ if (specifier === undefined) {
13
+ throw new CliError(`${file} is under no directory an import alias names.`, `Keep it under the source root in ${CONFIG_FILE}: a file is imported by an alias, never by a relative path.`);
14
+ }
15
+ return specifier;
16
+ }
17
+ //# sourceMappingURL=specifier-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specifier-of.js","sourceRoot":"","sources":["../../src/alias/specifier-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAe,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY;IACtD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;IAE7F,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,QAAQ,CAChB,GAAG,IAAI,+CAA+C,EACtD,oCAAoC,WAAW,6DAA6D,CAC7G,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * What an alias specifier ends with under "importExtension": nothing for `none`, `.js` otherwise.
3
+ * A value `check` reports as wrong is read as `js`, which is what a config without the key means.
4
+ */
5
+ export declare function specifierSuffix(importExtension: string): '' | '.js';
6
+ //# sourceMappingURL=specifier-suffix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specifier-suffix.d.ts","sourceRoot":"","sources":["../../src/alias/specifier-suffix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,EAAE,GAAG,KAAK,CAEnE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * What an alias specifier ends with under "importExtension": nothing for `none`, `.js` otherwise.
3
+ * A value `check` reports as wrong is read as `js`, which is what a config without the key means.
4
+ */
5
+ export function specifierSuffix(importExtension) {
6
+ return importExtension === 'none' ? '' : '.js';
7
+ }
8
+ //# sourceMappingURL=specifier-suffix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specifier-suffix.js","sourceRoot":"","sources":["../../src/alias/specifier-suffix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,eAAuB;IACrD,OAAO,eAAe,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import type { AliasRoot } from './alias-root.js';
2
2
  /**
3
3
  * The specifier that names a file of the project, given by its path from the project root with
4
- * or without its extension; nothing when the file is under no aliased tree.
4
+ * or without its extension, ending with `suffix` (`.js`, or nothing); nothing when the file is
5
+ * under no aliased tree.
5
6
  */
6
- export declare function toAlias(roots: readonly AliasRoot[], file: string): string | undefined;
7
+ export declare function toAlias(roots: readonly AliasRoot[], file: string, suffix: string): string | undefined;
7
8
  //# sourceMappingURL=to-alias.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-alias.d.ts","sourceRoot":"","sources":["../../src/alias/to-alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQrF"}
1
+ {"version":3,"file":"to-alias.d.ts","sourceRoot":"","sources":["../../src/alias/to-alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQrG"}
@@ -1,13 +1,14 @@
1
1
  const EXTENSION = /\.(?:ts|js)$/;
2
2
  /**
3
3
  * The specifier that names a file of the project, given by its path from the project root with
4
- * or without its extension; nothing when the file is under no aliased tree.
4
+ * or without its extension, ending with `suffix` (`.js`, or nothing); nothing when the file is
5
+ * under no aliased tree.
5
6
  */
6
- export function toAlias(roots, file) {
7
+ export function toAlias(roots, file, suffix) {
7
8
  const root = roots.find(({ directory }) => file.startsWith(`${directory}/`));
8
9
  if (root === undefined) {
9
10
  return undefined;
10
11
  }
11
- return `${root.prefix}${file.slice(root.directory.length + 1).replace(EXTENSION, '')}.js`;
12
+ return `${root.prefix}${file.slice(root.directory.length + 1).replace(EXTENSION, '')}${suffix}`;
12
13
  }
13
14
  //# sourceMappingURL=to-alias.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-alias.js","sourceRoot":"","sources":["../../src/alias/to-alias.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,KAA2B,EAAE,IAAY;IAC/D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC;IAE7E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC;AAC5F,CAAC"}
1
+ {"version":3,"file":"to-alias.js","sourceRoot":"","sources":["../../src/alias/to-alias.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAA2B,EAAE,IAAY,EAAE,MAAc;IAC/E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC;IAE7E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;AAClG,CAAC"}
@@ -3,6 +3,8 @@ import type { AliasRoot, BuildLayout } from '../alias/index.js';
3
3
  export interface EmittedPlace {
4
4
  readonly roots: readonly AliasRoot[];
5
5
  readonly layout: BuildLayout;
6
+ /** What an alias specifier ends with in the sources: `.js`, or nothing. */
7
+ readonly suffix: string;
6
8
  /** Whether a path, given from the project root, is a file. */
7
9
  readonly isFile: (file: string) => boolean;
8
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-place.d.ts","sourceRoot":"","sources":["../../src/build/emitted-place.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C"}
1
+ {"version":3,"file":"emitted-place.d.ts","sourceRoot":"","sources":["../../src/build/emitted-place.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C"}
@@ -1,8 +1,9 @@
1
1
  import type { EmittedPlace } from './emitted-place.js';
2
2
  /**
3
3
  * The relative specifier that names, from an emitted file, the emitted file an alias specifier
4
- * stands for, with its `.js` extension; nothing when the build emitted no such file. Both files
5
- * are given from the project root.
4
+ * stands for, always with its `.js` extension: Node resolves no other spelling. Nothing when the
5
+ * build emitted no such file, or when the specifier is not written as the project writes its
6
+ * imports. Both files are given from the project root.
6
7
  */
7
8
  export declare function emittedSpecifier(place: EmittedPlace, file: string, specifier: string): string | undefined;
8
9
  //# sourceMappingURL=emitted-specifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-specifier.d.ts","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoBzG"}
1
+ {"version":3,"file":"emitted-specifier.d.ts","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUzG"}
@@ -1,21 +1,15 @@
1
1
  import path from 'node:path';
2
+ import { emittedTarget } from './emitted-target.js';
2
3
  const DECLARATION = /\.d\.[cm]?ts$/;
3
4
  /**
4
5
  * The relative specifier that names, from an emitted file, the emitted file an alias specifier
5
- * stands for, with its `.js` extension; nothing when the build emitted no such file. Both files
6
- * are given from the project root.
6
+ * stands for, always with its `.js` extension: Node resolves no other spelling. Nothing when the
7
+ * build emitted no such file, or when the specifier is not written as the project writes its
8
+ * imports. Both files are given from the project root.
7
9
  */
8
10
  export function emittedSpecifier(place, file, specifier) {
9
- const root = place.roots.find(({ prefix }) => specifier.startsWith(prefix));
10
- if (root === undefined) {
11
- return undefined;
12
- }
13
- const { rootDir, outDir } = place.layout;
14
- const directory = path.posix.join(outDir, path.posix.relative(rootDir, root.directory));
15
- const named = path.posix.join(directory, specifier.slice(root.prefix.length));
16
- const emitted = (candidate) => place.isFile(candidate) || declared(place, file, candidate);
17
- const target = [named, `${named}.js`, `${named}/index.js`].find(emitted);
18
- if (target === undefined) {
11
+ const target = emittedTarget(place, specifier);
12
+ if (target === undefined || !(place.isFile(target) || declared(place, file, target))) {
19
13
  return undefined;
20
14
  }
21
15
  const relative = path.posix.relative(path.posix.dirname(file), target);
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-specifier.js","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACnF,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAC5G,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,EAAE,GAAG,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;AAC/D,CAAC;AAED,iFAAiF;AACjF,SAAS,QAAQ,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACpE,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAClH,CAAC"}
1
+ {"version":3,"file":"emitted-specifier.js","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACnF,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAE/C,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QACrF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;AAC/D,CAAC;AAED,iFAAiF;AACjF,SAAS,QAAQ,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACpE,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAClH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { EmittedPlace } from './emitted-place.js';
2
+ /**
3
+ * The emitted file an alias specifier names, from the project root, whether or not it exists;
4
+ * nothing when the specifier starts with no alias. One spelling names it: the path of the file
5
+ * with the ending the project writes, so a directory is never completed with an `index` and a
6
+ * specifier written the other way is never guessed.
7
+ */
8
+ export declare function emittedTarget(place: EmittedPlace, specifier: string): string | undefined;
9
+ //# sourceMappingURL=emitted-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitted-target.d.ts","sourceRoot":"","sources":["../../src/build/emitted-target.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYxF"}
@@ -0,0 +1,18 @@
1
+ import path from 'node:path';
2
+ /**
3
+ * The emitted file an alias specifier names, from the project root, whether or not it exists;
4
+ * nothing when the specifier starts with no alias. One spelling names it: the path of the file
5
+ * with the ending the project writes, so a directory is never completed with an `index` and a
6
+ * specifier written the other way is never guessed.
7
+ */
8
+ export function emittedTarget(place, specifier) {
9
+ const root = place.roots.find(({ prefix }) => specifier.startsWith(prefix));
10
+ if (root === undefined) {
11
+ return undefined;
12
+ }
13
+ const { rootDir, outDir } = place.layout;
14
+ const directory = path.posix.join(outDir, path.posix.relative(rootDir, root.directory));
15
+ const named = path.posix.join(directory, specifier.slice(root.prefix.length));
16
+ return place.suffix === '' ? `${named}.js` : named;
17
+ }
18
+ //# sourceMappingURL=emitted-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitted-target.js","sourceRoot":"","sources":["../../src/build/emitted-target.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,SAAiB;IAClE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9E,OAAO,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}