feat(compiler,babel-plugin,solid): componentNames flag — component owner labels that survive minification - #3340
Merged
Merged
Conversation
… that survive minification DOM output carries the source tag name as createComponent's third argument (createComponent(Home, props, "Home")); dev/observe runtimes label the owner with it, prod ignores it. Off by default, byte-identical when off; SSR and universal never emit. Both compilers in parity (shared fixtures, cross-mode ratchet, per-fixture options.json in the harness). Co-authored-by: Claude via Cursor <noreply@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: adc5cd1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Coverage Report for CI Build 34518563542Coverage increased (+0.02%) to 71.842%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.
Summary
Compiler flag
componentNames(off by default): DOM output carries the tag as written in source as a thirdcreateComponentargument, and the dev/observe runtimes label the component's owner with it. Observe-tier production bundles currently report hot scopes and holds under whatever the minifier left of the function name; with the flag, the sameownerPathreads by component.Before (minified observe build, Sentry adapter spike):
After:
(
<RK>is the route component the router invokes by value —createComponent(route.component, props)— so no tag exists to name it from; that's a router-side call.)Compilers (
@solidjs/babel-plugin,@solidjs/compiler)componentNames: boolean, defaultfalse.<Home />→createComponent(Home, props, "Home");<Ui.Button />→"Ui.Button";<For>→"For"(the source name, not the_$Foralias);<this.Row />→"this.Row"(both compilers rewritethisto_self$before component lowering — Babel tracks the rewritten identifiers in a WeakSet, Rust checks the span's source text).Comp(props); universal/dynamic never emit (the renderer owns a two-argumentcreateComponent).__dom_component_names_fixtures__, including agenerate: "ssr"case proving inertness), adom-component-namesmode in the parity harness so the cross-mode ratchet compiles every existing fixture through the flag too (zero divergences, no expectation files), and the harness now honors per-fixtureoptions.jsonthe way Babel's runner does.Runtime (
solid-js)createComponent(Comp, props, name?).observedComponentlabels the owner<${name || Comp.name || "Anonymous"}>and uses the resolved name for the devtools_component.name(anonymous stays""). Prod ignores the argument. Size scenarios within limits.Integration
@solidjs/vite-pluginturns the flag on for the dev posture and a newobserveposture (solidjs/vite-plugin PR follows; it needs the compiler release that carries the option).Tests
babel-plugin 257, compiler 5741, solid 595, web 725 — green.
scripts/sizescenarios all within limits.Co-authored with Claude via Cursor.