@expo/config-plugins 4.0.10 → 4.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/build/android/IntentFilters.d.ts +3 -3
  2. package/build/android/IntentFilters.js +44 -48
  3. package/build/android/IntentFilters.js.map +1 -1
  4. package/build/android/Manifest.d.ts +8 -1
  5. package/build/android/Manifest.js +3 -1
  6. package/build/android/Manifest.js.map +1 -1
  7. package/build/android/Permissions.d.ts +2 -0
  8. package/build/android/Permissions.js +88 -3
  9. package/build/android/Permissions.js.map +1 -1
  10. package/build/android/Updates.d.ts +2 -2
  11. package/build/android/Updates.js +20 -4
  12. package/build/android/Updates.js.map +1 -1
  13. package/build/android/Version.d.ts +9 -0
  14. package/build/android/Version.js +37 -1
  15. package/build/android/Version.js.map +1 -1
  16. package/build/ios/BundleIdentifier.js +11 -1
  17. package/build/ios/BundleIdentifier.js.map +1 -1
  18. package/build/ios/Maps.d.ts +3 -5
  19. package/build/ios/Maps.js +29 -34
  20. package/build/ios/Maps.js.map +1 -1
  21. package/build/ios/Name.d.ts +7 -2
  22. package/build/ios/Name.js +58 -1
  23. package/build/ios/Name.js.map +1 -1
  24. package/build/ios/ProvisioningProfile.js +11 -2
  25. package/build/ios/ProvisioningProfile.js.map +1 -1
  26. package/build/ios/Target.js +29 -10
  27. package/build/ios/Target.js.map +1 -1
  28. package/build/ios/Updates.d.ts +2 -2
  29. package/build/ios/Updates.js +20 -4
  30. package/build/ios/Updates.js.map +1 -1
  31. package/build/ios/utils/string.d.ts +1 -0
  32. package/build/ios/utils/string.js +11 -0
  33. package/build/ios/utils/string.js.map +1 -0
  34. package/build/utils/Updates.d.ts +1 -0
  35. package/build/utils/Updates.js +34 -0
  36. package/build/utils/Updates.js.map +1 -1
  37. package/package.json +2 -1
  38. package/build/utils/resolvePackageRootFolder.d.ts +0 -1
  39. package/build/utils/resolvePackageRootFolder.js +0 -57
  40. package/build/utils/resolvePackageRootFolder.js.map +0 -1
