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

Function postExtract

src/resolution/frameworks/react.ts:214–230  ·  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

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