first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
type Bitcode = NonNullable<ExpoConfig['ios']>['bitcode'];
/**
* Plugin to set a bitcode preference for the Xcode project
* based on the project's Expo config `ios.bitcode` value.
*/
export declare const withBitcode: ConfigPlugin;
/**
* Plugin to set a custom bitcode preference for the Xcode project.
* Does not read from the Expo config `ios.bitcode`.
*
* @param bitcode custom bitcode setting.
*/
export declare const withCustomBitcode: ConfigPlugin<Bitcode>;
/**
* Get the bitcode preference from the Expo config.
*/
export declare function getBitcode(config: Pick<ExpoConfig, 'ios'>): Bitcode;
/**
* Enable or disable the `ENABLE_BITCODE` property of the project configurations.
*/
export declare function setBitcodeWithConfig(config: Pick<ExpoConfig, 'ios'>, { project }: {
project: XcodeProject;
}): XcodeProject;
/**
* Enable or disable the `ENABLE_BITCODE` property.
*/
export declare function setBitcode(bitcode: Bitcode, { project }: {
project: XcodeProject;
}): XcodeProject;
export {};

110
node_modules/@expo/config-plugins/build/ios/Bitcode.js generated vendored Normal file
View File

@@ -0,0 +1,110 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBitcode = getBitcode;
exports.setBitcode = setBitcode;
exports.setBitcodeWithConfig = setBitcodeWithConfig;
exports.withCustomBitcode = exports.withBitcode = void 0;
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _warnings() {
const data = require("../utils/warnings");
_warnings = function () {
return data;
};
return data;
}
/**
* Plugin to set a bitcode preference for the Xcode project
* based on the project's Expo config `ios.bitcode` value.
*/
const withBitcode = config => {
return (0, _iosPlugins().withXcodeProject)(config, async config => {
config.modResults = await setBitcodeWithConfig(config, {
project: config.modResults
});
return config;
});
};
/**
* Plugin to set a custom bitcode preference for the Xcode project.
* Does not read from the Expo config `ios.bitcode`.
*
* @param bitcode custom bitcode setting.
*/
exports.withBitcode = withBitcode;
const withCustomBitcode = (config, bitcode) => {
return (0, _iosPlugins().withXcodeProject)(config, async config => {
config.modResults = await setBitcode(bitcode, {
project: config.modResults
});
return config;
});
};
/**
* Get the bitcode preference from the Expo config.
*/
exports.withCustomBitcode = withCustomBitcode;
function getBitcode(config) {
return config.ios?.bitcode;
}
/**
* Enable or disable the `ENABLE_BITCODE` property of the project configurations.
*/
function setBitcodeWithConfig(config, {
project
}) {
const bitcode = getBitcode(config);
return setBitcode(bitcode, {
project
});
}
/**
* Enable or disable the `ENABLE_BITCODE` property.
*/
function setBitcode(bitcode, {
project
}) {
const isDefaultBehavior = bitcode == null;
// If the value is undefined, then do nothing.
if (isDefaultBehavior) {
return project;
}
const targetName = typeof bitcode === 'string' ? bitcode : undefined;
const isBitcodeEnabled = !!bitcode;
if (targetName) {
// Assert if missing
const configs = Object.entries(project.pbxXCBuildConfigurationSection()).filter(_Xcodeproj().isNotComment);
const hasConfiguration = configs.find(([, configuration]) => configuration.name === targetName);
if (hasConfiguration) {
// If targetName is defined then disable bitcode everywhere.
project.addBuildProperty('ENABLE_BITCODE', 'NO');
} else {
const names = [
// Remove duplicates, wrap in double quotes, and sort alphabetically.
...new Set(configs.map(([, configuration]) => `"${configuration.name}"`))].sort();
(0, _warnings().addWarningIOS)('ios.bitcode', `No configuration named "${targetName}". Expected one of: ${names.join(', ')}.`);
}
}
project.addBuildProperty('ENABLE_BITCODE', isBitcodeEnabled ? 'YES' : 'NO', targetName);
return project;
}
//# sourceMappingURL=Bitcode.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
import type { ExpoConfig } from '@expo/config-types';
import type { ConfigPlugin } from '../Plugin.types';
import { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';
/**
* Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.
*
* The factory supports two modes from generic type inference
* ```ts
* // config-plugin without `props`, it will implicitly use the expo config as source config.
* createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
*
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
* createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
* ```
*
* @param configToPropertyRules config to property mapping rules
* @param name the config plugin name
*/
export declare function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[], name?: string): ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType>;
/**
* A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config
*/
export declare const withJsEnginePodfileProps: ConfigPlugin<void>;
export declare function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(config: SourceConfigType, podfileProperties: Record<string, string>, configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]): Record<string, string>;
export declare function updateIosBuildProperty(podfileProperties: Record<string, string>, name: string, value: string | null | undefined, options?: {
removePropWhenValueIsNull?: boolean;
}): Record<string, string>;

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createBuildPodfilePropsConfigPlugin = createBuildPodfilePropsConfigPlugin;
exports.updateIosBuildPropertiesFromConfig = updateIosBuildPropertiesFromConfig;
exports.updateIosBuildProperty = updateIosBuildProperty;
exports.withJsEnginePodfileProps = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
/**
* Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.
*
* The factory supports two modes from generic type inference
* ```ts
* // config-plugin without `props`, it will implicitly use the expo config as source config.
* createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
*
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
* createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
* ```
*
* @param configToPropertyRules config to property mapping rules
* @param name the config plugin name
*/
function createBuildPodfilePropsConfigPlugin(configToPropertyRules, name) {
const withUnknown = (config, sourceConfig) => (0, _iosPlugins().withPodfileProperties)(config, config => {
config.modResults = updateIosBuildPropertiesFromConfig(sourceConfig ?? config, config.modResults, configToPropertyRules);
return config;
});
if (name) {
Object.defineProperty(withUnknown, 'name', {
value: name
});
}
return withUnknown;
}
/**
* A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config
*/
const withJsEnginePodfileProps = exports.withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin([{
propName: 'expo.jsEngine',
propValueGetter: config => config.ios?.jsEngine ?? config.jsEngine ?? 'hermes'
}], 'withJsEnginePodfileProps');
function updateIosBuildPropertiesFromConfig(config, podfileProperties, configToPropertyRules) {
for (const configToProperty of configToPropertyRules) {
const value = configToProperty.propValueGetter(config);
updateIosBuildProperty(podfileProperties, configToProperty.propName, value);
}
return podfileProperties;
}
function updateIosBuildProperty(podfileProperties, name, value, options) {
if (value) {
podfileProperties[name] = value;
} else if (options?.removePropWhenValueIsNull) {
delete podfileProperties[name];
}
return podfileProperties;
}
//# sourceMappingURL=BuildProperties.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BuildProperties.js","names":["_iosPlugins","data","require","createBuildPodfilePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withPodfileProperties","modResults","updateIosBuildPropertiesFromConfig","Object","defineProperty","value","withJsEnginePodfileProps","exports","propName","propValueGetter","ios","jsEngine","podfileProperties","configToProperty","updateIosBuildProperty","options","removePropWhenValueIsNull"],"sources":["../../src/ios/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withPodfileProperties } from '../plugins/ios-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\n\n/**\n * Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withPodfileProperties(config, (config) => {\n config.modResults = updateIosBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config\n */\nexport const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: (config) => config.ios?.jsEngine ?? config.jsEngine ?? 'hermes',\n },\n ],\n 'withJsEnginePodfileProps'\n);\n\nexport function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(\n config: SourceConfigType,\n podfileProperties: Record<string, string>,\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateIosBuildProperty(podfileProperties, configToProperty.propName, value);\n }\n return podfileProperties;\n}\n\nexport function updateIosBuildProperty(\n podfileProperties: Record<string, string>,\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n if (value) {\n podfileProperties[name] = value;\n } else if (options?.removePropWhenValueIsNull) {\n delete podfileProperties[name];\n }\n return podfileProperties;\n}\n"],"mappings":";;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mCAAmCA,CACjDC,qBAAmE,EACnEC,IAAa,EACb;EACA,MAAMC,WAAwF,GAAGA,CAC/FC,MAAM,EACNC,YAAY,KAEZ,IAAAC,mCAAqB,EAACF,MAAM,EAAGA,MAAM,IAAK;IACxCA,MAAM,CAACG,UAAU,GAAGC,kCAAkC,CACnDH,YAAY,IAAID,MAAM,EACvBA,MAAM,CAACG,UAAU,EACjBN,qBACF,CAAC;IACD,OAAOG,MAAM;EACf,CAAC,CAAC;EACJ,IAAIF,IAAI,EAAE;IACRO,MAAM,CAACC,cAAc,CAACP,WAAW,EAAE,MAAM,EAAE;MACzCQ,KAAK,EAAET;IACT,CAAC,CAAC;EACJ;EACA,OAAOC,WAAW;AACpB;;AAEA;AACA;AACA;AACO,MAAMS,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAGZ,mCAAmC,CACzE,CACE;EACEc,QAAQ,EAAE,eAAe;EACzBC,eAAe,EAAGX,MAAM,IAAKA,MAAM,CAACY,GAAG,EAAEC,QAAQ,IAAIb,MAAM,CAACa,QAAQ,IAAI;AAC1E,CAAC,CACF,EACD,0BACF,CAAC;AAEM,SAAST,kCAAkCA,CAChDJ,MAAwB,EACxBc,iBAAyC,EACzCjB,qBAAmE,EACnE;EACA,KAAK,MAAMkB,gBAAgB,IAAIlB,qBAAqB,EAAE;IACpD,MAAMU,KAAK,GAAGQ,gBAAgB,CAACJ,eAAe,CAACX,MAAM,CAAC;IACtDgB,sBAAsB,CAACF,iBAAiB,EAAEC,gBAAgB,CAACL,QAAQ,EAAEH,KAAK,CAAC;EAC7E;EACA,OAAOO,iBAAiB;AAC1B;AAEO,SAASE,sBAAsBA,CACpCF,iBAAyC,EACzChB,IAAY,EACZS,KAAgC,EAChCU,OAAiD,EACjD;EACA,IAAIV,KAAK,EAAE;IACTO,iBAAiB,CAAChB,IAAI,CAAC,GAAGS,KAAK;EACjC,CAAC,MAAM,IAAIU,OAAO,EAAEC,yBAAyB,EAAE;IAC7C,OAAOJ,iBAAiB,CAAChB,IAAI,CAAC;EAChC;EACA,OAAOgB,iBAAiB;AAC1B","ignoreList":[]}

View File

@@ -0,0 +1,10 @@
export declare function getSchemesFromXcodeproj(projectRoot: string): string[];
export declare function getRunnableSchemesFromXcodeproj(projectRoot: string, { configuration }?: {
configuration?: 'Debug' | 'Release';
}): {
name: string;
osType: string;
type: string;
}[];
export declare function getApplicationTargetNameForSchemeAsync(projectRoot: string, scheme: string): Promise<string>;
export declare function getArchiveBuildConfigurationForSchemeAsync(projectRoot: string, scheme: string): Promise<string>;

View File

@@ -0,0 +1,113 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getApplicationTargetNameForSchemeAsync = getApplicationTargetNameForSchemeAsync;
exports.getArchiveBuildConfigurationForSchemeAsync = getArchiveBuildConfigurationForSchemeAsync;
exports.getRunnableSchemesFromXcodeproj = getRunnableSchemesFromXcodeproj;
exports.getSchemesFromXcodeproj = getSchemesFromXcodeproj;
function _Paths() {
const data = require("./Paths");
_Paths = function () {
return data;
};
return data;
}
function _Target() {
const data = require("./Target");
_Target = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _XML() {
const data = require("../utils/XML");
_XML = function () {
return data;
};
return data;
}
function getSchemesFromXcodeproj(projectRoot) {
return (0, _Paths().findSchemeNames)(projectRoot);
}
function getRunnableSchemesFromXcodeproj(projectRoot, {
configuration = 'Debug'
} = {}) {
const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
return (0, _Target().findSignableTargets)(project).map(([, target]) => {
let osType = 'iOS';
const type = (0, _Xcodeproj().unquote)(target.productType);
if (type === _Target().TargetType.WATCH) {
osType = 'watchOS';
} else if (
// (apps) com.apple.product-type.application
// (app clips) com.apple.product-type.application.on-demand-install-capable
// NOTE(EvanBacon): This matches against `watchOS` as well so we check for watch first.
type.startsWith(_Target().TargetType.APPLICATION)) {
// Attempt to resolve the platform SDK for each target so we can filter devices.
const xcConfigurationList = project.hash.project.objects.XCConfigurationList[target.buildConfigurationList];
if (xcConfigurationList) {
const buildConfiguration = xcConfigurationList.buildConfigurations.find(value => value.comment === configuration) || xcConfigurationList.buildConfigurations[0];
if (buildConfiguration?.value) {
const xcBuildConfiguration = project.hash.project.objects.XCBuildConfiguration?.[buildConfiguration.value];
const buildSdkRoot = xcBuildConfiguration.buildSettings.SDKROOT;
if (buildSdkRoot === 'appletvos' || 'TVOS_DEPLOYMENT_TARGET' in xcBuildConfiguration.buildSettings) {
// Is a TV app...
osType = 'tvOS';
} else if (buildSdkRoot === 'iphoneos') {
osType = 'iOS';
}
}
}
}
return {
name: (0, _Xcodeproj().unquote)(target.name),
osType,
type: (0, _Xcodeproj().unquote)(target.productType)
};
});
}
async function readSchemeAsync(projectRoot, scheme) {
const allSchemePaths = (0, _Paths().findSchemePaths)(projectRoot);
// NOTE(cedric): test on POSIX or UNIX separators, where UNIX needs to be double-escaped in the template literal and regex
const re = new RegExp(`[\\\\/]${scheme}.xcscheme`, 'i');
const schemePath = allSchemePaths.find(i => re.exec(i));
if (schemePath) {
return await (0, _XML().readXMLAsync)({
path: schemePath
});
} else {
throw new Error(`scheme '${scheme}' does not exist, make sure it's marked as shared`);
}
}
async function getApplicationTargetNameForSchemeAsync(projectRoot, scheme) {
const schemeXML = await readSchemeAsync(projectRoot, scheme);
const buildActionEntry = schemeXML?.Scheme?.BuildAction?.[0]?.BuildActionEntries?.[0]?.BuildActionEntry;
const targetName = buildActionEntry?.length === 1 ? getBlueprintName(buildActionEntry[0]) : getBlueprintName(buildActionEntry?.find(entry => {
return entry.BuildableReference?.[0]?.['$']?.BuildableName?.endsWith('.app');
}));
if (!targetName) {
throw new Error(`${scheme}.xcscheme seems to be corrupted`);
}
return targetName;
}
async function getArchiveBuildConfigurationForSchemeAsync(projectRoot, scheme) {
const schemeXML = await readSchemeAsync(projectRoot, scheme);
const buildConfiguration = schemeXML?.Scheme?.ArchiveAction?.[0]?.['$']?.buildConfiguration;
if (!buildConfiguration) {
throw new Error(`${scheme}.xcscheme seems to be corrupted`);
}
return buildConfiguration;
}
function getBlueprintName(entry) {
return entry?.BuildableReference?.[0]?.['$']?.BlueprintName;
}
//# sourceMappingURL=BuildScheme.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,50 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
import { ConfigPlugin } from '../Plugin.types';
export declare const withBundleIdentifier: ConfigPlugin<{
bundleIdentifier?: string;
}>;
declare function getBundleIdentifier(config: Pick<ExpoConfig, 'ios'>): string | null;
/**
* In Turtle v1 we set the bundleIdentifier directly on Info.plist rather
* than in pbxproj
*/
declare function setBundleIdentifier(config: ExpoConfig, infoPlist: InfoPlist): InfoPlist;
/**
* Gets the bundle identifier defined in the Xcode project found in the project directory.
*
* A bundle identifier is stored as a value in XCBuildConfiguration entry.
* Those entries exist for every pair (build target, build configuration).
* Unless target name is passed, the first target defined in the pbxproj is used
* (to keep compatibility with the inaccurate legacy implementation of this function).
* The build configuration is usually 'Release' or 'Debug'. However, it could be any arbitrary string.
* Defaults to 'Release'.
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {string} targetName Target name
* @param {string} buildConfiguration Build configuration. Defaults to 'Release'.
* @returns {string | null} bundle identifier of the Xcode project or null if the project is not configured
*/
declare function getBundleIdentifierFromPbxproj(projectRoot: string, { targetName, buildConfiguration, }?: {
targetName?: string;
buildConfiguration?: string;
}): string | null;
/**
* Updates the bundle identifier for a given pbxproj
*
* @param {string} pbxprojPath Path to pbxproj file
* @param {string} bundleIdentifier Bundle identifier to set in the pbxproj
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
declare function updateBundleIdentifierForPbxproj(pbxprojPath: string, bundleIdentifier: string, updateProductName?: boolean): void;
/**
* Updates the bundle identifier for pbx projects inside the ios directory of the given project root
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {string} bundleIdentifier Desired bundle identifier
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
declare function setBundleIdentifierForPbxproj(projectRoot: string, bundleIdentifier: string, updateProductName?: boolean): void;
declare function resetAllPlistBundleIdentifiers(projectRoot: string): void;
declare function resetPlistBundleIdentifier(plistPath: string): void;
export { getBundleIdentifier, setBundleIdentifier, getBundleIdentifierFromPbxproj, updateBundleIdentifierForPbxproj, setBundleIdentifierForPbxproj, resetAllPlistBundleIdentifiers, resetPlistBundleIdentifier, };

View File

@@ -0,0 +1,241 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBundleIdentifier = getBundleIdentifier;
exports.getBundleIdentifierFromPbxproj = getBundleIdentifierFromPbxproj;
exports.resetAllPlistBundleIdentifiers = resetAllPlistBundleIdentifiers;
exports.resetPlistBundleIdentifier = resetPlistBundleIdentifier;
exports.setBundleIdentifier = setBundleIdentifier;
exports.setBundleIdentifierForPbxproj = setBundleIdentifierForPbxproj;
exports.updateBundleIdentifierForPbxproj = updateBundleIdentifierForPbxproj;
exports.withBundleIdentifier = void 0;
function _plist() {
const data = _interopRequireDefault(require("@expo/plist"));
_plist = function () {
return data;
};
return data;
}
function _assert() {
const data = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _xcode() {
const data = _interopRequireDefault(require("xcode"));
_xcode = function () {
return data;
};
return data;
}
function _Paths() {
const data = require("./Paths");
_Paths = function () {
return data;
};
return data;
}
function _Target() {
const data = require("./Target");
_Target = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _string() {
const data = require("./utils/string");
_string = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const withBundleIdentifier = (config, {
bundleIdentifier
}) => {
return (0, _iosPlugins().withXcodeProject)(config, async config => {
const bundleId = bundleIdentifier ?? config.ios?.bundleIdentifier;
// Should never happen.
(0, _assert().default)(bundleId, '`bundleIdentifier` must be defined in the app config (`ios.bundleIdentifier`) or passed to the plugin `withBundleIdentifier`.');
config.modResults = updateBundleIdentifierForPbxprojObject(config.modResults, bundleId, false);
return config;
});
};
exports.withBundleIdentifier = withBundleIdentifier;
function getBundleIdentifier(config) {
return config.ios?.bundleIdentifier ?? null;
}
/**
* In Turtle v1 we set the bundleIdentifier directly on Info.plist rather
* than in pbxproj
*/
function setBundleIdentifier(config, infoPlist) {
const bundleIdentifier = getBundleIdentifier(config);
if (!bundleIdentifier) {
return infoPlist;
}
return {
...infoPlist,
CFBundleIdentifier: bundleIdentifier
};
}
/**
* Gets the bundle identifier defined in the Xcode project found in the project directory.
*
* A bundle identifier is stored as a value in XCBuildConfiguration entry.
* Those entries exist for every pair (build target, build configuration).
* Unless target name is passed, the first target defined in the pbxproj is used
* (to keep compatibility with the inaccurate legacy implementation of this function).
* The build configuration is usually 'Release' or 'Debug'. However, it could be any arbitrary string.
* Defaults to 'Release'.
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {string} targetName Target name
* @param {string} buildConfiguration Build configuration. Defaults to 'Release'.
* @returns {string | null} bundle identifier of the Xcode project or null if the project is not configured
*/
function getBundleIdentifierFromPbxproj(projectRoot, {
targetName,
buildConfiguration = 'Release'
} = {}) {
let pbxprojPath;
try {
pbxprojPath = (0, _Paths().getPBXProjectPath)(projectRoot);
} catch {
return null;
}
const project = _xcode().default.project(pbxprojPath);
project.parseSync();
const xcBuildConfiguration = (0, _Target().getXCBuildConfigurationFromPbxproj)(project, {
targetName,
buildConfiguration
});
if (!xcBuildConfiguration) {
return null;
}
return getProductBundleIdentifierFromBuildConfiguration(xcBuildConfiguration);
}
function getProductBundleIdentifierFromBuildConfiguration(xcBuildConfiguration) {
const bundleIdentifierRaw = xcBuildConfiguration.buildSettings.PRODUCT_BUNDLE_IDENTIFIER;
if (bundleIdentifierRaw) {
const bundleIdentifier = (0, _string().trimQuotes)(bundleIdentifierRaw);
return (0, _Xcodeproj().resolveXcodeBuildSetting)(bundleIdentifier, setting => xcBuildConfiguration.buildSettings[setting]);
} else {
return null;
}
}
/**
* Updates the bundle identifier for a given pbxproj
*
* @param {string} pbxprojPath Path to pbxproj file
* @param {string} bundleIdentifier Bundle identifier to set in the pbxproj
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
function updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateProductName = true) {
const project = _xcode().default.project(pbxprojPath);
project.parseSync();
_fs().default.writeFileSync(pbxprojPath, updateBundleIdentifierForPbxprojObject(project, bundleIdentifier, updateProductName).writeSync());
}
/**
* Updates the bundle identifier for a given pbxproj
*
* @param {string} project pbxproj file
* @param {string} bundleIdentifier Bundle identifier to set in the pbxproj
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
function updateBundleIdentifierForPbxprojObject(project, bundleIdentifier, updateProductName = true) {
const [, nativeTarget] = (0, _Target().findFirstNativeTarget)(project);
(0, _Xcodeproj().getBuildConfigurationsForListId)(project, nativeTarget.buildConfigurationList).forEach(([, item]) => {
if (item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER === bundleIdentifier) {
return;
}
item.buildSettings.PRODUCT_BUNDLE_IDENTIFIER = `"${bundleIdentifier}"`;
if (updateProductName) {
const productName = bundleIdentifier.split('.').pop();
if (!productName?.includes('$')) {
item.buildSettings.PRODUCT_NAME = productName;
}
}
});
return project;
}
/**
* Updates the bundle identifier for pbx projects inside the ios directory of the given project root
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {string} bundleIdentifier Desired bundle identifier
* @param {boolean} [updateProductName=true] Whether to update PRODUCT_NAME
*/
function setBundleIdentifierForPbxproj(projectRoot, bundleIdentifier, updateProductName = true) {
// Get all pbx projects in the ${projectRoot}/ios directory
let pbxprojPaths = [];
try {
pbxprojPaths = (0, _Paths().getAllPBXProjectPaths)(projectRoot);
} catch {}
for (const pbxprojPath of pbxprojPaths) {
updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateProductName);
}
}
/**
* Reset bundle identifier field in Info.plist to use PRODUCT_BUNDLE_IDENTIFIER, as recommended by Apple.
*/
const defaultBundleId = '$(PRODUCT_BUNDLE_IDENTIFIER)';
function resetAllPlistBundleIdentifiers(projectRoot) {
const infoPlistPaths = (0, _Paths().getAllInfoPlistPaths)(projectRoot);
for (const plistPath of infoPlistPaths) {
resetPlistBundleIdentifier(plistPath);
}
}
function resetPlistBundleIdentifier(plistPath) {
const rawPlist = _fs().default.readFileSync(plistPath, 'utf8');
const plistObject = _plist().default.parse(rawPlist);
if (plistObject.CFBundleIdentifier) {
if (plistObject.CFBundleIdentifier === defaultBundleId) return;
// attempt to match default Info.plist format
const format = {
pretty: true,
indent: `\t`
};
const xml = _plist().default.build({
...plistObject,
CFBundleIdentifier: defaultBundleId
}, format);
if (xml !== rawPlist) {
_fs().default.writeFileSync(plistPath, xml);
}
}
}
//# sourceMappingURL=BundleIdentifier.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
import type { ExpoConfig } from '@expo/config-types';
import { type XCBuildConfiguration } from 'xcode';
import type { ConfigPlugin, XcodeProject } from '../Plugin.types';
/**
* Set the Apple development team ID for all build configurations using the first native target.
*/
export declare const withDevelopmentTeam: ConfigPlugin<{
appleTeamId?: string;
} | void>;
/** Get the Apple development team ID from Expo config, if defined */
export declare function getDevelopmentTeam(config: Pick<ExpoConfig, 'ios'>): string | null;
/** Set the Apple development team ID for an XCBuildConfiguration object */
export declare function setDevelopmentTeamForBuildConfiguration(xcBuildConfiguration: XCBuildConfiguration, developmentTeam?: string): void;
/**
* Update the Apple development team ID for all XCBuildConfiguration entries, in all native targets.
*
* A development team is stored as a value in XCBuildConfiguration entry.
* Those entries exist for every pair (build target, build configuration).
* Unless target name is passed, the first target defined in the pbxproj is used
* (to keep compatibility with the inaccurate legacy implementation of this function).
*/
export declare function updateDevelopmentTeamForPbxproj(project: XcodeProject, appleTeamId?: string): XcodeProject;
/**
* Updates the Apple development team ID for pbx projects inside the ios directory of the given project root
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {[string]} appleTeamId Desired Apple development team ID
*/
export declare function setDevelopmentTeamForPbxproj(projectRoot: string, appleTeamId?: string): void;

