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

Chore: More sane config options #20

Merged
merged 2 commits into from
Dec 1, 2023
Merged

Chore: More sane config options #20

merged 2 commits into from
Dec 1, 2023

Conversation

nmn
Copy link
Contributor

@nmn nmn commented Nov 30, 2023

Previously there were two options with unexpected results:

  1. When dev was true it would enable both debug class names and runtime style injection.
  2. There was no way to keep debug class names without runtime injection.
  3. Runtime injection would also be enabled if stylexSheetName was not set.
  4. Setting stylexSheetName to anything other than the default value of '<>' would change the generated hashes.

In this PR

  1. The stylexSheetName option has been removed. There is currently no way to provide a "salt" for the hashing function.
  2. A new runtimeInjection option has been added with a boolean value which solely controls whether runtime style injection is enabled.
  3. runtimeInjection defaults to the value of dev. dev defaults to false.

Notable Changes

  • In the tests for the rollup plugin, all the generated hashes have changed. This is caused because it was previously using a custom value for stylexSheetName. Now the generated hashes are consistent with StyleX usage elsewhere.

Cause of bad formatting of some inline snapshots

  • Jest 29 (the current version) is incompatible with prettier 3.
  • Prettier 2 doesn't work well with haste parser
  • This sometimes causes inline snapshots to not format correctly.
  • In a follow-up PR, updating jest to v30.0.0-alpha.1 should fix the problem.

Copy link

vercel bot commented Nov 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
stylex ✅ Ready (Inspect) Visit Preview Nov 30, 2023 8:59am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 30, 2023
Copy link

compressed-size: runtime library

Size change: 0.00 kB
Total size: 2.36 kB

View unchanged
Filename: gzip (minify) kB size kB change % change
./packages/stylex/lib/stylex.js 1.02 (3.53) 0.00 (0.00) 0.0% (0.0%)
./packages/stylex/lib/StyleXSheet.js 1.34 (3.41) 0.00 (0.00) 0.0% (0.0%)

Copy link

github-actions bot commented Nov 30, 2023

compressed-size: e2e bundles

Size change: +0.17 kB
Total size: 1119.56 kB

Filename: gzip (minify) kB size kB change % change
./apps/rollup-example/.build/bundle.js 1005.35 (9859.61) +0.13 (-12.92) 0.0% (-0.1%) 🔴
./apps/rollup-example/.build/stylex.css 114.22 (456.05) +0.04 (+0.09) 0.0% (0.0%) 🔴

@nmn nmn requested review from necolas, nestorvanz and Jta26 November 30, 2023 23:18
* Chore: Update dependencies

* #21 <- Feat: Add config for px-to-rem conversion (#22)

* Feat: Add config for px-to-rem conversion

* Chore: Update website for new config options (#23)
@nmn nmn merged commit be21b5b into main Dec 1, 2023
8 checks passed
@nmn nmn deleted the clean-up-config branch December 1, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants