This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,65 @@
import { ExpoConfig } from '@expo/config-types';
import { ConfigPlugin, Mod } from '../Plugin.types';
import { Properties } from '../android';
import { AndroidManifest } from '../android/Manifest';
import { ApplicationProjectFile, GradleProjectFile } from '../android/Paths';
import { ResourceXML } from '../android/Resources';
declare type OptionalPromise<T> = T | Promise<T>;
declare type MutateDataAction<T> = (expo: ExpoConfig, data: T) => OptionalPromise<T>;
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
export declare function createAndroidManifestPlugin(action: MutateDataAction<AndroidManifest>, name: string): ConfigPlugin;
export declare function createStringsXmlPlugin(action: MutateDataAction<ResourceXML>, name: string): ConfigPlugin;
/**
* Provides the AndroidManifest.xml for modification.
*
* @param config
* @param action
*/
export declare const withAndroidManifest: ConfigPlugin<Mod<AndroidManifest>>;
/**
* Provides the strings.xml for modification.
*
* @param config
* @param action
*/
export declare const withStringsXml: ConfigPlugin<Mod<ResourceXML>>;
/**
* Provides the project MainActivity for modification.
*
* @param config
* @param action
*/
export declare const withMainActivity: ConfigPlugin<Mod<ApplicationProjectFile>>;
/**
* Provides the project /build.gradle for modification.
*
* @param config
* @param action
*/
export declare const withProjectBuildGradle: ConfigPlugin<Mod<GradleProjectFile>>;
/**
* Provides the app/build.gradle for modification.
*
* @param config
* @param action
*/
export declare const withAppBuildGradle: ConfigPlugin<Mod<GradleProjectFile>>;
/**
* Provides the /settings.gradle for modification.
*
* @param config
* @param action
*/
export declare const withSettingsGradle: ConfigPlugin<Mod<GradleProjectFile>>;
/**
* Provides the /gradle.properties for modification.
*
* @param config
* @param action
*/
export declare const withGradleProperties: ConfigPlugin<Mod<Properties.PropertiesItem[]>>;
export {};

View File

@ -0,0 +1,126 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_plugins_1 = require("./core-plugins");
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
function createAndroidManifestPlugin(action, name) {
const withUnknown = config => exports.withAndroidManifest(config, async (config) => {
config.modResults = await action(config, config.modResults);
return config;
});
if (name) {
Object.defineProperty(withUnknown, 'name', {
value: name,
});
}
return withUnknown;
}
exports.createAndroidManifestPlugin = createAndroidManifestPlugin;
function createStringsXmlPlugin(action, name) {
const withUnknown = config => exports.withStringsXml(config, async (config) => {
config.modResults = await action(config, config.modResults);
return config;
});
if (name) {
Object.defineProperty(withUnknown, 'name', {
value: name,
});
}
return withUnknown;
}
exports.createStringsXmlPlugin = createStringsXmlPlugin;
/**
* Provides the AndroidManifest.xml for modification.
*
* @param config
* @param action
*/
exports.withAndroidManifest = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'manifest',
action,
});
};
/**
* Provides the strings.xml for modification.
*
* @param config
* @param action
*/
exports.withStringsXml = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'strings',
action,
});
};
/**
* Provides the project MainActivity for modification.
*
* @param config
* @param action
*/
exports.withMainActivity = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'mainActivity',
action,
});
};
/**
* Provides the project /build.gradle for modification.
*
* @param config
* @param action
*/
exports.withProjectBuildGradle = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'projectBuildGradle',
action,
});
};
/**
* Provides the app/build.gradle for modification.
*
* @param config
* @param action
*/
exports.withAppBuildGradle = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'appBuildGradle',
action,
});
};
/**
* Provides the /settings.gradle for modification.
*
* @param config
* @param action
*/
exports.withSettingsGradle = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'settingsGradle',
action,
});
};
/**
* Provides the /gradle.properties for modification.
*
* @param config
* @param action
*/
exports.withGradleProperties = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'android',
mod: 'gradleProperties',
action,
});
};
//# sourceMappingURL=android-plugins.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
import { ConfigPlugin, ExportedConfig } from '../Plugin.types';
export declare function withBaseMods(config: ExportedConfig): ExportedConfig;
export declare function resolveModResults(results: any, platformName: string, modName: string): any;
export declare const withAndroidGradlePropertiesBaseMod: ConfigPlugin;

View File