View File

@@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getDevelopmentTeam = getDevelopmentTeam;
exports.setDevelopmentTeamForBuildConfiguration = setDevelopmentTeamForBuildConfiguration;
exports.setDevelopmentTeamForPbxproj = setDevelopmentTeamForPbxproj;
exports.updateDevelopmentTeamForPbxproj = updateDevelopmentTeamForPbxproj;
exports.withDevelopmentTeam = void 0;
function _nodeFs() {
const data = _interopRequireDefault(require("node:fs"));
_nodeFs = function () {
return data;
};
return data;
}
function _xcode() {
const data = _interopRequireDefault(require("xcode"));
_xcode = function () {
return data;
};
return data;
}
function _Paths() {
const data = require("./Paths");
_Paths = function () {
return data;
};
return data;
}
function _Target() {
const data = require("./Target");
_Target = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _string() {
const data = require("./utils/string");
_string = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Set the Apple development team ID for all build configurations using the first native target.
*/
const withDevelopmentTeam = (config, {
appleTeamId
} = {}) => {
return (0, _iosPlugins().withXcodeProject)(config, config => {
const teamId = appleTeamId ?? getDevelopmentTeam(config);
if (teamId) {
config.modResults = updateDevelopmentTeamForPbxproj(config.modResults, teamId);
}
return config;
});
};
/** Get the Apple development team ID from Expo config, if defined */
exports.withDevelopmentTeam = withDevelopmentTeam;
function getDevelopmentTeam(config) {
return config.ios?.appleTeamId ?? null;
}
/** Set the Apple development team ID for an XCBuildConfiguration object */
function setDevelopmentTeamForBuildConfiguration(xcBuildConfiguration, developmentTeam) {
if (developmentTeam) {
xcBuildConfiguration.buildSettings.DEVELOPMENT_TEAM = (0, _string().trimQuotes)(developmentTeam);
} else {
delete xcBuildConfiguration.buildSettings.DEVELOPMENT_TEAM;
}
}
/**
* Update the Apple development team ID for all XCBuildConfiguration entries, in all native targets.
*
* A development team is stored as a value in XCBuildConfiguration entry.
* Those entries exist for every pair (build target, build configuration).
* Unless target name is passed, the first target defined in the pbxproj is used
* (to keep compatibility with the inaccurate legacy implementation of this function).
*/
function updateDevelopmentTeamForPbxproj(project, appleTeamId) {
const nativeTargets = (0, _Target().getNativeTargets)(project);
nativeTargets.forEach(([, nativeTarget]) => {
(0, _Xcodeproj().getBuildConfigurationsForListId)(project, nativeTarget.buildConfigurationList).forEach(([, buildConfig]) => setDevelopmentTeamForBuildConfiguration(buildConfig, appleTeamId));
});
return project;
}
/**
* Updates the Apple development team ID for pbx projects inside the ios directory of the given project root
*
* @param {string} projectRoot Path to project root containing the ios directory
* @param {[string]} appleTeamId Desired Apple development team ID
*/
function setDevelopmentTeamForPbxproj(projectRoot, appleTeamId) {
// Get all pbx projects in the ${projectRoot}/ios directory
const pbxprojPaths = (0, _Paths().getAllPBXProjectPaths)(projectRoot);
for (const pbxprojPath of pbxprojPaths) {
let project = _xcode().default.project(pbxprojPath);
project.parseSync();
project = updateDevelopmentTeamForPbxproj(project, appleTeamId);
_nodeFs().default.writeFileSync(pbxprojPath, project.writeSync());
}
}
//# sourceMappingURL=DevelopmentTeam.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
export declare const withDeviceFamily: ConfigPlugin;
export declare function getSupportsTablet(config: Pick<ExpoConfig, 'ios'>): boolean;
export declare function getIsTabletOnly(config: Pick<ExpoConfig, 'ios'>): boolean;
export declare function getDeviceFamilies(config: Pick<ExpoConfig, 'ios'>): number[];
/**
* Wrapping the families in double quotes is the only way to set a value with a comma in it.
*
* @param deviceFamilies
*/
export declare function formatDeviceFamilies(deviceFamilies: number[]): string;
/**
* Add to pbxproj under TARGETED_DEVICE_FAMILY
*/
export declare function setDeviceFamily(config: Pick<ExpoConfig, 'ios'>, { project }: {
project: XcodeProject;
}): XcodeProject;

View File

@@ -0,0 +1,92 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.formatDeviceFamilies = formatDeviceFamilies;
exports.getDeviceFamilies = getDeviceFamilies;
exports.getIsTabletOnly = getIsTabletOnly;
exports.getSupportsTablet = getSupportsTablet;
exports.setDeviceFamily = setDeviceFamily;
exports.withDeviceFamily = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _warnings() {
const data = require("../utils/warnings");
_warnings = function () {
return data;
};
return data;
}
const withDeviceFamily = config => {
return (0, _iosPlugins().withXcodeProject)(config, async config => {
config.modResults = await setDeviceFamily(config, {
project: config.modResults
});
return config;
});
};
exports.withDeviceFamily = withDeviceFamily;
function getSupportsTablet(config) {
return !!config.ios?.supportsTablet;
}
function getIsTabletOnly(config) {
return !!config?.ios?.isTabletOnly;
}
function getDeviceFamilies(config) {
const supportsTablet = getSupportsTablet(config);
const isTabletOnly = getIsTabletOnly(config);
if (isTabletOnly && config.ios?.supportsTablet === false) {
(0, _warnings().addWarningIOS)('ios.supportsTablet', `Found contradictory values: \`{ ios: { isTabletOnly: true, supportsTablet: false } }\`. Using \`{ isTabletOnly: true }\`.`);
}
// 1 is iPhone, 2 is iPad
if (isTabletOnly) {
return [2];
} else if (supportsTablet) {
return [1, 2];
} else {
// is iPhone only
return [1];
}
}
/**
* Wrapping the families in double quotes is the only way to set a value with a comma in it.
*
* @param deviceFamilies
*/
function formatDeviceFamilies(deviceFamilies) {
return `"${deviceFamilies.join(',')}"`;
}
/**
* Add to pbxproj under TARGETED_DEVICE_FAMILY
*/
function setDeviceFamily(config, {
project
}) {
const deviceFamilies = formatDeviceFamilies(getDeviceFamilies(config));
const configurations = project.pbxXCBuildConfigurationSection();
// @ts-ignore
for (const {
buildSettings
} of Object.values(configurations || {})) {
// Guessing that this is the best way to emulate Xcode.
// Using `project.addToBuildSettings` modifies too many targets.
if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {
if (typeof buildSettings?.TVOS_DEPLOYMENT_TARGET !== 'undefined') {
buildSettings.TARGETED_DEVICE_FAMILY = '3';
} else {
buildSettings.TARGETED_DEVICE_FAMILY = deviceFamilies;
}
}
}
return project;
}
//# sourceMappingURL=DeviceFamily.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DeviceFamily.js","names":["_iosPlugins","data","require","_warnings","withDeviceFamily","config","withXcodeProject","modResults","setDeviceFamily","project","exports","getSupportsTablet","ios","supportsTablet","getIsTabletOnly","isTabletOnly","getDeviceFamilies","addWarningIOS","formatDeviceFamilies","deviceFamilies","join","configurations","pbxXCBuildConfigurationSection","buildSettings","Object","values","PRODUCT_NAME","TVOS_DEPLOYMENT_TARGET","TARGETED_DEVICE_FAMILY"],"sources":["../../src/ios/DeviceFamily.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport { XcodeProject } from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withXcodeProject } from '../plugins/ios-plugins';\nimport { addWarningIOS } from '../utils/warnings';\n\nexport const withDeviceFamily: ConfigPlugin = (config) => {\n return withXcodeProject(config, async (config) => {\n config.modResults = await setDeviceFamily(config, {\n project: config.modResults,\n });\n return config;\n });\n};\n\nexport function getSupportsTablet(config: Pick<ExpoConfig, 'ios'>): boolean {\n return !!config.ios?.supportsTablet;\n}\n\nexport function getIsTabletOnly(config: Pick<ExpoConfig, 'ios'>): boolean {\n return !!config?.ios?.isTabletOnly;\n}\n\nexport function getDeviceFamilies(config: Pick<ExpoConfig, 'ios'>): number[] {\n const supportsTablet = getSupportsTablet(config);\n const isTabletOnly = getIsTabletOnly(config);\n\n if (isTabletOnly && config.ios?.supportsTablet === false) {\n addWarningIOS(\n 'ios.supportsTablet',\n `Found contradictory values: \\`{ ios: { isTabletOnly: true, supportsTablet: false } }\\`. Using \\`{ isTabletOnly: true }\\`.`\n );\n }\n\n // 1 is iPhone, 2 is iPad\n if (isTabletOnly) {\n return [2];\n } else if (supportsTablet) {\n return [1, 2];\n } else {\n // is iPhone only\n return [1];\n }\n}\n\n/**\n * Wrapping the families in double quotes is the only way to set a value with a comma in it.\n *\n * @param deviceFamilies\n */\nexport function formatDeviceFamilies(deviceFamilies: number[]): string {\n return `\"${deviceFamilies.join(',')}\"`;\n}\n\n/**\n * Add to pbxproj under TARGETED_DEVICE_FAMILY\n */\nexport function setDeviceFamily(\n config: Pick<ExpoConfig, 'ios'>,\n { project }: { project: XcodeProject }\n): XcodeProject {\n const deviceFamilies = formatDeviceFamilies(getDeviceFamilies(config));\n\n const configurations = project.pbxXCBuildConfigurationSection();\n // @ts-ignore\n for (const { buildSettings } of Object.values(configurations || {})) {\n // Guessing that this is the best way to emulate Xcode.\n // Using `project.addToBuildSettings` modifies too many targets.\n if (typeof buildSettings?.PRODUCT_NAME !== 'undefined') {\n if (typeof buildSettings?.TVOS_DEPLOYMENT_TARGET !== 'undefined') {\n buildSettings.TARGETED_DEVICE_FAMILY = '3';\n } else {\n buildSettings.TARGETED_DEVICE_FAMILY = deviceFamilies;\n }\n }\n }\n\n return project;\n}\n"],"mappings":";;;;;;;;;;;AAIA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,gBAA8B,GAAIC,MAAM,IAAK;EACxD,OAAO,IAAAC,8BAAgB,EAACD,MAAM,EAAE,MAAOA,MAAM,IAAK;IAChDA,MAAM,CAACE,UAAU,GAAG,MAAMC,eAAe,CAACH,MAAM,EAAE;MAChDI,OAAO,EAAEJ,MAAM,CAACE;IAClB,CAAC,CAAC;IACF,OAAOF,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAACK,OAAA,CAAAN,gBAAA,GAAAA,gBAAA;AAEK,SAASO,iBAAiBA,CAACN,MAA+B,EAAW;EAC1E,OAAO,CAAC,CAACA,MAAM,CAACO,GAAG,EAAEC,cAAc;AACrC;AAEO,SAASC,eAAeA,CAACT,MAA+B,EAAW;EACxE,OAAO,CAAC,CAACA,MAAM,EAAEO,GAAG,EAAEG,YAAY;AACpC;AAEO,SAASC,iBAAiBA,CAACX,MAA+B,EAAY;EAC3E,MAAMQ,cAAc,GAAGF,iBAAiB,CAACN,MAAM,CAAC;EAChD,MAAMU,YAAY,GAAGD,eAAe,CAACT,MAAM,CAAC;EAE5C,IAAIU,YAAY,IAAIV,MAAM,CAACO,GAAG,EAAEC,cAAc,KAAK,KAAK,EAAE;IACxD,IAAAI,yBAAa,EACX,oBAAoB,EACpB,2HACF,CAAC;EACH;;EAEA;EACA,IAAIF,YAAY,EAAE;IAChB,OAAO,CAAC,CAAC,CAAC;EACZ,CAAC,MAAM,IAAIF,cAAc,EAAE;IACzB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;EACf,CAAC,MAAM;IACL;IACA,OAAO,CAAC,CAAC,CAAC;EACZ;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASK,oBAAoBA,CAACC,cAAwB,EAAU;EACrE,OAAO,IAAIA,cAAc,CAACC,IAAI,CAAC,GAAG,CAAC,GAAG;AACxC;;AAEA;AACA;AACA;AACO,SAASZ,eAAeA,CAC7BH,MAA+B,EAC/B;EAAEI;AAAmC,CAAC,EACxB;EACd,MAAMU,cAAc,GAAGD,oBAAoB,CAACF,iBAAiB,CAACX,MAAM,CAAC,CAAC;EAEtE,MAAMgB,cAAc,GAAGZ,OAAO,CAACa,8BAA8B,CAAC,CAAC;EAC/D;EACA,KAAK,MAAM;IAAEC;EAAc,CAAC,IAAIC,MAAM,CAACC,MAAM,CAACJ,cAAc,IAAI,CAAC,CAAC,CAAC,EAAE;IACnE;IACA;IACA,IAAI,OAAOE,aAAa,EAAEG,YAAY,KAAK,WAAW,EAAE;MACtD,IAAI,OAAOH,aAAa,EAAEI,sBAAsB,KAAK,WAAW,EAAE;QAChEJ,aAAa,CAACK,sBAAsB,GAAG,GAAG;MAC5C,CAAC,MAAM;QACLL,aAAa,CAACK,sBAAsB,GAAGT,cAAc;MACvD;IACF;EACF;EAEA,OAAOV,OAAO;AAChB","ignoreList":[]}

View File

@@ -0,0 +1,9 @@
import { ExpoConfig } from '@expo/config-types';
import { JSONObject } from '@expo/json-file';
export declare const withAssociatedDomains: import("..").ConfigPlugin;
export declare function setAssociatedDomains(config: ExpoConfig, { 'com.apple.developer.associated-domains': _, ...entitlementsPlist }: JSONObject): JSONObject;
export declare function getEntitlementsPath(projectRoot: string, { targetName, buildConfiguration, }?: {
targetName?: string;
buildConfiguration?: string;
}): string | null;
export declare function ensureApplicationTargetEntitlementsFileConfigured(projectRoot: string): void;

View File

@@ -0,0 +1,125 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ensureApplicationTargetEntitlementsFileConfigured = ensureApplicationTargetEntitlementsFileConfigured;
exports.getEntitlementsPath = getEntitlementsPath;
exports.setAssociatedDomains = setAssociatedDomains;
exports.withAssociatedDomains = void 0;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _Target() {
const data = require("./Target");
_Target = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _string() {
const data = require("./utils/string");
_string = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const withAssociatedDomains = exports.withAssociatedDomains = (0, _iosPlugins().createEntitlementsPlugin)(setAssociatedDomains, 'withAssociatedDomains');
function setAssociatedDomains(config, {
'com.apple.developer.associated-domains': _,
...entitlementsPlist
}) {
if (config.ios?.associatedDomains) {
return {
...entitlementsPlist,
'com.apple.developer.associated-domains': config.ios.associatedDomains
};
}
return entitlementsPlist;
}
function getEntitlementsPath(projectRoot, {
targetName,
buildConfiguration = 'Release'
} = {}) {
const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
const xcBuildConfiguration = (0, _Target().getXCBuildConfigurationFromPbxproj)(project, {
targetName,
buildConfiguration
});
if (!xcBuildConfiguration) {
return null;
}
const entitlementsPath = getEntitlementsPathFromBuildConfiguration(projectRoot, xcBuildConfiguration);
return entitlementsPath && _fs().default.existsSync(entitlementsPath) ? entitlementsPath : null;
}
function getEntitlementsPathFromBuildConfiguration(projectRoot, xcBuildConfiguration) {
const entitlementsPathRaw = xcBuildConfiguration?.buildSettings?.CODE_SIGN_ENTITLEMENTS;
if (entitlementsPathRaw) {
return _path().default.normalize(_path().default.join(projectRoot, 'ios', (0, _string().trimQuotes)(entitlementsPathRaw)));
} else {
return null;
}
}
function ensureApplicationTargetEntitlementsFileConfigured(projectRoot) {
const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
const projectName = (0, _Xcodeproj().getProjectName)(projectRoot);
const productName = (0, _Xcodeproj().getProductName)(project);
const [, applicationTarget] = (0, _Target().findFirstNativeTarget)(project);
const buildConfigurations = (0, _Xcodeproj().getBuildConfigurationsForListId)(project, applicationTarget.buildConfigurationList);
let hasChangesToWrite = false;
for (const [, xcBuildConfiguration] of buildConfigurations) {
const oldEntitlementPath = getEntitlementsPathFromBuildConfiguration(projectRoot, xcBuildConfiguration);
if (oldEntitlementPath && _fs().default.existsSync(oldEntitlementPath)) {
return;
}
hasChangesToWrite = true;
// Use posix formatted path, even on Windows
const entitlementsRelativePath = _path().default.join(projectName, `${productName}.entitlements`).replace(/\\/g, '/');
const entitlementsPath = _path().default.resolve(projectRoot, 'ios', entitlementsRelativePath);
_fs().default.mkdirSync(_path().default.dirname(entitlementsPath), {
recursive: true
});
if (!_fs().default.existsSync(entitlementsPath)) {
_fs().default.writeFileSync(entitlementsPath, ENTITLEMENTS_TEMPLATE);
}
xcBuildConfiguration.buildSettings.CODE_SIGN_ENTITLEMENTS = entitlementsRelativePath;
}
if (hasChangesToWrite) {
_fs().default.writeFileSync(project.filepath, project.writeSync());
}
}
const ENTITLEMENTS_TEMPLATE = `
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
`;
//# sourceMappingURL=Entitlements.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { InfoPlist } from './IosConfig.types';
import { ConfigPlugin, ModProps } from '../Plugin.types';
export declare const withGoogle: ConfigPlugin;
export declare const withGoogleServicesFile: ConfigPlugin;
export declare function getGoogleSignInReversedClientId(config: Pick<ExpoConfig, 'ios'>, modRequest: Pick<ModProps<InfoPlist>, 'projectRoot'>): string | null;
export declare function getGoogleServicesFile(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setGoogleSignInReversedClientId(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist, modRequest: Pick<ModProps<InfoPlist>, 'projectRoot'>): InfoPlist;
export declare function setGoogleConfig(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist, modRequest: ModProps<InfoPlist>): InfoPlist;
export declare function setGoogleServicesFile(config: Pick<ExpoConfig, 'ios'>, { projectRoot, project }: {
project: XcodeProject;
projectRoot: string;
}): XcodeProject;

139
node_modules/@expo/config-plugins/build/ios/Google.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getGoogleServicesFile = getGoogleServicesFile;
exports.getGoogleSignInReversedClientId = getGoogleSignInReversedClientId;
exports.setGoogleConfig = setGoogleConfig;
exports.setGoogleServicesFile = setGoogleServicesFile;
exports.setGoogleSignInReversedClientId = setGoogleSignInReversedClientId;
exports.withGoogleServicesFile = exports.withGoogle = void 0;
function _plist() {
const data = _interopRequireDefault(require("@expo/plist"));
_plist = function () {
return data;
};
return data;
}
function _assert() {
const data = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _Paths() {
const data = require("./Paths");
_Paths = function () {
return data;
};
return data;
}
function _Scheme() {
const data = require("./Scheme");
_Scheme = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const withGoogle = config => {
return (0, _iosPlugins().withInfoPlist)(config, config => {
config.modResults = setGoogleConfig(config, config.modResults, config.modRequest);
return config;
});
};
exports.withGoogle = withGoogle;
const withGoogleServicesFile = config => {
return (0, _iosPlugins().withXcodeProject)(config, config => {
config.modResults = setGoogleServicesFile(config, {
projectRoot: config.modRequest.projectRoot,
project: config.modResults
});
return config;
});
};
exports.withGoogleServicesFile = withGoogleServicesFile;
function readGoogleServicesInfoPlist(relativePath, {
projectRoot
}) {
const googleServiceFilePath = _path().default.resolve(projectRoot, relativePath);
const contents = _fs().default.readFileSync(googleServiceFilePath, 'utf8');
(0, _assert().default)(contents, 'GoogleService-Info.plist is empty');
return _plist().default.parse(contents);
}
function getGoogleSignInReversedClientId(config, modRequest) {
const googleServicesFileRelativePath = getGoogleServicesFile(config);
if (googleServicesFileRelativePath === null) {
return null;
}
const infoPlist = readGoogleServicesInfoPlist(googleServicesFileRelativePath, modRequest);
return infoPlist.REVERSED_CLIENT_ID ?? null;
}
function getGoogleServicesFile(config) {
return config.ios?.googleServicesFile ?? null;
}
function setGoogleSignInReversedClientId(config, infoPlist, modRequest) {
const reversedClientId = getGoogleSignInReversedClientId(config, modRequest);
if (reversedClientId === null) {
return infoPlist;
}
return (0, _Scheme().appendScheme)(reversedClientId, infoPlist);
}
function setGoogleConfig(config, infoPlist, modRequest) {
infoPlist = setGoogleSignInReversedClientId(config, infoPlist, modRequest);
return infoPlist;
}
function setGoogleServicesFile(config, {
projectRoot,
project
}) {
const googleServicesFileRelativePath = getGoogleServicesFile(config);
if (googleServicesFileRelativePath === null) {
return project;
}
const googleServiceFilePath = _path().default.resolve(projectRoot, googleServicesFileRelativePath);
_fs().default.copyFileSync(googleServiceFilePath, _path().default.join((0, _Paths().getSourceRoot)(projectRoot), 'GoogleService-Info.plist'));
const projectName = (0, _Xcodeproj().getProjectName)(projectRoot);
const plistFilePath = `${projectName}/GoogleService-Info.plist`;
if (!project.hasFile(plistFilePath)) {
project = (0, _Xcodeproj().addResourceFileToGroup)({
filepath: plistFilePath,
groupName: projectName,
project,
isBuildFile: true,
verbose: true
});
}
return project;
}
//# sourceMappingURL=Google.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,50 @@
import { JSONValue } from '@expo/json-file';
export type URLScheme = {
CFBundleURLName?: string;
CFBundleURLSchemes: string[];
};
export type InterfaceOrientation = 'UIInterfaceOrientationPortrait' | 'UIInterfaceOrientationPortraitUpsideDown' | 'UIInterfaceOrientationLandscapeLeft' | 'UIInterfaceOrientationLandscapeRight';
export type InterfaceStyle = 'Light' | 'Dark' | 'Automatic';
export type InfoPlist = Record<string, JSONValue | undefined> & {
UIStatusBarHidden?: boolean;
UIStatusBarStyle?: string;
UILaunchStoryboardName?: string | 'SplashScreen';
CFBundleShortVersionString?: string;
CFBundleVersion?: string;
CFBundleDisplayName?: string;
CFBundleIdentifier?: string;
CFBundleName?: string;
CFBundleURLTypes?: URLScheme[];
CFBundleDevelopmentRegion?: string;
ITSAppUsesNonExemptEncryption?: boolean;
LSApplicationQueriesSchemes?: string[];
UIBackgroundModes?: string[];
UISupportedInterfaceOrientations?: InterfaceOrientation[];
GMSApiKey?: string;
GADApplicationIdentifier?: string;
UIUserInterfaceStyle?: InterfaceStyle;
UIRequiresFullScreen?: boolean;
SKAdNetworkItems?: {
SKAdNetworkIdentifier: string;
}[];
branch_key?: {
live?: string;
};
};
export type ExpoPlist = {
EXUpdatesCheckOnLaunch?: string;
EXUpdatesEnabled?: boolean;
EXUpdatesHasEmbeddedUpdate?: boolean;
EXUpdatesLaunchWaitMs?: number;
EXUpdatesRuntimeVersion?: string;
EXUpdatesRequestHeaders?: Record<string, string>;
/**
* @deprecated removed, but kept in types so that it can be mutated (deleted) from existing plists
*/
EXUpdatesSDKVersion?: string;
EXUpdatesURL?: string;
EXUpdatesCodeSigningCertificate?: string;
EXUpdatesCodeSigningMetadata?: Record<string, string>;
EXUpdatesDisableAntiBrickingMeasures?: boolean;
EXUpdatesEnableBsdiffPatchSupport?: boolean;
};

View File

@@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=IosConfig.types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IosConfig.types.js","names":[],"sources":["../../src/ios/IosConfig.types.ts"],"sourcesContent":["import { JSONValue } from '@expo/json-file';\n\nexport type URLScheme = {\n CFBundleURLName?: string;\n CFBundleURLSchemes: string[];\n};\n\nexport type InterfaceOrientation =\n | 'UIInterfaceOrientationPortrait'\n | 'UIInterfaceOrientationPortraitUpsideDown'\n | 'UIInterfaceOrientationLandscapeLeft'\n | 'UIInterfaceOrientationLandscapeRight';\n\nexport type InterfaceStyle = 'Light' | 'Dark' | 'Automatic';\n\nexport type InfoPlist = Record<string, JSONValue | undefined> & {\n UIStatusBarHidden?: boolean;\n UIStatusBarStyle?: string;\n UILaunchStoryboardName?: string | 'SplashScreen';\n CFBundleShortVersionString?: string;\n CFBundleVersion?: string;\n CFBundleDisplayName?: string;\n CFBundleIdentifier?: string;\n CFBundleName?: string;\n CFBundleURLTypes?: URLScheme[];\n CFBundleDevelopmentRegion?: string;\n ITSAppUsesNonExemptEncryption?: boolean;\n LSApplicationQueriesSchemes?: string[];\n UIBackgroundModes?: string[];\n UISupportedInterfaceOrientations?: InterfaceOrientation[];\n GMSApiKey?: string;\n GADApplicationIdentifier?: string;\n UIUserInterfaceStyle?: InterfaceStyle;\n UIRequiresFullScreen?: boolean;\n SKAdNetworkItems?: { SKAdNetworkIdentifier: string }[];\n branch_key?: { live?: string };\n};\n\nexport type ExpoPlist = {\n EXUpdatesCheckOnLaunch?: string;\n EXUpdatesEnabled?: boolean;\n EXUpdatesHasEmbeddedUpdate?: boolean;\n EXUpdatesLaunchWaitMs?: number;\n EXUpdatesRuntimeVersion?: string;\n EXUpdatesRequestHeaders?: Record<string, string>;\n /**\n * @deprecated removed, but kept in types so that it can be mutated (deleted) from existing plists\n */\n EXUpdatesSDKVersion?: string;\n EXUpdatesURL?: string;\n EXUpdatesCodeSigningCertificate?: string;\n EXUpdatesCodeSigningMetadata?: Record<string, string>;\n EXUpdatesDisableAntiBrickingMeasures?: boolean;\n EXUpdatesEnableBsdiffPatchSupport?: boolean;\n};\n"],"mappings":"","ignoreList":[]}

View File

@@ -0,0 +1,17 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { ConfigPlugin } from '../Plugin.types';
import { LocaleJson, ResolvedLocalesJson } from '../utils/locales';
export declare const withLocales: ConfigPlugin;
export declare function writeStringsFile({ localesMap, supportingDirectory, fileName, projectName, project, }: {
localesMap: LocaleJson | ResolvedLocalesJson;
supportingDirectory: string;
fileName: string;
projectName: string;
project: XcodeProject;
}): Promise<XcodeProject>;
export declare function getLocales(config: Pick<ExpoConfig, 'locales'>): Record<string, string | LocaleJson> | null;
export declare function setLocalesAsync(config: Pick<ExpoConfig, 'locales'>, { projectRoot, project }: {
projectRoot: string;
project: XcodeProject;
}): Promise<XcodeProject>;

134
node_modules/@expo/config-plugins/build/ios/Locales.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getLocales = getLocales;
exports.setLocalesAsync = setLocalesAsync;
exports.withLocales = void 0;
exports.writeStringsFile = writeStringsFile;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _locales() {
const data = require("../utils/locales");
_locales = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const withLocales = config => {
return (0, _iosPlugins().withXcodeProject)(config, async config => {
config.modResults = await setLocalesAsync(config, {
projectRoot: config.modRequest.projectRoot,
project: config.modResults
});
return config;
});
};
exports.withLocales = withLocales;
async function writeStringsFile({
localesMap,
supportingDirectory,
fileName,
projectName,
project
}) {
for (const [lang, localizationObj] of Object.entries(localesMap)) {
if (Object.entries(localizationObj).length === 0) return project;
const dir = _path().default.join(supportingDirectory, `${lang}.lproj`);
await _fs().default.promises.mkdir(dir, {
recursive: true
});
const strings = _path().default.join(dir, fileName);
const buffer = [];
for (const [plistKey, localVersion] of Object.entries(localizationObj)) {
buffer.push(`${plistKey} = "${localVersion}";`);
}
// Write the file to the file system.
await _fs().default.promises.writeFile(strings, buffer.join('\n'));
const groupName = `${projectName}/Supporting/${lang}.lproj`;
// deep find the correct folder
const group = (0, _Xcodeproj().ensureGroupRecursively)(project, groupName);
// Ensure the file doesn't already exist
if (!group?.children.some(({
comment
}) => comment === fileName)) {
// Only write the file if it doesn't already exist.
project = (0, _Xcodeproj().addResourceFileToGroup)({
filepath: _path().default.relative(supportingDirectory, strings),
groupName,
project,
isBuildFile: true,
verbose: true
});
}
}
return project;
}
function getLocales(config) {
return config.locales ?? null;
}
async function setLocalesAsync(config, {
projectRoot,
project
}) {
const locales = getLocales(config);
if (!locales) {
return project;
}
// possibly validate CFBundleAllowMixedLocalizations is enabled
const {
localesMap,
localizableStringsIOS: localizableStrings
} = await (0, _locales().getResolvedLocalesAsync)(projectRoot, locales, 'ios');
const projectName = (0, _Xcodeproj().getProjectName)(projectRoot);
const supportingDirectory = _path().default.join(projectRoot, 'ios', projectName, 'Supporting');
// TODO: Should we delete all before running? Revisit after we land on a lock file.
project = await writeStringsFile({
localesMap,
supportingDirectory,
fileName: 'InfoPlist.strings',
projectName,
project
});
if (localizableStrings && Object.keys(localizableStrings).length) {
project = await writeStringsFile({
localesMap: localizableStrings,
supportingDirectory,
fileName: 'Localizable.strings',
projectName,
project
});
}
return project;
}
//# sourceMappingURL=Locales.js.map

File diff suppressed because one or more lines are too long

17
node_modules/@expo/config-plugins/build/ios/Maps.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { ExpoConfig } from '@expo/config-types';
import { ConfigPlugin, InfoPlist } from '../Plugin.types';
import { MergeResults } from '../utils/generateCode';
export declare const MATCH_INIT: RegExp;
export declare const withMaps: ConfigPlugin;
export declare function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>, { GMSApiKey, ...infoPlist }: InfoPlist): InfoPlist;
export declare function addGoogleMapsAppDelegateImport(src: string): MergeResults;
export declare function removeGoogleMapsAppDelegateImport(src: string): MergeResults;
export declare function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults;
export declare function removeGoogleMapsAppDelegateInit(src: string): MergeResults;
/**
* @param src The contents of the Podfile.
* @returns Podfile with Google Maps added.
*/
export declare function addMapsCocoaPods(src: string): MergeResults;
export declare function removeMapsCocoaPods(src: string): MergeResults;

208
node_modules/@expo/config-plugins/build/ios/Maps.js generated vendored Normal file
View File

@@ -0,0 +1,208 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MATCH_INIT = void 0;
exports.addGoogleMapsAppDelegateImport = addGoogleMapsAppDelegateImport;
exports.addGoogleMapsAppDelegateInit = addGoogleMapsAppDelegateInit;
exports.addMapsCocoaPods = addMapsCocoaPods;
exports.getGoogleMapsApiKey = getGoogleMapsApiKey;
exports.removeGoogleMapsAppDelegateImport = removeGoogleMapsAppDelegateImport;
exports.removeGoogleMapsAppDelegateInit = removeGoogleMapsAppDelegateInit;
exports.removeMapsCocoaPods = removeMapsCocoaPods;
exports.setGoogleMapsApiKey = setGoogleMapsApiKey;
exports.withMaps = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _resolveFrom() {
const data = _interopRequireDefault(require("resolve-from"));
_resolveFrom = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _generateCode() {
const data = require("../utils/generateCode");
_generateCode = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const debug = require('debug')('expo:config-plugins:ios:maps');
const MATCH_INIT = exports.MATCH_INIT = /\bsuper\.application\(\w+?, didFinishLaunchingWithOptions: \w+?\)/g;
const withGoogleMapsKey = (0, _iosPlugins().createInfoPlistPlugin)(setGoogleMapsApiKey, 'withGoogleMapsKey');
const withMaps = config => {
config = withGoogleMapsKey(config);
const apiKey = getGoogleMapsApiKey(config);
// Technically adds react-native-maps (Apple maps) and google maps.
debug('Google Maps API Key:', apiKey);
config = withMapsCocoaPods(config, {
useGoogleMaps: !!apiKey
});
// Adds/Removes AppDelegate setup for Google Maps API on iOS
config = withGoogleMapsAppDelegate(config, {
apiKey
});
return config;
};
exports.withMaps = withMaps;
function getGoogleMapsApiKey(config) {
return config.ios?.config?.googleMapsApiKey ?? null;
}
function setGoogleMapsApiKey(config, {
GMSApiKey,
...infoPlist
}) {
const apiKey = getGoogleMapsApiKey(config);
if (apiKey === null) {
return infoPlist;
}
return {
...infoPlist,
GMSApiKey: apiKey
};
}
function addGoogleMapsAppDelegateImport(src) {
const newSrc = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif'];
return (0, _generateCode().mergeContents)({
tag: 'react-native-maps-import',
src,
newSrc: newSrc.join('\n'),
anchor: /(@main|@UIApplicationMain)/,
offset: 0,
comment: '//'
});
}
function removeGoogleMapsAppDelegateImport(src) {
return (0, _generateCode().removeContents)({
tag: 'react-native-maps-import',
src
});
}
function addGoogleMapsAppDelegateInit(src, apiKey) {
const newSrc = ['#if canImport(GoogleMaps)', `GMSServices.provideAPIKey("${apiKey}")`, '#endif'];
return (0, _generateCode().mergeContents)({
tag: 'react-native-maps-init',
src,
newSrc: newSrc.join('\n'),
anchor: MATCH_INIT,
offset: 0,
comment: '//'
});
}
function removeGoogleMapsAppDelegateInit(src) {
return (0, _generateCode().removeContents)({
tag: 'react-native-maps-init',
src
});
}
/**
* @param src The contents of the Podfile.
* @returns Podfile with Google Maps added.
*/
function addMapsCocoaPods(src) {
return (0, _generateCode().mergeContents)({
tag: 'react-native-maps',
src,
newSrc: ` pod 'react-native-google-maps', path: File.dirname(\`node --print "require.resolve('react-native-maps/package.json')"\`)`,
anchor: /use_native_modules/,
offset: 0,
comment: '#'
});
}
function removeMapsCocoaPods(src) {
return (0, _generateCode().removeContents)({
tag: 'react-native-maps',
src
});
}
function isReactNativeMapsInstalled(projectRoot) {
const resolved = _resolveFrom().default.silent(projectRoot, 'react-native-maps/package.json');
return resolved ? _path().default.dirname(resolved) : null;
}
function isReactNativeMapsAutolinked(config) {
// Only add the native code changes if we know that the package is going to be linked natively.
// This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)
// but another app will not have it installed in the package.json, causing it to not be linked natively.
// This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.
// TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.
return true;
// return (
// !config._internal?.autolinkedModules ||
// config._internal.autolinkedModules.includes('react-native-maps')
// );
}
const withMapsCocoaPods = (config, {
useGoogleMaps
}) => {
return (0, _iosPlugins().withPodfile)(config, async config => {
// Only add the block if react-native-maps is installed in the project (best effort).
// Generally prebuild runs after a yarn install so this should always work as expected.
const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);
const isLinked = isReactNativeMapsAutolinked(config);
debug('Is Expo Autolinked:', isLinked);
debug('react-native-maps path:', googleMapsPath);
let results;
if (isLinked && googleMapsPath && useGoogleMaps) {
try {
results = addMapsCocoaPods(config.modResults.contents);
} catch (error) {
if (error.code === 'ERR_NO_MATCH') {
throw new Error(`Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Report this with a copy of your project Podfile: https://github.com/expo/expo/issues`);
}
throw error;
}
} else {
// If the package is no longer installed, then remove the block.
results = removeMapsCocoaPods(config.modResults.contents);
}
if (results.didMerge || results.didClear) {
config.modResults.contents = results.contents;
}
return config;
});
};
const withGoogleMapsAppDelegate = (config, {
apiKey
}) => {
return (0, _iosPlugins().withAppDelegate)(config, config => {
if (!apiKey || !isReactNativeMapsAutolinked(config) || !isReactNativeMapsInstalled(config.modRequest.projectRoot)) {
config.modResults.contents = removeGoogleMapsAppDelegateImport(config.modResults.contents).contents;
config.modResults.contents = removeGoogleMapsAppDelegateInit(config.modResults.contents).contents;
return config;
}
if (config.modResults.language !== 'swift') {
throw new Error(`Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`);
}
try {
config.modResults.contents = addGoogleMapsAppDelegateImport(config.modResults.contents).contents;
config.modResults.contents = addGoogleMapsAppDelegateInit(config.modResults.contents, apiKey).contents;
} catch (error) {
if (error.code === 'ERR_NO_MATCH') {
throw new Error(`Cannot add Google Maps to the project's AppDelegate because it's malformed. Report this with a copy of your project AppDelegate: https://github.com/expo/expo/issues`);
}
throw error;
}
return config;
});
};
//# sourceMappingURL=Maps.js.map

File diff suppressed because one or more lines are too long

20
node_modules/@expo/config-plugins/build/ios/Name.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { ExpoConfig } from '@expo/config-types';
import { XcodeProject } from 'xcode';
import { InfoPlist } from './IosConfig.types';
import { ConfigPlugin } from '../Plugin.types';
export declare const withDisplayName: ConfigPlugin;
export declare const withName: ConfigPlugin;
/** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */
export declare const withProductName: ConfigPlugin;
export declare function getName(config: Pick<ExpoConfig, 'name'>): string | null;
/**
* CFBundleDisplayName is used for most things: the name on the home screen, in
* notifications, and others.
*/
export declare function setDisplayName(configOrName: Pick<ExpoConfig, 'name'> | string, { CFBundleDisplayName, ...infoPlist }: InfoPlist): InfoPlist;
/**
* CFBundleName is recommended to be 16 chars or less and is used in lists, eg:
* sometimes on the App Store
*/
export declare function setName(config: Pick<ExpoConfig, 'name'>, { CFBundleName, ...infoPlist }: InfoPlist): InfoPlist;
export declare function setProductName(config: Pick<ExpoConfig, 'name'>, project: XcodeProject): XcodeProject;

111
node_modules/@expo/config-plugins/build/ios/Name.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getName = getName;
exports.setDisplayName = setDisplayName;
exports.setName = setName;
exports.setProductName = setProductName;
exports.withProductName = exports.withName = exports.withDisplayName = void 0;
function _Target() {
const data = require("./Target");
_Target = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
const withDisplayName = exports.withDisplayName = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setDisplayName, {
infoPlistProperty: 'CFBundleDisplayName',
expoConfigProperty: 'name'
}, 'withDisplayName');
const withName = exports.withName = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setName, {
infoPlistProperty: 'CFBundleName',
expoConfigProperty: 'name'
}, 'withName');
/** Set the PRODUCT_NAME variable in the xcproj file based on the app.json name property. */
const withProductName = config => {
return (0, _iosPlugins().withXcodeProject)(config, config => {
config.modResults = setProductName(config, config.modResults);
return config;
});
};
exports.withProductName = withProductName;
function getName(config) {
return typeof config.name === 'string' ? config.name : null;
}
/**
* CFBundleDisplayName is used for most things: the name on the home screen, in
* notifications, and others.
*/
function setDisplayName(configOrName, {
CFBundleDisplayName,
...infoPlist
}) {
let name = null;
if (typeof configOrName === 'string') {
name = configOrName;
} else {
name = getName(configOrName);
}
if (!name) {
return infoPlist;
}
return {
...infoPlist,
CFBundleDisplayName: name
};
}
/**
* CFBundleName is recommended to be 16 chars or less and is used in lists, eg:
* sometimes on the App Store
*/
function setName(config, {
CFBundleName,
...infoPlist
}) {
const name = getName(config);
if (!name) {
return infoPlist;
}
return {
...infoPlist,
CFBundleName: name
};
}
function setProductName(config, project) {
const name = (0, _Xcodeproj().sanitizedName)(getName(config) ?? '');
if (!name) {
return project;
}
const quotedName = ensureQuotes(name);
const [, nativeTarget] = (0, _Target().findFirstNativeTarget)(project);
(0, _Xcodeproj().getBuildConfigurationsForListId)(project, nativeTarget.buildConfigurationList).forEach(([, item]) => {
item.buildSettings.PRODUCT_NAME = quotedName;
});
return project;
}
const ensureQuotes = value => {
if (!value.match(/^['"]/)) {
return `"${value}"`;
}
return value;
};
//# sourceMappingURL=Name.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist, InterfaceOrientation } from './IosConfig.types';
export declare const withOrientation: import("..").ConfigPlugin;
export declare function getOrientation(config: Pick<ExpoConfig, 'orientation'>): "default" | "portrait" | "landscape" | null;
export declare const PORTRAIT_ORIENTATIONS: InterfaceOrientation[];
export declare const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[];
export declare function setOrientation(config: Pick<ExpoConfig, 'orientation'>, infoPlist: InfoPlist): InfoPlist;

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PORTRAIT_ORIENTATIONS = exports.LANDSCAPE_ORIENTATIONS = void 0;
exports.getOrientation = getOrientation;
exports.setOrientation = setOrientation;
exports.withOrientation = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
const withOrientation = exports.withOrientation = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setOrientation, {
infoPlistProperty: 'UISupportedInterfaceOrientations',
expoConfigProperty: 'orientation'
}, 'withOrientation');
function getOrientation(config) {
return config.orientation ?? null;
}
const PORTRAIT_ORIENTATIONS = exports.PORTRAIT_ORIENTATIONS = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown'];
const LANDSCAPE_ORIENTATIONS = exports.LANDSCAPE_ORIENTATIONS = ['UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight'];
function getUISupportedInterfaceOrientations(orientation) {
if (orientation === 'portrait') {
return PORTRAIT_ORIENTATIONS;
} else if (orientation === 'landscape') {
return LANDSCAPE_ORIENTATIONS;
} else {
return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];
}
}
function setOrientation(config, infoPlist) {
const orientation = getOrientation(config);
return {
...infoPlist,
UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation)
};
}
//# sourceMappingURL=Orientation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Orientation.js","names":["_iosPlugins","data","require","withOrientation","exports","createInfoPlistPluginWithPropertyGuard","setOrientation","infoPlistProperty","expoConfigProperty","getOrientation","config","orientation","PORTRAIT_ORIENTATIONS","LANDSCAPE_ORIENTATIONS","getUISupportedInterfaceOrientations","infoPlist","UISupportedInterfaceOrientations"],"sources":["../../src/ios/Orientation.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist, InterfaceOrientation } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withOrientation = createInfoPlistPluginWithPropertyGuard(\n setOrientation,\n {\n infoPlistProperty: 'UISupportedInterfaceOrientations',\n expoConfigProperty: 'orientation',\n },\n 'withOrientation'\n);\n\nexport function getOrientation(config: Pick<ExpoConfig, 'orientation'>) {\n return config.orientation ?? null;\n}\n\nexport const PORTRAIT_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationPortrait',\n 'UIInterfaceOrientationPortraitUpsideDown',\n];\n\nexport const LANDSCAPE_ORIENTATIONS: InterfaceOrientation[] = [\n 'UIInterfaceOrientationLandscapeLeft',\n 'UIInterfaceOrientationLandscapeRight',\n];\n\nfunction getUISupportedInterfaceOrientations(orientation: string | null): InterfaceOrientation[] {\n if (orientation === 'portrait') {\n return PORTRAIT_ORIENTATIONS;\n } else if (orientation === 'landscape') {\n return LANDSCAPE_ORIENTATIONS;\n } else {\n return [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS];\n }\n}\n\nexport function setOrientation(\n config: Pick<ExpoConfig, 'orientation'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const orientation = getOrientation(config);\n\n return {\n ...infoPlist,\n UISupportedInterfaceOrientations: getUISupportedInterfaceOrientations(orientation),\n };\n}\n"],"mappings":";;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,oDAAsC,EACnEC,cAAc,EACd;EACEC,iBAAiB,EAAE,kCAAkC;EACrDC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBACF,CAAC;AAEM,SAASC,cAAcA,CAACC,MAAuC,EAAE;EACtE,OAAOA,MAAM,CAACC,WAAW,IAAI,IAAI;AACnC;AAEO,MAAMC,qBAA6C,GAAAR,OAAA,CAAAQ,qBAAA,GAAG,CAC3D,gCAAgC,EAChC,0CAA0C,CAC3C;AAEM,MAAMC,sBAA8C,GAAAT,OAAA,CAAAS,sBAAA,GAAG,CAC5D,qCAAqC,EACrC,sCAAsC,CACvC;AAED,SAASC,mCAAmCA,CAACH,WAA0B,EAA0B;EAC/F,IAAIA,WAAW,KAAK,UAAU,EAAE;IAC9B,OAAOC,qBAAqB;EAC9B,CAAC,MAAM,IAAID,WAAW,KAAK,WAAW,EAAE;IACtC,OAAOE,sBAAsB;EAC/B,CAAC,MAAM;IACL,OAAO,CAAC,GAAGD,qBAAqB,EAAE,GAAGC,sBAAsB,CAAC;EAC9D;AACF;AAEO,SAASP,cAAcA,CAC5BI,MAAuC,EACvCK,SAAoB,EACT;EACX,MAAMJ,WAAW,GAAGF,cAAc,CAACC,MAAM,CAAC;EAE1C,OAAO;IACL,GAAGK,SAAS;IACZC,gCAAgC,EAAEF,mCAAmC,CAACH,WAAW;EACnF,CAAC;AACH","ignoreList":[]}

38
node_modules/@expo/config-plugins/build/ios/Paths.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
interface ProjectFile<L extends string = string> {
path: string;
language: L;
contents: string;
}
type AppleLanguage = 'objc' | 'objcpp' | 'swift' | 'rb';
export type PodfileProjectFile = ProjectFile<'rb'>;
export type AppDelegateProjectFile = ProjectFile<AppleLanguage>;
export declare function getAppDelegateHeaderFilePath(projectRoot: string): string;
export declare function getAppDelegateFilePath(projectRoot: string): string;
export declare function getAppDelegateObjcHeaderFilePath(projectRoot: string): string;
export declare function getPodfilePath(projectRoot: string): string;
export declare function getFileInfo(filePath: string): {
path: string;
contents: string;
language: AppleLanguage;
};
export declare function getAppDelegate(projectRoot: string): AppDelegateProjectFile;
export declare function getSourceRoot(projectRoot: string): string;
export declare function findSchemePaths(projectRoot: string): string[];
export declare function findSchemeNames(projectRoot: string): string[];
export declare function getAllXcodeProjectPaths(projectRoot: string): string[];
/**
* Get the pbxproj for the given path
*/
export declare function getXcodeProjectPath(projectRoot: string): string;
export declare function getAllPBXProjectPaths(projectRoot: string): string[];
export declare function getPBXProjectPath(projectRoot: string): string;
export declare function getAllInfoPlistPaths(projectRoot: string): string[];
export declare function getInfoPlistPath(projectRoot: string): string;
export declare function getAllEntitlementsPaths(projectRoot: string): string[];
/**
* @deprecated: use Entitlements.getEntitlementsPath instead
*/
export declare function getEntitlementsPath(projectRoot: string): string | null;
export declare function getSupportingPath(projectRoot: string): string;
export declare function getExpoPlistPath(projectRoot: string): string;
export {};

318
node_modules/@expo/config-plugins/build/ios/Paths.js generated vendored Normal file
View File

@@ -0,0 +1,318 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findSchemeNames = findSchemeNames;
exports.findSchemePaths = findSchemePaths;
exports.getAllEntitlementsPaths = getAllEntitlementsPaths;
exports.getAllInfoPlistPaths = getAllInfoPlistPaths;
exports.getAllPBXProjectPaths = getAllPBXProjectPaths;
exports.getAllXcodeProjectPaths = getAllXcodeProjectPaths;
exports.getAppDelegate = getAppDelegate;
exports.getAppDelegateFilePath = getAppDelegateFilePath;
exports.getAppDelegateHeaderFilePath = getAppDelegateHeaderFilePath;
exports.getAppDelegateObjcHeaderFilePath = getAppDelegateObjcHeaderFilePath;
exports.getEntitlementsPath = getEntitlementsPath;
exports.getExpoPlistPath = getExpoPlistPath;
exports.getFileInfo = getFileInfo;
exports.getInfoPlistPath = getInfoPlistPath;
exports.getPBXProjectPath = getPBXProjectPath;
exports.getPodfilePath = getPodfilePath;
exports.getSourceRoot = getSourceRoot;
exports.getSupportingPath = getSupportingPath;
exports.getXcodeProjectPath = getXcodeProjectPath;
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
function _glob() {
const data = require("glob");
_glob = function () {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require("path"));
path = function () {
return data;
};
return data;
}
function Entitlements() {
const data = _interopRequireWildcard(require("./Entitlements"));
Entitlements = function () {
return data;
};
return data;
}
function _errors() {
const data = require("../utils/errors");
_errors = function () {
return data;
};
return data;
}
function _glob2() {
const data = require("../utils/glob");
_glob2 = function () {
return data;
};
return data;
}
function _warnings() {
const data = require("../utils/warnings");
_warnings = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
function getAppDelegateHeaderFilePath(projectRoot) {
const [using, ...extra] = (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/*/AppDelegate.h', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
}));
if (!using) {
throw new (_errors().UnexpectedError)(`Could not locate a valid AppDelegate header at root: "${projectRoot}"`);
}
if (extra.length) {
warnMultipleFiles({
tag: 'app-delegate-header',
fileName: 'AppDelegate',
projectRoot,
using,
extra
});
}
return using;
}
function getAppDelegateFilePath(projectRoot) {
const [using, ...extra] = (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/*/AppDelegate.@(m|mm|swift)', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
}));
if (!using) {
throw new (_errors().UnexpectedError)(`Could not locate a valid AppDelegate at root: "${projectRoot}"`);
}
if (extra.length) {
warnMultipleFiles({
tag: 'app-delegate',
fileName: 'AppDelegate',
projectRoot,
using,
extra
});
}
return using;
}
function getAppDelegateObjcHeaderFilePath(projectRoot) {
const [using, ...extra] = (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/*/AppDelegate.h', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
}));
if (!using) {
throw new (_errors().UnexpectedError)(`Could not locate a valid AppDelegate.h at root: "${projectRoot}"`);
}
if (extra.length) {
warnMultipleFiles({
tag: 'app-delegate-objc-header',
fileName: 'AppDelegate.h',
projectRoot,
using,
extra
});
}
return using;
}
function getPodfilePath(projectRoot) {
const [using, ...extra] = (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/Podfile', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
}));
if (!using) {
throw new (_errors().UnexpectedError)(`Could not locate a valid Podfile at root: "${projectRoot}"`);
}
if (extra.length) {
warnMultipleFiles({
tag: 'podfile',
fileName: 'Podfile',
projectRoot,
using,
extra
});
}
return using;
}
function getLanguage(filePath) {
const extension = path().extname(filePath);
if (!extension && path().basename(filePath) === 'Podfile') {
return 'rb';
}
switch (extension) {
case '.mm':
return 'objcpp';
case '.m':
case '.h':
return 'objc';
case '.swift':
return 'swift';
default:
throw new (_errors().UnexpectedError)(`Unexpected iOS file extension: ${extension}`);
}
}
function getFileInfo(filePath) {
return {
path: path().normalize(filePath),
contents: (0, _fs().readFileSync)(filePath, 'utf8'),
language: getLanguage(filePath)
};
}
function getAppDelegate(projectRoot) {
const filePath = getAppDelegateFilePath(projectRoot);
return getFileInfo(filePath);
}
function getSourceRoot(projectRoot) {
const appDelegate = getAppDelegate(projectRoot);
return path().dirname(appDelegate.path);
}
function findSchemePaths(projectRoot) {
return (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
}));
}
function findSchemeNames(projectRoot) {
const schemePaths = findSchemePaths(projectRoot);
return schemePaths.map(schemePath => path().parse(schemePath).name);
}
function getAllXcodeProjectPaths(projectRoot) {
const iosFolder = 'ios';
const pbxprojPaths = (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/**/*.xcodeproj', {
cwd: projectRoot,
ignore: ignoredPaths
})
// Drop leading `/` from glob results to mimick glob@<9 behavior
.map(filePath => filePath.replace(/^\//, '')).filter(project => !/test|example|sample/i.test(project) || path().dirname(project) === iosFolder)).sort((a, b) => {
const isAInIos = path().dirname(a) === iosFolder;
const isBInIos = path().dirname(b) === iosFolder;
// preserve previous sort order
if (isAInIos && isBInIos || !isAInIos && !isBInIos) {
return 0;
}
return isAInIos ? -1 : 1;
});
if (!pbxprojPaths.length) {
throw new (_errors().UnexpectedError)(`Failed to locate the ios/*.xcodeproj files relative to path "${projectRoot}".`);
}
return pbxprojPaths.map(value => path().join(projectRoot, value));
}
/**
* Get the pbxproj for the given path
*/
function getXcodeProjectPath(projectRoot) {
const [using, ...extra] = getAllXcodeProjectPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'xcodeproj',
fileName: '*.xcodeproj',
projectRoot,
using,
extra
});
}
return using;
}
function getAllPBXProjectPaths(projectRoot) {
const projectPaths = getAllXcodeProjectPaths(projectRoot);
const paths = projectPaths.map(value => path().join(value, 'project.pbxproj')).filter(value => (0, _fs().existsSync)(value));
if (!paths.length) {
throw new (_errors().UnexpectedError)(`Failed to locate the ios/*.xcodeproj/project.pbxproj files relative to path "${projectRoot}".`);
}
return paths;
}
function getPBXProjectPath(projectRoot) {
const [using, ...extra] = getAllPBXProjectPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'project-pbxproj',
fileName: 'project.pbxproj',
projectRoot,
using,
extra
});
}
return using;
}
function getAllInfoPlistPaths(projectRoot) {
const paths = (0, _glob2().withSortedGlobResult)((0, _glob().globSync)('ios/*/Info.plist', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
})).sort(
// longer name means more suffixes, we want the shortest possible one to be first.
(a, b) => a.length - b.length);
if (!paths.length) {
throw new (_errors().UnexpectedError)(`Failed to locate Info.plist files relative to path "${projectRoot}".`);
}
return paths;
}
function getInfoPlistPath(projectRoot) {
const [using, ...extra] = getAllInfoPlistPaths(projectRoot);
if (extra.length) {
warnMultipleFiles({
tag: 'info-plist',
fileName: 'Info.plist',
projectRoot,
using,
extra
});
}
return using;
}
function getAllEntitlementsPaths(projectRoot) {
const paths = (0, _glob().globSync)('ios/*/*.entitlements', {
absolute: true,
cwd: projectRoot,
ignore: ignoredPaths
});
return paths;
}
/**
* @deprecated: use Entitlements.getEntitlementsPath instead
*/
function getEntitlementsPath(projectRoot) {
return Entitlements().getEntitlementsPath(projectRoot);
}
function getSupportingPath(projectRoot) {
return path().resolve(projectRoot, 'ios', path().basename(getSourceRoot(projectRoot)), 'Supporting');
}
function getExpoPlistPath(projectRoot) {
const supportingPath = getSupportingPath(projectRoot);
return path().join(supportingPath, 'Expo.plist');
}
function warnMultipleFiles({
tag,
fileName,
projectRoot,
using,
extra
}) {
const usingPath = projectRoot ? path().relative(projectRoot, using) : using;
const extraPaths = projectRoot ? extra.map(v => path().relative(projectRoot, v)) : extra;
(0, _warnings().addWarningIOS)(`paths-${tag}`, `Found multiple ${fileName} file paths, using "${usingPath}". Ignored paths: ${JSON.stringify(extraPaths)}`);
}
//# sourceMappingURL=Paths.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
import { InfoPlist } from './IosConfig.types';
import { ConfigPlugin } from '../Plugin.types';
export declare function applyPermissions<Defaults extends Record<string, string> = Record<string, string>>(defaults: Defaults, permissions: Partial<Record<keyof Defaults, string | false>>, infoPlist: InfoPlist): InfoPlist;
/**
* Helper method for creating mods to apply default permissions.
*
* @param action
*/
export declare function createPermissionsPlugin<Defaults extends Record<string, string> = Record<string, string>>(defaults: Defaults, name?: string): ConfigPlugin<Record<keyof Defaults, string | false | undefined>>;

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.applyPermissions = applyPermissions;
exports.createPermissionsPlugin = createPermissionsPlugin;
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const debug = (0, _debug().default)('expo:config-plugins:ios:permissions');
function applyPermissions(defaults, permissions, infoPlist) {
const entries = Object.entries(defaults);
if (entries.length === 0) {
debug(`No defaults provided: ${JSON.stringify(permissions)}`);
}
for (const [permission, description] of entries) {
if (permissions[permission] === false) {
debug(`Deleting "${permission}"`);
delete infoPlist[permission];
} else {
infoPlist[permission] = permissions[permission] || infoPlist[permission] || description;
debug(`Setting "${permission}" to "${infoPlist[permission]}"`);
}
}
return infoPlist;
}
/**
* Helper method for creating mods to apply default permissions.
*
* @param action
*/
function createPermissionsPlugin(defaults, name) {
const withIosPermissions = (config, permissions) => (0, _iosPlugins().withInfoPlist)(config, async config => {
config.modResults = applyPermissions(defaults, permissions, config.modResults);
return config;
});
if (name) {
Object.defineProperty(withIosPermissions, 'name', {
value: name
});
}
return withIosPermissions;
}
//# sourceMappingURL=Permissions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Permissions.js","names":["_debug","data","_interopRequireDefault","require","_iosPlugins","e","__esModule","default","debug","Debug","applyPermissions","defaults","permissions","infoPlist","entries","Object","length","JSON","stringify","permission","description","createPermissionsPlugin","name","withIosPermissions","config","withInfoPlist","modResults","defineProperty","value"],"sources":["../../src/ios/Permissions.ts"],"sourcesContent":["import Debug from 'debug';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\n\nconst debug = Debug('expo:config-plugins:ios:permissions');\n\nexport function applyPermissions<Defaults extends Record<string, string> = Record<string, string>>(\n defaults: Defaults,\n permissions: Partial<Record<keyof Defaults, string | false>>,\n infoPlist: InfoPlist\n): InfoPlist {\n const entries = Object.entries(defaults);\n if (entries.length === 0) {\n debug(`No defaults provided: ${JSON.stringify(permissions)}`);\n }\n for (const [permission, description] of entries) {\n if (permissions[permission] === false) {\n debug(`Deleting \"${permission}\"`);\n delete infoPlist[permission];\n } else {\n infoPlist[permission] = permissions[permission] || infoPlist[permission] || description;\n debug(`Setting \"${permission}\" to \"${infoPlist[permission]}\"`);\n }\n }\n return infoPlist;\n}\n\n/**\n * Helper method for creating mods to apply default permissions.\n *\n * @param action\n */\nexport function createPermissionsPlugin<\n Defaults extends Record<string, string> = Record<string, string>,\n>(defaults: Defaults, name?: string) {\n const withIosPermissions: ConfigPlugin<Record<keyof Defaults, string | undefined | false>> = (\n config,\n permissions\n ) =>\n withInfoPlist(config, async (config) => {\n config.modResults = applyPermissions(defaults, permissions, config.modResults);\n return config;\n });\n if (name) {\n Object.defineProperty(withIosPermissions, 'name', {\n value: name,\n });\n }\n return withIosPermissions;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAuD,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvD,MAAMG,KAAK,GAAG,IAAAC,gBAAK,EAAC,qCAAqC,CAAC;AAEnD,SAASC,gBAAgBA,CAC9BC,QAAkB,EAClBC,WAA4D,EAC5DC,SAAoB,EACT;EACX,MAAMC,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACH,QAAQ,CAAC;EACxC,IAAIG,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACxBR,KAAK,CAAC,yBAAyBS,IAAI,CAACC,SAAS,CAACN,WAAW,CAAC,EAAE,CAAC;EAC/D;EACA,KAAK,MAAM,CAACO,UAAU,EAAEC,WAAW,CAAC,IAAIN,OAAO,EAAE;IAC/C,IAAIF,WAAW,CAACO,UAAU,CAAC,KAAK,KAAK,EAAE;MACrCX,KAAK,CAAC,aAAaW,UAAU,GAAG,CAAC;MACjC,OAAON,SAAS,CAACM,UAAU,CAAC;IAC9B,CAAC,MAAM;MACLN,SAAS,CAACM,UAAU,CAAC,GAAGP,WAAW,CAACO,UAAU,CAAC,IAAIN,SAAS,CAACM,UAAU,CAAC,IAAIC,WAAW;MACvFZ,KAAK,CAAC,YAAYW,UAAU,SAASN,SAAS,CAACM,UAAU,CAAC,GAAG,CAAC;IAChE;EACF;EACA,OAAON,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASQ,uBAAuBA,CAErCV,QAAkB,EAAEW,IAAa,EAAE;EACnC,MAAMC,kBAAoF,GAAGA,CAC3FC,MAAM,EACNZ,WAAW,KAEX,IAAAa,2BAAa,EAACD,MAAM,EAAE,MAAOA,MAAM,IAAK;IACtCA,MAAM,CAACE,UAAU,GAAGhB,gBAAgB,CAACC,QAAQ,EAAEC,WAAW,EAAEY,MAAM,CAACE,UAAU,CAAC;IAC9E,OAAOF,MAAM;EACf,CAAC,CAAC;EACJ,IAAIF,IAAI,EAAE;IACRP,MAAM,CAACY,cAAc,CAACJ,kBAAkB,EAAE,MAAM,EAAE;MAChDK,KAAK,EAAEN;IACT,CAAC,CAAC;EACJ;EACA,OAAOC,kBAAkB;AAC3B","ignoreList":[]}

