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:
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* A store exported by a LATER statement — `const useStore = create(…)` then
|
||||
* `export default useStore` — is exported, and its actions are extracted like
|
||||
* an `export const` store's (object-literal-methods.test.ts covers that
|
||||
* form). The scope rule that keeps inline-object noise out still holds: a
|
||||
* store nothing exports stays a constant.
|
||||
*/
|
||||
import { describe, it, expect, beforeAll } from 'vitest';
|
||||
import { extractFromSource } from '../src/extraction';
|
||||
import { initGrammars, loadAllGrammars } from '../src/extraction/grammars';
|
||||
|
||||
beforeAll(async () => {
|
||||
await initGrammars();
|
||||
await loadAllGrammars();
|
||||
});
|
||||
|
||||
const fnNames = (code: string, file = 'store.ts') =>
|
||||
extractFromSource(file, code)
|
||||
.nodes.filter((n) => n.kind === 'function')
|
||||
.map((n) => n.name);
|
||||
|
||||
describe('store actions on a later-exported const', () => {
|
||||
it('export default NAME', () => {
|
||||
const code = `
|
||||
import { create } from 'zustand'
|
||||
const useCaptureStorage = create<State>((set, get) => ({
|
||||
object: null,
|
||||
setSettings: (settings: Settings) => {
|
||||
set({ settings })
|
||||
},
|
||||
reset: () => set({ object: null }),
|
||||
}))
|
||||
export default useCaptureStorage
|
||||
`;
|
||||
expect(fnNames(code)).toEqual(expect.arrayContaining(['setSettings', 'reset']));
|
||||
});
|
||||
|
||||
it('export { NAME } and export { NAME as default }', () => {
|
||||
const named = `
|
||||
const useStore = create((set) => ({ bump: () => set({}) }))
|
||||
export { useStore }
|
||||
`;
|
||||
const asDefault = `
|
||||
const useStore = create((set) => ({ bump: () => set({}) }))
|
||||
export { useStore as default }
|
||||
`;
|
||||
expect(fnNames(named)).toContain('bump');
|
||||
expect(fnNames(asDefault)).toContain('bump');
|
||||
});
|
||||
|
||||
it('a const nothing exports keeps its members out of the graph', () => {
|
||||
const code = `
|
||||
const useStore = create((set) => ({ bump: () => set({}) }))
|
||||
export const other = 1
|
||||
`;
|
||||
expect(fnNames(code)).not.toContain('bump');
|
||||
});
|
||||
|
||||
it('is not fooled by a different name in the export', () => {
|
||||
const code = `
|
||||
const useStoreInternal = create((set) => ({ bump: () => set({}) }))
|
||||
const useStore = 1
|
||||
export default useStore
|
||||
`;
|
||||
expect(fnNames(code)).not.toContain('bump');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user