fix(mobile): bound framework conventions to path segments (#1506)

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Thang Luu
2026-10-10 21:42:03 +08:00
committed by GitHub
co-authored by morluto
parent 8c47a9ce4b
commit a929c9f714
7 changed files with 163 additions and 7 deletions
+6 -3
View File
@@ -7,6 +7,10 @@ const foldSegment = (segment: string): string =>
const REACT_NATIVE_SEGMENTS = new Set([
"react.framework",
"reactnative.framework",
"libreactnative.so",
"libreactnativejni.so",
"libhermes_executor.so",
"libhermes.so",
"hermes.framework",
]);
@@ -15,15 +19,14 @@ const UNITY_SEGMENTS = new Set(["libunity.so", "unityframework.framework"]);
/**
* A runtime family named by one filename or directory segment.
* `reactnative` may occur inside a segment (`libreactnativejni.so`).
* The other names match the whole segment.
* Only recognized complete library and framework names establish a convention.
*/
export const nativeRuntimeConvention = (
path: string,
): NativeRuntimeConvention | null => {
for (const segment of path.split("/")) {
const folded = foldSegment(segment);
if (folded.includes("reactnative") || REACT_NATIVE_SEGMENTS.has(folded))
if (REACT_NATIVE_SEGMENTS.has(folded))
return "react-native";
if (FLUTTER_SEGMENTS.has(folded)) return "flutter";
if (UNITY_SEGMENTS.has(folded)) return "unity";