UNPKG

6.83 kBSource Map (JSON)View Raw
1{"version":3,"file":"Entitlements.js","sourceRoot":"","sources":["../../src/ios/Entitlements.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,+BAAwC;AACxC,wDAA0B;AAE1B,4DAAqD;AACrD,iDAO2B;AAE3B,4GAA4G;AAE5G,SAAgB,oBAAoB,CAClC,MAAkB,EAClB,YAAoB,EACpB,iBAAsB;;IAEtB,UAAI,MAAM,CAAC,GAAG,0CAAE,iBAAiB,EAAE;QACjC,qDAAqD;QACrD,iCAAa,CACX,uBAAuB,EACvB,wFAAwF;QACxF,0EAA0E;SAC3E,CAAC;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAfD,oDAeC;AAED,SAAgB,yBAAyB,CAAC,MAAkB,EAAE,iBAAsB;;IAClF,UAAI,MAAM,CAAC,GAAG,0CAAE,eAAe,EAAE;QAC/B,uCACK,iBAAiB,KACpB,iCAAiC,EAAE,CAAC,SAAS,CAAC,IAC9C;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AATD,8DASC;AAED,SAAgB,uBAAuB,CAAC,MAAkB,EAAE,iBAAsB;;IAChF,UAAI,MAAM,CAAC,GAAG,0CAAE,oBAAoB,EAAE;QACpC,uCACK,iBAAiB,KACpB,oCAAoC,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,IACrE;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AATD,0DASC;AAED,SAAgB,oBAAoB,CAAC,MAAkB,EAAE,iBAAsB;;IAC7E,UAAI,MAAM,CAAC,GAAG,0CAAE,iBAAiB,EAAE;QACjC,uCACK,iBAAiB,KACpB,wCAAwC,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,IACtE;KACH;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AATD,oDASC;AAED,SAAgB,mBAAmB,CAAC,WAAmB;;IACrD,YAAO,2BAA2B,CAAC,WAAW,CAAC,uCAAI,sBAAs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AAW,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,eAAe,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,qBAAqB,GAAG;;;;;;;CAO7B,CAAC;AAEF;;GAEG;AACH,SAAS,2BAA2B,CAAC,WAAmB;IACtD,MAAM,iBAAiB,GAAG,WAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;IACxF,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,gBAAgB,EAAE,GAAG,sBAAsB,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAEzE,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAChC,OAAO,CAAC,IAAI,CACV,4CAA4C,gBAAgB,iBAAiB,IAAI,CAAC,SAAS,CACzF,sBAAsB,CACvB,WAAW,CACb,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import path from 'path';\nimport { sync as globSync } from 'glob';\nimport fs from 'fs-extra';\nimport { ExpoConfig } from '../Config.types';\nimport { addWarningIOS } from '../WarningAggregator';\nimport {\n getPbxproj,\n getProjectName,\n getSourceRoot,\n isBuildConfig,\n removeComments,\n removeTestHosts,\n} from './utils/Xcodeproj';\n\n// TODO: should it be possible to turn off these entitlements by setting false in app.json and running apply\n\nexport function setICloudEntitlement(\n config: ExpoConfig,\n _appleTeamId: string,\n entitlementsPlist: any\n) {\n if (config.ios?.usesIcloudStorage) {\n // TODO: need access to the appleTeamId for this one!\n addWarningIOS(\n 'ios.usesIcloudStorage',\n 'Enable the iCloud Storage Entitlement from the Capabilities tab in your Xcode project.'\n // TODO: add a link to a docs page with more information on how to do this\n );\n }\n\n return entitlementsPlist;\n}\n\nexport function setAppleSignInEntitlement(config: ExpoConfig, entitlementsPlist: any) {\n if (config.ios?.usesAppleSignIn) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.applesignin': ['Default'],\n };\n }\n\n return entitlementsPlist;\n}\n\nexport function setAccessesContactNotes(config: ExpoConfig, entitlementsPlist: any) {\n if (config.ios?.accessesContactNotes) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.contacts.notes': config.ios.accessesContactNotes,\n };\n }\n\n return entitlementsPlist;\n}\n\nexport function setAssociatedDomains(config: ExpoConfig, entitlementsPlist: any) {\n if (config.ios?.associatedDomains) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.associated-domains': config.ios.associatedDomains,\n };\n }\n\n return entitlementsPlist;\n}\n\nexport function getEntitlementsPath(projectRoot: string): string {\n return getExistingEntitlementsPath(projectRoot) ?? createEntitlementsFile(projectRoot);\n}\n\nfunction createEntitlementsFile(projectRoot: string) {\n /**\n * Write file from template\n */\n const entitlementsPath = getDefaultEntitlementsPath(projectRoot);\n if (!fs.pathExistsSync(path.dirname(entitlementsPath))) {\n fs.mkdirSync(path.dirname(entitlementsPath));\n }\n fs.writeFileSync(entitlementsPath, ENTITLEMENTS_TEMPLATE);\n const entitlementsRelativePath = entitlementsPath.replace(`${projectRoot}/ios/`, '');\n\n /**\n * Add file to pbxproj under CODE_SIGN_ENTITLEMENTS\n */\n const project = getPbxproj(projectRoot);\n Object.entries(project.pbxXCBuildConfigurationSection())\n .filter(removeComments)\n .filter(isBuildConfig)\n .filter(removeTestHosts)\n .forEach(({ 1: { buildSettings } }: any) => {\n buildSettings.CODE_SIGN_ENTITLEMENTS = entitlementsRelativePath;\n });\n fs.writeFileSync(project.filepath, project.writeSync());\n\n return entitlementsPath;\n}\n\nfunction getDefaultEntitlementsPath(projectRoot: string) {\n const projectName = getProjectName(projectRoot);\n const project = getPbxproj(projectRoot);\n const productName = project.productName;\n return path.join(projectRoot, 'ios', projectName, `${productName}.entitlements`);\n}\n\nconst ENTITLEMENTS_TEMPLATE = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n</dict>\n</plist>\n`;\n\n/**\n * Get the path to an existing entitlements file or use the default\n */\nfunction getExistingEntitlementsPath(projectRoot: string): string | null {\n const entitlementsPaths = globSync(path.join(projectRoot, 'ios', '*', '.entitlements'));\n if (entitlementsPaths.length === 0) {\n return null;\n }\n let [entitlementsPath, ...otherEntitlementsPaths] = entitlementsPaths[0];\n\n if (entitlementsPaths.length > 1) {\n console.warn(\n `Found multiple entitlements paths, using ${entitlementsPath}. Other paths ${JSON.stringify(\n otherEntitlementsPaths\n )} ignored.`\n );\n }\n\n return entitlementsPath;\n}\n"]}
\No newline at end of file