@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,328 +0,0 @@
|
|
|
1
|
-
import { CliFilesystemPortToken, CliPathPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
-
import { messageFromCaughtUnknown } from "../../../../shell/domain/caught-unknown-message.value-object.mjs";
|
|
3
|
-
import { DIST_DIR, PACKAGE_JSON } from "../../domain/constants.domain.mjs";
|
|
4
|
-
import { createPathTransform, generateExports } from "../../domain/generate-mirror-exports.domain-service.mjs";
|
|
5
|
-
import { FileSystemServicePortToken, PackageRepositoryPortToken } from "../../composition/tokens.mjs";
|
|
6
|
-
import { inject, injectable } from "@codefast/di";
|
|
7
|
-
//#region src/domains/mirror/infrastructure/adapters/sync-workspace-package.adapter.ts
|
|
8
|
-
function toPrimitive(input, hint) {
|
|
9
|
-
if (typeof input !== "object" || input === null) return input;
|
|
10
|
-
var prim = input[Symbol.toPrimitive];
|
|
11
|
-
if (prim !== void 0) {
|
|
12
|
-
var res = prim.call(input, hint || "default");
|
|
13
|
-
if (typeof res !== "object") return res;
|
|
14
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
15
|
-
}
|
|
16
|
-
return (hint === "string" ? String : Number)(input);
|
|
17
|
-
}
|
|
18
|
-
function toPropertyKey(arg) {
|
|
19
|
-
var key = toPrimitive(arg, "string");
|
|
20
|
-
return typeof key === "symbol" ? key : String(key);
|
|
21
|
-
}
|
|
22
|
-
function checkInRHS(value) {
|
|
23
|
-
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
function setFunctionName(fn, name, prefix) {
|
|
27
|
-
if (typeof name === "symbol") {
|
|
28
|
-
name = name.description;
|
|
29
|
-
name = name ? "[" + name + "]" : "";
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
Object.defineProperty(fn, "name", {
|
|
33
|
-
configurable: true,
|
|
34
|
-
value: prefix ? prefix + " " + name : name
|
|
35
|
-
});
|
|
36
|
-
} catch (_) {}
|
|
37
|
-
return fn;
|
|
38
|
-
}
|
|
39
|
-
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
40
|
-
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
41
|
-
var defineProperty = Object.defineProperty;
|
|
42
|
-
var create = Object.create;
|
|
43
|
-
var metadata;
|
|
44
|
-
var existingNonFields = [create(null), create(null)];
|
|
45
|
-
var hasClassDecs = classDecs.length;
|
|
46
|
-
var _;
|
|
47
|
-
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
48
|
-
return function(thisArg, value) {
|
|
49
|
-
if (useStaticThis) {
|
|
50
|
-
value = thisArg;
|
|
51
|
-
thisArg = targetClass;
|
|
52
|
-
}
|
|
53
|
-
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
54
|
-
return hasValue ? value : thisArg;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
58
|
-
if (typeof fn !== "function") {
|
|
59
|
-
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
60
|
-
}
|
|
61
|
-
return fn;
|
|
62
|
-
}
|
|
63
|
-
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
64
|
-
function assertInstanceIfPrivate(target) {
|
|
65
|
-
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
66
|
-
}
|
|
67
|
-
var decs = [].concat(decInfo[0]);
|
|
68
|
-
var decVal = decInfo[3];
|
|
69
|
-
var isClass = !ret;
|
|
70
|
-
var isAccessor = kind === 1;
|
|
71
|
-
var isGetter = kind === 3;
|
|
72
|
-
var isSetter = kind === 4;
|
|
73
|
-
var isMethod = kind === 2;
|
|
74
|
-
function bindPropCall(name, useStaticThis, before) {
|
|
75
|
-
return function(_this, value) {
|
|
76
|
-
if (useStaticThis) {
|
|
77
|
-
value = _this;
|
|
78
|
-
_this = Class;
|
|
79
|
-
}
|
|
80
|
-
if (before) before(_this);
|
|
81
|
-
return desc[name].call(_this, value);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
var desc1 = {};
|
|
85
|
-
var init = [];
|
|
86
|
-
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
87
|
-
if (!isClass) {
|
|
88
|
-
if (isPrivate) {
|
|
89
|
-
if (isField || isAccessor) desc1 = {
|
|
90
|
-
get: setFunctionName(function() {
|
|
91
|
-
return decVal(this);
|
|
92
|
-
}, name, "get"),
|
|
93
|
-
set: function(value) {
|
|
94
|
-
decInfo[4](this, value);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
else desc1[key] = decVal;
|
|
98
|
-
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
99
|
-
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
100
|
-
if (!isField && !isPrivate) {
|
|
101
|
-
_ = existingNonFields[+isStatic][name];
|
|
102
|
-
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
103
|
-
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
var newValue = Class;
|
|
107
|
-
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
108
|
-
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
109
|
-
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
110
|
-
var decoratorFinishedRef = {};
|
|
111
|
-
var ctx = {
|
|
112
|
-
kind: [
|
|
113
|
-
"field",
|
|
114
|
-
"accessor",
|
|
115
|
-
"method",
|
|
116
|
-
"getter",
|
|
117
|
-
"setter",
|
|
118
|
-
"class"
|
|
119
|
-
][kind],
|
|
120
|
-
name,
|
|
121
|
-
metadata,
|
|
122
|
-
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
123
|
-
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
124
|
-
assertCallable(initializer, "An initializer", "be", true);
|
|
125
|
-
initializers.push(initializer);
|
|
126
|
-
}).bind(null, decoratorFinishedRef)
|
|
127
|
-
};
|
|
128
|
-
if (isClass) {
|
|
129
|
-
_ = dec.call(decThis, newValue, ctx);
|
|
130
|
-
decoratorFinishedRef.v = 1;
|
|
131
|
-
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
ctx.static = isStatic;
|
|
135
|
-
ctx.private = isPrivate;
|
|
136
|
-
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
137
|
-
return name in target;
|
|
138
|
-
} };
|
|
139
|
-
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
140
|
-
assertInstanceIfPrivate(_this);
|
|
141
|
-
return desc1.value;
|
|
142
|
-
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
143
|
-
return target[name];
|
|
144
|
-
};
|
|
145
|
-
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
146
|
-
target[name] = value;
|
|
147
|
-
};
|
|
148
|
-
newValue = dec.call(decThis, isAccessor ? {
|
|
149
|
-
get: desc1.get,
|
|
150
|
-
set: desc1.set
|
|
151
|
-
} : desc1[key], ctx);
|
|
152
|
-
decoratorFinishedRef.v = 1;
|
|
153
|
-
if (isAccessor) {
|
|
154
|
-
if (typeof newValue === "object" && newValue) {
|
|
155
|
-
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
156
|
-
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
157
|
-
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
158
|
-
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
159
|
-
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
160
|
-
else desc1[key] = newValue;
|
|
161
|
-
}
|
|
162
|
-
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
163
|
-
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
164
|
-
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
165
|
-
else defineProperty(Class, name, desc1);
|
|
166
|
-
return newValue;
|
|
167
|
-
}
|
|
168
|
-
function applyMemberDecs() {
|
|
169
|
-
var ret = [];
|
|
170
|
-
var protoInitializers;
|
|
171
|
-
var staticInitializers;
|
|
172
|
-
var pushInitializers = function(initializers) {
|
|
173
|
-
if (initializers) ret.push(createRunInitializers(initializers));
|
|
174
|
-
};
|
|
175
|
-
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
176
|
-
for (var i = 0; i < memberDecs.length; i++) {
|
|
177
|
-
var decInfo = memberDecs[i];
|
|
178
|
-
var kind = decInfo[1];
|
|
179
|
-
var kindOnly = kind & 7;
|
|
180
|
-
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
181
|
-
var name = decInfo[2];
|
|
182
|
-
var isPrivate = !!decInfo[3];
|
|
183
|
-
var decoratorsHaveThis = kind & 16;
|
|
184
|
-
applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
|
|
185
|
-
return checkInRHS(_) === targetClass;
|
|
186
|
-
} : instanceBrand);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
applyMemberDecsOfKind(8, 0);
|
|
191
|
-
applyMemberDecsOfKind(0, 0);
|
|
192
|
-
applyMemberDecsOfKind(8, 1);
|
|
193
|
-
applyMemberDecsOfKind(0, 1);
|
|
194
|
-
pushInitializers(protoInitializers);
|
|
195
|
-
pushInitializers(staticInitializers);
|
|
196
|
-
return ret;
|
|
197
|
-
}
|
|
198
|
-
function defineMetadata(Class) {
|
|
199
|
-
return defineProperty(Class, symbolMetadata, {
|
|
200
|
-
configurable: true,
|
|
201
|
-
enumerable: true,
|
|
202
|
-
value: metadata
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
206
|
-
metadata = create(metadata == null ? null : metadata);
|
|
207
|
-
_ = applyMemberDecs();
|
|
208
|
-
if (!hasClassDecs) defineMetadata(targetClass);
|
|
209
|
-
return {
|
|
210
|
-
e: _,
|
|
211
|
-
get c() {
|
|
212
|
-
var initializers = [];
|
|
213
|
-
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
let _dec, _initClass;
|
|
218
|
-
_dec = injectable([
|
|
219
|
-
inject(CliFilesystemPortToken),
|
|
220
|
-
inject(CliPathPortToken),
|
|
221
|
-
inject(PackageRepositoryPortToken),
|
|
222
|
-
inject(FileSystemServicePortToken)
|
|
223
|
-
]);
|
|
224
|
-
let _SyncWorkspacePackageAdapter;
|
|
225
|
-
(class {
|
|
226
|
-
fs;
|
|
227
|
-
pathService;
|
|
228
|
-
packageRepository;
|
|
229
|
-
fileSystemService;
|
|
230
|
-
static {
|
|
231
|
-
({c: [_SyncWorkspacePackageAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
232
|
-
}
|
|
233
|
-
constructor(fs, pathService, packageRepository, fileSystemService) {
|
|
234
|
-
this.fs = fs;
|
|
235
|
-
this.pathService = pathService;
|
|
236
|
-
this.packageRepository = packageRepository;
|
|
237
|
-
this.fileSystemService = fileSystemService;
|
|
238
|
-
}
|
|
239
|
-
async syncExportsForWorkspacePackage(rootDir, packagePathStr, config) {
|
|
240
|
-
const packageDir = this.pathService.resolve(rootDir, packagePathStr);
|
|
241
|
-
const distDir = this.pathService.join(packageDir, DIST_DIR);
|
|
242
|
-
const packageJsonPath = this.pathService.join(packageDir, PACKAGE_JSON);
|
|
243
|
-
const folderBasename = this.pathService.basename(packageDir);
|
|
244
|
-
const pkgStats = {
|
|
245
|
-
name: folderBasename,
|
|
246
|
-
path: packageDir,
|
|
247
|
-
jsModules: 0,
|
|
248
|
-
cssExports: 0,
|
|
249
|
-
customExports: 0,
|
|
250
|
-
totalExports: 0,
|
|
251
|
-
hasTransform: false,
|
|
252
|
-
cssConfigStatus: "",
|
|
253
|
-
skipped: false,
|
|
254
|
-
skipReason: "",
|
|
255
|
-
error: null,
|
|
256
|
-
prunedExportKeys: []
|
|
257
|
-
};
|
|
258
|
-
if (!this.fs.existsSync(packageJsonPath)) {
|
|
259
|
-
pkgStats.skipped = true;
|
|
260
|
-
pkgStats.skipReason = "package.json not found";
|
|
261
|
-
return pkgStats;
|
|
262
|
-
}
|
|
263
|
-
let packageJsonParseError;
|
|
264
|
-
try {
|
|
265
|
-
const packageContent = await this.fs.readFile(packageJsonPath, "utf8");
|
|
266
|
-
const rawPackageJson = JSON.parse(packageContent);
|
|
267
|
-
const parsedPackageJson = this.packageRepository.parsePackageJsonShape(rawPackageJson);
|
|
268
|
-
pkgStats.name = this.packageRepository.resolvePackageDisplayName(parsedPackageJson, folderBasename);
|
|
269
|
-
} catch (caughtError) {
|
|
270
|
-
pkgStats.name = folderBasename;
|
|
271
|
-
packageJsonParseError = caughtError;
|
|
272
|
-
}
|
|
273
|
-
const packageMeta = { packageName: pkgStats.name };
|
|
274
|
-
if (this.isPackageSkipped(config.skipPackages, packageMeta)) {
|
|
275
|
-
pkgStats.skipped = true;
|
|
276
|
-
pkgStats.skipReason = "configured to skip";
|
|
277
|
-
return pkgStats;
|
|
278
|
-
}
|
|
279
|
-
if (packageJsonParseError !== void 0) {
|
|
280
|
-
if (!this.fs.existsSync(distDir)) {
|
|
281
|
-
pkgStats.skipped = true;
|
|
282
|
-
pkgStats.skipReason = "dist/ not found";
|
|
283
|
-
return pkgStats;
|
|
284
|
-
}
|
|
285
|
-
pkgStats.error = messageFromCaughtUnknown(packageJsonParseError);
|
|
286
|
-
return pkgStats;
|
|
287
|
-
}
|
|
288
|
-
if (!this.fs.existsSync(distDir)) {
|
|
289
|
-
pkgStats.skipped = true;
|
|
290
|
-
pkgStats.skipReason = "dist/ not found";
|
|
291
|
-
return pkgStats;
|
|
292
|
-
}
|
|
293
|
-
try {
|
|
294
|
-
const pathTransform = createPathTransform(config, packageMeta);
|
|
295
|
-
pkgStats.hasTransform = !!pathTransform;
|
|
296
|
-
const cssConfig = this.resolvePackageScopedConfig(config.cssExports, packageMeta);
|
|
297
|
-
if (cssConfig === false) pkgStats.cssConfigStatus = "disabled";
|
|
298
|
-
else if (cssConfig !== void 0) pkgStats.cssConfigStatus = "configured";
|
|
299
|
-
const customExports = this.resolvePackageScopedConfig(config.customExports, packageMeta) || {};
|
|
300
|
-
const generatedExports = await generateExports(this.pathService, this.fileSystemService, distDir, pathTransform, cssConfig, customExports);
|
|
301
|
-
const { prunedKeys } = await this.packageRepository.writePackageJsonExportsAtomic(packageJsonPath, {
|
|
302
|
-
generatedExports: generatedExports.exports,
|
|
303
|
-
managedExportSpecifiers: Object.keys(generatedExports.exports),
|
|
304
|
-
originalPathBySpecifier: generatedExports.originalPathBySpecifier
|
|
305
|
-
});
|
|
306
|
-
pkgStats.jsModules = generatedExports.jsCount;
|
|
307
|
-
pkgStats.cssExports = generatedExports.cssCount;
|
|
308
|
-
pkgStats.customExports = Object.keys(customExports).length;
|
|
309
|
-
pkgStats.totalExports = Object.keys(generatedExports.exports).length;
|
|
310
|
-
pkgStats.prunedExportKeys = prunedKeys;
|
|
311
|
-
} catch (caughtError) {
|
|
312
|
-
pkgStats.error = messageFromCaughtUnknown(caughtError);
|
|
313
|
-
}
|
|
314
|
-
return pkgStats;
|
|
315
|
-
}
|
|
316
|
-
resolvePackageScopedConfig(configMap, packageMeta) {
|
|
317
|
-
if (!configMap) return;
|
|
318
|
-
return configMap[packageMeta.packageName];
|
|
319
|
-
}
|
|
320
|
-
isPackageSkipped(skipPackagesList, packageMeta) {
|
|
321
|
-
return !!skipPackagesList?.includes(packageMeta.packageName);
|
|
322
|
-
}
|
|
323
|
-
static {
|
|
324
|
-
_initClass();
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
//#endregion
|
|
328
|
-
export { _SyncWorkspacePackageAdapter as SyncWorkspacePackageAdapter };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createOptionalCliPortTelemetryActivation } from "../../shell/wiring/optional-cli-port-telemetry-activation.mjs";
|
|
2
|
-
import { ShellInfrastructureModule } from "../../shell/shell.module.mjs";
|
|
3
|
-
import { FileSystemServiceAdapter as _FileSystemServiceAdapter } from "./infrastructure/adapters/file-system-service.adapter.mjs";
|
|
4
|
-
import { MirrorSyncReporterAdapter as _MirrorSyncReporterAdapter } from "./infrastructure/adapters/mirror-sync-reporter.adapter.mjs";
|
|
5
|
-
import { PackageRepositoryAdapter as _PackageRepositoryAdapter } from "./infrastructure/adapters/package-repository.adapter.mjs";
|
|
6
|
-
import { FileSystemServicePortToken, MirrorPackagePathPortToken, MirrorSyncReporterPortToken, PackageRepositoryPortToken, PrepareMirrorSyncUseCaseToken, PresentMirrorSyncProgressPresenterToken, RunMirrorSyncUseCaseToken, SyncWorkspacePackagePortToken } from "./composition/tokens.mjs";
|
|
7
|
-
import { SyncWorkspacePackageAdapter as _SyncWorkspacePackageAdapter } from "./infrastructure/adapters/sync-workspace-package.adapter.mjs";
|
|
8
|
-
import { MirrorPackagePathResolverAdapter as _MirrorPackagePathResolverAdapter } from "./infrastructure/adapters/mirror-package-path-resolver.adapter.mjs";
|
|
9
|
-
import { PrepareMirrorSyncUseCase as _PrepareMirrorSyncUseCase } from "./application/use-cases/prepare-mirror-sync.use-case.mjs";
|
|
10
|
-
import { RunMirrorSyncUseCase as _RunMirrorSyncUseCase } from "./application/use-cases/run-mirror-sync.use-case.mjs";
|
|
11
|
-
import { PresentMirrorSyncPresenter as _PresentMirrorSyncPresenter } from "./presentation/presenters/present-mirror-sync-progress.presenter.mjs";
|
|
12
|
-
import { Module } from "@codefast/di";
|
|
13
|
-
//#region src/domains/mirror/mirror.module.ts
|
|
14
|
-
const MirrorModule = Module.create("cli-mirror", (moduleBuilder) => {
|
|
15
|
-
moduleBuilder.import(ShellInfrastructureModule);
|
|
16
|
-
moduleBuilder.bind(MirrorPackagePathPortToken).to(_MirrorPackagePathResolverAdapter).singleton().onActivation(createOptionalCliPortTelemetryActivation(MirrorPackagePathPortToken));
|
|
17
|
-
moduleBuilder.bind(PackageRepositoryPortToken).to(_PackageRepositoryAdapter).singleton().onActivation(createOptionalCliPortTelemetryActivation(PackageRepositoryPortToken));
|
|
18
|
-
moduleBuilder.bind(FileSystemServicePortToken).to(_FileSystemServiceAdapter).singleton().onActivation(createOptionalCliPortTelemetryActivation(FileSystemServicePortToken));
|
|
19
|
-
moduleBuilder.bind(MirrorSyncReporterPortToken).to(_MirrorSyncReporterAdapter).singleton().onActivation(createOptionalCliPortTelemetryActivation(MirrorSyncReporterPortToken));
|
|
20
|
-
moduleBuilder.bind(SyncWorkspacePackagePortToken).to(_SyncWorkspacePackageAdapter).singleton();
|
|
21
|
-
moduleBuilder.bind(PresentMirrorSyncProgressPresenterToken).to(_PresentMirrorSyncPresenter).singleton();
|
|
22
|
-
moduleBuilder.bind(PrepareMirrorSyncUseCaseToken).to(_PrepareMirrorSyncUseCase).singleton();
|
|
23
|
-
moduleBuilder.bind(RunMirrorSyncUseCaseToken).to(_RunMirrorSyncUseCase).singleton();
|
|
24
|
-
});
|
|
25
|
-
//#endregion
|
|
26
|
-
export { MirrorModule };
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { CliExecutorToken, CliLoggerPortToken, CliRuntimeToken, CliSchemaParsingToken, GlobalCliOptionsParsePortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
-
import { PrepareMirrorSyncUseCaseToken, PresentMirrorSyncProgressPresenterToken, RunMirrorSyncUseCaseToken } from "../../composition/tokens.mjs";
|
|
3
|
-
import { CLI_COMMAND_SLOT_NAME } from "../../../../shell/contracts/cli-command-slots.mjs";
|
|
4
|
-
import { readOptionalPositionalArg } from "../../../../shell/domain/cli-positional-arg.value-object.mjs";
|
|
5
|
-
import { exitCodeForMirrorSyncResult, formatMirrorSyncJsonOutput } from "../../application/mirror-sync-cli-result.mjs";
|
|
6
|
-
import { mirrorSyncRunRequestSchema } from "../presenters/mirror-cli.schema.mjs";
|
|
7
|
-
import { inject, injectable } from "@codefast/di";
|
|
8
|
-
//#region src/domains/mirror/presentation/cli/mirror.command.ts
|
|
9
|
-
function toPrimitive(input, hint) {
|
|
10
|
-
if (typeof input !== "object" || input === null) return input;
|
|
11
|
-
var prim = input[Symbol.toPrimitive];
|
|
12
|
-
if (prim !== void 0) {
|
|
13
|
-
var res = prim.call(input, hint || "default");
|
|
14
|
-
if (typeof res !== "object") return res;
|
|
15
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
16
|
-
}
|
|
17
|
-
return (hint === "string" ? String : Number)(input);
|
|
18
|
-
}
|
|
19
|
-
function toPropertyKey(arg) {
|
|
20
|
-
var key = toPrimitive(arg, "string");
|
|
21
|
-
return typeof key === "symbol" ? key : String(key);
|
|
22
|
-
}
|
|
23
|
-
function checkInRHS(value) {
|
|
24
|
-
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
function setFunctionName(fn, name, prefix) {
|
|
28
|
-
if (typeof name === "symbol") {
|
|
29
|
-
name = name.description;
|
|
30
|
-
name = name ? "[" + name + "]" : "";
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
Object.defineProperty(fn, "name", {
|
|
34
|
-
configurable: true,
|
|
35
|
-
value: prefix ? prefix + " " + name : name
|
|
36
|
-
});
|
|
37
|
-
} catch (_) {}
|
|
38
|
-
return fn;
|
|
39
|
-
}
|
|
40
|
-
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
41
|
-
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
42
|
-
var defineProperty = Object.defineProperty;
|
|
43
|
-
var create = Object.create;
|
|
44
|
-
var metadata;
|
|
45
|
-
var existingNonFields = [create(null), create(null)];
|
|
46
|
-
var hasClassDecs = classDecs.length;
|
|
47
|
-
var _;
|
|
48
|
-
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
49
|
-
return function(thisArg, value) {
|
|
50
|
-
if (useStaticThis) {
|
|
51
|
-
value = thisArg;
|
|
52
|
-
thisArg = targetClass;
|
|
53
|
-
}
|
|
54
|
-
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
55
|
-
return hasValue ? value : thisArg;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
59
|
-
if (typeof fn !== "function") {
|
|
60
|
-
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
61
|
-
}
|
|
62
|
-
return fn;
|
|
63
|
-
}
|
|
64
|
-
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
65
|
-
function assertInstanceIfPrivate(target) {
|
|
66
|
-
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
67
|
-
}
|
|
68
|
-
var decs = [].concat(decInfo[0]);
|
|
69
|
-
var decVal = decInfo[3];
|
|
70
|
-
var isClass = !ret;
|
|
71
|
-
var isAccessor = kind === 1;
|
|
72
|
-
var isGetter = kind === 3;
|
|
73
|
-
var isSetter = kind === 4;
|
|
74
|
-
var isMethod = kind === 2;
|
|
75
|
-
function bindPropCall(name, useStaticThis, before) {
|
|
76
|
-
return function(_this, value) {
|
|
77
|
-
if (useStaticThis) {
|
|
78
|
-
value = _this;
|
|
79
|
-
_this = Class;
|
|
80
|
-
}
|
|
81
|
-
if (before) before(_this);
|
|
82
|
-
return desc[name].call(_this, value);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
var desc1 = {};
|
|
86
|
-
var init = [];
|
|
87
|
-
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
88
|
-
if (!isClass) {
|
|
89
|
-
if (isPrivate) {
|
|
90
|
-
if (isField || isAccessor) desc1 = {
|
|
91
|
-
get: setFunctionName(function() {
|
|
92
|
-
return decVal(this);
|
|
93
|
-
}, name, "get"),
|
|
94
|
-
set: function(value) {
|
|
95
|
-
decInfo[4](this, value);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
else desc1[key] = decVal;
|
|
99
|
-
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
100
|
-
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
101
|
-
if (!isField && !isPrivate) {
|
|
102
|
-
_ = existingNonFields[+isStatic][name];
|
|
103
|
-
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
104
|
-
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
var newValue = Class;
|
|
108
|
-
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
109
|
-
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
110
|
-
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
111
|
-
var decoratorFinishedRef = {};
|
|
112
|
-
var ctx = {
|
|
113
|
-
kind: [
|
|
114
|
-
"field",
|
|
115
|
-
"accessor",
|
|
116
|
-
"method",
|
|
117
|
-
"getter",
|
|
118
|
-
"setter",
|
|
119
|
-
"class"
|
|
120
|
-
][kind],
|
|
121
|
-
name,
|
|
122
|
-
metadata,
|
|
123
|
-
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
124
|
-
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
125
|
-
assertCallable(initializer, "An initializer", "be", true);
|
|
126
|
-
initializers.push(initializer);
|
|
127
|
-
}).bind(null, decoratorFinishedRef)
|
|
128
|
-
};
|
|
129
|
-
if (isClass) {
|
|
130
|
-
_ = dec.call(decThis, newValue, ctx);
|
|
131
|
-
decoratorFinishedRef.v = 1;
|
|
132
|
-
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
ctx.static = isStatic;
|
|
136
|
-
ctx.private = isPrivate;
|
|
137
|
-
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
138
|
-
return name in target;
|
|
139
|
-
} };
|
|
140
|
-
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
141
|
-
assertInstanceIfPrivate(_this);
|
|
142
|
-
return desc1.value;
|
|
143
|
-
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
144
|
-
return target[name];
|
|
145
|
-
};
|
|
146
|
-
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
147
|
-
target[name] = value;
|
|
148
|
-
};
|
|
149
|
-
newValue = dec.call(decThis, isAccessor ? {
|
|
150
|
-
get: desc1.get,
|
|
151
|
-
set: desc1.set
|
|
152
|
-
} : desc1[key], ctx);
|
|
153
|
-
decoratorFinishedRef.v = 1;
|
|
154
|
-
if (isAccessor) {
|
|
155
|
-
if (typeof newValue === "object" && newValue) {
|
|
156
|
-
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
157
|
-
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
158
|
-
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
159
|
-
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
160
|
-
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
161
|
-
else desc1[key] = newValue;
|
|
162
|
-
}
|
|
163
|
-
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
164
|
-
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
165
|
-
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
166
|
-
else defineProperty(Class, name, desc1);
|
|
167
|
-
return newValue;
|
|
168
|
-
}
|
|
169
|
-
function applyMemberDecs() {
|
|
170
|
-
var ret = [];
|
|
171
|
-
var protoInitializers;
|
|
172
|
-
var staticInitializers;
|
|
173
|
-
var pushInitializers = function(initializers) {
|
|
174
|
-
if (initializers) ret.push(createRunInitializers(initializers));
|
|
175
|
-
};
|
|
176
|
-
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
177
|
-
for (var i = 0; i < memberDecs.length; i++) {
|
|
178
|
-
var decInfo = memberDecs[i];
|
|
179
|
-
var kind = decInfo[1];
|
|
180
|
-
var kindOnly = kind & 7;
|
|
181
|
-
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
182
|
-
var name = decInfo[2];
|
|
183
|
-
var isPrivate = !!decInfo[3];
|
|
184
|
-
var decoratorsHaveThis = kind & 16;
|
|
185
|
-
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(_) {
|
|
186
|
-
return checkInRHS(_) === targetClass;
|
|
187
|
-
} : instanceBrand);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
applyMemberDecsOfKind(8, 0);
|
|
192
|
-
applyMemberDecsOfKind(0, 0);
|
|
193
|
-
applyMemberDecsOfKind(8, 1);
|
|
194
|
-
applyMemberDecsOfKind(0, 1);
|
|
195
|
-
pushInitializers(protoInitializers);
|
|
196
|
-
pushInitializers(staticInitializers);
|
|
197
|
-
return ret;
|
|
198
|
-
}
|
|
199
|
-
function defineMetadata(Class) {
|
|
200
|
-
return defineProperty(Class, symbolMetadata, {
|
|
201
|
-
configurable: true,
|
|
202
|
-
enumerable: true,
|
|
203
|
-
value: metadata
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
207
|
-
metadata = create(metadata == null ? null : metadata);
|
|
208
|
-
_ = applyMemberDecs();
|
|
209
|
-
if (!hasClassDecs) defineMetadata(targetClass);
|
|
210
|
-
return {
|
|
211
|
-
e: _,
|
|
212
|
-
get c() {
|
|
213
|
-
var initializers = [];
|
|
214
|
-
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
let _dec, _initClass;
|
|
219
|
-
_dec = injectable([
|
|
220
|
-
inject(CliLoggerPortToken),
|
|
221
|
-
inject(CliRuntimeToken),
|
|
222
|
-
inject(PrepareMirrorSyncUseCaseToken),
|
|
223
|
-
inject(RunMirrorSyncUseCaseToken),
|
|
224
|
-
inject(GlobalCliOptionsParsePortToken),
|
|
225
|
-
inject(CliSchemaParsingToken),
|
|
226
|
-
inject(CliExecutorToken),
|
|
227
|
-
inject(PresentMirrorSyncProgressPresenterToken)
|
|
228
|
-
]);
|
|
229
|
-
let _MirrorCommand;
|
|
230
|
-
(class {
|
|
231
|
-
logger;
|
|
232
|
-
runtime;
|
|
233
|
-
prepareMirrorSync;
|
|
234
|
-
runMirrorSync;
|
|
235
|
-
globalCliOptions;
|
|
236
|
-
schemaValidation;
|
|
237
|
-
cliExecutor;
|
|
238
|
-
mirrorProgressPresenter;
|
|
239
|
-
static {
|
|
240
|
-
({c: [_MirrorCommand, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
241
|
-
}
|
|
242
|
-
constructor(logger, runtime, prepareMirrorSync, runMirrorSync, globalCliOptions, schemaValidation, cliExecutor, mirrorProgressPresenter) {
|
|
243
|
-
this.logger = logger;
|
|
244
|
-
this.runtime = runtime;
|
|
245
|
-
this.prepareMirrorSync = prepareMirrorSync;
|
|
246
|
-
this.runMirrorSync = runMirrorSync;
|
|
247
|
-
this.globalCliOptions = globalCliOptions;
|
|
248
|
-
this.schemaValidation = schemaValidation;
|
|
249
|
-
this.cliExecutor = cliExecutor;
|
|
250
|
-
this.mirrorProgressPresenter = mirrorProgressPresenter;
|
|
251
|
-
}
|
|
252
|
-
get definition() {
|
|
253
|
-
return {
|
|
254
|
-
name: CLI_COMMAND_SLOT_NAME.mirror,
|
|
255
|
-
description: "Keep package manifests aligned with what you ship",
|
|
256
|
-
children: [{
|
|
257
|
-
name: "sync",
|
|
258
|
-
description: "Write package.json exports from dist/ for workspace packages",
|
|
259
|
-
route: [
|
|
260
|
-
{
|
|
261
|
-
kind: "optionalPositional",
|
|
262
|
-
argumentTemplate: "[package]",
|
|
263
|
-
helpBlurb: "Optional package path relative to repo root (e.g. packages/ui)"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
kind: "booleanFlag",
|
|
267
|
-
flagPhrase: "-v, --verbose",
|
|
268
|
-
helpBlurb: "Print extra diagnostics",
|
|
269
|
-
whenUnsetUses: false
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
kind: "booleanFlag",
|
|
273
|
-
flagPhrase: "--json",
|
|
274
|
-
helpBlurb: "Print one JSON summary on stdout (suppresses human progress)",
|
|
275
|
-
whenUnsetUses: false
|
|
276
|
-
}
|
|
277
|
-
],
|
|
278
|
-
action: async (_positionalPieces, typedLocalOptionsCarrier, globalsBridge) => {
|
|
279
|
-
await this.runSynchronizedMirrorLeaf(readOptionalPositionalArg(_positionalPieces[0]), {
|
|
280
|
-
verbose: typedLocalOptionsCarrier.verbose,
|
|
281
|
-
json: typedLocalOptionsCarrier.json
|
|
282
|
-
}, globalsBridge.readMergedGlobalsOptionRecords());
|
|
283
|
-
}
|
|
284
|
-
}]
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
async runSynchronizedMirrorLeaf(packageRelativePathPiece, branchOptionsCarrier, globalsOptionCarrier) {
|
|
288
|
-
const globalOptionsOutcome = this.globalCliOptions.parseGlobalCliOptions(globalsOptionCarrier);
|
|
289
|
-
if (!this.cliExecutor.consumeCliAppError(globalOptionsOutcome)) return;
|
|
290
|
-
const prelude = await this.prepareMirrorSync.execute({
|
|
291
|
-
currentWorkingDirectory: this.runtime.cwd(),
|
|
292
|
-
packageArg: packageRelativePathPiece,
|
|
293
|
-
globals: globalOptionsOutcome.value
|
|
294
|
-
});
|
|
295
|
-
if (!this.cliExecutor.consumeCliAppError(prelude)) return;
|
|
296
|
-
const { rootDir, config, packageFilter } = prelude.value;
|
|
297
|
-
const parsed = this.schemaValidation.parseWithSchema(mirrorSyncRunRequestSchema, {
|
|
298
|
-
rootDir,
|
|
299
|
-
config: config.mirror ?? {},
|
|
300
|
-
packageFilter
|
|
301
|
-
});
|
|
302
|
-
if (!this.cliExecutor.consumeCliAppError(parsed)) return;
|
|
303
|
-
const json = !!branchOptionsCarrier.json;
|
|
304
|
-
const noColor = globalOptionsOutcome.value.color === false;
|
|
305
|
-
const verbose = !!branchOptionsCarrier.verbose;
|
|
306
|
-
let listener;
|
|
307
|
-
if (!json) {
|
|
308
|
-
this.mirrorProgressPresenter.configure({
|
|
309
|
-
noColor,
|
|
310
|
-
verbose
|
|
311
|
-
});
|
|
312
|
-
listener = this.mirrorProgressPresenter;
|
|
313
|
-
}
|
|
314
|
-
const startTime = performance.now();
|
|
315
|
-
const outcome = await this.runMirrorSync.execute({
|
|
316
|
-
...parsed.value,
|
|
317
|
-
listener
|
|
318
|
-
});
|
|
319
|
-
if (!this.cliExecutor.consumeCliAppError(outcome)) return;
|
|
320
|
-
if (json) this.logger.out(formatMirrorSyncJsonOutput(outcome.value, (performance.now() - startTime) / 1e3));
|
|
321
|
-
this.runtime.setExitCode(exitCodeForMirrorSyncResult(outcome.value));
|
|
322
|
-
}
|
|
323
|
-
static {
|
|
324
|
-
_initClass();
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
//#endregion
|
|
328
|
-
export { _MirrorCommand as MirrorCommand };
|