@ -0,0 +1,409 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plist_1 = __importDefault(require("@expo/plist"));
const fs_extra_1 = require("fs-extra");
const path_1 = __importDefault(require("path"));
const android_1 = require("../android");
const AndroidPaths = __importStar(require("../android/Paths"));
const Resources_1 = require("../android/Resources");
const Strings_1 = require("../android/Strings");
const Entitlements_1 = require("../ios/Entitlements");
const Paths_1 = require("../ios/Paths");
const Xcodeproj_1 = require("../ios/utils/Xcodeproj");
const XML_1 = require("../utils/XML");
const errors_1 = require("../utils/errors");
const WarningAggregator = __importStar(require("../utils/warnings"));
const core_plugins_1 = require("./core-plugins");
function withBaseMods(config) {
config = applyIOSBaseMods(config);
config = applyAndroidBaseMods(config);
return config;
}
exports.withBaseMods = withBaseMods;
function resolveModResults(results, platformName, modName) {
// If the results came from a mod, they'd be in the form of [config, data].
// Ensure the results are an array and omit the data since it should've been written by a data provider plugin.
const ensuredResults = results;
// Sanity check to help locate non compliant mods.
if (!ensuredResults || typeof ensuredResults !== 'object' || !(ensuredResults === null || ensuredResults === void 0 ? void 0 : ensuredResults.mods)) {
throw new Error(`Mod \`mods.${platformName}.${modName}\` evaluated to an object that is not a valid project config. Instead got: ${JSON.stringify(ensuredResults)}`);
}
return ensuredResults;
}
exports.resolveModResults = resolveModResults;
function applyAndroidBaseMods(config) {
config = withExpoDangerousBaseMod(config, 'android');
config = withAndroidStringsXMLBaseMod(config);
config = exports.withAndroidGradlePropertiesBaseMod(config);
config = withAndroidManifestBaseMod(config);
config = withAndroidMainActivityBaseMod(config);
config = withAndroidSettingsGradleBaseMod(config);
config = withAndroidProjectBuildGradleBaseMod(config);
config = withAndroidAppBuildGradleBaseMod(config);
return config;
}
const withAndroidManifestBaseMod = config => {
// Append a rule to supply AndroidManifest.xml data to mods on `mods.android.manifest`
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'manifest',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
const filePath = await AndroidPaths.getAndroidManifestAsync(modRequest.projectRoot);
let modResults = await android_1.Manifest.readAndroidManifestAsync(filePath);
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await android_1.Manifest.writeAndroidManifestAsync(filePath, modResults);
}
catch (error) {
console.error(`AndroidManifest.xml mod error:`);
throw error;
}
return results;
},
});
};
exports.withAndroidGradlePropertiesBaseMod = config => {
// Append a rule to supply gradle.properties data to mods on `mods.android.gradleProperties`
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'gradleProperties',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
const filePath = path_1.default.join(modRequest.platformProjectRoot, 'gradle.properties');
const contents = await fs_extra_1.readFile(filePath, 'utf8');
let modResults = android_1.Properties.parsePropertiesFile(contents);
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, android_1.Properties.propertiesListToString(modResults), 'utf8');
}
catch (error) {
console.error(`gradle.properties mod error:`);
throw error;
}
return results;
},
});
};
const withAndroidStringsXMLBaseMod = config => {
// Append a rule to supply strings.xml data to mods on `mods.android.strings`
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'strings',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
const filePath = await Strings_1.getProjectStringsXMLPathAsync(modRequest.projectRoot);
let modResults = await Resources_1.readResourcesXMLAsync({ path: filePath });
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await XML_1.writeXMLAsync({ path: filePath, xml: modResults });
}
catch (error) {
console.error(`strings.xml mod error:`);
throw error;
}
return results;
},
});
};
const withAndroidProjectBuildGradleBaseMod = config => {
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'projectBuildGradle',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
let modResults = await AndroidPaths.getProjectBuildGradleAsync(modRequest.projectRoot);
// Currently don't support changing the path or language
const filePath = modResults.path;
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, modResults.contents);
}
catch (error) {
console.error(`android/build.gradle mod error:`);
throw error;
}
return results;
},
});
};
const withAndroidSettingsGradleBaseMod = config => {
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'settingsGradle',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
let modResults = await AndroidPaths.getSettingsGradleAsync(modRequest.projectRoot);
// Currently don't support changing the path or language
const filePath = modResults.path;
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, modResults.contents);
}
catch (error) {
console.error(`android/settings.gradle mod error:`);
throw error;
}
return results;
},
});
};
const withAndroidAppBuildGradleBaseMod = config => {
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'appBuildGradle',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
let modResults = await AndroidPaths.getAppBuildGradleAsync(modRequest.projectRoot);
// Currently don't support changing the path or language
const filePath = modResults.path;
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, modResults.contents);
}
catch (error) {
console.error(`android/app/build.gradle mod error:`);
throw error;
}
return results;
},
});
};
const withAndroidMainActivityBaseMod = config => {
return core_plugins_1.withInterceptedMod(config, {
platform: 'android',
mod: 'mainActivity',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
let modResults = await AndroidPaths.getMainActivityAsync(modRequest.projectRoot);
// Currently don't support changing the path or language
const filePath = modResults.path;
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, modResults.contents);
}
catch (error) {
console.error(`MainActivity mod error:`);
throw error;
}
return results;
},
});
};
function applyIOSBaseMods(config) {
config = withExpoDangerousBaseMod(config, 'ios');
config = withAppDelegateBaseMod(config);
config = withIosInfoPlistBaseMod(config);
config = withExpoPlistBaseMod(config);
config = withXcodeProjectBaseMod(config);
config = withEntitlementsBaseMod(config);
return config;
}
const withExpoDangerousBaseMod = (config, platform) => {
// Used for scheduling when dangerous mods run.
return core_plugins_1.withInterceptedMod(config, {
platform,
mod: 'dangerous',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
const results = await nextMod(Object.assign(Object.assign({}, config), { modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
return results;
},
});
};
const withAppDelegateBaseMod = config => {
return core_plugins_1.withInterceptedMod(config, {
platform: 'ios',
mod: 'appDelegate',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
let modResults = Paths_1.getAppDelegate(modRequest.projectRoot);
// Currently don't support changing the path or language
const filePath = modResults.path;
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, modResults.contents);
}
catch (error) {
console.error(`AppDelegate mod error:`);
throw error;
}
return results;
},
});
};
const withExpoPlistBaseMod = config => {
// Append a rule to supply Expo.plist data to mods on `mods.ios.expoPlist`
return core_plugins_1.withInterceptedMod(config, {
platform: 'ios',
mod: 'expoPlist',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
const supportingDirectory = path_1.default.join(modRequest.platformProjectRoot, modRequest.projectName, 'Supporting');
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
const filePath = path_1.default.resolve(supportingDirectory, 'Expo.plist');
let modResults = plist_1.default.parse(await fs_extra_1.readFile(filePath, 'utf8'));
// TODO: Fix type
results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
modResults = results.modResults;
await fs_extra_1.writeFile(filePath, plist_1.default.build(modResults));
}
catch (error) {
WarningAggregator.addWarningIOS('updates', 'Expo.plist configuration could not be applied. You will need to create Expo.plist if it does not exist and add Updates configuration manually.', 'https://docs.expo.io/bare/updating-your-app/#configuration-options');
}
return results;
},
});
};
const withXcodeProjectBaseMod = config => {
// Append a rule to supply .xcodeproj data to mods on `mods.ios.xcodeproj`
return core_plugins_1.withInterceptedMod(config, {
platform: 'ios',
mod: 'xcodeproj',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
const modResults = Xcodeproj_1.getPbxproj(modRequest.projectRoot);
// TODO: Fix type
const results = await nextMod(Object.assign(Object.assign({}, config), { modResults,
modRequest }));
resolveModResults(results, modRequest.platform, modRequest.modName);
const resultData = results.modResults;
await fs_extra_1.writeFile(resultData.filepath, resultData.writeSync());
return results;
},
});
};
const withIosInfoPlistBaseMod = config => {
// Append a rule to supply Info.plist data to mods on `mods.ios.infoPlist`
return core_plugins_1.withInterceptedMod(config, {
platform: 'ios',
mod: 'infoPlist',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
const filePath = Paths_1.getInfoPlistPath(modRequest.projectRoot);
let results = Object.assign(Object.assign({}, config), { modRequest });
// Apply all of the Info.plist values to the expo.ios.infoPlist object
// TODO: Remove this in favor of just overwriting the Info.plist with the Expo object. This will enable people to actually remove values.
if (!config.ios) {
config.ios = {};
}
if (!config.ios.infoPlist) {
config.ios.infoPlist = {};
}
const contents = await fs_extra_1.readFile(filePath, 'utf8');
errors_1.assert(contents, 'Info.plist is empty');
let data = plist_1.default.parse(contents);
config.ios.infoPlist = Object.assign(Object.assign({}, (data || {})), config.ios.infoPlist);
// TODO: Fix type
results = await nextMod(Object.assign(Object.assign({}, config), { modRequest, modResults: config.ios.infoPlist }));
resolveModResults(results, modRequest.platform, modRequest.modName);
data = results.modResults;
await fs_extra_1.writeFile(filePath, plist_1.default.build(data));
return results;
},
});
};
const withEntitlementsBaseMod = config => {
// Append a rule to supply .entitlements data to mods on `mods.ios.entitlements`
return core_plugins_1.withInterceptedMod(config, {
platform: 'ios',
mod: 'entitlements',
skipEmptyMod: true,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), config = __rest(_a, ["modRequest"]);
const entitlementsPath = Entitlements_1.getEntitlementsPath(modRequest.projectRoot);
let results = Object.assign(Object.assign({}, config), { modRequest });
try {
const data = plist_1.default.parse(await fs_extra_1.readFile(entitlementsPath, 'utf8'));
// Apply all of the .entitlements values to the expo.ios.entitlements object
// TODO: Remove this in favor of just overwriting the .entitlements with the Expo object. This will enable people to actually remove values.
if (!config.ios) {
config.ios = {};
}
if (!config.ios.entitlements) {
config.ios.entitlements = {};
}
config.ios.entitlements = Object.assign(Object.assign({}, (data || {})), config.ios.entitlements);
// TODO: Fix type
results = await nextMod(Object.assign(Object.assign({}, config), { modRequest, modResults: config.ios.entitlements }));
resolveModResults(results, modRequest.platform, modRequest.modName);
await fs_extra_1.writeFile(entitlementsPath, plist_1.default.build(results.modResults));
}
catch (error) {
console.error(`${path_1.default.basename(entitlementsPath)} mod error:`);
throw error;
}
return results;
},
});
};
//# sourceMappingURL=compiler-plugins.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,67 @@
import { ConfigPlugin, ExportedConfig, Mod, ModPlatform, StaticPlugin } from '../Plugin.types';
import { PluginHistoryItem } from '../utils/history';
/**
* Resolves a list of plugins.
*
* @param config exported config
* @param plugins list of config config plugins to apply to the exported config
*/
export declare const withPlugins: ConfigPlugin<(StaticPlugin | ConfigPlugin | string)[]>;
/**
* Prevents the same plugin from being run twice.
* Used for migrating from unversioned expo config plugins to versioned plugins.
*
* @param config
* @param name
*/
export declare const withRunOnce: ConfigPlugin<{
plugin: ConfigPlugin<void>;
name: PluginHistoryItem['name'];
version?: PluginHistoryItem['version'];
}>;
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
export declare function createRunOncePlugin<T>(plugin: ConfigPlugin<T>, name: string, version?: string): ConfigPlugin<T>;
/**
* Mods that don't modify any data, all unresolved functionality is performed inside a dangerous mod.
* All dangerous mods run first before other mods.
*
* @param config
* @param platform
* @param action
*/
export declare const withDangerousMod: ConfigPlugin<[ModPlatform, Mod<unknown>]>;
/**
* Plugin to extend a mod function in the plugins config.
*
* @param config exported config
* @param platform platform to target (ios or android)
* @param mod name of the platform function to extend
* @param action method to run on the mod when the config is compiled
*/
export declare function withExtendedMod<T>(config: ExportedConfig, { platform, mod, action, }: {
platform: ModPlatform;
mod: string;
action: Mod<T>;
}): ExportedConfig;
/**
* Plugin to intercept execution of a given `mod` with the given `action`.
* If an action was already set on the given `config` config for `mod`, then it
* will be provided to the `action` as `nextMod` when it's evaluated, otherwise
* `nextMod` will be an identity function.
*
* @param config exported config
* @param platform platform to target (ios or android)
* @param mod name of the platform function to intercept
* @param skipEmptyMod should skip running the action if there is no existing mod to intercept
* @param action method to run on the mod when the config is compiled
*/
export declare function withInterceptedMod<T>(config: ExportedConfig, { platform, mod, action, skipEmptyMod, }: {
platform: ModPlatform;
mod: string;
action: Mod<T>;
skipEmptyMod?: boolean;
}): ExportedConfig;

View File

