The component a `component:` / `loadComponent:` value names.
(field: 'component' | 'loadComponent', text: string)
| 224 | |
| 225 | /** The component a `component:` / `loadComponent:` value names. */ |
| 226 | function componentRef(field: 'component' | 'loadComponent', text: string): AngularComponentRef | null { |
| 227 | if (field === 'component') { |
| 228 | const ident = /^\s*([A-Z][\w$]*)\s*$/.exec(text); |
| 229 | return ident ? { name: ident[1]!, spec: null } : null; |
| 230 | } |
| 231 | const lazy = lazyImport(text); |
| 232 | return lazy ? { name: lazy.member, spec: lazy.spec } : null; |
| 233 | } |
| 234 | |
| 235 | /** `() => import('./x')` → `./x`; `.then(m => m.X)` / `.then((c) => c.X)` names the member. */ |
| 236 | function lazyImport(text: string): { spec: string; member: string | null } | null { |
no test coverage detected