Commit 99c1058
fix(router-plugin): handle partial declarator exports + add edge case tests
Based on comprehensive code review feedback, this commit addresses:
**Bug Fix: Partial Declarators**
When multiple variables are declared in same statement (const a = 1, b = 2),
and only some are shared between split/non-split parts, we now correctly:
- Export only the shared variables
- Keep non-shared variables local in their respective files
- Split the declaration into separate statements when needed
Before: `export const a = 1, shared = new Map()` (both exported)
After: `const a = 1; export const shared = new Map()` (only shared exported)
**New Edge Case Tests (72 total across React/Solid):**
1. Split-only variable stays local (validates main correctness guard)
2. Partial declarators - only shared ones exported
3. let with reassignment (live binding behavior)
4. Destructuring precision (promotes correct binding)
5. Alias chains (tracks through variable aliases)
6. Nested closures (finds references in function bodies)
These tests ensure the implementation correctly handles complex variable
sharing scenarios and only promotes/imports variables that are genuinely
shared between split and non-split parts.
All 360 tests passing.
Reviewer feedback incorporated from PR TanStack#5767
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 4b53742 commit 99c1058
File tree
135 files changed
+1419
-17
lines changed- packages/router-plugin
- src/core/code-splitter
- tests/code-splitter
- snapshots
- react
- 1-default
- 2-components-combined-loader-separate
- 3-all-combined-errorComponent-separate
- solid
- 1-default
- 2-components-combined-loader-separate
- 3-all-combined-errorComponent-separate
- test-files
- react
- solid
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
135 files changed
+1419
-17
lines changedLines changed: 49 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
532 | 536 | | |
533 | 537 | | |
534 | 538 | | |
| |||
541 | 545 | | |
542 | 546 | | |
543 | 547 | | |
544 | | - | |
| 548 | + | |
545 | 549 | | |
546 | 550 | | |
547 | 551 | | |
548 | 552 | | |
549 | 553 | | |
550 | 554 | | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
557 | 599 | | |
558 | 600 | | |
559 | 601 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Whitespace-only changes.
Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Whitespace-only changes.
Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments