Skip to content

Remove all @keyframes in reference import mode #15581

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

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Jan 9, 2025

This PR fixes an issue where JavaScript plugins were still able to contribute @keyframes when loaded inside an @reference import. This was possible because we only gated the addBase API and not the addUtilities one which also has a special branch to handle @keyframe rules.

To make this work, we have to create a new instance of the plugin API that has awareness of wether the plugin accessing it is inside reference import mode.

Test plan

Added a unit test that reproduces the issue observed via #15544

@philipp-spiess philipp-spiess force-pushed the fix/rm-unknown-at-rules-from-reference-mode branch from ecd2e6d to 21bc021 Compare January 9, 2025 12:38
@philipp-spiess philipp-spiess changed the title Remove all @keyframes in reference mode Remove all @keyframes in reference import mode Jan 9, 2025
Comment on lines +223 to +225
if (!referenceMode) {
ast.push(rule(name, objectToAst(css)))
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was the place where previously it's possible to sneak-through @keyframes even when the plugin is inside an @reference import

@philipp-spiess philipp-spiess force-pushed the fix/rm-unknown-at-rules-from-reference-mode branch from 21bc021 to c7dedf6 Compare January 9, 2025 12:44
@philipp-spiess philipp-spiess marked this pull request as ready for review January 9, 2025 12:46
@philipp-spiess philipp-spiess requested a review from a team as a code owner January 9, 2025 12:46
@philipp-spiess philipp-spiess merged commit d7c8448 into next Jan 9, 2025
5 checks passed
@philipp-spiess philipp-spiess deleted the fix/rm-unknown-at-rules-from-reference-mode branch January 9, 2025 16:14
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