@codefast/cli 0.3.13-canary.0 → 0.3.13-canary.2
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/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 +129 -0
- package/dist/commands/mirror.d.ts +4 -0
- package/dist/commands/mirror.d.ts.map +1 -0
- package/dist/commands/mirror.js +75 -0
- package/dist/commands/tag.d.ts +3 -0
- package/dist/commands/tag.d.ts.map +1 -0
- package/dist/commands/tag.js +41 -0
- package/dist/lib/arrange/application/analyze.d.ts +17 -0
- package/dist/lib/arrange/application/analyze.d.ts.map +1 -0
- package/dist/lib/arrange/application/analyze.js +24 -0
- package/dist/lib/arrange/application/group-file-preview.d.ts +17 -0
- package/dist/lib/arrange/application/group-file-preview.d.ts.map +1 -0
- package/dist/lib/arrange/application/group-file-preview.js +46 -0
- package/dist/lib/arrange/application/group-file.d.ts +5 -0
- package/dist/lib/arrange/application/group-file.d.ts.map +1 -0
- package/dist/lib/arrange/application/group-file.js +40 -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/run-target.d.ts +19 -0
- package/dist/lib/arrange/application/run-target.d.ts.map +1 -0
- package/dist/lib/arrange/application/run-target.js +85 -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.d.ts +28 -0
- package/dist/lib/arrange/domain/ast/ast-helpers.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/ast-helpers.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.d.ts +7 -0
- package/dist/lib/arrange/domain/ast/collectors-cn.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/collectors-cn.js +70 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.d.ts +4 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/collectors-jsx.js +21 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.d.ts +13 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/collectors-tv.js +302 -0
- package/dist/lib/arrange/domain/ast/targets.d.ts +8 -0
- package/dist/lib/arrange/domain/ast/targets.d.ts.map +1 -0
- package/dist/lib/arrange/domain/ast/targets.js +147 -0
- package/dist/lib/arrange/domain/constants.d.ts +68 -0
- package/dist/lib/arrange/domain/constants.d.ts.map +1 -0
- package/dist/lib/arrange/domain/constants.js +180 -0
- package/dist/lib/arrange/domain/errors.d.ts +14 -0
- package/dist/lib/arrange/domain/errors.d.ts.map +1 -0
- package/dist/lib/arrange/domain/errors.js +16 -0
- package/dist/lib/arrange/domain/grouping.d.ts +41 -0
- package/dist/lib/arrange/domain/grouping.d.ts.map +1 -0
- package/dist/lib/arrange/domain/grouping.js +307 -0
- package/dist/lib/arrange/domain/imports.d.ts +7 -0
- package/dist/lib/arrange/domain/imports.d.ts.map +1 -0
- package/dist/lib/arrange/domain/imports.js +80 -0
- package/dist/lib/arrange/domain/source-text-formatters.d.ts +16 -0
- package/dist/lib/arrange/domain/source-text-formatters.d.ts.map +1 -0
- package/dist/lib/arrange/domain/source-text-formatters.js +55 -0
- package/dist/lib/arrange/domain/tokenizer.d.ts +45 -0
- package/dist/lib/arrange/domain/tokenizer.d.ts.map +1 -0
- package/dist/lib/arrange/domain/tokenizer.js +466 -0
- package/dist/lib/arrange/domain/types.d.ts +112 -0
- package/dist/lib/arrange/domain/types.d.ts.map +1 -0
- package/dist/lib/arrange/domain/types.js +7 -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.d.ts +14 -0
- package/dist/lib/arrange/infra/arrange-sync-cli-options.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.d.ts +3 -0
- package/dist/lib/arrange/infra/ensure-cn-import.d.ts.map +1 -0
- package/dist/lib/arrange/infra/ensure-cn-import.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.d.ts +8 -0
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.d.ts.map +1 -0
- package/dist/lib/arrange/infra/merge-cn-literal-pool-for-test.js +25 -0
- package/dist/lib/arrange/infra/ts-ast-translator.d.ts +10 -0
- package/dist/lib/arrange/infra/ts-ast-translator.d.ts.map +1 -0
- package/dist/lib/arrange/infra/ts-ast-translator.js +363 -0
- package/dist/lib/arrange/presentation/formatters.d.ts +3 -0
- package/dist/lib/arrange/presentation/formatters.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/formatters.js +2 -0
- package/dist/lib/arrange/presentation/report.d.ts +4 -0
- package/dist/lib/arrange/presentation/report.d.ts.map +1 -0
- package/dist/lib/arrange/presentation/report.js +37 -0
- package/dist/lib/config/domain/schema.d.ts +50 -0
- package/dist/lib/config/domain/schema.d.ts.map +1 -0
- package/dist/lib/config/domain/schema.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.d.ts +11 -0
- package/dist/lib/config/infra/loader.d.ts.map +1 -0
- package/dist/lib/config/infra/loader.js +90 -0
- package/dist/lib/core/application/architecture-boundaries.d.ts +19 -0
- package/dist/lib/core/application/architecture-boundaries.d.ts.map +1 -0
- package/dist/lib/core/application/architecture-boundaries.js +263 -0
- package/dist/lib/core/application/ports/cli-io.port.d.ts +27 -0
- package/dist/lib/core/application/ports/cli-io.port.d.ts.map +1 -0
- package/dist/lib/core/application/schema-parse.d.ts +8 -0
- package/dist/lib/core/application/schema-parse.d.ts.map +1 -0
- package/dist/lib/core/application/schema-parse.js +20 -0
- package/dist/lib/core/application/utils/caught-unknown-message.d.ts +6 -0
- package/dist/lib/core/application/utils/caught-unknown-message.d.ts.map +1 -0
- package/dist/lib/core/application/utils/caught-unknown-message.js +34 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.d.ts +5 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.d.ts.map +1 -0
- package/dist/lib/core/application/utils/verbose-diagnostics.js +7 -0
- package/dist/lib/core/domain/errors.d.ts +11 -0
- package/dist/lib/core/domain/errors.d.ts.map +1 -0
- package/dist/lib/core/domain/errors.js +9 -0
- package/dist/lib/core/domain/result.d.ts +15 -0
- package/dist/lib/core/domain/result.d.ts.map +1 -0
- package/dist/lib/core/domain/result.js +9 -0
- package/dist/lib/core/infra/container.d.ts +34 -0
- package/dist/lib/core/infra/container.d.ts.map +1 -0
- package/dist/lib/core/infra/container.js +65 -0
- package/dist/lib/core/infra/logging-decorator.d.ts +12 -0
- package/dist/lib/core/infra/logging-decorator.d.ts.map +1 -0
- package/dist/lib/core/infra/logging-decorator.js +75 -0
- package/dist/lib/core/presentation/cli-executor.d.ts +33 -0
- package/dist/lib/core/presentation/cli-executor.d.ts.map +1 -0
- package/dist/lib/core/presentation/cli-executor.js +73 -0
- package/dist/lib/core/presentation/create-command-handler.d.ts +20 -0
- package/dist/lib/core/presentation/create-command-handler.d.ts.map +1 -0
- package/dist/lib/core/presentation/create-command-handler.js +70 -0
- package/dist/lib/core/presentation/format-app-error.d.ts +6 -0
- package/dist/lib/core/presentation/format-app-error.d.ts.map +1 -0
- package/dist/lib/core/presentation/format-app-error.js +19 -0
- package/dist/lib/infra/caught-unknown-message.d.ts +2 -0
- package/dist/lib/infra/caught-unknown-message.d.ts.map +1 -0
- package/dist/lib/infra/caught-unknown-message.js +1 -0
- package/dist/lib/infra/config-reporter.d.ts +4 -0
- package/dist/lib/infra/config-reporter.d.ts.map +1 -0
- package/dist/lib/infra/config-reporter.js +9 -0
- package/dist/lib/infra/fs-contract.d.ts +2 -0
- package/dist/lib/infra/fs-contract.d.ts.map +1 -0
- package/dist/lib/infra/fs-contract.js +1 -0
- package/dist/lib/infra/node-io.d.ts +4 -0
- package/dist/lib/infra/node-io.d.ts.map +1 -0
- package/dist/lib/infra/node-io.js +27 -0
- package/dist/lib/infra/workspace/repo-root.d.ts +7 -0
- package/dist/lib/infra/workspace/repo-root.d.ts.map +1 -0
- package/dist/lib/infra/workspace/repo-root.js +23 -0
- package/dist/lib/mirror/application/engine.d.ts +10 -0
- package/dist/lib/mirror/application/engine.d.ts.map +1 -0
- package/dist/lib/mirror/application/engine.js +271 -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/sync.d.ts +19 -0
- package/dist/lib/mirror/application/sync.d.ts.map +1 -0
- package/dist/lib/mirror/application/sync.js +168 -0
- package/dist/lib/mirror/domain/constants.d.ts +6 -0
- package/dist/lib/mirror/domain/constants.d.ts.map +1 -0
- package/dist/lib/mirror/domain/constants.js +5 -0
- package/dist/lib/mirror/domain/errors.d.ts +10 -0
- package/dist/lib/mirror/domain/errors.d.ts.map +1 -0
- package/dist/lib/mirror/domain/errors.js +12 -0
- package/dist/lib/mirror/domain/types.d.ts +65 -0
- package/dist/lib/mirror/domain/types.d.ts.map +1 -0
- package/dist/lib/mirror/domain/types.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.d.ts +9 -0
- package/dist/lib/mirror/infra/dirent-list.d.ts.map +1 -0
- package/dist/lib/mirror/infra/dirent-list.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.d.ts +14 -0
- package/dist/lib/mirror/infra/mirror-sync-cli-options.d.ts.map +1 -0
- package/dist/lib/mirror/infra/mirror-sync-cli-options.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.d.ts +8 -0
- package/dist/lib/mirror/infra/package-filter.d.ts.map +1 -0
- package/dist/lib/mirror/infra/package-filter.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.d.ts +2 -0
- package/dist/lib/mirror/infra/path-normalizer.d.ts.map +1 -0
- package/dist/lib/mirror/infra/path-normalizer.js +4 -0
- package/dist/lib/mirror/infra/update-pkg.d.ts +19 -0
- package/dist/lib/mirror/infra/update-pkg.d.ts.map +1 -0
- package/dist/lib/mirror/infra/update-pkg.js +156 -0
- package/dist/lib/mirror/infra/workspace-packages.d.ts +26 -0
- package/dist/lib/mirror/infra/workspace-packages.d.ts.map +1 -0
- package/dist/lib/mirror/infra/workspace-packages.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/reporter.d.ts +25 -0
- package/dist/lib/mirror/presentation/reporter.d.ts.map +1 -0
- package/dist/lib/mirror/presentation/reporter.js +140 -0
- package/dist/lib/shared/source-code/domain/text-edit.d.ts +14 -0
- package/dist/lib/shared/source-code/domain/text-edit.d.ts.map +1 -0
- package/dist/lib/shared/source-code/domain/text-edit.js +30 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.d.ts +4 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.d.ts.map +1 -0
- package/dist/lib/shared/source-code/infra/tsx-file-walk.js +37 -0
- package/dist/lib/tag/application/engine.d.ts +23 -0
- package/dist/lib/tag/application/engine.d.ts.map +1 -0
- package/dist/lib/tag/application/engine.js +357 -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/domain/types.d.ts +56 -0
- package/dist/lib/tag/domain/types.d.ts.map +1 -0
- package/dist/lib/tag/domain/types.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.d.ts +14 -0
- package/dist/lib/tag/infra/tag-sync-cli-options.d.ts.map +1 -0
- package/dist/lib/tag/infra/tag-sync-cli-options.js +1 -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/target-resolver.d.ts +4 -0
- package/dist/lib/tag/infra/target-resolver.d.ts.map +1 -0
- package/dist/lib/tag/infra/target-resolver.js +200 -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.d.ts +8 -0
- package/dist/lib/tag/presentation/colors.d.ts.map +1 -0
- package/dist/lib/tag/presentation/colors.js +9 -0
- package/dist/lib/tag/presentation/tag-presenter.d.ts +20 -0
- package/dist/lib/tag/presentation/tag-presenter.d.ts.map +1 -0
- package/dist/lib/tag/presentation/tag-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/analyze-DvtJ3j9m.mjs +0 -92
- package/dist/arrange-Bbh62DrU.mjs +0 -107
- package/dist/arrange-BqP2DI3w.mjs +0 -8
- package/dist/ast-helpers-MDRYuIAk.mjs +0 -115
- package/dist/caught-unknown-message-CRhkDWO7.mjs +0 -20
- package/dist/collectors-cn-BS8TTQ8O.mjs +0 -61
- package/dist/collectors-jsx-D9tL2ZPM.mjs +0 -20
- package/dist/collectors-tv-D2PXZaRt.mjs +0 -170
- package/dist/colors-BjdkCfGK.mjs +0 -12
- package/dist/commands/arrange.mjs +0 -2
- package/dist/commands/mirror.mjs +0 -2
- package/dist/commands/mirror.test.mjs +0 -48
- package/dist/commands/tag.mjs +0 -2
- package/dist/config-DVia_f9a.mjs +0 -3
- package/dist/config-reporter-SCcWDZc1.mjs +0 -10
- package/dist/constants-AtPhF-Ct.mjs +0 -169
- package/dist/constants-Bq5wdyLC.mjs +0 -8
- package/dist/dirent-list-BSDeRG5i.mjs +0 -14
- package/dist/engine-CcWEHSCq.mjs +0 -287
- package/dist/engine-DRTdkc5u.mjs +0 -236
- package/dist/errors-CFH4w6ic.mjs +0 -15
- package/dist/errors-CpU1ogfA.mjs +0 -19
- package/dist/formatters-DGE8jJ53.mjs +0 -52
- package/dist/group-file-ClW7XdD6.mjs +0 -113
- package/dist/grouping-c1grpCQT.mjs +0 -235
- package/dist/imports-DSVq1xhB.mjs +0 -54
- package/dist/lib/arrange/application/analyze.mjs +0 -2
- package/dist/lib/arrange/application/analyze.test.mjs +0 -171
- package/dist/lib/arrange/application/group-file.mjs +0 -2
- package/dist/lib/arrange/application/group-file.test.mjs +0 -273
- package/dist/lib/arrange/application/run-target.mjs +0 -2
- package/dist/lib/arrange/application/run-target.test.mjs +0 -97
- package/dist/lib/arrange/domain/ast/ast-helpers.mjs +0 -2
- package/dist/lib/arrange/domain/ast/ast-helpers.test.mjs +0 -148
- package/dist/lib/arrange/domain/ast/collectors-cn.mjs +0 -2
- package/dist/lib/arrange/domain/ast/collectors-cn.test.mjs +0 -58
- package/dist/lib/arrange/domain/ast/collectors-jsx.mjs +0 -2
- package/dist/lib/arrange/domain/ast/collectors-jsx.test.mjs +0 -20
- package/dist/lib/arrange/domain/ast/collectors-tv.mjs +0 -2
- package/dist/lib/arrange/domain/ast/collectors-tv.test.mjs +0 -145
- package/dist/lib/arrange/domain/ast/targets.mjs +0 -2
- package/dist/lib/arrange/domain/ast/targets.test.mjs +0 -50
- package/dist/lib/arrange/domain/constants.mjs +0 -2
- package/dist/lib/arrange/domain/errors.mjs +0 -2
- package/dist/lib/arrange/domain/grouping.mjs +0 -2
- package/dist/lib/arrange/domain/grouping.test.mjs +0 -186
- package/dist/lib/arrange/domain/imports.mjs +0 -2
- package/dist/lib/arrange/domain/imports.test.mjs +0 -48
- package/dist/lib/arrange/domain/tokenizer.mjs +0 -2
- package/dist/lib/arrange/domain/tokenizer.test.mjs +0 -165
- package/dist/lib/arrange/index.mjs +0 -16
- package/dist/lib/arrange/infra/walk.mjs +0 -2
- package/dist/lib/arrange/infra/walk.test.mjs +0 -50
- package/dist/lib/arrange/presentation/formatters.mjs +0 -2
- package/dist/lib/arrange/presentation/formatters.test.mjs +0 -73
- package/dist/lib/arrange/presentation/report.mjs +0 -2
- package/dist/lib/config/domain/schema.mjs +0 -2
- package/dist/lib/config/index.mjs +0 -4
- package/dist/lib/config/infra/loader.mjs +0 -2
- package/dist/lib/config/infra/loader.test.mjs +0 -116
- package/dist/lib/infra/caught-unknown-message.mjs +0 -2
- package/dist/lib/infra/config-reporter.mjs +0 -2
- package/dist/lib/infra/node-io.mjs +0 -2
- package/dist/lib/infra/workspace/repo-root.mjs +0 -2
- package/dist/lib/infra/workspace/repo-root.test.mjs +0 -45
- package/dist/lib/mirror/application/engine.mjs +0 -2
- package/dist/lib/mirror/application/sync.mjs +0 -2
- package/dist/lib/mirror/application/sync.test.mjs +0 -482
- package/dist/lib/mirror/domain/constants.mjs +0 -2
- package/dist/lib/mirror/domain/errors.mjs +0 -2
- package/dist/lib/mirror/index.mjs +0 -3
- package/dist/lib/mirror/infra/dirent-list.mjs +0 -2
- package/dist/lib/mirror/infra/dirent-list.test.mjs +0 -18
- package/dist/lib/mirror/infra/package-filter.mjs +0 -2
- package/dist/lib/mirror/infra/package-filter.test.mjs +0 -32
- package/dist/lib/mirror/infra/path-normalizer.mjs +0 -2
- package/dist/lib/mirror/infra/update-pkg.mjs +0 -2
- package/dist/lib/mirror/infra/workspace-packages.mjs +0 -2
- package/dist/lib/mirror/infra/workspace-packages.test.mjs +0 -167
- package/dist/lib/mirror/presentation/reporter.mjs +0 -2
- package/dist/lib/tag/application/engine.mjs +0 -2
- package/dist/lib/tag/application/engine.test.mjs +0 -159
- package/dist/lib/tag/index.mjs +0 -5
- package/dist/lib/tag/infra/target-resolver.mjs +0 -2
- package/dist/lib/tag/presentation/colors.mjs +0 -2
- package/dist/lib/tag/presentation/tag-presenter.mjs +0 -2
- package/dist/lib/tag/presentation/tag-presenter.test.mjs +0 -29
- package/dist/loader-DpN-zl5g.mjs +0 -78
- package/dist/mirror-CbGiLXKT.mjs +0 -2
- package/dist/mirror-DqJE3ejL.mjs +0 -66
- package/dist/node-io-DFRbHO6m.mjs +0 -30
- package/dist/package-filter-C_8ryqvz.mjs +0 -26
- package/dist/path-normalizer-D4ceBO3l.mjs +0 -7
- package/dist/program-DR-H4tH3.mjs +0 -34
- package/dist/program.mjs +0 -2
- package/dist/repo-root-HmtIEm6J.mjs +0 -22
- package/dist/report-DYxvw34T.mjs +0 -24
- package/dist/reporter-CwIe_tAM.mjs +0 -108
- package/dist/run-target-CJWrqNT4.mjs +0 -65
- package/dist/schema-Or8RAARd.mjs +0 -25
- package/dist/sync-e1Sp-shi.mjs +0 -157
- package/dist/tag-Cd9JujU5.mjs +0 -2
- package/dist/tag-hEKVZ_-7.mjs +0 -58
- package/dist/tag-presenter-Cs66UBsH.mjs +0 -63
- package/dist/target-resolver-CR3FXMTy.mjs +0 -170
- package/dist/targets-pCTslnFh.mjs +0 -106
- package/dist/tokenizer-CeZx73Zu.mjs +0 -216
- package/dist/update-pkg-CnGfjWBy.mjs +0 -37
- package/dist/walk-DjgQn66n.mjs +0 -33
- package/dist/workspace-packages-K2NYTHJq.mjs +0 -159
- /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.js} +0 -0
- /package/dist/lib/{tag/domain/types.mjs → core/application/ports/cli-io.port.js} +0 -0
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { t as groupFile } from "../../../group-file-ClW7XdD6.mjs";
|
|
2
|
-
import { n as createNodeCliLogger, t as createNodeCliFs } from "../../../node-io-DFRbHO6m.mjs";
|
|
3
|
-
import "../../../arrange-BqP2DI3w.mjs";
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import os from "node:os";
|
|
7
|
-
//#region src/lib/arrange/application/group-file.test.ts
|
|
8
|
-
const arrangeFs = createNodeCliFs();
|
|
9
|
-
const arrangeLogger = createNodeCliLogger();
|
|
10
|
-
function withTempFixture(name, source, fn) {
|
|
11
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "group-file-"));
|
|
12
|
-
const filePath = path.join(dir, name);
|
|
13
|
-
try {
|
|
14
|
-
fs.writeFileSync(filePath, source, "utf8");
|
|
15
|
-
fn(filePath);
|
|
16
|
-
} finally {
|
|
17
|
-
fs.rmSync(dir, {
|
|
18
|
-
recursive: true,
|
|
19
|
-
force: true
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function captureStdout(fn) {
|
|
24
|
-
const chunks = [];
|
|
25
|
-
const spy = jest.spyOn(process.stdout, "write").mockImplementation((chunk) => {
|
|
26
|
-
chunks.push(typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8"));
|
|
27
|
-
return true;
|
|
28
|
-
});
|
|
29
|
-
try {
|
|
30
|
-
fn();
|
|
31
|
-
} finally {
|
|
32
|
-
spy.mockRestore();
|
|
33
|
-
}
|
|
34
|
-
return chunks.join("");
|
|
35
|
-
}
|
|
36
|
-
describe("groupFile", () => {
|
|
37
|
-
it("unwraps cn() inside tv base into string/array form", () => {
|
|
38
|
-
withTempFixture("FixtureTv.tsx", `import { cn, tv } from "@codefast/tailwind-variants";
|
|
39
|
-
|
|
40
|
-
export const styles = tv({
|
|
41
|
-
base: cn("flex gap-2 text-sm rounded-md border px-3 font-medium"),
|
|
42
|
-
});
|
|
43
|
-
`, (filePath) => {
|
|
44
|
-
const result = groupFile(filePath, {
|
|
45
|
-
write: true,
|
|
46
|
-
withClassName: false
|
|
47
|
-
}, arrangeFs, arrangeLogger);
|
|
48
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
49
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
50
|
-
expect(after.includes("base: cn(")).toBe(false);
|
|
51
|
-
expect(after).toMatch(/base:\s*(\[|"[^"]+)/);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it("converts long JSX className and inserts cn import after use client", () => {
|
|
55
|
-
withTempFixture("FixtureUseClient.tsx", `"use client";
|
|
56
|
-
|
|
57
|
-
export function Fixture() {
|
|
58
|
-
return <div className="flex items-center gap-2 px-4 py-2 text-sm rounded-md border bg-card" />;
|
|
59
|
-
}
|
|
60
|
-
`, (filePath) => {
|
|
61
|
-
const result = groupFile(filePath, {
|
|
62
|
-
write: true,
|
|
63
|
-
withClassName: false
|
|
64
|
-
}, arrangeFs, arrangeLogger);
|
|
65
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
66
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
67
|
-
expect(after.startsWith(`"use client";\n\nimport { cn }`)).toBe(true);
|
|
68
|
-
expect(after).toContain("className={cn(");
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
it("supports namespace imports for tw.tv / tw.cn and rewrites tw.cn usage", () => {
|
|
72
|
-
withTempFixture("FixtureNamespace.tsx", `import * as tw from "@codefast/tailwind-variants";
|
|
73
|
-
|
|
74
|
-
export const styles = tw.tv({
|
|
75
|
-
base: tw.cn("flex gap-2 text-sm rounded-md border px-3 font-medium hover:bg-accent"),
|
|
76
|
-
});
|
|
77
|
-
`, (filePath) => {
|
|
78
|
-
const result = groupFile(filePath, {
|
|
79
|
-
write: true,
|
|
80
|
-
withClassName: false
|
|
81
|
-
}, arrangeFs, arrangeLogger);
|
|
82
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
83
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
84
|
-
expect(after).toContain("tw.tv(");
|
|
85
|
-
expect(after.includes("tw.cn(")).toBe(false);
|
|
86
|
-
expect(after).toMatch(/base:\s*(\[|"[^"]+)/);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
it("supports namespace imports from legacy tailwind-variants package (backward compat)", () => {
|
|
90
|
-
withTempFixture("FixtureNamespaceLegacy.tsx", `import * as tw from "tailwind-variants";
|
|
91
|
-
|
|
92
|
-
export const styles = tw.tv({
|
|
93
|
-
base: tw.cn("flex gap-2 text-sm rounded-md border px-3 font-medium hover:bg-accent"),
|
|
94
|
-
});
|
|
95
|
-
`, (filePath) => {
|
|
96
|
-
const result = groupFile(filePath, {
|
|
97
|
-
write: true,
|
|
98
|
-
withClassName: false
|
|
99
|
-
}, arrangeFs, arrangeLogger);
|
|
100
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
101
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
102
|
-
expect(after).toContain("tw.tv(");
|
|
103
|
-
expect(after.includes("tw.cn(")).toBe(false);
|
|
104
|
-
expect(after).toMatch(/base:\s*(\[|"[^"]+)/);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
it("recognizes cn/tv imports from local ./utils re-export", () => {
|
|
108
|
-
withTempFixture("FixtureLocalUtils.tsx", `import { cn, tv } from "./utils";
|
|
109
|
-
export const styles = tv({ base: cn("flex gap-2 text-sm rounded-md border px-3 font-medium hover:bg-accent") });`, (filePath) => {
|
|
110
|
-
const result = groupFile(filePath, {
|
|
111
|
-
write: true,
|
|
112
|
-
withClassName: false
|
|
113
|
-
}, arrangeFs, arrangeLogger);
|
|
114
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
it("recognizes cn/tv imports from modules containing /utils/", () => {
|
|
118
|
-
withTempFixture("FixtureUtilsPath.tsx", `import { cn, tv } from "pkg/utils/cn";
|
|
119
|
-
export const styles = tv({ base: cn("flex gap-2 text-sm rounded-md border px-3 font-medium hover:bg-accent") });`, (filePath) => {
|
|
120
|
-
const result = groupFile(filePath, {
|
|
121
|
-
write: true,
|
|
122
|
-
withClassName: false
|
|
123
|
-
}, arrangeFs, arrangeLogger);
|
|
124
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
it("recognizes cn/tv imports from ./cn.ts shim", () => {
|
|
128
|
-
withTempFixture("FixtureCnTs.tsx", `import { cn, tv } from "./cn.ts";
|
|
129
|
-
export const styles = tv({ base: cn("flex gap-2 text-sm rounded-md border px-3 font-medium hover:bg-accent") });`, (filePath) => {
|
|
130
|
-
const result = groupFile(filePath, {
|
|
131
|
-
write: true,
|
|
132
|
-
withClassName: false
|
|
133
|
-
}, arrangeFs, arrangeLogger);
|
|
134
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
it("returns totalFound 0 for files without cn/tv/long class targets", () => {
|
|
138
|
-
withTempFixture("FixtureEmpty.tsx", "export const only = 1;\n", (filePath) => {
|
|
139
|
-
expect(groupFile(filePath, {
|
|
140
|
-
write: false,
|
|
141
|
-
withClassName: false
|
|
142
|
-
}, arrangeFs, arrangeLogger)).toEqual({
|
|
143
|
-
filePath,
|
|
144
|
-
totalFound: 0,
|
|
145
|
-
changed: 0
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
it("dry-run returns totalFound 0 when cn partition is already idempotent", () => {
|
|
150
|
-
withTempFixture("FixturePartitionEq.tsx", `import { cn } from "@codefast/tailwind-variants";
|
|
151
|
-
cn("flex gap-2", "text-sm");`, (filePath) => {
|
|
152
|
-
expect(groupFile(filePath, {
|
|
153
|
-
write: false,
|
|
154
|
-
withClassName: false
|
|
155
|
-
}, arrangeFs, arrangeLogger)).toEqual({
|
|
156
|
-
filePath,
|
|
157
|
-
totalFound: 0,
|
|
158
|
-
changed: 0
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
it("counts cn() inside tv with zero args as found but unchanged", () => {
|
|
163
|
-
withTempFixture("FixtureZeroArg.tsx", `import { cn, tv } from "@codefast/tailwind-variants";
|
|
164
|
-
export const broken = tv({ base: cn() });`, (filePath) => {
|
|
165
|
-
const dry = groupFile(filePath, {
|
|
166
|
-
write: false,
|
|
167
|
-
withClassName: false
|
|
168
|
-
}, arrangeFs, arrangeLogger);
|
|
169
|
-
expect(dry).toEqual({
|
|
170
|
-
filePath,
|
|
171
|
-
totalFound: 1,
|
|
172
|
-
changed: 0
|
|
173
|
-
});
|
|
174
|
-
const wet = groupFile(filePath, {
|
|
175
|
-
write: true,
|
|
176
|
-
withClassName: false
|
|
177
|
-
}, arrangeFs, arrangeLogger);
|
|
178
|
-
expect(wet).toEqual({
|
|
179
|
-
filePath,
|
|
180
|
-
totalFound: 1,
|
|
181
|
-
changed: 0
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
it("inserts cn import before first existing import", () => {
|
|
186
|
-
withTempFixture("FixtureImportOrder.tsx", `import React from "react";
|
|
187
|
-
export function Fixture() {
|
|
188
|
-
return <div className="flex items-center gap-2 px-4 py-2 text-sm rounded-md border bg-card" />;
|
|
189
|
-
}`, (filePath) => {
|
|
190
|
-
const result = groupFile(filePath, {
|
|
191
|
-
write: true,
|
|
192
|
-
withClassName: false
|
|
193
|
-
}, arrangeFs, arrangeLogger);
|
|
194
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
195
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
196
|
-
expect(after.indexOf("import { cn }")).toBeLessThan(after.indexOf("import React"));
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
it("passes withClassName option through cn replacement", () => {
|
|
200
|
-
withTempFixture("FixtureWithClassName.tsx", `import { cn } from "@codefast/tailwind-variants";
|
|
201
|
-
export function Fixture() {
|
|
202
|
-
return <div className="flex items-center gap-2 px-4 py-2 text-sm rounded-md border bg-card" />;
|
|
203
|
-
}`, (filePath) => {
|
|
204
|
-
const result = groupFile(filePath, {
|
|
205
|
-
write: true,
|
|
206
|
-
withClassName: true
|
|
207
|
-
}, arrangeFs, arrangeLogger);
|
|
208
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
209
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
210
|
-
expect(after).toContain("className={cn(");
|
|
211
|
-
expect(after).toContain("className");
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
it("merges cn into existing named import when cnImport override matches", () => {
|
|
215
|
-
withTempFixture("FixtureMergeImport.tsx", `import { tv } from "clsx";
|
|
216
|
-
export function Fixture() {
|
|
217
|
-
return <div className="flex items-center gap-2 px-4 py-2 text-sm rounded-md border bg-card" />;
|
|
218
|
-
}`, (filePath) => {
|
|
219
|
-
const result = groupFile(filePath, {
|
|
220
|
-
write: true,
|
|
221
|
-
withClassName: false,
|
|
222
|
-
cnImport: "clsx"
|
|
223
|
-
}, arrangeFs, arrangeLogger);
|
|
224
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
225
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
226
|
-
expect(after).toContain("import { cn, tv } from \"clsx\"");
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
it("groups compoundVariants class array slots", () => {
|
|
230
|
-
withTempFixture("FixtureCvClassArray.tsx", `import { tv } from "@codefast/tailwind-variants";
|
|
231
|
-
export const sheet = tv({
|
|
232
|
-
compoundVariants: [{ className: ["flex gap-2 text-sm rounded-md border px-3 font-medium", "shadow-xs"] }],
|
|
233
|
-
});`, (filePath) => {
|
|
234
|
-
const result = groupFile(filePath, {
|
|
235
|
-
write: true,
|
|
236
|
-
withClassName: false
|
|
237
|
-
}, arrangeFs, arrangeLogger);
|
|
238
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
239
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
240
|
-
expect(after).toContain("compoundVariants");
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
it("groups compoundVariants mixed class array slot with cn(...) and plain strings", () => {
|
|
244
|
-
withTempFixture("FixtureCvClassCn.tsx", `import { cn, tv } from "@codefast/tailwind-variants";
|
|
245
|
-
export const sheet = tv({
|
|
246
|
-
compoundVariants: [{ class: ["py-1", cn("flex gap-2 text-sm rounded-md border px-3 font-medium shadow-xs")] }],
|
|
247
|
-
});`, (filePath) => {
|
|
248
|
-
const result = groupFile(filePath, {
|
|
249
|
-
write: true,
|
|
250
|
-
withClassName: false
|
|
251
|
-
}, arrangeFs, arrangeLogger);
|
|
252
|
-
expect(result.changed).toBeGreaterThan(0);
|
|
253
|
-
const after = fs.readFileSync(filePath, "utf8");
|
|
254
|
-
expect(after).toContain("class:");
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
it("dry-run prints combined unwrap + grouping note", () => {
|
|
258
|
-
const long = "flex items-center gap-2 px-4 py-2 text-sm rounded-md border bg-card font-medium shadow-xs";
|
|
259
|
-
withTempFixture("FixtureDryCombined.tsx", `import { cn, tv } from "@codefast/tailwind-variants";
|
|
260
|
-
cn("${long}");
|
|
261
|
-
export const styles = tv({ base: cn("${long}") });`, (filePath) => {
|
|
262
|
-
const output = captureStdout(() => {
|
|
263
|
-
groupFile(filePath, {
|
|
264
|
-
write: false,
|
|
265
|
-
withClassName: false
|
|
266
|
-
}, arrangeFs, arrangeLogger);
|
|
267
|
-
});
|
|
268
|
-
expect(output).toContain("[cn] / [tv] / [JSX className]");
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
//#endregion
|
|
273
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { n as ArrangeErrorCode, t as ArrangeError } from "../../../errors-CpU1ogfA.mjs";
|
|
2
|
-
import { n as runOnTarget } from "../../../run-target-CJWrqNT4.mjs";
|
|
3
|
-
import { n as createNodeCliLogger, t as createNodeCliFs } from "../../../node-io-DFRbHO6m.mjs";
|
|
4
|
-
import "../../../arrange-BqP2DI3w.mjs";
|
|
5
|
-
import fs from "node:fs";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import os from "node:os";
|
|
8
|
-
//#region src/lib/arrange/application/run-target.test.ts
|
|
9
|
-
const arrangeFs = createNodeCliFs();
|
|
10
|
-
const arrangeLogger = createNodeCliLogger();
|
|
11
|
-
function captureStdout(fn) {
|
|
12
|
-
const chunks = [];
|
|
13
|
-
const spy = jest.spyOn(process.stdout, "write").mockImplementation((chunk) => {
|
|
14
|
-
chunks.push(typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8"));
|
|
15
|
-
return true;
|
|
16
|
-
});
|
|
17
|
-
try {
|
|
18
|
-
fn();
|
|
19
|
-
} finally {
|
|
20
|
-
spy.mockRestore();
|
|
21
|
-
}
|
|
22
|
-
return chunks.join("");
|
|
23
|
-
}
|
|
24
|
-
describe("runOnTarget", () => {
|
|
25
|
-
it("prints dry-run totals for directory targets", () => {
|
|
26
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "arr-run-dry-"));
|
|
27
|
-
const long = "peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50";
|
|
28
|
-
try {
|
|
29
|
-
fs.writeFileSync(path.join(dir, "Page.tsx"), `import { cn } from "@codefast/tailwind-variants"; export function P(){ cn("${long}"); return null; }`, "utf8");
|
|
30
|
-
const out = captureStdout(() => runOnTarget(dir, {
|
|
31
|
-
write: false,
|
|
32
|
-
withClassName: false
|
|
33
|
-
}, arrangeFs, arrangeLogger));
|
|
34
|
-
expect(out).toContain("Total:");
|
|
35
|
-
expect(out).toContain("to review");
|
|
36
|
-
} finally {
|
|
37
|
-
fs.rmSync(dir, {
|
|
38
|
-
recursive: true,
|
|
39
|
-
force: true
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
it("throws ArrangeError for missing target path", () => {
|
|
44
|
-
let caught;
|
|
45
|
-
try {
|
|
46
|
-
runOnTarget(path.join(os.tmpdir(), "no-such-arrange-target"), {
|
|
47
|
-
write: false,
|
|
48
|
-
withClassName: false
|
|
49
|
-
}, arrangeFs, arrangeLogger);
|
|
50
|
-
} catch (caughtError) {
|
|
51
|
-
caught = caughtError;
|
|
52
|
-
}
|
|
53
|
-
expect(caught).toBeInstanceOf(ArrangeError);
|
|
54
|
-
expect(caught.code).toBe(ArrangeErrorCode.TARGET_NOT_FOUND);
|
|
55
|
-
});
|
|
56
|
-
it("prints apply summary in write mode", () => {
|
|
57
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "arr-run-apply-"));
|
|
58
|
-
const before = `import { cn } from "@codefast/tailwind-variants";
|
|
59
|
-
export function Fixture() {
|
|
60
|
-
return <div className="flex items-center gap-2 px-4 py-2 text-sm rounded-md border bg-card" />;
|
|
61
|
-
}`;
|
|
62
|
-
try {
|
|
63
|
-
fs.writeFileSync(path.join(dir, "Apply.tsx"), before, "utf8");
|
|
64
|
-
const out = captureStdout(() => runOnTarget(dir, {
|
|
65
|
-
write: true,
|
|
66
|
-
withClassName: false
|
|
67
|
-
}, arrangeFs, arrangeLogger));
|
|
68
|
-
expect(out).toContain("Applied:");
|
|
69
|
-
expect(out).toContain("Note:");
|
|
70
|
-
} finally {
|
|
71
|
-
fs.rmSync(dir, {
|
|
72
|
-
recursive: true,
|
|
73
|
-
force: true
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
it("accepts legacy tailwind-variants imports when running directory dry-run (backward compat)", () => {
|
|
78
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "arr-run-dry-legacy-"));
|
|
79
|
-
const long = "peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50";
|
|
80
|
-
try {
|
|
81
|
-
fs.writeFileSync(path.join(dir, "Page.tsx"), `import { cn } from "tailwind-variants"; export function P(){ cn("${long}"); return null; }`, "utf8");
|
|
82
|
-
const out = captureStdout(() => runOnTarget(dir, {
|
|
83
|
-
write: false,
|
|
84
|
-
withClassName: false
|
|
85
|
-
}, arrangeFs, arrangeLogger));
|
|
86
|
-
expect(out).toContain("Total:");
|
|
87
|
-
expect(out).toContain("to review");
|
|
88
|
-
} finally {
|
|
89
|
-
fs.rmSync(dir, {
|
|
90
|
-
recursive: true,
|
|
91
|
-
force: true
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
//#endregion
|
|
97
|
-
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as isCnOrTvIdentifier, c as propertyAssignmentNameText, i as indentOfLineContaining, l as unwrapCnInsideTvCallReplacement, n as applyEditsDescending, o as lineOf, r as buildKnownCnTvBindings, s as moduleLooksLikeCnTvReexport, t as KNOWN_CN_TV_MODULES } from "../../../../ast-helpers-MDRYuIAk.mjs";
|
|
2
|
-
export { KNOWN_CN_TV_MODULES, applyEditsDescending, buildKnownCnTvBindings, indentOfLineContaining, isCnOrTvIdentifier, lineOf, moduleLooksLikeCnTvReexport, propertyAssignmentNameText, unwrapCnInsideTvCallReplacement };
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { a as isCnOrTvIdentifier, i as indentOfLineContaining, l as unwrapCnInsideTvCallReplacement, n as applyEditsDescending, o as lineOf, r as buildKnownCnTvBindings, s as moduleLooksLikeCnTvReexport, t as KNOWN_CN_TV_MODULES } from "../../../../ast-helpers-MDRYuIAk.mjs";
|
|
2
|
-
import "../../../../arrange-BqP2DI3w.mjs";
|
|
3
|
-
import ts from "typescript";
|
|
4
|
-
//#region src/lib/arrange/domain/ast/ast-helpers.test.ts
|
|
5
|
-
function parseCallee(source) {
|
|
6
|
-
const stmt = ts.createSourceFile("x.ts", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS).statements[0];
|
|
7
|
-
if (!ts.isExpressionStatement(stmt)) throw new Error("expected expression statement");
|
|
8
|
-
if (!ts.isCallExpression(stmt.expression)) throw new Error("expected call expression");
|
|
9
|
-
return stmt.expression.expression;
|
|
10
|
-
}
|
|
11
|
-
describe("indentOfLineContaining", () => {
|
|
12
|
-
it("handles CRLF files", () => {
|
|
13
|
-
const src = "a\r\n b\r\n c";
|
|
14
|
-
expect(indentOfLineContaining(src, src.indexOf("b"))).toBe(" ");
|
|
15
|
-
});
|
|
16
|
-
it("handles CR-only line endings", () => {
|
|
17
|
-
const src = "a\r b\rc";
|
|
18
|
-
expect(indentOfLineContaining(src, src.indexOf("b"))).toBe(" ");
|
|
19
|
-
});
|
|
20
|
-
it("supports pos at start and end of source", () => {
|
|
21
|
-
const src = "x\n y\n";
|
|
22
|
-
expect(indentOfLineContaining(src, 0)).toBe("");
|
|
23
|
-
expect(indentOfLineContaining(src, 6)).toBe("");
|
|
24
|
-
});
|
|
25
|
-
it("returns mixed tab/space indentation", () => {
|
|
26
|
-
const src = " line";
|
|
27
|
-
expect(indentOfLineContaining(src, src.indexOf("line"))).toBe(" ");
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe("applyEditsDescending", () => {
|
|
31
|
-
it("returns original text for empty edits", () => {
|
|
32
|
-
expect(applyEditsDescending("abc", [])).toBe("abc");
|
|
33
|
-
});
|
|
34
|
-
it("applies multiple edits at start/middle/end", () => {
|
|
35
|
-
const out = applyEditsDescending("abcdef", [
|
|
36
|
-
{
|
|
37
|
-
start: 0,
|
|
38
|
-
end: 1,
|
|
39
|
-
replacement: "A"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
start: 2,
|
|
43
|
-
end: 4,
|
|
44
|
-
replacement: "CD"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
start: 5,
|
|
48
|
-
end: 6,
|
|
49
|
-
replacement: "F"
|
|
50
|
-
}
|
|
51
|
-
]);
|
|
52
|
-
expect(out).toBe("AbCDeF");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe("buildKnownCnTvBindings", () => {
|
|
56
|
-
it("collects default, named alias, and namespace bindings", () => {
|
|
57
|
-
const sf = ts.createSourceFile("x.ts", ["import tvDefault, { cn as cx } from \"@codefast/tailwind-variants\";", "import * as tw from \"@codefast/tailwind-variants\";"].join("\n"), ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
58
|
-
expect(buildKnownCnTvBindings(sf)).toEqual(new Set([
|
|
59
|
-
"tvDefault",
|
|
60
|
-
"cx",
|
|
61
|
-
"tw"
|
|
62
|
-
]));
|
|
63
|
-
});
|
|
64
|
-
it("ignores type-only and unknown-module imports", () => {
|
|
65
|
-
const sf = ts.createSourceFile("x.ts", ["import type { cn } from \"@codefast/tailwind-variants\";", "import { cn } from \"lodash\";"].join("\n"), ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
66
|
-
expect(buildKnownCnTvBindings(sf)).toEqual(/* @__PURE__ */ new Set());
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe("known cn/tv module helpers", () => {
|
|
70
|
-
it("includes canonical shadcn-style module specifiers", () => {
|
|
71
|
-
expect(KNOWN_CN_TV_MODULES.has("#lib/utils")).toBe(true);
|
|
72
|
-
expect(KNOWN_CN_TV_MODULES.has("@codefast/tailwind-variants")).toBe(true);
|
|
73
|
-
expect(KNOWN_CN_TV_MODULES.has("tailwind-variants")).toBe(true);
|
|
74
|
-
});
|
|
75
|
-
it.each([
|
|
76
|
-
["./utils", true],
|
|
77
|
-
["pkg/utils/cn", true],
|
|
78
|
-
["./cn.ts", true],
|
|
79
|
-
["lodash", false]
|
|
80
|
-
])("moduleLooksLikeCnTvReexport(%s) -> %s", (mod, expected) => {
|
|
81
|
-
expect(moduleLooksLikeCnTvReexport(mod)).toBe(expected);
|
|
82
|
-
});
|
|
83
|
-
it("accepts legacy tailwind-variants import bindings (backward compat)", () => {
|
|
84
|
-
const sf = ts.createSourceFile("x.ts", ["import tvDefault, { cn as cx } from \"tailwind-variants\";", "import * as tw from \"tailwind-variants\";"].join("\n"), ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
85
|
-
expect(buildKnownCnTvBindings(sf)).toEqual(new Set([
|
|
86
|
-
"tvDefault",
|
|
87
|
-
"cx",
|
|
88
|
-
"tw"
|
|
89
|
-
]));
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
describe("isCnOrTvIdentifier", () => {
|
|
93
|
-
const known = new Set([
|
|
94
|
-
"cn",
|
|
95
|
-
"tv",
|
|
96
|
-
"tw"
|
|
97
|
-
]);
|
|
98
|
-
it("matches identifier calls", () => {
|
|
99
|
-
expect(isCnOrTvIdentifier(parseCallee("cn('a');"), "cn", known)).toBe(true);
|
|
100
|
-
expect(isCnOrTvIdentifier(parseCallee("tv({});"), "tv", known)).toBe(true);
|
|
101
|
-
});
|
|
102
|
-
it("matches property access with known namespace binding", () => {
|
|
103
|
-
expect(isCnOrTvIdentifier(parseCallee("tw.cn('a');"), "cn", known)).toBe(true);
|
|
104
|
-
expect(isCnOrTvIdentifier(parseCallee("tw.tv({});"), "tv", known)).toBe(true);
|
|
105
|
-
});
|
|
106
|
-
it("returns false for unknown namespace and non-identifier base", () => {
|
|
107
|
-
expect(isCnOrTvIdentifier(parseCallee("utils2.cn('a');"), "cn", known)).toBe(false);
|
|
108
|
-
expect(isCnOrTvIdentifier(parseCallee("getNs().cn('a');"), "cn", known)).toBe(false);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
describe("unwrapCnInsideTvCallReplacement", () => {
|
|
112
|
-
it("unwraps single arg to argument source", () => {
|
|
113
|
-
const src = "cn(\"flex gap-2\")";
|
|
114
|
-
const sf = ts.createSourceFile("x.ts", src, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
115
|
-
const expr = sf.statements[0].expression;
|
|
116
|
-
expect(unwrapCnInsideTvCallReplacement(expr, src, sf)).toBe("\"flex gap-2\"");
|
|
117
|
-
});
|
|
118
|
-
it("unwraps multiple args to multiline array", () => {
|
|
119
|
-
const src = "cn(\"flex gap-2\", \"text-sm\")";
|
|
120
|
-
const sf = ts.createSourceFile("x.ts", src, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
121
|
-
const expr = sf.statements[0].expression;
|
|
122
|
-
expect(unwrapCnInsideTvCallReplacement(expr, src, sf)).toBe([
|
|
123
|
-
"[",
|
|
124
|
-
" \"flex gap-2\",",
|
|
125
|
-
" \"text-sm\",",
|
|
126
|
-
"]"
|
|
127
|
-
].join("\n"));
|
|
128
|
-
});
|
|
129
|
-
it("returns undefined for zero args", () => {
|
|
130
|
-
const sf = ts.createSourceFile("x.ts", "cn()", ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
131
|
-
const expr = sf.statements[0].expression;
|
|
132
|
-
expect(unwrapCnInsideTvCallReplacement(expr, "cn()", sf)).toBeUndefined();
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
describe("lineOf", () => {
|
|
136
|
-
it("returns 1-based line number for node start", () => {
|
|
137
|
-
const src = [
|
|
138
|
-
"const a = 1;",
|
|
139
|
-
"const b = 2;",
|
|
140
|
-
"const c = 3;"
|
|
141
|
-
].join("\n");
|
|
142
|
-
const sf = ts.createSourceFile("x.ts", src, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
143
|
-
const stmt = sf.statements[1];
|
|
144
|
-
expect(lineOf(sf, stmt)).toBe(2);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
//#endregion
|
|
148
|
-
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as mergeCnUnconditionalLiteralPoolForTest, i as isUnsafeLiteralForCnStyleApplySplit, n as collectUnconditionalTailwindLiteralsFromCnArguments, r as forEachStringLiteralInClassExpression, t as CN_APPLY_LITERAL_WALK_OPTS } from "../../../../collectors-cn-BS8TTQ8O.mjs";
|
|
2
|
-
export { CN_APPLY_LITERAL_WALK_OPTS, collectUnconditionalTailwindLiteralsFromCnArguments, forEachStringLiteralInClassExpression, isUnsafeLiteralForCnStyleApplySplit, mergeCnUnconditionalLiteralPoolForTest };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import "../../../../constants-AtPhF-Ct.mjs";
|
|
2
|
-
import { a as mergeCnUnconditionalLiteralPoolForTest, r as forEachStringLiteralInClassExpression } from "../../../../collectors-cn-BS8TTQ8O.mjs";
|
|
3
|
-
import "../../../../arrange-BqP2DI3w.mjs";
|
|
4
|
-
import ts from "typescript";
|
|
5
|
-
//#region src/lib/arrange/domain/ast/collectors-cn.test.ts
|
|
6
|
-
describe("forEachStringLiteralInClassExpression", () => {
|
|
7
|
-
function literalsFromArgSnippet(snippet, walk) {
|
|
8
|
-
const arg0 = ts.createSourceFile("x.ts", `cn(${snippet});`, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS).statements[0].expression.arguments[0];
|
|
9
|
-
const out = [];
|
|
10
|
-
forEachStringLiteralInClassExpression(arg0, (n) => out.push(n.text), 0, walk);
|
|
11
|
-
return out;
|
|
12
|
-
}
|
|
13
|
-
it("collects both branches of conditionals by default", () => {
|
|
14
|
-
expect(literalsFromArgSnippet("x ? \"a\" : \"b\"")).toEqual(["a", "b"]);
|
|
15
|
-
});
|
|
16
|
-
it("skips conditional branches when configured", () => {
|
|
17
|
-
expect(literalsFromArgSnippet("x ? \"a\" : \"b\"", { descendIntoConditional: false })).toEqual([]);
|
|
18
|
-
});
|
|
19
|
-
it("walks nested arrays and assertions", () => {
|
|
20
|
-
expect(literalsFromArgSnippet("[\"p\", ((\"q\" as const))]")).toEqual(["p", "q"]);
|
|
21
|
-
});
|
|
22
|
-
it("documents that traversal stops safely when class expression depth exceeds the configured limit", () => {
|
|
23
|
-
let expr = "\"deep-token\"";
|
|
24
|
-
for (let i = 0; i < 14; i += 1) expr = `[${expr}]`;
|
|
25
|
-
const arg0 = ts.createSourceFile("x.ts", `cn(${expr});`, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS).statements[0].expression.arguments[0];
|
|
26
|
-
const out = [];
|
|
27
|
-
expect(() => {
|
|
28
|
-
forEachStringLiteralInClassExpression(arg0, (n) => out.push(n.text), 0);
|
|
29
|
-
}).not.toThrow();
|
|
30
|
-
expect(out).toEqual([]);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe("mergeCnUnconditionalLiteralPoolForTest", () => {
|
|
34
|
-
it("does not merge classes from mutually exclusive ternary branches", () => {
|
|
35
|
-
const pool = mergeCnUnconditionalLiteralPoolForTest("\"flex flex-1 justify-between leading-none\", nestLabel ? \"items-end\" : \"items-center\"");
|
|
36
|
-
expect(pool).toBe("flex flex-1 justify-between leading-none");
|
|
37
|
-
});
|
|
38
|
-
it("collects only unconditional literals", () => {
|
|
39
|
-
expect(mergeCnUnconditionalLiteralPoolForTest("\"a b\", cond ? \"c\" : \"d\"")).toBe("a b");
|
|
40
|
-
});
|
|
41
|
-
it("supports aliased callee names", () => {
|
|
42
|
-
expect(mergeCnUnconditionalLiteralPoolForTest("\"a b\", cond ? \"c\" : \"d\"", { callee: "cx" })).toBe("a b");
|
|
43
|
-
});
|
|
44
|
-
it("returns empty when every arg is ternary", () => {
|
|
45
|
-
expect(mergeCnUnconditionalLiteralPoolForTest("x ? \"a\" : \"b\"")).toBe("");
|
|
46
|
-
});
|
|
47
|
-
it("skips cn([...]) array arg literals for apply pool", () => {
|
|
48
|
-
expect(mergeCnUnconditionalLiteralPoolForTest("[\"foo\", nest ? \"a\" : \"b\"]")).toBe("");
|
|
49
|
-
});
|
|
50
|
-
it("collects parenthesized string literal arg", () => {
|
|
51
|
-
expect(mergeCnUnconditionalLiteralPoolForTest("((\"flex gap-2\" as const))")).toBe("flex gap-2");
|
|
52
|
-
});
|
|
53
|
-
it("collects no-substitution template literal arg", () => {
|
|
54
|
-
expect(mergeCnUnconditionalLiteralPoolForTest("`flex gap-2`")).toBe("flex gap-2");
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
//#endregion
|
|
58
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { t as jsxClassNameStaticLiteral } from "../../../../collectors-jsx-D9tL2ZPM.mjs";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
//#region src/lib/arrange/domain/ast/collectors-jsx.test.ts
|
|
4
|
-
function firstJsxClassAttr(source) {
|
|
5
|
-
const attr = ts.createSourceFile("x.tsx", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX).statements[0].declarationList.declarations[0].initializer.attributes.properties[0];
|
|
6
|
-
if (!attr || !ts.isJsxAttribute(attr)) throw new Error("expected jsx attribute");
|
|
7
|
-
return attr;
|
|
8
|
-
}
|
|
9
|
-
describe("jsxClassNameStaticLiteral", () => {
|
|
10
|
-
it("extracts direct string literal className", () => {
|
|
11
|
-
const result = jsxClassNameStaticLiteral(firstJsxClassAttr("const node = <div className=\"flex gap-2\" />;"));
|
|
12
|
-
expect(result?.lit.text).toBe("flex gap-2");
|
|
13
|
-
});
|
|
14
|
-
it("extracts className string inside JSX expression", () => {
|
|
15
|
-
const result = jsxClassNameStaticLiteral(firstJsxClassAttr("const node = <div className={\"flex gap-2\"} />;"));
|
|
16
|
-
expect(result?.lit.text).toBe("flex gap-2");
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
//#endregion
|
|
20
|
-
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as listAllCnCallsInsideTvInSourceFile, c as traverseTvObject, i as emitTvSlot, n as collectGroupableStringNodes, o as makeStringNode, r as collectTvSlots, s as slotClassString, t as collectCnCallsInsideTv } from "../../../../collectors-tv-D2PXZaRt.mjs";
|
|
2
|
-
export { collectCnCallsInsideTv, collectGroupableStringNodes, collectTvSlots, emitTvSlot, listAllCnCallsInsideTvInSourceFile, makeStringNode, slotClassString, traverseTvObject };
|