@codefast/cli 0.3.14 → 0.3.16-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/arrange/analyze.mjs +24 -0
- package/dist/{lib/arrange/presentation/arrange-cli.schema.mjs → arrange/cli-schema.mjs} +10 -1
- package/dist/arrange/command.mjs +106 -0
- package/dist/{lib/arrange/domain/arrange-analyze.service.mjs → arrange/domain/analyze-service.mjs} +17 -10
- package/dist/{lib/arrange/domain/ast/ast-node.model.mjs → arrange/domain/ast/ast-node.mjs} +57 -3
- package/dist/{lib/arrange/domain/ast/collectors-cn.collector.mjs → arrange/domain/ast/collectors-cn.mjs} +21 -9
- package/dist/{lib/arrange/domain/ast/collectors-jsx.collector.mjs → arrange/domain/ast/collectors-jsx.mjs} +5 -2
- package/dist/{lib/arrange/domain/ast/collectors-tv.collector.mjs → arrange/domain/ast/collectors-tv.mjs} +21 -6
- package/dist/{lib/arrange/domain/ast/ast-helpers.helper.mjs → arrange/domain/ast/helpers.mjs} +26 -9
- package/dist/{lib/arrange/domain/ast/targets.model.mjs → arrange/domain/ast/targets.mjs} +19 -10
- package/dist/{lib/arrange/domain/constants.domain.mjs → arrange/domain/constants.mjs} +63 -18
- package/dist/{lib/arrange/domain/arrange-grouping.service.mjs → arrange/domain/grouping-service.mjs} +31 -10
- package/dist/{lib/arrange/domain/grouping.domain.mjs → arrange/domain/grouping.mjs} +39 -18
- package/dist/{lib/arrange/domain/imports.domain.mjs → arrange/domain/imports.mjs} +7 -3
- package/dist/{lib/arrange/domain/source-text-formatters.formatter.mjs → arrange/domain/source-text-formatters.mjs} +22 -5
- package/dist/{lib/arrange/domain/tailwind-token.value-object.mjs → arrange/domain/tailwind-token.mjs} +12 -3
- package/dist/{lib/arrange/domain/tailwind-token-classifier.domain-service.mjs → arrange/domain/token-classifier.mjs} +40 -15
- package/dist/arrange/output.mjs +79 -0
- package/dist/arrange/process-file.mjs +42 -0
- package/dist/arrange/resolve-target.mjs +24 -0
- package/dist/arrange/scan-target.mjs +20 -0
- package/dist/arrange/source-parse.mjs +18 -0
- package/dist/arrange/suggest.mjs +15 -0
- package/dist/arrange/sync.mjs +51 -0
- package/dist/arrange/typescript-ast-translator.mjs +354 -0
- package/dist/arrange/workspace.mjs +31 -0
- package/dist/bin.mjs +1 -1
- package/dist/{program.mjs → cli.mjs} +14 -19
- package/dist/core/cli/format-error.mjs +15 -0
- package/dist/core/cli/global-options.mjs +10 -0
- package/dist/core/cli/positional.mjs +11 -0
- package/dist/core/cli/result-handle.mjs +51 -0
- package/dist/core/config/loader.mjs +79 -0
- package/dist/{lib/config/infrastructure/config-schema.adapter.mjs → core/config/schema.mjs} +20 -6
- package/dist/core/config/warnings.mjs +12 -0
- package/dist/core/config.mjs +19 -0
- package/dist/{lib/core/domain/caught-unknown-message.value-object.mjs → core/errors.mjs} +20 -4
- package/dist/core/exit-codes.mjs +17 -0
- package/dist/core/filesystem/node.mjs +32 -0
- package/dist/core/logger.mjs +15 -0
- package/dist/{lib/core/domain/result.model.mjs → core/result.mjs} +7 -3
- package/dist/{lib/core/application/services/schema-validator.service.mjs → core/schema-parse.mjs} +6 -5
- package/dist/{lib/shared/source-code/domain/text-edit.model.mjs → core/source-text-edit.mjs} +15 -14
- package/dist/core/verbose-diagnostics.mjs +11 -0
- package/dist/core/workspace/resolver.mjs +177 -0
- package/dist/core/workspace/typescript-walk.mjs +36 -0
- package/dist/mirror/cli-result.mjs +21 -0
- package/dist/{lib/mirror/presentation/mirror-cli.schema.mjs → mirror/cli-schema.mjs} +4 -4
- package/dist/mirror/command.mjs +57 -0
- package/dist/mirror/dist-filesystem-impl.mjs +42 -0
- package/dist/{lib/mirror/domain/constants.domain.mjs → mirror/domain/constants.mjs} +16 -1
- package/dist/{lib/mirror/infrastructure/dirent-list.guard.mjs → mirror/domain/dirent-guard.mjs} +5 -2
- package/dist/{lib/mirror/domain/errors.domain.mjs → mirror/domain/errors.mjs} +7 -1
- package/dist/{lib/mirror/application/services/generate-mirror-exports.service.mjs → mirror/domain/exports.mjs} +17 -10
- package/dist/{lib/mirror/domain/package-display-name.policy.mjs → mirror/domain/package-display-name.mjs} +5 -2
- package/dist/{lib/mirror/domain/path-normalizer.value-object.mjs → mirror/domain/path-normalizer.mjs} +4 -1
- package/dist/mirror/output.mjs +45 -0
- package/dist/mirror/package-path.mjs +32 -0
- package/dist/mirror/prepare.mjs +33 -0
- package/dist/mirror/sync-reporter.mjs +104 -0
- package/dist/mirror/sync-workspace-package.mjs +103 -0
- package/dist/mirror/sync.mjs +87 -0
- package/dist/{lib/mirror/infrastructure/package-json-exports.repository.mjs → mirror/write-exports.mjs} +35 -31
- package/dist/tag/cli-result.mjs +11 -0
- package/dist/{lib/tag/presentation/tag-cli.schema.mjs → tag/cli-schema.mjs} +4 -1
- package/dist/tag/command.mjs +56 -0
- package/dist/{lib/tag/presentation/tag-sync.presenter.mjs → tag/output.mjs} +54 -28
- package/dist/tag/prepare.mjs +29 -0
- package/dist/tag/resolve-target-path.mjs +12 -0
- package/dist/tag/since-writer.mjs +130 -0
- package/dist/tag/sync.mjs +141 -0
- package/dist/tag/target-candidates.mjs +68 -0
- package/dist/tag/target-runner.mjs +26 -0
- package/dist/tag/version-resolver.mjs +25 -0
- package/package.json +8 -9
- package/dist/lib/arrange/adapters/primary/cli/arrange.command.mjs +0 -324
- package/dist/lib/arrange/adapters/primary/cli/arrange.presentation.module.mjs +0 -14
- package/dist/lib/arrange/adapters/primary/cli/presentation.tokens.mjs +0 -5
- package/dist/lib/arrange/adapters/secondary/domain-source-parser.adapter.mjs +0 -239
- package/dist/lib/arrange/adapters/secondary/file-walker.adapter.mjs +0 -241
- package/dist/lib/arrange/adapters/secondary/workspace-resolver.adapter.mjs +0 -233
- package/dist/lib/arrange/application/requests/suggest-groups.request.mjs +0 -1
- package/dist/lib/arrange/application/services/arrange-file-processor.service.mjs +0 -267
- package/dist/lib/arrange/application/services/arrange-target-path-resolver.service.mjs +0 -21
- package/dist/lib/arrange/application/services/arrange-target-scanner.service.mjs +0 -243
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.mjs +0 -255
- package/dist/lib/arrange/application/use-cases/prepare-arrange-workspace.use-case.mjs +0 -263
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.mjs +0 -274
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +0 -237
- package/dist/lib/arrange/arrange.module.mjs +0 -31
- package/dist/lib/arrange/contracts/analyze-report-presenter.contract.mjs +0 -1
- package/dist/lib/arrange/contracts/models.mjs +0 -1
- package/dist/lib/arrange/contracts/services.contract.mjs +0 -1
- package/dist/lib/arrange/contracts/tokens.mjs +0 -15
- package/dist/lib/arrange/domain/tailwind-grouping.service.mjs +0 -231
- package/dist/lib/arrange/domain/types.domain.mjs +0 -1
- package/dist/lib/arrange/infrastructure/typescript-ast-translator.adapter.mjs +0 -355
- package/dist/lib/arrange/presentation/arrange-analyze.presenter.mjs +0 -259
- package/dist/lib/arrange/presentation/arrange-sync.presenter.mjs +0 -33
- package/dist/lib/arrange/presentation/group-file-preview.presenter.mjs +0 -271
- package/dist/lib/bootstrap/composition-root.mjs +0 -33
- package/dist/lib/config/application/ports/config-loader.port.mjs +0 -1
- package/dist/lib/config/application/ports/config-warning-reporter.port.mjs +0 -1
- package/dist/lib/config/application/services/load-config.service.mjs +0 -17
- package/dist/lib/config/contracts/tokens.mjs +0 -6
- package/dist/lib/config/domain/schema.domain.mjs +0 -1
- package/dist/lib/config/infrastructure/config-loader.adapter.mjs +0 -306
- package/dist/lib/config/infrastructure/config-warning-reporter.adapter.mjs +0 -234
- package/dist/lib/core/application/load-codefast-config.use-case.mjs +0 -245
- package/dist/lib/core/application/ports/cli-io.port.mjs +0 -1
- package/dist/lib/core/application/ports/path.port.mjs +0 -1
- package/dist/lib/core/application/ports/repo-root-resolver.port.mjs +0 -1
- package/dist/lib/core/application/ports/runtime.port.mjs +0 -1
- package/dist/lib/core/application/services/global-cli-options-parser.service.mjs +0 -9
- package/dist/lib/core/contracts/tokens.mjs +0 -10
- package/dist/lib/core/core.module.mjs +0 -9
- package/dist/lib/core/domain/cli-exit-codes.domain.mjs +0 -11
- package/dist/lib/core/domain/errors.domain.mjs +0 -17
- package/dist/lib/core/infrastructure/infrastructure.module.mjs +0 -30
- package/dist/lib/core/infrastructure/path.adapter.mjs +0 -246
- package/dist/lib/core/infrastructure/port-telemetry.decorator.mjs +0 -62
- package/dist/lib/core/infrastructure/repo-root-resolver.adapter.mjs +0 -233
- package/dist/lib/core/infrastructure/verbose-diagnostics.policy.mjs +0 -9
- package/dist/lib/core/presentation/cli-executor.presenter.mjs +0 -42
- package/dist/lib/core/presentation/cli-schema.parser.mjs +0 -7
- package/dist/lib/core/presentation/format-app-error.presenter.mjs +0 -17
- package/dist/lib/core/presentation/presentation.module.mjs +0 -5
- package/dist/lib/infrastructure/node-io.adapter.mjs +0 -285
- package/dist/lib/infrastructure/workspace/repo-root-resolver.service.mjs +0 -21
- package/dist/lib/kernel/contracts/cli-command.contract.mjs +0 -1
- package/dist/lib/kernel/contracts/tokens.mjs +0 -5
- package/dist/lib/mirror/adapters/primary/cli/mirror.command.mjs +0 -272
- package/dist/lib/mirror/adapters/secondary/file-system-service.adapter.mjs +0 -261
- package/dist/lib/mirror/adapters/secondary/mirror-sync-reporter.adapter.mjs +0 -243
- package/dist/lib/mirror/adapters/secondary/package-repository.adapter.mjs +0 -241
- package/dist/lib/mirror/adapters/secondary/sync-workspace-package.adapter.mjs +0 -351
- package/dist/lib/mirror/adapters/secondary/workspace-service.adapter.mjs +0 -237
- package/dist/lib/mirror/application/mirror-sync-json.format.mjs +0 -12
- package/dist/lib/mirror/application/ports/file-system-service.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/package-repository.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/sync-workspace-package.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/workspace-service.port.mjs +0 -1
- package/dist/lib/mirror/application/requests/mirror-sync.request.mjs +0 -1
- package/dist/lib/mirror/application/services/mirror-package-arg-resolver.service.mjs +0 -20
- package/dist/lib/mirror/application/use-cases/prepare-mirror-sync.use-case.mjs +0 -264
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.mjs +0 -302
- package/dist/lib/mirror/contracts/models.mjs +0 -1
- package/dist/lib/mirror/contracts/tokens.mjs +0 -11
- package/dist/lib/mirror/domain/types.domain.mjs +0 -1
- package/dist/lib/mirror/infrastructure/mirror-console-reporter.presenter.mjs +0 -99
- package/dist/lib/mirror/infrastructure/package-filter-resolver.service.mjs +0 -25
- package/dist/lib/mirror/infrastructure/workspace-packages.service.mjs +0 -158
- package/dist/lib/mirror/mirror.module.mjs +0 -25
- package/dist/lib/shared/source-code/infrastructure/typescript-source-file-walker.service.mjs +0 -33
- package/dist/lib/tag/adapters/primary/cli/presentation.tokens.mjs +0 -6
- package/dist/lib/tag/adapters/primary/cli/tag.command.mjs +0 -285
- package/dist/lib/tag/adapters/primary/cli/tag.presentation.module.mjs +0 -13
- package/dist/lib/tag/adapters/secondary/tag-since-writer.adapter.mjs +0 -348
- package/dist/lib/tag/adapters/secondary/tag-target-resolver.adapter.mjs +0 -233
- package/dist/lib/tag/adapters/secondary/tag-version-resolver.adapter.mjs +0 -249
- package/dist/lib/tag/adapters/secondary/typescript-tree-walk.adapter.mjs +0 -233
- package/dist/lib/tag/application/ports/tag-since-writer.port.mjs +0 -1
- package/dist/lib/tag/application/ports/tag-version-resolver.port.mjs +0 -1
- package/dist/lib/tag/application/ports/target-resolver.port.mjs +0 -1
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.mjs +0 -1
- package/dist/lib/tag/application/requests/tag-sync.request.mjs +0 -1
- package/dist/lib/tag/application/services/tag-cli-target-path-resolver.service.mjs +0 -9
- package/dist/lib/tag/application/services/tag-target-runner.service.mjs +0 -21
- package/dist/lib/tag/application/tag-sync-cli-result.mjs +0 -11
- package/dist/lib/tag/application/tag-sync-json.format.mjs +0 -14
- package/dist/lib/tag/application/use-cases/prepare-tag-sync.use-case.mjs +0 -264
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.mjs +0 -381
- package/dist/lib/tag/contracts/models.mjs +0 -1
- package/dist/lib/tag/contracts/tag-sync-result-presenter.contract.mjs +0 -1
- package/dist/lib/tag/contracts/tokens.mjs +0 -10
- package/dist/lib/tag/domain/types.domain.mjs +0 -1
- package/dist/lib/tag/infrastructure/tag-target-candidates.adapter.mjs +0 -170
- package/dist/lib/tag/presentation/colors.presenter.mjs +0 -12
- package/dist/lib/tag/presentation/present-tag-sync-result.presenter.mjs +0 -233
- package/dist/lib/tag/presentation/tag-sync-progress-listener.presenter.mjs +0 -243
- package/dist/lib/tag/tag.module.mjs +0 -23
- /package/dist/{lib/arrange/application/ports/domain-source-parser.port.mjs → arrange/domain/types.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/file-walker.port.mjs → core/filesystem/port.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/group-file-preview.port.mjs → mirror/domain/dist-filesystem.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/workspace-resolver.port.mjs → mirror/domain/types.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/analyze-directory.request.mjs → mirror/sync-types.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/arrange-sync.request.mjs → tag/domain/types.mjs} +0 -0
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { AppError } from "../domain/errors.domain.mjs";
|
|
2
|
-
import { err, ok } from "../domain/result.model.mjs";
|
|
3
|
-
import { messageFromCaughtUnknown } from "../domain/caught-unknown-message.value-object.mjs";
|
|
4
|
-
import { ConfigLoaderPortToken, ConfigWarningReporterPortToken } from "../../config/contracts/tokens.mjs";
|
|
5
|
-
import { loadCodefastConfig } from "../../config/application/services/load-config.service.mjs";
|
|
6
|
-
import { inject, injectable } from "@codefast/di";
|
|
7
|
-
//#region src/lib/core/application/load-codefast-config.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([inject(ConfigLoaderPortToken), inject(ConfigWarningReporterPortToken)]);
|
|
219
|
-
let _LoadCodefastConfigUseCaseImpl;
|
|
220
|
-
(class {
|
|
221
|
-
configLoader;
|
|
222
|
-
warningReporter;
|
|
223
|
-
static {
|
|
224
|
-
({c: [_LoadCodefastConfigUseCaseImpl, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
225
|
-
}
|
|
226
|
-
constructor(configLoader, warningReporter) {
|
|
227
|
-
this.configLoader = configLoader;
|
|
228
|
-
this.warningReporter = warningReporter;
|
|
229
|
-
}
|
|
230
|
-
async execute(rootDir) {
|
|
231
|
-
try {
|
|
232
|
-
const loadedConfig = await loadCodefastConfig(this.configLoader, rootDir);
|
|
233
|
-
if (!loadedConfig.ok) return loadedConfig;
|
|
234
|
-
this.warningReporter.reportSchemaWarnings(loadedConfig.value.warnings);
|
|
235
|
-
return ok({ config: loadedConfig.value.config });
|
|
236
|
-
} catch (caughtError) {
|
|
237
|
-
return err(new AppError("INFRA_FAILURE", messageFromCaughtUnknown(caughtError), caughtError));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
static {
|
|
241
|
-
_initClass();
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
//#endregion
|
|
245
|
-
export { _LoadCodefastConfigUseCaseImpl as LoadCodefastConfigUseCaseImpl };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { parseWithSchema } from "./schema-validator.service.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region src/lib/core/application/services/global-cli-options-parser.service.ts
|
|
4
|
-
const globalCliOptionsSchema = z.object({ color: z.boolean().optional() });
|
|
5
|
-
function parseGlobalCliOptions(raw) {
|
|
6
|
-
return parseWithSchema(globalCliOptionsSchema, raw);
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { parseGlobalCliOptions };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { token } from "@codefast/di";
|
|
2
|
-
//#region src/lib/core/contracts/tokens.ts
|
|
3
|
-
const CliFsToken = token("CliFs");
|
|
4
|
-
const CliLoggerToken = token("CliLogger");
|
|
5
|
-
const CliPathToken = token("CliPath");
|
|
6
|
-
const RepoRootResolverPortToken = token("RepoRootResolverPort");
|
|
7
|
-
const CliRuntimeToken = token("CliRuntime");
|
|
8
|
-
const LoadCodefastConfigUseCaseToken = token("LoadCodefastConfigUseCase");
|
|
9
|
-
//#endregion
|
|
10
|
-
export { CliFsToken, CliLoggerToken, CliPathToken, CliRuntimeToken, LoadCodefastConfigUseCaseToken, RepoRootResolverPortToken };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CliPathToken } from "./contracts/tokens.mjs";
|
|
2
|
-
import { NodeCliPathAdapter as _NodeCliPathAdapter } from "./infrastructure/path.adapter.mjs";
|
|
3
|
-
import { Module } from "@codefast/di";
|
|
4
|
-
//#region src/lib/core/core.module.ts
|
|
5
|
-
const CoreModule = Module.create("cli-core", (moduleBuilder) => {
|
|
6
|
-
moduleBuilder.bind(CliPathToken).to(_NodeCliPathAdapter).singleton();
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CoreModule };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/lib/core/domain/cli-exit-codes.domain.ts
|
|
2
|
-
/**
|
|
3
|
-
* Process exit codes for the `codefast` CLI.
|
|
4
|
-
*
|
|
5
|
-
* Conventions align with common Unix tooling: `0` success, `1` general failure,
|
|
6
|
-
* `2` for invalid invocation (schema / options), matching GNU `sysexits` `EX_USAGE` spirit.
|
|
7
|
-
*/ const CLI_EXIT_SUCCESS = 0;
|
|
8
|
-
const CLI_EXIT_GENERAL_ERROR = 1;
|
|
9
|
-
const CLI_EXIT_USAGE = 2;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { CLI_EXIT_GENERAL_ERROR, CLI_EXIT_SUCCESS, CLI_EXIT_USAGE };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/lib/core/domain/errors.domain.ts
|
|
2
|
-
/**
|
|
3
|
-
* Cross-context application errors for Result-based use cases (CLI orchestration).
|
|
4
|
-
* Does not extend the global `Error` type — instances are carried in `Result` values, not thrown.
|
|
5
|
-
*/ var AppError = class {
|
|
6
|
-
name = "AppError";
|
|
7
|
-
code;
|
|
8
|
-
message;
|
|
9
|
-
cause;
|
|
10
|
-
constructor(code, message, cause) {
|
|
11
|
-
this.code = code;
|
|
12
|
-
this.message = message;
|
|
13
|
-
if (cause !== void 0) this.cause = cause;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { AppError };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CliFsToken, CliLoggerToken, CliRuntimeToken, LoadCodefastConfigUseCaseToken, RepoRootResolverPortToken } from "../contracts/tokens.mjs";
|
|
2
|
-
import { ConfigLoaderPortToken, ConfigWarningReporterPortToken } from "../../config/contracts/tokens.mjs";
|
|
3
|
-
import { ConfigLoaderAdapterImpl as _ConfigLoaderAdapterImpl } from "../../config/infrastructure/config-loader.adapter.mjs";
|
|
4
|
-
import { ConfigWarningReporterAdapter as _ConfigWarningReporterAdapter } from "../../config/infrastructure/config-warning-reporter.adapter.mjs";
|
|
5
|
-
import { LoadCodefastConfigUseCaseImpl as _LoadCodefastConfigUseCaseImpl } from "../application/load-codefast-config.use-case.mjs";
|
|
6
|
-
import { CoreModule } from "../core.module.mjs";
|
|
7
|
-
import { isCliTelemetryEnabled, withCliPortTelemetry } from "./port-telemetry.decorator.mjs";
|
|
8
|
-
import { RepoRootResolverAdapter as _RepoRootResolverAdapter } from "./repo-root-resolver.adapter.mjs";
|
|
9
|
-
import { NodeCliFsAdapter as _NodeCliFsAdapter, NodeCliLoggerAdapter as _NodeCliLoggerAdapter, NodeCliRuntimeAdapter as _NodeCliRuntimeAdapter } from "../../infrastructure/node-io.adapter.mjs";
|
|
10
|
-
import { Module } from "@codefast/di";
|
|
11
|
-
//#region src/lib/core/infrastructure/infrastructure.module.ts
|
|
12
|
-
const InfrastructureModule = Module.create("cli-infrastructure", (moduleBuilder) => {
|
|
13
|
-
moduleBuilder.import(CoreModule);
|
|
14
|
-
moduleBuilder.bind(CliLoggerToken).to(_NodeCliLoggerAdapter).singleton();
|
|
15
|
-
moduleBuilder.bind(CliRuntimeToken).to(_NodeCliRuntimeAdapter).singleton();
|
|
16
|
-
moduleBuilder.bind(RepoRootResolverPortToken).to(_RepoRootResolverAdapter).singleton();
|
|
17
|
-
moduleBuilder.bind(CliFsToken).to(_NodeCliFsAdapter).singleton().onActivation((ctx, rawFs) => {
|
|
18
|
-
if (!isCliTelemetryEnabled()) return rawFs;
|
|
19
|
-
return withCliPortTelemetry({
|
|
20
|
-
portName: "CliFs",
|
|
21
|
-
implementation: rawFs,
|
|
22
|
-
logger: ctx.resolve(CliLoggerToken)
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
moduleBuilder.bind(ConfigLoaderPortToken).to(_ConfigLoaderAdapterImpl).singleton();
|
|
26
|
-
moduleBuilder.bind(ConfigWarningReporterPortToken).to(_ConfigWarningReporterAdapter).singleton();
|
|
27
|
-
moduleBuilder.bind(LoadCodefastConfigUseCaseToken).to(_LoadCodefastConfigUseCaseImpl).singleton();
|
|
28
|
-
});
|
|
29
|
-
//#endregion
|
|
30
|
-
export { InfrastructureModule };
|
|
@@ -1,246 +0,0 @@
|
|
|
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,62 +0,0 @@
|
|
|
1
|
-
//#region src/lib/core/infrastructure/port-telemetry.decorator.ts
|
|
2
|
-
function summarizeTelemetryArg(value, maxLen = 160) {
|
|
3
|
-
if (typeof value === "string") return value.length > maxLen ? `${value.slice(0, maxLen)}…(${value.length} chars)` : value;
|
|
4
|
-
if (value === null || value === void 0) return String(value);
|
|
5
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
6
|
-
if (typeof value === "object") try {
|
|
7
|
-
const json = JSON.stringify(value);
|
|
8
|
-
if (typeof json === "string") return json.length > maxLen ? `${json.slice(0, maxLen)}…` : json;
|
|
9
|
-
} catch {
|
|
10
|
-
return "[object]";
|
|
11
|
-
}
|
|
12
|
-
return "[value]";
|
|
13
|
-
}
|
|
14
|
-
function isPromiseLike(value) {
|
|
15
|
-
return value !== null && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Wraps a port implementation (object of functions) to log call timing and summarized arguments via `logger`.
|
|
19
|
-
* Does not modify application or domain code — wire only from the composition root.
|
|
20
|
-
*/ function withCliPortTelemetry(args) {
|
|
21
|
-
const { portName, implementation, logger } = args;
|
|
22
|
-
return new Proxy(implementation, { get(target, propertyKey, receiver) {
|
|
23
|
-
if (typeof propertyKey === "symbol") return Reflect.get(target, propertyKey, receiver);
|
|
24
|
-
const propertyName = String(propertyKey);
|
|
25
|
-
const value = Reflect.get(target, propertyKey, receiver);
|
|
26
|
-
if (typeof value !== "function") return value;
|
|
27
|
-
return (...callArgs) => {
|
|
28
|
-
const argSummary = callArgs.map((arg) => summarizeTelemetryArg(arg)).join(", ");
|
|
29
|
-
logger.out(`[telemetry:${portName}.${propertyName}] ← (${argSummary})`);
|
|
30
|
-
const startedAt = performance.now();
|
|
31
|
-
try {
|
|
32
|
-
const result = value.apply(target, callArgs);
|
|
33
|
-
if (isPromiseLike(result)) return result.then((resolved) => {
|
|
34
|
-
logger.out(`[telemetry:${portName}.${propertyName}] → ok ${(performance.now() - startedAt).toFixed(2)}ms`);
|
|
35
|
-
return resolved;
|
|
36
|
-
}, (rejection) => {
|
|
37
|
-
logger.out(`[telemetry:${portName}.${propertyName}] → err ${(performance.now() - startedAt).toFixed(2)}ms`);
|
|
38
|
-
throw rejection;
|
|
39
|
-
});
|
|
40
|
-
logger.out(`[telemetry:${portName}.${propertyName}] → ${(performance.now() - startedAt).toFixed(2)}ms`);
|
|
41
|
-
return result;
|
|
42
|
-
} catch (caughtSyncError) {
|
|
43
|
-
logger.out(`[telemetry:${portName}.${propertyName}] → err ${(performance.now() - startedAt).toFixed(2)}ms`);
|
|
44
|
-
throw caughtSyncError;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
} });
|
|
48
|
-
}
|
|
49
|
-
function isCliTelemetryEnabled() {
|
|
50
|
-
const raw = process.env.ENABLE_TELEMETRY;
|
|
51
|
-
return raw === "1" || raw === "true";
|
|
52
|
-
}
|
|
53
|
-
function withOptionalPortTelemetry(portName, implementation, logger) {
|
|
54
|
-
if (!isCliTelemetryEnabled()) return implementation;
|
|
55
|
-
return withCliPortTelemetry({
|
|
56
|
-
portName,
|
|
57
|
-
implementation,
|
|
58
|
-
logger
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
export { isCliTelemetryEnabled, withCliPortTelemetry, withOptionalPortTelemetry };
|