MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / componentRef

Function componentRef

src/resolution/frameworks/angular-router.ts:228–235  ·  view source on GitHub ↗

The component a `component:` / `loadComponent:` value names.

(field: 'component' | 'loadComponent', text: string)

Source from the content-addressed store, hash-verified

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

Callers 1

walkFunction · 0.85

Calls 2

lazyImportFunction · 0.85
execMethod · 0.65

Tested by

no test coverage detected