* Detect whether a file is plausibly an Expo Module — looking for both * the `: Module` inheritance and at least one declarative `Function(...)` * / `AsyncFunction(...)` / `Property(...)` / `Name(...)` literal. Any one * of those alone produces too many false positives (random Swift code can * h
(source: string)
| 92 | * have `class X: Module` for unrelated reasons). |
| 93 | */ |
| 94 | function isExpoModuleSource(source: string): boolean { |
| 95 | if (!EXPO_CLASS_RE.test(source)) return false; |
| 96 | // Reset lastIndex defensively; EXPO_DECL_RE has the `g` flag. |
| 97 | EXPO_DECL_RE.lastIndex = 0; |
| 98 | return EXPO_DECL_RE.test(source); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Extract Expo Module method declarations from a Swift / Kotlin source |
no outgoing calls
no test coverage detected