(decorator: ts.Decorator)
| 584 | * Return whether a given Angular decorator specifies `standalone: true`. |
| 585 | */ |
| 586 | export function isStandaloneDecorator(decorator: ts.Decorator): boolean | null { |
| 587 | const decoratorProps = findFirstMatchingNode(decorator, {filter: ts.isObjectLiteralExpression}); |
| 588 | if (decoratorProps === null) { |
| 589 | return null; |
| 590 | } |
| 591 | |
| 592 | for (const property of decoratorProps.properties) { |
| 593 | if (!ts.isPropertyAssignment(property)) { |
| 594 | continue; |
| 595 | } |
| 596 | // TODO(dylhunn): What if this is a dynamically evaluated expression? |
| 597 | if (property.name.getText() === 'standalone' && property.initializer.getText() === 'false') { |
| 598 | return false; |
| 599 | } |
| 600 | } |
| 601 | return true; |
| 602 | } |
| 603 | |
| 604 | /** |
| 605 | * Generate a new import. Follows the format: |
no test coverage detected