@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.
- package/README.md +1 -1
- package/dist/arrange/analyze.mjs +24 -0
- package/dist/{domains/arrange/presentation/presenters/arrange-cli.schema.mjs → arrange/cli-schema.mjs} +10 -1
- package/dist/arrange/command.mjs +106 -0
- package/dist/{domains/arrange/domain/arrange-analyze.domain-service.mjs → arrange/domain/analyze-service.mjs} +17 -10
- package/dist/{domains/arrange/domain/ast/ast-node.model.mjs → arrange/domain/ast/ast-node.mjs} +57 -3
- package/dist/{domains/arrange/domain/ast/collectors-cn.collector.mjs → arrange/domain/ast/collectors-cn.mjs} +21 -9
- package/dist/{domains/arrange/domain/ast/collectors-jsx.collector.mjs → arrange/domain/ast/collectors-jsx.mjs} +5 -2
- package/dist/{domains/arrange/domain/ast/collectors-tv.collector.mjs → arrange/domain/ast/collectors-tv.mjs} +21 -6
- package/dist/{domains/arrange/domain/ast/ast-helpers.helper.mjs → arrange/domain/ast/helpers.mjs} +26 -9
- package/dist/{domains/arrange/domain/ast/targets.model.mjs → arrange/domain/ast/targets.mjs} +19 -10
- package/dist/{domains/arrange/domain/constants.domain.mjs → arrange/domain/constants.mjs} +61 -16
- package/dist/{domains/arrange/domain/arrange-grouping.domain-service.mjs → arrange/domain/grouping-service.mjs} +31 -10
- package/dist/{domains/arrange/domain/grouping.domain.mjs → arrange/domain/grouping.mjs} +39 -18
- package/dist/{domains/arrange/domain/imports.domain.mjs → arrange/domain/imports.mjs} +7 -3
- package/dist/{domains/arrange/domain/source-text-formatters.formatter.mjs → arrange/domain/source-text-formatters.mjs} +22 -5
- package/dist/{domains/arrange/domain/tailwind-token.value-object.mjs → arrange/domain/tailwind-token.mjs} +12 -3
- package/dist/{domains/arrange/domain/tailwind-token-classifier.domain-service.mjs → arrange/domain/token-classifier.mjs} +39 -14
- 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 -20
- 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/{domains/config/domain/codefast-config.schema.mjs → core/config/schema.mjs} +16 -2
- package/dist/core/config/warnings.mjs +12 -0
- package/dist/core/config.mjs +19 -0
- package/dist/{shell/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/{shell/domain/result.model.mjs → core/result.mjs} +7 -3
- package/dist/core/schema-parse.mjs +18 -0
- package/dist/{shell/domain/source-text-edit.support.mjs → core/source-text-edit.mjs} +14 -13
- 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/{domains/mirror/application/mirror-sync-cli-result.mjs → mirror/cli-result.mjs} +8 -2
- package/dist/{domains/mirror/presentation/presenters/mirror-cli.schema.mjs → mirror/cli-schema.mjs} +4 -1
- package/dist/mirror/command.mjs +57 -0
- package/dist/mirror/dist-filesystem-impl.mjs +42 -0
- package/dist/{domains/mirror/domain/constants.domain.mjs → mirror/domain/constants.mjs} +16 -1
- package/dist/{domains/mirror/infrastructure/guards/dirent-list.guard.mjs → mirror/domain/dirent-guard.mjs} +5 -2
- package/dist/{domains/mirror/domain/errors.domain.mjs → mirror/domain/errors.mjs} +7 -1
- package/dist/{domains/mirror/domain/generate-mirror-exports.domain-service.mjs → mirror/domain/exports.mjs} +17 -10
- package/dist/{domains/mirror/domain/package-display-name.policy.mjs → mirror/domain/package-display-name.mjs} +5 -2
- package/dist/{domains/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/{domains/mirror/infrastructure/package-json-exports.repository.mjs → mirror/write-exports.mjs} +11 -7
- package/dist/tag/cli-result.mjs +11 -0
- package/dist/{domains/tag/presentation/presenters/tag-cli.schema.mjs → tag/cli-schema.mjs} +4 -1
- package/dist/tag/command.mjs +56 -0
- package/dist/tag/output.mjs +87 -0
- package/dist/tag/prepare.mjs +29 -0
- package/dist/tag/resolve-target-path.mjs +12 -0
- package/dist/tag/since-writer.mjs +131 -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 +11 -11
- package/dist/bootstrap/cli-application.module.mjs +0 -18
- package/dist/bootstrap/composition-root.mjs +0 -14
- package/dist/bootstrap/register-cli-command-trees.mjs +0 -7
- package/dist/domains/arrange/application/ports/outbound/arrange-target-scanner.port.mjs +0 -1
- package/dist/domains/arrange/application/ports/outbound/domain-source-parser.port.mjs +0 -1
- package/dist/domains/arrange/application/ports/outbound/file-walker.port.mjs +0 -1
- package/dist/domains/arrange/application/ports/presenting/present-analyze-report.presenter.mjs +0 -1
- package/dist/domains/arrange/application/ports/presenting/present-arrange-sync-result.presenter.mjs +0 -1
- package/dist/domains/arrange/application/ports/presenting/present-group-file-preview.presenter.mjs +0 -1
- package/dist/domains/arrange/application/requests/analyze-directory.request.mjs +0 -1
- package/dist/domains/arrange/application/requests/arrange-sync.request.mjs +0 -1
- package/dist/domains/arrange/application/requests/suggest-groups.request.mjs +0 -1
- package/dist/domains/arrange/application/use-cases/analyze-directory.use-case.mjs +0 -255
- package/dist/domains/arrange/application/use-cases/prepare-arrange-workspace.use-case.mjs +0 -264
- package/dist/domains/arrange/application/use-cases/run-arrange-sync.use-case.mjs +0 -274
- package/dist/domains/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +0 -237
- package/dist/domains/arrange/arrange.module.mjs +0 -38
- package/dist/domains/arrange/composition/tokens.mjs +0 -17
- package/dist/domains/arrange/contracts/models.mjs +0 -1
- package/dist/domains/arrange/domain/tailwind-grouping.domain-service.mjs +0 -231
- package/dist/domains/arrange/domain/types.domain.mjs +0 -1
- package/dist/domains/arrange/infrastructure/adapters/arrange-file-processor.adapter.mjs +0 -267
- package/dist/domains/arrange/infrastructure/adapters/arrange-target-path-resolver.adapter.mjs +0 -247
- package/dist/domains/arrange/infrastructure/adapters/arrange-target-scanner.adapter.mjs +0 -243
- package/dist/domains/arrange/infrastructure/adapters/domain-source-parser.adapter.mjs +0 -241
- package/dist/domains/arrange/infrastructure/adapters/file-walker.adapter.mjs +0 -240
- package/dist/domains/arrange/infrastructure/typescript-ast-translator.mjs +0 -580
- package/dist/domains/arrange/presentation/cli/arrange.command.mjs +0 -465
- package/dist/domains/arrange/presentation/presenters/arrange-analyze.presenter.mjs +0 -252
- package/dist/domains/arrange/presentation/presenters/arrange-sync.presenter.mjs +0 -236
- package/dist/domains/arrange/presentation/presenters/group-file-preview.presenter.mjs +0 -271
- package/dist/domains/config/application/ports/outbound/codefast-config-schema.port.mjs +0 -1
- package/dist/domains/config/application/ports/outbound/config-loader.port.mjs +0 -1
- package/dist/domains/config/application/ports/outbound/config-warning-reporter.port.mjs +0 -1
- package/dist/domains/config/composition/tokens.mjs +0 -7
- package/dist/domains/config/domain/schema.domain.mjs +0 -1
- package/dist/domains/config/infrastructure/adapters/config-loader.adapter.mjs +0 -305
- package/dist/domains/config/infrastructure/adapters/config-warning-reporter.adapter.mjs +0 -234
- package/dist/domains/config/infrastructure/adapters/zod-codefast-config-schema.adapter.mjs +0 -236
- package/dist/domains/mirror/application/ports/inbound/prepare-mirror-sync.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/inbound/run-mirror-sync.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/outbound/file-system-service.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/outbound/mirror-package-path.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/outbound/mirror-sync-reporter.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/outbound/package-repository.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/outbound/sync-workspace-package.port.mjs +0 -1
- package/dist/domains/mirror/application/ports/presenting/present-mirror-sync-progress.presenter.mjs +0 -1
- package/dist/domains/mirror/application/requests/mirror-sync-execution-input.mjs +0 -1
- package/dist/domains/mirror/application/requests/mirror-sync.request.mjs +0 -1
- package/dist/domains/mirror/application/use-cases/prepare-mirror-sync.use-case.mjs +0 -263
- package/dist/domains/mirror/application/use-cases/run-mirror-sync.use-case.mjs +0 -317
- package/dist/domains/mirror/composition/tokens.mjs +0 -12
- package/dist/domains/mirror/contracts/models.mjs +0 -1
- package/dist/domains/mirror/domain/types.domain.mjs +0 -1
- package/dist/domains/mirror/infrastructure/adapters/file-system-service.adapter.mjs +0 -261
- package/dist/domains/mirror/infrastructure/adapters/mirror-package-path-resolver.adapter.mjs +0 -252
- package/dist/domains/mirror/infrastructure/adapters/mirror-sync-reporter.adapter.mjs +0 -322
- package/dist/domains/mirror/infrastructure/adapters/package-repository.adapter.mjs +0 -241
- package/dist/domains/mirror/infrastructure/adapters/sync-workspace-package.adapter.mjs +0 -328
- package/dist/domains/mirror/mirror.module.mjs +0 -26
- package/dist/domains/mirror/presentation/cli/mirror.command.mjs +0 -328
- package/dist/domains/mirror/presentation/presenters/present-mirror-sync-progress.presenter.mjs +0 -265
- package/dist/domains/tag/application/ports/inbound/prepare-tag-sync.port.mjs +0 -1
- package/dist/domains/tag/application/ports/inbound/run-tag-sync.port.mjs +0 -1
- package/dist/domains/tag/application/ports/outbound/tag-eligible-workspace-paths.port.mjs +0 -1
- package/dist/domains/tag/application/ports/outbound/tag-since-writer.port.mjs +0 -1
- package/dist/domains/tag/application/ports/outbound/tag-target-path-resolver.port.mjs +0 -1
- package/dist/domains/tag/application/ports/outbound/tag-target-runner.port.mjs +0 -1
- package/dist/domains/tag/application/ports/outbound/tag-version-resolver.port.mjs +0 -1
- package/dist/domains/tag/application/ports/presenting/present-tag-sync-progress.presenter.mjs +0 -1
- package/dist/domains/tag/application/ports/presenting/present-tag-sync-result.presenter.mjs +0 -1
- package/dist/domains/tag/application/requests/tag-sync-execution-input.mjs +0 -1
- package/dist/domains/tag/application/requests/tag-sync.request.mjs +0 -1
- package/dist/domains/tag/application/tag-sync-cli-result.mjs +0 -11
- package/dist/domains/tag/application/use-cases/prepare-tag-sync.use-case.mjs +0 -260
- package/dist/domains/tag/application/use-cases/run-tag-sync.use-case.mjs +0 -375
- package/dist/domains/tag/composition/tokens.mjs +0 -13
- package/dist/domains/tag/contracts/models.mjs +0 -1
- package/dist/domains/tag/domain/types.domain.mjs +0 -1
- package/dist/domains/tag/infrastructure/adapters/tag-since-writer.adapter.mjs +0 -348
- package/dist/domains/tag/infrastructure/adapters/tag-target-path-resolver.adapter.mjs +0 -235
- package/dist/domains/tag/infrastructure/adapters/tag-target-resolver.adapter.mjs +0 -302
- package/dist/domains/tag/infrastructure/adapters/tag-target-runner.adapter.mjs +0 -259
- package/dist/domains/tag/infrastructure/adapters/tag-version-resolver.adapter.mjs +0 -249
- package/dist/domains/tag/presentation/cli/tag.command.mjs +0 -325
- package/dist/domains/tag/presentation/presenters/present-tag-sync-progress.presenter.mjs +0 -248
- package/dist/domains/tag/presentation/presenters/present-tag-sync-result.presenter.mjs +0 -290
- package/dist/domains/tag/tag.module.mjs +0 -28
- package/dist/shell/application/cli-runtime.tokens.mjs +0 -18
- package/dist/shell/application/coordination/cli-executor.coordination.mjs +0 -1
- package/dist/shell/application/coordination/cli-schema-parsing.coordination.mjs +0 -1
- package/dist/shell/application/global-cli-options.model.mjs +0 -5
- package/dist/shell/application/ports/inbound/load-codefast-config.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/cli-fs.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/cli-logger.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/cli-path.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/cli-runtime.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/cli-telemetry.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/cli-verbose-diagnostics.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/format-app-error.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/global-cli-options-parse.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/repo-root-resolver.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/typescript-source-file-walker.port.mjs +0 -1
- package/dist/shell/application/ports/outbound/workspace-package-layout.port.mjs +0 -1
- package/dist/shell/application/ports/primary/command.port.mjs +0 -1
- package/dist/shell/application/services/cli-executor.service.mjs +0 -267
- package/dist/shell/application/services/schema-validator.service.mjs +0 -236
- package/dist/shell/application/use-cases/load-codefast-config.use-case.mjs +0 -243
- package/dist/shell/composition/tokens.mjs +0 -5
- package/dist/shell/contracts/cli-command-slots.mjs +0 -11
- package/dist/shell/domain/cli-exit-codes.domain.mjs +0 -11
- package/dist/shell/domain/cli-positional-arg.value-object.mjs +0 -6
- package/dist/shell/domain/errors.domain.mjs +0 -17
- package/dist/shell/infrastructure/adapters/cli-verbose-diagnostics.adapter.mjs +0 -228
- package/dist/shell/infrastructure/adapters/format-app-error.adapter.mjs +0 -236
- package/dist/shell/infrastructure/adapters/global-cli-options-parser.adapter.mjs +0 -233
- package/dist/shell/infrastructure/adapters/repo-root-resolver.adapter.mjs +0 -244
- package/dist/shell/infrastructure/adapters/typescript-source-file-walker.adapter.mjs +0 -259
- package/dist/shell/infrastructure/commander/commander-cli-host.adapter.mjs +0 -69
- package/dist/shell/infrastructure/node/node-cli-fs.adapter.mjs +0 -249
- package/dist/shell/infrastructure/node/node-cli-logger.adapter.mjs +0 -231
- package/dist/shell/infrastructure/node/node-cli-path.adapter.mjs +0 -246
- package/dist/shell/infrastructure/node/node-cli-runtime.adapter.mjs +0 -234
- package/dist/shell/infrastructure/telemetry/cli-telemetry.adapter.mjs +0 -280
- package/dist/shell/infrastructure/workspace/node-pnpm-workspace-package-layout.adapter.mjs +0 -385
- package/dist/shell/shell.module.mjs +0 -43
- package/dist/shell/wiring/optional-cli-port-telemetry-activation.mjs +0 -13
- /package/dist/{domains/arrange/application/ports/inbound/analyze-directory.port.mjs → arrange/domain/types.mjs} +0 -0
- /package/dist/{domains/arrange/application/ports/inbound/prepare-arrange-workspace.port.mjs → core/filesystem/port.mjs} +0 -0
- /package/dist/{domains/arrange/application/ports/inbound/run-arrange-sync.port.mjs → mirror/domain/dist-filesystem.mjs} +0 -0
- /package/dist/{domains/arrange/application/ports/inbound/suggest-cn-groups.port.mjs → mirror/domain/types.mjs} +0 -0
- /package/dist/{domains/arrange/application/ports/outbound/arrange-file-processor.port.mjs → mirror/sync-types.mjs} +0 -0
- /package/dist/{domains/arrange/application/ports/outbound/arrange-target-path-resolver.port.mjs → tag/domain/types.mjs} +0 -0
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { CliLoggerPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
-
import { lineOf } from "../../domain/ast/ast-helpers.helper.mjs";
|
|
3
|
-
import { inject, injectable } from "@codefast/di";
|
|
4
|
-
//#region src/domains/arrange/presentation/presenters/group-file-preview.presenter.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(CliLoggerPortToken)]);
|
|
216
|
-
let _PresentGroupFilePreviewPresenter;
|
|
217
|
-
(class {
|
|
218
|
-
logger;
|
|
219
|
-
static {
|
|
220
|
-
({c: [_PresentGroupFilePreviewPresenter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
221
|
-
}
|
|
222
|
-
constructor(logger) {
|
|
223
|
-
this.logger = logger;
|
|
224
|
-
}
|
|
225
|
-
printGroupFilePreviewFromWork(work) {
|
|
226
|
-
this.printGroupFilePreviewFromPlan(work);
|
|
227
|
-
}
|
|
228
|
-
printGroupFilePreviewFromPlan(work) {
|
|
229
|
-
this.printGroupFilePreviewBody({
|
|
230
|
-
filePath: work.filePath,
|
|
231
|
-
reportTotal: work.reportTotal,
|
|
232
|
-
cnInTvNoReplacement: work.cnInTvNoReplacement,
|
|
233
|
-
cnInTvCalls: work.cnInTvCalls,
|
|
234
|
-
unwrapReplacementByCall: work.unwrapReplacementByCall,
|
|
235
|
-
sourceText: work.sourceText,
|
|
236
|
-
domainSf: work.domainSfForLineNumbers,
|
|
237
|
-
unwrapEdits: work.unwrapEdits,
|
|
238
|
-
plannedGroupEdits: work.plannedGroupEdits
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
printGroupFilePreviewBody(args) {
|
|
242
|
-
const { filePath, reportTotal, cnInTvNoReplacement, cnInTvCalls, unwrapReplacementByCall, sourceText, domainSf, unwrapEdits, plannedGroupEdits } = args;
|
|
243
|
-
let header = `\n── ${filePath} (${reportTotal} site(s)`;
|
|
244
|
-
if (cnInTvNoReplacement > 0) header += `; plus ${cnInTvNoReplacement} cn() inside tv left unchanged (0 args)`;
|
|
245
|
-
header += `) ──`;
|
|
246
|
-
this.logger.out(header);
|
|
247
|
-
for (const call of cnInTvCalls) {
|
|
248
|
-
const replacement = unwrapReplacementByCall.get(call);
|
|
249
|
-
if (replacement === void 0) {
|
|
250
|
-
this.logger.out(` Line ${lineOf(domainSf, call)} [tv ⊃ cn]: cn(...) has no arguments — skipped`);
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
const start = call.pos;
|
|
254
|
-
const end = call.end;
|
|
255
|
-
if (sourceText.slice(start, end) === replacement) continue;
|
|
256
|
-
this.logger.out(` Line ${lineOf(domainSf, call)} [tv ⊃ cn → string/array]:`);
|
|
257
|
-
this.logger.out(` ${replacement.split("\n").join("\n ")}`);
|
|
258
|
-
}
|
|
259
|
-
if (unwrapEdits.length > 0 && plannedGroupEdits.length > 0) this.logger.out(" ([cn] / [tv] / [JSX className] lines below reflect content after unwrap of cn inside tv.)");
|
|
260
|
-
for (const plan of plannedGroupEdits) {
|
|
261
|
-
this.logger.out(` Line ${lineOf(plan.lineSf, plan.reportNode)} [${plan.label}]:`);
|
|
262
|
-
this.logger.out(` ${plan.replacement.split("\n").join("\n ")}`);
|
|
263
|
-
this.logger.out(` // Buckets: ${JSON.stringify(plan.bucketSummary)}`);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
static {
|
|
267
|
-
_initClass();
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
//#endregion
|
|
271
|
-
export { _PresentGroupFilePreviewPresenter as PresentGroupFilePreviewPresenter };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { token } from "@codefast/di";
|
|
2
|
-
//#region src/domains/config/composition/tokens.ts
|
|
3
|
-
const CodefastConfigSchemaPortToken = token("CodefastConfigSchemaPort");
|
|
4
|
-
const ConfigLoaderPortToken = token("ConfigLoaderPort");
|
|
5
|
-
const ConfigWarningReporterPortToken = token("ConfigWarningReporterPort");
|
|
6
|
-
//#endregion
|
|
7
|
-
export { CodefastConfigSchemaPortToken, ConfigLoaderPortToken, ConfigWarningReporterPortToken };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import { CliFilesystemPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
-
import { CodefastConfigSchemaPortToken } from "../../composition/tokens.mjs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { inject, injectable } from "@codefast/di";
|
|
5
|
-
import jiti from "jiti";
|
|
6
|
-
//#region src/domains/config/infrastructure/adapters/config-loader.adapter.ts
|
|
7
|
-
function toPrimitive(input, hint) {
|
|
8
|
-
if (typeof input !== "object" || input === null) return input;
|
|
9
|
-
var prim = input[Symbol.toPrimitive];
|
|
10
|
-
if (prim !== void 0) {
|
|
11
|
-
var res = prim.call(input, hint || "default");
|
|
12
|
-
if (typeof res !== "object") return res;
|
|
13
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
14
|
-
}
|
|
15
|
-
return (hint === "string" ? String : Number)(input);
|
|
16
|
-
}
|
|
17
|
-
function toPropertyKey(arg) {
|
|
18
|
-
var key = toPrimitive(arg, "string");
|
|
19
|
-
return typeof key === "symbol" ? key : String(key);
|
|
20
|
-
}
|
|
21
|
-
function checkInRHS(value) {
|
|
22
|
-
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
function setFunctionName(fn, name, prefix) {
|
|
26
|
-
if (typeof name === "symbol") {
|
|
27
|
-
name = name.description;
|
|
28
|
-
name = name ? "[" + name + "]" : "";
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
Object.defineProperty(fn, "name", {
|
|
32
|
-
configurable: true,
|
|
33
|
-
value: prefix ? prefix + " " + name : name
|
|
34
|
-
});
|
|
35
|
-
} catch (_) {}
|
|
36
|
-
return fn;
|
|
37
|
-
}
|
|
38
|
-
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
39
|
-
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
40
|
-
var defineProperty = Object.defineProperty;
|
|
41
|
-
var create = Object.create;
|
|
42
|
-
var metadata;
|
|
43
|
-
var existingNonFields = [create(null), create(null)];
|
|
44
|
-
var hasClassDecs = classDecs.length;
|
|
45
|
-
var _;
|
|
46
|
-
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
47
|
-
return function(thisArg, value) {
|
|
48
|
-
if (useStaticThis) {
|
|
49
|
-
value = thisArg;
|
|
50
|
-
thisArg = targetClass;
|
|
51
|
-
}
|
|
52
|
-
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
53
|
-
return hasValue ? value : thisArg;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
57
|
-
if (typeof fn !== "function") {
|
|
58
|
-
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
59
|
-
}
|
|
60
|
-
return fn;
|
|
61
|
-
}
|
|
62
|
-
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
63
|
-
function assertInstanceIfPrivate(target) {
|
|
64
|
-
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
65
|
-
}
|
|
66
|
-
var decs = [].concat(decInfo[0]);
|
|
67
|
-
var decVal = decInfo[3];
|
|
68
|
-
var isClass = !ret;
|
|
69
|
-
var isAccessor = kind === 1;
|
|
70
|
-
var isGetter = kind === 3;
|
|
71
|
-
var isSetter = kind === 4;
|
|
72
|
-
var isMethod = kind === 2;
|
|
73
|
-
function bindPropCall(name, useStaticThis, before) {
|
|
74
|
-
return function(_this, value) {
|
|
75
|
-
if (useStaticThis) {
|
|
76
|
-
value = _this;
|
|
77
|
-
_this = Class;
|
|
78
|
-
}
|
|
79
|
-
if (before) before(_this);
|
|
80
|
-
return desc[name].call(_this, value);
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
var desc1 = {};
|
|
84
|
-
var init = [];
|
|
85
|
-
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
86
|
-
if (!isClass) {
|
|
87
|
-
if (isPrivate) {
|
|
88
|
-
if (isField || isAccessor) desc1 = {
|
|
89
|
-
get: setFunctionName(function() {
|
|
90
|
-
return decVal(this);
|
|
91
|
-
}, name, "get"),
|
|
92
|
-
set: function(value) {
|
|
93
|
-
decInfo[4](this, value);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
else desc1[key] = decVal;
|
|
97
|
-
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
98
|
-
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
99
|
-
if (!isField && !isPrivate) {
|
|
100
|
-
_ = existingNonFields[+isStatic][name];
|
|
101
|
-
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
102
|
-
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
var newValue = Class;
|
|
106
|
-
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
107
|
-
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
108
|
-
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
109
|
-
var decoratorFinishedRef = {};
|
|
110
|
-
var ctx = {
|
|
111
|
-
kind: [
|
|
112
|
-
"field",
|
|
113
|
-
"accessor",
|
|
114
|
-
"method",
|
|
115
|
-
"getter",
|
|
116
|
-
"setter",
|
|
117
|
-
"class"
|
|
118
|
-
][kind],
|
|
119
|
-
name,
|
|
120
|
-
metadata,
|
|
121
|
-
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
122
|
-
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
123
|
-
assertCallable(initializer, "An initializer", "be", true);
|
|
124
|
-
initializers.push(initializer);
|
|
125
|
-
}).bind(null, decoratorFinishedRef)
|
|
126
|
-
};
|
|
127
|
-
if (isClass) {
|
|
128
|
-
_ = dec.call(decThis, newValue, ctx);
|
|
129
|
-
decoratorFinishedRef.v = 1;
|
|
130
|
-
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
ctx.static = isStatic;
|
|
134
|
-
ctx.private = isPrivate;
|
|
135
|
-
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
136
|
-
return name in target;
|
|
137
|
-
} };
|
|
138
|
-
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
139
|
-
assertInstanceIfPrivate(_this);
|
|
140
|
-
return desc1.value;
|
|
141
|
-
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
142
|
-
return target[name];
|
|
143
|
-
};
|
|
144
|
-
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
145
|
-
target[name] = value;
|
|
146
|
-
};
|
|
147
|
-
newValue = dec.call(decThis, isAccessor ? {
|
|
148
|
-
get: desc1.get,
|
|
149
|
-
set: desc1.set
|
|
150
|
-
} : desc1[key], ctx);
|
|
151
|
-
decoratorFinishedRef.v = 1;
|
|
152
|
-
if (isAccessor) {
|
|
153
|
-
if (typeof newValue === "object" && newValue) {
|
|
154
|
-
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
155
|
-
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
156
|
-
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
157
|
-
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
158
|
-
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
159
|
-
else desc1[key] = newValue;
|
|
160
|
-
}
|
|
161
|
-
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
162
|
-
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
163
|
-
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
164
|
-
else defineProperty(Class, name, desc1);
|
|
165
|
-
return newValue;
|
|
166
|
-
}
|
|
167
|
-
function applyMemberDecs() {
|
|
168
|
-
var ret = [];
|
|
169
|
-
var protoInitializers;
|
|
170
|
-
var staticInitializers;
|
|
171
|
-
var pushInitializers = function(initializers) {
|
|
172
|
-
if (initializers) ret.push(createRunInitializers(initializers));
|
|
173
|
-
};
|
|
174
|
-
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
175
|
-
for (var i = 0; i < memberDecs.length; i++) {
|
|
176
|
-
var decInfo = memberDecs[i];
|
|
177
|
-
var kind = decInfo[1];
|
|
178
|
-
var kindOnly = kind & 7;
|
|
179
|
-
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
180
|
-
var name = decInfo[2];
|
|
181
|
-
var isPrivate = !!decInfo[3];
|
|
182
|
-
var decoratorsHaveThis = kind & 16;
|
|
183
|
-
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(_) {
|
|
184
|
-
return checkInRHS(_) === targetClass;
|
|
185
|
-
} : instanceBrand);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
applyMemberDecsOfKind(8, 0);
|
|
190
|
-
applyMemberDecsOfKind(0, 0);
|
|
191
|
-
applyMemberDecsOfKind(8, 1);
|
|
192
|
-
applyMemberDecsOfKind(0, 1);
|
|
193
|
-
pushInitializers(protoInitializers);
|
|
194
|
-
pushInitializers(staticInitializers);
|
|
195
|
-
return ret;
|
|
196
|
-
}
|
|
197
|
-
function defineMetadata(Class) {
|
|
198
|
-
return defineProperty(Class, symbolMetadata, {
|
|
199
|
-
configurable: true,
|
|
200
|
-
enumerable: true,
|
|
201
|
-
value: metadata
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
205
|
-
metadata = create(metadata == null ? null : metadata);
|
|
206
|
-
_ = applyMemberDecs();
|
|
207
|
-
if (!hasClassDecs) defineMetadata(targetClass);
|
|
208
|
-
return {
|
|
209
|
-
e: _,
|
|
210
|
-
get c() {
|
|
211
|
-
var initializers = [];
|
|
212
|
-
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
let _dec, _initClass;
|
|
217
|
-
_dec = injectable([inject(CliFilesystemPortToken), inject(CodefastConfigSchemaPortToken)]);
|
|
218
|
-
let _ConfigLoaderAdapter;
|
|
219
|
-
(class {
|
|
220
|
-
fs;
|
|
221
|
-
configSchema;
|
|
222
|
-
static {
|
|
223
|
-
({c: [_ConfigLoaderAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
224
|
-
}
|
|
225
|
-
constructor(fs, configSchema) {
|
|
226
|
-
this.fs = fs;
|
|
227
|
-
this.configSchema = configSchema;
|
|
228
|
-
}
|
|
229
|
-
configJsPriority = [
|
|
230
|
-
"codefast.config.mjs",
|
|
231
|
-
"codefast.config.js",
|
|
232
|
-
"codefast.config.cjs"
|
|
233
|
-
];
|
|
234
|
-
configJson = "codefast.config.json";
|
|
235
|
-
cachedLoads = /* @__PURE__ */ new Map();
|
|
236
|
-
async loadConfig(startDir) {
|
|
237
|
-
const cacheKey = path.resolve(startDir);
|
|
238
|
-
if (!this.cachedLoads.has(cacheKey)) this.cachedLoads.set(cacheKey, this.loadOnce(cacheKey));
|
|
239
|
-
const cached = this.cachedLoads.get(cacheKey);
|
|
240
|
-
if (cached === void 0) throw new Error("config loader cache invariant violated");
|
|
241
|
-
return cached;
|
|
242
|
-
}
|
|
243
|
-
formatZodError(error, filePath) {
|
|
244
|
-
const formatted = error.issues.map((issue) => {
|
|
245
|
-
return ` - ${issue.path.length > 0 ? issue.path.join(".") : "<root>"}: ${issue.message}`;
|
|
246
|
-
}).join("\n");
|
|
247
|
-
return `Invalid config schema in ${path.basename(filePath)}:\n${formatted}`;
|
|
248
|
-
}
|
|
249
|
-
parseLoadedConfig(raw, filePath) {
|
|
250
|
-
const outcome = this.configSchema.safeParseLoadedConfig(raw);
|
|
251
|
-
if (outcome.kind === "invalid_schema") throw new Error(this.formatZodError(outcome.zodError, filePath));
|
|
252
|
-
return outcome.config;
|
|
253
|
-
}
|
|
254
|
-
listConfigCandidates(startDir) {
|
|
255
|
-
const candidates = [];
|
|
256
|
-
let current = path.resolve(startDir);
|
|
257
|
-
while (true) {
|
|
258
|
-
for (const name of this.configJsPriority) {
|
|
259
|
-
const candidate = path.join(current, name);
|
|
260
|
-
if (this.fs.existsSync(candidate)) candidates.push(candidate);
|
|
261
|
-
}
|
|
262
|
-
const jsonCandidate = path.join(current, this.configJson);
|
|
263
|
-
if (this.fs.existsSync(jsonCandidate)) candidates.push(jsonCandidate);
|
|
264
|
-
const parent = path.dirname(current);
|
|
265
|
-
if (parent === current) break;
|
|
266
|
-
current = parent;
|
|
267
|
-
}
|
|
268
|
-
return candidates;
|
|
269
|
-
}
|
|
270
|
-
async readConfigFromPath(filePath, jitiBaseDir) {
|
|
271
|
-
if (path.extname(filePath) === ".json") {
|
|
272
|
-
const content = await this.fs.readFile(filePath, "utf8");
|
|
273
|
-
return this.parseLoadedConfig(JSON.parse(content), filePath);
|
|
274
|
-
}
|
|
275
|
-
const moduleConfig = jiti(jitiBaseDir, {
|
|
276
|
-
interopDefault: true,
|
|
277
|
-
moduleCache: false
|
|
278
|
-
})(filePath);
|
|
279
|
-
const unwrappedConfig = typeof moduleConfig === "object" && moduleConfig !== null && "default" in moduleConfig ? moduleConfig.default : moduleConfig;
|
|
280
|
-
return this.parseLoadedConfig(unwrappedConfig, filePath);
|
|
281
|
-
}
|
|
282
|
-
async loadOnce(startDir) {
|
|
283
|
-
const warnings = [];
|
|
284
|
-
const configPaths = this.listConfigCandidates(startDir);
|
|
285
|
-
if (configPaths.length === 0) return {
|
|
286
|
-
config: {},
|
|
287
|
-
warnings
|
|
288
|
-
};
|
|
289
|
-
const configPath = configPaths[0];
|
|
290
|
-
if (configPath === void 0) return {
|
|
291
|
-
config: {},
|
|
292
|
-
warnings
|
|
293
|
-
};
|
|
294
|
-
return {
|
|
295
|
-
config: await this.readConfigFromPath(configPath, startDir),
|
|
296
|
-
warnings,
|
|
297
|
-
configPath
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
static {
|
|
301
|
-
_initClass();
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
//#endregion
|
|
305
|
-
export { _ConfigLoaderAdapter as ConfigLoaderAdapter };
|