@ -0,0 +1,205 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = __importDefault(require("chalk"));
const getenv_1 = require("getenv");
const errors_1 = require("../utils/errors");
const history_1 = require("../utils/history");
const static_plugins_1 = require("./static-plugins");
const EXPO_DEBUG = getenv_1.boolish('EXPO_DEBUG', false);
/**
* Resolves a list of plugins.
*
* @param config exported config
* @param plugins list of config config plugins to apply to the exported config
*/
exports.withPlugins = (config, plugins) => {
errors_1.assert(Array.isArray(plugins), 'withPlugins expected a valid array of plugins or plugin module paths');
return plugins.reduce((prev, plugin) => {
return static_plugins_1.withStaticPlugin(prev, { plugin });
}, config);
};
/**
* Prevents the same plugin from being run twice.
* Used for migrating from unversioned expo config plugins to versioned plugins.
*
* @param config
* @param name
*/
exports.withRunOnce = (config, { plugin, name, version }) => {
// Detect if a plugin has already been run on this config.
if (history_1.getHistoryItem(config, name)) {
return config;
}
// Push the history item so duplicates cannot be run.
config = history_1.addHistoryItem(config, { name, version });
return plugin(config);
};
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
function createRunOncePlugin(plugin, name, version) {
return (config, props) => {
return exports.withRunOnce(config, { plugin: config => plugin(config, props), name, version });
};
}
exports.createRunOncePlugin = createRunOncePlugin;
/**
* Mods that don't modify any data, all unresolved functionality is performed inside a dangerous mod.
* All dangerous mods run first before other mods.
*
* @param config
* @param platform
* @param action
*/
exports.withDangerousMod = (config, [platform, action]) => {
return withExtendedMod(config, {
platform,
mod: 'dangerous',
action,
});
};
/**
* Plugin to extend a mod function in the plugins config.
*
* @param config exported config
* @param platform platform to target (ios or android)
* @param mod name of the platform function to extend
* @param action method to run on the mod when the config is compiled
*/
function withExtendedMod(config, { platform, mod, action, }) {
return withInterceptedMod(config, {
platform,
mod,
async action(_a) {
var _b = _a.modRequest, { nextMod } = _b, modRequest = __rest(_b, ["nextMod"]), { modResults } = _a, config = __rest(_a, ["modRequest", "modResults"]);
const results = await action(Object.assign({ modRequest, modResults: modResults }, config));
return nextMod(results);
},
});
}
exports.withExtendedMod = withExtendedMod;
/**
* Plugin to intercept execution of a given `mod` with the given `action`.
* If an action was already set on the given `config` config for `mod`, then it
* will be provided to the `action` as `nextMod` when it's evaluated, otherwise
* `nextMod` will be an identity function.
*
* @param config exported config
* @param platform platform to target (ios or android)
* @param mod name of the platform function to intercept
* @param skipEmptyMod should skip running the action if there is no existing mod to intercept
* @param action method to run on the mod when the config is compiled
*/
function withInterceptedMod(config, { platform, mod, action, skipEmptyMod, }) {
var _a, _b;
if (!config.mods) {
config.mods = {};
}
if (!config.mods[platform]) {
config.mods[platform] = {};
}
let interceptedMod = config.mods[platform][mod];
// No existing mod to intercept
if (!interceptedMod) {
if (skipEmptyMod) {
// Skip running the action
return config;
}
// Use a noop mod and continue
const noopMod = config => config;
interceptedMod = noopMod;
}
// Create a stack trace for debugging ahead of time
let debugTrace = '';
// Use the possibly user defined value. Otherwise fallback to the env variable.
// We support the env variable because user mods won't have _internal defined in time.
const isDebug = (_b = (_a = config._internal) === null || _a === void 0 ? void 0 : _a.isDebug) !== null && _b !== void 0 ? _b : EXPO_DEBUG;
if (isDebug) {
// Get a stack trace via the Error API
const stack = new Error().stack;
// Format the stack trace to create the debug log
debugTrace = getDebugPluginStackFromStackTrace(stack);
const modStack = chalk_1.default.bold(`${platform}.${mod}`);
debugTrace = `${modStack}: ${debugTrace}`;
}
async function interceptingMod(_a) {
var { modRequest } = _a, config = __rest(_a, ["modRequest"]);
if (isDebug) {
// In debug mod, log the plugin stack in the order which they were invoked
console.log(debugTrace);
}
return action(Object.assign(Object.assign({}, config), { modRequest: Object.assign(Object.assign({}, modRequest), { nextMod: interceptedMod }) }));
}
config.mods[platform][mod] = interceptingMod;
return config;
}
exports.withInterceptedMod = withInterceptedMod;
function getDebugPluginStackFromStackTrace(stacktrace) {
if (!stacktrace) {
return '';
}
const treeStackLines = [];
for (const line of stacktrace.split('\n')) {
const [first, second] = line.trim().split(' ');
if (first === 'at') {
treeStackLines.push(second);
}
}
const plugins = treeStackLines
.map(first => {
// Match the first part of the stack trace against the plugin naming convention
// "with" followed by a capital letter.
const match = first === null || first === void 0 ? void 0 : first.match(/(\bwith[A-Z].*?\b)/g);
if (match === null || match === void 0 ? void 0 : match.length) {
// Return the plugin name
return match[0];
}
return null;
})
.filter(Boolean);
// redundant as all debug logs are captured in withInterceptedMod
if (plugins[0] === 'withInterceptedMod') {
plugins.shift();
}
const commonPlugins = ['withPlugins', 'withExtendedMod'];
return (plugins
.reverse()
.map((pluginName, index) => {
// Base mods indicate a logical section.
if (pluginName.includes('BaseMod')) {
pluginName = chalk_1.default.bold(pluginName);
}
// highlight dangerous mods
if (pluginName.toLowerCase().includes('danger')) {
pluginName = chalk_1.default.red(pluginName);
}
if (index === 0) {
return chalk_1.default.blue(pluginName);
}
else if (commonPlugins.includes(pluginName)) {
// Common mod names often clutter up the logs, dim them out
return chalk_1.default.dim(pluginName);
}
return pluginName;
})
// Join the results:
// withExpoAndroidPlugins ➜ withPlugins ➜ withIcons ➜ withDangerousMod ➜ withExtendedMod
.join(' ➜ '));
}
//# sourceMappingURL=core-plugins.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,21 @@
/**
* These are the versioned first-party plugins with some of the future third-party plugins mixed in for legacy support.
*/
import { ConfigPlugin } from '../Plugin.types';
/**
* Config plugin to apply all of the custom Expo iOS config plugins we support by default.
* TODO: In the future most of this should go into versioned packages like expo-facebook, expo-updates, etc...
*/
export declare const withExpoIOSPlugins: ConfigPlugin<{
bundleIdentifier: string;
}>;
/**
* Config plugin to apply all of the custom Expo Android config plugins we support by default.
* TODO: In the future most of this should go into versioned packages like expo-facebook, expo-updates, etc...
*/
export declare const withExpoAndroidPlugins: ConfigPlugin<{
package: string;
}>;
export declare const withExpoVersionedSDKPlugins: ConfigPlugin<{
expoUsername: string | null;
}>;

View File

