@codefast/cli 0.3.13-canary.1 → 0.3.13-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/{bin.mjs → bin.js} +1 -4
- package/dist/commands/arrange.d.ts +3 -0
- package/dist/commands/arrange.d.ts.map +1 -0
- package/dist/commands/arrange.js +108 -0
- package/dist/commands/mirror.d.ts +3 -0
- package/dist/commands/mirror.d.ts.map +1 -0
- package/dist/commands/mirror.js +36 -0
- package/dist/commands/tag.d.ts +3 -0
- package/dist/commands/tag.d.ts.map +1 -0
- package/dist/commands/tag.js +44 -0
- package/dist/lib/arrange/application/ports/domain-source-parser.port.d.ts +5 -0
- package/dist/lib/arrange/application/ports/domain-source-parser.port.d.ts.map +1 -0
- package/dist/lib/arrange/application/ports/file-walker.port.d.ts +5 -0
- package/dist/lib/arrange/application/ports/file-walker.port.d.ts.map +1 -0
- package/dist/lib/arrange/application/requests/analyze-directory.request.d.ts +6 -0
- package/dist/lib/arrange/application/requests/analyze-directory.request.d.ts.map +1 -0
- package/dist/lib/arrange/application/requests/analyze-directory.request.js +4 -0
- package/dist/lib/arrange/application/requests/arrange-sync.request.d.ts +18 -0
- package/dist/lib/arrange/application/requests/arrange-sync.request.d.ts.map +1 -0
- package/dist/lib/arrange/application/requests/arrange-sync.request.js +15 -0
- package/dist/lib/arrange/application/requests/suggest-groups.request.d.ts +8 -0
- package/dist/lib/arrange/application/requests/suggest-groups.request.d.ts.map +1 -0
- package/dist/lib/arrange/application/requests/suggest-groups.request.js +8 -0
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.d.ts +17 -0
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.d.ts.map +1 -0
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.js +24 -0
- package/dist/lib/arrange/application/use-cases/group-file-preview.use-case.d.ts +17 -0
- package/dist/lib/arrange/application/use-cases/group-file-preview.use-case.d.ts.map +1 -0
- package/dist/lib/arrange/application/use-cases/group-file-preview.use-case.js +46 -0
- package/dist/lib/arrange/application/use-cases/group-file.use-case.d.ts +5 -0
- package/dist/lib/arrange/application/use-cases/group-file.use-case.d.ts.map +1 -0
- package/dist/lib/arrange/application/use-cases/group-file.use-case.js +40 -0
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.d.ts +19 -0
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.d.ts.map +1 -0
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.js +85 -0
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.d.ts +7 -0
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.d.ts.map +1 -0
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.js +10 -0
- package/dist/lib/arrange/domain/arrange-analyze.service.d.ts +12 -0
- package/dist/lib/arrange/domain/arrange-analyze.service.d.ts.map +1 -0
- package/dist/lib/arrange/domain/arrange-analyze.service.js +116 -0
- package/dist/lib/arrange/domain/arrange-grouping.service.d.ts +53 -0
- package/dist/lib/arrange/domain/arrange-grouping.service.d.ts.map +1 -0
- package/dist/lib/arrange/domain/arrange-grouping.service.js +106 -0
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.d.ts +28 -0
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/ast-helpers.helper.js +130 -0
- package/dist/lib/arrange/domain/ast/ast-node.model.d.ts +179 -0
- package/dist/lib/arrange/domain/ast/ast-node.model.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/ast-node.model.js +210 -0
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.d.ts +7 -0
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/collectors-cn.collector.js +70 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.d.ts +4 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.collector.js +21 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.d.ts +13 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.collector.js +302 -0
- package/dist/lib/arrange/domain/ast/targets.model.d.ts +8 -0
- package/dist/lib/arrange/domain/ast/targets.model.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/targets.model.js +147 -0
- package/dist/lib/arrange/domain/constants.domain.d.ts +70 -0
- package/dist/lib/arrange/domain/constants.domain.d.ts.map +1 -0
- package/dist/lib/arrange/domain/constants.domain.js +182 -0
- package/dist/lib/arrange/domain/errors.domain.d.ts +14 -0
- package/dist/lib/arrange/domain/errors.domain.d.ts.map +1 -0
- package/dist/lib/arrange/domain/errors.domain.js +16 -0
- package/dist/lib/arrange/domain/grouping.domain.d.ts +41 -0
- package/dist/lib/arrange/domain/grouping.domain.d.ts.map +1 -0
- package/dist/lib/arrange/domain/grouping.domain.js +371 -0
- package/dist/lib/arrange/domain/imports.domain.d.ts +7 -0
- package/dist/lib/arrange/domain/imports.domain.d.ts.map +1 -0
- package/dist/lib/arrange/domain/imports.domain.js +80 -0
- package/dist/lib/arrange/domain/source-text-formatters.formatter.d.ts +16 -0
- package/dist/lib/arrange/domain/source-text-formatters.formatter.d.ts.map +1 -0
- package/dist/lib/arrange/domain/source-text-formatters.formatter.js +55 -0
- package/dist/lib/arrange/domain/tokenizer.util.d.ts +45 -0
- package/dist/lib/arrange/domain/tokenizer.util.d.ts.map +1 -0
- package/dist/lib/arrange/domain/tokenizer.util.js +469 -0
- package/dist/lib/arrange/domain/types.domain.d.ts +115 -0
- package/dist/lib/arrange/domain/types.domain.d.ts.map +1 -0
- package/dist/lib/arrange/domain/types.domain.js +10 -0
- package/dist/lib/arrange/index.d.ts +45 -0
- package/dist/lib/arrange/index.d.ts.map +1 -0
- package/dist/lib/arrange/index.js +41 -0
- package/dist/lib/arrange/infra/arrange-sync-cli-options.adapter.d.ts +14 -0
- package/dist/lib/arrange/infra/arrange-sync-cli-options.adapter.d.ts.map +1 -0
- package/dist/lib/arrange/infra/domain-source-parser.adapter.d.ts +11 -0
- package/dist/lib/arrange/infra/domain-source-parser.adapter.d.ts.map +1 -0
- package/dist/lib/arrange/infra/domain-source-parser.adapter.js +19 -0
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.d.ts +3 -0
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.d.ts.map +1 -0
- package/dist/lib/arrange/infra/ensure-cn-import.adapter.js +6 -0
- package/dist/lib/arrange/infra/file-walker.adapter.d.ts +8 -0
- package/dist/lib/arrange/infra/file-walker.adapter.d.ts.map +1 -0
- package/dist/lib/arrange/infra/file-walker.adapter.js +17 -0
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.d.ts +8 -0
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.d.ts.map +1 -0
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.test-helper.js +25 -0
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.d.ts +10 -0
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.d.ts.map +1 -0
- package/dist/lib/arrange/infra/ts-ast-translator.adapter.js +363 -0
- package/dist/lib/arrange/presentation/arrange-prelude.presenter.d.ts +14 -0
- package/dist/lib/arrange/presentation/arrange-prelude.presenter.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/arrange-prelude.presenter.js +24 -0
- package/dist/lib/arrange/presentation/formatters.presenter.d.ts +3 -0
- package/dist/lib/arrange/presentation/formatters.presenter.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/formatters.presenter.js +2 -0
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.d.ts +4 -0
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/present-analyze-cli.presenter.js +4 -0
- package/dist/lib/arrange/presentation/report.presenter.d.ts +4 -0
- package/dist/lib/arrange/presentation/report.presenter.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/report.presenter.js +37 -0
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.d.ts +2 -0
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/resolve-arrange-cli-target.presenter.js +7 -0
- package/dist/lib/config/domain/schema.domain.d.ts +50 -0
- package/dist/lib/config/domain/schema.domain.d.ts.map +1 -0
- package/dist/lib/config/domain/schema.domain.js +43 -0
- package/dist/lib/config/index.d.ts +4 -0
- package/dist/lib/config/index.d.ts.map +1 -0
- package/dist/lib/config/index.js +2 -0
- package/dist/lib/config/infra/loader.adapter.d.ts +11 -0
- package/dist/lib/config/infra/loader.adapter.d.ts.map +1 -0
- package/dist/lib/config/infra/loader.adapter.js +90 -0
- package/dist/lib/core/application/architecture-boundaries.policy.d.ts +19 -0
- package/dist/lib/core/application/architecture-boundaries.policy.d.ts.map +1 -0
- package/dist/lib/core/application/architecture-boundaries.policy.js +370 -0
- package/dist/lib/core/application/ports/cli-io.port.d.ts +31 -0
- package/dist/lib/core/application/ports/cli-io.port.d.ts.map +1 -0
- package/dist/lib/core/application/schema-parse.util.d.ts +8 -0
- package/dist/lib/core/application/schema-parse.util.d.ts.map +1 -0
- package/dist/lib/core/application/schema-parse.util.js +20 -0
- package/dist/lib/core/application/utils/caught-unknown-message.util.d.ts +6 -0
- package/dist/lib/core/application/utils/caught-unknown-message.util.d.ts.map +1 -0
- package/dist/lib/core/application/utils/caught-unknown-message.util.js +34 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.util.d.ts +5 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.util.d.ts.map +1 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.util.js +7 -0
- package/dist/lib/core/domain/errors.domain.d.ts +11 -0
- package/dist/lib/core/domain/errors.domain.d.ts.map +1 -0
- package/dist/lib/core/domain/errors.domain.js +9 -0
- package/dist/lib/core/domain/result.model.d.ts +17 -0
- package/dist/lib/core/domain/result.model.d.ts.map +1 -0
- package/dist/lib/core/domain/result.model.js +15 -0
- package/dist/lib/core/infra/container.adapter.d.ts +58 -0
- package/dist/lib/core/infra/container.adapter.d.ts.map +1 -0
- package/dist/lib/core/infra/container.adapter.js +80 -0
- package/dist/lib/core/infra/logging-decorator.adapter.d.ts +12 -0
- package/dist/lib/core/infra/logging-decorator.adapter.d.ts.map +1 -0
- package/dist/lib/core/infra/logging-decorator.adapter.js +75 -0
- package/dist/lib/core/presentation/cli-executor.presenter.d.ts +33 -0
- package/dist/lib/core/presentation/cli-executor.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/cli-executor.presenter.js +73 -0
- package/dist/lib/core/presentation/format-app-error.presenter.d.ts +6 -0
- package/dist/lib/core/presentation/format-app-error.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/format-app-error.presenter.js +19 -0
- package/dist/lib/core/presentation/global-cli-options.presenter.d.ts +9 -0
- package/dist/lib/core/presentation/global-cli-options.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/global-cli-options.presenter.js +8 -0
- package/dist/lib/core/presentation/load-codefast-config.presenter.d.ts +8 -0
- package/dist/lib/core/presentation/load-codefast-config.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/load-codefast-config.presenter.js +15 -0
- package/dist/lib/core/presentation/parse-cli-schema.presenter.d.ts +5 -0
- package/dist/lib/core/presentation/parse-cli-schema.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/parse-cli-schema.presenter.js +4 -0
- package/dist/lib/core/presentation/run-cli-use-case-after-parse.presenter.d.ts +6 -0
- package/dist/lib/core/presentation/run-cli-use-case-after-parse.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/run-cli-use-case-after-parse.presenter.js +17 -0
- package/dist/lib/core/presentation/workspace-root-strict.presenter.d.ts +5 -0
- package/dist/lib/core/presentation/workspace-root-strict.presenter.d.ts.map +1 -0
- package/dist/lib/core/presentation/workspace-root-strict.presenter.js +12 -0
- package/dist/lib/infra/config-reporter.adapter.d.ts +4 -0
- package/dist/lib/infra/config-reporter.adapter.d.ts.map +1 -0
- package/dist/lib/infra/config-reporter.adapter.js +9 -0
- package/dist/lib/infra/fs-contract.port.d.ts +2 -0
- package/dist/lib/infra/fs-contract.port.d.ts.map +1 -0
- package/dist/lib/infra/fs-contract.port.js +1 -0
- package/dist/lib/infra/node-io.adapter.d.ts +4 -0
- package/dist/lib/infra/node-io.adapter.d.ts.map +1 -0
- package/dist/lib/infra/node-io.adapter.js +37 -0
- package/dist/lib/infra/workspace/repo-root.adapter.d.ts +7 -0
- package/dist/lib/infra/workspace/repo-root.adapter.d.ts.map +1 -0
- package/dist/lib/infra/workspace/repo-root.adapter.js +23 -0
- package/dist/lib/mirror/application/ports/file-system-service.port.d.ts +6 -0
- package/dist/lib/mirror/application/ports/file-system-service.port.d.ts.map +1 -0
- package/dist/lib/mirror/application/ports/file-system-service.port.js +1 -0
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.d.ts +27 -0
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.d.ts.map +1 -0
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.js +1 -0
- package/dist/lib/mirror/application/ports/package-repository.port.d.ts +16 -0
- package/dist/lib/mirror/application/ports/package-repository.port.d.ts.map +1 -0
- package/dist/lib/mirror/application/ports/package-repository.port.js +1 -0
- package/dist/lib/mirror/application/ports/workspace-service.port.d.ts +7 -0
- package/dist/lib/mirror/application/ports/workspace-service.port.d.ts.map +1 -0
- package/dist/lib/mirror/application/ports/workspace-service.port.js +1 -0
- package/dist/lib/mirror/application/requests/mirror-sync.request.d.ts +10 -0
- package/dist/lib/mirror/application/requests/mirror-sync.request.d.ts.map +1 -0
- package/dist/lib/mirror/application/requests/mirror-sync.request.js +8 -0
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.d.ts +10 -0
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.d.ts.map +1 -0
- package/dist/lib/mirror/application/use-cases/generate-mirror-exports.use-case.js +271 -0
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.d.ts +19 -0
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.d.ts.map +1 -0
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.js +168 -0
- package/dist/lib/mirror/domain/constants.domain.d.ts +6 -0
- package/dist/lib/mirror/domain/constants.domain.d.ts.map +1 -0
- package/dist/lib/mirror/domain/constants.domain.js +5 -0
- package/dist/lib/mirror/domain/errors.domain.d.ts +10 -0
- package/dist/lib/mirror/domain/errors.domain.d.ts.map +1 -0
- package/dist/lib/mirror/domain/errors.domain.js +12 -0
- package/dist/lib/mirror/domain/types.domain.d.ts +65 -0
- package/dist/lib/mirror/domain/types.domain.d.ts.map +1 -0
- package/dist/lib/mirror/domain/types.domain.js +1 -0
- package/dist/lib/mirror/index.d.ts +6 -0
- package/dist/lib/mirror/index.d.ts.map +1 -0
- package/dist/lib/mirror/index.js +1 -0
- package/dist/lib/mirror/infra/dirent-list.adapter.d.ts +9 -0
- package/dist/lib/mirror/infra/dirent-list.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/dirent-list.adapter.js +13 -0
- package/dist/lib/mirror/infra/file-system-service.adapter.d.ts +7 -0
- package/dist/lib/mirror/infra/file-system-service.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/file-system-service.adapter.js +47 -0
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.d.ts +14 -0
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/mirror-sync-cli-options.adapter.js +1 -0
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.d.ts +3 -0
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/mirror-sync-reporter.adapter.js +13 -0
- package/dist/lib/mirror/infra/package-filter.adapter.d.ts +8 -0
- package/dist/lib/mirror/infra/package-filter.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/package-filter.adapter.js +33 -0
- package/dist/lib/mirror/infra/package-repository.adapter.d.ts +17 -0
- package/dist/lib/mirror/infra/package-repository.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/package-repository.adapter.js +17 -0
- package/dist/lib/mirror/infra/path-normalizer.adapter.d.ts +2 -0
- package/dist/lib/mirror/infra/path-normalizer.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/path-normalizer.adapter.js +4 -0
- package/dist/lib/mirror/infra/update-pkg.adapter.d.ts +19 -0
- package/dist/lib/mirror/infra/update-pkg.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/update-pkg.adapter.js +156 -0
- package/dist/lib/mirror/infra/workspace-packages.adapter.d.ts +26 -0
- package/dist/lib/mirror/infra/workspace-packages.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/workspace-packages.adapter.js +170 -0
- package/dist/lib/mirror/infra/workspace-service.adapter.d.ts +8 -0
- package/dist/lib/mirror/infra/workspace-service.adapter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/workspace-service.adapter.js +10 -0
- package/dist/lib/mirror/presentation/mirror-prelude.presenter.d.ts +17 -0
- package/dist/lib/mirror/presentation/mirror-prelude.presenter.d.ts.map +1 -0
- package/dist/lib/mirror/presentation/mirror-prelude.presenter.js +35 -0
- package/dist/lib/mirror/presentation/reporter.presenter.d.ts +25 -0
- package/dist/lib/mirror/presentation/reporter.presenter.d.ts.map +1 -0
- package/dist/lib/mirror/presentation/reporter.presenter.js +140 -0
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.d.ts +11 -0
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.d.ts.map +1 -0
- package/dist/lib/mirror/presentation/resolve-mirror-package-arg.presenter.js +27 -0
- package/dist/lib/shared/source-code/domain/text-edit.model.d.ts +14 -0
- package/dist/lib/shared/source-code/domain/text-edit.model.d.ts.map +1 -0
- package/dist/lib/shared/source-code/domain/text-edit.model.js +30 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.d.ts +4 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.d.ts.map +1 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.adapter.js +37 -0
- package/dist/lib/tag/application/ports/target-resolver.port.d.ts +6 -0
- package/dist/lib/tag/application/ports/target-resolver.port.d.ts.map +1 -0
- package/dist/lib/tag/application/ports/target-resolver.port.js +1 -0
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.d.ts +6 -0
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.d.ts.map +1 -0
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.js +1 -0
- package/dist/lib/tag/application/requests/tag-sync.request.d.ts +10 -0
- package/dist/lib/tag/application/requests/tag-sync.request.d.ts.map +1 -0
- package/dist/lib/tag/application/requests/tag-sync.request.js +8 -0
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.d.ts +23 -0
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.d.ts.map +1 -0
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.js +357 -0
- package/dist/lib/tag/domain/types.domain.d.ts +56 -0
- package/dist/lib/tag/domain/types.domain.d.ts.map +1 -0
- package/dist/lib/tag/domain/types.domain.js +1 -0
- package/dist/lib/tag/index.d.ts +14 -0
- package/dist/lib/tag/index.d.ts.map +1 -0
- package/dist/lib/tag/index.js +10 -0
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.d.ts +14 -0
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.d.ts.map +1 -0
- package/dist/lib/tag/infra/tag-sync-cli-options.adapter.js +1 -0
- package/dist/lib/tag/infra/tag-target-candidates.adapter.d.ts +4 -0
- package/dist/lib/tag/infra/tag-target-candidates.adapter.d.ts.map +1 -0
- package/dist/lib/tag/infra/tag-target-candidates.adapter.js +200 -0
- package/dist/lib/tag/infra/tag-target-resolver.adapter.d.ts +3 -0
- package/dist/lib/tag/infra/tag-target-resolver.adapter.d.ts.map +1 -0
- package/dist/lib/tag/infra/tag-target-resolver.adapter.js +4 -0
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.d.ts +3 -0
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.d.ts.map +1 -0
- package/dist/lib/tag/infra/typescript-tree-walk.adapter.js +4 -0
- package/dist/lib/tag/presentation/colors.presenter.d.ts +8 -0
- package/dist/lib/tag/presentation/colors.presenter.d.ts.map +1 -0
- package/dist/lib/tag/presentation/colors.presenter.js +9 -0
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.d.ts +8 -0
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.d.ts.map +1 -0
- package/dist/lib/tag/presentation/resolve-tag-cli-target.presenter.js +10 -0
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.d.ts +8 -0
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.d.ts.map +1 -0
- package/dist/lib/tag/presentation/resolve-tag-workspace-root.presenter.js +10 -0
- package/dist/lib/tag/presentation/tag-prelude.presenter.d.ts +15 -0
- package/dist/lib/tag/presentation/tag-prelude.presenter.d.ts.map +1 -0
- package/dist/lib/tag/presentation/tag-prelude.presenter.js +31 -0
- package/dist/lib/tag/presentation/tag-sync.presenter.d.ts +20 -0
- package/dist/lib/tag/presentation/tag-sync.presenter.d.ts.map +1 -0
- package/dist/lib/tag/presentation/tag-sync.presenter.js +92 -0
- package/dist/program.d.ts +4 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +40 -0
- package/package.json +8 -5
- package/dist/commands/arrange.mjs +0 -107
- package/dist/commands/mirror.mjs +0 -66
- package/dist/commands/tag.mjs +0 -58
- package/dist/lib/arrange/application/analyze.mjs +0 -92
- package/dist/lib/arrange/application/group-file.mjs +0 -113
- package/dist/lib/arrange/application/run-target.mjs +0 -65
- package/dist/lib/arrange/domain/ast/ast-helpers.mjs +0 -115
- package/dist/lib/arrange/domain/ast/collectors-cn.mjs +0 -61
- package/dist/lib/arrange/domain/ast/collectors-jsx.mjs +0 -20
- package/dist/lib/arrange/domain/ast/collectors-tv.mjs +0 -170
- package/dist/lib/arrange/domain/ast/targets.mjs +0 -106
- package/dist/lib/arrange/domain/constants.mjs +0 -169
- package/dist/lib/arrange/domain/errors.mjs +0 -19
- package/dist/lib/arrange/domain/grouping.mjs +0 -235
- package/dist/lib/arrange/domain/imports.mjs +0 -54
- package/dist/lib/arrange/domain/tokenizer.mjs +0 -216
- package/dist/lib/arrange/index.mjs +0 -15
- package/dist/lib/arrange/infra/walk.mjs +0 -33
- package/dist/lib/arrange/presentation/formatters.mjs +0 -52
- package/dist/lib/arrange/presentation/report.mjs +0 -24
- package/dist/lib/config/domain/schema.mjs +0 -25
- package/dist/lib/config/index.mjs +0 -3
- package/dist/lib/config/infra/loader.mjs +0 -78
- package/dist/lib/infra/caught-unknown-message.mjs +0 -20
- package/dist/lib/infra/config-reporter.mjs +0 -10
- package/dist/lib/infra/node-io.mjs +0 -30
- package/dist/lib/infra/workspace/repo-root.mjs +0 -22
- package/dist/lib/mirror/application/engine.mjs +0 -248
- package/dist/lib/mirror/application/sync.mjs +0 -162
- package/dist/lib/mirror/domain/constants.mjs +0 -12
- package/dist/lib/mirror/domain/errors.mjs +0 -15
- package/dist/lib/mirror/index.mjs +0 -2
- package/dist/lib/mirror/infra/dirent-list.mjs +0 -14
- package/dist/lib/mirror/infra/package-filter.mjs +0 -26
- package/dist/lib/mirror/infra/path-normalizer.mjs +0 -7
- package/dist/lib/mirror/infra/update-pkg.mjs +0 -105
- package/dist/lib/mirror/infra/workspace-packages.mjs +0 -159
- package/dist/lib/mirror/presentation/reporter.mjs +0 -111
- package/dist/lib/tag/application/engine.mjs +0 -287
- package/dist/lib/tag/index.mjs +0 -4
- package/dist/lib/tag/infra/target-resolver.mjs +0 -170
- package/dist/lib/tag/presentation/colors.mjs +0 -12
- package/dist/lib/tag/presentation/tag-presenter.mjs +0 -63
- package/dist/program.mjs +0 -34
- /package/dist/lib/arrange/{domain/types.mjs → application/ports/domain-source-parser.port.js} +0 -0
- /package/dist/lib/{infra/fs-contract.mjs → arrange/application/ports/file-walker.port.js} +0 -0
- /package/dist/lib/{mirror/domain/types.mjs → arrange/infra/arrange-sync-cli-options.adapter.js} +0 -0
- /package/dist/lib/{tag/domain/types.mjs → core/application/ports/cli-io.port.js} +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { messageFromCaughtUnknown } from "../../infra/caught-unknown-message.mjs";
|
|
2
|
-
import { PACKAGE_JSON_EXPORT } from "../domain/constants.mjs";
|
|
3
|
-
import { MirrorError, MirrorErrorCode } from "../domain/errors.mjs";
|
|
4
|
-
//#region src/lib/mirror/infra/update-pkg.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
|
-
*/
|
|
15
|
-
function exportSpecifierRank(exportSpecifier, hasCatchAllWildcard) {
|
|
16
|
-
if (exportSpecifier === ".") return 0;
|
|
17
|
-
if (exportSpecifier === "./package.json") return hasCatchAllWildcard ? 2 : 4;
|
|
18
|
-
if (exportSpecifier.includes("*")) return 3;
|
|
19
|
-
return 1;
|
|
20
|
-
}
|
|
21
|
-
function compareExportSpecifiers(leftSpecifier, rightSpecifier, originalPathBySpecifier, hasCatchAllWildcard) {
|
|
22
|
-
const leftRank = exportSpecifierRank(leftSpecifier, hasCatchAllWildcard);
|
|
23
|
-
const rightRank = exportSpecifierRank(rightSpecifier, hasCatchAllWildcard);
|
|
24
|
-
if (leftRank !== rightRank) return leftRank - rightRank;
|
|
25
|
-
const leftOriginalPath = originalPathBySpecifier[leftSpecifier] ?? leftSpecifier;
|
|
26
|
-
const rightOriginalPath = originalPathBySpecifier[rightSpecifier] ?? rightSpecifier;
|
|
27
|
-
const originalPathComparison = leftOriginalPath.localeCompare(rightOriginalPath);
|
|
28
|
-
if (originalPathComparison !== 0) return originalPathComparison;
|
|
29
|
-
return leftSpecifier.localeCompare(rightSpecifier);
|
|
30
|
-
}
|
|
31
|
-
/** Shared rule: show `package.json#name` when it is a non-empty string; else folder basename. */
|
|
32
|
-
function resolvePackageDisplayName(packageJson, folderBasename) {
|
|
33
|
-
const declaredName = packageJson.name;
|
|
34
|
-
return typeof declaredName === "string" && declaredName.length > 0 ? declaredName : folderBasename;
|
|
35
|
-
}
|
|
36
|
-
async function readPackageJsonDisplayName(fs, packageJsonPath, folderBasename) {
|
|
37
|
-
if (!fs.existsSync(packageJsonPath)) return folderBasename;
|
|
38
|
-
try {
|
|
39
|
-
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
40
|
-
return resolvePackageDisplayName(JSON.parse(raw), folderBasename);
|
|
41
|
-
} catch {
|
|
42
|
-
return folderBasename;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Writes `exports` into `package.json` via a temp file + rename (atomic on same volume).
|
|
47
|
-
* Preserves a trailing newline after JSON.
|
|
48
|
-
*/
|
|
49
|
-
async function writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput) {
|
|
50
|
-
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
51
|
-
const packageJson = JSON.parse(raw);
|
|
52
|
-
const existingExports = packageJson.exports;
|
|
53
|
-
const existingExportMap = existingExports && typeof existingExports === "object" && !Array.isArray(existingExports) ? existingExports : {};
|
|
54
|
-
const managedSpecifiers = new Set(mergeInput.managedExportSpecifiers);
|
|
55
|
-
const originalPathBySpecifier = { ...mergeInput.originalPathBySpecifier };
|
|
56
|
-
const mergedExportMap = {};
|
|
57
|
-
const prunedKeys = [];
|
|
58
|
-
for (const [exportSpecifier, exportValue] of Object.entries(existingExportMap)) {
|
|
59
|
-
if (exportSpecifier === "./package.json") {
|
|
60
|
-
mergedExportMap[exportSpecifier] = exportValue;
|
|
61
|
-
if (!(exportSpecifier in originalPathBySpecifier)) originalPathBySpecifier[exportSpecifier] = exportSpecifier;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (!managedSpecifiers.has(exportSpecifier)) if (containsDistTarget(exportValue)) prunedKeys.push(exportSpecifier);
|
|
65
|
-
else {
|
|
66
|
-
mergedExportMap[exportSpecifier] = exportValue;
|
|
67
|
-
if (!(exportSpecifier in originalPathBySpecifier)) originalPathBySpecifier[exportSpecifier] = exportSpecifier;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
for (const [exportSpecifier, exportValue] of Object.entries(mergeInput.generatedExports)) mergedExportMap[exportSpecifier] = exportValue;
|
|
71
|
-
if (!("./package.json" in mergedExportMap)) mergedExportMap[PACKAGE_JSON_EXPORT] = PACKAGE_JSON_EXPORT;
|
|
72
|
-
originalPathBySpecifier[PACKAGE_JSON_EXPORT] = PACKAGE_JSON_EXPORT;
|
|
73
|
-
const rootExport = mergedExportMap["."];
|
|
74
|
-
if (rootExport && typeof rootExport === "object" && !Array.isArray(rootExport)) {
|
|
75
|
-
const rootEntry = rootExport;
|
|
76
|
-
const requirePath = typeof rootEntry.require === "string" ? rootEntry.require : void 0;
|
|
77
|
-
const importPath = typeof rootEntry.import === "string" ? rootEntry.import : void 0;
|
|
78
|
-
const typesPath = typeof rootEntry.types === "string" ? rootEntry.types : void 0;
|
|
79
|
-
if (requirePath || importPath) packageJson.main = requirePath ?? importPath;
|
|
80
|
-
if (importPath && importPath.endsWith(".mjs")) packageJson.module = importPath;
|
|
81
|
-
if (typesPath) packageJson.types = typesPath;
|
|
82
|
-
}
|
|
83
|
-
const filesField = packageJson.files;
|
|
84
|
-
if (Array.isArray(filesField)) {
|
|
85
|
-
const normalizedFiles = filesField.filter((entry) => typeof entry === "string");
|
|
86
|
-
if (!normalizedFiles.includes("dist")) normalizedFiles.push("dist");
|
|
87
|
-
packageJson.files = normalizedFiles;
|
|
88
|
-
} else packageJson.files = ["dist"];
|
|
89
|
-
const sortedExportMap = {};
|
|
90
|
-
const hasCatchAllWildcard = "./*" in mergedExportMap;
|
|
91
|
-
for (const exportSpecifier of Object.keys(mergedExportMap).sort((leftSpecifier, rightSpecifier) => compareExportSpecifiers(leftSpecifier, rightSpecifier, originalPathBySpecifier, hasCatchAllWildcard))) sortedExportMap[exportSpecifier] = mergedExportMap[exportSpecifier];
|
|
92
|
-
packageJson.exports = sortedExportMap;
|
|
93
|
-
const serialized = JSON.stringify(packageJson, null, 2) + "\n";
|
|
94
|
-
const tmpPath = `${packageJsonPath}.tmp`;
|
|
95
|
-
await fs.writeFile(tmpPath, serialized, "utf8");
|
|
96
|
-
try {
|
|
97
|
-
await fs.rename(tmpPath, packageJsonPath);
|
|
98
|
-
} catch (caughtRenameError) {
|
|
99
|
-
await fs.unlink(tmpPath).catch(() => {});
|
|
100
|
-
throw new MirrorError(MirrorErrorCode.PACKAGE_WRITE, `Failed to atomically update ${packageJsonPath}: ${messageFromCaughtUnknown(caughtRenameError)}`, caughtRenameError instanceof Error ? { cause: caughtRenameError } : void 0);
|
|
101
|
-
}
|
|
102
|
-
return { prunedKeys };
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
export { readPackageJsonDisplayName, resolvePackageDisplayName, writePackageJsonExportsAtomic };
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { messageFromCaughtUnknown } from "../../infra/caught-unknown-message.mjs";
|
|
2
|
-
import { normalizePath } from "./path-normalizer.mjs";
|
|
3
|
-
import { mirrorGlobWarning } from "../presentation/reporter.mjs";
|
|
4
|
-
import { globSync } from "node:fs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import picomatch from "picomatch";
|
|
7
|
-
import { parse } from "yaml";
|
|
8
|
-
//#region src/lib/mirror/infra/workspace-packages.ts
|
|
9
|
-
const PNPM_WORKSPACE = "pnpm-workspace.yaml";
|
|
10
|
-
/** Default when the workspace file is missing or has no `packages` key. */
|
|
11
|
-
const DEFAULT_INCLUDE = ["packages/*"];
|
|
12
|
-
function toPosix(filePath) {
|
|
13
|
-
return filePath.split(path.sep).join("/");
|
|
14
|
-
}
|
|
15
|
-
function isGlobPermissionError(caughtError) {
|
|
16
|
-
if (typeof caughtError !== "object" || caughtError === null || !("code" in caughtError)) return false;
|
|
17
|
-
const code = caughtError.code;
|
|
18
|
-
return code === "EACCES" || code === "EPERM";
|
|
19
|
-
}
|
|
20
|
-
/** Turn a pnpm `packages` glob into a `globSync` pattern that finds `package.json` files. */
|
|
21
|
-
function workspacePatternToPackageJsonGlob(pattern) {
|
|
22
|
-
const normalizedPattern = toPosix(pattern.trim()).replace(/\/+$/, "");
|
|
23
|
-
if (!normalizedPattern) return "**/package.json";
|
|
24
|
-
return `${normalizedPattern}/package.json`;
|
|
25
|
-
}
|
|
26
|
-
function splitWorkspacePackageEntries(raw) {
|
|
27
|
-
const include = [];
|
|
28
|
-
const exclude = [];
|
|
29
|
-
if (!Array.isArray(raw)) return {
|
|
30
|
-
include,
|
|
31
|
-
exclude
|
|
32
|
-
};
|
|
33
|
-
for (const entry of raw) {
|
|
34
|
-
if (typeof entry !== "string") continue;
|
|
35
|
-
const trimmed = entry.trim();
|
|
36
|
-
if (!trimmed) continue;
|
|
37
|
-
if (trimmed.startsWith("!")) exclude.push(trimmed.slice(1).trim());
|
|
38
|
-
else include.push(trimmed);
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
include,
|
|
42
|
-
exclude
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Reads `packages` from a parsed pnpm workspace document.
|
|
47
|
-
* @throws If the document is invalid or `packages` is present but not an array.
|
|
48
|
-
*/
|
|
49
|
-
function parsePnpmWorkspaceDocument(doc) {
|
|
50
|
-
if (doc === null || doc === void 0) throw new Error(`${PNPM_WORKSPACE} root document must be an object (got empty or null)`);
|
|
51
|
-
if (typeof doc !== "object" || Array.isArray(doc)) throw new Error(`${PNPM_WORKSPACE} root must be a mapping, not an array or scalar`);
|
|
52
|
-
const parsedDoc = doc;
|
|
53
|
-
if (!Object.prototype.hasOwnProperty.call(parsedDoc, "packages")) return {
|
|
54
|
-
include: [],
|
|
55
|
-
exclude: [],
|
|
56
|
-
hasPackagesKey: false,
|
|
57
|
-
isEmptyPackagesArray: false
|
|
58
|
-
};
|
|
59
|
-
const pkgs = parsedDoc.packages;
|
|
60
|
-
if (!Array.isArray(pkgs)) throw new Error(`${PNPM_WORKSPACE} field "packages" must be an array`);
|
|
61
|
-
if (pkgs.length === 0) return {
|
|
62
|
-
include: [],
|
|
63
|
-
exclude: [],
|
|
64
|
-
hasPackagesKey: true,
|
|
65
|
-
isEmptyPackagesArray: true
|
|
66
|
-
};
|
|
67
|
-
return {
|
|
68
|
-
...splitWorkspacePackageEntries(pkgs),
|
|
69
|
-
hasPackagesKey: true,
|
|
70
|
-
isEmptyPackagesArray: false
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
async function readWorkspaceYaml(rootDir, fs) {
|
|
74
|
-
const workspaceYamlPath = path.join(rootDir, PNPM_WORKSPACE);
|
|
75
|
-
if (!fs.existsSync(workspaceYamlPath)) return { exists: false };
|
|
76
|
-
let raw;
|
|
77
|
-
try {
|
|
78
|
-
raw = await fs.readFile(workspaceYamlPath, "utf8");
|
|
79
|
-
} catch (caughtReadError) {
|
|
80
|
-
throw new Error(`Failed to read ${PNPM_WORKSPACE}: ${messageFromCaughtUnknown(caughtReadError)}`);
|
|
81
|
-
}
|
|
82
|
-
let doc;
|
|
83
|
-
try {
|
|
84
|
-
doc = parse(raw);
|
|
85
|
-
} catch (caughtYamlParseError) {
|
|
86
|
-
throw new Error(`Failed to parse ${PNPM_WORKSPACE}: ${messageFromCaughtUnknown(caughtYamlParseError)}`);
|
|
87
|
-
}
|
|
88
|
-
if (doc === null || doc === void 0) throw new Error(`${PNPM_WORKSPACE} must define a mapping at the document root`);
|
|
89
|
-
return {
|
|
90
|
-
exists: true,
|
|
91
|
-
doc
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Workspace package directories relative to `rootDir` (POSIX slashes), sorted.
|
|
96
|
-
* Reads `pnpm-workspace.yaml` when present; otherwise uses `packages/*`.
|
|
97
|
-
* Only paths with a `package.json` are returned (same practical rule as pnpm).
|
|
98
|
-
*/
|
|
99
|
-
async function findWorkspacePackageRelPaths(rootDir, fs, logger) {
|
|
100
|
-
const workspaceYaml = await readWorkspaceYaml(rootDir, fs);
|
|
101
|
-
let include;
|
|
102
|
-
let exclude;
|
|
103
|
-
let multiSource;
|
|
104
|
-
if (!workspaceYaml.exists) {
|
|
105
|
-
include = [...DEFAULT_INCLUDE];
|
|
106
|
-
exclude = [];
|
|
107
|
-
multiSource = "default-patterns";
|
|
108
|
-
} else {
|
|
109
|
-
const parsed = parsePnpmWorkspaceDocument(workspaceYaml.doc);
|
|
110
|
-
if (!parsed.hasPackagesKey) {
|
|
111
|
-
include = [...DEFAULT_INCLUDE];
|
|
112
|
-
exclude = [];
|
|
113
|
-
multiSource = "default-patterns";
|
|
114
|
-
} else if (parsed.isEmptyPackagesArray) return {
|
|
115
|
-
relPaths: [],
|
|
116
|
-
multiSource: "declared-empty"
|
|
117
|
-
};
|
|
118
|
-
else {
|
|
119
|
-
include = parsed.include;
|
|
120
|
-
exclude = parsed.exclude;
|
|
121
|
-
multiSource = "pnpm-workspace-yaml";
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const found = /* @__PURE__ */ new Set();
|
|
125
|
-
const globOpts = {
|
|
126
|
-
cwd: rootDir,
|
|
127
|
-
posix: true,
|
|
128
|
-
...path.sep === "\\" ? { windowsPathsNoEscape: true } : {}
|
|
129
|
-
};
|
|
130
|
-
for (const pattern of include) {
|
|
131
|
-
const globPat = workspacePatternToPackageJsonGlob(pattern);
|
|
132
|
-
let matches;
|
|
133
|
-
try {
|
|
134
|
-
matches = globSync(globPat, globOpts);
|
|
135
|
-
} catch (caughtGlobError) {
|
|
136
|
-
if (isGlobPermissionError(caughtGlobError)) {
|
|
137
|
-
mirrorGlobWarning(logger, `Skipping workspace glob "${pattern}" (${messageFromCaughtUnknown(caughtGlobError)})`);
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
throw new Error(`Invalid workspace glob "${pattern}": ${messageFromCaughtUnknown(caughtGlobError)}`);
|
|
141
|
-
}
|
|
142
|
-
for (const matchedPath of matches) {
|
|
143
|
-
const posix = toPosix(matchedPath);
|
|
144
|
-
if (!posix.endsWith("/package.json")) continue;
|
|
145
|
-
const rel = posix.slice(0, -13);
|
|
146
|
-
if (!rel) continue;
|
|
147
|
-
found.add(normalizePath(rel));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
const excludeMatchers = exclude.map((pat) => picomatch(pat, { dot: true }));
|
|
151
|
-
const relPaths = [...found].filter((rel) => !excludeMatchers.some((isMatch) => isMatch(rel)));
|
|
152
|
-
relPaths.sort((a, b) => a.localeCompare(b));
|
|
153
|
-
return {
|
|
154
|
-
relPaths,
|
|
155
|
-
multiSource
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
export { findWorkspacePackageRelPaths, parsePnpmWorkspaceDocument, splitWorkspacePackageEntries, workspacePatternToPackageJsonGlob };
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { messageFromCaughtUnknown } from "../../infra/caught-unknown-message.mjs";
|
|
2
|
-
import { printConfigSchemaWarnings } from "../../infra/config-reporter.mjs";
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
//#region src/lib/mirror/presentation/reporter.ts
|
|
5
|
-
const Colors = {
|
|
6
|
-
RESET: "\x1B[0m",
|
|
7
|
-
BOLD: "\x1B[1m",
|
|
8
|
-
DIM: "\x1B[2m",
|
|
9
|
-
GREEN: "\x1B[32m",
|
|
10
|
-
YELLOW: "\x1B[33m",
|
|
11
|
-
CYAN: "\x1B[36m",
|
|
12
|
-
GRAY: "\x1B[90m",
|
|
13
|
-
MAGENTA: "\x1B[35m",
|
|
14
|
-
BRIGHT_GREEN: "\x1B[92m",
|
|
15
|
-
BRIGHT_YELLOW: "\x1B[93m",
|
|
16
|
-
BRIGHT_CYAN: "\x1B[96m",
|
|
17
|
-
disable() {
|
|
18
|
-
for (const key of Object.keys(this)) if (typeof this[key] === "string") this[key] = "";
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
function configureMirrorColors(noColor) {
|
|
22
|
-
if (!process.stdout.isTTY || noColor) Colors.disable();
|
|
23
|
-
}
|
|
24
|
-
function printMirrorConfigWarnings(logger, warnings) {
|
|
25
|
-
printConfigSchemaWarnings(logger, warnings);
|
|
26
|
-
}
|
|
27
|
-
function mirrorGlobWarning(logger, message) {
|
|
28
|
-
const { out } = logger;
|
|
29
|
-
out(`${Colors.YELLOW}⚠ ${message}${Colors.RESET}`);
|
|
30
|
-
}
|
|
31
|
-
function logSkippedWorkspacePackage(logger, index, total, displayName, reason) {
|
|
32
|
-
const { out } = logger;
|
|
33
|
-
out(`${`${Colors.DIM}[${index}/${total}]${Colors.RESET}`} ${Colors.GRAY}○${Colors.RESET} ${Colors.DIM}${displayName}${Colors.RESET}`);
|
|
34
|
-
out(` ${Colors.DIM}└─${Colors.RESET} ${Colors.GRAY}Skipped: ${reason}${Colors.RESET}`);
|
|
35
|
-
out("");
|
|
36
|
-
}
|
|
37
|
-
function mirrorBanner(logger) {
|
|
38
|
-
const { out } = logger;
|
|
39
|
-
out(`\n${Colors.BOLD}${Colors.CYAN}📦 Mirror — package exports${Colors.RESET}`);
|
|
40
|
-
out(`${Colors.DIM}${"═".repeat(60)}${Colors.RESET}\n`);
|
|
41
|
-
}
|
|
42
|
-
function mirrorProcessingMode(logger, mode) {
|
|
43
|
-
const { out } = logger;
|
|
44
|
-
if (mode.kind === "single") {
|
|
45
|
-
out(`${Colors.DIM}Processing single package...${Colors.RESET}\n`);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
switch (mode.source) {
|
|
49
|
-
case "default-patterns":
|
|
50
|
-
out(`${Colors.DIM}Discovering workspace packages using default patterns (packages/*)…${Colors.RESET}\n`);
|
|
51
|
-
break;
|
|
52
|
-
case "pnpm-workspace-yaml":
|
|
53
|
-
out(`${Colors.DIM}Discovering workspace packages from pnpm-workspace.yaml…${Colors.RESET}\n`);
|
|
54
|
-
break;
|
|
55
|
-
case "declared-empty":
|
|
56
|
-
out(`${Colors.DIM}pnpm-workspace.yaml declares an empty workspace package list.${Colors.RESET}\n`);
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function mirrorNoPackages(logger) {
|
|
61
|
-
logger.out(`${Colors.YELLOW}⚠ No packages found${Colors.RESET}`);
|
|
62
|
-
}
|
|
63
|
-
function logPackageSuccess(logger, index, total, pkgStats, generatedDistAssetCounts, verbose) {
|
|
64
|
-
const { out } = logger;
|
|
65
|
-
out(`${`${Colors.DIM}[${index}/${total}]${Colors.RESET}`} ${Colors.BRIGHT_GREEN}✓${Colors.RESET} ${Colors.BOLD}${pkgStats.name}${Colors.RESET}`);
|
|
66
|
-
if (verbose) {
|
|
67
|
-
out(` ${Colors.DIM}├─${Colors.RESET} Path: ${pkgStats.path}`);
|
|
68
|
-
if (pkgStats.hasTransform) out(` ${Colors.DIM}├─${Colors.RESET} ${Colors.CYAN}Custom path transformation${Colors.RESET}`);
|
|
69
|
-
if (pkgStats.cssConfigStatus) out(` ${Colors.DIM}├─${Colors.RESET} ${Colors.CYAN}${pkgStats.cssConfigStatus === "disabled" ? "CSS disabled" : "CSS configured"}${Colors.RESET}`);
|
|
70
|
-
}
|
|
71
|
-
const breakdown = [];
|
|
72
|
-
if (generatedDistAssetCounts.jsCount > 0) breakdown.push(`${Colors.GREEN}${generatedDistAssetCounts.jsCount} modules${Colors.RESET}`);
|
|
73
|
-
if (generatedDistAssetCounts.cssCount > 0) breakdown.push(`${Colors.MAGENTA}${generatedDistAssetCounts.cssCount} CSS${Colors.RESET}`);
|
|
74
|
-
if (pkgStats.customExports > 0) breakdown.push(`${Colors.YELLOW}${pkgStats.customExports} custom${Colors.RESET}`);
|
|
75
|
-
if (breakdown.length > 0) out(` ${Colors.DIM}└─${Colors.RESET} ${breakdown.join(" + ")} = ${Colors.BRIGHT_CYAN}${pkgStats.totalExports} exports${Colors.RESET}`);
|
|
76
|
-
else out(` ${Colors.DIM}└─${Colors.RESET} ${Colors.BRIGHT_CYAN}${pkgStats.totalExports} exports${Colors.RESET}`);
|
|
77
|
-
out("");
|
|
78
|
-
}
|
|
79
|
-
function logPrunedStaleExport(logger, exportSpecifier) {
|
|
80
|
-
logger.out(` ${Colors.DIM}└─${Colors.RESET} ${Colors.GRAY}Pruned stale export: ${exportSpecifier}${Colors.RESET}`);
|
|
81
|
-
}
|
|
82
|
-
function logPackageError(logger, index, total, displayName, errValue, verbose) {
|
|
83
|
-
const { out, err: errLine } = logger;
|
|
84
|
-
out(`${Colors.DIM}[${index}/${total}]${Colors.RESET} ${Colors.YELLOW}✗${Colors.RESET} ${Colors.BOLD}${displayName}${Colors.RESET}`);
|
|
85
|
-
out(` ${Colors.DIM}└─${Colors.RESET} ${Colors.YELLOW}Error: ${messageFromCaughtUnknown(errValue)}${Colors.RESET}\n`);
|
|
86
|
-
if (verbose) errLine(errValue instanceof Error && errValue.stack ? errValue.stack : messageFromCaughtUnknown(errValue));
|
|
87
|
-
}
|
|
88
|
-
function mirrorSummarySeparator(logger) {
|
|
89
|
-
logger.out(`${Colors.DIM}${"═".repeat(60)}${Colors.RESET}`);
|
|
90
|
-
}
|
|
91
|
-
function mirrorSummary(logger, stats, elapsedSeconds) {
|
|
92
|
-
const { out } = logger;
|
|
93
|
-
out(`${Colors.BOLD}📊 Summary${Colors.RESET} ${Colors.DIM}(completed in ${elapsedSeconds.toFixed(2)}s)${Colors.RESET}\n`);
|
|
94
|
-
out(` ${Colors.BOLD}Packages:${Colors.RESET}`);
|
|
95
|
-
out(` ${Colors.DIM}├─${Colors.RESET} Processed: ${Colors.GREEN}${stats.packagesProcessed}${Colors.RESET}`);
|
|
96
|
-
if (stats.packagesSkipped > 0) out(` ${Colors.DIM}├─${Colors.RESET} Skipped: ${Colors.GRAY}${stats.packagesSkipped}${Colors.RESET}`);
|
|
97
|
-
if (stats.packagesErrored > 0) out(` ${Colors.DIM}├─${Colors.RESET} Errors: ${Colors.YELLOW}${stats.packagesErrored}${Colors.RESET}`);
|
|
98
|
-
out(` ${Colors.DIM}└─${Colors.RESET} Total found: ${stats.packagesFound}\n`);
|
|
99
|
-
out(` ${Colors.BOLD}Exports:${Colors.RESET}`);
|
|
100
|
-
out(` ${Colors.DIM}├─${Colors.RESET} JS Modules: ${Colors.CYAN}${stats.totalJsModules}${Colors.RESET}`);
|
|
101
|
-
out(` ${Colors.DIM}├─${Colors.RESET} CSS Files: ${Colors.MAGENTA}${stats.totalCssExports}${Colors.RESET}`);
|
|
102
|
-
out(` ${Colors.DIM}└─${Colors.RESET} Total: ${Colors.BRIGHT_CYAN}${stats.totalExports}${Colors.RESET}\n`);
|
|
103
|
-
out(`${Colors.DIM}${"═".repeat(60)}${Colors.RESET}\n`);
|
|
104
|
-
}
|
|
105
|
-
function mirrorFatalError(logger, caughtError) {
|
|
106
|
-
const { out, err: errLine } = logger;
|
|
107
|
-
out(`${Colors.YELLOW}Fatal error: ${messageFromCaughtUnknown(caughtError)}${Colors.RESET}`);
|
|
108
|
-
errLine(caughtError instanceof Error && caughtError.stack ? caughtError.stack : messageFromCaughtUnknown(caughtError));
|
|
109
|
-
}
|
|
110
|
-
//#endregion
|
|
111
|
-
export { configureMirrorColors, logPackageError, logPackageSuccess, logPrunedStaleExport, logSkippedWorkspacePackage, mirrorBanner, mirrorFatalError, mirrorGlobWarning, mirrorNoPackages, mirrorProcessingMode, mirrorSummary, mirrorSummarySeparator, printMirrorConfigWarnings };
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { messageFromCaughtUnknown } from "../../infra/caught-unknown-message.mjs";
|
|
2
|
-
import { applyEditsDescending, indentOfLineContaining } from "../../arrange/domain/ast/ast-helpers.mjs";
|
|
3
|
-
import { walkTsxFiles } from "../../arrange/infra/walk.mjs";
|
|
4
|
-
import "../../arrange/index.mjs";
|
|
5
|
-
import { resolveTagTargetCandidates } from "../infra/target-resolver.mjs";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import ts from "typescript";
|
|
8
|
-
//#region src/lib/tag/application/engine.ts
|
|
9
|
-
const PACKAGE_JSON = "package.json";
|
|
10
|
-
const VERSION_TAG = "@since";
|
|
11
|
-
function hasExportModifier(node) {
|
|
12
|
-
return (ts.canHaveModifiers(node) ? ts.getModifiers(node) : void 0)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false;
|
|
13
|
-
}
|
|
14
|
-
function isTaggableDeclaration(node) {
|
|
15
|
-
return ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node) || ts.isVariableStatement(node);
|
|
16
|
-
}
|
|
17
|
-
function addDeclarationName(registry, name, declaration) {
|
|
18
|
-
if (!registry.has(name)) {
|
|
19
|
-
registry.set(name, new Set([declaration]));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
registry.get(name).add(declaration);
|
|
23
|
-
}
|
|
24
|
-
function collectLocalNamedDeclarations(sf) {
|
|
25
|
-
const declarations = /* @__PURE__ */ new Map();
|
|
26
|
-
for (const statement of sf.statements) {
|
|
27
|
-
if (ts.isFunctionDeclaration(statement) && statement.name) {
|
|
28
|
-
addDeclarationName(declarations, statement.name.text, statement);
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (ts.isClassDeclaration(statement) && statement.name) {
|
|
32
|
-
addDeclarationName(declarations, statement.name.text, statement);
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (ts.isInterfaceDeclaration(statement)) {
|
|
36
|
-
addDeclarationName(declarations, statement.name.text, statement);
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (ts.isTypeAliasDeclaration(statement)) {
|
|
40
|
-
addDeclarationName(declarations, statement.name.text, statement);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (ts.isEnumDeclaration(statement)) {
|
|
44
|
-
addDeclarationName(declarations, statement.name.text, statement);
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
if (!ts.isVariableStatement(statement)) continue;
|
|
48
|
-
for (const declaration of statement.declarationList.declarations) if (ts.isIdentifier(declaration.name)) addDeclarationName(declarations, declaration.name.text, statement);
|
|
49
|
-
}
|
|
50
|
-
return declarations;
|
|
51
|
-
}
|
|
52
|
-
function collectExportedDeclarations(sf) {
|
|
53
|
-
const exported = /* @__PURE__ */ new Set();
|
|
54
|
-
const localNamed = collectLocalNamedDeclarations(sf);
|
|
55
|
-
for (const statement of sf.statements) {
|
|
56
|
-
if (isTaggableDeclaration(statement) && hasExportModifier(statement)) {
|
|
57
|
-
exported.add(statement);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (ts.isExportDeclaration(statement) && !statement.moduleSpecifier && statement.exportClause && ts.isNamedExports(statement.exportClause)) {
|
|
61
|
-
for (const element of statement.exportClause.elements) {
|
|
62
|
-
const localName = element.propertyName?.text ?? element.name.text;
|
|
63
|
-
const declarations = localNamed.get(localName);
|
|
64
|
-
if (!declarations) continue;
|
|
65
|
-
for (const declaration of declarations) exported.add(declaration);
|
|
66
|
-
}
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (!ts.isExportAssignment(statement) || !ts.isIdentifier(statement.expression)) continue;
|
|
70
|
-
const declarations = localNamed.get(statement.expression.text);
|
|
71
|
-
if (!declarations) continue;
|
|
72
|
-
for (const declaration of declarations) exported.add(declaration);
|
|
73
|
-
}
|
|
74
|
-
return exported;
|
|
75
|
-
}
|
|
76
|
-
function makeJSDocSinceLine(existingComment, sourceText, version) {
|
|
77
|
-
const commentText = sourceText.slice(existingComment.pos, existingComment.end);
|
|
78
|
-
const baseIndent = indentOfLineContaining(sourceText, existingComment.pos);
|
|
79
|
-
const normalizedBodyLines = commentText.replace(/^\/\*\*\s?/, "").replace(/\s*\*\/$/, "").split("\n").map((line) => line.replace(/^\s*\*\s?/, "").replace(/\s+$/, "")).filter((line, lineIndex, lines) => {
|
|
80
|
-
if (line.length > 0) return true;
|
|
81
|
-
const hasNonEmptyBefore = lines.slice(0, lineIndex).some((value) => value.length > 0);
|
|
82
|
-
const hasNonEmptyAfter = lines.slice(lineIndex + 1).some((value) => value.length > 0);
|
|
83
|
-
return hasNonEmptyBefore && hasNonEmptyAfter;
|
|
84
|
-
});
|
|
85
|
-
const replacement = `/**\n${normalizedBodyLines.length > 0 ? `${normalizedBodyLines.map((line) => `${baseIndent} * ${line}`).join("\n")}\n${baseIndent} *\n` : ""}${baseIndent} * ${VERSION_TAG} ${version}\n${baseIndent} */`;
|
|
86
|
-
return {
|
|
87
|
-
start: existingComment.pos,
|
|
88
|
-
end: existingComment.end,
|
|
89
|
-
replacement
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function makeSinceOnlyJSDocBlock(declarationIndent, version) {
|
|
93
|
-
return `/**\n${declarationIndent} * ${VERSION_TAG} ${version}\n${declarationIndent} */`;
|
|
94
|
-
}
|
|
95
|
-
function makeDeclarationSinceLine(declaration, sf, sourceText, version) {
|
|
96
|
-
if (ts.getJSDocTags(declaration).some((tag) => tag.tagName.text === "since")) return;
|
|
97
|
-
const lastJsDoc = ts.getJSDocCommentsAndTags(declaration).filter(ts.isJSDoc).at(-1);
|
|
98
|
-
if (lastJsDoc) return makeJSDocSinceLine(lastJsDoc, sourceText, version);
|
|
99
|
-
const start = declaration.getStart(sf);
|
|
100
|
-
const indent = indentOfLineContaining(sourceText, start);
|
|
101
|
-
return {
|
|
102
|
-
start,
|
|
103
|
-
end: start,
|
|
104
|
-
replacement: `${indent}${makeSinceOnlyJSDocBlock(indent, version)}\n${indent}`
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function applySinceTagsToFile(filePath, version, fs, write) {
|
|
108
|
-
const sourceText = fs.readFileSync(filePath, "utf8");
|
|
109
|
-
const sf = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
110
|
-
const edits = [];
|
|
111
|
-
for (const declaration of collectExportedDeclarations(sf)) {
|
|
112
|
-
const edit = makeDeclarationSinceLine(declaration, sf, sourceText, version);
|
|
113
|
-
if (edit) edits.push(edit);
|
|
114
|
-
}
|
|
115
|
-
if (edits.length > 0 && write) {
|
|
116
|
-
const updated = applyEditsDescending(sourceText, edits);
|
|
117
|
-
fs.writeFileSync(filePath, updated, "utf8");
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
filePath,
|
|
121
|
-
taggedDeclarations: edits.length,
|
|
122
|
-
changed: edits.length > 0
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
function resolveNearestPackageVersion(targetPath, fs) {
|
|
126
|
-
const resolved = path.resolve(targetPath);
|
|
127
|
-
let current = fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved);
|
|
128
|
-
while (true) {
|
|
129
|
-
const packageJsonPath = path.join(current, PACKAGE_JSON);
|
|
130
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
131
|
-
const raw = fs.readFileSync(packageJsonPath, "utf8");
|
|
132
|
-
const version = JSON.parse(raw).version;
|
|
133
|
-
if (typeof version === "string" && version.length > 0) return version;
|
|
134
|
-
throw new Error(`Missing or invalid version in ${packageJsonPath}`);
|
|
135
|
-
}
|
|
136
|
-
const parent = path.dirname(current);
|
|
137
|
-
if (parent === current) break;
|
|
138
|
-
current = parent;
|
|
139
|
-
}
|
|
140
|
-
throw new Error(`Unable to locate ${PACKAGE_JSON} from target: ${targetPath}`);
|
|
141
|
-
}
|
|
142
|
-
function runTagOnTarget(targetPath, opts, fs) {
|
|
143
|
-
const resolvedTarget = path.resolve(targetPath);
|
|
144
|
-
const version = resolveNearestPackageVersion(resolvedTarget, fs);
|
|
145
|
-
const tsFiles = (fs.statSync(resolvedTarget).isDirectory() ? walkTsxFiles(resolvedTarget, fs) : [resolvedTarget]).filter((filePath) => filePath.endsWith(".ts") || filePath.endsWith(".tsx"));
|
|
146
|
-
const fileResults = tsFiles.map((filePath) => applySinceTagsToFile(filePath, version, fs, opts.write));
|
|
147
|
-
const filesChanged = fileResults.filter((result) => result.changed).length;
|
|
148
|
-
const taggedDeclarations = fileResults.reduce((sum, result) => sum + result.taggedDeclarations, 0);
|
|
149
|
-
return {
|
|
150
|
-
version,
|
|
151
|
-
filesScanned: tsFiles.length,
|
|
152
|
-
filesChanged,
|
|
153
|
-
taggedDeclarations,
|
|
154
|
-
fileResults
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
async function runTagOnAfterWriteHook(hook, modifiedFiles) {
|
|
158
|
-
if (!hook || modifiedFiles.length === 0) return null;
|
|
159
|
-
try {
|
|
160
|
-
await hook({ files: modifiedFiles });
|
|
161
|
-
return null;
|
|
162
|
-
} catch (caughtHookError) {
|
|
163
|
-
return `[tag] onAfterWrite hook failed: ${messageFromCaughtUnknown(caughtHookError)}`;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function summarizeVersions(targetResults) {
|
|
167
|
-
const distinctVersions = extractDistinctVersions(targetResults);
|
|
168
|
-
if (distinctVersions.size === 0) return "none";
|
|
169
|
-
if (distinctVersions.size > 1) return "mixed";
|
|
170
|
-
return [...distinctVersions][0];
|
|
171
|
-
}
|
|
172
|
-
function extractDistinctVersions(targetResults) {
|
|
173
|
-
return new Set(targetResults.map((targetResult) => targetResult.result?.version).filter((version) => typeof version === "string" && version.length > 0));
|
|
174
|
-
}
|
|
175
|
-
function chooseWorkspacePackageTargetPath(candidate, fs) {
|
|
176
|
-
if (candidate.source !== "workspace-package") return {
|
|
177
|
-
targetPath: candidate.candidatePath,
|
|
178
|
-
source: candidate.source
|
|
179
|
-
};
|
|
180
|
-
const preferredSourceDir = path.join(candidate.candidatePath, "src");
|
|
181
|
-
if (fs.existsSync(preferredSourceDir) && fs.statSync(preferredSourceDir).isDirectory()) return {
|
|
182
|
-
targetPath: preferredSourceDir,
|
|
183
|
-
source: "workspace-package-selected-src"
|
|
184
|
-
};
|
|
185
|
-
return {
|
|
186
|
-
targetPath: candidate.candidatePath,
|
|
187
|
-
source: "workspace-package-selected-root"
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function resolveTargetSelection(candidate, rootDir, fs) {
|
|
191
|
-
const selectedTarget = chooseWorkspacePackageTargetPath(candidate, fs);
|
|
192
|
-
const rootRelativeTargetPath = path.relative(rootDir, selectedTarget.targetPath).split(path.sep).join("/");
|
|
193
|
-
return {
|
|
194
|
-
targetPath: selectedTarget.targetPath,
|
|
195
|
-
rootRelativeTargetPath: rootRelativeTargetPath || ".",
|
|
196
|
-
source: selectedTarget.source,
|
|
197
|
-
packageDir: candidate.packageDir,
|
|
198
|
-
packageName: candidate.packageName
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function filterSkippedCandidates(targetCandidates, skipPackages) {
|
|
202
|
-
if (!skipPackages || skipPackages.length === 0) return {
|
|
203
|
-
includedCandidates: targetCandidates,
|
|
204
|
-
skippedPackages: []
|
|
205
|
-
};
|
|
206
|
-
const skipPackageSet = new Set(skipPackages);
|
|
207
|
-
const includedCandidates = [];
|
|
208
|
-
const skippedPackages = [];
|
|
209
|
-
for (const candidate of targetCandidates) {
|
|
210
|
-
const packageName = candidate.packageName;
|
|
211
|
-
if (packageName && skipPackageSet.has(packageName)) {
|
|
212
|
-
skippedPackages.push(packageName);
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
includedCandidates.push(candidate);
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
includedCandidates,
|
|
219
|
-
skippedPackages
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
async function runOnResolvedTarget(resolvedTarget, write, fs, listener) {
|
|
223
|
-
listener?.onTargetStarted(resolvedTarget);
|
|
224
|
-
const absoluteTargetPath = path.resolve(resolvedTarget.targetPath);
|
|
225
|
-
if (!fs.existsSync(absoluteTargetPath)) {
|
|
226
|
-
const missingTargetResult = {
|
|
227
|
-
target: resolvedTarget,
|
|
228
|
-
targetExists: false,
|
|
229
|
-
runError: `Not found: ${absoluteTargetPath}`,
|
|
230
|
-
result: null
|
|
231
|
-
};
|
|
232
|
-
listener?.onTargetCompleted(resolvedTarget, missingTargetResult);
|
|
233
|
-
return missingTargetResult;
|
|
234
|
-
}
|
|
235
|
-
try {
|
|
236
|
-
const targetRunResult = {
|
|
237
|
-
target: resolvedTarget,
|
|
238
|
-
targetExists: true,
|
|
239
|
-
runError: null,
|
|
240
|
-
result: runTagOnTarget(absoluteTargetPath, { write }, fs)
|
|
241
|
-
};
|
|
242
|
-
listener?.onTargetCompleted(resolvedTarget, targetRunResult);
|
|
243
|
-
return targetRunResult;
|
|
244
|
-
} catch (caughtRunError) {
|
|
245
|
-
const failedTargetRunResult = {
|
|
246
|
-
target: resolvedTarget,
|
|
247
|
-
targetExists: true,
|
|
248
|
-
runError: messageFromCaughtUnknown(caughtRunError),
|
|
249
|
-
result: null
|
|
250
|
-
};
|
|
251
|
-
listener?.onTargetCompleted(resolvedTarget, failedTargetRunResult);
|
|
252
|
-
return failedTargetRunResult;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* CLI entry: run tagging and optional `onAfterWrite` using config injected by the command layer.
|
|
257
|
-
* Returns structured execution data; presentation/logging belongs to command layer.
|
|
258
|
-
*/
|
|
259
|
-
async function runTagSync(opts) {
|
|
260
|
-
const { fs } = opts;
|
|
261
|
-
const { includedCandidates, skippedPackages } = filterSkippedCandidates(await resolveTagTargetCandidates(opts.rootDir, opts.targetPath, fs), opts.skipPackages);
|
|
262
|
-
const selectedTargets = includedCandidates.map((candidate) => resolveTargetSelection(candidate, opts.rootDir, fs));
|
|
263
|
-
const targetResults = await Promise.all(selectedTargets.map((resolvedTarget) => runOnResolvedTarget(resolvedTarget, opts.write, fs, opts.listener)));
|
|
264
|
-
const allFileResults = targetResults.flatMap((targetResult) => targetResult.result?.fileResults ?? []);
|
|
265
|
-
const filesScanned = targetResults.reduce((sum, targetResult) => sum + (targetResult.result?.filesScanned ?? 0), 0);
|
|
266
|
-
const filesChanged = targetResults.reduce((sum, targetResult) => sum + (targetResult.result?.filesChanged ?? 0), 0);
|
|
267
|
-
const taggedDeclarations = targetResults.reduce((sum, targetResult) => sum + (targetResult.result?.taggedDeclarations ?? 0), 0);
|
|
268
|
-
const modifiedFiles = allFileResults.filter((entry) => entry.changed).map((entry) => entry.filePath);
|
|
269
|
-
const hookError = opts.write && modifiedFiles.length > 0 ? await runTagOnAfterWriteHook(opts.config?.onAfterWrite, modifiedFiles) : null;
|
|
270
|
-
const distinctVersions = [...extractDistinctVersions(targetResults)].sort((left, right) => left.localeCompare(right));
|
|
271
|
-
return {
|
|
272
|
-
mode: opts.write ? "applied" : "dry-run",
|
|
273
|
-
selectedTargets,
|
|
274
|
-
resolvedTargets: selectedTargets,
|
|
275
|
-
skippedPackages,
|
|
276
|
-
targetResults,
|
|
277
|
-
filesScanned,
|
|
278
|
-
filesChanged,
|
|
279
|
-
taggedDeclarations,
|
|
280
|
-
versionSummary: summarizeVersions(targetResults),
|
|
281
|
-
distinctVersions,
|
|
282
|
-
modifiedFiles,
|
|
283
|
-
hookError
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
//#endregion
|
|
287
|
-
export { resolveNearestPackageVersion, runTagOnTarget, runTagSync };
|
package/dist/lib/tag/index.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createNodeCliFs, createNodeCliLogger } from "../infra/node-io.mjs";
|
|
2
|
-
import { resolveNearestPackageVersion, runTagOnTarget, runTagSync } from "./application/engine.mjs";
|
|
3
|
-
import { createTagProgressListener, formatProgress, formatSummary, formatTargetTable, formatWarningsAndErrors } from "./presentation/tag-presenter.mjs";
|
|
4
|
-
export { createNodeCliFs, createNodeCliLogger, createTagProgressListener, formatProgress, formatSummary, formatTargetTable, formatWarningsAndErrors, resolveNearestPackageVersion, runTagOnTarget, runTagSync };
|