@expo/config-plugins 9.0.14 → 9.0.15-canary-20250122-166c2cb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ios/Maps.js +21 -24
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/RequiresFullScreen.d.ts +0 -1
- package/build/ios/RequiresFullScreen.js +3 -29
- package/build/ios/RequiresFullScreen.js.map +1 -1
- package/build/ios/index.d.ts +1 -2
- package/build/ios/index.js +1 -14
- package/build/ios/index.js.map +1 -1
- package/build/utils/XML.js +3 -0
- package/build/utils/XML.js.map +1 -1
- package/package.json +6 -7
- package/build/ios/Swift.d.ts +0 -34
- package/build/ios/Swift.js +0 -196
- package/build/ios/Swift.js.map +0 -1
- package/build/utils/versions.d.ts +0 -3
- package/build/utils/versions.js +0 -42
- package/build/utils/versions.js.map +0 -1
package/build/ios/Maps.js
CHANGED
|
@@ -43,7 +43,7 @@ function _generateCode() {
|
|
|
43
43
|
}
|
|
44
44
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
45
45
|
const debug = require('debug')('expo:config-plugins:ios:maps');
|
|
46
|
-
const MATCH_INIT = exports.MATCH_INIT =
|
|
46
|
+
const MATCH_INIT = exports.MATCH_INIT = /\bsuper\.application\(\w+?, didFinishLaunchingWithOptions: \w+?\)/g;
|
|
47
47
|
const withGoogleMapsKey = (0, _iosPlugins().createInfoPlistPlugin)(setGoogleMapsApiKey, 'withGoogleMapsKey');
|
|
48
48
|
const withMaps = config => {
|
|
49
49
|
config = withGoogleMapsKey(config);
|
|
@@ -79,14 +79,13 @@ function setGoogleMapsApiKey(config, {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
function addGoogleMapsAppDelegateImport(src) {
|
|
82
|
-
const newSrc = [];
|
|
83
|
-
newSrc.push('#if __has_include(<GoogleMaps/GoogleMaps.h>)', '#import <GoogleMaps/GoogleMaps.h>', '#endif');
|
|
82
|
+
const newSrc = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif'];
|
|
84
83
|
return (0, _generateCode().mergeContents)({
|
|
85
84
|
tag: 'react-native-maps-import',
|
|
86
85
|
src,
|
|
87
86
|
newSrc: newSrc.join('\n'),
|
|
88
|
-
anchor:
|
|
89
|
-
offset:
|
|
87
|
+
anchor: /@UIApplicationMain/,
|
|
88
|
+
offset: 0,
|
|
90
89
|
comment: '//'
|
|
91
90
|
});
|
|
92
91
|
}
|
|
@@ -97,14 +96,13 @@ function removeGoogleMapsAppDelegateImport(src) {
|
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
function addGoogleMapsAppDelegateInit(src, apiKey) {
|
|
100
|
-
const newSrc = [];
|
|
101
|
-
newSrc.push('#if __has_include(<GoogleMaps/GoogleMaps.h>)', ` [GMSServices provideAPIKey:@"${apiKey}"];`, '#endif');
|
|
99
|
+
const newSrc = ['#if canImport(GoogleMaps)', `GMSServices.provideAPIKey("${apiKey}")`, '#endif'];
|
|
102
100
|
return (0, _generateCode().mergeContents)({
|
|
103
101
|
tag: 'react-native-maps-init',
|
|
104
102
|
src,
|
|
105
103
|
newSrc: newSrc.join('\n'),
|
|
106
104
|
anchor: MATCH_INIT,
|
|
107
|
-
offset:
|
|
105
|
+
offset: 0,
|
|
108
106
|
comment: '//'
|
|
109
107
|
});
|
|
110
108
|
}
|
|
@@ -187,24 +185,23 @@ const withGoogleMapsAppDelegate = (config, {
|
|
|
187
185
|
apiKey
|
|
188
186
|
}) => {
|
|
189
187
|
return (0, _iosPlugins().withAppDelegate)(config, config => {
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (error.code === 'ERR_NO_MATCH') {
|
|
197
|
-
throw new Error(`Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`);
|
|
198
|
-
}
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
} else {
|
|
202
|
-
config.modResults.contents = removeGoogleMapsAppDelegateImport(config.modResults.contents).contents;
|
|
203
|
-
config.modResults.contents = removeGoogleMapsAppDelegateInit(config.modResults.contents).contents;
|
|
204
|
-
}
|
|
205
|
-
} else {
|
|
188
|
+
if (!apiKey || !isReactNativeMapsAutolinked(config) || !isReactNativeMapsInstalled(config.modRequest.projectRoot)) {
|
|
189
|
+
config.modResults.contents = removeGoogleMapsAppDelegateImport(config.modResults.contents).contents;
|
|
190
|
+
config.modResults.contents = removeGoogleMapsAppDelegateInit(config.modResults.contents).contents;
|
|
191
|
+
return config;
|
|
192
|
+
}
|
|
193
|
+
if (config.modResults.language !== 'swift') {
|
|
206
194
|
throw new Error(`Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`);
|
|
207
195
|
}
|
|
196
|
+
try {
|
|
197
|
+
config.modResults.contents = addGoogleMapsAppDelegateImport(config.modResults.contents).contents;
|
|
198
|
+
config.modResults.contents = addGoogleMapsAppDelegateInit(config.modResults.contents, apiKey).contents;
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error.code === 'ERR_NO_MATCH') {
|
|
201
|
+
throw new Error(`Cannot add Google Maps to the project's AppDelegate because it's malformed. Please report this with a copy of your project AppDelegate.`);
|
|
202
|
+
}
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
208
205
|
return config;
|
|
209
206
|
});
|
|
210
207
|
};
|
package/build/ios/Maps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Maps.js","names":["_path","data","_interopRequireDefault","require","_resolveFrom","_iosPlugins","_generateCode","e","__esModule","default","debug","MATCH_INIT","exports","withGoogleMapsKey","createInfoPlistPlugin","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","push","mergeContents","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","removeContents","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","silent","path","dirname","isReactNativeMapsAutolinked","withPodfile","googleMapsPath","modRequest","isLinked","results","modResults","contents","error","code","Error","didMerge","didClear","withAppDelegate","includes","language"],"sources":["../../src/ios/Maps.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate, withPodfile } from '../plugins/ios-plugins';\nimport { mergeContents, MergeResults, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\nexport const MATCH_INIT =\n /-\\s*\\(BOOL\\)\\s*application:\\s*\\(UIApplication\\s*\\*\\s*\\)\\s*\\w+\\s+didFinishLaunchingWithOptions:/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: 2,\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 The contents of the Podfile.\n * @returns Podfile with Google Maps added.\n */\nexport function addMapsCocoaPods(src: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: File.dirname(\\`node --print \"require.resolve('react-native-maps/package.json')\"\\`)`,\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 // 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\n // TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.\n return true;\n\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 withPodfile(config, async (config) => {\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\n let results: MergeResults;\n\n if (isLinked && googleMapsPath && useGoogleMaps) {\n try {\n results = addMapsCocoaPods(config.modResults.contents);\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(config.modResults.contents);\n }\n\n if (results.didMerge || results.didClear) {\n config.modResults.contents = results.contents;\n }\n\n return config;\n });\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, (config) => {\n if (['objc', 'objcpp'].includes(config.modResults.language)) {\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: any) {\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(\n `Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`\n );\n }\n return config;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoF,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpF,MAAMG,KAAK,GAAGP,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,CAAuB;AAE7E,MAAMQ,UAAU,GAAAC,OAAA,CAAAD,UAAA,GACrB,iGAAiG;AAEnG,MAAME,iBAAiB,GAAG,IAAAC,mCAAqB,EAACC,mBAAmB,EAAE,mBAAmB,CAAC;AAElF,MAAMC,QAAsB,GAAIC,MAAM,IAAK;EAChDA,MAAM,GAAGJ,iBAAiB,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,CAAC/C,MAAM,CAACuC,UAAU,CAACS,QAAQ,CAAC,EAAE;MAC3D,IACE/C,MAAM,IACNgC,2BAA2B,CAACjC,MAAM,CAAC,IACnC0B,0BAA0B,CAAC1B,MAAM,CAACoC,UAAU,CAACT,WAAW,CAAC,EACzD;QACA,IAAI;UACF3B,MAAM,CAACuC,UAAU,CAACC,QAAQ,GAAG9B,8BAA8B,CACzDV,MAAM,CAACuC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;UACVxC,MAAM,CAACuC,UAAU,CAACC,QAAQ,GAAGlB,4BAA4B,CACvDtB,MAAM,CAACuC,UAAU,CAACC,QAAQ,EAC1BvC,MACF,CAAC,CAACuC,QAAQ;QACZ,CAAC,CAAC,OAAOC,KAAU,EAAE;UACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,cAAc,EAAE;YACjC,MAAM,IAAIC,KAAK,CACb,yIACF,CAAC;UACH;UACA,MAAMF,KAAK;QACb;MACF,CAAC,MAAM;QACLzC,MAAM,CAACuC,UAAU,CAACC,QAAQ,GAAGpB,iCAAiC,CAC5DpB,MAAM,CAACuC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;QACVxC,MAAM,CAACuC,UAAU,CAACC,QAAQ,GAAGjB,+BAA+B,CAC1DvB,MAAM,CAACuC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACZ;IACF,CAAC,MAAM;MACL,MAAM,IAAIG,KAAK,CACb,yFAAyF3C,MAAM,CAACuC,UAAU,CAACS,QAAQ,EACrH,CAAC;IACH;IACA,OAAOhD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Maps.js","names":["_path","data","_interopRequireDefault","require","_resolveFrom","_iosPlugins","_generateCode","e","__esModule","default","debug","MATCH_INIT","exports","withGoogleMapsKey","createInfoPlistPlugin","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","mergeContents","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","removeContents","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","silent","path","dirname","isReactNativeMapsAutolinked","withPodfile","googleMapsPath","modRequest","isLinked","results","modResults","contents","error","code","Error","didMerge","didClear","withAppDelegate","language"],"sources":["../../src/ios/Maps.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate, withPodfile } from '../plugins/ios-plugins';\nimport { mergeContents, MergeResults, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\nexport const MATCH_INIT = /\\bsuper\\.application\\(\\w+?, didFinishLaunchingWithOptions: \\w+?\\)/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 = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif'];\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /@UIApplicationMain/,\n offset: 0,\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 = ['#if canImport(GoogleMaps)', `GMSServices.provideAPIKey(\"${apiKey}\")`, '#endif'];\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 The contents of the Podfile.\n * @returns Podfile with Google Maps added.\n */\nexport function addMapsCocoaPods(src: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: File.dirname(\\`node --print \"require.resolve('react-native-maps/package.json')\"\\`)`,\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 // 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\n // TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.\n return true;\n\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 withPodfile(config, async (config) => {\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\n let results: MergeResults;\n\n if (isLinked && googleMapsPath && useGoogleMaps) {\n try {\n results = addMapsCocoaPods(config.modResults.contents);\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(config.modResults.contents);\n }\n\n if (results.didMerge || results.didClear) {\n config.modResults.contents = results.contents;\n }\n\n return config;\n });\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, (config) => {\n if (\n !apiKey ||\n !isReactNativeMapsAutolinked(config) ||\n !isReactNativeMapsInstalled(config.modRequest.projectRoot)\n ) {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n return config;\n }\n\n if (config.modResults.language !== 'swift') {\n throw new Error(\n `Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`\n );\n }\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: any) {\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 return config;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoF,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpF,MAAMG,KAAK,GAAGP,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,CAAuB;AAE7E,MAAMQ,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,oEAAoE;AAE9F,MAAME,iBAAiB,GAAG,IAAAC,mCAAqB,EAACC,mBAAmB,EAAE,mBAAmB,CAAC;AAElF,MAAMC,QAAsB,GAAIC,MAAM,IAAK;EAChDA,MAAM,GAAGJ,iBAAiB,CAACI,MAAM,CAAC;EAElC,MAAMC,MAAM,GAAGC,mBAAmB,CAACF,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AGpB,iCAAiC,CAC5DnB,MAAM,CAACsC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACVvC,MAAM,CAACsC,UAAU,CAACC,QAAQ,GAAGjB,+BAA+B,CAC1DtB,MAAM,CAACsC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACV,OAAOvC,MAAM;IACf;IAEA,IAAIA,MAAM,CAACsC,UAAU,CAACQ,QAAQ,KAAK,OAAO,EAAE;MAC1C,MAAM,IAAIJ,KAAK,CACb,yFAAyF1C,MAAM,CAACsC,UAAU,CAACQ,QAAQ,EACrH,CAAC;IACH;IAEA,IAAI;MACF9C,MAAM,CAACsC,UAAU,CAACC,QAAQ,GAAG7B,8BAA8B,CACzDV,MAAM,CAACsC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACVvC,MAAM,CAACsC,UAAU,CAACC,QAAQ,GAAGlB,4BAA4B,CACvDrB,MAAM,CAACsC,UAAU,CAACC,QAAQ,EAC1BtC,MACF,CAAC,CAACsC,QAAQ;IACZ,CAAC,CAAC,OAAOC,KAAU,EAAE;MACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,cAAc,EAAE;QACjC,MAAM,IAAIC,KAAK,CACb,yIACF,CAAC;MACH;MACA,MAAMF,KAAK;IACb;IACA,OAAOxC,MAAM;EACf,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
import { InfoPlist } from './IosConfig.types';
|
|
3
3
|
export declare const withRequiresFullScreen: import("..").ConfigPlugin;
|
|
4
|
-
export declare function getRequiresFullScreen(config: Pick<ExpoConfig, 'ios' | 'sdkVersion'>): boolean;
|
|
5
4
|
export declare function setRequiresFullScreen(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getRequiresFullScreen = getRequiresFullScreen;
|
|
7
6
|
exports.setRequiresFullScreen = setRequiresFullScreen;
|
|
8
7
|
exports.withRequiresFullScreen = void 0;
|
|
9
8
|
function _iosPlugins() {
|
|
@@ -13,13 +12,6 @@ function _iosPlugins() {
|
|
|
13
12
|
};
|
|
14
13
|
return data;
|
|
15
14
|
}
|
|
16
|
-
function _versions() {
|
|
17
|
-
const data = require("../utils/versions");
|
|
18
|
-
_versions = function () {
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
15
|
function _warnings() {
|
|
24
16
|
const data = require("../utils/warnings");
|
|
25
17
|
_warnings = function () {
|
|
@@ -28,25 +20,6 @@ function _warnings() {
|
|
|
28
20
|
return data;
|
|
29
21
|
}
|
|
30
22
|
const withRequiresFullScreen = exports.withRequiresFullScreen = (0, _iosPlugins().createInfoPlistPlugin)(setRequiresFullScreen, 'withRequiresFullScreen');
|
|
31
|
-
|
|
32
|
-
// NOTES: This is defaulted to `true` for now to match the behavior prior to SDK
|
|
33
|
-
// 34, but will change to `false` in SDK +43.
|
|
34
|
-
function getRequiresFullScreen(config) {
|
|
35
|
-
// Yes, the property is called ios.requireFullScreen, without the s - not "requires"
|
|
36
|
-
// This is confusing indeed because the actual property name does have the s
|
|
37
|
-
if (config.ios?.hasOwnProperty('requireFullScreen')) {
|
|
38
|
-
return !!config.ios.requireFullScreen;
|
|
39
|
-
} else {
|
|
40
|
-
// In SDK 43, the `requireFullScreen` default has been changed to false.
|
|
41
|
-
if ((0, _versions().gteSdkVersion)(config, '43.0.0')
|
|
42
|
-
// TODO: Uncomment after SDK 43 is released.
|
|
43
|
-
// || !config.sdkVersion
|
|
44
|
-
) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
23
|
const iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad';
|
|
51
24
|
const requiredIPadInterface = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight'];
|
|
52
25
|
function isStringArray(value) {
|
|
@@ -82,8 +55,9 @@ function resolveExistingIpadInterfaceOrientations(interfaceOrientations) {
|
|
|
82
55
|
|
|
83
56
|
// Whether requires full screen on iPad
|
|
84
57
|
function setRequiresFullScreen(config, infoPlist) {
|
|
85
|
-
const requiresFullScreen =
|
|
86
|
-
|
|
58
|
+
const requiresFullScreen = !!config.ios?.requireFullScreen;
|
|
59
|
+
const isTabletEnabled = config.ios?.supportsTablet || config.ios?.isTabletOnly;
|
|
60
|
+
if (isTabletEnabled && !requiresFullScreen) {
|
|
87
61
|
const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]);
|
|
88
62
|
|
|
89
63
|
// There currently exists no mechanism to safely undo this feature besides `npx expo prebuild --clear`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequiresFullScreen.js","names":["_iosPlugins","data","require","
|
|
1
|
+
{"version":3,"file":"RequiresFullScreen.js","names":["_iosPlugins","data","require","_warnings","withRequiresFullScreen","exports","createInfoPlistPlugin","setRequiresFullScreen","iPadInterfaceKey","requiredIPadInterface","isStringArray","value","Array","isArray","every","hasMinimumOrientations","masks","mask","includes","resolveExistingIpadInterfaceOrientations","interfaceOrientations","length","existingList","join","addWarningIOS","config","infoPlist","requiresFullScreen","ios","requireFullScreen","isTabletEnabled","supportsTablet","isTabletOnly","existing","Set","concat","UIRequiresFullScreen"],"sources":["../../src/ios/RequiresFullScreen.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { addWarningIOS } from '../utils/warnings';\n\nexport const withRequiresFullScreen = createInfoPlistPlugin(\n setRequiresFullScreen,\n 'withRequiresFullScreen'\n);\n\nconst iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad';\n\nconst requiredIPadInterface = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction isStringArray(value: any): value is string[] {\n return Array.isArray(value) && value.every((value) => typeof value === 'string');\n}\n\nfunction hasMinimumOrientations(masks: string[]): boolean {\n return requiredIPadInterface.every((mask) => masks.includes(mask));\n}\n\n/**\n * Require full screen being disabled requires all ipad interfaces to to be added,\n * otherwise submissions to the iOS App Store will fail.\n *\n * ERROR ITMS-90474: \"Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown' in bundle 'com.bacon.app'.\"\n *\n * @param interfaceOrientations\n * @returns\n */\nfunction resolveExistingIpadInterfaceOrientations(interfaceOrientations: any): string[] {\n if (\n // Ensure type.\n isStringArray(interfaceOrientations) &&\n // Don't warn if it's an empty array, this is invalid regardless.\n interfaceOrientations.length &&\n // Check if the minimum requirements are met.\n !hasMinimumOrientations(interfaceOrientations)\n ) {\n const existingList = interfaceOrientations!.join(', ');\n addWarningIOS(\n 'ios.requireFullScreen',\n `iPad multitasking requires all \\`${iPadInterfaceKey}\\` orientations to be defined in the Info.plist. The Info.plist currently defines values that are incompatible with multitasking, these will be overwritten to prevent submission failure. Existing: ${existingList}`\n );\n return interfaceOrientations;\n }\n return [];\n}\n\n// Whether requires full screen on iPad\nexport function setRequiresFullScreen(\n config: Pick<ExpoConfig, 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const requiresFullScreen = !!config.ios?.requireFullScreen;\n const isTabletEnabled = config.ios?.supportsTablet || config.ios?.isTabletOnly;\n if (isTabletEnabled && !requiresFullScreen) {\n const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]);\n\n // There currently exists no mechanism to safely undo this feature besides `npx expo prebuild --clear`,\n // this seems ok though because anyone using `UISupportedInterfaceOrientations~ipad` probably\n // wants them to be defined to this value anyways. This is also the default value used in the Xcode iOS template.\n\n // Merge any previous interfaces with the required interfaces.\n infoPlist[iPadInterfaceKey] = [...new Set(existing.concat(requiredIPadInterface))];\n }\n\n return {\n ...infoPlist,\n UIRequiresFullScreen: requiresFullScreen,\n };\n}\n"],"mappings":";;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,mCAAqB,EACzDC,qBAAqB,EACrB,wBACF,CAAC;AAED,MAAMC,gBAAgB,GAAG,uCAAuC;AAEhE,MAAMC,qBAAqB,GAAG,CAC5B,gCAAgC,EAChC,0CAA0C,EAC1C,qCAAqC,EACrC,sCAAsC,CACvC;AAED,SAASC,aAAaA,CAACC,KAAU,EAAqB;EACpD,OAAOC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,KAAK,CAAEH,KAAK,IAAK,OAAOA,KAAK,KAAK,QAAQ,CAAC;AAClF;AAEA,SAASI,sBAAsBA,CAACC,KAAe,EAAW;EACxD,OAAOP,qBAAqB,CAACK,KAAK,CAAEG,IAAI,IAAKD,KAAK,CAACE,QAAQ,CAACD,IAAI,CAAC,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,wCAAwCA,CAACC,qBAA0B,EAAY;EACtF;EACE;EACAV,aAAa,CAACU,qBAAqB,CAAC;EACpC;EACAA,qBAAqB,CAACC,MAAM;EAC5B;EACA,CAACN,sBAAsB,CAACK,qBAAqB,CAAC,EAC9C;IACA,MAAME,YAAY,GAAGF,qBAAqB,CAAEG,IAAI,CAAC,IAAI,CAAC;IACtD,IAAAC,yBAAa,EACX,uBAAuB,EACvB,oCAAoChB,gBAAgB,wMAAwMc,YAAY,EAC1Q,CAAC;IACD,OAAOF,qBAAqB;EAC9B;EACA,OAAO,EAAE;AACX;;AAEA;AACO,SAASb,qBAAqBA,CACnCkB,MAA+B,EAC/BC,SAAoB,EACT;EACX,MAAMC,kBAAkB,GAAG,CAAC,CAACF,MAAM,CAACG,GAAG,EAAEC,iBAAiB;EAC1D,MAAMC,eAAe,GAAGL,MAAM,CAACG,GAAG,EAAEG,cAAc,IAAIN,MAAM,CAACG,GAAG,EAAEI,YAAY;EAC9E,IAAIF,eAAe,IAAI,CAACH,kBAAkB,EAAE;IAC1C,MAAMM,QAAQ,GAAGd,wCAAwC,CAACO,SAAS,CAAClB,gBAAgB,CAAC,CAAC;;IAEtF;IACA;IACA;;IAEA;IACAkB,SAAS,CAAClB,gBAAgB,CAAC,GAAG,CAAC,GAAG,IAAI0B,GAAG,CAACD,QAAQ,CAACE,MAAM,CAAC1B,qBAAqB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAO;IACL,GAAGiB,SAAS;IACZU,oBAAoB,EAAET;EACxB,CAAC;AACH","ignoreList":[]}
|
package/build/ios/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ import * as PrivacyInfo from './PrivacyInfo';
|
|
|
17
17
|
import * as ProvisioningProfile from './ProvisioningProfile';
|
|
18
18
|
import * as RequiresFullScreen from './RequiresFullScreen';
|
|
19
19
|
import * as Scheme from './Scheme';
|
|
20
|
-
import * as Swift from './Swift';
|
|
21
20
|
import * as Target from './Target';
|
|
22
21
|
import * as Updates from './Updates';
|
|
23
22
|
import * as UsesNonExemptEncryption from './UsesNonExemptEncryption';
|
|
@@ -25,4 +24,4 @@ import * as Version from './Version';
|
|
|
25
24
|
import * as XcodeProjectFile from './XcodeProjectFile';
|
|
26
25
|
import * as XcodeUtils from './utils/Xcodeproj';
|
|
27
26
|
export { InfoPlist, ExpoPlist, Entitlements, Paths, Permissions, XcodeUtils };
|
|
28
|
-
export { Bitcode, BundleIdentifier, BuildProperties, BuildScheme, DevelopmentTeam, DeviceFamily, Google, Maps, Locales, Name, Orientation, ProvisioningProfile, RequiresFullScreen, Scheme,
|
|
27
|
+
export { Bitcode, BundleIdentifier, BuildProperties, BuildScheme, DevelopmentTeam, DeviceFamily, Google, Maps, Locales, Name, Orientation, ProvisioningProfile, RequiresFullScreen, Scheme, Target, Updates, UsesNonExemptEncryption, Version, XcodeProjectFile, PrivacyInfo, };
|
package/build/ios/index.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "InfoPlist", {
|
|
|
17
17
|
return _IosConfig().InfoPlist;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
exports.XcodeUtils = exports.XcodeProjectFile = exports.Version = exports.UsesNonExemptEncryption = exports.Updates = exports.Target = exports.
|
|
20
|
+
exports.XcodeUtils = exports.XcodeProjectFile = exports.Version = exports.UsesNonExemptEncryption = exports.Updates = exports.Target = exports.Scheme = exports.RequiresFullScreen = exports.ProvisioningProfile = exports.PrivacyInfo = exports.Permissions = exports.Paths = exports.Orientation = exports.Name = exports.Maps = exports.Locales = void 0;
|
|
21
21
|
function Bitcode() {
|
|
22
22
|
const data = _interopRequireWildcard(require("./Bitcode"));
|
|
23
23
|
Bitcode = function () {
|
|
@@ -259,19 +259,6 @@ Object.defineProperty(exports, "Scheme", {
|
|
|
259
259
|
return Scheme();
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
|
-
function Swift() {
|
|
263
|
-
const data = _interopRequireWildcard(require("./Swift"));
|
|
264
|
-
Swift = function () {
|
|
265
|
-
return data;
|
|
266
|
-
};
|
|
267
|
-
return data;
|
|
268
|
-
}
|
|
269
|
-
Object.defineProperty(exports, "Swift", {
|
|
270
|
-
enumerable: true,
|
|
271
|
-
get: function () {
|
|
272
|
-
return Swift();
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
262
|
function Target() {
|
|
276
263
|
const data = _interopRequireWildcard(require("./Target"));
|
|
277
264
|
Target = function () {
|
package/build/ios/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Bitcode","data","_interopRequireWildcard","require","Object","defineProperty","exports","enumerable","get","BuildProperties","BuildScheme","BundleIdentifier","DevelopmentTeam","DeviceFamily","Entitlements","Google","_IosConfig","Locales","Maps","Name","Orientation","Paths","Permissions","PrivacyInfo","ProvisioningProfile","RequiresFullScreen","Scheme","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Bitcode","data","_interopRequireWildcard","require","Object","defineProperty","exports","enumerable","get","BuildProperties","BuildScheme","BundleIdentifier","DevelopmentTeam","DeviceFamily","Entitlements","Google","_IosConfig","Locales","Maps","Name","Orientation","Paths","Permissions","PrivacyInfo","ProvisioningProfile","RequiresFullScreen","Scheme","Target","Updates","UsesNonExemptEncryption","Version","XcodeProjectFile","XcodeUtils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/ios/index.ts"],"sourcesContent":["import * as Bitcode from './Bitcode';\nimport * as BuildProperties from './BuildProperties';\nimport * as BuildScheme from './BuildScheme';\nimport * as BundleIdentifier from './BundleIdentifier';\nimport * as DevelopmentTeam from './DevelopmentTeam';\nimport * as DeviceFamily from './DeviceFamily';\nimport * as Entitlements from './Entitlements';\nimport * as Google from './Google';\nimport { ExpoPlist, InfoPlist } from './IosConfig.types';\nimport * as Locales from './Locales';\nimport * as Maps from './Maps';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as PrivacyInfo from './PrivacyInfo';\nimport * as ProvisioningProfile from './ProvisioningProfile';\nimport * as RequiresFullScreen from './RequiresFullScreen';\nimport * as Scheme from './Scheme';\nimport * as Target from './Target';\nimport * as Updates from './Updates';\nimport * as UsesNonExemptEncryption from './UsesNonExemptEncryption';\nimport * as Version from './Version';\nimport * as XcodeProjectFile from './XcodeProjectFile';\nimport * as XcodeUtils from './utils/Xcodeproj';\n\n// We can change this to export * as X with TypeScript 3.8+\n// https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#export-star-as-namespace-syntax\n// .. but we should wait for this to be the default VSCode version.\nexport { InfoPlist, ExpoPlist, Entitlements, Paths, Permissions, XcodeUtils };\n\nexport {\n Bitcode,\n BundleIdentifier,\n BuildProperties,\n BuildScheme,\n DevelopmentTeam,\n DeviceFamily,\n Google,\n Maps,\n Locales,\n Name,\n Orientation,\n ProvisioningProfile,\n RequiresFullScreen,\n Scheme,\n Target,\n Updates,\n UsesNonExemptEncryption,\n Version,\n XcodeProjectFile,\n PrivacyInfo,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqCG,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAR,OAAA;EAAA;AAAA;AACrC,SAAAS,gBAAA;EAAA,MAAAR,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAM,eAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqDG,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAC,eAAA;EAAA;AAAA;AACrD,SAAAC,YAAA;EAAA,MAAAT,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,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAA7B,GAAA,CAAA0B,CAAA,OAAAO,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAvC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAwC,wBAAA,WAAAC,CAAA,IAAAX,CAAA,oBAAAW,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAb,CAAA,EAAAW,CAAA,SAAAG,CAAA,GAAAL,CAAA,GAAAvC,MAAA,CAAAwC,wBAAA,CAAAV,CAAA,EAAAW,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAxC,GAAA,IAAAwC,CAAA,CAAAC,GAAA,IAAA7C,MAAA,CAAAC,cAAA,CAAAoC,CAAA,EAAAI,CAAA,EAAAG,CAAA,IAAAP,CAAA,CAAAI,CAAA,IAAAX,CAAA,CAAAW,CAAA,YAAAJ,CAAA,CAAAF,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAY,GAAA,CAAAf,CAAA,EAAAO,CAAA,GAAAA,CAAA","ignoreList":[]}
|
package/build/utils/XML.js
CHANGED
|
@@ -67,6 +67,9 @@ function _processAndroidXML(manifest) {
|
|
|
67
67
|
if (string.$.translatable === 'false' || string.$.translatable === false) {
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
|
+
if (!('_' in string)) {
|
|
71
|
+
throw new Error(`Empty string resource not supported: ${JSON.stringify(string)}`);
|
|
72
|
+
}
|
|
70
73
|
string._ = unescapeAndroidString(string._);
|
|
71
74
|
}
|
|
72
75
|
}
|
package/build/utils/XML.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XML.js","names":["_fs","data","_interopRequireDefault","require","_os","_path","_xml2js","e","__esModule","default","writeXMLAsync","options","xml","format","fs","promises","mkdir","path","dirname","recursive","writeFile","readXMLAsync","contents","readFile","encoding","flag","parser","Parser","manifest","parseStringPromise","fallback","_processAndroidXML","Array","isArray","resources","string","$","translatable","_","unescapeAndroidString","parseXMLAsync","stringTimesN","n","char","join","indentLevel","newline","EOL","xmlInput","toString","builder","Builder","headless","escapeAndroidString","buildObject","
|
|
1
|
+
{"version":3,"file":"XML.js","names":["_fs","data","_interopRequireDefault","require","_os","_path","_xml2js","e","__esModule","default","writeXMLAsync","options","xml","format","fs","promises","mkdir","path","dirname","recursive","writeFile","readXMLAsync","contents","readFile","encoding","flag","parser","Parser","manifest","parseStringPromise","fallback","_processAndroidXML","Array","isArray","resources","string","$","translatable","Error","JSON","stringify","_","unescapeAndroidString","parseXMLAsync","stringTimesN","n","char","join","indentLevel","newline","EOL","xmlInput","toString","builder","Builder","headless","escapeAndroidString","buildObject","indentString","formatted","regex","replace","pad","split","map","line","trim","forEach","indent","match","padding","value","m"],"sources":["../../src/utils/XML.ts"],"sourcesContent":["import fs from 'fs';\nimport { EOL } from 'os';\nimport path from 'path';\nimport { Builder, Parser } from 'xml2js';\n\nexport type XMLValue = boolean | number | string | null | XMLArray | XMLObject;\n\nexport interface XMLArray extends Array<XMLValue> {}\n\nexport interface XMLObject {\n [key: string]: XMLValue | undefined;\n}\n\nexport async function writeXMLAsync(options: { path: string; xml: any }): Promise<void> {\n const xml = format(options.xml);\n await fs.promises.mkdir(path.dirname(options.path), { recursive: true });\n await fs.promises.writeFile(options.path, xml);\n}\n\nexport async function readXMLAsync(options: {\n path: string;\n fallback?: string | null;\n}): Promise<XMLObject> {\n let contents: string = '';\n try {\n contents = await fs.promises.readFile(options.path, { encoding: 'utf8', flag: 'r' });\n } catch {\n // catch and use fallback\n }\n const parser = new Parser();\n const manifest = await parser.parseStringPromise(contents || options.fallback || '');\n\n return _processAndroidXML(manifest);\n}\n\nexport function _processAndroidXML(manifest: any): XMLObject {\n // For strings.xml\n if (Array.isArray(manifest?.resources?.string)) {\n for (const string of manifest?.resources?.string) {\n if (string.$.translatable === 'false' || string.$.translatable === false) {\n continue;\n }\n\n if (!('_' in string)) {\n throw new Error(`Empty string resource not supported: ${JSON.stringify(string)}`);\n }\n\n string._ = unescapeAndroidString(string._);\n }\n }\n\n return manifest;\n}\n\nexport async function parseXMLAsync(contents: string): Promise<XMLObject> {\n const xml = await new Parser().parseStringPromise(contents);\n return xml;\n}\n\nconst stringTimesN = (n: number, char: string) => Array(n + 1).join(char);\n\nexport function format(manifest: any, { indentLevel = 2, newline = EOL } = {}): string {\n let xmlInput: string;\n if (typeof manifest === 'string') {\n xmlInput = manifest;\n } else if (manifest.toString) {\n const builder = new Builder({\n headless: true,\n });\n\n // For strings.xml\n if (Array.isArray(manifest?.resources?.string)) {\n for (const string of manifest?.resources?.string) {\n if (string.$.translatable === 'false' || string.$.translatable === false) {\n continue;\n }\n string._ = escapeAndroidString(string._);\n }\n }\n\n xmlInput = builder.buildObject(manifest);\n\n return xmlInput;\n } else {\n throw new Error(`Invalid XML value passed in: ${manifest}`);\n }\n const indentString = stringTimesN(indentLevel, ' ');\n\n let formatted = '';\n const regex = /(>)(<)(\\/*)/g;\n const xml = xmlInput.replace(regex, `$1${newline}$2$3`);\n let pad = 0;\n xml\n .split(/\\r?\\n/)\n .map((line: string) => line.trim())\n .forEach((line: string) => {\n let indent = 0;\n if (line.match(/.+<\\/\\w[^>]*>$/)) {\n indent = 0;\n } else if (line.match(/^<\\/\\w/)) {\n if (pad !== 0) {\n pad -= 1;\n }\n } else if (line.match(/^<\\w([^>]*[^/])?>.*$/)) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n const padding = stringTimesN(pad, indentString);\n formatted += padding + line + newline;\n pad += indent;\n });\n\n return formatted.trim();\n}\n\n/**\n * Escapes Android string literals, specifically characters `\"`, `'`, `\\`, `\\n`, `\\r`, `\\t`\n *\n * @param value unescaped Android XML string literal.\n */\nexport function escapeAndroidString(value: string): string {\n value = value.replace(/[\\n\\r\\t'\"@]/g, (m) => {\n switch (m) {\n case '\"':\n case \"'\":\n case '@':\n return '\\\\' + m;\n case '\\n':\n return '\\\\n';\n case '\\r':\n return '\\\\r';\n case '\\t':\n return '\\\\t';\n default:\n throw new Error(`Cannot escape unhandled XML character: ${m}`);\n }\n });\n if (value.match(/(^\\s|\\s$)/)) {\n value = '\"' + value + '\"';\n }\n return value;\n}\n\nexport function unescapeAndroidString(value: string): string {\n return value.replace(/\\\\(.)/g, '$1');\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAUlC,eAAeG,aAAaA,CAACC,OAAmC,EAAiB;EACtF,MAAMC,GAAG,GAAGC,MAAM,CAACF,OAAO,CAACC,GAAG,CAAC;EAC/B,MAAME,aAAE,CAACC,QAAQ,CAACC,KAAK,CAACC,eAAI,CAACC,OAAO,CAACP,OAAO,CAACM,IAAI,CAAC,EAAE;IAAEE,SAAS,EAAE;EAAK,CAAC,CAAC;EACxE,MAAML,aAAE,CAACC,QAAQ,CAACK,SAAS,CAACT,OAAO,CAACM,IAAI,EAA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;EACF,IAAID,KAAK,CAACF,KAAK,CAAC,WAAW,CAAC,EAAE;IAC5BE,KAAK,GAAG,GAAG,GAAGA,KAAK,GAAG,GAAG;EAC3B;EACA,OAAOA,KAAK;AACd;AAEO,SAAS7B,qBAAqBA,CAAC6B,KAAa,EAAU;EAC3D,OAAOA,KAAK,CAACV,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;AACtC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.15-canary-20250122-166c2cb",
|
|
4
4
|
"description": "A library for Expo config plugins",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"paths"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@expo/config-types": "
|
|
37
|
-
"@expo/json-file": "
|
|
38
|
-
"@expo/plist": "
|
|
36
|
+
"@expo/config-types": "53.0.0-canary-20250122-166c2cb",
|
|
37
|
+
"@expo/json-file": "9.0.2-canary-20250122-166c2cb",
|
|
38
|
+
"@expo/plist": "0.2.2-canary-20250122-166c2cb",
|
|
39
39
|
"@expo/sdk-runtime-versions": "^1.0.0",
|
|
40
40
|
"chalk": "^4.1.2",
|
|
41
41
|
"debug": "^4.3.5",
|
|
@@ -52,10 +52,9 @@
|
|
|
52
52
|
"@types/debug": "^4.1.5",
|
|
53
53
|
"@types/find-up": "^4.0.0",
|
|
54
54
|
"@types/xml2js": "~0.4.11",
|
|
55
|
-
"expo-module-scripts": "
|
|
55
|
+
"expo-module-scripts": "4.0.4-canary-20250122-166c2cb"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
|
-
}
|
|
60
|
-
"gitHead": "986a4689b91f3efc527f7178a320b987c0005842"
|
|
59
|
+
}
|
|
61
60
|
}
|
package/build/ios/Swift.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/// <reference types="xcode" />
|
|
2
|
-
import { ConfigPlugin, XcodeProject } from '../Plugin.types';
|
|
3
|
-
/**
|
|
4
|
-
* Ensure a Swift bridging header is created for the project.
|
|
5
|
-
* This helps fix problems related to using modules that are written in Swift (lottie, FBSDK).
|
|
6
|
-
*
|
|
7
|
-
* 1. Ensures the file exists given the project path.
|
|
8
|
-
* 2. Writes the file and links to Xcode as a resource file.
|
|
9
|
-
* 3. Sets the build configuration `SWIFT_OBJC_BRIDGING_HEADER = [PROJECT_NAME]-Bridging-Header.h`
|
|
10
|
-
*/
|
|
11
|
-
export declare const withSwiftBridgingHeader: ConfigPlugin;
|
|
12
|
-
export declare function ensureSwiftBridgingHeaderSetup({ projectRoot, project, }: {
|
|
13
|
-
projectRoot: string;
|
|
14
|
-
project: XcodeProject;
|
|
15
|
-
}): XcodeProject;
|
|
16
|
-
export declare function getDesignatedSwiftBridgingHeaderFileReference({ project, }: {
|
|
17
|
-
project: XcodeProject;
|
|
18
|
-
}): string | null;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param bridgingHeader The bridging header filename ex: `ExpoAPIs-Bridging-Header.h`
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
export declare function linkBridgingHeaderFile({ project, bridgingHeader, }: {
|
|
25
|
-
project: XcodeProject;
|
|
26
|
-
bridgingHeader: string;
|
|
27
|
-
}): XcodeProject;
|
|
28
|
-
export declare function createBridgingHeaderFile({ projectRoot, projectName, project, bridgingHeader, }: {
|
|
29
|
-
project: XcodeProject;
|
|
30
|
-
projectName: string;
|
|
31
|
-
projectRoot: string;
|
|
32
|
-
bridgingHeader: string;
|
|
33
|
-
}): XcodeProject;
|
|
34
|
-
export declare const withNoopSwiftFile: ConfigPlugin;
|
package/build/ios/Swift.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createBridgingHeaderFile = createBridgingHeaderFile;
|
|
7
|
-
exports.ensureSwiftBridgingHeaderSetup = ensureSwiftBridgingHeaderSetup;
|
|
8
|
-
exports.getDesignatedSwiftBridgingHeaderFileReference = getDesignatedSwiftBridgingHeaderFileReference;
|
|
9
|
-
exports.linkBridgingHeaderFile = linkBridgingHeaderFile;
|
|
10
|
-
exports.withSwiftBridgingHeader = exports.withNoopSwiftFile = void 0;
|
|
11
|
-
function _fs() {
|
|
12
|
-
const data = _interopRequireDefault(require("fs"));
|
|
13
|
-
_fs = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
function _path() {
|
|
19
|
-
const data = _interopRequireDefault(require("path"));
|
|
20
|
-
_path = function () {
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
function _Paths() {
|
|
26
|
-
const data = require("./Paths");
|
|
27
|
-
_Paths = function () {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
function _XcodeProjectFile() {
|
|
33
|
-
const data = require("./XcodeProjectFile");
|
|
34
|
-
_XcodeProjectFile = function () {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
function _Xcodeproj() {
|
|
40
|
-
const data = require("./utils/Xcodeproj");
|
|
41
|
-
_Xcodeproj = function () {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
return data;
|
|
45
|
-
}
|
|
46
|
-
function _iosPlugins() {
|
|
47
|
-
const data = require("../plugins/ios-plugins");
|
|
48
|
-
_iosPlugins = function () {
|
|
49
|
-
return data;
|
|
50
|
-
};
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
54
|
-
const templateBridgingHeader = `//
|
|
55
|
-
// Use this file to import your target's public headers that you would like to expose to Swift.
|
|
56
|
-
//
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Ensure a Swift bridging header is created for the project.
|
|
61
|
-
* This helps fix problems related to using modules that are written in Swift (lottie, FBSDK).
|
|
62
|
-
*
|
|
63
|
-
* 1. Ensures the file exists given the project path.
|
|
64
|
-
* 2. Writes the file and links to Xcode as a resource file.
|
|
65
|
-
* 3. Sets the build configuration `SWIFT_OBJC_BRIDGING_HEADER = [PROJECT_NAME]-Bridging-Header.h`
|
|
66
|
-
*/
|
|
67
|
-
const withSwiftBridgingHeader = config => {
|
|
68
|
-
return (0, _iosPlugins().withXcodeProject)(config, config => {
|
|
69
|
-
config.modResults = ensureSwiftBridgingHeaderSetup({
|
|
70
|
-
project: config.modResults,
|
|
71
|
-
projectRoot: config.modRequest.projectRoot
|
|
72
|
-
});
|
|
73
|
-
return config;
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
exports.withSwiftBridgingHeader = withSwiftBridgingHeader;
|
|
77
|
-
function ensureSwiftBridgingHeaderSetup({
|
|
78
|
-
projectRoot,
|
|
79
|
-
project
|
|
80
|
-
}) {
|
|
81
|
-
// Only create a bridging header if using objective-c
|
|
82
|
-
if (shouldCreateSwiftBridgingHeader({
|
|
83
|
-
projectRoot,
|
|
84
|
-
project
|
|
85
|
-
})) {
|
|
86
|
-
const projectName = (0, _Xcodeproj().getProjectName)(projectRoot);
|
|
87
|
-
const bridgingHeader = createBridgingHeaderFileName(projectName);
|
|
88
|
-
// Ensure a bridging header is created in the Xcode project.
|
|
89
|
-
project = createBridgingHeaderFile({
|
|
90
|
-
project,
|
|
91
|
-
projectName,
|
|
92
|
-
projectRoot,
|
|
93
|
-
bridgingHeader
|
|
94
|
-
});
|
|
95
|
-
// Designate the newly created file as the Swift bridging header in the Xcode project.
|
|
96
|
-
project = linkBridgingHeaderFile({
|
|
97
|
-
project,
|
|
98
|
-
bridgingHeader: _path().default.join(projectName, bridgingHeader)
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return project;
|
|
102
|
-
}
|
|
103
|
-
function shouldCreateSwiftBridgingHeader({
|
|
104
|
-
projectRoot,
|
|
105
|
-
project
|
|
106
|
-
}) {
|
|
107
|
-
// Only create a bridging header if the project is using in Objective C (AppDelegate is written in Objc).
|
|
108
|
-
const isObjc = (0, _Paths().getAppDelegate)(projectRoot).language !== 'swift';
|
|
109
|
-
return isObjc && !getDesignatedSwiftBridgingHeaderFileReference({
|
|
110
|
-
project
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @returns String matching the default name used when Xcode automatically creates a bridging header file.
|
|
116
|
-
*/
|
|
117
|
-
function createBridgingHeaderFileName(projectName) {
|
|
118
|
-
return `${projectName}-Bridging-Header.h`;
|
|
119
|
-
}
|
|
120
|
-
function getDesignatedSwiftBridgingHeaderFileReference({
|
|
121
|
-
project
|
|
122
|
-
}) {
|
|
123
|
-
const configurations = project.pbxXCBuildConfigurationSection();
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
for (const {
|
|
126
|
-
buildSettings
|
|
127
|
-
} of Object.values(configurations || {})) {
|
|
128
|
-
// Guessing that this is the best way to emulate Xcode.
|
|
129
|
-
// Using `project.addToBuildSettings` modifies too many targets.
|
|
130
|
-
if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {
|
|
131
|
-
if (typeof buildSettings.SWIFT_OBJC_BRIDGING_HEADER === 'string' && buildSettings.SWIFT_OBJC_BRIDGING_HEADER) {
|
|
132
|
-
return buildSettings.SWIFT_OBJC_BRIDGING_HEADER;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* @param bridgingHeader The bridging header filename ex: `ExpoAPIs-Bridging-Header.h`
|
|
142
|
-
* @returns
|
|
143
|
-
*/
|
|
144
|
-
function linkBridgingHeaderFile({
|
|
145
|
-
project,
|
|
146
|
-
bridgingHeader
|
|
147
|
-
}) {
|
|
148
|
-
const configurations = project.pbxXCBuildConfigurationSection();
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
for (const {
|
|
151
|
-
buildSettings
|
|
152
|
-
} of Object.values(configurations || {})) {
|
|
153
|
-
// Guessing that this is the best way to emulate Xcode.
|
|
154
|
-
// Using `project.addToBuildSettings` modifies too many targets.
|
|
155
|
-
if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {
|
|
156
|
-
buildSettings.SWIFT_OBJC_BRIDGING_HEADER = bridgingHeader;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return project;
|
|
160
|
-
}
|
|
161
|
-
function createBridgingHeaderFile({
|
|
162
|
-
projectRoot,
|
|
163
|
-
projectName,
|
|
164
|
-
project,
|
|
165
|
-
bridgingHeader
|
|
166
|
-
}) {
|
|
167
|
-
const bridgingHeaderProjectPath = _path().default.join((0, _Paths().getSourceRoot)(projectRoot), bridgingHeader);
|
|
168
|
-
if (!_fs().default.existsSync(bridgingHeaderProjectPath)) {
|
|
169
|
-
// Create the file
|
|
170
|
-
_fs().default.writeFileSync(bridgingHeaderProjectPath, templateBridgingHeader, 'utf8');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// This is non-standard, Xcode generates the bridging header in `/ios` which is kinda annoying.
|
|
174
|
-
// Instead, this'll generate the default header in the application code folder `/ios/myproject/`.
|
|
175
|
-
const filePath = `${projectName}/${bridgingHeader}`;
|
|
176
|
-
// Ensure the file is linked with Xcode resource files
|
|
177
|
-
if (!project.hasFile(filePath)) {
|
|
178
|
-
project = (0, _Xcodeproj().addResourceFileToGroup)({
|
|
179
|
-
filepath: filePath,
|
|
180
|
-
groupName: projectName,
|
|
181
|
-
project,
|
|
182
|
-
// Not sure why, but this is how Xcode generates it.
|
|
183
|
-
isBuildFile: false,
|
|
184
|
-
verbose: false
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return project;
|
|
188
|
-
}
|
|
189
|
-
const withNoopSwiftFile = config => {
|
|
190
|
-
return (0, _XcodeProjectFile().withBuildSourceFile)(config, {
|
|
191
|
-
filePath: 'noop-file.swift',
|
|
192
|
-
contents: ['//', '// @generated', '// A blank Swift file must be created for native modules with Swift files to work correctly.', '//', ''].join('\n')
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
exports.withNoopSwiftFile = withNoopSwiftFile;
|
|
196
|
-
//# sourceMappingURL=Swift.js.map
|
package/build/ios/Swift.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Swift.js","names":["_fs","data","_interopRequireDefault","require","_path","_Paths","_XcodeProjectFile","_Xcodeproj","_iosPlugins","e","__esModule","default","templateBridgingHeader","withSwiftBridgingHeader","config","withXcodeProject","modResults","ensureSwiftBridgingHeaderSetup","project","projectRoot","modRequest","exports","shouldCreateSwiftBridgingHeader","projectName","getProjectName","bridgingHeader","createBridgingHeaderFileName","createBridgingHeaderFile","linkBridgingHeaderFile","path","join","isObjc","getAppDelegate","language","getDesignatedSwiftBridgingHeaderFileReference","configurations","pbxXCBuildConfigurationSection","buildSettings","Object","values","PRODUCT_NAME","SWIFT_OBJC_BRIDGING_HEADER","bridgingHeaderProjectPath","getSourceRoot","fs","existsSync","writeFileSync","filePath","hasFile","addResourceFileToGroup","filepath","groupName","isBuildFile","verbose","withNoopSwiftFile","withBuildSourceFile","contents"],"sources":["../../src/ios/Swift.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { getAppDelegate, getSourceRoot } from './Paths';\nimport { withBuildSourceFile } from './XcodeProjectFile';\nimport { ConfigPlugin, XcodeProject } from '../Plugin.types';\nimport { addResourceFileToGroup, getProjectName } from './utils/Xcodeproj';\nimport { withXcodeProject } from '../plugins/ios-plugins';\n\nconst templateBridgingHeader = `//\n// Use this file to import your target's public headers that you would like to expose to Swift.\n//\n`;\n\n/**\n * Ensure a Swift bridging header is created for the project.\n * This helps fix problems related to using modules that are written in Swift (lottie, FBSDK).\n *\n * 1. Ensures the file exists given the project path.\n * 2. Writes the file and links to Xcode as a resource file.\n * 3. Sets the build configuration `SWIFT_OBJC_BRIDGING_HEADER = [PROJECT_NAME]-Bridging-Header.h`\n */\nexport const withSwiftBridgingHeader: ConfigPlugin = (config) => {\n return withXcodeProject(config, (config) => {\n config.modResults = ensureSwiftBridgingHeaderSetup({\n project: config.modResults,\n projectRoot: config.modRequest.projectRoot,\n });\n return config;\n });\n};\n\nexport function ensureSwiftBridgingHeaderSetup({\n projectRoot,\n project,\n}: {\n projectRoot: string;\n project: XcodeProject;\n}) {\n // Only create a bridging header if using objective-c\n if (shouldCreateSwiftBridgingHeader({ projectRoot, project })) {\n const projectName = getProjectName(projectRoot);\n const bridgingHeader = createBridgingHeaderFileName(projectName);\n // Ensure a bridging header is created in the Xcode project.\n project = createBridgingHeaderFile({\n project,\n projectName,\n projectRoot,\n bridgingHeader,\n });\n // Designate the newly created file as the Swift bridging header in the Xcode project.\n project = linkBridgingHeaderFile({\n project,\n bridgingHeader: path.join(projectName, bridgingHeader),\n });\n }\n return project;\n}\n\nfunction shouldCreateSwiftBridgingHeader({\n projectRoot,\n project,\n}: {\n projectRoot: string;\n project: XcodeProject;\n}): boolean {\n // Only create a bridging header if the project is using in Objective C (AppDelegate is written in Objc).\n const isObjc = getAppDelegate(projectRoot).language !== 'swift';\n return isObjc && !getDesignatedSwiftBridgingHeaderFileReference({ project });\n}\n\n/**\n * @returns String matching the default name used when Xcode automatically creates a bridging header file.\n */\nfunction createBridgingHeaderFileName(projectName: string): string {\n return `${projectName}-Bridging-Header.h`;\n}\n\nexport function getDesignatedSwiftBridgingHeaderFileReference({\n project,\n}: {\n project: XcodeProject;\n}): string | null {\n const configurations = project.pbxXCBuildConfigurationSection();\n // @ts-ignore\n for (const { buildSettings } of Object.values(configurations || {})) {\n // Guessing that this is the best way to emulate Xcode.\n // Using `project.addToBuildSettings` modifies too many targets.\n if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {\n if (\n typeof buildSettings.SWIFT_OBJC_BRIDGING_HEADER === 'string' &&\n buildSettings.SWIFT_OBJC_BRIDGING_HEADER\n ) {\n return buildSettings.SWIFT_OBJC_BRIDGING_HEADER;\n }\n }\n }\n return null;\n}\n\n/**\n *\n * @param bridgingHeader The bridging header filename ex: `ExpoAPIs-Bridging-Header.h`\n * @returns\n */\nexport function linkBridgingHeaderFile({\n project,\n bridgingHeader,\n}: {\n project: XcodeProject;\n bridgingHeader: string;\n}): XcodeProject {\n const configurations = project.pbxXCBuildConfigurationSection();\n // @ts-ignore\n for (const { buildSettings } of Object.values(configurations || {})) {\n // Guessing that this is the best way to emulate Xcode.\n // Using `project.addToBuildSettings` modifies too many targets.\n if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {\n buildSettings.SWIFT_OBJC_BRIDGING_HEADER = bridgingHeader;\n }\n }\n\n return project;\n}\n\nexport function createBridgingHeaderFile({\n projectRoot,\n projectName,\n project,\n bridgingHeader,\n}: {\n project: XcodeProject;\n projectName: string;\n projectRoot: string;\n bridgingHeader: string;\n}): XcodeProject {\n const bridgingHeaderProjectPath = path.join(getSourceRoot(projectRoot), bridgingHeader);\n if (!fs.existsSync(bridgingHeaderProjectPath)) {\n // Create the file\n fs.writeFileSync(bridgingHeaderProjectPath, templateBridgingHeader, 'utf8');\n }\n\n // This is non-standard, Xcode generates the bridging header in `/ios` which is kinda annoying.\n // Instead, this'll generate the default header in the application code folder `/ios/myproject/`.\n const filePath = `${projectName}/${bridgingHeader}`;\n // Ensure the file is linked with Xcode resource files\n if (!project.hasFile(filePath)) {\n project = addResourceFileToGroup({\n filepath: filePath,\n groupName: projectName,\n project,\n // Not sure why, but this is how Xcode generates it.\n isBuildFile: false,\n verbose: false,\n });\n }\n return project;\n}\n\nexport const withNoopSwiftFile: ConfigPlugin = (config) => {\n return withBuildSourceFile(config, {\n filePath: 'noop-file.swift',\n contents: [\n '//',\n '// @generated',\n '// A blank Swift file must be created for native modules with Swift files to work correctly.',\n '//',\n '',\n ].join('\\n'),\n });\n};\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1D,MAAMG,sBAAsB,GAAG;AAC/B;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,uBAAqC,GAAIC,MAAM,IAAK;E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CAAC8B,OAAO,CAACD,QAAQ,CAAC,EAAE;IAC9B7B,OAAO,GAAG,IAAA+B,mCAAsB,EAAC;MAC/BC,QAAQ,EAAEH,QAAQ;MAClBI,SAAS,EAAE5B,WAAW;MACtBL,OAAO;MACP;MACAkC,WAAW,EAAE,KAAK;MAClBC,OAAO,EAAE;IACX,CAAC,CAAC;EACJ;EACA,OAAOnC,OAAO;AAChB;AAEO,MAAMoC,iBAA+B,GAAIxC,MAAM,IAAK;EACzD,OAAO,IAAAyC,uCAAmB,EAACzC,MAAM,EAAE;IACjCiC,QAAQ,EAAE,iBAAiB;IAC3BS,QAAQ,EAAE,CACR,IAAI,EACJ,eAAe,EACf,8FAA8F,EAC9F,IAAI,EACJ,EAAE,CACH,CAAC1B,IAAI,CAAC,IAAI;EACb,CAAC,CAAC;AACJ,CAAC;AAACT,OAAA,CAAAiC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/build/utils/versions.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.gteSdkVersion = gteSdkVersion;
|
|
7
|
-
exports.lteSdkVersion = lteSdkVersion;
|
|
8
|
-
function _semver() {
|
|
9
|
-
const data = _interopRequireDefault(require("semver"));
|
|
10
|
-
_semver = function () {
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function gteSdkVersion(exp, sdkVersion) {
|
|
17
|
-
if (!exp.sdkVersion) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if (exp.sdkVersion === 'UNVERSIONED') {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
return _semver().default.gte(exp.sdkVersion, sdkVersion);
|
|
25
|
-
} catch {
|
|
26
|
-
throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function lteSdkVersion(exp, sdkVersion) {
|
|
30
|
-
if (!exp.sdkVersion) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (exp.sdkVersion === 'UNVERSIONED') {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
return _semver().default.lte(exp.sdkVersion, sdkVersion);
|
|
38
|
-
} catch {
|
|
39
|
-
throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=versions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","names":["_semver","data","_interopRequireDefault","require","e","__esModule","default","gteSdkVersion","exp","sdkVersion","semver","gte","Error","lteSdkVersion","lte"],"sources":["../../src/utils/versions.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport semver from 'semver';\n\nexport function gteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return true;\n }\n\n try {\n return semver.gte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n\nexport function lteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return false;\n }\n\n try {\n return semver.lte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n"],"mappings":";;;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErB,SAASG,aAAaA,CAACC,GAAmC,EAAEC,UAAkB,EAAW;EAC9F,IAAI,CAACD,GAAG,CAACC,UAAU,EAAE;IACnB,OAAO,KAAK;EACd;EAEA,IAAID,GAAG,CAACC,UAAU,KAAK,aAAa,EAAE;IACpC,OAAO,IAAI;EACb;EAEA,IAAI;IACF,OAAOC,iBAAM,CAACC,GAAG,CAACH,GAAG,CAACC,UAAU,EAAEA,UAAU,CAAC;EAC/C,CAAC,CAAC,MAAM;IACN,MAAM,IAAIG,KAAK,CAAC,GAAGJ,GAAG,CAACC,UAAU,uDAAuD,CAAC;EAC3F;AACF;AAEO,SAASI,aAAaA,CAACL,GAAmC,EAAEC,UAAkB,EAAW;EAC9F,IAAI,CAACD,GAAG,CAACC,UAAU,EAAE;IACnB,OAAO,KAAK;EACd;EAEA,IAAID,GAAG,CAACC,UAAU,KAAK,aAAa,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,IAAI;IACF,OAAOC,iBAAM,CAACI,GAAG,CAACN,GAAG,CAACC,UAAU,EAAEA,UAAU,CAAC;EAC/C,CAAC,CAAC,MAAM;IACN,MAAM,IAAIG,KAAK,CAAC,GAAGJ,GAAG,CAACC,UAAU,uDAAuD,CAAC;EAC3F;AACF","ignoreList":[]}
|