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

fix(css): spread lightningcss options #14024

Merged
merged 4 commits into from
Aug 14, 2023
Merged

fix(css): spread lightningcss options #14024

merged 4 commits into from
Aug 14, 2023

Conversation

bru02
Copy link
Contributor

@bru02 bru02 commented Aug 5, 2023

Description

Before this PR lightning.d.ts had a comment saying:

Options are spread, so you can also use options that are not typed here
like visitor (not exposed because it would impact too much the bundle size)

But, in the actual implementation the options weren't spread; so you couldn't use visitor & other non-exposed features.

Furthermore, I also exposed all LightingCSS options in the types, without impacting bundle size, by not bundling LightingCSS.

This means, if you don't havelightingcss installed, LightningCSSOptions resolves to any, but otherwise you get the full types.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Aug 5, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ArnaudBarre
Copy link
Member

Oh yeah my bad I totally forgot the add the spread at the end. That's nice that TS fails very locally on the lightningCSS types reference, I need to test this on my side but like the change

ArnaudBarre
ArnaudBarre previously approved these changes Aug 11, 2023
Copy link
Member

@ArnaudBarre ArnaudBarre left a comment

Choose a reason for hiding this comment

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

I've finally decided to not spread on transformStyleAttribute.
This is used very rarely and I think it will cause more bugs in the future that will solve usecases.

Thanks for this simplification of the build!

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Nice refactor! And thanks for spotting this improvement.

@bluwy bluwy changed the title fix: spread lightningcss options fix(css): spread lightningcss options Aug 14, 2023
@bluwy bluwy added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) labels Aug 14, 2023
@patak-dev patak-dev added this to the 5.0 milestone Aug 14, 2023
@patak-dev patak-dev merged commit 63a4451 into vitejs:main Aug 14, 2023
14 checks passed
ArnaudBarre added a commit that referenced this pull request Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants