tailwindcss/packages/@tailwindcss-upgrade/src
Philipp Spiess 1467dab59e
Fix template migration issues (#14600)
This PR fixes two issues we found when testing the candidate codemodes:

1. Sometimes, core would emit the same candidate twice. This would
result into rewriting a range multiple times, without realizing that
this change might already be applied, causing it to swallow or duplicate
some bytes.
2. The codemods were mutating the `Candidate` object, however since the
`Candidate` parsing is _cached_ in core, it would sometimes return the
same instance. This is an issue especially since we monkey patch the
prefix to `null` when migrating prefixed candidates. This means that a
candidate would be cached that would be _invalid relative to the real
design system_. We fixed this by making sure the mutations would only be
applied to clones of the `Candidate` and I changed the `DesignSystem`
API to return `ReadOnly<T>` versions of these candidates. A better
solution would maybe be to disable the cache at all but this requires
broader changes in Core.
2024-10-08 18:06:43 +02:00
..
codemods Ensure upgrade tool has access to a JS config (#14597) 2024-10-07 18:02:28 +02:00
commands/help Add initial codemod tooling (#14434) 2024-09-18 16:45:43 +02:00
template Fix template migration issues (#14600) 2024-10-08 18:06:43 +02:00
utils Add CSS codemod for missing @layer (#14504) 2024-09-24 16:32:50 +00:00
index.test.ts Ensure upgrade tool has access to a JS config (#14597) 2024-10-07 18:02:28 +02:00
index.ts Ensure upgrade tool has access to a JS config (#14597) 2024-10-07 18:02:28 +02:00
migrate.ts Ensure upgrade tool has access to a JS config (#14597) 2024-10-07 18:02:28 +02:00