@codefast/cli 0.3.14-canary.1 → 0.3.14
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.
- package/dist/{commands/arrange.mjs → lib/arrange/adapters/primary/cli/arrange.command.mjs} +32 -33
- package/dist/lib/arrange/adapters/primary/cli/arrange.presentation.module.mjs +14 -0
- package/dist/lib/arrange/adapters/primary/cli/presentation.tokens.mjs +5 -0
- package/dist/lib/arrange/{infra → adapters/secondary}/domain-source-parser.adapter.mjs +5 -8
- package/dist/lib/arrange/{infra → adapters/secondary}/file-walker.adapter.mjs +11 -9
- package/dist/lib/arrange/adapters/secondary/workspace-resolver.adapter.mjs +233 -0
- package/dist/lib/arrange/application/services/arrange-file-processor.service.mjs +37 -12
- package/dist/lib/arrange/application/services/arrange-target-path-resolver.service.mjs +21 -0
- package/dist/lib/arrange/application/services/arrange-target-scanner.service.mjs +10 -4
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.mjs +7 -10
- package/dist/lib/arrange/{presentation/prepare-arrange.orchestrator.mjs → application/use-cases/prepare-arrange-workspace.use-case.mjs} +25 -20
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.mjs +10 -19
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +9 -5
- package/dist/lib/arrange/arrange.module.mjs +17 -13
- package/dist/lib/arrange/contracts/tokens.mjs +6 -5
- package/dist/lib/arrange/domain/arrange-analyze.service.mjs +1 -1
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.mjs +1 -1
- package/dist/lib/arrange/domain/ast/ast-node.model.mjs +1 -21
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.mjs +2 -2
- package/dist/lib/arrange/domain/ast/targets.model.mjs +6 -6
- package/dist/lib/arrange/domain/grouping.domain.mjs +3 -2
- package/dist/lib/arrange/domain/imports.domain.mjs +1 -1
- package/dist/lib/arrange/domain/source-text-formatters.formatter.mjs +19 -2
- package/dist/lib/{tag/presentation/create-tag-progress-listener.presenter.mjs → arrange/domain/tailwind-grouping.service.mjs} +10 -7
- package/dist/lib/arrange/domain/{tokenizer.util.mjs → tailwind-token-classifier.domain-service.mjs} +3 -29
- package/dist/lib/arrange/domain/tailwind-token.value-object.mjs +31 -0
- package/dist/lib/arrange/{infra/ts-ast-translator.adapter.mjs → infrastructure/typescript-ast-translator.adapter.mjs} +2 -2
- package/dist/lib/arrange/presentation/arrange-analyze.presenter.mjs +259 -0
- package/dist/lib/arrange/presentation/arrange-cli.schema.mjs +18 -0
- package/dist/lib/arrange/presentation/arrange-sync.presenter.mjs +23 -2
- package/dist/lib/arrange/presentation/group-file-preview.presenter.mjs +10 -14
- package/dist/lib/bootstrap/composition-root.mjs +33 -0
- package/dist/lib/config/application/services/load-config.service.mjs +17 -0
- package/dist/lib/config/contracts/tokens.mjs +2 -1
- package/dist/lib/config/infrastructure/config-loader.adapter.mjs +306 -0
- package/dist/lib/config/{infra → infrastructure}/config-schema.adapter.mjs +2 -2
- package/dist/lib/{arrange/presentation/present-analyze-report.presenter.mjs → config/infrastructure/config-warning-reporter.adapter.mjs} +9 -8
- package/dist/lib/core/{presentation/try-load-codefast-config.presenter.mjs → application/load-codefast-config.use-case.mjs} +22 -22
- package/dist/lib/core/{presentation/global-cli-options.presenter.mjs → application/services/global-cli-options-parser.service.mjs} +3 -3
- package/dist/lib/core/application/services/schema-validator.service.mjs +17 -0
- package/dist/lib/core/contracts/tokens.mjs +7 -2
- package/dist/lib/core/core.module.mjs +3 -3
- package/dist/lib/core/{application/utils/caught-unknown-message.util.mjs → domain/caught-unknown-message.value-object.mjs} +1 -1
- package/dist/lib/core/domain/errors.domain.mjs +13 -12
- package/dist/lib/core/domain/result.model.mjs +1 -7
- package/dist/lib/core/infrastructure/infrastructure.module.mjs +30 -0
- package/dist/lib/core/infrastructure/path.adapter.mjs +246 -0
- package/dist/lib/core/{infra/logging-decorator.adapter.mjs → infrastructure/port-telemetry.decorator.mjs} +1 -1
- package/dist/lib/core/infrastructure/repo-root-resolver.adapter.mjs +233 -0
- package/dist/lib/core/{application/utils/verbose-diagnostics.util.mjs → infrastructure/verbose-diagnostics.policy.mjs} +1 -1
- package/dist/lib/core/presentation/cli-executor.presenter.mjs +3 -18
- package/dist/lib/core/presentation/cli-schema.parser.mjs +7 -0
- package/dist/lib/core/presentation/presentation.module.mjs +1 -7
- package/dist/lib/{infra → infrastructure}/node-io.adapter.mjs +22 -3
- package/dist/lib/{infra/workspace/repo-root.adapter.mjs → infrastructure/workspace/repo-root-resolver.service.mjs} +1 -1
- package/dist/lib/kernel/contracts/tokens.mjs +5 -0
- package/dist/{commands/mirror.mjs → lib/mirror/adapters/primary/cli/mirror.command.mjs} +17 -12
- package/dist/lib/mirror/{infra → adapters/secondary}/file-system-service.adapter.mjs +14 -9
- package/dist/lib/mirror/{infra → adapters/secondary}/mirror-sync-reporter.adapter.mjs +12 -5
- package/dist/lib/mirror/{infra → adapters/secondary}/package-repository.adapter.mjs +12 -6
- package/dist/lib/mirror/{application/services/sync-workspace-package.service.mjs → adapters/secondary/sync-workspace-package.adapter.mjs} +29 -29
- package/dist/lib/mirror/{infra → adapters/secondary}/workspace-service.adapter.mjs +12 -7
- package/dist/lib/mirror/application/{use-cases/generate-mirror-exports.use-case.mjs → services/generate-mirror-exports.service.mjs} +7 -7
- package/dist/lib/mirror/{presentation/resolve-mirror-package-arg.presenter.mjs → application/services/mirror-package-arg-resolver.service.mjs} +4 -4
- package/dist/lib/mirror/{presentation/prepare-mirror.orchestrator.mjs → application/use-cases/prepare-mirror-sync.use-case.mjs} +23 -22
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.mjs +12 -12
- package/dist/lib/mirror/contracts/tokens.mjs +3 -3
- package/dist/lib/mirror/domain/package-display-name.policy.mjs +9 -0
- package/dist/lib/mirror/{infra/path-normalizer.adapter.mjs → domain/path-normalizer.value-object.mjs} +1 -1
- package/dist/lib/mirror/{infra/dirent-list.adapter.mjs → infrastructure/dirent-list.guard.mjs} +1 -1
- package/dist/lib/mirror/infrastructure/mirror-console-reporter.presenter.mjs +99 -0
- package/dist/lib/mirror/{infra/package-filter.adapter.mjs → infrastructure/package-filter-resolver.service.mjs} +2 -2
- package/dist/lib/mirror/{infra/update-pkg.adapter.mjs → infrastructure/package-json-exports.repository.mjs} +4 -19
- package/dist/lib/mirror/{infra/workspace-packages.adapter.mjs → infrastructure/workspace-packages.service.mjs} +4 -4
- package/dist/lib/mirror/mirror.module.mjs +17 -15
- package/dist/lib/mirror/presentation/{mirror-cli-schema.presenter.mjs → mirror-cli.schema.mjs} +1 -1
- package/dist/lib/shared/source-code/domain/text-edit.model.mjs +32 -5
- package/dist/lib/shared/source-code/{infra/tsx-file-walk.adapter.mjs → infrastructure/typescript-source-file-walker.service.mjs} +2 -2
- package/dist/lib/tag/adapters/primary/cli/presentation.tokens.mjs +6 -0
- package/dist/{commands/tag.mjs → lib/tag/adapters/primary/cli/tag.command.mjs} +23 -21
- package/dist/lib/tag/adapters/primary/cli/tag.presentation.module.mjs +13 -0
- package/dist/lib/tag/{infra → adapters/secondary}/tag-since-writer.adapter.mjs +12 -7
- package/dist/lib/tag/{infra → adapters/secondary}/tag-target-resolver.adapter.mjs +12 -5
- package/dist/lib/tag/{infra → adapters/secondary}/tag-version-resolver.adapter.mjs +10 -8
- package/dist/lib/tag/{infra → adapters/secondary}/typescript-tree-walk.adapter.mjs +12 -5
- package/dist/lib/tag/{presentation/resolve-tag-cli-target.presenter.mjs → application/services/tag-cli-target-path-resolver.service.mjs} +1 -1
- package/dist/lib/tag/application/services/tag-target-runner.service.mjs +21 -0
- package/dist/lib/tag/{presentation/prepare-tag.orchestrator.mjs → application/use-cases/prepare-tag-sync.use-case.mjs} +23 -23
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.mjs +14 -31
- package/dist/lib/tag/contracts/tokens.mjs +2 -4
- package/dist/lib/tag/{infra → infrastructure}/tag-target-candidates.adapter.mjs +4 -4
- package/dist/lib/tag/presentation/present-tag-sync-result.presenter.mjs +1 -1
- package/dist/lib/tag/presentation/{tag-cli-schema.presenter.mjs → tag-cli.schema.mjs} +1 -1
- package/dist/lib/tag/presentation/tag-sync-progress-listener.presenter.mjs +243 -0
- package/dist/lib/tag/presentation/tag-sync.presenter.mjs +6 -23
- package/dist/lib/tag/tag.module.mjs +15 -13
- package/dist/program.mjs +2 -2
- package/package.json +16 -9
- package/dist/lib/arrange/application/arrange-analyze-json.format.mjs +0 -10
- package/dist/lib/arrange/application/arrange-group-json.format.mjs +0 -11
- package/dist/lib/arrange/application/arrange-sync-cli-result.mjs +0 -7
- package/dist/lib/arrange/application/arrange-sync-json.format.mjs +0 -12
- package/dist/lib/arrange/application/use-cases/group-file.use-case.mjs +0 -35
- package/dist/lib/arrange/arrange.feature.module.mjs +0 -19
- package/dist/lib/arrange/arrange.presentation.module.mjs +0 -13
- package/dist/lib/arrange/domain/errors.domain.mjs +0 -18
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.mjs +0 -10
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.mjs +0 -18
- package/dist/lib/arrange/presentation/arrange-cli-schema.presenter.mjs +0 -29
- package/dist/lib/arrange/presentation/formatters.presenter.mjs +0 -2
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.mjs +0 -7
- package/dist/lib/arrange/presentation/report.presenter.mjs +0 -24
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.mjs +0 -21
- package/dist/lib/config/application/use-cases/load-config.use-case.mjs +0 -17
- package/dist/lib/config/infra/loader.adapter.mjs +0 -84
- package/dist/lib/core/application/schema-parse.util.mjs +0 -17
- package/dist/lib/core/infra/composition-root.mjs +0 -21
- package/dist/lib/core/infra/infra.module.mjs +0 -23
- package/dist/lib/core/infra/path.adapter.mjs +0 -13
- package/dist/lib/core/operational/contracts/tokens.mjs +0 -7
- package/dist/lib/core/presentation/load-codefast-config.presenter.mjs +0 -18
- package/dist/lib/core/presentation/parse-cli-schema.presenter.mjs +0 -7
- package/dist/lib/infra/config-reporter.adapter.mjs +0 -11
- package/dist/lib/kernel/di/command.token.mjs +0 -5
- package/dist/lib/mirror/contracts/use-cases.contract.mjs +0 -1
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.mjs +0 -1
- package/dist/lib/mirror/mirror.feature.module.mjs +0 -19
- package/dist/lib/mirror/mirror.presentation.module.mjs +0 -11
- package/dist/lib/mirror/presentation/reporter.presenter.mjs +0 -111
- package/dist/lib/tag/contracts/presentation.contract.mjs +0 -1
- package/dist/lib/tag/contracts/use-cases.contract.mjs +0 -1
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.mjs +0 -1
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.mjs +0 -12
- package/dist/lib/tag/tag.feature.module.mjs +0 -19
- package/dist/lib/tag/tag.presentation.module.mjs +0 -15
- /package/dist/lib/arrange/{contracts/presentation.contract.mjs → application/ports/workspace-resolver.port.mjs} +0 -0
- /package/dist/lib/arrange/contracts/{use-cases.contract.mjs → analyze-report-presenter.contract.mjs} +0 -0
- /package/dist/lib/{arrange/infra/arrange-sync-cli-options.adapter.mjs → config/application/ports/config-warning-reporter.port.mjs} +0 -0
- /package/dist/lib/core/{contracts/presentation.contract.mjs → application/ports/repo-root-resolver.port.mjs} +0 -0
- /package/dist/lib/core/{presentation/command.interface.mjs → application/ports/runtime.port.mjs} +0 -0
- /package/dist/lib/{infra/fs-contract.port.mjs → kernel/contracts/cli-command.contract.mjs} +0 -0
- /package/dist/lib/{mirror/contracts/presentation.contract.mjs → tag/contracts/tag-sync-result-presenter.contract.mjs} +0 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { injectable } from "@codefast/di";
|
|
3
|
+
//#region src/lib/core/infrastructure/path.adapter.ts
|
|
4
|
+
function toPrimitive(input, hint) {
|
|
5
|
+
if (typeof input !== "object" || input === null) return input;
|
|
6
|
+
var prim = input[Symbol.toPrimitive];
|
|
7
|
+
if (prim !== void 0) {
|
|
8
|
+
var res = prim.call(input, hint || "default");
|
|
9
|
+
if (typeof res !== "object") return res;
|
|
10
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
+
}
|
|
12
|
+
return (hint === "string" ? String : Number)(input);
|
|
13
|
+
}
|
|
14
|
+
function toPropertyKey(arg) {
|
|
15
|
+
var key = toPrimitive(arg, "string");
|
|
16
|
+
return typeof key === "symbol" ? key : String(key);
|
|
17
|
+
}
|
|
18
|
+
function checkInRHS(value) {
|
|
19
|
+
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function setFunctionName(fn, name, prefix) {
|
|
23
|
+
if (typeof name === "symbol") {
|
|
24
|
+
name = name.description;
|
|
25
|
+
name = name ? "[" + name + "]" : "";
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
Object.defineProperty(fn, "name", {
|
|
29
|
+
configurable: true,
|
|
30
|
+
value: prefix ? prefix + " " + name : name
|
|
31
|
+
});
|
|
32
|
+
} catch (_) {}
|
|
33
|
+
return fn;
|
|
34
|
+
}
|
|
35
|
+
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
36
|
+
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
37
|
+
var defineProperty = Object.defineProperty;
|
|
38
|
+
var create = Object.create;
|
|
39
|
+
var metadata;
|
|
40
|
+
var existingNonFields = [create(null), create(null)];
|
|
41
|
+
var hasClassDecs = classDecs.length;
|
|
42
|
+
var _;
|
|
43
|
+
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
44
|
+
return function(thisArg, value) {
|
|
45
|
+
if (useStaticThis) {
|
|
46
|
+
value = thisArg;
|
|
47
|
+
thisArg = targetClass;
|
|
48
|
+
}
|
|
49
|
+
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
50
|
+
return hasValue ? value : thisArg;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
54
|
+
if (typeof fn !== "function") {
|
|
55
|
+
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
56
|
+
}
|
|
57
|
+
return fn;
|
|
58
|
+
}
|
|
59
|
+
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
60
|
+
function assertInstanceIfPrivate(target) {
|
|
61
|
+
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
62
|
+
}
|
|
63
|
+
var decs = [].concat(decInfo[0]);
|
|
64
|
+
var decVal = decInfo[3];
|
|
65
|
+
var isClass = !ret;
|
|
66
|
+
var isAccessor = kind === 1;
|
|
67
|
+
var isGetter = kind === 3;
|
|
68
|
+
var isSetter = kind === 4;
|
|
69
|
+
var isMethod = kind === 2;
|
|
70
|
+
function bindPropCall(name, useStaticThis, before) {
|
|
71
|
+
return function(_this, value) {
|
|
72
|
+
if (useStaticThis) {
|
|
73
|
+
value = _this;
|
|
74
|
+
_this = Class;
|
|
75
|
+
}
|
|
76
|
+
if (before) before(_this);
|
|
77
|
+
return desc[name].call(_this, value);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var desc1 = {};
|
|
81
|
+
var init = [];
|
|
82
|
+
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
83
|
+
if (!isClass) {
|
|
84
|
+
if (isPrivate) {
|
|
85
|
+
if (isField || isAccessor) desc1 = {
|
|
86
|
+
get: setFunctionName(function() {
|
|
87
|
+
return decVal(this);
|
|
88
|
+
}, name, "get"),
|
|
89
|
+
set: function(value) {
|
|
90
|
+
decInfo[4](this, value);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
else desc1[key] = decVal;
|
|
94
|
+
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
95
|
+
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
96
|
+
if (!isField && !isPrivate) {
|
|
97
|
+
_ = existingNonFields[+isStatic][name];
|
|
98
|
+
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
99
|
+
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var newValue = Class;
|
|
103
|
+
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
104
|
+
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
105
|
+
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
106
|
+
var decoratorFinishedRef = {};
|
|
107
|
+
var ctx = {
|
|
108
|
+
kind: [
|
|
109
|
+
"field",
|
|
110
|
+
"accessor",
|
|
111
|
+
"method",
|
|
112
|
+
"getter",
|
|
113
|
+
"setter",
|
|
114
|
+
"class"
|
|
115
|
+
][kind],
|
|
116
|
+
name,
|
|
117
|
+
metadata,
|
|
118
|
+
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
119
|
+
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
120
|
+
assertCallable(initializer, "An initializer", "be", true);
|
|
121
|
+
initializers.push(initializer);
|
|
122
|
+
}).bind(null, decoratorFinishedRef)
|
|
123
|
+
};
|
|
124
|
+
if (isClass) {
|
|
125
|
+
_ = dec.call(decThis, newValue, ctx);
|
|
126
|
+
decoratorFinishedRef.v = 1;
|
|
127
|
+
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
ctx.static = isStatic;
|
|
131
|
+
ctx.private = isPrivate;
|
|
132
|
+
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
133
|
+
return name in target;
|
|
134
|
+
} };
|
|
135
|
+
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
136
|
+
assertInstanceIfPrivate(_this);
|
|
137
|
+
return desc1.value;
|
|
138
|
+
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
139
|
+
return target[name];
|
|
140
|
+
};
|
|
141
|
+
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
142
|
+
target[name] = value;
|
|
143
|
+
};
|
|
144
|
+
newValue = dec.call(decThis, isAccessor ? {
|
|
145
|
+
get: desc1.get,
|
|
146
|
+
set: desc1.set
|
|
147
|
+
} : desc1[key], ctx);
|
|
148
|
+
decoratorFinishedRef.v = 1;
|
|
149
|
+
if (isAccessor) {
|
|
150
|
+
if (typeof newValue === "object" && newValue) {
|
|
151
|
+
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
152
|
+
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
153
|
+
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
154
|
+
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
155
|
+
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
156
|
+
else desc1[key] = newValue;
|
|
157
|
+
}
|
|
158
|
+
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
159
|
+
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
160
|
+
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
161
|
+
else defineProperty(Class, name, desc1);
|
|
162
|
+
return newValue;
|
|
163
|
+
}
|
|
164
|
+
function applyMemberDecs() {
|
|
165
|
+
var ret = [];
|
|
166
|
+
var protoInitializers;
|
|
167
|
+
var staticInitializers;
|
|
168
|
+
var pushInitializers = function(initializers) {
|
|
169
|
+
if (initializers) ret.push(createRunInitializers(initializers));
|
|
170
|
+
};
|
|
171
|
+
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
172
|
+
for (var i = 0; i < memberDecs.length; i++) {
|
|
173
|
+
var decInfo = memberDecs[i];
|
|
174
|
+
var kind = decInfo[1];
|
|
175
|
+
var kindOnly = kind & 7;
|
|
176
|
+
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
177
|
+
var name = decInfo[2];
|
|
178
|
+
var isPrivate = !!decInfo[3];
|
|
179
|
+
var decoratorsHaveThis = kind & 16;
|
|
180
|
+
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(_) {
|
|
181
|
+
return checkInRHS(_) === targetClass;
|
|
182
|
+
} : instanceBrand);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
applyMemberDecsOfKind(8, 0);
|
|
187
|
+
applyMemberDecsOfKind(0, 0);
|
|
188
|
+
applyMemberDecsOfKind(8, 1);
|
|
189
|
+
applyMemberDecsOfKind(0, 1);
|
|
190
|
+
pushInitializers(protoInitializers);
|
|
191
|
+
pushInitializers(staticInitializers);
|
|
192
|
+
return ret;
|
|
193
|
+
}
|
|
194
|
+
function defineMetadata(Class) {
|
|
195
|
+
return defineProperty(Class, symbolMetadata, {
|
|
196
|
+
configurable: true,
|
|
197
|
+
enumerable: true,
|
|
198
|
+
value: metadata
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
202
|
+
metadata = create(metadata == null ? null : metadata);
|
|
203
|
+
_ = applyMemberDecs();
|
|
204
|
+
if (!hasClassDecs) defineMetadata(targetClass);
|
|
205
|
+
return {
|
|
206
|
+
e: _,
|
|
207
|
+
get c() {
|
|
208
|
+
var initializers = [];
|
|
209
|
+
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
let _dec, _initClass;
|
|
214
|
+
_dec = injectable([]);
|
|
215
|
+
let _NodeCliPathAdapter;
|
|
216
|
+
(class {
|
|
217
|
+
static {
|
|
218
|
+
({c: [_NodeCliPathAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
219
|
+
}
|
|
220
|
+
resolve(...paths) {
|
|
221
|
+
return path.resolve(...paths);
|
|
222
|
+
}
|
|
223
|
+
join(...paths) {
|
|
224
|
+
return path.join(...paths);
|
|
225
|
+
}
|
|
226
|
+
relative(from, to) {
|
|
227
|
+
return path.relative(from, to);
|
|
228
|
+
}
|
|
229
|
+
dirname(pathValue) {
|
|
230
|
+
return path.dirname(pathValue);
|
|
231
|
+
}
|
|
232
|
+
basename(pathValue) {
|
|
233
|
+
return path.basename(pathValue);
|
|
234
|
+
}
|
|
235
|
+
extname(pathValue) {
|
|
236
|
+
return path.extname(pathValue);
|
|
237
|
+
}
|
|
238
|
+
get separator() {
|
|
239
|
+
return path.sep;
|
|
240
|
+
}
|
|
241
|
+
static {
|
|
242
|
+
_initClass();
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
//#endregion
|
|
246
|
+
export { _NodeCliPathAdapter as NodeCliPathAdapter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/lib/core/
|
|
1
|
+
//#region src/lib/core/infrastructure/port-telemetry.decorator.ts
|
|
2
2
|
function summarizeTelemetryArg(value, maxLen = 160) {
|
|
3
3
|
if (typeof value === "string") return value.length > maxLen ? `${value.slice(0, maxLen)}…(${value.length} chars)` : value;
|
|
4
4
|
if (value === null || value === void 0) return String(value);
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { CliFsToken } from "../contracts/tokens.mjs";
|
|
2
|
+
import { findRepoRoot } from "../../infrastructure/workspace/repo-root-resolver.service.mjs";
|
|
3
|
+
import { inject, injectable } from "@codefast/di";
|
|
4
|
+
//#region src/lib/core/infrastructure/repo-root-resolver.adapter.ts
|
|
5
|
+
function toPrimitive(input, hint) {
|
|
6
|
+
if (typeof input !== "object" || input === null) return input;
|
|
7
|
+
var prim = input[Symbol.toPrimitive];
|
|
8
|
+
if (prim !== void 0) {
|
|
9
|
+
var res = prim.call(input, hint || "default");
|
|
10
|
+
if (typeof res !== "object") return res;
|
|
11
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
12
|
+
}
|
|
13
|
+
return (hint === "string" ? String : Number)(input);
|
|
14
|
+
}
|
|
15
|
+
function toPropertyKey(arg) {
|
|
16
|
+
var key = toPrimitive(arg, "string");
|
|
17
|
+
return typeof key === "symbol" ? key : String(key);
|
|
18
|
+
}
|
|
19
|
+
function checkInRHS(value) {
|
|
20
|
+
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function setFunctionName(fn, name, prefix) {
|
|
24
|
+
if (typeof name === "symbol") {
|
|
25
|
+
name = name.description;
|
|
26
|
+
name = name ? "[" + name + "]" : "";
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
Object.defineProperty(fn, "name", {
|
|
30
|
+
configurable: true,
|
|
31
|
+
value: prefix ? prefix + " " + name : name
|
|
32
|
+
});
|
|
33
|
+
} catch (_) {}
|
|
34
|
+
return fn;
|
|
35
|
+
}
|
|
36
|
+
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
37
|
+
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
38
|
+
var defineProperty = Object.defineProperty;
|
|
39
|
+
var create = Object.create;
|
|
40
|
+
var metadata;
|
|
41
|
+
var existingNonFields = [create(null), create(null)];
|
|
42
|
+
var hasClassDecs = classDecs.length;
|
|
43
|
+
var _;
|
|
44
|
+
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
45
|
+
return function(thisArg, value) {
|
|
46
|
+
if (useStaticThis) {
|
|
47
|
+
value = thisArg;
|
|
48
|
+
thisArg = targetClass;
|
|
49
|
+
}
|
|
50
|
+
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
51
|
+
return hasValue ? value : thisArg;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
55
|
+
if (typeof fn !== "function") {
|
|
56
|
+
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
57
|
+
}
|
|
58
|
+
return fn;
|
|
59
|
+
}
|
|
60
|
+
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
61
|
+
function assertInstanceIfPrivate(target) {
|
|
62
|
+
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
63
|
+
}
|
|
64
|
+
var decs = [].concat(decInfo[0]);
|
|
65
|
+
var decVal = decInfo[3];
|
|
66
|
+
var isClass = !ret;
|
|
67
|
+
var isAccessor = kind === 1;
|
|
68
|
+
var isGetter = kind === 3;
|
|
69
|
+
var isSetter = kind === 4;
|
|
70
|
+
var isMethod = kind === 2;
|
|
71
|
+
function bindPropCall(name, useStaticThis, before) {
|
|
72
|
+
return function(_this, value) {
|
|
73
|
+
if (useStaticThis) {
|
|
74
|
+
value = _this;
|
|
75
|
+
_this = Class;
|
|
76
|
+
}
|
|
77
|
+
if (before) before(_this);
|
|
78
|
+
return desc[name].call(_this, value);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var desc1 = {};
|
|
82
|
+
var init = [];
|
|
83
|
+
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
84
|
+
if (!isClass) {
|
|
85
|
+
if (isPrivate) {
|
|
86
|
+
if (isField || isAccessor) desc1 = {
|
|
87
|
+
get: setFunctionName(function() {
|
|
88
|
+
return decVal(this);
|
|
89
|
+
}, name, "get"),
|
|
90
|
+
set: function(value) {
|
|
91
|
+
decInfo[4](this, value);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
else desc1[key] = decVal;
|
|
95
|
+
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
96
|
+
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
97
|
+
if (!isField && !isPrivate) {
|
|
98
|
+
_ = existingNonFields[+isStatic][name];
|
|
99
|
+
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
100
|
+
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
var newValue = Class;
|
|
104
|
+
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
105
|
+
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
106
|
+
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
107
|
+
var decoratorFinishedRef = {};
|
|
108
|
+
var ctx = {
|
|
109
|
+
kind: [
|
|
110
|
+
"field",
|
|
111
|
+
"accessor",
|
|
112
|
+
"method",
|
|
113
|
+
"getter",
|
|
114
|
+
"setter",
|
|
115
|
+
"class"
|
|
116
|
+
][kind],
|
|
117
|
+
name,
|
|
118
|
+
metadata,
|
|
119
|
+
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
120
|
+
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
121
|
+
assertCallable(initializer, "An initializer", "be", true);
|
|
122
|
+
initializers.push(initializer);
|
|
123
|
+
}).bind(null, decoratorFinishedRef)
|
|
124
|
+
};
|
|
125
|
+
if (isClass) {
|
|
126
|
+
_ = dec.call(decThis, newValue, ctx);
|
|
127
|
+
decoratorFinishedRef.v = 1;
|
|
128
|
+
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
ctx.static = isStatic;
|
|
132
|
+
ctx.private = isPrivate;
|
|
133
|
+
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
134
|
+
return name in target;
|
|
135
|
+
} };
|
|
136
|
+
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
137
|
+
assertInstanceIfPrivate(_this);
|
|
138
|
+
return desc1.value;
|
|
139
|
+
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
140
|
+
return target[name];
|
|
141
|
+
};
|
|
142
|
+
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
143
|
+
target[name] = value;
|
|
144
|
+
};
|
|
145
|
+
newValue = dec.call(decThis, isAccessor ? {
|
|
146
|
+
get: desc1.get,
|
|
147
|
+
set: desc1.set
|
|
148
|
+
} : desc1[key], ctx);
|
|
149
|
+
decoratorFinishedRef.v = 1;
|
|
150
|
+
if (isAccessor) {
|
|
151
|
+
if (typeof newValue === "object" && newValue) {
|
|
152
|
+
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
153
|
+
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
154
|
+
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
155
|
+
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
156
|
+
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
157
|
+
else desc1[key] = newValue;
|
|
158
|
+
}
|
|
159
|
+
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
160
|
+
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
161
|
+
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
162
|
+
else defineProperty(Class, name, desc1);
|
|
163
|
+
return newValue;
|
|
164
|
+
}
|
|
165
|
+
function applyMemberDecs() {
|
|
166
|
+
var ret = [];
|
|
167
|
+
var protoInitializers;
|
|
168
|
+
var staticInitializers;
|
|
169
|
+
var pushInitializers = function(initializers) {
|
|
170
|
+
if (initializers) ret.push(createRunInitializers(initializers));
|
|
171
|
+
};
|
|
172
|
+
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
173
|
+
for (var i = 0; i < memberDecs.length; i++) {
|
|
174
|
+
var decInfo = memberDecs[i];
|
|
175
|
+
var kind = decInfo[1];
|
|
176
|
+
var kindOnly = kind & 7;
|
|
177
|
+
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
178
|
+
var name = decInfo[2];
|
|
179
|
+
var isPrivate = !!decInfo[3];
|
|
180
|
+
var decoratorsHaveThis = kind & 16;
|
|
181
|
+
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(_) {
|
|
182
|
+
return checkInRHS(_) === targetClass;
|
|
183
|
+
} : instanceBrand);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
applyMemberDecsOfKind(8, 0);
|
|
188
|
+
applyMemberDecsOfKind(0, 0);
|
|
189
|
+
applyMemberDecsOfKind(8, 1);
|
|
190
|
+
applyMemberDecsOfKind(0, 1);
|
|
191
|
+
pushInitializers(protoInitializers);
|
|
192
|
+
pushInitializers(staticInitializers);
|
|
193
|
+
return ret;
|
|
194
|
+
}
|
|
195
|
+
function defineMetadata(Class) {
|
|
196
|
+
return defineProperty(Class, symbolMetadata, {
|
|
197
|
+
configurable: true,
|
|
198
|
+
enumerable: true,
|
|
199
|
+
value: metadata
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
203
|
+
metadata = create(metadata == null ? null : metadata);
|
|
204
|
+
_ = applyMemberDecs();
|
|
205
|
+
if (!hasClassDecs) defineMetadata(targetClass);
|
|
206
|
+
return {
|
|
207
|
+
e: _,
|
|
208
|
+
get c() {
|
|
209
|
+
var initializers = [];
|
|
210
|
+
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
let _dec, _initClass;
|
|
215
|
+
_dec = injectable([inject(CliFsToken)]);
|
|
216
|
+
let _RepoRootResolverAdapter;
|
|
217
|
+
(class {
|
|
218
|
+
fs;
|
|
219
|
+
static {
|
|
220
|
+
({c: [_RepoRootResolverAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
221
|
+
}
|
|
222
|
+
constructor(fs) {
|
|
223
|
+
this.fs = fs;
|
|
224
|
+
}
|
|
225
|
+
findRepoRoot(fromDirectory) {
|
|
226
|
+
return findRepoRoot(this.fs, fromDirectory);
|
|
227
|
+
}
|
|
228
|
+
static {
|
|
229
|
+
_initClass();
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
//#endregion
|
|
233
|
+
export { _RepoRootResolverAdapter as RepoRootResolverAdapter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/lib/core/
|
|
1
|
+
//#region src/lib/core/infrastructure/verbose-diagnostics.policy.ts
|
|
2
2
|
/**
|
|
3
3
|
* When true, infrastructure failures may log full stack traces (e.g. in {@link consumeCliAppError}).
|
|
4
4
|
*/ function isVerboseInfraDiagnostics() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../domain/cli-exit-codes.domain.mjs";
|
|
2
2
|
import { formatAppError } from "./format-app-error.presenter.mjs";
|
|
3
|
-
import { isVerboseInfraDiagnostics } from "../
|
|
3
|
+
import { isVerboseInfraDiagnostics } from "../infrastructure/verbose-diagnostics.policy.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
//#region src/lib/core/presentation/cli-executor.presenter.ts
|
|
6
6
|
function assertExhaustiveAppErrorCode(code) {
|
|
@@ -31,22 +31,7 @@ function assertExhaustiveAppErrorCode(code) {
|
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*/ async function consumeCliAppErrorAsync(logger, outcomePromise, options) {
|
|
36
|
-
const outcome = await outcomePromise;
|
|
37
|
-
consumeCliAppError(logger, outcome, options);
|
|
38
|
-
return outcome;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Completes CLI handling: errors are logged and `process.exitCode` is set; success runs `onSuccess`
|
|
42
|
-
* and assigns `process.exitCode` from its return value (default `0`).
|
|
43
|
-
*/ function runCliResult(logger, outcome, onSuccess) {
|
|
44
|
-
if (!consumeCliAppError(logger, outcome)) return;
|
|
45
|
-
const exit = onSuccess(outcome.value);
|
|
46
|
-
process.exitCode = exit === void 0 ? 0 : exit;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Async variant of {@link runCliResult}.
|
|
34
|
+
* Async CLI result handling that sets `process.exitCode` from success/error outcome.
|
|
50
35
|
*/ async function runCliResultAsync(logger, outcomePromise, onSuccess) {
|
|
51
36
|
const outcome = await outcomePromise;
|
|
52
37
|
if (!consumeCliAppError(logger, outcome)) return;
|
|
@@ -54,4 +39,4 @@ function assertExhaustiveAppErrorCode(code) {
|
|
|
54
39
|
process.exitCode = exit === void 0 ? 0 : exit;
|
|
55
40
|
}
|
|
56
41
|
//#endregion
|
|
57
|
-
export { consumeCliAppError,
|
|
42
|
+
export { consumeCliAppError, runCliResultAsync };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { parseWithSchema } from "../application/services/schema-validator.service.mjs";
|
|
2
|
+
//#region src/lib/core/presentation/cli-schema.parser.ts
|
|
3
|
+
function parseWithCliSchema(schema, raw) {
|
|
4
|
+
return parseWithSchema(schema, raw);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { parseWithCliSchema };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { InfraModule } from "../infra/infra.module.mjs";
|
|
2
|
-
import { TryLoadCodefastConfigPresenterToken } from "../contracts/tokens.mjs";
|
|
3
|
-
import { TryLoadCodefastConfigPresenterImpl as _TryLoadCodefastConfigPresenterImpl } from "./try-load-codefast-config.presenter.mjs";
|
|
4
1
|
import { Module } from "@codefast/di";
|
|
5
2
|
//#region src/lib/core/presentation/presentation.module.ts
|
|
6
|
-
const PresentationModule = Module.create("cli-presentation", (
|
|
7
|
-
moduleBuilder.import(InfraModule);
|
|
8
|
-
moduleBuilder.bind(TryLoadCodefastConfigPresenterToken).to(_TryLoadCodefastConfigPresenterImpl).singleton();
|
|
9
|
-
});
|
|
3
|
+
const PresentationModule = Module.create("cli-presentation", () => {});
|
|
10
4
|
//#endregion
|
|
11
5
|
export { PresentationModule };
|
|
@@ -3,7 +3,7 @@ import fsSync from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { injectable } from "@codefast/di";
|
|
5
5
|
import fsPromises from "node:fs/promises";
|
|
6
|
-
//#region src/lib/
|
|
6
|
+
//#region src/lib/infrastructure/node-io.adapter.ts
|
|
7
7
|
function toPrimitive(input, hint) {
|
|
8
8
|
if (typeof input !== "object" || input === null) return input;
|
|
9
9
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -213,7 +213,7 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
-
let _dec, _initClass, _dec1, _initClass1;
|
|
216
|
+
let _dec, _initClass, _dec1, _initClass1, _dec2, _initClass2;
|
|
217
217
|
function canonicalPathSyncNode(inputPath) {
|
|
218
218
|
try {
|
|
219
219
|
return fsSync.realpathSync.native(inputPath);
|
|
@@ -262,5 +262,24 @@ let _NodeCliLoggerAdapter;
|
|
|
262
262
|
_initClass1();
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
|
+
_dec2 = injectable([]);
|
|
266
|
+
let _NodeCliRuntimeAdapter;
|
|
267
|
+
(class {
|
|
268
|
+
static {
|
|
269
|
+
({c: [_NodeCliRuntimeAdapter, _initClass2]} = _apply_decs_2311(this, [_dec2], []));
|
|
270
|
+
}
|
|
271
|
+
cwd() {
|
|
272
|
+
return process.cwd();
|
|
273
|
+
}
|
|
274
|
+
setExitCode(code) {
|
|
275
|
+
process.exitCode = code;
|
|
276
|
+
}
|
|
277
|
+
isStdoutTty() {
|
|
278
|
+
return !!process.stdout.isTTY;
|
|
279
|
+
}
|
|
280
|
+
static {
|
|
281
|
+
_initClass2();
|
|
282
|
+
}
|
|
283
|
+
});
|
|
265
284
|
//#endregion
|
|
266
|
-
export { _NodeCliFsAdapter as NodeCliFsAdapter, _NodeCliLoggerAdapter as NodeCliLoggerAdapter };
|
|
285
|
+
export { _NodeCliFsAdapter as NodeCliFsAdapter, _NodeCliLoggerAdapter as NodeCliLoggerAdapter, _NodeCliRuntimeAdapter as NodeCliRuntimeAdapter };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
//#region src/lib/
|
|
3
|
+
//#region src/lib/infrastructure/workspace/repo-root-resolver.service.ts
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the monorepo root (directory containing `pnpm-workspace.yaml`).
|
|
6
6
|
* Tries the compiled package location first, then the provided `startDir`.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { CliLoggerToken } from "
|
|
3
|
-
import { parseWithCliSchema } from "
|
|
4
|
-
import { consumeCliAppError, runCliResultAsync } from "
|
|
5
|
-
import {
|
|
6
|
-
import { mirrorSyncRunRequestSchema } from "
|
|
7
|
-
import
|
|
1
|
+
import "../../../../core/domain/cli-exit-codes.domain.mjs";
|
|
2
|
+
import { CliLoggerToken, CliRuntimeToken } from "../../../../core/contracts/tokens.mjs";
|
|
3
|
+
import { parseWithCliSchema } from "../../../../core/presentation/cli-schema.parser.mjs";
|
|
4
|
+
import { consumeCliAppError, runCliResultAsync } from "../../../../core/presentation/cli-executor.presenter.mjs";
|
|
5
|
+
import { PrepareMirrorSyncUseCaseToken, RunMirrorSyncUseCaseToken } from "../../../contracts/tokens.mjs";
|
|
6
|
+
import { mirrorSyncRunRequestSchema } from "../../../presentation/mirror-cli.schema.mjs";
|
|
7
|
+
import { parseGlobalCliOptions } from "../../../../core/application/services/global-cli-options-parser.service.mjs";
|
|
8
8
|
import { inject, injectable } from "@codefast/di";
|
|
9
|
-
//#region src/
|
|
9
|
+
//#region src/lib/mirror/adapters/primary/cli/mirror.command.ts
|
|
10
10
|
function toPrimitive(input, hint) {
|
|
11
11
|
if (typeof input !== "object" || input === null) return input;
|
|
12
12
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -219,19 +219,22 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
219
219
|
let _dec, _initClass;
|
|
220
220
|
_dec = injectable([
|
|
221
221
|
inject(CliLoggerToken),
|
|
222
|
-
inject(
|
|
222
|
+
inject(CliRuntimeToken),
|
|
223
|
+
inject(PrepareMirrorSyncUseCaseToken),
|
|
223
224
|
inject(RunMirrorSyncUseCaseToken)
|
|
224
225
|
]);
|
|
225
226
|
let _MirrorCommand;
|
|
226
227
|
(class {
|
|
227
228
|
logger;
|
|
229
|
+
runtime;
|
|
228
230
|
prepareMirrorSync;
|
|
229
231
|
runMirrorSync;
|
|
230
232
|
static {
|
|
231
233
|
({c: [_MirrorCommand, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
232
234
|
}
|
|
233
|
-
constructor(logger, prepareMirrorSync, runMirrorSync) {
|
|
235
|
+
constructor(logger, runtime, prepareMirrorSync, runMirrorSync) {
|
|
234
236
|
this.logger = logger;
|
|
237
|
+
this.runtime = runtime;
|
|
235
238
|
this.prepareMirrorSync = prepareMirrorSync;
|
|
236
239
|
this.runMirrorSync = runMirrorSync;
|
|
237
240
|
}
|
|
@@ -241,10 +244,12 @@ let _MirrorCommand;
|
|
|
241
244
|
program.command(this.name).description(this.description).command("sync").description("Write package.json exports from dist/ for workspace packages").argument("[package]", "Optional package path relative to repo root (e.g. packages/ui)").option("-v, --verbose", "Print extra diagnostics", false).option("--json", "Print one JSON summary on stdout (suppresses human progress)", false).action(this.execute.bind(this));
|
|
242
245
|
}
|
|
243
246
|
async execute(pkg, options, command) {
|
|
247
|
+
const globalOptionsOutcome = parseGlobalCliOptions(command.optsWithGlobals());
|
|
248
|
+
if (!consumeCliAppError(this.logger, globalOptionsOutcome)) return;
|
|
244
249
|
const prelude = await this.prepareMirrorSync.execute({
|
|
245
|
-
currentWorkingDirectory:
|
|
250
|
+
currentWorkingDirectory: this.runtime.cwd(),
|
|
246
251
|
packageArg: pkg,
|
|
247
|
-
|
|
252
|
+
globals: globalOptionsOutcome.value
|
|
248
253
|
});
|
|
249
254
|
if (!consumeCliAppError(this.logger, prelude)) return;
|
|
250
255
|
const { rootDir, config, packageFilter, globals } = prelude.value;
|