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

Function componentRef

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

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

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

Source from the content-addressed store, hash-verified

224
225/** The component a `component:` / `loadComponent:` value names. */
226function 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. */
236function 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