From e228dc73991bd20a222eec32220d99dafc553332 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Thu, 12 Dec 2024 16:47:39 +0800 Subject: [PATCH] fix: support linking of BaseReactPackage subclasses (#2563) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: support linking of BaseReactPackage subclasses * Update packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts Co-authored-by: Michał Pierzchała --------- Co-authored-by: Michał Pierzchała --- .../src/config/__fixtures__/android.ts | 11 +++++++++++ .../src/config/findPackageClassName.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli-platform-android/src/config/__fixtures__/android.ts b/packages/cli-platform-android/src/config/__fixtures__/android.ts index f8ba3e141..0148d7180 100644 --- a/packages/cli-platform-android/src/config/__fixtures__/android.ts +++ b/packages/cli-platform-android/src/config/__fixtures__/android.ts @@ -203,6 +203,10 @@ export const findPackagesClassNameKotlinValid = [ ` class SomeExampleKotlinPackage : TurboReactPackage { + }`, + ` + class SomeExampleKotlinPackage : BaseReactPackage { + }`, ]; @@ -265,6 +269,13 @@ export const findPackagesClassNameJavaValid = [ extends TurboReactPackage { + } + `, + ` + class SomeExampleKotlinPackage + extends + BaseReactPackage { + } `, ` diff --git a/packages/cli-platform-android/src/config/findPackageClassName.ts b/packages/cli-platform-android/src/config/findPackageClassName.ts index 5903efa62..c9082e735 100644 --- a/packages/cli-platform-android/src/config/findPackageClassName.ts +++ b/packages/cli-platform-android/src/config/findPackageClassName.ts @@ -76,7 +76,7 @@ export function matchClassName(file: string) { return nativeModuleMatch; } else { return file.match( - /class\s+(\w+[^(\s]*)[\s\w():]*(\s+extends\s+|:)[\s\w():,]*[^{]*TurboReactPackage/, + /class\s+(\w+[^(\s]*)[\s\w():]*(\s+extends\s+|:)[\s\w():,]*[^{]*(Turbo|Base)ReactPackage/, ); } }