expo-modules-autolinking 1.9.0 → 1.10.1
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 +12 -0
- package/build/ExpoModuleConfig.d.ts +11 -7
- package/build/ExpoModuleConfig.js +27 -14
- package/build/ExpoModuleConfig.js.map +1 -1
- package/build/autolinking/generatePackageList.js +2 -1
- package/build/autolinking/generatePackageList.js.map +1 -1
- package/build/autolinking/mergeLinkingOptions.d.ts +1 -1
- package/build/autolinking/mergeLinkingOptions.js +11 -2
- package/build/autolinking/mergeLinkingOptions.js.map +1 -1
- package/build/autolinking/resolveModules.js +2 -1
- package/build/autolinking/resolveModules.js.map +1 -1
- package/build/autolinking/utils.d.ts +2 -0
- package/build/autolinking/utils.js +18 -0
- package/build/autolinking/utils.js.map +1 -0
- package/build/index.js +11 -1
- package/build/index.js.map +1 -1
- package/build/platforms/{ios.js → apple.js} +7 -7
- package/build/platforms/apple.js.map +1 -0
- package/build/types.d.ts +61 -36
- package/build/types.js.map +1 -1
- package/package.json +2 -2
- package/scripts/ios/autolinking_manager.rb +45 -20
- package/scripts/ios/package.rb +17 -0
- package/scripts/ios/project_integrator.rb +11 -3
- package/src/ExpoModuleConfig.ts +35 -15
- package/src/autolinking/generatePackageList.ts +2 -1
- package/src/autolinking/mergeLinkingOptions.ts +17 -4
- package/src/autolinking/resolveModules.ts +2 -1
- package/src/autolinking/utils.ts +15 -0
- package/src/index.ts +30 -3
- package/src/platforms/{ios.ts → apple.ts} +6 -6
- package/src/types.ts +69 -40
- package/build/platforms/ios.js.map +0 -1
- /package/build/platforms/{ios.d.ts → apple.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 1.10.1 — 2024-01-18
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Introduced a universal `"apple"` platform as a replacement for `"ios"`, `"macos"` and `"tvos"`. ([#26398](https://github.com/expo/expo/pull/26398) by [@tsapeta](https://github.com/tsapeta))
|
|
18
|
+
|
|
19
|
+
## 1.10.0 — 2024-01-10
|
|
20
|
+
|
|
21
|
+
### 🎉 New features
|
|
22
|
+
|
|
23
|
+
- Added support for macOS and tvOS targets. ([#26287](https://github.com/expo/expo/pull/26287) by [@tsapeta](https://github.com/tsapeta))
|
|
24
|
+
|
|
13
25
|
## 1.9.0 — 2023-12-12
|
|
14
26
|
|
|
15
27
|
### 🐛 Bug fixes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AndroidGradlePluginDescriptor, RawExpoModuleConfig, SupportedPlatform } from './types';
|
|
1
|
+
import { AndroidGradlePluginDescriptor, RawExpoModuleConfig, RawModuleConfigApple, SupportedPlatform } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* A class that wraps the raw config (`expo-module.json` or `unimodule.json`).
|
|
4
4
|
*/
|
|
@@ -9,30 +9,34 @@ export declare class ExpoModuleConfig {
|
|
|
9
9
|
* Whether the module supports given platform.
|
|
10
10
|
*/
|
|
11
11
|
supportsPlatform(platform: SupportedPlatform): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the generic config for all Apple platforms with a fallback to the legacy iOS config.
|
|
14
|
+
*/
|
|
15
|
+
getAppleConfig(): RawModuleConfigApple | null;
|
|
12
16
|
/**
|
|
13
17
|
* Returns a list of names of Swift native modules classes to put to the generated modules provider file.
|
|
14
18
|
*/
|
|
15
|
-
|
|
19
|
+
appleModules(): string[];
|
|
16
20
|
/**
|
|
17
21
|
* Returns a list of names of Swift classes that receives AppDelegate life-cycle events.
|
|
18
22
|
*/
|
|
19
|
-
|
|
23
|
+
appleAppDelegateSubscribers(): string[];
|
|
20
24
|
/**
|
|
21
25
|
* Returns a list of names of Swift classes that implement `ExpoReactDelegateHandler`.
|
|
22
26
|
*/
|
|
23
|
-
|
|
27
|
+
appleReactDelegateHandlers(): string[];
|
|
24
28
|
/**
|
|
25
29
|
* Returns podspec paths defined by the module author.
|
|
26
30
|
*/
|
|
27
|
-
|
|
31
|
+
applePodspecPaths(): string[];
|
|
28
32
|
/**
|
|
29
33
|
* Returns the product module names, if defined by the module author.
|
|
30
34
|
*/
|
|
31
|
-
|
|
35
|
+
appleSwiftModuleNames(): string[];
|
|
32
36
|
/**
|
|
33
37
|
* Returns whether this module will be added only to the debug configuration
|
|
34
38
|
*/
|
|
35
|
-
|
|
39
|
+
appleDebugOnly(): boolean;
|
|
36
40
|
/**
|
|
37
41
|
* Returns a list of names of Kotlin native modules classes to put to the generated package provider file.
|
|
38
42
|
*/
|
|
@@ -19,45 +19,58 @@ class ExpoModuleConfig {
|
|
|
19
19
|
* Whether the module supports given platform.
|
|
20
20
|
*/
|
|
21
21
|
supportsPlatform(platform) {
|
|
22
|
-
|
|
22
|
+
const supportedPlatforms = this.rawConfig.platforms ?? [];
|
|
23
|
+
if (platform === 'apple') {
|
|
24
|
+
// Apple platform is supported when any of iOS, macOS and tvOS is supported.
|
|
25
|
+
return supportedPlatforms.some((supportedPlatform) => {
|
|
26
|
+
return ['apple', 'ios', 'macos', 'tvos'].includes(supportedPlatform);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return supportedPlatforms.includes(platform);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the generic config for all Apple platforms with a fallback to the legacy iOS config.
|
|
33
|
+
*/
|
|
34
|
+
getAppleConfig() {
|
|
35
|
+
return this.rawConfig.apple ?? this.rawConfig.ios ?? null;
|
|
23
36
|
}
|
|
24
37
|
/**
|
|
25
38
|
* Returns a list of names of Swift native modules classes to put to the generated modules provider file.
|
|
26
39
|
*/
|
|
27
|
-
|
|
28
|
-
const
|
|
40
|
+
appleModules() {
|
|
41
|
+
const appleConfig = this.getAppleConfig();
|
|
29
42
|
// `modulesClassNames` is a legacy name for the same config.
|
|
30
|
-
return
|
|
43
|
+
return appleConfig?.modules ?? appleConfig?.modulesClassNames ?? [];
|
|
31
44
|
}
|
|
32
45
|
/**
|
|
33
46
|
* Returns a list of names of Swift classes that receives AppDelegate life-cycle events.
|
|
34
47
|
*/
|
|
35
|
-
|
|
36
|
-
return this.
|
|
48
|
+
appleAppDelegateSubscribers() {
|
|
49
|
+
return this.getAppleConfig()?.appDelegateSubscribers ?? [];
|
|
37
50
|
}
|
|
38
51
|
/**
|
|
39
52
|
* Returns a list of names of Swift classes that implement `ExpoReactDelegateHandler`.
|
|
40
53
|
*/
|
|
41
|
-
|
|
42
|
-
return this.
|
|
54
|
+
appleReactDelegateHandlers() {
|
|
55
|
+
return this.getAppleConfig()?.reactDelegateHandlers ?? [];
|
|
43
56
|
}
|
|
44
57
|
/**
|
|
45
58
|
* Returns podspec paths defined by the module author.
|
|
46
59
|
*/
|
|
47
|
-
|
|
48
|
-
return arrayize(this.
|
|
60
|
+
applePodspecPaths() {
|
|
61
|
+
return arrayize(this.getAppleConfig()?.podspecPath);
|
|
49
62
|
}
|
|
50
63
|
/**
|
|
51
64
|
* Returns the product module names, if defined by the module author.
|
|
52
65
|
*/
|
|
53
|
-
|
|
54
|
-
return arrayize(this.
|
|
66
|
+
appleSwiftModuleNames() {
|
|
67
|
+
return arrayize(this.getAppleConfig()?.swiftModuleName);
|
|
55
68
|
}
|
|
56
69
|
/**
|
|
57
70
|
* Returns whether this module will be added only to the debug configuration
|
|
58
71
|
*/
|
|
59
|
-
|
|
60
|
-
return this.
|
|
72
|
+
appleDebugOnly() {
|
|
73
|
+
return this.getAppleConfig()?.debugOnly ?? false;
|
|
61
74
|
}
|
|
62
75
|
/**
|
|
63
76
|
* Returns a list of names of Kotlin native modules classes to put to the generated package provider file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoModuleConfig.js","sourceRoot":"","sources":["../src/ExpoModuleConfig.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ExpoModuleConfig.js","sourceRoot":"","sources":["../src/Ex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ACH,0BAA0B;QACxB,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,qBAAqB,IAAI,EAAE,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,WAAW,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,SAAS,IAAI,KAAK,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAE7C,4DAA4D;QAC5D,OAAO,aAAa,EAAE,OAAO,IAAI,aAAa,EAAE,iBAAiB,IAAI,EAAE,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,oBAAoB;QAClB,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AApGD,4CAoGC;AAED;;GAEG;AACH,SAAgB,iCAAiC,CAAC,IAAY;IAC5D,kDAAkD;IAClD,4DAA4D;IAC5D,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAwB,CAAC,CAAC;AACpE,CAAC;AAJD,8EAIC","sourcesContent":["import {\n AndroidGradlePluginDescriptor,\n RawExpoModuleConfig,\n RawModuleConfigApple,\n SupportedPlatform,\n} from './types';\n\nfunction arrayize<T>(value: T[] | T | undefined): T[] {\n if (Array.isArray(value)) {\n return value;\n }\n return value != null ? [value] : [];\n}\n\n/**\n * A class that wraps the raw config (`expo-module.json` or `unimodule.json`).\n */\nexport class ExpoModuleConfig {\n constructor(readonly rawConfig: RawExpoModuleConfig) {}\n\n /**\n * Whether the module supports given platform.\n */\n supportsPlatform(platform: SupportedPlatform): boolean {\n const supportedPlatforms = this.rawConfig.platforms ?? [];\n\n if (platform === 'apple') {\n // Apple platform is supported when any of iOS, macOS and tvOS is supported.\n return supportedPlatforms.some((supportedPlatform) => {\n return ['apple', 'ios', 'macos', 'tvos'].includes(supportedPlatform);\n });\n }\n return supportedPlatforms.includes(platform);\n }\n\n /**\n * Returns the generic config for all Apple platforms with a fallback to the legacy iOS config.\n */\n getAppleConfig(): RawModuleConfigApple | null {\n return this.rawConfig.apple ?? this.rawConfig.ios ?? null;\n }\n\n /**\n * Returns a list of names of Swift native modules classes to put to the generated modules provider file.\n */\n appleModules() {\n const appleConfig = this.getAppleConfig();\n\n // `modulesClassNames` is a legacy name for the same config.\n return appleConfig?.modules ?? appleConfig?.modulesClassNames ?? [];\n }\n\n /**\n * Returns a list of names of Swift classes that receives AppDelegate life-cycle events.\n */\n appleAppDelegateSubscribers(): string[] {\n return this.getAppleConfig()?.appDelegateSubscribers ?? [];\n }\n\n /**\n * Returns a list of names of Swift classes that implement `ExpoReactDelegateHandler`.\n */\n appleReactDelegateHandlers(): string[] {\n return this.getAppleConfig()?.reactDelegateHandlers ?? [];\n }\n\n /**\n * Returns podspec paths defined by the module author.\n */\n applePodspecPaths(): string[] {\n return arrayize(this.getAppleConfig()?.podspecPath);\n }\n\n /**\n * Returns the product module names, if defined by the module author.\n */\n appleSwiftModuleNames(): string[] {\n return arrayize(this.getAppleConfig()?.swiftModuleName);\n }\n\n /**\n * Returns whether this module will be added only to the debug configuration\n */\n appleDebugOnly(): boolean {\n return this.getAppleConfig()?.debugOnly ?? false;\n }\n\n /**\n * Returns a list of names of Kotlin native modules classes to put to the generated package provider file.\n */\n androidModules() {\n const androidConfig = this.rawConfig.android;\n\n // `modulesClassNames` is a legacy name for the same config.\n return androidConfig?.modules ?? androidConfig?.modulesClassNames ?? [];\n }\n\n /**\n * Returns build.gradle file paths defined by the module author.\n */\n androidGradlePaths(): string[] {\n return arrayize(this.rawConfig.android?.gradlePath ?? []);\n }\n\n /**\n * Returns gradle plugins descriptors defined by the module author.\n */\n androidGradlePlugins(): AndroidGradlePluginDescriptor[] {\n return arrayize(this.rawConfig.android?.gradlePlugins ?? []);\n }\n\n /**\n * Returns serializable raw config.\n */\n toJSON(): RawExpoModuleConfig {\n return this.rawConfig;\n }\n}\n\n/**\n * Reads the config at given path and returns the config wrapped by `ExpoModuleConfig` class.\n */\nexport function requireAndResolveExpoModuleConfig(path: string): ExpoModuleConfig {\n // TODO: Validate the raw config against a schema.\n // TODO: Support for `*.js` files, not only static `*.json`.\n return new ExpoModuleConfig(require(path) as RawExpoModuleConfig);\n}\n"]}
|
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generatePackageListAsync = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const utils_1 = require("./utils");
|
|
8
9
|
/**
|
|
9
10
|
* Generates a source file listing all packages to link.
|
|
10
11
|
* Right know it works only for Android platform.
|
|
11
12
|
*/
|
|
12
13
|
async function generatePackageListAsync(modules, options) {
|
|
13
14
|
try {
|
|
14
|
-
const platformLinking =
|
|
15
|
+
const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
|
|
15
16
|
await platformLinking.generatePackageListAsync(modules, options.target, options.namespace);
|
|
16
17
|
}
|
|
17
18
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePackageList.js","sourceRoot":"","sources":["../../src/autolinking/generatePackageList.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"generatePackageList.js","sourceRoot":"","sources":["../../src/autolinking/generatePackageList.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,mCAA8D;AAG9D;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC5C,OAA2B,EAC3B,OAAwB;IAExB,IAAI;QACF,MAAM,eAAe,GAAG,IAAA,2CAAmC,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC9E,MAAM,eAAe,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAC5F;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,0DAA0D,OAAO,CAAC,QAAQ,EAAE,CAAC,CACxF,CAAC;QACF,MAAM,CAAC,CAAC;KACT;AACH,CAAC;AAbD,4DAaC","sourcesContent":["import chalk from 'chalk';\n\nimport { getLinkingImplementationForPlatform } from './utils';\nimport { GenerateOptions, ModuleDescriptor } from '../types';\n\n/**\n * Generates a source file listing all packages to link.\n * Right know it works only for Android platform.\n */\nexport async function generatePackageListAsync(\n modules: ModuleDescriptor[],\n options: GenerateOptions\n) {\n try {\n const platformLinking = getLinkingImplementationForPlatform(options.platform);\n await platformLinking.generatePackageListAsync(modules, options.target, options.namespace);\n } catch (e) {\n console.error(\n chalk.red(`Generating package list is not available for platform: ${options.platform}`)\n );\n throw e;\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ export declare function getProjectPackageJsonPathAsync(projectRoot: string): Pro
|
|
|
6
6
|
/**
|
|
7
7
|
* Merges autolinking options from different sources (the later the higher priority)
|
|
8
8
|
* - options defined in package.json's `expo.autolinking` field
|
|
9
|
-
* - platform-specific options from the above (e.g. `expo.autolinking.
|
|
9
|
+
* - platform-specific options from the above (e.g. `expo.autolinking.apple`)
|
|
10
10
|
* - options provided to the CLI command
|
|
11
11
|
*/
|
|
12
12
|
export declare function mergeLinkingOptionsAsync<OptionsType extends SearchOptions>(providedOptions: OptionsType): Promise<OptionsType>;
|
|
@@ -21,13 +21,13 @@ exports.getProjectPackageJsonPathAsync = getProjectPackageJsonPathAsync;
|
|
|
21
21
|
/**
|
|
22
22
|
* Merges autolinking options from different sources (the later the higher priority)
|
|
23
23
|
* - options defined in package.json's `expo.autolinking` field
|
|
24
|
-
* - platform-specific options from the above (e.g. `expo.autolinking.
|
|
24
|
+
* - platform-specific options from the above (e.g. `expo.autolinking.apple`)
|
|
25
25
|
* - options provided to the CLI command
|
|
26
26
|
*/
|
|
27
27
|
async function mergeLinkingOptionsAsync(providedOptions) {
|
|
28
28
|
const packageJson = require(await getProjectPackageJsonPathAsync(providedOptions.projectRoot));
|
|
29
29
|
const baseOptions = packageJson.expo?.autolinking;
|
|
30
|
-
const platformOptions = providedOptions.platform
|
|
30
|
+
const platformOptions = getPlatformOptions(providedOptions.platform, baseOptions);
|
|
31
31
|
const finalOptions = Object.assign({}, baseOptions, platformOptions, providedOptions);
|
|
32
32
|
// Makes provided paths absolute or falls back to default paths if none was provided.
|
|
33
33
|
finalOptions.searchPaths = await resolveSearchPathsAsync(finalOptions.searchPaths, providedOptions.projectRoot);
|
|
@@ -79,4 +79,13 @@ async function resolveNativeModulesDirAsync(nativeModulesDir, cwd) {
|
|
|
79
79
|
const resolvedPath = path_1.default.resolve(projectRoot, nativeModulesDir || 'modules');
|
|
80
80
|
return fs_extra_1.default.existsSync(resolvedPath) ? resolvedPath : null;
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets the platform-specific autolinking options from the base options.
|
|
84
|
+
*/
|
|
85
|
+
function getPlatformOptions(platform, options) {
|
|
86
|
+
if (platform === 'apple') {
|
|
87
|
+
return options?.apple ?? options?.ios ?? {};
|
|
88
|
+
}
|
|
89
|
+
return options?.[platform] ?? {};
|
|
90
|
+
}
|
|
82
91
|
//# sourceMappingURL=mergeLinkingOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLinkingOptions.js","sourceRoot":"","sources":["../../src/autolinking/mergeLinkingOptions.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAC7B,wDAA0B;AAC1B,gDAAwB;AAIxB;;GAEG;AACI,KAAK,UAAU,8BAA8B,CAAC,WAAmB;IACtE,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAM,EAAC,cAAc,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,8CAA8C,WAAW,GAAG,CAAC,CAAC;KAC/E;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wEAMC;AAED;;;;;GAKG;AACI,KAAK,UAAU,wBAAwB,CAC5C,eAA4B;IAE5B,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,8BAA8B,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/F,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"mergeLinkingOptions.js","sourceRoot":"","sources":["../../src/autolinking/mergeLinkingOptions.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAC7B,wDAA0B;AAC1B,gDAAwB;AAIxB;;GAEG;AACI,KAAK,UAAU,8BAA8B,CAAC,WAAmB;IACtE,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAM,EAAC,cAAc,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,8CAA8C,WAAW,GAAG,CAAC,CAAC;KAC/E;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wEAMC;AAED;;;;;GAKG;AACI,KAAK,UAAU,wBAAwB,CAC5C,eAA4B;IAE5B,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,8BAA8B,CAAC,eAAe,CAAC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AC;QAC9C,KAAK,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;QAEzD,gFAAgF;QAChF,IAAI,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;YAC7B,MAAM;SACP;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,4BAA4B,CACzC,gBAA2C,EAC3C,GAAW;IAEX,MAAM,eAAe,GAAG,MAAM,IAAA,iBAAM,EAAC,cAAc,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACrF,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,IAAI,SAAS,CAAC,CAAC;IAC9E,OAAO,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CACzB,QAA2B,EAC3B,OAA4B;IAE5B,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,OAAO,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;KAC7C;IACD,OAAO,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import findUp from 'find-up';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { AutolinkingOptions, SearchOptions, SupportedPlatform } from '../types';\n\n/**\n * Find the path to the `package.json` of the closest project in the given project root.\n */\nexport async function getProjectPackageJsonPathAsync(projectRoot: string): Promise<string> {\n const result = await findUp('package.json', { cwd: projectRoot });\n if (!result) {\n throw new Error(`Couldn't find \"package.json\" up from path \"${projectRoot}\"`);\n }\n return result;\n}\n\n/**\n * Merges autolinking options from different sources (the later the higher priority)\n * - options defined in package.json's `expo.autolinking` field\n * - platform-specific options from the above (e.g. `expo.autolinking.apple`)\n * - options provided to the CLI command\n */\nexport async function mergeLinkingOptionsAsync<OptionsType extends SearchOptions>(\n providedOptions: OptionsType\n): Promise<OptionsType> {\n const packageJson = require(await getProjectPackageJsonPathAsync(providedOptions.projectRoot));\n const baseOptions = packageJson.expo?.autolinking as AutolinkingOptions;\n const platformOptions = getPlatformOptions(providedOptions.platform, baseOptions);\n const finalOptions = Object.assign(\n {},\n baseOptions,\n platformOptions,\n providedOptions\n ) as OptionsType;\n\n // Makes provided paths absolute or falls back to default paths if none was provided.\n finalOptions.searchPaths = await resolveSearchPathsAsync(\n finalOptions.searchPaths,\n providedOptions.projectRoot\n );\n\n finalOptions.nativeModulesDir = await resolveNativeModulesDirAsync(\n finalOptions.nativeModulesDir,\n providedOptions.projectRoot\n );\n\n return finalOptions;\n}\n\n/**\n * Resolves autolinking search paths. If none is provided, it accumulates all node_modules when\n * going up through the path components. This makes workspaces work out-of-the-box without any configs.\n */\nexport async function resolveSearchPathsAsync(\n searchPaths: string[] | null,\n cwd: string\n): Promise<string[]> {\n return searchPaths && searchPaths.length > 0\n ? searchPaths.map((searchPath) => path.resolve(cwd, searchPath))\n : await findDefaultPathsAsync(cwd);\n}\n\n/**\n * Looks up for workspace's `node_modules` paths.\n */\nasync function findDefaultPathsAsync(cwd: string): Promise<string[]> {\n const paths = [];\n let dir = cwd;\n let pkgJsonPath: string | undefined;\n\n while ((pkgJsonPath = await findUp('package.json', { cwd: dir }))) {\n dir = path.dirname(path.dirname(pkgJsonPath));\n paths.push(path.join(pkgJsonPath, '..', 'node_modules'));\n\n // This stops the infinite loop when the package.json is placed at the root dir.\n if (path.dirname(dir) === dir) {\n break;\n }\n }\n return paths;\n}\n\n/**\n * Finds the real path to custom native modules directory.\n * - When {@link cwd} is inside the project directory, the path is searched relatively\n * to the project root (directory with the `package.json` file).\n * - When {@link cwd} is outside project directory (no `package.json` found), it is relative to\n * the current working directory (the {@link cwd} param).\n *\n * @param nativeModulesDir path to custom native modules directory. Defaults to `\"./modules\"` if null.\n * @param cwd current working directory\n * @returns resolved native modules directory or `null` if it is not found or doesn't exist.\n */\nasync function resolveNativeModulesDirAsync(\n nativeModulesDir: string | null | undefined,\n cwd: string\n): Promise<string | null> {\n const packageJsonPath = await findUp('package.json', { cwd });\n const projectRoot = packageJsonPath != null ? path.join(packageJsonPath, '..') : cwd;\n const resolvedPath = path.resolve(projectRoot, nativeModulesDir || 'modules');\n return fs.existsSync(resolvedPath) ? resolvedPath : null;\n}\n\n/**\n * Gets the platform-specific autolinking options from the base options.\n */\nfunction getPlatformOptions(\n platform: SupportedPlatform,\n options?: AutolinkingOptions\n): AutolinkingOptions {\n if (platform === 'apple') {\n return options?.apple ?? options?.ios ?? {};\n }\n return options?.[platform] ?? {};\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveModulesAsync = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
4
5
|
/**
|
|
5
6
|
* Resolves search results to a list of platform-specific configuration.
|
|
6
7
|
*/
|
|
7
8
|
async function resolveModulesAsync(searchResults, options) {
|
|
8
|
-
const platformLinking =
|
|
9
|
+
const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
|
|
9
10
|
return (await Promise.all(Object.entries(searchResults).map(async ([packageName, revision]) => {
|
|
10
11
|
const resolvedModule = await platformLinking.resolveModuleAsync(packageName, revision, options);
|
|
11
12
|
return resolvedModule
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveModules.js","sourceRoot":"","sources":["../../src/autolinking/resolveModules.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"resolveModules.js","sourceRoot":"","sources":["../../src/autolinking/resolveModules.ts"],"names":[],"mappings":";;;AAAA,mCAA8D;AAG9D;;GAEG;AACI,KAAK,UAAU,mBAAmB,CACvC,aAA4B,EAC5B,OAAuB;IAEvB,MAAM,eAAe,GAAG,IAAA,2CAAmC,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9E,OAAO,CACL,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,EAAE;QAClE,MAAM,cAAc,GAAG,MAAM,eAAe,CAAC,kBAAkB,CAC7D,WAAW,EACX,QAAQ,EACR,OAAO,CACR,CAAC;QACF,OAAO,cAAc;YACnB,CAAC,CAAC;gBACE,WAAW;gBACX,cAAc,EAAE,QAAQ,CAAC,OAAO;gBAChC,GAAG,cAAc;aAClB;YACH,CAAC,CAAC,IAAI,CAAC;IACX,CAAC,CAAC,CACH,CACF;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAChE,CAAC;AA1BD,kDA0BC","sourcesContent":["import { getLinkingImplementationForPlatform } from './utils';\nimport { ModuleDescriptor, ResolveOptions, SearchResults } from '../types';\n\n/**\n * Resolves search results to a list of platform-specific configuration.\n */\nexport async function resolveModulesAsync(\n searchResults: SearchResults,\n options: ResolveOptions\n): Promise<ModuleDescriptor[]> {\n const platformLinking = getLinkingImplementationForPlatform(options.platform);\n\n return (\n await Promise.all(\n Object.entries(searchResults).map(async ([packageName, revision]) => {\n const resolvedModule = await platformLinking.resolveModuleAsync(\n packageName,\n revision,\n options\n );\n return resolvedModule\n ? {\n packageName,\n packageVersion: revision.version,\n ...resolvedModule,\n }\n : null;\n })\n )\n )\n .filter(Boolean)\n .sort((a, b) => a.packageName.localeCompare(b.packageName));\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLinkingImplementationForPlatform = void 0;
|
|
4
|
+
function getLinkingImplementationForPlatform(platform) {
|
|
5
|
+
switch (platform) {
|
|
6
|
+
case 'ios':
|
|
7
|
+
case 'macos':
|
|
8
|
+
case 'tvos':
|
|
9
|
+
case 'apple':
|
|
10
|
+
return require('../platforms/apple');
|
|
11
|
+
case 'android':
|
|
12
|
+
return require('../platforms/android');
|
|
13
|
+
case 'devtools':
|
|
14
|
+
return require('../platforms/devtools');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.getLinkingImplementationForPlatform = getLinkingImplementationForPlatform;
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/autolinking/utils.ts"],"names":[],"mappings":";;;AAEA,SAAgB,mCAAmC,CAAC,QAA2B;IAC7E,QAAQ,QAAQ,EAAE;QAChB,KAAK,KAAK,CAAC;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACvC,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACzC,KAAK,UAAU;YACb,OAAO,OAAO,CAAC,uBAAuB,CAAC,CAAC;KAC3C;AACH,CAAC;AAZD,kFAYC","sourcesContent":["import { SupportedPlatform } from '../types';\n\nexport function getLinkingImplementationForPlatform(platform: SupportedPlatform) {\n switch (platform) {\n case 'ios':\n case 'macos':\n case 'tvos':\n case 'apple':\n return require('../platforms/apple');\n case 'android':\n return require('../platforms/android');\n case 'devtools':\n return require('../platforms/devtools');\n }\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -15,7 +15,7 @@ function registerSearchCommand(commandName, fn) {
|
|
|
15
15
|
.command(`${commandName} [paths...]`)
|
|
16
16
|
.option('-i, --ignore-paths <ignorePaths...>', 'Paths to ignore when looking up for modules.', (value, previous) => (previous ?? []).concat(value))
|
|
17
17
|
.option('-e, --exclude <exclude...>', 'Package names to exclude when looking up for modules.', (value, previous) => (previous ?? []).concat(value))
|
|
18
|
-
.option('-p, --platform [platform]', 'The platform that the resulting modules must support. Available options: "
|
|
18
|
+
.option('-p, --platform [platform]', 'The platform that the resulting modules must support. Available options: "apple", "android"', 'apple')
|
|
19
19
|
.option('--silent', 'Silence resolution warnings')
|
|
20
20
|
.addOption(new commander_1.default.Option('--project-root <projectRoot>', 'The path to the root of the project').default(process.cwd(), 'process.cwd()'))
|
|
21
21
|
.option('--only-project-deps', 'For a monorepo, include only modules that are the project dependencies.', true)
|
|
@@ -72,6 +72,7 @@ module.exports = async function (args) {
|
|
|
72
72
|
}
|
|
73
73
|
}).option('-j, --json', 'Output results in the plain JSON format.', () => true, false);
|
|
74
74
|
// Generates a source file listing all packages to link.
|
|
75
|
+
// It's deprecated, use `generate-modules-provider` instead.
|
|
75
76
|
registerResolveCommand('generate-package-list', async (results, options) => {
|
|
76
77
|
const modules = options.empty ? [] : await (0, autolinking_1.resolveModulesAsync)(results, options);
|
|
77
78
|
(0, autolinking_1.generatePackageListAsync)(modules, options);
|
|
@@ -79,6 +80,15 @@ module.exports = async function (args) {
|
|
|
79
80
|
.option('-t, --target <path>', 'Path to the target file, where the package list should be written to.')
|
|
80
81
|
.option('-n, --namespace <namespace>', 'Java package name under which the package list should be placed.')
|
|
81
82
|
.option('--empty', 'Whether to only generate an empty list. Might be used when the user opts-out of autolinking.', false);
|
|
83
|
+
// Generates a source file listing all packages to link in the runtime.
|
|
84
|
+
registerResolveCommand('generate-modules-provider', async (results, options) => {
|
|
85
|
+
const packages = options.packages ?? [];
|
|
86
|
+
const modules = await (0, autolinking_1.resolveModulesAsync)(results, options);
|
|
87
|
+
const filteredModules = modules.filter((module) => packages.includes(module.packageName));
|
|
88
|
+
(0, autolinking_1.generatePackageListAsync)(filteredModules, options);
|
|
89
|
+
})
|
|
90
|
+
.option('-t, --target <path>', 'Path to the target file, where the package list should be written to.')
|
|
91
|
+
.option('-p, --packages <packages...>', 'Names of the packages to include in the generated modules provider.');
|
|
82
92
|
registerPatchReactImportsCommand();
|
|
83
93
|
await commander_1.default
|
|
84
94
|
.version(require('expo-modules-autolinking/package.json').version)
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,+DAA+D;AAC/D,+CAMuB;AACvB,uEAAgF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,+DAA+D;AAC/D,+CAMuB;AACvB,uEAAgF;AAShF;;GAEG;AACH,SAAS,qBAAqB,CAC5B,WAAmB,EACnB,EAAwD;IAExD,OAAO,mBAAS;SACb,OAAO,CAAC,GAAG,WAAW,aAAa,CAAC;SACpC,MAAM,CACL,qCAAqC,EACrC,8CAA8C,EAC9C,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpD;SACA,MAAM,CACL,4BAA4B,EAC5B,uDAAuD,EACvD,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpD;SACA,MAAM,CACL,2BAA2B,EAC3B,6FAA6F,EAC7F,OAAO,CACR;SACA,MAAM,CAAC,UAAU,EAAE,6BAA6B,CAAC;SACjD,SAAS,CACR,IAAI,mBAAS,CAAC,MAAM,CAClB,8BAA8B,EAC9B,qCAAqC,CACtC,CAAC,OA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O,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAA,iCAAmB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjF,IAAA,sCAAwB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC;SACC,MAAM,CACL,qBAAqB,EACrB,uEAAuE,CACxE;SACA,MAAM,CACL,6BAA6B,EAC7B,kEAAkE,CACnE;SACA,MAAM,CACL,SAAS,EACT,8FAA8F,EAC9F,KAAK,CACN,CAAC;IAEJ,uEAAuE;IACvE,sBAAsB,CACpB,2BAA2B,EAC3B,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAmB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;QAE1F,IAAA,sCAAwB,EAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC,CACF;SACE,MAAM,CACL,qBAAqB,EACrB,uEAAuE,CACxE;SACA,MAAM,CACL,8BAA8B,EAC9B,qEAAqE,CACtE,CAAC;IAEJ,gCAAgC,EAAE,CAAC;IAEnC,MAAM,mBAAS;SACZ,OAAO,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC,OAAO,CAAC;SACjE,WAAW,CAAC,8DAA8D,CAAC;SAC3E,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import commander from 'commander';\n\nimport { patchReactImportsAsync } from './ReactImportsPatcher';\nimport {\n findModulesAsync,\n resolveModulesAsync,\n verifySearchResults,\n generatePackageListAsync,\n mergeLinkingOptionsAsync,\n} from './autolinking';\nimport { resolveExtraDependenciesAsync } from './autolinking/extraDependencies';\nimport {\n GenerateModulesProviderOptions,\n GenerateOptions,\n ResolveOptions,\n SearchOptions,\n SearchResults,\n} from './types';\n\n/**\n * Registers a command that only searches for available expo modules.\n */\nfunction registerSearchCommand<OptionsType extends SearchOptions>(\n commandName: string,\n fn: (search: SearchResults, options: OptionsType) => any\n) {\n return commander\n .command(`${commandName} [paths...]`)\n .option<string[] | null>(\n '-i, --ignore-paths <ignorePaths...>',\n 'Paths to ignore when looking up for modules.',\n (value, previous) => (previous ?? []).concat(value)\n )\n .option<string[] | null>(\n '-e, --exclude <exclude...>',\n 'Package names to exclude when looking up for modules.',\n (value, previous) => (previous ?? []).concat(value)\n )\n .option(\n '-p, --platform [platform]',\n 'The platform that the resulting modules must support. Available options: \"apple\", \"android\"',\n 'apple'\n )\n .option('--silent', 'Silence resolution warnings')\n .addOption(\n new commander.Option(\n '--project-root <projectRoot>',\n 'The path to the root of the project'\n ).default(process.cwd(), 'process.cwd()')\n )\n .option(\n '--only-project-deps',\n 'For a monorepo, include only modules that are the project dependencies.',\n true\n )\n .option('--no-only-project-deps', 'Opposite of --only-project-deps', false)\n .action(async (searchPaths, providedOptions) => {\n const options = await mergeLinkingOptionsAsync<OptionsType>({\n ...providedOptions,\n searchPaths,\n });\n const searchResults = await findModulesAsync(options);\n return await fn(searchResults, options);\n });\n}\n\n/**\n * Registers a command that searches for modules and then resolves them for specific platform.\n */\nfunction registerResolveCommand<OptionsType extends ResolveOptions>(\n commandName: string,\n fn: (search: SearchResults, options: OptionsType) => any\n) {\n return registerSearchCommand<OptionsType>(commandName, fn);\n}\n\n// Register for `patch-react-imports` command\nfunction registerPatchReactImportsCommand() {\n return commander\n .command('patch-react-imports [paths...]')\n .requiredOption('--pods-root <podsRoot>', 'The path to `Pods` directory')\n .option('--dry-run', 'Only list files without writing changes to the file system')\n .action(patchReactImportsAsync);\n}\n\nmodule.exports = async function (args: string[]) {\n // Searches for available expo modules.\n registerSearchCommand<SearchOptions & { json?: boolean }>('search', async (results, options) => {\n if (options.json) {\n console.log(JSON.stringify(results));\n } else {\n console.log(require('util').inspect(results, false, null, true));\n }\n }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);\n\n // Checks whether there are no resolving issues in the current setup.\n registerSearchCommand('verify', (results, options) => {\n const numberOfDuplicates = verifySearchResults(results, options);\n if (!numberOfDuplicates) {\n console.log('✅ Everything is fine!');\n }\n });\n\n // Searches for available expo modules and resolves the results for given platform.\n registerResolveCommand('resolve', async (results, options) => {\n const modules = await resolveModulesAsync(results, options);\n const extraDependencies = await resolveExtraDependenciesAsync(options.projectRoot);\n\n if (options.json) {\n console.log(JSON.stringify({ extraDependencies, modules }));\n } else {\n console.log(require('util').inspect({ extraDependencies, modules }, false, null, true));\n }\n }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);\n\n // Generates a source file listing all packages to link.\n // It's deprecated, use `generate-modules-provider` instead.\n registerResolveCommand<GenerateOptions>('generate-package-list', async (results, options) => {\n const modules = options.empty ? [] : await resolveModulesAsync(results, options);\n generatePackageListAsync(modules, options);\n })\n .option(\n '-t, --target <path>',\n 'Path to the target file, where the package list should be written to.'\n )\n .option(\n '-n, --namespace <namespace>',\n 'Java package name under which the package list should be placed.'\n )\n .option(\n '--empty',\n 'Whether to only generate an empty list. Might be used when the user opts-out of autolinking.',\n false\n );\n\n // Generates a source file listing all packages to link in the runtime.\n registerResolveCommand<GenerateModulesProviderOptions>(\n 'generate-modules-provider',\n async (results, options) => {\n const packages = options.packages ?? [];\n const modules = await resolveModulesAsync(results, options);\n const filteredModules = modules.filter((module) => packages.includes(module.packageName));\n\n generatePackageListAsync(filteredModules, options);\n }\n )\n .option(\n '-t, --target <path>',\n 'Path to the target file, where the package list should be written to.'\n )\n .option(\n '-p, --packages <packages...>',\n 'Names of the packages to include in the generated modules provider.'\n );\n\n registerPatchReactImportsCommand();\n\n await commander\n .version(require('expo-modules-autolinking/package.json').version)\n .description('CLI command that searches for Expo modules to autolink them.')\n .parseAsync(args, { from: 'user' });\n};\n"]}
|
|
@@ -9,7 +9,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const indent = ' ';
|
|
11
11
|
async function findPodspecFiles(revision) {
|
|
12
|
-
const configPodspecPaths = revision.config?.
|
|
12
|
+
const configPodspecPaths = revision.config?.applePodspecPaths();
|
|
13
13
|
if (configPodspecPaths && configPodspecPaths.length) {
|
|
14
14
|
return configPodspecPaths;
|
|
15
15
|
}
|
|
@@ -39,16 +39,16 @@ async function resolveModuleAsync(packageName, revision, options) {
|
|
|
39
39
|
podName: path_1.default.basename(podspecFile, path_1.default.extname(podspecFile)),
|
|
40
40
|
podspecDir: path_1.default.dirname(path_1.default.join(revision.path, podspecFile)),
|
|
41
41
|
}));
|
|
42
|
-
const swiftModuleNames = getSwiftModuleNames(pods, revision.config?.
|
|
42
|
+
const swiftModuleNames = getSwiftModuleNames(pods, revision.config?.appleSwiftModuleNames());
|
|
43
43
|
return {
|
|
44
44
|
packageName,
|
|
45
45
|
pods,
|
|
46
46
|
swiftModuleNames,
|
|
47
47
|
flags: options.flags,
|
|
48
|
-
modules: revision.config?.
|
|
49
|
-
appDelegateSubscribers: revision.config?.
|
|
50
|
-
reactDelegateHandlers: revision.config?.
|
|
51
|
-
debugOnly: revision.config?.
|
|
48
|
+
modules: revision.config?.appleModules() ?? [],
|
|
49
|
+
appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],
|
|
50
|
+
reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],
|
|
51
|
+
debugOnly: revision.config?.appleDebugOnly() ?? false,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
exports.resolveModuleAsync = resolveModuleAsync;
|
|
@@ -166,4 +166,4 @@ function wrapInDebugConfigurationCheck(indentationLevel, debugBlock, releaseBloc
|
|
|
166
166
|
}
|
|
167
167
|
return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\n${indent.repeat(indentationLevel)}${debugBlock}\n${indent.repeat(indentationLevel)}#endif`;
|
|
168
168
|
}
|
|
169
|
-
//# sourceMappingURL=
|
|
169
|
+
//# sourceMappingURL=apple.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../src/platforms/apple.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,wDAA0B;AAC1B,gDAAwB;AASxB,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,KAAK,UAAU,gBAAgB,CAAC,QAAyB;IACvD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAChE,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,EAAE;QACnD,OAAO,kBAAkB,CAAC;KAC3B;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,mBAAI,EAAC,aAAa,EAAE;QAC7C,GAAG,EAAE,QAAQ,CAAC,IAAI;QAClB,MAAM,EAAE,CAAC,oBAAoB,CAAC;KAC/B,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,mBAAmB,CACjC,IAA4B,EAC5B,gBAAsC;IAEtC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,EAAE;QAC/C,OAAO,gBAAgB,CAAC;KACzB;IACD,+FAA+F;IAC/F,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AATD,kDASC;AAED;;GAEG;AACI,KAAK,UAAU,kBAAkB,CACtC,WAAmB,EACnB,QAAyB,EACzB,OAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,QA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AED;;GAEG;AACH,SAAgB,iCAAiC,CAAC,OAA8B;IAC9E,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,qBAAqB,EAAE;YAClD,MAAM,CAAC,IAAI,CAAC,kBAAkB,MAAM,CAAC,WAAW,eAAe,OAAO,QAAQ,CAAC,CAAC;SACjF;KACF;IACD,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EAC3E,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AACtB,CAAC;AATD,8EASC;AAED,SAAS,6BAA6B,CACpC,gBAAwB,EACxB,UAAkB,EAClB,eAA8B,IAAI;IAElC,IAAI,YAAY,EAAE;QAChB,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,iCAAiC,MAAM,CAAC,MAAM,CACrF,gBAAgB,CACjB,GAAG,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,MAAM,CAAC,MAAM,CACvE,gBAAgB,CACjB,GAAG,YAAY,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;KAC9D;IAED,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,iCAAiC,MAAM,CAAC,MAAM,CACrF,gBAAgB,CACjB,GAAG,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;AAC7D,CAAC","sourcesContent":["import glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n ModuleDescriptorIos,\n ModuleIosPodspecInfo,\n PackageRevision,\n SearchOptions,\n} from '../types';\n\nconst indent = ' ';\n\nasync function findPodspecFiles(revision: PackageRevision): Promise<string[]> {\n const configPodspecPaths = revision.config?.applePodspecPaths();\n if (configPodspecPaths && configPodspecPaths.length) {\n return configPodspecPaths;\n }\n\n const podspecFiles = await glob('*/*.podspec', {\n cwd: revision.path,\n ignore: ['**/node_modules/**'],\n });\n\n return podspecFiles;\n}\n\nexport function getSwiftModuleNames(\n pods: ModuleIosPodspecInfo[],\n swiftModuleNames: string[] | undefined\n): string[] {\n if (swiftModuleNames && swiftModuleNames.length) {\n return swiftModuleNames;\n }\n // by default, non-alphanumeric characters in the pod name are replaced by _ in the module name\n return pods.map((pod) => pod.podName.replace(/[^a-zA-Z0-9]/g, '_'));\n}\n\n/**\n * Resolves module search result with additional details required for iOS platform.\n */\nexport async function resolveModuleAsync(\n packageName: string,\n revision: PackageRevision,\n options: SearchOptions\n): Promise<ModuleDescriptorIos | null> {\n const podspecFiles = await findPodspecFiles(revision);\n if (!podspecFiles.length) {\n return null;\n }\n\n const pods = podspecFiles.map((podspecFile) => ({\n podName: path.basename(podspecFile, path.extname(podspecFile)),\n podspecDir: path.dirname(path.join(revision.path, podspecFile)),\n }));\n\n const swiftModuleNames = getSwiftModuleNames(pods, revision.config?.appleSwiftModuleNames());\n\n return {\n packageName,\n pods,\n swiftModuleNames,\n flags: options.flags,\n modules: revision.config?.appleModules() ?? [],\n appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],\n reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],\n debugOnly: revision.config?.appleDebugOnly() ?? false,\n };\n}\n\n/**\n * Generates Swift file that contains all autolinked Swift packages.\n */\nexport async function generatePackageListAsync(\n modules: ModuleDescriptorIos[],\n targetPath: string\n): Promise<void> {\n const className = path.basename(targetPath, path.extname(targetPath));\n const generatedFileContent = await generatePackageListFileContentAsync(modules, className);\n\n await fs.outputFile(targetPath, generatedFileContent);\n}\n\n/**\n * Generates the string to put into the generated package list.\n */\nasync function generatePackageListFileContentAsync(\n modules: ModuleDescriptorIos[],\n className: string\n): Promise<string> {\n const iosModules = modules.filter(\n (module) =>\n module.modules.length ||\n module.appDelegateSubscribers.length ||\n module.reactDelegateHandlers.length\n );\n\n const modulesToImport = iosModules.filter((module) => !module.debugOnly);\n const debugOnlyModules = iosModules.filter((module) => module.debugOnly);\n\n const swiftModules = ([] as string[])\n .concat(...modulesToImport.map((module) => module.swiftModuleNames))\n .filter(Boolean);\n\n const debugOnlySwiftModules = ([] as string[])\n .concat(...debugOnlyModules.map((module) => module.swiftModuleNames))\n .filter(Boolean);\n\n const modulesClassNames = ([] as string[])\n .concat(...modulesToImport.map((module) => module.modules))\n .filter(Boolean);\n\n const debugOnlyModulesClassNames = ([] as string[])\n .concat(...debugOnlyModules.map((module) => module.modules))\n .filter(Boolean);\n\n const appDelegateSubscribers = ([] as string[]).concat(\n ...modulesToImport.map((module) => module.appDelegateSubscribers)\n );\n\n const debugOnlyAppDelegateSubscribers = ([] as string[]).concat(\n ...debugOnlyModules.map((module) => module.appDelegateSubscribers)\n );\n\n const reactDelegateHandlerModules = modulesToImport.filter(\n (module) => !!module.reactDelegateHandlers.length\n );\n\n const debugOnlyReactDelegateHandlerModules = debugOnlyModules.filter(\n (module) => !!module.reactDelegateHandlers.length\n );\n\n return `/**\n * Automatically generated by expo-modules-autolinking.\n *\n * This autogenerated class provides a list of classes of native Expo modules,\n * but only these that are written in Swift and use the new API for creating Expo modules.\n */\n\nimport ExpoModulesCore\n${generateCommonImportList(swiftModules)}\n${generateDebugOnlyImportList(debugOnlySwiftModules)}\n@objc(${className})\npublic class ${className}: ModulesProvider {\n public override func getModuleClasses() -> [AnyModule.Type] {\n${generateModuleClasses(modulesClassNames, debugOnlyModulesClassNames)}\n }\n\n public override func getAppDelegateSubscribers() -> [ExpoAppDelegateSubscriber.Type] {\n${generateModuleClasses(appDelegateSubscribers, debugOnlyAppDelegateSubscribers)}\n }\n\n public override func getReactDelegateHandlers() -> [ExpoReactDelegateHandlerTupleType] {\n${generateReactDelegateHandlers(reactDelegateHandlerModules, debugOnlyReactDelegateHandlerModules)}\n }\n}\n`;\n}\n\nfunction generateCommonImportList(swiftModules: string[]): string {\n return swiftModules.map((moduleName) => `import ${moduleName}`).join('\\n');\n}\n\nfunction generateDebugOnlyImportList(swiftModules: string[]): string {\n if (!swiftModules.length) {\n return '';\n }\n\n return (\n wrapInDebugConfigurationCheck(\n 0,\n swiftModules.map((moduleName) => `import ${moduleName}`).join('\\n')\n ) + '\\n'\n );\n}\n\nfunction generateModuleClasses(classNames: string[], debugOnlyClassName: string[]): string {\n const commonClassNames = formatArrayOfClassNames(classNames);\n if (debugOnlyClassName.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfClassNames(classNames.concat(debugOnlyClassName))}`,\n `return ${commonClassNames}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonClassNames}`;\n }\n}\n\n/**\n * Formats an array of class names to Swift's array containing these classes.\n */\nfunction formatArrayOfClassNames(classNames: string[]): string {\n return `[${classNames.map((className) => `\\n${indent.repeat(3)}${className}.self`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction generateReactDelegateHandlers(\n module: ModuleDescriptorIos[],\n debugOnlyModules: ModuleDescriptorIos[]\n): string {\n const commonModules = formatArrayOfReactDelegateHandler(module);\n if (debugOnlyModules.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfReactDelegateHandler(module.concat(debugOnlyModules))}`,\n `return ${commonModules}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonModules}`;\n }\n}\n\n/**\n * Formats an array of modules to Swift's array containing ReactDelegateHandlers\n */\nexport function formatArrayOfReactDelegateHandler(modules: ModuleDescriptorIos[]): string {\n const values: string[] = [];\n for (const module of modules) {\n for (const handler of module.reactDelegateHandlers) {\n values.push(`(packageName: \"${module.packageName}\", handler: ${handler}.self)`);\n }\n }\n return `[${values.map((value) => `\\n${indent.repeat(3)}${value}`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction wrapInDebugConfigurationCheck(\n indentationLevel: number,\n debugBlock: string,\n releaseBlock: string | null = null\n) {\n if (releaseBlock) {\n return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\\n${indent.repeat(\n indentationLevel\n )}${debugBlock}\\n${indent.repeat(indentationLevel)}#else\\n${indent.repeat(\n indentationLevel\n )}${releaseBlock}\\n${indent.repeat(indentationLevel)}#endif`;\n }\n\n return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\\n${indent.repeat(\n indentationLevel\n )}${debugBlock}\\n${indent.repeat(indentationLevel)}#endif`;\n}\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { ExpoModuleConfig } from './ExpoModuleConfig';
|
|
2
|
-
export type SupportedPlatform = 'ios' | 'android' | 'web' | 'devtools';
|
|
2
|
+
export type SupportedPlatform = 'apple' | 'ios' | 'android' | 'web' | 'macos' | 'tvos' | 'devtools';
|
|
3
|
+
/**
|
|
4
|
+
* Options that can be passed through `expo.autolinking` config in the package.json file.
|
|
5
|
+
*/
|
|
6
|
+
export type AutolinkingOptions = {
|
|
7
|
+
searchPaths?: string[] | null;
|
|
8
|
+
ignorePaths?: string[] | null;
|
|
9
|
+
exclude?: string[] | null;
|
|
10
|
+
flags?: Record<string, any>;
|
|
11
|
+
} & {
|
|
12
|
+
[key in SupportedPlatform]?: AutolinkingOptions;
|
|
13
|
+
};
|
|
3
14
|
export interface SearchOptions {
|
|
4
15
|
searchPaths: string[];
|
|
5
16
|
ignorePaths?: string[] | null;
|
|
@@ -24,6 +35,10 @@ export interface GenerateOptions extends ResolveOptions {
|
|
|
24
35
|
namespace?: string;
|
|
25
36
|
empty?: boolean;
|
|
26
37
|
}
|
|
38
|
+
export interface GenerateModulesProviderOptions extends ResolveOptions {
|
|
39
|
+
target: string;
|
|
40
|
+
packages: string[];
|
|
41
|
+
}
|
|
27
42
|
export interface PatchReactImportsOptions {
|
|
28
43
|
podsRoot: string;
|
|
29
44
|
dryRun: boolean;
|
|
@@ -85,6 +100,43 @@ export interface AndroidGradlePluginDescriptor {
|
|
|
85
100
|
*/
|
|
86
101
|
sourceDir: string;
|
|
87
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Represents a raw config specific to Apple platforms.
|
|
105
|
+
*/
|
|
106
|
+
export type RawModuleConfigApple = {
|
|
107
|
+
/**
|
|
108
|
+
* Names of Swift native modules classes to put to the generated modules provider file.
|
|
109
|
+
*/
|
|
110
|
+
modules?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* Names of Swift native modules classes to put to the generated modules provider file.
|
|
113
|
+
* @deprecated Deprecated in favor of `modules`. Might be removed in the future releases.
|
|
114
|
+
*/
|
|
115
|
+
modulesClassNames?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.
|
|
118
|
+
*/
|
|
119
|
+
appDelegateSubscribers?: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Names of Swift classes that implement `ExpoReactDelegateHandler` to hook React instance creation.
|
|
122
|
+
*/
|
|
123
|
+
reactDelegateHandlers?: string[];
|
|
124
|
+
/**
|
|
125
|
+
* Podspec relative path.
|
|
126
|
+
* To have multiple podspecs, string array type is also supported.
|
|
127
|
+
*/
|
|
128
|
+
podspecPath?: string | string[];
|
|
129
|
+
/**
|
|
130
|
+
* Swift product module name. If empty, the pod name is used for Swift imports.
|
|
131
|
+
* To have multiple modules, string array is also supported.
|
|
132
|
+
*/
|
|
133
|
+
swiftModuleName?: string | string[];
|
|
134
|
+
/**
|
|
135
|
+
* Whether this module will be added only to the debug configuration.
|
|
136
|
+
* Defaults to false.
|
|
137
|
+
*/
|
|
138
|
+
debugOnly?: boolean;
|
|
139
|
+
};
|
|
88
140
|
/**
|
|
89
141
|
* Represents a raw config from `expo-module.json`.
|
|
90
142
|
*/
|
|
@@ -94,42 +146,15 @@ export interface RawExpoModuleConfig {
|
|
|
94
146
|
*/
|
|
95
147
|
platforms?: SupportedPlatform[];
|
|
96
148
|
/**
|
|
97
|
-
*
|
|
149
|
+
* A config for all Apple platforms.
|
|
98
150
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* @deprecated Deprecated in favor of `modules`. Might be removed in the future releases.
|
|
107
|
-
*/
|
|
108
|
-
modulesClassNames?: string[];
|
|
109
|
-
/**
|
|
110
|
-
* Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.
|
|
111
|
-
*/
|
|
112
|
-
appDelegateSubscribers?: string[];
|
|
113
|
-
/**
|
|
114
|
-
* Names of Swift classes that implement `ExpoReactDelegateHandler` to hook React instance creation.
|
|
115
|
-
*/
|
|
116
|
-
reactDelegateHandlers?: string[];
|
|
117
|
-
/**
|
|
118
|
-
* Podspec relative path.
|
|
119
|
-
* To have multiple podspecs, string array type is also supported.
|
|
120
|
-
*/
|
|
121
|
-
podspecPath?: string | string[];
|
|
122
|
-
/**
|
|
123
|
-
* Swift product module name. If empty, the pod name is used for Swift imports.
|
|
124
|
-
* To have multiple modules, string array is also supported.
|
|
125
|
-
*/
|
|
126
|
-
swiftModuleName?: string | string[];
|
|
127
|
-
/**
|
|
128
|
-
* Whether this module will be added only to the debug configuration.
|
|
129
|
-
* Defaults to false.
|
|
130
|
-
*/
|
|
131
|
-
debugOnly?: boolean;
|
|
132
|
-
};
|
|
151
|
+
apple?: RawModuleConfigApple;
|
|
152
|
+
/**
|
|
153
|
+
* The legacy config previously used for iOS platform. For backwards compatibility it's used as the fallback for `apple`.
|
|
154
|
+
* Also due to backwards compatibility, it includes the deprecated `modulesClassNames` field.
|
|
155
|
+
* @deprecated As the module can now support more than iOS platform, use the generic `apple` config instead.
|
|
156
|
+
*/
|
|
157
|
+
ios?: RawModuleConfigApple;
|
|
133
158
|
/**
|
|
134
159
|
* Android-specific config.
|
|
135
160
|
*/
|