@expo/config-plugins 4.0.3 → 4.0.8

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 (109) hide show
  1. package/README.md +14 -0
  2. package/build/Plugin.types.js +6 -6
  3. package/build/android/AllowBackup.js +1 -1
  4. package/build/android/Colors.js +3 -3
  5. package/build/android/EasBuild.js +1 -1
  6. package/build/android/GoogleServices.js +3 -3
  7. package/build/android/IntentFilters.js +1 -1
  8. package/build/android/JsEngine.js +2 -1
  9. package/build/android/JsEngine.js.map +1 -1
  10. package/build/android/Manifest.js +10 -10
  11. package/build/android/Name.d.ts +2 -1
  12. package/build/android/Name.js +7 -4
  13. package/build/android/Name.js.map +1 -1
  14. package/build/android/Orientation.js +2 -1
  15. package/build/android/Orientation.js.map +1 -1
  16. package/build/android/Package.js +4 -4
  17. package/build/android/Package.js.map +1 -1
  18. package/build/android/Paths.js +9 -9
  19. package/build/android/Permissions.js +6 -6
  20. package/build/android/Resources.js +5 -5
  21. package/build/android/Scheme.js +3 -3
  22. package/build/android/StatusBar.js +3 -3
  23. package/build/android/Strings.js +1 -1
  24. package/build/android/Styles.js +5 -5
  25. package/build/android/Updates.d.ts +0 -5
  26. package/build/android/Updates.js +14 -23
  27. package/build/android/Updates.js.map +1 -1
  28. package/build/android/Version.js +2 -2
  29. package/build/android/WindowSoftInputMode.js +1 -1
  30. package/build/android/codeMod.js +2 -2
  31. package/build/android/index.d.ts +1 -4
  32. package/build/android/index.js +1 -52
  33. package/build/android/index.js.map +1 -1
  34. package/build/index.js +54 -53
  35. package/build/index.js.map +1 -1
  36. package/build/ios/Bitcode.d.ts +33 -0
  37. package/build/ios/Bitcode.js +131 -0
  38. package/build/ios/Bitcode.js.map +1 -0
  39. package/build/ios/BuildScheme.js +2 -2
  40. package/build/ios/BundleIdentifier.js +3 -3
  41. package/build/ios/DeviceFamily.js +3 -3
  42. package/build/ios/Entitlements.js +2 -2
  43. package/build/ios/Entitlements.js.map +1 -1
  44. package/build/ios/Google.js +2 -2
  45. package/build/ios/JsEngine.js +2 -1
  46. package/build/ios/JsEngine.js.map +1 -1
  47. package/build/ios/Locales.js +1 -1
  48. package/build/ios/Maps.js +32 -18
  49. package/build/ios/Maps.js.map +1 -1
  50. package/build/ios/Orientation.js +2 -1
  51. package/build/ios/Orientation.js.map +1 -1
  52. package/build/ios/Paths.js +14 -14
  53. package/build/ios/Paths.js.map +1 -1
  54. package/build/ios/Permissions.js +1 -1
  55. package/build/ios/Permissions.js.map +1 -1
  56. package/build/ios/Scheme.js +4 -4
  57. package/build/ios/Swift.js +2 -2
  58. package/build/ios/Target.js +5 -5
  59. package/build/ios/Updates.d.ts +0 -5
  60. package/build/ios/Updates.js +14 -23
  61. package/build/ios/Updates.js.map +1 -1
  62. package/build/ios/Version.js +3 -3
  63. package/build/ios/codeMod.js +2 -2
  64. package/build/ios/index.d.ts +2 -3
  65. package/build/ios/index.js +20 -35
  66. package/build/ios/index.js.map +1 -1
  67. package/build/ios/utils/Xcodeproj.js +9 -9
  68. package/build/plugins/android-plugins.js +1 -1
  69. package/build/plugins/createBaseMod.js +2 -2
  70. package/build/plugins/createBaseMod.js.map +1 -1
  71. package/build/plugins/ios-plugins.js +2 -2
  72. package/build/plugins/mod-compiler.js +3 -3
  73. package/build/plugins/mod-compiler.js.map +1 -1
  74. package/build/plugins/withAndroidBaseMods.js +1 -1
  75. package/build/plugins/withIosBaseMods.js +1 -1
  76. package/build/plugins/withStaticPlugin.js +16 -5
  77. package/build/plugins/withStaticPlugin.js.map +1 -1
  78. package/build/utils/Updates.d.ts +1 -0
  79. package/build/utils/Updates.js +24 -1
  80. package/build/utils/Updates.js.map +1 -1
  81. package/build/utils/XML.d.ts +6 -0
  82. package/build/utils/XML.js +57 -10
  83. package/build/utils/XML.js.map +1 -1
  84. package/build/utils/errors.js +1 -1
  85. package/build/utils/generateCode.js +2 -2
  86. package/build/utils/history.js +1 -1
  87. package/build/utils/modules.js +1 -1
  88. package/build/utils/plugin-resolver.js +4 -4
  89. package/build/utils/sortObject.js +2 -2
  90. package/build/utils/warnings.js +1 -1
  91. package/package.json +4 -4
  92. package/build/android/NavigationBar.d.ts +0 -9
  93. package/build/android/NavigationBar.js +0 -141
  94. package/build/android/NavigationBar.js.map +0 -1
  95. package/build/android/RootViewBackgroundColor.d.ts +0 -6
  96. package/build/android/RootViewBackgroundColor.js +0 -81
  97. package/build/android/RootViewBackgroundColor.js.map +0 -1
  98. package/build/android/UserInterfaceStyle.d.ts +0 -10
  99. package/build/android/UserInterfaceStyle.js +0 -119
  100. package/build/android/UserInterfaceStyle.js.map +0 -1
  101. package/build/ios/RootViewBackgroundColor.d.ts +0 -6
  102. package/build/ios/RootViewBackgroundColor.js +0 -70
  103. package/build/ios/RootViewBackgroundColor.js.map +0 -1
  104. package/build/ios/UserInterfaceStyle.d.ts +0 -5
  105. package/build/ios/UserInterfaceStyle.js +0 -59
  106. package/build/ios/UserInterfaceStyle.js.map +0 -1
  107. package/build/utils/resolvePackageRootFolder.d.ts +0 -1
  108. package/build/utils/resolvePackageRootFolder.js +0 -57
  109. package/build/utils/resolvePackageRootFolder.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ios/Bitcode.ts"],"names":["withBitcode","config","modResults","setBitcodeWithConfig","project","withCustomBitcode","bitcode","setBitcode","getBitcode","ios","isDefaultBehavior","targetName","undefined","isBitcodeEnabled","configs","Object","entries","pbxXCBuildConfigurationSection","filter","isNotComment","hasConfiguration","find","configuration","name","addBuildProperty","names","Set","map","sort","join"],"mappings":";;;;;;;;;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AACA;AACA;AACA;AACO,MAAMA,WAAyB,GAAGC,MAAM,IAAI;AACjD,SAAO,oCAAiBA,MAAjB,EAAyB,MAAMA,MAAN,IAAgB;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,MAAM,CAACC,OAAP,CAAeZ,OAAO,CAACa,8BAAR,EAAf,EAAyDC,MAAzD,CAAgEC,yBAAhE,CAAhB;AACA,UAAMC,gBAAgB,GAAGN,OAAO,CAACO,IAAR,CAAa,CAAC,GAAGC,aAAH,CAAD,KAAuBA,aAAa,CAACC,IAAd,KAAuBZ,UAA3D,CAAzB;;AACA,QAAIS,gBAAJ,EAAsB;AACpB;AACAhB,MAAAA,OAAO,CAACoB,gBAAR,CAAyB,gBAAzB,EAA2C,IAA3C;AACD,KAHD,MAGO;AACL,YAAMC,KAAK,GAAG,CACZ;AACA,SAAG,IAAIC,GAAJ,CAAQZ,OAAO,CAACa,GAAR,CAAY,CAAC,GAAGL,aAAH,CAAD,KAAwB,IAAGA,aAAa,CAACC,IAAK,GAA1D,CAAR,CAFS,EAGZK,IAHY,EAAd;AAIA,qCACE,aADF,EAEG,2BAA0BjB,UAAW,uBAAsBc,KAAK,CAACI,IAAN,CAAW,IAAX,CAAiB,GAF/E;AAID;AACF;;AAEDzB,EAAAA,OAAO,CAACoB,gBAAR,CAAyB,gBAAzB,EAA2CX,gBAAgB,GAAG,KAAH,GAAW,IAAtE,EAA4EF,UAA5E;AAEA,SAAOP,OAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\nimport { addWarningIOS } from '../utils/warnings';\nimport { isNotComment } from './utils/Xcodeproj';\n\ntype Bitcode = NonNullable<ExpoConfig['ios']>['bitcode'];\n\n/**\n * Plugin to set a bitcode preference for the Xcode project\n * based on the project's Expo config `ios.bitcode` value.\n */\nexport const withBitcode: ConfigPlugin = config => {\n return withXcodeProject(config, async config => {\n config.modResults = await setBitcodeWithConfig(config, {\n project: config.modResults,\n });\n return config;\n });\n};\n\n/**\n * Plugin to set a custom bitcode preference for the Xcode project.\n * Does not read from the Expo config `ios.bitcode`.\n *\n * @param bitcode custom bitcode setting.\n */\nexport const withCustomBitcode: ConfigPlugin<Bitcode> = (config, bitcode) => {\n return withXcodeProject(config, async config => {\n config.modResults = await setBitcode(bitcode, {\n project: config.modResults,\n });\n return config;\n });\n};\n\n/**\n * Get the bitcode preference from the Expo config.\n */\nexport function getBitcode(config: Pick<ExpoConfig, 'ios'>): Bitcode {\n return config.ios?.bitcode;\n}\n\n/**\n * Enable or disable the `ENABLE_BITCODE` property of the project configurations.\n */\nexport function setBitcodeWithConfig(\n config: Pick<ExpoConfig, 'ios'>,\n { project }: { project: XcodeProject }\n): XcodeProject {\n const bitcode = getBitcode(config);\n return setBitcode(bitcode, { project });\n}\n\n/**\n * Enable or disable the `ENABLE_BITCODE` property.\n */\nexport function setBitcode(bitcode: Bitcode, { project }: { project: XcodeProject }): XcodeProject {\n const isDefaultBehavior = bitcode == null;\n // If the value is undefined, then do nothing.\n if (isDefaultBehavior) {\n return project;\n }\n\n const targetName = typeof bitcode === 'string' ? bitcode : undefined;\n const isBitcodeEnabled = !!bitcode;\n if (targetName) {\n // Assert if missing\n const configs = Object.entries(project.pbxXCBuildConfigurationSection()).filter(isNotComment);\n const hasConfiguration = configs.find(([, configuration]) => configuration.name === targetName);\n if (hasConfiguration) {\n // If targetName is defined then disable bitcode everywhere.\n project.addBuildProperty('ENABLE_BITCODE', 'NO');\n } else {\n const names = [\n // Remove duplicates, wrap in double quotes, and sort alphabetically.\n ...new Set(configs.map(([, configuration]) => `\"${configuration.name}\"`)),\n ].sort();\n addWarningIOS(\n 'ios.bitcode',\n `No configuration named \"${targetName}\". Expected one of: ${names.join(', ')}.`\n );\n }\n }\n\n project.addBuildProperty('ENABLE_BITCODE', isBitcodeEnabled ? 'YES' : 'NO', targetName);\n\n return project;\n}\n"],"file":"Bitcode.js"}
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSchemesFromXcodeproj = getSchemesFromXcodeproj;
7
- exports.getRunnableSchemesFromXcodeproj = getRunnableSchemesFromXcodeproj;
8
6
  exports.getApplicationTargetNameForSchemeAsync = getApplicationTargetNameForSchemeAsync;
9
7
  exports.getArchiveBuildConfigurationForSchemeAsync = getArchiveBuildConfigurationForSchemeAsync;
8
+ exports.getRunnableSchemesFromXcodeproj = getRunnableSchemesFromXcodeproj;
9
+ exports.getSchemesFromXcodeproj = getSchemesFromXcodeproj;
10
10
 
11
11
  function _XML() {
12
12
  const data = require("../utils/XML");
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getBundleIdentifier = getBundleIdentifier;
7
- exports.setBundleIdentifier = setBundleIdentifier;
8
7
  exports.getBundleIdentifierFromPbxproj = getBundleIdentifierFromPbxproj;
9
- exports.updateBundleIdentifierForPbxproj = updateBundleIdentifierForPbxproj;
10
- exports.setBundleIdentifierForPbxproj = setBundleIdentifierForPbxproj;
11
8
  exports.resetAllPlistBundleIdentifiers = resetAllPlistBundleIdentifiers;
12
9
  exports.resetPlistBundleIdentifier = resetPlistBundleIdentifier;
10
+ exports.setBundleIdentifier = setBundleIdentifier;
11
+ exports.setBundleIdentifierForPbxproj = setBundleIdentifierForPbxproj;
12
+ exports.updateBundleIdentifierForPbxproj = updateBundleIdentifierForPbxproj;
13
13
  exports.withBundleIdentifier = void 0;
14
14
 
15
15
  function _plist() {
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSupportsTablet = getSupportsTablet;
7
- exports.getIsTabletOnly = getIsTabletOnly;
8
- exports.getDeviceFamilies = getDeviceFamilies;
9
6
  exports.formatDeviceFamilies = formatDeviceFamilies;
7
+ exports.getDeviceFamilies = getDeviceFamilies;
8
+ exports.getIsTabletOnly = getIsTabletOnly;
9
+ exports.getSupportsTablet = getSupportsTablet;
10
10
  exports.setDeviceFamily = setDeviceFamily;
11
11
  exports.withDeviceFamily = void 0;
12
12
 
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setAssociatedDomains = setAssociatedDomains;
7
6
  exports.getEntitlementsPath = getEntitlementsPath;
7
+ exports.setAssociatedDomains = setAssociatedDomains;
8
8
  exports.withAssociatedDomains = void 0;
9
9
 
10
10
  function _fsExtra() {
@@ -137,7 +137,7 @@ function getEntitlementsPath(projectRoot) {
137
137
  buildSettings
138
138
  }
139
139
  }) => {
140
- buildSettings.CODE_SIGN_ENTITLEMENTS = entitlementsRelativePath;
140
+ buildSettings.CODE_SIGN_ENTITLEMENTS = `"${entitlementsRelativePath}"`;
141
141
  });
142
142
 
143
143
  _fsExtra().default.writeFileSync(project.filepath, project.writeSync());
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Entitlements.ts"],"names":["withAssociatedDomains","setAssociatedDomains","config","_","entitlementsPlist","ios","associatedDomains","getEntitlementsPath","projectRoot","paths","Paths","getAllEntitlementsPaths","targetPath","project","projectName","productName","entitlementsRelativePath","path","join","entitlementsPath","normalize","pathsToDelete","length","last","pop","push","template","ENTITLEMENTS_TEMPLATE","fs","readFileSync","ensureDirSync","dirname","writeFileSync","Object","entries","pbxXCBuildConfigurationSection","filter","isNotComment","isBuildConfig","isNotTestHost","forEach","buildSettings","CODE_SIGN_ENTITLEMENTS","filepath","writeSync","deleteEntitlementsFiles","entitlementsPaths","removeSync"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AASO,MAAMA,qBAAqB,GAAG,4CACnCC,oBADmC,EAEnC,uBAFmC,CAA9B;;;AAKA,S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ACA,QAAIO,QAAQ,GAAGC,qBAAf,CAJe,CAMf;;AACA,QAAIN,aAAa,CAACC,MAAlB,EAA0B;AACxB;AACA,YAAMC,IAAI,GAAGF,aAAa,CAACA,aAAa,CAACC,MAAd,GAAuB,CAAxB,CAA1B;AACAI,MAAAA,QAAQ,GAAGE,mBAAGC,YAAH,CAAgBN,IAAhB,EAAsB,MAAtB,CAAX;AACD;;AAEDK,uBAAGE,aAAH,CAAiBb,gBAAKc,OAAL,CAAaZ,gBAAb,CAAjB;;AACAS,uBAAGI,aAAH,CAAiBb,gBAAjB,EAAmCO,QAAnC;;AAEAO,IAAAA,MAAM,CAACC,OAAP,CAAerB,OAAO,CAACsB,8BAAR,EAAf,EACGC,MADH,CACUC,yBADV,EAEGD,MAFH,CAEUE,0BAFV,EAGGF,MAHH,CAGUG,0BAHV,EAIGC,OAJH,CAIW,CAAC;AAAE,SAAG;AAAEC,QAAAA;AAAF;AAAL,KAAD,KAAmC;AAC1CA,MAAAA,aAAa,CAACC,sBAAd,GAAuC1B,wBAAvC;AACD,KANH;;AAOAY,uBAAGI,aAAH,CAAiBnB,OAAO,CAAC8B,QAAzB,EAAmC9B,OAAO,CAAC+B,SAAR,EAAnC;AACD,GArD8D,CAuD/D;;;AACAC,EAAAA,uBAAuB,CAACxB,aAAD,CAAvB;AAEA,SAAOF,gBAAP;AACD;;AAED,SAAS0B,uBAAT,CAAiCC,iBAAjC,EAA8D;AAC5D,OAAK,MAAM7B,IAAX,IAAmB6B,iBAAnB,EAAsC;AACpClB,uBAAGmB,UAAH,CAAc9B,IAAd;AACD;AACF;;AAED,MAAMU,qBAAqB,GAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,CAPA","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport slash from 'slash';\n\nimport { createEntitlementsPlugin } from '../plugins/ios-plugins';\nimport * as Paths from './Paths';\nimport {\n getPbxproj,\n getProductName,\n getProjectName,\n isBuildConfig,\n isNotComment,\n isNotTestHost,\n} from './utils/Xcodeproj';\n\nexport const withAssociatedDomains = createEntitlementsPlugin(\n setAssociatedDomains,\n 'withAssociatedDomains'\n);\n\nexport function setAssociatedDomains(\n config: ExpoConfig,\n { 'com.apple.developer.associated-domains': _, ...entitlementsPlist }: JSONObject\n): JSONObject {\n if (config.ios?.associatedDomains) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.associated-domains': config.ios.associatedDomains,\n };\n }\n\n return entitlementsPlist;\n}\n\nexport function getEntitlementsPath(projectRoot: string): string {\n const paths = Paths.getAllEntitlementsPaths(projectRoot);\n let targetPath: string | null = null;\n\n /**\n * Add file to pbxproj under CODE_SIGN_ENTITLEMENTS\n */\n const project = getPbxproj(projectRoot);\n const projectName = getProjectName(projectRoot);\n const productName = getProductName(project);\n\n // Use posix formatted path, even on Windows\n const entitlementsRelativePath = slash(path.join(projectName, `${productName}.entitlements`));\n const entitlementsPath = slash(\n path.normalize(path.join(projectRoot, 'ios', entitlementsRelativePath))\n );\n\n const pathsToDelete: string[] = [];\n\n while (paths.length) {\n const last = slash(path.normalize(paths.pop()!));\n if (last !== entitlementsPath) {\n pathsToDelete.push(last);\n } else {\n targetPath = last;\n }\n }\n\n // Create a new entitlements file\n if (!targetPath) {\n targetPath = entitlementsPath;\n\n // Use the default template\n let template = ENTITLEMENTS_TEMPLATE;\n\n // If an old entitlements file exists, copy it's contents into the new file.\n if (pathsToDelete.length) {\n // Get the last entitlements file and use it as the template\n const last = pathsToDelete[pathsToDelete.length - 1]!;\n template = fs.readFileSync(last, 'utf8');\n }\n\n fs.ensureDirSync(path.dirname(entitlementsPath));\n fs.writeFileSync(entitlementsPath, template);\n\n Object.entries(project.pbxXCBuildConfigurationSection())\n .filter(isNotComment)\n .filter(isBuildConfig)\n .filter(isNotTestHost)\n .forEach(({ 1: { buildSettings } }: any) => {\n buildSettings.CODE_SIGN_ENTITLEMENTS = entitlementsRelativePath;\n });\n fs.writeFileSync(project.filepath, project.writeSync());\n }\n\n // Clean up others\n deleteEntitlementsFiles(pathsToDelete);\n\n return entitlementsPath;\n}\n\nfunction deleteEntitlementsFiles(entitlementsPaths: string[]) {\n for (const path of entitlementsPaths) {\n fs.removeSync(path);\n }\n}\n\nconst ENTITLEMENTS_TEMPLATE = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n</dict>\n</plist>\n`;\n"],"file":"Entitlements.js"}
1
+ {"version":3,"sources":["../../src/ios/Entitlements.ts"],"names":["withAssociatedDomains","setAssociatedDomains","config","_","entitlementsPlist","ios","associatedDomains","getEntitlementsPath","projectRoot","paths","Paths","getAllEntitlementsPaths","targetPath","project","projectName","productName","entitlementsRelativePath","path","join","entitlementsPath","normalize","pathsToDelete","length","last","pop","push","template","ENTITLEMENTS_TEMPLATE","fs","readFileSync","ensureDirSync","dirname","writeFileSync","Object","entries","pbxXCBuildConfigurationSection","filter","isNotComment","isBuildConfig","isNotTestHost","forEach","buildSettings","CODE_SIGN_ENTITLEMENTS","filepath","writeSync","deleteEntitlementsFiles","entitlementsPaths","removeSync"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AASO,MAAMA,qBAAqB,GAAG,4CACnCC,oBADmC,EAEnC,uBAFmC,CAA9B;;;AAKA,SAASA,oBAAT,CACLC,MADK,EAEL;AAAE,4CAA0CC,CAA5C;AAA+C,KA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a,CAACC,MAAlB,EAA0B;AACxB;AACA,YAAMC,IAAI,GAAGF,aAAa,CAACA,aAAa,CAACC,MAAd,GAAuB,CAAxB,CAA1B;AACAI,MAAAA,QAAQ,GAAGE,mBAAGC,YAAH,CAAgBN,IAAhB,EAAsB,MAAtB,CAAX;AACD;;AAEDK,uBAAGE,aAAH,CAAiBb,gBAAKc,OAAL,CAAaZ,gBAAb,CAAjB;;AACAS,uBAAGI,aAAH,CAAiBb,gBAAjB,EAAmCO,QAAnC;;AAEAO,IAAAA,MAAM,CAACC,OAAP,CAAerB,OAAO,CAACsB,8BAAR,EAAf,EACGC,MADH,CACUC,yBADV,EAEGD,MAFH,CAEUE,0BAFV,EAGGF,MAHH,CAGUG,0BAHV,EAIGC,OAJH,CAIW,CAAC;AAAE,SAAG;AAAEC,QAAAA;AAAF;AAAL,KAAD,KAAmC;AAC1CA,MAAAA,aAAa,CAACC,sBAAd,GAAwC,IAAG1B,wBAAyB,GAApE;AACD,KANH;;AAOAY,uBAAGI,aAAH,CAAiBnB,OAAO,CAAC8B,QAAzB,EAAmC9B,OAAO,CAAC+B,SAAR,EAAnC;AACD,GArD8D,CAuD/D;;;AACAC,EAAAA,uBAAuB,CAACxB,aAAD,CAAvB;AAEA,SAAOF,gBAAP;AACD;;AAED,SAAS0B,uBAAT,CAAiCC,iBAAjC,EAA8D;AAC5D,OAAK,MAAM7B,IAAX,IAAmB6B,iBAAnB,EAAsC;AACpClB,uBAAGmB,UAAH,CAAc9B,IAAd;AACD;AACF;;AAED,MAAMU,qBAAqB,GAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,CAPA","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport slash from 'slash';\n\nimport { createEntitlementsPlugin } from '../plugins/ios-plugins';\nimport * as Paths from './Paths';\nimport {\n getPbxproj,\n getProductName,\n getProjectName,\n isBuildConfig,\n isNotComment,\n isNotTestHost,\n} from './utils/Xcodeproj';\n\nexport const withAssociatedDomains = createEntitlementsPlugin(\n setAssociatedDomains,\n 'withAssociatedDomains'\n);\n\nexport function setAssociatedDomains(\n config: ExpoConfig,\n { 'com.apple.developer.associated-domains': _, ...entitlementsPlist }: JSONObject\n): JSONObject {\n if (config.ios?.associatedDomains) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.associated-domains': config.ios.associatedDomains,\n };\n }\n\n return entitlementsPlist;\n}\n\nexport function getEntitlementsPath(projectRoot: string): string {\n const paths = Paths.getAllEntitlementsPaths(projectRoot);\n let targetPath: string | null = null;\n\n /**\n * Add file to pbxproj under CODE_SIGN_ENTITLEMENTS\n */\n const project = getPbxproj(projectRoot);\n const projectName = getProjectName(projectRoot);\n const productName = getProductName(project);\n\n // Use posix formatted path, even on Windows\n const entitlementsRelativePath = slash(path.join(projectName, `${productName}.entitlements`));\n const entitlementsPath = slash(\n path.normalize(path.join(projectRoot, 'ios', entitlementsRelativePath))\n );\n\n const pathsToDelete: string[] = [];\n\n while (paths.length) {\n const last = slash(path.normalize(paths.pop()!));\n if (last !== entitlementsPath) {\n pathsToDelete.push(last);\n } else {\n targetPath = last;\n }\n }\n\n // Create a new entitlements file\n if (!targetPath) {\n targetPath = entitlementsPath;\n\n // Use the default template\n let template = ENTITLEMENTS_TEMPLATE;\n\n // If an old entitlements file exists, copy it's contents into the new file.\n if (pathsToDelete.length) {\n // Get the last entitlements file and use it as the template\n const last = pathsToDelete[pathsToDelete.length - 1]!;\n template = fs.readFileSync(last, 'utf8');\n }\n\n fs.ensureDirSync(path.dirname(entitlementsPath));\n fs.writeFileSync(entitlementsPath, template);\n\n Object.entries(project.pbxXCBuildConfigurationSection())\n .filter(isNotComment)\n .filter(isBuildConfig)\n .filter(isNotTestHost)\n .forEach(({ 1: { buildSettings } }: any) => {\n buildSettings.CODE_SIGN_ENTITLEMENTS = `\"${entitlementsRelativePath}\"`;\n });\n fs.writeFileSync(project.filepath, project.writeSync());\n }\n\n // Clean up others\n deleteEntitlementsFiles(pathsToDelete);\n\n return entitlementsPath;\n}\n\nfunction deleteEntitlementsFiles(entitlementsPaths: string[]) {\n for (const path of entitlementsPaths) {\n fs.removeSync(path);\n }\n}\n\nconst ENTITLEMENTS_TEMPLATE = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n</dict>\n</plist>\n`;\n"],"file":"Entitlements.js"}
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getGoogleSignInReservedClientId = getGoogleSignInReservedClientId;
7
6
  exports.getGoogleServicesFile = getGoogleServicesFile;
8
- exports.setGoogleSignInReservedClientId = setGoogleSignInReservedClientId;
7
+ exports.getGoogleSignInReservedClientId = getGoogleSignInReservedClientId;
9
8
  exports.setGoogleConfig = setGoogleConfig;
10
9
  exports.setGoogleServicesFile = setGoogleServicesFile;
10
+ exports.setGoogleSignInReservedClientId = setGoogleSignInReservedClientId;
11
11
  exports.withGoogleServicesFile = exports.withGoogle = void 0;
12
12
 
13
13
  function _fsExtra() {
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.JS_ENGINE_PROP_KEY = exports.DEFAULT_JS_ENGINE = void 0;
6
7
  exports.getJsEngine = getJsEngine;
7
8
  exports.setJsEngine = setJsEngine;
8
- exports.withJsEnginePodfileProps = exports.DEFAULT_JS_ENGINE = exports.JS_ENGINE_PROP_KEY = void 0;
9
+ exports.withJsEnginePodfileProps = void 0;
9
10
 
10
11
  function _iosPlugins() {
11
12
  const data = require("../plugins/ios-plugins");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/JsEngine.ts"],"names":["JS_ENGINE_PROP_KEY","DEFAULT_JS_ENGINE","withJsEnginePodfileProps","config","modResults","setJsEngine","getJsEngine","ios","jsEngine","podfileProperties"],"mappings":";;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,kBAAkB,GAAG,eAA3B;;AACA,MAAMC,iBAAiB,GAAG,KAA1B;;;AAEA,MAAMC,wBAAsC,GAAGC,MAAM,IAAI;AAC9D,SAAO,yCAAsBA,MAAtB,EAA8BA,MAAM,IAAI;AAC7CA,IAAAA,MAAM,CAACC,UAAP,GAAoBC,WAAW,CAACF,MAAD,EAASA,MAAM,CAACC,UAAhB,CAA/B;AACA,WAAOD,MAAP;AACD,GAHM,CAAP;AAID,CALM;;;;AAOA,SAASG,WAAT,CAAqBH,MAArB,EAAmE;AAAA;;AACxE,wDAAOA,MAAM,CAACI,GAAd,gDAAO,YAAYC,QAAnB,uEAA+BL,MAAM,CAACK,QAAtC,uCAAkDP,iBAAlD;AACD;;AAEM,SAASI,WAAT,CACLF,MADK,EAELM,iBAFK,EAGmB;AAAA;;AACxBA,EAAAA,iBAAiB,CAACT,kBAAD,CAAjB,qDACEG,MAAM,CAACI,GADT,iDACE,aAAYC,QADd,yEAC0BL,MAAM,CAACK,QADjC,yCAC6CP,iBAD7C;AAEA,SAAOQ,iBAAP;AACD","sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withPodfileProperties } from '../plugins/ios-plugins';\n\nexport const JS_ENGINE_PROP_KEY = 'expo.jsEngine';\nexport const DEFAULT_JS_ENGINE = 'jsc';\n\nexport const withJsEnginePodfileProps: ConfigPlugin = config => {\n return withPodfileProperties(config, config => {\n config.modResults = setJsEngine(config, config.modResults);\n return config;\n });\n};\n\nexport function getJsEngine(config: Pick<ExpoConfig, 'ios' | 'jsEngine'>) {\n return config.ios?.jsEngine ?? config.jsEngine ?? DEFAULT_JS_ENGINE;\n}\n\nexport function setJsEngine(\n config: Pick<ExpoConfig, 'ios' | 'jsEngine'>,\n podfileProperties: Record<string, string>\n): Record<string, string> {\n podfileProperties[JS_ENGINE_PROP_KEY] =\n config.ios?.jsEngine ?? config.jsEngine ?? DEFAULT_JS_ENGINE;\n return podfileProperties;\n}\n"],"file":"JsEngine.js"}
1
+ {"version":3,"sources":["../../src/ios/JsEngine.ts"],"names":["JS_ENGINE_PROP_KEY","DEFAULT_JS_ENGINE","withJsEnginePodfileProps","config","modResults","setJsEngine","getJsEngine","ios","jsEngine","podfileProperties"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,kBAAkB,GAAG,eAA3B;;AACA,MAAMC,iBAAiB,GAAG,KAA1B;;;AAEA,MAAMC,wBAAsC,GAAGC,MAAM,IAAI;AAC9D,SAAO,yCAAsBA,MAAtB,EAA8BA,MAAM,IAAI;AAC7CA,IAAAA,MAAM,CAACC,UAAP,GAAoBC,WAAW,CAACF,MAAD,EAASA,MAAM,CAACC,UAAhB,CAA/B;AACA,WAAOD,MAAP;AACD,GAHM,CAAP;AAID,CALM;;;;AAOA,SAASG,WAAT,CAAqBH,MAArB,EAAmE;AAAA;;AACxE,wDAAOA,MAAM,CAACI,GAAd,gDAAO,YAAYC,QAAnB,uEAA+BL,MAAM,CAACK,QAAtC,uCAAkDP,iBAAlD;AACD;;AAEM,SAASI,WAAT,CACLF,MADK,EAELM,iBAFK,EAGmB;AAAA;;AACxBA,EAAAA,iBAAiB,CAACT,kBAAD,CAAjB,qDACEG,MAAM,CAACI,GADT,iDACE,aAAYC,QADd,yEAC0BL,MAAM,CAACK,QADjC,yCAC6CP,iBAD7C;AAEA,SAAOQ,iBAAP;AACD","sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withPodfileProperties } from '../plugins/ios-plugins';\n\nexport const JS_ENGINE_PROP_KEY = 'expo.jsEngine';\nexport const DEFAULT_JS_ENGINE = 'jsc';\n\nexport const withJsEnginePodfileProps: ConfigPlugin = config => {\n return withPodfileProperties(config, config => {\n config.modResults = setJsEngine(config, config.modResults);\n return config;\n });\n};\n\nexport function getJsEngine(config: Pick<ExpoConfig, 'ios' | 'jsEngine'>) {\n return config.ios?.jsEngine ?? config.jsEngine ?? DEFAULT_JS_ENGINE;\n}\n\nexport function setJsEngine(\n config: Pick<ExpoConfig, 'ios' | 'jsEngine'>,\n podfileProperties: Record<string, string>\n): Record<string, string> {\n podfileProperties[JS_ENGINE_PROP_KEY] =\n config.ios?.jsEngine ?? config.jsEngine ?? DEFAULT_JS_ENGINE;\n return podfileProperties;\n}\n"],"file":"JsEngine.js"}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLocales = getLocales;
7
- exports.setLocalesAsync = setLocalesAsync;
8
7
  exports.getResolvedLocalesAsync = getResolvedLocalesAsync;
8
+ exports.setLocalesAsync = setLocalesAsync;
9
9
  exports.withLocales = void 0;
10
10
 
11
11
  function _jsonFile() {
package/build/ios/Maps.js CHANGED
@@ -3,15 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getGoogleMapsApiKey = getGoogleMapsApiKey;
7
- exports.setGoogleMapsApiKey = setGoogleMapsApiKey;
6
+ exports.MATCH_INIT = void 0;
8
7
  exports.addGoogleMapsAppDelegateImport = addGoogleMapsAppDelegateImport;
9
- exports.removeGoogleMapsAppDelegateImport = removeGoogleMapsAppDelegateImport;
10
8
  exports.addGoogleMapsAppDelegateInit = addGoogleMapsAppDelegateInit;
11
- exports.removeGoogleMapsAppDelegateInit = removeGoogleMapsAppDelegateInit;
12
9
  exports.addMapsCocoaPods = addMapsCocoaPods;
10
+ exports.getGoogleMapsApiKey = getGoogleMapsApiKey;
11
+ exports.removeGoogleMapsAppDelegateImport = removeGoogleMapsAppDelegateImport;
12
+ exports.removeGoogleMapsAppDelegateInit = removeGoogleMapsAppDelegateInit;
13
13
  exports.removeMapsCocoaPods = removeMapsCocoaPods;
14
- exports.withMaps = exports.MATCH_INIT = void 0;
14
+ exports.setGoogleMapsApiKey = setGoogleMapsApiKey;
15
+ exports.withMaps = void 0;
15
16
 
16
17
  function _fsExtra() {
17
18
  const data = _interopRequireDefault(require("fs-extra"));
@@ -33,6 +34,16 @@ function _path() {
33
34
  return data;
34
35
  }
35
36
 
37
+ function _resolveFrom() {
38
+ const data = _interopRequireDefault(require("resolve-from"));
39
+
40
+ _resolveFrom = function () {
41
+ return data;
42
+ };
43
+
44
+ return data;
45
+ }
46
+
36
47
  function _iosPlugins() {
37
48
  const data = require("../plugins/ios-plugins");
38
49
 
@@ -63,19 +74,11 @@ function _generateCode() {
63
74
  return data;
64
75
  }
65
76
 
66
- function _resolvePackageRootFolder() {
67
- const data = require("../utils/resolvePackageRootFolder");
68
-
69
- _resolvePackageRootFolder = function () {
70
- return data;
71
- };
77
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72
78
 
73
- return data;
74
- }
79
+ const debug = require('debug')('expo:config-plugins:ios:maps'); // Match against `UMModuleRegistryAdapter` (unimodules), and React Native without unimodules (Expo Modules).
75
80
 
76
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
77
81
 
78
- // Match against `UMModuleRegistryAdapter` (unimodules), and React Native without unimodules (Expo Modules).
79
82
  const MATCH_INIT = /(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[\[RCTBridge alloc\])/g;
80
83
  exports.MATCH_INIT = MATCH_INIT;
81
84
  const withGoogleMapsKey = (0, _iosPlugins().createInfoPlistPlugin)(setGoogleMapsApiKey, 'withGoogleMapsKey');
@@ -84,6 +87,7 @@ const withMaps = config => {
84
87
  config = withGoogleMapsKey(config);
85
88
  const apiKey = getGoogleMapsApiKey(config); // Technically adds react-native-maps (Apple maps) and google maps.
86
89
 
90
+ debug('Google Maps API Key:', apiKey);
87
91
  config = withMapsCocoaPods(config, {
88
92
  useGoogleMaps: !!apiKey
89
93
  }); // Adds/Removes AppDelegate setup for Google Maps API on iOS
@@ -183,7 +187,14 @@ function removeMapsCocoaPods(src) {
183
187
  }
184
188
 
185
189
  function isReactNativeMapsInstalled(projectRoot) {
186
- return (0, _resolvePackageRootFolder().resolvePackageRootFolder)(projectRoot, 'react-native-maps');
190
+ const resolved = _resolveFrom().default.silent(projectRoot, 'react-native-maps/package.json');
191
+
192
+ return resolved ? _path().default.dirname(resolved) : null;
193
+ }
194
+
195
+ function isReactNativeMapsAutolinked(config) {
196
+ // TODO: Detect autolinking
197
+ return true;
187
198
  }
188
199
 
189
200
  const withMapsCocoaPods = (config, {
@@ -197,8 +208,11 @@ const withMapsCocoaPods = (config, {
197
208
  // Generally prebuild runs after a yarn install so this should always work as expected.
198
209
 
199
210
  const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);
211
+ const isLinked = isReactNativeMapsAutolinked(config);
212
+ debug('Is Expo Autolinked:', isLinked);
213
+ debug('react-native-maps path:', googleMapsPath);
200
214
 
201
- if (googleMapsPath && useGoogleMaps) {
215
+ if (isLinked && googleMapsPath && useGoogleMaps) {
202
216
  // Make the pod path relative to the ios folder.
203
217
  const googleMapsPodPath = _path().default.relative(config.modRequest.platformProjectRoot, googleMapsPath);
204
218
 
@@ -229,7 +243,7 @@ const withGoogleMapsAppDelegate = (config, {
229
243
  }) => {
230
244
  return (0, _iosPlugins().withAppDelegate)(config, config => {
231
245
  if (config.modResults.language === 'objc') {
232
- if (apiKey && isReactNativeMapsInstalled(config.modRequest.projectRoot)) {
246
+ if (apiKey && isReactNativeMapsAutolinked(config) && isReactNativeMapsInstalled(config.modRequest.projectRoot)) {
233
247
  try {
234
248
  config.modResults.contents = addGoogleMapsAppDelegateImport(config.modResults.contents).contents;
235
249
  config.modResults.contents = addGoogleMapsAppDelegateInit(config.modResults.contents, apiKey).contents;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Maps.ts"],"names":["MATCH_INIT","withGoogleMapsKey","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","push","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","googleMapsPath","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","filePath","path","modRequest","platformProjectRoot","contents","fs","readFile","results","googleMapsPodPath","relative","error","code","Error","didMerge","didClear","writeFile","modResults","language"],"mappings":";;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA;AACO,MAAMA,UAAU,GAAG,uHAAnB;;AAEP,MAAMC,iBAAiB,GAAG,yCAAsBC,mBAAtB,EAA2C,mBAA3C,CAA1B;;AAEO,MAAMC,QAAsB,GAAGC,MAAM,IAAI;AAC9CA,EAAAA,MAAM,GAAGH,iBAAiB,CAACG,MAAD,CAA1B;AAEA,QAAMC,MAAM,GAAGC,mBAAmB,CAACF,MAAD,CAAlC,CAH8C,CAI9C;;AACAA,EAAAA,MAAM,GAAGG,iBAAiB,CAACH,MAAD,EAAS;AAAEI,IAAAA,aAAa,EAAE,CAAC,CAACH;AAAnB,GAAT,CAA1B,CAL8C,CAM9C;;AACAD,EAAAA,MAAM,GAAGK,yBAAyB,CAACL,MAAD,EAAS;AAAEC,IAAAA;AAAF,GAAT,CAAlC;AAEA,SAAOD,MAAP;AACD,CA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,CAE3BA,QAFF;AAGA/B,UAAAA,MAAM,CAAC2C,UAAP,CAAkBZ,QAAlB,GAA6BX,4BAA4B,CACvDpB,MAAM,CAAC2C,UAAP,CAAkBZ,QADqC,EAEvD9B,MAFuD,CAA5B,CAG3B8B,QAHF;AAID,SARD,CAQE,OAAOM,KAAP,EAAc;AACd,cAAIA,KAAK,CAACC,IAAN,KAAe,cAAnB,EAAmC;AACjC,kBAAM,IAAIC,KAAJ,CACH,yIADG,CAAN;AAGD;;AACD,gBAAMF,KAAN;AACD;AACF,OAjBD,MAiBO;AACLrC,QAAAA,MAAM,CAAC2C,UAAP,CAAkBZ,QAAlB,GAA6BZ,iCAAiC,CAC5DnB,MAAM,CAAC2C,UAAP,CAAkBZ,QAD0C,CAAjC,CAE3BA,QAFF;AAGA/B,QAAAA,MAAM,CAAC2C,UAAP,CAAkBZ,QAAlB,GAA6BV,+BAA+B,CAC1DrB,MAAM,CAAC2C,UAAP,CAAkBZ,QADwC,CAA/B,CAE3BA,QAFF;AAGD;AACF,KA1BD,MA0BO;AACL,YAAM,IAAIQ,KAAJ,CAAU,qEAAV,CAAN;AACD;;AACD,WAAOvC,MAAP;AACD,GA/BM,CAAP;AAgCD,CAjCD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate } from '../plugins/ios-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { mergeContents, MergeResults, removeContents } from '../utils/generateCode';\nimport { resolvePackageRootFolder } from '../utils/resolvePackageRootFolder';\n\n// Match against `UMModuleRegistryAdapter` (unimodules), and React Native without unimodules (Expo Modules).\nexport const MATCH_INIT = /(?:(self\\.|_)(\\w+)\\s?=\\s?\\[\\[UMModuleRegistryAdapter alloc\\])|(?:RCTBridge\\s?\\*\\s?(\\w+)\\s?=\\s?\\[\\[RCTBridge alloc\\])/g;\n\nconst withGoogleMapsKey = createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');\n\nexport const withMaps: ConfigPlugin = config => {\n config = withGoogleMapsKey(config);\n\n const apiKey = getGoogleMapsApiKey(config);\n // Technically adds react-native-maps (Apple maps) and google maps.\n config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });\n // Adds/Removes AppDelegate setup for Google Maps API on iOS\n config = withGoogleMapsAppDelegate(config, { apiKey });\n\n return config;\n};\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMapsApiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'ios'>,\n { GMSApiKey, ...infoPlist }: InfoPlist\n): InfoPlist {\n const apiKey = getGoogleMapsApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GMSApiKey: apiKey,\n };\n}\n\nexport function addGoogleMapsAppDelegateImport(src: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n '#import <GoogleMaps/GoogleMaps.h>',\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /#import \"AppDelegate\\.h\"/,\n offset: 1,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateImport(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-import',\n src,\n });\n}\n\nexport function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n ` [GMSServices provideAPIKey:@\"${apiKey}\"];`,\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-init',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: MATCH_INIT,\n offset: 0,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateInit(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-init',\n src,\n });\n}\n\n/**\n * @param src\n * @param useGoogleMaps\n * @param googleMapsPath '../node_modules/react-native-maps'\n * @returns\n */\nexport function addMapsCocoaPods(src: string, googleMapsPath: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: '${googleMapsPath}'`,\n anchor: /use_native_modules/,\n offset: 0,\n comment: '#',\n });\n}\n\nexport function removeMapsCocoaPods(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps',\n src,\n });\n}\n\nfunction isReactNativeMapsInstalled(projectRoot: string): string | null {\n return resolvePackageRootFolder(projectRoot, 'react-native-maps');\n}\n\nconst withMapsCocoaPods: ConfigPlugin<{ useGoogleMaps: boolean }> = (config, { useGoogleMaps }) => {\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');\n const contents = await fs.readFile(filePath, 'utf-8');\n let results: MergeResults;\n // Only add the block if react-native-maps is installed in the project (best effort).\n // Generally prebuild runs after a yarn install so this should always work as expected.\n const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);\n if (googleMapsPath && useGoogleMaps) {\n // Make the pod path relative to the ios folder.\n const googleMapsPodPath = path.relative(\n config.modRequest.platformProjectRoot,\n googleMapsPath\n );\n try {\n results = addMapsCocoaPods(contents, googleMapsPodPath);\n } catch (error) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile.`\n );\n }\n throw error;\n }\n } else {\n // If the package is no longer installed, then remove the block.\n results = removeMapsCocoaPods(contents);\n }\n if (results.didMerge || results.didClear) {\n await fs.writeFile(filePath, results.contents);\n }\n return config;\n },\n ]);\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, config => {\n if (config.modResults.language === 'objc') {\n if (apiKey && isReactNativeMapsInstalled(config.modRequest.projectRoot)) {\n try {\n config.modResults.contents = addGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = addGoogleMapsAppDelegateInit(\n config.modResults.contents,\n apiKey\n ).contents;\n } catch (error) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`\n );\n }\n throw error;\n }\n } else {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n }\n } else {\n throw new Error('Cannot setup Google Maps because the AppDelegate is not Objective C');\n }\n return config;\n });\n};\n"],"file":"Maps.js"}
1
+ {"version":3,"sources":["../../src/ios/Maps.ts"],"names":["debug","require","MATCH_INIT","withGoogleMapsKey","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","push","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","googleMapsPath","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","silent","path","dirname","isReactNativeMapsAutolinked","filePath","modRequest","platformProjectRoot","contents","fs","readFile","results","isLinked","googleMapsPodPath","relative","error","code","Error","didMerge","didClear","writeFile","modResults","language"],"mappings":";;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;A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A5B,CAG3BmC,QAHF;AAID,SARD,CAQE,OAAOO,KAAP,EAAc;AACd,cAAIA,KAAK,CAACC,IAAN,KAAe,cAAnB,EAAmC;AACjC,kBAAM,IAAIC,KAAJ,CACH,yIADG,CAAN;AAGD;;AACD,gBAAMF,KAAN;AACD;AACF,OArBD,MAqBO;AACL3C,QAAAA,MAAM,CAACiD,UAAP,CAAkBb,QAAlB,GAA6BjB,iCAAiC,CAC5DnB,MAAM,CAACiD,UAAP,CAAkBb,QAD0C,CAAjC,CAE3BA,QAFF;AAGApC,QAAAA,MAAM,CAACiD,UAAP,CAAkBb,QAAlB,GAA6Bf,+BAA+B,CAC1DrB,MAAM,CAACiD,UAAP,CAAkBb,QADwC,CAA/B,CAE3BA,QAFF;AAGD;AACF,KA9BD,MA8BO;AACL,YAAM,IAAIS,KAAJ,CAAU,qEAAV,CAAN;AACD;;AACD,WAAO7C,MAAP;AACD,GAnCM,CAAP;AAoCD,CArCD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate } from '../plugins/ios-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { mergeContents, MergeResults, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\n// Match against `UMModuleRegistryAdapter` (unimodules), and React Native without unimodules (Expo Modules).\nexport const MATCH_INIT = /(?:(self\\.|_)(\\w+)\\s?=\\s?\\[\\[UMModuleRegistryAdapter alloc\\])|(?:RCTBridge\\s?\\*\\s?(\\w+)\\s?=\\s?\\[\\[RCTBridge alloc\\])/g;\n\nconst withGoogleMapsKey = createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');\n\nexport const withMaps: ConfigPlugin = config => {\n config = withGoogleMapsKey(config);\n\n const apiKey = getGoogleMapsApiKey(config);\n // Technically adds react-native-maps (Apple maps) and google maps.\n\n debug('Google Maps API Key:', apiKey);\n config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });\n\n // Adds/Removes AppDelegate setup for Google Maps API on iOS\n config = withGoogleMapsAppDelegate(config, { apiKey });\n\n return config;\n};\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMapsApiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'ios'>,\n { GMSApiKey, ...infoPlist }: InfoPlist\n): InfoPlist {\n const apiKey = getGoogleMapsApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GMSApiKey: apiKey,\n };\n}\n\nexport function addGoogleMapsAppDelegateImport(src: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n '#import <GoogleMaps/GoogleMaps.h>',\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /#import \"AppDelegate\\.h\"/,\n offset: 1,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateImport(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-import',\n src,\n });\n}\n\nexport function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults {\n const newSrc = [];\n newSrc.push(\n '#if __has_include(<GoogleMaps/GoogleMaps.h>)',\n ` [GMSServices provideAPIKey:@\"${apiKey}\"];`,\n '#endif'\n );\n\n return mergeContents({\n tag: 'react-native-maps-init',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: MATCH_INIT,\n offset: 0,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateInit(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-init',\n src,\n });\n}\n\n/**\n * @param src\n * @param useGoogleMaps\n * @param googleMapsPath '../node_modules/react-native-maps'\n * @returns\n */\nexport function addMapsCocoaPods(src: string, googleMapsPath: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: '${googleMapsPath}'`,\n anchor: /use_native_modules/,\n offset: 0,\n comment: '#',\n });\n}\n\nexport function removeMapsCocoaPods(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps',\n src,\n });\n}\n\nfunction isReactNativeMapsInstalled(projectRoot: string): string | null {\n const resolved = resolveFrom.silent(projectRoot, 'react-native-maps/package.json');\n return resolved ? path.dirname(resolved) : null;\n}\n\nfunction isReactNativeMapsAutolinked(config: Pick<ExpoConfig, '_internal'>): boolean {\n // TODO: Detect autolinking\n return true;\n}\n\nconst withMapsCocoaPods: ConfigPlugin<{ useGoogleMaps: boolean }> = (config, { useGoogleMaps }) => {\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');\n const contents = await fs.readFile(filePath, 'utf-8');\n let results: MergeResults;\n // Only add the block if react-native-maps is installed in the project (best effort).\n // Generally prebuild runs after a yarn install so this should always work as expected.\n const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);\n const isLinked = isReactNativeMapsAutolinked(config);\n debug('Is Expo Autolinked:', isLinked);\n debug('react-native-maps path:', googleMapsPath);\n if (isLinked && googleMapsPath && useGoogleMaps) {\n // Make the pod path relative to the ios folder.\n const googleMapsPodPath = path.relative(\n config.modRequest.platformProjectRoot,\n googleMapsPath\n );\n try {\n results = addMapsCocoaPods(contents, googleMapsPodPath);\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile.`\n );\n }\n throw error;\n }\n } else {\n // If the package is no longer installed, then remove the block.\n results = removeMapsCocoaPods(contents);\n }\n if (results.didMerge || results.didClear) {\n await fs.writeFile(filePath, results.contents);\n }\n return config;\n },\n ]);\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, config => {\n if (config.modResults.language === 'objc') {\n if (\n apiKey &&\n isReactNativeMapsAutolinked(config) &&\n isReactNativeMapsInstalled(config.modRequest.projectRoot)\n ) {\n try {\n config.modResults.contents = addGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = addGoogleMapsAppDelegateInit(\n config.modResults.contents,\n apiKey\n ).contents;\n } catch (error) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`\n );\n }\n throw error;\n }\n } else {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n }\n } else {\n throw new Error('Cannot setup Google Maps because the AppDelegate is not Objective C');\n }\n return config;\n });\n};\n"],"file":"Maps.js"}
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.PORTRAIT_ORIENTATIONS = exports.LANDSCAPE_ORIENTATIONS = void 0;
6
7
  exports.getOrientation = getOrientation;
7
8
  exports.setOrientation = setOrientation;
8
- exports.LANDSCAPE_ORIENTATIONS = exports.PORTRAIT_ORIENTATIONS = exports.withOrientation = void 0;
9
+ exports.withOrientation = void 0;
9
10
 
10
11
  function _iosPlugins() {
11
12
  const data = require("../plugins/ios-plugins");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Orientation.ts"],"names":["withOrientation","setOrientation","getOrientation","config","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,eAAe,GAAG,yCAAsBC,cAAtB,EAAsC,iBAAtC,CAAxB;;;AAEA,SAASC,cAAT,CAAwBC,MAAxB,EAAiE;AAAA;;AACtE,gCAAOA,MAAM,CAACC,WAAd,qEAA6B,IAA7B;AACD;;AAEM,MAAMC,qBAA6C,GAAG,CAC3D,gCAD2D,EAE3D,0CAF2D,CAAtD;;AAKA,MAAMC,sBAA8C,GAAG,CAC5D,qCAD4D,EAE5D,sCAF4D,CAAvD;;;AAKP,SAASC,mCAAT,CAA6CH,WAA7C,EAAiG;AAC/F,MAAIA,WAAW,KAAK,UAApB,EAAgC;AAC9B,WAAOC,qBAAP;AACD,GAFD,MAEO,IAAID,WAAW,KAAK,WAApB,EAAiC;AACtC,WAAOE,sBAAP;AACD,GAFM,MAEA;AACL,WAAO,CAAC,GAAGD,qBAAJ,EAA2B,GAAGC,sBAA9B,CAAP;AACD;AACF;;AAEM,SAASL,cAAT,CACLE,MADK,EAELK,SAFK,EAGM;AACX,QAAMJ,WAAW,GAAGF,cAAc,CAACC,MAAD,CAAlC;AAEA,SAAO,EACL,GAAGK,SADE;AAELC,IAAAA,gCAAgC,EAAEF,mCAAmC,CAACH,WAAD;AAFhE,GAAP;AAID","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\n\nexport const withOrientation = createInfoPlistPlugin(setOrientation, 'withOrientation');\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"file":"Orientation.js"}
1
+ {"version":3,"sources":["../../src/ios/Orientation.ts"],"names":["withOrientation","setOrientation","getOrientation","config","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"mappings":";;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,eAAe,GAAG,yCAAsBC,cAAtB,EAAsC,iBAAtC,CAAxB;;;AAEA,SAASC,cAAT,CAAwBC,MAAxB,EAAiE;AAAA;;AACtE,gCAAOA,MAAM,CAACC,WAAd,qEAA6B,IAA7B;AACD;;AAEM,MAAMC,qBAA6C,GAAG,CAC3D,gCAD2D,EAE3D,0CAF2D,CAAtD;;AAKA,MAAMC,sBAA8C,GAAG,CAC5D,qCAD4D,EAE5D,sCAF4D,CAAvD;;;AAKP,SAASC,mCAAT,CAA6CH,WAA7C,EAAiG;AAC/F,MAAIA,WAAW,KAAK,UAApB,EAAgC;AAC9B,WAAOC,qBAAP;AACD,GAFD,MAEO,IAAID,WAAW,KAAK,WAApB,EAAiC;AACtC,WAAOE,sBAAP;AACD,GAFM,MAEA;AACL,WAAO,CAAC,GAAGD,qBAAJ,EAA2B,GAAGC,sBAA9B,CAAP;AACD;AACF;;AAEM,SAASL,cAAT,CACLE,MADK,EAELK,SAFK,EAGM;AACX,QAAMJ,WAAW,GAAGF,cAAc,CAACC,MAAD,CAAlC;AAEA,SAAO,EACL,GAAGK,SADE;AAELC,IAAAA,gCAAgC,EAAEF,mCAAmC,CAACH,WAAD;AAFhE,GAAP;AAID","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\n\nexport const withOrientation = createInfoPlistPlugin(setOrientation, 'withOrientation');\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"file":"Orientation.js"}
@@ -3,24 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAppDelegateHeaderFilePath = getAppDelegateHeaderFilePath;
6
+ exports.findSchemeNames = findSchemeNames;
7
+ exports.findSchemePaths = findSchemePaths;
8
+ exports.getAllEntitlementsPaths = getAllEntitlementsPaths;
9
+ exports.getAllInfoPlistPaths = getAllInfoPlistPaths;
10
+ exports.getAllPBXProjectPaths = getAllPBXProjectPaths;
11
+ exports.getAllXcodeProjectPaths = getAllXcodeProjectPaths;
12
+ exports.getAppDelegate = getAppDelegate;
7
13
  exports.getAppDelegateFilePath = getAppDelegateFilePath;
14
+ exports.getAppDelegateHeaderFilePath = getAppDelegateHeaderFilePath;
8
15
  exports.getAppDelegateObjcHeaderFilePath = getAppDelegateObjcHeaderFilePath;
16
+ exports.getEntitlementsPath = getEntitlementsPath;
17
+ exports.getExpoPlistPath = getExpoPlistPath;
9
18
  exports.getFileInfo = getFileInfo;
10
- exports.getAppDelegate = getAppDelegate;
11
- exports.getSourceRoot = getSourceRoot;
12
- exports.findSchemePaths = findSchemePaths;
13
- exports.findSchemeNames = findSchemeNames;
14
- exports.getAllXcodeProjectPaths = getAllXcodeProjectPaths;
15
- exports.getXcodeProjectPath = getXcodeProjectPath;
16
- exports.getAllPBXProjectPaths = getAllPBXProjectPaths;
17
- exports.getPBXProjectPath = getPBXProjectPath;
18
- exports.getAllInfoPlistPaths = getAllInfoPlistPaths;
19
19
  exports.getInfoPlistPath = getInfoPlistPath;
20
- exports.getAllEntitlementsPaths = getAllEntitlementsPaths;
21
- exports.getEntitlementsPath = getEntitlementsPath;
20
+ exports.getPBXProjectPath = getPBXProjectPath;
21
+ exports.getSourceRoot = getSourceRoot;
22
22
  exports.getSupportingPath = getSupportingPath;
23
- exports.getExpoPlistPath = getExpoPlistPath;
23
+ exports.getXcodeProjectPath = getXcodeProjectPath;
24
24
 
25
25
  function _fsExtra() {
26
26
  const data = require("fs-extra");
@@ -194,7 +194,7 @@ function findSchemePaths(projectRoot) {
194
194
 
195
195
  function findSchemeNames(projectRoot) {
196
196
  const schemePaths = findSchemePaths(projectRoot);
197
- return schemePaths.map(schemePath => path().basename(schemePath).split('.')[0]);
197
+ return schemePaths.map(schemePath => path().parse(schemePath).name);
198
198
  }
199
199
 
200
200
  function getAllXcodeProjectPaths(projectRoot) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Paths.ts"],"names":["ignoredPaths","getAppDelegateHeaderFilePath","projectRoot","using","extra","absolute","cwd","ignore","UnexpectedError","length","warnMultipleFiles","tag","fileName","getAppDelegateFilePath","getAppDelegateObjcHeaderFilePath","getLanguage","filePath","extension","path","extname","getFileInfo","normalize","contents","language","getAppDelegate","getSourceRoot","appDelegate","dirname","findSchemePaths","findSchemeNames","schemePaths","map","schemePath","basename","split","getAllXcodeProjectPaths","iosFolder","pbxprojPaths","filter","project","test","sort","value","join","getXcodeProjectPath","getAllPBXProjectPaths","projectPaths","paths","getPBXProjectPath","getAllInfoPlistPaths","a","b","getInfoPlistPath","getAllEntitlementsPaths","getEntitlementsPath","getSupportingPath","resolve","getExpoPlistPath","supportingPath","usingPath","relative","extraPaths","v","JSON","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEA,MAAMA,YAAY,GAAG,CAAC,4CAAD,CAArB;;AAUO,SAASC,4BAAT,CAAsCC,WAAtC,EAAmE;AACxE,QAAM,CAACC,KAAD,EAAQ,GAAGC,KAAX,IAAoB,kBAAS,qBAAT,EAAgC;AACxDC,IAAAA,QAAQ,EAAE,IAD8C;AAExDC,IAAAA,GAAG,EAAEJ,WAFmD;AAGxDK,IAAAA,MAAM,EAAEP;AAHgD,GAAhC,CAA1B;;AAMA,MAAI,CAACG,KAAL,EAAY;AACV,UAAM,KAAIK,yBAAJ,EACH,yDAAwDN,WAAY,GADjE,CAAN;AAGD;;AAED,MAAIE,KAAK,CAACK,MAAV,EAAkB;AAChBC,IAAAA,iBAAiB,CAAC;AAChBC,MAAAA,GAAG,EAAE,qBADW;AAEhBC,MAAAA,QAAQ,EAAE,aAFM;AAGhBV,MAAAA,WAHgB;AAIhBC,MAAAA,KAJgB;AAKhBC,M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uD,gBAAT,CAA0BvD,WAA1B,EAAuD;AAC5D,QAAMwD,cAAc,GAAGH,iBAAiB,CAACrD,WAAD,CAAxC;AACA,SAAOgB,IAAI,GAACyB,IAAL,CAAUe,cAAV,EAA0B,YAA1B,CAAP;AACD;;AAED,SAAShD,iBAAT,CAA2B;AACzBC,EAAAA,GADyB;AAEzBC,EAAAA,QAFyB;AAGzBV,EAAAA,WAHyB;AAIzBC,EAAAA,KAJyB;AAKzBC,EAAAA;AALyB,CAA3B,EAYG;AACD,QAAMuD,SAAS,GAAGzD,WAAW,GAAGgB,IAAI,GAAC0C,QAAL,CAAc1D,WAAd,EAA2BC,KAA3B,CAAH,GAAuCA,KAApE;AACA,QAAM0D,UAAU,GAAG3D,WAAW,GAAGE,KAAK,CAAC2B,GAAN,CAAU+B,CAAC,IAAI5C,IAAI,GAAC0C,QAAL,CAAc1D,WAAd,EAA2B4D,CAA3B,CAAf,CAAH,GAAmD1D,KAAjF;AACA,iCACG,SAAQO,GAAI,EADf,EAEG,kBAAiBC,QAAS,uBAAsB+C,SAAU,qBAAoBI,IAAI,CAACC,SAAL,CAC7EH,UAD6E,CAE7E,EAJJ;AAMD","sourcesContent":["import { pathExistsSync, readFileSync } from 'fs-extra';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport { UnexpectedError } from '../utils/errors';\nimport { addWarningIOS } from '../utils/warnings';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\ninterface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\nexport type AppDelegateProjectFile = ProjectFile<'objc' | 'swift'>;\n\nexport function getAppDelegateHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(\n `Could not locate a valid AppDelegate header at root: \"${projectRoot}\"`\n );\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-header',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.@(m|swift)', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateObjcHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate.h at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-objc-header',\n fileName: 'AppDelegate.h',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nfunction getLanguage(filePath: string): 'objc' | 'swift' {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.m':\n case '.h':\n return 'objc';\n case '.swift':\n return 'swift';\n default:\n throw new UnexpectedError(`Unexpected iOS file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath),\n };\n}\n\nexport function getAppDelegate(projectRoot: string): AppDelegateProjectFile {\n const filePath = getAppDelegateFilePath(projectRoot);\n return getFileInfo(filePath);\n}\n\nexport function getSourceRoot(projectRoot: string): string {\n const appDelegate = getAppDelegate(projectRoot);\n return path.dirname(appDelegate.path);\n}\n\nexport function findSchemePaths(projectRoot: string): string[] {\n return globSync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\nexport function findSchemeNames(projectRoot: string): string[] {\n const schemePaths = findSchemePaths(projectRoot);\n return schemePaths.map(schemePath => path.basename(schemePath).split('.')[0]);\n}\n\nexport function getAllXcodeProjectPaths(projectRoot: string): string[] {\n const iosFolder = 'ios';\n const pbxprojPaths = globSync('**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })\n .filter(project => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder)\n .sort(project => (path.dirname(project) === iosFolder ? -1 : 1))\n // sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)\n .sort();\n\n if (!pbxprojPaths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj files relative to path \"${projectRoot}\".`\n );\n }\n return pbxprojPaths.map(value => path.join(projectRoot, value));\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getXcodeProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'xcodeproj',\n fileName: '*.xcodeproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllPBXProjectPaths(projectRoot: string): string[] {\n const projectPaths = getAllXcodeProjectPaths(projectRoot);\n const paths = projectPaths\n .map(value => path.join(value, 'project.pbxproj'))\n .filter(value => pathExistsSync(value));\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getPBXProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllPBXProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'project-pbxproj',\n fileName: 'project.pbxproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllInfoPlistPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/Info.plist', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n }).sort(\n // longer name means more suffixes, we want the shortest possible one to be first.\n (a, b) => a.length - b.length\n );\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate Info.plist files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getInfoPlistPath(projectRoot: string): string {\n const [using, ...extra] = getAllInfoPlistPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'info-plist',\n fileName: 'Info.plist',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllEntitlementsPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/*.entitlements', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n return paths;\n}\n\n/**\n * Get the entitlements file path if it exists.\n *\n * @param projectRoot\n */\nexport function getEntitlementsPath(projectRoot: string): string | null {\n const [using, ...extra] = getAllEntitlementsPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'entitlements',\n fileName: '*.entitlements',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using ?? null;\n}\n\nexport function getSupportingPath(projectRoot: string): string {\n return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');\n}\n\nexport function getExpoPlistPath(projectRoot: string): string {\n const supportingPath = getSupportingPath(projectRoot);\n return path.join(supportingPath, 'Expo.plist');\n}\n\nfunction warnMultipleFiles({\n tag,\n fileName,\n projectRoot,\n using,\n extra,\n}: {\n tag: string;\n fileName: string;\n projectRoot?: string;\n using: string;\n extra: string[];\n}) {\n const usingPath = projectRoot ? path.relative(projectRoot, using) : using;\n const extraPaths = projectRoot ? extra.map(v => path.relative(projectRoot, v)) : extra;\n addWarningIOS(\n `paths-${tag}`,\n `Found multiple ${fileName} file paths, using \"${usingPath}\". Ignored paths: ${JSON.stringify(\n extraPaths\n )}`\n );\n}\n"],"file":"Paths.js"}
1
+ {"version":3,"sources":["../../src/ios/Paths.ts"],"names":["ignoredPaths","getAppDelegateHeaderFilePath","projectRoot","using","extra","absolute","cwd","ignore","UnexpectedError","length","warnMultipleFiles","tag","fileName","getAppDelegateFilePath","getAppDelegateObjcHeaderFilePath","getLanguage","filePath","extension","path","extname","getFileInfo","normalize","contents","language","getAppDelegate","getSourceRoot","appDelegate","dirname","findSchemePaths","findSchemeNames","schemePaths","map","schemePath","parse","name","getAllXcodeProjectPaths","iosFolder","pbxprojPaths","filter","project","test","sort","value","join","getXcodeProjectPath","getAllPBXProjectPaths","projectPaths","paths","getPBXProjectPath","getAllInfoPlistPaths","a","b","getInfoPlistPath","getAllEntitlementsPaths","getEntitlementsPath","getSupportingPath","resolve","basename","getExpoPlistPath","supportingPath","usingPath","relative","extraPaths","v","JSON","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEA,MAAMA,YAAY,GAAG,CAAC,4CAAD,CAArB;;AAUO,SAASC,4BAAT,CAAsCC,WAAtC,EAAmE;AACxE,QAAM,CAACC,KAAD,EAAQ,GAAGC,KAAX,IAAoB,kBAAS,qBAAT,EAAgC;AACxDC,IAAAA,QAAQ,EAAE,IAD8C;AAExDC,IAAAA,GAAG,EAAEJ,WAFmD;AAGxDK,IAAAA,MAAM,EAAEP;AAHgD,GAAhC,CAA1B;;AAMA,MAAI,CAACG,KAAL,EAAY;AACV,UAAM,KAAIK,yBAAJ,EACH,yDAAwDN,WAAY,GADjE,CAAN;AAGD;;AAED,MAAIE,KAAK,CAACK,MAAV,EAAkB;AAChBC,IAAAA,iBAAiB,CAAC;AAChBC,MAAAA,GAAG,EAAE,qBADW;AAEhBC,MAAAA,QAAQ,EAAE,aAFM;AAGhBV,MAAAA,WAH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ASwD,gBAAT,CAA0BxD,WAA1B,EAAuD;AAC5D,QAAMyD,cAAc,GAAGJ,iBAAiB,CAACrD,WAAD,CAAxC;AACA,SAAOgB,IAAI,GAACyB,IAAL,CAAUgB,cAAV,EAA0B,YAA1B,CAAP;AACD;;AAED,SAASjD,iBAAT,CAA2B;AACzBC,EAAAA,GADyB;AAEzBC,EAAAA,QAFyB;AAGzBV,EAAAA,WAHyB;AAIzBC,EAAAA,KAJyB;AAKzBC,EAAAA;AALyB,CAA3B,EAYG;AACD,QAAMwD,SAAS,GAAG1D,WAAW,GAAGgB,IAAI,GAAC2C,QAAL,CAAc3D,WAAd,EAA2BC,KAA3B,CAAH,GAAuCA,KAApE;AACA,QAAM2D,UAAU,GAAG5D,WAAW,GAAGE,KAAK,CAAC2B,GAAN,CAAUgC,CAAC,IAAI7C,IAAI,GAAC2C,QAAL,CAAc3D,WAAd,EAA2B6D,CAA3B,CAAf,CAAH,GAAmD3D,KAAjF;AACA,iCACG,SAAQO,GAAI,EADf,EAEG,kBAAiBC,QAAS,uBAAsBgD,SAAU,qBAAoBI,IAAI,CAACC,SAAL,CAC7EH,UAD6E,CAE7E,EAJJ;AAMD","sourcesContent":["import { pathExistsSync, readFileSync } from 'fs-extra';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport { UnexpectedError } from '../utils/errors';\nimport { addWarningIOS } from '../utils/warnings';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\ninterface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\nexport type AppDelegateProjectFile = ProjectFile<'objc' | 'swift'>;\n\nexport function getAppDelegateHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(\n `Could not locate a valid AppDelegate header at root: \"${projectRoot}\"`\n );\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-header',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.@(m|swift)', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateObjcHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate.h at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-objc-header',\n fileName: 'AppDelegate.h',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nfunction getLanguage(filePath: string): 'objc' | 'swift' {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.m':\n case '.h':\n return 'objc';\n case '.swift':\n return 'swift';\n default:\n throw new UnexpectedError(`Unexpected iOS file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath),\n };\n}\n\nexport function getAppDelegate(projectRoot: string): AppDelegateProjectFile {\n const filePath = getAppDelegateFilePath(projectRoot);\n return getFileInfo(filePath);\n}\n\nexport function getSourceRoot(projectRoot: string): string {\n const appDelegate = getAppDelegate(projectRoot);\n return path.dirname(appDelegate.path);\n}\n\nexport function findSchemePaths(projectRoot: string): string[] {\n return globSync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\nexport function findSchemeNames(projectRoot: string): string[] {\n const schemePaths = findSchemePaths(projectRoot);\n return schemePaths.map(schemePath => path.parse(schemePath).name);\n}\n\nexport function getAllXcodeProjectPaths(projectRoot: string): string[] {\n const iosFolder = 'ios';\n const pbxprojPaths = globSync('**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })\n .filter(project => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder)\n .sort(project => (path.dirname(project) === iosFolder ? -1 : 1))\n // sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)\n .sort();\n\n if (!pbxprojPaths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj files relative to path \"${projectRoot}\".`\n );\n }\n return pbxprojPaths.map(value => path.join(projectRoot, value));\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getXcodeProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'xcodeproj',\n fileName: '*.xcodeproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllPBXProjectPaths(projectRoot: string): string[] {\n const projectPaths = getAllXcodeProjectPaths(projectRoot);\n const paths = projectPaths\n .map(value => path.join(value, 'project.pbxproj'))\n .filter(value => pathExistsSync(value));\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getPBXProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllPBXProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'project-pbxproj',\n fileName: 'project.pbxproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllInfoPlistPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/Info.plist', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n }).sort(\n // longer name means more suffixes, we want the shortest possible one to be first.\n (a, b) => a.length - b.length\n );\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate Info.plist files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getInfoPlistPath(projectRoot: string): string {\n const [using, ...extra] = getAllInfoPlistPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'info-plist',\n fileName: 'Info.plist',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllEntitlementsPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/*.entitlements', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n return paths;\n}\n\n/**\n * Get the entitlements file path if it exists.\n *\n * @param projectRoot\n */\nexport function getEntitlementsPath(projectRoot: string): string | null {\n const [using, ...extra] = getAllEntitlementsPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'entitlements',\n fileName: '*.entitlements',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using ?? null;\n}\n\nexport function getSupportingPath(projectRoot: string): string {\n return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');\n}\n\nexport function getExpoPlistPath(projectRoot: string): string {\n const supportingPath = getSupportingPath(projectRoot);\n return path.join(supportingPath, 'Expo.plist');\n}\n\nfunction warnMultipleFiles({\n tag,\n fileName,\n projectRoot,\n using,\n extra,\n}: {\n tag: string;\n fileName: string;\n projectRoot?: string;\n using: string;\n extra: string[];\n}) {\n const usingPath = projectRoot ? path.relative(projectRoot, using) : using;\n const extraPaths = projectRoot ? extra.map(v => path.relative(projectRoot, v)) : extra;\n addWarningIOS(\n `paths-${tag}`,\n `Found multiple ${fileName} file paths, using \"${usingPath}\". Ignored paths: ${JSON.stringify(\n extraPaths\n )}`\n );\n}\n"],"file":"Paths.js"}
@@ -28,7 +28,7 @@ function _iosPlugins() {
28
28
 
29
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
30
 
31
- const debug = (0, _debug().default)('config-plugins:ios:permissions');
31
+ const debug = (0, _debug().default)('expo:config-plugins:ios:permissions');
32
32
 
33
33
  function applyPermissions(defaults, permissions, infoPlist) {
34
34
  const entries = Object.entries(defaults);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Permissions.ts"],"names":["debug","applyPermissions","defaults","permissions","infoPlist","entries","Object","length","JSON","stringify","permission","description","createPermissionsPlugin","name","withIosPermissions","config","modResults","defineProperty","value"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAGA,MAAMA,KAAK,GAAG,sBAAM,gCAAN,CAAd;;AAEO,SAASC,gBAAT,CACLC,QADK,EAELC,WAFK,EAGLC,SAHK,EAIM;AACX,QAAMC,OAAO,GAAGC,MAAM,CAACD,OAAP,CAAeH,QAAf,CAAhB;;AACA,MAAIG,OAAO,CAACE,MAAR,KAAmB,CAAvB,EAA0B;AACxBP,IAAAA,KAAK,CAAE,yBAAwBQ,IAAI,CAACC,SAAL,CAAeN,WAAf,CAA4B,EAAtD,CAAL;AACD;;AACD,OAAK,MAAM,CAACO,UAAD,EAAaC,WAAb,CAAX,IAAwCN,OAAxC,EAAiD;AAC/C,QAAIF,WAAW,CAACO,UAAD,CAAX,KAA4B,KAAhC,EAAuC;AACrCV,MAAAA,KAAK,CAAE,aAAYU,UAAW,GAAzB,CAAL;AACA,aAAON,SAAS,CAACM,UAAD,CAAhB;AACD,KAHD,MAGO;AACLN,MAAAA,SAAS,CAACM,UAAD,CAAT,GAAwBP,WAAW,CAACO,UAAD,CAAX,IAA2BN,SAAS,CAACM,UAAD,CAApC,IAAoDC,WAA5E;AACAX,MAAAA,KAAK,CAAE,YAAWU,UAAW,SAAQN,SAAS,CAACM,UAAD,CAAa,GAAtD,CAAL;AACD;AACF;;AACD,SAAON,SAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASQ,uBAAT,CAELV,QAFK,EAEeW,IAFf,EAE8B;AACnC,QAAMC,kBAAoF,GAAG,CAC3FC,MAD2F,EAE3FZ,WAF2F,KAI3F,iCAAcY,MAAd,EAAsB,MAAMA,MAAN,IAAgB;AACpCA,IAAAA,MAAM,CAACC,UAAP,GAAoBf,gBAAgB,CAACC,QAAD,EAAWC,WAAX,EAAwBY,MAAM,CAACC,UAA/B,CAApC;AACA,WAAOD,MAAP;AACD,GAHD,CAJF;;AAQA,MAAIF,IAAJ,EAAU;AACRP,IAAAA,MAAM,CAACW,cAAP,CAAsBH,kBAAtB,EAA0C,MAA1C,EAAkD;AAChDI,MAAAA,KAAK,EAAEL;AADyC,KAAlD;AAGD;;AACD,SAAOC,kBAAP;AACD","sourcesContent":["import Debug from 'debug';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nconst debug = Debug('config-plugins:ios:permissions');\n\nexport function applyPermissions<Defaults extends Record<string, string> = Record<string, string>>(\n defaults: Defaults,\n permissions: Partial<Record<keyof Defaults, string | false>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const entries = Object.entries(defaults);\n if (entries.length === 0) {\n debug(`No defaults provided: ${JSON.stringify(permissions)}`);\n }\n for (const [permission, description] of entries) {\n if (permissions[permission] === false) {\n debug(`Deleting \"${permission}\"`);\n delete infoPlist[permission];\n } else {\n infoPlist[permission] = permissions[permission] || infoPlist[permission] || description;\n debug(`Setting \"${permission}\" to \"${infoPlist[permission]}\"`);\n }\n }\n return infoPlist;\n}\n\n/**\n * Helper method for creating mods to apply default permissions.\n *\n * @param action\n */\nexport function createPermissionsPlugin<\n Defaults extends Record<string, string> = Record<string, string>\n>(defaults: Defaults, name?: string) {\n const withIosPermissions: ConfigPlugin<Record<keyof Defaults, string | undefined | false>> = (\n config,\n permissions\n ) =>\n withInfoPlist(config, async config => {\n config.modResults = applyPermissions(defaults, permissions, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withIosPermissions, 'name', {\n value: name,\n });\n }\n return withIosPermissions;\n}\n"],"file":"Permissions.js"}
1
+ {"version":3,"sources":["../../src/ios/Permissions.ts"],"names":["debug","applyPermissions","defaults","permissions","infoPlist","entries","Object","length","JSON","stringify","permission","description","createPermissionsPlugin","name","withIosPermissions","config","modResults","defineProperty","value"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAGA,MAAMA,KAAK,GAAG,sBAAM,qCAAN,CAAd;;AAEO,SAASC,gBAAT,CACLC,QADK,EAELC,WAFK,EAGLC,SAHK,EAIM;AACX,QAAMC,OAAO,GAAGC,MAAM,CAACD,OAAP,CAAeH,QAAf,CAAhB;;AACA,MAAIG,OAAO,CAACE,MAAR,KAAmB,CAAvB,EAA0B;AACxBP,IAAAA,KAAK,CAAE,yBAAwBQ,IAAI,CAACC,SAAL,CAAeN,WAAf,CAA4B,EAAtD,CAAL;AACD;;AACD,OAAK,MAAM,CAACO,UAAD,EAAaC,WAAb,CAAX,IAAwCN,OAAxC,EAAiD;AAC/C,QAAIF,WAAW,CAACO,UAAD,CAAX,KAA4B,KAAhC,EAAuC;AACrCV,MAAAA,KAAK,CAAE,aAAYU,UAAW,GAAzB,CAAL;AACA,aAAON,SAAS,CAACM,UAAD,CAAhB;AACD,KAHD,MAGO;AACLN,MAAAA,SAAS,CAACM,UAAD,CAAT,GAAwBP,WAAW,CAACO,UAAD,CAAX,IAA2BN,SAAS,CAACM,UAAD,CAApC,IAAoDC,WAA5E;AACAX,MAAAA,KAAK,CAAE,YAAWU,UAAW,SAAQN,SAAS,CAACM,UAAD,CAAa,GAAtD,CAAL;AACD;AACF;;AACD,SAAON,SAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASQ,uBAAT,CAELV,QAFK,EAEeW,IAFf,EAE8B;AACnC,QAAMC,kBAAoF,GAAG,CAC3FC,MAD2F,EAE3FZ,WAF2F,KAI3F,iCAAcY,MAAd,EAAsB,MAAMA,MAAN,IAAgB;AACpCA,IAAAA,MAAM,CAACC,UAAP,GAAoBf,gBAAgB,CAACC,QAAD,EAAWC,WAAX,EAAwBY,MAAM,CAACC,UAA/B,CAApC;AACA,WAAOD,MAAP;AACD,GAHD,CAJF;;AAQA,MAAIF,IAAJ,EAAU;AACRP,IAAAA,MAAM,CAACW,cAAP,CAAsBH,kBAAtB,EAA0C,MAA1C,EAAkD;AAChDI,MAAAA,KAAK,EAAEL;AADyC,KAAlD;AAGD;;AACD,SAAOC,kBAAP;AACD","sourcesContent":["import Debug from 'debug';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nconst debug = Debug('expo:config-plugins:ios:permissions');\n\nexport function applyPermissions<Defaults extends Record<string, string> = Record<string, string>>(\n defaults: Defaults,\n permissions: Partial<Record<keyof Defaults, string | false>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const entries = Object.entries(defaults);\n if (entries.length === 0) {\n debug(`No defaults provided: ${JSON.stringify(permissions)}`);\n }\n for (const [permission, description] of entries) {\n if (permissions[permission] === false) {\n debug(`Deleting \"${permission}\"`);\n delete infoPlist[permission];\n } else {\n infoPlist[permission] = permissions[permission] || infoPlist[permission] || description;\n debug(`Setting \"${permission}\" to \"${infoPlist[permission]}\"`);\n }\n }\n return infoPlist;\n}\n\n/**\n * Helper method for creating mods to apply default permissions.\n *\n * @param action\n */\nexport function createPermissionsPlugin<\n Defaults extends Record<string, string> = Record<string, string>\n>(defaults: Defaults, name?: string) {\n const withIosPermissions: ConfigPlugin<Record<keyof Defaults, string | undefined | false>> = (\n config,\n permissions\n ) =>\n withInfoPlist(config, async config => {\n config.modResults = applyPermissions(defaults, permissions, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withIosPermissions, 'name', {\n value: name,\n });\n }\n return withIosPermissions;\n}\n"],"file":"Permissions.js"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getScheme = getScheme;
7
- exports.setScheme = setScheme;
8
6
  exports.appendScheme = appendScheme;
9
- exports.removeScheme = removeScheme;
10
- exports.hasScheme = hasScheme;
7
+ exports.getScheme = getScheme;
11
8
  exports.getSchemesFromPlist = getSchemesFromPlist;
9
+ exports.hasScheme = hasScheme;
10
+ exports.removeScheme = removeScheme;
11
+ exports.setScheme = setScheme;
12
12
  exports.withScheme = void 0;
13
13
 
14
14
  function _iosPlugins() {
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.createBridgingHeaderFile = createBridgingHeaderFile;
6
7
  exports.ensureSwiftBridgingHeaderSetup = ensureSwiftBridgingHeaderSetup;
7
8
  exports.getDesignatedSwiftBridgingHeaderFileReference = getDesignatedSwiftBridgingHeaderFileReference;
8
9
  exports.linkBridgingHeaderFile = linkBridgingHeaderFile;
9
- exports.createBridgingHeaderFile = createBridgingHeaderFile;
10
- exports.withNoopSwiftFile = exports.withSwiftBridgingHeader = void 0;
10
+ exports.withSwiftBridgingHeader = exports.withNoopSwiftFile = void 0;
11
11
 
12
12
  function _fsExtra() {
13
13
  const data = _interopRequireDefault(require("fs-extra"));
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getXCBuildConfigurationFromPbxproj = getXCBuildConfigurationFromPbxproj;
6
+ exports.TargetType = void 0;
7
7
  exports.findApplicationTargetWithDependenciesAsync = findApplicationTargetWithDependenciesAsync;
8
- exports.isTargetOfType = isTargetOfType;
9
- exports.getNativeTargets = getNativeTargets;
10
- exports.findSignableTargets = findSignableTargets;
11
8
  exports.findFirstNativeTarget = findFirstNativeTarget;
12
9
  exports.findNativeTargetByName = findNativeTargetByName;
13
- exports.TargetType = void 0;
10
+ exports.findSignableTargets = findSignableTargets;
11
+ exports.getNativeTargets = getNativeTargets;
12
+ exports.getXCBuildConfigurationFromPbxproj = getXCBuildConfigurationFromPbxproj;
13
+ exports.isTargetOfType = isTargetOfType;
14
14
 
15
15
  function _BuildScheme() {
16
16
  const data = require("./BuildScheme");
@@ -12,11 +12,6 @@ export declare enum Config {
12
12
  RELEASE_CHANNEL = "EXUpdatesReleaseChannel",
13
13
  UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = "EXUpdatesRequestHeaders"
14
14
  }
15
- /**
16
- * runtime version maybe null in projects using classic updates. In that
17
- * case we use SDK version
18
- */
19
- export declare function getRuntimeVersionNullable(config: Pick<ExpoConfigUpdates, 'runtimeVersion'>): string | null;
20
15
  export declare function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null;
21
16
  export declare function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean;
22
17
  export declare function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number;