(programPath)
| 522 | |
| 523 | babel.traverse(options.ast, { |
| 524 | Program(programPath) { |
| 525 | programPath.traverse({ |
| 526 | JSXElement(path) { |
| 527 | if (getJSXElementName(path.node) !== localName) return |
| 528 | |
| 529 | if (options.env === 'server') { |
| 530 | path.node.openingElement.attributes = |
| 531 | path.node.openingElement.attributes.filter((item) => { |
| 532 | if ( |
| 533 | t.isJSXAttribute(item) && |
| 534 | t.isJSXIdentifier(item.name, { name: 'fallback' }) |
| 535 | ) { |
| 536 | if (item.value) { |
| 537 | stripBindingsOnlyReferencedBy(path, item.value) |
| 538 | } |
| 539 | state.modified = true |
| 540 | return false |
| 541 | } |
| 542 | |
| 543 | if ( |
| 544 | t.isJSXSpreadAttribute(item) && |
| 545 | t.isObjectExpression(item.argument) |
| 546 | ) { |
| 547 | if ( |
| 548 | stripObjectExpressionProperty( |
| 549 | path, |
| 550 | item.argument, |
| 551 | 'fallback', |
| 552 | ) |
| 553 | ) { |
| 554 | state.modified = true |
| 555 | } |
| 556 | return item.argument.properties.length > 0 |
| 557 | } |
| 558 | |
| 559 | if ( |
| 560 | t.isJSXSpreadAttribute(item) && |
| 561 | t.isIdentifier(item.argument) |
| 562 | ) { |
| 563 | const init = getSingleUseObjectExpressionBinding( |
| 564 | path, |
| 565 | item.argument, |
| 566 | ) |
| 567 | if ( |
| 568 | init && |
| 569 | stripObjectExpressionProperty(path, init, 'fallback') |
| 570 | ) { |
| 571 | state.modified = true |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | return true |
| 576 | }) |
| 577 | } |
| 578 | |
| 579 | const split = getBooleanProp(path.node.openingElement, 'split') |
| 580 | if (split === false) return |
| 581 |
nothing calls this directly
no test coverage detected