Skip to content

feat(compiler,babel-plugin,solid): componentNames flag — component owner labels that survive minification - #3340

Merged
ryansolid merged 2 commits into
nextfrom
observe-component-names
Sep 10, 2026
Merged

feat(compiler,babel-plugin,solid): componentNames flag — component owner labels that survive minification#3340
ryansolid merged 2 commits into
nextfrom
observe-component-names

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Summary

Compiler flag componentNames (off by default): DOM output carries the tag as written in source as a third createComponent argument, 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 same ownerPath reads by component.

Before (minified observe build, Sentry adapter spike):

<o> › <r> › computed › <mc> › <children> › <pq> › computed › <hc> › computed › <ro> › value › <r> › computed › <IK>

After:

<Router> › <RouterContextObj> › computed › <Root> › <RootComp> › <Layout> › computed › <Routes> › computed › <Show> › value › <RouteContextObj> › computed › <RK> › <For> › <For>

(<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, default false. <Home />createComponent(Home, props, "Home"); <Ui.Button />"Ui.Button"; <For>"For" (the source name, not the _$For alias); <this.Row />"this.Row" (both compilers rewrite this to _self$ before component lowering — Babel tracks the rewritten identifiers in a WeakSet, Rust checks the span's source text).
  • DOM output only. SSR keeps inlining Comp(props); universal/dynamic never emit (the renderer owns a two-argument createComponent).
  • Off → byte-identical output.
  • Parity: shared fixture dir (__dom_component_names_fixtures__, including a generate: "ssr" case proving inertness), a dom-component-names mode 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-fixture options.json the way Babel's runner does.

Runtime (solid-js)

  • createComponent(Comp, props, name?). observedComponent labels 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-plugin turns the flag on for the dev posture and a new observe posture (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/size scenarios all within limits.

Co-authored with Claude via Cursor.

… 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-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: adc5cd1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
solid-js Patch
test-integration Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
@solidjs/universal Patch
@solidjs/web Patch
@solidjs/diagnostics Patch
@solidjs/signals Patch

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

@coveralls

coveralls commented Sep 10, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 34518563542

Coverage increased (+0.02%) to 71.842%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 3 of 3 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1007
Covered Lines: 772
Line Coverage: 76.66%
Relevant Branches: 790
Covered Branches: 519
Branch Coverage: 65.7%
Branches in Coverage %: Yes
Coverage Strength: 15.01 hits per line

💛 - Coveralls

@codspeed-hq

codspeed-hq Bot commented Sep 10, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 151 untouched benchmarks


Comparing observe-component-names (adc5cd1) with next (51c201f)

Open in CodSpeed

@ryansolid
ryansolid merged commit 01ac18c into next Sep 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants