Skip to content

feat(framework): slot extraction — Babel AST parser for defineSlots#183

Merged
qantrepreneur merged 2 commits into
mainfrom
171-slot-extraction
May 17, 2026
Merged

feat(framework): slot extraction — Babel AST parser for defineSlots#183
qantrepreneur merged 2 commits into
mainfrom
171-slot-extraction

Conversation

@qantrepreneur
Copy link
Copy Markdown
Contributor

Summary

  • Parse route module source to extract each slot's JSX + dependency closure into standalone virtual module strings
  • Supports inline JSX, imported components, block bodies with locals, multi-component trees, conditional expressions
  • Adds @babel/parser, @babel/traverse, @babel/generator, @babel/types as framework deps

Test plan

  • Inline JSX with loaderData refs → correct param and references
  • Imported component → only referenced component imported
  • Block body with locals → locals hoisted, transitive imports resolved
  • Multi-component JSX → all components imported
  • Conditional expression → both branches' deps included
  • No defineSlots → empty map
  • Static slot → no loaderData param
  • Full test suite passes (236 tests)

Closes #171

🤖 Generated with Claude Code

Lorenzo and others added 2 commits May 17, 2026 23:54
Parse route modules to extract each slot's JSX and dependency closure
into standalone virtual module source strings. Supports inline JSX,
imported components, block bodies with locals, multi-component trees,
and conditional expressions.

Closes #171

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove CJS interop dance, non-null assertions, and unnecessary type
casts. Use proper Babel types, explicit null coalescing via sliceNode
helper, and structured control flow instead of continue statements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qantrepreneur qantrepreneur merged commit 19a39e7 into main May 17, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request May 17, 2026
qantrepreneur added a commit that referenced this pull request May 21, 2026
…183)

* feat(framework): slot extraction — Babel AST parser for defineSlots

Parse route modules to extract each slot's JSX and dependency closure
into standalone virtual module source strings. Supports inline JSX,
imported components, block bodies with locals, multi-component trees,
and conditional expressions.

Closes #171

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(framework): clean up slot extraction — remove hacks and casts

Remove CJS interop dance, non-null assertions, and unnecessary type
casts. Use proper Babel types, explicit null coalescing via sliceNode
helper, and structured control flow instead of continue statements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Lorenzo <lorenzofkramer@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 23, 2026
@qantrepreneur qantrepreneur deleted the 171-slot-extraction branch May 24, 2026 13:03
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.

feat(framework): slot extraction — Babel AST parser for defineSlots

1 participant