-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🏗🚀 Mangle values of specific enum objects #36935
Conversation
Hey @erwinmombay! These files were changed:
Hey @jridgewell! These files were changed:
Hey @gmajoulet, @newmuis! These files were changed:
|
build-system/babel-plugins/babel-plugin-mangle-object-values/index.js
Outdated
Show resolved
Hide resolved
build-system/babel-plugins/babel-plugin-mangle-object-values/index.js
Outdated
Show resolved
Hide resolved
if (!charset) { | ||
// Letters first since they allow unbracketed syntax when used as keys: | ||
// (foo.a0 vs. foo['0a']) | ||
charset = indexCharset( |
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.
Optional: If there are only 10 (or fewer) enum values, we could optimize to a number instead. That'd save a few bytes.
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.
If we use numbers let's please exclude 0
that's falsy
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.
From my local output, using numbers from 0..99
seems to reduce the amp-story
bundle by a further 75 B compressed. Cool!
Note that I'm using letters only for values ≥ 99 since we could be using the enum values as keys (like StateProperty
) and we'd like to prevent the collision of foo[0] vs. foo['0']
...tem/babel-plugins/babel-plugin-mangle-object-values/test/fixtures/transform/mangle/output.js
Outdated
Show resolved
Hide resolved
8352b92
to
bb78393
Compare
This reverts commit 5f27973.
Reduces compressed size of
amp-story
bundles by ~0.6K