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

Function lazyPropertiesRender

src/resolution/frameworks/react.ts:1604–1612  ·  view source on GitHub ↗

* React Router 7's object of lazy properties, `lazy: { loader: …, Component: * async () => (await import('./x')).Page }`: each loads on its own, and the * `Component`'s loader resolves to the page itself.

(code: string)

Source from the content-addressed store, hash-verified

1602 * `Component`'s loader resolves to the page itself.
1603 */
1604function lazyPropertiesRender(code: string): string | null | undefined {
1605 if (matchBracket(code, 0) !== code.length - 1) return undefined;
1606 const component = objectEntries(code.slice(1, -1)).props.get('Component');
1607 if (component === undefined) return null;
1608 const page = pageReference(loaderValue(component, new Map()));
1609 if (page) return page;
1610 const spec = FIRST_IMPORT.exec(component)?.[1];
1611 return spec ? LAZY_ROUTE_PREFIX + spec : undefined;
1612}
1613
1614/** The distinct exports `text` uses through the names a loader bound them to: `Page`, `m.Page`. */
1615function loadedExports(text: string, scope: LoaderScope): Loaded[] {

Callers 1

lazyRouteReferenceFunction · 0.85

Calls 6

matchBracketFunction · 0.90
objectEntriesFunction · 0.85
pageReferenceFunction · 0.85
loaderValueFunction · 0.85
getMethod · 0.65
execMethod · 0.65

Tested by

no test coverage detected