View File

@@ -0,0 +1,20 @@
import { ExpoConfig } from '@expo/config-types';
import type { XcodeProject } from 'xcode';
import { ExportedConfigWithProps } from '../Plugin.types';
export type PrivacyInfo = {
NSPrivacyAccessedAPITypes: {
NSPrivacyAccessedAPIType: string;
NSPrivacyAccessedAPITypeReasons: string[];
}[];
NSPrivacyCollectedDataTypes: {
NSPrivacyCollectedDataType: string;
NSPrivacyCollectedDataTypeLinked: boolean;
NSPrivacyCollectedDataTypeTracking: boolean;
NSPrivacyCollectedDataTypePurposes: string[];
}[];
NSPrivacyTracking: boolean;
NSPrivacyTrackingDomains: string[];
};
export declare function withPrivacyInfo(config: ExpoConfig): ExpoConfig;
export declare function setPrivacyInfo(projectConfig: ExportedConfigWithProps<XcodeProject>, privacyManifests: Partial<PrivacyInfo>): ExportedConfigWithProps<XcodeProject>;
export declare function mergePrivacyInfo(existing: Partial<PrivacyInfo>, privacyManifests: Partial<PrivacyInfo>): PrivacyInfo;

View File

@@ -0,0 +1,129 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mergePrivacyInfo = mergePrivacyInfo;
exports.setPrivacyInfo = setPrivacyInfo;
exports.withPrivacyInfo = withPrivacyInfo;
function _plist() {
const data = _interopRequireDefault(require("@expo/plist"));
_plist = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function withPrivacyInfo(config) {
const privacyManifests = config.ios?.privacyManifests;
if (!privacyManifests) {
return config;
}
return (0, _iosPlugins().withXcodeProject)(config, projectConfig => {
return setPrivacyInfo(projectConfig, privacyManifests);
});
}
function setPrivacyInfo(projectConfig, privacyManifests) {
const {
projectRoot,
platformProjectRoot
} = projectConfig.modRequest;
const projectName = (0, _Xcodeproj().getProjectName)(projectRoot);
const privacyFilePath = _path().default.join(platformProjectRoot, projectName, 'PrivacyInfo.xcprivacy');
const existingFileContent = getFileContents(privacyFilePath);
const parsedContent = existingFileContent ? _plist().default.parse(existingFileContent) : {};
const mergedContent = mergePrivacyInfo(parsedContent, privacyManifests);
const contents = _plist().default.build(mergedContent);
ensureFileExists(privacyFilePath, contents);
if (!projectConfig.modResults.hasFile(privacyFilePath)) {
projectConfig.modResults = (0, _Xcodeproj().addResourceFileToGroup)({
filepath: _path().default.join(projectName, 'PrivacyInfo.xcprivacy'),
groupName: projectName,
project: projectConfig.modResults,
isBuildFile: true,
verbose: true
});
}
return projectConfig;
}
function getFileContents(filePath) {
if (!_fs().default.existsSync(filePath)) {
return null;
}
return _fs().default.readFileSync(filePath, {
encoding: 'utf8'
});
}
function ensureFileExists(filePath, contents) {
if (!_fs().default.existsSync(_path().default.dirname(filePath))) {
_fs().default.mkdirSync(_path().default.dirname(filePath), {
recursive: true
});
}
_fs().default.writeFileSync(filePath, contents);
}
function mergePrivacyInfo(existing, privacyManifests) {
let {
NSPrivacyAccessedAPITypes = [],
NSPrivacyCollectedDataTypes = [],
NSPrivacyTracking = false,
NSPrivacyTrackingDomains = []
} = structuredClone(existing);
// tracking is a boolean, so we can just overwrite it
NSPrivacyTracking = privacyManifests.NSPrivacyTracking ?? existing.NSPrivacyTracking ?? false;
// merge the api types for each type ensure the key is in the array, and if it is add the reason if it's not there
privacyManifests.NSPrivacyAccessedAPITypes?.forEach(newType => {
const existingType = NSPrivacyAccessedAPITypes.find(t => t.NSPrivacyAccessedAPIType === newType.NSPrivacyAccessedAPIType);
if (!existingType) {
NSPrivacyAccessedAPITypes.push(newType);
} else {
existingType.NSPrivacyAccessedAPITypeReasons = [...new Set(existingType?.NSPrivacyAccessedAPITypeReasons?.concat(...newType.NSPrivacyAccessedAPITypeReasons))];
}
});
// merge the collected data types for each type ensure the key is in the array, and if it is add the purposes if it's not there
privacyManifests.NSPrivacyCollectedDataTypes?.forEach(newType => {
const existingType = NSPrivacyCollectedDataTypes.find(t => t.NSPrivacyCollectedDataType === newType.NSPrivacyCollectedDataType);
if (!existingType) {
NSPrivacyCollectedDataTypes.push(newType);
} else {
existingType.NSPrivacyCollectedDataTypePurposes = [...new Set(existingType?.NSPrivacyCollectedDataTypePurposes?.concat(...newType.NSPrivacyCollectedDataTypePurposes))];
}
});
// merge the tracking domains
NSPrivacyTrackingDomains = [...new Set(NSPrivacyTrackingDomains.concat(privacyManifests.NSPrivacyTrackingDomains ?? []))];
return {
NSPrivacyAccessedAPITypes,
NSPrivacyCollectedDataTypes,
NSPrivacyTracking,
NSPrivacyTrackingDomains
};
}
//# sourceMappingURL=PrivacyInfo.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
type ProvisioningProfileSettings = {
targetName?: string;
appleTeamId: string;
profileName: string;
buildConfiguration?: string;
};
export declare function setProvisioningProfileForPbxproj(projectRoot: string, { targetName, profileName, appleTeamId, buildConfiguration, }: ProvisioningProfileSettings): void;
export {};

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setProvisioningProfileForPbxproj = setProvisioningProfileForPbxproj;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _Target() {
const data = require("./Target");
_Target = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _string() {
const data = require("./utils/string");
_string = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function setProvisioningProfileForPbxproj(projectRoot, {
targetName,
profileName,
appleTeamId,
buildConfiguration = 'Release'
}) {
const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
const nativeTargetEntry = targetName ? (0, _Target().findNativeTargetByName)(project, targetName) : (0, _Target().findFirstNativeTarget)(project);
const [nativeTargetId, nativeTarget] = nativeTargetEntry;
const quotedAppleTeamId = ensureQuotes(appleTeamId);
(0, _Xcodeproj().getBuildConfigurationsForListId)(project, nativeTarget.buildConfigurationList).filter(([, item]) => (0, _string().trimQuotes)(item.name) === buildConfiguration).forEach(([, item]) => {
item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `"${profileName}"`;
item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;
item.buildSettings.CODE_SIGN_IDENTITY = '"iPhone Distribution"';
item.buildSettings.CODE_SIGN_STYLE = 'Manual';
});
Object.entries((0, _Xcodeproj().getProjectSection)(project)).filter(_Xcodeproj().isNotComment).forEach(([, item]) => {
if (!item.attributes.TargetAttributes[nativeTargetId]) {
item.attributes.TargetAttributes[nativeTargetId] = {};
}
item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;
item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';
});
_fs().default.writeFileSync(project.filepath, project.writeSync());
}
const ensureQuotes = value => {
if (!value.match(/^['"]/)) {
return `"${value}"`;
}
return value;
};
//# sourceMappingURL=ProvisioningProfile.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withRequiresFullScreen: import("..").ConfigPlugin;
export declare function setRequiresFullScreen(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;

View File

@@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setRequiresFullScreen = setRequiresFullScreen;
exports.withRequiresFullScreen = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _warnings() {
const data = require("../utils/warnings");
_warnings = function () {
return data;
};
return data;
}
const withRequiresFullScreen = exports.withRequiresFullScreen = (0, _iosPlugins().createInfoPlistPlugin)(setRequiresFullScreen, 'withRequiresFullScreen');
const iPadInterfaceKey = 'UISupportedInterfaceOrientations~ipad';
const requiredIPadInterface = ['UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight'];
function isStringArray(value) {
return Array.isArray(value) && value.every(value => typeof value === 'string');
}
function hasMinimumOrientations(masks) {
return requiredIPadInterface.every(mask => masks.includes(mask));
}
/**
* Require full screen being disabled requires all ipad interfaces to to be added,
* otherwise submissions to the iOS App Store will fail.
*
* ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown' in bundle 'com.bacon.app'."
*
* @param interfaceOrientations
* @returns
*/
function resolveExistingIpadInterfaceOrientations(interfaceOrientations) {
if (
// Ensure type.
isStringArray(interfaceOrientations) &&
// Don't warn if it's an empty array, this is invalid regardless.
interfaceOrientations.length &&
// Check if the minimum requirements are met.
!hasMinimumOrientations(interfaceOrientations)) {
const existingList = interfaceOrientations.join(', ');
(0, _warnings().addWarningIOS)('ios.requireFullScreen', `iPad multitasking requires all \`${iPadInterfaceKey}\` orientations to be defined in the Info.plist. The Info.plist currently defines values that are incompatible with multitasking, these will be overwritten to prevent submission failure. Existing: ${existingList}`);
return interfaceOrientations;
}
return [];
}
// Whether requires full screen on iPad
function setRequiresFullScreen(config, infoPlist) {
const requiresFullScreen = !!config.ios?.requireFullScreen;
const isTabletEnabled = config.ios?.supportsTablet || config.ios?.isTabletOnly;
if (isTabletEnabled && !requiresFullScreen) {
const existing = resolveExistingIpadInterfaceOrientations(infoPlist[iPadInterfaceKey]);
// There currently exists no mechanism to safely undo this feature besides `npx expo prebuild --clear`,
// this seems ok though because anyone using `UISupportedInterfaceOrientations~ipad` probably
// wants them to be defined to this value anyways. This is also the default value used in the Xcode iOS template.
// Merge any previous interfaces with the required interfaces.
infoPlist[iPadInterfaceKey] = [...new Set(existing.concat(requiredIPadInterface))];
}
return {
...infoPlist,
UIRequiresFullScreen: requiresFullScreen
};
}
//# sourceMappingURL=RequiresFullScreen.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withScheme: import("..").ConfigPlugin;
export declare function getScheme(config: {
scheme?: string | string[];
}): string[];
export declare function setScheme(config: Partial<Pick<ExpoConfig, 'scheme' | 'ios'>>, infoPlist: InfoPlist): InfoPlist;
export declare function appendScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist;
export declare function removeScheme(scheme: string | null, infoPlist: InfoPlist): InfoPlist;
export declare function hasScheme(scheme: string, infoPlist: InfoPlist): boolean;
export declare function getSchemesFromPlist(infoPlist: InfoPlist): string[];

109
node_modules/@expo/config-plugins/build/ios/Scheme.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.appendScheme = appendScheme;
exports.getScheme = getScheme;
exports.getSchemesFromPlist = getSchemesFromPlist;
exports.hasScheme = hasScheme;
exports.removeScheme = removeScheme;
exports.setScheme = setScheme;
exports.withScheme = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
const withScheme = exports.withScheme = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setScheme, {
infoPlistProperty: 'CFBundleURLTypes',
expoConfigProperty: 'scheme'
}, 'withScheme');
function getScheme(config) {
if (Array.isArray(config.scheme)) {
const validate = value => {
return typeof value === 'string';
};
return config.scheme.filter(validate);
} else if (typeof config.scheme === 'string') {
return [config.scheme];
}
return [];
}
function setScheme(config, infoPlist) {
const scheme = [...getScheme(config), ...getScheme(config.ios ?? {})];
// Add the bundle identifier to the list of schemes for easier Google auth and parity with Turtle v1.
if (config.ios?.bundleIdentifier) {
scheme.push(config.ios.bundleIdentifier);
}
if (scheme.length === 0) {
return infoPlist;
}
return {
...infoPlist,
CFBundleURLTypes: [{
CFBundleURLSchemes: scheme
}]
};
}
function appendScheme(scheme, infoPlist) {
if (!scheme) {
return infoPlist;
}
const existingSchemes = infoPlist.CFBundleURLTypes ?? [];
if (existingSchemes?.some(({
CFBundleURLSchemes
}) => CFBundleURLSchemes.includes(scheme))) {
return infoPlist;
}
return {
...infoPlist,
CFBundleURLTypes: [...existingSchemes, {
CFBundleURLSchemes: [scheme]
}]
};
}
function removeScheme(scheme, infoPlist) {
if (!scheme) {
return infoPlist;
}
// No need to remove if we don't have any
if (!infoPlist.CFBundleURLTypes) {
return infoPlist;
}
infoPlist.CFBundleURLTypes = infoPlist.CFBundleURLTypes.map(bundleUrlType => {
const index = bundleUrlType.CFBundleURLSchemes.indexOf(scheme);
if (index > -1) {
bundleUrlType.CFBundleURLSchemes.splice(index, 1);
if (bundleUrlType.CFBundleURLSchemes.length === 0) {
return undefined;
}
}
return bundleUrlType;
}).filter(Boolean);
return infoPlist;
}
function hasScheme(scheme, infoPlist) {
const existingSchemes = infoPlist.CFBundleURLTypes;
if (!Array.isArray(existingSchemes)) return false;
return existingSchemes?.some(({
CFBundleURLSchemes: schemes
}) => Array.isArray(schemes) ? schemes.includes(scheme) : false);
}
function getSchemesFromPlist(infoPlist) {
if (Array.isArray(infoPlist.CFBundleURLTypes)) {
return infoPlist.CFBundleURLTypes.reduce((schemes, {
CFBundleURLSchemes
}) => {
if (Array.isArray(CFBundleURLSchemes)) {
return [...schemes, ...CFBundleURLSchemes];
}
return schemes;
}, []);
}
return [];
}
//# sourceMappingURL=Scheme.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
import { PBXNativeTarget, XCBuildConfiguration, XcodeProject } from 'xcode';
import { NativeTargetSectionEntry } from './utils/Xcodeproj';
export declare enum TargetType {
APPLICATION = "com.apple.product-type.application",
EXTENSION = "com.apple.product-type.app-extension",
WATCH = "com.apple.product-type.application.watchapp",
APP_CLIP = "com.apple.product-type.application.on-demand-install-capable",
STICKER_PACK_EXTENSION = "com.apple.product-type.app-extension.messages-sticker-pack",
FRAMEWORK = "com.apple.product-type.framework",
OTHER = "other"
}
export interface Target {
name: string;
type: TargetType;
signable: boolean;
dependencies?: Target[];
}
export declare function getXCBuildConfigurationFromPbxproj(project: XcodeProject, { targetName, buildConfiguration, }?: {
targetName?: string;
buildConfiguration?: string;
}): XCBuildConfiguration | null;
export declare function findApplicationTargetWithDependenciesAsync(projectRoot: string, scheme: string): Promise<Target>;
export declare function isTargetOfType(target: PBXNativeTarget, targetType: TargetType): boolean;
export declare function getNativeTargets(project: XcodeProject): NativeTargetSectionEntry[];
export declare function findSignableTargets(project: XcodeProject): NativeTargetSectionEntry[];
export declare function findFirstNativeTarget(project: XcodeProject): NativeTargetSectionEntry;
export declare function findNativeTargetByName(project: XcodeProject, targetName: string): NativeTargetSectionEntry;

136
node_modules/@expo/config-plugins/build/ios/Target.js generated vendored Normal file
View File

@@ -0,0 +1,136 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TargetType = void 0;
exports.findApplicationTargetWithDependenciesAsync = findApplicationTargetWithDependenciesAsync;
exports.findFirstNativeTarget = findFirstNativeTarget;
exports.findNativeTargetByName = findNativeTargetByName;
exports.findSignableTargets = findSignableTargets;
exports.getNativeTargets = getNativeTargets;
exports.getXCBuildConfigurationFromPbxproj = getXCBuildConfigurationFromPbxproj;
exports.isTargetOfType = isTargetOfType;
function _BuildScheme() {
const data = require("./BuildScheme");
_BuildScheme = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _string() {
const data = require("./utils/string");
_string = function () {
return data;
};
return data;
}
let TargetType = exports.TargetType = /*#__PURE__*/function (TargetType) {
TargetType["APPLICATION"] = "com.apple.product-type.application";
TargetType["EXTENSION"] = "com.apple.product-type.app-extension";
TargetType["WATCH"] = "com.apple.product-type.application.watchapp";
TargetType["APP_CLIP"] = "com.apple.product-type.application.on-demand-install-capable";
TargetType["STICKER_PACK_EXTENSION"] = "com.apple.product-type.app-extension.messages-sticker-pack";
TargetType["FRAMEWORK"] = "com.apple.product-type.framework";
TargetType["OTHER"] = "other";
return TargetType;
}({});
function getXCBuildConfigurationFromPbxproj(project, {
targetName,
buildConfiguration = 'Release'
} = {}) {
const [, nativeTarget] = targetName ? findNativeTargetByName(project, targetName) : findFirstNativeTarget(project);
const [, xcBuildConfiguration] = (0, _Xcodeproj().getBuildConfigurationForListIdAndName)(project, {
configurationListId: nativeTarget.buildConfigurationList,
buildConfiguration
});
return xcBuildConfiguration ?? null;
}
async function findApplicationTargetWithDependenciesAsync(projectRoot, scheme) {
const applicationTargetName = await (0, _BuildScheme().getApplicationTargetNameForSchemeAsync)(projectRoot, scheme);
const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);
const dependencies = getTargetDependencies(project, applicationTarget);
return {
name: (0, _string().trimQuotes)(applicationTarget.name),
type: TargetType.APPLICATION,
signable: true,
dependencies
};
}
function getTargetDependencies(project, parentTarget) {
if (!parentTarget.dependencies || parentTarget.dependencies.length === 0) {
return undefined;
}
const nonSignableTargetTypes = [TargetType.FRAMEWORK];
return parentTarget.dependencies.map(({
value
}) => {
const {
target: targetId
} = project.getPBXGroupByKeyAndType(value, 'PBXTargetDependency');
const [, target] = findNativeTargetById(project, targetId);
const type = isTargetOfType(target, TargetType.EXTENSION) ? TargetType.EXTENSION : TargetType.OTHER;
return {
name: (0, _string().trimQuotes)(target.name),
type,
signable: !nonSignableTargetTypes.some(signableTargetType => isTargetOfType(target, signableTargetType)),
dependencies: getTargetDependencies(project, target)
};
});
}
function isTargetOfType(target, targetType) {
return (0, _string().trimQuotes)(target.productType) === targetType;
}
function getNativeTargets(project) {
const section = project.pbxNativeTargetSection();
return Object.entries(section).filter(_Xcodeproj().isNotComment);
}
function findSignableTargets(project) {
const targets = getNativeTargets(project);
const signableTargetTypes = [TargetType.APPLICATION, TargetType.APP_CLIP, TargetType.EXTENSION, TargetType.WATCH, TargetType.STICKER_PACK_EXTENSION];
const applicationTargets = targets.filter(([, target]) => {
for (const targetType of signableTargetTypes) {
if (isTargetOfType(target, targetType)) {
return true;
}
}
return false;
});
if (applicationTargets.length === 0) {
throw new Error(`Could not find any signable targets in project.pbxproj`);
}
return applicationTargets;
}
function findFirstNativeTarget(project) {
const targets = getNativeTargets(project);
const applicationTargets = targets.filter(([, target]) => isTargetOfType(target, TargetType.APPLICATION));
if (applicationTargets.length === 0) {
throw new Error(`Could not find any application target in project.pbxproj`);
}
return applicationTargets[0];
}
function findNativeTargetByName(project, targetName) {
const nativeTargets = getNativeTargets(project);
const nativeTargetEntry = nativeTargets.find(([, i]) => (0, _string().trimQuotes)(i.name) === targetName);
if (!nativeTargetEntry) {
throw new Error(`Could not find target '${targetName}' in project.pbxproj`);
}
return nativeTargetEntry;
}
function findNativeTargetById(project, targetId) {
const nativeTargets = getNativeTargets(project);
const nativeTargetEntry = nativeTargets.find(([key]) => key === targetId);
if (!nativeTargetEntry) {
throw new Error(`Could not find target with id '${targetId}' in project.pbxproj`);
}
return nativeTargetEntry;
}
//# sourceMappingURL=Target.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
import { ExpoPlist } from './IosConfig.types';
import { ConfigPlugin } from '../Plugin.types';
import { ExpoConfigUpdates } from '../utils/Updates';
export declare enum Config {
ENABLED = "EXUpdatesEnabled",
CHECK_ON_LAUNCH = "EXUpdatesCheckOnLaunch",
LAUNCH_WAIT_MS = "EXUpdatesLaunchWaitMs",
RUNTIME_VERSION = "EXUpdatesRuntimeVersion",
UPDATE_URL = "EXUpdatesURL",
UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = "EXUpdatesRequestHeaders",
UPDATES_HAS_EMBEDDED_UPDATE = "EXUpdatesHasEmbeddedUpdate",
CODE_SIGNING_CERTIFICATE = "EXUpdatesCodeSigningCertificate",
CODE_SIGNING_METADATA = "EXUpdatesCodeSigningMetadata",
DISABLE_ANTI_BRICKING_MEASURES = "EXUpdatesDisableAntiBrickingMeasures",
ENABLE_BSDIFF_PATCH_SUPPORT = "EXUpdatesEnableBsdiffPatchSupport"
}
export declare const withUpdates: ConfigPlugin;
/**
* A config-plugin to update `ios/Podfile.properties.json` from the `updates.useNativeDebug` in expo config
*/
export declare const withUpdatesNativeDebugPodfileProps: ConfigPlugin<void>;
export declare function setUpdatesConfigAsync(projectRoot: string, config: ExpoConfigUpdates, expoPlist: ExpoPlist, expoUpdatesPackageVersion?: string | null): Promise<ExpoPlist>;
export declare function setVersionsConfigAsync(projectRoot: string, config: ExpoConfigUpdates, expoPlist: ExpoPlist): Promise<ExpoPlist>;

160
node_modules/@expo/config-plugins/build/ios/Updates.js generated vendored Normal file
View File

@@ -0,0 +1,160 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Config = void 0;
exports.setUpdatesConfigAsync = setUpdatesConfigAsync;
exports.setVersionsConfigAsync = setVersionsConfigAsync;
exports.withUpdatesNativeDebugPodfileProps = exports.withUpdates = void 0;
function _BuildProperties() {
const data = require("./BuildProperties");
_BuildProperties = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _withPlugins() {
const data = require("../plugins/withPlugins");
_withPlugins = function () {
return data;
};
return data;
}
function _Updates() {
const data = require("../utils/Updates");
_Updates = function () {
return data;
};
return data;
}
function _warnings() {
const data = require("../utils/warnings");
_warnings = function () {
return data;
};
return data;
}
let Config = exports.Config = /*#__PURE__*/function (Config) {
Config["ENABLED"] = "EXUpdatesEnabled";
Config["CHECK_ON_LAUNCH"] = "EXUpdatesCheckOnLaunch";
Config["LAUNCH_WAIT_MS"] = "EXUpdatesLaunchWaitMs";
Config["RUNTIME_VERSION"] = "EXUpdatesRuntimeVersion";
Config["UPDATE_URL"] = "EXUpdatesURL";
Config["UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY"] = "EXUpdatesRequestHeaders";
Config["UPDATES_HAS_EMBEDDED_UPDATE"] = "EXUpdatesHasEmbeddedUpdate";
Config["CODE_SIGNING_CERTIFICATE"] = "EXUpdatesCodeSigningCertificate";
Config["CODE_SIGNING_METADATA"] = "EXUpdatesCodeSigningMetadata";
Config["DISABLE_ANTI_BRICKING_MEASURES"] = "EXUpdatesDisableAntiBrickingMeasures";
Config["ENABLE_BSDIFF_PATCH_SUPPORT"] = "EXUpdatesEnableBsdiffPatchSupport";
return Config;
}({}); // when making changes to this config plugin, ensure the same changes are also made in eas-cli and build-tools
// Also ensure the docs are up-to-date: https://docs.expo.dev/bare/installing-updates/
const withUpdates = config => {
return (0, _withPlugins().withPlugins)(config, [withUpdatesPlist, withUpdatesNativeDebugPodfileProps]);
};
/**
* A config-plugin to update `ios/Podfile.properties.json` from the `updates.useNativeDebug` in expo config
*/
exports.withUpdates = withUpdates;
const withUpdatesNativeDebugPodfileProps = exports.withUpdatesNativeDebugPodfileProps = (0, _BuildProperties().createBuildPodfilePropsConfigPlugin)([{
propName: 'updatesNativeDebug',
propValueGetter: config => config?.updates?.useNativeDebug === true ? 'true' : undefined
}], 'withUpdatesNativeDebugPodfileProps');
const withUpdatesPlist = config => {
return (0, _iosPlugins().withExpoPlist)(config, async config => {
const projectRoot = config.modRequest.projectRoot;
const expoUpdatesPackageVersion = (0, _Updates().getExpoUpdatesPackageVersion)(projectRoot);
config.modResults = await setUpdatesConfigAsync(projectRoot, config, config.modResults, expoUpdatesPackageVersion);
return config;
});
};
async function setUpdatesConfigAsync(projectRoot, config, expoPlist, expoUpdatesPackageVersion) {
const checkOnLaunch = (0, _Updates().getUpdatesCheckOnLaunch)(config, expoUpdatesPackageVersion);
const timeout = (0, _Updates().getUpdatesTimeout)(config);
const useEmbeddedUpdate = (0, _Updates().getUpdatesUseEmbeddedUpdate)(config);
// TODO: is there a better place for this validation?
if (!useEmbeddedUpdate && timeout === 0 && checkOnLaunch !== 'ALWAYS') {
(0, _warnings().addWarningIOS)('updates.useEmbeddedUpdate', `updates.checkOnLaunch should be set to "ON_LOAD" and updates.fallbackToCacheTimeout should be set to a non-zero value when updates.useEmbeddedUpdate is set to false. This is because an update must be fetched on the initial launch, when no embedded update is available.`);
}
const newExpoPlist = {
...expoPlist,
[Config.ENABLED]: (0, _Updates().getUpdatesEnabled)(config),
[Config.CHECK_ON_LAUNCH]: checkOnLaunch,
[Config.LAUNCH_WAIT_MS]: timeout
};
// The native config name is "has embedded update", but we want to expose
// this to the user as "use embedded update", since this is more accurate.
// The field does not disable actually building and embedding the update,
// only whether it is actually used.
if (useEmbeddedUpdate) {
delete newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE];
} else {
newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE] = false;
}
const updateUrl = (0, _Updates().getUpdateUrl)(config);
if (updateUrl) {
newExpoPlist[Config.UPDATE_URL] = updateUrl;
} else {
delete newExpoPlist[Config.UPDATE_URL];
}
const codeSigningCertificate = (0, _Updates().getUpdatesCodeSigningCertificate)(projectRoot, config);
if (codeSigningCertificate) {
newExpoPlist[Config.CODE_SIGNING_CERTIFICATE] = codeSigningCertificate;
} else {
delete newExpoPlist[Config.CODE_SIGNING_CERTIFICATE];
}
const codeSigningMetadata = (0, _Updates().getUpdatesCodeSigningMetadata)(config);
if (codeSigningMetadata) {
newExpoPlist[Config.CODE_SIGNING_METADATA] = codeSigningMetadata;
} else {
delete newExpoPlist[Config.CODE_SIGNING_METADATA];
}
const requestHeaders = (0, _Updates().getUpdatesRequestHeaders)(config);
if (requestHeaders) {
newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = requestHeaders;
} else {
delete newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY];
}
const disableAntiBrickingMeasures = (0, _Updates().getDisableAntiBrickingMeasures)(config);
if (disableAntiBrickingMeasures) {
newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES] = disableAntiBrickingMeasures;
} else {
delete newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES];
}
const bsPatchSupport = (0, _Updates().getUpdatesBsdiffPatchSupportEnabled)(config);
if (bsPatchSupport) {
newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT] = bsPatchSupport;
} else {
delete newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT];
}
return await setVersionsConfigAsync(projectRoot, config, newExpoPlist);
}
async function setVersionsConfigAsync(projectRoot, config, expoPlist) {
const newExpoPlist = {
...expoPlist
};
const runtimeVersion = await (0, _Updates().getRuntimeVersionNullableAsync)(projectRoot, config, 'ios');
if (!runtimeVersion && expoPlist[Config.RUNTIME_VERSION]) {
throw new Error('A runtime version is set in your Expo.plist, but is missing from your Expo app config (app.json/app.config.js). Set runtimeVersion in your Expo app config or remove EXUpdatesRuntimeVersion from your Expo.plist.');
}
if (runtimeVersion) {
delete newExpoPlist['EXUpdatesSDKVersion'];
newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;
} else {
delete newExpoPlist['EXUpdatesSDKVersion'];
delete newExpoPlist[Config.RUNTIME_VERSION];
}
return newExpoPlist;
}
//# sourceMappingURL=Updates.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withUsesNonExemptEncryption: import("..").ConfigPlugin;
export declare function getUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>): boolean | null;
export declare function setUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>, { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist): InfoPlist;

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getUsesNonExemptEncryption = getUsesNonExemptEncryption;
exports.setUsesNonExemptEncryption = setUsesNonExemptEncryption;
exports.withUsesNonExemptEncryption = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
const withUsesNonExemptEncryption = exports.withUsesNonExemptEncryption = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setUsesNonExemptEncryption, {
infoPlistProperty: 'ITSAppUsesNonExemptEncryption',
expoConfigProperty: 'ios.config.usesNonExemptEncryption'
}, 'withUsesNonExemptEncryption');
function getUsesNonExemptEncryption(config) {
return config?.ios?.config?.usesNonExemptEncryption ?? null;
}
function setUsesNonExemptEncryption(config, {
ITSAppUsesNonExemptEncryption,
...infoPlist
}) {
const usesNonExemptEncryption = getUsesNonExemptEncryption(config);
// Make no changes if the key is left blank
if (usesNonExemptEncryption === null) {
return infoPlist;
}
return {
...infoPlist,
ITSAppUsesNonExemptEncryption: usesNonExemptEncryption
};
}
//# sourceMappingURL=UsesNonExemptEncryption.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"UsesNonExemptEncryption.js","names":["_iosPlugins","data","require","withUsesNonExemptEncryption","exports","createInfoPlistPluginWithPropertyGuard","setUsesNonExemptEncryption","infoPlistProperty","expoConfigProperty","getUsesNonExemptEncryption","config","ios","usesNonExemptEncryption","ITSAppUsesNonExemptEncryption","infoPlist"],"sources":["../../src/ios/UsesNonExemptEncryption.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withUsesNonExemptEncryption = createInfoPlistPluginWithPropertyGuard(\n setUsesNonExemptEncryption,\n {\n infoPlistProperty: 'ITSAppUsesNonExemptEncryption',\n expoConfigProperty: 'ios.config.usesNonExemptEncryption',\n },\n 'withUsesNonExemptEncryption'\n);\n\nexport function getUsesNonExemptEncryption(config: Pick<ExpoConfig, 'ios'>) {\n return config?.ios?.config?.usesNonExemptEncryption ?? null;\n}\n\nexport function setUsesNonExemptEncryption(\n config: Pick<ExpoConfig, 'ios'>,\n { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist\n): InfoPlist {\n const usesNonExemptEncryption = getUsesNonExemptEncryption(config);\n\n // Make no changes if the key is left blank\n if (usesNonExemptEncryption === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n ITSAppUsesNonExemptEncryption: usesNonExemptEncryption,\n };\n}\n"],"mappings":";;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,IAAAE,oDAAsC,EAC/EC,0BAA0B,EAC1B;EACEC,iBAAiB,EAAE,+BAA+B;EAClDC,kBAAkB,EAAE;AACtB,CAAC,EACD,6BACF,CAAC;AAEM,SAASC,0BAA0BA,CAACC,MAA+B,EAAE;EAC1E,OAAOA,MAAM,EAAEC,GAAG,EAAED,MAAM,EAAEE,uBAAuB,IAAI,IAAI;AAC7D;AAEO,SAASN,0BAA0BA,CACxCI,MAA+B,EAC/B;EAAEG,6BAA6B;EAAE,GAAGC;AAAqB,CAAC,EAC/C;EACX,MAAMF,uBAAuB,GAAGH,0BAA0B,CAACC,MAAM,CAAC;;EAElE;EACA,IAAIE,uBAAuB,KAAK,IAAI,EAAE;IACpC,OAAOE,SAAS;EAClB;EAEA,OAAO;IACL,GAAGA,SAAS;IACZD,6BAA6B,EAAED;EACjC,CAAC;AACH","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
import { ExpoConfig } from '@expo/config-types';
import { InfoPlist } from './IosConfig.types';
export declare const withVersion: import("..").ConfigPlugin;
export declare const withBuildNumber: import("..").ConfigPlugin;
export declare function getVersion(config: Pick<ExpoConfig, 'version' | 'ios'>): string;
export declare function setVersion(config: Pick<ExpoConfig, 'version' | 'ios'>, infoPlist: InfoPlist): InfoPlist;
export declare function getBuildNumber(config: Pick<ExpoConfig, 'ios'>): string;
export declare function setBuildNumber(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist;

45
node_modules/@expo/config-plugins/build/ios/Version.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBuildNumber = getBuildNumber;
exports.getVersion = getVersion;
exports.setBuildNumber = setBuildNumber;
exports.setVersion = setVersion;
exports.withVersion = exports.withBuildNumber = void 0;
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
const withVersion = exports.withVersion = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setVersion, {
infoPlistProperty: 'CFBundleShortVersionString',
expoConfigProperty: 'version | ios.version',
expoPropertyGetter: getVersion
}, 'withVersion');
const withBuildNumber = exports.withBuildNumber = (0, _iosPlugins().createInfoPlistPluginWithPropertyGuard)(setBuildNumber, {
infoPlistProperty: 'CFBundleVersion',
expoConfigProperty: 'ios.buildNumber'
}, 'withBuildNumber');
function getVersion(config) {
return config.ios?.version || config.version || '1.0.0';
}
function setVersion(config, infoPlist) {
return {
...infoPlist,
CFBundleShortVersionString: getVersion(config)
};
}
function getBuildNumber(config) {
return config.ios?.buildNumber ? config.ios.buildNumber : '1';
}
function setBuildNumber(config, infoPlist) {
return {
...infoPlist,
CFBundleVersion: getBuildNumber(config)
};
}
//# sourceMappingURL=Version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Version.js","names":["_iosPlugins","data","require","withVersion","exports","createInfoPlistPluginWithPropertyGuard","setVersion","infoPlistProperty","expoConfigProperty","expoPropertyGetter","getVersion","withBuildNumber","setBuildNumber","config","ios","version","infoPlist","CFBundleShortVersionString","getBuildNumber","buildNumber","CFBundleVersion"],"sources":["../../src/ios/Version.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { InfoPlist } from './IosConfig.types';\nimport { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins';\n\nexport const withVersion = createInfoPlistPluginWithPropertyGuard(\n setVersion,\n {\n infoPlistProperty: 'CFBundleShortVersionString',\n expoConfigProperty: 'version | ios.version',\n expoPropertyGetter: getVersion,\n },\n 'withVersion'\n);\n\nexport const withBuildNumber = createInfoPlistPluginWithPropertyGuard(\n setBuildNumber,\n {\n infoPlistProperty: 'CFBundleVersion',\n expoConfigProperty: 'ios.buildNumber',\n },\n 'withBuildNumber'\n);\n\nexport function getVersion(config: Pick<ExpoConfig, 'version' | 'ios'>) {\n return config.ios?.version || config.version || '1.0.0';\n}\n\nexport function setVersion(\n config: Pick<ExpoConfig, 'version' | 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n return {\n ...infoPlist,\n CFBundleShortVersionString: getVersion(config),\n };\n}\n\nexport function getBuildNumber(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.buildNumber ? config.ios.buildNumber : '1';\n}\n\nexport function setBuildNumber(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n return {\n ...infoPlist,\n CFBundleVersion: getBuildNumber(config),\n };\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,oDAAsC,EAC/DC,UAAU,EACV;EACEC,iBAAiB,EAAE,4BAA4B;EAC/CC,kBAAkB,EAAE,uBAAuB;EAC3CC,kBAAkB,EAAEC;AACtB,CAAC,EACD,aACF,CAAC;AAEM,MAAMC,eAAe,GAAAP,OAAA,CAAAO,eAAA,GAAG,IAAAN,oDAAsC,EACnEO,cAAc,EACd;EACEL,iBAAiB,EAAE,iBAAiB;EACpCC,kBAAkB,EAAE;AACtB,CAAC,EACD,iBACF,CAAC;AAEM,SAASE,UAAUA,CAACG,MAA2C,EAAE;EACtE,OAAOA,MAAM,CAACC,GAAG,EAAEC,OAAO,IAAIF,MAAM,CAACE,OAAO,IAAI,OAAO;AACzD;AAEO,SAAST,UAAUA,CACxBO,MAA2C,EAC3CG,SAAoB,EACT;EACX,OAAO;IACL,GAAGA,SAAS;IACZC,0BAA0B,EAAEP,UAAU,CAACG,MAAM;EAC/C,CAAC;AACH;AAEO,SAASK,cAAcA,CAACL,MAA+B,EAAE;EAC9D,OAAOA,MAAM,CAACC,GAAG,EAAEK,WAAW,GAAGN,MAAM,CAACC,GAAG,CAACK,WAAW,GAAG,GAAG;AAC/D;AAEO,SAASP,cAAcA,CAACC,MAA+B,EAAEG,SAAoB,EAAa;EAC/F,OAAO;IACL,GAAGA,SAAS;IACZI,eAAe,EAAEF,cAAc,CAACL,MAAM;EACxC,CAAC;AACH","ignoreList":[]}

