@codefast/cli 0.11.0 → 0.12.0
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/CHANGELOG.md +51 -0
- package/README.md +57 -46
- package/dist/arrange/command.js +24 -25
- package/dist/arrange/domain/ast/collectors-cn.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-cn.js +2 -2
- package/dist/arrange/domain/ast/collectors-jsx.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-jsx.js +1 -1
- package/dist/arrange/domain/ast/collectors-tv.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-tv.js +5 -5
- package/dist/arrange/domain/ast/helpers.d.ts +2 -2
- package/dist/arrange/domain/ast/helpers.js +3 -4
- package/dist/arrange/domain/ast/simplify-targets.d.ts +1 -1
- package/dist/arrange/domain/ast/simplify-targets.js +5 -5
- package/dist/arrange/domain/ast/targets.d.ts +2 -2
- package/dist/arrange/domain/ast/targets.js +9 -9
- package/dist/arrange/domain/ast/translator.d.ts +1 -1
- package/dist/arrange/domain/ast/translator.js +1 -1
- package/dist/arrange/domain/constants.d.ts +1 -1
- package/dist/arrange/domain/grouping-service.d.ts +2 -2
- package/dist/arrange/domain/grouping-service.js +3 -3
- package/dist/arrange/domain/grouping.js +3 -3
- package/dist/arrange/domain/imports.d.ts +1 -1
- package/dist/arrange/domain/imports.js +2 -2
- package/dist/arrange/domain/source-text-formatters.js +1 -1
- package/dist/arrange/domain/tailwind-token.js +1 -1
- package/dist/arrange/domain/token-classifier.d.ts +1 -1
- package/dist/arrange/domain/token-classifier.js +2 -2
- package/dist/arrange/domain/types.d.ts +3 -3
- package/dist/arrange/group/cli-result.d.ts +1 -1
- package/dist/arrange/group/output.d.ts +1 -1
- package/dist/arrange/group/output.js +1 -1
- package/dist/arrange/group/suggest.d.ts +2 -2
- package/dist/arrange/group/suggest.js +2 -2
- package/dist/arrange/inspect/cli-result.d.ts +1 -1
- package/dist/arrange/inspect/domain/analyze-service.d.ts +2 -2
- package/dist/arrange/inspect/domain/analyze-service.js +7 -7
- package/dist/arrange/inspect/output.d.ts +1 -1
- package/dist/arrange/inspect/output.js +2 -2
- package/dist/arrange/inspect/run.d.ts +4 -4
- package/dist/arrange/inspect/run.js +6 -6
- package/dist/arrange/prepare.d.ts +4 -4
- package/dist/arrange/prepare.js +5 -5
- package/dist/arrange/regroup/cli-result.d.ts +1 -1
- package/dist/arrange/regroup/cli-result.js +1 -1
- package/dist/arrange/regroup/output.d.ts +2 -2
- package/dist/arrange/regroup/output.js +2 -2
- package/dist/arrange/regroup/process-file.d.ts +2 -2
- package/dist/arrange/regroup/process-file.js +3 -3
- package/dist/arrange/regroup/run.d.ts +5 -5
- package/dist/arrange/regroup/run.js +4 -4
- package/dist/arrange/resolve-target.d.ts +1 -1
- package/dist/arrange/resolve-target.js +2 -2
- package/dist/arrange/scan-target.d.ts +1 -1
- package/dist/arrange/scan-target.js +3 -3
- package/dist/arrange/simplify/cli-result.d.ts +1 -1
- package/dist/arrange/simplify/fold-targets.d.ts +3 -3
- package/dist/arrange/simplify/fold-targets.js +3 -3
- package/dist/arrange/simplify/output.d.ts +1 -1
- package/dist/arrange/simplify/output.js +1 -1
- package/dist/arrange/simplify/process-file.d.ts +3 -3
- package/dist/arrange/simplify/process-file.js +5 -5
- package/dist/arrange/simplify/run.d.ts +4 -4
- package/dist/arrange/simplify/run.js +4 -4
- package/dist/arrange/simplify/variant-classname-probe.js +1 -1
- package/dist/arrange/source-parse.d.ts +1 -1
- package/dist/arrange/source-parse.js +3 -3
- package/dist/audit/command.js +45 -28
- package/dist/audit/comments/cli-result.d.ts +1 -1
- package/dist/audit/comments/cli-result.js +1 -1
- package/dist/audit/comments/output.d.ts +1 -1
- package/dist/audit/comments/output.js +1 -1
- package/dist/audit/comments/prepare.d.ts +4 -4
- package/dist/audit/comments/prepare.js +1 -1
- package/dist/audit/comments/run.d.ts +4 -4
- package/dist/audit/comments/run.js +9 -9
- package/dist/audit/display-names/cli-result.d.ts +1 -1
- package/dist/audit/display-names/cli-result.js +1 -1
- package/dist/audit/display-names/domain/display-names.d.ts +1 -1
- package/dist/audit/display-names/output.d.ts +1 -1
- package/dist/audit/display-names/output.js +1 -1
- package/dist/audit/display-names/prepare.d.ts +4 -4
- package/dist/audit/display-names/prepare.js +1 -1
- package/dist/audit/display-names/run.d.ts +4 -4
- package/dist/audit/display-names/run.js +5 -5
- package/dist/audit/domain/types.d.ts +43 -0
- package/dist/audit/imports/cli-result.d.ts +1 -1
- package/dist/audit/imports/cli-result.js +1 -1
- package/dist/audit/imports/domain/import-policy.d.ts +1 -1
- package/dist/audit/imports/output.d.ts +1 -1
- package/dist/audit/imports/output.js +1 -1
- package/dist/audit/imports/prepare.d.ts +4 -4
- package/dist/audit/imports/prepare.js +1 -1
- package/dist/audit/imports/run.d.ts +4 -4
- package/dist/audit/imports/run.js +6 -6
- package/dist/audit/links/cli-result.d.ts +1 -1
- package/dist/audit/links/cli-result.js +1 -1
- package/dist/audit/links/domain/markdown-links.d.ts +3 -3
- package/dist/audit/links/domain/markdown-links.js +22 -8
- package/dist/audit/links/output.d.ts +1 -1
- package/dist/audit/links/output.js +1 -1
- package/dist/audit/links/prepare.d.ts +4 -4
- package/dist/audit/links/prepare.js +1 -1
- package/dist/audit/links/run.d.ts +4 -4
- package/dist/audit/links/run.js +4 -4
- package/dist/audit/prepare.d.ts +4 -4
- package/dist/audit/prepare.js +4 -4
- package/dist/audit/publish/cli-result.d.ts +13 -0
- package/dist/audit/publish/cli-result.js +22 -0
- package/dist/audit/publish/cli-schema.d.ts +18 -0
- package/dist/audit/publish/cli-schema.js +12 -0
- package/dist/audit/publish/domain/legacy-subpath.d.ts +8 -0
- package/dist/audit/publish/domain/legacy-subpath.js +22 -0
- package/dist/audit/publish/output.d.ts +7 -0
- package/dist/audit/publish/output.js +24 -0
- package/dist/audit/publish/prepare.d.ts +16 -0
- package/dist/audit/publish/prepare.js +12 -0
- package/dist/audit/publish/run.d.ts +14 -0
- package/dist/audit/publish/run.js +62 -0
- package/dist/audit/rtl/cli-result.d.ts +1 -1
- package/dist/audit/rtl/cli-result.js +1 -1
- package/dist/audit/rtl/domain/audit-file.d.ts +1 -1
- package/dist/audit/rtl/domain/audit-file.js +2 -2
- package/dist/audit/rtl/domain/tokenize.d.ts +1 -1
- package/dist/audit/rtl/output.d.ts +1 -1
- package/dist/audit/rtl/output.js +1 -1
- package/dist/audit/rtl/prepare.d.ts +4 -4
- package/dist/audit/rtl/prepare.js +5 -5
- package/dist/audit/rtl/run.d.ts +4 -4
- package/dist/audit/rtl/run.js +4 -4
- package/dist/bin.js +1 -1
- package/dist/cli.js +5 -5
- package/dist/core/cli/command-pipeline.d.ts +4 -5
- package/dist/core/cli/command-pipeline.js +7 -7
- package/dist/core/cli/format-error.d.ts +1 -1
- package/dist/core/cli/resolve-root.d.ts +3 -3
- package/dist/core/cli/resolve-root.js +3 -3
- package/dist/core/cli/result-handle.d.ts +2 -2
- package/dist/core/cli/result-handle.js +4 -4
- package/dist/core/config/define-config.d.ts +1 -1
- package/dist/core/config/loader.d.ts +2 -2
- package/dist/core/config/loader.js +2 -2
- package/dist/core/config/warnings.js +1 -1
- package/dist/core/config.d.ts +4 -4
- package/dist/core/config.js +4 -4
- package/dist/core/filesystem/node.d.ts +1 -1
- package/dist/core/schema-parse.d.ts +2 -2
- package/dist/core/schema-parse.js +2 -2
- package/dist/core/workspace/markdown-walk.d.ts +1 -1
- package/dist/core/workspace/markdown-walk.js +1 -1
- package/dist/core/workspace/package-version.d.ts +1 -1
- package/dist/core/workspace/package-version.js +2 -2
- package/dist/core/workspace/resolver.d.ts +1 -1
- package/dist/core/workspace/resolver.js +5 -5
- package/dist/core/workspace/source-walk.d.ts +1 -1
- package/dist/core/workspace/source-walk.js +1 -1
- package/dist/core/workspace/typescript-walk.d.ts +1 -1
- package/dist/core/workspace/typescript-walk.js +1 -1
- package/dist/core/workspace/walk-files.d.ts +1 -1
- package/dist/core/workspace/walk-files.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/mirror/cli-result.d.ts +1 -1
- package/dist/mirror/cli-result.js +1 -1
- package/dist/mirror/cli-schema.d.ts +1 -1
- package/dist/mirror/command.js +7 -7
- package/dist/mirror/dist-filesystem-node.d.ts +2 -2
- package/dist/mirror/dist-filesystem-node.js +2 -2
- package/dist/mirror/domain/dirent-guard.d.ts +1 -1
- package/dist/mirror/domain/exports.d.ts +2 -2
- package/dist/mirror/domain/exports.js +1 -1
- package/dist/mirror/domain/types.d.ts +2 -2
- package/dist/mirror/output.d.ts +1 -1
- package/dist/mirror/output.js +2 -2
- package/dist/mirror/package-path.d.ts +3 -3
- package/dist/mirror/package-path.js +3 -3
- package/dist/mirror/prepare.d.ts +5 -5
- package/dist/mirror/prepare.js +4 -4
- package/dist/mirror/run.d.ts +6 -6
- package/dist/mirror/run.js +7 -7
- package/dist/mirror/supplement-exports.d.ts +1 -1
- package/dist/mirror/supplement-exports.js +2 -2
- package/dist/mirror/sync-workspace-package.d.ts +3 -3
- package/dist/mirror/sync-workspace-package.js +11 -14
- package/dist/mirror/write-exports.d.ts +2 -2
- package/dist/mirror/write-exports.js +3 -3
- package/dist/pack-slim/cli-result.d.ts +1 -1
- package/dist/pack-slim/cli-result.js +1 -1
- package/dist/pack-slim/command.js +9 -9
- package/dist/pack-slim/domain/transform.d.ts +22 -1
- package/dist/pack-slim/domain/transform.js +65 -8
- package/dist/pack-slim/output.d.ts +1 -1
- package/dist/pack-slim/output.js +1 -1
- package/dist/pack-slim/prepare.d.ts +3 -3
- package/dist/pack-slim/prepare.js +2 -2
- package/dist/pack-slim/run.d.ts +5 -5
- package/dist/pack-slim/run.js +5 -5
- package/dist/pack-slim/working-tree.d.ts +2 -2
- package/dist/pack-slim/working-tree.js +2 -2
- package/dist/tag/cli-result.d.ts +1 -1
- package/dist/tag/cli-result.js +1 -1
- package/dist/tag/cli-schema.d.ts +1 -1
- package/dist/tag/command.js +7 -7
- package/dist/tag/domain/skip-filter.d.ts +1 -1
- package/dist/tag/domain/skip-filter.js +1 -1
- package/dist/tag/domain/types.d.ts +1 -1
- package/dist/tag/domain/version-summary.d.ts +1 -1
- package/dist/tag/output.d.ts +1 -1
- package/dist/tag/output.js +1 -1
- package/dist/tag/prepare.d.ts +4 -4
- package/dist/tag/prepare.js +4 -4
- package/dist/tag/run.d.ts +4 -4
- package/dist/tag/run.js +7 -7
- package/dist/tag/target/candidates.d.ts +2 -2
- package/dist/tag/target/candidates.js +2 -2
- package/dist/tag/target/resolve-path.d.ts +1 -1
- package/dist/tag/target/runner.d.ts +2 -2
- package/dist/tag/target/runner.js +3 -3
- package/dist/tag/writer/since-writer.d.ts +2 -2
- package/dist/tag/writer/since-writer.js +1 -1
- package/dist/tag/writer/version-resolver.d.ts +1 -1
- package/dist/tag/writer/version-resolver.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @codefast/cli
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#892](https://github.com/codefastlabs/codefast/pull/892) [`4c97c5b`](https://github.com/codefastlabs/codefast/commit/4c97c5b8c2314f25ee9df7eac5a4b5dd723d6d90) Thanks [@thevuong](https://github.com/thevuong)! - Add `codefast audit publish`, a static publish-surface check. It flags `#/`-prefixed internal import specifiers — valid
|
|
8
|
+
to the in-repo runners but rejected by Node's ESM resolver on the supported floor, so they break the published package —
|
|
9
|
+
and any `exports`/`imports` target the slimmed publish manifest would not ship. It joins the `audit` family and gates
|
|
10
|
+
CI, replacing an external `publint` step.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#885](https://github.com/codefastlabs/codefast/pull/885) [`8580a2b`](https://github.com/codefastlabs/codefast/commit/8580a2b2dd9f502d7c330e5a2f0a3942041633b6) Thanks [@thevuong](https://github.com/thevuong)! - Match GitHub's heading-slug algorithm in `audit links`, so a cross-reference that resolves on GitHub resolves in the
|
|
15
|
+
audit.
|
|
16
|
+
|
|
17
|
+
Heading anchors are now slugged the way GitHub does: each space becomes its own hyphen with runs left intact,
|
|
18
|
+
underscores are kept as slug characters, and repeated headings gain `-1`, `-2`, … suffixes in heading order. The
|
|
19
|
+
previous slugger collapsed whitespace, dropped underscores, and offered only the base slug for duplicates, so a link a
|
|
20
|
+
browser lands on could be reported as dangling — the `@remarks` already claimed GitHub parity the code did not deliver.
|
|
21
|
+
|
|
22
|
+
- [#892](https://github.com/codefastlabs/codefast/pull/892) [`4c97c5b`](https://github.com/codefastlabs/codefast/commit/4c97c5b8c2314f25ee9df7eac5a4b5dd723d6d90) Thanks [@thevuong](https://github.com/thevuong)! - Lower the monorepo's Node floor from 24 to 22.12, so the packages install and run on the active Node 22 LTS line.
|
|
23
|
+
|
|
24
|
+
`engines.node` becomes `>=22.12.0` across every package — the floor the shared toolchain (oxlint, Vite, Vitest, TanStack
|
|
25
|
+
Start) already requires. Development stays on the latest Node (`.node-version`) for speed, and a CI matrix exercises the
|
|
26
|
+
floor and the active LTS directly, so the floor is a contract CI proves rather than one everyone has to run.
|
|
27
|
+
`@types/node` is pinned to the floor's major (`^22`), with a workspace override holding the whole tree there so a dev
|
|
28
|
+
tool's `@types/node: "*"` peer can no longer pull a newer major and mask an API the floor lacks. The floor stays
|
|
29
|
+
mechanical, not advisory: `@codefast/di` keeps its own `Map` upsert helpers rather than the ES2025
|
|
30
|
+
`Map.prototype.getOrInsert` (which would raise the floor to 26) and its `lib` stays `ES2024`. `@codefast/cli`'s mirror
|
|
31
|
+
step now calls the `node:path` functions directly instead of aliasing them, which the floor's types correctly flag as
|
|
32
|
+
unbound methods.
|
|
33
|
+
|
|
34
|
+
The shared `@codefast/typescript-config` presets pin `lib` and `target` to `ES2024` (was `ESNext`) so the compiler's
|
|
35
|
+
ECMAScript surface matches the Node floor: an ES2025 builtin such as `Map.prototype.getOrInsert` now fails to type-check
|
|
36
|
+
rather than compiling and crashing on Node 22.12. `@codefast/di` and `@codefast/di-testing` already pinned `lib` and are
|
|
37
|
+
unchanged.
|
|
38
|
+
|
|
39
|
+
Internal subpath imports move from a `#/` prefix to a bare `#` (`#core/token`, not `#/core/token`), and the
|
|
40
|
+
`package.json#imports` keys become `#*`/`#tests/*`/`#examples/*` to match. Node's native ESM resolver rejects a
|
|
41
|
+
`#/`-prefixed specifier with `ERR_INVALID_MODULE_SPECIFIER` on the whole Node 22 line (and on Node 24 before 24.14), and
|
|
42
|
+
each package ships those specifiers verbatim inside its published `dist/*.js` for a consumer's Node to resolve — so this
|
|
43
|
+
rename is what actually lets the packages import on the new floor. Purely internal: a consumer's own import paths are
|
|
44
|
+
unchanged.
|
|
45
|
+
|
|
46
|
+
- [#892](https://github.com/codefastlabs/codefast/pull/892) [`4c97c5b`](https://github.com/codefastlabs/codefast/commit/4c97c5b8c2314f25ee9df7eac5a4b5dd723d6d90) Thanks [@thevuong](https://github.com/thevuong)! - Fix `pack-slim` stripping the stylesheet source of packages that export CSS.
|
|
47
|
+
|
|
48
|
+
`codefast pack-slim` removed the whole `src` directory from a package's published `files`, but `@codefast/ui` and
|
|
49
|
+
`@codefast/tracking` ship Tailwind source through `./css/*` → `./src/css/*`, so their published tarballs went out with
|
|
50
|
+
no CSS at all and the `./css/*` export resolved to nothing. pack-slim now keeps the `src` subtrees a surviving
|
|
51
|
+
`exports`/`imports` target still points into (e.g. `src/css`) and drops the rest of `src`, so the stylesheets ship while
|
|
52
|
+
the TypeScript source stays out. Surfaced and now guarded by the new `codefast audit publish` check.
|
|
53
|
+
|
|
3
54
|
## 0.11.0
|
|
4
55
|
|
|
5
56
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -16,13 +16,13 @@ encode an opinionated house style (called out below) that you can adopt, ignore,
|
|
|
16
16
|
|
|
17
17
|
- **Safe by default.** Every writing command supports `--dry-run`, and every audit is read-only except
|
|
18
18
|
`audit comments --fix`.
|
|
19
|
-
- **Scriptable.** `--json` prints one JSON object on stdout
|
|
19
|
+
- **Scriptable.** `--json` prints one JSON object on stdout instead of the human-readable output.
|
|
20
20
|
- **CI-ready.** Audits exit non-zero when findings remain, so they gate a pipeline with no extra glue.
|
|
21
21
|
- **Configurable.** An optional `codefast.config.*` file, validated by a strict schema, adjusts every command.
|
|
22
22
|
|
|
23
23
|
## Requirements
|
|
24
24
|
|
|
25
|
-
- **Node.js ≥
|
|
25
|
+
- **Node.js ≥ 22.12** (the CLI is published as ESM).
|
|
26
26
|
- **A project root — workspace or single package.** Commands resolve their root by walking up from the current
|
|
27
27
|
directory: the nearest `pnpm-workspace.yaml` marks a **workspace** (every package under it is in scope), and with no
|
|
28
28
|
workspace file the nearest `package.json` marks a **single package** (that one package is the whole scope). Only
|
|
@@ -75,22 +75,72 @@ codefast audit links # find broken markdown cross-
|
|
|
75
75
|
`codefast mirror --no-color`.
|
|
76
76
|
- **Writing commands write by default; pass `--dry-run` to preview.** The audits are read-only — the one exception is
|
|
77
77
|
`audit comments --fix`, which repairs section dividers in place.
|
|
78
|
-
- **`--json` prints a single JSON object on stdout**
|
|
79
|
-
|
|
78
|
+
- **`--json` prints a single JSON object on stdout** instead of the human-readable output, so any command can gate a
|
|
79
|
+
script or a CI job.
|
|
80
|
+
- **Set `CODEFAST_VERBOSE=1` (or `true`) for verbose error diagnostics.** On an unexpected infrastructure failure the
|
|
81
|
+
CLI also prints the underlying stack trace. This is distinct from `mirror --verbose`, which adds per-package progress
|
|
82
|
+
detail to that one command.
|
|
80
83
|
|
|
81
84
|
## Commands at a glance
|
|
82
85
|
|
|
86
|
+
```text
|
|
87
|
+
codefast # Codefast monorepo developer CLI
|
|
88
|
+
│ ├─ --no-color # disable ANSI color output
|
|
89
|
+
│ └─ --version
|
|
90
|
+
│
|
|
91
|
+
├─ arrange [target] # regroup Tailwind classes in cn()/tv() in render-pipeline order
|
|
92
|
+
│ │ ├─ --dry-run # preview, without writing files
|
|
93
|
+
│ │ ├─ --with-class-name # append className as the final cn() argument (alias: --with-classname)
|
|
94
|
+
│ │ ├─ --cn-import <spec> # override the module specifier when adding a cn import
|
|
95
|
+
│ │ └─ --json
|
|
96
|
+
│ │
|
|
97
|
+
│ ├─ inspect [target] # report long strings, cn nested in tv() (read-only)
|
|
98
|
+
│ │ └─ --json
|
|
99
|
+
│ ├─ simplify [target] # flatten grouped arrays & static cn() to plain strings in tv() slots
|
|
100
|
+
│ │ ├─ --dry-run
|
|
101
|
+
│ │ └─ --fold-variant-class-name # fold cn() overrides into the variant's className option (uses the TS type server)
|
|
102
|
+
│ └─ group <tokens...> # group a pasted class string (stdout: cn(...) or a tv() array with --tv)
|
|
103
|
+
│ ├─ --tv # emit a tv()-style array instead of a cn() call
|
|
104
|
+
│ ├─ --with-class-name
|
|
105
|
+
│ └─ --json
|
|
106
|
+
│
|
|
107
|
+
├─ audit # source audits (read-only source scans)
|
|
108
|
+
│ ├─ rtl [target] # physical-direction Tailwind classes to make logical / rtl:-paired
|
|
109
|
+
│ ├─ links [target] # markdown links pointing at a missing path/anchor
|
|
110
|
+
│ ├─ imports [target] # banned import forms (React by-name, Zod namespace in front-end, …)
|
|
111
|
+
│ ├─ display-names [target] # token()/tag()/module names breaking the <namespace>:<Name> convention
|
|
112
|
+
│ └─ comments [target] # section dividers not in the one allowed form
|
|
113
|
+
│ └─ --fix # rewrite every fixable divider in place (the only audit that writes)
|
|
114
|
+
│ (each audit also takes [target] + --json)
|
|
115
|
+
│
|
|
116
|
+
├─ mirror [package] # write package.json#exports from dist/ for workspace packages
|
|
117
|
+
│ ├─ --dry-run
|
|
118
|
+
│ ├─ -v, --verbose
|
|
119
|
+
│ └─ --json
|
|
120
|
+
│
|
|
121
|
+
├─ pack-slim [package] # strip src, source conditions, dev-only scripts/devDeps, source maps before publish
|
|
122
|
+
│ ├─ --dry-run
|
|
123
|
+
│ ├─ --force # run even if the git working tree has uncommitted changes
|
|
124
|
+
│ └─ --json
|
|
125
|
+
│
|
|
126
|
+
└─ tag [target] # add @since <version> to exported declarations
|
|
127
|
+
├─ --dry-run
|
|
128
|
+
└─ --json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Every command also responds to `--help`; each command's section below explains what its flags do.
|
|
132
|
+
|
|
83
133
|
| Command | What it does | Writes? |
|
|
84
134
|
| --------------------- | -------------------------------------------------------------------------- | ----------------- |
|
|
85
135
|
| `arrange` | Regroup Tailwind classes in `cn()` / `tv()` calls in render-pipeline order | yes (`--dry-run`) |
|
|
86
136
|
| `mirror` | Write each package's `package.json#exports` from its built `dist/` | yes (`--dry-run`) |
|
|
87
137
|
| `pack-slim` | Strip the dev-only surface from a package right before publish | yes (`--dry-run`) |
|
|
88
138
|
| `tag` | Stamp `@since <version>` on exported declarations that lack one | yes (`--dry-run`) |
|
|
89
|
-
| `audit links` | Report markdown cross-references that resolve to nothing | no |
|
|
90
139
|
| `audit rtl` | Report physical-direction Tailwind classes that should be logical | no |
|
|
140
|
+
| `audit links` | Report markdown cross-references that resolve to nothing | no |
|
|
91
141
|
| `audit imports` | Enforce the import policy (React by-name, Zod namespace in front-end) | no (report only) |
|
|
92
|
-
| `audit comments` | Check doc-comment conventions; repair section dividers | `--fix` only |
|
|
93
142
|
| `audit display-names` | Enforce the `namespace:Name` display-name convention | no |
|
|
143
|
+
| `audit comments` | Check doc-comment conventions; repair section dividers | `--fix` only |
|
|
94
144
|
|
|
95
145
|
**Which of these are for you?** `arrange`, `mirror`, `pack-slim`, `tag`, and `audit links` are general-purpose — they
|
|
96
146
|
work for any pnpm workspace or single package that builds with `tsc`. The other four audits encode codefast's own house
|
|
@@ -120,13 +170,6 @@ intentional; pass such a file explicitly to process it.
|
|
|
120
170
|
`#lib/utils` re-export, any `…/utils` path, or a dedicated `cn.ts` module — so an unrelated local `cn` is left alone.
|
|
121
171
|
Long static JSX `className` strings are regrouped regardless of where `cn` comes from.
|
|
122
172
|
|
|
123
|
-
| Flag | Description |
|
|
124
|
-
| -------------------- | ----------------------------------------------------------------------------- |
|
|
125
|
-
| `--dry-run` | Preview suggested replacements without writing files. |
|
|
126
|
-
| `--with-classname` | Append `className` as the final `cn()` argument (alias: `--with-class-name`). |
|
|
127
|
-
| `--cn-import <spec>` | Override the module specifier used when a missing `cn` import is added. |
|
|
128
|
-
| `--json` | Print one JSON summary on stdout (suppresses human progress). |
|
|
129
|
-
|
|
130
173
|
Exits `1` when the `arrange.onAfterWrite` hook fails, `0` otherwise.
|
|
131
174
|
|
|
132
175
|
### `arrange inspect [target]`
|
|
@@ -139,12 +182,6 @@ Flattens grouped arrays and static-only `cn()` calls back to plain strings in `t
|
|
|
139
182
|
In a mixed `cn()` call it coalesces only _adjacent_ static literals and keeps argument order, so tailwind-merge
|
|
140
183
|
precedence is unchanged (a later argument still overrides an earlier one).
|
|
141
184
|
|
|
142
|
-
| Flag | Description |
|
|
143
|
-
| -------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
144
|
-
| `--dry-run` | Show what simplify would change without writing files. |
|
|
145
|
-
| `--fold-variant-classname` | Fold `cn()` overrides into a variant function's `className` option (alias: `--fold-variant-class-name`). |
|
|
146
|
-
| `--json` | Print one JSON summary on stdout. |
|
|
147
|
-
|
|
148
185
|
With `--fold-variant-classname`, `cn(buttonVariants({ size: "sm" }), "flex-1")` becomes
|
|
149
186
|
`buttonVariants({ size: "sm", className: "flex-1" })`, and a dynamic or multi-part override folds into a `className`
|
|
150
187
|
array. The fold fires only when the native TypeScript type server confirms the callee's options accept a `className` (or
|
|
@@ -162,11 +199,7 @@ codefast arrange group "relative flex h-10 w-full items-center rounded-md bg-pri
|
|
|
162
199
|
codefast arrange group --tv "flex items-center gap-2"
|
|
163
200
|
```
|
|
164
201
|
|
|
165
|
-
|
|
166
|
-
| ------------------ | ----------------------------------------------------------------------------- |
|
|
167
|
-
| `--tv` | Emit a `tv()`-style array instead of a `cn()` call. |
|
|
168
|
-
| `--with-classname` | Append `className` as the final `cn()` argument (alias: `--with-class-name`). |
|
|
169
|
-
| `--json` | Emit `{ schemaVersion, primaryLine, bucketsCommentLine }` on stdout. |
|
|
202
|
+
With `--json`, that object is `{ schemaVersion, primaryLine, bucketsCommentLine }`.
|
|
170
203
|
|
|
171
204
|
## `mirror`
|
|
172
205
|
|
|
@@ -181,12 +214,6 @@ codefast mirror packages/ui # one package (path relative to repo root)
|
|
|
181
214
|
codefast mirror --dry-run # report changes without writing
|
|
182
215
|
```
|
|
183
216
|
|
|
184
|
-
| Flag | Description |
|
|
185
|
-
| ----------------- | ------------------------------------------------------------- |
|
|
186
|
-
| `--dry-run` | Report what would change without writing any `package.json`. |
|
|
187
|
-
| `-v`, `--verbose` | Print extra diagnostics. |
|
|
188
|
-
| `--json` | Print one JSON summary on stdout (suppresses human progress). |
|
|
189
|
-
|
|
190
217
|
Exits `1` when any package fails, `0` otherwise.
|
|
191
218
|
|
|
192
219
|
### Per-package `mirror` configuration
|
|
@@ -235,12 +262,6 @@ codefast pack-slim packages/ui # one package (path relative to repo root)
|
|
|
235
262
|
codefast pack-slim --dry-run # report what would be stripped without touching a file
|
|
236
263
|
```
|
|
237
264
|
|
|
238
|
-
| Flag | Description |
|
|
239
|
-
| ----------- | ----------------------------------------------------------------- |
|
|
240
|
-
| `--dry-run` | Report what would be stripped without touching any file. |
|
|
241
|
-
| `--force` | Run even if the git working tree has uncommitted tracked changes. |
|
|
242
|
-
| `--json` | Print one JSON summary on stdout (suppresses human progress). |
|
|
243
|
-
|
|
244
265
|
Exits `1` when any package fails, `0` otherwise.
|
|
245
266
|
|
|
246
267
|
## `tag`
|
|
@@ -256,11 +277,6 @@ codefast tag packages/ui/src # tag one directory or file
|
|
|
256
277
|
codefast tag --dry-run # summary only, no writes
|
|
257
278
|
```
|
|
258
279
|
|
|
259
|
-
| Flag | Description |
|
|
260
|
-
| ----------- | ------------------------------------------------------------- |
|
|
261
|
-
| `--dry-run` | Show summary without writing files. |
|
|
262
|
-
| `--json` | Print one JSON summary on stdout (suppresses human progress). |
|
|
263
|
-
|
|
264
280
|
Exits `1` when no target is selected, when any target fails, or when the `tag.onAfterWrite` hook fails.
|
|
265
281
|
|
|
266
282
|
## `audit`
|
|
@@ -331,11 +347,6 @@ codefast audit comments --fix # rewrite fixable dividers in place
|
|
|
331
347
|
codefast audit comments --json # machine-readable summary
|
|
332
348
|
```
|
|
333
349
|
|
|
334
|
-
| Flag | Description |
|
|
335
|
-
| -------- | ---------------------------------------------------- |
|
|
336
|
-
| `--fix` | Rewrite every mechanically fixable divider in place. |
|
|
337
|
-
| `--json` | Print one JSON summary on stdout. |
|
|
338
|
-
|
|
339
350
|
Configure exceptions via `audit.comments.allowlist` — each entry is a divider line as written or
|
|
340
351
|
`repo/relative/path.ts:<divider>`.
|
|
341
352
|
|
package/dist/arrange/command.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { formatArrangeGroupJsonOutput } from "
|
|
3
|
-
import { arrangeSuggestGroupsRequestSchema } from "
|
|
4
|
-
import { presentArrangeGroupResult } from "
|
|
5
|
-
import { suggestCnGroupsFromCli } from "
|
|
6
|
-
import { formatArrangeAnalyzeJsonOutput } from "
|
|
7
|
-
import { arrangeAnalyzeDirectoryRequestSchema } from "
|
|
8
|
-
import { presentAnalyzeReport } from "
|
|
9
|
-
import { runArrangeInspect } from "
|
|
10
|
-
import { prepareArrangeWorkspace } from "
|
|
11
|
-
import { exitCodeForArrangeResult, formatArrangeJsonOutput } from "
|
|
12
|
-
import { arrangeRunRequestSchema } from "
|
|
13
|
-
import { presentArrangeResult, presentGroupFilePreviewFromWork } from "
|
|
14
|
-
import { runArrange } from "
|
|
15
|
-
import { formatArrangeSimplifyJsonOutput } from "
|
|
16
|
-
import { arrangeSimplifyRunRequestSchema } from "
|
|
17
|
-
import { presentSimplifyResult } from "
|
|
18
|
-
import { runArrangeSimplify } from "
|
|
19
|
-
import { applyCommandPipeline, registerPipelineSubcommand } from "
|
|
20
|
-
import { consumeCliAppError } from "
|
|
21
|
-
import { CLI_EXIT_SUCCESS } from "
|
|
22
|
-
import { nodeFilesystem } from "
|
|
23
|
-
import { logger } from "
|
|
24
|
-
import { parseWithSchema } from "
|
|
2
|
+
import { formatArrangeGroupJsonOutput } from "#arrange/group/cli-result";
|
|
3
|
+
import { arrangeSuggestGroupsRequestSchema } from "#arrange/group/cli-schema";
|
|
4
|
+
import { presentArrangeGroupResult } from "#arrange/group/output";
|
|
5
|
+
import { suggestCnGroupsFromCli } from "#arrange/group/suggest";
|
|
6
|
+
import { formatArrangeAnalyzeJsonOutput } from "#arrange/inspect/cli-result";
|
|
7
|
+
import { arrangeAnalyzeDirectoryRequestSchema } from "#arrange/inspect/cli-schema";
|
|
8
|
+
import { presentAnalyzeReport } from "#arrange/inspect/output";
|
|
9
|
+
import { runArrangeInspect } from "#arrange/inspect/run";
|
|
10
|
+
import { prepareArrangeWorkspace } from "#arrange/prepare";
|
|
11
|
+
import { exitCodeForArrangeResult, formatArrangeJsonOutput } from "#arrange/regroup/cli-result";
|
|
12
|
+
import { arrangeRunRequestSchema } from "#arrange/regroup/cli-schema";
|
|
13
|
+
import { presentArrangeResult, presentGroupFilePreviewFromWork } from "#arrange/regroup/output";
|
|
14
|
+
import { runArrange } from "#arrange/regroup/run";
|
|
15
|
+
import { formatArrangeSimplifyJsonOutput } from "#arrange/simplify/cli-result";
|
|
16
|
+
import { arrangeSimplifyRunRequestSchema } from "#arrange/simplify/cli-schema";
|
|
17
|
+
import { presentSimplifyResult } from "#arrange/simplify/output";
|
|
18
|
+
import { runArrangeSimplify } from "#arrange/simplify/run";
|
|
19
|
+
import { applyCommandPipeline, registerPipelineSubcommand } from "#core/cli/command-pipeline";
|
|
20
|
+
import { consumeCliAppError } from "#core/cli/result-handle";
|
|
21
|
+
import { CLI_EXIT_SUCCESS } from "#core/exit-codes";
|
|
22
|
+
import { nodeFilesystem } from "#core/filesystem/node";
|
|
23
|
+
import { logger } from "#core/logger";
|
|
24
|
+
import { parseWithSchema } from "#core/schema-parse";
|
|
25
25
|
const targetHelp = "Directory or file (default: nearest package directory from cwd)";
|
|
26
26
|
const prepareWorkspace = (fs, input) => prepareArrangeWorkspace(fs, { currentWorkingDirectory: input.currentWorkingDirectory, rawTarget: input.rawArg });
|
|
27
27
|
const regroupPipeline = {
|
|
@@ -58,7 +58,6 @@ const inspectPipeline = {
|
|
|
58
58
|
name: "inspect",
|
|
59
59
|
description: "Report long strings, nested cn in tv(), and related findings (read-only)",
|
|
60
60
|
positional: { name: "[target]", help: targetHelp },
|
|
61
|
-
jsonHelp: "Print one JSON object on stdout instead of a human report",
|
|
62
61
|
schema: arrangeAnalyzeDirectoryRequestSchema,
|
|
63
62
|
prepare: prepareWorkspace,
|
|
64
63
|
buildRequest: ({ prelude }) => ({ analyzeRootPath: prelude.resolvedTarget }),
|
|
@@ -113,7 +112,7 @@ export function createArrangeCommand() {
|
|
|
113
112
|
.argument("<tokens...>", "Class tokens (quote a single string if it contains spaces)")
|
|
114
113
|
.option("--tv", "Emit tv()-style array instead of cn() call", false)
|
|
115
114
|
.option("--with-classname, --with-class-name", "Append className as final cn() argument", false)
|
|
116
|
-
.option("--json", "Print one JSON object on stdout instead of
|
|
115
|
+
.option("--json", "Print one JSON object on stdout instead of the human-readable output", false)
|
|
117
116
|
.action(async (classTokenSeries, opts) => {
|
|
118
117
|
const parsed = parseWithSchema(arrangeSuggestGroupsRequestSchema, {
|
|
119
118
|
inlineClasses: classTokenSeries.join(" ").trim(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DomainAstNode } from "
|
|
2
|
-
import type { ForEachStringLiteralInClassExpressionOptions, TailwindClassLiteral } from "
|
|
1
|
+
import type { DomainAstNode } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import type { ForEachStringLiteralInClassExpressionOptions, TailwindClassLiteral } from "#arrange/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Visits every static class literal reachable inside a class expression.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DomainBinaryOperator, DomainSyntaxKind, isDomainArrayLiteralExpression, isDomainTailwindClassLiteral, } from "
|
|
2
|
-
import { MAX_CLASS_EXPR_DEPTH } from "
|
|
1
|
+
import { DomainBinaryOperator, DomainSyntaxKind, isDomainArrayLiteralExpression, isDomainTailwindClassLiteral, } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { MAX_CLASS_EXPR_DEPTH } from "#arrange/domain/constants";
|
|
3
3
|
/**
|
|
4
4
|
* Visits every static class literal reachable inside a class expression.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DomainJsxAttribute } from "
|
|
2
|
-
import type { JsxClassNameStatic } from "
|
|
1
|
+
import type { DomainJsxAttribute } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import type { JsxClassNameStatic } from "#arrange/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Extracts the static literal of a JSX `className` attribute, or `undefined` when it is not static.
|
|
5
5
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDomainIdentifier, isDomainJsxExpression, isDomainTailwindClassLiteral } from "
|
|
1
|
+
import { isDomainIdentifier, isDomainJsxExpression, isDomainTailwindClassLiteral } from "#arrange/domain/ast/ast-node";
|
|
2
2
|
/**
|
|
3
3
|
* Extracts the static literal of a JSX `className` attribute, or `undefined` when it is not static.
|
|
4
4
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DomainCallExpression, DomainObjectLiteralExpression, DomainSourceFile } from "
|
|
2
|
-
import type { StringNode, TailwindClassLiteral } from "
|
|
1
|
+
import type { DomainCallExpression, DomainObjectLiteralExpression, DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import type { StringNode, TailwindClassLiteral } from "#arrange/domain/types";
|
|
3
3
|
type StringNodeVisitor = (classLiteral: TailwindClassLiteral, sourceFile: DomainSourceFile, cnCall?: DomainCallExpression) => void;
|
|
4
4
|
/**
|
|
5
5
|
* Visits every class literal reachable inside a `tv({ ... })` object, including `cn()` arguments.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isDomainArrayLiteralExpression, isDomainCallExpression, isDomainObjectLiteralExpression, isDomainPropertyAssignment, isDomainSpreadElement, isDomainTailwindClassLiteral, forEachDomainChild, } from "
|
|
2
|
-
import { CN_APPLY_LITERAL_WALK_OPTS, collectUnconditionalTailwindLiteralsFromCnArguments, forEachStringLiteralInClassExpression, isUnsafeLiteralForCnStyleApplySplit, } from "
|
|
3
|
-
import { buildKnownCnTvBindings, isCnOrTvIdentifier, propertyAssignmentNameText } from "
|
|
4
|
-
import { APPLY_MIN_TOKENS, MAX_OBJECT_DEPTH } from "
|
|
5
|
-
import { tokenizeClassString } from "
|
|
1
|
+
import { isDomainArrayLiteralExpression, isDomainCallExpression, isDomainObjectLiteralExpression, isDomainPropertyAssignment, isDomainSpreadElement, isDomainTailwindClassLiteral, forEachDomainChild, } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { CN_APPLY_LITERAL_WALK_OPTS, collectUnconditionalTailwindLiteralsFromCnArguments, forEachStringLiteralInClassExpression, isUnsafeLiteralForCnStyleApplySplit, } from "#arrange/domain/ast/collectors-cn";
|
|
3
|
+
import { buildKnownCnTvBindings, isCnOrTvIdentifier, propertyAssignmentNameText } from "#arrange/domain/ast/helpers";
|
|
4
|
+
import { APPLY_MIN_TOKENS, MAX_OBJECT_DEPTH } from "#arrange/domain/constants";
|
|
5
|
+
import { tokenizeClassString } from "#arrange/domain/tailwind-token";
|
|
6
6
|
/**
|
|
7
7
|
* Visits every class literal reachable inside a `tv({ ... })` object, including `cn()` arguments.
|
|
8
8
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DomainAstNode, DomainCallExpression, DomainPropertyAssignment, DomainSourceFile } from "
|
|
2
|
-
import { applyEditsDescending } from "
|
|
1
|
+
import type { DomainAstNode, DomainCallExpression, DomainPropertyAssignment, DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { applyEditsDescending } from "#core/source-text-edit";
|
|
3
3
|
/**
|
|
4
4
|
* Builds a set of local binding names that are imported from a known cn/tv
|
|
5
5
|
* module in `sourceFile`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isDomainIdentifier, isDomainImportDeclaration, isDomainNamedImports, isDomainNamespaceImport, isDomainPropertyAccessExpression, isDomainStringLiteral, lineOfSourcePosition, } from "
|
|
2
|
-
import { EMPTY_CN_TV_BINDINGS } from "
|
|
3
|
-
import { applyEditsDescending, indentOfLineContaining } from "
|
|
1
|
+
import { isDomainIdentifier, isDomainImportDeclaration, isDomainNamedImports, isDomainNamespaceImport, isDomainPropertyAccessExpression, isDomainStringLiteral, lineOfSourcePosition, } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { EMPTY_CN_TV_BINDINGS } from "#arrange/domain/constants";
|
|
3
|
+
import { applyEditsDescending, indentOfLineContaining } from "#core/source-text-edit";
|
|
4
4
|
/**
|
|
5
5
|
* Known module specifiers that export `cn` / `tv`.
|
|
6
6
|
*/
|
|
@@ -12,7 +12,6 @@ const KNOWN_CN_TV_MODULES = new Set([
|
|
|
12
12
|
// from "tailwind-variants"; new code should prefer "@codefast/tailwind-variants".
|
|
13
13
|
"tailwind-variants",
|
|
14
14
|
"#lib/utils",
|
|
15
|
-
"#/lib/utils",
|
|
16
15
|
"~/lib/utils",
|
|
17
16
|
"@/lib/utils",
|
|
18
17
|
]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { forEachDomainChild, isDomainArrayLiteralExpression, isDomainCallExpression, isDomainJsxAttribute, isDomainJsxExpression, isDomainObjectLiteralExpression, isDomainPropertyAssignment, isDomainSpreadElement, isDomainTailwindClassLiteral, } from "
|
|
2
|
-
import { buildKnownCnTvBindings, isCnOrTvIdentifier } from "
|
|
3
|
-
import { MAX_OBJECT_DEPTH } from "
|
|
4
|
-
import { escapeTsStringLiteralContent } from "
|
|
5
|
-
import { indentOfLineContaining } from "
|
|
1
|
+
import { forEachDomainChild, isDomainArrayLiteralExpression, isDomainCallExpression, isDomainJsxAttribute, isDomainJsxExpression, isDomainObjectLiteralExpression, isDomainPropertyAssignment, isDomainSpreadElement, isDomainTailwindClassLiteral, } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { buildKnownCnTvBindings, isCnOrTvIdentifier } from "#arrange/domain/ast/helpers";
|
|
3
|
+
import { MAX_OBJECT_DEPTH } from "#arrange/domain/constants";
|
|
4
|
+
import { escapeTsStringLiteralContent } from "#arrange/domain/source-text-formatters";
|
|
5
|
+
import { indentOfLineContaining } from "#core/source-text-edit";
|
|
6
6
|
function toFlatString(text) {
|
|
7
7
|
return `"${escapeTsStringLiteralContent(text.trim())}"`;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DomainSourceFile } from "
|
|
2
|
-
import type { GroupTarget, PlannedGroupEdit } from "
|
|
1
|
+
import type { DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import type { GroupTarget, PlannedGroupEdit } from "#arrange/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Resolves the source position where a group target's replacement begins.
|
|
5
5
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isDomainArrayLiteralExpression, isDomainJsxAttribute, isDomainPropertyAssignment, isDomainTailwindClassLiteral, forEachDomainChild, } from "
|
|
2
|
-
import { isUnsafeLiteralForCnStyleApplySplit } from "
|
|
3
|
-
import { jsxClassNameStaticLiteral } from "
|
|
4
|
-
import { collectGroupableStringNodes, slotClassString } from "
|
|
5
|
-
import { APPLY_MIN_TOKENS } from "
|
|
6
|
-
import { areCnTailwindPartitionsEquivalent, suggestCnGroups, summarizeGroupBucketLabels, } from "
|
|
7
|
-
import { escapeTsStringLiteralContent, formatArray, formatArrayElementsAsSiblingLines, formatJsxCnAttributeValue, } from "
|
|
8
|
-
import { tokenizeClassString } from "
|
|
9
|
-
import { endAfterOptionalCommaFollowingInSource, indentOfLineContaining, textPrefixFromLineStartToPosition, } from "
|
|
1
|
+
import { isDomainArrayLiteralExpression, isDomainJsxAttribute, isDomainPropertyAssignment, isDomainTailwindClassLiteral, forEachDomainChild, } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { isUnsafeLiteralForCnStyleApplySplit } from "#arrange/domain/ast/collectors-cn";
|
|
3
|
+
import { jsxClassNameStaticLiteral } from "#arrange/domain/ast/collectors-jsx";
|
|
4
|
+
import { collectGroupableStringNodes, slotClassString } from "#arrange/domain/ast/collectors-tv";
|
|
5
|
+
import { APPLY_MIN_TOKENS } from "#arrange/domain/constants";
|
|
6
|
+
import { areCnTailwindPartitionsEquivalent, suggestCnGroups, summarizeGroupBucketLabels, } from "#arrange/domain/grouping";
|
|
7
|
+
import { escapeTsStringLiteralContent, formatArray, formatArrayElementsAsSiblingLines, formatJsxCnAttributeValue, } from "#arrange/domain/source-text-formatters";
|
|
8
|
+
import { tokenizeClassString } from "#arrange/domain/tailwind-token";
|
|
9
|
+
import { endAfterOptionalCommaFollowingInSource, indentOfLineContaining, textPrefixFromLineStartToPosition, } from "#core/source-text-edit";
|
|
10
10
|
/**
|
|
11
11
|
* Resolves the source position where a group target's replacement begins.
|
|
12
12
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Anti-corruption layer: maps the oxc-parser ESTree AST to the arrange domain AST.
|
|
3
3
|
* This is the only place that parses TypeScript source for arrange AST translation.
|
|
4
4
|
*/
|
|
5
|
-
import type { DomainSourceFile } from "
|
|
5
|
+
import type { DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
6
6
|
/**
|
|
7
7
|
* The translator mapping the `oxc-parser` ESTree AST to the arrange domain AST.
|
|
8
8
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* This is the only place that parses TypeScript source for arrange AST translation.
|
|
4
4
|
*/
|
|
5
5
|
import { parseSync } from "oxc-parser";
|
|
6
|
-
import { DomainBinaryOperator, DomainSyntaxKind } from "
|
|
6
|
+
import { DomainBinaryOperator, DomainSyntaxKind } from "#arrange/domain/ast/ast-node";
|
|
7
7
|
function isOxcNode(value) {
|
|
8
8
|
return typeof value === "object" && value !== null && typeof value.type === "string";
|
|
9
9
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Rich domain: plan Tailwind class grouping / cn-in-tv unwrap for a single file.
|
|
3
3
|
* Pure: only DomainSourceFile, source strings, and options — no I/O.
|
|
4
4
|
*/
|
|
5
|
-
import type { DomainCallExpression, DomainSourceFile } from "
|
|
6
|
-
import type { GroupFileResult, PlannedGroupEdit } from "
|
|
5
|
+
import type { DomainCallExpression, DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
6
|
+
import type { GroupFileResult, PlannedGroupEdit } from "#arrange/domain/types";
|
|
7
7
|
/**
|
|
8
8
|
* A planned replacement unwrapping one `cn()` call nested in `tv({ ... })`.
|
|
9
9
|
*
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Rich domain: plan Tailwind class grouping / cn-in-tv unwrap for a single file.
|
|
3
3
|
* Pure: only DomainSourceFile, source strings, and options — no I/O.
|
|
4
4
|
*/
|
|
5
|
-
import { listAllCnCallsInsideTvInSourceFile } from "
|
|
6
|
-
import { applyEditsDescending, buildKnownCnTvBindings, unwrapCnInsideTvCallReplacement, } from "
|
|
7
|
-
import { collectGroupTargets, planGroupEditForTarget, targetReplaceStart } from "
|
|
5
|
+
import { listAllCnCallsInsideTvInSourceFile } from "#arrange/domain/ast/collectors-tv";
|
|
6
|
+
import { applyEditsDescending, buildKnownCnTvBindings, unwrapCnInsideTvCallReplacement, } from "#arrange/domain/ast/helpers";
|
|
7
|
+
import { collectGroupTargets, planGroupEditForTarget, targetReplaceStart } from "#arrange/domain/ast/targets";
|
|
8
8
|
function toUnwrapPlans(cnInTvCalls, sourceText) {
|
|
9
9
|
return cnInTvCalls
|
|
10
10
|
.map((call) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BUCKET_ORDER, MAX_GROUPS_BASE, MAX_GROUPS_CAP, MAX_GROUPS_HEADROOM, MIN_GROUP_TOKENS, } from "
|
|
2
|
-
import { stripVariants, tokenizeClassString } from "
|
|
3
|
-
import { bucketsCompatible, bucketsMergeCompatible, classifyToken, compositeSecondaryOrder, selectorKey, stateKey, } from "
|
|
1
|
+
import { BUCKET_ORDER, MAX_GROUPS_BASE, MAX_GROUPS_CAP, MAX_GROUPS_HEADROOM, MIN_GROUP_TOKENS, } from "#arrange/domain/constants";
|
|
2
|
+
import { stripVariants, tokenizeClassString } from "#arrange/domain/tailwind-token";
|
|
3
|
+
import { bucketsCompatible, bucketsMergeCompatible, classifyToken, compositeSecondaryOrder, selectorKey, stateKey, } from "#arrange/domain/token-classifier";
|
|
4
4
|
/**
|
|
5
5
|
* `cn()` grouping: bucket sequence is {@link BUCKET_ORDER} only; tokens are classified with
|
|
6
6
|
* {@link classifyToken}. Comparators here (`compareClassifiedTailwindTokensForCnGrouping`, …)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DomainSourceFile } from "
|
|
1
|
+
import type { DomainSourceFile } from "#arrange/domain/ast/ast-node";
|
|
2
2
|
/**
|
|
3
3
|
* After simplify rewrites, drop the `cn` import specifier when `cn` is no
|
|
4
4
|
* longer referenced anywhere outside the import declarations.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { forEachDomainChild, isDomainIdentifier, isDomainImportDeclaration, isDomainNamedImports, isDomainStringLiteral, } from "
|
|
2
|
-
import { endAfterOptionalCommaFollowingInSource } from "
|
|
1
|
+
import { forEachDomainChild, isDomainIdentifier, isDomainImportDeclaration, isDomainNamedImports, isDomainStringLiteral, } from "#arrange/domain/ast/ast-node";
|
|
2
|
+
import { endAfterOptionalCommaFollowingInSource } from "#core/source-text-edit";
|
|
3
3
|
function sourceFileImportsCn(sourceFile) {
|
|
4
4
|
for (const statement of sourceFile.statements) {
|
|
5
5
|
if (!isDomainImportDeclaration(statement) || !statement.importClause) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { COMPATIBLE_BUCKET_SETS, RESPONSIVE_PREFIX, STATE_PREFIXES } from "
|
|
2
|
-
import { indexOfFirstVariantColon, stripVariants } from "
|
|
1
|
+
import { COMPATIBLE_BUCKET_SETS, RESPONSIVE_PREFIX, STATE_PREFIXES } from "#arrange/domain/constants";
|
|
2
|
+
import { indexOfFirstVariantColon, stripVariants } from "#arrange/domain/tailwind-token";
|
|
3
3
|
/**
|
|
4
4
|
* Bare-token classification is **total** (always returns a {@link Bucket}). The `Result` pattern
|
|
5
5
|
* (`isOk` / `isErr`) belongs at arrange use-case / I/O boundaries, not on this hot path.
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* `arbitrary` and `other` are non-pipeline tails for `[prop:value]` syntax and unknown utilities.
|
|
9
9
|
*/
|
|
10
|
-
import type { DomainAstNode, DomainCallExpression, DomainSourceFile, DomainTailwindClassLiteral } from "
|
|
11
|
-
import type { GroupFileWorkPlan } from "
|
|
12
|
-
import type { CodefastConfig } from "
|
|
10
|
+
import type { DomainAstNode, DomainCallExpression, DomainSourceFile, DomainTailwindClassLiteral } from "#arrange/domain/ast/ast-node";
|
|
11
|
+
import type { GroupFileWorkPlan } from "#arrange/domain/grouping-service";
|
|
12
|
+
import type { CodefastConfig } from "#core/config/schema";
|
|
13
13
|
/**
|
|
14
14
|
* The render-pipeline bucket a Tailwind token classifies into.
|
|
15
15
|
*
|