Repository navigation
perf(widget): rename more private members in the minified builds, checked by a test - #453
Merged
Merged
Conversation
This was referenced Oct 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes room in the widget's size budget for #447 (the "New reply" pill, about 270 B), and for whatever comes after it. The panel was at 16.84 of 17 KB and the single file at 18.92 of 19 KB.
Terser's property mangling renames a property everywhere in the bundle. That's safe for a private member, but a config field, a request body key (
conversationId,messages), a stored field or a DOM property renamed by mistake breaks only the CDN build, and the unit tests run onsrc, so they'd miss it. That was my concern on #447. So instead of a longer hand-written regex:packages/widget/mangle.tsholds the list, and both Vite configs import it. The 33 names from before (EARLIER) stay as they were. They're internal on both ends, and the e2e suite runs against the minified builds.CHECKED) are the private members that are only ever used asthis.<name>. I found them by scanningsrcfor everyprivatemember and dropping any that's accessed on another object, used as an object key or shorthand, written in a string, mentioned inapi/widget.api.md, or two letters long. I also left out generic names likesend,resetandemit.tests/mangle.test.tsre-checks everyCHECKEDname on each run. It's declaredprivate, only used throughthis, never a key or a string, not in the API snapshot, and not a property ofwindowor the DOM prototypes the widget uses. AddingapiUrl,conversationIdandresetto the list makes it fail.CONTRIBUTING's widget section explains the list.
Tested: build, typecheck, test:coverage, lint (dev baseline),
api:checkand size pass. The full e2e suite passes in Chrome (69), and it loads the minified loader, panel and single-file builds.