View File

@@ -0,0 +1,30 @@
import { ConfigPlugin, XcodeProject } from '../Plugin.types';
/**
* Create a build source file and link it to Xcode.
*
* @param config
* @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.
* @param props.contents file contents to write.
* @param props.overwrite should the contents overwrite any existing file in the same location on disk.
* @returns
*/
export declare const withBuildSourceFile: ConfigPlugin<{
filePath: string;
contents: string;
overwrite?: boolean;
}>;
/**
* Add a source file to the Xcode project and write it to the file system.
*
* @param nativeProjectRoot absolute path to the native app root `user/app/ios`
* @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`
* @param fileContents string file contents to write to the `filePath`
* @param overwrite should write file even if one already exists
*/
export declare function createBuildSourceFile({ project, nativeProjectRoot, filePath, fileContents, overwrite, }: {
project: XcodeProject;
nativeProjectRoot: string;
filePath: string;
fileContents: string;
overwrite?: boolean;
}): XcodeProject;

View File

@@ -0,0 +1,99 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createBuildSourceFile = createBuildSourceFile;
exports.withBuildSourceFile = void 0;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _Xcodeproj() {
const data = require("./utils/Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _iosPlugins() {
const data = require("../plugins/ios-plugins");
_iosPlugins = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Create a build source file and link it to Xcode.
*
* @param config
* @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.
* @param props.contents file contents to write.
* @param props.overwrite should the contents overwrite any existing file in the same location on disk.
* @returns
*/
const withBuildSourceFile = (config, {
filePath,
contents,
overwrite
}) => {
return (0, _iosPlugins().withXcodeProject)(config, config => {
const projectName = (0, _Xcodeproj().getProjectName)(config.modRequest.projectRoot);
config.modResults = createBuildSourceFile({
project: config.modResults,
nativeProjectRoot: config.modRequest.platformProjectRoot,
fileContents: contents,
filePath: _path().default.join(projectName, filePath),
overwrite
});
return config;
});
};
/**
* Add a source file to the Xcode project and write it to the file system.
*
* @param nativeProjectRoot absolute path to the native app root `user/app/ios`
* @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`
* @param fileContents string file contents to write to the `filePath`
* @param overwrite should write file even if one already exists
*/
exports.withBuildSourceFile = withBuildSourceFile;
function createBuildSourceFile({
project,
nativeProjectRoot,
filePath,
fileContents,
overwrite
}) {
const absoluteFilePath = _path().default.join(nativeProjectRoot, filePath);
if (overwrite || !_fs().default.existsSync(absoluteFilePath)) {
// Create the file
_fs().default.writeFileSync(absoluteFilePath, fileContents, 'utf8');
}
// `myapp`
const groupName = _path().default.dirname(filePath);
// Ensure the file is linked with Xcode resource files
if (!project.hasFile(filePath)) {
project = (0, _Xcodeproj().addBuildSourceFileToGroup)({
filepath: filePath,
groupName,
project
});
}
return project;
}
//# sourceMappingURL=XcodeProjectFile.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XcodeProjectFile.js","names":["_fs","data","_interopRequireDefault","require","_path","_Xcodeproj","_iosPlugins","e","__esModule","default","withBuildSourceFile","config","filePath","contents","overwrite","withXcodeProject","projectName","getProjectName","modRequest","projectRoot","modResults","createBuildSourceFile","project","nativeProjectRoot","platformProjectRoot","fileContents","path","join","exports","absoluteFilePath","fs","existsSync","writeFileSync","groupName","dirname","hasFile","addBuildSourceFileToGroup","filepath"],"sources":["../../src/ios/XcodeProjectFile.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { ConfigPlugin, XcodeProject } from '../Plugin.types';\nimport { addBuildSourceFileToGroup, getProjectName } from './utils/Xcodeproj';\nimport { withXcodeProject } from '../plugins/ios-plugins';\n\n/**\n * Create a build source file and link it to Xcode.\n *\n * @param config\n * @param props.filePath relative to the build source folder. ex: `ViewController.swift` would be created in `ios/myapp/ViewController.swift`.\n * @param props.contents file contents to write.\n * @param props.overwrite should the contents overwrite any existing file in the same location on disk.\n * @returns\n */\nexport const withBuildSourceFile: ConfigPlugin<{\n filePath: string;\n contents: string;\n overwrite?: boolean;\n}> = (config, { filePath, contents, overwrite }) => {\n return withXcodeProject(config, (config) => {\n const projectName = getProjectName(config.modRequest.projectRoot);\n\n config.modResults = createBuildSourceFile({\n project: config.modResults,\n nativeProjectRoot: config.modRequest.platformProjectRoot,\n fileContents: contents,\n filePath: path.join(projectName, filePath),\n overwrite,\n });\n return config;\n });\n};\n\n/**\n * Add a source file to the Xcode project and write it to the file system.\n *\n * @param nativeProjectRoot absolute path to the native app root `user/app/ios`\n * @param filePath path relative to the `nativeProjectRoot` for the file to create `user/app/ios/myapp/foobar.swift`\n * @param fileContents string file contents to write to the `filePath`\n * @param overwrite should write file even if one already exists\n */\nexport function createBuildSourceFile({\n project,\n nativeProjectRoot,\n filePath,\n fileContents,\n overwrite,\n}: {\n project: XcodeProject;\n nativeProjectRoot: string;\n filePath: string;\n fileContents: string;\n overwrite?: boolean;\n}): XcodeProject {\n const absoluteFilePath = path.join(nativeProjectRoot, filePath);\n if (overwrite || !fs.existsSync(absoluteFilePath)) {\n // Create the file\n fs.writeFileSync(absoluteFilePath, fileContents, 'utf8');\n }\n\n // `myapp`\n const groupName = path.dirname(filePath);\n\n // Ensure the file is linked with Xcode resource files\n if (!project.hasFile(filePath)) {\n project = addBuildSourceFileToGroup({\n filepath: filePath,\n groupName,\n project,\n });\n }\n return project;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,mBAIX,GAAGA,CAACC,MAAM,EAAE;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC;AAAU,CAAC,KAAK;EAClD,OAAO,IAAAC,8BAAgB,EAACJ,MAAM,EAAGA,MAAM,IAAK;IAC1C,MAAMK,WAAW,GAAG,IAAAC,2BAAc,EAACN,MAAM,CAACO,UAAU,CAACC,WAAW,CAAC;IAEjER,MAAM,CAACS,UAAU,GAAGC,qBAAqB,CAAC;MACxCC,OAAO,EAAEX,MAAM,CAACS,UAAU;MAC1BG,iBAAiB,EAAEZ,MAAM,CAACO,UAAU,CAACM,mBAAmB;MACxDC,YAAY,EAAEZ,QAAQ;MACtBD,QAAQ,EAAEc,eAAI,CAACC,IAAI,CAACX,WAAW,EAAEJ,QAAQ,CAAC;MAC1CE;IACF,CAAC,CAAC;IACF,OAAOH,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAiB,OAAA,CAAAlB,mBAAA,GAAAA,mBAAA;AAQO,SAASW,qBAAqBA,CAAC;EACpCC,OAAO;EACPC,iBAAiB;EACjBX,QAAQ;EACRa,YAAY;EACZX;AAOF,CAAC,EAAgB;EACf,MAAMe,gBAAgB,GAAGH,eAAI,CAACC,IAAI,CAACJ,iBAAiB,EAAEX,QAAQ,CAAC;EAC/D,IAAIE,SAAS,IAAI,CAACgB,aAAE,CAACC,UAAU,CAACF,gBAAgB,CAAC,EAAE;IACjD;IACAC,aAAE,CAACE,aAAa,CAACH,gBAAgB,EAAEJ,YAAY,EAAE,MAAM,CAAC;EAC1D;;EAEA;EACA,MAAMQ,SAAS,GAAGP,eAAI,CAACQ,OAAO,CAACtB,QAAQ,CAAC;;EAExC;EACA,IAAI,CAACU,OAAO,CAACa,OAAO,CAACvB,QAAQ,CAAC,EAAE;IAC9BU,OAAO,GAAG,IAAAc,sCAAyB,EAAC;MAClCC,QAAQ,EAAEzB,QAAQ;MAClBqB,SAAS;MACTX;IACF,CAAC,CAAC;EACJ;EACA,OAAOA,OAAO;AAChB","ignoreList":[]}

View File

@@ -0,0 +1,88 @@
import { CodeBlock } from '../utils/commonCodeMod';
interface InsertContentFunctionOptions {
position: 'head' | 'tail' | 'tailBeforeLastReturn';
indent?: number;
}
/**
* Add Objective-C import
* @param source source contents
* @param imports array of imports, e.g. ['<Foundation/Foundation.h>']
* @returns updated contents
*/
export declare function addObjcImports(source: string, imports: string[]): string;
/**
* Add Swift import
* @param source source contents
* @param imports array of imports, e.g. ['Expo']
* @returns updated contents
*/
export declare function addSwiftImports(source: string, imports: string[]): string;
/**
* Find code block of Objective-C interface or implementation
*
* @param contents source contents
* @param declaration interface/implementation, e.g. '@interface Foo'
* @returns found CodeBlock, or null if not found
*/
export declare function findObjcInterfaceCodeBlock(contents: string, declaration: string): CodeBlock | null;
/**
* Find code block of Objective-C function without declaration, will return only {} block
*
* @param contents source contents
* @param selector function selector, e.g. 'doSomething:withSomeValue:'
* @returns found CodeBlock, or null if not found.
*/
export declare function findObjcFunctionCodeBlock(contents: string, selector: string): CodeBlock | null;
/**
* Insert contents to the Objective-C function block
*
* @param srcContents source contents
* @param selector function selector, e.g. 'doSomething:withSomeValue:'
* @param insertion code to insert
* @param options insertion options
* @returns updated contents
*/
export declare function insertContentsInsideObjcFunctionBlock(srcContents: string, selector: string, insertion: string, options: InsertContentFunctionOptions): string;
/**
* Insert contents to the Objective-C interface/implementation block
*
* @param srcContents source contents
* @param declaration interface/implementation, e.g. '@interface Foo'
* @param insertion code to insert
* @param options insertion options
* @returns updated contents
*/
export declare function insertContentsInsideObjcInterfaceBlock(srcContents: string, declaration: string, insertion: string, options: {
position: 'head' | 'tail';
}): string;
/**
* Find code block of Swift function without declaration, will return only {} block
*
* @param contents source contents
* @param selector function selector, e.g. 'doSomething(_:withSomeValue:)'
* @returns found CodeBlock, or null if not found.
*/
export declare function findSwiftFunctionCodeBlock(contents: string, selector: string): CodeBlock | null;
/**
* Insert contents to the swift class block
*
* @param srcContents source contents
* @param declaration class/extension declaration, e.g. 'class AppDelegate'
* @param insertion code to append
* @param options insertion options
* @returns updated contents
*/
export declare function insertContentsInsideSwiftClassBlock(srcContents: string, declaration: string, insertion: string, options: {
position: 'head' | 'tail';
}): string;
/**
* Insert contents to the Swift function block
*
* @param srcContents source contents
* @param selector function selector, e.g. 'doSomething:withSomeValue:'
* @param insertion code to insert
* @param options insertion options
* @returns updated contents
*/
export declare function insertContentsInsideSwiftFunctionBlock(srcContents: string, selector: string, insertion: string, options: InsertContentFunctionOptions): string;
export {};

284
node_modules/@expo/config-plugins/build/ios/codeMod.js generated vendored Normal file
View File

@@ -0,0 +1,284 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addObjcImports = addObjcImports;
exports.addSwiftImports = addSwiftImports;
exports.findObjcFunctionCodeBlock = findObjcFunctionCodeBlock;
exports.findObjcInterfaceCodeBlock = findObjcInterfaceCodeBlock;
exports.findSwiftFunctionCodeBlock = findSwiftFunctionCodeBlock;
exports.insertContentsInsideObjcFunctionBlock = insertContentsInsideObjcFunctionBlock;
exports.insertContentsInsideObjcInterfaceBlock = insertContentsInsideObjcInterfaceBlock;
exports.insertContentsInsideSwiftClassBlock = insertContentsInsideSwiftClassBlock;
exports.insertContentsInsideSwiftFunctionBlock = insertContentsInsideSwiftFunctionBlock;
function _commonCodeMod() {
const data = require("../utils/commonCodeMod");
_commonCodeMod = function () {
return data;
};
return data;
}
function _matchBrackets() {
const data = require("../utils/matchBrackets");
_matchBrackets = function () {
return data;
};
return data;
}
/**
* Add Objective-C import
* @param source source contents
* @param imports array of imports, e.g. ['<Foundation/Foundation.h>']
* @returns updated contents
*/
function addObjcImports(source, imports) {
const lines = source.split('\n');
// Try to insert statements after first #import where would probably not in #if block
const lineIndexWithFirstImport = lines.findIndex(line => line.match(/^#import .*$/));
for (const importElement of imports) {
if (!source.includes(importElement)) {
const importStatement = `#import ${importElement}`;
lines.splice(lineIndexWithFirstImport + 1, 0, importStatement);
}
}
return lines.join('\n');
}
/**
* Add Swift import
* @param source source contents
* @param imports array of imports, e.g. ['Expo']
* @returns updated contents
*/
function addSwiftImports(source, imports) {
const lines = source.split('\n');
// Try to insert statements after first import where would probably not in #if block
const lineIndexWithFirstImport = lines.findIndex(line => line.match(/^import .*$/));
for (const importElement of imports) {
if (!source.includes(importElement)) {
const importStatement = `import ${importElement}`;
lines.splice(lineIndexWithFirstImport + 1, 0, importStatement);
}
}
return lines.join('\n');
}
/**
* Find code block of Objective-C interface or implementation
*
* @param contents source contents
* @param declaration interface/implementation, e.g. '@interface Foo'
* @returns found CodeBlock, or null if not found
*/
function findObjcInterfaceCodeBlock(contents, declaration) {
const start = contents.search(new RegExp(`^${declaration}\\W`, 'm'));
if (start < 0) {
return null;
}
let end = contents.indexOf('\n@end', start);
end += 5; // '\n@end'.length === 5
return {
start,
end,
code: contents.substring(start, end)
};
}
/**
* Find code block of Objective-C function without declaration, will return only {} block
*
* @param contents source contents
* @param selector function selector, e.g. 'doSomething:withSomeValue:'
* @returns found CodeBlock, or null if not found.
*/
function findObjcFunctionCodeBlock(contents, selector) {
const symbols = selector.split(':');
const argsCount = symbols.length - 1;
let pattern = '^[\\-+]\\s*\\(.+?\\)';
if (argsCount === 0) {
pattern += `${symbols[0]}\\s+`;
} else {
for (let i = 0; i < argsCount; ++i) {
const argSymbol = `${symbols[i]}:\\(.+\\)\\w+`;
pattern += `${argSymbol}\\s+`;
}
}
pattern += '{';
let start = contents.search(new RegExp(pattern, 'm'));
if (start < 0) {
return null;
}
start = contents.indexOf('{', start);
const end = (0, _matchBrackets().findMatchingBracketPosition)(contents, '{', start);
return {
start,
end,
code: contents.substring(start, end + 1)
};
}
/**
* Insert contents to the Objective-C function block
*
* @param srcContents source contents
* @param selector function selector, e.g. 'doSomething:withSomeValue:'
* @param insertion code to insert
* @param options insertion options
* @returns updated contents
*/
function insertContentsInsideObjcFunctionBlock(srcContents, selector, insertion, options) {
return insertContentsInsideFunctionBlock(srcContents, selector, insertion, options, 'objc');
}
/**
* Insert contents to the Objective-C interface/implementation block
*
* @param srcContents source contents
* @param declaration interface/implementation, e.g. '@interface Foo'
* @param insertion code to insert
* @param options insertion options
* @returns updated contents
*/
function insertContentsInsideObjcInterfaceBlock(srcContents, declaration, insertion, options) {
const codeBlock = findObjcInterfaceCodeBlock(srcContents, declaration);
if (!codeBlock) {
return srcContents;
}
const {
position
} = options;
if (position === 'head') {
const firstNewLineIndex = srcContents.indexOf('\n', codeBlock.start);
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, insertion, firstNewLineIndex);
} else if (position === 'tail') {
const endLen = '@end'.length;
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, insertion, codeBlock.end - endLen);
}
return srcContents;
}
/**
* Find code block of Swift function without declaration, will return only {} block
*
* @param contents source contents
* @param selector function selector, e.g. 'doSomething(_:withSomeValue:)'
* @returns found CodeBlock, or null if not found.
*/
function findSwiftFunctionCodeBlock(contents, selector) {
const parenthesesIndex = selector.indexOf('(');
// `functName` === 'doSomething' of 'doSomething(_:withSomeValue:)'
const funcName = selector.substring(0, parenthesesIndex);
// `argLabels` === ['_', 'withSomeValue'] 'doSomething(_:withSomeValue:)'
const argLabels = selector.substring(parenthesesIndex + 1, selector.length - 2).split(':');
let searchOffset = 0;
const funcCandidateRegExp = new RegExp(`\\sfunc\\s+${funcName}\\(`, 'm');
let funcCandidateOffset = (0, _commonCodeMod().searchFromOffset)(contents, funcCandidateRegExp, searchOffset);
while (funcCandidateOffset >= 0) {
// Parse function parameters
const paramsStartOffset = contents.indexOf('(', funcCandidateOffset);
const paramsEndOffset = (0, _matchBrackets().findMatchingBracketPosition)(contents, '(', paramsStartOffset);
const paramsString = contents.substring(paramsStartOffset + 1, paramsEndOffset);
const params = paramsString.split(',').map(parseSwiftFunctionParam);
// Prepare offset for next round
searchOffset = paramsEndOffset + 1;
funcCandidateOffset = (0, _commonCodeMod().searchFromOffset)(contents, funcCandidateRegExp, searchOffset);
// Try to match function parameters
if (argLabels.length !== params.length) {
continue;
}
for (let i = 0; i < argLabels.length; ++i) {
if (argLabels[i] !== params[i].argumentLabel) {
continue;
}
}
// This function is matched one, get the code block.
const codeBlockStart = contents.indexOf('{', paramsEndOffset);
const codeBlockEnd = (0, _matchBrackets().findMatchingBracketPosition)(contents, '{', paramsEndOffset);
const codeBlock = contents.substring(codeBlockStart, codeBlockEnd + 1);
return {
start: codeBlockStart,
end: codeBlockEnd,
code: codeBlock
};
}
return null;
}
function parseSwiftFunctionParam(paramTuple) {
const semiIndex = paramTuple.indexOf(':');
const [argumentLabel, parameterName] = paramTuple.substring(0, semiIndex).split(/\s+/);
const typeString = paramTuple.substring(semiIndex + 1).trim();
return {
argumentLabel,
parameterName,
typeString
};
}
/**
* Insert contents to the swift class block
*
* @param srcContents source contents
* @param declaration class/extension declaration, e.g. 'class AppDelegate'
* @param insertion code to append
* @param options insertion options
* @returns updated contents
*/
function insertContentsInsideSwiftClassBlock(srcContents, declaration, insertion, options) {
const start = srcContents.search(new RegExp(`\\s*${declaration}.*?[\\(\\{]`));
if (start < 0) {
throw new Error(`Unable to find class code block - declaration[${declaration}]`);
}
const {
position
} = options;
if (position === 'head') {
const firstBracketIndex = srcContents.indexOf('{', start);
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, insertion, firstBracketIndex + 1);
} else if (position === 'tail') {
const endBracketIndex = (0, _matchBrackets().findMatchingBracketPosition)(srcContents, '{', start);
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, insertion, endBracketIndex);
}
return srcContents;
}
/**
* Insert contents to the Swift function block
*
* @param srcContents source contents
* @param selector function selector, e.g. 'doSomething:withSomeValue:'
* @param insertion code to insert
* @param options insertion options
* @returns updated contents
*/
function insertContentsInsideSwiftFunctionBlock(srcContents, selector, insertion, options) {
return insertContentsInsideFunctionBlock(srcContents, selector, insertion, options, 'swift');
}
function insertContentsInsideFunctionBlock(srcContents, selector, insertion, options, language) {
const codeBlock = language === 'objc' ? findObjcFunctionCodeBlock(srcContents, selector) : findSwiftFunctionCodeBlock(srcContents, selector);
if (!codeBlock) {
return srcContents;
}
const {
position
} = options;
const indent = ' '.repeat(options.indent ?? 2);
if (position === 'head') {
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, `\n${indent}${insertion}`, codeBlock.start + 1);
} else if (position === 'tail') {
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, `\n${indent}${insertion}`, codeBlock.end - 1);
} else if (position === 'tailBeforeLastReturn') {
let lastReturnIndex = srcContents.lastIndexOf(' return ', codeBlock.end);
if (lastReturnIndex < 0) {
throw new Error(`Cannot find last return statement:\n${srcContents}`);
}
lastReturnIndex += 1; // +1 for the prefix space
srcContents = (0, _commonCodeMod().insertContentsAtOffset)(srcContents, `${insertion}\n${indent}`, lastReturnIndex);
}
return srcContents;
}
//# sourceMappingURL=codeMod.js.map

