@expo/config-plugins 4.0.8 → 4.0.12

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 (38) hide show
  1. package/build/android/IntentFilters.d.ts +3 -3
  2. package/build/android/IntentFilters.js +44 -48
  3. package/build/android/IntentFilters.js.map +1 -1
  4. package/build/android/Manifest.d.ts +5 -1
  5. package/build/android/Manifest.js.map +1 -1
  6. package/build/android/Updates.d.ts +2 -2
  7. package/build/android/Updates.js +20 -4
  8. package/build/android/Updates.js.map +1 -1
  9. package/build/android/Version.d.ts +9 -0
  10. package/build/android/Version.js +37 -1
  11. package/build/android/Version.js.map +1 -1
  12. package/build/index.d.ts +1 -1
  13. package/build/index.js +7 -0
  14. package/build/index.js.map +1 -1
  15. package/build/ios/BundleIdentifier.js +11 -1
  16. package/build/ios/BundleIdentifier.js.map +1 -1
  17. package/build/ios/JsEngine.d.ts +2 -1
  18. package/build/ios/JsEngine.js.map +1 -1
  19. package/build/ios/Maps.js +7 -2
  20. package/build/ios/Maps.js.map +1 -1
  21. package/build/ios/ProvisioningProfile.js +11 -2
  22. package/build/ios/ProvisioningProfile.js.map +1 -1
  23. package/build/ios/Target.js +29 -10
  24. package/build/ios/Target.js.map +1 -1
  25. package/build/ios/Updates.d.ts +2 -2
  26. package/build/ios/Updates.js +20 -4
  27. package/build/ios/Updates.js.map +1 -1
  28. package/build/ios/utils/string.d.ts +1 -0
  29. package/build/ios/utils/string.js +11 -0
  30. package/build/ios/utils/string.js.map +1 -0
  31. package/build/plugins/ios-plugins.d.ts +2 -2
  32. package/build/plugins/ios-plugins.js.map +1 -1
  33. package/build/plugins/withIosBaseMods.d.ts +3 -3
  34. package/build/plugins/withIosBaseMods.js.map +1 -1
  35. package/build/utils/Updates.d.ts +1 -0
  36. package/build/utils/Updates.js +34 -0
  37. package/build/utils/Updates.js.map +1 -1
  38. package/package.json +2 -1
@@ -92,6 +92,16 @@ function _Xcodeproj() {
92
92
  return data;
93
93
  }
94
94
 
95
+ function _string() {
96
+ const data = require("./utils/string");
97
+
98
+ _string = function () {
99
+ return data;
100
+ };
101
+
102
+ return data;
103
+ }
104
+
95
105
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
96
106
 