@ -0,0 +1,115 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const AndroidConfig = __importStar(require("../android"));
const IOSConfig = __importStar(require("../ios"));
const core_plugins_1 = require("./core-plugins");
const expo_ads_admob_1 = __importDefault(require("./unversioned/expo-ads-admob"));
const expo_apple_authentication_1 = __importDefault(require("./unversioned/expo-apple-authentication"));
const expo_branch_1 = __importDefault(require("./unversioned/expo-branch"));
const expo_document_picker_1 = __importDefault(require("./unversioned/expo-document-picker"));
const expo_facebook_1 = __importDefault(require("./unversioned/expo-facebook"));
const expo_notifications_1 = __importDefault(require("./unversioned/expo-notifications"));
const expo_splash_screen_1 = __importDefault(require("./unversioned/expo-splash-screen"));
const expo_updates_1 = __importDefault(require("./unversioned/expo-updates"));
const react_native_maps_1 = __importDefault(require("./unversioned/react-native-maps"));
/**
* Config plugin to apply all of the custom Expo iOS config plugins we support by default.
* TODO: In the future most of this should go into versioned packages like expo-facebook, expo-updates, etc...
*/
exports.withExpoIOSPlugins = (config, { bundleIdentifier }) => {
// Set the bundle ID ahead of time.
if (!config.ios)
config.ios = {};
config.ios.bundleIdentifier = bundleIdentifier;
return core_plugins_1.withPlugins(config, [
[IOSConfig.BundleIdentifier.withBundleIdentifier, { bundleIdentifier }],
IOSConfig.SwiftBridgingHeader.withSwiftBridgingHeader,
IOSConfig.Google.withGoogle,
IOSConfig.Name.withDisplayName,
IOSConfig.Orientation.withOrientation,
IOSConfig.RequiresFullScreen.withRequiresFullScreen,
IOSConfig.Scheme.withScheme,
IOSConfig.UserInterfaceStyle.withUserInterfaceStyle,
IOSConfig.UsesNonExemptEncryption.withUsesNonExemptEncryption,
IOSConfig.Version.withBuildNumber,
IOSConfig.Version.withVersion,
IOSConfig.Google.withGoogleServicesFile,
// Entitlements
IOSConfig.Entitlements.withAccessesContactNotes,
IOSConfig.Entitlements.withAssociatedDomains,
// XcodeProject
IOSConfig.DeviceFamily.withDeviceFamily,
IOSConfig.Locales.withLocales,
// Dangerous
IOSConfig.Icons.withIcons,
]);
};
/**
* Config plugin to apply all of the custom Expo Android config plugins we support by default.
* TODO: In the future most of this should go into versioned packages like expo-facebook, expo-updates, etc...
*/
exports.withExpoAndroidPlugins = (config, props) => {
// Set the package name ahead of time.
if (!config.android)
config.android = {};
config.android.package = props.package;
return core_plugins_1.withPlugins(config, [
// settings.gradle
AndroidConfig.Name.withNameSettingsGradle,
// project build.gradle
AndroidConfig.GoogleServices.withClassPath,
// app/build.gradle
AndroidConfig.GoogleServices.withApplyPlugin,
AndroidConfig.Package.withPackageGradle,
AndroidConfig.Version.withVersion,
// AndroidManifest.xml
AndroidConfig.Package.withPackageManifest,
AndroidConfig.AllowBackup.withAllowBackup,
// Note: The withAndroidIntentFilters plugin must appear before the withScheme
// plugin or withScheme will override the output of withAndroidIntentFilters.
AndroidConfig.IntentFilters.withAndroidIntentFilters,
AndroidConfig.Scheme.withScheme,
AndroidConfig.Orientation.withOrientation,
AndroidConfig.Permissions.withPermissions,
AndroidConfig.UserInterfaceStyle.withUiModeManifest,
// MainActivity.*
AndroidConfig.UserInterfaceStyle.withUiModeMainActivity,
// strings.xml
AndroidConfig.Name.withName,
// Dangerous -- these plugins run in reverse order.
AndroidConfig.GoogleServices.withGoogleServicesFile,
// Modify colors.xml and styles.xml
AndroidConfig.RootViewBackgroundColor.withRootViewBackgroundColor,
AndroidConfig.NavigationBar.withNavigationBar,
AndroidConfig.StatusBar.withStatusBar,
AndroidConfig.PrimaryColor.withPrimaryColor,
AndroidConfig.Icon.withIcons,
// If we renamed the package, we should also move it around and rename it in source files
// Added last to ensure this plugin runs first. Out of tree solutions will mistakenly resolve the package incorrectly otherwise.
AndroidConfig.Package.withPackageRefactor,
]);
};
exports.withExpoVersionedSDKPlugins = (config, { expoUsername }) => {
return core_plugins_1.withPlugins(config, [
react_native_maps_1.default,
expo_ads_admob_1.default,
expo_apple_authentication_1.default,
expo_notifications_1.default,
[expo_updates_1.default, { expoUsername }],
expo_branch_1.default,
expo_document_picker_1.default,
expo_facebook_1.default,
expo_splash_screen_1.default,
]);
};
//# sourceMappingURL=expo-plugins.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,58 @@
import { ExpoConfig } from '@expo/config-types';
import { JSONObject } from '@expo/json-file';
import { XcodeProject } from 'xcode';
import { ConfigPlugin, Mod } from '../Plugin.types';
import { ExpoPlist, InfoPlist } from '../ios/IosConfig.types';
import { AppDelegateProjectFile } from '../ios/Paths';
declare type MutateInfoPlistAction = (expo: ExpoConfig, infoPlist: InfoPlist) => InfoPlist;
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
export declare function createInfoPlistPlugin(action: MutateInfoPlistAction, name?: string): ConfigPlugin;
declare type MutateEntitlementsPlistAction = (expo: ExpoConfig, entitlements: JSONObject) => JSONObject;
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
export declare function createEntitlementsPlugin(action: MutateEntitlementsPlistAction, name: string): ConfigPlugin;
/**
* Provides the AppDelegate file for modification.
*
* @param config
* @param action
*/
export declare const withAppDelegate: ConfigPlugin<Mod<AppDelegateProjectFile>>;
/**
* Provides the Info.plist file for modification.
* Keeps the config's expo.ios.infoPlist object in sync with the data.
*
* @param config
* @param action
*/
export declare const withInfoPlist: ConfigPlugin<Mod<InfoPlist>>;
/**
* Provides the main .entitlements file for modification.
* Keeps the config's expo.ios.entitlements object in sync with the data.
*
* @param config
* @param action
*/
export declare const withEntitlementsPlist: ConfigPlugin<Mod<JSONObject>>;
/**
* Provides the Expo.plist for modification.
*
* @param config
* @param action
*/
export declare const withExpoPlist: ConfigPlugin<Mod<ExpoPlist>>;
/**
* Provides the main .xcodeproj for modification.
*
* @param config
* @param action
*/
export declare const withXcodeProject: ConfigPlugin<Mod<XcodeProject>>;
export {};

View File

@ -0,0 +1,121 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_plugins_1 = require("./core-plugins");
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
function createInfoPlistPlugin(action, name) {
const withUnknown = config => exports.withInfoPlist(config, async (config) => {
config.modResults = await action(config, config.modResults);
return config;
});
if (name) {
Object.defineProperty(withUnknown, 'name', {
value: name,
});
}
return withUnknown;
}
exports.createInfoPlistPlugin = createInfoPlistPlugin;
/**
* Helper method for creating mods from existing config functions.
*
* @param action
*/
function createEntitlementsPlugin(action, name) {
const withUnknown = config => exports.withEntitlementsPlist(config, async (config) => {
config.modResults = await action(config, config.modResults);
return config;
});
if (name) {
Object.defineProperty(withUnknown, 'name', {
value: name,
});
}
return withUnknown;
}
exports.createEntitlementsPlugin = createEntitlementsPlugin;
/**
* Provides the AppDelegate file for modification.
*
* @param config
* @param action
*/
exports.withAppDelegate = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'ios',
mod: 'appDelegate',
action,
});
};
/**
* Provides the Info.plist file for modification.
* Keeps the config's expo.ios.infoPlist object in sync with the data.
*
* @param config
* @param action
*/
exports.withInfoPlist = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'ios',
mod: 'infoPlist',
async action(config) {
config = await action(config);
if (!config.ios) {
config.ios = {};
}
config.ios.infoPlist = config.modResults;
return config;
},
});
};
/**
* Provides the main .entitlements file for modification.
* Keeps the config's expo.ios.entitlements object in sync with the data.
*
* @param config
* @param action
*/
exports.withEntitlementsPlist = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'ios',
mod: 'entitlements',
async action(config) {
config = await action(config);
if (!config.ios) {
config.ios = {};
}
config.ios.entitlements = config.modResults;
return config;
},
});
};
/**
* Provides the Expo.plist for modification.
*
* @param config
* @param action
*/
exports.withExpoPlist = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'ios',
mod: 'expoPlist',
action,
});
};
/**
* Provides the main .xcodeproj for modification.
*
* @param config
* @param action
*/
exports.withXcodeProject = (config, action) => {
return core_plugins_1.withExtendedMod(config, {
platform: 'ios',
mod: 'xcodeproj',
action,
});
};
//# sourceMappingURL=ios-plugins.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
import { ExportedConfig, ModPlatform } from '../Plugin.types';
/**
*
* @param projectRoot
* @param config
*/
export declare function compileModsAsync(config: ExportedConfig, props: {
projectRoot: string;
platforms?: ModPlatform[];
}): Promise<ExportedConfig>;
/**
* A generic plugin compiler.
*
* @param config
*/
export declare function evalModsAsync(config: ExportedConfig, { projectRoot, platforms }: {
projectRoot: string;
platforms?: ModPlatform[];
}): Promise<ExportedConfig>;

View File