File diff suppressed because one or more lines are too long

27
node_modules/@expo/config-plugins/build/ios/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import * as Bitcode from './Bitcode';
import * as BuildProperties from './BuildProperties';
import * as BuildScheme from './BuildScheme';
import * as BundleIdentifier from './BundleIdentifier';
import * as DevelopmentTeam from './DevelopmentTeam';
import * as DeviceFamily from './DeviceFamily';
import * as Entitlements from './Entitlements';
import * as Google from './Google';
import { ExpoPlist, InfoPlist } from './IosConfig.types';
import * as Locales from './Locales';
import * as Maps from './Maps';
import * as Name from './Name';
import * as Orientation from './Orientation';
import * as Paths from './Paths';
import * as Permissions from './Permissions';
import * as PrivacyInfo from './PrivacyInfo';
import * as ProvisioningProfile from './ProvisioningProfile';
import * as RequiresFullScreen from './RequiresFullScreen';
import * as Scheme from './Scheme';
import * as Target from './Target';
import * as Updates from './Updates';
import * as UsesNonExemptEncryption from './UsesNonExemptEncryption';
import * as Version from './Version';
import * as XcodeProjectFile from './XcodeProjectFile';
import * as XcodeUtils from './utils/Xcodeproj';
export { InfoPlist, ExpoPlist, Entitlements, Paths, Permissions, XcodeUtils };
export { Bitcode, BundleIdentifier, BuildProperties, BuildScheme, DevelopmentTeam, DeviceFamily, Google, Maps, Locales, Name, Orientation, ProvisioningProfile, RequiresFullScreen, Scheme, Target, Updates, UsesNonExemptEncryption, Version, XcodeProjectFile, PrivacyInfo, };

