-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Detect and migrate static plugin usages #14648
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19afa8f to
ea0dc30
Compare
51fd7af to
d86af92
Compare
dccb8a0 to
dec4153
Compare
0ef9065 to
82c81ff
Compare
Member
Author
|
(Purposely not adding a change log since it's still covered in the initial JS config => CSS change log entry) |
philipp-spiess
commented
Oct 14, 2024
| switch (pluginDefinition.type) { | ||
| case 'identifier': | ||
| let source = imports[pluginDefinition.text] | ||
| if (!source || (source.export !== null && source.export !== '*')) { |
Member
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also be default
Member
Author
|
Will add support for this in a follow-up: import typography from '@tailwindcss/typography'
plugins: [
require('@tailwindcss/typography')({
className: 'wysiwyg',
}),
typography({
className: 'wysiwyg',
})
] |
70c69a5 to
c68258f
Compare
adamwathan
approved these changes
Oct 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR builds on top of the new JS config to CSS migration and extends it to support migrating static plugins.
What are static plugins you might ask? Static plugins are plugins where we can statically determine that these are coming from a different file (so there is nothing inside the JS config that creates them). An example for this is this config file:
Here, the
pluginsarray only has one element and it is a static import from the@tailwindcss/typographymodule. In this PR we attempt to parse the config file via Tree-sitter to extract the following information from this file:pluginsarrayWe then check if all entries in the
pluginsarray are either static resources or strings (something I saw working in some tests but I’m not sure it still does). We migrate the JS config file to CSS if all plugins are static and we can migrate them to CSS@plugincalls.