feat(expo-router): add Expo Router support for Screens and navigations and introduce Steps API
Introduce Expo Router integration with a new Screens view and API to surface screens and transitions, plus a new Steps API and UI to depict typed steps from anchors or symbols. Extend codegraph’s extraction and resolution to handle namespace objects (export default NAME, two-statement forms, and default bindings) and React hook bindings for handlers, improving accuracy of flows across JS ↔ native boundaries. Add Swift/React Native bridge receiver evidence (RCT_EXTERN_MODULE, RCT_EXTERN_METHOD) and related resolution logic, with tests covering namespace-object resolution, useCallback-driven handlers, and inline RN event listeners. Update UI to include a Steps tab and associated components (StepsView, StepNode, ScreenEdge) and wire navigation to expose steps-based exploration via /api/steps and UI routes. Documentation and changelog reflect the new Expo Router integration and steps surface capabilities.
This commit is contained in:
@@ -73,3 +73,41 @@ export async function annotateWhen(cg: CodeGraph, projectRoot: string, batches:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A per-request reader of the conditions ONE call site sits under, for the
|
||||
* endpoints that walk chains rather than annotate rails (the Screens view's
|
||||
* transitions, the Steps view's links). Files are resolved once, drifted
|
||||
* files yield no label, and the count of sites labelled is bounded so a wide
|
||||
* walk cannot turn one request into a parse of the repository.
|
||||
*/
|
||||
export function createWhenReader(
|
||||
cg: CodeGraph,
|
||||
projectRoot: string,
|
||||
maxSites = 600
|
||||
): (caller: { filePath: string; language: Language }, site: { line?: number; column?: number }) => Promise<string> {
|
||||
const files = new Map<string, { abs: string; language: Language } | null>();
|
||||
let sites = 0;
|
||||
return async (caller, site): Promise<string> => {
|
||||
if (!site.line || sites >= maxSites || !supportsBranchGuards(caller.language)) return '';
|
||||
const posix = caller.filePath.replace(/\\/g, '/');
|
||||
let file = files.get(posix);
|
||||
if (file === undefined) {
|
||||
file = null;
|
||||
const found = findIndexedFile(cg, posix);
|
||||
if (found && !hasDriftedOnDisk(projectRoot, found.storedPath, found.record)) {
|
||||
try {
|
||||
file = { abs: resolveProjectFile(projectRoot, found.storedPath), language: found.record.language as Language };
|
||||
} catch {
|
||||
file = null;
|
||||
}
|
||||
}
|
||||
files.set(posix, file);
|
||||
}
|
||||
if (!file) return '';
|
||||
sites++;
|
||||
const key = { line: site.line, column: typeof site.column === 'number' ? site.column : null };
|
||||
const g = (await guardsForFile(file.abs, file.language, [key])).get(siteKey(key));
|
||||
return g ? guardLabel(g) : '';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user