342
node_modules/@expo/config-plugins/build/ios/index.js generated vendored Normal file
View File

@@ -0,0 +1,342 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Entitlements = exports.DeviceFamily = exports.DevelopmentTeam = exports.BundleIdentifier = exports.BuildScheme = exports.BuildProperties = exports.Bitcode = void 0;
Object.defineProperty(exports, "ExpoPlist", {
enumerable: true,
get: function () {
return _IosConfig().ExpoPlist;
}
});
exports.Google = void 0;
Object.defineProperty(exports, "InfoPlist", {
enumerable: true,
get: function () {
return _IosConfig().InfoPlist;
}
});
exports.XcodeUtils = exports.XcodeProjectFile = exports.Version = exports.UsesNonExemptEncryption = exports.Updates = exports.Target = exports.Scheme = exports.RequiresFullScreen = exports.ProvisioningProfile = exports.PrivacyInfo = exports.Permissions = exports.Paths = exports.Orientation = exports.Name = exports.Maps = exports.Locales = void 0;
function Bitcode() {
const data = _interopRequireWildcard(require("./Bitcode"));
Bitcode = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Bitcode", {
enumerable: true,
get: function () {
return Bitcode();
}
});
function BuildProperties() {
const data = _interopRequireWildcard(require("./BuildProperties"));
BuildProperties = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "BuildProperties", {
enumerable: true,
get: function () {
return BuildProperties();
}
});
function BuildScheme() {
const data = _interopRequireWildcard(require("./BuildScheme"));
BuildScheme = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "BuildScheme", {
enumerable: true,
get: function () {
return BuildScheme();
}
});
function BundleIdentifier() {
const data = _interopRequireWildcard(require("./BundleIdentifier"));
BundleIdentifier = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "BundleIdentifier", {
enumerable: true,
get: function () {
return BundleIdentifier();
}
});
function DevelopmentTeam() {
const data = _interopRequireWildcard(require("./DevelopmentTeam"));
DevelopmentTeam = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "DevelopmentTeam", {
enumerable: true,
get: function () {
return DevelopmentTeam();
}
});
function DeviceFamily() {
const data = _interopRequireWildcard(require("./DeviceFamily"));
DeviceFamily = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "DeviceFamily", {
enumerable: true,
get: function () {
return DeviceFamily();
}
});
function Entitlements() {
const data = _interopRequireWildcard(require("./Entitlements"));
Entitlements = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Entitlements", {
enumerable: true,
get: function () {
return Entitlements();
}
});
function Google() {
const data = _interopRequireWildcard(require("./Google"));
Google = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Google", {
enumerable: true,
get: function () {
return Google();
}
});
function _IosConfig() {
const data = require("./IosConfig.types");
_IosConfig = function () {
return data;
};
return data;
}
function Locales() {
const data = _interopRequireWildcard(require("./Locales"));
Locales = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Locales", {
enumerable: true,
get: function () {
return Locales();
}
});
function Maps() {
const data = _interopRequireWildcard(require("./Maps"));
Maps = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Maps", {
enumerable: true,
get: function () {
return Maps();
}
});
function Name() {
const data = _interopRequireWildcard(require("./Name"));
Name = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Name", {
enumerable: true,
get: function () {
return Name();
}
});
function Orientation() {
const data = _interopRequireWildcard(require("./Orientation"));
Orientation = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Orientation", {
enumerable: true,
get: function () {
return Orientation();
}
});
function Paths() {
const data = _interopRequireWildcard(require("./Paths"));
Paths = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Paths", {
enumerable: true,
get: function () {
return Paths();
}
});
function Permissions() {
const data = _interopRequireWildcard(require("./Permissions"));
Permissions = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Permissions", {
enumerable: true,
get: function () {
return Permissions();
}
});
function PrivacyInfo() {
const data = _interopRequireWildcard(require("./PrivacyInfo"));
PrivacyInfo = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "PrivacyInfo", {
enumerable: true,
get: function () {
return PrivacyInfo();
}
});
function ProvisioningProfile() {
const data = _interopRequireWildcard(require("./ProvisioningProfile"));
ProvisioningProfile = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "ProvisioningProfile", {
enumerable: true,
get: function () {
return ProvisioningProfile();
}
});
function RequiresFullScreen() {
const data = _interopRequireWildcard(require("./RequiresFullScreen"));
RequiresFullScreen = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "RequiresFullScreen", {
enumerable: true,
get: function () {
return RequiresFullScreen();
}
});
function Scheme() {
const data = _interopRequireWildcard(require("./Scheme"));
Scheme = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Scheme", {
enumerable: true,
get: function () {
return Scheme();
}
});
function Target() {
const data = _interopRequireWildcard(require("./Target"));
Target = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Target", {
enumerable: true,
get: function () {
return Target();
}
});
function Updates() {
const data = _interopRequireWildcard(require("./Updates"));
Updates = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Updates", {
enumerable: true,
get: function () {
return Updates();
}
});
function UsesNonExemptEncryption() {
const data = _interopRequireWildcard(require("./UsesNonExemptEncryption"));
UsesNonExemptEncryption = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "UsesNonExemptEncryption", {
enumerable: true,
get: function () {
return UsesNonExemptEncryption();
}
});
function Version() {
const data = _interopRequireWildcard(require("./Version"));
Version = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "Version", {
enumerable: true,
get: function () {
return Version();
}
});
function XcodeProjectFile() {
const data = _interopRequireWildcard(require("./XcodeProjectFile"));
XcodeProjectFile = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "XcodeProjectFile", {
enumerable: true,
get: function () {
return XcodeProjectFile();
}
});
function XcodeUtils() {
const data = _interopRequireWildcard(require("./utils/Xcodeproj"));
XcodeUtils = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "XcodeUtils", {
enumerable: true,
get: function () {
return XcodeUtils();
}
});
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,93 @@
/**
* Copyright © 2023-present 650 Industries, Inc. (aka Expo)
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { ExpoConfig } from '@expo/config-types';
import xcode, { PBXFile, PBXGroup, PBXNativeTarget, PBXProject, UUID, XCBuildConfiguration, XCConfigurationList, XcodeProject } from 'xcode';
export type ProjectSectionEntry = [string, PBXProject];
export type NativeTargetSection = Record<string, PBXNativeTarget>;
export type NativeTargetSectionEntry = [string, PBXNativeTarget];
export type ConfigurationLists = Record<string, XCConfigurationList>;
export type ConfigurationListEntry = [string, XCConfigurationList];
export type ConfigurationSectionEntry = [string, XCBuildConfiguration];
export declare function getProjectName(projectRoot: string): string;
export declare function resolvePathOrProject(projectRootOrProject: string | XcodeProject): XcodeProject | null;
export declare function sanitizedName(name: string): string;
export declare function getHackyProjectName(projectRoot: string, config: ExpoConfig): string;
/**
* Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
export declare function addResourceFileToGroup({ filepath, groupName, isBuildFile, project, verbose, targetUuid, }: {
filepath: string;
groupName: string;
isBuildFile?: boolean;
project: XcodeProject;
verbose?: boolean;
targetUuid?: string;
}): XcodeProject;
/**
* Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
export declare function addBuildSourceFileToGroup({ filepath, groupName, project, verbose, targetUuid, }: {
filepath: string;
groupName: string;
project: XcodeProject;
verbose?: boolean;
targetUuid?: string;
}): XcodeProject;
export declare function addFileToGroupAndLink({ filepath, groupName, project, verbose, addFileToProject, targetUuid, }: {
filepath: string;
groupName: string;
project: XcodeProject;
verbose?: boolean;
targetUuid?: string;
addFileToProject: (props: {
file: PBXFile;
project: XcodeProject;
}) => void;
}): XcodeProject;
export declare function getApplicationNativeTarget({ project, projectName, }: {
project: XcodeProject;
projectName: string;
}): {
uuid: UUID;
target: PBXNativeTarget;
};
/**
* Add a framework to the default app native target.
*
* @param projectName Name of the PBX project.
* @param framework String ending in `.framework`, i.e. `StoreKit.framework`
*/
export declare function addFramework({ project, projectName, framework, }: {
project: XcodeProject;
projectName: string;
framework: string;
}): unknown;
export declare function ensureGroupRecursively(project: XcodeProject, filepath: string): PBXGroup | null;
/**
* Get the pbxproj for the given path
*/
export declare function getPbxproj(projectRoot: string): XcodeProject;
/**
* Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.
*
* @param project
*/
export declare function getProductName(project: XcodeProject): string;
export declare function getProjectSection(project: XcodeProject): Record<string, xcode.PBXProject> & Record<string, string>;
export declare function getXCConfigurationListEntries(project: XcodeProject): ConfigurationListEntry[];
export declare function getBuildConfigurationsForListId(project: XcodeProject, configurationListId: string): ConfigurationSectionEntry[];
export declare function getBuildConfigurationForListIdAndName(project: XcodeProject, { configurationListId, buildConfiguration, }: {
configurationListId: string;
buildConfiguration: string;
}): ConfigurationSectionEntry;
export declare function isBuildConfig([, sectionItem]: ConfigurationSectionEntry): boolean;
export declare function isNotTestHost([, sectionItem]: ConfigurationSectionEntry): boolean;
export declare function isNotComment([key]: ConfigurationSectionEntry | ProjectSectionEntry | ConfigurationListEntry | NativeTargetSectionEntry): boolean;
export declare function unquote(value: string): string;
export declare function resolveXcodeBuildSetting(value: string, lookup: (buildSetting: string) => string | undefined): string;

