@codefast/cli 0.3.13-canary.2 → 0.3.13-canary.4

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 (426) hide show
  1. package/README.md +30 -4
  2. package/dist/{bin.js → bin.mjs} +4 -1
  3. package/dist/commands/arrange.mjs +325 -0
  4. package/dist/commands/mirror.mjs +267 -0
  5. package/dist/commands/tag.mjs +283 -0
  6. package/dist/lib/arrange/application/arrange-analyze-json.format.mjs +10 -0
  7. package/dist/lib/arrange/application/arrange-group-json.format.mjs +11 -0
  8. package/dist/lib/arrange/application/arrange-sync-cli-result.mjs +7 -0
  9. package/dist/lib/arrange/application/arrange-sync-json.format.mjs +12 -0
  10. package/dist/lib/arrange/application/services/arrange-file-processor.service.mjs +242 -0
  11. package/dist/lib/arrange/application/services/arrange-target-scanner.service.mjs +237 -0
  12. package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.mjs +258 -0
  13. package/dist/lib/arrange/application/use-cases/group-file.use-case.mjs +35 -0
  14. package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.mjs +283 -0
  15. package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +233 -0
  16. package/dist/lib/arrange/arrange.feature.module.mjs +19 -0
  17. package/dist/lib/arrange/arrange.module.mjs +27 -0
  18. package/dist/lib/arrange/arrange.presentation.module.mjs +13 -0
  19. package/dist/lib/arrange/contracts/tokens.mjs +14 -0
  20. package/dist/lib/arrange/domain/arrange-analyze.service.mjs +95 -0
  21. package/dist/lib/arrange/domain/arrange-grouping.service.mjs +100 -0
  22. package/dist/lib/arrange/domain/ast/ast-helpers.helper.mjs +89 -0
  23. package/dist/lib/arrange/domain/ast/ast-node.model.mjs +181 -0
  24. package/dist/lib/arrange/domain/ast/collectors-cn.collector.mjs +52 -0
  25. package/dist/lib/arrange/domain/ast/collectors-jsx.collector.mjs +20 -0
  26. package/dist/lib/arrange/domain/ast/collectors-tv.collector.mjs +174 -0
  27. package/dist/lib/arrange/domain/ast/targets.model.mjs +110 -0
  28. package/dist/lib/arrange/domain/constants.domain.mjs +154 -0
  29. package/dist/lib/arrange/domain/errors.domain.mjs +18 -0
  30. package/dist/lib/arrange/domain/grouping.domain.mjs +306 -0
  31. package/dist/lib/arrange/domain/imports.domain.mjs +55 -0
  32. package/dist/lib/arrange/domain/source-text-formatters.formatter.mjs +54 -0
  33. package/dist/lib/arrange/domain/tokenizer.util.mjs +209 -0
  34. package/dist/lib/arrange/infra/domain-source-parser.adapter.mjs +240 -0
  35. package/dist/lib/arrange/infra/ensure-cn-import.adapter.mjs +8 -0
  36. package/dist/lib/arrange/infra/file-walker.adapter.mjs +239 -0
  37. package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.mjs +18 -0
  38. package/dist/lib/arrange/infra/ts-ast-translator.adapter.mjs +355 -0
  39. package/dist/lib/arrange/presentation/arrange-cli-schema.presenter.mjs +29 -0
  40. package/dist/lib/arrange/presentation/arrange-sync.presenter.mjs +12 -0
  41. package/dist/lib/arrange/presentation/formatters.presenter.mjs +2 -0
  42. package/dist/lib/arrange/presentation/group-file-preview.presenter.mjs +275 -0
  43. package/dist/lib/arrange/presentation/prepare-arrange.orchestrator.mjs +258 -0
  44. package/dist/lib/arrange/presentation/present-analyze-cli.presenter.mjs +7 -0
  45. package/dist/lib/arrange/presentation/present-analyze-report.presenter.mjs +233 -0
  46. package/dist/lib/arrange/presentation/report.presenter.mjs +24 -0
  47. package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.mjs +21 -0
  48. package/dist/lib/config/application/use-cases/load-config.use-case.mjs +17 -0
  49. package/dist/lib/config/contracts/tokens.mjs +5 -0
  50. package/dist/lib/config/infra/config-schema.adapter.mjs +25 -0
  51. package/dist/lib/config/infra/loader.adapter.mjs +84 -0
  52. package/dist/lib/core/application/architecture-boundaries.policy.mjs +311 -0
  53. package/dist/lib/core/application/ports/path.port.mjs +1 -0
  54. package/dist/lib/core/application/schema-parse.util.mjs +17 -0
  55. package/dist/lib/core/application/utils/caught-unknown-message.util.mjs +19 -0
  56. package/dist/lib/core/application/utils/verbose-diagnostics.util.mjs +9 -0
  57. package/dist/lib/core/contracts/presentation.contract.mjs +1 -0
  58. package/dist/lib/core/contracts/tokens.mjs +5 -0
  59. package/dist/lib/core/core.module.mjs +9 -0
  60. package/dist/lib/core/domain/cli-exit-codes.domain.mjs +11 -0
  61. package/dist/lib/core/domain/errors.domain.mjs +16 -0
  62. package/dist/lib/core/domain/result.model.mjs +23 -0
  63. package/dist/lib/core/infra/composition-root.mjs +21 -0
  64. package/dist/lib/core/infra/infra.module.mjs +23 -0
  65. package/dist/lib/core/infra/logging-decorator.adapter.mjs +62 -0
  66. package/dist/lib/core/infra/path.adapter.mjs +13 -0
  67. package/dist/lib/core/operational/contracts/tokens.mjs +7 -0
  68. package/dist/lib/core/presentation/cli-executor.presenter.mjs +57 -0
  69. package/dist/lib/core/presentation/command.interface.mjs +1 -0
  70. package/dist/lib/core/presentation/format-app-error.presenter.mjs +17 -0
  71. package/dist/lib/core/presentation/global-cli-options.presenter.mjs +9 -0
  72. package/dist/lib/core/presentation/load-codefast-config.presenter.mjs +18 -0
  73. package/dist/lib/core/presentation/parse-cli-schema.presenter.mjs +7 -0
  74. package/dist/lib/core/presentation/presentation.module.mjs +11 -0
  75. package/dist/lib/core/presentation/try-load-codefast-config.presenter.mjs +245 -0
  76. package/dist/lib/infra/config-reporter.adapter.mjs +9 -0
  77. package/dist/lib/infra/fs-contract.port.mjs +1 -0
  78. package/dist/lib/infra/node-io.adapter.mjs +266 -0
  79. package/dist/lib/infra/workspace/repo-root.adapter.mjs +21 -0
  80. package/dist/lib/kernel/di/command.token.mjs +5 -0
  81. package/dist/lib/mirror/application/mirror-sync-json.format.mjs +12 -0
  82. package/dist/lib/mirror/application/ports/file-system-service.port.mjs +1 -0
  83. package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.mjs +1 -0
  84. package/dist/lib/mirror/application/ports/package-repository.port.mjs +1 -0
  85. package/dist/lib/mirror/application/ports/sync-workspace-package.port.mjs +1 -0
  86. package/dist/lib/mirror/application/ports/workspace-service.port.mjs +1 -0
  87. package/dist/lib/mirror/application/requests/mirror-sync.request.mjs +1 -0
  88. package/dist/lib/mirror/application/services/sync-workspace-package.service.mjs +351 -0
  89. package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.mjs +219 -0
  90. package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.mjs +302 -0
  91. package/dist/lib/mirror/contracts/models.mjs +1 -0
  92. package/dist/lib/mirror/contracts/presentation.contract.mjs +1 -0
  93. package/dist/lib/mirror/contracts/tokens.mjs +11 -0
  94. package/dist/lib/mirror/contracts/use-cases.contract.mjs +1 -0
  95. package/dist/lib/mirror/domain/constants.domain.mjs +16 -0
  96. package/dist/lib/mirror/domain/errors.domain.mjs +15 -0
  97. package/dist/lib/mirror/domain/types.domain.mjs +1 -0
  98. package/dist/lib/mirror/infra/dirent-list.adapter.mjs +13 -0
  99. package/dist/lib/mirror/infra/file-system-service.adapter.mjs +256 -0
  100. package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.mjs +1 -0
  101. package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.mjs +236 -0
  102. package/dist/lib/mirror/infra/package-filter.adapter.mjs +25 -0
  103. package/dist/lib/mirror/infra/package-repository.adapter.mjs +235 -0
  104. package/dist/lib/mirror/infra/path-normalizer.adapter.mjs +7 -0
  105. package/dist/lib/mirror/infra/update-pkg.adapter.mjs +102 -0
  106. package/dist/lib/mirror/infra/workspace-packages.adapter.mjs +154 -0
  107. package/dist/lib/mirror/infra/workspace-service.adapter.mjs +232 -0
  108. package/dist/lib/mirror/mirror.feature.module.mjs +19 -0
  109. package/dist/lib/mirror/mirror.module.mjs +23 -0
  110. package/dist/lib/mirror/mirror.presentation.module.mjs +11 -0
  111. package/dist/lib/mirror/presentation/mirror-cli-schema.presenter.mjs +12 -0
  112. package/dist/lib/mirror/presentation/prepare-mirror.orchestrator.mjs +263 -0
  113. package/dist/lib/mirror/presentation/reporter.presenter.mjs +111 -0
  114. package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.mjs +20 -0
  115. package/dist/lib/shared/source-code/domain/text-edit.model.mjs +28 -0
  116. package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.mjs +33 -0
  117. package/dist/lib/tag/application/ports/tag-since-writer.port.mjs +1 -0
  118. package/dist/lib/tag/application/ports/tag-version-resolver.port.mjs +1 -0
  119. package/dist/lib/tag/application/ports/target-resolver.port.mjs +1 -0
  120. package/dist/lib/tag/application/ports/typescript-tree-walk.port.mjs +1 -0
  121. package/dist/lib/tag/application/requests/tag-sync.request.mjs +1 -0
  122. package/dist/lib/tag/application/tag-sync-cli-result.mjs +11 -0
  123. package/dist/lib/tag/application/tag-sync-json.format.mjs +14 -0
  124. package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.mjs +398 -0
  125. package/dist/lib/tag/contracts/models.mjs +1 -0
  126. package/dist/lib/tag/contracts/presentation.contract.mjs +1 -0
  127. package/dist/lib/tag/contracts/tokens.mjs +12 -0
  128. package/dist/lib/tag/contracts/use-cases.contract.mjs +1 -0
  129. package/dist/lib/tag/domain/types.domain.mjs +1 -0
  130. package/dist/lib/tag/infra/tag-since-writer.adapter.mjs +343 -0
  131. package/dist/lib/tag/infra/tag-sync-cli-options.adapter.mjs +1 -0
  132. package/dist/lib/tag/infra/tag-target-candidates.adapter.mjs +170 -0
  133. package/dist/lib/tag/infra/tag-target-resolver.adapter.mjs +226 -0
  134. package/dist/lib/tag/infra/tag-version-resolver.adapter.mjs +247 -0
  135. package/dist/lib/tag/infra/typescript-tree-walk.adapter.mjs +226 -0
  136. package/dist/lib/tag/presentation/colors.presenter.mjs +12 -0
  137. package/dist/lib/tag/presentation/create-tag-progress-listener.presenter.mjs +228 -0
  138. package/dist/lib/tag/presentation/prepare-tag.orchestrator.mjs +264 -0
  139. package/dist/lib/tag/presentation/present-tag-sync-result.presenter.mjs +233 -0
  140. package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.mjs +9 -0
  141. package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.mjs +12 -0
  142. package/dist/lib/tag/presentation/tag-cli-schema.presenter.mjs +12 -0
  143. package/dist/lib/tag/presentation/tag-sync.presenter.mjs +78 -0
  144. package/dist/lib/tag/tag.feature.module.mjs +19 -0
  145. package/dist/lib/tag/tag.module.mjs +21 -0
  146. package/dist/lib/tag/tag.presentation.module.mjs +15 -0
  147. package/dist/program.mjs +39 -0
  148. package/package.json +16 -19
  149. package/dist/bin.d.ts +0 -3
  150. package/dist/bin.d.ts.map +0 -1
  151. package/dist/commands/arrange.d.ts +0 -3
  152. package/dist/commands/arrange.d.ts.map +0 -1
  153. package/dist/commands/arrange.js +0 -129
  154. package/dist/commands/mirror.d.ts +0 -4
  155. package/dist/commands/mirror.d.ts.map +0 -1
  156. package/dist/commands/mirror.js +0 -75
  157. package/dist/commands/tag.d.ts +0 -3
  158. package/dist/commands/tag.d.ts.map +0 -1
  159. package/dist/commands/tag.js +0 -41
  160. package/dist/lib/arrange/application/analyze.d.ts +0 -17
  161. package/dist/lib/arrange/application/analyze.d.ts.map +0 -1
  162. package/dist/lib/arrange/application/analyze.js +0 -24
  163. package/dist/lib/arrange/application/group-file-preview.d.ts +0 -17
  164. package/dist/lib/arrange/application/group-file-preview.d.ts.map +0 -1
  165. package/dist/lib/arrange/application/group-file-preview.js +0 -46
  166. package/dist/lib/arrange/application/group-file.d.ts +0 -5
  167. package/dist/lib/arrange/application/group-file.d.ts.map +0 -1
  168. package/dist/lib/arrange/application/group-file.js +0 -40
  169. package/dist/lib/arrange/application/ports/domain-source-parser.port.d.ts +0 -5
  170. package/dist/lib/arrange/application/ports/domain-source-parser.port.d.ts.map +0 -1
  171. package/dist/lib/arrange/application/ports/file-walker.port.d.ts +0 -5
  172. package/dist/lib/arrange/application/ports/file-walker.port.d.ts.map +0 -1
  173. package/dist/lib/arrange/application/requests/analyze-directory.request.d.ts +0 -6
  174. package/dist/lib/arrange/application/requests/analyze-directory.request.d.ts.map +0 -1
  175. package/dist/lib/arrange/application/requests/analyze-directory.request.js +0 -4
  176. package/dist/lib/arrange/application/requests/arrange-sync.request.d.ts +0 -18
  177. package/dist/lib/arrange/application/requests/arrange-sync.request.d.ts.map +0 -1
  178. package/dist/lib/arrange/application/requests/arrange-sync.request.js +0 -15
  179. package/dist/lib/arrange/application/run-target.d.ts +0 -19
  180. package/dist/lib/arrange/application/run-target.d.ts.map +0 -1
  181. package/dist/lib/arrange/application/run-target.js +0 -85
  182. package/dist/lib/arrange/domain/arrange-analyze.service.d.ts +0 -12
  183. package/dist/lib/arrange/domain/arrange-analyze.service.d.ts.map +0 -1
  184. package/dist/lib/arrange/domain/arrange-analyze.service.js +0 -116
  185. package/dist/lib/arrange/domain/arrange-grouping.service.d.ts +0 -53
  186. package/dist/lib/arrange/domain/arrange-grouping.service.d.ts.map +0 -1
  187. package/dist/lib/arrange/domain/arrange-grouping.service.js +0 -106
  188. package/dist/lib/arrange/domain/ast/ast-helpers.d.ts +0 -28
  189. package/dist/lib/arrange/domain/ast/ast-helpers.d.ts.map +0 -1
  190. package/dist/lib/arrange/domain/ast/ast-helpers.js +0 -130
  191. package/dist/lib/arrange/domain/ast/ast-node.model.d.ts +0 -179
  192. package/dist/lib/arrange/domain/ast/ast-node.model.d.ts.map +0 -1
  193. package/dist/lib/arrange/domain/ast/ast-node.model.js +0 -210
  194. package/dist/lib/arrange/domain/ast/collectors-cn.d.ts +0 -7
  195. package/dist/lib/arrange/domain/ast/collectors-cn.d.ts.map +0 -1
  196. package/dist/lib/arrange/domain/ast/collectors-cn.js +0 -70
  197. package/dist/lib/arrange/domain/ast/collectors-jsx.d.ts +0 -4
  198. package/dist/lib/arrange/domain/ast/collectors-jsx.d.ts.map +0 -1
  199. package/dist/lib/arrange/domain/ast/collectors-jsx.js +0 -21
  200. package/dist/lib/arrange/domain/ast/collectors-tv.d.ts +0 -13
  201. package/dist/lib/arrange/domain/ast/collectors-tv.d.ts.map +0 -1
  202. package/dist/lib/arrange/domain/ast/collectors-tv.js +0 -302
  203. package/dist/lib/arrange/domain/ast/targets.d.ts +0 -8
  204. package/dist/lib/arrange/domain/ast/targets.d.ts.map +0 -1
  205. package/dist/lib/arrange/domain/ast/targets.js +0 -147
  206. package/dist/lib/arrange/domain/constants.d.ts +0 -68
  207. package/dist/lib/arrange/domain/constants.d.ts.map +0 -1
  208. package/dist/lib/arrange/domain/constants.js +0 -180
  209. package/dist/lib/arrange/domain/errors.d.ts +0 -14
  210. package/dist/lib/arrange/domain/errors.d.ts.map +0 -1
  211. package/dist/lib/arrange/domain/errors.js +0 -16
  212. package/dist/lib/arrange/domain/grouping.d.ts +0 -41
  213. package/dist/lib/arrange/domain/grouping.d.ts.map +0 -1
  214. package/dist/lib/arrange/domain/grouping.js +0 -307
  215. package/dist/lib/arrange/domain/imports.d.ts +0 -7
  216. package/dist/lib/arrange/domain/imports.d.ts.map +0 -1
  217. package/dist/lib/arrange/domain/imports.js +0 -80
  218. package/dist/lib/arrange/domain/source-text-formatters.d.ts +0 -16
  219. package/dist/lib/arrange/domain/source-text-formatters.d.ts.map +0 -1
  220. package/dist/lib/arrange/domain/source-text-formatters.js +0 -55
  221. package/dist/lib/arrange/domain/tokenizer.d.ts +0 -45
  222. package/dist/lib/arrange/domain/tokenizer.d.ts.map +0 -1
  223. package/dist/lib/arrange/domain/tokenizer.js +0 -466
  224. package/dist/lib/arrange/domain/types.d.ts +0 -112
  225. package/dist/lib/arrange/domain/types.d.ts.map +0 -1
  226. package/dist/lib/arrange/domain/types.js +0 -7
  227. package/dist/lib/arrange/index.d.ts +0 -45
  228. package/dist/lib/arrange/index.d.ts.map +0 -1
  229. package/dist/lib/arrange/index.js +0 -41
  230. package/dist/lib/arrange/infra/arrange-sync-cli-options.d.ts +0 -14
  231. package/dist/lib/arrange/infra/arrange-sync-cli-options.d.ts.map +0 -1
  232. package/dist/lib/arrange/infra/domain-source-parser.adapter.d.ts +0 -11
  233. package/dist/lib/arrange/infra/domain-source-parser.adapter.d.ts.map +0 -1
  234. package/dist/lib/arrange/infra/domain-source-parser.adapter.js +0 -19
  235. package/dist/lib/arrange/infra/ensure-cn-import.d.ts +0 -3
  236. package/dist/lib/arrange/infra/ensure-cn-import.d.ts.map +0 -1
  237. package/dist/lib/arrange/infra/ensure-cn-import.js +0 -6
  238. package/dist/lib/arrange/infra/file-walker.adapter.d.ts +0 -8
  239. package/dist/lib/arrange/infra/file-walker.adapter.d.ts.map +0 -1
  240. package/dist/lib/arrange/infra/file-walker.adapter.js +0 -17
  241. package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.d.ts +0 -8
  242. package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.d.ts.map +0 -1
  243. package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.js +0 -25
  244. package/dist/lib/arrange/infra/ts-ast-translator.d.ts +0 -10
  245. package/dist/lib/arrange/infra/ts-ast-translator.d.ts.map +0 -1
  246. package/dist/lib/arrange/infra/ts-ast-translator.js +0 -363
  247. package/dist/lib/arrange/presentation/formatters.d.ts +0 -3
  248. package/dist/lib/arrange/presentation/formatters.d.ts.map +0 -1
  249. package/dist/lib/arrange/presentation/formatters.js +0 -2
  250. package/dist/lib/arrange/presentation/report.d.ts +0 -4
  251. package/dist/lib/arrange/presentation/report.d.ts.map +0 -1
  252. package/dist/lib/arrange/presentation/report.js +0 -37
  253. package/dist/lib/config/domain/schema.d.ts +0 -50
  254. package/dist/lib/config/domain/schema.d.ts.map +0 -1
  255. package/dist/lib/config/domain/schema.js +0 -43
  256. package/dist/lib/config/index.d.ts +0 -4
  257. package/dist/lib/config/index.d.ts.map +0 -1
  258. package/dist/lib/config/index.js +0 -2
  259. package/dist/lib/config/infra/loader.d.ts +0 -11
  260. package/dist/lib/config/infra/loader.d.ts.map +0 -1
  261. package/dist/lib/config/infra/loader.js +0 -90
  262. package/dist/lib/core/application/architecture-boundaries.d.ts +0 -19
  263. package/dist/lib/core/application/architecture-boundaries.d.ts.map +0 -1
  264. package/dist/lib/core/application/architecture-boundaries.js +0 -263
  265. package/dist/lib/core/application/ports/cli-io.port.d.ts +0 -27
  266. package/dist/lib/core/application/ports/cli-io.port.d.ts.map +0 -1
  267. package/dist/lib/core/application/schema-parse.d.ts +0 -8
  268. package/dist/lib/core/application/schema-parse.d.ts.map +0 -1
  269. package/dist/lib/core/application/schema-parse.js +0 -20
  270. package/dist/lib/core/application/utils/caught-unknown-message.d.ts +0 -6
  271. package/dist/lib/core/application/utils/caught-unknown-message.d.ts.map +0 -1
  272. package/dist/lib/core/application/utils/caught-unknown-message.js +0 -34
  273. package/dist/lib/core/application/utils/verbose-diagnostics.d.ts +0 -5
  274. package/dist/lib/core/application/utils/verbose-diagnostics.d.ts.map +0 -1
  275. package/dist/lib/core/application/utils/verbose-diagnostics.js +0 -7
  276. package/dist/lib/core/domain/errors.d.ts +0 -11
  277. package/dist/lib/core/domain/errors.d.ts.map +0 -1
  278. package/dist/lib/core/domain/errors.js +0 -9
  279. package/dist/lib/core/domain/result.d.ts +0 -15
  280. package/dist/lib/core/domain/result.d.ts.map +0 -1
  281. package/dist/lib/core/domain/result.js +0 -9
  282. package/dist/lib/core/infra/container.d.ts +0 -34
  283. package/dist/lib/core/infra/container.d.ts.map +0 -1
  284. package/dist/lib/core/infra/container.js +0 -65
  285. package/dist/lib/core/infra/logging-decorator.d.ts +0 -12
  286. package/dist/lib/core/infra/logging-decorator.d.ts.map +0 -1
  287. package/dist/lib/core/infra/logging-decorator.js +0 -75
  288. package/dist/lib/core/presentation/cli-executor.d.ts +0 -33
  289. package/dist/lib/core/presentation/cli-executor.d.ts.map +0 -1
  290. package/dist/lib/core/presentation/cli-executor.js +0 -73
  291. package/dist/lib/core/presentation/create-command-handler.d.ts +0 -20
  292. package/dist/lib/core/presentation/create-command-handler.d.ts.map +0 -1
  293. package/dist/lib/core/presentation/create-command-handler.js +0 -70
  294. package/dist/lib/core/presentation/format-app-error.d.ts +0 -6
  295. package/dist/lib/core/presentation/format-app-error.d.ts.map +0 -1
  296. package/dist/lib/core/presentation/format-app-error.js +0 -19
  297. package/dist/lib/infra/caught-unknown-message.d.ts +0 -2
  298. package/dist/lib/infra/caught-unknown-message.d.ts.map +0 -1
  299. package/dist/lib/infra/caught-unknown-message.js +0 -1
  300. package/dist/lib/infra/config-reporter.d.ts +0 -4
  301. package/dist/lib/infra/config-reporter.d.ts.map +0 -1
  302. package/dist/lib/infra/config-reporter.js +0 -9
  303. package/dist/lib/infra/fs-contract.d.ts +0 -2
  304. package/dist/lib/infra/fs-contract.d.ts.map +0 -1
  305. package/dist/lib/infra/node-io.d.ts +0 -4
  306. package/dist/lib/infra/node-io.d.ts.map +0 -1
  307. package/dist/lib/infra/node-io.js +0 -27
  308. package/dist/lib/infra/workspace/repo-root.d.ts +0 -7
  309. package/dist/lib/infra/workspace/repo-root.d.ts.map +0 -1
  310. package/dist/lib/infra/workspace/repo-root.js +0 -23
  311. package/dist/lib/mirror/application/engine.d.ts +0 -10
  312. package/dist/lib/mirror/application/engine.d.ts.map +0 -1
  313. package/dist/lib/mirror/application/engine.js +0 -271
  314. package/dist/lib/mirror/application/ports/file-system-service.port.d.ts +0 -6
  315. package/dist/lib/mirror/application/ports/file-system-service.port.d.ts.map +0 -1
  316. package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.d.ts +0 -27
  317. package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.d.ts.map +0 -1
  318. package/dist/lib/mirror/application/ports/package-repository.port.d.ts +0 -16
  319. package/dist/lib/mirror/application/ports/package-repository.port.d.ts.map +0 -1
  320. package/dist/lib/mirror/application/ports/workspace-service.port.d.ts +0 -7
  321. package/dist/lib/mirror/application/ports/workspace-service.port.d.ts.map +0 -1
  322. package/dist/lib/mirror/application/requests/mirror-sync.request.d.ts +0 -10
  323. package/dist/lib/mirror/application/requests/mirror-sync.request.d.ts.map +0 -1
  324. package/dist/lib/mirror/application/requests/mirror-sync.request.js +0 -8
  325. package/dist/lib/mirror/application/sync.d.ts +0 -19
  326. package/dist/lib/mirror/application/sync.d.ts.map +0 -1
  327. package/dist/lib/mirror/application/sync.js +0 -168
  328. package/dist/lib/mirror/domain/constants.d.ts +0 -6
  329. package/dist/lib/mirror/domain/constants.d.ts.map +0 -1
  330. package/dist/lib/mirror/domain/constants.js +0 -5
  331. package/dist/lib/mirror/domain/errors.d.ts +0 -10
  332. package/dist/lib/mirror/domain/errors.d.ts.map +0 -1
  333. package/dist/lib/mirror/domain/errors.js +0 -12
  334. package/dist/lib/mirror/domain/types.d.ts +0 -65
  335. package/dist/lib/mirror/domain/types.d.ts.map +0 -1
  336. package/dist/lib/mirror/index.d.ts +0 -6
  337. package/dist/lib/mirror/index.d.ts.map +0 -1
  338. package/dist/lib/mirror/index.js +0 -1
  339. package/dist/lib/mirror/infra/dirent-list.d.ts +0 -9
  340. package/dist/lib/mirror/infra/dirent-list.d.ts.map +0 -1
  341. package/dist/lib/mirror/infra/dirent-list.js +0 -13
  342. package/dist/lib/mirror/infra/file-system-service.adapter.d.ts +0 -7
  343. package/dist/lib/mirror/infra/file-system-service.adapter.d.ts.map +0 -1
  344. package/dist/lib/mirror/infra/file-system-service.adapter.js +0 -47
  345. package/dist/lib/mirror/infra/mirror-sync-cli-options.d.ts +0 -14
  346. package/dist/lib/mirror/infra/mirror-sync-cli-options.d.ts.map +0 -1
  347. package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.d.ts +0 -3
  348. package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.d.ts.map +0 -1
  349. package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.js +0 -13
  350. package/dist/lib/mirror/infra/package-filter.d.ts +0 -8
  351. package/dist/lib/mirror/infra/package-filter.d.ts.map +0 -1
  352. package/dist/lib/mirror/infra/package-filter.js +0 -33
  353. package/dist/lib/mirror/infra/package-repository.adapter.d.ts +0 -17
  354. package/dist/lib/mirror/infra/package-repository.adapter.d.ts.map +0 -1
  355. package/dist/lib/mirror/infra/package-repository.adapter.js +0 -17
  356. package/dist/lib/mirror/infra/path-normalizer.d.ts +0 -2
  357. package/dist/lib/mirror/infra/path-normalizer.d.ts.map +0 -1
  358. package/dist/lib/mirror/infra/path-normalizer.js +0 -4
  359. package/dist/lib/mirror/infra/update-pkg.d.ts +0 -19
  360. package/dist/lib/mirror/infra/update-pkg.d.ts.map +0 -1
  361. package/dist/lib/mirror/infra/update-pkg.js +0 -156
  362. package/dist/lib/mirror/infra/workspace-packages.d.ts +0 -26
  363. package/dist/lib/mirror/infra/workspace-packages.d.ts.map +0 -1
  364. package/dist/lib/mirror/infra/workspace-packages.js +0 -170
  365. package/dist/lib/mirror/infra/workspace-service.adapter.d.ts +0 -8
  366. package/dist/lib/mirror/infra/workspace-service.adapter.d.ts.map +0 -1
  367. package/dist/lib/mirror/infra/workspace-service.adapter.js +0 -10
  368. package/dist/lib/mirror/presentation/reporter.d.ts +0 -25
  369. package/dist/lib/mirror/presentation/reporter.d.ts.map +0 -1
  370. package/dist/lib/mirror/presentation/reporter.js +0 -140
  371. package/dist/lib/shared/source-code/domain/text-edit.d.ts +0 -14
  372. package/dist/lib/shared/source-code/domain/text-edit.d.ts.map +0 -1
  373. package/dist/lib/shared/source-code/domain/text-edit.js +0 -30
  374. package/dist/lib/shared/source-code/infra/tsx-file-walk.d.ts +0 -4
  375. package/dist/lib/shared/source-code/infra/tsx-file-walk.d.ts.map +0 -1
  376. package/dist/lib/shared/source-code/infra/tsx-file-walk.js +0 -37
  377. package/dist/lib/tag/application/engine.d.ts +0 -23
  378. package/dist/lib/tag/application/engine.d.ts.map +0 -1
  379. package/dist/lib/tag/application/engine.js +0 -357
  380. package/dist/lib/tag/application/ports/target-resolver.port.d.ts +0 -6
  381. package/dist/lib/tag/application/ports/target-resolver.port.d.ts.map +0 -1
  382. package/dist/lib/tag/application/ports/typescript-tree-walk.port.d.ts +0 -6
  383. package/dist/lib/tag/application/ports/typescript-tree-walk.port.d.ts.map +0 -1
  384. package/dist/lib/tag/application/requests/tag-sync.request.d.ts +0 -10
  385. package/dist/lib/tag/application/requests/tag-sync.request.d.ts.map +0 -1
  386. package/dist/lib/tag/application/requests/tag-sync.request.js +0 -8
  387. package/dist/lib/tag/domain/types.d.ts +0 -56
  388. package/dist/lib/tag/domain/types.d.ts.map +0 -1
  389. package/dist/lib/tag/index.d.ts +0 -14
  390. package/dist/lib/tag/index.d.ts.map +0 -1
  391. package/dist/lib/tag/index.js +0 -10
  392. package/dist/lib/tag/infra/tag-sync-cli-options.d.ts +0 -14
  393. package/dist/lib/tag/infra/tag-sync-cli-options.d.ts.map +0 -1
  394. package/dist/lib/tag/infra/tag-target-resolver.adapter.d.ts +0 -3
  395. package/dist/lib/tag/infra/tag-target-resolver.adapter.d.ts.map +0 -1
  396. package/dist/lib/tag/infra/tag-target-resolver.adapter.js +0 -4
  397. package/dist/lib/tag/infra/target-resolver.d.ts +0 -4
  398. package/dist/lib/tag/infra/target-resolver.d.ts.map +0 -1
  399. package/dist/lib/tag/infra/target-resolver.js +0 -200
  400. package/dist/lib/tag/infra/typescript-tree-walk.adapter.d.ts +0 -3
  401. package/dist/lib/tag/infra/typescript-tree-walk.adapter.d.ts.map +0 -1
  402. package/dist/lib/tag/infra/typescript-tree-walk.adapter.js +0 -4
  403. package/dist/lib/tag/presentation/colors.d.ts +0 -8
  404. package/dist/lib/tag/presentation/colors.d.ts.map +0 -1
  405. package/dist/lib/tag/presentation/colors.js +0 -9
  406. package/dist/lib/tag/presentation/tag-presenter.d.ts +0 -20
  407. package/dist/lib/tag/presentation/tag-presenter.d.ts.map +0 -1
  408. package/dist/lib/tag/presentation/tag-presenter.js +0 -92
  409. package/dist/program.d.ts +0 -4
  410. package/dist/program.d.ts.map +0 -1
  411. package/dist/program.js +0 -40
  412. /package/dist/lib/arrange/application/ports/{domain-source-parser.port.js → domain-source-parser.port.mjs} +0 -0
  413. /package/dist/lib/arrange/application/ports/{file-walker.port.js → file-walker.port.mjs} +0 -0
  414. /package/dist/lib/arrange/{infra/arrange-sync-cli-options.js → application/ports/group-file-preview.port.mjs} +0 -0
  415. /package/dist/lib/{core/application/ports/cli-io.port.js → arrange/application/requests/analyze-directory.request.mjs} +0 -0
  416. /package/dist/lib/{infra/fs-contract.js → arrange/application/requests/arrange-sync.request.mjs} +0 -0
  417. /package/dist/lib/{mirror/application/ports/file-system-service.port.js → arrange/application/requests/suggest-groups.request.mjs} +0 -0
  418. /package/dist/lib/{mirror/application/ports/mirror-sync-reporter.port.js → arrange/contracts/models.mjs} +0 -0
  419. /package/dist/lib/{mirror/application/ports/package-repository.port.js → arrange/contracts/presentation.contract.mjs} +0 -0
  420. /package/dist/lib/{mirror/application/ports/workspace-service.port.js → arrange/contracts/services.contract.mjs} +0 -0
  421. /package/dist/lib/{mirror/domain/types.js → arrange/contracts/use-cases.contract.mjs} +0 -0
  422. /package/dist/lib/{mirror/infra/mirror-sync-cli-options.js → arrange/domain/types.domain.mjs} +0 -0
  423. /package/dist/lib/{tag/application/ports/target-resolver.port.js → arrange/infra/arrange-sync-cli-options.adapter.mjs} +0 -0
  424. /package/dist/lib/{tag/application/ports/typescript-tree-walk.port.js → config/application/ports/config-loader.port.mjs} +0 -0
  425. /package/dist/lib/{tag/domain/types.js → config/domain/schema.domain.mjs} +0 -0
  426. /package/dist/lib/{tag/infra/tag-sync-cli-options.js → core/application/ports/cli-io.port.mjs} +0 -0