@ -0,0 +1,79 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const Xcodeproj_1 = require("../ios/utils/Xcodeproj");
const compiler_plugins_1 = require("./compiler-plugins");
/**
*
* @param projectRoot
* @param config
*/
async function compileModsAsync(config, props) {
config = compiler_plugins_1.withBaseMods(config);
return await evalModsAsync(config, props);
}
exports.compileModsAsync = compileModsAsync;
function sortMods(commands, order) {
const allKeys = commands.map(([key]) => key);
const completeOrder = [...new Set([...order, ...allKeys])];
const sorted = [];
while (completeOrder.length) {
const group = completeOrder.shift();
const commandSet = commands.find(([key]) => key === group);
if (commandSet) {
sorted.push(commandSet);
}
}
return sorted;
}
const orders = {
ios: [
// dangerous runs first
'dangerous',
// run the XcodeProject mod second because many plugins attempt to read from it.
'xcodeproj',
],
android: ['dangerous'],
};
/**
* A generic plugin compiler.
*
* @param config
*/
async function evalModsAsync(config, { projectRoot, platforms }) {
var _a;
for (const [platformName, platform] of Object.entries((_a = config.mods) !== null && _a !== void 0 ? _a : {})) {
if (platforms && !platforms.includes(platformName)) {
continue;
}
let entries = Object.entries(platform);
if (entries.length) {
// Move dangerous item to the first position if it exists, this ensures that all dangerous code runs first.
entries = sortMods(entries, orders[platformName]);
const platformProjectRoot = path_1.default.join(projectRoot, platformName);
const projectName = platformName === 'ios' ? Xcodeproj_1.getHackyProjectName(projectRoot, config) : undefined;
for (const [modName, mod] of entries) {
const modRequest = {
projectRoot,
projectName,
platformProjectRoot,
platform: platformName,
modName,
};
const results = await mod(Object.assign(Object.assign({}, config), { modResults: null, modRequest }));
// Sanity check to help locate non compliant mods.
config = compiler_plugins_1.resolveModResults(results, platformName, modName);
// @ts-ignore: data is added for modifications
delete config.modResults;
// @ts-ignore: info is added for modifications
delete config.modRequest;
}
}
}
return config;
}
exports.evalModsAsync = evalModsAsync;
//# sourceMappingURL=mod-compiler.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"mod-compiler.js","sourceRoot":"","sources":["../../src/plugins/mod-compiler.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAGxB,sDAA6D;AAC7D,yDAAqE;AAErE;;;;GAIG;AACI,KAAK,UAAU,gBAAgB,CACpC,MAAsB,EACtB,KAAyD;IAEzD,MAAM,GAAG,+BAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,MAAM,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAND,4CAMC;AAED,SAAS,QAAQ,CAAC,QAAyB,EAAE,KAAe;IAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,OAAO,aAAa,CAAC,MAAM,EAAE;QAC3B,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,EAAG,CAAC;QACrC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC;QAC3D,IAAI,UAAU,EAAE;YACd,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACzB;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,MAAM,GAA6B;IACvC,GAAG,EAAE;QACH,uBAAuB;QACvB,WAAW;QACX,gFAAgF;QAChF,WAAW;KACZ;IACD,OAAO,EAAE,CAAC,WAAW,CAAC;CACvB,CAAC;AACF;;;;GAIG;AACI,KAAK,UAAU,aAAa,CACjC,MAAsB,EACtB,EAAE,WAAW,EAAE,SAAS,EAAsD;;IAE9E,KAAK,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,OAAC,MAAM,CAAC,IAAI,mCAAK,EAAgB,CAAC,EAAE;QACvF,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAmB,CAAC,EAAE;YACzD,SAAS;SACV;QAED,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,2GAA2G;YAC3G,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,YAAY,CAAE,CAAC,CAAC;YAEnD,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YACjE,MAAM,WAAW,GACf,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,+BAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAEhF,KAAK,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE;gBACpC,MAAM,UAAU,GAAG;oBACjB,WAAW;oBACX,WAAW;oBACX,mBAAmB;oBACnB,QAAQ,EAAE,YAA2B;oBACrC,OAAO;iBACR,CAAC;gBAEF,MAAM,OAAO,GAAG,MAAO,GAAW,iCAC7B,MAAM,KACT,UAAU,EAAE,IAAI,EAChB,UAAU,IACV,CAAC;gBAEH,kDAAkD;gBAClD,MAAM,GAAG,oCAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;gBAC3D,8CAA8C;gBAC9C,OAAO,MAAM,CAAC,UAAU,CAAC;gBACzB,8CAA8C;gBAC9C,OAAO,MAAM,CAAC,UAAU,CAAC;aAC1B;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA5CD,sCA4CC","sourcesContent":["import path from 'path';\n\nimport { ExportedConfig, Mod, ModConfig, ModPlatform } from '../Plugin.types';\nimport { getHackyProjectName } from '../ios/utils/Xcodeproj';\nimport { resolveModResults, withBaseMods } from './compiler-plugins';\n\n/**\n *\n * @param projectRoot\n * @param config\n */\nexport async function compileModsAsync(\n config: ExportedConfig,\n props: { projectRoot: string; platforms?: ModPlatform[] }\n): Promise<ExportedConfig> {\n config = withBaseMods(config);\n return await evalModsAsync(config, props);\n}\n\nfunction sortMods(commands: [string, any][], order: string[]): [string, any][] {\n const allKeys = commands.map(([key]) => key);\n const completeOrder = [...new Set([...order, ...allKeys])];\n const sorted: [string, any][] = [];\n while (completeOrder.length) {\n const group = completeOrder.shift()!;\n const commandSet = commands.find(([key]) => key === group);\n if (commandSet) {\n sorted.push(commandSet);\n }\n }\n return sorted;\n}\n\nconst orders: Record<string, string[]> = {\n ios: [\n // dangerous runs first\n 'dangerous',\n // run the XcodeProject mod second because many plugins attempt to read from it.\n 'xcodeproj',\n ],\n android: ['dangerous'],\n};\n/**\n * A generic plugin compiler.\n *\n * @param config\n */\nexport async function evalModsAsync(\n config: ExportedConfig,\n { projectRoot, platforms }: { projectRoot: string; platforms?: ModPlatform[] }\n): Promise<ExportedConfig> {\n for (const [platformName, platform] of Object.entries(config.mods ?? ({} as ModConfig))) {\n if (platforms && !platforms.includes(platformName as any)) {\n continue;\n }\n\n let entries = Object.entries(platform);\n if (entries.length) {\n // Move dangerous item to the first position if it exists, this ensures that all dangerous code runs first.\n entries = sortMods(entries, orders[platformName]!);\n\n const platformProjectRoot = path.join(projectRoot, platformName);\n const projectName =\n platformName === 'ios' ? getHackyProjectName(projectRoot, config) : undefined;\n\n for (const [modName, mod] of entries) {\n const modRequest = {\n projectRoot,\n projectName,\n platformProjectRoot,\n platform: platformName as ModPlatform,\n modName,\n };\n\n const results = await (mod as Mod)({\n ...config,\n modResults: null,\n modRequest,\n });\n\n // Sanity check to help locate non compliant mods.\n config = resolveModResults(results, platformName, modName);\n // @ts-ignore: data is added for modifications\n delete config.modResults;\n // @ts-ignore: info is added for modifications\n delete config.modRequest;\n }\n }\n }\n\n return config;\n}\n"]}

View File

@ -0,0 +1,17 @@
import { ConfigPlugin, StaticPlugin } from '../Plugin.types';
/**
* Resolves static module plugin and potentially falls back on a provided plugin if the module cannot be resolved
*
* @param config
* @param fallback Plugin with `_resolverError` explaining why the module couldn't be used
* @param projectRoot optional project root, fallback to _internal.projectRoot. Used for testing.
* @param _isLegacyPlugin Used to suppress errors thrown by plugins that are applied automatically
*/
export declare const withStaticPlugin: ConfigPlugin<{
plugin: StaticPlugin | ConfigPlugin | string;
fallback?: ConfigPlugin<{
_resolverError: Error;
} & any>;
projectRoot?: string;
_isLegacyPlugin?: boolean;
}>;

View File

