tailwindcss-patch 8.7.4-alpha.0 → 9.0.0-alpha.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.
Files changed (70) hide show
  1. package/README.md +65 -5
  2. package/dist/{chunk-ZXW4S356.js → chunk-TOAZIPHJ.js} +295 -285
  3. package/dist/{chunk-6ZDYMYHE.mjs → chunk-VDWTCQ74.mjs} +259 -249
  4. package/dist/cli.js +4 -4
  5. package/dist/cli.mjs +1 -1
  6. package/dist/index.d.mts +46 -134
  7. package/dist/index.d.ts +46 -134
  8. package/dist/index.js +5 -3
  9. package/dist/index.mjs +4 -2
  10. package/package.json +8 -3
  11. package/src/api/tailwindcss-patcher.ts +424 -0
  12. package/src/babel/index.ts +12 -0
  13. package/src/cache/context.ts +212 -0
  14. package/src/cache/store.ts +1440 -0
  15. package/src/cache/types.ts +71 -0
  16. package/src/cli.ts +20 -0
  17. package/src/commands/basic-handlers.ts +145 -0
  18. package/src/commands/cli.ts +56 -0
  19. package/src/commands/command-context.ts +77 -0
  20. package/src/commands/command-definitions.ts +102 -0
  21. package/src/commands/command-metadata.ts +68 -0
  22. package/src/commands/command-registrar.ts +39 -0
  23. package/src/commands/command-runtime.ts +33 -0
  24. package/src/commands/default-handler-map.ts +25 -0
  25. package/src/commands/migrate-config.ts +104 -0
  26. package/src/commands/migrate-handler.ts +67 -0
  27. package/src/commands/migration-aggregation.ts +100 -0
  28. package/src/commands/migration-args.ts +85 -0
  29. package/src/commands/migration-file-executor.ts +189 -0
  30. package/src/commands/migration-output.ts +115 -0
  31. package/src/commands/migration-report-loader.ts +26 -0
  32. package/src/commands/migration-report.ts +21 -0
  33. package/src/commands/migration-source.ts +318 -0
  34. package/src/commands/migration-target-files.ts +161 -0
  35. package/src/commands/migration-target-resolver.ts +34 -0
  36. package/src/commands/migration-types.ts +65 -0
  37. package/src/commands/restore-handler.ts +24 -0
  38. package/src/commands/status-handler.ts +17 -0
  39. package/src/commands/status-output.ts +60 -0
  40. package/src/commands/token-output.ts +30 -0
  41. package/src/commands/types.ts +137 -0
  42. package/src/commands/validate-handler.ts +42 -0
  43. package/src/commands/validate.ts +83 -0
  44. package/src/config/index.ts +25 -0
  45. package/src/config/workspace.ts +87 -0
  46. package/src/constants.ts +4 -0
  47. package/src/extraction/candidate-extractor.ts +354 -0
  48. package/src/index.ts +57 -0
  49. package/src/install/class-collector.ts +1 -0
  50. package/src/install/context-registry.ts +1 -0
  51. package/src/install/index.ts +5 -0
  52. package/src/install/patch-runner.ts +1 -0
  53. package/src/install/process-tailwindcss.ts +1 -0
  54. package/src/install/status.ts +1 -0
  55. package/src/logger.ts +5 -0
  56. package/src/options/legacy.ts +93 -0
  57. package/src/options/normalize.ts +262 -0
  58. package/src/options/types.ts +217 -0
  59. package/src/patching/operations/export-context/index.ts +110 -0
  60. package/src/patching/operations/export-context/postcss-v2.ts +235 -0
  61. package/src/patching/operations/export-context/postcss-v3.ts +249 -0
  62. package/src/patching/operations/extend-length-units.ts +197 -0
  63. package/src/patching/patch-runner.ts +46 -0
  64. package/src/patching/status.ts +262 -0
  65. package/src/runtime/class-collector.ts +105 -0
  66. package/src/runtime/collector.ts +148 -0
  67. package/src/runtime/context-registry.ts +65 -0
  68. package/src/runtime/process-tailwindcss.ts +115 -0
  69. package/src/types.ts +159 -0
  70. package/src/utils.ts +52 -0