@@ -0,0 +1,302 @@
1
+ import { CliFsToken, CliLoggerToken } from "../../../core/operational/contracts/tokens.mjs";
2
+ import { appError } from "../../../core/domain/errors.domain.mjs";
3
+ import { err, ok } from "../../../core/domain/result.model.mjs";
4
+ import { messageFromCaughtUnknown } from "../../../core/application/utils/caught-unknown-message.util.mjs";
5
+ import { MirrorSyncReporterPortToken, SyncWorkspacePackageServiceToken, WorkspaceServicePortToken } from "../../contracts/tokens.mjs";
6
+ import { formatMirrorSyncJsonOutput } from "../mirror-sync-json.format.mjs";
7
+ import { injectable } from "@codefast/di";
8
+ //#region src/lib/mirror/application/use-cases/run-mirror-sync.use-case.ts
9
+ function toPrimitive(input, hint) {
10
+ if (typeof input !== "object" || input === null) return input;
11
+ var prim = input[Symbol.toPrimitive];
12
+ if (prim !== void 0) {
13
+ var res = prim.call(input, hint || "default");
14
+ if (typeof res !== "object") return res;
15
+ throw new TypeError("@@toPrimitive must return a primitive value.");
16
+ }
17
+ return (hint === "string" ? String : Number)(input);
18
+ }
19
+ function toPropertyKey(arg) {
20
+ var key = toPrimitive(arg, "string");
21
+ return typeof key === "symbol" ? key : String(key);
22
+ }
23
+ function checkInRHS(value) {
24
+ if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
25
+ return value;
26
+ }
27
+ function setFunctionName(fn, name, prefix) {
28
+ if (typeof name === "symbol") {
29
+ name = name.description;
30
+ name = name ? "[" + name + "]" : "";
31
+ }
32
+ try {
33
+ Object.defineProperty(fn, "name", {
34
+ configurable: true,
35
+ value: prefix ? prefix + " " + name : name
36
+ });
37
+ } catch (_) {}
38
+ return fn;
39
+ }
40
+ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
41
+ var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
42
+ var defineProperty = Object.defineProperty;
43
+ var create = Object.create;
44
+ var metadata;
45
+ var existingNonFields = [create(null), create(null)];
46
+ var hasClassDecs = classDecs.length;
47
+ var _;
48
+ function createRunInitializers(initializers, useStaticThis, hasValue) {
49
+ return function(thisArg, value) {
50
+ if (useStaticThis) {
51
+ value = thisArg;
52
+ thisArg = targetClass;
53
+ }
54
+ for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
55
+ return hasValue ? value : thisArg;
56
+ };
57
+ }
58
+ function assertCallable(fn, hint1, hint2, throwUndefined) {
59
+ if (typeof fn !== "function") {
60
+ if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
61
+ }
62
+ return fn;
63
+ }
64
+ function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
65
+ function assertInstanceIfPrivate(target) {
66
+ if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
67
+ }
68
+ var decs = [].concat(decInfo[0]);
69
+ var decVal = decInfo[3];
70
+ var isClass = !ret;
71
+ var isAccessor = kind === 1;
72
+ var isGetter = kind === 3;
73
+ var isSetter = kind === 4;
74
+ var isMethod = kind === 2;
75
+ function bindPropCall(name, useStaticThis, before) {
76
+ return function(_this, value) {
77
+ if (useStaticThis) {
78
+ value = _this;
79
+ _this = Class;
80
+ }
81
+ if (before) before(_this);
82
+ return desc[name].call(_this, value);
83
+ };
84
+ }
85
+ var desc1 = {};
86
+ var init = [];
87
+ var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
88
+ if (!isClass) {
89
+ if (isPrivate) {
90
+ if (isField || isAccessor) desc1 = {
91
+ get: setFunctionName(function() {
92
+ return decVal(this);
93
+ }, name, "get"),
94
+ set: function(value) {
95
+ decInfo[4](this, value);
96
+ }
97
+ };
98
+ else desc1[key] = decVal;
99
+ if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
100
+ } else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
101
+ if (!isField && !isPrivate) {
102
+ _ = existingNonFields[+isStatic][name];
103
+ if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
104
+ existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
105
+ }
106
+ }
107
+ var newValue = Class;
108
+ for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
109
+ var dec = assertCallable(decs[i], "A decorator", "be", true);
110
+ var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
111
+ var decoratorFinishedRef = {};
112
+ var ctx = {
113
+ kind: [
114
+ "field",
115
+ "accessor",
116
+ "method",
117
+ "getter",
118
+ "setter",
119
+ "class"
120
+ ][kind],
121
+ name,
122
+ metadata,
123
+ addInitializer: (function(decoratorFinishedRef, initializer) {
124
+ if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
125
+ assertCallable(initializer, "An initializer", "be", true);
126
+ initializers.push(initializer);
127
+ }).bind(null, decoratorFinishedRef)
128
+ };
129
+ if (isClass) {
130
+ _ = dec.call(decThis, newValue, ctx);
131
+ decoratorFinishedRef.v = 1;
132
+ if (assertCallable(_, "class decorators", "return")) newValue = _;
133
+ continue;
134
+ }
135
+ ctx.static = isStatic;
136
+ ctx.private = isPrivate;
137
+ _ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
138
+ return name in target;
139
+ } };
140
+ if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
141
+ assertInstanceIfPrivate(_this);
142
+ return desc1.value;
143
+ } : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
144
+ return target[name];
145
+ };
146
+ if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
147
+ target[name] = value;
148
+ };
149
+ newValue = dec.call(decThis, isAccessor ? {
150
+ get: desc1.get,
151
+ set: desc1.set
152
+ } : desc1[key], ctx);
153
+ decoratorFinishedRef.v = 1;
154
+ if (isAccessor) {
155
+ if (typeof newValue === "object" && newValue) {
156
+ if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
157
+ if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
158
+ if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
159
+ } else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
160
+ } else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
161
+ else desc1[key] = newValue;
162
+ }
163
+ if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
164
+ if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
165
+ else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
166
+ else defineProperty(Class, name, desc1);
167
+ return newValue;
168
+ }
169
+ function applyMemberDecs() {
170
+ var ret = [];
171
+ var protoInitializers;
172
+ var staticInitializers;
173
+ var pushInitializers = function(initializers) {
174
+ if (initializers) ret.push(createRunInitializers(initializers));
175
+ };
176
+ var applyMemberDecsOfKind = function(isStatic, isField) {
177
+ for (var i = 0; i < memberDecs.length; i++) {
178
+ var decInfo = memberDecs[i];
179
+ var kind = decInfo[1];
180
+ var kindOnly = kind & 7;
181
+ if ((kind & 8) == isStatic && !kindOnly == isField) {
182
+ var name = decInfo[2];
183
+ var isPrivate = !!decInfo[3];
184
+ var decoratorsHaveThis = kind & 16;
185
+ applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
186
+ return checkInRHS(_) === targetClass;
187
+ } : instanceBrand);
188
+ }
189
+ }
190
+ };
191
+ applyMemberDecsOfKind(8, 0);
192
+ applyMemberDecsOfKind(0, 0);
193
+ applyMemberDecsOfKind(8, 1);
194
+ applyMemberDecsOfKind(0, 1);
195
+ pushInitializers(protoInitializers);
196
+ pushInitializers(staticInitializers);
197
+ return ret;
198
+ }
199
+ function defineMetadata(Class) {
200
+ return defineProperty(Class, symbolMetadata, {
201
+ configurable: true,
202
+ enumerable: true,
203
+ value: metadata
204
+ });
205
+ }
206
+ if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
207
+ metadata = create(metadata == null ? null : metadata);
208
+ _ = applyMemberDecs();
209
+ if (!hasClassDecs) defineMetadata(targetClass);
210
+ return {
211
+ e: _,
212
+ get c() {
213
+ var initializers = [];
214
+ return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
215
+ }
216
+ };
217
+ }
218
+ let _dec, _initClass;
219
+ _dec = injectable([
220
+ CliFsToken,
221
+ CliLoggerToken,
222
+ WorkspaceServicePortToken,
223
+ MirrorSyncReporterPortToken,
224
+ SyncWorkspacePackageServiceToken
225
+ ]);
226
+ let _RunMirrorSyncUseCaseImpl;
227
+ (class {
228
+ fs;
229
+ logger;
230
+ workspaceService;
231
+ mirrorReporter;
232
+ syncWorkspacePackage;
233
+ static {
234
+ ({c: [_RunMirrorSyncUseCaseImpl, _initClass]} = _apply_decs_2311(this, [_dec], []));
235
+ }
236
+ constructor(fs, logger, workspaceService, mirrorReporter, syncWorkspacePackage) {
237
+ this.fs = fs;
238
+ this.logger = logger;
239
+ this.workspaceService = workspaceService;
240
+ this.mirrorReporter = mirrorReporter;
241
+ this.syncWorkspacePackage = syncWorkspacePackage;
242
+ }
243
+ async execute(request) {
244
+ const config = request.config ?? {};
245
+ const json = !!request.json;
246
+ if (!json) {
247
+ this.mirrorReporter.configureMirrorColors(!!request.noColor);
248
+ this.mirrorReporter.mirrorBanner(this.logger);
249
+ }
250
+ const startTime = performance.now();
251
+ const verbose = !!request.verbose;
252
+ try {
253
+ const stats = {
254
+ packagesFound: 0,
255
+ packagesProcessed: 0,
256
+ packagesSkipped: 0,
257
+ packagesErrored: 0,
258
+ totalExports: 0,
259
+ totalJsModules: 0,
260
+ totalCssExports: 0,
261
+ packageDetails: []
262
+ };
263
+ let targetPackages = [];
264
+ if (request.packageFilter) {
265
+ targetPackages = [this.workspaceService.resolvePackageFilterUnderRoot(request.rootDir, request.packageFilter)];
266
+ if (!json) this.mirrorReporter.mirrorProcessingMode(this.logger, { kind: "single" });
267
+ } else {
268
+ const { relPaths, multiSource } = await this.workspaceService.findWorkspacePackageRelPaths(request.rootDir, this.fs, json ? () => {} : (message) => this.mirrorReporter.logWorkspaceGlobWarning(this.logger, message));
269
+ targetPackages = relPaths;
270
+ if (!json) this.mirrorReporter.mirrorProcessingMode(this.logger, {
271
+ kind: "multi",
272
+ source: multiSource
273
+ });
274
+ }
275
+ stats.packagesFound = targetPackages.length;
276
+ if (targetPackages.length === 0) {
277
+ if (!json) this.mirrorReporter.mirrorNoPackages(this.logger);
278
+ const elapsedEmpty = (performance.now() - startTime) / 1e3;
279
+ if (json) this.logger.out(formatMirrorSyncJsonOutput(stats, elapsedEmpty));
280
+ return ok(stats);
281
+ }
282
+ let nextPackageOrdinal = 1;
283
+ for (const pkgPath of targetPackages) {
284
+ const pkgStats = await this.syncWorkspacePackage.syncExportsForWorkspacePackage(request.rootDir, pkgPath, nextPackageOrdinal++, targetPackages.length, config, verbose, stats, json);
285
+ stats.packageDetails.push(pkgStats);
286
+ }
287
+ const elapsed = (performance.now() - startTime) / 1e3;
288
+ if (!json) {
289
+ this.mirrorReporter.mirrorSummarySeparator(this.logger);
290
+ this.mirrorReporter.mirrorSummary(this.logger, stats, elapsed);
291
+ } else this.logger.out(formatMirrorSyncJsonOutput(stats, elapsed));
292
+ return ok(stats);
293
+ } catch (caughtError) {
294
+ return err(appError("INFRA_FAILURE", messageFromCaughtUnknown(caughtError), caughtError));
295
+ }
296
+ }
297
+ static {
298
+ _initClass();
299
+ }
300
+ });
301
+ //#endregion
302
+ export { _RunMirrorSyncUseCaseImpl as RunMirrorSyncUseCaseImpl };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { token } from "@codefast/di";
2
+ //#region src/lib/mirror/contracts/tokens.ts
3
+ const WorkspaceServicePortToken = token("WorkspaceServicePort");
4
+ const PackageRepositoryPortToken = token("PackageRepositoryPort");
5
+ const FileSystemServicePortToken = token("FileSystemServicePort");
6
+ const MirrorSyncReporterPortToken = token("MirrorSyncReporterPort");
7
+ const SyncWorkspacePackageServiceToken = token("SyncWorkspacePackageService");
8
+ const RunMirrorSyncUseCaseToken = token("RunMirrorSyncUseCase");
9
+ const PrepareMirrorOrchestratorToken = token("PrepareMirrorOrchestrator");
10
+ //#endregion
11
+ export { FileSystemServicePortToken, MirrorSyncReporterPortToken, PackageRepositoryPortToken, PrepareMirrorOrchestratorToken, RunMirrorSyncUseCaseToken, SyncWorkspacePackageServiceToken, WorkspaceServicePortToken };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ //#region src/lib/mirror/domain/constants.domain.ts
2
+ const DIST_DIR = "dist";
3
+ const PACKAGE_JSON = "package.json";
4
+ const VALID_JS_EXTENSIONS = new Set([
5
+ ".js",
6
+ ".mjs",
7
+ ".cjs"
8
+ ]);
9
+ const VALID_DTS_EXTENSIONS = new Set([
10
+ ".d.ts",
11
+ ".d.mts",
12
+ ".d.cts"
13
+ ]);
14
+ const PACKAGE_JSON_EXPORT = "./package.json";
15
+ //#endregion
16
+ export { DIST_DIR, PACKAGE_JSON, PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS };
@@ -0,0 +1,15 @@
1
+ //#region src/lib/mirror/domain/errors.domain.ts
2
+ const MirrorErrorCode = {
3
+ FATAL: "FATAL",
4
+ PACKAGE_WRITE: "PACKAGE_WRITE"
5
+ };
6
+ var MirrorError = class extends Error {
7
+ code;
8
+ constructor(code, message, options) {
9
+ super(message, options);
10
+ this.name = "MirrorError";
11
+ this.code = code;
12
+ }
13
+ };
14
+ //#endregion
15
+ export { MirrorError, MirrorErrorCode };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ //#region src/lib/mirror/infra/dirent-list.adapter.ts
2
+ /**
3
+ * Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
4
+ * Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
5
+ * Returning `true` for an empty array is intentional: callers treat empty lists
6
+ * the same regardless of the element type, so `[]` is safely accepted as `Dirent[]`.
7
+ */ function isDirentList(x) {
8
+ if (x.length === 0) return true;
9
+ const first = x[0];
10
+ return typeof first === "object" && first !== null && "isFile" in first && "isDirectory" in first;
11
+ }
12
+ //#endregion
13
+ export { isDirentList };
@@ -0,0 +1,256 @@
1
+ import { isDirentList } from "./dirent-list.adapter.mjs";
2
+ import { normalizePath } from "./path-normalizer.adapter.mjs";
3
+ import path from "node:path";
4
+ import { injectable } from "@codefast/di";
5
+ //#region src/lib/mirror/infra/file-system-service.adapter.ts
6
+ function toPrimitive(input, hint) {
7
+ if (typeof input !== "object" || input === null) return input;
8
+ var prim = input[Symbol.toPrimitive];
9
+ if (prim !== void 0) {
10
+ var res = prim.call(input, hint || "default");
11
+ if (typeof res !== "object") return res;
12
+ throw new TypeError("@@toPrimitive must return a primitive value.");
13
+ }
14
+ return (hint === "string" ? String : Number)(input);
15
+ }
16
+ function toPropertyKey(arg) {
17
+ var key = toPrimitive(arg, "string");
18
+ return typeof key === "symbol" ? key : String(key);
19
+ }
20
+ function checkInRHS(value) {
21
+ if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
22
+ return value;
23
+ }
24
+ function setFunctionName(fn, name, prefix) {
25
+ if (typeof name === "symbol") {
26
+ name = name.description;
27
+ name = name ? "[" + name + "]" : "";
28
+ }
29
+ try {
30
+ Object.defineProperty(fn, "name", {
31
+ configurable: true,
32
+ value: prefix ? prefix + " " + name : name
33
+ });
34
+ } catch (_) {}
35
+ return fn;
36
+ }
37
+ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
38
+ var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
39
+ var defineProperty = Object.defineProperty;
40
+ var create = Object.create;
41
+ var metadata;
42
+ var existingNonFields = [create(null), create(null)];
43
+ var hasClassDecs = classDecs.length;
44
+ var _;
45
+ function createRunInitializers(initializers, useStaticThis, hasValue) {
46
+ return function(thisArg, value) {
47
+ if (useStaticThis) {
48
+ value = thisArg;
49
+ thisArg = targetClass;
50
+ }
51
+ for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
52
+ return hasValue ? value : thisArg;
53
+ };
54
+ }
55
+ function assertCallable(fn, hint1, hint2, throwUndefined) {
56
+ if (typeof fn !== "function") {
57
+ if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
58
+ }
59
+ return fn;
60
+ }
61
+ function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
62
+ function assertInstanceIfPrivate(target) {
63
+ if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
64
+ }
65
+ var decs = [].concat(decInfo[0]);
66
+ var decVal = decInfo[3];
67
+ var isClass = !ret;
68
+ var isAccessor = kind === 1;
69
+ var isGetter = kind === 3;
70
+ var isSetter = kind === 4;
71
+ var isMethod = kind === 2;
72
+ function bindPropCall(name, useStaticThis, before) {
73
+ return function(_this, value) {
74
+ if (useStaticThis) {
75
+ value = _this;
76
+ _this = Class;
77
+ }
78
+ if (before) before(_this);
79
+ return desc[name].call(_this, value);
80
+ };
81
+ }
82
+ var desc1 = {};
83
+ var init = [];
84
+ var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
85
+ if (!isClass) {
86
+ if (isPrivate) {
87
+ if (isField || isAccessor) desc1 = {
88
+ get: setFunctionName(function() {
89
+ return decVal(this);
90
+ }, name, "get"),
91
+ set: function(value) {
92
+ decInfo[4](this, value);
93
+ }
94
+ };
95
+ else desc1[key] = decVal;
96
+ if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
97
+ } else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
98
+ if (!isField && !isPrivate) {
99
+ _ = existingNonFields[+isStatic][name];
100
+ if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
101
+ existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
102
+ }
103
+ }
104
+ var newValue = Class;
105
+ for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
106
+ var dec = assertCallable(decs[i], "A decorator", "be", true);
107
+ var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
108
+ var decoratorFinishedRef = {};
109
+ var ctx = {
110
+ kind: [
111
+ "field",
112
+ "accessor",
113
+ "method",
114
+ "getter",
115
+ "setter",
116
+ "class"
117
+ ][kind],
118
+ name,
119
+ metadata,
120
+ addInitializer: (function(decoratorFinishedRef, initializer) {
121
+ if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
122
+ assertCallable(initializer, "An initializer", "be", true);
123
+ initializers.push(initializer);
124
+ }).bind(null, decoratorFinishedRef)
125
+ };
126
+ if (isClass) {
127
+ _ = dec.call(decThis, newValue, ctx);
128
+ decoratorFinishedRef.v = 1;
129
+ if (assertCallable(_, "class decorators", "return")) newValue = _;
130
+ continue;
131
+ }
132
+ ctx.static = isStatic;
133
+ ctx.private = isPrivate;
134
+ _ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
135
+ return name in target;
136
+ } };
137
+ if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
138
+ assertInstanceIfPrivate(_this);
139
+ return desc1.value;
140
+ } : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
141
+ return target[name];
142
+ };
143
+ if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
144
+ target[name] = value;
145
+ };
146
+ newValue = dec.call(decThis, isAccessor ? {
147
+ get: desc1.get,
148
+ set: desc1.set
149
+ } : desc1[key], ctx);
150
+ decoratorFinishedRef.v = 1;
151
+ if (isAccessor) {
152
+ if (typeof newValue === "object" && newValue) {
153
+ if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
154
+ if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
155
+ if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
156
+ } else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
157
+ } else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
158
+ else desc1[key] = newValue;
159
+ }
160
+ if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
161
+ if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
162
+ else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
163
+ else defineProperty(Class, name, desc1);
164
+ return newValue;
165
+ }
166
+ function applyMemberDecs() {
167
+ var ret = [];
168
+ var protoInitializers;
169
+ var staticInitializers;
170
+ var pushInitializers = function(initializers) {
171
+ if (initializers) ret.push(createRunInitializers(initializers));
172
+ };
173
+ var applyMemberDecsOfKind = function(isStatic, isField) {
174
+ for (var i = 0; i < memberDecs.length; i++) {
175
+ var decInfo = memberDecs[i];
176
+ var kind = decInfo[1];
177
+ var kindOnly = kind & 7;
178
+ if ((kind & 8) == isStatic && !kindOnly == isField) {
179
+ var name = decInfo[2];
180
+ var isPrivate = !!decInfo[3];
181
+ var decoratorsHaveThis = kind & 16;
182
+ applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
183
+ return checkInRHS(_) === targetClass;
184
+ } : instanceBrand);
185
+ }
186
+ }
187
+ };
188
+ applyMemberDecsOfKind(8, 0);
189
+ applyMemberDecsOfKind(0, 0);
190
+ applyMemberDecsOfKind(8, 1);
191
+ applyMemberDecsOfKind(0, 1);
192
+ pushInitializers(protoInitializers);
193
+ pushInitializers(staticInitializers);
194
+ return ret;
195
+ }
196
+ function defineMetadata(Class) {
197
+ return defineProperty(Class, symbolMetadata, {
198
+ configurable: true,
199
+ enumerable: true,
200
+ value: metadata
201
+ });
202
+ }
203
+ if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
204
+ metadata = create(metadata == null ? null : metadata);
205
+ _ = applyMemberDecs();
206
+ if (!hasClassDecs) defineMetadata(targetClass);
207
+ return {
208
+ e: _,
209
+ get c() {
210
+ var initializers = [];
211
+ return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
212
+ }
213
+ };
214
+ }
215
+ let _dec, _initClass;
216
+ function isKnownReadDirError(caughtError) {
217
+ return typeof caughtError === "object" && caughtError !== null && "code" in caughtError && (caughtError.code === "ENOENT" || caughtError.code === "EACCES");
218
+ }
219
+ _dec = injectable([]);
220
+ let _FileSystemServiceAdapter;
221
+ (class {
222
+ static {
223
+ ({c: [_FileSystemServiceAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
224
+ }
225
+ async listRelativeFilesRecursively(fs, dirPath) {
226
+ try {
227
+ const raw = await fs.readdir(dirPath, {
228
+ recursive: true,
229
+ withFileTypes: true
230
+ });
231
+ if (!isDirentList(raw)) return [];
232
+ return raw.filter((dirent) => dirent.isFile()).map((dirent) => {
233
+ const fullPath = path.join(dirent.parentPath, dirent.name);
234
+ return normalizePath(path.relative(dirPath, fullPath));
235
+ });
236
+ } catch (caughtError) {
237
+ if (isKnownReadDirError(caughtError)) return [];
238
+ throw caughtError;
239
+ }
240
+ }
241
+ async isDirectoryCssOnly(fs, distDir, dirPath) {
242
+ try {
243
+ const raw = await fs.readdir(path.join(distDir, dirPath), { withFileTypes: true });
244
+ if (!isDirentList(raw)) return false;
245
+ if (raw.length === 0) return true;
246
+ return raw.every((dirent) => dirent.isFile() && dirent.name.endsWith(".css"));
247
+ } catch {
248
+ return false;
249
+ }
250
+ }
251
+ static {
252
+ _initClass();
253
+ }
254
+ });
255
+ //#endregion
256
+ export { _FileSystemServiceAdapter as FileSystemServiceAdapter };