@expo/config-plugins 5.0.4 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Plugin.types.d.ts +7 -7
- package/build/Plugin.types.js +0 -9
- package/build/Plugin.types.js.map +1 -1
- package/build/android/AllowBackup.js +0 -15
- package/build/android/AllowBackup.js.map +1 -1
- package/build/android/BuildProperties.js +2 -16
- package/build/android/BuildProperties.js.map +1 -1
- package/build/android/Colors.js +3 -25
- package/build/android/Colors.js.map +1 -1
- package/build/android/EasBuild.js +2 -22
- package/build/android/EasBuild.js.map +1 -1
- package/build/android/EasBuildGradleScript.js.map +1 -1
- package/build/android/GoogleMapsApiKey.js +0 -12
- package/build/android/GoogleMapsApiKey.js.map +1 -1
- package/build/android/GoogleServices.js +10 -48
- package/build/android/GoogleServices.js.map +1 -1
- package/build/android/IntentFilters.d.ts +1 -1
- package/build/android/IntentFilters.js +8 -24
- package/build/android/IntentFilters.js.map +1 -1
- package/build/android/Manifest.d.ts +19 -19
- package/build/android/Manifest.js +7 -66
- package/build/android/Manifest.js.map +1 -1
- package/build/android/Name.js +6 -27
- package/build/android/Name.js.map +1 -1
- package/build/android/Orientation.js +2 -12
- package/build/android/Orientation.js.map +1 -1
- package/build/android/Package.js +26 -111
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.d.ts +2 -2
- package/build/android/Paths.js +0 -47
- package/build/android/Paths.js.map +1 -1
- package/build/android/Permissions.js +8 -52
- package/build/android/Permissions.js.map +1 -1
- package/build/android/PrimaryColor.js +0 -18
- package/build/android/PrimaryColor.js.map +1 -1
- package/build/android/Properties.d.ts +1 -1
- package/build/android/Properties.js +0 -9
- package/build/android/Properties.js.map +1 -1
- package/build/android/Resources.d.ts +4 -4
- package/build/android/Resources.js +9 -29
- package/build/android/Resources.js.map +1 -1
- package/build/android/Scheme.d.ts +1 -1
- package/build/android/Scheme.js +13 -66
- package/build/android/Scheme.js.map +1 -1
- package/build/android/StatusBar.js +5 -33
- package/build/android/StatusBar.js.map +1 -1
- package/build/android/Strings.js +0 -14
- package/build/android/Strings.js.map +1 -1
- package/build/android/Styles.js +7 -34
- package/build/android/Styles.js.map +1 -1
- package/build/android/Updates.d.ts +2 -0
- package/build/android/Updates.js +50 -47
- package/build/android/Updates.js.map +1 -1
- package/build/android/Version.js +3 -29
- package/build/android/Version.js.map +1 -1
- package/build/android/WindowSoftInputMode.js +0 -14
- package/build/android/WindowSoftInputMode.js.map +1 -1
- package/build/android/codeMod.js +6 -22
- package/build/android/codeMod.js.map +1 -1
- package/build/android/index.js +0 -94
- package/build/android/index.js.map +1 -1
- package/build/index.js +2 -65
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.d.ts +1 -1
- package/build/ios/Bitcode.js +8 -28
- package/build/ios/Bitcode.js.map +1 -1
- package/build/ios/BuildProperties.js +2 -14
- package/build/ios/BuildProperties.js.map +1 -1
- package/build/ios/BuildScheme.js +2 -34
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/BundleIdentifier.js +13 -72
- package/build/ios/BundleIdentifier.js.map +1 -1
- package/build/ios/DeviceFamily.js +6 -24
- package/build/ios/DeviceFamily.js.map +1 -1
- package/build/ios/Entitlements.js +4 -45
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.d.ts +2 -2
- package/build/ios/Google.js +11 -66
- package/build/ios/Google.js.map +1 -1
- package/build/ios/IosConfig.types.d.ts +6 -11
- package/build/ios/IosConfig.types.js.map +1 -1
- package/build/ios/Locales.d.ts +3 -3
- package/build/ios/Locales.js +12 -43
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Maps.js +15 -53
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Name.js +7 -31
- package/build/ios/Name.js.map +1 -1
- package/build/ios/Orientation.js +2 -10
- package/build/ios/Orientation.js.map +1 -1
- package/build/ios/Paths.d.ts +2 -2
- package/build/ios/Paths.js +8 -73
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Permissions.js +1 -16
- package/build/ios/Permissions.js.map +1 -1
- package/build/ios/ProvisioningProfile.d.ts +1 -1
- package/build/ios/ProvisioningProfile.js +0 -18
- package/build/ios/ProvisioningProfile.js.map +1 -1
- package/build/ios/RequiresFullScreen.js +19 -31
- package/build/ios/RequiresFullScreen.js.map +1 -1
- package/build/ios/Scheme.js +10 -32
- package/build/ios/Scheme.js.map +1 -1
- package/build/ios/Swift.js +16 -50
- package/build/ios/Swift.js.map +1 -1
- package/build/ios/Target.js +0 -30
- package/build/ios/Target.js.map +1 -1
- package/build/ios/Updates.js +10 -49
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/UsesNonExemptEncryption.js +4 -10
- package/build/ios/UsesNonExemptEncryption.js.map +1 -1
- package/build/ios/Version.js +4 -11
- package/build/ios/Version.js.map +1 -1
- package/build/ios/XcodeProjectFile.js +5 -23
- package/build/ios/XcodeProjectFile.js.map +1 -1
- package/build/ios/codeMod.js +19 -60
- package/build/ios/codeMod.js.map +1 -1
- package/build/ios/index.js +0 -97
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.d.ts +6 -6
- package/build/ios/utils/Xcodeproj.js +15 -101
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/ios/utils/getInfoPlistPath.js +2 -15
- package/build/ios/utils/getInfoPlistPath.js.map +1 -1
- package/build/ios/utils/string.js +0 -1
- package/build/ios/utils/string.js.map +1 -1
- package/build/plugins/android-plugins.d.ts +2 -2
- package/build/plugins/android-plugins.js +11 -42
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/createBaseMod.d.ts +3 -3
- package/build/plugins/createBaseMod.js +8 -25
- package/build/plugins/createBaseMod.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +2 -2
- package/build/plugins/ios-plugins.js +8 -48
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/mod-compiler.js +21 -72
- package/build/plugins/mod-compiler.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.d.ts +1 -1
- package/build/plugins/withAndroidBaseMods.js +4 -89
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withDangerousMod.js +0 -5
- package/build/plugins/withDangerousMod.js.map +1 -1
- package/build/plugins/withIosBaseMods.d.ts +1 -1
- package/build/plugins/withIosBaseMods.js +26 -118
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/plugins/withMod.d.ts +1 -1
- package/build/plugins/withMod.js +24 -59
- package/build/plugins/withMod.js.map +1 -1
- package/build/plugins/withPlugins.js +0 -9
- package/build/plugins/withPlugins.js.map +1 -1
- package/build/plugins/withRunOnce.js +3 -9
- package/build/plugins/withRunOnce.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +21 -43
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/BuildProperties.types.d.ts +2 -2
- package/build/utils/BuildProperties.types.js.map +1 -1
- package/build/utils/Updates.d.ts +3 -1
- package/build/utils/Updates.js +18 -77
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +1 -1
- package/build/utils/XML.js +7 -44
- package/build/utils/XML.js.map +1 -1
- package/build/utils/commonCodeMod.js +2 -10
- package/build/utils/commonCodeMod.js.map +1 -1
- package/build/utils/errors.d.ts +1 -1
- package/build/utils/errors.js +3 -11
- package/build/utils/errors.js.map +1 -1
- package/build/utils/fs.js +1 -12
- package/build/utils/fs.js.map +1 -1
- package/build/utils/generateCode.d.ts +1 -1
- package/build/utils/generateCode.js +8 -25
- package/build/utils/generateCode.js.map +1 -1
- package/build/utils/history.d.ts +1 -1
- package/build/utils/history.js +0 -6
- package/build/utils/history.js.map +1 -1
- package/build/utils/matchBrackets.d.ts +3 -3
- package/build/utils/matchBrackets.js +2 -17
- package/build/utils/matchBrackets.js.map +1 -1
- package/build/utils/modules.js +0 -10
- package/build/utils/modules.js.map +1 -1
- package/build/utils/obj.js +0 -4
- package/build/utils/obj.js.map +1 -1
- package/build/utils/plugin-resolver.js +25 -69
- package/build/utils/plugin-resolver.js.map +1 -1
- package/build/utils/sortObject.js +4 -10
- package/build/utils/sortObject.js.map +1 -1
- package/build/utils/versions.js +0 -10
- package/build/utils/versions.js.map +1 -1
- package/build/utils/warnings.js +1 -9
- package/build/utils/warnings.js.map +1 -1
- package/package.json +5 -5
package/build/ios/Name.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Name.js","names":["withDisplayName","createInfoPlistPluginWithPropertyGuard","setDisplayName","infoPlistProperty","expoConfigProperty","withName","setName","withProductName","config","withXcodeProject","modResults","setProductName","getName","name","configOrName","CFBundleDisplayName","infoPlist","CFBundleName","project","sanitizedName","quotedName","ensureQuotes","nativeTarget","findFirstNativeTarget","getBuildConfigurationsForListId","buildConfigurationList","forEach","item","buildSettings","PRODUCT_NAME","value","match"],"sources":["../../src/ios/Name.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createInfoPlistPluginWithPropertyGuard, withXcodeProject } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\nimport { findFirstNativeTarget } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n sanitizedName,\n} from './utils/Xcodeproj';\n\nexport const withDisplayName = createInfoPlistPluginWithPropertyGuard(\n setDisplayName,\n {\n infoPlistProperty: 'CFBundleDisplayName',\n expoConfigProperty: 'name',\n },\n 'withDisplayName'\n);\n\nexport const withName = createInfoPlistPluginWithPropertyGuard(\n setName,\n {\n infoPlistProperty: 'CFBundleName',\n expoConfigProperty: 'name',\n },\n 'withName'\n);\n\n/** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */\nexport const withProductName: ConfigPlugin = (config) => {\n return withXcodeProject(config, (config) => {\n config.modResults = setProductName(config, config.modResults);\n return config;\n });\n};\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\n/**\n * CFBundleDisplayName is used for most things: the name on the home screen, in\n * notifications, and others.\n */\nexport function setDisplayName(\n configOrName: Pick<ExpoConfig, 'name'> | string,\n { CFBundleDisplayName, ...infoPlist }: InfoPlist\n): InfoPlist {\n let name: string | null = null;\n if (typeof configOrName === 'string') {\n name = configOrName;\n } else {\n name = getName(configOrName);\n }\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleDisplayName: name,\n };\n}\n\n/**\n * CFBundleName is recommended to be 16 chars or less and is used in lists, eg:\n * sometimes on the App Store\n */\nexport function setName(\n config: Pick<ExpoConfig, 'name'>,\n { CFBundleName, ...infoPlist }: InfoPlist\n): InfoPlist {\n const name = getName(config);\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleName: name,\n };\n}\n\nexport function setProductName(\n config: Pick<ExpoConfig, 'name'>,\n project: XcodeProject\n): XcodeProject {\n const name = sanitizedName(getName(config) ?? '');\n\n if (!name) {\n return project;\n }\n const quotedName = ensureQuotes(name);\n\n const [, nativeTarget] = findFirstNativeTarget(project);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).forEach(\n ([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PRODUCT_NAME = quotedName;\n }\n );\n\n return project;\n}\n\nconst ensureQuotes = (value: string) => {\n if (!value.match(/^['\"]/)) {\n return `\"${value}\"`;\n }\n return value;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Name.js","names":["withDisplayName","createInfoPlistPluginWithPropertyGuard","setDisplayName","infoPlistProperty","expoConfigProperty","withName","setName","withProductName","config","withXcodeProject","modResults","setProductName","getName","name","configOrName","CFBundleDisplayName","infoPlist","CFBundleName","project","sanitizedName","quotedName","ensureQuotes","nativeTarget","findFirstNativeTarget","getBuildConfigurationsForListId","buildConfigurationList","forEach","item","buildSettings","PRODUCT_NAME","value","match"],"sources":["../../src/ios/Name.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createInfoPlistPluginWithPropertyGuard, withXcodeProject } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\nimport { findFirstNativeTarget } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n sanitizedName,\n} from './utils/Xcodeproj';\n\nexport const withDisplayName = createInfoPlistPluginWithPropertyGuard(\n setDisplayName,\n {\n infoPlistProperty: 'CFBundleDisplayName',\n expoConfigProperty: 'name',\n },\n 'withDisplayName'\n);\n\nexport const withName = createInfoPlistPluginWithPropertyGuard(\n setName,\n {\n infoPlistProperty: 'CFBundleName',\n expoConfigProperty: 'name',\n },\n 'withName'\n);\n\n/** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */\nexport const withProductName: ConfigPlugin = (config) => {\n return withXcodeProject(config, (config) => {\n config.modResults = setProductName(config, config.modResults);\n return config;\n });\n};\n\nexport function getName(config: Pick<ExpoConfig, 'name'>) {\n return typeof config.name === 'string' ? config.name : null;\n}\n\n/**\n * CFBundleDisplayName is used for most things: the name on the home screen, in\n * notifications, and others.\n */\nexport function setDisplayName(\n configOrName: Pick<ExpoConfig, 'name'> | string,\n { CFBundleDisplayName, ...infoPlist }: InfoPlist\n): InfoPlist {\n let name: string | null = null;\n if (typeof configOrName === 'string') {\n name = configOrName;\n } else {\n name = getName(configOrName);\n }\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleDisplayName: name,\n };\n}\n\n/**\n * CFBundleName is recommended to be 16 chars or less and is used in lists, eg:\n * sometimes on the App Store\n */\nexport function setName(\n config: Pick<ExpoConfig, 'name'>,\n { CFBundleName, ...infoPlist }: InfoPlist\n): InfoPlist {\n const name = getName(config);\n\n if (!name) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleName: name,\n };\n}\n\nexport function setProductName(\n config: Pick<ExpoConfig, 'name'>,\n project: XcodeProject\n): XcodeProject {\n const name = sanitizedName(getName(config) ?? '');\n\n if (!name) {\n return project;\n }\n const quotedName = ensureQuotes(name);\n\n const [, nativeTarget] = findFirstNativeTarget(project);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).forEach(\n ([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PRODUCT_NAME = quotedName;\n }\n );\n\n return project;\n}\n\nconst ensureQuotes = (value: string) => {\n if (!value.match(/^['\"]/)) {\n return `\"${value}\"`;\n }\n return value;\n};\n"],"mappings":";;;;;;;;;;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMO,MAAMA,eAAe,GAAG,IAAAC,oDAAsC,EACnEC,cAAc,EACd;EACEC,iBAAiB,EAAE,qBAAqB;EACxCC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBAAiB,CAClB;AAAC;AAEK,MAAMC,QAAQ,GAAG,IAAAJ,oDAAsC,EAC5DK,OAAO,EACP;EACEH,iBAAiB,EAAE,cAAc;EACjCC,kBAAkB,EAAE;AACtB,CAAC,EACD,UAAU,CACX;;AAED;AAAA;AACO,MAAMG,eAA6B,GAAIC,MAAM,IAAK;EACvD,OAAO,IAAAC,8BAAgB,EAACD,MAAM,EAAGA,MAAM,IAAK;IAC1CA,MAAM,CAACE,UAAU,GAAGC,cAAc,CAACH,MAAM,EAAEA,MAAM,CAACE,UAAU,CAAC;IAC7D,OAAOF,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAAC;AAEK,SAASI,OAAO,CAACJ,MAAgC,EAAE;EACxD,OAAO,OAAOA,MAAM,CAACK,IAAI,KAAK,QAAQ,GAAGL,MAAM,CAACK,IAAI,GAAG,IAAI;AAC7D;;AAEA;AACA;AACA;AACA;AACO,SAASX,cAAc,CAC5BY,YAA+C,EAC/C;EAAEC,mBAAmB;EAAE,GAAGC;AAAqB,CAAC,EAC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M,GAAE;EACrB;EACA,OAAOA,KAAK;AACd,CAAC"}
|
package/build/ios/Orientation.js
CHANGED
|
@@ -7,34 +7,26 @@ exports.PORTRAIT_ORIENTATIONS = exports.LANDSCAPE_ORIENTATIONS = void 0;
|
|
|
7
7
|
exports.getOrientation = getOrientation;
|
|
8
8
|
exports.setOrientation = setOrientation;
|
|
9
9
|
exports.withOrientation = void 0;
|
|
10
|
-
|
|
11
10
|
function _iosPlugins() {
|
|
12
11
|
const data = require("../plugins/ios-plugins");
|
|
13
|
-
|
|
14
12
|
_iosPlugins = function () {
|
|
15
13
|
return data;
|
|
16
14
|
};
|
|
17
|
-
|
|
18
15
|
return data;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
const withOrientation = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setOrientation, {
|
|
22
18
|
infoPlistProperty: 'UISupportedInterfaceOrientations',
|
|
23
19
|
expoConfigProperty: 'orientation'
|
|
24
20
|
}, 'withOrientation');
|
|
25
21
|
exports.withOrientation = withOrientation;
|
|
26
|
-
|
|
27
22
|
function getOrientation(config) {
|
|
28
23
|
var _config$orientation;
|
|
29
|
-
|
|
30
24
|
return (_config$orientation = config.orientation) !== null && _config$orientation !== void 0 ? _config$orientation : null;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
const PORTRAIT_ORIENTATIONS = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown'];
|
|
34
27
|
exports.PORTRAIT_ORIENTATIONS = PORTRAIT_ORIENTATIONS;
|
|
35
28
|
const LANDSCAPE_ORIENTATIONS = ['UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight'];
|
|
36
29
|
exports.LANDSCAPE_ORIENTATIONS = LANDSCAPE_ORIENTATIONS;
|
|
37
|
-
|
|
38
30
|
function getUISupportedInterfaceOrientations(orientation) {
|
|
39
31
|
if (orientation === 'portrait') {
|
|
40
32
|
return PORTRAIT_ORIENTATIONS;
|
|
@@ -44,10 +36,10 @@ function getUISupportedInterfaceOrientations(orientation) {
|
|
|
44
36
|
return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];
|
|
45
37
|
}
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
function setOrientation(config, infoPlist) {
|
|
49
40
|
const orientation = getOrientation(config);
|
|
50
|
-
return {
|
|
41
|
+
return {
|
|
42
|
+
...infoPlist,
|
|
51
43
|
UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation)
|
|
52
44
|
};
|
|
53
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Orientation.js","names":["withOrientation","createInfoPlistPluginWithPropertyGuard","setOrientation","infoPlistProperty","expoConfigProperty","getOrientation","config","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"sources":["../../src/ios/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\n\nexport const withOrientation = createInfoPlistPluginWithPropertyGuard(\n setOrientation,\n {\n infoPlistProperty: 'UISupportedInterfaceOrientations',\n expoConfigProperty: 'orientation',\n },\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Orientation.js","names":["withOrientation","createInfoPlistPluginWithPropertyGuard","setOrientation","infoPlistProperty","expoConfigProperty","getOrientation","config","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"sources":["../../src/ios/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\n\nexport const withOrientation = createInfoPlistPluginWithPropertyGuard(\n setOrientation,\n {\n infoPlistProperty: 'UISupportedInterfaceOrientations',\n expoConfigProperty: 'orientation',\n },\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"mappings":";;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,eAAe,GAAG,IAAAC,oDAAsC,EACnEC,cAAc,EACd;EACEC,iBAAiB,EAAE,kCAAkC;EACrDC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBAAiB,CAClB;AAAC;AAEK,SAASC,cAAc,CAACC,MAAuC,EAAE;EAAA;EACtE,8BAAOA,MAAM,CAACC,WAAW,qEAAI,IAAI;AACnC;AAEO,MAAMC,qBAA6C,GAAG,CAC3D,gCAAgC,EAChC,0CAA0C,CAC3C;AAAC;AAEK,MAAMC,sBAA8C,GAAG,CAC5D,qCAAqC,EACrC,sCAAsC,CACvC;AAAC;AAEF,SAASC,mCAAmC,CAACH,WAA0B,EAA0B;EAC/F,IAAIA,WAAW,KAAK,UAAU,EAAE;IAC9B,OAAOC,qBAAqB;EAC9B,CAAC,MAAM,IAAID,WAAW,KAAK,WAAW,EAAE;IACtC,OAAOE,sBAAsB;EAC/B,CAAC,MAAM;IACL,OAAO,CAAC,GAAGD,qBAAqB,EAAE,GAAGC,sBAAsB,CAAC;EAC9D;AACF;AAEO,SAASP,cAAc,CAC5BI,MAAuC,EACvCK,SAAoB,EACT;EACX,MAAMJ,WAAW,GAAGF,cAAc,CAACC,MAAM,CAAC;EAE1C,OAAO;IACL,GAAGK,SAAS;IACZC,gCAAgC,EAAEF,mCAAmC,CAACH,WAAW;EACnF,CAAC;AACH"}
|
package/build/ios/Paths.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ interface ProjectFile<L extends string = string> {
|
|
|
3
3
|
language: L;
|
|
4
4
|
contents: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
export
|
|
6
|
+
type AppleLanguage = 'objc' | 'objcpp' | 'swift';
|
|
7
|
+
export type AppDelegateProjectFile = ProjectFile<AppleLanguage>;
|
|
8
8
|
export declare function getAppDelegateHeaderFilePath(projectRoot: string): string;
|
|
9
9
|
export declare function getAppDelegateFilePath(projectRoot: string): string;
|
|
10
10
|
export declare function getAppDelegateObjcHeaderFilePath(projectRoot: string): string;
|
package/build/ios/Paths.js
CHANGED
|
@@ -21,84 +21,60 @@ exports.getPBXProjectPath = getPBXProjectPath;
|
|
|
21
21
|
exports.getSourceRoot = getSourceRoot;
|
|
22
22
|
exports.getSupportingPath = getSupportingPath;
|
|
23
23
|
exports.getXcodeProjectPath = getXcodeProjectPath;
|
|
24
|
-
|
|
25
24
|
function _fs() {
|
|
26
25
|
const data = require("fs");
|
|
27
|
-
|
|
28
26
|
_fs = function () {
|
|
29
27
|
return data;
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
return data;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
function _glob() {
|
|
36
32
|
const data = require("glob");
|
|
37
|
-
|
|
38
33
|
_glob = function () {
|
|
39
34
|
return data;
|
|
40
35
|
};
|
|
41
|
-
|
|
42
36
|
return data;
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
function path() {
|
|
46
39
|
const data = _interopRequireWildcard(require("path"));
|
|
47
|
-
|
|
48
40
|
path = function () {
|
|
49
41
|
return data;
|
|
50
42
|
};
|
|
51
|
-
|
|
52
43
|
return data;
|
|
53
44
|
}
|
|
54
|
-
|
|
55
45
|
function _errors() {
|
|
56
46
|
const data = require("../utils/errors");
|
|
57
|
-
|
|
58
47
|
_errors = function () {
|
|
59
48
|
return data;
|
|
60
49
|
};
|
|
61
|
-
|
|
62
50
|
return data;
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
function _warnings() {
|
|
66
53
|
const data = require("../utils/warnings");
|
|
67
|
-
|
|
68
54
|
_warnings = function () {
|
|
69
55
|
return data;
|
|
70
56
|
};
|
|
71
|
-
|
|
72
57
|
return data;
|
|
73
58
|
}
|
|
74
|
-
|
|
75
59
|
function Entitlements() {
|
|
76
60
|
const data = _interopRequireWildcard(require("./Entitlements"));
|
|
77
|
-
|
|
78
61
|
Entitlements = function () {
|
|
79
62
|
return data;
|
|
80
63
|
};
|
|
81
|
-
|
|
82
64
|
return data;
|
|
83
65
|
}
|
|
84
|
-
|
|
85
66
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
86
|
-
|
|
87
67
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
88
|
-
|
|
89
68
|
const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
|
|
90
|
-
|
|
91
69
|
function getAppDelegateHeaderFilePath(projectRoot) {
|
|
92
70
|
const [using, ...extra] = (0, _glob().sync)('ios/*/AppDelegate.h', {
|
|
93
71
|
absolute: true,
|
|
94
72
|
cwd: projectRoot,
|
|
95
73
|
ignore: ignoredPaths
|
|
96
74
|
});
|
|
97
|
-
|
|
98
75
|
if (!using) {
|
|
99
76
|
throw new (_errors().UnexpectedError)(`Could not locate a valid AppDelegate header at root: "${projectRoot}"`);
|
|
100
77
|
}
|
|
101
|
-
|
|
102
78
|
if (extra.length) {
|
|
103
79
|
warnMultipleFiles({
|
|
104
80
|
tag: 'app-delegate-header',
|
|
@@ -108,21 +84,17 @@ function getAppDelegateHeaderFilePath(projectRoot) {
|
|
|
108
84
|
extra
|
|
109
85
|
});
|
|
110
86
|
}
|
|
111
|
-
|
|
112
87
|
return using;
|
|
113
88
|
}
|
|
114
|
-
|
|
115
89
|
function getAppDelegateFilePath(projectRoot) {
|
|
116
90
|
const [using, ...extra] = (0, _glob().sync)('ios/*/AppDelegate.@(m|mm|swift)', {
|
|
117
91
|
absolute: true,
|
|
118
92
|
cwd: projectRoot,
|
|
119
93
|
ignore: ignoredPaths
|
|
120
94
|
});
|
|
121
|
-
|
|
122
95
|
if (!using) {
|
|
123
96
|
throw new (_errors().UnexpectedError)(`Could not locate a valid AppDelegate at root: "${projectRoot}"`);
|
|
124
97
|
}
|
|
125
|
-
|
|
126
98
|
if (extra.length) {
|
|
127
99
|
warnMultipleFiles({
|
|
128
100
|
tag: 'app-delegate',
|
|
@@ -132,21 +104,17 @@ function getAppDelegateFilePath(projectRoot) {
|
|
|
132
104
|
extra
|
|
133
105
|
});
|
|
134
106
|
}
|
|
135
|
-
|
|
136
107
|
return using;
|
|
137
108
|
}
|
|
138
|
-
|
|
139
109
|
function getAppDelegateObjcHeaderFilePath(projectRoot) {
|
|
140
110
|
const [using, ...extra] = (0, _glob().sync)('ios/*/AppDelegate.h', {
|
|
141
111
|
absolute: true,
|
|
142
112
|
cwd: projectRoot,
|
|
143
113
|
ignore: ignoredPaths
|
|
144
114
|
});
|
|
145
|
-
|
|
146
115
|
if (!using) {
|
|
147
116
|
throw new (_errors().UnexpectedError)(`Could not locate a valid AppDelegate.h at root: "${projectRoot}"`);
|
|
148
117
|
}
|
|
149
|
-
|
|
150
118
|
if (extra.length) {
|
|
151
119
|
warnMultipleFiles({
|
|
152
120
|
tag: 'app-delegate-objc-header',
|
|
@@ -156,29 +124,22 @@ function getAppDelegateObjcHeaderFilePath(projectRoot) {
|
|
|
156
124
|
extra
|
|
157
125
|
});
|
|
158
126
|
}
|
|
159
|
-
|
|
160
127
|
return using;
|
|
161
128
|
}
|
|
162
|
-
|
|
163
129
|
function getLanguage(filePath) {
|
|
164
130
|
const extension = path().extname(filePath);
|
|
165
|
-
|
|
166
131
|
switch (extension) {
|
|
167
132
|
case '.mm':
|
|
168
133
|
return 'objcpp';
|
|
169
|
-
|
|
170
134
|
case '.m':
|
|
171
135
|
case '.h':
|
|
172
136
|
return 'objc';
|
|
173
|
-
|
|
174
137
|
case '.swift':
|
|
175
138
|
return 'swift';
|
|
176
|
-
|
|
177
139
|
default:
|
|
178
140
|
throw new (_errors().UnexpectedError)(`Unexpected iOS file extension: ${extension}`);
|
|
179
141
|
}
|
|
180
142
|
}
|
|
181
|
-
|
|
182
143
|
function getFileInfo(filePath) {
|
|
183
144
|
return {
|
|
184
145
|
path: path().normalize(filePath),
|
|
@@ -186,17 +147,14 @@ function getFileInfo(filePath) {
|
|
|
186
147
|
language: getLanguage(filePath)
|
|
187
148
|
};
|
|
188
149
|
}
|
|
189
|
-
|
|
190
150
|
function getAppDelegate(projectRoot) {
|
|
191
151
|
const filePath = getAppDelegateFilePath(projectRoot);
|
|
192
152
|
return getFileInfo(filePath);
|
|
193
153
|
}
|
|
194
|
-
|
|
195
154
|
function getSourceRoot(projectRoot) {
|
|
196
155
|
const appDelegate = getAppDelegate(projectRoot);
|
|
197
156
|
return path().dirname(appDelegate.path);
|
|
198
157
|
}
|
|
199
|
-
|
|
200
158
|
function findSchemePaths(projectRoot) {
|
|
201
159
|
return (0, _glob().sync)('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {
|
|
202
160
|
absolute: true,
|
|
@@ -204,43 +162,37 @@ function findSchemePaths(projectRoot) {
|
|
|
204
162
|
ignore: ignoredPaths
|
|
205
163
|
});
|
|
206
164
|
}
|
|
207
|
-
|
|
208
165
|
function findSchemeNames(projectRoot) {
|
|
209
166
|
const schemePaths = findSchemePaths(projectRoot);
|
|
210
167
|
return schemePaths.map(schemePath => path().parse(schemePath).name);
|
|
211
168
|
}
|
|
212
|
-
|
|
213
169
|
function getAllXcodeProjectPaths(projectRoot) {
|
|
214
170
|
const iosFolder = 'ios';
|
|
215
171
|
const pbxprojPaths = (0, _glob().sync)('ios/**/*.xcodeproj', {
|
|
216
172
|
cwd: projectRoot,
|
|
217
173
|
ignore: ignoredPaths
|
|
218
|
-
}).filter(project => !/test|example|sample/i.test(project) || path().dirname(project) === iosFolder)
|
|
174
|
+
}).filter(project => !/test|example|sample/i.test(project) || path().dirname(project) === iosFolder)
|
|
175
|
+
// sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)
|
|
219
176
|
.sort().sort((a, b) => {
|
|
220
177
|
const isAInIos = path().dirname(a) === iosFolder;
|
|
221
|
-
const isBInIos = path().dirname(b) === iosFolder;
|
|
222
|
-
|
|
178
|
+
const isBInIos = path().dirname(b) === iosFolder;
|
|
179
|
+
// preserve previous sort order
|
|
223
180
|
if (isAInIos && isBInIos || !isAInIos && !isBInIos) {
|
|
224
181
|
return 0;
|
|
225
182
|
}
|
|
226
|
-
|
|
227
183
|
return isAInIos ? -1 : 1;
|
|
228
184
|
});
|
|
229
|
-
|
|
230
185
|
if (!pbxprojPaths.length) {
|
|
231
186
|
throw new (_errors().UnexpectedError)(`Failed to locate the ios/*.xcodeproj files relative to path "${projectRoot}".`);
|
|
232
187
|
}
|
|
233
|
-
|
|
234
188
|
return pbxprojPaths.map(value => path().join(projectRoot, value));
|
|
235
189
|
}
|
|
190
|
+
|
|
236
191
|
/**
|
|
237
192
|
* Get the pbxproj for the given path
|
|
238
193
|
*/
|
|
239
|
-
|
|
240
|
-
|
|
241
194
|
function getXcodeProjectPath(projectRoot) {
|
|
242
195
|
const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);
|
|
243
|
-
|
|
244
196
|
if (extra.length) {
|
|
245
197
|
warnMultipleFiles({
|
|
246
198
|
tag: 'xcodeproj',
|
|
@@ -250,24 +202,18 @@ function getXcodeProjectPath(projectRoot) {
|
|
|
250
202
|
extra
|
|
251
203
|
});
|
|
252
204
|
}
|
|
253
|
-
|
|
254
205
|
return using;
|
|
255
206
|
}
|
|
256
|
-
|
|
257
207
|
function getAllPBXProjectPaths(projectRoot) {
|
|
258
208
|
const projectPaths = getAllXcodeProjectPaths(projectRoot);
|
|
259
209
|
const paths = projectPaths.map(value => path().join(value, 'project.pbxproj')).filter(value => (0, _fs().existsSync)(value));
|
|
260
|
-
|
|
261
210
|
if (!paths.length) {
|
|
262
211
|
throw new (_errors().UnexpectedError)(`Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path "${projectRoot}".`);
|
|
263
212
|
}
|
|
264
|
-
|
|
265
213
|
return paths;
|
|
266
214
|
}
|
|
267
|
-
|
|
268
215
|
function getPBXProjectPath(projectRoot) {
|
|
269
216
|
const [using, ...extra] = getAllPBXProjectPaths(projectRoot);
|
|
270
|
-
|
|
271
217
|
if (extra.length) {
|
|
272
218
|
warnMultipleFiles({
|
|
273
219
|
tag: 'project-pbxproj',
|
|
@@ -277,28 +223,23 @@ function getPBXProjectPath(projectRoot) {
|
|
|
277
223
|
extra
|
|
278
224
|
});
|
|
279
225
|
}
|
|
280
|
-
|
|
281
226
|
return using;
|
|
282
227
|
}
|
|
283
|
-
|
|
284
228
|
function getAllInfoPlistPaths(projectRoot) {
|
|
285
229
|
const paths = (0, _glob().sync)('ios/*/Info.plist', {
|
|
286
230
|
absolute: true,
|
|
287
231
|
cwd: projectRoot,
|
|
288
232
|
ignore: ignoredPaths
|
|
289
|
-
}).sort(
|
|
233
|
+
}).sort(
|
|
234
|
+
// longer name means more suffixes, we want the shortest possible one to be first.
|
|
290
235
|
(a, b) => a.length - b.length);
|
|
291
|
-
|
|
292
236
|
if (!paths.length) {
|
|
293
237
|
throw new (_errors().UnexpectedError)(`Failed to locate Info.plist files relative to path "${projectRoot}".`);
|
|
294
238
|
}
|
|
295
|
-
|
|
296
239
|
return paths;
|
|
297
240
|
}
|
|
298
|
-
|
|
299
241
|
function getInfoPlistPath(projectRoot) {
|
|
300
242
|
const [using, ...extra] = getAllInfoPlistPaths(projectRoot);
|
|
301
|
-
|
|
302
243
|
if (extra.length) {
|
|
303
244
|
warnMultipleFiles({
|
|
304
245
|
tag: 'info-plist',
|
|
@@ -308,10 +249,8 @@ function getInfoPlistPath(projectRoot) {
|
|
|
308
249
|
extra
|
|
309
250
|
});
|
|
310
251
|
}
|
|
311
|
-
|
|
312
252
|
return using;
|
|
313
253
|
}
|
|
314
|
-
|
|
315
254
|
function getAllEntitlementsPaths(projectRoot) {
|
|
316
255
|
const paths = (0, _glob().sync)('ios/*/*.entitlements', {
|
|
317
256
|
absolute: true,
|
|
@@ -320,24 +259,20 @@ function getAllEntitlementsPaths(projectRoot) {
|
|
|
320
259
|
});
|
|
321
260
|
return paths;
|
|
322
261
|
}
|
|
262
|
+
|
|
323
263
|
/**
|
|
324
264
|
* @deprecated: use Entitlements.getEntitlementsPath instead
|
|
325
265
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
266
|
function getEntitlementsPath(projectRoot) {
|
|
329
267
|
return Entitlements().getEntitlementsPath(projectRoot);
|
|
330
268
|
}
|
|
331
|
-
|
|
332
269
|
function getSupportingPath(projectRoot) {
|
|
333
270
|
return path().resolve(projectRoot, 'ios', path().basename(getSourceRoot(projectRoot)), 'Supporting');
|
|
334
271
|
}
|
|
335
|
-
|
|
336
272
|
function getExpoPlistPath(projectRoot) {
|
|
337
273
|
const supportingPath = getSupportingPath(projectRoot);
|
|
338
274
|
return path().join(supportingPath, 'Expo.plist');
|
|
339
275
|
}
|
|
340
|
-
|
|
341
276
|
function warnMultipleFiles({
|
|
342
277
|
tag,
|
|
343
278
|
fileName,
|
package/build/ios/Paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paths.js","names":["ignoredPaths","getAppDelegateHeaderFilePath","projectRoot","using","extra","globSync","absolute","cwd","ignore","UnexpectedError","length","warnMultipleFiles","tag","fileName","getAppDelegateFilePath","getAppDelegateObjcHeaderFilePath","getLanguage","filePath","extension","path","extname","getFileInfo","normalize","contents","readFileSync","language","getAppDelegate","getSourceRoot","appDelegate","dirname","findSchemePaths","findSchemeNames","schemePaths","map","schemePath","parse","name","getAllXcodeProjectPaths","iosFolder","pbxprojPaths","filter","project","test","sort","a","b","isAInIos","isBInIos","value","join","getXcodeProjectPath","getAllPBXProjectPaths","projectPaths","paths","existsSync","getPBXProjectPath","getAllInfoPlistPaths","getInfoPlistPath","getAllEntitlementsPaths","getEntitlementsPath","Entitlements","getSupportingPath","resolve","basename","getExpoPlistPath","supportingPath","usingPath","relative","extraPaths","v","addWarningIOS","JSON","stringify"],"sources":["../../src/ios/Paths.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport { UnexpectedError } from '../utils/errors';\nimport { addWarningIOS } from '../utils/warnings';\nimport * as Entitlements from './Entitlements';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\ninterface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\ntype AppleLanguage = 'objc' | 'objcpp' | 'swift';\n\nexport type AppDelegateProjectFile = ProjectFile<AppleLanguage>;\n\nexport function getAppDelegateHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(\n `Could not locate a valid AppDelegate header at root: \"${projectRoot}\"`\n );\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-header',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.@(m|mm|swift)', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateObjcHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate.h at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-objc-header',\n fileName: 'AppDelegate.h',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nfunction getLanguage(filePath: string): AppleLanguage {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.mm':\n return 'objcpp';\n case '.m':\n case '.h':\n return 'objc';\n case '.swift':\n return 'swift';\n default:\n throw new UnexpectedError(`Unexpected iOS file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath),\n };\n}\n\nexport function getAppDelegate(projectRoot: string): AppDelegateProjectFile {\n const filePath = getAppDelegateFilePath(projectRoot);\n return getFileInfo(filePath);\n}\n\nexport function getSourceRoot(projectRoot: string): string {\n const appDelegate = getAppDelegate(projectRoot);\n return path.dirname(appDelegate.path);\n}\n\nexport function findSchemePaths(projectRoot: string): string[] {\n return globSync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\nexport function findSchemeNames(projectRoot: string): string[] {\n const schemePaths = findSchemePaths(projectRoot);\n return schemePaths.map((schemePath) => path.parse(schemePath).name);\n}\n\nexport function getAllXcodeProjectPaths(projectRoot: string): string[] {\n const iosFolder = 'ios';\n const pbxprojPaths = globSync('ios/**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })\n .filter(\n (project) => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder\n )\n // sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)\n .sort()\n .sort((a, b) => {\n const isAInIos = path.dirname(a) === iosFolder;\n const isBInIos = path.dirname(b) === iosFolder;\n // preserve previous sort order\n if ((isAInIos && isBInIos) || (!isAInIos && !isBInIos)) {\n return 0;\n }\n return isAInIos ? -1 : 1;\n });\n\n if (!pbxprojPaths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj files relative to path \"${projectRoot}\".`\n );\n }\n return pbxprojPaths.map((value) => path.join(projectRoot, value));\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getXcodeProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'xcodeproj',\n fileName: '*.xcodeproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllPBXProjectPaths(projectRoot: string): string[] {\n const projectPaths = getAllXcodeProjectPaths(projectRoot);\n const paths = projectPaths\n .map((value) => path.join(value, 'project.pbxproj'))\n .filter((value) => existsSync(value));\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getPBXProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllPBXProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'project-pbxproj',\n fileName: 'project.pbxproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllInfoPlistPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/Info.plist', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n }).sort(\n // longer name means more suffixes, we want the shortest possible one to be first.\n (a, b) => a.length - b.length\n );\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate Info.plist files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getInfoPlistPath(projectRoot: string): string {\n const [using, ...extra] = getAllInfoPlistPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'info-plist',\n fileName: 'Info.plist',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllEntitlementsPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/*.entitlements', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n return paths;\n}\n\n/**\n * @deprecated: use Entitlements.getEntitlementsPath instead\n */\nexport function getEntitlementsPath(projectRoot: string): string | null {\n return Entitlements.getEntitlementsPath(projectRoot);\n}\n\nexport function getSupportingPath(projectRoot: string): string {\n return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');\n}\n\nexport function getExpoPlistPath(projectRoot: string): string {\n const supportingPath = getSupportingPath(projectRoot);\n return path.join(supportingPath, 'Expo.plist');\n}\n\nfunction warnMultipleFiles({\n tag,\n fileName,\n projectRoot,\n using,\n extra,\n}: {\n tag: string;\n fileName: string;\n projectRoot?: string;\n using: string;\n extra: string[];\n}) {\n const usingPath = projectRoot ? path.relative(projectRoot, using) : using;\n const extraPaths = projectRoot ? extra.map((v) => path.relative(projectRoot, v)) : extra;\n addWarningIOS(\n `paths-${tag}`,\n `Found multiple ${fileName} file paths, using \"${usingPath}\". Ignored paths: ${JSON.stringify(\n extraPaths\n )}`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAC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B,EAAiE;EACtE,OAAO0D,YAAY,GAACD,mBAAb,CAAiCzD,WAAjC,CAAP;AACD;;AAEM,SAAS2D,iBAAT,CAA2B3D,WAA3B,EAAwD;EAC7D,OAAOiB,IAAI,GAAC2C,OAAL,CAAa5D,WAAb,EAA0B,KAA1B,EAAiCiB,IAAI,GAAC4C,QAAL,CAAcpC,aAAa,CAACzB,WAAD,CAA3B,CAAjC,EAA4E,YAA5E,CAAP;AACD;;AAEM,SAAS8D,gBAAT,CAA0B9D,WAA1B,EAAuD;EAC5D,MAAM+D,cAAc,GAAGJ,iBAAiB,CAAC3D,WAAD,CAAxC;EACA,OAAOiB,IAAI,GAAC8B,IAAL,CAAUgB,cAAV,EAA0B,YAA1B,CAAP;AACD;;AAED,SAAStD,iBAAT,CAA2B;EACzBC,GADyB;EAEzBC,QAFyB;EAGzBX,WAHyB;EAIzBC,KAJyB;EAKzBC;AALyB,CAA3B,EAYG;EACD,MAAM8D,SAAS,GAAGhE,WAAW,GAAGiB,IAAI,GAACgD,QAAL,CAAcjE,WAAd,EAA2BC,KAA3B,CAAH,GAAuCA,KAApE;EACA,MAAMiE,UAAU,GAAGlE,WAAW,GAAGE,KAAK,CAAC6B,GAAN,CAAWoC,CAAD,IAAOlD,IAAI,GAACgD,QAAL,CAAcjE,WAAd,EAA2BmE,CAA3B,CAAjB,CAAH,GAAqDjE,KAAnF;EACA,IAAAkE,yBAAA,EACG,SAAQ1D,GAAI,EADf,EAEG,kBAAiBC,QAAS,uBAAsBqD,SAAU,qBAAoBK,IAAI,CAACC,SAAL,CAC7EJ,UAD6E,CAE7E,EAJJ;AAMD"}
|
|
1
|
+
{"version":3,"file":"Paths.js","names":["ignoredPaths","getAppDelegateHeaderFilePath","projectRoot","using","extra","globSync","absolute","cwd","ignore","UnexpectedError","length","warnMultipleFiles","tag","fileName","getAppDelegateFilePath","getAppDelegateObjcHeaderFilePath","getLanguage","filePath","extension","path","extname","getFileInfo","normalize","contents","readFileSync","language","getAppDelegate","getSourceRoot","appDelegate","dirname","findSchemePaths","findSchemeNames","schemePaths","map","schemePath","parse","name","getAllXcodeProjectPaths","iosFolder","pbxprojPaths","filter","project","test","sort","a","b","isAInIos","isBInIos","value","join","getXcodeProjectPath","getAllPBXProjectPaths","projectPaths","paths","existsSync","getPBXProjectPath","getAllInfoPlistPaths","getInfoPlistPath","getAllEntitlementsPaths","getEntitlementsPath","Entitlements","getSupportingPath","resolve","basename","getExpoPlistPath","supportingPath","usingPath","relative","extraPaths","v","addWarningIOS","JSON","stringify"],"sources":["../../src/ios/Paths.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport { UnexpectedError } from '../utils/errors';\nimport { addWarningIOS } from '../utils/warnings';\nimport * as Entitlements from './Entitlements';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\ninterface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\ntype AppleLanguage = 'objc' | 'objcpp' | 'swift';\n\nexport type AppDelegateProjectFile = ProjectFile<AppleLanguage>;\n\nexport function getAppDelegateHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(\n `Could not locate a valid AppDelegate header at root: \"${projectRoot}\"`\n );\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-header',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.@(m|mm|swift)', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate',\n fileName: 'AppDelegate',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAppDelegateObjcHeaderFilePath(projectRoot: string): string {\n const [using, ...extra] = globSync('ios/*/AppDelegate.h', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n\n if (!using) {\n throw new UnexpectedError(`Could not locate a valid AppDelegate.h at root: \"${projectRoot}\"`);\n }\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'app-delegate-objc-header',\n fileName: 'AppDelegate.h',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nfunction getLanguage(filePath: string): AppleLanguage {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.mm':\n return 'objcpp';\n case '.m':\n case '.h':\n return 'objc';\n case '.swift':\n return 'swift';\n default:\n throw new UnexpectedError(`Unexpected iOS file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath),\n };\n}\n\nexport function getAppDelegate(projectRoot: string): AppDelegateProjectFile {\n const filePath = getAppDelegateFilePath(projectRoot);\n return getFileInfo(filePath);\n}\n\nexport function getSourceRoot(projectRoot: string): string {\n const appDelegate = getAppDelegate(projectRoot);\n return path.dirname(appDelegate.path);\n}\n\nexport function findSchemePaths(projectRoot: string): string[] {\n return globSync('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\nexport function findSchemeNames(projectRoot: string): string[] {\n const schemePaths = findSchemePaths(projectRoot);\n return schemePaths.map((schemePath) => path.parse(schemePath).name);\n}\n\nexport function getAllXcodeProjectPaths(projectRoot: string): string[] {\n const iosFolder = 'ios';\n const pbxprojPaths = globSync('ios/**/*.xcodeproj', { cwd: projectRoot, ignore: ignoredPaths })\n .filter(\n (project) => !/test|example|sample/i.test(project) || path.dirname(project) === iosFolder\n )\n // sort alphabetically to ensure this works the same across different devices (Fail in CI (linux) without this)\n .sort()\n .sort((a, b) => {\n const isAInIos = path.dirname(a) === iosFolder;\n const isBInIos = path.dirname(b) === iosFolder;\n // preserve previous sort order\n if ((isAInIos && isBInIos) || (!isAInIos && !isBInIos)) {\n return 0;\n }\n return isAInIos ? -1 : 1;\n });\n\n if (!pbxprojPaths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj files relative to path \"${projectRoot}\".`\n );\n }\n return pbxprojPaths.map((value) => path.join(projectRoot, value));\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getXcodeProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'xcodeproj',\n fileName: '*.xcodeproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllPBXProjectPaths(projectRoot: string): string[] {\n const projectPaths = getAllXcodeProjectPaths(projectRoot);\n const paths = projectPaths\n .map((value) => path.join(value, 'project.pbxproj'))\n .filter((value) => existsSync(value));\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getPBXProjectPath(projectRoot: string): string {\n const [using, ...extra] = getAllPBXProjectPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'project-pbxproj',\n fileName: 'project.pbxproj',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllInfoPlistPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/Info.plist', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n }).sort(\n // longer name means more suffixes, we want the shortest possible one to be first.\n (a, b) => a.length - b.length\n );\n\n if (!paths.length) {\n throw new UnexpectedError(\n `Failed to locate Info.plist files relative to path \"${projectRoot}\".`\n );\n }\n return paths;\n}\n\nexport function getInfoPlistPath(projectRoot: string): string {\n const [using, ...extra] = getAllInfoPlistPaths(projectRoot);\n\n if (extra.length) {\n warnMultipleFiles({\n tag: 'info-plist',\n fileName: 'Info.plist',\n projectRoot,\n using,\n extra,\n });\n }\n\n return using;\n}\n\nexport function getAllEntitlementsPaths(projectRoot: string): string[] {\n const paths = globSync('ios/*/*.entitlements', {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n return paths;\n}\n\n/**\n * @deprecated: use Entitlements.getEntitlementsPath instead\n */\nexport function getEntitlementsPath(projectRoot: string): string | null {\n return Entitlements.getEntitlementsPath(projectRoot);\n}\n\nexport function getSupportingPath(projectRoot: string): string {\n return path.resolve(projectRoot, 'ios', path.basename(getSourceRoot(projectRoot)), 'Supporting');\n}\n\nexport function getExpoPlistPath(projectRoot: string): string {\n const supportingPath = getSupportingPath(projectRoot);\n return path.join(supportingPath, 'Expo.plist');\n}\n\nfunction warnMultipleFiles({\n tag,\n fileName,\n projectRoot,\n using,\n extra,\n}: {\n tag: string;\n fileName: string;\n projectRoot?: string;\n using: string;\n extra: string[];\n}) {\n const usingPath = projectRoot ? path.relative(projectRoot, using) : using;\n const extraPaths = projectRoot ? extra.map((v) => path.relative(projectRoot, v)) : extra;\n addWarningIOS(\n `paths-${tag}`,\n `Found multiple ${fileName} file paths, using \"${usingPath}\". Ignored paths: ${JSON.stringify(\n extraPaths\n )}`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+C;AAAA;AAE/C,MAAMA,YAAY,GAAG,CAAC,4CAA4C,CAAC;AAY5D,SAASC,4BAA4B,CAACC,WAA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c,GAAGJ,iBAAiB,CAAC3D,WAAW,CAAC;EACrD,OAAOiB,IAAI,GAAC8B,IAAI,CAACgB,cAAc,EAAE,YAAY,CAAC;AAChD;AAEA,SAAStD,iBAAiB,CAAC;EACzBC,GAAG;EACHC,QAAQ;EACRX,WAAW;EACXC,KAAK;EACLC;AAOF,CAAC,EAAE;EACD,MAAM8D,SAAS,GAAGhE,WAAW,GAAGiB,IAAI,GAACgD,QAAQ,CAACjE,WAAW,EAAEC,KAAK,CAAC,GAAGA,KAAK;EACzE,MAAMiE,UAAU,GAAGlE,WAAW,GAAGE,KAAK,CAAC6B,GAAG,CAAEoC,CAAC,IAAKlD,IAAI,GAACgD,QAAQ,CAACjE,WAAW,EAAEmE,CAAC,CAAC,CAAC,GAAGjE,KAAK;EACxF,IAAAkE,yBAAa,EACV,SAAQ1D,GAAI,EAAC,EACb,kBAAiBC,QAAS,uBAAsBqD,SAAU,qBAAoBK,IAAI,CAACC,SAAS,CAC3FJ,UAAU,CACV,EAAC,CACJ;AACH"}
|
package/build/ios/Permissions.js
CHANGED
|
@@ -5,38 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.applyPermissions = applyPermissions;
|
|
7
7
|
exports.createPermissionsPlugin = createPermissionsPlugin;
|
|
8
|
-
|
|
9
8
|
function _debug() {
|
|
10
9
|
const data = _interopRequireDefault(require("debug"));
|
|
11
|
-
|
|
12
10
|
_debug = function () {
|
|
13
11
|
return data;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
13
|
return data;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
function _iosPlugins() {
|
|
20
16
|
const data = require("../plugins/ios-plugins");
|
|
21
|
-
|
|
22
17
|
_iosPlugins = function () {
|
|
23
18
|
return data;
|
|
24
19
|
};
|
|
25
|
-
|
|
26
20
|
return data;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
-
|
|
31
23
|
const debug = (0, _debug().default)('expo:config-plugins:ios:permissions');
|
|
32
|
-
|
|
33
24
|
function applyPermissions(defaults, permissions, infoPlist) {
|
|
34
25
|
const entries = Object.entries(defaults);
|
|
35
|
-
|
|
36
26
|
if (entries.length === 0) {
|
|
37
27
|
debug(`No defaults provided: ${JSON.stringify(permissions)}`);
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
for (const [permission, description] of entries) {
|
|
41
30
|
if (permissions[permission] === false) {
|
|
42
31
|
debug(`Deleting "${permission}"`);
|
|
@@ -46,28 +35,24 @@ function applyPermissions(defaults, permissions, infoPlist) {
|
|
|
46
35
|
debug(`Setting "${permission}" to "${infoPlist[permission]}"`);
|
|
47
36
|
}
|
|
48
37
|
}
|
|
49
|
-
|
|
50
38
|
return infoPlist;
|
|
51
39
|
}
|
|
40
|
+
|
|
52
41
|
/**
|
|
53
42
|
* Helper method for creating mods to apply default permissions.
|
|
54
43
|
*
|
|
55
44
|
* @param action
|
|
56
45
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
46
|
function createPermissionsPlugin(defaults, name) {
|
|
60
47
|
const withIosPermissions = (config, permissions) => (0, _iosPlugins().withInfoPlist)(config, async config => {
|
|
61
48
|
config.modResults = applyPermissions(defaults, permissions, config.modResults);
|
|
62
49
|
return config;
|
|
63
50
|
});
|
|
64
|
-
|
|
65
51
|
if (name) {
|
|
66
52
|
Object.defineProperty(withIosPermissions, 'name', {
|
|
67
53
|
value: name
|
|
68
54
|
});
|
|
69
55
|
}
|
|
70
|
-
|
|
71
56
|
return withIosPermissions;
|
|
72
57
|
}
|
|
73
58
|
//# sourceMappingURL=Permissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Permissions.js","names":["debug","Debug","applyPermissions","defaults","permissions","infoPlist","entries","Object","length","JSON","stringify","permission","description","createPermissionsPlugin","name","withIosPermissions","config","withInfoPlist","modResults","defineProperty","value"],"sources":["../../src/ios/Permissions.ts"],"sourcesContent":["import Debug from 'debug';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nconst debug = Debug('expo:config-plugins:ios:permissions');\n\nexport function applyPermissions<Defaults extends Record<string, string> = Record<string, string>>(\n defaults: Defaults,\n permissions: Partial<Record<keyof Defaults, string | false>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const entries = Object.entries(defaults);\n if (entries.length === 0) {\n debug(`No defaults provided: ${JSON.stringify(permissions)}`);\n }\n for (const [permission, description] of entries) {\n if (permissions[permission] === false) {\n debug(`Deleting \"${permission}\"`);\n delete infoPlist[permission];\n } else {\n infoPlist[permission] = permissions[permission] || infoPlist[permission] || description;\n debug(`Setting \"${permission}\" to \"${infoPlist[permission]}\"`);\n }\n }\n return infoPlist;\n}\n\n/**\n * Helper method for creating mods to apply default permissions.\n *\n * @param action\n */\nexport function createPermissionsPlugin<\n Defaults extends Record<string, string> = Record<string, string>\n>(defaults: Defaults, name?: string) {\n const withIosPermissions: ConfigPlugin<Record<keyof Defaults, string | undefined | false>> = (\n config,\n permissions\n ) =>\n withInfoPlist(config, async (config) => {\n config.modResults = applyPermissions(defaults, permissions, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withIosPermissions, 'name', {\n value: name,\n });\n }\n return withIosPermissions;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Permissions.js","names":["debug","Debug","applyPermissions","defaults","permissions","infoPlist","entries","Object","length","JSON","stringify","permission","description","createPermissionsPlugin","name","withIosPermissions","config","withInfoPlist","modResults","defineProperty","value"],"sources":["../../src/ios/Permissions.ts"],"sourcesContent":["import Debug from 'debug';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\nconst debug = Debug('expo:config-plugins:ios:permissions');\n\nexport function applyPermissions<Defaults extends Record<string, string> = Record<string, string>>(\n defaults: Defaults,\n permissions: Partial<Record<keyof Defaults, string | false>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const entries = Object.entries(defaults);\n if (entries.length === 0) {\n debug(`No defaults provided: ${JSON.stringify(permissions)}`);\n }\n for (const [permission, description] of entries) {\n if (permissions[permission] === false) {\n debug(`Deleting \"${permission}\"`);\n delete infoPlist[permission];\n } else {\n infoPlist[permission] = permissions[permission] || infoPlist[permission] || description;\n debug(`Setting \"${permission}\" to \"${infoPlist[permission]}\"`);\n }\n }\n return infoPlist;\n}\n\n/**\n * Helper method for creating mods to apply default permissions.\n *\n * @param action\n */\nexport function createPermissionsPlugin<\n Defaults extends Record<string, string> = Record<string, string>\n>(defaults: Defaults, name?: string) {\n const withIosPermissions: ConfigPlugin<Record<keyof Defaults, string | undefined | false>> = (\n config,\n permissions\n ) =>\n withInfoPlist(config, async (config) => {\n config.modResults = applyPermissions(defaults, permissions, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withIosPermissions, 'name', {\n value: name,\n });\n }\n return withIosPermissions;\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuD;AAGvD,MAAMA,KAAK,GAAG,IAAAC,gBAAK,EAAC,qCAAqC,CAAC;AAEnD,SAASC,gBAAgB,CAC9BC,QAAkB,EAClBC,WAA4D,EAC5DC,SAAoB,EACT;EACX,MAAMC,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACH,QAAQ,CAAC;EACxC,IAAIG,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACxBR,KAAK,CAAE,yBAAwBS,IAAI,CAACC,SAAS,CAACN,WAAW,CAAE,EAAC,CAAC;EAC/D;EACA,KAAK,MAAM,CAACO,UAAU,EAAEC,WAAW,CAAC,IAAIN,OAAO,EAAE;IAC/C,IAAIF,WAAW,CAACO,UAAU,CAAC,KAAK,KAAK,EAAE;MACrCX,KAAK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