|
1 | 1 | # @lytics/dev-agent-core |
2 | 2 |
|
| 3 | +## 0.5.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- d0481b4: feat(scanner): Extract arrow functions, function expressions, and exported constants |
| 8 | + |
| 9 | + ### New Features |
| 10 | + |
| 11 | + **Arrow Function Extraction** |
| 12 | + |
| 13 | + - Extract arrow functions assigned to `const`/`let` variables |
| 14 | + - Extract function expressions assigned to variables |
| 15 | + - Detect React hooks automatically (`use*` naming pattern) |
| 16 | + - Detect async arrow functions |
| 17 | + |
| 18 | + **Exported Constant Extraction** |
| 19 | + |
| 20 | + - Extract exported `const` with object literal initializers (config objects) |
| 21 | + - Extract exported `const` with array literal initializers (static lists) |
| 22 | + - Extract exported `const` with call expression initializers (factories like `createContext()`) |
| 23 | + |
| 24 | + ### API Changes |
| 25 | + |
| 26 | + **New DocumentType value:** |
| 27 | + |
| 28 | + - Added `'variable'` to `DocumentType` union |
| 29 | + |
| 30 | + **New metadata fields:** |
| 31 | + |
| 32 | + - `isArrowFunction?: boolean` - true for arrow functions (vs function expressions) |
| 33 | + - `isHook?: boolean` - true if name matches `/^use[A-Z]/` (React convention) |
| 34 | + - `isAsync?: boolean` - true for async functions |
| 35 | + - `isConstant?: boolean` - true for exported constants |
| 36 | + - `constantKind?: 'object' | 'array' | 'value'` - kind of constant initializer |
| 37 | + |
| 38 | + ### Examples |
| 39 | + |
| 40 | + Now extracts: |
| 41 | + |
| 42 | + ```typescript |
| 43 | + export const useAuth = () => { ... } // Hook (isHook: true) |
| 44 | + export const fetchData = async (url) => { ... } // Async (isAsync: true) |
| 45 | + const validateEmail = (email: string) => ... // Utility function |
| 46 | + export const API_CONFIG = { baseUrl: '...' } // Object constant |
| 47 | + export const LANGUAGES = ['ts', 'js'] // Array constant |
| 48 | + export const AppContext = createContext({}) // Factory constant |
| 49 | + ``` |
| 50 | + |
| 51 | + ### Migration |
| 52 | + |
| 53 | + No breaking changes. The new `'variable'` DocumentType is additive. Existing queries for `'function'`, `'class'`, etc. continue to work unchanged. |
| 54 | + |
3 | 55 | ## 0.4.0 |
4 | 56 |
|
5 | 57 | ### Minor Changes |
|
0 commit comments