@codefast/cli 0.3.15 → 0.3.16-canary.1

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 (209) hide show
  1. package/README.md +1 -1
  2. package/dist/arrange/analyze.mjs +24 -0
  3. package/dist/{domains/arrange/presentation/presenters/arrange-cli.schema.mjs → arrange/cli-schema.mjs} +10 -1
  4. package/dist/arrange/command.mjs +106 -0
  5. package/dist/{domains/arrange/domain/arrange-analyze.domain-service.mjs → arrange/domain/analyze-service.mjs} +17 -10
  6. package/dist/{domains/arrange/domain/ast/ast-node.model.mjs → arrange/domain/ast/ast-node.mjs} +57 -3
  7. package/dist/{domains/arrange/domain/ast/collectors-cn.collector.mjs → arrange/domain/ast/collectors-cn.mjs} +21 -9
  8. package/dist/{domains/arrange/domain/ast/collectors-jsx.collector.mjs → arrange/domain/ast/collectors-jsx.mjs} +5 -2
  9. package/dist/{domains/arrange/domain/ast/collectors-tv.collector.mjs → arrange/domain/ast/collectors-tv.mjs} +21 -6
  10. package/dist/{domains/arrange/domain/ast/ast-helpers.helper.mjs → arrange/domain/ast/helpers.mjs} +26 -9
  11. package/dist/{domains/arrange/domain/ast/targets.model.mjs → arrange/domain/ast/targets.mjs} +19 -10
  12. package/dist/{domains/arrange/domain/constants.domain.mjs → arrange/domain/constants.mjs} +61 -16
  13. package/dist/{domains/arrange/domain/arrange-grouping.domain-service.mjs → arrange/domain/grouping-service.mjs} +31 -10
  14. package/dist/{domains/arrange/domain/grouping.domain.mjs → arrange/domain/grouping.mjs} +39 -18
  15. package/dist/{domains/arrange/domain/imports.domain.mjs → arrange/domain/imports.mjs} +7 -3
  16. package/dist/{domains/arrange/domain/source-text-formatters.formatter.mjs → arrange/domain/source-text-formatters.mjs} +22 -5
  17. package/dist/{domains/arrange/domain/tailwind-token.value-object.mjs → arrange/domain/tailwind-token.mjs} +12 -3
  18. package/dist/{domains/arrange/domain/tailwind-token-classifier.domain-service.mjs → arrange/domain/token-classifier.mjs} +39 -14
  19. package/dist/arrange/output.mjs +79 -0
  20. package/dist/arrange/process-file.mjs +42 -0
  21. package/dist/arrange/resolve-target.mjs +24 -0
  22. package/dist/arrange/scan-target.mjs +20 -0
  23. package/dist/arrange/source-parse.mjs +18 -0
  24. package/dist/arrange/suggest.mjs +15 -0
  25. package/dist/arrange/sync.mjs +51 -0
  26. package/dist/arrange/typescript-ast-translator.mjs +354 -0
  27. package/dist/arrange/workspace.mjs +31 -0
  28. package/dist/bin.mjs +1 -1
  29. package/dist/{program.mjs → cli.mjs} +14 -20
  30. package/dist/core/cli/format-error.mjs +15 -0
  31. package/dist/core/cli/global-options.mjs +10 -0
  32. package/dist/core/cli/positional.mjs +11 -0
  33. package/dist/core/cli/result-handle.mjs +51 -0
  34. package/dist/core/config/loader.mjs +79 -0
  35. package/dist/{domains/config/domain/codefast-config.schema.mjs → core/config/schema.mjs} +16 -2
  36. package/dist/core/config/warnings.mjs +12 -0
  37. package/dist/core/config.mjs +19 -0
  38. package/dist/{shell/domain/caught-unknown-message.value-object.mjs → core/errors.mjs} +20 -4
  39. package/dist/core/exit-codes.mjs +17 -0
  40. package/dist/core/filesystem/node.mjs +32 -0
  41. package/dist/core/logger.mjs +15 -0
  42. package/dist/{shell/domain/result.model.mjs → core/result.mjs} +7 -3
  43. package/dist/core/schema-parse.mjs +18 -0
  44. package/dist/{shell/domain/source-text-edit.support.mjs → core/source-text-edit.mjs} +14 -13
  45. package/dist/core/verbose-diagnostics.mjs +11 -0
  46. package/dist/core/workspace/resolver.mjs +177 -0
  47. package/dist/core/workspace/typescript-walk.mjs +36 -0
  48. package/dist/{domains/mirror/application/mirror-sync-cli-result.mjs → mirror/cli-result.mjs} +8 -2
  49. package/dist/{domains/mirror/presentation/presenters/mirror-cli.schema.mjs → mirror/cli-schema.mjs} +4 -1
  50. package/dist/mirror/command.mjs +57 -0
  51. package/dist/mirror/dist-filesystem-impl.mjs +42 -0
  52. package/dist/{domains/mirror/domain/constants.domain.mjs → mirror/domain/constants.mjs} +16 -1
  53. package/dist/{domains/mirror/infrastructure/guards/dirent-list.guard.mjs → mirror/domain/dirent-guard.mjs} +5 -2
  54. package/dist/{domains/mirror/domain/errors.domain.mjs → mirror/domain/errors.mjs} +7 -1
  55. package/dist/{domains/mirror/domain/generate-mirror-exports.domain-service.mjs → mirror/domain/exports.mjs} +17 -10
  56. package/dist/{domains/mirror/domain/package-display-name.policy.mjs → mirror/domain/package-display-name.mjs} +5 -2
  57. package/dist/{domains/mirror/domain/path-normalizer.value-object.mjs → mirror/domain/path-normalizer.mjs} +4 -1
  58. package/dist/mirror/output.mjs +45 -0
  59. package/dist/mirror/package-path.mjs +32 -0
  60. package/dist/mirror/prepare.mjs +33 -0
  61. package/dist/mirror/sync-reporter.mjs +104 -0
  62. package/dist/mirror/sync-workspace-package.mjs +103 -0
  63. package/dist/mirror/sync.mjs +87 -0
  64. package/dist/{domains/mirror/infrastructure/package-json-exports.repository.mjs → mirror/write-exports.mjs} +11 -7
  65. package/dist/tag/cli-result.mjs +11 -0
  66. package/dist/{domains/tag/presentation/presenters/tag-cli.schema.mjs → tag/cli-schema.mjs} +4 -1
  67. package/dist/tag/command.mjs +56 -0
  68. package/dist/tag/output.mjs +87 -0
  69. package/dist/tag/prepare.mjs +29 -0
  70. package/dist/tag/resolve-target-path.mjs +12 -0
  71. package/dist/tag/since-writer.mjs +131 -0
  72. package/dist/tag/sync.mjs +141 -0
  73. package/dist/tag/target-candidates.mjs +68 -0
  74. package/dist/tag/target-runner.mjs +26 -0
  75. package/dist/tag/version-resolver.mjs +25 -0
  76. package/package.json +11 -11
  77. package/dist/bootstrap/cli-application.module.mjs +0 -18
  78. package/dist/bootstrap/composition-root.mjs +0 -14
  79. package/dist/bootstrap/register-cli-command-trees.mjs +0 -7
  80. package/dist/domains/arrange/application/ports/outbound/arrange-target-scanner.port.mjs +0 -1
  81. package/dist/domains/arrange/application/ports/outbound/domain-source-parser.port.mjs +0 -1
  82. package/dist/domains/arrange/application/ports/outbound/file-walker.port.mjs +0 -1
  83. package/dist/domains/arrange/application/ports/presenting/present-analyze-report.presenter.mjs +0 -1
  84. package/dist/domains/arrange/application/ports/presenting/present-arrange-sync-result.presenter.mjs +0 -1
  85. package/dist/domains/arrange/application/ports/presenting/present-group-file-preview.presenter.mjs +0 -1
  86. package/dist/domains/arrange/application/requests/analyze-directory.request.mjs +0 -1
  87. package/dist/domains/arrange/application/requests/arrange-sync.request.mjs +0 -1
  88. package/dist/domains/arrange/application/requests/suggest-groups.request.mjs +0 -1
  89. package/dist/domains/arrange/application/use-cases/analyze-directory.use-case.mjs +0 -255
  90. package/dist/domains/arrange/application/use-cases/prepare-arrange-workspace.use-case.mjs +0 -264
  91. package/dist/domains/arrange/application/use-cases/run-arrange-sync.use-case.mjs +0 -274
  92. package/dist/domains/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +0 -237
  93. package/dist/domains/arrange/arrange.module.mjs +0 -38
  94. package/dist/domains/arrange/composition/tokens.mjs +0 -17
  95. package/dist/domains/arrange/contracts/models.mjs +0 -1
  96. package/dist/domains/arrange/domain/tailwind-grouping.domain-service.mjs +0 -231
  97. package/dist/domains/arrange/domain/types.domain.mjs +0 -1
  98. package/dist/domains/arrange/infrastructure/adapters/arrange-file-processor.adapter.mjs +0 -267
  99. package/dist/domains/arrange/infrastructure/adapters/arrange-target-path-resolver.adapter.mjs +0 -247
  100. package/dist/domains/arrange/infrastructure/adapters/arrange-target-scanner.adapter.mjs +0 -243
  101. package/dist/domains/arrange/infrastructure/adapters/domain-source-parser.adapter.mjs +0 -241
  102. package/dist/domains/arrange/infrastructure/adapters/file-walker.adapter.mjs +0 -240
  103. package/dist/domains/arrange/infrastructure/typescript-ast-translator.mjs +0 -580
  104. package/dist/domains/arrange/presentation/cli/arrange.command.mjs +0 -465
  105. package/dist/domains/arrange/presentation/presenters/arrange-analyze.presenter.mjs +0 -252
  106. package/dist/domains/arrange/presentation/presenters/arrange-sync.presenter.mjs +0 -236
  107. package/dist/domains/arrange/presentation/presenters/group-file-preview.presenter.mjs +0 -271
  108. package/dist/domains/config/application/ports/outbound/codefast-config-schema.port.mjs +0 -1
  109. package/dist/domains/config/application/ports/outbound/config-loader.port.mjs +0 -1
  110. package/dist/domains/config/application/ports/outbound/config-warning-reporter.port.mjs +0 -1
  111. package/dist/domains/config/composition/tokens.mjs +0 -7
  112. package/dist/domains/config/domain/schema.domain.mjs +0 -1
  113. package/dist/domains/config/infrastructure/adapters/config-loader.adapter.mjs +0 -305
  114. package/dist/domains/config/infrastructure/adapters/config-warning-reporter.adapter.mjs +0 -234
  115. package/dist/domains/config/infrastructure/adapters/zod-codefast-config-schema.adapter.mjs +0 -236
  116. package/dist/domains/mirror/application/ports/inbound/prepare-mirror-sync.port.mjs +0 -1
  117. package/dist/domains/mirror/application/ports/inbound/run-mirror-sync.port.mjs +0 -1
  118. package/dist/domains/mirror/application/ports/outbound/file-system-service.port.mjs +0 -1
  119. package/dist/domains/mirror/application/ports/outbound/mirror-package-path.port.mjs +0 -1
  120. package/dist/domains/mirror/application/ports/outbound/mirror-sync-reporter.port.mjs +0 -1
  121. package/dist/domains/mirror/application/ports/outbound/package-repository.port.mjs +0 -1
  122. package/dist/domains/mirror/application/ports/outbound/sync-workspace-package.port.mjs +0 -1
  123. package/dist/domains/mirror/application/ports/presenting/present-mirror-sync-progress.presenter.mjs +0 -1
  124. package/dist/domains/mirror/application/requests/mirror-sync-execution-input.mjs +0 -1
  125. package/dist/domains/mirror/application/requests/mirror-sync.request.mjs +0 -1
  126. package/dist/domains/mirror/application/use-cases/prepare-mirror-sync.use-case.mjs +0 -263
  127. package/dist/domains/mirror/application/use-cases/run-mirror-sync.use-case.mjs +0 -317
  128. package/dist/domains/mirror/composition/tokens.mjs +0 -12
  129. package/dist/domains/mirror/contracts/models.mjs +0 -1
  130. package/dist/domains/mirror/domain/types.domain.mjs +0 -1
  131. package/dist/domains/mirror/infrastructure/adapters/file-system-service.adapter.mjs +0 -261
  132. package/dist/domains/mirror/infrastructure/adapters/mirror-package-path-resolver.adapter.mjs +0 -252
  133. package/dist/domains/mirror/infrastructure/adapters/mirror-sync-reporter.adapter.mjs +0 -322
  134. package/dist/domains/mirror/infrastructure/adapters/package-repository.adapter.mjs +0 -241
  135. package/dist/domains/mirror/infrastructure/adapters/sync-workspace-package.adapter.mjs +0 -328
  136. package/dist/domains/mirror/mirror.module.mjs +0 -26
  137. package/dist/domains/mirror/presentation/cli/mirror.command.mjs +0 -328
  138. package/dist/domains/mirror/presentation/presenters/present-mirror-sync-progress.presenter.mjs +0 -265
  139. package/dist/domains/tag/application/ports/inbound/prepare-tag-sync.port.mjs +0 -1
  140. package/dist/domains/tag/application/ports/inbound/run-tag-sync.port.mjs +0 -1
  141. package/dist/domains/tag/application/ports/outbound/tag-eligible-workspace-paths.port.mjs +0 -1
  142. package/dist/domains/tag/application/ports/outbound/tag-since-writer.port.mjs +0 -1
  143. package/dist/domains/tag/application/ports/outbound/tag-target-path-resolver.port.mjs +0 -1
  144. package/dist/domains/tag/application/ports/outbound/tag-target-runner.port.mjs +0 -1
  145. package/dist/domains/tag/application/ports/outbound/tag-version-resolver.port.mjs +0 -1
  146. package/dist/domains/tag/application/ports/presenting/present-tag-sync-progress.presenter.mjs +0 -1
  147. package/dist/domains/tag/application/ports/presenting/present-tag-sync-result.presenter.mjs +0 -1
  148. package/dist/domains/tag/application/requests/tag-sync-execution-input.mjs +0 -1
  149. package/dist/domains/tag/application/requests/tag-sync.request.mjs +0 -1
  150. package/dist/domains/tag/application/tag-sync-cli-result.mjs +0 -11
  151. package/dist/domains/tag/application/use-cases/prepare-tag-sync.use-case.mjs +0 -260
  152. package/dist/domains/tag/application/use-cases/run-tag-sync.use-case.mjs +0 -375
  153. package/dist/domains/tag/composition/tokens.mjs +0 -13
  154. package/dist/domains/tag/contracts/models.mjs +0 -1
  155. package/dist/domains/tag/domain/types.domain.mjs +0 -1
  156. package/dist/domains/tag/infrastructure/adapters/tag-since-writer.adapter.mjs +0 -348
  157. package/dist/domains/tag/infrastructure/adapters/tag-target-path-resolver.adapter.mjs +0 -235
  158. package/dist/domains/tag/infrastructure/adapters/tag-target-resolver.adapter.mjs +0 -302
  159. package/dist/domains/tag/infrastructure/adapters/tag-target-runner.adapter.mjs +0 -259
  160. package/dist/domains/tag/infrastructure/adapters/tag-version-resolver.adapter.mjs +0 -249
  161. package/dist/domains/tag/presentation/cli/tag.command.mjs +0 -325
  162. package/dist/domains/tag/presentation/presenters/present-tag-sync-progress.presenter.mjs +0 -248
  163. package/dist/domains/tag/presentation/presenters/present-tag-sync-result.presenter.mjs +0 -290
  164. package/dist/domains/tag/tag.module.mjs +0 -28
  165. package/dist/shell/application/cli-runtime.tokens.mjs +0 -18
  166. package/dist/shell/application/coordination/cli-executor.coordination.mjs +0 -1
  167. package/dist/shell/application/coordination/cli-schema-parsing.coordination.mjs +0 -1
  168. package/dist/shell/application/global-cli-options.model.mjs +0 -5
  169. package/dist/shell/application/ports/inbound/load-codefast-config.port.mjs +0 -1
  170. package/dist/shell/application/ports/outbound/cli-fs.port.mjs +0 -1
  171. package/dist/shell/application/ports/outbound/cli-logger.port.mjs +0 -1
  172. package/dist/shell/application/ports/outbound/cli-path.port.mjs +0 -1
  173. package/dist/shell/application/ports/outbound/cli-runtime.port.mjs +0 -1
  174. package/dist/shell/application/ports/outbound/cli-telemetry.port.mjs +0 -1
  175. package/dist/shell/application/ports/outbound/cli-verbose-diagnostics.port.mjs +0 -1
  176. package/dist/shell/application/ports/outbound/format-app-error.port.mjs +0 -1
  177. package/dist/shell/application/ports/outbound/global-cli-options-parse.port.mjs +0 -1
  178. package/dist/shell/application/ports/outbound/repo-root-resolver.port.mjs +0 -1
  179. package/dist/shell/application/ports/outbound/typescript-source-file-walker.port.mjs +0 -1
  180. package/dist/shell/application/ports/outbound/workspace-package-layout.port.mjs +0 -1
  181. package/dist/shell/application/ports/primary/command.port.mjs +0 -1
  182. package/dist/shell/application/services/cli-executor.service.mjs +0 -267
  183. package/dist/shell/application/services/schema-validator.service.mjs +0 -236
  184. package/dist/shell/application/use-cases/load-codefast-config.use-case.mjs +0 -243
  185. package/dist/shell/composition/tokens.mjs +0 -5
  186. package/dist/shell/contracts/cli-command-slots.mjs +0 -11
  187. package/dist/shell/domain/cli-exit-codes.domain.mjs +0 -11
  188. package/dist/shell/domain/cli-positional-arg.value-object.mjs +0 -6
  189. package/dist/shell/domain/errors.domain.mjs +0 -17
  190. package/dist/shell/infrastructure/adapters/cli-verbose-diagnostics.adapter.mjs +0 -228
  191. package/dist/shell/infrastructure/adapters/format-app-error.adapter.mjs +0 -236
  192. package/dist/shell/infrastructure/adapters/global-cli-options-parser.adapter.mjs +0 -233
  193. package/dist/shell/infrastructure/adapters/repo-root-resolver.adapter.mjs +0 -244
  194. package/dist/shell/infrastructure/adapters/typescript-source-file-walker.adapter.mjs +0 -259
  195. package/dist/shell/infrastructure/commander/commander-cli-host.adapter.mjs +0 -69
  196. package/dist/shell/infrastructure/node/node-cli-fs.adapter.mjs +0 -249
  197. package/dist/shell/infrastructure/node/node-cli-logger.adapter.mjs +0 -231
  198. package/dist/shell/infrastructure/node/node-cli-path.adapter.mjs +0 -246
  199. package/dist/shell/infrastructure/node/node-cli-runtime.adapter.mjs +0 -234
  200. package/dist/shell/infrastructure/telemetry/cli-telemetry.adapter.mjs +0 -280
  201. package/dist/shell/infrastructure/workspace/node-pnpm-workspace-package-layout.adapter.mjs +0 -385
  202. package/dist/shell/shell.module.mjs +0 -43
  203. package/dist/shell/wiring/optional-cli-port-telemetry-activation.mjs +0 -13
  204. /package/dist/{domains/arrange/application/ports/inbound/analyze-directory.port.mjs → arrange/domain/types.mjs} +0 -0
  205. /package/dist/{domains/arrange/application/ports/inbound/prepare-arrange-workspace.port.mjs → core/filesystem/port.mjs} +0 -0
  206. /package/dist/{domains/arrange/application/ports/inbound/run-arrange-sync.port.mjs → mirror/domain/dist-filesystem.mjs} +0 -0
  207. /package/dist/{domains/arrange/application/ports/inbound/suggest-cn-groups.port.mjs → mirror/domain/types.mjs} +0 -0
  208. /package/dist/{domains/arrange/application/ports/outbound/arrange-file-processor.port.mjs → mirror/sync-types.mjs} +0 -0
  209. /package/dist/{domains/arrange/application/ports/outbound/arrange-target-path-resolver.port.mjs → tag/domain/types.mjs} +0 -0
