Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate legacy classes to the v4 alternative #14643

Merged
merged 6 commits into from
Oct 11, 2024

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Oct 10, 2024

This PR adds a mapping from legacy classes to new classes. For example, the flex-shrink-0 is still used in our projects, but is deprecated in v3.

The migration does a tiny bit of parsing because we can't rely on designSystem.parseCandidate(…) because this requires the utility to be defined which is not the case for legacy classes.

This migration runs after the migration where we handle prefixes, so we don't have to worry about that. We do have to worry about the ! location, because the important migration also relies on the designSystem.

Old New
overflow-clip text-clip
overflow-ellipsis text-ellipsis
flex-grow-0 grow-0
flex-shrink-0 shrink-0
decoration-clone box-decoration-clone
decoration-slice box-decoration-slice

We were passing through the extension, but weren't using it.
@RobinMalfait RobinMalfait force-pushed the feat/migrate-legacy-classes branch from 1a958f4 to 8a09726 Compare October 10, 2024 20:46
@RobinMalfait RobinMalfait changed the title Migrate legacy classes to the new v4 alternative Migrate legacy classes to the v4 alternative Oct 10, 2024
with the `in`, we go up the prototype chain. Which means that this
happens:

```js
let utility = 'constructor'

utility in LEGACY_CLASS_MAP // true
LEGACY_CLASS_MAP[utility].toString() // function Object() { [native code] }
```
We will register empty utilities for the old legacy classes, this way we
can rely on the design system and the real parser to get an Candidate
AST out of the rawCandidate.
Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicee

@RobinMalfait RobinMalfait merged commit bd3d6bc into next Oct 11, 2024
1 check passed
@RobinMalfait RobinMalfait deleted the feat/migrate-legacy-classes branch October 11, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants