From 47363ee556daaed9f568296c5bef76aa33971504 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Thu, 12 Dec 2024 16:13:14 +0800 Subject: [PATCH 1/2] fix: support linking of BaseReactPackage subclasses --- .../src/config/__fixtures__/android.ts | 11 +++++++++++ .../src/config/__tests__/findPackageClassName.test.ts | 1 + .../src/config/findPackageClassName.ts | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/cli-config-android/src/config/__fixtures__/android.ts b/packages/cli-config-android/src/config/__fixtures__/android.ts index f8ba3e141..0148d7180 100644 --- a/packages/cli-config-android/src/config/__fixtures__/android.ts +++ b/packages/cli-config-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-config-android/src/config/__tests__/findPackageClassName.test.ts b/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts index 99dbd121b..7853f2948 100644 --- a/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts +++ b/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts @@ -79,6 +79,7 @@ describe('android:FindPackageClassNameRegex', () => { ].forEach((files) => { it('returns the name of the kotlin/java class implementing ReactPackage', () => { files.forEach((file) => { + console.log({file}); expect(matchClassName(file)[1]).toBe('SomeExampleKotlinPackage'); }); }); diff --git a/packages/cli-config-android/src/config/findPackageClassName.ts b/packages/cli-config-android/src/config/findPackageClassName.ts index 5903efa62..c9082e735 100644 --- a/packages/cli-config-android/src/config/findPackageClassName.ts +++ b/packages/cli-config-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/, ); } } From d96f00bad713896084b638470cc0c48826c16176 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Thu, 12 Dec 2024 09:40:30 +0100 Subject: [PATCH 2/2] Update packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Pierzchała --- .../src/config/__tests__/findPackageClassName.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts b/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts index 7853f2948..99dbd121b 100644 --- a/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts +++ b/packages/cli-config-android/src/config/__tests__/findPackageClassName.test.ts @@ -79,7 +79,6 @@ describe('android:FindPackageClassNameRegex', () => { ].forEach((files) => { it('returns the name of the kotlin/java class implementing ReactPackage', () => { files.forEach((file) => { - console.log({file}); expect(matchClassName(file)[1]).toBe('SomeExampleKotlinPackage'); }); });