@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const getenv_1 = require("getenv");
const errors_1 = require("../utils/errors");
const plugin_resolver_1 = require("../utils/plugin-resolver");
const EXPO_DEBUG = getenv_1.boolish('EXPO_DEBUG', false);
const EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = getenv_1.boolish('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false);
function isModuleMissingError(name, error) {
// @ts-ignore
if (error.code === 'MODULE_NOT_FOUND') {
return true;
}
return error.message.includes(`Cannot find module '${name}'`);
}
function isUnexpectedTokenError(error) {
if (error instanceof SyntaxError) {
return (
// These are the most common errors that'll be thrown when a package isn't transpiled correctly.
!!error.message.match(/Unexpected token/) ||
!!error.message.match(/Cannot use import statement/));
}
return false;
}
/**
* Resolves static module plugin and potentially falls back on a provided plugin if the module cannot be resolved
*
* @param config
* @param fallback Plugin with `_resolverError` explaining why the module couldn't be used
* @param projectRoot optional project root, fallback to _internal.projectRoot. Used for testing.
* @param _isLegacyPlugin Used to suppress errors thrown by plugins that are applied automatically
*/
exports.withStaticPlugin = (config, props) => {
var _a;
let projectRoot = props.projectRoot;
if (!projectRoot) {
projectRoot = (_a = config._internal) === null || _a === void 0 ? void 0 : _a.projectRoot;
plugin_resolver_1.assertInternalProjectRoot(projectRoot);
}
let [pluginResolve, pluginProps] = plugin_resolver_1.normalizeStaticPlugin(props.plugin);
// Ensure no one uses this property by accident.
errors_1.assert(!(pluginProps === null || pluginProps === void 0 ? void 0 : pluginProps._resolverError), `Plugin property '_resolverError' is a reserved property of \`withStaticPlugin\``);
let withPlugin;
// Function was provided, no need to resolve: [withPlugin, {}]
if (typeof pluginResolve === 'function') {
withPlugin = pluginResolve;
}
else if (typeof pluginResolve === 'string') {
try {
// Resolve and evaluate plugins.
withPlugin = plugin_resolver_1.resolveConfigPluginFunction(projectRoot, pluginResolve);
}
catch (error) {
if (EXPO_DEBUG) {
if (EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS) {
// Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).
console.log(`Error resolving plugin "${pluginResolve}"`);
console.log(error);
console.log();
}
else {
const shouldMuteWarning = props._isLegacyPlugin &&
(isModuleMissingError(pluginResolve, error) || isUnexpectedTokenError(error));
if (!shouldMuteWarning) {
if (isModuleMissingError(pluginResolve, error)) {
// Prevent causing log spew for basic resolution errors.
console.log(`Could not find plugin "${pluginResolve}"`);
}
else {
// Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).
console.log(`Error resolving plugin "${pluginResolve}"`);
console.log(error);
console.log();
}
}
}
}
// TODO: Maybe allow for `PluginError`s to be thrown so external plugins can assert invalid options.
// If the static module failed to resolve, attempt to use a fallback.
// This enables support for built-in plugins with versioned variations living in other packages.
if (props.fallback) {
if (!pluginProps)
pluginProps = {};
// Pass this to the fallback plugin for potential warnings about needing to install a versioned package.
pluginProps._resolverError = error;
withPlugin = props.fallback;
}
else {
// If no fallback, throw the resolution error.
throw error;
}
}
}
else {
throw new errors_1.PluginError(`Plugin is an unexpected type: ${typeof pluginResolve}`, 'INVALID_PLUGIN_TYPE');
}
// Execute the plugin.
config = withPlugin(config, pluginProps);
return config;
};
//# sourceMappingURL=static-plugins.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withAdMob: ConfigPlugin;
export default withAdMob;

View File

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const AdMob_1 = require("../../android/AdMob");
const AdMob_2 = require("../../ios/AdMob");
const core_plugins_1 = require("../core-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'expo-ads-admob';
exports.withAdMob = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedAdMob,
});
};
const withUnversionedAdMob = core_plugins_1.createRunOncePlugin(config => {
config = AdMob_1.withAdMob(config);
config = AdMob_2.withAdMob(config);
return config;
}, packageName);
exports.default = exports.withAdMob;
//# sourceMappingURL=expo-ads-admob.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-ads-admob.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-ads-admob.ts"],"names":[],"mappings":";;AACA,+CAAoE;AACpE,2CAA4D;AAC5D,kDAAsD;AACtD,sDAAqD;AAErD,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAExB,QAAA,SAAS,GAAiB,MAAM,CAAC,EAAE;IAC9C,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,oBAAoB;KAC/B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IACtE,MAAM,GAAG,iBAAgB,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,GAAG,iBAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,iBAAS,CAAC","sourcesContent":["import { ConfigPlugin } from '../../Plugin.types';\nimport { withAdMob as withAdMobAndroid } from '../../android/AdMob';\nimport { withAdMob as withAdMobIOS } from '../../ios/AdMob';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'expo-ads-admob';\n\nexport const withAdMob: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedAdMob,\n });\n};\n\nconst withUnversionedAdMob: ConfigPlugin = createRunOncePlugin(config => {\n config = withAdMobAndroid(config);\n config = withAdMobIOS(config);\n return config;\n}, packageName);\n\nexport default withAdMob;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withAppleAuthentication: ConfigPlugin;
export default withAppleAuthentication;

View File

@ -0,0 +1,40 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_plugins_1 = require("../core-plugins");
const ios_plugins_1 = require("../ios-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'expo-apple-authentication';
const withAppleSignInEntitlement = ios_plugins_1.createEntitlementsPlugin(setAppleSignInEntitlement, 'withAppleSignInEntitlement');
function setAppleSignInEntitlement(config, _a) {
var _b;
var { 'com.apple.developer.applesignin': _ } = _a, entitlementsPlist = __rest(_a, ['com.apple.developer.applesignin']);
if ((_b = config.ios) === null || _b === void 0 ? void 0 : _b.usesAppleSignIn) {
return Object.assign(Object.assign({}, entitlementsPlist), { 'com.apple.developer.applesignin': ['Default'] });
}
return entitlementsPlist;
}
exports.withAppleAuthentication = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedAppleAuthentication,
});
};
const withUnversionedAppleAuthentication = core_plugins_1.createRunOncePlugin(config => {
config = withAppleSignInEntitlement(config);
return config;
}, packageName);
exports.default = exports.withAppleAuthentication;
//# sourceMappingURL=expo-apple-authentication.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-apple-authentication.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-apple-authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAIA,kDAAsD;AACtD,gDAA0D;AAC1D,sDAAqD;AAErD,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEhD,MAAM,0BAA0B,GAAG,sCAAwB,CACzD,yBAAyB,EACzB,4BAA4B,CAC7B,CAAC;AAEF,SAAS,yBAAyB,CAChC,MAAkB,EAClB,EAA0E;;QAA1E,EAAE,iCAAiC,EAAE,CAAC,OAAoC,EAAlC,mEAAoB;IAE5D,UAAI,MAAM,CAAC,GAAG,0CAAE,eAAe,EAAE;QAC/B,uCACK,iBAAiB,KACpB,iCAAiC,EAAE,CAAC,SAAS,CAAC,IAC9C;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAEY,QAAA,uBAAuB,GAAiB,MAAM,CAAC,EAAE;IAC5D,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,kCAAkC;KAC7C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,kCAAkC,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IACpF,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,+BAAuB,CAAC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\n\nimport { ConfigPlugin } from '../../Plugin.types';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { createEntitlementsPlugin } from '../ios-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'expo-apple-authentication';\n\nconst withAppleSignInEntitlement = createEntitlementsPlugin(\n setAppleSignInEntitlement,\n 'withAppleSignInEntitlement'\n);\n\nfunction setAppleSignInEntitlement(\n config: ExpoConfig,\n { 'com.apple.developer.applesignin': _, ...entitlementsPlist }: JSONObject\n): JSONObject {\n if (config.ios?.usesAppleSignIn) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.applesignin': ['Default'],\n };\n }\n\n return entitlementsPlist;\n}\n\nexport const withAppleAuthentication: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedAppleAuthentication,\n });\n};\n\nconst withUnversionedAppleAuthentication: ConfigPlugin = createRunOncePlugin(config => {\n config = withAppleSignInEntitlement(config);\n return config;\n}, packageName);\n\nexport default withAppleAuthentication;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withBranch: ConfigPlugin;
export default withBranch;

View File

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Branch_1 = require("../../android/Branch");
const Branch_2 = require("../../ios/Branch");
const core_plugins_1 = require("../core-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'expo-branch';
exports.withBranch = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedBranch,
});
};
const withUnversionedBranch = core_plugins_1.createRunOncePlugin(config => {
config = Branch_1.withBranch(config);
config = Branch_2.withBranch(config);
return config;
}, packageName);
exports.default = exports.withBranch;
//# sourceMappingURL=expo-branch.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-branch.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-branch.ts"],"names":[],"mappings":";;AACA,iDAAuE;AACvE,6CAA+D;AAC/D,kDAAsD;AACtD,sDAAqD;AAErD,MAAM,WAAW,GAAG,aAAa,CAAC;AAErB,QAAA,UAAU,GAAiB,MAAM,CAAC,EAAE;IAC/C,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,qBAAqB;KAChC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IACvE,MAAM,GAAG,mBAAiB,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,GAAG,mBAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,kBAAU,CAAC","sourcesContent":["import { ConfigPlugin } from '../../Plugin.types';\nimport { withBranch as withBranchAndroid } from '../../android/Branch';\nimport { withBranch as withBranchIOS } from '../../ios/Branch';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'expo-branch';\n\nexport const withBranch: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedBranch,\n });\n};\n\nconst withUnversionedBranch: ConfigPlugin = createRunOncePlugin(config => {\n config = withBranchAndroid(config);\n config = withBranchIOS(config);\n return config;\n}, packageName);\n\nexport default withBranch;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
declare const withDocumentPicker: ConfigPlugin;
export default withDocumentPicker;

View File

