(decorator: ts.Decorator)
| 554 | * Return whether a given Angular decorator specifies `standalone: true`. |
| 555 | */ |
| 556 | export function isStandaloneDecorator(decorator: ts.Decorator): boolean | null { |
| 557 | const decoratorProps = findFirstMatchingNode(decorator, {filter: ts.isObjectLiteralExpression}); |
| 558 | if (decoratorProps === null) { |
| 559 | return null; |
| 560 | } |
| 561 | |
| 562 | for (const property of decoratorProps.properties) { |
| 563 | if (!ts.isPropertyAssignment(property)) { |
| 564 | continue; |
| 565 | } |
| 566 | // TODO(dylhunn): What if this is a dynamically evaluated expression? |
| 567 | if (property.name.getText() === 'standalone' && property.initializer.getText() === 'false') { |
| 568 | return false; |
| 569 | } |
| 570 | } |
| 571 | return true; |
| 572 | } |
| 573 | |
| 574 | /** |
| 575 | * Generate a new import. Follows the format: |
no test coverage detected