package/README.md CHANGED
@@ -115,7 +115,69 @@ Skip `next()` to fully replace a command (e.g. custom `init` or cache clearing b
115
115
  | `--css <file>` | Provide a CSS entry file when working with Tailwind v4 projects. |
116
116
  | `--no-write` | Skip writing to disk and only return the collected classes. |
117
117
 
118
- The CLI loads `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. Legacy configs continue to work; see the [migration guide](./MIGRATION.md) for hints on the new fields.
118
+ The CLI loads `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. v9 expects the modern `registry` shape; use `tw-patch migrate` before upgrading if your config still uses deprecated keys.
119
+
120
+ ### Public Type Names
121
+
122
+ The current alpha exports the modern option type names only:
123
+
124
+ ```ts
125
+ import type {
126
+ ApplyOptions,
127
+ CacheOptions,
128
+ ExtractOptions,
129
+ TailwindCssOptions,
130
+ TailwindCssPatchOptions,
131
+ TailwindV2Options,
132
+ TailwindV3Options,
133
+ TailwindV4Options,
134
+ NormalizedTailwindCssPatchOptions,
135
+ } from 'tailwindcss-patch'
136
+ ```
137
+
138
+ Older aliases such as `TailwindcssPatchOptions`, `TailwindLocatorOptions`, and `TailwindTargetOptions` are intentionally removed in the alpha line.
139
+
140
+ ### v9 upgrade flow
141
+
142
+ 1. Run `pnpm dlx tw-patch migrate --dry-run` to preview required config rewrites.
143
+ 2. Apply the migration, or rewrite the config manually to modern `registry` fields.
144
+ 3. Confirm every config sets `registry.tailwindcss.version` explicitly.
145
+ 4. Upgrade to v9 and rerun `tw-patch install` / `tw-patch extract` in your project.
146
+
147
+ Legacy to v9 example:
148
+
149
+ ```ts
150
+ // before
151
+ export default defineConfig({
152
+ registry: {
153
+ output: {
154
+ file: '.tw-patch/tw-class-list.json',
155
+ },
156
+ tailwind: {
157
+ package: 'tailwindcss',
158
+ classic: {
159
+ cwd: 'apps/web',
160
+ },
161
+ },
162
+ },
163
+ })
164
+
165
+ // after
166
+ export default defineConfig({
167
+ registry: {
168
+ extract: {
169
+ file: '.tw-patch/tw-class-list.json',
170
+ },
171
+ tailwindcss: {
172
+ version: 3,
173
+ packageName: 'tailwindcss',
174
+ v3: {
175
+ cwd: 'apps/web',
176
+ },
177
+ },
178
+ },
179
+ })
180
+ ```
119
181
 
120
182
  ### Migrate options
121
183
 
@@ -296,9 +358,7 @@ const patchStatus = await patcher.getPatchStatus()
296
358
  console.log(patchStatus.entries)
297
359
  ```
298
360
 
299
- The constructor accepts either the new object shown above or historical shapes. Conversions happen internally so existing configs remain backwards compatible.
300
-
301
- Deprecated fields kept temporarily (to be removed in the next major): `cwd`, `overwrite`, `tailwind`, `features`, `output`.
361
+ The constructor accepts the modern object shown above only in v9.
302
362
 
303
363
  Migration mapping:
304
364
 
@@ -308,7 +368,7 @@ Migration mapping:
308
368
  - `features` -> `apply`
309
369
  - `output` -> `extract`
310
370
 
311
- When deprecated fields are detected at runtime, `normalizeOptions` logs a one-time warning to help migration.
371
+ Deprecated fields are rejected at runtime in v9. Run `tw-patch migrate --dry-run` to preview required rewrites.
312
372
 
313
373
  Use cache.driver to switch between the default file-backed cache, an in-memory cache (memory), or a no-op cache (noop) when filesystem permissions are restricted.
314
374