@expo/cli 0.1.3 → 0.1.4

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 (108) hide show
  1. package/build/bin/cli +8 -2
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/export/index.js +1 -0
  4. package/build/src/export/index.js.map +1 -1
  5. package/build/src/run/android/runAndroidAsync.js +3 -3
  6. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  7. package/build/src/run/ensureNativeProject.js +3 -0
  8. package/build/src/run/ensureNativeProject.js.map +1 -1
  9. package/build/src/run/hints.js +1 -1
  10. package/build/src/run/hints.js.map +1 -1
  11. package/build/src/run/ios/XcodeBuild.js +275 -0
  12. package/build/src/run/ios/XcodeBuild.js.map +1 -0
  13. package/build/src/run/ios/XcodeBuild.types.js +6 -0
  14. package/build/src/run/ios/XcodeBuild.types.js.map +1 -0
  15. package/build/src/run/ios/appleDevice/AppleDevice.js +161 -0
  16. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -0
  17. package/build/src/run/ios/appleDevice/ClientManager.js +161 -0
  18. package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -0
  19. package/build/src/run/ios/appleDevice/client/AFCClient.js +195 -0
  20. package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -0
  21. package/build/src/run/ios/appleDevice/client/DebugserverClient.js +107 -0
  22. package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -0
  23. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +97 -0
  24. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -0
  25. package/build/src/run/ios/appleDevice/client/LockdowndClient.js +140 -0
  26. package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -0
  27. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +91 -0
  28. package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -0
  29. package/build/src/run/ios/appleDevice/client/ServiceClient.js +21 -0
  30. package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -0
  31. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +117 -0
  32. package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -0
  33. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +90 -0
  34. package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -0
  35. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +332 -0
  36. package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -0
  37. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +115 -0
  38. package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -0
  39. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +126 -0
  40. package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -0
  41. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +74 -0
  42. package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -0
  43. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +65 -0
  44. package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -0
  45. package/build/src/run/ios/codeSigning/Security.js +85 -0
  46. package/build/src/run/ios/codeSigning/Security.js.map +1 -0
  47. package/build/src/run/ios/codeSigning/configureCodeSigning.js +77 -0
  48. package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -0
  49. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +102 -0
  50. package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -0
  51. package/build/src/run/ios/codeSigning/settings.js +21 -0
  52. package/build/src/run/ios/codeSigning/settings.js.map +1 -0
  53. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +76 -0
  54. package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -0
  55. package/build/src/run/ios/index.js +98 -0
  56. package/build/src/run/ios/index.js.map +1 -0
  57. package/build/src/run/ios/launchApp.js +75 -0
  58. package/build/src/run/ios/launchApp.js.map +1 -0
  59. package/build/src/run/ios/options/promptDevice.js +50 -0
  60. package/build/src/run/ios/options/promptDevice.js.map +1 -0
  61. package/build/src/run/ios/options/resolveDevice.js +92 -0
  62. package/build/src/run/ios/options/resolveDevice.js.map +1 -0
  63. package/build/src/run/ios/options/resolveNativeScheme.js +92 -0
  64. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -0
  65. package/build/src/run/ios/options/resolveOptions.js +44 -0
  66. package/build/src/run/ios/options/resolveOptions.js.map +1 -0
  67. package/build/src/run/ios/options/resolveXcodeProject.js +39 -0
  68. package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -0
  69. package/build/src/run/ios/runIosAsync.js +85 -0
  70. package/build/src/run/ios/runIosAsync.js.map +1 -0
  71. package/build/src/run/resolveBundlerProps.js +9 -6
  72. package/build/src/run/resolveBundlerProps.js.map +1 -1
  73. package/build/src/run/startBundler.js +4 -2
  74. package/build/src/run/startBundler.js.map +1 -1
  75. package/build/src/start/doctor/Prerequisite.js +4 -4
  76. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  77. package/build/src/start/doctor/SecurityBinPrerequisite.js +27 -0
  78. package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -0
  79. package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +69 -0
  80. package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -0
  81. package/build/src/start/platforms/android/emulator.js +8 -0
  82. package/build/src/start/platforms/android/emulator.js.map +1 -1
  83. package/build/src/start/platforms/android/promptAndroidDevice.js +1 -5
  84. package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
  85. package/build/src/start/platforms/ios/AppleDeviceManager.js +5 -1
  86. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  87. package/build/src/start/platforms/ios/promptAppleDevice.js +1 -5
  88. package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
  89. package/build/src/start/platforms/ios/simctl.js +14 -0
  90. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  91. package/build/src/start/platforms/ios/simctlLogging.js +220 -0
  92. package/build/src/start/platforms/ios/simctlLogging.js.map +1 -0
  93. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
  94. package/build/src/utils/analytics/rudderstackClient.js +30 -3
  95. package/build/src/utils/analytics/rudderstackClient.js.map +1 -1
  96. package/build/src/utils/cocoapods.js +47 -0
  97. package/build/src/utils/cocoapods.js.map +1 -1
  98. package/build/src/utils/dir.js +6 -1
  99. package/build/src/utils/dir.js.map +1 -1
  100. package/build/src/utils/plist.js +59 -0
  101. package/build/src/utils/plist.js.map +1 -0
  102. package/build/src/utils/prompts.js +16 -0
  103. package/build/src/utils/prompts.js.map +1 -1
  104. package/build/src/utils/resolveArgs.js +4 -1
  105. package/build/src/utils/resolveArgs.js.map +1 -1
  106. package/build/src/utils/terminal.js +10 -0
  107. package/build/src/utils/terminal.js.map +1 -0
  108. package/package.json +5 -5
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.getLastDeveloperCodeSigningIdAsync = getLastDeveloperCodeSigningIdAsync;
6
+ exports.setLastDeveloperCodeSigningIdAsync = setLastDeveloperCodeSigningIdAsync;
7
+ var _userSettings = _interopRequireDefault(require("../../../api/user/UserSettings"));
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
13
+ async function getLastDeveloperCodeSigningIdAsync() {
14
+ const { developmentCodeSigningId } = await _userSettings.default.readAsync();
15
+ return developmentCodeSigningId != null ? developmentCodeSigningId : null;
16
+ }
17
+ async function setLastDeveloperCodeSigningIdAsync(id) {
18
+ await _userSettings.default.setAsync("developmentCodeSigningId", id).catch(()=>{});
19
+ }
20
+
21
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/run/ios/codeSigning/settings.ts"],"sourcesContent":["import UserSettings from '../../../api/user/UserSettings';\n\n/** Get the cached code signing ID from the last time a user configured code signing via the CLI. */\nexport async function getLastDeveloperCodeSigningIdAsync(): Promise<string | null> {\n const { developmentCodeSigningId } = await UserSettings.readAsync();\n return developmentCodeSigningId ?? null;\n}\n\n/** Cache the code signing ID that the user chose for their project, we'll recommend this value for the next project they code sign. */\nexport async function setLastDeveloperCodeSigningIdAsync(id: string): Promise<void> {\n await UserSettings.setAsync('developmentCodeSigningId', id).catch(() => {});\n}\n"],"names":["getLastDeveloperCodeSigningIdAsync","setLastDeveloperCodeSigningIdAsync","developmentCodeSigningId","UserSettings","readAsync","id","setAsync","catch"],"mappings":"AAAA;;;;QAGsBA,kCAAkC,GAAlCA,kCAAkC;QAMlCC,kCAAkC,GAAlCA,kCAAkC;AAT/B,IAAA,aAAgC,kCAAhC,gCAAgC,EAAA;;;;;;AAGlD,eAAeD,kCAAkC,GAA2B;IACjF,MAAM,EAAEE,wBAAwB,CAAA,EAAE,GAAG,MAAMC,aAAY,QAAA,CAACC,SAAS,EAAE,AAAC;IACpE,OAAOF,wBAAwB,WAAxBA,wBAAwB,GAAI,IAAI,CAAC;CACzC;AAGM,eAAeD,kCAAkC,CAACI,EAAU,EAAiB;IAClF,MAAMF,aAAY,QAAA,CAACG,QAAQ,CAAC,0BAA0B,EAAED,EAAE,CAAC,CAACE,KAAK,CAAC,IAAM,EAAE,CAAC,CAAC;CAC7E"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.getCodeSigningInfoForPbxproj = getCodeSigningInfoForPbxproj;
6
+ exports.mutateXcodeProjectWithAutoCodeSigningInfo = mutateXcodeProjectWithAutoCodeSigningInfo;
7
+ exports.setAutoCodeSigningInfoForPbxproj = setAutoCodeSigningInfoForPbxproj;
8
+ var _configPlugins = require("@expo/config-plugins");
9
+ var _fs = _interopRequireDefault(require("fs"));
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : {
12
+ default: obj
13
+ };
14
+ }
15
+ function getCodeSigningInfoForPbxproj(projectRoot) {
16
+ const project = _configPlugins.IOSConfig.XcodeUtils.getPbxproj(projectRoot);
17
+ const targets = _configPlugins.IOSConfig.Target.findSignableTargets(project);
18
+ const signingInfo = {};
19
+ for (const [nativeTargetId, nativeTarget] of targets){
20
+ const developmentTeams = [];
21
+ const provisioningProfiles = [];
22
+ _configPlugins.IOSConfig.XcodeUtils.getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).filter(([, item])=>item.buildSettings.PRODUCT_NAME
23
+ ).forEach(([, item])=>{
24
+ const { DEVELOPMENT_TEAM , PROVISIONING_PROFILE } = item.buildSettings;
25
+ if (typeof DEVELOPMENT_TEAM === "string" && // If the user selects "Team: none" in Xcode, it'll be an empty string.
26
+ !!DEVELOPMENT_TEAM && // xcode package sometimes reads an empty string as a quoted empty string.
27
+ DEVELOPMENT_TEAM !== '""') {
28
+ developmentTeams.push(DEVELOPMENT_TEAM);
29
+ }
30
+ if (typeof PROVISIONING_PROFILE === "string" && !!PROVISIONING_PROFILE) {
31
+ provisioningProfiles.push(PROVISIONING_PROFILE);
32
+ }
33
+ });
34
+ signingInfo[nativeTargetId] = {
35
+ developmentTeams,
36
+ provisioningProfiles
37
+ };
38
+ }
39
+ return signingInfo;
40
+ }
41
+ function mutateXcodeProjectWithAutoCodeSigningInfo({ project , appleTeamId }) {
42
+ const targets = _configPlugins.IOSConfig.Target.findSignableTargets(project);
43
+ const quotedAppleTeamId = ensureQuotes(appleTeamId);
44
+ for (const [nativeTargetId, nativeTarget] of targets){
45
+ _configPlugins.IOSConfig.XcodeUtils.getBuildConfigurationsForListId(project, nativeTarget.buildConfigurationList).filter(([, item])=>item.buildSettings.PRODUCT_NAME
46
+ ).forEach(([, item])=>{
47
+ item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;
48
+ item.buildSettings.CODE_SIGN_IDENTITY = '"Apple Development"';
49
+ item.buildSettings.CODE_SIGN_STYLE = "Automatic";
50
+ });
51
+ Object.entries(_configPlugins.IOSConfig.XcodeUtils.getProjectSection(project)).filter(_configPlugins.IOSConfig.XcodeUtils.isNotComment).forEach(([, item])=>{
52
+ if (!item.attributes.TargetAttributes[nativeTargetId]) {
53
+ item.attributes.TargetAttributes[nativeTargetId] = {};
54
+ }
55
+ item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;
56
+ item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = "Automatic";
57
+ });
58
+ }
59
+ return project;
60
+ }
61
+ function setAutoCodeSigningInfoForPbxproj(projectRoot, { appleTeamId }) {
62
+ const project = _configPlugins.IOSConfig.XcodeUtils.getPbxproj(projectRoot);
63
+ mutateXcodeProjectWithAutoCodeSigningInfo({
64
+ project,
65
+ appleTeamId
66
+ });
67
+ _fs.default.writeFileSync(project.filepath, project.writeSync());
68
+ }
69
+ const ensureQuotes = (value)=>{
70
+ if (!value.match(/^['"]/)) {
71
+ return `"${value}"`;
72
+ }
73
+ return value;
74
+ };
75
+
76
+ //# sourceMappingURL=xcodeCodeSigning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/run/ios/codeSigning/xcodeCodeSigning.ts"],"sourcesContent":["import { IOSConfig, XcodeProject } from '@expo/config-plugins';\nimport fs from 'fs';\n\nexport type CodeSigningInfo = Record<\n string,\n {\n developmentTeams: string[];\n provisioningProfiles: string[];\n }\n>;\n\n/** Find the development team and provisioning profile that's currently in use by the Xcode project. */\nexport function getCodeSigningInfoForPbxproj(projectRoot: string): CodeSigningInfo {\n const project = IOSConfig.XcodeUtils.getPbxproj(projectRoot);\n const targets = IOSConfig.Target.findSignableTargets(project);\n\n const signingInfo: CodeSigningInfo = {};\n for (const [nativeTargetId, nativeTarget] of targets) {\n const developmentTeams: string[] = [];\n const provisioningProfiles: string[] = [];\n\n IOSConfig.XcodeUtils.getBuildConfigurationsForListId(\n project,\n nativeTarget.buildConfigurationList\n )\n .filter(\n ([, item]: IOSConfig.XcodeUtils.ConfigurationSectionEntry) =>\n item.buildSettings.PRODUCT_NAME\n )\n .forEach(([, item]: IOSConfig.XcodeUtils.ConfigurationSectionEntry) => {\n const { DEVELOPMENT_TEAM, PROVISIONING_PROFILE } = item.buildSettings;\n if (\n typeof DEVELOPMENT_TEAM === 'string' &&\n // If the user selects \"Team: none\" in Xcode, it'll be an empty string.\n !!DEVELOPMENT_TEAM &&\n // xcode package sometimes reads an empty string as a quoted empty string.\n DEVELOPMENT_TEAM !== '\"\"'\n ) {\n developmentTeams.push(DEVELOPMENT_TEAM);\n }\n if (typeof PROVISIONING_PROFILE === 'string' && !!PROVISIONING_PROFILE) {\n provisioningProfiles.push(PROVISIONING_PROFILE);\n }\n });\n signingInfo[nativeTargetId] = {\n developmentTeams,\n provisioningProfiles,\n };\n }\n\n return signingInfo;\n}\n\n/**\n * Set the development team and configure the Xcode project for automatic code signing,\n * this helps us resolve the code signing on subsequent runs and emulates Xcode behavior.\n *\n * @param props.project xcode project object from `xcode` package.\n * @param props.appleTeamId Apple Team ID to use for code signing.\n */\nexport function mutateXcodeProjectWithAutoCodeSigningInfo({\n project,\n appleTeamId,\n}: {\n project: XcodeProject;\n appleTeamId: string;\n}): XcodeProject {\n const targets = IOSConfig.Target.findSignableTargets(project);\n\n const quotedAppleTeamId = ensureQuotes(appleTeamId);\n\n for (const [nativeTargetId, nativeTarget] of targets) {\n IOSConfig.XcodeUtils.getBuildConfigurationsForListId(\n project,\n nativeTarget.buildConfigurationList\n )\n .filter(\n ([, item]: IOSConfig.XcodeUtils.ConfigurationSectionEntry) =>\n item.buildSettings.PRODUCT_NAME\n )\n .forEach(([, item]: IOSConfig.XcodeUtils.ConfigurationSectionEntry) => {\n item.buildSettings.DEVELOPMENT_TEAM = quotedAppleTeamId;\n item.buildSettings.CODE_SIGN_IDENTITY = '\"Apple Development\"';\n item.buildSettings.CODE_SIGN_STYLE = 'Automatic';\n });\n\n Object.entries(IOSConfig.XcodeUtils.getProjectSection(project))\n .filter(IOSConfig.XcodeUtils.isNotComment)\n .forEach(([, item]: IOSConfig.XcodeUtils.ProjectSectionEntry) => {\n if (!item.attributes.TargetAttributes[nativeTargetId]) {\n item.attributes.TargetAttributes[nativeTargetId] = {};\n }\n\n item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam = quotedAppleTeamId;\n item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle = 'Automatic';\n });\n }\n\n return project;\n}\n\n/**\n * Configures the Xcode project for automatic code signing and persists the results.\n */\nexport function setAutoCodeSigningInfoForPbxproj(\n projectRoot: string,\n { appleTeamId }: { appleTeamId: string }\n): void {\n const project = IOSConfig.XcodeUtils.getPbxproj(projectRoot);\n mutateXcodeProjectWithAutoCodeSigningInfo({ project, appleTeamId });\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"],"names":["getCodeSigningInfoForPbxproj","mutateXcodeProjectWithAutoCodeSigningInfo","setAutoCodeSigningInfoForPbxproj","projectRoot","project","IOSConfig","XcodeUtils","getPbxproj","targets","Target","findSignableTargets","signingInfo","nativeTargetId","nativeTarget","developmentTeams","provisioningProfiles","getBuildConfigurationsForListId","buildConfigurationList","filter","item","buildSettings","PRODUCT_NAME","forEach","DEVELOPMENT_TEAM","PROVISIONING_PROFILE","push","appleTeamId","quotedAppleTeamId","ensureQuotes","CODE_SIGN_IDENTITY","CODE_SIGN_STYLE","Object","entries","getProjectSection","isNotComment","attributes","TargetAttributes","DevelopmentTeam","ProvisioningStyle","fs","writeFileSync","filepath","writeSync","value","match"],"mappings":"AAAA;;;;QAYgBA,4BAA4B,GAA5BA,4BAA4B;QAgD5BC,yCAAyC,GAAzCA,yCAAyC;QA4CzCC,gCAAgC,GAAhCA,gCAAgC;AAxGR,IAAA,cAAs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,CAAC;YACrFR,IAAI,CAACgB,UAAU,CAACC,gBAAgB,CAACxB,cAAc,CAAC,CAAC0B,iBAAiB,GAAG,WAAW,CAAC;SAClF,CAAC,CAAC;KACN;IAED,OAAOlC,OAAO,CAAC;CAChB;AAKM,SAASF,gCAAgC,CAC9CC,WAAmB,EACnB,EAAEuB,WAAW,CAAA,EAA2B,EAClC;IACN,MAAMtB,OAAO,GAAGC,cAAS,UAAA,CAACC,UAAU,CAACC,UAAU,CAACJ,WAAW,CAAC,AAAC;IAC7DF,yCAAyC,CAAC;QAAEG,OAAO;QAAEsB,WAAW;KAAE,CAAC,CAAC;IAEpEa,GAAE,QAAA,CAACC,aAAa,CAACpC,OAAO,CAACqC,QAAQ,EAAErC,OAAO,CAACsC,SAAS,EAAE,CAAC,CAAC;CACzD;AAED,MAAMd,YAAY,GAAG,CAACe,KAAa,GAAK;IACtC,IAAI,CAACA,KAAK,CAACC,KAAK,SAAS,EAAE;QACzB,OAAO,CAAC,CAAC,EAAED,KAAK,CAAC,CAAC,CAAC,CAAC;KACrB;IACD,OAAOA,KAAK,CAAC;CACd,AAAC"}
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.expoRunIos = void 0;
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var _args = require("../../utils/args");
10
+ var _errors = require("../../utils/errors");
11
+ function _interopRequireDefault(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ function _interopRequireWildcard(obj) {
17
+ if (obj && obj.__esModule) {
18
+ return obj;
19
+ } else {
20
+ var newObj = {};
21
+ if (obj != null) {
22
+ for(var key in obj){
23
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
24
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
25
+ if (desc.get || desc.set) {
26
+ Object.defineProperty(newObj, key, desc);
27
+ } else {
28
+ newObj[key] = obj[key];
29
+ }
30
+ }
31
+ }
32
+ }
33
+ newObj.default = obj;
34
+ return newObj;
35
+ }
36
+ }
37
+ const expoRunIos = async (argv)=>{
38
+ const rawArgsMap = {
39
+ // Types
40
+ "--help": Boolean,
41
+ "--no-build-cache": Boolean,
42
+ "--no-install": Boolean,
43
+ "--no-bundler": Boolean,
44
+ "--configuration": String,
45
+ "--port": Number,
46
+ // Aliases
47
+ "-p": "--port",
48
+ "-h": "--help"
49
+ };
50
+ const args = (0, _args).assertWithOptionsArgs(rawArgsMap, {
51
+ argv,
52
+ permissive: true
53
+ });
54
+ // '-d' -> '--device': Boolean,
55
+ // '--scheme': String,
56
+ if (args["--help"]) {
57
+ (0, _args).printHelp(`Run the iOS app binary locally`, `npx expo run:ios`, [
58
+ `--no-build-cache Clear the native derived data before building`,
59
+ `--no-install Skip installing dependencies`,
60
+ `--no-bundler Skip starting the Metro bundler`,
61
+ `--scheme [scheme] Scheme to build`,
62
+ _chalk.default`--configuration <configuration> Xcode configuration to use. Debug or Release. {dim Default: Debug}`,
63
+ `-d, --device [device] Device name or UDID to build the app on`,
64
+ _chalk.default`-p, --port <port> Port to start the Metro bundler on. {dim Default: 8081}`,
65
+ `-h, --help Usage info`,
66
+ ].join("\n"), [
67
+ "",
68
+ _chalk.default` Build for production (unsigned) with the {bold Release} configuration:`,
69
+ _chalk.default` {dim $} npx expo run:ios --configuration Release`,
70
+ "",
71
+ ].join("\n"));
72
+ }
73
+ const { resolveStringOrBooleanArgsAsync } = await Promise.resolve().then(function() {
74
+ return _interopRequireWildcard(require("../../utils/resolveArgs"));
75
+ });
76
+ const parsed = await resolveStringOrBooleanArgsAsync(argv != null ? argv : [], rawArgsMap, {
77
+ "--scheme": Boolean,
78
+ "--device": Boolean,
79
+ "-d": "--device"
80
+ }).catch(_errors.logCmdError);
81
+ const { runIosAsync } = await Promise.resolve().then(function() {
82
+ return _interopRequireWildcard(require("./runIosAsync"));
83
+ });
84
+ return runIosAsync(_path.default.resolve(parsed.projectRoot), {
85
+ // Parsed options
86
+ buildCache: !args["--no-build-cache"],
87
+ install: !args["--no-install"],
88
+ bundler: !args["--no-bundler"],
89
+ port: args["--port"],
90
+ // Custom parsed args
91
+ device: parsed.args["--device"],
92
+ scheme: parsed.args["--scheme"],
93
+ configuration: parsed.args["--configuration"]
94
+ }).catch(_errors.logCmdError);
95
+ };
96
+ exports.expoRunIos = expoRunIos;
97
+
98
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/run/ios/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { Command } from '../../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../../utils/args';\nimport { logCmdError } from '../../utils/errors';\nimport { XcodeConfiguration } from './XcodeBuild.types';\n\nexport const expoRunIos: Command = async (argv) => {\n const rawArgsMap: arg.Spec = {\n // Types\n '--help': Boolean,\n '--no-build-cache': Boolean,\n '--no-install': Boolean,\n '--no-bundler': Boolean,\n '--configuration': String,\n\n '--port': Number,\n // Aliases\n '-p': '--port',\n\n '-h': '--help',\n };\n const args = assertWithOptionsArgs(rawArgsMap, {\n argv,\n\n permissive: true,\n });\n\n // '-d' -> '--device': Boolean,\n // '--scheme': String,\n\n if (args['--help']) {\n printHelp(\n `Run the iOS app binary locally`,\n `npx expo run:ios`,\n [\n `--no-build-cache Clear the native derived data before building`,\n `--no-install Skip installing dependencies`,\n `--no-bundler Skip starting the Metro bundler`,\n `--scheme [scheme] Scheme to build`,\n chalk`--configuration <configuration> Xcode configuration to use. Debug or Release. {dim Default: Debug}`,\n `-d, --device [device] Device name or UDID to build the app on`,\n chalk`-p, --port <port> Port to start the Metro bundler on. {dim Default: 8081}`,\n `-h, --help Usage info`,\n ].join('\\n'),\n [\n '',\n chalk` Build for production (unsigned) with the {bold Release} configuration:`,\n chalk` {dim $} npx expo run:ios --configuration Release`,\n '',\n ].join('\\n')\n );\n }\n\n const { resolveStringOrBooleanArgsAsync } = await import('../../utils/resolveArgs');\n const parsed = await resolveStringOrBooleanArgsAsync(argv ?? [], rawArgsMap, {\n '--scheme': Boolean,\n '--device': Boolean,\n '-d': '--device',\n }).catch(logCmdError);\n\n const { runIosAsync } = await import('./runIosAsync');\n return runIosAsync(path.resolve(parsed.projectRoot), {\n // Parsed options\n buildCache: !args['--no-build-cache'],\n install: !args['--no-install'],\n bundler: !args['--no-bundler'],\n port: args['--port'],\n\n // Custom parsed args\n device: parsed.args['--device'],\n scheme: parsed.args['--scheme'],\n configuration: parsed.args['--configuration'] as XcodeConfiguration,\n }).catch(logCmdError);\n};\n"],"names":["expoRunIos","argv","rawArgsMap","Boolean","String","Number","args","assertWithOptionsArgs","permissive","printHelp","chalk","join","resolveStringOrBooleanArgsAsync","parsed","catch","logCmdError","runIosAsync","path","resolve","projectRoot","buildCache","install","bundler","port","device","scheme","configuration"],"mappings":"AAAA;;;;;;AAEkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;AAG0B,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACvC,IAAA,OAAoB,WAApB,oBAAoB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGzC,MAAMA,UAAU,GAAY,OAAOC,IAAI,GAAK;IACjD,MAAMC,UAAU,GAAa;QAC3B,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,kBAAkB,EAAEA,OAAO;QAC3B,cAAc,EAAEA,OAAO;QACvB,cAAc,EAAEA,OAAO;QACvB,iBAAiB,EAAEC,MAAM;QAEzB,QAAQ,EAAEC,MAAM;QAChB,UAAU;QACV,IAAI,EAAE,QAAQ;QAEd,IAAI,EAAE,QAAQ;KACf,AAAC;IACF,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAqB,AAIhC,CAAA,sBAJgC,CAACL,UA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AO,EAAE,CAACf,IAAI,CAAC,cAAc,CAAC;QAC9BgB,OAAO,EAAE,CAAChB,IAAI,CAAC,cAAc,CAAC;QAC9BiB,IAAI,EAAEjB,IAAI,CAAC,QAAQ,CAAC;QAEpB,qBAAqB;QACrBkB,MAAM,EAAEX,MAAM,CAACP,IAAI,CAAC,UAAU,CAAC;QAC/BmB,MAAM,EAAEZ,MAAM,CAACP,IAAI,CAAC,UAAU,CAAC;QAC/BoB,aAAa,EAAEb,MAAM,CAACP,IAAI,CAAC,iBAAiB,CAAC;KAC9C,CAAC,CAACQ,KAAK,CAACC,OAAW,YAAA,CAAC,CAAC;CACvB,AAAC;QAnEWf,UAAU,GAAVA,UAAU"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.launchAppAsync = launchAppAsync;
6
+ var _chalk = _interopRequireDefault(require("chalk"));
7
+ var _path = _interopRequireDefault(require("path"));
8
+ var _appleDeviceManager = require("../../start/platforms/ios/AppleDeviceManager");
9
+ var _simctlLogging = require("../../start/platforms/ios/simctlLogging");
10
+ var _plist = require("../../utils/plist");
11
+ var _profile = require("../../utils/profile");
12
+ var XcodeBuild = _interopRequireWildcard(require("./XcodeBuild"));
13
+ var _installOnDeviceAsync = require("./appleDevice/installOnDeviceAsync");
14
+ function _interopRequireDefault(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ function _interopRequireWildcard(obj) {
20
+ if (obj && obj.__esModule) {
21
+ return obj;
22
+ } else {
23
+ var newObj = {};
24
+ if (obj != null) {
25
+ for(var key in obj){
26
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
27
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
28
+ if (desc.get || desc.set) {
29
+ Object.defineProperty(newObj, key, desc);
30
+ } else {
31
+ newObj[key] = obj[key];
32
+ }
33
+ }
34
+ }
35
+ }
36
+ newObj.default = obj;
37
+ return newObj;
38
+ }
39
+ }
40
+ async function launchAppAsync(binaryPath, manager, props) {
41
+ const appId = await (0, _profile).profile(getBundleIdentifierForBinaryAsync)(binaryPath);
42
+ if (!props.isSimulator) {
43
+ await (0, _profile).profile(_installOnDeviceAsync.installOnDeviceAsync)({
44
+ bundleIdentifier: appId,
45
+ bundle: binaryPath,
46
+ appDeltaDirectory: (0, _installOnDeviceAsync).getAppDeltaDirectory(appId),
47
+ udid: props.device.udid,
48
+ deviceName: props.device.name
49
+ });
50
+ return;
51
+ }
52
+ XcodeBuild.logPrettyItem(_chalk.default`{bold Installing} on ${props.device.name}`);
53
+ const device = await _appleDeviceManager.AppleDeviceManager.resolveAsync({
54
+ device: props.device
55
+ });
56
+ await device.installAppAsync(binaryPath);
57
+ XcodeBuild.logPrettyItem(_chalk.default`{bold Opening} on ${device.name} {dim (${appId})}`);
58
+ if (props.shouldStartBundler) {
59
+ await _simctlLogging.SimulatorLogStreamer.getStreamer(device.device, {
60
+ appId
61
+ }).attachAsync();
62
+ }
63
+ await manager.getDefaultDevServer().openCustomRuntimeAsync("simulator", {
64
+ applicationId: appId
65
+ }, {
66
+ device
67
+ });
68
+ }
69
+ async function getBundleIdentifierForBinaryAsync(binaryPath) {
70
+ const builtInfoPlistPath = _path.default.join(binaryPath, "Info.plist");
71
+ const { CFBundleIdentifier } = await (0, _plist).parsePlistAsync(builtInfoPlistPath);
72
+ return CFBundleIdentifier;
73
+ }
74
+
75
+ //# sourceMappingURL=launchApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/run/ios/launchApp.ts"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport { AppleDeviceManager } from '../../start/platforms/ios/AppleDeviceManager';\nimport { SimulatorLogStreamer } from '../../start/platforms/ios/simctlLogging';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { parsePlistAsync } from '../../utils/plist';\nimport { profile } from '../../utils/profile';\nimport * as XcodeBuild from './XcodeBuild';\nimport { BuildProps } from './XcodeBuild.types';\nimport { getAppDeltaDirectory, installOnDeviceAsync } from './appleDevice/installOnDeviceAsync';\n\n/** Install and launch the app binary on a device. */\nexport async function launchAppAsync(\n binaryPath: string,\n manager: DevServerManager,\n props: Pick<BuildProps, 'isSimulator' | 'device' | 'shouldStartBundler'>\n) {\n const appId = await profile(getBundleIdentifierForBinaryAsync)(binaryPath);\n\n if (!props.isSimulator) {\n await profile(installOnDeviceAsync)({\n bundleIdentifier: appId,\n bundle: binaryPath,\n appDeltaDirectory: getAppDeltaDirectory(appId),\n udid: props.device.udid,\n deviceName: props.device.name,\n });\n return;\n }\n\n XcodeBuild.logPrettyItem(chalk`{bold Installing} on ${props.device.name}`);\n\n const device = await AppleDeviceManager.resolveAsync({ device: props.device });\n await device.installAppAsync(binaryPath);\n\n XcodeBuild.logPrettyItem(chalk`{bold Opening} on ${device.name} {dim (${appId})}`);\n\n if (props.shouldStartBundler) {\n await SimulatorLogStreamer.getStreamer(device.device, {\n appId,\n }).attachAsync();\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync(\n 'simulator',\n {\n applicationId: appId,\n },\n { device }\n );\n}\n\nasync function getBundleIdentifierForBinaryAsync(binaryPath: string): Promise<string> {\n const builtInfoPlistPath = path.join(binaryPath, 'Info.plist');\n const { CFBundleIdentifier } = await parsePlistAsync(builtInfoPlistPath);\n return CFBundleIdentifier;\n}\n"],"names":["launchAppAsync","XcodeBuild","binaryPath","manager","props","appId","profile","getBundleIdentifierForBinaryAsync","isSimulator","installOnDeviceAsync","bundleIdentifier","bundle","appDeltaDirectory","getAppDeltaDirectory","udid","device","deviceName","name","logPrettyItem","chalk","AppleDeviceManager","resolveAsync","installAppAsync","shouldStartBundler","SimulatorLogStreamer","getStreamer","attachAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","builtInfoPlistPath","path","join","CFBundleIdentifier","parsePlistAsync"],"mappings":"AAAA;;;;QAasBA,cAAc,GAA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e,CAACpB,UAAU,CAAC,CAAC;IAEzCD,UAAU,CAACiB,aAAa,CAACC,MAAK,QAAA,CAAC,kBAAkB,EAAEJ,MAAM,CAACE,IAAI,CAAC,OAAO,EAAEZ,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnF,IAAID,KAAK,CAACmB,kBAAkB,EAAE;QAC5B,MAAMC,cAAoB,qBAAA,CAACC,WAAW,CAACV,MAAM,CAACA,MAAM,EAAE;YACpDV,KAAK;SACN,CAAC,CAACqB,WAAW,EAAE,CAAC;KAClB;IAED,MAAMvB,OAAO,CAACwB,mBAAmB,EAAE,CAACC,sBAAsB,CACxD,WAAW,EACX;QACEC,aAAa,EAAExB,KAAK;KACrB,EACD;QAAEU,MAAM;KAAE,CACX,CAAC;CACH;AAED,eAAeR,iCAAiC,CAACL,UAAkB,EAAmB;IACpF,MAAM4B,kBAAkB,GAAGC,KAAI,QAAA,CAACC,IAAI,CAAC9B,UAAU,EAAE,YAAY,CAAC,AAAC;IAC/D,MAAM,EAAE+B,kBAAkB,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,MAAe,AAAoB,CAAA,gBAApB,CAACJ,kBAAkB,CAAC,AAAC;IACzE,OAAOG,kBAAkB,CAAC;CAC3B"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.formatDeviceChoice = formatDeviceChoice;
6
+ exports.promptDeviceAsync = promptDeviceAsync;
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var _prompts = _interopRequireDefault(require("../../../utils/prompts"));
9
+ function _interopRequireDefault(obj) {
10
+ return obj && obj.__esModule ? obj : {
11
+ default: obj
12
+ };
13
+ }
14
+ function isConnectedDevice(item) {
15
+ return "deviceType" in item;
16
+ }
17
+ function isSimControlDevice(item) {
18
+ return "state" in item;
19
+ }
20
+ function formatDeviceChoice(item) {
21
+ const isConnected = isConnectedDevice(item) && item.deviceType === "device";
22
+ const isActive = isSimControlDevice(item) && item.state === "Booted";
23
+ const symbol = isConnected ? "\uD83D\uDD0C " : "";
24
+ const format = isActive ? _chalk.default.bold : (text)=>text
25
+ ;
26
+ return {
27
+ title: `${symbol}${format(item.name)}${item.osVersion ? _chalk.default.dim(` (${item.osVersion})`) : ""}`,
28
+ value: item.udid
29
+ };
30
+ }
31
+ async function promptDeviceAsync(devices) {
32
+ // --device with no props after
33
+ const { value } = await (0, _prompts).default({
34
+ type: "autocomplete",
35
+ name: "value",
36
+ limit: 11,
37
+ message: "Select a device",
38
+ choices: devices.map((item)=>formatDeviceChoice(item)
39
+ ),
40
+ suggest: (input, choices)=>{
41
+ const regex = new RegExp(input, "i");
42
+ return choices.filter((choice)=>regex.test(choice.title)
43
+ );
44
+ }
45
+ });
46
+ return devices.find((device)=>device.udid === value
47
+ );
48
+ }
49
+
50
+ //# sourceMappingURL=promptDevice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/run/ios/options/promptDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport * as SimControl from '../../../start/platforms/ios/simctl';\nimport prompt from '../../../utils/prompts';\nimport { ConnectedDevice } from '../appleDevice/AppleDevice';\n\ntype AnyDevice = SimControl.Device | ConnectedDevice;\n\nfunction isConnectedDevice(item: AnyDevice): item is ConnectedDevice {\n return 'deviceType' in item;\n}\n\nfunction isSimControlDevice(item: AnyDevice): item is SimControl.Device {\n return 'state' in item;\n}\n\n/** Format a device for the prompt list. Exposed for testing. */\nexport function formatDeviceChoice(item: AnyDevice): { title: string; value: string } {\n const isConnected = isConnectedDevice(item) && item.deviceType === 'device';\n const isActive = isSimControlDevice(item) && item.state === 'Booted';\n const symbol = isConnected ? '🔌 ' : '';\n const format = isActive ? chalk.bold : (text: string) => text;\n return {\n title: `${symbol}${format(item.name)}${\n item.osVersion ? chalk.dim(` (${item.osVersion})`) : ''\n }`,\n value: item.udid,\n };\n}\n\n/** Prompt to select a device from a searchable list of devices. */\nexport async function promptDeviceAsync(devices: AnyDevice[]): Promise<AnyDevice> {\n // --device with no props after\n const { value } = await prompt({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device',\n choices: devices.map((item) => formatDeviceChoice(item)),\n suggest: (input: any, choices: any) => {\n const regex = new RegExp(input, 'i');\n return choices.filter((choice: any) => regex.test(choice.title));\n },\n });\n return devices.find((device) => device.udid === value)!;\n}\n"],"names":["formatDeviceChoice","promptDeviceAsync","isConnectedDevice","item","isSimControlDevice","isConnected","deviceType","isActive","state","symbol","format","chalk","bold","text","title","name","osVersion","dim","value","udid","devices","prompt","type","limit","message","choices","map","suggest","input","regex","RegExp","filter","choice","test","find","device"],"mappings":"AAAA;;;;QAiBgBA,kBAAkB,GAAlBA,kBAAkB;QAcZC,iBAAiB,GAAjBA,iBAAiB;AA/BrB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAGN,IAAA,QAAwB,kCAAxB,wBAAwB,EAAA;;;;;;AAK3C,SAASC,iBAAiB,CAACC,IAAe,EAA2B;IACnE,OAAO,YAAY,IAAIA,IAAI,CAAC;CAC7B;AAED,SAASC,kBAAkB,CAACD,IAAe,EAA6B;IACtE,OAAO,OAAO,IAAIA,IAAI,CAAC;CACxB;AAGM,SAASH,kBAAkB,CAACG,IAAe,EAAoC;IACpF,MAAME,WAAW,GAAGH,iBAAiB,CAACC,IAAI,CAAC,IAAIA,IAAI,CAACG,UAAU,KAAK,QAAQ,AAAC;IAC5E,MAAMC,QAAQ,GAAGH,kBAAkB,CAACD,IAAI,CAAC,IAAIA,IAAI,CAACK,KAAK,KAAK,QAAQ,AAAC;IACrE,MAAMC,MAAM,GAAGJ,WAAW,GAAG,eAAI,GAAG,EAAE,AAAC;IACvC,MAAMK,MAAM,GAAGH,QAAQ,GAAGI,MAAK,QAAA,CAACC,IAAI,GAAG,CAACC,IAAY,GAAKA,IAAI;IAAC;IAC9D,OAAO;QACLC,KAAK,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEC,MAAM,CAACP,IAAI,CAACY,IAAI,CAAC,CAAC,EACnCZ,IAAI,CAACa,SAAS,GAAGL,MAAK,QAAA,CAACM,GAAG,CAAC,CAAC,EAAE,EAAEd,IAAI,CAACa,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CACxD,CAAC;QACFE,KAAK,EAAEf,IAAI,CAACgB,IAAI;KACjB,CAAC;CACH;AAGM,eAAelB,iBAAiB,CAACmB,OAAoB,EAAsB;IAChF,+BAA+B;IAC/B,MAAM,EAAEF,KAAK,CAAA,EAAE,GAAG,MAAMG,CAAAA,GAAAA,QAAM,AAU5B,CAAA,QAV4B,CAAC;QAC7BC,IAAI,EAAE,cAAc;QACpBP,IAAI,EAAE,OAAO;QACbQ,KAAK,EAAE,EAAE;QACTC,OAAO,EAAE,iBAAiB;QAC1BC,OAAO,EAAEL,OAAO,CAACM,GAAG,CAAC,CAACvB,IAAI,GAAKH,kBAAkB,CAACG,IAAI,CAAC;QAAA,CAAC;QACxDwB,OAAO,EAAE,CAACC,KAAU,EAAEH,OAAY,GAAK;YACrC,MAAMI,KAAK,GAAG,IAAIC,MAAM,CAACF,KAAK,EAAE,GAAG,CAAC,AAAC;YACrC,OAAOH,OAAO,CAACM,MAAM,CAAC,CAACC,MAAW,GAAKH,KAAK,CAACI,IAAI,CAACD,MAAM,CAAClB,KAAK,CAAC;YAAA,CAAC,CAAC;SAClE;KACF,CAAC,AAAC;IACH,OAAOM,OAAO,CAACc,IAAI,CAAC,CAACC,MAAM,GAAKA,MAAM,CAAChB,IAAI,KAAKD,KAAK;IAAA,CAAC,CAAE;CACzD"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.resolveDeviceAsync = resolveDeviceAsync;
6
+ exports.isSimulatorDevice = isSimulatorDevice;
7
+ var Log = _interopRequireWildcard(require("../../../log"));
8
+ var _appleDeviceManager = require("../../../start/platforms/ios/AppleDeviceManager");
9
+ var _assertSystemRequirements = require("../../../start/platforms/ios/assertSystemRequirements");
10
+ var _promptAppleDevice = require("../../../start/platforms/ios/promptAppleDevice");
11
+ var SimControl = _interopRequireWildcard(require("../../../start/platforms/ios/simctl"));
12
+ var _errors = require("../../../utils/errors");
13
+ var _profile = require("../../../utils/profile");
14
+ var _hints = require("../../hints");
15
+ var AppleDevice = _interopRequireWildcard(require("../appleDevice/AppleDevice"));
16
+ var _promptDevice = require("./promptDevice");
17
+ function _interopRequireWildcard(obj) {
18
+ if (obj && obj.__esModule) {
19
+ return obj;
20
+ } else {
21
+ var newObj = {};
22
+ if (obj != null) {
23
+ for(var key in obj){
24
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
25
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
26
+ if (desc.get || desc.set) {
27
+ Object.defineProperty(newObj, key, desc);
28
+ } else {
29
+ newObj[key] = obj[key];
30
+ }
31
+ }
32
+ }
33
+ }
34
+ newObj.default = obj;
35
+ return newObj;
36
+ }
37
+ }
38
+ /** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */ async function getDevicesAsync({ osType } = {}) {
39
+ const connectedDevices = await AppleDevice.getConnectedDevicesAsync();
40
+ const simulators = await (0, _promptAppleDevice).sortDefaultDeviceToBeginningAsync(await (0, _profile).profile(SimControl.getDevicesAsync)(), osType);
41
+ const devices = [
42
+ ...connectedDevices,
43
+ ...simulators
44
+ ];
45
+ // If osType is defined, then filter out ineligible simulators.
46
+ // Only do this inside of the device selection so users who pass the entire device udid can attempt to select any simulator (even if it's invalid).
47
+ return osType ? filterDevicesForOsType(devices, osType) : devices;
48
+ }
49
+ /** @returns a list of devices, filtered by the provided `osType`. */ function filterDevicesForOsType(devices, osType) {
50
+ return devices.filter((device)=>!("osType" in device) || device.osType === osType
51
+ );
52
+ }
53
+ async function resolveDeviceAsync(device, { osType } = {}) {
54
+ await (0, _assertSystemRequirements).assertSystemRequirementsAsync();
55
+ if (!device) {
56
+ /** Finds the first possible device and returns in a booted state. */ const manager = await _appleDeviceManager.AppleDeviceManager.resolveAsync({
57
+ device: {
58
+ osType
59
+ }
60
+ });
61
+ Log.debug(`Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${osType})`);
62
+ return manager.device;
63
+ }
64
+ const devices = await getDevicesAsync({
65
+ osType
66
+ });
67
+ const resolved = device === true ? await (0, _promptDevice).promptDeviceAsync(devices) : findDeviceFromSearchValue(devices, device.toLowerCase());
68
+ return ensureBootedAsync(resolved);
69
+ }
70
+ function isSimulatorDevice(device) {
71
+ return !("deviceType" in device) || device.deviceType.startsWith("com.apple.CoreSimulator.SimDeviceType.");
72
+ }
73
+ /** @returns device matching the `searchValue` against name or UDID. */ function findDeviceFromSearchValue(devices, searchValue) {
74
+ const device1 = devices.find((device)=>device.udid.toLowerCase() === searchValue || device.name.toLowerCase() === searchValue
75
+ );
76
+ if (!device1) {
77
+ throw new _errors.CommandError("BAD_ARGS", `No device UDID or name matching "${searchValue}"`);
78
+ }
79
+ return device1;
80
+ }
81
+ /** Ensures the device is booted if it's a simulator. */ async function ensureBootedAsync(device) {
82
+ // --device with no props after
83
+ (0, _hints).logDeviceArgument(device.udid);
84
+ if (isSimulatorDevice(device)) {
85
+ return (0, _appleDeviceManager).ensureSimulatorOpenAsync({
86
+ udid: device.udid
87
+ });
88
+ }
89
+ return device;
90
+ }
91
+
92
+ //# sourceMappingURL=resolveDevice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/run/ios/options/resolveDevice.ts"],"sourcesContent":["import * as Log from '../../../log';\nimport {\n AppleDeviceManager,\n ensureSimulatorOpenAsync,\n} from '../../../start/platforms/ios/AppleDeviceManager';\nimport { assertSystemRequirementsAsync } from '../../../start/platforms/ios/assertSystemRequirements';\nimport { sortDefaultDeviceToBeginningAsync } from '../../../start/platforms/ios/promptAppleDevice';\nimport { OSType } from '../../../start/platforms/ios/simctl';\nimport * as SimControl from '../../../start/platforms/ios/simctl';\nimport { CommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { logDeviceArgument } from '../../hints';\nimport * as AppleDevice from '../appleDevice/AppleDevice';\nimport { promptDeviceAsync } from './promptDevice';\n\ntype AnyDevice = SimControl.Device | AppleDevice.ConnectedDevice;\n\n/** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */\nasync function getDevicesAsync({ osType }: { osType?: OSType } = {}): Promise<AnyDevice[]> {\n const connectedDevices = await AppleDevice.getConnectedDevicesAsync();\n\n const simulators = await sortDefaultDeviceToBeginningAsync(\n await profile(SimControl.getDevicesAsync)(),\n osType\n );\n\n const devices = [...connectedDevices, ...simulators];\n\n // If osType is defined, then filter out ineligible simulators.\n // Only do this inside of the device selection so users who pass the entire device udid can attempt to select any simulator (even if it's invalid).\n return osType ? filterDevicesForOsType(devices, osType) : devices;\n}\n\n/** @returns a list of devices, filtered by the provided `osType`. */\nfunction filterDevicesForOsType(devices: AnyDevice[], osType: OSType): AnyDevice[] {\n return devices.filter((device) => !('osType' in device) || device.osType === osType);\n}\n\n/** Given a `device` argument from the CLI, parse and prompt our way to a usable device for building. */\nexport async function resolveDeviceAsync(\n device?: string | boolean,\n { osType }: { osType?: OSType } = {}\n): Promise<AnyDevice> {\n await assertSystemRequirementsAsync();\n\n if (!device) {\n /** Finds the first possible device and returns in a booted state. */\n const manager = await AppleDeviceManager.resolveAsync({\n device: {\n osType,\n },\n });\n Log.debug(\n `Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${osType})`\n );\n return manager.device;\n }\n\n const devices: AnyDevice[] = await getDevicesAsync({\n osType,\n });\n\n const resolved =\n device === true\n ? // `--device` (no props after)\n await promptDeviceAsync(devices)\n : // `--device <name|udid>`\n findDeviceFromSearchValue(devices, device.toLowerCase());\n\n return ensureBootedAsync(resolved);\n}\n\n/** @returns `true` if the given device is a simulator. */\nexport function isSimulatorDevice(device: AnyDevice): boolean {\n return (\n !('deviceType' in device) ||\n device.deviceType.startsWith('com.apple.CoreSimulator.SimDeviceType.')\n );\n}\n\n/** @returns device matching the `searchValue` against name or UDID. */\nfunction findDeviceFromSearchValue(devices: AnyDevice[], searchValue: string): AnyDevice {\n const device = devices.find(\n (device) =>\n device.udid.toLowerCase() === searchValue || device.name.toLowerCase() === searchValue\n );\n if (!device) {\n throw new CommandError('BAD_ARGS', `No device UDID or name matching \"${searchValue}\"`);\n }\n return device;\n}\n\n/** Ensures the device is booted if it's a simulator. */\nasync function ensureBootedAsync(device: AnyDevice): Promise<AnyDevice> {\n // --device with no props after\n logDeviceArgument(device.udid);\n if (isSimulatorDevice(device)) {\n return ensureSimulatorOpenAsync({ udid: device.udid });\n }\n return device;\n}\n"],"names":["resolveDeviceAsync","isSimulatorDevice","Log","SimControl","AppleDevice","getDevicesAsync","osType","connectedDevices","getConnectedDevicesAsync","simulators","sortDefaultDeviceToBeginningAsync","profile","devices","filterDevicesForOsType","filter","device","assertSystemRequirementsAsync","manager","AppleDeviceManager","resolveAsync","debug","name","udid","resolved","promptDeviceAsync","findDeviceFromSearchValue","toLowerCase","ensureBootedAsync","deviceType","startsWith","searchValue","find","CommandError","logDeviceArgument","ensureSimulatorOpenAsync"],"mappings":"AAAA;;;;QAuCsBA,kBAAkB,GAAlBA,kBAAkB;QAkCxBC,iBAAiB,GAAjBA,iBAAiB;AAzErBC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AAIR,IAAA,mBAAiD,WAAjD,iDAAiD,CAAA;AACV,IAAA,yBAAuD,WAAvD,uDAAuD,CAAA;AACnD,IAAA,kBAAgD,WAAhD,gDAAgD,CAAA;AAEtFC,IAAAA,UAAU,mCAAM,qCAAqC,EAA3C;AACO,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AAC5B,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACd,IAAA,MAAa,WAAb,aAAa,CAAA;AACnCC,IAAAA,WAAW,mCAAM,4BAA4B,EAAlC;AACW,IAAA,aAAgB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,MAAM,CAAC,EAAE;QAC7B,OAAOmB,CAAAA,GAAAA,mBAAwB,AAAuB,CAAA,yBAAvB,CAAC;YAAEZ,IAAI,EAAEP,MAAM,CAACO,IAAI;SAAE,CAAC,CAAC;KACxD;IACD,OAAOP,MAAM,CAAC;CACf"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.resolveNativeSchemePropsAsync = resolveNativeSchemePropsAsync;
6
+ exports.promptOrQueryNativeSchemeAsync = promptOrQueryNativeSchemeAsync;
7
+ exports.getDefaultNativeScheme = getDefaultNativeScheme;
8
+ var _configPlugins = require("@expo/config-plugins");
9
+ var _chalk = _interopRequireDefault(require("chalk"));
10
+ var _path = _interopRequireDefault(require("path"));
11
+ var Log = _interopRequireWildcard(require("../../../log"));
12
+ var _errors = require("../../../utils/errors");
13
+ var _profile = require("../../../utils/profile");
14
+ var _prompts = require("../../../utils/prompts");
15
+ function _interopRequireDefault(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ function _interopRequireWildcard(obj) {
21
+ if (obj && obj.__esModule) {
22
+ return obj;
23
+ } else {
24
+ var newObj = {};
25
+ if (obj != null) {
26
+ for(var key in obj){
27
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
28
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
29
+ if (desc.get || desc.set) {
30
+ Object.defineProperty(newObj, key, desc);
31
+ } else {
32
+ newObj[key] = obj[key];
33
+ }
34
+ }
35
+ }
36
+ }
37
+ newObj.default = obj;
38
+ return newObj;
39
+ }
40
+ }
41
+ async function resolveNativeSchemePropsAsync(projectRoot, options, xcodeProject) {
42
+ var ref;
43
+ return (ref = await promptOrQueryNativeSchemeAsync(projectRoot, options)) != null ? ref : getDefaultNativeScheme(projectRoot, options, xcodeProject);
44
+ }
45
+ async function promptOrQueryNativeSchemeAsync(projectRoot, { scheme , configuration }) {
46
+ const schemes = _configPlugins.IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj(projectRoot, {
47
+ configuration
48
+ });
49
+ if (!schemes.length) {
50
+ throw new _errors.CommandError("IOS_MALFORMED", "No native iOS build schemes found");
51
+ }
52
+ if (scheme === true) {
53
+ if (schemes.length === 1) {
54
+ Log.log(`Auto selecting only available scheme: ${schemes[0].name}`);
55
+ return schemes[0];
56
+ }
57
+ const resolvedSchemeName = await (0, _prompts).selectAsync("Select a scheme", schemes.map((value)=>{
58
+ const isApp = value.type === _configPlugins.IOSConfig.Target.TargetType.APPLICATION && value.osType === "iOS";
59
+ return {
60
+ value: value.name,
61
+ title: isApp ? _chalk.default.bold(value.name) + _chalk.default.gray(" (app)") : value.name
62
+ };
63
+ }), {
64
+ nonInteractiveHelp: `--scheme: argument must be provided with a string in non-interactive mode. Valid choices are: ${schemes.join(", ")}`
65
+ });
66
+ var ref;
67
+ return (ref = schemes.find(({ name })=>resolvedSchemeName === name
68
+ )) != null ? ref : null;
69
+ }
70
+ // Attempt to match the schemes up so we can open the correct simulator
71
+ return scheme ? schemes.find(({ name })=>name === scheme
72
+ ) || {
73
+ name: scheme
74
+ } : null;
75
+ }
76
+ function getDefaultNativeScheme(projectRoot, options, xcodeProject) {
77
+ // If the resolution failed then we should just use the first runnable scheme that
78
+ // matches the provided configuration.
79
+ const resolvedScheme = (0, _profile).profile(_configPlugins.IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj)(projectRoot, {
80
+ configuration: options.configuration
81
+ })[0];
82
+ // If we couldn't find the scheme, then we'll guess at it,
83
+ // this is needed for cases where the native code hasn't been generated yet.
84
+ if (resolvedScheme) {
85
+ return resolvedScheme;
86
+ }
87
+ return {
88
+ name: _path.default.basename(xcodeProject.name, _path.default.extname(xcodeProject.name))
89
+ };
90
+ }
91
+
92
+ //# sourceMappingURL=resolveNativeScheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/run/ios/options/resolveNativeScheme.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { selectAsync } from '../../../utils/prompts';\nimport { Options, ProjectInfo, XcodeConfiguration } from '../XcodeBuild.types';\n\ntype NativeSchemeProps = {\n name: string;\n osType?: string;\n};\n\nexport async function resolveNativeSchemePropsAsync(\n projectRoot: string,\n options: Pick<Options, 'scheme' | 'configuration'>,\n xcodeProject: ProjectInfo\n): Promise<NativeSchemeProps> {\n return (\n (await promptOrQueryNativeSchemeAsync(projectRoot, options)) ??\n getDefaultNativeScheme(projectRoot, options, xcodeProject)\n );\n}\n\n/** Resolve the native iOS build `scheme` for a given `configuration`. If the `scheme` isn't provided then the user will be prompted to select one. */\nexport async function promptOrQueryNativeSchemeAsync(\n projectRoot: string,\n { scheme, configuration }: { scheme?: string | boolean; configuration?: XcodeConfiguration }\n): Promise<NativeSchemeProps | null> {\n const schemes = IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj(projectRoot, {\n configuration,\n });\n if (!schemes.length) {\n throw new CommandError('IOS_MALFORMED', 'No native iOS build schemes found');\n }\n\n if (scheme === true) {\n if (schemes.length === 1) {\n Log.log(`Auto selecting only available scheme: ${schemes[0].name}`);\n return schemes[0];\n }\n const resolvedSchemeName = await selectAsync(\n 'Select a scheme',\n schemes.map((value) => {\n const isApp =\n value.type === IOSConfig.Target.TargetType.APPLICATION && value.osType === 'iOS';\n return {\n value: value.name,\n title: isApp ? chalk.bold(value.name) + chalk.gray(' (app)') : value.name,\n };\n }),\n {\n nonInteractiveHelp: `--scheme: argument must be provided with a string in non-interactive mode. Valid choices are: ${schemes.join(\n ', '\n )}`,\n }\n );\n return schemes.find(({ name }) => resolvedSchemeName === name) ?? null;\n }\n // Attempt to match the schemes up so we can open the correct simulator\n return scheme ? schemes.find(({ name }) => name === scheme) || { name: scheme } : null;\n}\n\nexport function getDefaultNativeScheme(\n projectRoot: string,\n options: Pick<Options, 'configuration'>,\n xcodeProject: ProjectInfo\n): NativeSchemeProps {\n // If the resolution failed then we should just use the first runnable scheme that\n // matches the provided configuration.\n const resolvedScheme = profile(IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj)(\n projectRoot,\n {\n configuration: options.configuration,\n }\n )[0];\n\n // If we couldn't find the scheme, then we'll guess at it,\n // this is needed for cases where the native code hasn't been generated yet.\n if (resolvedScheme) {\n return resolvedScheme;\n }\n return {\n name: path.basename(xcodeProject.name, path.extname(xcodeProject.name)),\n };\n}\n"],"names":["resolveNativeSchemePropsAsync","promptOrQueryNativeSchemeAsync","getDefaultNativeScheme","Log","projectRoot","options","xcodeProject","scheme","configuration","schemes","IOSConfig","BuildScheme","getRunnableSchemesFromXcodeproj","length","CommandError","log","name","resolvedSchemeName","selectAsync","map","value","isApp","type","Target","TargetType","APPLICATION","osType","title","chalk","bold","gray","nonInteractiveHelp","join","find","resolvedScheme","profile","path","basename","extname"],"mappings":"AAAA;;;;QAesBA,6BAA6B,GAA7BA,6BAA6B;QAY7BC,8BAA8B,GAA9BA,8BAA8B;QAsCpCC,sBAAsB,GAAtBA,sBAAsB;AAjEZ,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACc,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AAC5B,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACpB,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQ7C,eAAeH,6BAA6B,CACjDI,WAAmB,EACnBC,OAAkD,EAClDC,YAAyB,EACG;QAE1B,GAA4D;IAD9D,OACE,CAAA,GAA4D,GAA3D,MAAML,8BAA8B,CAACG,WAAW,EAAEC,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