@codefast/cli 0.3.13-canary.3 → 0.3.13-canary.4
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 +29 -3
- package/dist/{bin.js → bin.mjs} +4 -1
- package/dist/commands/arrange.mjs +325 -0
- package/dist/commands/mirror.mjs +267 -0
- package/dist/commands/tag.mjs +283 -0
- package/dist/lib/arrange/application/arrange-analyze-json.format.mjs +10 -0
- package/dist/lib/arrange/application/arrange-group-json.format.mjs +11 -0
- package/dist/lib/arrange/application/arrange-sync-cli-result.mjs +7 -0
- package/dist/lib/arrange/application/arrange-sync-json.format.mjs +12 -0
- package/dist/lib/arrange/application/services/arrange-file-processor.service.mjs +242 -0
- package/dist/lib/arrange/application/services/arrange-target-scanner.service.mjs +237 -0
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.mjs +258 -0
- package/dist/lib/arrange/application/use-cases/group-file.use-case.mjs +35 -0
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.mjs +283 -0
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +233 -0
- package/dist/lib/arrange/arrange.feature.module.mjs +19 -0
- package/dist/lib/arrange/arrange.module.mjs +27 -0
- package/dist/lib/arrange/arrange.presentation.module.mjs +13 -0
- package/dist/lib/arrange/contracts/tokens.mjs +14 -0
- package/dist/lib/arrange/domain/arrange-analyze.service.mjs +95 -0
- package/dist/lib/arrange/domain/arrange-grouping.service.mjs +100 -0
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.mjs +89 -0
- package/dist/lib/arrange/domain/ast/ast-node.model.mjs +181 -0
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.mjs +52 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.mjs +20 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.mjs +174 -0
- package/dist/lib/arrange/domain/ast/targets.model.mjs +110 -0
- package/dist/lib/arrange/domain/constants.domain.mjs +154 -0
- package/dist/lib/arrange/domain/errors.domain.mjs +18 -0
- package/dist/lib/arrange/domain/grouping.domain.mjs +306 -0
- package/dist/lib/arrange/domain/imports.domain.mjs +55 -0
- package/dist/lib/arrange/domain/source-text-formatters.formatter.mjs +54 -0
- package/dist/lib/arrange/domain/tokenizer.util.mjs +209 -0
- package/dist/lib/arrange/infra/domain-source-parser.adapter.mjs +240 -0
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.mjs +8 -0
- package/dist/lib/arrange/infra/file-walker.adapter.mjs +239 -0
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.mjs +18 -0
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.mjs +355 -0
- package/dist/lib/arrange/presentation/arrange-cli-schema.presenter.mjs +29 -0
- package/dist/lib/arrange/presentation/arrange-sync.presenter.mjs +12 -0
- package/dist/lib/arrange/presentation/formatters.presenter.mjs +2 -0
- package/dist/lib/arrange/presentation/group-file-preview.presenter.mjs +275 -0
- package/dist/lib/arrange/presentation/prepare-arrange.orchestrator.mjs +258 -0
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.mjs +7 -0
- package/dist/lib/arrange/presentation/present-analyze-report.presenter.mjs +233 -0
- package/dist/lib/arrange/presentation/report.presenter.mjs +24 -0
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.mjs +21 -0
- package/dist/lib/config/application/use-cases/load-config.use-case.mjs +17 -0
- package/dist/lib/config/contracts/tokens.mjs +5 -0
- package/dist/lib/config/infra/config-schema.adapter.mjs +25 -0
- package/dist/lib/config/infra/loader.adapter.mjs +84 -0
- package/dist/lib/core/application/architecture-boundaries.policy.mjs +311 -0
- package/dist/lib/core/application/ports/path.port.mjs +1 -0
- package/dist/lib/core/application/schema-parse.util.mjs +17 -0
- package/dist/lib/core/application/utils/caught-unknown-message.util.mjs +19 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.util.mjs +9 -0
- package/dist/lib/core/contracts/presentation.contract.mjs +1 -0
- package/dist/lib/core/contracts/tokens.mjs +5 -0
- package/dist/lib/core/core.module.mjs +9 -0
- package/dist/lib/core/domain/cli-exit-codes.domain.mjs +11 -0
- package/dist/lib/core/domain/errors.domain.mjs +16 -0
- package/dist/lib/core/domain/result.model.mjs +23 -0
- package/dist/lib/core/infra/composition-root.mjs +21 -0
- package/dist/lib/core/infra/infra.module.mjs +23 -0
- package/dist/lib/core/infra/logging-decorator.adapter.mjs +62 -0
- package/dist/lib/core/infra/path.adapter.mjs +13 -0
- package/dist/lib/core/operational/contracts/tokens.mjs +7 -0
- package/dist/lib/core/presentation/cli-executor.presenter.mjs +57 -0
- package/dist/lib/core/presentation/command.interface.mjs +1 -0
- package/dist/lib/core/presentation/format-app-error.presenter.mjs +17 -0
- package/dist/lib/core/presentation/global-cli-options.presenter.mjs +9 -0
- package/dist/lib/core/presentation/load-codefast-config.presenter.mjs +18 -0
- package/dist/lib/core/presentation/parse-cli-schema.presenter.mjs +7 -0
- package/dist/lib/core/presentation/presentation.module.mjs +11 -0
- package/dist/lib/core/presentation/try-load-codefast-config.presenter.mjs +245 -0
- package/dist/lib/infra/config-reporter.adapter.mjs +9 -0
- package/dist/lib/infra/fs-contract.port.mjs +1 -0
- package/dist/lib/infra/node-io.adapter.mjs +266 -0
- package/dist/lib/infra/workspace/repo-root.adapter.mjs +21 -0
- package/dist/lib/kernel/di/command.token.mjs +5 -0
- package/dist/lib/mirror/application/mirror-sync-json.format.mjs +12 -0
- package/dist/lib/mirror/application/ports/file-system-service.port.mjs +1 -0
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.mjs +1 -0
- package/dist/lib/mirror/application/ports/package-repository.port.mjs +1 -0
- package/dist/lib/mirror/application/ports/sync-workspace-package.port.mjs +1 -0
- package/dist/lib/mirror/application/ports/workspace-service.port.mjs +1 -0
- package/dist/lib/mirror/application/requests/mirror-sync.request.mjs +1 -0
- package/dist/lib/mirror/application/services/sync-workspace-package.service.mjs +351 -0
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.mjs +219 -0
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.mjs +302 -0
- package/dist/lib/mirror/contracts/models.mjs +1 -0
- package/dist/lib/mirror/contracts/presentation.contract.mjs +1 -0
- package/dist/lib/mirror/contracts/tokens.mjs +11 -0
- package/dist/lib/mirror/contracts/use-cases.contract.mjs +1 -0
- package/dist/lib/mirror/domain/constants.domain.mjs +16 -0
- package/dist/lib/mirror/domain/errors.domain.mjs +15 -0
- package/dist/lib/mirror/domain/types.domain.mjs +1 -0
- package/dist/lib/mirror/infra/dirent-list.adapter.mjs +13 -0
- package/dist/lib/mirror/infra/file-system-service.adapter.mjs +256 -0
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.mjs +1 -0
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.mjs +236 -0
- package/dist/lib/mirror/infra/package-filter.adapter.mjs +25 -0
- package/dist/lib/mirror/infra/package-repository.adapter.mjs +235 -0
- package/dist/lib/mirror/infra/path-normalizer.adapter.mjs +7 -0
- package/dist/lib/mirror/infra/update-pkg.adapter.mjs +102 -0
- package/dist/lib/mirror/infra/workspace-packages.adapter.mjs +154 -0
- package/dist/lib/mirror/infra/workspace-service.adapter.mjs +232 -0
- package/dist/lib/mirror/mirror.feature.module.mjs +19 -0
- package/dist/lib/mirror/mirror.module.mjs +23 -0
- package/dist/lib/mirror/mirror.presentation.module.mjs +11 -0
- package/dist/lib/mirror/presentation/mirror-cli-schema.presenter.mjs +12 -0
- package/dist/lib/mirror/presentation/prepare-mirror.orchestrator.mjs +263 -0
- package/dist/lib/mirror/presentation/reporter.presenter.mjs +111 -0
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.mjs +20 -0
- package/dist/lib/shared/source-code/domain/text-edit.model.mjs +28 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.mjs +33 -0
- package/dist/lib/tag/application/ports/tag-since-writer.port.mjs +1 -0
- package/dist/lib/tag/application/ports/tag-version-resolver.port.mjs +1 -0
- package/dist/lib/tag/application/ports/target-resolver.port.mjs +1 -0
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.mjs +1 -0
- package/dist/lib/tag/application/requests/tag-sync.request.mjs +1 -0
- package/dist/lib/tag/application/tag-sync-cli-result.mjs +11 -0
- package/dist/lib/tag/application/tag-sync-json.format.mjs +14 -0
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.mjs +398 -0
- package/dist/lib/tag/contracts/models.mjs +1 -0
- package/dist/lib/tag/contracts/presentation.contract.mjs +1 -0
- package/dist/lib/tag/contracts/tokens.mjs +12 -0
- package/dist/lib/tag/contracts/use-cases.contract.mjs +1 -0
- package/dist/lib/tag/domain/types.domain.mjs +1 -0
- package/dist/lib/tag/infra/tag-since-writer.adapter.mjs +343 -0
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.mjs +1 -0
- package/dist/lib/tag/infra/tag-target-candidates.adapter.mjs +170 -0
- package/dist/lib/tag/infra/tag-target-resolver.adapter.mjs +226 -0
- package/dist/lib/tag/infra/tag-version-resolver.adapter.mjs +247 -0
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.mjs +226 -0
- package/dist/lib/tag/presentation/colors.presenter.mjs +12 -0
- package/dist/lib/tag/presentation/create-tag-progress-listener.presenter.mjs +228 -0
- package/dist/lib/tag/presentation/prepare-tag.orchestrator.mjs +264 -0
- package/dist/lib/tag/presentation/present-tag-sync-result.presenter.mjs +233 -0
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.mjs +9 -0
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.mjs +12 -0
- package/dist/lib/tag/presentation/tag-cli-schema.presenter.mjs +12 -0
- package/dist/lib/tag/presentation/tag-sync.presenter.mjs +78 -0
- package/dist/lib/tag/tag.feature.module.mjs +19 -0
- package/dist/lib/tag/tag.module.mjs +21 -0
- package/dist/lib/tag/tag.presentation.module.mjs +15 -0
- package/dist/program.mjs +39 -0
- package/package.json +16 -19
- package/dist/bin.d.ts +0 -3
- package/dist/bin.d.ts.map +0 -1
- package/dist/commands/arrange.d.ts +0 -3
- package/dist/commands/arrange.d.ts.map +0 -1
- package/dist/commands/arrange.js +0 -108
- package/dist/commands/mirror.d.ts +0 -3
- package/dist/commands/mirror.d.ts.map +0 -1
- package/dist/commands/mirror.js +0 -36
- package/dist/commands/tag.d.ts +0 -3
- package/dist/commands/tag.d.ts.map +0 -1
- package/dist/commands/tag.js +0 -44
- package/dist/lib/arrange/application/ports/domain-source-parser.port.d.ts +0 -5
- package/dist/lib/arrange/application/ports/domain-source-parser.port.d.ts.map +0 -1
- package/dist/lib/arrange/application/ports/file-walker.port.d.ts +0 -5
- package/dist/lib/arrange/application/ports/file-walker.port.d.ts.map +0 -1
- package/dist/lib/arrange/application/requests/analyze-directory.request.d.ts +0 -6
- package/dist/lib/arrange/application/requests/analyze-directory.request.d.ts.map +0 -1
- package/dist/lib/arrange/application/requests/analyze-directory.request.js +0 -4
- package/dist/lib/arrange/application/requests/arrange-sync.request.d.ts +0 -18
- package/dist/lib/arrange/application/requests/arrange-sync.request.d.ts.map +0 -1
- package/dist/lib/arrange/application/requests/arrange-sync.request.js +0 -15
- package/dist/lib/arrange/application/requests/suggest-groups.request.d.ts +0 -8
- package/dist/lib/arrange/application/requests/suggest-groups.request.d.ts.map +0 -1
- package/dist/lib/arrange/application/requests/suggest-groups.request.js +0 -8
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.d.ts +0 -17
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.d.ts.map +0 -1
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.js +0 -24
- package/dist/lib/arrange/application/use-cases/group-file-preview.use-case.d.ts +0 -17
- package/dist/lib/arrange/application/use-cases/group-file-preview.use-case.d.ts.map +0 -1
- package/dist/lib/arrange/application/use-cases/group-file-preview.use-case.js +0 -46
- package/dist/lib/arrange/application/use-cases/group-file.use-case.d.ts +0 -5
- package/dist/lib/arrange/application/use-cases/group-file.use-case.d.ts.map +0 -1
- package/dist/lib/arrange/application/use-cases/group-file.use-case.js +0 -40
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.d.ts +0 -19
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.d.ts.map +0 -1
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.js +0 -85
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.d.ts +0 -7
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.d.ts.map +0 -1
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.js +0 -10
- package/dist/lib/arrange/domain/arrange-analyze.service.d.ts +0 -12
- package/dist/lib/arrange/domain/arrange-analyze.service.d.ts.map +0 -1
- package/dist/lib/arrange/domain/arrange-analyze.service.js +0 -116
- package/dist/lib/arrange/domain/arrange-grouping.service.d.ts +0 -53
- package/dist/lib/arrange/domain/arrange-grouping.service.d.ts.map +0 -1
- package/dist/lib/arrange/domain/arrange-grouping.service.js +0 -106
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.d.ts +0 -28
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.d.ts.map +0 -1
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.js +0 -130
- package/dist/lib/arrange/domain/ast/ast-node.model.d.ts +0 -179
- package/dist/lib/arrange/domain/ast/ast-node.model.d.ts.map +0 -1
- package/dist/lib/arrange/domain/ast/ast-node.model.js +0 -210
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.d.ts +0 -7
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.d.ts.map +0 -1
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.js +0 -70
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.d.ts +0 -4
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.d.ts.map +0 -1
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.js +0 -21
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.d.ts +0 -13
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.d.ts.map +0 -1
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.js +0 -302
- package/dist/lib/arrange/domain/ast/targets.model.d.ts +0 -8
- package/dist/lib/arrange/domain/ast/targets.model.d.ts.map +0 -1
- package/dist/lib/arrange/domain/ast/targets.model.js +0 -147
- package/dist/lib/arrange/domain/constants.domain.d.ts +0 -70
- package/dist/lib/arrange/domain/constants.domain.d.ts.map +0 -1
- package/dist/lib/arrange/domain/constants.domain.js +0 -182
- package/dist/lib/arrange/domain/errors.domain.d.ts +0 -14
- package/dist/lib/arrange/domain/errors.domain.d.ts.map +0 -1
- package/dist/lib/arrange/domain/errors.domain.js +0 -16
- package/dist/lib/arrange/domain/grouping.domain.d.ts +0 -41
- package/dist/lib/arrange/domain/grouping.domain.d.ts.map +0 -1
- package/dist/lib/arrange/domain/grouping.domain.js +0 -371
- package/dist/lib/arrange/domain/imports.domain.d.ts +0 -7
- package/dist/lib/arrange/domain/imports.domain.d.ts.map +0 -1
- package/dist/lib/arrange/domain/imports.domain.js +0 -80
- package/dist/lib/arrange/domain/source-text-formatters.formatter.d.ts +0 -16
- package/dist/lib/arrange/domain/source-text-formatters.formatter.d.ts.map +0 -1
- package/dist/lib/arrange/domain/source-text-formatters.formatter.js +0 -55
- package/dist/lib/arrange/domain/tokenizer.util.d.ts +0 -45
- package/dist/lib/arrange/domain/tokenizer.util.d.ts.map +0 -1
- package/dist/lib/arrange/domain/tokenizer.util.js +0 -469
- package/dist/lib/arrange/domain/types.domain.d.ts +0 -115
- package/dist/lib/arrange/domain/types.domain.d.ts.map +0 -1
- package/dist/lib/arrange/domain/types.domain.js +0 -10
- package/dist/lib/arrange/index.d.ts +0 -45
- package/dist/lib/arrange/index.d.ts.map +0 -1
- package/dist/lib/arrange/index.js +0 -41
- package/dist/lib/arrange/infra/arrange-sync-cli-options.adapter.d.ts +0 -14
- package/dist/lib/arrange/infra/arrange-sync-cli-options.adapter.d.ts.map +0 -1
- package/dist/lib/arrange/infra/domain-source-parser.adapter.d.ts +0 -11
- package/dist/lib/arrange/infra/domain-source-parser.adapter.d.ts.map +0 -1
- package/dist/lib/arrange/infra/domain-source-parser.adapter.js +0 -19
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.d.ts +0 -3
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.d.ts.map +0 -1
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.js +0 -6
- package/dist/lib/arrange/infra/file-walker.adapter.d.ts +0 -8
- package/dist/lib/arrange/infra/file-walker.adapter.d.ts.map +0 -1
- package/dist/lib/arrange/infra/file-walker.adapter.js +0 -17
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.d.ts +0 -8
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.d.ts.map +0 -1
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.js +0 -25
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.d.ts +0 -10
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.d.ts.map +0 -1
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.js +0 -363
- package/dist/lib/arrange/presentation/arrange-prelude.presenter.d.ts +0 -14
- package/dist/lib/arrange/presentation/arrange-prelude.presenter.d.ts.map +0 -1
- package/dist/lib/arrange/presentation/arrange-prelude.presenter.js +0 -24
- package/dist/lib/arrange/presentation/formatters.presenter.d.ts +0 -3
- package/dist/lib/arrange/presentation/formatters.presenter.d.ts.map +0 -1
- package/dist/lib/arrange/presentation/formatters.presenter.js +0 -2
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.d.ts +0 -4
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.d.ts.map +0 -1
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.js +0 -4
- package/dist/lib/arrange/presentation/report.presenter.d.ts +0 -4
- package/dist/lib/arrange/presentation/report.presenter.d.ts.map +0 -1
- package/dist/lib/arrange/presentation/report.presenter.js +0 -37
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.d.ts +0 -2
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.d.ts.map +0 -1
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.js +0 -7
- package/dist/lib/config/domain/schema.domain.d.ts +0 -50
- package/dist/lib/config/domain/schema.domain.d.ts.map +0 -1
- package/dist/lib/config/domain/schema.domain.js +0 -43
- package/dist/lib/config/index.d.ts +0 -4
- package/dist/lib/config/index.d.ts.map +0 -1
- package/dist/lib/config/index.js +0 -2
- package/dist/lib/config/infra/loader.adapter.d.ts +0 -11
- package/dist/lib/config/infra/loader.adapter.d.ts.map +0 -1
- package/dist/lib/config/infra/loader.adapter.js +0 -90
- package/dist/lib/core/application/architecture-boundaries.policy.d.ts +0 -19
- package/dist/lib/core/application/architecture-boundaries.policy.d.ts.map +0 -1
- package/dist/lib/core/application/architecture-boundaries.policy.js +0 -370
- package/dist/lib/core/application/ports/cli-io.port.d.ts +0 -31
- package/dist/lib/core/application/ports/cli-io.port.d.ts.map +0 -1
- package/dist/lib/core/application/schema-parse.util.d.ts +0 -8
- package/dist/lib/core/application/schema-parse.util.d.ts.map +0 -1
- package/dist/lib/core/application/schema-parse.util.js +0 -20
- package/dist/lib/core/application/utils/caught-unknown-message.util.d.ts +0 -6
- package/dist/lib/core/application/utils/caught-unknown-message.util.d.ts.map +0 -1
- package/dist/lib/core/application/utils/caught-unknown-message.util.js +0 -34
- package/dist/lib/core/application/utils/verbose-diagnostics.util.d.ts +0 -5
- package/dist/lib/core/application/utils/verbose-diagnostics.util.d.ts.map +0 -1
- package/dist/lib/core/application/utils/verbose-diagnostics.util.js +0 -7
- package/dist/lib/core/domain/errors.domain.d.ts +0 -11
- package/dist/lib/core/domain/errors.domain.d.ts.map +0 -1
- package/dist/lib/core/domain/errors.domain.js +0 -9
- package/dist/lib/core/domain/result.model.d.ts +0 -17
- package/dist/lib/core/domain/result.model.d.ts.map +0 -1
- package/dist/lib/core/domain/result.model.js +0 -15
- package/dist/lib/core/infra/container.adapter.d.ts +0 -58
- package/dist/lib/core/infra/container.adapter.d.ts.map +0 -1
- package/dist/lib/core/infra/container.adapter.js +0 -80
- package/dist/lib/core/infra/logging-decorator.adapter.d.ts +0 -12
- package/dist/lib/core/infra/logging-decorator.adapter.d.ts.map +0 -1
- package/dist/lib/core/infra/logging-decorator.adapter.js +0 -75
- package/dist/lib/core/presentation/cli-executor.presenter.d.ts +0 -33
- package/dist/lib/core/presentation/cli-executor.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/cli-executor.presenter.js +0 -73
- package/dist/lib/core/presentation/format-app-error.presenter.d.ts +0 -6
- package/dist/lib/core/presentation/format-app-error.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/format-app-error.presenter.js +0 -19
- package/dist/lib/core/presentation/global-cli-options.presenter.d.ts +0 -9
- package/dist/lib/core/presentation/global-cli-options.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/global-cli-options.presenter.js +0 -8
- package/dist/lib/core/presentation/load-codefast-config.presenter.d.ts +0 -8
- package/dist/lib/core/presentation/load-codefast-config.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/load-codefast-config.presenter.js +0 -15
- package/dist/lib/core/presentation/parse-cli-schema.presenter.d.ts +0 -5
- package/dist/lib/core/presentation/parse-cli-schema.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/parse-cli-schema.presenter.js +0 -4
- package/dist/lib/core/presentation/run-cli-use-case-after-parse.presenter.d.ts +0 -6
- package/dist/lib/core/presentation/run-cli-use-case-after-parse.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/run-cli-use-case-after-parse.presenter.js +0 -17
- package/dist/lib/core/presentation/workspace-root-strict.presenter.d.ts +0 -5
- package/dist/lib/core/presentation/workspace-root-strict.presenter.d.ts.map +0 -1
- package/dist/lib/core/presentation/workspace-root-strict.presenter.js +0 -12
- package/dist/lib/infra/config-reporter.adapter.d.ts +0 -4
- package/dist/lib/infra/config-reporter.adapter.d.ts.map +0 -1
- package/dist/lib/infra/config-reporter.adapter.js +0 -9
- package/dist/lib/infra/fs-contract.port.d.ts +0 -2
- package/dist/lib/infra/fs-contract.port.d.ts.map +0 -1
- package/dist/lib/infra/node-io.adapter.d.ts +0 -4
- package/dist/lib/infra/node-io.adapter.d.ts.map +0 -1
- package/dist/lib/infra/node-io.adapter.js +0 -37
- package/dist/lib/infra/workspace/repo-root.adapter.d.ts +0 -7
- package/dist/lib/infra/workspace/repo-root.adapter.d.ts.map +0 -1
- package/dist/lib/infra/workspace/repo-root.adapter.js +0 -23
- package/dist/lib/mirror/application/ports/file-system-service.port.d.ts +0 -6
- package/dist/lib/mirror/application/ports/file-system-service.port.d.ts.map +0 -1
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.d.ts +0 -27
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.d.ts.map +0 -1
- package/dist/lib/mirror/application/ports/package-repository.port.d.ts +0 -16
- package/dist/lib/mirror/application/ports/package-repository.port.d.ts.map +0 -1
- package/dist/lib/mirror/application/ports/workspace-service.port.d.ts +0 -7
- package/dist/lib/mirror/application/ports/workspace-service.port.d.ts.map +0 -1
- package/dist/lib/mirror/application/requests/mirror-sync.request.d.ts +0 -10
- package/dist/lib/mirror/application/requests/mirror-sync.request.d.ts.map +0 -1
- package/dist/lib/mirror/application/requests/mirror-sync.request.js +0 -8
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.d.ts +0 -10
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.d.ts.map +0 -1
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.js +0 -271
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.d.ts +0 -19
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.d.ts.map +0 -1
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.js +0 -168
- package/dist/lib/mirror/domain/constants.domain.d.ts +0 -6
- package/dist/lib/mirror/domain/constants.domain.d.ts.map +0 -1
- package/dist/lib/mirror/domain/constants.domain.js +0 -5
- package/dist/lib/mirror/domain/errors.domain.d.ts +0 -10
- package/dist/lib/mirror/domain/errors.domain.d.ts.map +0 -1
- package/dist/lib/mirror/domain/errors.domain.js +0 -12
- package/dist/lib/mirror/domain/types.domain.d.ts +0 -65
- package/dist/lib/mirror/domain/types.domain.d.ts.map +0 -1
- package/dist/lib/mirror/index.d.ts +0 -6
- package/dist/lib/mirror/index.d.ts.map +0 -1
- package/dist/lib/mirror/index.js +0 -1
- package/dist/lib/mirror/infra/dirent-list.adapter.d.ts +0 -9
- package/dist/lib/mirror/infra/dirent-list.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/dirent-list.adapter.js +0 -13
- package/dist/lib/mirror/infra/file-system-service.adapter.d.ts +0 -7
- package/dist/lib/mirror/infra/file-system-service.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/file-system-service.adapter.js +0 -47
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.d.ts +0 -14
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.d.ts +0 -3
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.js +0 -13
- package/dist/lib/mirror/infra/package-filter.adapter.d.ts +0 -8
- package/dist/lib/mirror/infra/package-filter.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/package-filter.adapter.js +0 -33
- package/dist/lib/mirror/infra/package-repository.adapter.d.ts +0 -17
- package/dist/lib/mirror/infra/package-repository.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/package-repository.adapter.js +0 -17
- package/dist/lib/mirror/infra/path-normalizer.adapter.d.ts +0 -2
- package/dist/lib/mirror/infra/path-normalizer.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/path-normalizer.adapter.js +0 -4
- package/dist/lib/mirror/infra/update-pkg.adapter.d.ts +0 -19
- package/dist/lib/mirror/infra/update-pkg.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/update-pkg.adapter.js +0 -156
- package/dist/lib/mirror/infra/workspace-packages.adapter.d.ts +0 -26
- package/dist/lib/mirror/infra/workspace-packages.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/workspace-packages.adapter.js +0 -170
- package/dist/lib/mirror/infra/workspace-service.adapter.d.ts +0 -8
- package/dist/lib/mirror/infra/workspace-service.adapter.d.ts.map +0 -1
- package/dist/lib/mirror/infra/workspace-service.adapter.js +0 -10
- package/dist/lib/mirror/presentation/mirror-prelude.presenter.d.ts +0 -17
- package/dist/lib/mirror/presentation/mirror-prelude.presenter.d.ts.map +0 -1
- package/dist/lib/mirror/presentation/mirror-prelude.presenter.js +0 -35
- package/dist/lib/mirror/presentation/reporter.presenter.d.ts +0 -25
- package/dist/lib/mirror/presentation/reporter.presenter.d.ts.map +0 -1
- package/dist/lib/mirror/presentation/reporter.presenter.js +0 -140
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.d.ts +0 -11
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.d.ts.map +0 -1
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.js +0 -27
- package/dist/lib/shared/source-code/domain/text-edit.model.d.ts +0 -14
- package/dist/lib/shared/source-code/domain/text-edit.model.d.ts.map +0 -1
- package/dist/lib/shared/source-code/domain/text-edit.model.js +0 -30
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.d.ts +0 -4
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.d.ts.map +0 -1
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.js +0 -37
- package/dist/lib/tag/application/ports/target-resolver.port.d.ts +0 -6
- package/dist/lib/tag/application/ports/target-resolver.port.d.ts.map +0 -1
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.d.ts +0 -6
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.d.ts.map +0 -1
- package/dist/lib/tag/application/requests/tag-sync.request.d.ts +0 -10
- package/dist/lib/tag/application/requests/tag-sync.request.d.ts.map +0 -1
- package/dist/lib/tag/application/requests/tag-sync.request.js +0 -8
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.d.ts +0 -23
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.d.ts.map +0 -1
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.js +0 -357
- package/dist/lib/tag/domain/types.domain.d.ts +0 -56
- package/dist/lib/tag/domain/types.domain.d.ts.map +0 -1
- package/dist/lib/tag/index.d.ts +0 -14
- package/dist/lib/tag/index.d.ts.map +0 -1
- package/dist/lib/tag/index.js +0 -10
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.d.ts +0 -14
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.d.ts.map +0 -1
- package/dist/lib/tag/infra/tag-target-candidates.adapter.d.ts +0 -4
- package/dist/lib/tag/infra/tag-target-candidates.adapter.d.ts.map +0 -1
- package/dist/lib/tag/infra/tag-target-candidates.adapter.js +0 -200
- package/dist/lib/tag/infra/tag-target-resolver.adapter.d.ts +0 -3
- package/dist/lib/tag/infra/tag-target-resolver.adapter.d.ts.map +0 -1
- package/dist/lib/tag/infra/tag-target-resolver.adapter.js +0 -4
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.d.ts +0 -3
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.d.ts.map +0 -1
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.js +0 -4
- package/dist/lib/tag/presentation/colors.presenter.d.ts +0 -8
- package/dist/lib/tag/presentation/colors.presenter.d.ts.map +0 -1
- package/dist/lib/tag/presentation/colors.presenter.js +0 -9
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.d.ts +0 -8
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.d.ts.map +0 -1
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.js +0 -10
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.d.ts +0 -8
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.d.ts.map +0 -1
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.js +0 -10
- package/dist/lib/tag/presentation/tag-prelude.presenter.d.ts +0 -15
- package/dist/lib/tag/presentation/tag-prelude.presenter.d.ts.map +0 -1
- package/dist/lib/tag/presentation/tag-prelude.presenter.js +0 -31
- package/dist/lib/tag/presentation/tag-sync.presenter.d.ts +0 -20
- package/dist/lib/tag/presentation/tag-sync.presenter.d.ts.map +0 -1
- package/dist/lib/tag/presentation/tag-sync.presenter.js +0 -92
- package/dist/program.d.ts +0 -4
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js +0 -40
- /package/dist/lib/arrange/application/ports/{domain-source-parser.port.js → domain-source-parser.port.mjs} +0 -0
- /package/dist/lib/arrange/application/ports/{file-walker.port.js → file-walker.port.mjs} +0 -0
- /package/dist/lib/arrange/{infra/arrange-sync-cli-options.adapter.js → application/ports/group-file-preview.port.mjs} +0 -0
- /package/dist/lib/{core/application/ports/cli-io.port.js → arrange/application/requests/analyze-directory.request.mjs} +0 -0
- /package/dist/lib/{infra/fs-contract.port.js → arrange/application/requests/arrange-sync.request.mjs} +0 -0
- /package/dist/lib/{mirror/application/ports/file-system-service.port.js → arrange/application/requests/suggest-groups.request.mjs} +0 -0
- /package/dist/lib/{mirror/application/ports/mirror-sync-reporter.port.js → arrange/contracts/models.mjs} +0 -0
- /package/dist/lib/{mirror/application/ports/package-repository.port.js → arrange/contracts/presentation.contract.mjs} +0 -0
- /package/dist/lib/{mirror/application/ports/workspace-service.port.js → arrange/contracts/services.contract.mjs} +0 -0
- /package/dist/lib/{mirror/domain/types.domain.js → arrange/contracts/use-cases.contract.mjs} +0 -0
- /package/dist/lib/{mirror/infra/mirror-sync-cli-options.adapter.js → arrange/domain/types.domain.mjs} +0 -0
- /package/dist/lib/{tag/application/ports/target-resolver.port.js → arrange/infra/arrange-sync-cli-options.adapter.mjs} +0 -0
- /package/dist/lib/{tag/application/ports/typescript-tree-walk.port.js → config/application/ports/config-loader.port.mjs} +0 -0
- /package/dist/lib/{tag/domain/types.domain.js → config/domain/schema.domain.mjs} +0 -0
- /package/dist/lib/{tag/infra/tag-sync-cli-options.adapter.js → core/application/ports/cli-io.port.mjs} +0 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { configureMirrorColors, logPackageError, logPackageSuccess, logPrunedStaleExport, logSkippedWorkspacePackage, mirrorBanner, mirrorGlobWarning, mirrorNoPackages, mirrorProcessingMode, mirrorSummary, mirrorSummarySeparator } from "../presentation/reporter.presenter.mjs";
|
|
2
|
+
import { injectable } from "@codefast/di";
|
|
3
|
+
//#region src/lib/mirror/infra/mirror-sync-reporter.adapter.ts
|
|
4
|
+
function toPrimitive(input, hint) {
|
|
5
|
+
if (typeof input !== "object" || input === null) return input;
|
|
6
|
+
var prim = input[Symbol.toPrimitive];
|
|
7
|
+
if (prim !== void 0) {
|
|
8
|
+
var res = prim.call(input, hint || "default");
|
|
9
|
+
if (typeof res !== "object") return res;
|
|
10
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
+
}
|
|
12
|
+
return (hint === "string" ? String : Number)(input);
|
|
13
|
+
}
|
|
14
|
+
function toPropertyKey(arg) {
|
|
15
|
+
var key = toPrimitive(arg, "string");
|
|
16
|
+
return typeof key === "symbol" ? key : String(key);
|
|
17
|
+
}
|
|
18
|
+
function checkInRHS(value) {
|
|
19
|
+
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function setFunctionName(fn, name, prefix) {
|
|
23
|
+
if (typeof name === "symbol") {
|
|
24
|
+
name = name.description;
|
|
25
|
+
name = name ? "[" + name + "]" : "";
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
Object.defineProperty(fn, "name", {
|
|
29
|
+
configurable: true,
|
|
30
|
+
value: prefix ? prefix + " " + name : name
|
|
31
|
+
});
|
|
32
|
+
} catch (_) {}
|
|
33
|
+
return fn;
|
|
34
|
+
}
|
|
35
|
+
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
36
|
+
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
37
|
+
var defineProperty = Object.defineProperty;
|
|
38
|
+
var create = Object.create;
|
|
39
|
+
var metadata;
|
|
40
|
+
var existingNonFields = [create(null), create(null)];
|
|
41
|
+
var hasClassDecs = classDecs.length;
|
|
42
|
+
var _;
|
|
43
|
+
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
44
|
+
return function(thisArg, value) {
|
|
45
|
+
if (useStaticThis) {
|
|
46
|
+
value = thisArg;
|
|
47
|
+
thisArg = targetClass;
|
|
48
|
+
}
|
|
49
|
+
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
50
|
+
return hasValue ? value : thisArg;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
54
|
+
if (typeof fn !== "function") {
|
|
55
|
+
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
56
|
+
}
|
|
57
|
+
return fn;
|
|
58
|
+
}
|
|
59
|
+
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
60
|
+
function assertInstanceIfPrivate(target) {
|
|
61
|
+
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
62
|
+
}
|
|
63
|
+
var decs = [].concat(decInfo[0]);
|
|
64
|
+
var decVal = decInfo[3];
|
|
65
|
+
var isClass = !ret;
|
|
66
|
+
var isAccessor = kind === 1;
|
|
67
|
+
var isGetter = kind === 3;
|
|
68
|
+
var isSetter = kind === 4;
|
|
69
|
+
var isMethod = kind === 2;
|
|
70
|
+
function bindPropCall(name, useStaticThis, before) {
|
|
71
|
+
return function(_this, value) {
|
|
72
|
+
if (useStaticThis) {
|
|
73
|
+
value = _this;
|
|
74
|
+
_this = Class;
|
|
75
|
+
}
|
|
76
|
+
if (before) before(_this);
|
|
77
|
+
return desc[name].call(_this, value);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var desc1 = {};
|
|
81
|
+
var init = [];
|
|
82
|
+
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
83
|
+
if (!isClass) {
|
|
84
|
+
if (isPrivate) {
|
|
85
|
+
if (isField || isAccessor) desc1 = {
|
|
86
|
+
get: setFunctionName(function() {
|
|
87
|
+
return decVal(this);
|
|
88
|
+
}, name, "get"),
|
|
89
|
+
set: function(value) {
|
|
90
|
+
decInfo[4](this, value);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
else desc1[key] = decVal;
|
|
94
|
+
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
95
|
+
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
96
|
+
if (!isField && !isPrivate) {
|
|
97
|
+
_ = existingNonFields[+isStatic][name];
|
|
98
|
+
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
99
|
+
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var newValue = Class;
|
|
103
|
+
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
104
|
+
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
105
|
+
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
106
|
+
var decoratorFinishedRef = {};
|
|
107
|
+
var ctx = {
|
|
108
|
+
kind: [
|
|
109
|
+
"field",
|
|
110
|
+
"accessor",
|
|
111
|
+
"method",
|
|
112
|
+
"getter",
|
|
113
|
+
"setter",
|
|
114
|
+
"class"
|
|
115
|
+
][kind],
|
|
116
|
+
name,
|
|
117
|
+
metadata,
|
|
118
|
+
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
119
|
+
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
120
|
+
assertCallable(initializer, "An initializer", "be", true);
|
|
121
|
+
initializers.push(initializer);
|
|
122
|
+
}).bind(null, decoratorFinishedRef)
|
|
123
|
+
};
|
|
124
|
+
if (isClass) {
|
|
125
|
+
_ = dec.call(decThis, newValue, ctx);
|
|
126
|
+
decoratorFinishedRef.v = 1;
|
|
127
|
+
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
ctx.static = isStatic;
|
|
131
|
+
ctx.private = isPrivate;
|
|
132
|
+
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
133
|
+
return name in target;
|
|
134
|
+
} };
|
|
135
|
+
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
136
|
+
assertInstanceIfPrivate(_this);
|
|
137
|
+
return desc1.value;
|
|
138
|
+
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
139
|
+
return target[name];
|
|
140
|
+
};
|
|
141
|
+
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
142
|
+
target[name] = value;
|
|
143
|
+
};
|
|
144
|
+
newValue = dec.call(decThis, isAccessor ? {
|
|
145
|
+
get: desc1.get,
|
|
146
|
+
set: desc1.set
|
|
147
|
+
} : desc1[key], ctx);
|
|
148
|
+
decoratorFinishedRef.v = 1;
|
|
149
|
+
if (isAccessor) {
|
|
150
|
+
if (typeof newValue === "object" && newValue) {
|
|
151
|
+
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
152
|
+
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
153
|
+
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
154
|
+
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
155
|
+
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
156
|
+
else desc1[key] = newValue;
|
|
157
|
+
}
|
|
158
|
+
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
159
|
+
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
160
|
+
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
161
|
+
else defineProperty(Class, name, desc1);
|
|
162
|
+
return newValue;
|
|
163
|
+
}
|
|
164
|
+
function applyMemberDecs() {
|
|
165
|
+
var ret = [];
|
|
166
|
+
var protoInitializers;
|
|
167
|
+
var staticInitializers;
|
|
168
|
+
var pushInitializers = function(initializers) {
|
|
169
|
+
if (initializers) ret.push(createRunInitializers(initializers));
|
|
170
|
+
};
|
|
171
|
+
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
172
|
+
for (var i = 0; i < memberDecs.length; i++) {
|
|
173
|
+
var decInfo = memberDecs[i];
|
|
174
|
+
var kind = decInfo[1];
|
|
175
|
+
var kindOnly = kind & 7;
|
|
176
|
+
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
177
|
+
var name = decInfo[2];
|
|
178
|
+
var isPrivate = !!decInfo[3];
|
|
179
|
+
var decoratorsHaveThis = kind & 16;
|
|
180
|
+
applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
|
|
181
|
+
return checkInRHS(_) === targetClass;
|
|
182
|
+
} : instanceBrand);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
applyMemberDecsOfKind(8, 0);
|
|
187
|
+
applyMemberDecsOfKind(0, 0);
|
|
188
|
+
applyMemberDecsOfKind(8, 1);
|
|
189
|
+
applyMemberDecsOfKind(0, 1);
|
|
190
|
+
pushInitializers(protoInitializers);
|
|
191
|
+
pushInitializers(staticInitializers);
|
|
192
|
+
return ret;
|
|
193
|
+
}
|
|
194
|
+
function defineMetadata(Class) {
|
|
195
|
+
return defineProperty(Class, symbolMetadata, {
|
|
196
|
+
configurable: true,
|
|
197
|
+
enumerable: true,
|
|
198
|
+
value: metadata
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
202
|
+
metadata = create(metadata == null ? null : metadata);
|
|
203
|
+
_ = applyMemberDecs();
|
|
204
|
+
if (!hasClassDecs) defineMetadata(targetClass);
|
|
205
|
+
return {
|
|
206
|
+
e: _,
|
|
207
|
+
get c() {
|
|
208
|
+
var initializers = [];
|
|
209
|
+
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
let _dec, _initClass;
|
|
214
|
+
_dec = injectable([]);
|
|
215
|
+
let _MirrorSyncReporterAdapter;
|
|
216
|
+
(class {
|
|
217
|
+
static {
|
|
218
|
+
({c: [_MirrorSyncReporterAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
219
|
+
}
|
|
220
|
+
configureMirrorColors = configureMirrorColors;
|
|
221
|
+
mirrorBanner = mirrorBanner;
|
|
222
|
+
mirrorProcessingMode = mirrorProcessingMode;
|
|
223
|
+
mirrorNoPackages = mirrorNoPackages;
|
|
224
|
+
logWorkspaceGlobWarning = mirrorGlobWarning;
|
|
225
|
+
logSkippedWorkspacePackage = logSkippedWorkspacePackage;
|
|
226
|
+
logPackageSuccess = logPackageSuccess;
|
|
227
|
+
logPrunedStaleExport = logPrunedStaleExport;
|
|
228
|
+
logPackageError = logPackageError;
|
|
229
|
+
mirrorSummarySeparator = mirrorSummarySeparator;
|
|
230
|
+
mirrorSummary = mirrorSummary;
|
|
231
|
+
static {
|
|
232
|
+
_initClass();
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
//#endregion
|
|
236
|
+
export { _MirrorSyncReporterAdapter as MirrorSyncReporterAdapter };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { normalizePath } from "./path-normalizer.adapter.mjs";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
//#region src/lib/mirror/infra/package-filter.adapter.ts
|
|
5
|
+
function tryRealpath(entryPath) {
|
|
6
|
+
try {
|
|
7
|
+
return realpathSync.native(entryPath);
|
|
8
|
+
} catch {
|
|
9
|
+
return path.resolve(entryPath);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve `packageFilter` to a POSIX-ish path relative to `rootDir`, without using
|
|
14
|
+
* `process.cwd()`. Use for programmatic `runMirrorSync` calls.
|
|
15
|
+
*
|
|
16
|
+
* @throws If the resolved path is not a strict subdirectory of `rootDir`.
|
|
17
|
+
*/ function resolvePackageFilterUnderRoot(rootDir, packageFilter) {
|
|
18
|
+
const rootReal = tryRealpath(path.resolve(rootDir));
|
|
19
|
+
const resolved = path.isAbsolute(packageFilter) ? tryRealpath(path.resolve(packageFilter)) : tryRealpath(path.join(rootReal, packageFilter));
|
|
20
|
+
const normalized = normalizePath(path.relative(rootReal, resolved));
|
|
21
|
+
if (normalized.startsWith("..") || path.isAbsolute(normalized) || normalized === "" || normalized === ".") throw new Error(`Package path must be a subdirectory under monorepo root: ${rootDir}`);
|
|
22
|
+
return normalized;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { resolvePackageFilterUnderRoot };
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { resolvePackageDisplayName, writePackageJsonExportsAtomic } from "./update-pkg.adapter.mjs";
|
|
2
|
+
import { injectable } from "@codefast/di";
|
|
3
|
+
//#region src/lib/mirror/infra/package-repository.adapter.ts
|
|
4
|
+
function toPrimitive(input, hint) {
|
|
5
|
+
if (typeof input !== "object" || input === null) return input;
|
|
6
|
+
var prim = input[Symbol.toPrimitive];
|
|
7
|
+
if (prim !== void 0) {
|
|
8
|
+
var res = prim.call(input, hint || "default");
|
|
9
|
+
if (typeof res !== "object") return res;
|
|
10
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
+
}
|
|
12
|
+
return (hint === "string" ? String : Number)(input);
|
|
13
|
+
}
|
|
14
|
+
function toPropertyKey(arg) {
|
|
15
|
+
var key = toPrimitive(arg, "string");
|
|
16
|
+
return typeof key === "symbol" ? key : String(key);
|
|
17
|
+
}
|
|
18
|
+
function checkInRHS(value) {
|
|
19
|
+
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function setFunctionName(fn, name, prefix) {
|
|
23
|
+
if (typeof name === "symbol") {
|
|
24
|
+
name = name.description;
|
|
25
|
+
name = name ? "[" + name + "]" : "";
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
Object.defineProperty(fn, "name", {
|
|
29
|
+
configurable: true,
|
|
30
|
+
value: prefix ? prefix + " " + name : name
|
|
31
|
+
});
|
|
32
|
+
} catch (_) {}
|
|
33
|
+
return fn;
|
|
34
|
+
}
|
|
35
|
+
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
36
|
+
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
37
|
+
var defineProperty = Object.defineProperty;
|
|
38
|
+
var create = Object.create;
|
|
39
|
+
var metadata;
|
|
40
|
+
var existingNonFields = [create(null), create(null)];
|
|
41
|
+
var hasClassDecs = classDecs.length;
|
|
42
|
+
var _;
|
|
43
|
+
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
44
|
+
return function(thisArg, value) {
|
|
45
|
+
if (useStaticThis) {
|
|
46
|
+
value = thisArg;
|
|
47
|
+
thisArg = targetClass;
|
|
48
|
+
}
|
|
49
|
+
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
50
|
+
return hasValue ? value : thisArg;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
54
|
+
if (typeof fn !== "function") {
|
|
55
|
+
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
56
|
+
}
|
|
57
|
+
return fn;
|
|
58
|
+
}
|
|
59
|
+
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
60
|
+
function assertInstanceIfPrivate(target) {
|
|
61
|
+
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
62
|
+
}
|
|
63
|
+
var decs = [].concat(decInfo[0]);
|
|
64
|
+
var decVal = decInfo[3];
|
|
65
|
+
var isClass = !ret;
|
|
66
|
+
var isAccessor = kind === 1;
|
|
67
|
+
var isGetter = kind === 3;
|
|
68
|
+
var isSetter = kind === 4;
|
|
69
|
+
var isMethod = kind === 2;
|
|
70
|
+
function bindPropCall(name, useStaticThis, before) {
|
|
71
|
+
return function(_this, value) {
|
|
72
|
+
if (useStaticThis) {
|
|
73
|
+
value = _this;
|
|
74
|
+
_this = Class;
|
|
75
|
+
}
|
|
76
|
+
if (before) before(_this);
|
|
77
|
+
return desc[name].call(_this, value);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var desc1 = {};
|
|
81
|
+
var init = [];
|
|
82
|
+
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
83
|
+
if (!isClass) {
|
|
84
|
+
if (isPrivate) {
|
|
85
|
+
if (isField || isAccessor) desc1 = {
|
|
86
|
+
get: setFunctionName(function() {
|
|
87
|
+
return decVal(this);
|
|
88
|
+
}, name, "get"),
|
|
89
|
+
set: function(value) {
|
|
90
|
+
decInfo[4](this, value);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
else desc1[key] = decVal;
|
|
94
|
+
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
95
|
+
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
96
|
+
if (!isField && !isPrivate) {
|
|
97
|
+
_ = existingNonFields[+isStatic][name];
|
|
98
|
+
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
99
|
+
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var newValue = Class;
|
|
103
|
+
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
104
|
+
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
105
|
+
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
106
|
+
var decoratorFinishedRef = {};
|
|
107
|
+
var ctx = {
|
|
108
|
+
kind: [
|
|
109
|
+
"field",
|
|
110
|
+
"accessor",
|
|
111
|
+
"method",
|
|
112
|
+
"getter",
|
|
113
|
+
"setter",
|
|
114
|
+
"class"
|
|
115
|
+
][kind],
|
|
116
|
+
name,
|
|
117
|
+
metadata,
|
|
118
|
+
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
119
|
+
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
120
|
+
assertCallable(initializer, "An initializer", "be", true);
|
|
121
|
+
initializers.push(initializer);
|
|
122
|
+
}).bind(null, decoratorFinishedRef)
|
|
123
|
+
};
|
|
124
|
+
if (isClass) {
|
|
125
|
+
_ = dec.call(decThis, newValue, ctx);
|
|
126
|
+
decoratorFinishedRef.v = 1;
|
|
127
|
+
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
ctx.static = isStatic;
|
|
131
|
+
ctx.private = isPrivate;
|
|
132
|
+
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
133
|
+
return name in target;
|
|
134
|
+
} };
|
|
135
|
+
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
136
|
+
assertInstanceIfPrivate(_this);
|
|
137
|
+
return desc1.value;
|
|
138
|
+
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
139
|
+
return target[name];
|
|
140
|
+
};
|
|
141
|
+
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
142
|
+
target[name] = value;
|
|
143
|
+
};
|
|
144
|
+
newValue = dec.call(decThis, isAccessor ? {
|
|
145
|
+
get: desc1.get,
|
|
146
|
+
set: desc1.set
|
|
147
|
+
} : desc1[key], ctx);
|
|
148
|
+
decoratorFinishedRef.v = 1;
|
|
149
|
+
if (isAccessor) {
|
|
150
|
+
if (typeof newValue === "object" && newValue) {
|
|
151
|
+
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
152
|
+
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
153
|
+
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
154
|
+
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
155
|
+
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
156
|
+
else desc1[key] = newValue;
|
|
157
|
+
}
|
|
158
|
+
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
159
|
+
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
160
|
+
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
161
|
+
else defineProperty(Class, name, desc1);
|
|
162
|
+
return newValue;
|
|
163
|
+
}
|
|
164
|
+
function applyMemberDecs() {
|
|
165
|
+
var ret = [];
|
|
166
|
+
var protoInitializers;
|
|
167
|
+
var staticInitializers;
|
|
168
|
+
var pushInitializers = function(initializers) {
|
|
169
|
+
if (initializers) ret.push(createRunInitializers(initializers));
|
|
170
|
+
};
|
|
171
|
+
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
172
|
+
for (var i = 0; i < memberDecs.length; i++) {
|
|
173
|
+
var decInfo = memberDecs[i];
|
|
174
|
+
var kind = decInfo[1];
|
|
175
|
+
var kindOnly = kind & 7;
|
|
176
|
+
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
177
|
+
var name = decInfo[2];
|
|
178
|
+
var isPrivate = !!decInfo[3];
|
|
179
|
+
var decoratorsHaveThis = kind & 16;
|
|
180
|
+
applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
|
|
181
|
+
return checkInRHS(_) === targetClass;
|
|
182
|
+
} : instanceBrand);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
applyMemberDecsOfKind(8, 0);
|
|
187
|
+
applyMemberDecsOfKind(0, 0);
|
|
188
|
+
applyMemberDecsOfKind(8, 1);
|
|
189
|
+
applyMemberDecsOfKind(0, 1);
|
|
190
|
+
pushInitializers(protoInitializers);
|
|
191
|
+
pushInitializers(staticInitializers);
|
|
192
|
+
return ret;
|
|
193
|
+
}
|
|
194
|
+
function defineMetadata(Class) {
|
|
195
|
+
return defineProperty(Class, symbolMetadata, {
|
|
196
|
+
configurable: true,
|
|
197
|
+
enumerable: true,
|
|
198
|
+
value: metadata
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
202
|
+
metadata = create(metadata == null ? null : metadata);
|
|
203
|
+
_ = applyMemberDecs();
|
|
204
|
+
if (!hasClassDecs) defineMetadata(targetClass);
|
|
205
|
+
return {
|
|
206
|
+
e: _,
|
|
207
|
+
get c() {
|
|
208
|
+
var initializers = [];
|
|
209
|
+
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
let _dec, _initClass;
|
|
214
|
+
_dec = injectable([]);
|
|
215
|
+
let _PackageRepositoryAdapter;
|
|
216
|
+
(class {
|
|
217
|
+
static {
|
|
218
|
+
({c: [_PackageRepositoryAdapter, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
219
|
+
}
|
|
220
|
+
resolvePackageDisplayName(packageJson, folderBasename) {
|
|
221
|
+
return resolvePackageDisplayName(packageJson, folderBasename);
|
|
222
|
+
}
|
|
223
|
+
writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput) {
|
|
224
|
+
return writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput);
|
|
225
|
+
}
|
|
226
|
+
parsePackageJsonShape(rawPackageJson) {
|
|
227
|
+
if (rawPackageJson === null || typeof rawPackageJson !== "object" || Array.isArray(rawPackageJson)) throw new SyntaxError("package.json root must be a JSON object");
|
|
228
|
+
return rawPackageJson;
|
|
229
|
+
}
|
|
230
|
+
static {
|
|
231
|
+
_initClass();
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
//#endregion
|
|
235
|
+
export { _PackageRepositoryAdapter as PackageRepositoryAdapter };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { messageFromCaughtUnknown } from "../../core/application/utils/caught-unknown-message.util.mjs";
|
|
2
|
+
import { PACKAGE_JSON_EXPORT } from "../domain/constants.domain.mjs";
|
|
3
|
+
import { MirrorError, MirrorErrorCode } from "../domain/errors.domain.mjs";
|
|
4
|
+
//#region src/lib/mirror/infra/update-pkg.adapter.ts
|
|
5
|
+
function containsDistTarget(value) {
|
|
6
|
+
if (typeof value === "string") return value.startsWith("./dist/");
|
|
7
|
+
if (Array.isArray(value)) return value.some((entryValue) => containsDistTarget(entryValue));
|
|
8
|
+
if (value && typeof value === "object") return Object.values(value).some((entryValue) => containsDistTarget(entryValue));
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Keep `./package.json` at the very end for aesthetics by default.
|
|
13
|
+
* If a catch-all `./*` exists, move `./package.json` before wildcards so it remains reachable.
|
|
14
|
+
*/ function exportSpecifierRank(exportSpecifier, hasCatchAllWildcard) {
|
|
15
|
+
if (exportSpecifier === ".") return 0;
|
|
16
|
+
if (exportSpecifier === "./package.json") return hasCatchAllWildcard ? 2 : 4;
|
|
17
|
+
if (exportSpecifier.includes("*")) return 3;
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
function compareExportSpecifiers(leftSpecifier, rightSpecifier, originalPathBySpecifier, hasCatchAllWildcard) {
|
|
21
|
+
const leftRank = exportSpecifierRank(leftSpecifier, hasCatchAllWildcard);
|
|
22
|
+
const rightRank = exportSpecifierRank(rightSpecifier, hasCatchAllWildcard);
|
|
23
|
+
if (leftRank !== rightRank) return leftRank - rightRank;
|
|
24
|
+
const leftOriginalPath = originalPathBySpecifier[leftSpecifier] ?? leftSpecifier;
|
|
25
|
+
const rightOriginalPath = originalPathBySpecifier[rightSpecifier] ?? rightSpecifier;
|
|
26
|
+
const originalPathComparison = leftOriginalPath.localeCompare(rightOriginalPath);
|
|
27
|
+
if (originalPathComparison !== 0) return originalPathComparison;
|
|
28
|
+
return leftSpecifier.localeCompare(rightSpecifier);
|
|
29
|
+
}
|
|
30
|
+
/** Shared rule: show `package.json#name` when it is a non-empty string; else folder basename. */ function resolvePackageDisplayName(packageJson, folderBasename) {
|
|
31
|
+
const declaredName = packageJson.name;
|
|
32
|
+
return typeof declaredName === "string" && declaredName.length > 0 ? declaredName : folderBasename;
|
|
33
|
+
}
|
|
34
|
+
async function readPackageJsonDisplayName(fs, packageJsonPath, folderBasename) {
|
|
35
|
+
if (!fs.existsSync(packageJsonPath)) return folderBasename;
|
|
36
|
+
try {
|
|
37
|
+
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
38
|
+
return resolvePackageDisplayName(JSON.parse(raw), folderBasename);
|
|
39
|
+
} catch {
|
|
40
|
+
return folderBasename;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Writes `exports` into `package.json` via a temp file + rename (atomic on same volume).
|
|
45
|
+
* Preserves a trailing newline after JSON.
|
|
46
|
+
*/ async function writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput) {
|
|
47
|
+
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
48
|
+
const packageJson = JSON.parse(raw);
|
|
49
|
+
const existingExports = packageJson.exports;
|
|
50
|
+
const existingExportMap = existingExports && typeof existingExports === "object" && !Array.isArray(existingExports) ? existingExports : {};
|
|
51
|
+
const managedSpecifiers = new Set(mergeInput.managedExportSpecifiers);
|
|
52
|
+
const originalPathBySpecifier = { ...mergeInput.originalPathBySpecifier };
|
|
53
|
+
const mergedExportMap = {};
|
|
54
|
+
const prunedKeys = [];
|
|
55
|
+
for (const [exportSpecifier, exportValue] of Object.entries(existingExportMap)) {
|
|
56
|
+
if (exportSpecifier === "./package.json") {
|
|
57
|
+
mergedExportMap[exportSpecifier] = exportValue;
|
|
58
|
+
if (!(exportSpecifier in originalPathBySpecifier)) originalPathBySpecifier[exportSpecifier] = exportSpecifier;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (!managedSpecifiers.has(exportSpecifier)) if (containsDistTarget(exportValue)) prunedKeys.push(exportSpecifier);
|
|
62
|
+
else {
|
|
63
|
+
mergedExportMap[exportSpecifier] = exportValue;
|
|
64
|
+
if (!(exportSpecifier in originalPathBySpecifier)) originalPathBySpecifier[exportSpecifier] = exportSpecifier;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (const [exportSpecifier, exportValue] of Object.entries(mergeInput.generatedExports)) mergedExportMap[exportSpecifier] = exportValue;
|
|
68
|
+
if (!("./package.json" in mergedExportMap)) mergedExportMap[PACKAGE_JSON_EXPORT] = PACKAGE_JSON_EXPORT;
|
|
69
|
+
originalPathBySpecifier[PACKAGE_JSON_EXPORT] = PACKAGE_JSON_EXPORT;
|
|
70
|
+
const rootExport = mergedExportMap["."];
|
|
71
|
+
if (rootExport && typeof rootExport === "object" && !Array.isArray(rootExport)) {
|
|
72
|
+
const rootEntry = rootExport;
|
|
73
|
+
const requirePath = typeof rootEntry.require === "string" ? rootEntry.require : void 0;
|
|
74
|
+
const importPath = typeof rootEntry.import === "string" ? rootEntry.import : void 0;
|
|
75
|
+
const typesPath = typeof rootEntry.types === "string" ? rootEntry.types : void 0;
|
|
76
|
+
if (requirePath || importPath) packageJson.main = requirePath ?? importPath;
|
|
77
|
+
if (importPath && importPath.endsWith(".mjs")) packageJson.module = importPath;
|
|
78
|
+
if (typesPath) packageJson.types = typesPath;
|
|
79
|
+
}
|
|
80
|
+
const filesField = packageJson.files;
|
|
81
|
+
if (Array.isArray(filesField)) {
|
|
82
|
+
const normalizedFiles = filesField.filter((entry) => typeof entry === "string");
|
|
83
|
+
if (!normalizedFiles.includes("dist")) normalizedFiles.push("dist");
|
|
84
|
+
packageJson.files = normalizedFiles;
|
|
85
|
+
} else packageJson.files = ["dist"];
|
|
86
|
+
const sortedExportMap = {};
|
|
87
|
+
const hasCatchAllWildcard = "./*" in mergedExportMap;
|
|
88
|
+
for (const exportSpecifier of Object.keys(mergedExportMap).sort((leftSpecifier, rightSpecifier) => compareExportSpecifiers(leftSpecifier, rightSpecifier, originalPathBySpecifier, hasCatchAllWildcard))) sortedExportMap[exportSpecifier] = mergedExportMap[exportSpecifier];
|
|
89
|
+
packageJson.exports = sortedExportMap;
|
|
90
|
+
const serialized = JSON.stringify(packageJson, null, 2) + "\n";
|
|
91
|
+
const tmpPath = `${packageJsonPath}.tmp`;
|
|
92
|
+
await fs.writeFile(tmpPath, serialized, "utf8");
|
|
93
|
+
try {
|
|
94
|
+
await fs.rename(tmpPath, packageJsonPath);
|
|
95
|
+
} catch (caughtRenameError) {
|
|
96
|
+
await fs.unlink(tmpPath).catch(() => {});
|
|
97
|
+
throw new MirrorError(MirrorErrorCode.PACKAGE_WRITE, `Failed to atomically update ${packageJsonPath}: ${messageFromCaughtUnknown(caughtRenameError)}`, caughtRenameError instanceof Error ? { cause: caughtRenameError } : void 0);
|
|
98
|
+
}
|
|
99
|
+
return { prunedKeys };
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { readPackageJsonDisplayName, resolvePackageDisplayName, writePackageJsonExportsAtomic };
|