-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Extract the ES usage analyzer from the ES minifier crate #6586
Extract the ES usage analyzer from the ES minifier crate #6586
Conversation
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.
I'm bit worried about the number of breaking changes
@@ -234,7 +234,7 @@ enum RecursiveUsage { | |||
|
|||
/// Analyzed info of a whole program we are working on. | |||
#[derive(Debug, Default)] | |||
pub(crate) struct ProgramData { | |||
pub struct ProgramData { |
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.
Are you going to use this type directly?
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.
I prefer storing this type in swc_ecma_minifier
, to reduce breaking changes.
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.
The current definition of UsageAnalyzer
depends on it: UsageAnalyzer<S = ProgramData>
. But I agree this makes more sense to live in swc_ecma_minifier
for now so I'll move it and remove the default type.
From what I can tell the only breaking change is the marks::Marks
type changing crates, and we can always re-export it from swc_ecma_minifier
.
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.
Yeah, I think it's fine. Thank you!
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.
Thank you!
swc-bump:
- swc_ecma_minifier
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.
Automated review comment generated by auto-rebase script
Head branch was pushed to by a user without write access
06e071f
to
7aa4e29
Compare
Description:
This PR extracts the EcmaScript usage analyzer from the ES minifier crate into its own crate, to make it reusable by third parties. Notably, we plan on using this in Turbopack to implement tree shaking.
BREAKING CHANGE:
The
swc_ecma_minifier::marks::Marks
type is now exported fromswc_ecma_usage_analyzer::marks::Marks
instead. It might make sense to also re-export it from theswc_ecma_minifier
crate.Related issue (if exists):
Fixes WEB-269