expo-modules-autolinking 3.0.0 → 3.0.2

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/autolinking/findModules.d.ts +11 -5
  3. package/build/autolinking/findModules.js +8 -16
  4. package/build/autolinking/findModules.js.map +1 -1
  5. package/build/autolinking/generatePackageList.d.ts +16 -10
  6. package/build/autolinking/generatePackageList.js +13 -28
  7. package/build/autolinking/generatePackageList.js.map +1 -1
  8. package/build/autolinking/getConfiguration.d.ts +9 -2
  9. package/build/autolinking/getConfiguration.js +9 -4
  10. package/build/autolinking/getConfiguration.js.map +1 -1
  11. package/build/autolinking/index.d.ts +22 -17
  12. package/build/autolinking/index.js +23 -47
  13. package/build/autolinking/index.js.map +1 -1
  14. package/build/autolinking/resolveModules.d.ts +13 -9
  15. package/build/autolinking/resolveModules.js +21 -18
  16. package/build/autolinking/resolveModules.js.map +1 -1
  17. package/build/commands/autolinkingOptions.d.ts +50 -0
  18. package/build/commands/autolinkingOptions.js +168 -0
  19. package/build/commands/autolinkingOptions.js.map +1 -0
  20. package/build/commands/generateModulesProviderCommand.d.ts +3 -0
  21. package/build/commands/generateModulesProviderCommand.js +35 -0
  22. package/build/commands/generateModulesProviderCommand.js.map +1 -0
  23. package/build/commands/generatePackageListCommand.d.ts +6 -0
  24. package/build/commands/generatePackageListCommand.js +39 -0
  25. package/build/commands/generatePackageListCommand.js.map +1 -0
  26. package/build/commands/reactNativeConfigCommand.d.ts +3 -0
  27. package/build/commands/reactNativeConfigCommand.js +36 -0
  28. package/build/commands/reactNativeConfigCommand.js.map +1 -0
  29. package/build/commands/resolveCommand.d.ts +3 -0
  30. package/build/commands/resolveCommand.js +63 -0
  31. package/build/commands/resolveCommand.js.map +1 -0
  32. package/build/commands/searchCommand.d.ts +2 -0
  33. package/build/commands/searchCommand.js +27 -0
  34. package/build/commands/searchCommand.js.map +1 -0
  35. package/build/{autolinking/verifySearchResults.d.ts → commands/verifyCommand.d.ts} +4 -2
  36. package/build/{autolinking/verifySearchResults.js → commands/verifyCommand.js} +24 -3
  37. package/build/commands/verifyCommand.js.map +1 -0
  38. package/build/dependencies/CachedDependenciesLinker.d.ts +2 -1
  39. package/build/dependencies/CachedDependenciesLinker.js +23 -9
  40. package/build/dependencies/CachedDependenciesLinker.js.map +1 -1
  41. package/build/exports.d.ts +17 -1
  42. package/build/exports.js +48 -1
  43. package/build/exports.js.map +1 -1
  44. package/build/index.js +18 -162
  45. package/build/index.js.map +1 -1
  46. package/build/platforms/{android.d.ts → android/android.d.ts} +7 -2
  47. package/build/platforms/{android.js → android/android.js} +1 -5
  48. package/build/platforms/android/android.js.map +1 -0
  49. package/build/platforms/android/index.d.ts +1 -0
  50. package/build/platforms/android/index.js +9 -0
  51. package/build/platforms/android/index.js.map +1 -0
  52. package/build/platforms/{apple.d.ts → apple/apple.d.ts} +6 -6
  53. package/build/platforms/{apple.js → apple/apple.js} +5 -7
  54. package/build/platforms/apple/apple.js.map +1 -0
  55. package/build/platforms/apple/index.d.ts +1 -0
  56. package/build/platforms/apple/index.js +8 -0
  57. package/build/platforms/apple/index.js.map +1 -0
  58. package/build/platforms/index.d.ts +15 -0
  59. package/build/{autolinking/utils.js → platforms/index.js} +6 -1
  60. package/build/platforms/index.js.map +1 -0
  61. package/build/reactNativeConfig/reactNativeConfig.d.ts +11 -2
  62. package/build/reactNativeConfig/reactNativeConfig.js +13 -15
  63. package/build/reactNativeConfig/reactNativeConfig.js.map +1 -1
  64. package/build/reactNativeConfig/reactNativeConfig.types.d.ts +4 -33
  65. package/build/reactNativeConfig/reactNativeConfig.types.js.map +1 -1
  66. package/build/types.d.ts +1 -58
  67. package/build/types.js.map +1 -1
  68. package/package.json +3 -3
  69. package/src/autolinking/findModules.ts +18 -16
  70. package/src/autolinking/generatePackageList.ts +30 -31
  71. package/src/autolinking/getConfiguration.ts +16 -5
  72. package/src/autolinking/index.ts +48 -41
  73. package/src/autolinking/resolveModules.ts +47 -34
  74. package/src/commands/autolinkingOptions.ts +265 -0
  75. package/src/commands/generateModulesProviderCommand.ts +60 -0
  76. package/src/commands/generatePackageListCommand.ts +67 -0
  77. package/src/commands/reactNativeConfigCommand.ts +50 -0
  78. package/src/commands/resolveCommand.ts +101 -0
  79. package/src/commands/searchCommand.ts +35 -0
  80. package/src/{autolinking/verifySearchResults.ts → commands/verifyCommand.ts} +48 -6
  81. package/src/dependencies/CachedDependenciesLinker.ts +30 -12
  82. package/src/exports.ts +65 -0
  83. package/src/index.ts +18 -286
  84. package/src/platforms/{android.ts → android/android.ts} +10 -12
  85. package/src/platforms/android/index.ts +6 -0
  86. package/src/platforms/{apple.ts → apple/apple.ts} +10 -11
  87. package/src/platforms/apple/index.ts +5 -0
  88. package/src/platforms/index.ts +49 -0
  89. package/src/reactNativeConfig/reactNativeConfig.ts +25 -28
  90. package/src/reactNativeConfig/reactNativeConfig.types.ts +4 -35
  91. package/src/types.ts +10 -70
  92. package/build/autolinking/mergeLinkingOptions.d.ts +0 -27
  93. package/build/autolinking/mergeLinkingOptions.js +0 -112
  94. package/build/autolinking/mergeLinkingOptions.js.map +0 -1
  95. package/build/autolinking/utils.d.ts +0 -2
  96. package/build/autolinking/utils.js.map +0 -1
  97. package/build/autolinking/verifySearchResults.js.map +0 -1
  98. package/build/platforms/android.js.map +0 -1
  99. package/build/platforms/apple.js.map +0 -1
  100. package/src/autolinking/mergeLinkingOptions.ts +0 -146
  101. package/src/autolinking/utils.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 3.0.2 — 2025-08-16
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Regression: Use the command's root instead of the app's root when resolving extra build dependencies ([#38907](https://github.com/expo/expo/pull/38907) by [@kitten](https://github.com/kitten))
18
+
19
+ ### 💡 Others
20
+
21
+ - Refactor command implementations and deprecate old Expo modules autolinking API ([#38907](https://github.com/expo/expo/pull/38907) by [@kitten](https://github.com/kitten))
22
+ - Add internal API to scan only for Expo modules ([#38909](https://github.com/expo/expo/pull/38909) by [@kitten](https://github.com/kitten))
23
+ - Expose `getLinkingImplementationForPlatform` and `PackageRevision` for Expo modules from internal autolinking API ([#38913](https://github.com/expo/expo/pull/38913) by [@kitten](https://github.com/kitten))
24
+
25
+ ## 3.0.1 — 2025-08-15
26
+
27
+ _This version does not introduce any user-facing changes._
28
+
13
29
  ## 3.0.0 — 2025-08-13
14
30
 
15
31
  ### 🛠 Breaking changes
@@ -1,7 +1,13 @@
1
+ import { AutolinkingOptions } from '../commands/autolinkingOptions';
1
2
  import { type DependencyResolution } from '../dependencies';
2
- import { PackageRevision, SearchOptions, SearchResults, SupportedPlatform } from '../types';
3
+ import { PackageRevision, SearchResults, SupportedPlatform } from '../types';
3
4
  export declare function resolveExpoModule(resolution: DependencyResolution, platform: SupportedPlatform, excludeNames: Set<string>): Promise<PackageRevision | null>;
4
- /**
5
- * Searches for modules to link based on given config.
6
- */
7
- export declare function findModulesAsync(providedOptions: SearchOptions): Promise<SearchResults>;
5
+ interface FindModulesParams {
6
+ appRoot: string;
7
+ autolinkingOptions: AutolinkingOptions & {
8
+ platform: SupportedPlatform;
9
+ };
10
+ }
11
+ /** Searches for modules to link based on given config. */
12
+ export declare function findModulesAsync({ appRoot, autolinkingOptions, }: FindModulesParams): Promise<SearchResults>;
13
+ export {};
@@ -1,12 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.resolveExpoModule = resolveExpoModule;
7
4
  exports.findModulesAsync = findModulesAsync;
8
- const fs_1 = __importDefault(require("fs"));
9
- const mergeLinkingOptions_1 = require("./mergeLinkingOptions");
10
5
  const ExpoModuleConfig_1 = require("../ExpoModuleConfig");
11
6
  const dependencies_1 = require("../dependencies");
12
7
  async function resolveExpoModule(resolution, platform, excludeNames) {
@@ -31,19 +26,16 @@ async function resolveExpoModule(resolution, platform, excludeNames) {
31
26
  return null;
32
27
  }
33
28
  }
34
- /**
35
- * Searches for modules to link based on given config.
36
- */
37
- async function findModulesAsync(providedOptions) {
38
- const options = await (0, mergeLinkingOptions_1.mergeLinkingOptionsAsync)(providedOptions);
39
- const excludeNames = new Set(options.exclude);
29
+ /** Searches for modules to link based on given config. */
30
+ async function findModulesAsync({ appRoot, autolinkingOptions, }) {
31
+ const excludeNames = new Set(autolinkingOptions.exclude);
40
32
  // custom native modules should be resolved first so that they can override other modules
41
- const searchPaths = options.nativeModulesDir && fs_1.default.existsSync(options.nativeModulesDir)
42
- ? [options.nativeModulesDir, ...(options.searchPaths ?? [])]
43
- : (options.searchPaths ?? []);
33
+ const searchPaths = autolinkingOptions.nativeModulesDir
34
+ ? [autolinkingOptions.nativeModulesDir, ...autolinkingOptions.searchPaths]
35
+ : autolinkingOptions.searchPaths;
44
36
  return (0, dependencies_1.filterMapResolutionResult)((0, dependencies_1.mergeResolutionResults)(await Promise.all([
45
37
  ...searchPaths.map((searchPath) => (0, dependencies_1.scanDependenciesInSearchPath)(searchPath)),
46
- (0, dependencies_1.scanDependenciesRecursively)(options.projectRoot),
47
- ])), (resolution) => resolveExpoModule(resolution, options.platform, excludeNames));
38
+ (0, dependencies_1.scanDependenciesRecursively)(appRoot),
39
+ ])), (resolution) => resolveExpoModule(resolution, autolinkingOptions.platform, excludeNames));
48
40
  }
49
41
  //# sourceMappingURL=findModules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"findModules.js","sourceRoot":"","sources":["../../src/autolinking/findModules.ts"],"names":[],"mappings":";;;;;AAaA,8CAyBC;AAKD,4CAmBC;AA9DD,4CAAoB;AAEpB,+DAAiE;AACjE,0DAAoE;AACpE,kDAMyB;AAGlB,KAAK,UAAU,iBAAiB,CACrC,UAAgC,EAChC,QAA2B,EAC3B,YAAyB;IAEzB,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,gBAAgB,GAAG,MAAM,IAAA,gDAA6B,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9E,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpE,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,MAAM,EAAE,gBAAgB;YACxB,UAAU,EACR,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;gBACzC,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC,IAAI,EAAE;SACZ,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,eAA8B;IACnE,MAAM,OAAO,GAAG,MAAM,IAAA,8CAAwB,EAAC,eAAe,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9C,yFAAyF;IACzF,MAAM,WAAW,GACf,OAAO,CAAC,gBAAgB,IAAI,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACjE,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IAElC,OAAO,IAAA,wCAAyB,EAC9B,IAAA,qCAAsB,EACpB,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAA,2CAA4B,EAAC,UAAU,CAAC,CAAC;QAC5E,IAAA,0CAA2B,EAAC,OAAO,CAAC,WAAW,CAAC;KACjD,CAAC,CACH,EACD,CAAC,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAC9E,CAAC;AACJ,CAAC","sourcesContent":["import fs from 'fs';\n\nimport { mergeLinkingOptionsAsync } from './mergeLinkingOptions';\nimport { discoverExpoModuleConfigAsync } from '../ExpoModuleConfig';\nimport {\n type DependencyResolution,\n scanDependenciesRecursively,\n scanDependenciesInSearchPath,\n filterMapResolutionResult,\n mergeResolutionResults,\n} from '../dependencies';\nimport { PackageRevision, SearchOptions, SearchResults, SupportedPlatform } from '../types';\n\nexport async function resolveExpoModule(\n resolution: DependencyResolution,\n platform: SupportedPlatform,\n excludeNames: Set<string>\n): Promise<PackageRevision | null> {\n if (excludeNames.has(resolution.name)) {\n return null;\n }\n const expoModuleConfig = await discoverExpoModuleConfigAsync(resolution.path);\n if (expoModuleConfig && expoModuleConfig.supportsPlatform(platform)) {\n return {\n name: resolution.name,\n path: resolution.path,\n version: resolution.version,\n config: expoModuleConfig,\n duplicates:\n resolution.duplicates?.map((duplicate) => ({\n name: duplicate.name,\n path: duplicate.path,\n version: duplicate.version,\n })) ?? [],\n };\n } else {\n return null;\n }\n}\n\n/**\n * Searches for modules to link based on given config.\n */\nexport async function findModulesAsync(providedOptions: SearchOptions): Promise<SearchResults> {\n const options = await mergeLinkingOptionsAsync(providedOptions);\n const excludeNames = new Set(options.exclude);\n\n // custom native modules should be resolved first so that they can override other modules\n const searchPaths =\n options.nativeModulesDir && fs.existsSync(options.nativeModulesDir)\n ? [options.nativeModulesDir, ...(options.searchPaths ?? [])]\n : (options.searchPaths ?? []);\n\n return filterMapResolutionResult(\n mergeResolutionResults(\n await Promise.all([\n ...searchPaths.map((searchPath) => scanDependenciesInSearchPath(searchPath)),\n scanDependenciesRecursively(options.projectRoot),\n ])\n ),\n (resolution) => resolveExpoModule(resolution, options.platform, excludeNames)\n );\n}\n"]}
1
+ {"version":3,"file":"findModules.js","sourceRoot":"","sources":["../../src/autolinking/findModules.ts"],"names":[],"mappings":";;AAWA,8CAyBC;AAQD,4CAoBC;AAhED,0DAAoE;AAEpE,kDAMyB;AAGlB,KAAK,UAAU,iBAAiB,CACrC,UAAgC,EAChC,QAA2B,EAC3B,YAAyB;IAEzB,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,gBAAgB,GAAG,MAAM,IAAA,gDAA6B,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9E,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpE,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,MAAM,EAAE,gBAAgB;YACxB,UAAU,EACR,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;gBACzC,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC,IAAI,EAAE;SACZ,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAOD,0DAA0D;AACnD,KAAK,UAAU,gBAAgB,CAAC,EACrC,OAAO,EACP,kBAAkB,GACA;IAClB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAEzD,yFAAyF;IACzF,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB;QACrD,CAAC,CAAC,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,WAAW,CAAC;QAC1E,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC;IAEnC,OAAO,IAAA,wCAAyB,EAC9B,IAAA,qCAAsB,EACpB,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAA,2CAA4B,EAAC,UAAU,CAAC,CAAC;QAC5E,IAAA,0CAA2B,EAAC,OAAO,CAAC;KACrC,CAAC,CACH,EACD,CAAC,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC,CACzF,CAAC;AACJ,CAAC","sourcesContent":["import { discoverExpoModuleConfigAsync } from '../ExpoModuleConfig';\nimport { AutolinkingOptions } from '../commands/autolinkingOptions';\nimport {\n type DependencyResolution,\n scanDependenciesRecursively,\n scanDependenciesInSearchPath,\n filterMapResolutionResult,\n mergeResolutionResults,\n} from '../dependencies';\nimport { PackageRevision, SearchResults, SupportedPlatform } from '../types';\n\nexport async function resolveExpoModule(\n resolution: DependencyResolution,\n platform: SupportedPlatform,\n excludeNames: Set<string>\n): Promise<PackageRevision | null> {\n if (excludeNames.has(resolution.name)) {\n return null;\n }\n const expoModuleConfig = await discoverExpoModuleConfigAsync(resolution.path);\n if (expoModuleConfig && expoModuleConfig.supportsPlatform(platform)) {\n return {\n name: resolution.name,\n path: resolution.path,\n version: resolution.version,\n config: expoModuleConfig,\n duplicates:\n resolution.duplicates?.map((duplicate) => ({\n name: duplicate.name,\n path: duplicate.path,\n version: duplicate.version,\n })) ?? [],\n };\n } else {\n return null;\n }\n}\n\ninterface FindModulesParams {\n appRoot: string;\n autolinkingOptions: AutolinkingOptions & { platform: SupportedPlatform };\n}\n\n/** Searches for modules to link based on given config. */\nexport async function findModulesAsync({\n appRoot,\n autolinkingOptions,\n}: FindModulesParams): Promise<SearchResults> {\n const excludeNames = new Set(autolinkingOptions.exclude);\n\n // custom native modules should be resolved first so that they can override other modules\n const searchPaths = autolinkingOptions.nativeModulesDir\n ? [autolinkingOptions.nativeModulesDir, ...autolinkingOptions.searchPaths]\n : autolinkingOptions.searchPaths;\n\n return filterMapResolutionResult(\n mergeResolutionResults(\n await Promise.all([\n ...searchPaths.map((searchPath) => scanDependenciesInSearchPath(searchPath)),\n scanDependenciesRecursively(appRoot),\n ])\n ),\n (resolution) => resolveExpoModule(resolution, autolinkingOptions.platform, excludeNames)\n );\n}\n"]}
@@ -1,11 +1,17 @@
1
- import { GenerateModulesProviderOptions, GenerateOptions, ModuleDescriptor } from '../types';
2
- /**
3
- * Generates a source file listing all packages to link.
4
- * Right know it works only for Android platform.
1
+ import { ModuleDescriptor, SupportedPlatform } from '../types';
2
+ interface GeneratePackageListParams {
3
+ platform: SupportedPlatform;
4
+ targetPath: string;
5
+ namespace: string;
6
+ }
7
+ /** Generates a source file listing all packages to link (Android-only) */
8
+ export declare function generatePackageListAsync(modules: ModuleDescriptor[], params: GeneratePackageListParams): Promise<void>;
9
+ interface GenerateModulesProviderParams {
10
+ platform: SupportedPlatform;
11
+ targetPath: string;
12
+ entitlementPath: string | null;
13
+ }
14
+ /** Generates ExpoModulesProvider file listing all packages to link (Apple-only)
5
15
  */
6
- export declare function generatePackageListAsync(modules: ModuleDescriptor[], options: GenerateOptions): Promise<void>;
7
- /**
8
- * Generates ExpoModulesProvider file listing all packages to link.
9
- * Right know it works only for Apple platforms.
10
- */
11
- export declare function generateModulesProviderAsync(modules: ModuleDescriptor[], options: GenerateModulesProviderOptions): Promise<void>;
16
+ export declare function generateModulesProviderAsync(modules: ModuleDescriptor[], params: GenerateModulesProviderParams): Promise<void>;
17
+ export {};
@@ -1,38 +1,23 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.generatePackageListAsync = generatePackageListAsync;
7
4
  exports.generateModulesProviderAsync = generateModulesProviderAsync;
8
- const chalk_1 = __importDefault(require("chalk"));
9
- const utils_1 = require("./utils");
10
- /**
11
- * Generates a source file listing all packages to link.
12
- * Right know it works only for Android platform.
13
- */
14
- async function generatePackageListAsync(modules, options) {
15
- try {
16
- const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
17
- await platformLinking.generatePackageListAsync(modules, options.target, options.namespace);
18
- }
19
- catch (e) {
20
- console.error(chalk_1.default.red(`Generating package list is not available for platform: ${options.platform}`));
21
- throw e;
5
+ const platforms_1 = require("../platforms");
6
+ /** Generates a source file listing all packages to link (Android-only) */
7
+ async function generatePackageListAsync(modules, params) {
8
+ const platformLinking = (0, platforms_1.getLinkingImplementationForPlatform)(params.platform);
9
+ if (!('generatePackageListAsync' in platformLinking)) {
10
+ throw new Error(`Generating package list is not available for platform "${params.platform}"`);
22
11
  }
12
+ await platformLinking.generatePackageListAsync(modules, params.targetPath, params.namespace);
23
13
  }
24
- /**
25
- * Generates ExpoModulesProvider file listing all packages to link.
26
- * Right know it works only for Apple platforms.
14
+ /** Generates ExpoModulesProvider file listing all packages to link (Apple-only)
27
15
  */
28
- async function generateModulesProviderAsync(modules, options) {
29
- try {
30
- const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
31
- await platformLinking.generateModulesProviderAsync(modules, options.target, options.entitlement);
32
- }
33
- catch (e) {
34
- console.error(chalk_1.default.red(`Generating modules provider is not available for platform: ${options.platform}`));
35
- throw e;
16
+ async function generateModulesProviderAsync(modules, params) {
17
+ const platformLinking = (0, platforms_1.getLinkingImplementationForPlatform)(params.platform);
18
+ if (!('generateModulesProviderAsync' in platformLinking)) {
19
+ throw new Error(`Generating modules provider is not available for platform "${params.platform}"`);
36
20
  }
21
+ await platformLinking.generateModulesProviderAsync(modules, params.targetPath, params.entitlementPath);
37
22
  }
38
23
  //# sourceMappingURL=generatePackageList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generatePackageList.js","sourceRoot":"","sources":["../../src/autolinking/generatePackageList.ts"],"names":[],"mappings":";;;;;AASA,4DAaC;AAMD,oEAiBC;AA7CD,kDAA0B;AAE1B,mCAA8D;AAG9D;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC5C,OAA2B,EAC3B,OAAwB;IAExB,IAAI,CAAC;QACH,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;IAC7F,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,0DAA0D,OAAO,CAAC,QAAQ,EAAE,CAAC,CACxF,CAAC;QACF,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,4BAA4B,CAChD,OAA2B,EAC3B,OAAuC;IAEvC,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAA,2CAAmC,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC9E,MAAM,eAAe,CAAC,4BAA4B,CAChD,OAAO,EACP,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,WAAW,CACpB,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,8DAA8D,OAAO,CAAC,QAAQ,EAAE,CAAC,CAC5F,CAAC;QACF,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC","sourcesContent":["import chalk from 'chalk';\n\nimport { getLinkingImplementationForPlatform } from './utils';\nimport { GenerateModulesProviderOptions, 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\n/**\n * Generates ExpoModulesProvider file listing all packages to link.\n * Right know it works only for Apple platforms.\n */\nexport async function generateModulesProviderAsync(\n modules: ModuleDescriptor[],\n options: GenerateModulesProviderOptions\n) {\n try {\n const platformLinking = getLinkingImplementationForPlatform(options.platform);\n await platformLinking.generateModulesProviderAsync(\n modules,\n options.target,\n options.entitlement\n );\n } catch (e) {\n console.error(\n chalk.red(`Generating modules provider is not available for platform: ${options.platform}`)\n );\n throw e;\n }\n}\n"]}
1
+ {"version":3,"file":"generatePackageList.js","sourceRoot":"","sources":["../../src/autolinking/generatePackageList.ts"],"names":[],"mappings":";;AAUA,4DASC;AAUD,oEAeC;AA5CD,4CAAmE;AASnE,0EAA0E;AACnE,KAAK,UAAU,wBAAwB,CAC5C,OAA2B,EAC3B,MAAiC;IAEjC,MAAM,eAAe,GAAG,IAAA,+CAAmC,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7E,IAAI,CAAC,CAAC,0BAA0B,IAAI,eAAe,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,0DAA0D,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;IAChG,CAAC;IACD,MAAM,eAAe,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AAC/F,CAAC;AAQD;GACG;AACI,KAAK,UAAU,4BAA4B,CAChD,OAA2B,EAC3B,MAAqC;IAErC,MAAM,eAAe,GAAG,IAAA,+CAAmC,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7E,IAAI,CAAC,CAAC,8BAA8B,IAAI,eAAe,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CACb,8DAA8D,MAAM,CAAC,QAAQ,GAAG,CACjF,CAAC;IACJ,CAAC;IACD,MAAM,eAAe,CAAC,4BAA4B,CAChD,OAAgC,EAChC,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,eAAe,CACvB,CAAC;AACJ,CAAC","sourcesContent":["import { getLinkingImplementationForPlatform } from '../platforms';\nimport { ModuleDescriptor, ModuleDescriptorIos, SupportedPlatform } from '../types';\n\ninterface GeneratePackageListParams {\n platform: SupportedPlatform;\n targetPath: string;\n namespace: string;\n}\n\n/** Generates a source file listing all packages to link (Android-only) */\nexport async function generatePackageListAsync(\n modules: ModuleDescriptor[],\n params: GeneratePackageListParams\n) {\n const platformLinking = getLinkingImplementationForPlatform(params.platform);\n if (!('generatePackageListAsync' in platformLinking)) {\n throw new Error(`Generating package list is not available for platform \"${params.platform}\"`);\n }\n await platformLinking.generatePackageListAsync(modules, params.targetPath, params.namespace);\n}\n\ninterface GenerateModulesProviderParams {\n platform: SupportedPlatform;\n targetPath: string;\n entitlementPath: string | null;\n}\n\n/** Generates ExpoModulesProvider file listing all packages to link (Apple-only)\n */\nexport async function generateModulesProviderAsync(\n modules: ModuleDescriptor[],\n params: GenerateModulesProviderParams\n) {\n const platformLinking = getLinkingImplementationForPlatform(params.platform);\n if (!('generateModulesProviderAsync' in platformLinking)) {\n throw new Error(\n `Generating modules provider is not available for platform \"${params.platform}\"`\n );\n }\n await platformLinking.generateModulesProviderAsync(\n modules as ModuleDescriptorIos[],\n params.targetPath,\n params.entitlementPath\n );\n}\n"]}
@@ -1,2 +1,9 @@
1
- import type { ResolveOptions } from '../types';
2
- export declare function getConfiguration(options: ResolveOptions): any;
1
+ import { AutolinkingOptions } from '../commands/autolinkingOptions';
2
+ import type { SupportedPlatform } from '../types';
3
+ interface GetConfigurationParams {
4
+ autolinkingOptions: AutolinkingOptions & {
5
+ platform: SupportedPlatform;
6
+ };
7
+ }
8
+ export declare function getConfiguration({ autolinkingOptions, }: GetConfigurationParams): Record<string, any> | undefined;
9
+ export {};
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConfiguration = getConfiguration;
4
- const utils_1 = require("./utils");
5
- function getConfiguration(options) {
6
- const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
7
- return platformLinking.getConfiguration?.(options);
4
+ const platforms_1 = require("../platforms");
5
+ function getConfiguration({ autolinkingOptions, }) {
6
+ const platformLinking = (0, platforms_1.getLinkingImplementationForPlatform)(autolinkingOptions.platform);
7
+ if ('getConfiguration' in platformLinking) {
8
+ return platformLinking.getConfiguration(autolinkingOptions);
9
+ }
10
+ else {
11
+ return undefined;
12
+ }
8
13
  }
9
14
  //# sourceMappingURL=getConfiguration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../src/autolinking/getConfiguration.ts"],"names":[],"mappings":";;AAGA,4CAGC;AALD,mCAA8D;AAE9D,SAAgB,gBAAgB,CAAC,OAAuB;IACtD,MAAM,eAAe,GAAG,IAAA,2CAAmC,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9E,OAAO,eAAe,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type { ResolveOptions } from '../types';\nimport { getLinkingImplementationForPlatform } from './utils';\n\nexport function getConfiguration(options: ResolveOptions) {\n const platformLinking = getLinkingImplementationForPlatform(options.platform);\n return platformLinking.getConfiguration?.(options);\n}\n"]}
1
+ {"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../src/autolinking/getConfiguration.ts"],"names":[],"mappings":";;AAQA,4CASC;AAhBD,4CAAmE;AAOnE,SAAgB,gBAAgB,CAAC,EAC/B,kBAAkB,GACK;IACvB,MAAM,eAAe,GAAG,IAAA,+CAAmC,EAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACzF,IAAI,kBAAkB,IAAI,eAAe,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import { AutolinkingOptions } from '../commands/autolinkingOptions';\nimport { getLinkingImplementationForPlatform } from '../platforms';\nimport type { SupportedPlatform } from '../types';\n\ninterface GetConfigurationParams {\n autolinkingOptions: AutolinkingOptions & { platform: SupportedPlatform };\n}\n\nexport function getConfiguration({\n autolinkingOptions,\n}: GetConfigurationParams): Record<string, any> | undefined {\n const platformLinking = getLinkingImplementationForPlatform(autolinkingOptions.platform);\n if ('getConfiguration' in platformLinking) {\n return platformLinking.getConfiguration(autolinkingOptions);\n } else {\n return undefined;\n }\n}\n"]}
@@ -1,18 +1,23 @@
1
- import { findModulesAsync } from './findModules';
2
- import { getProjectPackageJsonPathAsync, mergeLinkingOptionsAsync } from './mergeLinkingOptions';
3
- import { resolveExtraBuildDependenciesAsync, resolveModulesAsync } from './resolveModules';
4
- import type { ModuleDescriptor, SearchOptions } from '../types';
5
- import { getConfiguration } from './getConfiguration';
6
- export { findModulesAsync, getProjectPackageJsonPathAsync, mergeLinkingOptionsAsync, resolveExtraBuildDependenciesAsync, resolveModulesAsync, getConfiguration, };
1
+ import { AutolinkingOptions } from '../commands/autolinkingOptions';
2
+ import { ExtraDependencies, ModuleDescriptor, SearchResults, SupportedPlatform } from '../types';
3
+ export { getConfiguration } from './getConfiguration';
7
4
  export { generateModulesProviderAsync, generatePackageListAsync } from './generatePackageList';
8
- export { verifySearchResults } from './verifySearchResults';
9
- export * from '../types';
10
- export declare function resolveSearchPathsAsync(searchPaths: string[] | null, cwd: string): Promise<string[]>;
11
- /**
12
- * Programmatic API to query autolinked modules for a project.
13
- */
14
- export declare function queryAutolinkingModulesFromProjectAsync(projectRoot: string, options: Pick<SearchOptions, 'platform' | 'exclude' | 'onlyProjectDeps'>): Promise<ModuleDescriptor[]>;
15
- /**
16
- * Get the project root directory from the current working directory.
17
- */
18
- export declare function findProjectRootSync(cwd?: string): string;
5
+ /** @deprecated */
6
+ export interface SearchOptions extends Partial<AutolinkingOptions> {
7
+ projectRoot: string;
8
+ platform: SupportedPlatform;
9
+ [extra: string]: unknown;
10
+ }
11
+ /** @deprecated */
12
+ export interface ResolveOptions {
13
+ projectRoot: string;
14
+ platform: SupportedPlatform;
15
+ [extra: string]: unknown;
16
+ }
17
+ /** @deprecated */
18
+ declare function apiFindModulesAsync(providedOptions: SearchOptions): Promise<SearchResults>;
19
+ /** @deprecated */
20
+ declare function apiResolveExtraBuildDependenciesAsync(providedOptions: ResolveOptions): Promise<ExtraDependencies>;
21
+ /** @deprecated */
22
+ declare function apiResolveModulesAsync(searchResults: SearchResults, providedOptions: SearchOptions): Promise<ModuleDescriptor[]>;
23
+ export { apiFindModulesAsync as findModulesAsync, apiResolveExtraBuildDependenciesAsync as resolveExtraBuildDependenciesAsync, apiResolveModulesAsync as resolveModulesAsync, };
@@ -1,59 +1,35 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
2
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.verifySearchResults = exports.generatePackageListAsync = exports.generateModulesProviderAsync = exports.getConfiguration = exports.resolveModulesAsync = exports.resolveExtraBuildDependenciesAsync = exports.mergeLinkingOptionsAsync = exports.getProjectPackageJsonPathAsync = exports.findModulesAsync = void 0;
21
- exports.resolveSearchPathsAsync = resolveSearchPathsAsync;
22
- exports.queryAutolinkingModulesFromProjectAsync = queryAutolinkingModulesFromProjectAsync;
23
- exports.findProjectRootSync = findProjectRootSync;
24
- const path_1 = __importDefault(require("path"));
3
+ exports.generatePackageListAsync = exports.generateModulesProviderAsync = exports.getConfiguration = void 0;
4
+ exports.findModulesAsync = apiFindModulesAsync;
5
+ exports.resolveExtraBuildDependenciesAsync = apiResolveExtraBuildDependenciesAsync;
6
+ exports.resolveModulesAsync = apiResolveModulesAsync;
7
+ const autolinkingOptions_1 = require("../commands/autolinkingOptions");
25
8
  const findModules_1 = require("./findModules");
26
- Object.defineProperty(exports, "findModulesAsync", { enumerable: true, get: function () { return findModules_1.findModulesAsync; } });
27
- const mergeLinkingOptions_1 = require("./mergeLinkingOptions");
28
- Object.defineProperty(exports, "getProjectPackageJsonPathAsync", { enumerable: true, get: function () { return mergeLinkingOptions_1.getProjectPackageJsonPathAsync; } });
29
- Object.defineProperty(exports, "mergeLinkingOptionsAsync", { enumerable: true, get: function () { return mergeLinkingOptions_1.mergeLinkingOptionsAsync; } });
30
9
  const resolveModules_1 = require("./resolveModules");
31
- Object.defineProperty(exports, "resolveExtraBuildDependenciesAsync", { enumerable: true, get: function () { return resolveModules_1.resolveExtraBuildDependenciesAsync; } });
32
- Object.defineProperty(exports, "resolveModulesAsync", { enumerable: true, get: function () { return resolveModules_1.resolveModulesAsync; } });
33
- const getConfiguration_1 = require("./getConfiguration");
10
+ var getConfiguration_1 = require("./getConfiguration");
34
11
  Object.defineProperty(exports, "getConfiguration", { enumerable: true, get: function () { return getConfiguration_1.getConfiguration; } });
35
12
  var generatePackageList_1 = require("./generatePackageList");
36
13
  Object.defineProperty(exports, "generateModulesProviderAsync", { enumerable: true, get: function () { return generatePackageList_1.generateModulesProviderAsync; } });
37
14
  Object.defineProperty(exports, "generatePackageListAsync", { enumerable: true, get: function () { return generatePackageList_1.generatePackageListAsync; } });
38
- var verifySearchResults_1 = require("./verifySearchResults");
39
- Object.defineProperty(exports, "verifySearchResults", { enumerable: true, get: function () { return verifySearchResults_1.verifySearchResults; } });
40
- __exportStar(require("../types"), exports);
41
- async function resolveSearchPathsAsync(searchPaths, cwd) {
42
- return (0, mergeLinkingOptions_1.resolveSearchPaths)(searchPaths, cwd);
15
+ /** @deprecated */
16
+ async function apiFindModulesAsync(providedOptions) {
17
+ const autolinkingOptionsLoader = (0, autolinkingOptions_1.createAutolinkingOptionsLoader)(providedOptions);
18
+ return (0, findModules_1.findModulesAsync)({
19
+ appRoot: await autolinkingOptionsLoader.getAppRoot(),
20
+ autolinkingOptions: await autolinkingOptionsLoader.getPlatformOptions(providedOptions.platform),
21
+ });
43
22
  }
44
- /**
45
- * Programmatic API to query autolinked modules for a project.
46
- */
47
- async function queryAutolinkingModulesFromProjectAsync(projectRoot, options) {
48
- const searchPaths = await resolveSearchPathsAsync(null, projectRoot);
49
- const linkOptions = await (0, mergeLinkingOptions_1.mergeLinkingOptionsAsync)({ ...options, projectRoot, searchPaths });
50
- const searchResults = await (0, findModules_1.findModulesAsync)(linkOptions);
51
- return await (0, resolveModules_1.resolveModulesAsync)(searchResults, linkOptions);
23
+ /** @deprecated */
24
+ async function apiResolveExtraBuildDependenciesAsync(providedOptions) {
25
+ return (0, resolveModules_1.resolveExtraBuildDependenciesAsync)({
26
+ commandRoot: providedOptions.projectRoot,
27
+ platform: providedOptions.platform,
28
+ });
52
29
  }
53
- /**
54
- * Get the project root directory from the current working directory.
55
- */
56
- function findProjectRootSync(cwd = process.cwd()) {
57
- return path_1.default.dirname((0, mergeLinkingOptions_1.getProjectPackageJsonPathSync)(cwd));
30
+ /** @deprecated */
31
+ async function apiResolveModulesAsync(searchResults, providedOptions) {
32
+ const autolinkingOptionsLoader = (0, autolinkingOptions_1.createAutolinkingOptionsLoader)(providedOptions);
33
+ return (0, resolveModules_1.resolveModulesAsync)(searchResults, await autolinkingOptionsLoader.getPlatformOptions(providedOptions.platform));
58
34
  }
59
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autolinking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,0DAKC;AAKD,0FAQC;AAKD,kDAEC;AAlDD,gDAAwB;AAExB,+CAAiD;AAY/C,iGAZO,8BAAgB,OAYP;AAXlB,+DAK+B;AAO7B,+GAXA,oDAA8B,OAWA;AAC9B,yGAVA,8CAAwB,OAUA;AAP1B,qDAA2F;AAQzF,mHARO,mDAAkC,OAQP;AAClC,oGAT2C,oCAAmB,OAS3C;AAPrB,yDAAsD;AAQpD,iGARO,mCAAgB,OAQP;AAElB,6DAA+F;AAAtF,mIAAA,4BAA4B,OAAA;AAAE,+HAAA,wBAAwB,OAAA;AAC/D,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,2CAAyB;AAElB,KAAK,UAAU,uBAAuB,CAC3C,WAA4B,EAC5B,GAAW;IAEX,OAAO,IAAA,wCAAkB,EAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,uCAAuC,CAC3D,WAAmB,EACnB,OAAwE;IAExE,MAAM,WAAW,GAAG,MAAM,uBAAuB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,MAAM,IAAA,8CAAwB,EAAC,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7F,MAAM,aAAa,GAAG,MAAM,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAC;IAC1D,OAAO,MAAM,IAAA,oCAAmB,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC7D,OAAO,cAAI,CAAC,OAAO,CAAC,IAAA,mDAA6B,EAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import path from 'path';\n\nimport { findModulesAsync } from './findModules';\nimport {\n getProjectPackageJsonPathAsync,\n getProjectPackageJsonPathSync,\n mergeLinkingOptionsAsync,\n resolveSearchPaths,\n} from './mergeLinkingOptions';\nimport { resolveExtraBuildDependenciesAsync, resolveModulesAsync } from './resolveModules';\nimport type { ModuleDescriptor, SearchOptions } from '../types';\nimport { getConfiguration } from './getConfiguration';\n\nexport {\n findModulesAsync,\n getProjectPackageJsonPathAsync,\n mergeLinkingOptionsAsync,\n resolveExtraBuildDependenciesAsync,\n resolveModulesAsync,\n getConfiguration,\n};\nexport { generateModulesProviderAsync, generatePackageListAsync } from './generatePackageList';\nexport { verifySearchResults } from './verifySearchResults';\nexport * from '../types';\n\nexport async function resolveSearchPathsAsync(\n searchPaths: string[] | null,\n cwd: string\n): Promise<string[]> {\n return resolveSearchPaths(searchPaths, cwd);\n}\n\n/**\n * Programmatic API to query autolinked modules for a project.\n */\nexport async function queryAutolinkingModulesFromProjectAsync(\n projectRoot: string,\n options: Pick<SearchOptions, 'platform' | 'exclude' | 'onlyProjectDeps'>\n): Promise<ModuleDescriptor[]> {\n const searchPaths = await resolveSearchPathsAsync(null, projectRoot);\n const linkOptions = await mergeLinkingOptionsAsync({ ...options, projectRoot, searchPaths });\n const searchResults = await findModulesAsync(linkOptions);\n return await resolveModulesAsync(searchResults, linkOptions);\n}\n\n/**\n * Get the project root directory from the current working directory.\n */\nexport function findProjectRootSync(cwd: string = process.cwd()): string {\n return path.dirname(getProjectPackageJsonPathSync(cwd));\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autolinking/index.ts"],"names":[],"mappings":";;;AAsDyB,+CAAgB;AACE,mFAAkC;AACjD,qDAAmB;AAxD/C,uEAAoG;AAEpG,+CAAiD;AACjD,qDAA2F;AAE3F,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,6DAA+F;AAAtF,mIAAA,4BAA4B,OAAA;AAAE,+HAAA,wBAAwB,OAAA;AAgB/D,kBAAkB;AAClB,KAAK,UAAU,mBAAmB,CAAC,eAA8B;IAC/D,MAAM,wBAAwB,GAAG,IAAA,mDAA8B,EAAC,eAAe,CAAC,CAAC;IACjF,OAAO,IAAA,8BAAgB,EAAC;QACtB,OAAO,EAAE,MAAM,wBAAwB,CAAC,UAAU,EAAE;QACpD,kBAAkB,EAAE,MAAM,wBAAwB,CAAC,kBAAkB,CAAC,eAAe,CAAC,QAAQ,CAAC;KAChG,CAAC,CAAC;AACL,CAAC;AAED,kBAAkB;AAClB,KAAK,UAAU,qCAAqC,CAClD,eAA+B;IAE/B,OAAO,IAAA,mDAAkC,EAAC;QACxC,WAAW,EAAE,eAAe,CAAC,WAAW;QACxC,QAAQ,EAAE,eAAe,CAAC,QAAQ;KACnC,CAAC,CAAC;AACL,CAAC;AAED,kBAAkB;AAClB,KAAK,UAAU,sBAAsB,CACnC,aAA4B,EAC5B,eAA8B;IAE9B,MAAM,wBAAwB,GAAG,IAAA,mDAA8B,EAAC,eAAe,CAAC,CAAC;IACjF,OAAO,IAAA,oCAAmB,EACxB,aAAa,EACb,MAAM,wBAAwB,CAAC,kBAAkB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAC5E,CAAC;AACJ,CAAC","sourcesContent":["import { AutolinkingOptions, createAutolinkingOptionsLoader } from '../commands/autolinkingOptions';\nimport { ExtraDependencies, ModuleDescriptor, SearchResults, SupportedPlatform } from '../types';\nimport { findModulesAsync } from './findModules';\nimport { resolveExtraBuildDependenciesAsync, resolveModulesAsync } from './resolveModules';\n\nexport { getConfiguration } from './getConfiguration';\nexport { generateModulesProviderAsync, generatePackageListAsync } from './generatePackageList';\n\n/** @deprecated */\nexport interface SearchOptions extends Partial<AutolinkingOptions> {\n projectRoot: string;\n platform: SupportedPlatform;\n [extra: string]: unknown;\n}\n\n/** @deprecated */\nexport interface ResolveOptions {\n projectRoot: string;\n platform: SupportedPlatform;\n [extra: string]: unknown;\n}\n\n/** @deprecated */\nasync function apiFindModulesAsync(providedOptions: SearchOptions): Promise<SearchResults> {\n const autolinkingOptionsLoader = createAutolinkingOptionsLoader(providedOptions);\n return findModulesAsync({\n appRoot: await autolinkingOptionsLoader.getAppRoot(),\n autolinkingOptions: await autolinkingOptionsLoader.getPlatformOptions(providedOptions.platform),\n });\n}\n\n/** @deprecated */\nasync function apiResolveExtraBuildDependenciesAsync(\n providedOptions: ResolveOptions\n): Promise<ExtraDependencies> {\n return resolveExtraBuildDependenciesAsync({\n commandRoot: providedOptions.projectRoot,\n platform: providedOptions.platform,\n });\n}\n\n/** @deprecated */\nasync function apiResolveModulesAsync(\n searchResults: SearchResults,\n providedOptions: SearchOptions\n): Promise<ModuleDescriptor[]> {\n const autolinkingOptionsLoader = createAutolinkingOptionsLoader(providedOptions);\n return resolveModulesAsync(\n searchResults,\n await autolinkingOptionsLoader.getPlatformOptions(providedOptions.platform)\n );\n}\n\nexport {\n apiFindModulesAsync as findModulesAsync,\n apiResolveExtraBuildDependenciesAsync as resolveExtraBuildDependenciesAsync,\n apiResolveModulesAsync as resolveModulesAsync,\n};\n"]}
@@ -1,9 +1,13 @@
1
- import type { ExtraDependencies, ModuleDescriptor, ResolveOptions, SearchResults } from '../types';
2
- /**
3
- * Resolves search results to a list of platform-specific configuration.
4
- */
5
- export declare function resolveModulesAsync(searchResults: SearchResults, options: ResolveOptions): Promise<ModuleDescriptor[]>;
6
- /**
7
- * Resolves the extra build dependencies for the project, such as additional Maven repositories or CocoaPods pods.
8
- */
9
- export declare function resolveExtraBuildDependenciesAsync(options: ResolveOptions): Promise<ExtraDependencies>;
1
+ import { AutolinkingOptions } from '../commands/autolinkingOptions';
2
+ import type { ExtraDependencies, ModuleDescriptor, SearchResults, SupportedPlatform } from '../types';
3
+ /** Resolves search results to a list of platform-specific configuration. */
4
+ export declare function resolveModulesAsync(searchResults: SearchResults, autolinkingOptions: AutolinkingOptions & {
5
+ platform: SupportedPlatform;
6
+ }): Promise<ModuleDescriptor[]>;
7
+ interface ResolveExtraBuildDependenciesParams {
8
+ commandRoot: string;
9
+ platform: SupportedPlatform;
10
+ }
11
+ /** Resolves the extra build dependencies for the project, such as additional Maven repositories or CocoaPods pods. */
12
+ export declare function resolveExtraBuildDependenciesAsync({ commandRoot, platform, }: ResolveExtraBuildDependenciesParams): Promise<ExtraDependencies>;
13
+ export {};
@@ -2,31 +2,34 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveModulesAsync = resolveModulesAsync;
4
4
  exports.resolveExtraBuildDependenciesAsync = resolveExtraBuildDependenciesAsync;
5
- const utils_1 = require("./utils");
6
- /**
7
- * Resolves search results to a list of platform-specific configuration.
8
- */
9
- async function resolveModulesAsync(searchResults, options) {
10
- const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
11
- return (await Promise.all(Object.entries(searchResults).map(async ([packageName, revision]) => {
12
- const resolvedModule = await platformLinking.resolveModuleAsync(packageName, revision, options);
5
+ const platforms_1 = require("../platforms");
6
+ /** Resolves search results to a list of platform-specific configuration. */
7
+ async function resolveModulesAsync(searchResults, autolinkingOptions) {
8
+ const platformLinking = (0, platforms_1.getLinkingImplementationForPlatform)(autolinkingOptions.platform);
9
+ // Additional output property for Cocoapods flags
10
+ const extraOutput = { flags: autolinkingOptions.flags };
11
+ const moduleDescriptorList = await Promise.all(Object.entries(searchResults).map(async ([packageName, revision]) => {
12
+ const resolvedModule = await platformLinking.resolveModuleAsync(packageName, revision, extraOutput);
13
13
  return resolvedModule
14
14
  ? {
15
- packageName,
16
- packageVersion: revision.version,
17
15
  ...resolvedModule,
16
+ packageVersion: revision.version,
17
+ packageName: resolvedModule.packageName ?? packageName,
18
18
  }
19
19
  : null;
20
- })))
21
- .filter(Boolean)
20
+ }));
21
+ return moduleDescriptorList
22
+ .filter((moduleDescriptor) => moduleDescriptor != null)
22
23
  .sort((a, b) => a.packageName.localeCompare(b.packageName));
23
24
  }
24
- /**
25
- * Resolves the extra build dependencies for the project, such as additional Maven repositories or CocoaPods pods.
26
- */
27
- async function resolveExtraBuildDependenciesAsync(options) {
28
- const platformLinking = (0, utils_1.getLinkingImplementationForPlatform)(options.platform);
29
- const extraDependencies = await platformLinking.resolveExtraBuildDependenciesAsync(options.projectRoot);
25
+ /** Resolves the extra build dependencies for the project, such as additional Maven repositories or CocoaPods pods. */
26
+ async function resolveExtraBuildDependenciesAsync({ commandRoot, platform, }) {
27
+ const platformLinking = (0, platforms_1.getLinkingImplementationForPlatform)(platform);
28
+ const extraDependencies = await platformLinking.resolveExtraBuildDependenciesAsync(
29
+ // NOTE: We assume we must be inside the native folder here
30
+ // The `resolve` command either is invoked in the CWD of `./{android,ios}` or has a `--project-root`
31
+ // that's in the native directory
32
+ commandRoot);
30
33
  return extraDependencies ?? [];
31
34
  }
32
35
  //# sourceMappingURL=resolveModules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveModules.js","sourceRoot":"","sources":["../../src/autolinking/resolveModules.ts"],"names":[],"mappings":";;AAMA,kDA0BC;AAKD,gFAQC;AA7CD,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;AAED;;GAEG;AACI,KAAK,UAAU,kCAAkC,CACtD,OAAuB;IAEvB,MAAM,eAAe,GAAG,IAAA,2CAAmC,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9E,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC,kCAAkC,CAChF,OAAO,CAAC,WAAW,CACpB,CAAC;IACF,OAAO,iBAAiB,IAAI,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { getLinkingImplementationForPlatform } from './utils';\nimport type { ExtraDependencies, 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\n/**\n * Resolves the extra build dependencies for the project, such as additional Maven repositories or CocoaPods pods.\n */\nexport async function resolveExtraBuildDependenciesAsync(\n options: ResolveOptions\n): Promise<ExtraDependencies> {\n const platformLinking = getLinkingImplementationForPlatform(options.platform);\n const extraDependencies = await platformLinking.resolveExtraBuildDependenciesAsync(\n options.projectRoot\n );\n return extraDependencies ?? [];\n}\n"]}
1
+ {"version":3,"file":"resolveModules.js","sourceRoot":"","sources":["../../src/autolinking/resolveModules.ts"],"names":[],"mappings":";;AAUA,kDA4BC;AAQD,gFAYC;AAzDD,4CAAmE;AAQnE,4EAA4E;AACrE,KAAK,UAAU,mBAAmB,CACvC,aAA4B,EAC5B,kBAAwE;IAExE,MAAM,eAAe,GAAG,IAAA,+CAAmC,EAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACzF,iDAAiD;IACjD,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAAE,CAAC;IAExD,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,GAAG,CAC5C,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,WAAW,CACZ,CAAC;QACF,OAAO,cAAc;YACnB,CAAC,CAAC;gBACE,GAAG,cAAc;gBACjB,cAAc,EAAE,QAAQ,CAAC,OAAO;gBAChC,WAAW,EAAE,cAAc,CAAC,WAAW,IAAI,WAAW;aACvD;YACH,CAAC,CAAC,IAAI,CAAC;IACX,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,oBAAoB;SACxB,MAAM,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,IAAI,IAAI,CAAC;SACtD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAChE,CAAC;AAOD,sHAAsH;AAC/G,KAAK,UAAU,kCAAkC,CAAC,EACvD,WAAW,EACX,QAAQ,GAC4B;IACpC,MAAM,eAAe,GAAG,IAAA,+CAAmC,EAAC,QAAQ,CAAC,CAAC;IACtE,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC,kCAAkC;IAChF,2DAA2D;IAC3D,oGAAoG;IACpG,iCAAiC;IACjC,WAAW,CACZ,CAAC;IACF,OAAO,iBAAiB,IAAI,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { AutolinkingOptions } from '../commands/autolinkingOptions';\nimport { getLinkingImplementationForPlatform } from '../platforms';\nimport type {\n ExtraDependencies,\n ModuleDescriptor,\n SearchResults,\n SupportedPlatform,\n} from '../types';\n\n/** Resolves search results to a list of platform-specific configuration. */\nexport async function resolveModulesAsync(\n searchResults: SearchResults,\n autolinkingOptions: AutolinkingOptions & { platform: SupportedPlatform }\n): Promise<ModuleDescriptor[]> {\n const platformLinking = getLinkingImplementationForPlatform(autolinkingOptions.platform);\n // Additional output property for Cocoapods flags\n const extraOutput = { flags: autolinkingOptions.flags };\n\n const moduleDescriptorList = await Promise.all(\n Object.entries(searchResults).map(async ([packageName, revision]) => {\n const resolvedModule = await platformLinking.resolveModuleAsync(\n packageName,\n revision,\n extraOutput\n );\n return resolvedModule\n ? {\n ...resolvedModule,\n packageVersion: revision.version,\n packageName: resolvedModule.packageName ?? packageName,\n }\n : null;\n })\n );\n\n return moduleDescriptorList\n .filter((moduleDescriptor) => moduleDescriptor != null)\n .sort((a, b) => a.packageName.localeCompare(b.packageName));\n}\n\ninterface ResolveExtraBuildDependenciesParams {\n commandRoot: string;\n platform: SupportedPlatform;\n}\n\n/** Resolves the extra build dependencies for the project, such as additional Maven repositories or CocoaPods pods. */\nexport async function resolveExtraBuildDependenciesAsync({\n commandRoot,\n platform,\n}: ResolveExtraBuildDependenciesParams): Promise<ExtraDependencies> {\n const platformLinking = getLinkingImplementationForPlatform(platform);\n const extraDependencies = await platformLinking.resolveExtraBuildDependenciesAsync(\n // NOTE: We assume we must be inside the native folder here\n // The `resolve` command either is invoked in the CWD of `./{android,ios}` or has a `--project-root`\n // that's in the native directory\n commandRoot\n );\n return extraDependencies ?? [];\n}\n"]}
@@ -0,0 +1,50 @@
1
+ import commander from 'commander';
2
+ import { SupportedPlatform } from '../types';
3
+ export interface AutolinkingOptions {
4
+ /** Only scan direct "dependencies" of a project for React Native modules, rather than including transitive dependencies.
5
+ * @remarks
6
+ * Before SDK 54, React Native modules would only be linked if they were listed as dependencies
7
+ * of a project. However, in SDK 54+ transitive React Native modules dependencies are also
8
+ * auto-linked, unless this flag is enabled.
9
+ * @defaultValue `false`
10
+ */
11
+ legacy_shallowReactNativeLinking: boolean;
12
+ /** Extra modules directories to search for native modules.
13
+ * @defaultValue `[]`
14
+ */
15
+ searchPaths: string[];
16
+ /** Local native modules directory to add to autolinking.
17
+ * @defaultValue `"./modules"`
18
+ */
19
+ nativeModulesDir: string | null;
20
+ /** Native modules to exclude from autolinking by name.
21
+ * @defaultValue `[]`
22
+ */
23
+ exclude: string[];
24
+ /** A list of package names to opt out of prebuilt Expo modules (Android-only)
25
+ * @defaultValue `[]`
26
+ */
27
+ buildFromSource?: string[];
28
+ /** CocoaPods flags to pass to each autolinked pod (Apple/iOS-only)
29
+ * @defaultValue `[]`
30
+ */
31
+ flags?: Record<string, any>;
32
+ }
33
+ export declare const filterMapSearchPaths: (searchPaths: unknown, basePath: string) => string[] | undefined;
34
+ /** Common commandline arguments for autolinking commands (Not to be confused with `AutolinkingOptions` */
35
+ export interface AutolinkingCommonArguments {
36
+ projectRoot?: string | null;
37
+ searchPaths?: string[] | null;
38
+ exclude?: string[] | null;
39
+ platform?: SupportedPlatform | null;
40
+ }
41
+ export declare function registerAutolinkingArguments(command: commander.Command): commander.Command;
42
+ export interface LinkingOptionsLoader {
43
+ getCommandRoot(): string;
44
+ getAppRoot(): Promise<string>;
45
+ getPlatformOptions<T extends SupportedPlatform | undefined>(platform: T): Promise<AutolinkingOptions & {
46
+ platform: T;
47
+ }>;
48
+ getPlatformOptions(): Promise<AutolinkingOptions>;
49
+ }
50
+ export declare function createAutolinkingOptionsLoader(argumentsOptions?: AutolinkingCommonArguments): LinkingOptionsLoader;