expo-modules-autolinking 1.10.3 → 1.11.0

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 (48) hide show
  1. package/CHANGELOG.md +18 -4
  2. package/build/ExpoModuleConfig.js +2 -2
  3. package/build/ExpoModuleConfig.js.map +1 -1
  4. package/build/ReactImportsPatcher.js +2 -3
  5. package/build/ReactImportsPatcher.js.map +1 -1
  6. package/build/autolinking/findModules.js +1 -2
  7. package/build/autolinking/findModules.js.map +1 -1
  8. package/build/autolinking/generatePackageList.js +1 -2
  9. package/build/autolinking/generatePackageList.js.map +1 -1
  10. package/build/autolinking/index.d.ts +2 -2
  11. package/build/autolinking/index.js +3 -2
  12. package/build/autolinking/index.js.map +1 -1
  13. package/build/autolinking/mergeLinkingOptions.js +3 -4
  14. package/build/autolinking/mergeLinkingOptions.js.map +1 -1
  15. package/build/autolinking/resolveModules.d.ts +5 -1
  16. package/build/autolinking/resolveModules.js +10 -2
  17. package/build/autolinking/resolveModules.js.map +1 -1
  18. package/build/autolinking/utils.js +1 -2
  19. package/build/autolinking/utils.js.map +1 -1
  20. package/build/autolinking/verifySearchResults.js +1 -2
  21. package/build/autolinking/verifySearchResults.js.map +1 -1
  22. package/build/index.js +1 -2
  23. package/build/index.js.map +1 -1
  24. package/build/platforms/android.d.ts +11 -1
  25. package/build/platforms/android.js +43 -4
  26. package/build/platforms/android.js.map +1 -1
  27. package/build/platforms/apple.d.ts +2 -1
  28. package/build/platforms/apple.js +21 -5
  29. package/build/platforms/apple.js.map +1 -1
  30. package/build/platforms/devtools.d.ts +2 -1
  31. package/build/platforms/devtools.js +5 -2
  32. package/build/platforms/devtools.js.map +1 -1
  33. package/build/types.d.ts +47 -0
  34. package/build/types.js.map +1 -1
  35. package/package.json +4 -5
  36. package/scripts/android/autolinking_implementation.gradle +53 -22
  37. package/scripts/ios/autolinking_manager.rb +4 -2
  38. package/src/autolinking/index.ts +8 -2
  39. package/src/autolinking/resolveModules.ts +14 -1
  40. package/src/index.ts +2 -2
  41. package/src/platforms/android.ts +43 -1
  42. package/src/platforms/apple.ts +21 -1
  43. package/src/platforms/devtools.ts +7 -1
  44. package/src/types.ts +56 -0
  45. package/build/autolinking/extraDependencies.d.ts +0 -30
  46. package/build/autolinking/extraDependencies.js +0 -31
  47. package/build/autolinking/extraDependencies.js.map +0 -1
  48. package/src/autolinking/extraDependencies.ts +0 -53
