@codefast/cli 0.3.14-canary.2 → 0.3.15
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/bootstrap/cli-application.module.mjs +18 -0
- package/dist/bootstrap/composition-root.mjs +14 -0
- package/dist/bootstrap/register-cli-command-trees.mjs +7 -0
- package/dist/{lib → domains}/arrange/application/use-cases/analyze-directory.use-case.mjs +12 -12
- package/dist/{lib → domains}/arrange/application/use-cases/prepare-arrange-workspace.use-case.mjs +19 -18
- package/dist/{lib → domains}/arrange/application/use-cases/run-arrange-sync.use-case.mjs +18 -18
- package/dist/{lib → domains}/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +5 -5
- package/dist/domains/arrange/arrange.module.mjs +38 -0
- package/dist/domains/arrange/composition/tokens.mjs +17 -0
- package/dist/{lib/arrange/domain/arrange-analyze.service.mjs → domains/arrange/domain/arrange-analyze.domain-service.mjs} +1 -1
- package/dist/{lib/arrange/domain/arrange-grouping.service.mjs → domains/arrange/domain/arrange-grouping.domain-service.mjs} +2 -2
- package/dist/{lib → domains}/arrange/domain/ast/ast-helpers.helper.mjs +2 -2
- package/dist/{lib → domains}/arrange/domain/ast/ast-node.model.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/ast/collectors-cn.collector.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/ast/collectors-jsx.collector.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/ast/collectors-tv.collector.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/ast/targets.model.mjs +2 -2
- package/dist/{lib → domains}/arrange/domain/constants.domain.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/grouping.domain.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/imports.domain.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/source-text-formatters.formatter.mjs +2 -2
- package/dist/{lib/arrange/domain/tailwind-grouping.service.mjs → domains/arrange/domain/tailwind-grouping.domain-service.mjs} +5 -5
- package/dist/{lib → domains}/arrange/domain/tailwind-token-classifier.domain-service.mjs +1 -1
- package/dist/{lib → domains}/arrange/domain/tailwind-token.value-object.mjs +1 -1
- package/dist/{lib/arrange/application/services/arrange-file-processor.service.mjs → domains/arrange/infrastructure/adapters/arrange-file-processor.adapter.mjs} +8 -8
- package/dist/domains/arrange/infrastructure/adapters/arrange-target-path-resolver.adapter.mjs +247 -0
- package/dist/{lib/arrange/application/services/arrange-target-scanner.service.mjs → domains/arrange/infrastructure/adapters/arrange-target-scanner.adapter.mjs} +8 -8
- package/dist/{lib/arrange/adapters/secondary → domains/arrange/infrastructure/adapters}/domain-source-parser.adapter.mjs +10 -8
- package/dist/{lib/arrange/adapters/secondary → domains/arrange/infrastructure/adapters}/file-walker.adapter.mjs +8 -9
- package/dist/domains/arrange/infrastructure/typescript-ast-translator.mjs +580 -0
- package/dist/{lib/arrange/adapters/primary → domains/arrange/presentation}/cli/arrange.command.mjs +195 -54
- package/dist/{lib/arrange/presentation → domains/arrange/presentation/presenters}/arrange-analyze.presenter.mjs +26 -33
- package/dist/{lib/arrange/presentation → domains/arrange/presentation/presenters}/arrange-cli.schema.mjs +1 -1
- package/dist/{lib/tag/presentation/present-tag-sync-result.presenter.mjs → domains/arrange/presentation/presenters/arrange-sync.presenter.mjs} +12 -9
- package/dist/{lib/arrange/presentation → domains/arrange/presentation/presenters}/group-file-preview.presenter.mjs +46 -46
- package/dist/domains/config/composition/tokens.mjs +7 -0
- package/dist/{lib/config/infrastructure/config-schema.adapter.mjs → domains/config/domain/codefast-config.schema.mjs} +6 -6
- package/dist/{lib/config/infrastructure → domains/config/infrastructure/adapters}/config-loader.adapter.mjs +76 -77
- package/dist/{lib/config/infrastructure → domains/config/infrastructure/adapters}/config-warning-reporter.adapter.mjs +6 -6
- package/dist/domains/config/infrastructure/adapters/zod-codefast-config-schema.adapter.mjs +236 -0
- package/dist/domains/mirror/application/mirror-sync-cli-result.mjs +15 -0
- package/dist/{lib → domains}/mirror/application/use-cases/prepare-mirror-sync.use-case.mjs +14 -15
- package/dist/{lib → domains}/mirror/application/use-cases/run-mirror-sync.use-case.mjs +69 -54
- package/dist/{lib/mirror/contracts → domains/mirror/composition}/tokens.mjs +4 -3
- package/dist/{lib → domains}/mirror/domain/constants.domain.mjs +1 -1
- package/dist/{lib → domains}/mirror/domain/errors.domain.mjs +1 -1
- package/dist/{lib/mirror/application/services/generate-mirror-exports.service.mjs → domains/mirror/domain/generate-mirror-exports.domain-service.mjs} +2 -2
- package/dist/{lib → domains}/mirror/domain/package-display-name.policy.mjs +1 -1
- package/dist/{lib → domains}/mirror/domain/path-normalizer.value-object.mjs +1 -1
- package/dist/{lib/mirror/adapters/secondary → domains/mirror/infrastructure/adapters}/file-system-service.adapter.mjs +8 -8
- package/dist/domains/mirror/infrastructure/adapters/mirror-package-path-resolver.adapter.mjs +252 -0
- package/dist/{lib/mirror/adapters/secondary → domains/mirror/infrastructure/adapters}/mirror-sync-reporter.adapter.mjs +94 -15
- package/dist/{lib/mirror/adapters/secondary → domains/mirror/infrastructure/adapters}/package-repository.adapter.mjs +4 -4
- package/dist/{lib/mirror/adapters/secondary → domains/mirror/infrastructure/adapters}/sync-workspace-package.adapter.mjs +23 -46
- package/dist/{lib/mirror/infrastructure → domains/mirror/infrastructure/guards}/dirent-list.guard.mjs +1 -1
- package/dist/{lib → domains}/mirror/infrastructure/package-json-exports.repository.mjs +27 -27
- package/dist/domains/mirror/mirror.module.mjs +26 -0
- package/dist/{lib/mirror/adapters/primary → domains/mirror/presentation}/cli/mirror.command.mjs +83 -27
- package/dist/{lib/mirror/presentation → domains/mirror/presentation/presenters}/mirror-cli.schema.mjs +1 -4
- package/dist/domains/mirror/presentation/presenters/present-mirror-sync-progress.presenter.mjs +265 -0
- package/dist/domains/tag/application/ports/outbound/tag-eligible-workspace-paths.port.mjs +1 -0
- package/dist/domains/tag/application/ports/outbound/tag-since-writer.port.mjs +1 -0
- package/dist/domains/tag/application/ports/outbound/tag-target-path-resolver.port.mjs +1 -0
- package/dist/domains/tag/application/ports/outbound/tag-target-runner.port.mjs +1 -0
- package/dist/domains/tag/application/ports/outbound/tag-version-resolver.port.mjs +1 -0
- package/dist/domains/tag/application/ports/presenting/present-tag-sync-progress.presenter.mjs +1 -0
- package/dist/domains/tag/application/ports/presenting/present-tag-sync-result.presenter.mjs +1 -0
- package/dist/domains/tag/application/requests/tag-sync-execution-input.mjs +1 -0
- package/dist/domains/tag/application/requests/tag-sync.request.mjs +1 -0
- package/dist/{lib → domains}/tag/application/tag-sync-cli-result.mjs +3 -3
- package/dist/{lib → domains}/tag/application/use-cases/prepare-tag-sync.use-case.mjs +20 -24
- package/dist/{lib → domains}/tag/application/use-cases/run-tag-sync.use-case.mjs +123 -129
- package/dist/domains/tag/composition/tokens.mjs +13 -0
- package/dist/domains/tag/contracts/models.mjs +1 -0
- package/dist/domains/tag/domain/types.domain.mjs +1 -0
- package/dist/{lib/tag/adapters/secondary → domains/tag/infrastructure/adapters}/tag-since-writer.adapter.mjs +105 -105
- package/dist/{lib/tag/adapters/secondary/typescript-tree-walk.adapter.mjs → domains/tag/infrastructure/adapters/tag-target-path-resolver.adapter.mjs} +11 -9
- package/dist/domains/tag/infrastructure/adapters/tag-target-resolver.adapter.mjs +302 -0
- package/dist/domains/tag/infrastructure/adapters/tag-target-runner.adapter.mjs +259 -0
- package/dist/{lib/tag/adapters/secondary → domains/tag/infrastructure/adapters}/tag-version-resolver.adapter.mjs +6 -6
- package/dist/{lib/tag/adapters/primary → domains/tag/presentation}/cli/tag.command.mjs +67 -27
- package/dist/{lib/tag/presentation/tag-sync-progress-listener.presenter.mjs → domains/tag/presentation/presenters/present-tag-sync-progress.presenter.mjs} +14 -9
- package/dist/domains/tag/presentation/presenters/present-tag-sync-result.presenter.mjs +290 -0
- package/dist/{lib/tag/presentation → domains/tag/presentation/presenters}/tag-cli.schema.mjs +1 -1
- package/dist/domains/tag/tag.module.mjs +28 -0
- package/dist/program.mjs +3 -2
- package/dist/shell/application/cli-runtime.tokens.mjs +18 -0
- package/dist/shell/application/coordination/cli-executor.coordination.mjs +1 -0
- package/dist/shell/application/coordination/cli-schema-parsing.coordination.mjs +1 -0
- package/dist/shell/application/global-cli-options.model.mjs +5 -0
- package/dist/shell/application/ports/inbound/load-codefast-config.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/cli-fs.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/cli-logger.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/cli-path.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/cli-runtime.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/cli-telemetry.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/cli-verbose-diagnostics.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/format-app-error.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/global-cli-options-parse.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/repo-root-resolver.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/typescript-source-file-walker.port.mjs +1 -0
- package/dist/shell/application/ports/outbound/workspace-package-layout.port.mjs +1 -0
- package/dist/shell/application/ports/primary/command.port.mjs +1 -0
- package/dist/shell/application/services/cli-executor.service.mjs +267 -0
- package/dist/shell/application/services/schema-validator.service.mjs +236 -0
- package/dist/{lib/core/application → shell/application/use-cases}/load-codefast-config.use-case.mjs +11 -13
- package/dist/shell/composition/tokens.mjs +5 -0
- package/dist/shell/contracts/cli-command-slots.mjs +11 -0
- package/dist/{lib/core → shell}/domain/caught-unknown-message.value-object.mjs +1 -1
- package/dist/{lib/core → shell}/domain/cli-exit-codes.domain.mjs +1 -1
- package/dist/shell/domain/cli-positional-arg.value-object.mjs +6 -0
- package/dist/{lib/core → shell}/domain/errors.domain.mjs +1 -1
- package/dist/{lib/core → shell}/domain/result.model.mjs +1 -1
- package/dist/{lib/shared/source-code/domain/text-edit.model.mjs → shell/domain/source-text-edit.support.mjs} +2 -2
- package/dist/shell/infrastructure/adapters/cli-verbose-diagnostics.adapter.mjs +228 -0
- package/dist/{lib/tag/adapters/secondary/tag-target-resolver.adapter.mjs → shell/infrastructure/adapters/format-app-error.adapter.mjs} +16 -13
- package/dist/shell/infrastructure/adapters/global-cli-options-parser.adapter.mjs +233 -0
- package/dist/{lib/mirror/adapters/secondary/workspace-service.adapter.mjs → shell/infrastructure/adapters/repo-root-resolver.adapter.mjs} +20 -13
- package/dist/shell/infrastructure/adapters/typescript-source-file-walker.adapter.mjs +259 -0
- package/dist/shell/infrastructure/commander/commander-cli-host.adapter.mjs +69 -0
- package/dist/{lib/infrastructure/node-io.adapter.mjs → shell/infrastructure/node/node-cli-fs.adapter.mjs} +11 -47
- package/dist/{lib/arrange/adapters/secondary/workspace-resolver.adapter.mjs → shell/infrastructure/node/node-cli-logger.adapter.mjs} +11 -13
- package/dist/{lib/core/infrastructure/path.adapter.mjs → shell/infrastructure/node/node-cli-path.adapter.mjs} +1 -1
- package/dist/{lib/core/infrastructure/repo-root-resolver.adapter.mjs → shell/infrastructure/node/node-cli-runtime.adapter.mjs} +14 -13
- package/dist/shell/infrastructure/telemetry/cli-telemetry.adapter.mjs +280 -0
- package/dist/shell/infrastructure/workspace/node-pnpm-workspace-package-layout.adapter.mjs +385 -0
- package/dist/shell/shell.module.mjs +43 -0
- package/dist/shell/wiring/optional-cli-port-telemetry-activation.mjs +13 -0
- package/package.json +9 -7
- 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/application/services/arrange-target-path-resolver.service.mjs +0 -21
- package/dist/lib/arrange/arrange.module.mjs +0 -31
- package/dist/lib/arrange/contracts/tokens.mjs +0 -15
- package/dist/lib/arrange/infrastructure/typescript-ast-translator.adapter.mjs +0 -355
- package/dist/lib/arrange/presentation/arrange-sync.presenter.mjs +0 -33
- package/dist/lib/bootstrap/composition-root.mjs +0 -33
- package/dist/lib/config/application/services/load-config.service.mjs +0 -17
- package/dist/lib/config/contracts/tokens.mjs +0 -6
- package/dist/lib/core/application/services/global-cli-options-parser.service.mjs +0 -9
- package/dist/lib/core/application/services/schema-validator.service.mjs +0 -17
- package/dist/lib/core/contracts/tokens.mjs +0 -10
- package/dist/lib/core/core.module.mjs +0 -9
- package/dist/lib/core/infrastructure/infrastructure.module.mjs +0 -30
- package/dist/lib/core/infrastructure/port-telemetry.decorator.mjs +0 -62
- 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/workspace/repo-root-resolver.service.mjs +0 -21
- package/dist/lib/kernel/contracts/tokens.mjs +0 -5
- package/dist/lib/mirror/application/mirror-sync-json.format.mjs +0 -12
- package/dist/lib/mirror/application/services/mirror-package-arg-resolver.service.mjs +0 -20
- 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.presentation.module.mjs +0 -13
- 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-json.format.mjs +0 -14
- package/dist/lib/tag/contracts/tokens.mjs +0 -10
- 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/tag-sync.presenter.mjs +0 -61
- package/dist/lib/tag/tag.module.mjs +0 -23
- /package/dist/{lib/arrange/application/ports/domain-source-parser.port.mjs → domains/arrange/application/ports/inbound/analyze-directory.port.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/file-walker.port.mjs → domains/arrange/application/ports/inbound/prepare-arrange-workspace.port.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/group-file-preview.port.mjs → domains/arrange/application/ports/inbound/run-arrange-sync.port.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/workspace-resolver.port.mjs → domains/arrange/application/ports/inbound/suggest-cn-groups.port.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/analyze-directory.request.mjs → domains/arrange/application/ports/outbound/arrange-file-processor.port.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/arrange-sync.request.mjs → domains/arrange/application/ports/outbound/arrange-target-path-resolver.port.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/suggest-groups.request.mjs → domains/arrange/application/ports/outbound/arrange-target-scanner.port.mjs} +0 -0
- /package/dist/{lib/arrange/contracts/analyze-report-presenter.contract.mjs → domains/arrange/application/ports/outbound/domain-source-parser.port.mjs} +0 -0
- /package/dist/{lib/arrange/contracts/models.mjs → domains/arrange/application/ports/outbound/file-walker.port.mjs} +0 -0
- /package/dist/{lib/arrange/contracts/services.contract.mjs → domains/arrange/application/ports/presenting/present-analyze-report.presenter.mjs} +0 -0
- /package/dist/{lib/arrange/domain/types.domain.mjs → domains/arrange/application/ports/presenting/present-arrange-sync-result.presenter.mjs} +0 -0
- /package/dist/{lib/config/application/ports/config-loader.port.mjs → domains/arrange/application/ports/presenting/present-group-file-preview.presenter.mjs} +0 -0
- /package/dist/{lib/config/application/ports/config-warning-reporter.port.mjs → domains/arrange/application/requests/analyze-directory.request.mjs} +0 -0
- /package/dist/{lib/config/domain/schema.domain.mjs → domains/arrange/application/requests/arrange-sync.request.mjs} +0 -0
- /package/dist/{lib/core/application/ports/cli-io.port.mjs → domains/arrange/application/requests/suggest-groups.request.mjs} +0 -0
- /package/dist/{lib/mirror → domains/arrange}/contracts/models.mjs +0 -0
- /package/dist/{lib/mirror → domains/arrange}/domain/types.domain.mjs +0 -0
- /package/dist/{lib/core/application/ports/path.port.mjs → domains/config/application/ports/outbound/codefast-config-schema.port.mjs} +0 -0
- /package/dist/{lib/core/application/ports/repo-root-resolver.port.mjs → domains/config/application/ports/outbound/config-loader.port.mjs} +0 -0
- /package/dist/{lib/core/application/ports/runtime.port.mjs → domains/config/application/ports/outbound/config-warning-reporter.port.mjs} +0 -0
- /package/dist/{lib/kernel/contracts/cli-command.contract.mjs → domains/config/domain/schema.domain.mjs} +0 -0
- /package/dist/{lib/mirror/application/ports/file-system-service.port.mjs → domains/mirror/application/ports/inbound/prepare-mirror-sync.port.mjs} +0 -0
- /package/dist/{lib/mirror/application/ports/mirror-sync-reporter.port.mjs → domains/mirror/application/ports/inbound/run-mirror-sync.port.mjs} +0 -0
- /package/dist/{lib/mirror/application/ports/package-repository.port.mjs → domains/mirror/application/ports/outbound/file-system-service.port.mjs} +0 -0
- /package/dist/{lib/mirror/application/ports/sync-workspace-package.port.mjs → domains/mirror/application/ports/outbound/mirror-package-path.port.mjs} +0 -0
- /package/dist/{lib/mirror/application/ports/workspace-service.port.mjs → domains/mirror/application/ports/outbound/mirror-sync-reporter.port.mjs} +0 -0
- /package/dist/{lib/mirror/application/requests/mirror-sync.request.mjs → domains/mirror/application/ports/outbound/package-repository.port.mjs} +0 -0
- /package/dist/{lib/tag/application/ports/tag-since-writer.port.mjs → domains/mirror/application/ports/outbound/sync-workspace-package.port.mjs} +0 -0
- /package/dist/{lib/tag/application/ports/tag-version-resolver.port.mjs → domains/mirror/application/ports/presenting/present-mirror-sync-progress.presenter.mjs} +0 -0
- /package/dist/{lib/tag/application/ports/target-resolver.port.mjs → domains/mirror/application/requests/mirror-sync-execution-input.mjs} +0 -0
- /package/dist/{lib/tag/application/ports/typescript-tree-walk.port.mjs → domains/mirror/application/requests/mirror-sync.request.mjs} +0 -0
- /package/dist/{lib/tag → domains/mirror}/contracts/models.mjs +0 -0
- /package/dist/{lib/tag → domains/mirror}/domain/types.domain.mjs +0 -0
- /package/dist/{lib/tag/application/requests/tag-sync.request.mjs → domains/tag/application/ports/inbound/prepare-tag-sync.port.mjs} +0 -0
- /package/dist/{lib/tag/contracts/tag-sync-result-presenter.contract.mjs → domains/tag/application/ports/inbound/run-tag-sync.port.mjs} +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { injectable } from "@codefast/di";
|
|
2
|
+
//#region src/shell/infrastructure/adapters/cli-verbose-diagnostics.adapter.ts
|
|
3
|
+
function toPrimitive(input, hint) {
|
|
4
|
+
if (typeof input !== "object" || input === null) return input;
|
|
5
|
+
var prim = input[Symbol.toPrimitive];
|
|
6
|
+
if (prim !== void 0) {
|
|
7
|
+
var res = prim.call(input, hint || "default");
|
|
8
|
+
if (typeof res !== "object") return res;
|
|
9
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
+
}
|
|
11
|
+
return (hint === "string" ? String : Number)(input);
|
|
12
|
+
}
|
|
13
|
+
function toPropertyKey(arg) {
|
|
14
|
+
var key = toPrimitive(arg, "string");
|
|
15
|
+
return typeof key === "symbol" ? key : String(key);
|
|
16
|
+
}
|
|
17
|
+
function checkInRHS(value) {
|
|
18
|
+
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
function setFunctionName(fn, name, prefix) {
|
|
22
|
+
if (typeof name === "symbol") {
|
|
23
|
+
name = name.description;
|
|
24
|
+
name = name ? "[" + name + "]" : "";
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
Object.defineProperty(fn, "name", {
|
|
28
|
+
configurable: true,
|
|
29
|
+
value: prefix ? prefix + " " + name : name
|
|
30
|
+
});
|
|
31
|
+
} catch (_) {}
|
|
32
|
+
return fn;
|
|
33
|
+
}
|
|
34
|
+
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
35
|
+
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
36
|
+
var defineProperty = Object.defineProperty;
|
|
37
|
+
var create = Object.create;
|
|
38
|
+
var metadata;
|
|
39
|
+
var existingNonFields = [create(null), create(null)];
|
|
40
|
+
var hasClassDecs = classDecs.length;
|
|
41
|
+
var _;
|
|
42
|
+
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
43
|
+
return function(thisArg, value) {
|
|
44
|
+
if (useStaticThis) {
|
|
45
|
+
value = thisArg;
|
|
46
|
+
thisArg = targetClass;
|
|
47
|
+
}
|
|
48
|
+
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
49
|
+
return hasValue ? value : thisArg;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
53
|
+
if (typeof fn !== "function") {
|
|
54
|
+
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
55
|
+
}
|
|
56
|
+
return fn;
|
|
57
|
+
}
|
|
58
|
+
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
59
|
+
function assertInstanceIfPrivate(target) {
|
|
60
|
+
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
61
|
+
}
|
|
62
|
+
var decs = [].concat(decInfo[0]);
|
|
63
|
+
var decVal = decInfo[3];
|
|
64
|
+
var isClass = !ret;
|
|
65
|
+
var isAccessor = kind === 1;
|
|
66
|
+
var isGetter = kind === 3;
|
|
67
|
+
var isSetter = kind === 4;
|
|
68
|
+
var isMethod = kind === 2;
|
|
69
|
+
function bindPropCall(name, useStaticThis, before) {
|
|
70
|
+
return function(_this, value) {
|
|
71
|
+
if (useStaticThis) {
|
|
72
|
+
value = _this;
|
|
73
|
+
_this = Class;
|
|
74
|
+
}
|
|
75
|
+
if (before) before(_this);
|
|
76
|
+
return desc[name].call(_this, value);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
var desc1 = {};
|
|
80
|
+
var init = [];
|
|
81
|
+
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
82
|
+
if (!isClass) {
|
|
83
|
+
if (isPrivate) {
|
|
84
|
+
if (isField || isAccessor) desc1 = {
|
|
85
|
+
get: setFunctionName(function() {
|
|
86
|
+
return decVal(this);
|
|
87
|
+
}, name, "get"),
|
|
88
|
+
set: function(value) {
|
|
89
|
+
decInfo[4](this, value);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
else desc1[key] = decVal;
|
|
93
|
+
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
94
|
+
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
95
|
+
if (!isField && !isPrivate) {
|
|
96
|
+
_ = existingNonFields[+isStatic][name];
|
|
97
|
+
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
98
|
+
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var newValue = Class;
|
|
102
|
+
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
103
|
+
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
104
|
+
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
105
|
+
var decoratorFinishedRef = {};
|
|
106
|
+
var ctx = {
|
|
107
|
+
kind: [
|
|
108
|
+
"field",
|
|
109
|
+
"accessor",
|
|
110
|
+
"method",
|
|
111
|
+
"getter",
|
|
112
|
+
"setter",
|
|
113
|
+
"class"
|
|
114
|
+
][kind],
|
|
115
|
+
name,
|
|
116
|
+
metadata,
|
|
117
|
+
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
118
|
+
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
119
|
+
assertCallable(initializer, "An initializer", "be", true);
|
|
120
|
+
initializers.push(initializer);
|
|
121
|
+
}).bind(null, decoratorFinishedRef)
|
|
122
|
+
};
|
|
123
|
+
if (isClass) {
|
|
124
|
+
_ = dec.call(decThis, newValue, ctx);
|
|
125
|
+
decoratorFinishedRef.v = 1;
|
|
126
|
+
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
ctx.static = isStatic;
|
|
130
|
+
ctx.private = isPrivate;
|
|
131
|
+
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
132
|
+
return name in target;
|
|
133
|
+
} };
|
|
134
|
+
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
135
|
+
assertInstanceIfPrivate(_this);
|
|
136
|
+
return desc1.value;
|
|
137
|
+
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
138
|
+
return target[name];
|
|
139
|
+
};
|
|
140
|
+
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
141
|
+
target[name] = value;
|
|
142
|
+
};
|
|
143
|
+
newValue = dec.call(decThis, isAccessor ? {
|
|
144
|
+
get: desc1.get,
|
|
145
|
+
set: desc1.set
|
|
146
|
+
} : desc1[key], ctx);
|
|
147
|
+
decoratorFinishedRef.v = 1;
|
|
148
|
+
if (isAccessor) {
|
|
149
|
+
if (typeof newValue === "object" && newValue) {
|
|
150
|
+
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
151
|
+
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
152
|
+
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
153
|
+
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
154
|
+
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
155
|
+
else desc1[key] = newValue;
|
|
156
|
+
}
|
|
157
|
+
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
158
|
+
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
159
|
+
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
160
|
+
else defineProperty(Class, name, desc1);
|
|
161
|
+
return newValue;
|
|
162
|
+
}
|
|
163
|
+
function applyMemberDecs() {
|
|
164
|
+
var ret = [];
|
|
165
|
+
var protoInitializers;
|
|
166
|
+
var staticInitializers;
|
|
167
|
+
var pushInitializers = function(initializers) {
|
|
168
|
+
if (initializers) ret.push(createRunInitializers(initializers));
|
|
169
|
+
};
|
|
170
|
+
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
171
|
+
for (var i = 0; i < memberDecs.length; i++) {
|
|
172
|
+
var decInfo = memberDecs[i];
|
|
173
|
+
var kind = decInfo[1];
|
|
174
|
+
var kindOnly = kind & 7;
|
|
175
|
+
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
176
|
+
var name = decInfo[2];
|
|
177
|
+
var isPrivate = !!decInfo[3];
|
|
178
|
+
var decoratorsHaveThis = kind & 16;
|
|
179
|
+
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(_) {
|
|
180
|
+
return checkInRHS(_) === targetClass;
|
|
181
|
+
} : instanceBrand);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
applyMemberDecsOfKind(8, 0);
|
|
186
|
+
applyMemberDecsOfKind(0, 0);
|
|
187
|
+
applyMemberDecsOfKind(8, 1);
|
|
188
|
+
applyMemberDecsOfKind(0, 1);
|
|
189
|
+
pushInitializers(protoInitializers);
|
|
190
|
+
pushInitializers(staticInitializers);
|
|
191
|
+
return ret;
|
|
192
|
+
}
|
|
193
|
+
function defineMetadata(Class) {
|
|
194
|
+
return defineProperty(Class, symbolMetadata, {
|
|
195
|
+
configurable: true,
|
|
196
|
+
enumerable: true,
|
|
197
|
+
value: metadata
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
201
|
+
metadata = create(metadata == null ? null : metadata);
|
|
202
|
+
_ = applyMemberDecs();
|
|
203
|
+
if (!hasClassDecs) defineMetadata(targetClass);
|
|
204
|
+
return {
|
|
205
|
+
e: _,
|
|
206
|
+
get c() {
|
|
207
|
+
var initializers = [];
|
|
208
|
+
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
let _dec, _initClass;
|
|
213
|
+
_dec = injectable();
|
|
214
|
+
let _CliVerboseDiagnosticsAdapter;
|
|
215
|
+
(class {
|
|
216
|
+
static {
|
|
217
|
+
({c: [_CliVerboseDiagnosticsAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
218
|
+
}
|
|
219
|
+
isVerboseCliDiagnostics() {
|
|
220
|
+
const raw = process.env.CODEFAST_VERBOSE;
|
|
221
|
+
return raw === "1" || raw === "true";
|
|
222
|
+
}
|
|
223
|
+
static {
|
|
224
|
+
_initClass();
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
//#endregion
|
|
228
|
+
export { _CliVerboseDiagnosticsAdapter as CliVerboseDiagnosticsAdapter };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { inject, injectable } from "@codefast/di";
|
|
4
|
-
//#region src/lib/tag/adapters/secondary/tag-target-resolver.adapter.ts
|
|
1
|
+
import { injectable } from "@codefast/di";
|
|
2
|
+
//#region src/shell/infrastructure/adapters/format-app-error.adapter.ts
|
|
5
3
|
function toPrimitive(input, hint) {
|
|
6
4
|
if (typeof input !== "object" || input === null) return input;
|
|
7
5
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -212,22 +210,27 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
212
210
|
};
|
|
213
211
|
}
|
|
214
212
|
let _dec, _initClass;
|
|
215
|
-
_dec = injectable(
|
|
216
|
-
let
|
|
213
|
+
_dec = injectable();
|
|
214
|
+
let _FormatAppErrorAdapter;
|
|
217
215
|
(class {
|
|
218
|
-
fs;
|
|
219
216
|
static {
|
|
220
|
-
({c: [
|
|
217
|
+
({c: [_FormatAppErrorAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
221
218
|
}
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
assertExhaustiveAppErrorCode(code) {
|
|
220
|
+
return `Unhandled error code: ${String(code)}`;
|
|
224
221
|
}
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
format(error) {
|
|
223
|
+
const { code, message } = error;
|
|
224
|
+
switch (code) {
|
|
225
|
+
case "NOT_FOUND": return `[NOT_FOUND] ${message}`;
|
|
226
|
+
case "VALIDATION_ERROR": return `[VALIDATION_ERROR] ${message}`;
|
|
227
|
+
case "INFRA_FAILURE": return `[INFRA_FAILURE] ${message}`;
|
|
228
|
+
default: return this.assertExhaustiveAppErrorCode(code);
|
|
229
|
+
}
|
|
227
230
|
}
|
|
228
231
|
static {
|
|
229
232
|
_initClass();
|
|
230
233
|
}
|
|
231
234
|
});
|
|
232
235
|
//#endregion
|
|
233
|
-
export {
|
|
236
|
+
export { _FormatAppErrorAdapter as FormatAppErrorAdapter };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { CliSchemaParsingToken } from "../../application/cli-runtime.tokens.mjs";
|
|
2
|
+
import { globalCliCommanderOptionsSchema } from "../../application/global-cli-options.model.mjs";
|
|
3
|
+
import { inject, injectable } from "@codefast/di";
|
|
4
|
+
//#region src/shell/infrastructure/adapters/global-cli-options-parser.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(CliSchemaParsingToken)]);
|
|
216
|
+
let _GlobalCliOptionsParserAdapter;
|
|
217
|
+
(class {
|
|
218
|
+
schemaValidation;
|
|
219
|
+
static {
|
|
220
|
+
({c: [_GlobalCliOptionsParserAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
221
|
+
}
|
|
222
|
+
constructor(schemaValidation) {
|
|
223
|
+
this.schemaValidation = schemaValidation;
|
|
224
|
+
}
|
|
225
|
+
parseGlobalCliOptions(raw) {
|
|
226
|
+
return this.schemaValidation.parseWithSchema(globalCliCommanderOptionsSchema, raw);
|
|
227
|
+
}
|
|
228
|
+
static {
|
|
229
|
+
_initClass();
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
//#endregion
|
|
233
|
+
export { _GlobalCliOptionsParserAdapter as GlobalCliOptionsParserAdapter };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { CliFilesystemPortToken } from "../../application/cli-runtime.tokens.mjs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { inject, injectable } from "@codefast/di";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/shell/infrastructure/adapters/repo-root-resolver.adapter.ts
|
|
6
6
|
function toPrimitive(input, hint) {
|
|
7
7
|
if (typeof input !== "object" || input === null) return input;
|
|
8
8
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -213,25 +213,32 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
let _dec, _initClass;
|
|
216
|
-
_dec = injectable([inject(
|
|
217
|
-
let
|
|
216
|
+
_dec = injectable([inject(CliFilesystemPortToken)]);
|
|
217
|
+
let _RepoRootResolverAdapter;
|
|
218
218
|
(class {
|
|
219
219
|
fs;
|
|
220
220
|
static {
|
|
221
|
-
({c: [
|
|
221
|
+
({c: [_RepoRootResolverAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
222
222
|
}
|
|
223
223
|
constructor(fs) {
|
|
224
224
|
this.fs = fs;
|
|
225
225
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
findRepoRoot(fromDirectory) {
|
|
227
|
+
const candidates = [path.dirname(fileURLToPath(import.meta.url)), fromDirectory];
|
|
228
|
+
for (const start of candidates) {
|
|
229
|
+
let dir = path.resolve(start);
|
|
230
|
+
for (;;) {
|
|
231
|
+
if (this.fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) return dir;
|
|
232
|
+
const parent = path.dirname(dir);
|
|
233
|
+
if (parent === dir) break;
|
|
234
|
+
dir = parent;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
throw new Error(`Could not locate monorepo root (missing pnpm-workspace.yaml). Searched from: ${candidates.join(", ")}`);
|
|
231
238
|
}
|
|
232
239
|
static {
|
|
233
240
|
_initClass();
|
|
234
241
|
}
|
|
235
242
|
});
|
|
236
243
|
//#endregion
|
|
237
|
-
export {
|
|
244
|
+
export { _RepoRootResolverAdapter as RepoRootResolverAdapter };
|