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

Function postExtract

src/resolution/frameworks/react.ts:215–231  ·  view source on GitHub ↗

* Name the routes whose path is built from a constant — bulletproof-react's * `path: paths.app.discussions.path` under `path: paths.app.root.path` is * `/app/discussions` — by reading the constant's object literal where it is * declared. Idempotent: the parts ride on the node's signature.

(context: ResolutionContext)

Source from the content-addressed store, hash-verified

213 * declared. Idempotent: the parts ride on the node's signature.
214 */
215 postExtract(context: ResolutionContext): Node[] {
216 const updates: Node[] = [];
217 for (const route of context.getNodesByKind('route')) {
218 if (!route.signature?.startsWith(ROUTE_PARTS_PREFIX)) continue;
219 let parts: RoutePart[];
220 try {
221 parts = JSON.parse(route.signature.slice(ROUTE_PARTS_PREFIX.length)) as RoutePart[];
222 } catch {
223 continue;
224 }
225 const values = parts.map((p) => p.lit ?? (p.expr ? constantPathValue(p.expr, route.filePath, context) : null));
226 if (values.some((v) => v === null)) continue;
227 const name = composeRoutePath(values as string[]);
228 if (name !== route.name) updates.push({ ...route, name });
229 }
230 return updates;
231 },
232
233 /** The routes of tables another file hands the router (`tableRoutes`). */
234 crossFileNodes(context: ResolutionContext) {

Callers

nothing calls this directly

Calls 6

constantPathValueFunction · 0.85
composeRoutePathFunction · 0.85
parseMethod · 0.80
mapMethod · 0.80
pushMethod · 0.80
getNodesByKindMethod · 0.65

Tested by

no test coverage detected