@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
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import { err, ok } from "
|
|
4
|
-
import { messageFromCaughtUnknown } from "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { WorkspacePackageLayoutPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
+
import { AppError } from "../../../../shell/domain/errors.domain.mjs";
|
|
3
|
+
import { err, ok } from "../../../../shell/domain/result.model.mjs";
|
|
4
|
+
import { messageFromCaughtUnknown } from "../../../../shell/domain/caught-unknown-message.value-object.mjs";
|
|
5
|
+
import { normalizePath } from "../../domain/path-normalizer.value-object.mjs";
|
|
6
|
+
import { MirrorPackagePathPortToken, SyncWorkspacePackagePortToken } from "../../composition/tokens.mjs";
|
|
7
|
+
import path from "node:path";
|
|
7
8
|
import { inject, injectable } from "@codefast/di";
|
|
8
|
-
//#region src/
|
|
9
|
+
//#region src/domains/mirror/application/use-cases/run-mirror-sync.use-case.ts
|
|
9
10
|
function toPrimitive(input, hint) {
|
|
10
11
|
if (typeof input !== "object" || input === null) return input;
|
|
11
12
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -217,41 +218,46 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
217
218
|
}
|
|
218
219
|
let _dec, _initClass;
|
|
219
220
|
_dec = injectable([
|
|
220
|
-
inject(
|
|
221
|
-
inject(
|
|
222
|
-
inject(WorkspaceServicePortToken),
|
|
223
|
-
inject(MirrorSyncReporterPortToken),
|
|
221
|
+
inject(MirrorPackagePathPortToken),
|
|
222
|
+
inject(WorkspacePackageLayoutPortToken),
|
|
224
223
|
inject(SyncWorkspacePackagePortToken)
|
|
225
224
|
]);
|
|
226
|
-
let
|
|
225
|
+
let _RunMirrorSyncUseCase;
|
|
227
226
|
(class {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
workspaceService;
|
|
231
|
-
mirrorReporter;
|
|
227
|
+
mirrorPackagePath;
|
|
228
|
+
workspacePackageLayout;
|
|
232
229
|
syncWorkspacePackage;
|
|
233
230
|
static {
|
|
234
|
-
({c: [
|
|
231
|
+
({c: [_RunMirrorSyncUseCase, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
235
232
|
}
|
|
236
|
-
constructor(
|
|
237
|
-
this.
|
|
238
|
-
this.
|
|
239
|
-
this.workspaceService = workspaceService;
|
|
240
|
-
this.mirrorReporter = mirrorReporter;
|
|
233
|
+
constructor(mirrorPackagePath, workspacePackageLayout, syncWorkspacePackage) {
|
|
234
|
+
this.mirrorPackagePath = mirrorPackagePath;
|
|
235
|
+
this.workspacePackageLayout = workspacePackageLayout;
|
|
241
236
|
this.syncWorkspacePackage = syncWorkspacePackage;
|
|
242
237
|
}
|
|
243
|
-
async execute(
|
|
244
|
-
const config =
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
this.mirrorReporter.configureMirrorColors(!!request.noColor);
|
|
248
|
-
this.mirrorReporter.mirrorBanner(this.logger);
|
|
249
|
-
}
|
|
238
|
+
async execute(input) {
|
|
239
|
+
const config = input.config ?? {};
|
|
240
|
+
const { listener } = input;
|
|
241
|
+
listener?.onBanner();
|
|
250
242
|
const startTime = performance.now();
|
|
251
|
-
const verbose = !!request.verbose;
|
|
252
243
|
try {
|
|
244
|
+
let targetPackages = [];
|
|
245
|
+
if (input.packageFilter) {
|
|
246
|
+
const filterOutcome = this.mirrorPackagePath.resolvePackageFilterUnderRoot(input.rootDir, input.packageFilter);
|
|
247
|
+
if (!filterOutcome.ok) return filterOutcome;
|
|
248
|
+
targetPackages = [filterOutcome.value];
|
|
249
|
+
listener?.onProcessingMode({ kind: "single" });
|
|
250
|
+
} else {
|
|
251
|
+
const layoutOutcome = await this.workspacePackageLayout.listPackageDirectoryPathsAbsolute(input.rootDir, false);
|
|
252
|
+
const { relPaths, multiSource } = this.mirrorTargetsFromWorkspaceLayout(input.rootDir, layoutOutcome);
|
|
253
|
+
targetPackages = relPaths;
|
|
254
|
+
listener?.onProcessingMode({
|
|
255
|
+
kind: "multi",
|
|
256
|
+
source: multiSource
|
|
257
|
+
});
|
|
258
|
+
}
|
|
253
259
|
const stats = {
|
|
254
|
-
packagesFound:
|
|
260
|
+
packagesFound: targetPackages.length,
|
|
255
261
|
packagesProcessed: 0,
|
|
256
262
|
packagesSkipped: 0,
|
|
257
263
|
packagesErrored: 0,
|
|
@@ -260,43 +266,52 @@ let _RunMirrorSyncUseCaseImpl;
|
|
|
260
266
|
totalCssExports: 0,
|
|
261
267
|
packageDetails: []
|
|
262
268
|
};
|
|
263
|
-
let targetPackages = [];
|
|
264
|
-
if (request.packageFilter) {
|
|
265
|
-
targetPackages = [this.workspaceService.resolvePackageFilterUnderRoot(request.rootDir, request.packageFilter)];
|
|
266
|
-
if (!json) this.mirrorReporter.mirrorProcessingMode(this.logger, { kind: "single" });
|
|
267
|
-
} else {
|
|
268
|
-
const { relPaths, multiSource } = await this.workspaceService.findWorkspacePackageRelPaths(request.rootDir, json ? () => {} : (message) => this.mirrorReporter.logWorkspaceGlobWarning(this.logger, message));
|
|
269
|
-
targetPackages = relPaths;
|
|
270
|
-
if (!json) this.mirrorReporter.mirrorProcessingMode(this.logger, {
|
|
271
|
-
kind: "multi",
|
|
272
|
-
source: multiSource
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
stats.packagesFound = targetPackages.length;
|
|
276
269
|
if (targetPackages.length === 0) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (json) this.logger.out(formatMirrorSyncJsonOutput(stats, elapsedEmpty));
|
|
270
|
+
listener?.onNoPackages();
|
|
271
|
+
listener?.onComplete(stats, (performance.now() - startTime) / 1e3);
|
|
280
272
|
return ok(stats);
|
|
281
273
|
}
|
|
282
|
-
let
|
|
274
|
+
let ordinal = 1;
|
|
283
275
|
for (const pkgPath of targetPackages) {
|
|
284
|
-
const pkgStats = await this.syncWorkspacePackage.syncExportsForWorkspacePackage(
|
|
276
|
+
const pkgStats = await this.syncWorkspacePackage.syncExportsForWorkspacePackage(input.rootDir, pkgPath, config);
|
|
285
277
|
stats.packageDetails.push(pkgStats);
|
|
278
|
+
listener?.onPackageComplete(pkgStats, ordinal, targetPackages.length);
|
|
279
|
+
ordinal++;
|
|
280
|
+
this.accumulateStats(stats, pkgStats);
|
|
286
281
|
}
|
|
287
282
|
const elapsed = (performance.now() - startTime) / 1e3;
|
|
288
|
-
|
|
289
|
-
this.mirrorReporter.mirrorSummarySeparator(this.logger);
|
|
290
|
-
this.mirrorReporter.mirrorSummary(this.logger, stats, elapsed);
|
|
291
|
-
} else this.logger.out(formatMirrorSyncJsonOutput(stats, elapsed));
|
|
283
|
+
listener?.onComplete(stats, elapsed);
|
|
292
284
|
return ok(stats);
|
|
293
285
|
} catch (caughtError) {
|
|
294
286
|
return err(new AppError("INFRA_FAILURE", messageFromCaughtUnknown(caughtError), caughtError));
|
|
295
287
|
}
|
|
296
288
|
}
|
|
289
|
+
accumulateStats(stats, pkgStats) {
|
|
290
|
+
if (pkgStats.skipped) stats.packagesSkipped++;
|
|
291
|
+
else if (pkgStats.error !== null) stats.packagesErrored++;
|
|
292
|
+
else {
|
|
293
|
+
stats.packagesProcessed++;
|
|
294
|
+
stats.totalExports += pkgStats.totalExports;
|
|
295
|
+
stats.totalJsModules += pkgStats.jsModules;
|
|
296
|
+
stats.totalCssExports += pkgStats.cssExports;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
mirrorTargetsFromWorkspaceLayout(rootDir, layoutOutcome) {
|
|
300
|
+
if (layoutOutcome.layoutSource === "declared-empty") return {
|
|
301
|
+
relPaths: [],
|
|
302
|
+
multiSource: "declared-empty"
|
|
303
|
+
};
|
|
304
|
+
const multiSource = layoutOutcome.layoutSource;
|
|
305
|
+
const relPaths = layoutOutcome.packageDirectoryPathsAbsolute.map((absolutePath) => normalizePath(path.relative(rootDir, absolutePath))).filter((relativePath) => relativePath.length > 0);
|
|
306
|
+
relPaths.sort((left, right) => left.localeCompare(right));
|
|
307
|
+
return {
|
|
308
|
+
relPaths,
|
|
309
|
+
multiSource
|
|
310
|
+
};
|
|
311
|
+
}
|
|
297
312
|
static {
|
|
298
313
|
_initClass();
|
|
299
314
|
}
|
|
300
315
|
});
|
|
301
316
|
//#endregion
|
|
302
|
-
export {
|
|
317
|
+
export { _RunMirrorSyncUseCase as RunMirrorSyncUseCase };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { token } from "@codefast/di";
|
|
2
|
-
//#region src/
|
|
3
|
-
const WorkspaceServicePortToken = token("WorkspaceServicePort");
|
|
2
|
+
//#region src/domains/mirror/composition/tokens.ts
|
|
4
3
|
const PackageRepositoryPortToken = token("PackageRepositoryPort");
|
|
4
|
+
const MirrorPackagePathPortToken = token("MirrorPackagePathPort");
|
|
5
5
|
const FileSystemServicePortToken = token("FileSystemServicePort");
|
|
6
6
|
const MirrorSyncReporterPortToken = token("MirrorSyncReporterPort");
|
|
7
7
|
const SyncWorkspacePackagePortToken = token("SyncWorkspacePackagePort");
|
|
8
8
|
const RunMirrorSyncUseCaseToken = token("RunMirrorSyncUseCase");
|
|
9
9
|
const PrepareMirrorSyncUseCaseToken = token("PrepareMirrorSyncUseCase");
|
|
10
|
+
const PresentMirrorSyncProgressPresenterToken = token("PresentMirrorSyncProgressPresenter");
|
|
10
11
|
//#endregion
|
|
11
|
-
export { FileSystemServicePortToken, MirrorSyncReporterPortToken, PackageRepositoryPortToken, PrepareMirrorSyncUseCaseToken, RunMirrorSyncUseCaseToken, SyncWorkspacePackagePortToken
|
|
12
|
+
export { FileSystemServicePortToken, MirrorPackagePathPortToken, MirrorSyncReporterPortToken, PackageRepositoryPortToken, PrepareMirrorSyncUseCaseToken, PresentMirrorSyncProgressPresenterToken, RunMirrorSyncUseCaseToken, SyncWorkspacePackagePortToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS } from "
|
|
2
|
-
//#region src/
|
|
1
|
+
import { PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS } from "./constants.domain.mjs";
|
|
2
|
+
//#region src/domains/mirror/domain/generate-mirror-exports.domain-service.ts
|
|
3
3
|
function resolvePackageScopedConfig(configMap, pkgMeta) {
|
|
4
4
|
if (!configMap) return;
|
|
5
5
|
return configMap[pkgMeta.packageName];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/domains/mirror/domain/package-display-name.policy.ts
|
|
2
2
|
/**
|
|
3
3
|
* Domain rule: prefer `package.json#name` when it is present, otherwise use folder basename.
|
|
4
4
|
*/ function resolvePackageDisplayName(packageJson, folderBasename) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/domains/mirror/domain/path-normalizer.value-object.ts
|
|
3
3
|
function normalizePath(pathString) {
|
|
4
4
|
return pathString.split(path.sep).join("/").replace(/\\/g, "/");
|
|
5
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isDirentList } from "
|
|
1
|
+
import { CliFilesystemPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
+
import { isDirentList } from "../guards/dirent-list.guard.mjs";
|
|
3
3
|
import { normalizePath } from "../../domain/path-normalizer.value-object.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { inject, injectable } from "@codefast/di";
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/domains/mirror/infrastructure/adapters/file-system-service.adapter.ts
|
|
7
7
|
function toPrimitive(input, hint) {
|
|
8
8
|
if (typeof input !== "object" || input === null) return input;
|
|
9
9
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -214,10 +214,7 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
let _dec, _initClass;
|
|
217
|
-
|
|
218
|
-
return typeof caughtError === "object" && caughtError !== null && "code" in caughtError && (caughtError.code === "ENOENT" || caughtError.code === "EACCES");
|
|
219
|
-
}
|
|
220
|
-
_dec = injectable([inject(CliFsToken)]);
|
|
217
|
+
_dec = injectable([inject(CliFilesystemPortToken)]);
|
|
221
218
|
let _FileSystemServiceAdapter;
|
|
222
219
|
(class {
|
|
223
220
|
fs;
|
|
@@ -239,7 +236,7 @@ let _FileSystemServiceAdapter;
|
|
|
239
236
|
return normalizePath(path.relative(dirPath, fullPath));
|
|
240
237
|
});
|
|
241
238
|
} catch (caughtError) {
|
|
242
|
-
if (isKnownReadDirError(caughtError)) return [];
|
|
239
|
+
if (this.isKnownReadDirError(caughtError)) return [];
|
|
243
240
|
throw caughtError;
|
|
244
241
|
}
|
|
245
242
|
}
|
|
@@ -253,6 +250,9 @@ let _FileSystemServiceAdapter;
|
|
|
253
250
|
return false;
|
|
254
251
|
}
|
|
255
252
|
}
|
|
253
|
+
isKnownReadDirError(caughtError) {
|
|
254
|
+
return typeof caughtError === "object" && caughtError !== null && "code" in caughtError && (caughtError.code === "ENOENT" || caughtError.code === "EACCES");
|
|
255
|
+
}
|
|
256
256
|
static {
|
|
257
257
|
_initClass();
|
|
258
258
|
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { CliFilesystemPortToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
+
import { AppError } from "../../../../shell/domain/errors.domain.mjs";
|
|
3
|
+
import { err, ok } from "../../../../shell/domain/result.model.mjs";
|
|
4
|
+
import { normalizePath } from "../../domain/path-normalizer.value-object.mjs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { inject, injectable } from "@codefast/di";
|
|
7
|
+
//#region src/domains/mirror/infrastructure/adapters/mirror-package-path-resolver.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([inject(CliFilesystemPortToken)]);
|
|
219
|
+
let _MirrorPackagePathResolverAdapter;
|
|
220
|
+
(class {
|
|
221
|
+
fileSystem;
|
|
222
|
+
static {
|
|
223
|
+
({c: [_MirrorPackagePathResolverAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
224
|
+
}
|
|
225
|
+
constructor(fileSystem) {
|
|
226
|
+
this.fileSystem = fileSystem;
|
|
227
|
+
}
|
|
228
|
+
resolveFromCliArg(args) {
|
|
229
|
+
const { rootDir, packageArg, currentWorkingDirectory } = args;
|
|
230
|
+
if (!packageArg) return ok(void 0);
|
|
231
|
+
const rootReal = this.fileSystem.canonicalPathSync(path.resolve(rootDir));
|
|
232
|
+
const cwdReal = this.fileSystem.canonicalPathSync(currentWorkingDirectory);
|
|
233
|
+
const resolved = path.isAbsolute(packageArg) ? path.resolve(packageArg) : path.resolve(cwdReal, packageArg);
|
|
234
|
+
const targetReal = this.fileSystem.canonicalPathSync(resolved);
|
|
235
|
+
const normalized = normalizePath(path.relative(rootReal, targetReal));
|
|
236
|
+
if (normalized.startsWith("..") || path.isAbsolute(normalized) || normalized === "" || normalized === ".") return err(new AppError("VALIDATION_ERROR", `Package path must be a subdirectory under monorepo root: ${rootDir}`));
|
|
237
|
+
return ok(normalized);
|
|
238
|
+
}
|
|
239
|
+
resolvePackageFilterUnderRoot(rootDir, packageFilter) {
|
|
240
|
+
const rootResolved = path.resolve(rootDir);
|
|
241
|
+
const rootReal = this.fileSystem.canonicalPathSync(rootResolved);
|
|
242
|
+
const resolved = path.isAbsolute(packageFilter) ? this.fileSystem.canonicalPathSync(path.resolve(packageFilter)) : this.fileSystem.canonicalPathSync(path.join(rootReal, packageFilter));
|
|
243
|
+
const normalized = normalizePath(path.relative(rootReal, resolved));
|
|
244
|
+
if (normalized.startsWith("..") || path.isAbsolute(normalized) || normalized === "" || normalized === ".") return err(new AppError("VALIDATION_ERROR", `Package path must be a subdirectory under monorepo root: ${rootDir}`));
|
|
245
|
+
return ok(normalized);
|
|
246
|
+
}
|
|
247
|
+
static {
|
|
248
|
+
_initClass();
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
//#endregion
|
|
252
|
+
export { _MirrorPackagePathResolverAdapter as MirrorPackagePathResolverAdapter };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CliRuntimeToken } from "
|
|
2
|
-
import {
|
|
1
|
+
import { CliRuntimeToken } from "../../../../shell/application/cli-runtime.tokens.mjs";
|
|
2
|
+
import { messageFromCaughtUnknown } from "../../../../shell/domain/caught-unknown-message.value-object.mjs";
|
|
3
3
|
import { inject, injectable } from "@codefast/di";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/domains/mirror/infrastructure/adapters/mirror-sync-reporter.adapter.ts
|
|
5
5
|
function toPrimitive(input, hint) {
|
|
6
6
|
if (typeof input !== "object" || input === null) return input;
|
|
7
7
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -212,6 +212,18 @@ function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis,
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
let _dec, _initClass;
|
|
215
|
+
const ANSI = {
|
|
216
|
+
reset: "\x1B[0m",
|
|
217
|
+
bold: "\x1B[1m",
|
|
218
|
+
dim: "\x1B[2m",
|
|
219
|
+
green: "\x1B[32m",
|
|
220
|
+
yellow: "\x1B[33m",
|
|
221
|
+
cyan: "\x1B[36m",
|
|
222
|
+
gray: "\x1B[90m",
|
|
223
|
+
magenta: "\x1B[35m",
|
|
224
|
+
brightGreen: "\x1B[92m",
|
|
225
|
+
brightCyan: "\x1B[96m"
|
|
226
|
+
};
|
|
215
227
|
_dec = injectable([inject(CliRuntimeToken)]);
|
|
216
228
|
let _MirrorSyncReporterAdapter;
|
|
217
229
|
(class {
|
|
@@ -222,19 +234,86 @@ let _MirrorSyncReporterAdapter;
|
|
|
222
234
|
constructor(runtime) {
|
|
223
235
|
this.runtime = runtime;
|
|
224
236
|
}
|
|
237
|
+
colorsAreEnabled = true;
|
|
225
238
|
configureMirrorColors(noColor) {
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
mirrorBanner
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
this.colorsAreEnabled = this.runtime.isStdoutTty() && !noColor;
|
|
240
|
+
}
|
|
241
|
+
mirrorBanner(logger) {
|
|
242
|
+
logger.out(`\n${this.paint("📦 Mirror — package exports", ANSI.bold + ANSI.cyan)}`);
|
|
243
|
+
logger.out(`${this.paint("═".repeat(60), ANSI.dim)}\n`);
|
|
244
|
+
}
|
|
245
|
+
mirrorProcessingMode(logger, mode) {
|
|
246
|
+
if (mode.kind === "single") {
|
|
247
|
+
logger.out(`${this.paint("Processing single package...", ANSI.dim)}\n`);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (mode.source === "default-patterns") {
|
|
251
|
+
logger.out(`${this.paint("Discovering workspace packages using default patterns (packages/*)…", ANSI.dim)}\n`);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (mode.source === "pnpm-workspace-yaml") {
|
|
255
|
+
logger.out(`${this.paint("Discovering workspace packages from pnpm-workspace.yaml…", ANSI.dim)}\n`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
logger.out(`${this.paint("pnpm-workspace.yaml declares an empty workspace package list.", ANSI.dim)}\n`);
|
|
259
|
+
}
|
|
260
|
+
mirrorNoPackages(logger) {
|
|
261
|
+
logger.out(this.paint("⚠ No packages found", ANSI.yellow));
|
|
262
|
+
}
|
|
263
|
+
logSkippedWorkspacePackage(logger, index, total, displayName, reason) {
|
|
264
|
+
const progress = this.paint(`[${index}/${total}]`, ANSI.dim);
|
|
265
|
+
logger.out(`${progress} ${this.paint("○", ANSI.gray)} ${this.paint(displayName, ANSI.dim)}`);
|
|
266
|
+
logger.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Skipped: ${reason}`, ANSI.gray)}`);
|
|
267
|
+
logger.out("");
|
|
268
|
+
}
|
|
269
|
+
logPackageSuccess(logger, index, total, pkgStats, generatedDistAssetCounts, verbose) {
|
|
270
|
+
const progress = this.paint(`[${index}/${total}]`, ANSI.dim);
|
|
271
|
+
logger.out(`${progress} ${this.paint("✓", ANSI.brightGreen)} ${this.paint(pkgStats.name, ANSI.bold)}`);
|
|
272
|
+
if (verbose) {
|
|
273
|
+
logger.out(` ${this.paint("├─", ANSI.dim)} Path: ${pkgStats.path}`);
|
|
274
|
+
if (pkgStats.hasTransform) logger.out(` ${this.paint("├─", ANSI.dim)} ${this.paint("Custom path transformation", ANSI.cyan)}`);
|
|
275
|
+
if (pkgStats.cssConfigStatus) {
|
|
276
|
+
const status = pkgStats.cssConfigStatus === "disabled" ? "CSS disabled" : "CSS configured";
|
|
277
|
+
logger.out(` ${this.paint("├─", ANSI.dim)} ${this.paint(status, ANSI.cyan)}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const breakdown = [];
|
|
281
|
+
if (generatedDistAssetCounts.jsCount > 0) breakdown.push(this.paint(`${generatedDistAssetCounts.jsCount} modules`, ANSI.green));
|
|
282
|
+
if (generatedDistAssetCounts.cssCount > 0) breakdown.push(this.paint(`${generatedDistAssetCounts.cssCount} CSS`, ANSI.magenta));
|
|
283
|
+
if (pkgStats.customExports > 0) breakdown.push(this.paint(`${pkgStats.customExports} custom`, ANSI.yellow));
|
|
284
|
+
const totalExportsText = this.paint(`${pkgStats.totalExports} exports`, ANSI.brightCyan);
|
|
285
|
+
if (breakdown.length === 0) logger.out(` ${this.paint("└─", ANSI.dim)} ${totalExportsText}`);
|
|
286
|
+
else logger.out(` ${this.paint("└─", ANSI.dim)} ${breakdown.join(" + ")} = ${totalExportsText}`);
|
|
287
|
+
logger.out("");
|
|
288
|
+
}
|
|
289
|
+
logPrunedStaleExport(logger, exportSpecifier) {
|
|
290
|
+
logger.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Pruned stale export: ${exportSpecifier}`, ANSI.gray)}`);
|
|
291
|
+
}
|
|
292
|
+
logPackageError(logger, index, total, displayName, errorValue, verbose) {
|
|
293
|
+
logger.out(`${this.paint(`[${index}/${total}]`, ANSI.dim)} ${this.paint("✗", ANSI.yellow)} ${this.paint(displayName, ANSI.bold)}`);
|
|
294
|
+
logger.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Error: ${messageFromCaughtUnknown(errorValue)}`, ANSI.yellow)}\n`);
|
|
295
|
+
if (verbose) logger.err(errorValue instanceof Error && errorValue.stack ? errorValue.stack : messageFromCaughtUnknown(errorValue));
|
|
296
|
+
}
|
|
297
|
+
mirrorSummarySeparator(logger) {
|
|
298
|
+
logger.out(this.paint("═".repeat(60), ANSI.dim));
|
|
299
|
+
}
|
|
300
|
+
mirrorSummary(logger, stats, elapsedSeconds) {
|
|
301
|
+
logger.out(`${this.paint("📊 Summary", ANSI.bold)} ${this.paint(`(completed in ${elapsedSeconds.toFixed(2)}s)`, ANSI.dim)}\n`);
|
|
302
|
+
logger.out(` ${this.paint("Packages:", ANSI.bold)}`);
|
|
303
|
+
logger.out(` ${this.paint("├─", ANSI.dim)} Processed: ${this.paint(String(stats.packagesProcessed), ANSI.green)}`);
|
|
304
|
+
if (stats.packagesSkipped > 0) logger.out(` ${this.paint("├─", ANSI.dim)} Skipped: ${this.paint(String(stats.packagesSkipped), ANSI.gray)}`);
|
|
305
|
+
if (stats.packagesErrored > 0) logger.out(` ${this.paint("├─", ANSI.dim)} Errors: ${this.paint(String(stats.packagesErrored), ANSI.yellow)}`);
|
|
306
|
+
logger.out(` ${this.paint("└─", ANSI.dim)} Total found: ${stats.packagesFound}\n`);
|
|
307
|
+
logger.out(` ${this.paint("Exports:", ANSI.bold)}`);
|
|
308
|
+
logger.out(` ${this.paint("├─", ANSI.dim)} JS Modules: ${this.paint(String(stats.totalJsModules), ANSI.cyan)}`);
|
|
309
|
+
logger.out(` ${this.paint("├─", ANSI.dim)} CSS Files: ${this.paint(String(stats.totalCssExports), ANSI.magenta)}`);
|
|
310
|
+
logger.out(` ${this.paint("└─", ANSI.dim)} Total: ${this.paint(String(stats.totalExports), ANSI.brightCyan)}\n`);
|
|
311
|
+
logger.out(`${this.paint("═".repeat(60), ANSI.dim)}\n`);
|
|
312
|
+
}
|
|
313
|
+
paint(text, openSequence) {
|
|
314
|
+
if (!this.colorsAreEnabled) return text;
|
|
315
|
+
return `${openSequence}${text}${ANSI.reset}`;
|
|
316
|
+
}
|
|
238
317
|
static {
|
|
239
318
|
_initClass();
|
|
240
319
|
}
|