97
107
  const withBundleIdentifier = (config, {
@@ -179,7 +189,7 @@ function getProductBundleIdentifierFromBuildConfiguration(xcBuildConfiguration)
179
189
  const bundleIdentifierRaw = xcBuildConfiguration.buildSettings.PRODUCT_BUNDLE_IDENTIFIER;
180
190
 
181
191
  if (bundleIdentifierRaw) {
182
- const bundleIdentifier = bundleIdentifierRaw[0] === '"' ? bundleIdentifierRaw.slice(1, -1) : bundleIdentifierRaw; // it's possible to use interpolation for the bundle identifier
192
+ const bundleIdentifier = (0, _string().trimQuotes)(bundleIdentifierRaw); // it's possible to use interpolation for the bundle identifier
183
193
  // the most common case is when the last part of the id is set to `$(PRODUCT_NAME:rfc1034identifier)`
184
194
  // in this case, PRODUCT_NAME should be replaced with its value
185
195
  // the `rfc1034identifier` modifier replaces all non-alphanumeric characters with dashes
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/BundleIdentifier.ts"],"names":["withBundleIdentifier","config","bundleIdentifier","bundleId","ios","setBundleIdentifierForPbxproj","modRequest","projectRoot","getBundleIdentifier","setBundleIdentifier","infoPlist","CFBundleIdentifier","getBundleIdentifierFromPbxproj","targetName","buildConfiguration","pbxprojPath","project","xcode","parseSync","xcBuildConfiguration","getProductBundleIdentifierFromBuildConfiguration","bundleIdentifierRaw","buildSettings","PRODUCT_BUNDLE_IDENTIFIER","slice","bundleIdentifierParts","split","length","PRODUCT_NAME","replace","join","updateBundleIdentifierForPbxproj","updateProductName","nativeTarget","buildConfigurationList","forEach","item","productName","pop","includes","fs","writeFileSync","writeSync","pbxprojPaths","defaultBundleId","resetAllPlistBundleIdentifiers","infoPlistPaths","plistPath","resetPlistBundleIdentifier","rawPlist","readFileSync","plistObject","plist","parse","format","pretty","indent","xml","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ACA,MAAIW,YAAsB,GAAG,EAA7B;;AACA,MAAI;AACFA,IAAAA,YAAY,GAAG,oCAAsBpC,WAAtB,CAAf;AACD,GAFD,CAEE,MAAM,CAAE;;AAEV,OAAK,MAAMQ,WAAX,IAA0B4B,YAA1B,EAAwC;AACtCZ,IAAAA,gCAAgC,CAAChB,WAAD,EAAcb,gBAAd,EAAgC8B,iBAAhC,CAAhC;AACD;AACF;AAED;AACA;AACA;;;AAEA,MAAMY,eAAe,GAAG,8BAAxB;;AAEA,SAASC,8BAAT,CAAwCtC,WAAxC,EAAmE;AACjE,QAAMuC,cAAc,GAAG,mCAAqBvC,WAArB,CAAvB;;AAEA,OAAK,MAAMwC,SAAX,IAAwBD,cAAxB,EAAwC;AACtCE,IAAAA,0BAA0B,CAACD,SAAD,CAA1B;AACD;AACF;;AAED,SAASC,0BAAT,CAAoCD,SAApC,EAA6D;AAC3D,QAAME,QAAQ,GAAGT,mBAAGU,YAAH,CAAgBH,SAAhB,EAA2B,MAA3B,CAAjB;;AACA,QAAMI,WAAW,GAAGC,iBAAMC,KAAN,CAAYJ,QAAZ,CAApB;;AAEA,MAAIE,WAAW,CAACxC,kBAAhB,EAAoC;AAClC,QAAIwC,WAAW,CAACxC,kBAAZ,KAAmCiC,eAAvC,EAAwD,OADtB,CAGlC;;AACA,UAAMU,MAAM,GAAG;AAAEC,MAAAA,MAAM,EAAE,IAAV;AAAgBC,MAAAA,MAAM,EAAG;AAAzB,KAAf;;AAEA,UAAMC,GAAG,GAAGL,iBAAMM,KAAN,CACV,EACE,GAAGP,WADL;AAEExC,MAAAA,kBAAkB,EAAEiC;AAFtB,KADU,EAKVU,MALU,CAAZ;;AAQA,QAAIG,GAAG,KAAKR,QAAZ,EAAsB;AACpBT,yBAAGC,aAAH,CAAiBM,SAAjB,EAA4BU,GAA5B;AACD;AACF;AACF","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport plist, { PlistObject } from '@expo/plist';\nimport assert from 'assert';\nimport fs from 'fs-extra';\nimport xcode, { XCBuildConfiguration } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { InfoPlist } from './IosConfig.types';\nimport { getAllInfoPlistPaths, getAllPBXProjectPaths, getPBXProjectPath } from './Paths';\nimport { findFirstNativeTarget, getXCBuildConfigurationFromPbxproj } from './Target';\nimport { ConfigurationSectionEntry, getBuildConfigurationsForListId } from './utils/Xcodeproj';\n\nexport const withBundleIdentifier: ConfigPlugin<{ bundleIdentifier?: string }> = (\n config,\n { bundleIdentifier }\n) => {\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const bundleId = bundleIdentifier ?? config.ios?.bundleIdentifier;\n assert(\n bundleId,\n '`bundleIdentifier` must be defined in the app config (`expo.ios.bundleIdentifier`) or passed to the plugin `withBundleIdentifier`.'\n );\n await setBundleIdentifierForPbxproj(config.modRequest.projectRoot, bundleId!);\n return config;\n },\n ]);\n};\n\nfunction getBundleIdentifier(config: Pick<ExpoConfig, 'ios'>): string | null {\n return config.ios?.bundleIdentifier ?? null;\n}\n\n/**\n * In Turtle v1 we set the bundleIdentifier directly on Info.plist rather\n * than in pbxproj\n */\nfunction setBundleIdentifier(config: ExpoConfig, infoPlist: InfoPlist): InfoPlist {\n const bundleIdentifier = getBundleIdentifier(config);\n\n if (!bundleIdentifier) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleIdentifier: bundleIdentifier,\n };\n}\n\n/**\n * Gets the bundle identifier defined in the Xcode project found in the project directory.\n *\n * A bundle identifier is stored as a value in XCBuildConfiguration entry.\n * Those entries exist for every pair (build target, build configuration).\n * Unless target name is passed, the first target defined in the pbxproj is used\n * (to keep compatibility with the inaccurate legacy implementation of this function).\n * The build configuration is usually 'Release' or 'Debug'. However, it could be any arbitrary string.\n * Defaults to 'Release'.\n *\n * @param {string} projectRoot Path to project root containing the ios directory\n * @param {string} targetName Target name\n * @param {string} buildConfiguration Build configuration. Defaults to 'Release'.\n * @returns {string | null} bundle identifier of the Xcode project or null if the project is not configured\n */\nfunction getBundleIdentifierFromPbxproj(\n projectRoot: string,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string } = {}\n): string | null {\n let pbxprojPath: string;\n try {\n pbxprojPath = getPBXProjectPath(projectRoot);\n } catch {\n return null;\n }\n const project = xcode.project(pbxprojPath);\n project.parseSync();\n\n const xcBuildConfiguration = getXCBuildConfigurationFromPbxproj(project, {\n targetName,\n buildConfiguration,\n });\n if (!xcBuildConfiguration) {\n return null;\n }\n return getProductBundleIdentifierFromBuildConfiguration(xcBuildConfiguration);\n}\n\nfunction getProductBundleIdentifierFromBuildConfiguration(\n xcBuildConfiguration: XCBuildConfiguration\n): string | null {\n const bundleIdentifierRaw = xcBuildConfiguration.buildSettings.PRODUCT_BUNDLE_IDENTIFIER;\n if (bundleIdentifierRaw) {\n const bundleIdentifier =\n bundleIdentifierRaw[0] === '\"' ? bundleIdentifierRaw.slice(1, -1) : bundleIdentifierRaw;\n // it's possible to use interpolation for the bundle identifier\n // the most common case is when the last part of the id is set to `$(PRODUCT_NAME:rfc1034identifier)`\n // in this case, PRODUCT_NAME should be replaced with its value\n // the `rfc1034identifier` modifier replaces all non-alphanumeric characters with dashes\n const bundleIdentifierParts = bundleIdentifier.split('.');\n if (\n bundleIdentifierParts[bundleIdentifierParts.length - 1] ===\n '$(PRODUCT_NAME:rfc1034identifier)' &&\n xcBuildConfiguration.buildSettings.PRODUCT_NAME\n ) {\n bundleIdentifierParts[\n bundleIdentifierParts.length - 1\n ] = xcBuildConfiguration.buildSettings.PRODUCT_NAME.replace(/[^a-zA-Z0-9]/g, '-');\n }\n return bundleIdentifierParts.join('.');\n } else {\n return null;\n }\n}\n\n/**\n * Updates the bundle identifier for a given pbxproj\n *\n * @param {string} pbxprojPath Path to pbxproj file\n * @param {string} bundleIdentifier Bundle identifier to set in the pbxproj\n * @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME\n */\nfunction updateBundleIdentifierForPbxproj(\n pbxprojPath: string,\n bundleIdentifier: string,\n updateProductName: boolean = true\n): void {\n const project = xcode.project(pbxprojPath);\n project.parseSync();\n\n const [, nativeTarget] = findFirstNativeTarget(project);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).forEach(\n ([, item]: ConfigurationSectionEntry) => {\n if (item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER === bundleIdentifier) {\n return;\n }\n\n item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER = `\"${bundleIdentifier}\"`;\n\n if (updateProductName) {\n const productName = bundleIdentifier.split('.').pop();\n if (!productName?.includes('$')) {\n item.buildSettings.PRODUCT_NAME = productName;\n }\n }\n }\n );\n fs.writeFileSync(pbxprojPath, project.writeSync());\n}\n\n/**\n * Updates the bundle identifier for pbx projects inside the ios directory of the given project root\n *\n * @param {string} projectRoot Path to project root containing the ios directory\n * @param {string} bundleIdentifier Desired bundle identifier\n * @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME\n */\nfunction setBundleIdentifierForPbxproj(\n projectRoot: string,\n bundleIdentifier: string,\n updateProductName: boolean = true\n): void {\n // Get all pbx projects in the ${projectRoot}/ios directory\n let pbxprojPaths: string[] = [];\n try {\n pbxprojPaths = getAllPBXProjectPaths(projectRoot);\n } catch {}\n\n for (const pbxprojPath of pbxprojPaths) {\n updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateProductName);\n }\n}\n\n/**\n * Reset bundle identifier field in Info.plist to use PRODUCT_BUNDLE_IDENTIFIER, as recommended by Apple.\n */\n\nconst defaultBundleId = '$(PRODUCT_BUNDLE_IDENTIFIER)';\n\nfunction resetAllPlistBundleIdentifiers(projectRoot: string): void {\n const infoPlistPaths = getAllInfoPlistPaths(projectRoot);\n\n for (const plistPath of infoPlistPaths) {\n resetPlistBundleIdentifier(plistPath);\n }\n}\n\nfunction resetPlistBundleIdentifier(plistPath: string): void {\n const rawPlist = fs.readFileSync(plistPath, 'utf8');\n const plistObject = plist.parse(rawPlist) as PlistObject;\n\n if (plistObject.CFBundleIdentifier) {\n if (plistObject.CFBundleIdentifier === defaultBundleId) return;\n\n // attempt to match default Info.plist format\n const format = { pretty: true, indent: `\\t` };\n\n const xml = plist.build(\n {\n ...plistObject,\n CFBundleIdentifier: defaultBundleId,\n },\n format\n );\n\n if (xml !== rawPlist) {\n fs.writeFileSync(plistPath, xml);\n }\n }\n}\n\nexport {\n getBundleIdentifier,\n setBundleIdentifier,\n getBundleIdentifierFromPbxproj,\n updateBundleIdentifierForPbxproj,\n setBundleIdentifierForPbxproj,\n resetAllPlistBundleIdentifiers,\n resetPlistBundleIdentifier,\n};\n"],"file":"BundleIdentifier.js"}
1
+ {"version":3,"sources":["../../src/ios/BundleIdentifier.ts"],"names":["withBundleIdentifier","config","bundleIdentifier","bundleId","ios","setBundleIdentifierForPbxproj","modRequest","projectRoot","getBundleIdentifier","setBundleIdentifier","infoPlist","CFBundleIdentifier","getBundleIdentifierFromPbxproj","targetName","buildConfiguration","pbxprojPath","project","xcode","parseSync","xcBuildConfiguration","getProductBundleIdentifierFromBuildConfiguration","bundleIdentifierRaw","buildSettings","PRODUCT_BUNDLE_IDENTIFIER","bundleIdentifierParts","split","length","PRODUCT_NAME","replace","join","updateBundleIdentifierForPbxproj","updateProductName","nativeTarget","buildConfigurationList","forEach","item","productName","pop","includes","fs","writeFileSync","writeSync","pbxprojPaths","defaultBundleId","resetAllPlistBundleIdentifiers","infoPlistPaths","plistPath","resetPlistBundleIdentifier","rawPlist","readFileSync","plistObject","plist","parse","format","pretty","indent","xml","build"],"mappings":";;;;;;;;;;;;;;AACA;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;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;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SAASC,8BAAT,CAAwCrC,WAAxC,EAAmE;AACjE,QAAMsC,cAAc,GAAG,mCAAqBtC,WAArB,CAAvB;;AAEA,OAAK,MAAMuC,SAAX,IAAwBD,cAAxB,EAAwC;AACtCE,IAAAA,0BAA0B,CAACD,SAAD,CAA1B;AACD;AACF;;AAED,SAASC,0BAAT,CAAoCD,SAApC,EAA6D;AAC3D,QAAME,QAAQ,GAAGT,mBAAGU,YAAH,CAAgBH,SAAhB,EAA2B,MAA3B,CAAjB;;AACA,QAAMI,WAAW,GAAGC,iBAAMC,KAAN,CAAYJ,QAAZ,CAApB;;AAEA,MAAIE,WAAW,CAACvC,kBAAhB,EAAoC;AAClC,QAAIuC,WAAW,CAACvC,kBAAZ,KAAmCgC,eAAvC,EAAwD,OADtB,CAGlC;;AACA,UAAMU,MAAM,GAAG;AAAEC,MAAAA,MAAM,EAAE,IAAV;AAAgBC,MAAAA,MAAM,EAAG;AAAzB,KAAf;;AAEA,UAAMC,GAAG,GAAGL,iBAAMM,KAAN,CACV,EACE,GAAGP,WADL;AAEEvC,MAAAA,kBAAkB,EAAEgC;AAFtB,KADU,EAKVU,MALU,CAAZ;;AAQA,QAAIG,GAAG,KAAKR,QAAZ,EAAsB;AACpBT,yBAAGC,aAAH,CAAiBM,SAAjB,EAA4BU,GAA5B;AACD;AACF;AACF","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport plist, { PlistObject } from '@expo/plist';\nimport assert from 'assert';\nimport fs from 'fs-extra';\nimport xcode, { XCBuildConfiguration } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { InfoPlist } from './IosConfig.types';\nimport { getAllInfoPlistPaths, getAllPBXProjectPaths, getPBXProjectPath } from './Paths';\nimport { findFirstNativeTarget, getXCBuildConfigurationFromPbxproj } from './Target';\nimport { ConfigurationSectionEntry, getBuildConfigurationsForListId } from './utils/Xcodeproj';\nimport { trimQuotes } from './utils/string';\n\nexport const withBundleIdentifier: ConfigPlugin<{ bundleIdentifier?: string }> = (\n config,\n { bundleIdentifier }\n) => {\n return withDangerousMod(config, [\n 'ios',\n async config => {\n const bundleId = bundleIdentifier ?? config.ios?.bundleIdentifier;\n assert(\n bundleId,\n '`bundleIdentifier` must be defined in the app config (`expo.ios.bundleIdentifier`) or passed to the plugin `withBundleIdentifier`.'\n );\n await setBundleIdentifierForPbxproj(config.modRequest.projectRoot, bundleId!);\n return config;\n },\n ]);\n};\n\nfunction getBundleIdentifier(config: Pick<ExpoConfig, 'ios'>): string | null {\n return config.ios?.bundleIdentifier ?? null;\n}\n\n/**\n * In Turtle v1 we set the bundleIdentifier directly on Info.plist rather\n * than in pbxproj\n */\nfunction setBundleIdentifier(config: ExpoConfig, infoPlist: InfoPlist): InfoPlist {\n const bundleIdentifier = getBundleIdentifier(config);\n\n if (!bundleIdentifier) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleIdentifier: bundleIdentifier,\n };\n}\n\n/**\n * Gets the bundle identifier defined in the Xcode project found in the project directory.\n *\n * A bundle identifier is stored as a value in XCBuildConfiguration entry.\n * Those entries exist for every pair (build target, build configuration).\n * Unless target name is passed, the first target defined in the pbxproj is used\n * (to keep compatibility with the inaccurate legacy implementation of this function).\n * The build configuration is usually 'Release' or 'Debug'. However, it could be any arbitrary string.\n * Defaults to 'Release'.\n *\n * @param {string} projectRoot Path to project root containing the ios directory\n * @param {string} targetName Target name\n * @param {string} buildConfiguration Build configuration. Defaults to 'Release'.\n * @returns {string | null} bundle identifier of the Xcode project or null if the project is not configured\n */\nfunction getBundleIdentifierFromPbxproj(\n projectRoot: string,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string } = {}\n): string | null {\n let pbxprojPath: string;\n try {\n pbxprojPath = getPBXProjectPath(projectRoot);\n } catch {\n return null;\n }\n const project = xcode.project(pbxprojPath);\n project.parseSync();\n\n const xcBuildConfiguration = getXCBuildConfigurationFromPbxproj(project, {\n targetName,\n buildConfiguration,\n });\n if (!xcBuildConfiguration) {\n return null;\n }\n return getProductBundleIdentifierFromBuildConfiguration(xcBuildConfiguration);\n}\n\nfunction getProductBundleIdentifierFromBuildConfiguration(\n xcBuildConfiguration: XCBuildConfiguration\n): string | null {\n const bundleIdentifierRaw = xcBuildConfiguration.buildSettings.PRODUCT_BUNDLE_IDENTIFIER;\n if (bundleIdentifierRaw) {\n const bundleIdentifier = trimQuotes(bundleIdentifierRaw);\n // it's possible to use interpolation for the bundle identifier\n // the most common case is when the last part of the id is set to `$(PRODUCT_NAME:rfc1034identifier)`\n // in this case, PRODUCT_NAME should be replaced with its value\n // the `rfc1034identifier` modifier replaces all non-alphanumeric characters with dashes\n const bundleIdentifierParts = bundleIdentifier.split('.');\n if (\n bundleIdentifierParts[bundleIdentifierParts.length - 1] ===\n '$(PRODUCT_NAME:rfc1034identifier)' &&\n xcBuildConfiguration.buildSettings.PRODUCT_NAME\n ) {\n bundleIdentifierParts[\n bundleIdentifierParts.length - 1\n ] = xcBuildConfiguration.buildSettings.PRODUCT_NAME.replace(/[^a-zA-Z0-9]/g, '-');\n }\n return bundleIdentifierParts.join('.');\n } else {\n return null;\n }\n}\n\n/**\n * Updates the bundle identifier for a given pbxproj\n *\n * @param {string} pbxprojPath Path to pbxproj file\n * @param {string} bundleIdentifier Bundle identifier to set in the pbxproj\n * @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME\n */\nfunction updateBundleIdentifierForPbxproj(\n pbxprojPath: string,\n bundleIdentifier: string,\n updateProductName: boolean = true\n): void {\n const project = xcode.project(pbxprojPath);\n project.parseSync();\n\n const [, nativeTarget] = findFirstNativeTarget(project);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).forEach(\n ([, item]: ConfigurationSectionEntry) => {\n if (item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER === bundleIdentifier) {\n return;\n }\n\n item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER = `\"${bundleIdentifier}\"`;\n\n if (updateProductName) {\n const productName = bundleIdentifier.split('.').pop();\n if (!productName?.includes('$')) {\n item.buildSettings.PRODUCT_NAME = productName;\n }\n }\n }\n );\n fs.writeFileSync(pbxprojPath, project.writeSync());\n}\n\n/**\n * Updates the bundle identifier for pbx projects inside the ios directory of the given project root\n *\n * @param {string} projectRoot Path to project root containing the ios directory\n * @param {string} bundleIdentifier Desired bundle identifier\n * @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME\n */\nfunction setBundleIdentifierForPbxproj(\n projectRoot: string,\n bundleIdentifier: string,\n updateProductName: boolean = true\n): void {\n // Get all pbx projects in the ${projectRoot}/ios directory\n let pbxprojPaths: string[] = [];\n try {\n pbxprojPaths = getAllPBXProjectPaths(projectRoot);\n } catch {}\n\n for (const pbxprojPath of pbxprojPaths) {\n updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateProductName);\n }\n}\n\n/**\n * Reset bundle identifier field in Info.plist to use PRODUCT_BUNDLE_IDENTIFIER, as recommended by Apple.\n */\n\nconst defaultBundleId = '$(PRODUCT_BUNDLE_IDENTIFIER)';\n\nfunction resetAllPlistBundleIdentifiers(projectRoot: string): void {\n const infoPlistPaths = getAllInfoPlistPaths(projectRoot);\n\n for (const plistPath of infoPlistPaths) {\n resetPlistBundleIdentifier(plistPath);\n }\n}\n\nfunction resetPlistBundleIdentifier(plistPath: string): void {\n const rawPlist = fs.readFileSync(plistPath, 'utf8');\n const plistObject = plist.parse(rawPlist) as PlistObject;\n\n if (plistObject.CFBundleIdentifier) {\n if (plistObject.CFBundleIdentifier === defaultBundleId) return;\n\n // attempt to match default Info.plist format\n const format = { pretty: true, indent: `\\t` };\n\n const xml = plist.build(\n {\n ...plistObject,\n CFBundleIdentifier: defaultBundleId,\n },\n format\n );\n\n if (xml !== rawPlist) {\n fs.writeFileSync(plistPath, xml);\n }\n }\n}\n\nexport {\n getBundleIdentifier,\n setBundleIdentifier,\n getBundleIdentifierFromPbxproj,\n updateBundleIdentifierForPbxproj,\n setBundleIdentifierForPbxproj,\n resetAllPlistBundleIdentifiers,\n resetPlistBundleIdentifier,\n};\n"],"file":"BundleIdentifier.js"}
@@ -1,7 +1,8 @@
1
1
  import type { ExpoConfig } from '@expo/config-types';
2
+ import { JSONValue } from '@expo/json-file';
2
3
  import type { ConfigPlugin } from '../Plugin.types';
3
4
  export declare const JS_ENGINE_PROP_KEY = "expo.jsEngine";
4
5
  export declare const DEFAULT_JS_ENGINE = "jsc";
5
6
  export declare const withJsEnginePodfileProps: ConfigPlugin;
6
7
  export declare function getJsEngine(config: Pick<ExpoConfig, 'ios' | 'jsEngine'>): "hermes" | "jsc";
7
- export declare function setJsEngine(config: Pick<ExpoConfig, 'ios' | 'jsEngine'>, podfileProperties: Record<string, string>): Record<string, string>;
8
+ export declare function setJsEngine(config: Pick<ExpoConfig, 'ios' | 'jsEngine'>, podfileProperties: Record<string, JSONValue>): Record<string, JSONValue>;
@@ -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":";;;;;;;;;;AAIA;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,EAGsB;AAAA;;AAC3BA,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';\nimport { JSONValue } from '@expo/json-file';\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, JSONValue>\n): Record<string, JSONValue> {\n podfileProperties[JS_ENGINE_PROP_KEY] =\n config.ios?.jsEngine ?? config.jsEngine ?? DEFAULT_JS_ENGINE;\n return podfileProperties;\n}\n"],"file":"JsEngine.js"}
package/build/ios/Maps.js CHANGED
@@ -193,8 +193,13 @@ function isReactNativeMapsInstalled(projectRoot) {
193
193
  }
194
194
 
195
195
  function isReactNativeMapsAutolinked(config) {
196
- // TODO: Detect autolinking
197
- return true;
196
+ var _config$_internal;
197
+
198
+ // Only add the native code changes if we know that the package is going to be linked natively.
199
+ // This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)
200
+ // but another app will not have it installed in the package.json, causing it to not be linked natively.
201
+ // This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.
202
+ return !((_config$_internal = config._internal) !== null && _config$_internal !== void 0 && _config$_internal.autolinkedModules) || config._internal.autolinkedModules.includes('react-native-maps');
198
203
  }
199
204
 
200
205
  const withMapsCocoaPods = (config, {
@@ -1 +1 @@
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;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAD,CAAP,CAAiB,8BAAjB,CAAd,C,CAEA;;;AAC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,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"}
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","_internal","autolinkedModules","includes","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;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,UAAP,CAAkBb,QADuC,CAA9B,CAE3BA,QAFF;AAGAvC,UAAAA,MAAM,CAACoD,UAAP,CAAkBb,QAAlB,GAA6BnB,4BAA4B,CACvDpB,MAAM,CAACoD,UAAP,CAAkBb,QADqC,EAEvDtC,MAFuD,CAA5B,CAG3BsC,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;AACL9C,QAAAA,MAAM,CAACoD,UAAP,CAAkBb,QAAlB,GAA6BpB,iCAAiC,CAC5DnB,MAAM,CAACoD,UAAP,CAAkBb,QAD0C,CAAjC,CAE3BA,QAFF;AAGAvC,QAAAA,MAAM,CAACoD,UAAP,CAAkBb,QAAlB,GAA6BlB,+BAA+B,CAC1DrB,MAAM,CAACoD,UAAP,CAAkBb,QADwC,CAA/B,CAE3BA,QAFF;AAGD;AACF,KA9BD,MA8BO;AACL,YAAM,IAAIS,KAAJ,CAAU,qEAAV,CAAN;AACD;;AACD,WAAOhD,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'>): string | null {\n // Only add the native code changes if we know that the package is going to be linked natively.\n // This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)\n // but another app will not have it installed in the package.json, causing it to not be linked natively.\n // This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.\n return (\n !config._internal?.autolinkedModules ||\n config._internal.autolinkedModules.includes('react-native-maps')\n );\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"}
@@ -46,17 +46,26 @@ function setProvisioningProfileForPbxproj(projectRoot, {
46
46
  const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
47
47
  const nativeTargetEntry = targetName ? (0, _Target().findNativeTargetByName)(project, targetName) : (0, _Target().findFirstNativeTarget)(project);
48
48
  const [nativeTargetId, nativeTarget] = nativeTargetEntry;
49
+ const quotedAppleTeamId = ensureQuotes(appleTeamId);
49
50
  (0, _Xcodeproj().getBuildConfigurationsForListId)(project, nativeTarget.buildConfigurationList).filter(([, item]) => item.name === buildConfiguration).forEach(([, item]) => {
50
51
  item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `"${profileName}"`;
51
- item.buildSettings.DEVELOPMENT_TEAM = appleTeamId;
52
+ item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;
52
53
  item.buildSettings.CODE_SIGN_IDENTITY = '"iPhone Distribution"';
53
54
  item.buildSettings.CODE_SIGN_STYLE = 'Manual';
54
55
  });
55
56
  Object.entries((0, _Xcodeproj().getProjectSection)(project)).filter(_Xcodeproj().isNotComment).forEach(([, item]) => {
56
- item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = appleTeamId;
57
+ item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;
57
58
  item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';
58
59
  });
59
60
 
60
61
  _fsExtra().default.writeFileSync(project.filepath, project.writeSync());
61
62
  }
63
+
64
+ const ensureQuotes = value => {
65
+ if (!value.match(/^['"]/)) {
66
+ return `"${value}"`;
67
+ }
68
+
69
+ return value;
70
+ };
62
71
  //# sourceMappingURL=ProvisioningProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/ProvisioningProfile.ts"],"names":["setProvisioningProfileForPbxproj","projectRoot","targetName","profileName","appleTeamId","buildConfiguration","project","nativeTargetEntry","nativeTargetId","nativeTarget","buildConfigurationList","filter","item","name","forEach","buildSettings","PROVISIONING_PROFILE_SPECIFIER","DEVELOPMENT_TEAM","CODE_SIGN_IDENTITY","CODE_SIGN_STYLE","Object","entries","isNotComment","attributes","TargetAttributes","DevelopmentTeam","ProvisioningStyle","fs","writeFileSync","filepath","writeSync"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA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O,CAACuB,QAAzB,EAAmCvB,OAAO,CAACwB,SAAR,EAAnC;AACD","sourcesContent":["import fs from 'fs-extra';\n\nimport { findFirstNativeTarget, findNativeTargetByName } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n getPbxproj,\n getProjectSection,\n isNotComment,\n ProjectSectionEntry,\n} from './utils/Xcodeproj';\n\ntype ProvisioningProfileSettings = {\n targetName?: string;\n appleTeamId: string;\n profileName: string;\n buildConfiguration?: string;\n};\n\nexport function setProvisioningProfileForPbxproj(\n projectRoot: string,\n {\n targetName,\n profileName,\n appleTeamId,\n buildConfiguration = 'Release',\n }: ProvisioningProfileSettings\n): void {\n const project = getPbxproj(projectRoot);\n\n const nativeTargetEntry = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [nativeTargetId, nativeTarget] = nativeTargetEntry;\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList)\n .filter(([, item]: ConfigurationSectionEntry) => item.name === buildConfiguration)\n .forEach(([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `\"${profileName}\"`;\n item.buildSettings.DEVELOPMENT_TEAM = appleTeamId;\n item.buildSettings.CODE_SIGN_IDENTITY = '\"iPhone Distribution\"';\n item.buildSettings.CODE_SIGN_STYLE = 'Manual';\n });\n\n Object.entries(getProjectSection(project))\n .filter(isNotComment)\n .forEach(([, item]: ProjectSectionEntry) => {\n item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = appleTeamId;\n item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';\n });\n\n fs.writeFileSync(project.filepath, project.writeSync());\n}\n"],"file":"ProvisioningProfile.js"}
1
+ {"version":3,"sources":["../../src/ios/ProvisioningProfile.ts"],"names":["setProvisioningProfileForPbxproj","projectRoot","targetName","profileName","appleTeamId","buildConfiguration","project","nativeTargetEntry","nativeTargetId","nativeTarget","quotedAppleTeamId","ensureQuotes","buildConfigurationList","filter","item","name","forEach","buildSettings","PROVISIONING_PROFILE_SPECIFIER","DEVELOPMENT_TEAM","CODE_SIGN_IDENTITY","CODE_SIGN_STYLE","Object","entries","isNotComment","attributes","TargetAttributes","DevelopmentTeam","ProvisioningStyle","fs","writeFileSync","filepath","writeSync","value","match"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAgBO,SAASA,gCAAT,CACLC,WADK,EAEL;AACEC,EAAAA,UADF;AAEEC,EAAAA,WAFF;AAGEC,EAAAA,WAHF;AAIEC,EAAAA,kBAAkB,GAAG;AAJvB,CAFK,EAQC;AACN,QAAMC,OAAO,GAAG,6BAAWL,WAAX,CAAhB;AAEA,QAAMM,iBAAiB,GAAGL,UAAU,GAChC,sCAAuBI,OAAvB,EAAgCJ,UAAhC,CADgC,GAEhC,qCAAsBI,OAAtB,CAFJ;AAGA,QAAM,CAACE,cAAD,EAAiBC,YAAjB,IAAiCF,iBAAvC;AAEA,QAAMG,iBAAiB,GAAGC,YAAY,CAACP,WAAD,CAAtC;AAEA,oDAAgCE,OAAhC,EAAyCG,YAAY,CAACG,sBAAtD,EACGC,MADH,CACU,CAAC,GAAGC,IAAH,CAAD,KAAyCA,IAAI,CAACC,IAAL,KAAcV,kBADjE,EAEGW,OAFH,CAEW,CAAC,GAAGF,IAAH,CAAD,KAAyC;AAChDA,IAAAA,IAAI,CAACG,aAAL,CAAmBC,8BAAnB,GAAqD,IAAGf,WAAY,GAApE;AACAW,IAAAA,IAAI,CAACG,aAAL,CAAmBE,gBAAnB,GAAsCT,iBAAtC;AACAI,IAAAA,IAAI,CAACG,aAAL,CAAmBG,kBAAnB,GAAwC,uBAAxC;AACAN,IAAAA,IAAI,CAACG,aAAL,CAAmBI,eAAnB,GAAqC,QAArC;AACD,GAPH;AASAC,EAAAA,MAAM,CAACC,OAAP,CAAe,oCAAkBjB,OAAlB,CAAf,EACGO,MADH,CACUW,yBADV,EAEGR,OAFH,CAEW,CAAC,GAAGF,IAAH,CAAD,KAAmC;AAC1CA,IAAAA,IAAI,CAACW,UAAL,CAAgBC,gBAAhB,CAAiClB,cAAjC,EAAiDmB,eAAjD,GAAmEjB,iBAAnE;AACAI,IAAAA,IAAI,CAACW,UAAL,CAAgBC,gBAAhB,CAAiClB,cAAjC,EAAiDoB,iBAAjD,GAAqE,QAArE;AACD,GALH;;AAOAC,qBAAGC,aAAH,CAAiBxB,OAAO,CAACyB,QAAzB,EAAmCzB,OAAO,CAAC0B,SAAR,EAAnC;AACD;;AAED,MAAMrB,YAAY,GAAIsB,KAAD,IAAmB;AACtC,MAAI,CAACA,KAAK,CAACC,KAAN,CAAY,OAAZ,CAAL,EAA2B;AACzB,WAAQ,IAAGD,KAAM,GAAjB;AACD;;AACD,SAAOA,KAAP;AACD,CALD","sourcesContent":["import fs from 'fs-extra';\n\nimport { findFirstNativeTarget, findNativeTargetByName } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n getPbxproj,\n getProjectSection,\n isNotComment,\n ProjectSectionEntry,\n} from './utils/Xcodeproj';\n\ntype ProvisioningProfileSettings = {\n targetName?: string;\n appleTeamId: string;\n profileName: string;\n buildConfiguration?: string;\n};\n\nexport function setProvisioningProfileForPbxproj(\n projectRoot: string,\n {\n targetName,\n profileName,\n appleTeamId,\n buildConfiguration = 'Release',\n }: ProvisioningProfileSettings\n): void {\n const project = getPbxproj(projectRoot);\n\n const nativeTargetEntry = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [nativeTargetId, nativeTarget] = nativeTargetEntry;\n\n const quotedAppleTeamId = ensureQuotes(appleTeamId);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList)\n .filter(([, item]: ConfigurationSectionEntry) => item.name === buildConfiguration)\n .forEach(([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `\"${profileName}\"`;\n item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;\n item.buildSettings.CODE_SIGN_IDENTITY = '\"iPhone Distribution\"';\n item.buildSettings.CODE_SIGN_STYLE = 'Manual';\n });\n\n Object.entries(getProjectSection(project))\n .filter(isNotComment)\n .forEach(([, item]: ProjectSectionEntry) => {\n item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;\n item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';\n });\n\n fs.writeFileSync(project.filepath, project.writeSync());\n}\n\nconst ensureQuotes = (value: string) => {\n if (!value.match(/^['\"]/)) {\n return `\"${value}\"`;\n }\n return value;\n};\n"],"file":"ProvisioningProfile.js"}
@@ -32,6 +32,16 @@ function _Xcodeproj() {
32
32
  return data;
33
33
  }
34
34
 
35
+ function _string() {
36
+ const data = require("./utils/string");
37
+
38
+ _string = function () {
39
+ return data;
40
+ };
41
+
42
+ return data;
43
+ }
44
+
35
45
  let TargetType;
36
46
  exports.TargetType = TargetType;
37
47
 
@@ -59,7 +69,20 @@ async function findApplicationTargetWithDependenciesAsync(projectRoot, scheme) {
59
69
  const applicationTargetName = await (0, _BuildScheme().getApplicationTargetNameForSchemeAsync)(projectRoot, scheme);
60
70
  const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
61
71
  const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);
62
- const dependencies = applicationTarget.dependencies.map(({
72
+ const dependencies = getTargetDependencies(project, applicationTarget);
73
+ return {
74
+ name: (0, _string().trimQuotes)(applicationTarget.name),
75
+ type: TargetType.APPLICATION,
76
+ dependencies
77
+ };
78
+ }
79
+
80
+ function getTargetDependencies(project, parentTarget) {
81
+ if (!parentTarget.dependencies || parentTarget.dependencies.length === 0) {
82
+ return undefined;
83
+ }
84
+
85
+ return parentTarget.dependencies.map(({
63
86
  value
64
87
  }) => {
65
88
  const {
@@ -68,19 +91,15 @@ async function findApplicationTargetWithDependenciesAsync(projectRoot, scheme) {
68
91
  const [, target] = findNativeTargetById(project, targetId);
69
92
  const type = isTargetOfType(target, TargetType.EXTENSION) ? TargetType.EXTENSION : TargetType.OTHER;
70
93
  return {
71
- name: target.name,
72
- type
94
+ name: (0, _string().trimQuotes)(target.name),
95
+ type,
96
+ dependencies: getTargetDependencies(project, target)
73
97
  };
74
98
  });
75
- return {
76
- name: applicationTarget.name,
77
- type: TargetType.APPLICATION,
78
- dependencies
79
- };
80
99
  }
81
100
 
82
101
  function isTargetOfType(target, targetType) {
83
- return target.productType === targetType || target.productType === `"${targetType}"`;
102
+ return (0, _string().trimQuotes)(target.productType) === targetType;
84
103
  }
85
104
 
86
105
  function getNativeTargets(project) {
@@ -112,7 +131,7 @@ function findFirstNativeTarget(project) {
112
131
 
113
132
  function findNativeTargetByName(project, targetName) {
114
133
  const nativeTargets = getNativeTargets(project);
115
- const nativeTargetEntry = nativeTargets.find(([, i]) => i.name === targetName || i.name === `"${targetName}"`);
134
+ const nativeTargetEntry = nativeTargets.find(([, i]) => (0, _string().trimQuotes)(i.name) === targetName);
116
135
 
117
136
  if (!nativeTargetEntry) {
118
137
  throw new Error(`Could not find target '${targetName}' in project.pbxproj`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Target.ts"],"names":["TargetType","getXCBuildConfigurationFromPbxproj","project","targetName","buildConfiguration","nativeTarget","findNativeTargetByName","findFirstNativeTarget","xcBuildConfiguration","configurationListId","buildConfigurationList","findApplicationTargetWithDependenciesAsync","projectRoot","scheme","applicationTargetName","applicationTarget","dependencies","map","value","target","targetId","getPBXGroupByKeyAndType","findNativeTargetById","type","isTargetOfType","EXTENSION","OTHER","name","APPLICATION","targetType","productType","getNativeTargets","section","pbxNativeTargetSection","Object","entries","filter","isNotComment","findSignableTargets","targets","applicationTargets","WATCH","STICKER_PACK_EXTENSION","length","Error","nativeTargets","nativeTargetEntry","find","i","key"],"mappings":";;;;;;;;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sourcesContent":["import { PBXNativeTarget, PBXTargetDependency, XCBuildConfiguration, XcodeProject } from 'xcode';\n\nimport { getApplicationTargetNameForSchemeAsync } from './BuildScheme';\nimport {\n getBuildConfigurationForListIdAndName,\n getPbxproj,\n isNotComment,\n NativeTargetSectionEntry,\n} from './utils/Xcodeproj';\n\nexport enum TargetType {\n APPLICATION = 'com.apple.product-type.application',\n EXTENSION = 'com.apple.product-type.app-extension',\n WATCH = 'com.apple.product-type.application.watchapp',\n STICKER_PACK_EXTENSION = 'com.apple.product-type.app-extension.messages-sticker-pack',\n OTHER = 'other',\n}\n\nexport interface Target {\n name: string;\n type: TargetType;\n dependencies?: Target[];\n}\n\nexport function getXCBuildConfigurationFromPbxproj(\n project: XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string } = {}\n): XCBuildConfiguration | null {\n const [, nativeTarget] = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [, xcBuildConfiguration] = getBuildConfigurationForListIdAndName(project, {\n configurationListId: nativeTarget.buildConfigurationList,\n buildConfiguration,\n });\n return xcBuildConfiguration ?? null;\n}\n\nexport async function findApplicationTargetWithDependenciesAsync(\n projectRoot: string,\n scheme: string\n): Promise<Target> {\n const applicationTargetName = await getApplicationTargetNameForSchemeAsync(projectRoot, scheme);\n const project = getPbxproj(projectRoot);\n const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);\n\n const dependencies: Target[] = applicationTarget.dependencies.map(({ value }) => {\n const { target: targetId } = project.getPBXGroupByKeyAndType(\n value,\n 'PBXTargetDependency'\n ) as PBXTargetDependency;\n\n const [, target] = findNativeTargetById(project, targetId);\n\n const type = isTargetOfType(target, TargetType.EXTENSION)\n ? TargetType.EXTENSION\n : TargetType.OTHER;\n return {\n name: target.name,\n type,\n };\n });\n\n return {\n name: applicationTarget.name,\n type: TargetType.APPLICATION,\n dependencies,\n };\n}\n\nexport function isTargetOfType(target: PBXNativeTarget, targetType: TargetType): boolean {\n return target.productType === targetType || target.productType === `\"${targetType}\"`;\n}\n\nexport function getNativeTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const section = project.pbxNativeTargetSection();\n return Object.entries(section).filter(isNotComment);\n}\n\nexport function findSignableTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(\n ([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION) ||\n isTargetOfType(target, TargetType.EXTENSION) ||\n isTargetOfType(target, TargetType.WATCH) ||\n isTargetOfType(target, TargetType.STICKER_PACK_EXTENSION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any signable targets in project.pbxproj`);\n }\n return applicationTargets;\n}\n\nexport function findFirstNativeTarget(project: XcodeProject): NativeTargetSectionEntry {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any application target in project.pbxproj`);\n }\n return applicationTargets[0];\n}\n\nexport function findNativeTargetByName(\n project: XcodeProject,\n targetName: string\n): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(\n ([, i]) => i.name === targetName || i.name === `\"${targetName}\"`\n );\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target '${targetName}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n\nfunction findNativeTargetById(project: XcodeProject, targetId: string): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(([key]) => key === targetId);\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target with id '${targetId}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n"],"file":"Target.js"}
1
+ {"version":3,"sources":["../../src/ios/Target.ts"],"names":["TargetType","getXCBuildConfigurationFromPbxproj","project","targetName","buildConfiguration","nativeTarget","findNativeTargetByName","findFirstNativeTarget","xcBuildConfiguration","configurationListId","buildConfigurationList","findApplicationTargetWithDependenciesAsync","projectRoot","scheme","applicationTargetName","applicationTarget","dependencies","getTargetDependencies","name","type","APPLICATION","parentTarget","length","undefined","map","value","target","targetId","getPBXGroupByKeyAndType","findNativeTargetById","isTargetOfType","EXTENSION","OTHER","targetType","productType","getNativeTargets","section","pbxNativeTargetSection","Object","entries","filter","isNotComment","findSignableTargets","targets","applicationTargets","WATCH","STICKER_PACK_EXTENSION","Error","nativeTargets","nativeTargetEntry","find","i","key"],"mappings":";;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;IAEYA,U;;;WAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,0BAAAA,U;;AAcL,SAASC,kCAAT,CACLC,OADK,EAEL;AACEC,EAAAA,UADF;AAEEC,EAAAA,kBAAkB,GAAG;AAFvB,IAG0D,EALrD,EAMwB;AAC7B,QAAM,GAAGC,YAAH,IAAmBF,UAAU,GAC/BG,sBAAsB,CAACJ,OAAD,EAAUC,UAAV,CADS,GAE/BI,qBAAqB,CAACL,OAAD,CAFzB;AAGA,QAAM,GAAGM,oBAAH,IAA2B,wDAAsCN,OAAtC,EAA+C;AAC9EO,IAAAA,mBAAmB,EAAEJ,YAAY,CAACK,sBAD4C;AAE9EN,IAAAA;AAF8E,GAA/C,CAAjC;AAIA,SAAOI,oBAAP,aAAOA,oBAAP,cAAOA,oBAAP,GAA+B,IAA/B;AACD;;AAEM,eAAeG,0CAAf,CACLC,WADK,EAELC,MAFK,EAGY;AACjB,QAAMC,qBAAqB,GAAG,MAAM,2DAAuCF,WAAvC,EAAoDC,MAApD,CAApC;AACA,QAAMX,OAAO,GAAG,6BAAWU,WAAX,CAAhB;AACA,QAAM,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AM+C,iBAAiB,GAAGD,aAAa,CAACE,IAAd,CAAmB,CAAC,GAAGC,CAAH,CAAD,KAAW,0BAAWA,CAAC,CAACjC,IAAb,MAAuBf,UAArD,CAA1B;;AACA,MAAI,CAAC8C,iBAAL,EAAwB;AACtB,UAAM,IAAIF,KAAJ,CAAW,0BAAyB5C,UAAW,sBAA/C,CAAN;AACD;;AACD,SAAO8C,iBAAP;AACD;;AAED,SAASpB,oBAAT,CAA8B3B,OAA9B,EAAqDyB,QAArD,EAAiG;AAC/F,QAAMqB,aAAa,GAAGb,gBAAgB,CAACjC,OAAD,CAAtC;AACA,QAAM+C,iBAAiB,GAAGD,aAAa,CAACE,IAAd,CAAmB,CAAC,CAACE,GAAD,CAAD,KAAWA,GAAG,KAAKzB,QAAtC,CAA1B;;AACA,MAAI,CAACsB,iBAAL,EAAwB;AACtB,UAAM,IAAIF,KAAJ,CAAW,kCAAiCpB,QAAS,sBAArD,CAAN;AACD;;AACD,SAAOsB,iBAAP;AACD","sourcesContent":["import { PBXNativeTarget, PBXTargetDependency, XCBuildConfiguration, XcodeProject } from 'xcode';\n\nimport { getApplicationTargetNameForSchemeAsync } from './BuildScheme';\nimport {\n getBuildConfigurationForListIdAndName,\n getPbxproj,\n isNotComment,\n NativeTargetSectionEntry,\n} from './utils/Xcodeproj';\nimport { trimQuotes } from './utils/string';\n\nexport enum TargetType {\n APPLICATION = 'com.apple.product-type.application',\n EXTENSION = 'com.apple.product-type.app-extension',\n WATCH = 'com.apple.product-type.application.watchapp',\n STICKER_PACK_EXTENSION = 'com.apple.product-type.app-extension.messages-sticker-pack',\n OTHER = 'other',\n}\n\nexport interface Target {\n name: string;\n type: TargetType;\n dependencies?: Target[];\n}\n\nexport function getXCBuildConfigurationFromPbxproj(\n project: XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string } = {}\n): XCBuildConfiguration | null {\n const [, nativeTarget] = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [, xcBuildConfiguration] = getBuildConfigurationForListIdAndName(project, {\n configurationListId: nativeTarget.buildConfigurationList,\n buildConfiguration,\n });\n return xcBuildConfiguration ?? null;\n}\n\nexport async function findApplicationTargetWithDependenciesAsync(\n projectRoot: string,\n scheme: string\n): Promise<Target> {\n const applicationTargetName = await getApplicationTargetNameForSchemeAsync(projectRoot, scheme);\n const project = getPbxproj(projectRoot);\n const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);\n const dependencies = getTargetDependencies(project, applicationTarget);\n return {\n name: trimQuotes(applicationTarget.name),\n type: TargetType.APPLICATION,\n dependencies,\n };\n}\n\nfunction getTargetDependencies(\n project: XcodeProject,\n parentTarget: PBXNativeTarget\n): Target[] | undefined {\n if (!parentTarget.dependencies || parentTarget.dependencies.length === 0) {\n return undefined;\n }\n return parentTarget.dependencies.map(({ value }) => {\n const { target: targetId } = project.getPBXGroupByKeyAndType(\n value,\n 'PBXTargetDependency'\n ) as PBXTargetDependency;\n\n const [, target] = findNativeTargetById(project, targetId);\n\n const type = isTargetOfType(target, TargetType.EXTENSION)\n ? TargetType.EXTENSION\n : TargetType.OTHER;\n return {\n name: trimQuotes(target.name),\n type,\n dependencies: getTargetDependencies(project, target),\n };\n });\n}\n\nexport function isTargetOfType(target: PBXNativeTarget, targetType: TargetType): boolean {\n return trimQuotes(target.productType) === targetType;\n}\n\nexport function getNativeTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const section = project.pbxNativeTargetSection();\n return Object.entries(section).filter(isNotComment);\n}\n\nexport function findSignableTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(\n ([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION) ||\n isTargetOfType(target, TargetType.EXTENSION) ||\n isTargetOfType(target, TargetType.WATCH) ||\n isTargetOfType(target, TargetType.STICKER_PACK_EXTENSION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any signable targets in project.pbxproj`);\n }\n return applicationTargets;\n}\n\nexport function findFirstNativeTarget(project: XcodeProject): NativeTargetSectionEntry {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any application target in project.pbxproj`);\n }\n return applicationTargets[0];\n}\n\nexport function findNativeTargetByName(\n project: XcodeProject,\n targetName: string\n): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(([, i]) => trimQuotes(i.name) === targetName);\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target '${targetName}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n\nfunction findNativeTargetById(project: XcodeProject, targetId: string): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(([key]) => key === targetId);\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target with id '${targetId}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n"],"file":"Target.js"}
@@ -15,11 +15,11 @@ export declare enum Config {
15
15
  export declare function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null;
16
16
  export declare function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean;
17
17
  export declare function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number;
18
- export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>): 'NEVER' | 'ALWAYS';
18
+ export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>, expoUpdatesPackageVersion?: string | null): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS';
19
19
  export declare const withUpdates: ConfigPlugin<{
20
20
  expoUsername: string | null;
21
21
  }>;
22
- export declare function setUpdatesConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist, username: string | null): ExpoPlist;
22
+ export declare function setUpdatesConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist, username: string | null, expoUpdatesPackageVersion?: string | null): ExpoPlist;
23
23
  export declare function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist;
24
24
  interface ShellScriptBuildPhase {
25
25
  isa: 'PBXShellScriptBuildPhase';
@@ -38,6 +38,16 @@ function _resolveFrom() {
38
38
  return data;
39
39
  }
40
40
 
41
+ function _semver() {
42
+ const data = _interopRequireDefault(require("semver"));
43
+
44
+ _semver = function () {
45
+ return data;
46
+ };
47
+
48
+ return data;
49
+ }
50
+
41
51
  function _iosPlugins() {
42
52
  const data = require("../plugins/ios-plugins");
43
53
 
@@ -95,10 +105,15 @@ function getUpdatesTimeout(config) {
95
105
  return (_config$updates$fallb = (_config$updates2 = config.updates) === null || _config$updates2 === void 0 ? void 0 : _config$updates2.fallbackToCacheTimeout) !== null && _config$updates$fallb !== void 0 ? _config$updates$fallb : 0;
96
106
  }
97
107
 
98
- function getUpdatesCheckOnLaunch(config) {
108
+ function getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion) {
99
109
  var _config$updates3, _config$updates4;
100
110
 
101
111
  if (((_config$updates3 = config.updates) === null || _config$updates3 === void 0 ? void 0 : _config$updates3.checkAutomatically) === 'ON_ERROR_RECOVERY') {
112
+ // native 'ERROR_RECOVERY_ONLY' option was only introduced in 0.11.x
113
+ if (expoUpdatesPackageVersion && _semver().default.gte(expoUpdatesPackageVersion, '0.11.0')) {
114
+ return 'ERROR_RECOVERY_ONLY';
115
+ }
116
+
102
117
  return 'NEVER';
103
118
  } else if (((_config$updates4 = config.updates) === null || _config$updates4 === void 0 ? void 0 : _config$updates4.checkAutomatically) === 'ON_LOAD') {
104
119
  return 'ALWAYS';
@@ -111,17 +126,18 @@ const withUpdates = (config, {
111
126
  expoUsername
112
127
  }) => {
113
128
  return (0, _iosPlugins().withExpoPlist)(config, config => {
114
- config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);
129
+ const expoUpdatesPackageVersion = (0, _Updates().getExpoUpdatesPackageVersion)(config.modRequest.projectRoot);
130
+ config.modResults = setUpdatesConfig(config, config.modResults, expoUsername, expoUpdatesPackageVersion);
115
131
  return config;
116
132
  });
117
133
  };
118
134
 
119
135
  exports.withUpdates = withUpdates;
120
136
 
121
- function setUpdatesConfig(config, expoPlist, username) {
137
+ function setUpdatesConfig(config, expoPlist, username, expoUpdatesPackageVersion) {
122
138
  const newExpoPlist = { ...expoPlist,
123
139
  [Config.ENABLED]: getUpdatesEnabled(config),
124
- [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config),
140
+ [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion),
125
141
  [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config)
126
142
  };
127
143
  const updateUrl = (0, _Updates().getUpdateUrl)(config, username);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Updates.ts"],"names":["CREATE_MANIFEST_IOS_PATH","Config","getSDKVersion","config","sdkVersion","getUpdatesEnabled","updates","enabled","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","checkAutomatically","withUpdates","expoUsername","modResults","setUpdatesConfig","expoPlist","username","newExpoPlist","ENABLED","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","updateUrl","UPDATE_URL","setVersionsConfig","runtimeVersion","SDK_VERSION","RUNTIME_VERSION","formatConfigurationScriptPath","projectRoot","buildScriptPath","resolveFrom","silent","Error","relativePath","path","relative","join","process","platform","replace","getBundleReactNativePhase","project","shellScriptBuildPhase","hash","objects","PBXShellScriptBuildPhase","bundleReactNative","Object","values","find","buildPhase","name","ensureBundleReactNativePhaseContainsConfigurationScript","buildPhaseShellScriptPath","isShellScriptBuildPhaseConfigured","shellScript","includes","RegExp","isPlistConfigurationSet","Boolean","EXUpdatesURL","EXUpdatesSDKVersion","EXUpdatesRuntimeVersion","isPlistConfigurationSynced","EXUpdatesEnabled","EXUpdatesLaunchWaitMs","EXUpdatesCheckOnLaunch","isPlistVersionConfigurationSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAGA,MAAMA,wBAAwB,GAAG,6CAAjC;IAEYC,M;;;WAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;GAAAA,M,sBAAAA,M;;AAWL,SAASC,aAAT,CAAuBC,MAAvB,EAAqF;AAC1F,SAAO,OAAOA,MAAM,CAACC,UAAd,KAA6B,QAA7B,GAAwCD,MAAM,CAACC,UAA/C,GAA4D,IAAnE;AACD;;AAEM,SAASC,iBAAT,CAA2BF,MAA3B,EAAgF;AAAA;;AACrF,SAAO,oBAAAA,MAAM,CAACG,OAAP,oEAAgBC,OAAhB,MAA4B,KAAnC;AACD;;AAEM,SAASC,iBAAT,CAA2BL,MAA3B,EAAuE;AAAA;;AAC5E,sDAAOA,MAAM,CAACG,OAAd,qDAAO,iBAAgBG,sBAAvB,yEAAiD,CAAjD;AACD;;AAEM,SAASC,uBAAT,CACLP,MADK,EAEe;AAAA;;AACpB,MAAI,qBAAAA,MAAM,CAACG,OAAP,sEAAgBK,kBAAhB,MAAuC,mBAA3C,EAAgE;AAC9D,WAAO,OAAP;AACD,GAFD,MAEO,IAAI,qBAAAR,MAAM,CAACG,OAAP,sEAAgBK,kBAAhB,MAAuC,SAA3C,EAAsD;AAC3D,WAAO,QAAP;AACD;;AACD,SAAO,QAAP;AACD;;AAEM,MAAMC,WAA0D,GA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iD,gBADxC,IAEAzD,iBAAiB,CAACL,MAAD,CAAjB,KAA8Ba,SAAS,CAACkD,qBAFxC,IAGAxD,uBAAuB,CAACP,MAAD,CAAvB,KAAoCa,SAAS,CAACmD,sBAH9C,IAIAC,iCAAiC,CAACjE,MAAD,EAASa,SAAT,CALnC;AAOD;;AAEM,SAASoD,iCAAT,CACLjE,MADK,EAELa,SAFK,EAGI;AAAA;;AACT,QAAMqD,sBAAsB,GAAG,0CAA0BlE,MAA1B,EAAkC,KAAlC,CAA/B;AACA,QAAMmE,kBAAkB,GAAGpE,aAAa,CAACC,MAAD,CAAxC;AAEA,QAAMoE,qBAAqB,4BAAGvD,SAAS,CAAC+C,uBAAb,yEAAwC,IAAnE;AACA,QAAMS,iBAAiB,4BAAGxD,SAAS,CAAC8C,mBAAb,yEAAoC,IAA3D;;AAEA,MAAIO,sBAAsB,KAAK,IAA/B,EAAqC;AACnC,WAAOE,qBAAqB,KAAKF,sBAA1B,IAAoDG,iBAAiB,KAAK,IAAjF;AACD,GAFD,MAEO,IAAIF,kBAAkB,KAAK,IAA3B,EAAiC;AACtC,WAAOE,iBAAiB,KAAKF,kBAAtB,IAA4CC,qBAAqB,KAAK,IAA7E;AACD,GAFM,MAEA;AACL,WAAO,IAAP;AACD;AACF","sourcesContent":["import * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport xcode from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport { ExpoConfigUpdates, getRuntimeVersionNullable, getUpdateUrl } from '../utils/Updates';\nimport { ExpoPlist } from './IosConfig.types';\n\nconst CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n SDK_VERSION = 'EXUpdatesSDKVersion',\n UPDATE_URL = 'EXUpdatesURL',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n return config.updates?.enabled !== false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>) {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): 'NEVER' | 'ALWAYS' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n }\n return 'ALWAYS';\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withExpoPlist(config, config => {\n config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);\n return config;\n });\n};\n\nexport function setUpdatesConfig(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): ExpoPlist {\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config),\n [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config),\n };\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n return setVersionsConfig(config, newExpoPlist);\n}\n\nexport function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = getRuntimeVersionNullable(config, 'ios');\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n delete newExpoPlist[Config.SDK_VERSION];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else if (sdkVersion) {\n /**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\n delete newExpoPlist[Config.RUNTIME_VERSION];\n newExpoPlist[Config.SDK_VERSION] = sdkVersion;\n } else {\n delete newExpoPlist[Config.SDK_VERSION];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n\nfunction formatConfigurationScriptPath(projectRoot: string): string {\n const buildScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);\n\n if (!buildScriptPath) {\n throw new Error(\n \"Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);\n return process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n}\n\ninterface ShellScriptBuildPhase {\n isa: 'PBXShellScriptBuildPhase';\n name: string;\n shellScript: string;\n [key: string]: any;\n}\n\nexport function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase {\n const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase as Record<\n string,\n ShellScriptBuildPhase\n >;\n const bundleReactNative = Object.values(shellScriptBuildPhase).find(\n buildPhase => buildPhase.name === '\"Bundle React Native code and images\"'\n );\n\n if (!bundleReactNative) {\n throw new Error(`Couldn't find a build phase \"Bundle React Native code and images\"`);\n }\n\n return bundleReactNative;\n}\n\nexport function ensureBundleReactNativePhaseContainsConfigurationScript(\n projectRoot: string,\n project: xcode.XcodeProject\n): xcode.XcodeProject {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n\n if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {\n // check if there's already another path to create-manifest-ios.sh\n // this might be the case for monorepos\n if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {\n bundleReactNative.shellScript = bundleReactNative.shellScript.replace(\n new RegExp(`(\\\\\\\\n)(\\\\.\\\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`),\n ''\n );\n }\n bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(\n /\"$/,\n ''\n )}${buildPhaseShellScriptPath}\\\\n\"`;\n }\n return project;\n}\n\nexport function isShellScriptBuildPhaseConfigured(\n projectRoot: string,\n project: xcode.XcodeProject\n): boolean {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);\n}\n\nexport function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean {\n return Boolean(\n expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion)\n );\n}\n\nexport function isPlistConfigurationSynced(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&\n getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&\n getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&\n getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&\n isPlistVersionConfigurationSynced(config, expoPlist)\n );\n}\n\nexport function isPlistVersionConfigurationSynced(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n expoPlist: ExpoPlist\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config, 'ios');\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = expoPlist.EXUpdatesRuntimeVersion ?? null;\n const currentSdkVersion = expoPlist.EXUpdatesSDKVersion ?? null;\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"file":"Updates.js"}
1
+ {"version":3,"sources":["../../src/ios/Updates.ts"],"names":["CREATE_MANIFEST_IOS_PATH","Config","getSDKVersion","config","sdkVersion","getUpdatesEnabled","updates","enabled","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","expoUpdatesPackageVersion","checkAutomatically","semver","gte","withUpdates","expoUsername","modRequest","projectRoot","modResults","setUpdatesConfig","expoPlist","username","newExpoPlist","ENABLED","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","updateUrl","UPDATE_URL","setVersionsConfig","runtimeVersion","SDK_VERSION","RUNTIME_VERSION","formatConfigurationScriptPath","buildScriptPath","resolveFrom","silent","Error","relativePath","path","relative","join","process","platform","replace","getBundleReactNativePhase","project","shellScriptBuildPhase","hash","objects","PBXShellScriptBuildPhase","bundleReactNative","Object","values","find","buildPhase","name","ensureBundleReactNativePhaseContainsConfigurationScript","buildPhaseShellScriptPath","isShellScriptBuildPhaseConfigured","shellScript","includes","RegExp","isPlistConfigurationSet","Boolean","EXUpdatesURL","EXUpdatesSDKVersion","EXUpdatesRuntimeVersion","isPlistConfigurationSynced","EXUpdatesEnabled","EXUpdatesLaunchWaitMs","EXUpdatesCheckOnLaunch","isPlistVersionConfigurationSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAA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ADxC,IAEA7D,iBAAiB,CAACL,MAAD,CAAjB,KAA8BkB,SAAS,CAACiD,qBAFxC,IAGA5D,uBAAuB,CAACP,MAAD,CAAvB,KAAoCkB,SAAS,CAACkD,sBAH9C,IAIAC,iCAAiC,CAACrE,MAAD,EAASkB,SAAT,CALnC;AAOD;;AAEM,SAASmD,iCAAT,CACLrE,MADK,EAELkB,SAFK,EAGI;AAAA;;AACT,QAAMoD,sBAAsB,GAAG,0CAA0BtE,MAA1B,EAAkC,KAAlC,CAA/B;AACA,QAAMuE,kBAAkB,GAAGxE,aAAa,CAACC,MAAD,CAAxC;AAEA,QAAMwE,qBAAqB,4BAAGtD,SAAS,CAAC8C,uBAAb,yEAAwC,IAAnE;AACA,QAAMS,iBAAiB,4BAAGvD,SAAS,CAAC6C,mBAAb,yEAAoC,IAA3D;;AAEA,MAAIO,sBAAsB,KAAK,IAA/B,EAAqC;AACnC,WAAOE,qBAAqB,KAAKF,sBAA1B,IAAoDG,iBAAiB,KAAK,IAAjF;AACD,GAFD,MAEO,IAAIF,kBAAkB,KAAK,IAA3B,EAAiC;AACtC,WAAOE,iBAAiB,KAAKF,kBAAtB,IAA4CC,qBAAqB,KAAK,IAA7E;AACD,GAFM,MAEA;AACL,WAAO,IAAP;AACD;AACF","sourcesContent":["import * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\nimport xcode from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport {\n ExpoConfigUpdates,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullable,\n getUpdateUrl,\n} from '../utils/Updates';\nimport { ExpoPlist } from './IosConfig.types';\n\nconst CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n SDK_VERSION = 'EXUpdatesSDKVersion',\n UPDATE_URL = 'EXUpdatesURL',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n return config.updates?.enabled !== false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>) {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>,\n expoUpdatesPackageVersion?: string | null\n): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n // native 'ERROR_RECOVERY_ONLY' option was only introduced in 0.11.x\n if (expoUpdatesPackageVersion && semver.gte(expoUpdatesPackageVersion, '0.11.0')) {\n return 'ERROR_RECOVERY_ONLY';\n }\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n }\n return 'ALWAYS';\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withExpoPlist(config, config => {\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(config.modRequest.projectRoot);\n config.modResults = setUpdatesConfig(\n config,\n config.modResults,\n expoUsername,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nexport function setUpdatesConfig(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null,\n expoUpdatesPackageVersion?: string | null\n): ExpoPlist {\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion),\n [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config),\n };\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n return setVersionsConfig(config, newExpoPlist);\n}\n\nexport function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = getRuntimeVersionNullable(config, 'ios');\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n delete newExpoPlist[Config.SDK_VERSION];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else if (sdkVersion) {\n /**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\n delete newExpoPlist[Config.RUNTIME_VERSION];\n newExpoPlist[Config.SDK_VERSION] = sdkVersion;\n } else {\n delete newExpoPlist[Config.SDK_VERSION];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n\nfunction formatConfigurationScriptPath(projectRoot: string): string {\n const buildScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);\n\n if (!buildScriptPath) {\n throw new Error(\n \"Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);\n return process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n}\n\ninterface ShellScriptBuildPhase {\n isa: 'PBXShellScriptBuildPhase';\n name: string;\n shellScript: string;\n [key: string]: any;\n}\n\nexport function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase {\n const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase as Record<\n string,\n ShellScriptBuildPhase\n >;\n const bundleReactNative = Object.values(shellScriptBuildPhase).find(\n buildPhase => buildPhase.name === '\"Bundle React Native code and images\"'\n );\n\n if (!bundleReactNative) {\n throw new Error(`Couldn't find a build phase \"Bundle React Native code and images\"`);\n }\n\n return bundleReactNative;\n}\n\nexport function ensureBundleReactNativePhaseContainsConfigurationScript(\n projectRoot: string,\n project: xcode.XcodeProject\n): xcode.XcodeProject {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n\n if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {\n // check if there's already another path to create-manifest-ios.sh\n // this might be the case for monorepos\n if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {\n bundleReactNative.shellScript = bundleReactNative.shellScript.replace(\n new RegExp(`(\\\\\\\\n)(\\\\.\\\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`),\n ''\n );\n }\n bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(\n /\"$/,\n ''\n )}${buildPhaseShellScriptPath}\\\\n\"`;\n }\n return project;\n}\n\nexport function isShellScriptBuildPhaseConfigured(\n projectRoot: string,\n project: xcode.XcodeProject\n): boolean {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);\n}\n\nexport function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean {\n return Boolean(\n expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion)\n );\n}\n\nexport function isPlistConfigurationSynced(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&\n getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&\n getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&\n getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&\n isPlistVersionConfigurationSynced(config, expoPlist)\n );\n}\n\nexport function isPlistVersionConfigurationSynced(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n expoPlist: ExpoPlist\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config, 'ios');\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = expoPlist.EXUpdatesRuntimeVersion ?? null;\n const currentSdkVersion = expoPlist.EXUpdatesSDKVersion ?? null;\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"file":"Updates.js"}
@@ -0,0 +1 @@
1
+ export declare function trimQuotes(s: string): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.trimQuotes = trimQuotes;
7
+
8
+ function trimQuotes(s) {
9
+ return s && s[0] === '"' && s[s.length - 1] === '"' ? s.slice(1, -1) : s;
10
+ }
11
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ios/utils/string.ts"],"names":["trimQuotes","s","length","slice"],"mappings":";;;;;;;AAAO,SAASA,UAAT,CAAoBC,CAApB,EAAuC;AAC5C,SAAOA,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAD,KAAS,GAAd,IAAqBA,CAAC,CAACA,CAAC,CAACC,MAAF,GAAW,CAAZ,CAAD,KAAoB,GAAzC,GAA+CD,CAAC,CAACE,KAAF,CAAQ,CAAR,EAAW,CAAC,CAAZ,CAA/C,GAAgEF,CAAvE;AACD","sourcesContent":["export function trimQuotes(s: string): string {\n return s && s[0] === '\"' && s[s.length - 1] === '\"' ? s.slice(1, -1) : s;\n}\n"],"file":"string.js"}
@@ -1,5 +1,5 @@
1
1
  import type { ExpoConfig } from '@expo/config-types';
2
- import type { JSONObject } from '@expo/json-file';
2
+ import type { JSONObject, JSONValue } from '@expo/json-file';
3
3
  import type { XcodeProject } from 'xcode';
4
4
  import type { ConfigPlugin, Mod } from '../Plugin.types';
5
5
  import type { ExpoPlist, InfoPlist } from '../ios/IosConfig.types';
@@ -61,5 +61,5 @@ export declare const withXcodeProject: ConfigPlugin<Mod<XcodeProject>>;
61
61
  * @param config
62
62
  * @param action
63
63
  */
64
- export declare const withPodfileProperties: ConfigPlugin<Mod<Record<string, string>>>;
64
+ export declare const withPodfileProperties: ConfigPlugin<Mod<Record<string, JSONValue>>>;
65
65
  export {};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/ios-plugins.ts"],"names":["createInfoPlistPlugin","action","name","withUnknown","config","withInfoPlist","modResults","Object","defineProperty","value","createEntitlementsPlugin","withEntitlementsPlist","withAppDelegate","platform","mod","ios","infoPlist","entitlements","withExpoPlist","withXcodeProject","withPodfileProperties"],"mappings":";;;;;;;;;AAOA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAA+BC,MAA/B,EAA8DC,IAA9D,EAA2F;AAChG,QAAMC,WAAyB,GAAGC,MAAM,IACtCC,aAAa,CAACD,MAAD,EAAS,MAAMA,MAAN,IAAgB;AACpCA,IAAAA,MAAM,CAACE,UAAP,GAAoB,MAAML,MAAM,CAACG,MAAD,EAASA,MAAM,CAACE,UAAhB,CAAhC;AACA,WAAOF,MAAP;AACD,GAHY,CADf;;AAKA,MAAIF,IAAJ,EAAU;AACRK,IAAAA,MAAM,CAACC,cAAP,CAAsBL,WAAtB,EAAmC,MAAnC,EAA2C;AACzCM,MAAAA,KAAK,EAAEP;AADkC,KAA3C;AAGD;;AACD,SAAOC,WAAP;AACD;;AAID;AACA;AACA;AACA;AACA;AACO,SAASO,wBAAT,CACL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nimport type { JSONObject } from '@expo/json-file';\nimport type { XcodeProject } from 'xcode';\n\nimport type { ConfigPlugin, Mod } from '../Plugin.types';\nimport type { ExpoPlist, InfoPlist } from '../ios/IosConfig.types';\nimport type { AppDelegateProjectFile } from '../ios/Paths';\nimport { withMod } from './withMod';\n\ntype MutateInfoPlistAction = (expo: ExpoConfig, infoPlist: InfoPlist) => InfoPlist;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createInfoPlistPlugin(action: MutateInfoPlistAction, name?: string): ConfigPlugin {\n const withUnknown: ConfigPlugin = config =>\n withInfoPlist(config, async config => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\ntype MutateEntitlementsPlistAction = (expo: ExpoConfig, entitlements: JSONObject) => JSONObject;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createEntitlementsPlugin(\n action: MutateEntitlementsPlistAction,\n name: string\n): ConfigPlugin {\n const withUnknown: ConfigPlugin = config =>\n withEntitlementsPlist(config, async config => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * Provides the AppDelegate file for modification.\n *\n * @param config\n * @param action\n */\nexport const withAppDelegate: ConfigPlugin<Mod<AppDelegateProjectFile>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'appDelegate',\n action,\n });\n};\n\n/**\n * Provides the Info.plist file for modification.\n * Keeps the config's expo.ios.infoPlist object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withInfoPlist: ConfigPlugin<Mod<InfoPlist>> = (config, action) => {\n return withMod<InfoPlist>(config, {\n platform: 'ios',\n mod: 'infoPlist',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.infoPlist = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the main .entitlements file for modification.\n * Keeps the config's expo.ios.entitlements object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withEntitlementsPlist: ConfigPlugin<Mod<JSONObject>> = (config, action) => {\n return withMod<JSONObject>(config, {\n platform: 'ios',\n mod: 'entitlements',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.entitlements = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the Expo.plist for modification.\n *\n * @param config\n * @param action\n */\nexport const withExpoPlist: ConfigPlugin<Mod<ExpoPlist>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'expoPlist',\n action,\n });\n};\n\n/**\n * Provides the main .xcodeproj for modification.\n *\n * @param config\n * @param action\n */\nexport const withXcodeProject: ConfigPlugin<Mod<XcodeProject>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'xcodeproj',\n action,\n });\n};\n\n/**\n * Provides the Podfile.properties.json for modification.\n *\n * @param config\n * @param action\n */\nexport const withPodfileProperties: ConfigPlugin<Mod<Record<string, string>>> = (\n config,\n action\n) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'podfileProperties',\n action,\n });\n};\n"],"file":"ios-plugins.js"}
1
+ {"version":3,"sources":["../../src/plugins/ios-plugins.ts"],"names":["createInfoPlistPlugin","action","name","withUnknown","config","withInfoPlist","modResults","Object","defineProperty","value","createEntitlementsPlugin","withEntitlementsPlist","withAppDelegate","platform","mod","ios","infoPlist","entitlements","withExpoPlist","withXcodeProject","withPodfileProperties"],"mappings":";;;;;;;;;AAOA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAA+BC,MAA/B,EAA8DC,IAA9D,EAA2F;AAChG,QAAMC,WAAyB,GAAGC,MAAM,IACtCC,aAAa,CAACD,MAAD,EAAS,MAAMA,MAAN,IAAgB;AACpCA,IAAAA,MAAM,CAACE,UAAP,GAAoB,MAAML,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P;AAKD,CANM;AAQP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMmB,qBAAmE,GAAG,CACjFhB,MADiF,EAEjFH,MAFiF,KAG9E;AACH,SAAO,wBAAQG,MAAR,EAAgB;AACrBS,IAAAA,QAAQ,EAAE,KADW;AAErBC,IAAAA,GAAG,EAAE,mBAFgB;AAGrBb,IAAAA;AAHqB,GAAhB,CAAP;AAKD,CATM","sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport type { JSONObject, JSONValue } from '@expo/json-file';\nimport type { XcodeProject } from 'xcode';\n\nimport type { ConfigPlugin, Mod } from '../Plugin.types';\nimport type { ExpoPlist, InfoPlist } from '../ios/IosConfig.types';\nimport type { AppDelegateProjectFile } from '../ios/Paths';\nimport { withMod } from './withMod';\n\ntype MutateInfoPlistAction = (expo: ExpoConfig, infoPlist: InfoPlist) => InfoPlist;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createInfoPlistPlugin(action: MutateInfoPlistAction, name?: string): ConfigPlugin {\n const withUnknown: ConfigPlugin = config =>\n withInfoPlist(config, async config => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\ntype MutateEntitlementsPlistAction = (expo: ExpoConfig, entitlements: JSONObject) => JSONObject;\n\n/**\n * Helper method for creating mods from existing config functions.\n *\n * @param action\n */\nexport function createEntitlementsPlugin(\n action: MutateEntitlementsPlistAction,\n name: string\n): ConfigPlugin {\n const withUnknown: ConfigPlugin = config =>\n withEntitlementsPlist(config, async config => {\n config.modResults = await action(config, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * Provides the AppDelegate file for modification.\n *\n * @param config\n * @param action\n */\nexport const withAppDelegate: ConfigPlugin<Mod<AppDelegateProjectFile>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'appDelegate',\n action,\n });\n};\n\n/**\n * Provides the Info.plist file for modification.\n * Keeps the config's expo.ios.infoPlist object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withInfoPlist: ConfigPlugin<Mod<InfoPlist>> = (config, action) => {\n return withMod<InfoPlist>(config, {\n platform: 'ios',\n mod: 'infoPlist',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.infoPlist = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the main .entitlements file for modification.\n * Keeps the config's expo.ios.entitlements object in sync with the data.\n *\n * @param config\n * @param action\n */\nexport const withEntitlementsPlist: ConfigPlugin<Mod<JSONObject>> = (config, action) => {\n return withMod<JSONObject>(config, {\n platform: 'ios',\n mod: 'entitlements',\n async action(config) {\n config = await action(config);\n if (!config.ios) {\n config.ios = {};\n }\n config.ios.entitlements = config.modResults;\n return config;\n },\n });\n};\n\n/**\n * Provides the Expo.plist for modification.\n *\n * @param config\n * @param action\n */\nexport const withExpoPlist: ConfigPlugin<Mod<ExpoPlist>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'expoPlist',\n action,\n });\n};\n\n/**\n * Provides the main .xcodeproj for modification.\n *\n * @param config\n * @param action\n */\nexport const withXcodeProject: ConfigPlugin<Mod<XcodeProject>> = (config, action) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'xcodeproj',\n action,\n });\n};\n\n/**\n * Provides the Podfile.properties.json for modification.\n *\n * @param config\n * @param action\n */\nexport const withPodfileProperties: ConfigPlugin<Mod<Record<string, JSONValue>>> = (\n config,\n action\n) => {\n return withMod(config, {\n platform: 'ios',\n mod: 'podfileProperties',\n action,\n });\n};\n"],"file":"ios-plugins.js"}