Commit 2a41068
Fix critical PPX bug: DOM element externals not injected at structure level
**Root Cause**: External declarations for DOM elements with data attributes
were generated at expression level but only injected at structure level,
causing "Unbound value makeProps_div_*" compilation errors.
**Technical Analysis**:
- DOM elements processed in `transformLowercaseCall3` (expression level)
- External declarations stored in `externalDeclarations` ref
- But externals only injected in `method! structure` which resets the ref
- Result: DOM element externals never reach final AST output
**Solution**: Modified structure processing to preserve externals across
nested contexts by:
1. Storing parent externals before processing
2. Collecting all externals (React components + DOM elements)
3. Restoring and accumulating externals properly
4. Injecting all externals at structure boundaries
**Maintains**:
- Existing functionality for React components
- Deduplication logic (externalExists check)
- Zero-runtime performance (compile-time only)
- Kebab-case transformation (data_test_id → data-test-id)
**Fixes**: All DOM elements with data attributes now compile successfully
including nested modules, functions, and complex nested structures.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 4ca0aa3 commit 2a41068
2 files changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
236 | | - | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
| 271 | + | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1464 | 1464 | | |
1465 | 1465 | | |
1466 | 1466 | | |
| 1467 | + | |
| 1468 | + | |
1467 | 1469 | | |
1468 | 1470 | | |
| 1471 | + | |
1469 | 1472 | | |
1470 | 1473 | | |
1471 | | - | |
1472 | | - | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1473 | 1479 | | |
1474 | | - | |
| 1480 | + | |
| 1481 | + | |
1475 | 1482 | | |
1476 | 1483 | | |
1477 | 1484 | | |
| |||
0 commit comments