@expo/config-plugins 9.1.6 → 10.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/android/Scheme.js
CHANGED
|
@@ -40,13 +40,7 @@ function getScheme(config) {
|
|
|
40
40
|
// The only way to reliably remove schemes from the project is to nuke the file and regenerate the code (`npx expo prebuild --clean`).
|
|
41
41
|
// Regardless, having extra schemes isn't a fatal issue and therefore a tolerable compromise is to just add new schemes that aren't currently present.
|
|
42
42
|
function setScheme(config, androidManifest) {
|
|
43
|
-
const schemes = [...getScheme(config),
|
|
44
|
-
// @ts-ignore: TODO: android.scheme is an unreleased -- harder to add to turtle v1.
|
|
45
|
-
...getScheme(config.android ?? {})];
|
|
46
|
-
// Add the package name to the list of schemes for easier Google auth and parity with Turtle v1.
|
|
47
|
-
if (config.android?.package) {
|
|
48
|
-
schemes.push(config.android.package);
|
|
49
|
-
}
|
|
43
|
+
const schemes = [...getScheme(config), ...getScheme(config.android ?? {})];
|
|
50
44
|
if (schemes.length === 0) {
|
|
51
45
|
return androidManifest;
|
|
52
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scheme.js","names":["_androidPlugins","data","require","_warnings","withScheme","exports","createAndroidManifestPlugin","setScheme","getScheme","config","Array","isArray","scheme","validate","value","filter","androidManifest","schemes","android","package","push","length","ensureManifestHasValidIntentFilter","addWarningAndroid","currentSchemes","getSchemesFromManifest","uri","index","indexOf","splice","appendScheme","isValidRedirectIntentFilter","actions","categories","includes","propertiesFromIntentFilter","intentFilter","action","map","$","category","host","getSingleTaskIntentFilters","manifest","application","outputSchemes","activity","activities","singleTaskActivities","intentFilters","concat","requestedHost","singleTaskIntentFilters","properties","hasScheme","removeScheme","dataKey"],"sources":["../../src/android/Scheme.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { AndroidManifest, ManifestActivity } from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\n\nexport type IntentFilterProps = {\n actions: string[];\n categories: string[];\n data: {\n scheme: string;\n host?: string;\n }[];\n};\n\nexport const withScheme = createAndroidManifestPlugin(setScheme, 'withScheme');\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => typeof value === 'string';\n\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\n// This plugin used to remove the unused schemes but this is unpredictable because other plugins could add schemes.\n// The only way to reliably remove schemes from the project is to nuke the file and regenerate the code (`npx expo prebuild --clean`).\n// Regardless, having extra schemes isn't a fatal issue and therefore a tolerable compromise is to just add new schemes that aren't currently present.\nexport function setScheme(\n config: Pick<ExpoConfig, 'scheme' | 'android'>,\n androidManifest: AndroidManifest\n) {\n const schemes = [\n ...getScheme(config),\n // @ts-ignore: TODO: android.scheme is an unreleased -- harder to add to turtle v1.\n ...getScheme(config.android ?? {}),\n ];\n // Add the package name to the list of schemes for easier Google auth and parity with Turtle v1.\n if (config.android?.package) {\n schemes.push(config.android.package);\n }\n if (schemes.length === 0) {\n return androidManifest;\n }\n\n if (!ensureManifestHasValidIntentFilter(androidManifest)) {\n addWarningAndroid(\n 'scheme',\n `Cannot add schemes because the provided manifest does not have a valid Activity with \\`android:launchMode=\"singleTask\"\\``,\n 'https://expo.fyi/setup-android-uri-scheme'\n );\n return androidManifest;\n }\n\n // Get the current schemes and remove them from the list of schemes to add.\n const currentSchemes = getSchemesFromManifest(androidManifest);\n for (const uri of currentSchemes) {\n const index = schemes.indexOf(uri);\n if (index > -1) schemes.splice(index, 1);\n }\n\n // Now add all of the remaining schemes.\n for (const uri of schemes) {\n androidManifest = appendScheme(uri, androidManifest);\n }\n\n return androidManifest;\n}\n\nfunction isValidRedirectIntentFilter({ actions, categories }: IntentFilterProps): boolean {\n return (\n actions.includes('android.intent.action.VIEW') &&\n !categories.includes('android.intent.category.LAUNCHER')\n );\n}\n\nfunction propertiesFromIntentFilter(intentFilter: any): IntentFilterProps {\n const actions = intentFilter?.action?.map((data: any) => data?.$?.['android:name']) ?? [];\n const categories = intentFilter?.category?.map((data: any) => data?.$?.['android:name']) ?? [];\n const data =\n intentFilter?.data\n ?.filter((data: any) => data?.$?.['android:scheme'])\n ?.map((data: any) => ({\n scheme: data?.$?.['android:scheme'],\n host: data?.$?.['android:host'],\n })) ?? [];\n return {\n actions,\n categories,\n data,\n };\n}\n\nfunction getSingleTaskIntentFilters(androidManifest: AndroidManifest): any[] {\n if (!Array.isArray(androidManifest.manifest.application)) return [];\n\n let outputSchemes: any[] = [];\n for (const application of androidManifest.manifest.application) {\n const { activity } = application;\n // @ts-ignore\n const activities = Array.isArray(activity) ? activity : [activity];\n const singleTaskActivities = (activities as ManifestActivity[]).filter(\n (activity) => activity?.$?.['android:launchMode'] === 'singleTask'\n );\n for (const activity of singleTaskActivities) {\n const intentFilters = activity['intent-filter'];\n outputSchemes = outputSchemes.concat(intentFilters);\n }\n }\n return outputSchemes;\n}\n\nexport function getSchemesFromManifest(\n androidManifest: AndroidManifest,\n requestedHost: string | null = null\n): string[] {\n const outputSchemes: string[] = [];\n\n const singleTaskIntentFilters = getSingleTaskIntentFilters(androidManifest);\n for (const intentFilter of singleTaskIntentFilters) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties) && properties.data) {\n for (const { scheme, host } of properties.data) {\n if (requestedHost === null || !host || host === requestedHost) {\n outputSchemes.push(scheme);\n }\n }\n }\n }\n\n return outputSchemes;\n}\n\nexport function ensureManifestHasValidIntentFilter(androidManifest: AndroidManifest): boolean {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return false;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n return true;\n }\n }\n if (!activity['intent-filter']) {\n activity['intent-filter'] = [];\n }\n\n activity['intent-filter'].push({\n action: [{ $: { 'android:name': 'android.intent.action.VIEW' } }],\n category: [\n { $: { 'android:name': 'android.intent.category.DEFAULT' } },\n { $: { 'android:name': 'android.intent.category.BROWSABLE' } },\n ],\n });\n return true;\n }\n }\n }\n return false;\n}\n\nexport function hasScheme(scheme: string, androidManifest: AndroidManifest): boolean {\n const schemes = getSchemesFromManifest(androidManifest);\n return schemes.includes(scheme);\n}\n\nexport function appendScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n if (!intentFilter.data) intentFilter.data = [];\n intentFilter.data.push({\n $: { 'android:scheme': scheme },\n });\n }\n }\n break;\n }\n }\n }\n return androidManifest;\n}\n\nexport function removeScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n for (const dataKey in intentFilter?.data || []) {\n const data = intentFilter.data?.[dataKey];\n if (data?.$?.['android:scheme'] === scheme) {\n delete intentFilter.data?.[dataKey];\n }\n }\n }\n }\n break;\n }\n }\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAA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Q,IAAI,EAAE,EAAE;MACjD,IAAIA,QAAQ,EAAEP,CAAC,GAAG,oBAAoB,CAAC,KAAK,YAAY,EAAE;QACxD,KAAK,MAAMH,YAAY,IAAIU,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE;UAC1D;UACA,MAAMO,UAAU,GAAGlB,0BAA0B,CAACC,YAAY,CAAC;UAC3D,IAAIL,2BAA2B,CAACsB,UAAU,CAAC,EAAE;YAC3C,KAAK,MAAMG,OAAO,IAAIpB,YAAY,EAAEnC,IAAI,IAAI,EAAE,EAAE;cAC9C,MAAMA,IAAI,GAAGmC,YAAY,CAACnC,IAAI,GAAGuD,OAAO,CAAC;cACzC,IAAIvD,IAAI,EAAEsC,CAAC,GAAG,gBAAgB,CAAC,KAAK3B,MAAM,EAAE;gBAC1C,OAAOwB,YAAY,CAACnC,IAAI,GAAGuD,OAAO,CAAC;cACrC;YACF;UACF;QACF;QACA;MACF;IACF;EACF;EAEA,OAAOxC,eAAe;AACxB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Scheme.js","names":["_androidPlugins","data","require","_warnings","withScheme","exports","createAndroidManifestPlugin","setScheme","getScheme","config","Array","isArray","scheme","validate","value","filter","androidManifest","schemes","android","length","ensureManifestHasValidIntentFilter","addWarningAndroid","currentSchemes","getSchemesFromManifest","uri","index","indexOf","splice","appendScheme","isValidRedirectIntentFilter","actions","categories","includes","propertiesFromIntentFilter","intentFilter","action","map","$","category","host","getSingleTaskIntentFilters","manifest","application","outputSchemes","activity","activities","singleTaskActivities","intentFilters","concat","requestedHost","singleTaskIntentFilters","properties","push","hasScheme","removeScheme","dataKey"],"sources":["../../src/android/Scheme.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { AndroidManifest, ManifestActivity } from './Manifest';\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\n\nexport type IntentFilterProps = {\n actions: string[];\n categories: string[];\n data: {\n scheme: string;\n host?: string;\n }[];\n};\n\nexport const withScheme = createAndroidManifestPlugin(setScheme, 'withScheme');\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => typeof value === 'string';\n\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\n// This plugin used to remove the unused schemes but this is unpredictable because other plugins could add schemes.\n// The only way to reliably remove schemes from the project is to nuke the file and regenerate the code (`npx expo prebuild --clean`).\n// Regardless, having extra schemes isn't a fatal issue and therefore a tolerable compromise is to just add new schemes that aren't currently present.\nexport function setScheme(\n config: Pick<ExpoConfig, 'scheme' | 'android'>,\n androidManifest: AndroidManifest\n) {\n const schemes = [...getScheme(config), ...getScheme(config.android ?? {})];\n if (schemes.length === 0) {\n return androidManifest;\n }\n\n if (!ensureManifestHasValidIntentFilter(androidManifest)) {\n addWarningAndroid(\n 'scheme',\n `Cannot add schemes because the provided manifest does not have a valid Activity with \\`android:launchMode=\"singleTask\"\\``,\n 'https://expo.fyi/setup-android-uri-scheme'\n );\n return androidManifest;\n }\n\n // Get the current schemes and remove them from the list of schemes to add.\n const currentSchemes = getSchemesFromManifest(androidManifest);\n for (const uri of currentSchemes) {\n const index = schemes.indexOf(uri);\n if (index > -1) schemes.splice(index, 1);\n }\n\n // Now add all of the remaining schemes.\n for (const uri of schemes) {\n androidManifest = appendScheme(uri, androidManifest);\n }\n\n return androidManifest;\n}\n\nfunction isValidRedirectIntentFilter({ actions, categories }: IntentFilterProps): boolean {\n return (\n actions.includes('android.intent.action.VIEW') &&\n !categories.includes('android.intent.category.LAUNCHER')\n );\n}\n\nfunction propertiesFromIntentFilter(intentFilter: any): IntentFilterProps {\n const actions = intentFilter?.action?.map((data: any) => data?.$?.['android:name']) ?? [];\n const categories = intentFilter?.category?.map((data: any) => data?.$?.['android:name']) ?? [];\n const data =\n intentFilter?.data\n ?.filter((data: any) => data?.$?.['android:scheme'])\n ?.map((data: any) => ({\n scheme: data?.$?.['android:scheme'],\n host: data?.$?.['android:host'],\n })) ?? [];\n return {\n actions,\n categories,\n data,\n };\n}\n\nfunction getSingleTaskIntentFilters(androidManifest: AndroidManifest): any[] {\n if (!Array.isArray(androidManifest.manifest.application)) return [];\n\n let outputSchemes: any[] = [];\n for (const application of androidManifest.manifest.application) {\n const { activity } = application;\n // @ts-ignore\n const activities = Array.isArray(activity) ? activity : [activity];\n const singleTaskActivities = (activities as ManifestActivity[]).filter(\n (activity) => activity?.$?.['android:launchMode'] === 'singleTask'\n );\n for (const activity of singleTaskActivities) {\n const intentFilters = activity['intent-filter'];\n outputSchemes = outputSchemes.concat(intentFilters);\n }\n }\n return outputSchemes;\n}\n\nexport function getSchemesFromManifest(\n androidManifest: AndroidManifest,\n requestedHost: string | null = null\n): string[] {\n const outputSchemes: string[] = [];\n\n const singleTaskIntentFilters = getSingleTaskIntentFilters(androidManifest);\n for (const intentFilter of singleTaskIntentFilters) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties) && properties.data) {\n for (const { scheme, host } of properties.data) {\n if (requestedHost === null || !host || host === requestedHost) {\n outputSchemes.push(scheme);\n }\n }\n }\n }\n\n return outputSchemes;\n}\n\nexport function ensureManifestHasValidIntentFilter(androidManifest: AndroidManifest): boolean {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return false;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n return true;\n }\n }\n if (!activity['intent-filter']) {\n activity['intent-filter'] = [];\n }\n\n activity['intent-filter'].push({\n action: [{ $: { 'android:name': 'android.intent.action.VIEW' } }],\n category: [\n { $: { 'android:name': 'android.intent.category.DEFAULT' } },\n { $: { 'android:name': 'android.intent.category.BROWSABLE' } },\n ],\n });\n return true;\n }\n }\n }\n return false;\n}\n\nexport function hasScheme(scheme: string, androidManifest: AndroidManifest): boolean {\n const schemes = getSchemesFromManifest(androidManifest);\n return schemes.includes(scheme);\n}\n\nexport function appendScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n if (!intentFilter.data) intentFilter.data = [];\n intentFilter.data.push({\n $: { 'android:scheme': scheme },\n });\n }\n }\n break;\n }\n }\n }\n return androidManifest;\n}\n\nexport function removeScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n for (const dataKey in intentFilter?.data || []) {\n const data = intentFilter.data?.[dataKey];\n if (data?.$?.['android:scheme'] === scheme) {\n delete intentFilter.data?.[dataKey];\n }\n }\n }\n }\n break;\n }\n }\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,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;AAWO,MAAMG,UAAU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AMA,IAAI,GAAGiC,YAAY,CAACjC,IAAI,GAAGsD,OAAO,CAAC;cACzC,IAAItD,IAAI,EAAEoC,CAAC,GAAG,gBAAgB,CAAC,KAAKzB,MAAM,EAAE;gBAC1C,OAAOsB,YAAY,CAACjC,IAAI,GAAGsD,OAAO,CAAC;cACrC;YACF;UACF;QACF;QACA;MACF;IACF;EACF;EAEA,OAAOvC,eAAe;AACxB","ignoreList":[]}
|
package/build/ios/Scheme.js
CHANGED
|
@@ -33,9 +33,7 @@ function getScheme(config) {
|
|
|
33
33
|
return [];
|
|
34
34
|
}
|
|
35
35
|
function setScheme(config, infoPlist) {
|
|
36
|
-
const scheme = [...getScheme(config),
|
|
37
|
-
// @ts-ignore: TODO: ios.scheme is an unreleased -- harder to add to turtle v1.
|
|
38
|
-
...getScheme(config.ios ?? {})];
|
|
36
|
+
const scheme = [...getScheme(config), ...getScheme(config.ios ?? {})];
|
|
39
37
|
// Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.
|
|
40
38
|
if (config.ios?.bundleIdentifier) {
|
|
41
39
|
scheme.push(config.ios.bundleIdentifier);
|
package/build/ios/Scheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scheme.js","names":["_iosPlugins","data","require","withScheme","exports","createInfoPlistPluginWithPropertyGuard","setScheme","infoPlistProperty","expoConfigProperty","getScheme","config","Array","isArray","scheme","validate","value","filter","infoPlist","ios","bundleIdentifier","push","length","CFBundleURLTypes","CFBundleURLSchemes","appendScheme","existingSchemes","some","includes","removeScheme","map","bundleUrlType","index","indexOf","splice","undefined","Boolean","hasScheme","schemes","getSchemesFromPlist","reduce"],"sources":["../../src/ios/Scheme.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, URLScheme } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withScheme = createInfoPlistPluginWithPropertyGuard(\n setScheme,\n {\n infoPlistProperty: 'CFBundleURLTypes',\n expoConfigProperty: 'scheme',\n },\n 'withScheme'\n);\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => {\n return typeof value === 'string';\n };\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\nexport function setScheme(\n config: Partial<Pick<ExpoConfig, 'scheme' | 'ios'>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const scheme = [
|
|
1
|
+
{"version":3,"file":"Scheme.js","names":["_iosPlugins","data","require","withScheme","exports","createInfoPlistPluginWithPropertyGuard","setScheme","infoPlistProperty","expoConfigProperty","getScheme","config","Array","isArray","scheme","validate","value","filter","infoPlist","ios","bundleIdentifier","push","length","CFBundleURLTypes","CFBundleURLSchemes","appendScheme","existingSchemes","some","includes","removeScheme","map","bundleUrlType","index","indexOf","splice","undefined","Boolean","hasScheme","schemes","getSchemesFromPlist","reduce"],"sources":["../../src/ios/Scheme.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, URLScheme } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withScheme = createInfoPlistPluginWithPropertyGuard(\n setScheme,\n {\n infoPlistProperty: 'CFBundleURLTypes',\n expoConfigProperty: 'scheme',\n },\n 'withScheme'\n);\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => {\n return typeof value === 'string';\n };\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\nexport function setScheme(\n config: Partial<Pick<ExpoConfig, 'scheme' | 'ios'>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const scheme = [...getScheme(config), ...getScheme(config.ios ?? {})];\n // Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.\n if (config.ios?.bundleIdentifier) {\n scheme.push(config.ios.bundleIdentifier);\n }\n if (scheme.length === 0) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleURLTypes: [{ CFBundleURLSchemes: scheme }],\n };\n}\n\nexport function appendScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist {\n if (!scheme) {\n return infoPlist;\n }\n\n const existingSchemes = infoPlist.CFBundleURLTypes ?? [];\n if (existingSchemes?.some(({ CFBundleURLSchemes }) => CFBundleURLSchemes.includes(scheme))) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n CFBundleURLTypes: [\n ...existingSchemes,\n {\n CFBundleURLSchemes: [scheme],\n },\n ],\n };\n}\n\nexport function removeScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist {\n if (!scheme) {\n return infoPlist;\n }\n\n // No need to remove if we don't have any\n if (!infoPlist.CFBundleURLTypes) {\n return infoPlist;\n }\n\n infoPlist.CFBundleURLTypes = infoPlist.CFBundleURLTypes.map((bundleUrlType) => {\n const index = bundleUrlType.CFBundleURLSchemes.indexOf(scheme);\n if (index > -1) {\n bundleUrlType.CFBundleURLSchemes.splice(index, 1);\n if (bundleUrlType.CFBundleURLSchemes.length === 0) {\n return undefined;\n }\n }\n return bundleUrlType;\n }).filter(Boolean) as URLScheme[];\n\n return infoPlist;\n}\n\nexport function hasScheme(scheme: string, infoPlist: InfoPlist): boolean {\n const existingSchemes = infoPlist.CFBundleURLTypes;\n\n if (!Array.isArray(existingSchemes)) return false;\n\n return existingSchemes?.some(({ CFBundleURLSchemes: schemes }: any) =>\n Array.isArray(schemes) ? schemes.includes(scheme) : false\n );\n}\n\nexport function getSchemesFromPlist(infoPlist: InfoPlist): string[] {\n if (Array.isArray(infoPlist.CFBundleURLTypes)) {\n return infoPlist.CFBundleURLTypes.reduce<string[]>((schemes, { CFBundleURLSchemes }) => {\n if (Array.isArray(CFBundleURLSchemes)) {\n return [...schemes, ...CFBundleURLSchemes];\n }\n return schemes;\n }, []);\n }\n return [];\n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AAK,CAACC,OAAO,CAACa,eAAe,CAAC,EAAE,OAAO,KAAK;EAEjD,OAAOA,eAAe,EAAEC,IAAI,CAAC,CAAC;IAAEH,kBAAkB,EAAEc;EAAa,CAAC,KAChE1B,KAAK,CAACC,OAAO,CAACyB,OAAO,CAAC,GAAGA,OAAO,CAACV,QAAQ,CAACd,MAAM,CAAC,GAAG,KACtD,CAAC;AACH;AAEO,SAASyB,mBAAmBA,CAACrB,SAAoB,EAAY;EAClE,IAAIN,KAAK,CAACC,OAAO,CAACK,SAAS,CAACK,gBAAgB,CAAC,EAAE;IAC7C,OAAOL,SAAS,CAACK,gBAAgB,CAACiB,MAAM,CAAW,CAACF,OAAO,EAAE;MAAEd;IAAmB,CAAC,KAAK;MACtF,IAAIZ,KAAK,CAACC,OAAO,CAACW,kBAAkB,CAAC,EAAE;QACrC,OAAO,CAAC,GAAGc,OAAO,EAAE,GAAGd,kBAAkB,CAAC;MAC5C;MACA,OAAOc,OAAO;IAChB,CAAC,EAAE,EAAE,CAAC;EACR;EACA,OAAO,EAAE;AACX","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
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": "^53.0.
|
|
37
|
-
"@expo/json-file": "~9.1.
|
|
38
|
-
"@expo/plist": "^0.3.
|
|
36
|
+
"@expo/config-types": "^53.0.2",
|
|
37
|
+
"@expo/json-file": "~9.1.3",
|
|
38
|
+
"@expo/plist": "^0.3.3",
|
|
39
39
|
"@expo/sdk-runtime-versions": "^1.0.0",
|
|
40
40
|
"chalk": "^4.1.2",
|
|
41
41
|
"debug": "^4.3.5",
|
|
@@ -52,10 +52,10 @@
|
|
|
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": "^4.1.
|
|
55
|
+
"expo-module-scripts": "^4.1.5"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "bb2cf89d99a9d7f70b07419cc36cdf80c2764217"
|
|
61
61
|
}
|