@@ -1,263 +0,0 @@
1
- import { LoadCodefastConfigUseCaseToken, RepoRootResolverPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
2
- import { AppError } from "../../../../shell/domain/errors.domain.mjs";
3
- import { err, ok } from "../../../../shell/domain/result.model.mjs";
4
- import { messageFromCaughtUnknown } from "../../../../shell/domain/caught-unknown-message.value-object.mjs";
5
- import { MirrorPackagePathPortToken } from "../../composition/tokens.mjs";
6
- import { inject, injectable } from "@codefast/di";
7
- //#region src/domains/mirror/application/use-cases/prepare-mirror-sync.use-case.ts
8
- function toPrimitive(input, hint) {
9
- if (typeof input !== "object" || input === null) return input;
10
- var prim = input[Symbol.toPrimitive];
11
- if (prim !== void 0) {
12
- var res = prim.call(input, hint || "default");
13
- if (typeof res !== "object") return res;
14
- throw new TypeError("@@toPrimitive must return a primitive value.");
15
- }
16
- return (hint === "string" ? String : Number)(input);
17
- }
18
- function toPropertyKey(arg) {
19
- var key = toPrimitive(arg, "string");
20
- return typeof key === "symbol" ? key : String(key);
21
- }
22
- function checkInRHS(value) {
23
- if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
24
- return value;
25
- }
26
- function setFunctionName(fn, name, prefix) {
27
- if (typeof name === "symbol") {
28
- name = name.description;
29
- name = name ? "[" + name + "]" : "";
30
- }
31
- try {
32
- Object.defineProperty(fn, "name", {
33
- configurable: true,
34
- value: prefix ? prefix + " " + name : name
35
- });
36
- } catch (_) {}
37
- return fn;
38
- }
39
- function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
40
- var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
41
- var defineProperty = Object.defineProperty;
42
- var create = Object.create;
43
- var metadata;
44
- var existingNonFields = [create(null), create(null)];
45
- var hasClassDecs = classDecs.length;
46
- var _;
47
- function createRunInitializers(initializers, useStaticThis, hasValue) {
48
- return function(thisArg, value) {
49
- if (useStaticThis) {
50
- value = thisArg;
51
- thisArg = targetClass;
52
- }
53
- for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
54
- return hasValue ? value : thisArg;
55
- };
56
- }
57
- function assertCallable(fn, hint1, hint2, throwUndefined) {
58
- if (typeof fn !== "function") {
59
- if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
60
- }
61
- return fn;
62
- }
63
- function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
64
- function assertInstanceIfPrivate(target) {
65
- if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
66
- }
67
- var decs = [].concat(decInfo[0]);
68
- var decVal = decInfo[3];
69
- var isClass = !ret;
70
- var isAccessor = kind === 1;
71
- var isGetter = kind === 3;
72
- var isSetter = kind === 4;
73
- var isMethod = kind === 2;
74
- function bindPropCall(name, useStaticThis, before) {
75
- return function(_this, value) {
76
- if (useStaticThis) {
77
- value = _this;
78
- _this = Class;
79
- }
80
- if (before) before(_this);
81
- return desc[name].call(_this, value);
82
- };
83
- }
84
- var desc1 = {};
85
- var init = [];
86
- var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
87
- if (!isClass) {
88
- if (isPrivate) {
89
- if (isField || isAccessor) desc1 = {
90
- get: setFunctionName(function() {
91
- return decVal(this);
92
- }, name, "get"),
93
- set: function(value) {
94
- decInfo[4](this, value);
95
- }
96
- };
97
- else desc1[key] = decVal;
98
- if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
99
- } else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
100
- if (!isField && !isPrivate) {
101
- _ = existingNonFields[+isStatic][name];
102
- if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
103
- existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
104
- }
105
- }
106
- var newValue = Class;
107
- for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
108
- var dec = assertCallable(decs[i], "A decorator", "be", true);
109
- var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
110
- var decoratorFinishedRef = {};
111
- var ctx = {
112
- kind: [
113
- "field",
114
- "accessor",
115
- "method",
116
- "getter",
117
- "setter",
118
- "class"
119
- ][kind],
120
- name,
121
- metadata,
122
- addInitializer: (function(decoratorFinishedRef, initializer) {
123
- if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
124
- assertCallable(initializer, "An initializer", "be", true);
125
- initializers.push(initializer);
126
- }).bind(null, decoratorFinishedRef)
127
- };
128
- if (isClass) {
129
- _ = dec.call(decThis, newValue, ctx);
130
- decoratorFinishedRef.v = 1;
131
- if (assertCallable(_, "class decorators", "return")) newValue = _;
132
- continue;
133
- }
134
- ctx.static = isStatic;
135
- ctx.private = isPrivate;
136
- _ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
137
- return name in target;
138
- } };
139
- if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
140
- assertInstanceIfPrivate(_this);
141
- return desc1.value;
142
- } : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
143
- return target[name];
144
- };
145
- if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
146
- target[name] = value;
147
- };
148
- newValue = dec.call(decThis, isAccessor ? {
149
- get: desc1.get,
150
- set: desc1.set
151
- } : desc1[key], ctx);
152
- decoratorFinishedRef.v = 1;
153
- if (isAccessor) {
154
- if (typeof newValue === "object" && newValue) {
155
- if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
156
- if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
157
- if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
158
- } else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
159
- } else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
160
- else desc1[key] = newValue;
161
- }
162
- if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
163
- if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
164
- else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
165
- else defineProperty(Class, name, desc1);
166
- return newValue;
167
- }
168
- function applyMemberDecs() {
169
- var ret = [];
170
- var protoInitializers;
171
- var staticInitializers;
172
- var pushInitializers = function(initializers) {
173
- if (initializers) ret.push(createRunInitializers(initializers));
174
- };
175
- var applyMemberDecsOfKind = function(isStatic, isField) {
176
- for (var i = 0; i < memberDecs.length; i++) {
177
- var decInfo = memberDecs[i];
178
- var kind = decInfo[1];
179
- var kindOnly = kind & 7;
180
- if ((kind & 8) == isStatic && !kindOnly == isField) {
181
- var name = decInfo[2];
182
- var isPrivate = !!decInfo[3];
183
- var decoratorsHaveThis = kind & 16;
184
- 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(_) {
185
- return checkInRHS(_) === targetClass;
186
- } : instanceBrand);
187
- }
188
- }
189
- };
190
- applyMemberDecsOfKind(8, 0);
191
- applyMemberDecsOfKind(0, 0);
192
- applyMemberDecsOfKind(8, 1);
193
- applyMemberDecsOfKind(0, 1);
194
- pushInitializers(protoInitializers);
195
- pushInitializers(staticInitializers);
196
- return ret;
197
- }
198
- function defineMetadata(Class) {
199
- return defineProperty(Class, symbolMetadata, {
200
- configurable: true,
201
- enumerable: true,
202
- value: metadata
203
- });
204
- }
205
- if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
206
- metadata = create(metadata == null ? null : metadata);
207
- _ = applyMemberDecs();
208
- if (!hasClassDecs) defineMetadata(targetClass);
209
- return {
210
- e: _,
211
- get c() {
212
- var initializers = [];
213
- return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
214
- }
215
- };
216
- }
217
- let _dec, _initClass;
218
- _dec = injectable([
219
- inject(MirrorPackagePathPortToken),
220
- inject(RepoRootResolverPortToken),
221
- inject(LoadCodefastConfigUseCaseToken)
222
- ]);
223
- let _PrepareMirrorSyncUseCase;
224
- (class {
225
- mirrorPackagePath;
226
- repoRootResolver;
227
- loadCodefastConfig;
228
- static {
229
- ({c: [_PrepareMirrorSyncUseCase, _initClass]} = _apply_decs_2311(this, [_dec], []));
230
- }
231
- constructor(mirrorPackagePath, repoRootResolver, loadCodefastConfig) {
232
- this.mirrorPackagePath = mirrorPackagePath;
233
- this.repoRootResolver = repoRootResolver;
234
- this.loadCodefastConfig = loadCodefastConfig;
235
- }
236
- async execute(args) {
237
- let rootDir;
238
- try {
239
- rootDir = this.repoRootResolver.findRepoRoot(args.currentWorkingDirectory);
240
- } catch (caughtError) {
241
- return err(new AppError("INFRA_FAILURE", messageFromCaughtUnknown(caughtError), caughtError));
242
- }
243
- const filterOutcome = this.mirrorPackagePath.resolveFromCliArg({
244
- rootDir,
245
- packageArg: args.packageArg,
246
- currentWorkingDirectory: args.currentWorkingDirectory
247
- });
248
- if (!filterOutcome.ok) return filterOutcome;
249
- const loadedOutcome = await this.loadCodefastConfig.execute(rootDir);
250
- if (!loadedOutcome.ok) return loadedOutcome;
251
- return ok({
252
- globals: args.globals,
253
- rootDir,
254
- config: loadedOutcome.value.config,
255
- packageFilter: filterOutcome.value
256
- });
257
- }
258
- static {
259
- _initClass();
260
- }
261
- });
262
- //#endregion
263
- export { _PrepareMirrorSyncUseCase as PrepareMirrorSyncUseCase };
@@ -1,317 +0,0 @@
1
- import { WorkspacePackageLayoutPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
2
- import { AppError } from "../../../../shell/domain/errors.domain.mjs";
3
- import { err, ok } from "../../../../shell/domain/result.model.mjs";
4
- import { messageFromCaughtUnknown } from "../../../../shell/domain/caught-unknown-message.value-object.mjs";
5
- import { normalizePath } from "../../domain/path-normalizer.value-object.mjs";
6
- import { MirrorPackagePathPortToken, SyncWorkspacePackagePortToken } from "../../composition/tokens.mjs";
7
- import path from "node:path";
8
- import { inject, injectable } from "@codefast/di";
9
- //#region src/domains/mirror/application/use-cases/run-mirror-sync.use-case.ts
10
- function toPrimitive(input, hint) {
11
- if (typeof input !== "object" || input === null) return input;
12
- var prim = input[Symbol.toPrimitive];
13
- if (prim !== void 0) {
14
- var res = prim.call(input, hint || "default");
15
- if (typeof res !== "object") return res;
16
- throw new TypeError("@@toPrimitive must return a primitive value.");
17
- }
18
- return (hint === "string" ? String : Number)(input);
19
- }
20
- function toPropertyKey(arg) {
21
- var key = toPrimitive(arg, "string");
22
- return typeof key === "symbol" ? key : String(key);
23
- }
24
- function checkInRHS(value) {
25
- if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
26
- return value;
27
- }
28
- function setFunctionName(fn, name, prefix) {
29
- if (typeof name === "symbol") {
30
- name = name.description;
31
- name = name ? "[" + name + "]" : "";
32
- }
33
- try {
34
- Object.defineProperty(fn, "name", {
35
- configurable: true,
36
- value: prefix ? prefix + " " + name : name
37
- });
38
- } catch (_) {}
39
- return fn;
40
- }
41
- function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
42
- var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
43
- var defineProperty = Object.defineProperty;
44
- var create = Object.create;
45
- var metadata;
46
- var existingNonFields = [create(null), create(null)];
47
- var hasClassDecs = classDecs.length;
48
- var _;
49
- function createRunInitializers(initializers, useStaticThis, hasValue) {
50
- return function(thisArg, value) {
51
- if (useStaticThis) {
52
- value = thisArg;
53
- thisArg = targetClass;
54
- }
55
- for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
56
- return hasValue ? value : thisArg;
57
- };
58
- }
59
- function assertCallable(fn, hint1, hint2, throwUndefined) {
60
- if (typeof fn !== "function") {
61
- if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
62
- }
63
- return fn;
64
- }
65
- function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
66
- function assertInstanceIfPrivate(target) {
67
- if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
68
- }
69
- var decs = [].concat(decInfo[0]);
70
- var decVal = decInfo[3];
71
- var isClass = !ret;
72
- var isAccessor = kind === 1;
73
- var isGetter = kind === 3;
74
- var isSetter = kind === 4;
75
- var isMethod = kind === 2;
76
- function bindPropCall(name, useStaticThis, before) {
77
- return function(_this, value) {
78
- if (useStaticThis) {
79
- value = _this;
80
- _this = Class;
81
- }
82
- if (before) before(_this);
83
- return desc[name].call(_this, value);
84
- };
85
- }
86
- var desc1 = {};
87
- var init = [];
88
- var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
89
- if (!isClass) {
90
- if (isPrivate) {
91
- if (isField || isAccessor) desc1 = {
92
- get: setFunctionName(function() {
93
- return decVal(this);
94
- }, name, "get"),
95
- set: function(value) {
96
- decInfo[4](this, value);
97
- }
98
- };
99
- else desc1[key] = decVal;
100
- if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
101
- } else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
102
- if (!isField && !isPrivate) {
103
- _ = existingNonFields[+isStatic][name];
104
- if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
105
- existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
106
- }
107
- }
108
- var newValue = Class;
109
- for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
110
- var dec = assertCallable(decs[i], "A decorator", "be", true);
111
- var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
112
- var decoratorFinishedRef = {};
113
- var ctx = {
114
- kind: [
115
- "field",
116
- "accessor",
117
- "method",
118
- "getter",
119
- "setter",
120
- "class"
121
- ][kind],
122
- name,
123
- metadata,
124
- addInitializer: (function(decoratorFinishedRef, initializer) {
125
- if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
126
- assertCallable(initializer, "An initializer", "be", true);
127
- initializers.push(initializer);
128
- }).bind(null, decoratorFinishedRef)
129
- };
130
- if (isClass) {
131
- _ = dec.call(decThis, newValue, ctx);
132
- decoratorFinishedRef.v = 1;
133
- if (assertCallable(_, "class decorators", "return")) newValue = _;
134
- continue;
135
- }
136
- ctx.static = isStatic;
137
- ctx.private = isPrivate;
138
- _ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
139
- return name in target;
140
- } };
141
- if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
142
- assertInstanceIfPrivate(_this);
143
- return desc1.value;
144
- } : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
145
- return target[name];
146
- };
147
- if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
148
- target[name] = value;
149
- };
150
- newValue = dec.call(decThis, isAccessor ? {
151
- get: desc1.get,
152
- set: desc1.set
153
- } : desc1[key], ctx);
154
- decoratorFinishedRef.v = 1;
155
- if (isAccessor) {
156
- if (typeof newValue === "object" && newValue) {
157
- if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
158
- if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
159
- if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
160
- } else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
161
- } else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
162
- else desc1[key] = newValue;
163
- }
164
- if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
165
- if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
166
- else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
167
- else defineProperty(Class, name, desc1);
168
- return newValue;
169
- }
170
- function applyMemberDecs() {
171
- var ret = [];
172
- var protoInitializers;
173
- var staticInitializers;
174
- var pushInitializers = function(initializers) {
175
- if (initializers) ret.push(createRunInitializers(initializers));
176
- };
177
- var applyMemberDecsOfKind = function(isStatic, isField) {
178
- for (var i = 0; i < memberDecs.length; i++) {
179
- var decInfo = memberDecs[i];
180
- var kind = decInfo[1];
181
- var kindOnly = kind & 7;
182
- if ((kind & 8) == isStatic && !kindOnly == isField) {
183
- var name = decInfo[2];
184
- var isPrivate = !!decInfo[3];
185
- var decoratorsHaveThis = kind & 16;
186
- 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(_) {
187
- return checkInRHS(_) === targetClass;
188
- } : instanceBrand);
189
- }
190
- }
191
- };
192
- applyMemberDecsOfKind(8, 0);
193
- applyMemberDecsOfKind(0, 0);
194
- applyMemberDecsOfKind(8, 1);
195
- applyMemberDecsOfKind(0, 1);
196
- pushInitializers(protoInitializers);
197
- pushInitializers(staticInitializers);
198
- return ret;
199
- }
200
- function defineMetadata(Class) {
201
- return defineProperty(Class, symbolMetadata, {
202
- configurable: true,
203
- enumerable: true,
204
- value: metadata
205
- });
206
- }
207
- if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
208
- metadata = create(metadata == null ? null : metadata);
209
- _ = applyMemberDecs();
210
- if (!hasClassDecs) defineMetadata(targetClass);
211
- return {
212
- e: _,
213
- get c() {
214
- var initializers = [];
215
- return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
216
- }
217
- };
218
- }
219
- let _dec, _initClass;
220
- _dec = injectable([
221
- inject(MirrorPackagePathPortToken),
222
- inject(WorkspacePackageLayoutPortToken),
223
- inject(SyncWorkspacePackagePortToken)
224
- ]);
225
- let _RunMirrorSyncUseCase;
226
- (class {
227
- mirrorPackagePath;
228
- workspacePackageLayout;
229
- syncWorkspacePackage;
230
- static {
231
- ({c: [_RunMirrorSyncUseCase, _initClass]} = _apply_decs_2311(this, [_dec], []));
232
- }
233
- constructor(mirrorPackagePath, workspacePackageLayout, syncWorkspacePackage) {
234
- this.mirrorPackagePath = mirrorPackagePath;
235
- this.workspacePackageLayout = workspacePackageLayout;
236
- this.syncWorkspacePackage = syncWorkspacePackage;
237
- }
238
- async execute(input) {
239
- const config = input.config ?? {};
240
- const { listener } = input;
241
- listener?.onBanner();
242
- const startTime = performance.now();
243
- try {
244
- let targetPackages = [];
245
- if (input.packageFilter) {
246
- const filterOutcome = this.mirrorPackagePath.resolvePackageFilterUnderRoot(input.rootDir, input.packageFilter);
247
- if (!filterOutcome.ok) return filterOutcome;
248
- targetPackages = [filterOutcome.value];
249
- listener?.onProcessingMode({ kind: "single" });
250
- } else {
251
- const layoutOutcome = await this.workspacePackageLayout.listPackageDirectoryPathsAbsolute(input.rootDir, false);
252
- const { relPaths, multiSource } = this.mirrorTargetsFromWorkspaceLayout(input.rootDir, layoutOutcome);
253
- targetPackages = relPaths;
254
- listener?.onProcessingMode({
255
- kind: "multi",
256
- source: multiSource
257
- });
258
- }
259
- const stats = {
260
- packagesFound: targetPackages.length,
261
- packagesProcessed: 0,
262
- packagesSkipped: 0,
263
- packagesErrored: 0,
264
- totalExports: 0,
265
- totalJsModules: 0,
266
- totalCssExports: 0,
267
- packageDetails: []
268
- };
269
- if (targetPackages.length === 0) {
270
- listener?.onNoPackages();
271
- listener?.onComplete(stats, (performance.now() - startTime) / 1e3);
272
- return ok(stats);
273
- }
274
- let ordinal = 1;
275
- for (const pkgPath of targetPackages) {
276
- const pkgStats = await this.syncWorkspacePackage.syncExportsForWorkspacePackage(input.rootDir, pkgPath, config);
277
- stats.packageDetails.push(pkgStats);
278
- listener?.onPackageComplete(pkgStats, ordinal, targetPackages.length);
279
- ordinal++;
280
- this.accumulateStats(stats, pkgStats);
281
- }
282
- const elapsed = (performance.now() - startTime) / 1e3;
283
- listener?.onComplete(stats, elapsed);
284
- return ok(stats);
285
- } catch (caughtError) {
286
- return err(new AppError("INFRA_FAILURE", messageFromCaughtUnknown(caughtError), caughtError));
287
- }
288
- }
289
- accumulateStats(stats, pkgStats) {
290
- if (pkgStats.skipped) stats.packagesSkipped++;
291
- else if (pkgStats.error !== null) stats.packagesErrored++;
292
- else {
293
- stats.packagesProcessed++;
294
- stats.totalExports += pkgStats.totalExports;
295
- stats.totalJsModules += pkgStats.jsModules;
296
- stats.totalCssExports += pkgStats.cssExports;
297
- }
298
- }
299
- mirrorTargetsFromWorkspaceLayout(rootDir, layoutOutcome) {
300
- if (layoutOutcome.layoutSource === "declared-empty") return {
301
- relPaths: [],
302
- multiSource: "declared-empty"
303
- };
304
- const multiSource = layoutOutcome.layoutSource;
305
- const relPaths = layoutOutcome.packageDirectoryPathsAbsolute.map((absolutePath) => normalizePath(path.relative(rootDir, absolutePath))).filter((relativePath) => relativePath.length > 0);
306
- relPaths.sort((left, right) => left.localeCompare(right));
307
- return {
308
- relPaths,
309
- multiSource
310
- };
311
- }
312
- static {
313
- _initClass();
314
- }
315
- });
316
- //#endregion
317
- export { _RunMirrorSyncUseCase as RunMirrorSyncUseCase };
@@ -1,12 +0,0 @@
1
- import { token } from "@codefast/di";
2
- //#region src/domains/mirror/composition/tokens.ts
3
- const PackageRepositoryPortToken = token("PackageRepositoryPort");
4
- const MirrorPackagePathPortToken = token("MirrorPackagePathPort");
5
- const FileSystemServicePortToken = token("FileSystemServicePort");
6
- const MirrorSyncReporterPortToken = token("MirrorSyncReporterPort");
7
- const SyncWorkspacePackagePortToken = token("SyncWorkspacePackagePort");
8
- const RunMirrorSyncUseCaseToken = token("RunMirrorSyncUseCase");
9
- const PrepareMirrorSyncUseCaseToken = token("PrepareMirrorSyncUseCase");
10
- const PresentMirrorSyncProgressPresenterToken = token("PresentMirrorSyncProgressPresenter");
11
- //#endregion
12
- export { FileSystemServicePortToken, MirrorPackagePathPortToken, MirrorSyncReporterPortToken, PackageRepositoryPortToken, PrepareMirrorSyncUseCaseToken, PresentMirrorSyncProgressPresenterToken, RunMirrorSyncUseCaseToken, SyncWorkspacePackagePortToken };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};