@ -0,0 +1,45 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const WarningAggregator = __importStar(require("../../utils/warnings"));
const core_plugins_1 = require("../core-plugins");
const ios_plugins_1 = require("../ios-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'expo-document-picker';
const withICloudEntitlement = (config, { appleTeamId }) => {
return ios_plugins_1.withEntitlementsPlist(config, config => {
config.modResults = setICloudEntitlement(config, config.modResults, appleTeamId);
return config;
});
};
function setICloudEntitlement(config, entitlementsPlist, appleTeamId) {
var _a;
if ((_a = config.ios) === null || _a === void 0 ? void 0 : _a.usesIcloudStorage) {
// TODO: need access to the appleTeamId for this one!
WarningAggregator.addWarningIOS('ios.usesIcloudStorage', 'Enable the iCloud Storage Entitlement from the Capabilities tab in your Xcode project.'
// TODO: add a link to a docs page with more information on how to do this
);
}
return entitlementsPlist;
}
const withUnversionedDocumentPicker = core_plugins_1.createRunOncePlugin(config => {
// No mechanism to get Apple Team ID.
config = withICloudEntitlement(config, { appleTeamId: 'TODO-GET-APPLE-TEAM-ID' });
return config;
}, packageName);
const withDocumentPicker = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedDocumentPicker,
});
};
exports.default = withDocumentPicker;
//# sourceMappingURL=expo-document-picker.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-document-picker.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-document-picker.ts"],"names":[],"mappings":";;;;;;;;;AAIA,wEAA0D;AAC1D,kDAAsD;AACtD,gDAAuD;AACvD,sDAAqD;AAErD,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAE3C,MAAM,qBAAqB,GAA0C,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;IAC/F,OAAO,mCAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QAC5C,MAAM,CAAC,UAAU,GAAG,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACjF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAC3B,MAAkB,EAClB,iBAA6B,EAC7B,WAAmB;;IAEnB,UAAI,MAAM,CAAC,GAAG,0CAAE,iBAAiB,EAAE;QACjC,qDAAqD;QACrD,iBAAiB,CAAC,aAAa,CAC7B,uBAAuB,EACvB,wFAAwF;QACxF,0EAA0E;SAC3E,CAAC;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,6BAA6B,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IAC/E,qCAAqC;IACrC,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,MAAM,kBAAkB,GAAiB,MAAM,CAAC,EAAE;IAChD,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,6BAA6B;KACxC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\n\nimport { ConfigPlugin } from '../../Plugin.types';\nimport * as WarningAggregator from '../../utils/warnings';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withEntitlementsPlist } from '../ios-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'expo-document-picker';\n\nconst withICloudEntitlement: ConfigPlugin<{ appleTeamId: string }> = (config, { appleTeamId }) => {\n return withEntitlementsPlist(config, config => {\n config.modResults = setICloudEntitlement(config, config.modResults, appleTeamId);\n return config;\n });\n};\n\nfunction setICloudEntitlement(\n config: ExpoConfig,\n entitlementsPlist: JSONObject,\n appleTeamId: string\n): JSONObject {\n if (config.ios?.usesIcloudStorage) {\n // TODO: need access to the appleTeamId for this one!\n WarningAggregator.addWarningIOS(\n 'ios.usesIcloudStorage',\n 'Enable the iCloud Storage Entitlement from the Capabilities tab in your Xcode project.'\n // TODO: add a link to a docs page with more information on how to do this\n );\n }\n\n return entitlementsPlist;\n}\n\nconst withUnversionedDocumentPicker: ConfigPlugin = createRunOncePlugin(config => {\n // No mechanism to get Apple Team ID.\n config = withICloudEntitlement(config, { appleTeamId: 'TODO-GET-APPLE-TEAM-ID' });\n return config;\n}, packageName);\n\nconst withDocumentPicker: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedDocumentPicker,\n });\n};\n\nexport default withDocumentPicker;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withFacebook: ConfigPlugin;
export default withFacebook;

View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Facebook_1 = require("../../android/Facebook");
const Facebook_2 = require("../../ios/Facebook");
const core_plugins_1 = require("../core-plugins");
const static_plugins_1 = require("../static-plugins");
// Local unversioned facebook plugin
const packageName = 'expo-facebook';
exports.withFacebook = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedFacebook,
});
};
const withUnversionedFacebook = core_plugins_1.createRunOncePlugin(config => {
config = Facebook_1.withFacebookManifest(config);
config = Facebook_1.withFacebookAppIdString(config);
config = Facebook_2.withFacebook(config);
return config;
}, packageName);
exports.default = exports.withFacebook;
//# sourceMappingURL=expo-facebook.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-facebook.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-facebook.ts"],"names":[],"mappings":";;AACA,qDAAuF;AACvF,iDAAqE;AACrE,kDAAsD;AACtD,sDAAqD;AAErD,oCAAoC;AAEpC,MAAM,WAAW,GAAG,eAAe,CAAC;AAEvB,QAAA,YAAY,GAAiB,MAAM,CAAC,EAAE;IACjD,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,uBAAuB;KAClC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IACzE,MAAM,GAAG,+BAAoB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,GAAG,kCAAuB,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,GAAG,uBAAe,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,oBAAY,CAAC","sourcesContent":["import { ConfigPlugin } from '../../Plugin.types';\nimport { withFacebookAppIdString, withFacebookManifest } from '../../android/Facebook';\nimport { withFacebook as withFacebookIOS } from '../../ios/Facebook';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\n// Local unversioned facebook plugin\n\nconst packageName = 'expo-facebook';\n\nexport const withFacebook: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedFacebook,\n });\n};\n\nconst withUnversionedFacebook: ConfigPlugin = createRunOncePlugin(config => {\n config = withFacebookManifest(config);\n config = withFacebookAppIdString(config);\n config = withFacebookIOS(config);\n return config;\n}, packageName);\n\nexport default withFacebook;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withNotifications: ConfigPlugin;
export default withNotifications;

View File

@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Notifications_1 = require("../../android/Notifications");
const core_plugins_1 = require("../core-plugins");
const ios_plugins_1 = require("../ios-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'expo-notifications';
exports.withNotifications = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedNotifications,
});
};
const withNotificationsEntitlement = (config, mode) => {
return ios_plugins_1.withEntitlementsPlist(config, config => {
config.modResults['aps-environment'] = mode;
return config;
});
};
const withUnversionedNotifications = core_plugins_1.createRunOncePlugin(config => {
// Android
config = Notifications_1.withNotificationManifest(config);
config = Notifications_1.withNotificationIconColor(config);
config = Notifications_1.withNotificationIcons(config);
// iOS
config = withNotificationsEntitlement(config, 'development');
return config;
}, packageName);
exports.default = exports.withNotifications;
//# sourceMappingURL=expo-notifications.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-notifications.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-notifications.ts"],"names":[],"mappings":";;AACA,+DAIqC;AACrC,kDAAsD;AACtD,gDAAuD;AACvD,sDAAqD;AAErD,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAE5B,QAAA,iBAAiB,GAAiB,MAAM,CAAC,EAAE;IACtD,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,4BAA4B;KACvC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAA+C,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;IAChG,OAAO,mCAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QAC5C,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;QAC5C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IAC9E,UAAU;IACV,MAAM,GAAG,wCAAwB,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,GAAG,yCAAyB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,qCAAqB,CAAC,MAAM,CAAC,CAAC;IAEvC,MAAM;IACN,MAAM,GAAG,4BAA4B,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE7D,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,yBAAiB,CAAC","sourcesContent":["import { ConfigPlugin } from '../../Plugin.types';\nimport {\n withNotificationIconColor,\n withNotificationIcons,\n withNotificationManifest,\n} from '../../android/Notifications';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withEntitlementsPlist } from '../ios-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'expo-notifications';\n\nexport const withNotifications: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedNotifications,\n });\n};\n\nconst withNotificationsEntitlement: ConfigPlugin<'production' | 'development'> = (config, mode) => {\n return withEntitlementsPlist(config, config => {\n config.modResults['aps-environment'] = mode;\n return config;\n });\n};\n\nconst withUnversionedNotifications: ConfigPlugin = createRunOncePlugin(config => {\n // Android\n config = withNotificationManifest(config);\n config = withNotificationIconColor(config);\n config = withNotificationIcons(config);\n\n // iOS\n config = withNotificationsEntitlement(config, 'development');\n\n return config;\n}, packageName);\n\nexport default withNotifications;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withSplashScreen: ConfigPlugin;
export default withSplashScreen;

View File

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const SplashScreen_1 = require("../../android/SplashScreen");
const SplashScreen_2 = require("../../ios/SplashScreen");
const core_plugins_1 = require("../core-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'expo-splash-screen';
exports.withSplashScreen = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedSplashScreen,
});
};
const withUnversionedSplashScreen = core_plugins_1.createRunOncePlugin(config => {
config = SplashScreen_1.withSplashScreen(config);
config = SplashScreen_2.withSplashScreen(config);
return config;
}, packageName);
exports.default = exports.withSplashScreen;
//# sourceMappingURL=expo-splash-screen.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-splash-screen.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-splash-screen.ts"],"names":[],"mappings":";;AACA,6DAAyF;AACzF,yDAAiF;AACjF,kDAAsD;AACtD,sDAAqD;AAErD,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAE5B,QAAA,gBAAgB,GAAiB,MAAM,CAAC,EAAE;IACrD,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,2BAA2B;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;IAC7E,MAAM,GAAG,+BAAuB,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,GAAG,+BAAmB,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,wBAAgB,CAAC","sourcesContent":["import { ConfigPlugin } from '../../Plugin.types';\nimport { withSplashScreen as withSplashScreenAndroid } from '../../android/SplashScreen';\nimport { withSplashScreen as withSplashScreenIOS } from '../../ios/SplashScreen';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'expo-splash-screen';\n\nexport const withSplashScreen: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedSplashScreen,\n });\n};\n\nconst withUnversionedSplashScreen: ConfigPlugin = createRunOncePlugin(config => {\n config = withSplashScreenAndroid(config);\n config = withSplashScreenIOS(config);\n return config;\n}, packageName);\n\nexport default withSplashScreen;\n"]}

