Skip to content

fix(babel-plugin): preserve source locations for SSR captures - #3783

Merged
ryansolid merged 1 commit into
solidjs:nextfrom
everton-dgn:fix/ssr-capture-source-locations
Oct 5, 2026
Merged

ryansolid merged 1 commit into
solidjs:nextfrom
everton-dgn:fix/ssr-capture-source-locations

Conversation

@everton-dgn

Copy link
Copy Markdown

Hoisted SSR props constructors created capture arguments without source locations. Their source-map entries inherited nearby positions: in a dynamic TSRX tag, a capture at column 21 mapped to column 27.

Use the location of the first authored reference for each captured binding when building the constructor arguments. Keep comments attached to the original reference. Add map assertions for dynamic tags, repeated getters, refs, Unicode, and nested shadowing in development and production.

Validation:

  • All six regressions failed before the fix and pass afterward.
  • Full Babel suite: 281 tests passed; typecheck and Prettier passed.
  • The emitted JavaScript for the six cases is byte-for-byte unchanged. Four additional regressions verify that block and line comments appear only once. Existing SSR runtime-stub tests also passed.

@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 506eb5b

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

This PR includes changesets to release 12 packages
Name Type
@solidjs/babel-plugin Patch
test-integration Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal Patch
@solidjs/web Patch
todos-server-example 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

@codspeed

codspeed Bot commented Oct 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 185 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing everton-dgn:fix/ssr-capture-source-locations (506eb5b) with next (1b9ceb6)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ryansolid
ryansolid merged commit 7513131 into solidjs:next Oct 5, 2026
7 checks passed
@ryansolid

Copy link
Copy Markdown
Member

Merged — thanks for the SSR capture source-location fix and the source-map assertions!

One follow-up: the native compiler (@solidjs/compiler) still has the same gap. In ssr/props.rs its new _P$(…) capture arguments are built with a dummy span, so they map to the start of the JSX element (for example column 9 instead of 22). Also, for a dynamic TSRX tag it doesn't hoist a props constructor at all. The equivalent native fix hasn't landed yet.

— Claude via Cursor

ryansolid added a commit that referenced this pull request Oct 5, 2026
Port #3783 to the native compiler: each captured binding argument of a
hoisted SSR props constructor carries the span of the binding's first
authored reference instead of a dummy span, so source maps point at the
authored expression rather than the start of the JSX element.

The source-map checks from #3783 move to a shared expectation module
(babel-plugin/test/__shared_fixtures__/ssrCaptureMaps) that both the
Babel spec and a new native suite run against.

Co-authored-by: Claude via Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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