package/CHANGELOG.md CHANGED
@@ -10,25 +10,39 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 1.10.3 — 2024-02-06
13
+ ## 1.11.0 — 2024-04-18
14
+
15
+ ### 🎉 New features
16
+
17
+ - Expand Android auto-linking to support new expo-build-properties ([#26895](https://github.com/expo/expo/pull/26895) by [@bpeltonc](https://github.com/bpeltonc))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Support custom debug build configuration for debugOnly pods (expo-dev-client for example) ([#28085](https://github.com/expo/expo/pull/28085) by [@Titozzz](https://github.com/Titozzz))
22
+
23
+ ### 💡 Others
24
+
25
+ - Read `extraPods` from **Podfile.properties.json** and `extraMavenRepos` from **gradle.properties**. ([#28106](https://github.com/expo/expo/pull/28106) by [@kudo](https://github.com/kudo))
26
+
27
+ ## 1.10.3 - 2024-02-06
14
28
 
15
29
  ### 🐛 Bug fixes
16
30
 
17
31
  - Fixed generating a list of app delegate subscribers. ([#26851](https://github.com/expo/expo/pull/26851) by [@tsapeta](https://github.com/tsapeta))
18
32
 
19
- ## 1.10.2 2024-01-18
33
+ ## 1.10.2 - 2024-01-18
20
34
 
21
35
  ### 🐛 Bug fixes
22
36
 
23
37
  - Fixed a list of packages to include in the generated modules provider for tvOS and macOS platforms. ([#26497](https://github.com/expo/expo/pull/26497) by [@tsapeta](https://github.com/tsapeta))
24
38
 
25
- ## 1.10.1 2024-01-18
39
+ ## 1.10.1 - 2024-01-18
26
40
 
27
41
  ### 🎉 New features
28
42
 
29
43
  - 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))
30
44
 
31
- ## 1.10.0 2024-01-10
45
+ ## 1.10.0 - 2024-01-10
32
46
 
33
47
  ### 🎉 New features
34
48
 
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requireAndResolveExpoModuleConfig = exports.ExpoModuleConfig = void 0;
3
+ exports.ExpoModuleConfig = void 0;
4
+ exports.requireAndResolveExpoModuleConfig = requireAndResolveExpoModuleConfig;
4
5
  function arrayize(value) {
5
6
  if (Array.isArray(value)) {
6
7
  return value;
@@ -108,5 +109,4 @@ function requireAndResolveExpoModuleConfig(path) {
108
109
  // TODO: Support for `*.js` files, not only static `*.json`.
109
110
  return new ExpoModuleConfig(require(path));
110
111
  }
111
- exports.requireAndResolveExpoModuleConfig = requireAndResolveExpoModuleConfig;
112
112
  //# sourceMappingURL=ExpoModuleConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoModuleConfig.js","sourceRoot":"","sources":["../src/ExpoModuleConfig.ts"],"names":[],"mappings":";;;AAOA,SAAS,QAAQ,CAAI,KAA0B;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAa,gBAAgB;IACN;IAArB,YAAqB,SAA8B;QAA9B,cAAS,GAAT,SAAS,CAAqB;IAAG,CAAC;IAEvD;;OAEG;IACH,gBAAgB,CAAC,QAA2B;QAC1C,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC;QAE1D,IAAI,QAAQ,KAAK,OAAO,EAAE;YACxB,4EAA4E;YAC5E,OAAO,k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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"]}
1
+ {"version":3,"file":"ExpoModuleConfig.js","sourceRoot":"","sources":["../src/ExpoModuleConfig.ts"],"names":[],"mappings":";;;AA0HA,8EAIC;AAvHD,SAAS,QAAQ,CAAI,KAA0B;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAa,gBAAgB;IACN;IAArB,YAAqB,SAA8B;QAA9B,cAAS,GAAT,SAAS,CAAqB;IAAG,CAAC;IAEvD;;OAEG;IACH,gBAAgB,CAAC,QAA2B;QAC1C,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC;QAE1D,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,4EAA4E;YAC5E,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE;gBACnD,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,YAAY;QACV,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAE1C,4DAA4D;QAC5D,OAAO,WAAW,EAAE,OAAO,IAAI,WAAW,EAAE,iB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AAI,CAAwB,CAAC,CAAC;AACpE,CAAC","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"]}
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.patchFileAsync = exports.patchReactImportsAsync = void 0;
7
+ exports.patchReactImportsAsync = patchReactImportsAsync;
8
+ exports.patchFileAsync = patchFileAsync;
8
9
  const fast_glob_1 = __importDefault(require("fast-glob"));
9
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
10
11
  const path_1 = __importDefault(require("path"));
@@ -17,7 +18,6 @@ async function patchReactImportsAsync(dirs, options) {
17
18
  const headerSet = await generateReactHeaderSetAsync(path_1.default.join(options.podsRoot, 'Headers', 'Public', 'React-Core', 'React'));
18
19
  await Promise.all(dirs.map((dir) => patchDirAsync(headerSet, dir, options.dryRun)));
19
20
  }
20
- exports.patchReactImportsAsync = patchReactImportsAsync;
21
21
  /**
22
22
  * Generate `React-Core` public header names as a set, will transform necessary headers based on this set.
23
23
  */
@@ -75,7 +75,6 @@ async function patchFileAsync(headerSet, file, dryRun) {
75
75
  }
76
76
  }
77
77
  }
78
- exports.patchFileAsync = patchFileAsync;
79
78
  /**
80
79
  * Patch imports from a directory
81
80
  * @param headerSet prebuilt React-Core header set
@@ -1 +1 @@
1
- {"version":3,"file":"ReactImportsPatcher.js","sourceRoot":"","sources":["../src/ReactImportsPatcher.ts"],"names":[],"mappings":";AAAA,8DAA8D;;;;;;AAE9D,0DAA6B;AAC7B,wDAA0B;AAC1B,gDAAwB;AAIxB;;;;GAIG;AACI,KAAK,UAAU,sBAAsB,CAAC,IAAc,EAAE,OAAiC;IAC5F,MAAM,SAAS,GAAG,MAAM,2BAA2B,CACjD,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CACxE,CAAC;IACF,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AALD,wDAKC;AAED;;GAEG;AACH,KAAK,UAAU,2BAA2B,CAAC,cAAsB;IAC/D,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAI,EAAC,KAAK,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC;IACzD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,SAAsB,EAAE,IAAY,EAAE,MAAe;IACxF,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,OAAO,GAAG,MAAM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AC,CACF,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,kBAAE,CAAC,SAAS,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;SAC5C;KACF;AACH,CAAC;AAvDD,wCAuDC;AAED;;;;;GAKG;AACH,KAAK,UAAU,aAAa,CAAC,SAAsB,EAAE,GAAW,EAAE,MAAe;IAC/E,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAI,EAAC,eAAe,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC","sourcesContent":["// Copyright 2018-present 650 Industries. All rights reserved.\n\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { PatchReactImportsOptions } from './types';\n\n/**\n * Remove all double-quoted react header imports\n * @param dirs target directories to patch\n * @param options PatchReactImportsOptions\n */\nexport async function patchReactImportsAsync(dirs: string[], options: PatchReactImportsOptions) {\n const headerSet = await generateReactHeaderSetAsync(\n path.join(options.podsRoot, 'Headers', 'Public', 'React-Core', 'React')\n );\n await Promise.all(dirs.map((dir) => patchDirAsync(headerSet, dir, options.dryRun)));\n}\n\n/**\n * Generate `React-Core` public header names as a set, will transform necessary headers based on this set.\n */\nasync function generateReactHeaderSetAsync(reactHeaderDir: string): Promise<Set<string>> {\n const files = await glob('*.h', { cwd: reactHeaderDir });\n return new Set(files);\n}\n\n/**\n * Patch imports from a file\n * @param headerSet prebuilt React-Core header set\n * @param file target patch file\n * @param dryRun true if not writing changes to file\n */\nexport async function patchFileAsync(headerSet: Set<string>, file: string, dryRun: boolean) {\n let changed = false;\n const content = await fs.readFile(file, 'utf-8');\n let transformContent = content.replace(\n /(?<=^\\s*)#import\\s+\"(.+)\"(?=\\s*$)/gm,\n (match: string, headerName: string): string => {\n // `#import \"RCTBridge.h\"` -> `#import <React/RCTBridge.h>`\n if (headerSet.has(headerName)) {\n changed = true;\n return `#import <React/${headerName}>`;\n }\n\n // `#import \"React/RCTBridge.h\"` -> `#import <React/RCTBridge.h>`\n if (headerName.startsWith('React/')) {\n const name = headerName.substring(6);\n if (headerSet.has(name)) {\n changed = true;\n return `#import <React/${name}>`;\n }\n }\n\n // Otherwise, return original import\n return match;\n }\n );\n\n transformContent = transformContent.replace(\n /(?<=^\\s*)#(if|elif)\\s+__has_include\\(\"(.+)\"\\)(?=\\s*$)/gm,\n (match: string, ifPrefix: string, headerName: string): string => {\n // `#if __has_include(\"RCTBridge.h\")` -> `#if __has_include(<React/RCTBridge.h>)`\n if (headerSet.has(headerName)) {\n changed = true;\n return `#${ifPrefix} __has_include(<React/${headerName}>)`;\n }\n\n // `#if __has_include(\"React/RCTBridge.h\")` -> `#if __has_include(<React/RCTBridge.h>)`\n if (headerName.startsWith('React/')) {\n const name = headerName.substring(6);\n if (headerSet.has(name)) {\n changed = true;\n return `#${ifPrefix} __has_include(<React/${name}>)`;\n }\n }\n\n // Otherwise, return original import\n return match;\n }\n );\n\n if (changed) {\n console.log(`Patching imports for file: ${file}`);\n if (!dryRun) {\n await fs.writeFile(file, transformContent);\n }\n }\n}\n\n/**\n * Patch imports from a directory\n * @param headerSet prebuilt React-Core header set\n * @param file target patch file\n * @param dryRun true if not writing changes to file\n */\nasync function patchDirAsync(headerSet: Set<string>, dir: string, dryRun: boolean) {\n const files = await glob('**/*.{h,m,mm}', { cwd: dir, absolute: true });\n return Promise.all(files.map((file) => patchFileAsync(headerSet, file, dryRun)));\n}\n"]}
1
+ {"version":3,"file":"ReactImportsPatcher.js","sourceRoot":"","sources":["../src/ReactImportsPatcher.ts"],"names":[],"m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EAAE,GAAW,EAAE,MAAe;IAC/E,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAI,EAAC,eAAe,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC","sourcesContent":["// Copyright 2018-present 650 Industries. All rights reserved.\n\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { PatchReactImportsOptions } from './types';\n\n/**\n * Remove all double-quoted react header imports\n * @param dirs target directories to patch\n * @param options PatchReactImportsOptions\n */\nexport async function patchReactImportsAsync(dirs: string[], options: PatchReactImportsOptions) {\n const headerSet = await generateReactHeaderSetAsync(\n path.join(options.podsRoot, 'Headers', 'Public', 'React-Core', 'React')\n );\n await Promise.all(dirs.map((dir) => patchDirAsync(headerSet, dir, options.dryRun)));\n}\n\n/**\n * Generate `React-Core` public header names as a set, will transform necessary headers based on this set.\n */\nasync function generateReactHeaderSetAsync(reactHeaderDir: string): Promise<Set<string>> {\n const files = await glob('*.h', { cwd: reactHeaderDir });\n return new Set(files);\n}\n\n/**\n * Patch imports from a file\n * @param headerSet prebuilt React-Core header set\n * @param file target patch file\n * @param dryRun true if not writing changes to file\n */\nexport async function patchFileAsync(headerSet: Set<string>, file: string, dryRun: boolean) {\n let changed = false;\n const content = await fs.readFile(file, 'utf-8');\n let transformContent = content.replace(\n /(?<=^\\s*)#import\\s+\"(.+)\"(?=\\s*$)/gm,\n (match: string, headerName: string): string => {\n // `#import \"RCTBridge.h\"` -> `#import <React/RCTBridge.h>`\n if (headerSet.has(headerName)) {\n changed = true;\n return `#import <React/${headerName}>`;\n }\n\n // `#import \"React/RCTBridge.h\"` -> `#import <React/RCTBridge.h>`\n if (headerName.startsWith('React/')) {\n const name = headerName.substring(6);\n if (headerSet.has(name)) {\n changed = true;\n return `#import <React/${name}>`;\n }\n }\n\n // Otherwise, return original import\n return match;\n }\n );\n\n transformContent = transformContent.replace(\n /(?<=^\\s*)#(if|elif)\\s+__has_include\\(\"(.+)\"\\)(?=\\s*$)/gm,\n (match: string, ifPrefix: string, headerName: string): string => {\n // `#if __has_include(\"RCTBridge.h\")` -> `#if __has_include(<React/RCTBridge.h>)`\n if (headerSet.has(headerName)) {\n changed = true;\n return `#${ifPrefix} __has_include(<React/${headerName}>)`;\n }\n\n // `#if __has_include(\"React/RCTBridge.h\")` -> `#if __has_include(<React/RCTBridge.h>)`\n if (headerName.startsWith('React/')) {\n const name = headerName.substring(6);\n if (headerSet.has(name)) {\n changed = true;\n return `#${ifPrefix} __has_include(<React/${name}>)`;\n }\n }\n\n // Otherwise, return original import\n return match;\n }\n );\n\n if (changed) {\n console.log(`Patching imports for file: ${file}`);\n if (!dryRun) {\n await fs.writeFile(file, transformContent);\n }\n }\n}\n\n/**\n * Patch imports from a directory\n * @param headerSet prebuilt React-Core header set\n * @param file target patch file\n * @param dryRun true if not writing changes to file\n */\nasync function patchDirAsync(headerSet: Set<string>, dir: string, dryRun: boolean) {\n const files = await glob('**/*.{h,m,mm}', { cwd: dir, absolute: true });\n return Promise.all(files.map((file) => patchFileAsync(headerSet, file, dryRun)));\n}\n"]}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.findModulesAsync = void 0;
6
+ exports.findModulesAsync = findModulesAsync;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const fast_glob_1 = __importDefault(require("fast-glob"));
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -81,7 +81,6 @@ async function findModulesAsync(providedOptions) {
81
81
  alwaysIncludedPackagesNames: nativeModuleNames,
82
82
  });
83
83
  }
84
- exports.findModulesAsync = findModulesAsync;
85
84
  /**
86
85
  * Returns the priority of the config at given path. Higher number means higher priority.
87
86
  */
@@ -1 +1 @@
1
- {"version":3,"file":"findModules.js","sourceRoot":"","sources":["../../src/autolinking/findModules.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,0DAA6B;AAC7B,wDAA0B;AAC1B,mCAAuC;AACvC,gDAAwB;AAExB,+DAAiG;AACjG,0DAAwE;AAGxE,8DAA8D;AAC9D,MAAM,4BAA4B,GAAG,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;AAEnF;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,eAA8B;IACnE,MAAM,OAAO,GAAG,MAAM,IAAA,8CAAwB,EAAC,eAAe,CAAC,CAAC;IAChE,MAAM,OAAO,GAAiC,IAAI,GAAG,EAAE,CAAC;IAExD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE5C,yFAAyF;IACzF,MAAM,WAAW,GAAG,IAAI,GAAG,CACzB,OAAO,CAAC,gBAAgB,IAAI,kBAAE,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACjE,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;QACpD,CAAC,CAAC,OAAO,CAAC,WAAW,CACxB,CAAC;IAEF,sGAAsG;IACtG,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,kBAAkB,GAAG,UAAU,KAAK,OAAO,CAAC,gBAAgB,CAAC;QAEnE,MAAM,kBAAkB,GAAG,MAAM,4BAA4B,CAAC,UAAU,CAAC,CAAC;QAE1E,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE;YAClD,MAAM,WAAW,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC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eAAe,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAC;oBACnD,yBAAyB,GAAG,cAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;iBAC9E;qBAAM;oBACL,IAAI;wBACF;;;2BAGG;wBACH,MAAM,cAAc,GAAG,IAAA,sBAAa,EAAC,eAAe,CAAC,CAAC;wBACtD,yBAAyB,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,cAAc,eAAe,CAAC,CAAC;qBACtF;oBAAC,OAAO,KAAU,EAAE;wBACnB,mEAAmE;wBACnE,wFAAwF;wBACxF,2EAA2E;wBAC3E,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,+BAA+B,EAAE;4BACrE,OAAO,CAAC,IAAI,CACV,eAAK,CAAC,MAAM,CAAC,mCAAmC,cAAc,YAAY,CAAC,CAC5E,CAAC;yBACH;wBACD,SAAS;qBACV;iBACF;gBAED,gCAAgC;gBAChC,YAAY,CAAC,yBAAyB,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED,2BAA2B;IAC3B,MAAM,sBAAsB,GAAG,MAAM,IAAA,oDAA8B,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACzF,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAErC,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import chalk from 'chalk';\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport { createRequire } from 'module';\nimport path from 'path';\n\nimport { getProjectPackageJsonPathAsync, mergeLinkingOptionsAsync } from './mergeLinkingOptions';\nimport { requireAndResolveExpoModuleConfig } from '../ExpoModuleConfig';\nimport { PackageRevision, SearchOptions, SearchResults } from '../types';\n\n// Names of the config files. From lowest to highest priority.\nconst EXPO_MODULE_CONFIG_FILENAMES = ['unimodule.json', 'expo-module.config.json'];\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 results: Map<string, PackageRevision> = new Map();\n\n const nativeModuleNames = new Set<string>();\n\n // custom native modules should be resolved first so that they can override other modules\n const searchPaths = new Set(\n options.nativeModulesDir && fs.existsSync(options.nativeModulesDir)\n ? [options.nativeModulesDir, ...options.searchPaths]\n : options.searchPaths\n );\n\n // `searchPaths` can be mutated to discover all \"isolated modules groups\", when using isolated modules\n for (const searchPath of searchPaths) {\n const isNativeModulesDir = searchPath === options.nativeModulesDir;\n\n const packageConfigPaths = await findPackagesConfigPathsAsync(searchPath);\n\n for (const packageConfigPath of packageConfigPaths) {\n const packagePath = await fs.realpath(path.join(searchPath, path.dirname(packageConfigPath)));\n const expoModuleConfig = requireAndResolveExpoModuleConfig(\n path.join(packagePath, path.basename(packageConfigPath))\n );\n\n const { name, version } = resolvePackageNameAndVersion(packagePath, {\n fallbackToDirName: isNativeModulesDir,\n });\n\n // Check if the project is using isolated modules, by checking\n // if the parent dir of `packagePath` is a `node_modules` folder.\n // Isolated modules installs dependencies in small groups such as:\n // - /.pnpm/expo@50.x.x(...)/node_modules/@expo/cli\n // - /.pnpm/expo@50.x.x(...)/node_modules/expo\n // - /.pnpm/expo@50.x.x(...)/node_modules/expo-application\n // When isolated modules are detected, expand the `searchPaths`\n // to include possible nested dependencies.\n const maybeIsolatedModulesPath = path.join(\n packagePath,\n name.startsWith('@') && name.includes('/') ? '../..' : '..' // scoped packages are nested deeper\n );\n const isIsolatedModulesPath = path.basename(maybeIsolatedModulesPath) === 'node_modules';\n if (isIsolatedModulesPath && !searchPaths.has(maybeIsolatedModulesPath)) {\n searchPaths.add(maybeIsolatedModulesPath);\n }\n\n // we ignore the `exclude` option for custom native modules\n if (\n (!isNativeModulesDir && options.exclude?.includes(name)) ||\n !expoModuleConfig.supportsPlatform(options.platform)\n ) {\n continue;\n }\n\n // add the current revision to the results\n const currentRevision: PackageRevision = {\n path: packagePath,\n version,\n config: expoModuleConfig,\n };\n addRevisionToResults(results, name, currentRevision);\n\n // if the module is a native module, we need to add it to the nativeModuleNames set\n if (isNativeModulesDir && !nativeModuleNames.has(name)) {\n nativeModuleNames.add(name);\n }\n }\n }\n\n const searchResults: SearchResults = Object.fromEntries(results.entries());\n\n // It doesn't make much sense to strip modules if there is only one search path.\n // (excluding custom native modules path)\n // Workspace root usually doesn't specify all its dependencies (see Expo Go),\n // so in this case we should link everything.\n if (options.searchPaths.length <= 1 || options.onlyProjectDeps === false) {\n return searchResults;\n }\n\n return await filterToProjectDependenciesAsync(searchResults, {\n ...providedOptions,\n // Custom native modules are not filtered out\n // when they're not specified in package.json dependencies.\n alwaysIncludedPackagesNames: nativeModuleNames,\n });\n}\n\n/**\n * Returns the priority of the config at given path. Higher number means higher priority.\n */\nfunction configPriority(fullpath: string): number {\n return EXPO_MODULE_CONFIG_FILENAMES.indexOf(path.basename(fullpath));\n}\n\n/**\n * Adds {@link revision} to the {@link results} map\n * or to package duplicates if it already exists.\n * @param results [mutable] yet resolved packages map\n * @param name resolved package name\n * @param revision resolved package revision\n */\nfunction addRevisionToResults(\n results: Map<string, PackageRevision>,\n name: string,\n revision: PackageRevision\n): void {\n if (!results.has(name)) {\n // The revision that was found first will be the main one.\n // An array of duplicates and the config are needed only here.\n results.set(name, {\n ...revision,\n duplicates: [],\n });\n } else if (\n results.get(name)?.path !== revision.path &&\n results.get(name)?.duplicates?.every(({ path }) => path !== revision.path)\n ) {\n const { config, duplicates, ...duplicateEntry } = revision;\n results.get(name)?.duplicates?.push(duplicateEntry);\n }\n}\n\n/**\n * Returns paths to the highest priority config files, relative to the {@link searchPath}.\n * @example\n * ```\n * // Given the following file exists: /foo/myapp/modules/mymodule/expo-module.config.json\n * await findPackagesConfigPathsAsync('/foo/myapp/modules');\n * // returns ['mymodule/expo-module.config.json']\n *\n * await findPackagesConfigPathsAsync('/foo/myapp/modules/mymodule');\n * // returns ['expo-module.config.json']\n * ```\n */\nasync function findPackagesConfigPathsAsync(searchPath: string): Promise<string[]> {\n const bracedFilenames = '{' + EXPO_MODULE_CONFIG_FILENAMES.join(',') + '}';\n const paths = await glob(\n [`*/${bracedFilenames}`, `@*/*/${bracedFilenames}`, `./${bracedFilenames}`],\n {\n cwd: searchPath,\n }\n );\n\n // If the package has multiple configs (e.g. `unimodule.json` and `expo-module.config.json` during the transition time)\n // then we want to give `expo-module.config.json` the priority.\n return Object.values(\n paths.reduce<Record<string, string>>((acc, configPath) => {\n const dirname = path.dirname(configPath);\n\n if (!acc[dirname] || configPriority(configPath) > configPriority(acc[dirname])) {\n acc[dirname] = configPath;\n }\n return acc;\n }, {})\n );\n}\n\n/**\n * Resolves package name and version for the given {@link packagePath} from its `package.json`.\n * if {@link fallbackToDirName} is true, it returns the dir name when `package.json` doesn't exist.\n * @returns object with `name` and `version` properties. `version` falls back to `UNVERSIONED` if cannot be resolved.\n */\nfunction resolvePackageNameAndVersion(\n packagePath: string,\n { fallbackToDirName }: { fallbackToDirName?: boolean } = {}\n): { name: string; version: string } {\n try {\n const { name, version } = require(path.join(packagePath, 'package.json'));\n return { name, version: version || 'UNVERSIONED' };\n } catch (e) {\n if (fallbackToDirName) {\n // we don't have the package.json name, so we'll use the directory name\n return {\n name: path.basename(packagePath),\n version: 'UNVERSIONED',\n };\n } else {\n throw e;\n }\n }\n}\n\n/**\n * Filters out packages that are not the dependencies of the project.\n */\nasync function filterToProjectDependenciesAsync(\n results: SearchResults,\n options: Pick<SearchOptions, 'projectRoot' | 'silent'> & {\n alwaysIncludedPackagesNames?: Set<string>;\n }\n): Promise<SearchResults> {\n const filteredResults: SearchResults = {};\n const visitedPackages = new Set<string>();\n\n // iterate through always included package names and add them to the visited packages\n // if the results contains them\n for (const name of options.alwaysIncludedPackagesNames ?? []) {\n if (results[name] && !visitedPackages.has(name)) {\n filteredResults[name] = results[name];\n visitedPackages.add(name);\n }\n }\n\n // Helper for traversing the dependency hierarchy.\n function visitPackage(packageJsonPath: string) {\n const packageJson = require(packageJsonPath);\n\n // Prevent getting into the recursive loop.\n if (visitedPackages.has(packageJson.name)) {\n return;\n }\n visitedPackages.add(packageJson.name);\n\n // Iterate over the dependencies to find transitive modules.\n for (const dependencyName in packageJson.dependencies) {\n const dependencyResult = results[dependencyName];\n\n if (!filteredResults[dependencyName]) {\n let dependencyPackageJsonPath: string;\n\n if (dependencyResult) {\n filteredResults[dependencyName] = dependencyResult;\n dependencyPackageJsonPath = path.join(dependencyResult.path, 'package.json');\n } else {\n try {\n /**\n * Custom `require` that resolves from the current working dir instead of this script path.\n * **Requires Node v12.2.0**\n */\n const projectRequire = createRequire(packageJsonPath);\n dependencyPackageJsonPath = projectRequire.resolve(`${dependencyName}/package.json`);\n } catch (error: any) {\n // Some packages don't include package.json in its `exports` field,\n // but none of our packages do that, so it seems fine to just ignore that type of error.\n // Related issue: https://github.com/react-native-community/cli/issues/1168\n if (!options.silent && error.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') {\n console.warn(\n chalk.yellow(`⚠️ Cannot resolve the path to \"${dependencyName}\" package.`)\n );\n }\n continue;\n }\n }\n\n // Visit the dependency package.\n visitPackage(dependencyPackageJsonPath);\n }\n }\n }\n\n // Visit project's package.\n const projectPackageJsonPath = await getProjectPackageJsonPathAsync(options.projectRoot);\n visitPackage(projectPackageJsonPath);\n\n return filteredResults;\n}\n"]}
1
+ {"version":3,"file":"findModules.js","sourceRoot":"","sources":["../../src/autolinking/findModules.ts"],"names":[],"mappings":";;;;;AAgBA,4CAqFC;AArGD,kDAA0B;AAC1B,0DAA6B;AAC7B,wDAA0B;AAC1B,mCAAuC;AACvC,gDAAwB;AAExB,+DAAiG;AACjG,0DAAwE;AAGxE,8DAA8D;AAC9D,MAAM,4BAA4B,GAAG,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;AAEnF;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,eAA8B;IACnE,MAAM,OAAO,GAAG,MAAM,IAAA,8CAAwB,EAAC,eAAe,CAAC,CAAC;IAChE,MAAM,OAAO,G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C,CAAC;oBACvF,CAAC;oBAAC,OAAO,KAAU,EAAE,CAAC;wBACpB,mEAAmE;wBACnE,wFAAwF;wBACxF,2EAA2E;wBAC3E,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,+BAA+B,EAAE,CAAC;4BACtE,OAAO,CAAC,IAAI,CACV,eAAK,CAAC,MAAM,CAAC,mCAAmC,cAAc,YAAY,CAAC,CAC5E,CAAC;wBACJ,CAAC;wBACD,SAAS;oBACX,CAAC;gBACH,CAAC;gBAED,gCAAgC;gBAChC,YAAY,CAAC,yBAAyB,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,MAAM,sBAAsB,GAAG,MAAM,IAAA,oDAA8B,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACzF,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAErC,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import chalk from 'chalk';\nimport glob from 'fast-glob';\nimport fs from 'fs-extra';\nimport { createRequire } from 'module';\nimport path from 'path';\n\nimport { getProjectPackageJsonPathAsync, mergeLinkingOptionsAsync } from './mergeLinkingOptions';\nimport { requireAndResolveExpoModuleConfig } from '../ExpoModuleConfig';\nimport { PackageRevision, SearchOptions, SearchResults } from '../types';\n\n// Names of the config files. From lowest to highest priority.\nconst EXPO_MODULE_CONFIG_FILENAMES = ['unimodule.json', 'expo-module.config.json'];\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 results: Map<string, PackageRevision> = new Map();\n\n const nativeModuleNames = new Set<string>();\n\n // custom native modules should be resolved first so that they can override other modules\n const searchPaths = new Set(\n options.nativeModulesDir && fs.existsSync(options.nativeModulesDir)\n ? [options.nativeModulesDir, ...options.searchPaths]\n : options.searchPaths\n );\n\n // `searchPaths` can be mutated to discover all \"isolated modules groups\", when using isolated modules\n for (const searchPath of searchPaths) {\n const isNativeModulesDir = searchPath === options.nativeModulesDir;\n\n const packageConfigPaths = await findPackagesConfigPathsAsync(searchPath);\n\n for (const packageConfigPath of packageConfigPaths) {\n const packagePath = await fs.realpath(path.join(searchPath, path.dirname(packageConfigPath)));\n const expoModuleConfig = requireAndResolveExpoModuleConfig(\n path.join(packagePath, path.basename(packageConfigPath))\n );\n\n const { name, version } = resolvePackageNameAndVersion(packagePath, {\n fallbackToDirName: isNativeModulesDir,\n });\n\n // Check if the project is using isolated modules, by checking\n // if the parent dir of `packagePath` is a `node_modules` folder.\n // Isolated modules installs dependencies in small groups such as:\n // - /.pnpm/expo@50.x.x(...)/node_modules/@expo/cli\n // - /.pnpm/expo@50.x.x(...)/node_modules/expo\n // - /.pnpm/expo@50.x.x(...)/node_modules/expo-application\n // When isolated modules are detected, expand the `searchPaths`\n // to include possible nested dependencies.\n const maybeIsolatedModulesPath = path.join(\n packagePath,\n name.startsWith('@') && name.includes('/') ? '../..' : '..' // scoped packages are nested deeper\n );\n const isIsolatedModulesPath = path.basename(maybeIsolatedModulesPath) === 'node_modules';\n if (isIsolatedModulesPath && !searchPaths.has(maybeIsolatedModulesPath)) {\n searchPaths.add(maybeIsolatedModulesPath);\n }\n\n // we ignore the `exclude` option for custom native modules\n if (\n (!isNativeModulesDir && options.exclude?.includes(name)) ||\n !expoModuleConfig.supportsPlatform(options.platform)\n ) {\n continue;\n }\n\n // add the current revision to the results\n const currentRevision: PackageRevision = {\n path: packagePath,\n version,\n config: expoModuleConfig,\n };\n addRevisionToResults(results, name, currentRevision);\n\n // if the module is a native module, we need to add it to the nativeModuleNames set\n if (isNativeModulesDir && !nativeModuleNames.has(name)) {\n nativeModuleNames.add(name);\n }\n }\n }\n\n const searchResults: SearchResults = Object.fromEntries(results.entries());\n\n // It doesn't make much sense to strip modules if there is only one search path.\n // (excluding custom native modules path)\n // Workspace root usually doesn't specify all its dependencies (see Expo Go),\n // so in this case we should link everything.\n if (options.searchPaths.length <= 1 || options.onlyProjectDeps === false) {\n return searchResults;\n }\n\n return await filterToProjectDependenciesAsync(searchResults, {\n ...providedOptions,\n // Custom native modules are not filtered out\n // when they're not specified in package.json dependencies.\n alwaysIncludedPackagesNames: nativeModuleNames,\n });\n}\n\n/**\n * Returns the priority of the config at given path. Higher number means higher priority.\n */\nfunction configPriority(fullpath: string): number {\n return EXPO_MODULE_CONFIG_FILENAMES.indexOf(path.basename(fullpath));\n}\n\n/**\n * Adds {@link revision} to the {@link results} map\n * or to package duplicates if it already exists.\n * @param results [mutable] yet resolved packages map\n * @param name resolved package name\n * @param revision resolved package revision\n */\nfunction addRevisionToResults(\n results: Map<string, PackageRevision>,\n name: string,\n revision: PackageRevision\n): void {\n if (!results.has(name)) {\n // The revision that was found first will be the main one.\n // An array of duplicates and the config are needed only here.\n results.set(name, {\n ...revision,\n duplicates: [],\n });\n } else if (\n results.get(name)?.path !== revision.path &&\n results.get(name)?.duplicates?.every(({ path }) => path !== revision.path)\n ) {\n const { config, duplicates, ...duplicateEntry } = revision;\n results.get(name)?.duplicates?.push(duplicateEntry);\n }\n}\n\n/**\n * Returns paths to the highest priority config files, relative to the {@link searchPath}.\n * @example\n * ```\n * // Given the following file exists: /foo/myapp/modules/mymodule/expo-module.config.json\n * await findPackagesConfigPathsAsync('/foo/myapp/modules');\n * // returns ['mymodule/expo-module.config.json']\n *\n * await findPackagesConfigPathsAsync('/foo/myapp/modules/mymodule');\n * // returns ['expo-module.config.json']\n * ```\n */\nasync function findPackagesConfigPathsAsync(searchPath: string): Promise<string[]> {\n const bracedFilenames = '{' + EXPO_MODULE_CONFIG_FILENAMES.join(',') + '}';\n const paths = await glob(\n [`*/${bracedFilenames}`, `@*/*/${bracedFilenames}`, `./${bracedFilenames}`],\n {\n cwd: searchPath,\n }\n );\n\n // If the package has multiple configs (e.g. `unimodule.json` and `expo-module.config.json` during the transition time)\n // then we want to give `expo-module.config.json` the priority.\n return Object.values(\n paths.reduce<Record<string, string>>((acc, configPath) => {\n const dirname = path.dirname(configPath);\n\n if (!acc[dirname] || configPriority(configPath) > configPriority(acc[dirname])) {\n acc[dirname] = configPath;\n }\n return acc;\n }, {})\n );\n}\n\n/**\n * Resolves package name and version for the given {@link packagePath} from its `package.json`.\n * if {@link fallbackToDirName} is true, it returns the dir name when `package.json` doesn't exist.\n * @returns object with `name` and `version` properties. `version` falls back to `UNVERSIONED` if cannot be resolved.\n */\nfunction resolvePackageNameAndVersion(\n packagePath: string,\n { fallbackToDirName }: { fallbackToDirName?: boolean } = {}\n): { name: string; version: string } {\n try {\n const { name, version } = require(path.join(packagePath, 'package.json'));\n return { name, version: version || 'UNVERSIONED' };\n } catch (e) {\n if (fallbackToDirName) {\n // we don't have the package.json name, so we'll use the directory name\n return {\n name: path.basename(packagePath),\n version: 'UNVERSIONED',\n };\n } else {\n throw e;\n }\n }\n}\n\n/**\n * Filters out packages that are not the dependencies of the project.\n */\nasync function filterToProjectDependenciesAsync(\n results: SearchResults,\n options: Pick<SearchOptions, 'projectRoot' | 'silent'> & {\n alwaysIncludedPackagesNames?: Set<string>;\n }\n): Promise<SearchResults> {\n const filteredResults: SearchResults = {};\n const visitedPackages = new Set<string>();\n\n // iterate through always included package names and add them to the visited packages\n // if the results contains them\n for (const name of options.alwaysIncludedPackagesNames ?? []) {\n if (results[name] && !visitedPackages.has(name)) {\n filteredResults[name] = results[name];\n visitedPackages.add(name);\n }\n }\n\n // Helper for traversing the dependency hierarchy.\n function visitPackage(packageJsonPath: string) {\n const packageJson = require(packageJsonPath);\n\n // Prevent getting into the recursive loop.\n if (visitedPackages.has(packageJson.name)) {\n return;\n }\n visitedPackages.add(packageJson.name);\n\n // Iterate over the dependencies to find transitive modules.\n for (const dependencyName in packageJson.dependencies) {\n const dependencyResult = results[dependencyName];\n\n if (!filteredResults[dependencyName]) {\n let dependencyPackageJsonPath: string;\n\n if (dependencyResult) {\n filteredResults[dependencyName] = dependencyResult;\n dependencyPackageJsonPath = path.join(dependencyResult.path, 'package.json');\n } else {\n try {\n /**\n * Custom `require` that resolves from the current working dir instead of this script path.\n * **Requires Node v12.2.0**\n */\n const projectRequire = createRequire(packageJsonPath);\n dependencyPackageJsonPath = projectRequire.resolve(`${dependencyName}/package.json`);\n } catch (error: any) {\n // Some packages don't include package.json in its `exports` field,\n // but none of our packages do that, so it seems fine to just ignore that type of error.\n // Related issue: https://github.com/react-native-community/cli/issues/1168\n if (!options.silent && error.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') {\n console.warn(\n chalk.yellow(`⚠️ Cannot resolve the path to \"${dependencyName}\" package.`)\n );\n }\n continue;\n }\n }\n\n // Visit the dependency package.\n visitPackage(dependencyPackageJsonPath);\n }\n }\n }\n\n // Visit project's package.\n const projectPackageJsonPath = await getProjectPackageJsonPathAsync(options.projectRoot);\n visitPackage(projectPackageJsonPath);\n\n return filteredResults;\n}\n"]}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generatePackageListAsync = void 0;
6
+ exports.generatePackageListAsync = generatePackageListAsync;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const utils_1 = require("./utils");
9
9
  /**
@@ -20,5 +20,4 @@ async function generatePackageListAsync(modules, options) {
20
20
  throw e;
21
21
  }
22
22
  }
23
- exports.generatePackageListAsync = generatePackageListAsync;
24
23
  //# sourceMappingURL=generatePackageList.js.map
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"generatePackageList.js","sourceRoot":"","sources":["../../src/autolinking/generatePackageList.ts"],"names":[],"mappings":";;;;;AASA,4DAaC;AAtBD,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","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"]}
@@ -1,8 +1,8 @@
1
1
  import { findModulesAsync } from './findModules';
2
2
  import { mergeLinkingOptionsAsync, resolveSearchPathsAsync } from './mergeLinkingOptions';
3
- import { resolveModulesAsync } from './resolveModules';
3
+ import { resolveExtraBuildDependenciesAsync, resolveModulesAsync } from './resolveModules';
4
4
  import type { ModuleDescriptor, SearchOptions } from '../types';
5
- export { findModulesAsync, mergeLinkingOptionsAsync, resolveModulesAsync, resolveSearchPathsAsync };
5
+ export { findModulesAsync, mergeLinkingOptionsAsync, resolveExtraBuildDependenciesAsync, resolveModulesAsync, resolveSearchPathsAsync, };
6
6
  export { generatePackageListAsync } from './generatePackageList';
7
7
  export { verifySearchResults } from './verifySearchResults';
8
8
  export * from '../types';
@@ -14,13 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.queryAutolinkingModulesFromProjectAsync = exports.verifySearchResults = exports.generatePackageListAsync = exports.resolveSearchPathsAsync = exports.resolveModulesAsync = exports.mergeLinkingOptionsAsync = exports.findModulesAsync = void 0;
17
+ exports.verifySearchResults = exports.generatePackageListAsync = exports.resolveSearchPathsAsync = exports.resolveModulesAsync = exports.resolveExtraBuildDependenciesAsync = exports.mergeLinkingOptionsAsync = exports.findModulesAsync = void 0;
18
+ exports.queryAutolinkingModulesFromProjectAsync = queryAutolinkingModulesFromProjectAsync;
18
19
  const findModules_1 = require("./findModules");
19
20
  Object.defineProperty(exports, "findModulesAsync", { enumerable: true, get: function () { return findModules_1.findModulesAsync; } });
20
21
  const mergeLinkingOptions_1 = require("./mergeLinkingOptions");
21
22
  Object.defineProperty(exports, "mergeLinkingOptionsAsync", { enumerable: true, get: function () { return mergeLinkingOptions_1.mergeLinkingOptionsAsync; } });
22
23
  Object.defineProperty(exports, "resolveSearchPathsAsync", { enumerable: true, get: function () { return mergeLinkingOptions_1.resolveSearchPathsAsync; } });
23
24
  const resolveModules_1 = require("./resolveModules");
25
+ Object.defineProperty(exports, "resolveExtraBuildDependenciesAsync", { enumerable: true, get: function () { return resolveModules_1.resolveExtraBuildDependenciesAsync; } });
24
26
  Object.defineProperty(exports, "resolveModulesAsync", { enumerable: true, get: function () { return resolveModules_1.resolveModulesAsync; } });
25
27
  var generatePackageList_1 = require("./generatePackageList");
26
28
  Object.defineProperty(exports, "generatePackageListAsync", { enumerable: true, get: function () { return generatePackageList_1.generatePackageListAsync; } });
@@ -36,5 +38,4 @@ async function queryAutolinkingModulesFromProjectAsync(projectRoot, options) {
36
38
  const searchResults = await (0, findModules_1.findModulesAsync)(linkOptions);
37
39
  return await (0, resolveModules_1.resolveModulesAsync)(searchResults, linkOptions);
38
40
  }
39
- exports.queryAutolinkingModulesFromProjectAsync = queryAutolinkingModulesFromProjectAsync;
40
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autolinking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAiD;AAKxC,iGALA,8BAAgB,OAKA;AAJzB,+DAA0F;AAI/D,yGAJlB,8CAAwB,OAIkB;AAAuB,wGAJvC,6CAAuB,OAIuC;AAHjG,qDAAuD;AAGF,oGAH5C,oCAAmB,OAG4C;AACxE,6DAAiE;AAAxD,+HAAA,wBAAwB,OAAA;AACjC,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,2CAAyB;AAEzB;;GAEG;AACI,KAAK,UAAU,uCAAuC,CAC3D,WAAmB,EACnB,OAAwE;IAExE,MAAM,WAAW,GAAG,MAAM,IAAA,6CAAuB,EAAC,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;AARD,0FAQC","sourcesContent":["import { findModulesAsync } from './findModules';\nimport { mergeLinkingOptionsAsync, resolveSearchPathsAsync } from './mergeLinkingOptions';\nimport { resolveModulesAsync } from './resolveModules';\nimport type { ModuleDescriptor, SearchOptions } from '../types';\n\nexport { findModulesAsync, mergeLinkingOptionsAsync, resolveModulesAsync, resolveSearchPathsAsync };\nexport { generatePackageListAsync } from './generatePackageList';\nexport { verifySearchResults } from './verifySearchResults';\nexport * from '../types';\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autolinking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAmBA,0FAQC;AA3BD,+CAAiD;AAM/C,iGANO,8BAAgB,OAMP;AALlB,+DAA0F;AAMxF,yGANO,8CAAwB,OAMP;AAGxB,wGATiC,6CAAuB,OASjC;AARzB,qDAA2F;AAMzF,mHANO,mDAAkC,OAMP;AAClC,oGAP2C,oCAAmB,OAO3C;AAGrB,6DAAiE;AAAxD,+HAAA,wBAAwB,OAAA;AACjC,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,2CAAyB;AAEzB;;GAEG;AACI,KAAK,UAAU,uCAAuC,CAC3D,WAAmB,EACnB,OAAwE;IAExE,MAAM,WAAW,GAAG,MAAM,IAAA,6CAAuB,EAAC,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","sourcesContent":["import { findModulesAsync } from './findModules';\nimport { mergeLinkingOptionsAsync, resolveSearchPathsAsync } from './mergeLinkingOptions';\nimport { resolveExtraBuildDependenciesAsync, resolveModulesAsync } from './resolveModules';\nimport type { ModuleDescriptor, SearchOptions } from '../types';\n\nexport {\n findModulesAsync,\n mergeLinkingOptionsAsync,\n resolveExtraBuildDependenciesAsync,\n resolveModulesAsync,\n resolveSearchPathsAsync,\n};\nexport { generatePackageListAsync } from './generatePackageList';\nexport { verifySearchResults } from './verifySearchResults';\nexport * from '../types';\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"]}
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveSearchPathsAsync = exports.mergeLinkingOptionsAsync = exports.getProjectPackageJsonPathAsync = void 0;
6
+ exports.getProjectPackageJsonPathAsync = getProjectPackageJsonPathAsync;
7
+ exports.mergeLinkingOptionsAsync = mergeLinkingOptionsAsync;
8
+ exports.resolveSearchPathsAsync = resolveSearchPathsAsync;
7
9
  const find_up_1 = __importDefault(require("find-up"));
8
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
11
  const path_1 = __importDefault(require("path"));
@@ -17,7 +19,6 @@ async function getProjectPackageJsonPathAsync(projectRoot) {
17
19
  }
18
20
  return result;
19
21
  }
20
- exports.getProjectPackageJsonPathAsync = getProjectPackageJsonPathAsync;
21
22
  /**
22
23
  * Merges autolinking options from different sources (the later the higher priority)
23
24
  * - options defined in package.json's `expo.autolinking` field
@@ -34,7 +35,6 @@ async function mergeLinkingOptionsAsync(providedOptions) {
34
35
  finalOptions.nativeModulesDir = await resolveNativeModulesDirAsync(finalOptions.nativeModulesDir, providedOptions.projectRoot);
35
36
  return finalOptions;
36
37
  }
37
- exports.mergeLinkingOptionsAsync = mergeLinkingOptionsAsync;
38
38
  /**
39
39
  * Resolves autolinking search paths. If none is provided, it accumulates all node_modules when
40
40
  * going up through the path components. This makes workspaces work out-of-the-box without any configs.
@@ -44,7 +44,6 @@ async function resolveSearchPathsAsync(searchPaths, cwd) {
44
44
  ? searchPaths.map((searchPath) => path_1.default.resolve(cwd, searchPath))
45
45
  : await findDefaultPathsAsync(cwd);
46
46
  }
47
- exports.resolveSearchPathsAsync = resolveSearchPathsAsync;
48
47
  /**
49
48
  * Looks up for workspace's `node_modules` paths.
50
49
  */
@@ -1 +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AAE,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
+ {"version":3,"file":"mergeLinkingOptions.js","sour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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,CAAC;QACzB,OAAO,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IAC9C,CAAC;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,5 +1,9 @@
1
- import { ModuleDescriptor, ResolveOptions, SearchResults } from '../types';
1
+ import type { ExtraDependencies, ModuleDescriptor, ResolveOptions, SearchResults } from '../types';
2
2
  /**
3
3
  * Resolves search results to a list of platform-specific configuration.
4
4
  */
5
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,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveModulesAsync = void 0;
3
+ exports.resolveModulesAsync = resolveModulesAsync;
4
+ exports.resolveExtraBuildDependenciesAsync = resolveExtraBuildDependenciesAsync;
4
5
  const utils_1 = require("./utils");
5
6
  /**
6
7
  * Resolves search results to a list of platform-specific configuration.
@@ -20,5 +21,12 @@ async function resolveModulesAsync(searchResults, options) {
20
21
  .filter(Boolean)
21
22
  .sort((a, b) => a.packageName.localeCompare(b.packageName));
22
23
  }
23
- exports.resolveModulesAsync = resolveModulesAsync;
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);
30
+ return extraDependencies ?? [];
31
+ }
24
32
  //# sourceMappingURL=resolveModules.js.map
@@ -1 +1 @@
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"]}
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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLinkingImplementationForPlatform = void 0;
3
+ exports.getLinkingImplementationForPlatform = getLinkingImplementationForPlatform;
4
4
  function getLinkingImplementationForPlatform(platform) {
5
5
  switch (platform) {
6
6
  case 'ios':
@@ -14,5 +14,4 @@ function getLinkingImplementationForPlatform(platform) {
14
14
  return require('../platforms/devtools');
15
15
  }
16
16
  }
17
- exports.getLinkingImplementationForPlatform = getLinkingImplementationForPlatform;
18
17
  //# sourceMappingURL=utils.js.map
@@ -1 +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"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/autolinking/utils.ts"],"names":[],"mappings":";;AAEA,kFAYC;AAZD,SAAgB,mCAAmC,CAAC,QAA2B;IAC7E,QAAQ,QAAQ,EAAE,CAAC;QACjB,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;IAC5C,CAAC;AACH,CAAC","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"]}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.verifySearchResults = void 0;
6
+ exports.verifySearchResults = verifySearchResults;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  /**
@@ -28,5 +28,4 @@ function verifySearchResults(searchResults, options) {
28
28
  }
29
29
  return counter;
30
30
  }
31
- exports.verifySearchResults = verifySearchResults;
32
31
  //# sourceMappingURL=verifySearchResults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifySearchResults.js","sourceRoot":"","sources":["../../src/autolinking/verifySearchResults.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AAIxB;;GAEG;AACH,SAAgB,mBAAmB,CAAC,aAA4B,EAAE,OAAsB;IACtF,MAAM,YAAY,GAAqC,CAAC,GAAG,EAAE,EAAE,CAC7D,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE;QACtC,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QAE3C,IAAI,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE;YAC/B,OAAO,CAAC,IAAI,CAAC,mCAAmC,eAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC3E,OAAO,CAAC,GAAG,CAAC,MAAM,eAAK,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE7F,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,UAAU,EAAE;gBAC3C,OAAO,CAAC,GAAG,CAAC,MAAM,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,KAAK,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;aAC7F;YACD,OAAO,EAAE,CAAC;SACX;KACF;IACD,IAAI,OAAO,GAAG,CAAC,EAAE;QACf,OAAO,CAAC,IAAI,CACV,wGAAwG,CACzG,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAxBD,kDAwBC","sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport { PackageRevision, SearchOptions, SearchResults } from '../types';\n\n/**\n * Verifies the search results by checking whether there are no duplicates.\n */\nexport function verifySearchResults(searchResults: SearchResults, options: SearchOptions): number {\n const relativePath: (pkg: PackageRevision) => string = (pkg) =>\n path.relative(options.projectRoot, pkg.path);\n let counter = 0;\n\n for (const moduleName in searchResults) {\n const revision = searchResults[moduleName];\n\n if (revision.duplicates?.length) {\n console.warn(`⚠️ Found multiple revisions of ${chalk.green(moduleName)}`);\n console.log(` - ${chalk.magenta(relativePath(revision))} (${chalk.cyan(revision.version)})`);\n\n for (const duplicate of revision.duplicates) {\n console.log(` - ${chalk.gray(relativePath(duplicate))} (${chalk.gray(duplicate.version)})`);\n }\n counter++;\n }\n }\n if (counter > 0) {\n console.warn(\n '⚠️ Please get rid of multiple revisions as it may introduce some side effects or compatibility issues'\n );\n }\n return counter;\n}\n"]}
1
+ {"version":3,"file":"verifySearchResults.js","sourceRoot":"","sources":["../../src/autolinking/verifySearchResults.ts"],"names":[],"mappings":";;;;;AAQA,kDAwBC;AAhCD,kDAA0B;AAC1B,gDAAwB;AAIxB;;GAEG;AACH,SAAgB,mBAAmB,CAAC,aAA4B,EAAE,OAAsB;IACtF,MAAM,YAAY,GAAqC,CAAC,GAAG,EAAE,EAAE,CAC7D,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QAE3C,IAAI,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,mCAAmC,eAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC3E,OAAO,CAAC,GAAG,CAAC,MAAM,eAAK,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE7F,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;gBAC5C,OAAO,CAAC,GAAG,CAAC,MAAM,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,KAAK,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC9F,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CACV,wGAAwG,CACzG,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport { PackageRevision, SearchOptions, SearchResults } from '../types';\n\n/**\n * Verifies the search results by checking whether there are no duplicates.\n */\nexport function verifySearchResults(searchResults: SearchResults, options: SearchOptions): number {\n const relativePath: (pkg: PackageRevision) => string = (pkg) =>\n path.relative(options.projectRoot, pkg.path);\n let counter = 0;\n\n for (const moduleName in searchResults) {\n const revision = searchResults[moduleName];\n\n if (revision.duplicates?.length) {\n console.warn(`⚠️ Found multiple revisions of ${chalk.green(moduleName)}`);\n console.log(` - ${chalk.magenta(relativePath(revision))} (${chalk.cyan(revision.version)})`);\n\n for (const duplicate of revision.duplicates) {\n console.log(` - ${chalk.gray(relativePath(duplicate))} (${chalk.gray(duplicate.version)})`);\n }\n counter++;\n }\n }\n if (counter > 0) {\n console.warn(\n '⚠️ Please get rid of multiple revisions as it may introduce some side effects or compatibility issues'\n );\n }\n return counter;\n}\n"]}
package/build/index.js CHANGED
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const commander_1 = __importDefault(require("commander"));
7
7
  const ReactImportsPatcher_1 = require("./ReactImportsPatcher");
8
8
  const autolinking_1 = require("./autolinking");
9
- const extraDependencies_1 = require("./autolinking/extraDependencies");
10
9
  /**
11
10
  * Registers a command that only searches for available expo modules.
12
11
  */
@@ -63,7 +62,7 @@ module.exports = async function (args) {
63
62
  // Searches for available expo modules and resolves the results for given platform.
64
63
  registerResolveCommand('resolve', async (results, options) => {
65
64
  const modules = await (0, autolinking_1.resolveModulesAsync)(results, options);
66
- const extraDependencies = await (0, extraDependencies_1.resolveExtraDependenciesAsync)(options.projectRoot);
65
+ const extraDependencies = await (0, autolinking_1.resolveExtraBuildDependenciesAsync)(options);
67
66
  if (options.json) {
68
67
  console.log(JSON.stringify({ extraDependencies, modules }));
69
68
  }
@@ -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;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,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAC1C;SACA,MAAM,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CAAmB,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(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AAE;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 resolveExtraBuildDependenciesAsync,\n resolveModulesAsync,\n verifySearchResults,\n generatePackageListAsync,\n mergeLinkingOptionsAsync,\n} from './autolinking';\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 resolveExtraBuildDependenciesAsync(options);\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"]}
@@ -1,9 +1,10 @@
1
- import { ModuleDescriptorAndroid, PackageRevision } from '../types';
1
+ import type { ExtraDependencies, ModuleDescriptorAndroid, PackageRevision } from '../types';
2
2
  /**
3
3
  * Generates Java file that contains all autolinked packages.
4
4
  */
5
5
  export declare function generatePackageListAsync(modules: ModuleDescriptorAndroid[], targetPath: string, namespace: string): Promise<void>;
6
6
  export declare function resolveModuleAsync(packageName: string, revision: PackageRevision): Promise<ModuleDescriptorAndroid | null>;
7
+ export declare function resolveExtraBuildDependenciesAsync(projectNativeRoot: string): Promise<ExtraDependencies | null>;
7
8
  /**
8
9
  * Converts the package name and gradle file path to Android's project name.
9
10
  * `$` to indicate subprojects
@@ -16,3 +17,12 @@ export declare function resolveModuleAsync(packageName: string, revision: Packag
16
17
  * - `expo-test` + `subproject/build.gradle` → `react-native-third-party$subproject`
17
18
  */
18
19
  export declare function convertPackageNameToProjectName(packageName: string, buildGradleFile: string): string;
20
+ /**
21
+ * Given the contents of a `gradle.properties` file,
22
+ * searches for a property with the given name.
23
+ *
24
+ * This function will return the first property found with the given name.
25
+ * The implementation follows config-plugins and
26
+ * tries to align the behavior with the `withGradleProperties` plugin.
27
+ */
28
+ export declare function searchGradlePropertyFirst(contents: string, propertyName: string): string | null;