expo-modules-autolinking 3.0.13 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/android/expo-gradle-plugin/expo-autolinking-plugin/src/main/kotlin/expo/modules/plugin/ExpoAutolinkingPlugin.kt +79 -0
- package/build/ExpoModuleConfig.d.ts +1 -1
- package/build/ExpoModuleConfig.js +4 -4
- package/build/ExpoModuleConfig.js.map +1 -1
- package/build/commands/verifyCommand.js +7 -4
- package/build/commands/verifyCommand.js.map +1 -1
- package/build/dependencies/CachedDependenciesLinker.d.ts +0 -1
- package/build/dependencies/CachedDependenciesLinker.js +0 -5
- package/build/dependencies/CachedDependenciesLinker.js.map +1 -1
- package/build/dependencies/resolution.d.ts +0 -1
- package/build/dependencies/resolution.js +8 -40
- package/build/dependencies/resolution.js.map +1 -1
- package/build/dependencies/utils.d.ts +1 -1
- package/build/dependencies/utils.js +4 -4
- package/build/dependencies/utils.js.map +1 -1
- package/build/reactNativeConfig/config.d.ts +1 -2
- package/build/reactNativeConfig/config.js +4 -3
- package/build/reactNativeConfig/config.js.map +1 -1
- package/build/reactNativeConfig/reactNativeConfig.js +9 -8
- package/build/reactNativeConfig/reactNativeConfig.js.map +1 -1
- package/build/utils.d.ts +1 -0
- package/build/utils.js +21 -0
- package/build/utils.js.map +1 -0
- package/jest.setup.ts +4 -0
- package/package.json +2 -2
- package/scripts/ios/cocoapods/installer.rb +81 -0
- package/src/ExpoModuleConfig.ts +3 -2
- package/src/commands/verifyCommand.ts +12 -4
- package/src/dependencies/CachedDependenciesLinker.ts +3 -11
- package/src/dependencies/resolution.ts +11 -46
- package/src/dependencies/utils.ts +5 -2
- package/src/reactNativeConfig/config.ts +5 -4
- package/src/reactNativeConfig/reactNativeConfig.ts +10 -7
- package/src/utils.ts +17 -0
|
@@ -49,9 +49,17 @@ export async function resolveReactNativeModule(
|
|
|
49
49
|
): Promise<RNConfigDependency | null> {
|
|
50
50
|
if (excludeNames.has(resolution.name)) {
|
|
51
51
|
return null;
|
|
52
|
+
} else if (resolution.name === 'react-native' || resolution.name === 'react-native-macos') {
|
|
53
|
+
// Starting from version 0.76, the `react-native` package only defines platforms
|
|
54
|
+
// when @react-native-community/cli-platform-android/ios is installed.
|
|
55
|
+
// Therefore, we need to manually filter it out.
|
|
56
|
+
// NOTE(@kitten): `loadConfigAsync` is skipped too, because react-native's config is too slow
|
|
57
|
+
return null;
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
const libraryConfig = await loadConfigAsync
|
|
60
|
+
const libraryConfig = (await loadConfigAsync(
|
|
61
|
+
resolution.path
|
|
62
|
+
)) as RNConfigReactNativeLibraryConfig;
|
|
55
63
|
const reactNativeConfig = {
|
|
56
64
|
...libraryConfig?.dependency,
|
|
57
65
|
...projectConfig?.dependencies?.[resolution.name],
|
|
@@ -61,11 +69,6 @@ export async function resolveReactNativeModule(
|
|
|
61
69
|
// Package defines platforms would be a platform host package.
|
|
62
70
|
// The rnc-cli will skip this package.
|
|
63
71
|
return null;
|
|
64
|
-
} else if (resolution.name === 'react-native' || resolution.name === 'react-native-macos') {
|
|
65
|
-
// Starting from version 0.76, the `react-native` package only defines platforms
|
|
66
|
-
// when @react-native-community/cli-platform-android/ios is installed.
|
|
67
|
-
// Therefore, we need to manually filter it out.
|
|
68
|
-
return null;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
let maybeExpoModuleConfig: ExpoModuleConfig | null | undefined;
|
|
@@ -132,7 +135,7 @@ export async function createReactNativeConfigAsync({
|
|
|
132
135
|
autolinkingOptions,
|
|
133
136
|
}: CreateRNConfigParams): Promise<RNConfigResult> {
|
|
134
137
|
const excludeNames = new Set(autolinkingOptions.exclude);
|
|
135
|
-
const projectConfig = await loadConfigAsync
|
|
138
|
+
const projectConfig = (await loadConfigAsync(appRoot)) as RNConfigReactNativeProjectConfig;
|
|
136
139
|
|
|
137
140
|
// custom native modules should be resolved first so that they can override other modules
|
|
138
141
|
const searchPaths = autolinkingOptions.nativeModulesDir
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const MAX_SIZE = 5_000;
|
|
2
|
+
|
|
3
|
+
export function memoize<const Fn extends (input: string, ...args: any[]) => Promise<any>>(fn: Fn) {
|
|
4
|
+
const cache = new Map<string, ReturnType<Fn>>();
|
|
5
|
+
return async (input: string, ...args: any[]) => {
|
|
6
|
+
if (!cache.has(input)) {
|
|
7
|
+
const result = await fn(input, ...args);
|
|
8
|
+
if (cache.size > MAX_SIZE) {
|
|
9
|
+
cache.clear();
|
|
10
|
+
}
|
|
11
|
+
cache.set(input, result);
|
|
12
|
+
return result;
|
|
13
|
+
} else {
|
|
14
|
+
return cache.get(input);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|