View File

@ -0,0 +1,5 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withUpdates: ConfigPlugin<{
expoUsername: string;
}>;
export default withUpdates;

View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Updates_1 = require("../../android/Updates");
const Updates_2 = require("../../ios/Updates");
const core_plugins_1 = require("../core-plugins");
const static_plugins_1 = require("../static-plugins");
// Local unversioned updates plugin
const packageName = 'expo-updates';
exports.withUpdates = (config, props) => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
// Pass props to the static plugin if it exists.
plugin: [packageName, props],
// If the static plugin isn't found, use the unversioned one.
fallback: config => withUnversionedUpdates(config, props),
});
};
const withUnversionedUpdates = core_plugins_1.createRunOncePlugin((config, props) => {
config = Updates_1.withUpdates(config, props);
config = Updates_2.withUpdates(config, props);
return config;
}, packageName);
exports.default = exports.withUpdates;
//# sourceMappingURL=expo-updates.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expo-updates.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/expo-updates.ts"],"names":[],"mappings":";;AACA,mDAA0E;AAC1E,+CAAkE;AAClE,kDAAsD;AACtD,sDAAqD;AAErD,mCAAmC;AAEnC,MAAM,WAAW,GAAG,cAAc,CAAC;AAEtB,QAAA,WAAW,GAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;IACnF,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,gDAAgD;QAChD,MAAM,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC;QAC5B,6DAA6D;QAC7D,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAA2C,kCAAmB,CACxF,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;IAChB,MAAM,GAAG,qBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3C,MAAM,GAAG,qBAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC,EACD,WAAW,CACZ,CAAC;AAEF,kBAAe,mBAAW,CAAC","sourcesContent":["import { ConfigPlugin } from '../../Plugin.types';\nimport { withUpdates as withUpdatesAndroid } from '../../android/Updates';\nimport { withUpdates as withUpdatesIOS } from '../../ios/Updates';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\n// Local unversioned updates plugin\n\nconst packageName = 'expo-updates';\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string }> = (config, props) => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n // Pass props to the static plugin if it exists.\n plugin: [packageName, props],\n // If the static plugin isn't found, use the unversioned one.\n fallback: config => withUnversionedUpdates(config, props),\n });\n};\n\nconst withUnversionedUpdates: ConfigPlugin<{ expoUsername: string }> = createRunOncePlugin(\n (config, props) => {\n config = withUpdatesAndroid(config, props);\n config = withUpdatesIOS(config, props);\n return config;\n },\n packageName\n);\n\nexport default withUpdates;\n"]}

View File

@ -0,0 +1,3 @@
import { ConfigPlugin } from '../../Plugin.types';
export declare const withMaps: ConfigPlugin;
export default withMaps;

View File

@ -0,0 +1,48 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const resolve_from_1 = __importDefault(require("resolve-from"));
const GoogleMapsApiKey_1 = require("../../android/GoogleMapsApiKey");
const Permissions_1 = require("../../android/Permissions");
const Maps_1 = require("../../ios/Maps");
const core_plugins_1 = require("../core-plugins");
const static_plugins_1 = require("../static-plugins");
const packageName = 'react-native-maps';
const LOCATION_USAGE = 'Allow $(PRODUCT_NAME) to access your location';
// Copied from expo-location package, this gets used when the
// user has react-native-maps installed but not expo-location.
const withDefaultLocationPermissions = config => {
if (!config.ios)
config.ios = {};
if (!config.ios.infoPlist)
config.ios.infoPlist = {};
config.ios.infoPlist.NSLocationWhenInUseUsageDescription =
config.ios.infoPlist.NSLocationWhenInUseUsageDescription || LOCATION_USAGE;
return Permissions_1.withPermissions(config, [
'android.permission.ACCESS_COARSE_LOCATION',
'android.permission.ACCESS_FINE_LOCATION',
]);
};
exports.withMaps = config => {
return static_plugins_1.withStaticPlugin(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: withUnversionedMaps,
});
};
const withUnversionedMaps = core_plugins_1.createRunOncePlugin(config => {
var _a, _b;
config = GoogleMapsApiKey_1.withGoogleMapsApiKey(config);
config = Maps_1.withMaps(config);
// Only add location permissions if react-native-maps is installed.
if (((_a = config._internal) === null || _a === void 0 ? void 0 : _a.projectRoot) &&
resolve_from_1.default.silent((_b = config._internal) === null || _b === void 0 ? void 0 : _b.projectRoot, 'react-native-maps')) {
config = withDefaultLocationPermissions(config);
}
return config;
}, packageName);
exports.default = exports.withMaps;
//# sourceMappingURL=react-native-maps.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"react-native-maps.js","sourceRoot":"","sources":["../../../src/plugins/unversioned/react-native-maps.ts"],"names":[],"mappings":";;;;;AAAA,gEAAuC;AAGvC,qEAAsE;AACtE,2DAA4D;AAC5D,yCAAyD;AACzD,kDAAsD;AACtD,sDAAqD;AAErD,MAAM,WAAW,GAAG,mBAAmB,CAAC;AACxC,MAAM,cAAc,GAAG,+CAA+C,CAAC;AAEvE,6DAA6D;AAC7D,8DAA8D;AAC9D,MAAM,8BAA8B,GAAiB,MAAM,CAAC,EAAE;IAC5D,IAAI,CAAC,MAAM,CAAC,GAAG;QAAE,MAAM,CAAC,GAAG,GAAG,EAAE,CAAC;IACjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS;QAAE,MAAM,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC;IACrD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAmC;QACtD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAmC,IAAI,cAAc,CAAC;IAE7E,OAAO,6BAAe,CAAC,MAAM,EAAE;QAC7B,2CAA2C;QAC3C,yCAAyC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC;AAEW,QAAA,QAAQ,GAAiB,MAAM,CAAC,EAAE;IAC7C,OAAO,iCAAgB,CAAC,MAAM,EAAE;QAC9B,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,WAAW;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,mBAAmB;KAC9B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAiB,kCAAmB,CAAC,MAAM,CAAC,EAAE;;IACrE,MAAM,GAAG,uCAAoB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,GAAG,eAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,mEAAmE;IACnE,IACE,OAAA,MAAM,CAAC,SAAS,0CAAE,WAAW;QAC7B,sBAAW,CAAC,MAAM,CAAC,MAAA,MAAM,CAAC,SAAS,0CAAE,WAAY,EAAE,mBAAmB,CAAC,EACvE;QACA,MAAM,GAAG,8BAA8B,CAAC,MAAM,CAAC,CAAC;KACjD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEhB,kBAAe,gBAAQ,CAAC","sourcesContent":["import resolveFrom from 'resolve-from';\n\nimport { ConfigPlugin } from '../../Plugin.types';\nimport { withGoogleMapsApiKey } from '../../android/GoogleMapsApiKey';\nimport { withPermissions } from '../../android/Permissions';\nimport { withMaps as withMapsIOS } from '../../ios/Maps';\nimport { createRunOncePlugin } from '../core-plugins';\nimport { withStaticPlugin } from '../static-plugins';\n\nconst packageName = 'react-native-maps';\nconst LOCATION_USAGE = 'Allow $(PRODUCT_NAME) to access your location';\n\n// Copied from expo-location package, this gets used when the\n// user has react-native-maps installed but not expo-location.\nconst withDefaultLocationPermissions: ConfigPlugin = config => {\n if (!config.ios) config.ios = {};\n if (!config.ios.infoPlist) config.ios.infoPlist = {};\n config.ios.infoPlist.NSLocationWhenInUseUsageDescription =\n config.ios.infoPlist.NSLocationWhenInUseUsageDescription || LOCATION_USAGE;\n\n return withPermissions(config, [\n 'android.permission.ACCESS_COARSE_LOCATION',\n 'android.permission.ACCESS_FINE_LOCATION',\n ]);\n};\n\nexport const withMaps: ConfigPlugin = config => {\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: withUnversionedMaps,\n });\n};\n\nconst withUnversionedMaps: ConfigPlugin = createRunOncePlugin(config => {\n config = withGoogleMapsApiKey(config);\n config = withMapsIOS(config);\n // Only add location permissions if react-native-maps is installed.\n if (\n config._internal?.projectRoot &&\n resolveFrom.silent(config._internal?.projectRoot!, 'react-native-maps')\n ) {\n config = withDefaultLocationPermissions(config);\n }\n return config;\n}, packageName);\n\nexport default withMaps;\n"]}