View File

@@ -0,0 +1,484 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addBuildSourceFileToGroup = addBuildSourceFileToGroup;
exports.addFileToGroupAndLink = addFileToGroupAndLink;
exports.addFramework = addFramework;
exports.addResourceFileToGroup = addResourceFileToGroup;
exports.ensureGroupRecursively = ensureGroupRecursively;
exports.getApplicationNativeTarget = getApplicationNativeTarget;
exports.getBuildConfigurationForListIdAndName = getBuildConfigurationForListIdAndName;
exports.getBuildConfigurationsForListId = getBuildConfigurationsForListId;
exports.getHackyProjectName = getHackyProjectName;
exports.getPbxproj = getPbxproj;
exports.getProductName = getProductName;
exports.getProjectName = getProjectName;
exports.getProjectSection = getProjectSection;
exports.getXCConfigurationListEntries = getXCConfigurationListEntries;
exports.isBuildConfig = isBuildConfig;
exports.isNotComment = isNotComment;
exports.isNotTestHost = isNotTestHost;
exports.resolvePathOrProject = resolvePathOrProject;
exports.resolveXcodeBuildSetting = resolveXcodeBuildSetting;
exports.sanitizedName = sanitizedName;
exports.unquote = unquote;
function _assert() {
const data = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _slugify() {
const data = _interopRequireDefault(require("slugify"));
_slugify = function () {
return data;
};
return data;
}
function _xcode() {
const data = _interopRequireDefault(require("xcode"));
_xcode = function () {
return data;
};
return data;
}
function _pbxFile() {
const data = _interopRequireDefault(require("xcode/lib/pbxFile"));
_pbxFile = function () {
return data;
};
return data;
}
function _string() {
const data = require("./string");
_string = function () {
return data;
};
return data;
}
function _warnings() {
const data = require("../../utils/warnings");
_warnings = function () {
return data;
};
return data;
}
function Paths() {
const data = _interopRequireWildcard(require("../Paths"));
Paths = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright © 2023-present 650 Industries, Inc. (aka Expo)
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getProjectName(projectRoot) {
const sourceRoot = Paths().getSourceRoot(projectRoot);
return _path().default.basename(sourceRoot);
}
function resolvePathOrProject(projectRootOrProject) {
if (typeof projectRootOrProject === 'string') {
try {
return getPbxproj(projectRootOrProject);
} catch {
return null;
}
}
return projectRootOrProject;
}
// TODO: come up with a better solution for using app.json expo.name in various places
function sanitizedName(name) {
// Default to the name `app` when every safe character has been sanitized
return sanitizedNameForProjects(name) || sanitizedNameForProjects((0, _slugify().default)(name)) || 'app';
}
function sanitizedNameForProjects(name) {
return name.replace(/[\W_]+/g, '').normalize('NFD').replace(/[\u0300-\u036f]/g, '');
}
// TODO: it's silly and kind of fragile that we look at app config to determine
// the ios project paths. Overall this function needs to be revamped, just a
// placeholder for now! Make this more robust when we support applying config
// at any time (currently it's only applied on eject).
function getHackyProjectName(projectRoot, config) {
// Attempt to get the current ios folder name (apply).
try {
return getProjectName(projectRoot);
} catch {
// If no iOS project exists then create a new one (eject).
const projectName = config.name;
(0, _assert().default)(projectName, 'Your project needs a name in app.json/app.config.js.');
return sanitizedName(projectName);
}
}
function createProjectFileForGroup({
filepath,
group
}) {
const file = new (_pbxFile().default)(filepath);
const conflictingFile = group.children.find(child => child.comment === file.basename);
if (conflictingFile) {
// This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.
// Not much we can do here since it might be a conflicting file.
return null;
}
return file;
}
/**
* Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
function addResourceFileToGroup({
filepath,
groupName,
// Should add to `PBXBuildFile Section`
isBuildFile,
project,
verbose,
targetUuid
}) {
return addFileToGroupAndLink({
filepath,
groupName,
project,
verbose,
targetUuid,
addFileToProject({
project,
file
}) {
project.addToPbxFileReferenceSection(file);
if (isBuildFile) {
project.addToPbxBuildFileSection(file);
}
project.addToPbxResourcesBuildPhase(file);
}
});
}
/**
* Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.
* This is akin to creating a new code file in Xcode with `⌘+n`.
*/
function addBuildSourceFileToGroup({
filepath,
groupName,
project,
verbose,
targetUuid
}) {
return addFileToGroupAndLink({
filepath,
groupName,
project,
verbose,
targetUuid,
addFileToProject({
project,
file
}) {
project.addToPbxFileReferenceSection(file);
project.addToPbxBuildFileSection(file);
project.addToPbxSourcesBuildPhase(file);
}
});
}
// TODO(brentvatne): I couldn't figure out how to do this with an existing
// higher level function exposed by the xcode library, but we should find out how to do
// that and replace this with it
function addFileToGroupAndLink({
filepath,
groupName,
project,
verbose,
addFileToProject,
targetUuid
}) {
const group = pbxGroupByPathOrAssert(project, groupName);
const file = createProjectFileForGroup({
filepath,
group
});
if (!file) {
if (verbose) {
// This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.
// Not much we can do here since it might be a conflicting file.
(0, _warnings().addWarningIOS)('ios-xcode-project', `Skipped adding duplicate file "${filepath}" to PBXGroup named "${groupName}"`);
}
return project;
}
if (targetUuid != null) {
file.target = targetUuid;
} else {
const applicationNativeTarget = project.getTarget('com.apple.product-type.application');
file.target = applicationNativeTarget?.uuid;
}
file.uuid = project.generateUuid();
file.fileRef = project.generateUuid();
addFileToProject({
project,
file
});
group.children.push({
value: file.fileRef,
comment: file.basename
});
return project;
}
function getApplicationNativeTarget({
project,
projectName
}) {
const applicationNativeTarget = project.getTarget('com.apple.product-type.application');
(0, _assert().default)(applicationNativeTarget, `Couldn't locate application PBXNativeTarget in '.xcodeproj' file.`);
(0, _assert().default)(String(applicationNativeTarget.target.name) === projectName, `Application native target name mismatch. Expected ${projectName}, but found ${applicationNativeTarget.target.name}.`);
return applicationNativeTarget;
}
/**
* Add a framework to the default app native target.
*
* @param projectName Name of the PBX project.
* @param framework String ending in `.framework`, i.e. `StoreKit.framework`
*/
function addFramework({
project,
projectName,
framework
}) {
const target = getApplicationNativeTarget({
project,
projectName
});
return project.addFramework(framework, {
target: target.uuid
});
}
function splitPath(path) {
// TODO: Should we account for other platforms that may not use `/`
return path.split('/');
}
const findGroup = (group, name) => {
if (!group) {
return undefined;
}
return group.children.find(group => group.comment === name);
};
function findGroupInsideGroup(project, group, name) {
const foundGroup = findGroup(group, name);
if (foundGroup) {
return project.getPBXGroupByKey(foundGroup.value) ?? null;
}
return null;
}
function pbxGroupByPathOrAssert(project, path) {
const {
firstProject
} = project.getFirstProject();
let group = project.getPBXGroupByKey(firstProject.mainGroup);
const components = splitPath(path);
for (const name of components) {
const nextGroup = findGroupInsideGroup(project, group, name);
if (nextGroup) {
group = nextGroup;
} else {
break;
}
}
if (!group) {
throw Error(`Xcode PBXGroup with name "${path}" could not be found in the Xcode project.`);
}
return group;
}
function ensureGroupRecursively(project, filepath) {
const components = splitPath(filepath);
const hasChild = (group, name) => group.children.find(({
comment
}) => comment === name);
const {
firstProject
} = project.getFirstProject();
let topMostGroup = project.getPBXGroupByKey(firstProject.mainGroup);
for (const pathComponent of components) {
if (topMostGroup && !hasChild(topMostGroup, pathComponent)) {
topMostGroup.children.push({
comment: pathComponent,
value: project.pbxCreateGroup(pathComponent, '""')
});
}
topMostGroup = project.pbxGroupByName(pathComponent);
}
return topMostGroup ?? null;
}
/**
* Get the pbxproj for the given path
*/
function getPbxproj(projectRoot) {
const projectPath = Paths().getPBXProjectPath(projectRoot);
const project = _xcode().default.project(projectPath);
project.parseSync();
return project;
}
/**
* Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.
*
* @param project
*/
function getProductName(project) {
let productName = '$(TARGET_NAME)';
try {
// If the product name is numeric, this will fail (it's a getter).
// If the bundle identifier' final component is only numeric values, then the PRODUCT_NAME
// will be a numeric value, this results in a bug where the product name isn't useful,
// i.e. `com.bacon.001` -> `1` -- in this case, use the first target name.
productName = project.productName;
} catch {}
if (productName === '$(TARGET_NAME)') {
const targetName = project.getFirstTarget()?.firstTarget?.productName;
productName = targetName ?? productName;
}
return productName;
}
function getProjectSection(project) {
return project.pbxProjectSection();
}
function getXCConfigurationListEntries(project) {
const lists = project.pbxXCConfigurationList();
return Object.entries(lists).filter(isNotComment);
}
function getBuildConfigurationsForListId(project, configurationListId) {
const configurationListEntries = getXCConfigurationListEntries(project);
const [, configurationList] = configurationListEntries.find(([key]) => key === configurationListId);
const buildConfigurations = configurationList.buildConfigurations.map(i => i.value);
return Object.entries(project.pbxXCBuildConfigurationSection()).filter(isNotComment).filter(isBuildConfig).filter(([key]) => buildConfigurations.includes(key));
}
function getBuildConfigurationForListIdAndName(project, {
configurationListId,
buildConfiguration
}) {
const xcBuildConfigurationEntry = getBuildConfigurationsForListId(project, configurationListId).find(i => (0, _string().trimQuotes)(i[1].name) === buildConfiguration);
if (!xcBuildConfigurationEntry) {
throw new Error(`Build configuration '${buildConfiguration}' does not exist in list with id '${configurationListId}'`);
}
return xcBuildConfigurationEntry;
}
function isBuildConfig([, sectionItem]) {
return sectionItem.isa === 'XCBuildConfiguration';
}
function isNotTestHost([, sectionItem]) {
return !sectionItem.buildSettings.TEST_HOST;
}
function isNotComment([key]) {
return !key.endsWith(`_comment`);
}
// Remove surrounding double quotes if they exist.
function unquote(value) {
// projects with numeric names will fail due to a bug in the xcode package.
if (typeof value === 'number') {
value = String(value);
}
return value.match(/^"(.*)"$/)?.[1] ?? value;
}
function resolveXcodeBuildSetting(value, lookup) {
const parsedValue = value?.replace(/\$\(([^()]*|\([^)]*\))\)/g, match => {
// Remove the `$(` and `)`, then split modifier(s) from the variable name.
const [variable, ...transformations] = match.slice(2, -1).split(':');
// Resolve the variable recursively.
let lookedUp = lookup(variable);
if (lookedUp) {
lookedUp = resolveXcodeBuildSetting(lookedUp, lookup);
}
let resolved = lookedUp;
// Ref: http://codeworkshop.net/posts/xcode-build-setting-transformations
transformations.forEach(modifier => {
switch (modifier) {
case 'lower':
// A lowercase representation.
resolved = resolved?.toLowerCase();
break;
case 'upper':
// An uppercase representation.
resolved = resolved?.toUpperCase();
break;
case 'suffix':
if (resolved) {
// The extension of a path including the '.' divider.
resolved = _path().default.extname(resolved);
}
break;
case 'file':
if (resolved) {
// The file portion of a path.
resolved = _path().default.basename(resolved);
}
break;
case 'dir':
if (resolved) {
// The directory portion of a path.
resolved = _path().default.dirname(resolved);
}
break;
case 'base':
if (resolved) {
// The base name of a path - the last path component with any extension removed.
const b = _path().default.basename(resolved);
const extensionIndex = b.lastIndexOf('.');
resolved = extensionIndex === -1 ? b : b.slice(0, extensionIndex);
}
break;
case 'rfc1034identifier':
// A representation suitable for use in a DNS name.
// TODO: Check the spec if there is one, this is just what we had before.
resolved = resolved?.replace(/[^a-zA-Z0-9]/g, '-');
// resolved = resolved.replace(/[\/\*\s]/g, '-');
break;
case 'c99extidentifier':
// Like identifier, but with support for extended characters allowed by C99. Added in Xcode 6.
// TODO: Check the spec if there is one.
resolved = resolved?.replace(/[-\s]/g, '_');
break;
case 'standardizepath':
if (resolved) {
// The equivalent of calling stringByStandardizingPath on the string.
// https://developer.apple.com/documentation/foundation/nsstring/1407194-standardizingpath
resolved = _path().default.resolve(resolved);
}
break;
default:
resolved ||= modifier.match(/default=(.*)/)?.[1];
break;
}
});
return resolveXcodeBuildSetting(resolved ?? '', lookup);
});
if (parsedValue !== value) {
return resolveXcodeBuildSetting(parsedValue, lookup);
}
return value;
}
//# sourceMappingURL=Xcodeproj.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,12 @@
import { XcodeProject } from 'xcode';
/**
* Find the Info.plist path linked to a specific build configuration.
*
* @param projectRoot
* @param param1
* @returns
*/
export declare function getInfoPlistPathFromPbxproj(projectRootOrProject: string | XcodeProject, { targetName, buildConfiguration, }?: {
targetName?: string;
buildConfiguration?: string | 'Release' | 'Debug';
}): string | null;

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getInfoPlistPathFromPbxproj = getInfoPlistPathFromPbxproj;
function _Xcodeproj() {
const data = require("./Xcodeproj");
_Xcodeproj = function () {
return data;
};
return data;
}
function _Target() {
const data = require("../Target");
_Target = function () {
return data;
};
return data;
}
/**
* Find the Info.plist path linked to a specific build configuration.
*
* @param projectRoot
* @param param1
* @returns
*/
function getInfoPlistPathFromPbxproj(projectRootOrProject, {
targetName,
buildConfiguration = 'Release'
} = {}) {
const project = (0, _Xcodeproj().resolvePathOrProject)(projectRootOrProject);
if (!project) {
return null;
}
const xcBuildConfiguration = (0, _Target().getXCBuildConfigurationFromPbxproj)(project, {
targetName,
buildConfiguration
});
if (!xcBuildConfiguration) {
return null;
}
// The `INFOPLIST_FILE` is relative to the project folder, ex: app/Info.plist.
return sanitizeInfoPlistBuildProperty(xcBuildConfiguration.buildSettings.INFOPLIST_FILE);
}
function sanitizeInfoPlistBuildProperty(infoPlist) {
return infoPlist?.replace(/"/g, '').replace('$(SRCROOT)', '') ?? null;
}
//# sourceMappingURL=getInfoPlistPath.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getInfoPlistPath.js","names":["_Xcodeproj","data","require","_Target","getInfoPlistPathFromPbxproj","projectRootOrProject","targetName","buildConfiguration","project","resolvePathOrProject","xcBuildConfiguration","getXCBuildConfigurationFromPbxproj","sanitizeInfoPlistBuildProperty","buildSettings","INFOPLIST_FILE","infoPlist","replace"],"sources":["../../../src/ios/utils/getInfoPlistPath.ts"],"sourcesContent":["import { XcodeProject } from 'xcode';\n\nimport { resolvePathOrProject } from './Xcodeproj';\nimport { getXCBuildConfigurationFromPbxproj } from '../Target';\n\n/**\n * Find the Info.plist path linked to a specific build configuration.\n *\n * @param projectRoot\n * @param param1\n * @returns\n */\nexport function getInfoPlistPathFromPbxproj(\n projectRootOrProject: string | XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string | 'Release' | 'Debug' } = {}\n): string | null {\n const project = resolvePathOrProject(projectRootOrProject);\n if (!project) {\n return null;\n }\n\n const xcBuildConfiguration = getXCBuildConfigurationFromPbxproj(project, {\n targetName,\n buildConfiguration,\n });\n if (!xcBuildConfiguration) {\n return null;\n }\n // The `INFOPLIST_FILE` is relative to the project folder, ex: app/Info.plist.\n return sanitizeInfoPlistBuildProperty(xcBuildConfiguration.buildSettings.INFOPLIST_FILE);\n}\n\nfunction sanitizeInfoPlistBuildProperty(infoPlist?: string): string | null {\n return infoPlist?.replace(/\"/g, '').replace('$(SRCROOT)', '') ?? null;\n}\n"],"mappings":";;;;;;AAEA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,2BAA2BA,CACzCC,oBAA2C,EAC3C;EACEC,UAAU;EACVC,kBAAkB,GAAG;AACqD,CAAC,GAAG,CAAC,CAAC,EACnE;EACf,MAAMC,OAAO,GAAG,IAAAC,iCAAoB,EAACJ,oBAAoB,CAAC;EAC1D,IAAI,CAACG,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EAEA,MAAME,oBAAoB,GAAG,IAAAC,4CAAkC,EAACH,OAAO,EAAE;IACvEF,UAAU;IACVC;EACF,CAAC,CAAC;EACF,IAAI,CAACG,oBAAoB,EAAE;IACzB,OAAO,IAAI;EACb;EACA;EACA,OAAOE,8BAA8B,CAACF,oBAAoB,CAACG,aAAa,CAACC,cAAc,CAAC;AAC1F;AAEA,SAASF,8BAA8BA,CAACG,SAAkB,EAAiB;EACzE,OAAOA,SAAS,EAAEC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,IAAI;AACvE","ignoreList":[]}

View File

@@ -0,0 +1 @@
export declare function trimQuotes(s: string): string;

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.trimQuotes = trimQuotes;
function trimQuotes(s) {
return s && s[0] === '"' && s[s.length - 1] === '"' ? s.slice(1, -1) : s;
}
//# sourceMappingURL=string.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"string.js","names":["trimQuotes","s","length","slice"],"sources":["../../../src/ios/utils/string.ts"],"sourcesContent":["export function trimQuotes(s: string): string {\n return s && s[0] === '\"' && s[s.length - 1] === '\"' ? s.slice(1, -1) : s;\n}\n"],"mappings":";;;;;;AAAO,SAASA,UAAUA,CAACC,CAAS,EAAU;EAC5C,OAAOA,CAAC,IAAIA,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAIA,CAAC,CAACA,CAAC,CAACC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,GAAGD,CAAC,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGF,CAAC;AAC1E","ignoreList":[]}