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.
- package/README.md +65 -5
- package/dist/{chunk-ZXW4S356.js → chunk-TOAZIPHJ.js} +295 -285
- package/dist/{chunk-6ZDYMYHE.mjs → chunk-VDWTCQ74.mjs} +259 -249
- package/dist/cli.js +4 -4
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +46 -134
- package/dist/index.d.ts +46 -134
- package/dist/index.js +5 -3
- package/dist/index.mjs +4 -2
- package/package.json +8 -3
- package/src/api/tailwindcss-patcher.ts +424 -0
- package/src/babel/index.ts +12 -0
- package/src/cache/context.ts +212 -0
- package/src/cache/store.ts +1440 -0
- package/src/cache/types.ts +71 -0
- package/src/cli.ts +20 -0
- package/src/commands/basic-handlers.ts +145 -0
- package/src/commands/cli.ts +56 -0
- package/src/commands/command-context.ts +77 -0
- package/src/commands/command-definitions.ts +102 -0
- package/src/commands/command-metadata.ts +68 -0
- package/src/commands/command-registrar.ts +39 -0
- package/src/commands/command-runtime.ts +33 -0
- package/src/commands/default-handler-map.ts +25 -0
- package/src/commands/migrate-config.ts +104 -0
- package/src/commands/migrate-handler.ts +67 -0
- package/src/commands/migration-aggregation.ts +100 -0
- package/src/commands/migration-args.ts +85 -0
- package/src/commands/migration-file-executor.ts +189 -0
- package/src/commands/migration-output.ts +115 -0
- package/src/commands/migration-report-loader.ts +26 -0
- package/src/commands/migration-report.ts +21 -0
- package/src/commands/migration-source.ts +318 -0
- package/src/commands/migration-target-files.ts +161 -0
- package/src/commands/migration-target-resolver.ts +34 -0
- package/src/commands/migration-types.ts +65 -0
- package/src/commands/restore-handler.ts +24 -0
- package/src/commands/status-handler.ts +17 -0
- package/src/commands/status-output.ts +60 -0
- package/src/commands/token-output.ts +30 -0
- package/src/commands/types.ts +137 -0
- package/src/commands/validate-handler.ts +42 -0
- package/src/commands/validate.ts +83 -0
- package/src/config/index.ts +25 -0
- package/src/config/workspace.ts +87 -0
- package/src/constants.ts +4 -0
- package/src/extraction/candidate-extractor.ts +354 -0
- package/src/index.ts +57 -0
- package/src/install/class-collector.ts +1 -0
- package/src/install/context-registry.ts +1 -0
- package/src/install/index.ts +5 -0
- package/src/install/patch-runner.ts +1 -0
- package/src/install/process-tailwindcss.ts +1 -0
- package/src/install/status.ts +1 -0
- package/src/logger.ts +5 -0
- package/src/options/legacy.ts +93 -0
- package/src/options/normalize.ts +262 -0
- package/src/options/types.ts +217 -0
- package/src/patching/operations/export-context/index.ts +110 -0
- package/src/patching/operations/export-context/postcss-v2.ts +235 -0
- package/src/patching/operations/export-context/postcss-v3.ts +249 -0
- package/src/patching/operations/extend-length-units.ts +197 -0
- package/src/patching/patch-runner.ts +46 -0
- package/src/patching/status.ts +262 -0
- package/src/runtime/class-collector.ts +105 -0
- package/src/runtime/collector.ts +148 -0
- package/src/runtime/context-registry.ts +65 -0
- package/src/runtime/process-tailwindcss.ts +115 -0
- package/src/types.ts +159 -0
- 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`.
|
|
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
|
|
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
|
-
|
|
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
|
|