@@ -46,17 +46,26 @@ function setProvisioningProfileForPbxproj(projectRoot, {
46
46
  const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
47
47
  const nativeTargetEntry = targetName ? (0, _Target().findNativeTargetByName)(project, targetName) : (0, _Target().findFirstNativeTarget)(project);
48
48
  const [nativeTargetId, nativeTarget] = nativeTargetEntry;
49
+ const quotedAppleTeamId = ensureQuotes(appleTeamId);
49
50
  (0, _Xcodeproj().getBuildConfigurationsForListId)(project, nativeTarget.buildConfigurationList).filter(([, item]) => item.name === buildConfiguration).forEach(([, item]) => {
50
51
  item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `"${profileName}"`;
51
- item.buildSettings.DEVELOPMENT_TEAM = appleTeamId;
52
+ item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;
52
53
  item.buildSettings.CODE_SIGN_IDENTITY = '"iPhone Distribution"';
53
54
  item.buildSettings.CODE_SIGN_STYLE = 'Manual';
54
55
  });
55
56
  Object.entries((0, _Xcodeproj().getProjectSection)(project)).filter(_Xcodeproj().isNotComment).forEach(([, item]) => {
56
- item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = appleTeamId;
57
+ item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;
57
58
  item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';
58
59
  });
59
60
 
60
61
  _fsExtra().default.writeFileSync(project.filepath, project.writeSync());
61
62
  }
63
+
64
+ const ensureQuotes = value => {
65
+ if (!value.match(/^['"]/)) {
66
+ return `"${value}"`;
67
+ }
68
+
69
+ return value;
70
+ };
62
71
  //# sourceMappingURL=ProvisioningProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/ProvisioningProfile.ts"],"names":["setProvisioningProfileForPbxproj","projectRoot","targetName","profileName","appleTeamId","buildConfiguration","project","nativeTargetEntry","nativeTargetId","nativeTarget","buildConfigurationList","filter","item","name","forEach","buildSettings","PROVISIONING_PROFILE_SPECIFIER","DEVELOPMENT_TEAM","CODE_SIGN_IDENTITY","CODE_SIGN_STYLE","Object","entries","isNotComment","attributes","TargetAttributes","DevelopmentTeam","ProvisioningStyle","fs","writeFileSync","filepath","writeSync"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAgBO,SAASA,gCAAT,CACLC,WADK,EAEL;AACEC,EAAAA,UADF;AAEEC,EAAAA,WAFF;AAGEC,EAAAA,WAHF;AAIEC,EAAAA,kBAAkB,GAAG;AAJvB,CAFK,EAQC;AACN,QAAMC,OAAO,GAAG,6BAAWL,WAAX,CAAhB;AAEA,QAAMM,iBAAiB,GAAGL,UAAU,GAChC,sCAAuBI,OAAvB,EAAgCJ,UAAhC,CADgC,GAEhC,qCAAsBI,OAAtB,CAFJ;AAGA,QAAM,CAACE,cAAD,EAAiBC,YAAjB,IAAiCF,iBAAvC;AAEA,oDAAgCD,OAAhC,EAAyCG,YAAY,CAACC,sBAAtD,EACGC,MADH,CACU,CAAC,GAAGC,IAAH,CAAD,KAAyCA,IAAI,CAACC,IAAL,KAAcR,kBADjE,EAEGS,OAFH,CAEW,CAAC,GAAGF,IAAH,CAAD,KAAyC;AAChDA,IAAAA,IAAI,CAACG,aAAL,CAAmBC,8BAAnB,GAAqD,IAAGb,WAAY,GAApE;AACAS,IAAAA,IAAI,CAACG,aAAL,CAAmBE,gBAAnB,GAAsCb,WAAtC;AACAQ,IAAAA,IAAI,CAACG,aAAL,CAAmBG,kBAAnB,GAAwC,uBAAxC;AACAN,IAAAA,IAAI,CAACG,aAAL,CAAmBI,eAAnB,GAAqC,QAArC;AACD,GAPH;AASAC,EAAAA,MAAM,CAACC,OAAP,CAAe,oCAAkBf,OAAlB,CAAf,EACGK,MADH,CACUW,yBADV,EAEGR,OAFH,CAEW,CAAC,GAAGF,IAAH,CAAD,KAAmC;AAC1CA,IAAAA,IAAI,CAACW,UAAL,CAAgBC,gBAAhB,CAAiChB,cAAjC,EAAiDiB,eAAjD,GAAmErB,WAAnE;AACAQ,IAAAA,IAAI,CAACW,UAAL,CAAgBC,gBAAhB,CAAiChB,cAAjC,EAAiDkB,iBAAjD,GAAqE,QAArE;AACD,GALH;;AAOAC,qBAAGC,aAAH,CAAiBtB,OAAO,CAACuB,QAAzB,EAAmCvB,OAAO,CAACwB,SAAR,EAAnC;AACD","sourcesContent":["import fs from 'fs-extra';\n\nimport { findFirstNativeTarget, findNativeTargetByName } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n getPbxproj,\n getProjectSection,\n isNotComment,\n ProjectSectionEntry,\n} from './utils/Xcodeproj';\n\ntype ProvisioningProfileSettings = {\n targetName?: string;\n appleTeamId: string;\n profileName: string;\n buildConfiguration?: string;\n};\n\nexport function setProvisioningProfileForPbxproj(\n projectRoot: string,\n {\n targetName,\n profileName,\n appleTeamId,\n buildConfiguration = 'Release',\n }: ProvisioningProfileSettings\n): void {\n const project = getPbxproj(projectRoot);\n\n const nativeTargetEntry = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [nativeTargetId, nativeTarget] = nativeTargetEntry;\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList)\n .filter(([, item]: ConfigurationSectionEntry) => item.name === buildConfiguration)\n .forEach(([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `\"${profileName}\"`;\n item.buildSettings.DEVELOPMENT_TEAM = appleTeamId;\n item.buildSettings.CODE_SIGN_IDENTITY = '\"iPhone Distribution\"';\n item.buildSettings.CODE_SIGN_STYLE = 'Manual';\n });\n\n Object.entries(getProjectSection(project))\n .filter(isNotComment)\n .forEach(([, item]: ProjectSectionEntry) => {\n item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = appleTeamId;\n item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';\n });\n\n fs.writeFileSync(project.filepath, project.writeSync());\n}\n"],"file":"ProvisioningProfile.js"}
1
+ {"version":3,"sources":["../../src/ios/ProvisioningProfile.ts"],"names":["setProvisioningProfileForPbxproj","projectRoot","targetName","profileName","appleTeamId","buildConfiguration","project","nativeTargetEntry","nativeTargetId","nativeTarget","quotedAppleTeamId","ensureQuotes","buildConfigurationList","filter","item","name","forEach","buildSettings","PROVISIONING_PROFILE_SPECIFIER","DEVELOPMENT_TEAM","CODE_SIGN_IDENTITY","CODE_SIGN_STYLE","Object","entries","isNotComment","attributes","TargetAttributes","DevelopmentTeam","ProvisioningStyle","fs","writeFileSync","filepath","writeSync","value","match"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAgBO,SAASA,gCAAT,CACLC,WADK,EAEL;AACEC,EAAAA,UADF;AAEEC,EAAAA,WAFF;AAGEC,EAAAA,WAHF;AAIEC,EAAAA,kBAAkB,GAAG;AAJvB,CAFK,EAQC;AACN,QAAMC,OAAO,GAAG,6BAAWL,WAAX,CAAhB;AAEA,QAAMM,iBAAiB,GAAGL,UAAU,GAChC,sCAAuBI,OAAvB,EAAgCJ,UAAhC,CADgC,GAEhC,qCAAsBI,OAAtB,CAFJ;AAGA,QAAM,CAACE,cAAD,EAAiBC,YAAjB,IAAiCF,iBAAvC;AAEA,QAAMG,iBAAiB,GAAGC,YAAY,CAACP,WAAD,CAAtC;AAEA,oDAAgCE,OAAhC,EAAyCG,YAAY,CAACG,sBAAtD,EACGC,MADH,CACU,CAAC,GAAGC,IAAH,CAAD,KAAyCA,IAAI,CAACC,IAAL,KAAcV,kBADjE,EAEGW,OAFH,CAEW,CAAC,GAAGF,IAAH,CAAD,KAAyC;AAChDA,IAAAA,IAAI,CAACG,aAAL,CAAmBC,8BAAnB,GAAqD,IAAGf,WAAY,GAApE;AACAW,IAAAA,IAAI,CAACG,aAAL,CAAmBE,gBAAnB,GAAsCT,iBAAtC;AACAI,IAAAA,IAAI,CAACG,aAAL,CAAmBG,kBAAnB,GAAwC,uBAAxC;AACAN,IAAAA,IAAI,CAACG,aAAL,CAAmBI,eAAnB,GAAqC,QAArC;AACD,GAPH;AASAC,EAAAA,MAAM,CAACC,OAAP,CAAe,oCAAkBjB,OAAlB,CAAf,EACGO,MADH,CACUW,yBADV,EAEGR,OAFH,CAEW,CAAC,GAAGF,IAAH,CAAD,KAAmC;AAC1CA,IAAAA,IAAI,CAACW,UAAL,CAAgBC,gBAAhB,CAAiClB,cAAjC,EAAiDmB,eAAjD,GAAmEjB,iBAAnE;AACAI,IAAAA,IAAI,CAACW,UAAL,CAAgBC,gBAAhB,CAAiClB,cAAjC,EAAiDoB,iBAAjD,GAAqE,QAArE;AACD,GALH;;AAOAC,qBAAGC,aAAH,CAAiBxB,OAAO,CAACyB,QAAzB,EAAmCzB,OAAO,CAAC0B,SAAR,EAAnC;AACD;;AAED,MAAMrB,YAAY,GAAIsB,KAAD,IAAmB;AACtC,MAAI,CAACA,KAAK,CAACC,KAAN,CAAY,OAAZ,CAAL,EAA2B;AACzB,WAAQ,IAAGD,KAAM,GAAjB;AACD;;AACD,SAAOA,KAAP;AACD,CALD","sourcesContent":["import fs from 'fs-extra';\n\nimport { findFirstNativeTarget, findNativeTargetByName } from './Target';\nimport {\n ConfigurationSectionEntry,\n getBuildConfigurationsForListId,\n getPbxproj,\n getProjectSection,\n isNotComment,\n ProjectSectionEntry,\n} from './utils/Xcodeproj';\n\ntype ProvisioningProfileSettings = {\n targetName?: string;\n appleTeamId: string;\n profileName: string;\n buildConfiguration?: string;\n};\n\nexport function setProvisioningProfileForPbxproj(\n projectRoot: string,\n {\n targetName,\n profileName,\n appleTeamId,\n buildConfiguration = 'Release',\n }: ProvisioningProfileSettings\n): void {\n const project = getPbxproj(projectRoot);\n\n const nativeTargetEntry = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [nativeTargetId, nativeTarget] = nativeTargetEntry;\n\n const quotedAppleTeamId = ensureQuotes(appleTeamId);\n\n getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList)\n .filter(([, item]: ConfigurationSectionEntry) => item.name === buildConfiguration)\n .forEach(([, item]: ConfigurationSectionEntry) => {\n item.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `\"${profileName}\"`;\n item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;\n item.buildSettings.CODE_SIGN_IDENTITY = '\"iPhone Distribution\"';\n item.buildSettings.CODE_SIGN_STYLE = 'Manual';\n });\n\n Object.entries(getProjectSection(project))\n .filter(isNotComment)\n .forEach(([, item]: ProjectSectionEntry) => {\n item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;\n item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Manual';\n });\n\n fs.writeFileSync(project.filepath, project.writeSync());\n}\n\nconst ensureQuotes = (value: string) => {\n if (!value.match(/^['\"]/)) {\n return `\"${value}\"`;\n }\n return value;\n};\n"],"file":"ProvisioningProfile.js"}
@@ -32,6 +32,16 @@ function _Xcodeproj() {
32
32
  return data;
33
33
  }
34
34
 
35
+ function _string() {
36
+ const data = require("./utils/string");
37
+
38
+ _string = function () {
39
+ return data;
40
+ };
41
+
42
+ return data;
43
+ }
44
+
35
45
  let TargetType;
36
46
  exports.TargetType = TargetType;
37
47
 
@@ -59,7 +69,20 @@ async function findApplicationTargetWithDependenciesAsync(projectRoot, scheme) {
59
69
  const applicationTargetName = await (0, _BuildScheme().getApplicationTargetNameForSchemeAsync)(projectRoot, scheme);
60
70
  const project = (0, _Xcodeproj().getPbxproj)(projectRoot);
61
71
  const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);
62
- const dependencies = applicationTarget.dependencies.map(({
72
+ const dependencies = getTargetDependencies(project, applicationTarget);
73
+ return {
74
+ name: (0, _string().trimQuotes)(applicationTarget.name),
75
+ type: TargetType.APPLICATION,
76
+ dependencies
77
+ };
78
+ }
79
+
80
+ function getTargetDependencies(project, parentTarget) {
81
+ if (!parentTarget.dependencies || parentTarget.dependencies.length === 0) {
82
+ return undefined;
83
+ }
84
+
85
+ return parentTarget.dependencies.map(({
63
86
  value
64
87
  }) => {
65
88
  const {
@@ -68,19 +91,15 @@ async function findApplicationTargetWithDependenciesAsync(projectRoot, scheme) {
68
91
  const [, target] = findNativeTargetById(project, targetId);
69
92
  const type = isTargetOfType(target, TargetType.EXTENSION) ? TargetType.EXTENSION : TargetType.OTHER;
70
93
  return {
71
- name: target.name,
72
- type
94
+ name: (0, _string().trimQuotes)(target.name),
95
+ type,
96
+ dependencies: getTargetDependencies(project, target)
73
97
  };
74
98
  });
75
- return {
76
- name: applicationTarget.name,
77
- type: TargetType.APPLICATION,
78
- dependencies
79
- };
80
99
  }
81
100
 
82
101
  function isTargetOfType(target, targetType) {
83
- return target.productType === targetType || target.productType === `"${targetType}"`;
102
+ return (0, _string().trimQuotes)(target.productType) === targetType;
84
103
  }
85
104
 
86
105
  function getNativeTargets(project) {
@@ -112,7 +131,7 @@ function findFirstNativeTarget(project) {
112
131
 
113
132
  function findNativeTargetByName(project, targetName) {
114
133
  const nativeTargets = getNativeTargets(project);
115
- const nativeTargetEntry = nativeTargets.find(([, i]) => i.name === targetName || i.name === `"${targetName}"`);
134
+ const nativeTargetEntry = nativeTargets.find(([, i]) => (0, _string().trimQuotes)(i.name) === targetName);
116
135
 
117
136
  if (!nativeTargetEntry) {
118
137
  throw new Error(`Could not find target '${targetName}' in project.pbxproj`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Target.ts"],"names":["TargetType","getXCBuildConfigurationFromPbxproj","project","targetName","buildConfiguration","nativeTarget","findNativeTargetByName","findFirstNativeTarget","xcBuildConfiguration","configurationListId","buildConfigurationList","findApplicationTargetWithDependenciesAsync","projectRoot","scheme","applicationTargetName","applicationTarget","dependencies","map","value","target","targetId","getPBXGroupByKeyAndType","findNativeTargetById","type","isTargetOfType","EXTENSION","OTHER","name","APPLICATION","targetType","productType","getNativeTargets","section","pbxNativeTargetSection","Object","entries","filter","isNotComment","findSignableTargets","targets","applicationTargets","WATCH","STICKER_PACK_EXTENSION","length","Error","nativeTargets","nativeTargetEntry","find","i","key"],"mappings":";;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;IAOYA,U;;;WAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,0BAAAA,U;;AAcL,SAASC,kCAAT,CACLC,OADK,EAEL;AACEC,EAAAA,UADF;AAEEC,EAAAA,kBAAkB,GAAG;AAFvB,IAG0D,EALrD,EAMwB;AAC7B,QAAM,GAAGC,YAAH,IAAmBF,UAAU,GAC/BG,sBAAsB,CAACJ,OAAD,EAAUC,UAAV,CADS,GAE/BI,qBAAqB,CAACL,OAAD,CAFzB;AAGA,QAAM,GAAGM,oBAAH,IAA2B,wDAAsCN,OAAtC,EAA+C;AAC9EO,IAAAA,mBAAmB,EAAEJ,YAAY,CAACK,sBAD4C;AAE9EN,IAAAA;AAF8E,GAA/C,CAAjC;AAIA,SAAOI,oBAAP,aAAOA,oBAAP,cAAOA,oBAAP,GAA+B,IAA/B;AACD;;AAEM,eAAeG,0CAAf,CACLC,WADK,EAELC,MAFK,EAGY;AACjB,QAAMC,qBAAqB,GAAG,MAAM,2DAAuCF,WAAvC,EAAoDC,MAApD,CAApC;AACA,QAAMX,OAAO,GAAG,6BAAWU,WAAX,CAAhB;AACA,QAAM,GAAGG,iBAAH,IAAwBT,sBAAsB,CAACJ,OAAD,EAAUY,qBAAV,CAApD;AAEA,QAAME,YAAsB,GAAGD,iBAAiB,CAACC,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AAgB,CAAC7B,OAAD,CAAtC;AACA,QAAM4C,iBAAiB,GAAGD,aAAa,CAACE,IAAd,CAAmB,CAAC,CAACE,GAAD,CAAD,KAAWA,GAAG,KAAK7B,QAAtC,CAA1B;;AACA,MAAI,CAAC0B,iBAAL,EAAwB;AACtB,UAAM,IAAIF,KAAJ,CAAW,kCAAiCxB,QAAS,sBAArD,CAAN;AACD;;AACD,SAAO0B,iBAAP;AACD","sourcesContent":["import { PBXNativeTarget, PBXTargetDependency, XCBuildConfiguration, XcodeProject } from 'xcode';\n\nimport { getApplicationTargetNameForSchemeAsync } from './BuildScheme';\nimport {\n getBuildConfigurationForListIdAndName,\n getPbxproj,\n isNotComment,\n NativeTargetSectionEntry,\n} from './utils/Xcodeproj';\n\nexport enum TargetType {\n APPLICATION = 'com.apple.product-type.application',\n EXTENSION = 'com.apple.product-type.app-extension',\n WATCH = 'com.apple.product-type.application.watchapp',\n STICKER_PACK_EXTENSION = 'com.apple.product-type.app-extension.messages-sticker-pack',\n OTHER = 'other',\n}\n\nexport interface Target {\n name: string;\n type: TargetType;\n dependencies?: Target[];\n}\n\nexport function getXCBuildConfigurationFromPbxproj(\n project: XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string } = {}\n): XCBuildConfiguration | null {\n const [, nativeTarget] = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [, xcBuildConfiguration] = getBuildConfigurationForListIdAndName(project, {\n configurationListId: nativeTarget.buildConfigurationList,\n buildConfiguration,\n });\n return xcBuildConfiguration ?? null;\n}\n\nexport async function findApplicationTargetWithDependenciesAsync(\n projectRoot: string,\n scheme: string\n): Promise<Target> {\n const applicationTargetName = await getApplicationTargetNameForSchemeAsync(projectRoot, scheme);\n const project = getPbxproj(projectRoot);\n const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);\n\n const dependencies: Target[] = applicationTarget.dependencies.map(({ value }) => {\n const { target: targetId } = project.getPBXGroupByKeyAndType(\n value,\n 'PBXTargetDependency'\n ) as PBXTargetDependency;\n\n const [, target] = findNativeTargetById(project, targetId);\n\n const type = isTargetOfType(target, TargetType.EXTENSION)\n ? TargetType.EXTENSION\n : TargetType.OTHER;\n return {\n name: target.name,\n type,\n };\n });\n\n return {\n name: applicationTarget.name,\n type: TargetType.APPLICATION,\n dependencies,\n };\n}\n\nexport function isTargetOfType(target: PBXNativeTarget, targetType: TargetType): boolean {\n return target.productType === targetType || target.productType === `\"${targetType}\"`;\n}\n\nexport function getNativeTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const section = project.pbxNativeTargetSection();\n return Object.entries(section).filter(isNotComment);\n}\n\nexport function findSignableTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(\n ([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION) ||\n isTargetOfType(target, TargetType.EXTENSION) ||\n isTargetOfType(target, TargetType.WATCH) ||\n isTargetOfType(target, TargetType.STICKER_PACK_EXTENSION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any signable targets in project.pbxproj`);\n }\n return applicationTargets;\n}\n\nexport function findFirstNativeTarget(project: XcodeProject): NativeTargetSectionEntry {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any application target in project.pbxproj`);\n }\n return applicationTargets[0];\n}\n\nexport function findNativeTargetByName(\n project: XcodeProject,\n targetName: string\n): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(\n ([, i]) => i.name === targetName || i.name === `\"${targetName}\"`\n );\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target '${targetName}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n\nfunction findNativeTargetById(project: XcodeProject, targetId: string): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(([key]) => key === targetId);\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target with id '${targetId}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n"],"file":"Target.js"}
1
+ {"version":3,"sources":["../../src/ios/Target.ts"],"names":["TargetType","getXCBuildConfigurationFromPbxproj","project","targetName","buildConfiguration","nativeTarget","findNativeTargetByName","findFirstNativeTarget","xcBuildConfiguration","configurationListId","buildConfigurationList","findApplicationTargetWithDependenciesAsync","projectRoot","scheme","applicationTargetName","applicationTarget","dependencies","getTargetDependencies","name","type","APPLICATION","parentTarget","length","undefined","map","value","target","targetId","getPBXGroupByKeyAndType","findNativeTargetById","isTargetOfType","EXTENSION","OTHER","targetType","productType","getNativeTargets","section","pbxNativeTargetSection","Object","entries","filter","isNotComment","findSignableTargets","targets","applicationTargets","WATCH","STICKER_PACK_EXTENSION","Error","nativeTargets","nativeTargetEntry","find","i","key"],"mappings":";;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;IAEYA,U;;;WAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,0BAAAA,U;;AAcL,SAASC,kCAAT,CACLC,OADK,EAEL;AACEC,EAAAA,UADF;AAEEC,EAAAA,kBAAkB,GAAG;AAFvB,IAG0D,EALrD,EAMwB;AAC7B,QAAM,GAAGC,YAAH,IAAmBF,UAAU,GAC/BG,sBAAsB,CAACJ,OAAD,EAAUC,UAAV,CADS,GAE/BI,qBAAqB,CAACL,OAAD,CAFzB;AAGA,QAAM,GAAGM,oBAAH,IAA2B,wDAAsCN,OAAtC,EAA+C;AAC9EO,IAAAA,mBAAmB,EAAEJ,YAAY,CAACK,sBAD4C;AAE9EN,IAAA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A,MAAIwB,kBAAkB,CAACtB,MAAnB,KAA8B,CAAlC,EAAqC;AACnC,UAAM,IAAIyB,KAAJ,CAAW,0DAAX,CAAN;AACD;;AACD,SAAOH,kBAAkB,CAAC,CAAD,CAAzB;AACD;;AAEM,SAAStC,sBAAT,CACLJ,OADK,EAELC,UAFK,EAGqB;AAC1B,QAAM6C,aAAa,GAAGb,gBAAgB,CAACjC,OAAD,CAAtC;AACA,QAAM+C,iBAAiB,GAAGD,aAAa,CAACE,IAAd,CAAmB,CAAC,GAAGC,CAAH,CAAD,KAAW,0BAAWA,CAAC,CAACjC,IAAb,MAAuBf,UAArD,CAA1B;;AACA,MAAI,CAAC8C,iBAAL,EAAwB;AACtB,UAAM,IAAIF,KAAJ,CAAW,0BAAyB5C,UAAW,sBAA/C,CAAN;AACD;;AACD,SAAO8C,iBAAP;AACD;;AAED,SAASpB,oBAAT,CAA8B3B,OAA9B,EAAqDyB,QAArD,EAAiG;AAC/F,QAAMqB,aAAa,GAAGb,gBAAgB,CAACjC,OAAD,CAAtC;AACA,QAAM+C,iBAAiB,GAAGD,aAAa,CAACE,IAAd,CAAmB,CAAC,CAACE,GAAD,CAAD,KAAWA,GAAG,KAAKzB,QAAtC,CAA1B;;AACA,MAAI,CAACsB,iBAAL,EAAwB;AACtB,UAAM,IAAIF,KAAJ,CAAW,kCAAiCpB,QAAS,sBAArD,CAAN;AACD;;AACD,SAAOsB,iBAAP;AACD","sourcesContent":["import { PBXNativeTarget, PBXTargetDependency, XCBuildConfiguration, XcodeProject } from 'xcode';\n\nimport { getApplicationTargetNameForSchemeAsync } from './BuildScheme';\nimport {\n getBuildConfigurationForListIdAndName,\n getPbxproj,\n isNotComment,\n NativeTargetSectionEntry,\n} from './utils/Xcodeproj';\nimport { trimQuotes } from './utils/string';\n\nexport enum TargetType {\n APPLICATION = 'com.apple.product-type.application',\n EXTENSION = 'com.apple.product-type.app-extension',\n WATCH = 'com.apple.product-type.application.watchapp',\n STICKER_PACK_EXTENSION = 'com.apple.product-type.app-extension.messages-sticker-pack',\n OTHER = 'other',\n}\n\nexport interface Target {\n name: string;\n type: TargetType;\n dependencies?: Target[];\n}\n\nexport function getXCBuildConfigurationFromPbxproj(\n project: XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string } = {}\n): XCBuildConfiguration | null {\n const [, nativeTarget] = targetName\n ? findNativeTargetByName(project, targetName)\n : findFirstNativeTarget(project);\n const [, xcBuildConfiguration] = getBuildConfigurationForListIdAndName(project, {\n configurationListId: nativeTarget.buildConfigurationList,\n buildConfiguration,\n });\n return xcBuildConfiguration ?? null;\n}\n\nexport async function findApplicationTargetWithDependenciesAsync(\n projectRoot: string,\n scheme: string\n): Promise<Target> {\n const applicationTargetName = await getApplicationTargetNameForSchemeAsync(projectRoot, scheme);\n const project = getPbxproj(projectRoot);\n const [, applicationTarget] = findNativeTargetByName(project, applicationTargetName);\n const dependencies = getTargetDependencies(project, applicationTarget);\n return {\n name: trimQuotes(applicationTarget.name),\n type: TargetType.APPLICATION,\n dependencies,\n };\n}\n\nfunction getTargetDependencies(\n project: XcodeProject,\n parentTarget: PBXNativeTarget\n): Target[] | undefined {\n if (!parentTarget.dependencies || parentTarget.dependencies.length === 0) {\n return undefined;\n }\n return parentTarget.dependencies.map(({ value }) => {\n const { target: targetId } = project.getPBXGroupByKeyAndType(\n value,\n 'PBXTargetDependency'\n ) as PBXTargetDependency;\n\n const [, target] = findNativeTargetById(project, targetId);\n\n const type = isTargetOfType(target, TargetType.EXTENSION)\n ? TargetType.EXTENSION\n : TargetType.OTHER;\n return {\n name: trimQuotes(target.name),\n type,\n dependencies: getTargetDependencies(project, target),\n };\n });\n}\n\nexport function isTargetOfType(target: PBXNativeTarget, targetType: TargetType): boolean {\n return trimQuotes(target.productType) === targetType;\n}\n\nexport function getNativeTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const section = project.pbxNativeTargetSection();\n return Object.entries(section).filter(isNotComment);\n}\n\nexport function findSignableTargets(project: XcodeProject): NativeTargetSectionEntry[] {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(\n ([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION) ||\n isTargetOfType(target, TargetType.EXTENSION) ||\n isTargetOfType(target, TargetType.WATCH) ||\n isTargetOfType(target, TargetType.STICKER_PACK_EXTENSION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any signable targets in project.pbxproj`);\n }\n return applicationTargets;\n}\n\nexport function findFirstNativeTarget(project: XcodeProject): NativeTargetSectionEntry {\n const targets = getNativeTargets(project);\n const applicationTargets = targets.filter(([, target]) =>\n isTargetOfType(target, TargetType.APPLICATION)\n );\n if (applicationTargets.length === 0) {\n throw new Error(`Could not find any application target in project.pbxproj`);\n }\n return applicationTargets[0];\n}\n\nexport function findNativeTargetByName(\n project: XcodeProject,\n targetName: string\n): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(([, i]) => trimQuotes(i.name) === targetName);\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target '${targetName}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n\nfunction findNativeTargetById(project: XcodeProject, targetId: string): NativeTargetSectionEntry {\n const nativeTargets = getNativeTargets(project);\n const nativeTargetEntry = nativeTargets.find(([key]) => key === targetId);\n if (!nativeTargetEntry) {\n throw new Error(`Could not find target with id '${targetId}' in project.pbxproj`);\n }\n return nativeTargetEntry;\n}\n"],"file":"Target.js"}
@@ -15,11 +15,11 @@ export declare enum Config {
15
15
  export declare function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null;
16
16
  export declare function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean;
17
17
  export declare function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number;
18
- export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>): 'NEVER' | 'ALWAYS';
18
+ export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>, expoUpdatesPackageVersion?: string | null): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS';
19
19
  export declare const withUpdates: ConfigPlugin<{
20
20
  expoUsername: string | null;
21
21
  }>;
22
- export declare function setUpdatesConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist, username: string | null): ExpoPlist;
22
+ export declare function setUpdatesConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist, username: string | null, expoUpdatesPackageVersion?: string | null): ExpoPlist;
23
23
  export declare function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist;
24
24
  interface ShellScriptBuildPhase {
25
25
  isa: 'PBXShellScriptBuildPhase';
@@ -38,6 +38,16 @@ function _resolveFrom() {
38
38
  return data;
39
39
  }
40
40
 
41
+ function _semver() {
42
+ const data = _interopRequireDefault(require("semver"));
43
+
44
+ _semver = function () {
45
+ return data;
46
+ };
47
+
48
+ return data;
49
+ }
50
+
41
51
  function _iosPlugins() {
42
52
  const data = require("../plugins/ios-plugins");
43
53
 
@@ -95,10 +105,15 @@ function getUpdatesTimeout(config) {
95
105
  return (_config$updates$fallb = (_config$updates2 = config.updates) === null || _config$updates2 === void 0 ? void 0 : _config$updates2.fallbackToCacheTimeout) !== null && _config$updates$fallb !== void 0 ? _config$updates$fallb : 0;
96
106
  }
97
107
 
98
- function getUpdatesCheckOnLaunch(config) {
108
+ function getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion) {
99
109
  var _config$updates3, _config$updates4;
100
110
 
101
111
  if (((_config$updates3 = config.updates) === null || _config$updates3 === void 0 ? void 0 : _config$updates3.checkAutomatically) === 'ON_ERROR_RECOVERY') {
112
+ // native 'ERROR_RECOVERY_ONLY' option was only introduced in 0.11.x
113
+ if (expoUpdatesPackageVersion && _semver().default.gte(expoUpdatesPackageVersion, '0.11.0')) {
114
+ return 'ERROR_RECOVERY_ONLY';
115
+ }
116
+
102
117
  return 'NEVER';
103
118
  } else if (((_config$updates4 = config.updates) === null || _config$updates4 === void 0 ? void 0 : _config$updates4.checkAutomatically) === 'ON_LOAD') {
104
119
  return 'ALWAYS';
@@ -111,17 +126,18 @@ const withUpdates = (config, {
111
126
  expoUsername
112
127
  }) => {
113
128
  return (0, _iosPlugins().withExpoPlist)(config, config => {
114
- config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);
129
+ const expoUpdatesPackageVersion = (0, _Updates().getExpoUpdatesPackageVersion)(config.modRequest.projectRoot);
130
+ config.modResults = setUpdatesConfig(config, config.modResults, expoUsername, expoUpdatesPackageVersion);
115
131
  return config;
116
132
  });
117
133
  };
118
134
 
119
135
  exports.withUpdates = withUpdates;
120
136
 
121
- function setUpdatesConfig(config, expoPlist, username) {
137
+ function setUpdatesConfig(config, expoPlist, username, expoUpdatesPackageVersion) {
122
138
  const newExpoPlist = { ...expoPlist,
123
139
  [Config.ENABLED]: getUpdatesEnabled(config),
124
- [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config),
140
+ [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion),
125
141
  [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config)
126
142
  };
127
143
  const updateUrl = (0, _Updates().getUpdateUrl)(config, username);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/Updates.ts"],"names":["CREATE_MANIFEST_IOS_PATH","Config","getSDKVersion","config","sdkVersion","getUpdatesEnabled","updates","enabled","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","checkAutomatically","withUpdates","expoUsername","modResults","setUpdatesConfig","expoPlist","username","newExpoPlist","ENABLED","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","updateUrl","UPDATE_URL","setVersionsConfig","runtimeVersion","SDK_VERSION","RUNTIME_VERSION","formatConfigurationScriptPath","projectRoot","buildScriptPath","resolveFrom","silent","Error","relativePath","path","relative","join","process","platform","replace","getBundleReactNativePhase","project","shellScriptBuildPhase","hash","objects","PBXShellScriptBuildPhase","bundleReactNative","Object","values","find","buildPhase","name","ensureBundleReactNativePhaseContainsConfigurationScript","buildPhaseShellScriptPath","isShellScriptBuildPhaseConfigured","shellScript","includes","RegExp","isPlistConfigurationSet","Boolean","EXUpdatesURL","EXUpdatesSDKVersion","EXUpdatesRuntimeVersion","isPlistConfigurationSynced","EXUpdatesEnabled","EXUpdatesLaunchWaitMs","EXUpdatesCheckOnLaunch","isPlistVersionConfigurationSynced","expectedRuntimeVersion","expectedSdkVersion","currentRuntimeVersion","currentSdkVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAGA,MAAMA,wBAAwB,GAAG,6CAAjC;IAEYC,M;;;WAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;AAAAA,EAAAA,M;GAAAA,M,sBAAAA,M;;AAWL,SAASC,aAAT,CAAuBC,MAAvB,EAAqF;AAC1F,SAAO,OAAOA,MAAM,CAACC,UAAd,KAA6B,QAA7B,GAAwCD,MAAM,CAACC,UAA/C,GAA4D,IAAnE;AACD;;AAEM,SAASC,iBAAT,CAA2BF,MAA3B,EAAgF;AAAA;;AACrF,SAAO,oBAAAA,MAAM,CAACG,OAAP,oEAAgBC,OAAhB,MAA4B,KAAnC;AACD;;AAEM,SAASC,iBAAT,CAA2BL,MAA3B,EAAuE;AAAA;;AAC5E,sDAAOA,MAAM,CAACG,OAAd,qDAAO,iBAAgBG,sBAAvB,yEAAiD,CAAjD;AACD;;AAEM,SAASC,uBAAT,CACLP,MADK,E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YAAV,KAA2B7C,SAAS,CAAC8C,mBAAV,IAAiC9C,SAAS,CAAC+C,uBAAtE,CADY,CAAd;AAGD;;AAEM,SAASC,0BAAT,CACL7D,MADK,EAELa,SAFK,EAGLC,QAHK,EAII;AACT,SACE,6BAAad,MAAb,EAAqBc,QAArB,MAAmCD,SAAS,CAAC6C,YAA7C,IACAxD,iBAAiB,CAACF,MAAD,CAAjB,KAA8Ba,SAAS,CAACiD,gBADxC,IAEAzD,iBAAiB,CAACL,MAAD,CAAjB,KAA8Ba,SAAS,CAACkD,qBAFxC,IAGAxD,uBAAuB,CAACP,MAAD,CAAvB,KAAoCa,SAAS,CAACmD,sBAH9C,IAIAC,iCAAiC,CAACjE,MAAD,EAASa,SAAT,CALnC;AAOD;;AAEM,SAASoD,iCAAT,CACLjE,MADK,EAELa,SAFK,EAGI;AAAA;;AACT,QAAMqD,sBAAsB,GAAG,0CAA0BlE,MAA1B,EAAkC,KAAlC,CAA/B;AACA,QAAMmE,kBAAkB,GAAGpE,aAAa,CAACC,MAAD,CAAxC;AAEA,QAAMoE,qBAAqB,4BAAGvD,SAAS,CAAC+C,uBAAb,yEAAwC,IAAnE;AACA,QAAMS,iBAAiB,4BAAGxD,SAAS,CAAC8C,mBAAb,yEAAoC,IAA3D;;AAEA,MAAIO,sBAAsB,KAAK,IAA/B,EAAqC;AACnC,WAAOE,qBAAqB,KAAKF,sBAA1B,IAAoDG,iBAAiB,KAAK,IAAjF;AACD,GAFD,MAEO,IAAIF,kBAAkB,KAAK,IAA3B,EAAiC;AACtC,WAAOE,iBAAiB,KAAKF,kBAAtB,IAA4CC,qBAAqB,KAAK,IAA7E;AACD,GAFM,MAEA;AACL,WAAO,IAAP;AACD;AACF","sourcesContent":["import * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport xcode from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport { ExpoConfigUpdates, getRuntimeVersionNullable, getUpdateUrl } from '../utils/Updates';\nimport { ExpoPlist } from './IosConfig.types';\n\nconst CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n SDK_VERSION = 'EXUpdatesSDKVersion',\n UPDATE_URL = 'EXUpdatesURL',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n return config.updates?.enabled !== false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>) {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): 'NEVER' | 'ALWAYS' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n }\n return 'ALWAYS';\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withExpoPlist(config, config => {\n config.modResults = setUpdatesConfig(config, config.modResults, expoUsername);\n return config;\n });\n};\n\nexport function setUpdatesConfig(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): ExpoPlist {\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config),\n [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config),\n };\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n return setVersionsConfig(config, newExpoPlist);\n}\n\nexport function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = getRuntimeVersionNullable(config, 'ios');\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n delete newExpoPlist[Config.SDK_VERSION];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else if (sdkVersion) {\n /**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\n delete newExpoPlist[Config.RUNTIME_VERSION];\n newExpoPlist[Config.SDK_VERSION] = sdkVersion;\n } else {\n delete newExpoPlist[Config.SDK_VERSION];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n\nfunction formatConfigurationScriptPath(projectRoot: string): string {\n const buildScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);\n\n if (!buildScriptPath) {\n throw new Error(\n \"Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);\n return process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n}\n\ninterface ShellScriptBuildPhase {\n isa: 'PBXShellScriptBuildPhase';\n name: string;\n shellScript: string;\n [key: string]: any;\n}\n\nexport function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase {\n const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase as Record<\n string,\n ShellScriptBuildPhase\n >;\n const bundleReactNative = Object.values(shellScriptBuildPhase).find(\n buildPhase => buildPhase.name === '\"Bundle React Native code and images\"'\n );\n\n if (!bundleReactNative) {\n throw new Error(`Couldn't find a build phase \"Bundle React Native code and images\"`);\n }\n\n return bundleReactNative;\n}\n\nexport function ensureBundleReactNativePhaseContainsConfigurationScript(\n projectRoot: string,\n project: xcode.XcodeProject\n): xcode.XcodeProject {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n\n if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {\n // check if there's already another path to create-manifest-ios.sh\n // this might be the case for monorepos\n if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {\n bundleReactNative.shellScript = bundleReactNative.shellScript.replace(\n new RegExp(`(\\\\\\\\n)(\\\\.\\\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`),\n ''\n );\n }\n bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(\n /\"$/,\n ''\n )}${buildPhaseShellScriptPath}\\\\n\"`;\n }\n return project;\n}\n\nexport function isShellScriptBuildPhaseConfigured(\n projectRoot: string,\n project: xcode.XcodeProject\n): boolean {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);\n}\n\nexport function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean {\n return Boolean(\n expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion)\n );\n}\n\nexport function isPlistConfigurationSynced(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&\n getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&\n getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&\n getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&\n isPlistVersionConfigurationSynced(config, expoPlist)\n );\n}\n\nexport function isPlistVersionConfigurationSynced(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n expoPlist: ExpoPlist\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config, 'ios');\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = expoPlist.EXUpdatesRuntimeVersion ?? null;\n const currentSdkVersion = expoPlist.EXUpdatesSDKVersion ?? null;\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"file":"Updates.js"}
1
+ {"version":3,"sources":["../../src/ios/Updates.ts"],"names":["CREATE_MANIFEST_IOS_PATH","Config","getSDKVersion","config","sdkVersion","getUpdatesEnabled","updates","enabled","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","expoUpdatesPackageVersion","checkAutomatically","semver","gte","withUpdates","expoUsername","modRequest","projectRoot","modResults","setUpdatesConfig","expoPlist","username","newExpoPlist","ENABLED","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","updateUrl","UPDATE_URL","setVersionsConfig","runtimeVersion","SDK_VERSION","RUNTIME_VERSION","formatConfigurationScriptPath","buildScriptPath","resolveFrom","silent","Error","relativePath","path","relative","join","process","platform","replace","getBundleReactNativePhase","project","shellScriptBuildPhase","hash","objects","PBXShellScriptBuildPhase","bundleReactNative","Object","values","find","buildPhase","name","ensureBundleReactNativePhaseContainsConfigurationScript","buildPhaseShellScriptPath","isShellScriptBuildPhaseConfigured","shellScript","includes","RegExp","isPlistConfigurationSet","Boolean","EXUpdatesURL","EXUpdatesSDKVersion","EXUpdatesRuntimeVersion","isPlistConfigurationSynced","EXUpdatesEnabled","EXUpdatesLaunchWaitMs","EXUpdatesCheckOnLaunch","isPlistVersionConfigurationSynced","expectedRuntimeVersion","expectedSdkVersion","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2B5C,SAAS,CAAC6C,mBAAV,IAAiC7C,SAAS,CAAC8C,uBAAtE,CADY,CAAd;AAGD;;AAEM,SAASC,0BAAT,CACLjE,MADK,EAELkB,SAFK,EAGLC,QAHK,EAII;AACT,SACE,6BAAanB,MAAb,EAAqBmB,QAArB,MAAmCD,SAAS,CAAC4C,YAA7C,IACA5D,iBAAiB,CAACF,MAAD,CAAjB,KAA8BkB,SAAS,CAACgD,gBADxC,IAEA7D,iBAAiB,CAACL,MAAD,CAAjB,KAA8BkB,SAAS,CAACiD,qBAFxC,IAGA5D,uBAAuB,CAACP,MAAD,CAAvB,KAAoCkB,SAAS,CAACkD,sBAH9C,IAIAC,iCAAiC,CAACrE,MAAD,EAASkB,SAAT,CALnC;AAOD;;AAEM,SAASmD,iCAAT,CACLrE,MADK,EAELkB,SAFK,EAGI;AAAA;;AACT,QAAMoD,sBAAsB,GAAG,0CAA0BtE,MAA1B,EAAkC,KAAlC,CAA/B;AACA,QAAMuE,kBAAkB,GAAGxE,aAAa,CAACC,MAAD,CAAxC;AAEA,QAAMwE,qBAAqB,4BAAGtD,SAAS,CAAC8C,uBAAb,yEAAwC,IAAnE;AACA,QAAMS,iBAAiB,4BAAGvD,SAAS,CAAC6C,mBAAb,yEAAoC,IAA3D;;AAEA,MAAIO,sBAAsB,KAAK,IAA/B,EAAqC;AACnC,WAAOE,qBAAqB,KAAKF,sBAA1B,IAAoDG,iBAAiB,KAAK,IAAjF;AACD,GAFD,MAEO,IAAIF,kBAAkB,KAAK,IAA3B,EAAiC;AACtC,WAAOE,iBAAiB,KAAKF,kBAAtB,IAA4CC,qBAAqB,KAAK,IAA7E;AACD,GAFM,MAEA;AACL,WAAO,IAAP;AACD;AACF","sourcesContent":["import * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\nimport xcode from 'xcode';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport {\n ExpoConfigUpdates,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullable,\n getUpdateUrl,\n} from '../utils/Updates';\nimport { ExpoPlist } from './IosConfig.types';\n\nconst CREATE_MANIFEST_IOS_PATH = 'expo-updates/scripts/create-manifest-ios.sh';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n SDK_VERSION = 'EXUpdatesSDKVersion',\n UPDATE_URL = 'EXUpdatesURL',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n return config.updates?.enabled !== false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>) {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>,\n expoUpdatesPackageVersion?: string | null\n): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n // native 'ERROR_RECOVERY_ONLY' option was only introduced in 0.11.x\n if (expoUpdatesPackageVersion && semver.gte(expoUpdatesPackageVersion, '0.11.0')) {\n return 'ERROR_RECOVERY_ONLY';\n }\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n }\n return 'ALWAYS';\n}\n\nexport const withUpdates: ConfigPlugin<{ expoUsername: string | null }> = (\n config,\n { expoUsername }\n) => {\n return withExpoPlist(config, config => {\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(config.modRequest.projectRoot);\n config.modResults = setUpdatesConfig(\n config,\n config.modResults,\n expoUsername,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nexport function setUpdatesConfig(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null,\n expoUpdatesPackageVersion?: string | null\n): ExpoPlist {\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion),\n [Config.LAUNCH_WAIT_MS]: getUpdatesTimeout(config),\n };\n\n const updateUrl = getUpdateUrl(config, username);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n return setVersionsConfig(config, newExpoPlist);\n}\n\nexport function setVersionsConfig(config: ExpoConfigUpdates, expoPlist: ExpoPlist): ExpoPlist {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = getRuntimeVersionNullable(config, 'ios');\n const sdkVersion = getSDKVersion(config);\n if (runtimeVersion) {\n delete newExpoPlist[Config.SDK_VERSION];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else if (sdkVersion) {\n /**\n * runtime version maybe null in projects using classic updates. In that\n * case we use SDK version\n */\n delete newExpoPlist[Config.RUNTIME_VERSION];\n newExpoPlist[Config.SDK_VERSION] = sdkVersion;\n } else {\n delete newExpoPlist[Config.SDK_VERSION];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n\nfunction formatConfigurationScriptPath(projectRoot: string): string {\n const buildScriptPath = resolveFrom.silent(projectRoot, CREATE_MANIFEST_IOS_PATH);\n\n if (!buildScriptPath) {\n throw new Error(\n \"Could not find the build script for iOS. This could happen in case of outdated 'node_modules'. Run 'npm install' to make sure that it's up-to-date.\"\n );\n }\n\n const relativePath = path.relative(path.join(projectRoot, 'ios'), buildScriptPath);\n return process.platform === 'win32' ? relativePath.replace(/\\\\/g, '/') : relativePath;\n}\n\ninterface ShellScriptBuildPhase {\n isa: 'PBXShellScriptBuildPhase';\n name: string;\n shellScript: string;\n [key: string]: any;\n}\n\nexport function getBundleReactNativePhase(project: xcode.XcodeProject): ShellScriptBuildPhase {\n const shellScriptBuildPhase = project.hash.project.objects.PBXShellScriptBuildPhase as Record<\n string,\n ShellScriptBuildPhase\n >;\n const bundleReactNative = Object.values(shellScriptBuildPhase).find(\n buildPhase => buildPhase.name === '\"Bundle React Native code and images\"'\n );\n\n if (!bundleReactNative) {\n throw new Error(`Couldn't find a build phase \"Bundle React Native code and images\"`);\n }\n\n return bundleReactNative;\n}\n\nexport function ensureBundleReactNativePhaseContainsConfigurationScript(\n projectRoot: string,\n project: xcode.XcodeProject\n): xcode.XcodeProject {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n\n if (!isShellScriptBuildPhaseConfigured(projectRoot, project)) {\n // check if there's already another path to create-manifest-ios.sh\n // this might be the case for monorepos\n if (bundleReactNative.shellScript.includes(CREATE_MANIFEST_IOS_PATH)) {\n bundleReactNative.shellScript = bundleReactNative.shellScript.replace(\n new RegExp(`(\\\\\\\\n)(\\\\.\\\\.)+/node_modules/${CREATE_MANIFEST_IOS_PATH}`),\n ''\n );\n }\n bundleReactNative.shellScript = `${bundleReactNative.shellScript.replace(\n /\"$/,\n ''\n )}${buildPhaseShellScriptPath}\\\\n\"`;\n }\n return project;\n}\n\nexport function isShellScriptBuildPhaseConfigured(\n projectRoot: string,\n project: xcode.XcodeProject\n): boolean {\n const bundleReactNative = getBundleReactNativePhase(project);\n const buildPhaseShellScriptPath = formatConfigurationScriptPath(projectRoot);\n return bundleReactNative.shellScript.includes(buildPhaseShellScriptPath);\n}\n\nexport function isPlistConfigurationSet(expoPlist: ExpoPlist): boolean {\n return Boolean(\n expoPlist.EXUpdatesURL && (expoPlist.EXUpdatesSDKVersion || expoPlist.EXUpdatesRuntimeVersion)\n );\n}\n\nexport function isPlistConfigurationSynced(\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n username: string | null\n): boolean {\n return (\n getUpdateUrl(config, username) === expoPlist.EXUpdatesURL &&\n getUpdatesEnabled(config) === expoPlist.EXUpdatesEnabled &&\n getUpdatesTimeout(config) === expoPlist.EXUpdatesLaunchWaitMs &&\n getUpdatesCheckOnLaunch(config) === expoPlist.EXUpdatesCheckOnLaunch &&\n isPlistVersionConfigurationSynced(config, expoPlist)\n );\n}\n\nexport function isPlistVersionConfigurationSynced(\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n expoPlist: ExpoPlist\n): boolean {\n const expectedRuntimeVersion = getRuntimeVersionNullable(config, 'ios');\n const expectedSdkVersion = getSDKVersion(config);\n\n const currentRuntimeVersion = expoPlist.EXUpdatesRuntimeVersion ?? null;\n const currentSdkVersion = expoPlist.EXUpdatesSDKVersion ?? null;\n\n if (expectedRuntimeVersion !== null) {\n return currentRuntimeVersion === expectedRuntimeVersion && currentSdkVersion === null;\n } else if (expectedSdkVersion !== null) {\n return currentSdkVersion === expectedSdkVersion && currentRuntimeVersion === null;\n } else {\n return true;\n }\n}\n"],"file":"Updates.js"}
@@ -0,0 +1 @@
1
+ export declare function trimQuotes(s: string): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.trimQuotes = trimQuotes;
7
+
8
+ function trimQuotes(s) {
9
+ return s && s[0] === '"' && s[s.length - 1] === '"' ? s.slice(1, -1) : s;
10
+ }
11
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ios/utils/string.ts"],"names":["trimQuotes","s","length","slice"],"mappings":";;;;;;;AAAO,SAASA,UAAT,CAAoBC,CAApB,EAAuC;AAC5C,SAAOA,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAD,KAAS,GAAd,IAAqBA,CAAC,CAACA,CAAC,CAACC,MAAF,GAAW,CAAZ,CAAD,KAAoB,GAAzC,GAA+CD,CAAC,CAACE,KAAF,CAAQ,CAAR,EAAW,CAAC,CAAZ,CAA/C,GAAgEF,CAAvE;AACD","sourcesContent":["export function trimQuotes(s: string): string {\n return s && s[0] === '\"' && s[s.length - 1] === '\"' ? s.slice(1, -1) : s;\n}\n"],"file":"string.js"}
@@ -1,5 +1,6 @@
1
1
  import { Android, ExpoConfig, IOS } from '@expo/config-types';
2
2
  export declare type ExpoConfigUpdates = Pick<ExpoConfig, 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'>;
3
+ export declare function getExpoUpdatesPackageVersion(projectRoot: string): string | null;
3
4
  export declare function getUpdateUrl(config: Pick<ExpoConfigUpdates, 'owner' | 'slug' | 'updates'>, username: string | null): string | null;
4
5
  export declare function getNativeVersion(config: Pick<ExpoConfig, 'version'> & {
5
6
  android?: Pick<Android, 'versionCode'>;
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getExpoUpdatesPackageVersion = getExpoUpdatesPackageVersion;
6
7
  exports.getNativeVersion = getNativeVersion;
7
8
  exports.getRuntimeVersion = getRuntimeVersion;
8
9
  exports.getRuntimeVersionNullable = getRuntimeVersionNullable;
@@ -19,6 +20,16 @@ function _sdkRuntimeVersions() {
19
20
  return data;
20
21
  }
21
22
 
23
+ function _fs() {
24
+ const data = _interopRequireDefault(require("fs"));
25
+
26
+ _fs = function () {
27
+ return data;
28
+ };
29
+
30
+ return data;
31
+ }
32
+
22
33
  function _getenv() {
23
34
  const data = require("getenv");
24
35
 
@@ -29,6 +40,16 @@ function _getenv() {
29
40
  return data;
30
41
  }
31
42
 
43
+ function _resolveFrom() {
44
+ const data = _interopRequireDefault(require("resolve-from"));
45
+
46
+ _resolveFrom = function () {
47
+ return data;
48
+ };
49
+
50
+ return data;
51
+ }
52
+
32
53
  function _() {
33
54
  const data = require("..");
34
55
 
@@ -39,6 +60,19 @@ function _() {
39
60
  return data;
40
61
  }
41
62
 
63
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
64
+
65
+ function getExpoUpdatesPackageVersion(projectRoot) {
66
+ const expoUpdatesPackageJsonPath = _resolveFrom().default.silent(projectRoot, 'expo-updates/package.json');
67
+
68
+ if (!expoUpdatesPackageJsonPath || !_fs().default.existsSync(expoUpdatesPackageJsonPath)) {
69
+ return null;
70
+ }
71
+
72
+ const packageJson = JSON.parse(_fs().default.readFileSync(expoUpdatesPackageJsonPath, 'utf8'));
73
+ return packageJson.version;
74
+ }
75
+
42
76
  function getUpdateUrl(config, username) {
43
77
  var _config$updates;
44
78
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/Updates.ts"],"names":["getUpdateUrl","config","username","updates","url","user","owner","slug","getNativeVersion","platform","version","IOSConfig","Version","getVersion","buildNumber","getBuildNumber","versionCode","AndroidConfig","getVersionCode","Error","withRuntimeVersion","ios","runtimeVersion","getRuntimeVersion","android","getRuntimeVersionNullable","e","console","log","policy","sdkVersion","JSON","stringify"],"mappings":";;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAOO,SAASA,YAAT,CACLC,MADK,EAELC,QAFK,EAGU;AAAA;;AACf,yBAAID,MAAM,CAACE,OAAX,4CAAI,gBAAgBC,GAApB,EAAyB;AAAA;;AACvB,+BAAOH,MAAM,CAACE,OAAd,qDAAO,iBAAgBC,GAAvB;AACD;;AAED,QAAMC,IAAI,GAAG,OAAOJ,MAAM,CAACK,KAAd,KAAwB,QAAxB,GAAmCL,MAAM,CAACK,KAA1C,GAAkDJ,QAA/D;;AACA,MAAI,CAACG,IAAL,EAAW;AACT,WAAO,IAAP;AACD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;;;AAiBA,SAASwB,yBAAT,CACL,GAAG,CAACxB,MAAD,EAASQ,QAAT,CADE,EAEU;AACf,MAAI;AACF,WAAOc,iBAAiB,CAACtB,MAAD,EAASQ,QAAT,CAAxB;AACD,GAFD,CAEE,OAAOiB,CAAP,EAAU;AACV,QAAI,uBAAQ,YAAR,EAAsB,KAAtB,CAAJ,EAAkC;AAChCC,MAAAA,OAAO,CAACC,GAAR,CAAYF,CAAZ;AACD;;AACD,WAAO,IAAP;AACD;AACF;;AAEM,SAASH,iBAAT,CACLtB,MADK,EAKLQ,QALK,EAMG;AAAA;;AACR,QAAMa,cAAc,gDAAGrB,MAAM,CAACQ,QAAD,CAAT,qDAAG,iBAAkBa,cAArB,yEAAuCrB,MAAM,CAACqB,cAAlE;;AACA,MAAI,CAACA,cAAL,EAAqB;AACnB,UAAM,IAAIH,KAAJ,CACH,wEAAuEV,QAAS,GAD7E,CAAN;AAGD;;AAED,MAAI,OAAOa,cAAP,KAA0B,QAA9B,EAAwC;AACtC,WAAOA,cAAP;AACD,GAFD,MAEO,IAAIA,cAAc,CAACO,MAAf,KAA0B,eAA9B,EAA+C;AACpD,WAAOrB,gBAAgB,CAACP,MAAD,EAASQ,QAAT,CAAvB;AACD,GAFM,MAEA,IAAIa,cAAc,CAACO,MAAf,KAA0B,YAA9B,EAA4C;AACjD,QAAI,CAAC5B,MAAM,CAAC6B,UAAZ,EAAwB;AACtB,YAAM,IAAIX,KAAJ,CAAU,4EAAV,CAAN;AACD;;AACD,WAAO,0DAA+BlB,MAAM,CAAC6B,UAAtC,CAAP;AACD;;AAED,QAAM,IAAIX,KAAJ,CACH,IACC,OAAOG,cAAP,KAA0B,QAA1B,GAAqCS,IAAI,CAACC,SAAL,CAAeV,cAAf,CAArC,GAAsEA,cACvE,sHAHG,CAAN;AAKD","sourcesContent":["import { Android, ExpoConfig, IOS } from '@expo/config-types';\nimport { getRuntimeVersionForSDKVersion } from '@expo/sdk-runtime-versions';\nimport { boolish } from 'getenv';\n\nimport { AndroidConfig, IOSConfig } from '..';\n\nexport type ExpoConfigUpdates = Pick<\n ExpoConfig,\n 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'\n>;\n\nexport function getUpdateUrl(\n config: Pick<ExpoConfigUpdates, 'owner' | 'slug' | 'updates'>,\n username: string | null\n): string | null {\n if (config.updates?.url) {\n return config.updates?.url;\n }\n\n const user = typeof config.owner === 'string' ? config.owner : username;\n if (!user) {\n return null;\n }\n return `https://exp.host/@${user}/${config.slug}`;\n}\n\nexport function getNativeVersion(\n config: Pick<ExpoConfig, 'version'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): string {\n const version = IOSConfig.Version.getVersion(config);\n switch (platform) {\n case 'ios': {\n const buildNumber = IOSConfig.Version.getBuildNumber(config);\n return `${version}(${buildNumber})`;\n }\n case 'android': {\n const versionCode = AndroidConfig.Version.getVersionCode(config);\n return `${version}(${versionCode})`;\n }\n default: {\n throw new Error(\n `\"${platform}\" is not a supported platform. Choose either \"ios\" or \"android\".`\n );\n }\n }\n}\n\n/**\n * Compute runtime version policies.\n * @return an expoConfig with only string valued platform specific runtime versions.\n */\nexport const withRuntimeVersion: (config: ExpoConfig) => ExpoConfig = config => {\n if (config.ios?.runtimeVersion || config.runtimeVersion) {\n config.ios = {\n ...config.ios,\n runtimeVersion: getRuntimeVersion(config, 'ios'),\n };\n }\n if (config.android?.runtimeVersion || config.runtimeVersion) {\n config.android = {\n ...config.android,\n runtimeVersion: getRuntimeVersion(config, 'android'),\n };\n }\n delete config.runtimeVersion;\n return config;\n};\n\nexport function getRuntimeVersionNullable(\n ...[config, platform]: Parameters<typeof getRuntimeVersion>\n): string | null {\n try {\n return getRuntimeVersion(config, platform);\n } catch (e) {\n if (boolish('EXPO_DEBUG', false)) {\n console.log(e);\n }\n return null;\n }\n}\n\nexport function getRuntimeVersion(\n config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;\n ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;\n },\n platform: 'android' | 'ios'\n): string {\n const runtimeVersion = config[platform]?.runtimeVersion ?? config.runtimeVersion;\n if (!runtimeVersion) {\n throw new Error(\n `There is neither a value or a policy set for the runtime version on \"${platform}\"`\n );\n }\n\n if (typeof runtimeVersion === 'string') {\n return runtimeVersion;\n } else if (runtimeVersion.policy === 'nativeVersion') {\n return getNativeVersion(config, platform);\n } else if (runtimeVersion.policy === 'sdkVersion') {\n if (!config.sdkVersion) {\n throw new Error(\"An SDK version must be defined when using the 'sdkVersion' runtime policy.\");\n }\n return getRuntimeVersionForSDKVersion(config.sdkVersion);\n }\n\n throw new Error(\n `\"${\n typeof runtimeVersion === 'object' ? JSON.stringify(runtimeVersion) : runtimeVersion\n }\" is not a valid runtime version. getRuntimeVersion only supports a string, \"sdkVersion\", or \"nativeVersion\" policy.`\n );\n}\n"],"file":"Updates.js"}
1
+ {"version":3,"sources":["../../src/utils/Updates.ts"],"names":["getExpoUpdatesPackageVersion","projectRoot","expoUpdatesPackageJsonPath","resolveFrom","silent","fs","existsSync","packageJson","JSON","parse","readFileSync","version","getUpdateUrl","config","username","updates","url","user","owner","slug","getNativeVersion","platform","IOSConfig","Version","getVersion","buildNumber","getBuildNumber","versionCode","AndroidConfig","getVersionCode","Error","withRuntimeVersion","ios","runtimeVersion","getRuntimeVersion","android","getRuntimeVersionNullable","e","console","log","policy","sdkVersion","stringify"],"mappings":";;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAOO,SAASA,4BAAT,CAAsCC,WAAtC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uET,QAAS,GAD7E,CAAN;AAGD;;AAED,MAAI,OAAOY,cAAP,KAA0B,QAA9B,EAAwC;AACtC,WAAOA,cAAP;AACD,GAFD,MAEO,IAAIA,cAAc,CAACO,MAAf,KAA0B,eAA9B,EAA+C;AACpD,WAAOpB,gBAAgB,CAACP,MAAD,EAASQ,QAAT,CAAvB;AACD,GAFM,MAEA,IAAIY,cAAc,CAACO,MAAf,KAA0B,YAA9B,EAA4C;AACjD,QAAI,CAAC3B,MAAM,CAAC4B,UAAZ,EAAwB;AACtB,YAAM,IAAIX,KAAJ,CAAU,4EAAV,CAAN;AACD;;AACD,WAAO,0DAA+BjB,MAAM,CAAC4B,UAAtC,CAAP;AACD;;AAED,QAAM,IAAIX,KAAJ,CACH,IACC,OAAOG,cAAP,KAA0B,QAA1B,GAAqCzB,IAAI,CAACkC,SAAL,CAAeT,cAAf,CAArC,GAAsEA,cACvE,sHAHG,CAAN;AAKD","sourcesContent":["import { Android, ExpoConfig, IOS } from '@expo/config-types';\nimport { getRuntimeVersionForSDKVersion } from '@expo/sdk-runtime-versions';\nimport fs from 'fs';\nimport { boolish } from 'getenv';\nimport resolveFrom from 'resolve-from';\n\nimport { AndroidConfig, IOSConfig } from '..';\n\nexport type ExpoConfigUpdates = Pick<\n ExpoConfig,\n 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'\n>;\n\nexport function getExpoUpdatesPackageVersion(projectRoot: string): string | null {\n const expoUpdatesPackageJsonPath = resolveFrom.silent(projectRoot, 'expo-updates/package.json');\n if (!expoUpdatesPackageJsonPath || !fs.existsSync(expoUpdatesPackageJsonPath)) {\n return null;\n }\n const packageJson = JSON.parse(fs.readFileSync(expoUpdatesPackageJsonPath, 'utf8'));\n return packageJson.version;\n}\n\nexport function getUpdateUrl(\n config: Pick<ExpoConfigUpdates, 'owner' | 'slug' | 'updates'>,\n username: string | null\n): string | null {\n if (config.updates?.url) {\n return config.updates?.url;\n }\n\n const user = typeof config.owner === 'string' ? config.owner : username;\n if (!user) {\n return null;\n }\n return `https://exp.host/@${user}/${config.slug}`;\n}\n\nexport function getNativeVersion(\n config: Pick<ExpoConfig, 'version'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): string {\n const version = IOSConfig.Version.getVersion(config);\n switch (platform) {\n case 'ios': {\n const buildNumber = IOSConfig.Version.getBuildNumber(config);\n return `${version}(${buildNumber})`;\n }\n case 'android': {\n const versionCode = AndroidConfig.Version.getVersionCode(config);\n return `${version}(${versionCode})`;\n }\n default: {\n throw new Error(\n `\"${platform}\" is not a supported platform. Choose either \"ios\" or \"android\".`\n );\n }\n }\n}\n\n/**\n * Compute runtime version policies.\n * @return an expoConfig with only string valued platform specific runtime versions.\n */\nexport const withRuntimeVersion: (config: ExpoConfig) => ExpoConfig = config => {\n if (config.ios?.runtimeVersion || config.runtimeVersion) {\n config.ios = {\n ...config.ios,\n runtimeVersion: getRuntimeVersion(config, 'ios'),\n };\n }\n if (config.android?.runtimeVersion || config.runtimeVersion) {\n config.android = {\n ...config.android,\n runtimeVersion: getRuntimeVersion(config, 'android'),\n };\n }\n delete config.runtimeVersion;\n return config;\n};\n\nexport function getRuntimeVersionNullable(\n ...[config, platform]: Parameters<typeof getRuntimeVersion>\n): string | null {\n try {\n return getRuntimeVersion(config, platform);\n } catch (e) {\n if (boolish('EXPO_DEBUG', false)) {\n console.log(e);\n }\n return null;\n }\n}\n\nexport function getRuntimeVersion(\n config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;\n ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;\n },\n platform: 'android' | 'ios'\n): string {\n const runtimeVersion = config[platform]?.runtimeVersion ?? config.runtimeVersion;\n if (!runtimeVersion) {\n throw new Error(\n `There is neither a value or a policy set for the runtime version on \"${platform}\"`\n );\n }\n\n if (typeof runtimeVersion === 'string') {\n return runtimeVersion;\n } else if (runtimeVersion.policy === 'nativeVersion') {\n return getNativeVersion(config, platform);\n } else if (runtimeVersion.policy === 'sdkVersion') {\n if (!config.sdkVersion) {\n throw new Error(\"An SDK version must be defined when using the 'sdkVersion' runtime policy.\");\n }\n return getRuntimeVersionForSDKVersion(config.sdkVersion);\n }\n\n throw new Error(\n `\"${\n typeof runtimeVersion === 'object' ? JSON.stringify(runtimeVersion) : runtimeVersion\n }\" is not a valid runtime version. getRuntimeVersion only supports a string, \"sdkVersion\", or \"nativeVersion\" policy.`\n );\n}\n"],"file":"Updates.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/config-plugins",
3
- "version": "4.0.10",
3
+ "version": "4.0.14",
4
4
  "description": "A library for Expo config plugins",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -35,6 +35,7 @@
35
35
  "@expo/config-types": "^43.0.1",
36
36
  "@expo/json-file": "8.2.34",
37
37
  "@expo/plist": "0.0.16",
38
+ "@expo/sdk-runtime-versions": "^1.0.0",
38
39
  "@react-native/normalize-color": "^2.0.0",
39
40
  "chalk": "^4.1.2",
40
41
  "debug": "^4.3.1",
@@ -1 +0,0 @@
1
- export declare function resolvePackageRootFolder(fromDirectory: string, moduleId: string): string | null;
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolvePackageRootFolder = resolvePackageRootFolder;
7
-
8
- function _findUp() {
9
- const data = _interopRequireDefault(require("find-up"));
10
-
11
- _findUp = function () {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function path() {
19
- const data = _interopRequireWildcard(require("path"));
20
-
21
- path = function () {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _resolveFrom() {
29
- const data = _interopRequireDefault(require("resolve-from"));
30
-
31
- _resolveFrom = function () {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
-
40
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
-
42
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
-
44
- function resolvePackageRootFolder(fromDirectory, moduleId) {
45
- const resolved = _resolveFrom().default.silent(fromDirectory, moduleId);
46
-
47
- if (!resolved) return null; // Get the closest package.json to the node module
48
-
49
- const packageJson = _findUp().default.sync('package.json', {
50
- cwd: resolved
51
- });
52
-
53
- if (!packageJson) return null; // resolve the root folder for the node module
54
-
55
- return path().dirname(packageJson);
56
- }
57
- //# sourceMappingURL=resolvePackageRootFolder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/resolvePackageRootFolder.ts"],"names":["resolvePackageRootFolder","fromDirectory","moduleId","resolved","resolveFrom","silent","packageJson","findUp","sync","cwd","path","dirname"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAEO,SAASA,wBAAT,CAAkCC,aAAlC,EAAyDC,QAAzD,EAA0F;AAC/F,QAAMC,QAAQ,GAAGC,uBAAYC,MAAZ,CAAmBJ,aAAnB,EAAkCC,QAAlC,CAAjB;;AACA,MAAI,CAACC,QAAL,EAAe,OAAO,IAAP,CAFgF,CAG/F;;AACA,QAAMG,WAAW,GAAGC,kBAAOC,IAAP,CAAY,cAAZ,EAA4B;AAAEC,IAAAA,GAAG,EAAEN;AAAP,GAA5B,CAApB;;AACA,MAAI,CAACG,WAAL,EAAkB,OAAO,IAAP,CAL6E,CAM/F;;AACA,SAAOI,IAAI,GAACC,OAAL,CAAaL,WAAb,CAAP;AACD","sourcesContent":["import findUp from 'find-up';\nimport * as path from 'path';\nimport resolveFrom from 'resolve-from';\n\nexport function resolvePackageRootFolder(fromDirectory: string, moduleId: string): string | null {\n const resolved = resolveFrom.silent(fromDirectory, moduleId);\n if (!resolved) return null;\n // Get the closest package.json to the node module\n const packageJson = findUp.sync('package.json', { cwd: resolved });\n if (!packageJson) return null;\n // resolve the root folder for the node module\n return path.dirname(packageJson);\n}\n"],"file":"resolvePackageRootFolder.js"}