Skip to content

[babel-plugin] Allow -- prefixed keys in defineConsts to preserve user-authored names - #1460

Merged
mellyeliu merged 1 commit into
mainfrom
defineConstsDash
Jan 22, 2026
Merged

mellyeliu merged 1 commit into
mainfrom
defineConstsDash

Conversation

@mellyeliu

@mellyeliu mellyeliu commented Jan 22, 2026

Copy link
Copy Markdown
Member

Context

Similar to defineVars, keys starting with -- now preserve the user-authored name instead of being hashed. Mainly for flexibility though it comes with some safety risks.

Similar to defineVars, keys starting with -- now preserve the user-authored
name instead of being hashed. This removes the INVALID_CONST_KEY restriction.
@vercel

vercel Bot commented Jan 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
stylex Ready Ready Preview, Comment Jan 22, 2026 6:57am

Request Review

@meta-cla meta-cla 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 Jan 22, 2026
@github-actions

Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.WRLGBqbcdZ /tmp/tmp.Yp5PG9hxjV

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,311 1,311 1.00
· minified 4,150 4,150 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,793 1,793 1.00
· minified 4,915 4,915 1.00
benchmarks/size/.build/bundle.js
· compressed 496,650 496,650 1.00
· minified 4,847,840 4,847,840 1.00
benchmarks/size/.build/stylex.css
· compressed 99,853 99,853 1.00
· minified 747,541 747,541 1.00
Done in 0.08s.
Done in 0.32s.

@github-actions

Copy link
Copy Markdown

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.vrvCNsylCj /tmp/tmp.rq9LygkNNi

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 523 512 0.98 -
· complex create 63 61 0.97 -
babel-plugin: stylex.createTheme
· basic themes 429 395 0.92 !!
· complex themes 33 32 0.97 -
Done in 0.09s.
Done in 0.35s.

@mellyeliu
mellyeliu merged commit b254cb3 into main Jan 22, 2026
10 checks passed
@mellyeliu
mellyeliu deleted the defineConstsDash branch January 22, 2026 21:12
abhakat pushed a commit that referenced this pull request Feb 6, 2026
…r-authored names (#1460)

Similar to defineVars, keys starting with -- now preserve the user-authored
name instead of being hashed. This removes the INVALID_CONST_KEY restriction.
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.

1 participant