@expo/cli 0.18.3 → 0.18.5
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.
- package/build/bin/cli +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +1 -0
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/exportAsync.js +0 -2
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +2 -0
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/install/installAsync.js +2 -2
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.types.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +26 -2
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/launchApp.js +12 -7
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/appleDestinations.js +124 -0
- package/build/src/run/ios/options/appleDestinations.js.map +1 -0
- package/build/src/run/ios/options/promptDevice.js +1 -1
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +48 -16
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +6 -3
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/startBundler.js +1 -0
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +33 -15
- package/build/src/start/platforms/ios/devicectl.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +7 -4
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +6 -5
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +6 -2
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +59 -4
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "resolveDestinationsAsync", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>resolveDestinationsAsync
|
|
8
|
+
});
|
|
9
|
+
function _spawnAsync() {
|
|
10
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/spawn-async"));
|
|
11
|
+
_spawnAsync = function() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
const _log = require("../../../log");
|
|
17
|
+
function _interopRequireDefault(obj) {
|
|
18
|
+
return obj && obj.__esModule ? obj : {
|
|
19
|
+
default: obj
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const debug = require("debug")("expo:apple-destination");
|
|
23
|
+
function coerceDestinationPlatformToOsType(platform) {
|
|
24
|
+
// The only two devices I have to test against...
|
|
25
|
+
switch(platform){
|
|
26
|
+
case "iOS":
|
|
27
|
+
return "iOS";
|
|
28
|
+
case "xrOS":
|
|
29
|
+
case "visionOS":
|
|
30
|
+
return "xrOS";
|
|
31
|
+
case "macOS":
|
|
32
|
+
return "macOS";
|
|
33
|
+
default:
|
|
34
|
+
debug("Unknown destination platform (needs to be added to Expo CLI):", platform);
|
|
35
|
+
return platform;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Runs `.filter(Boolean)` on the array with correct types.
|
|
39
|
+
function filterBoolean(array) {
|
|
40
|
+
return array.filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
function warnDestinationObject(obj) {
|
|
43
|
+
if (!obj || typeof obj !== "object") {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if ("platform" in obj && "id" in obj && "name" in obj) {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
_log.Log.warn("Unexpected xcode destination object:", obj);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function parseXcodeDestinationString(str) {
|
|
53
|
+
const parsedLines = filterBoolean(str.trim().split("\n").map((line)=>{
|
|
54
|
+
line = line.trim();
|
|
55
|
+
return line.startsWith("{") ? line : null;
|
|
56
|
+
})).map((line)=>{
|
|
57
|
+
var ref;
|
|
58
|
+
const inner = (ref = line.match(/{(.*)}/)) == null ? void 0 : ref[1];
|
|
59
|
+
if (!inner) return null;
|
|
60
|
+
return Object.fromEntries(filterBoolean(inner.trim().split(", ").map((item)=>{
|
|
61
|
+
var ref;
|
|
62
|
+
return (ref = item.trim().match(/(?<key>[^:]+):(?<value>.+)/)) == null ? void 0 : ref.groups;
|
|
63
|
+
})).map((item)=>[
|
|
64
|
+
item.key,
|
|
65
|
+
item.value
|
|
66
|
+
]));
|
|
67
|
+
});
|
|
68
|
+
return filterBoolean(parsedLines.map(warnDestinationObject));
|
|
69
|
+
}
|
|
70
|
+
function coercePhysicalDevice(device) {
|
|
71
|
+
// physical device
|
|
72
|
+
return {
|
|
73
|
+
/** @example `00008101-001964A22629003A` */ udid: device.id,
|
|
74
|
+
/** @example `Evan's phone` */ name: device.name,
|
|
75
|
+
/** @example `iPhone13,4` */ // model: 'UNKNOWN',
|
|
76
|
+
/** @example `device` */ deviceType: "device",
|
|
77
|
+
osType: coerceDestinationPlatformToOsType(device.platform),
|
|
78
|
+
osVersion: ""
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function coerceSimulatorDevice(device) {
|
|
82
|
+
// simulator
|
|
83
|
+
return {
|
|
84
|
+
/** '00E55DC0-0364-49DF-9EC6-77BE587137D4' */ udid: device.id,
|
|
85
|
+
/** 'com.apple.CoreSimulator.SimRuntime.iOS-15-1' */ runtime: "",
|
|
86
|
+
/** If the device is "available" which generally means that the OS files haven't been deleted (this can happen when Xcode updates). */ isAvailable: true,
|
|
87
|
+
deviceTypeIdentifier: "",
|
|
88
|
+
state: "Shutdown",
|
|
89
|
+
/** 'iPhone 13 Pro' */ name: device.name,
|
|
90
|
+
/** Type of OS the device uses. */ osType: device.platform === "visionOS Simulator" ? "xrOS" : "iOS",
|
|
91
|
+
/** '15.1' */ osVersion: device.OS,
|
|
92
|
+
/** 'iPhone 13 Pro (15.1)' */ windowName: `${device.name} (${device.OS})`
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function coerceDestinationObjectToKnownDeviceType(device) {
|
|
96
|
+
if (device.arch) {
|
|
97
|
+
// physical device
|
|
98
|
+
return coercePhysicalDevice(device);
|
|
99
|
+
} else if (device.OS) {
|
|
100
|
+
// simulator
|
|
101
|
+
return coerceSimulatorDevice(device);
|
|
102
|
+
} else {
|
|
103
|
+
// "Any device"
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function resolveDestinationsAsync(props) {
|
|
108
|
+
// xcodebuild -workspace /Users/evanbacon/Documents/GitHub/lab/apr23/ios/apr23.xcworkspace -configuration Debug -scheme apr23 -showdestinations -json
|
|
109
|
+
const { stdout } = await (0, _spawnAsync().default)("xcodebuild", [
|
|
110
|
+
props.xcodeProject.isWorkspace ? "-workspace" : "-project",
|
|
111
|
+
props.xcodeProject.name,
|
|
112
|
+
"-configuration",
|
|
113
|
+
props.configuration,
|
|
114
|
+
"-scheme",
|
|
115
|
+
props.scheme,
|
|
116
|
+
"-showdestinations",
|
|
117
|
+
"-quiet",
|
|
118
|
+
]);
|
|
119
|
+
// console.log(JSON.stringify(stdout, null, 2));
|
|
120
|
+
const destinationObjects = parseXcodeDestinationString(stdout);
|
|
121
|
+
return filterBoolean(destinationObjects.map(coerceDestinationObjectToKnownDeviceType));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=appleDestinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/options/appleDestinations.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\n\nimport { Log } from '../../../log';\nimport { OSType } from '../../../start/platforms/ios/simctl';\nimport * as SimControl from '../../../start/platforms/ios/simctl';\nimport { BuildProps } from '../XcodeBuild.types';\nimport * as AppleDevice from '../appleDevice/AppleDevice';\n\nconst debug = require('debug')('expo:apple-destination') as typeof console.log;\n\ninterface Destination {\n // 'visionOS'\n platform: string;\n // 'arm64'\n arch?: string;\n // 'Designed for [iPad,iPhone]'\n variant?: string;\n // '00008112-001A20EC1E78A01E'\n id: string;\n // 'Apple Vision Pro'\n name: string;\n // Available in simulators\n OS?: string;\n}\n\nfunction coerceDestinationPlatformToOsType(platform: string): OSType {\n // The only two devices I have to test against...\n switch (platform) {\n case 'iOS':\n return 'iOS';\n case 'xrOS':\n case 'visionOS':\n return 'xrOS';\n case 'macOS':\n return 'macOS';\n default:\n debug('Unknown destination platform (needs to be added to Expo CLI):', platform);\n return platform as OSType;\n }\n}\n\n// Runs `.filter(Boolean)` on the array with correct types.\nfunction filterBoolean<T>(array: (T | null | undefined)[]): T[] {\n return array.filter(Boolean) as T[];\n}\n\nfunction warnDestinationObject(obj: any): Destination | null {\n if (!obj || typeof obj !== 'object') {\n return null;\n }\n\n if ('platform' in obj && 'id' in obj && 'name' in obj) {\n return obj;\n }\n Log.warn('Unexpected xcode destination object:', obj);\n return null;\n}\n\nfunction parseXcodeDestinationString(str: string): Destination[] {\n const parsedLines = filterBoolean(\n str\n .trim()\n .split('\\n')\n .map((line: string) => {\n line = line.trim();\n return line.startsWith('{') ? line : null;\n })\n ).map((line) => {\n const inner = line.match(/{(.*)}/)?.[1];\n\n if (!inner) return null;\n\n return Object.fromEntries(\n filterBoolean(\n inner\n .trim()\n .split(', ')\n .map((item) => item.trim().match(/(?<key>[^:]+):(?<value>.+)/)?.groups)\n ).map((item) => [item!.key, item!.value])\n );\n });\n\n return filterBoolean(parsedLines.map(warnDestinationObject));\n}\n\nfunction coercePhysicalDevice(\n device: Destination\n): Pick<AppleDevice.ConnectedDevice, 'udid' | 'name' | 'osType' | 'deviceType' | 'osVersion'> {\n // physical device\n return {\n /** @example `00008101-001964A22629003A` */\n udid: device.id,\n /** @example `Evan's phone` */\n name: device.name,\n /** @example `iPhone13,4` */\n // model: 'UNKNOWN',\n /** @example `device` */\n deviceType: 'device',\n osType: coerceDestinationPlatformToOsType(device.platform),\n\n osVersion: '',\n };\n}\n\nfunction coerceSimulatorDevice(\n device: Destination\n): Pick<\n SimControl.Device,\n | 'udid'\n | 'name'\n | 'osType'\n | 'osVersion'\n | 'runtime'\n | 'isAvailable'\n | 'deviceTypeIdentifier'\n | 'state'\n | 'windowName'\n> {\n // simulator\n return {\n /** '00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n udid: device.id,\n /** 'com.apple.CoreSimulator.SimRuntime.iOS-15-1' */\n runtime: '',\n /** If the device is \"available\" which generally means that the OS files haven't been deleted (this can happen when Xcode updates). */\n isAvailable: true,\n\n deviceTypeIdentifier: '',\n\n state: 'Shutdown',\n /** 'iPhone 13 Pro' */\n name: device.name,\n /** Type of OS the device uses. */\n osType: device.platform === 'visionOS Simulator' ? 'xrOS' : 'iOS',\n /** '15.1' */\n osVersion: device.OS!,\n /** 'iPhone 13 Pro (15.1)' */\n windowName: `${device.name} (${device.OS})`,\n };\n}\n\nfunction coerceDestinationObjectToKnownDeviceType(device: Destination) {\n if (device.arch) {\n // physical device\n return coercePhysicalDevice(device);\n } else if (device.OS) {\n // simulator\n return coerceSimulatorDevice(device);\n } else {\n // \"Any device\"\n return null;\n }\n}\n\nexport async function resolveDestinationsAsync(\n props: Pick<BuildProps, 'configuration' | 'scheme' | 'xcodeProject'>\n): Promise<{ name: string; osType: OSType; osVersion: string; udid: string }[]> {\n // xcodebuild -workspace /Users/evanbacon/Documents/GitHub/lab/apr23/ios/apr23.xcworkspace -configuration Debug -scheme apr23 -showdestinations -json\n\n const { stdout } = await spawnAsync('xcodebuild', [\n props.xcodeProject.isWorkspace ? '-workspace' : '-project',\n props.xcodeProject.name,\n '-configuration',\n props.configuration,\n '-scheme',\n props.scheme,\n '-showdestinations',\n '-quiet',\n ]);\n\n // console.log(JSON.stringify(stdout, null, 2));\n\n const destinationObjects = parseXcodeDestinationString(stdout);\n\n return filterBoolean(destinationObjects.map(coerceDestinationObjectToKnownDeviceType));\n}\n"],"names":["resolveDestinationsAsync","debug","require","coerceDestinationPlatformToOsType","platform","filterBoolean","array","filter","Boolean","warnDestinationObject","obj","Log","warn","parseXcodeDestinationString","str","parsedLines","trim","split","map","line","startsWith","inner","match","Object","fromEntries","item","groups","key","value","coercePhysicalDevice","device","udid","id","name","deviceType","osType","osVersion","coerceSimulatorDevice","runtime","isAvailable","deviceTypeIdentifier","state","OS","windowName","coerceDestinationObjectToKnownDeviceType","arch","props","stdout","spawnAsync","xcodeProject","isWorkspace","configuration","scheme","destinationObjects"],"mappings":"AAAA;;;;+BA0JsBA,0BAAwB;;aAAxBA,wBAAwB;;;8DA1JvB,mBAAmB;;;;;;qBAEtB,cAAc;;;;;;AAMlC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,AAAsB,AAAC;AAiB/E,SAASC,iCAAiC,CAACC,QAAgB,EAAU;IACnE,iDAAiD;IACjD,OAAQA,QAAQ;QACd,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,UAAU;YACb,OAAO,MAAM,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB;YACEH,KAAK,CAAC,+DAA+D,EAAEG,QAAQ,CAAC,CAAC;YACjF,OAAOA,QAAQ,CAAW;KAC7B;AACH,CAAC;AA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AM,CAACG,IAAI,CAAC,EAAE,EAAEH,MAAM,CAACY,EAAE,CAAC,CAAC,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,SAASE,wCAAwC,CAACd,MAAmB,EAAE;IACrE,IAAIA,MAAM,CAACe,IAAI,EAAE;QACf,kBAAkB;QAClB,OAAOhB,oBAAoB,CAACC,MAAM,CAAC,CAAC;IACtC,OAAO,IAAIA,MAAM,CAACY,EAAE,EAAE;QACpB,YAAY;QACZ,OAAOL,qBAAqB,CAACP,MAAM,CAAC,CAAC;IACvC,OAAO;QACL,eAAe;QACf,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAEM,eAAe9B,wBAAwB,CAC5C8C,KAAoE,EACU;IAC9E,qJAAqJ;IAErJ,MAAM,EAAEC,MAAM,CAAA,EAAE,GAAG,MAAMC,IAAAA,WAAU,EAAA,QAAA,EAAC,YAAY,EAAE;QAChDF,KAAK,CAACG,YAAY,CAACC,WAAW,GAAG,YAAY,GAAG,UAAU;QAC1DJ,KAAK,CAACG,YAAY,CAAChB,IAAI;QACvB,gBAAgB;QAChBa,KAAK,CAACK,aAAa;QACnB,SAAS;QACTL,KAAK,CAACM,MAAM;QACZ,mBAAmB;QACnB,QAAQ;KACT,CAAC,AAAC;IAEH,kDAAkD;IAElD,MAAMC,kBAAkB,GAAGxC,2BAA2B,CAACkC,MAAM,CAAC,AAAC;IAE/D,OAAO1C,aAAa,CAACgD,kBAAkB,CAACnC,GAAG,CAAC0B,wCAAwC,CAAC,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -34,7 +34,7 @@ function isSimControlDevice(item) {
|
|
|
34
34
|
function formatDeviceChoice(item) {
|
|
35
35
|
const isConnected = isConnectedDevice(item) && item.deviceType === "device";
|
|
36
36
|
const isActive = isSimControlDevice(item) && item.state === "Booted";
|
|
37
|
-
const symbol = isConnected ? item.connectionType === "Network" ? "\uD83C\uDF10 " : "\uD83D\uDD0C " : "";
|
|
37
|
+
const symbol = item.osType === "macOS" ? "\uD83D\uDDA5️ " : isConnected ? item.connectionType === "Network" ? "\uD83C\uDF10 " : "\uD83D\uDD0C " : "";
|
|
38
38
|
const format = isActive ? _chalk().default.bold : (text)=>text;
|
|
39
39
|
return {
|
|
40
40
|
title: `${symbol}${format(item.name)}${item.osVersion ? _chalk().default.dim(` (${item.osVersion})`) : ""}`,
|
|
@@ -1 +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
|
|
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 =\n item.osType === 'macOS'\n ? '🖥️ '\n : isConnected\n ? item.connectionType === 'Network'\n ? '🌐 '\n : '🔌 '\n : '';\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","osType","connectionType","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;;;;;;;;;;;IAiBgBA,kBAAkB,MAAlBA,kBAAkB;IAqBZC,iBAAiB,MAAjBA,iBAAiB;;;8DAtCrB,OAAO;;;;;;8DAGN,wBAAwB;;;;;;AAK3C,SAASC,iBAAiB,CAACC,IAAe,EAA2B;IACnE,OAAO,YAAY,IAAIA,IAAI,CAAC;AAC9B,CAAC;AAED,SAASC,kBAAkB,CAACD,IAAe,EAA6B;IACtE,OAAO,OAAO,IAAIA,IAAI,CAAC;AACzB,CAAC;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,GACVN,IAAI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,CAAChB,IAAI,KAAKD,KAAK,CAAC,CAAE;AAC1D,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// import { resolveDestinationsAsync } from './appleDestinations';
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
@@ -17,6 +18,7 @@ const _log = /*#__PURE__*/ _interopRequireWildcard(require("../../../log"));
|
|
|
17
18
|
const _appleDeviceManager = require("../../../start/platforms/ios/AppleDeviceManager");
|
|
18
19
|
const _promptAppleDevice = require("../../../start/platforms/ios/promptAppleDevice");
|
|
19
20
|
const _simctl = /*#__PURE__*/ _interopRequireWildcard(require("../../../start/platforms/ios/simctl"));
|
|
21
|
+
const _array = require("../../../utils/array");
|
|
20
22
|
const _errors = require("../../../utils/errors");
|
|
21
23
|
const _profile = require("../../../utils/profile");
|
|
22
24
|
const _hints = require("../../hints");
|
|
@@ -60,39 +62,69 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
60
62
|
}
|
|
61
63
|
return newObj;
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
// type AnyDevice = SimControl.Device | AppleDevice.ConnectedDevice;
|
|
66
|
+
/** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */ async function getDevicesAsync({ osType }) {
|
|
67
|
+
const devices = await (0, _promptAppleDevice.sortDefaultDeviceToBeginningAsync)((0, _array.uniqBy)((await Promise.all([
|
|
68
|
+
_appleDevice.getConnectedDevicesAsync(),
|
|
69
|
+
await (0, _profile.profile)(_simctl.getDevicesAsync)(),
|
|
70
|
+
])).flat(), (item)=>item.udid), osType);
|
|
71
|
+
// Sort devices to top of front of the list
|
|
72
|
+
const physical = [];
|
|
73
|
+
const simulators = devices.filter((device)=>{
|
|
74
|
+
if ("isAvailable" in device) {
|
|
75
|
+
return true;
|
|
76
|
+
} else {
|
|
77
|
+
physical.push(device);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const isPhone = (a)=>a.osType === "iOS";
|
|
82
|
+
const sorted = [
|
|
83
|
+
...physical.sort((a, b)=>{
|
|
84
|
+
const aPhone = isPhone(a);
|
|
85
|
+
const bPhone = isPhone(b);
|
|
86
|
+
if (aPhone && !bPhone) return -1;
|
|
87
|
+
if (!aPhone && bPhone) return 1;
|
|
88
|
+
return 0;
|
|
89
|
+
}),
|
|
90
|
+
...simulators,
|
|
69
91
|
];
|
|
70
92
|
// If osType is defined, then filter out ineligible simulators.
|
|
71
93
|
// 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).
|
|
72
|
-
return osType ? filterDevicesForOsType(
|
|
94
|
+
return osType ? filterDevicesForOsType(sorted, osType) : sorted;
|
|
73
95
|
}
|
|
74
96
|
/** @returns a list of devices, filtered by the provided `osType`. */ function filterDevicesForOsType(devices, osType) {
|
|
75
|
-
return devices.filter((device)
|
|
97
|
+
return devices.filter((device)=>{
|
|
98
|
+
if (osType === "iOS") {
|
|
99
|
+
// Compatible devices for iOS builds
|
|
100
|
+
return [
|
|
101
|
+
"iOS",
|
|
102
|
+
"macOS",
|
|
103
|
+
"xrOS"
|
|
104
|
+
].includes(device.osType);
|
|
105
|
+
}
|
|
106
|
+
return device.osType === osType;
|
|
107
|
+
});
|
|
76
108
|
}
|
|
77
|
-
async function resolveDeviceAsync(device,
|
|
109
|
+
async function resolveDeviceAsync(device, buildProps) {
|
|
78
110
|
await _appleDeviceManager.AppleDeviceManager.assertSystemRequirementsAsync();
|
|
79
111
|
if (!device) {
|
|
80
112
|
/** Finds the first possible device and returns in a booted state. */ const manager = await _appleDeviceManager.AppleDeviceManager.resolveAsync({
|
|
81
113
|
device: {
|
|
82
|
-
osType
|
|
114
|
+
osType: buildProps.osType
|
|
83
115
|
}
|
|
84
116
|
});
|
|
85
|
-
_log.debug(`Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${osType})`);
|
|
117
|
+
_log.debug(`Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${buildProps.osType})`);
|
|
86
118
|
return manager.device;
|
|
87
119
|
}
|
|
88
|
-
const devices = await getDevicesAsync(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const resolved = device === true ? await (0, _promptDevice.promptDeviceAsync)(devices) : findDeviceFromSearchValue(devices, device.toLowerCase());
|
|
120
|
+
const devices = await getDevicesAsync(buildProps);
|
|
121
|
+
const resolved = device === true ? // @ts-expect-error
|
|
122
|
+
await (0, _promptDevice.promptDeviceAsync)(devices) : findDeviceFromSearchValue(devices, device.toLowerCase());
|
|
92
123
|
return ensureBootedAsync(resolved);
|
|
93
124
|
}
|
|
94
125
|
function isSimulatorDevice(device) {
|
|
95
|
-
|
|
126
|
+
var ref;
|
|
127
|
+
return !("deviceType" in device) || !!((ref = device.deviceType) == null ? void 0 : ref.startsWith == null ? void 0 : ref.startsWith("com.apple.CoreSimulator.SimDeviceType."));
|
|
96
128
|
}
|
|
97
129
|
/** @returns device matching the `searchValue` against name or UDID. */ function findDeviceFromSearchValue(devices, searchValue) {
|
|
98
130
|
const device = devices.find((device)=>device.udid.toLowerCase() === searchValue || device.name.toLowerCase() === searchValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/run/ios/options/resolveDevice.ts"],"sourcesContent":["import { promptDeviceAsync } from './promptDevice';\nimport * as Log from '../../../log';\nimport {\n AppleDeviceManager,\n ensureSimulatorOpenAsync,\n} from '../../../start/platforms/ios/AppleDeviceManager';\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';\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({
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/options/resolveDevice.ts"],"sourcesContent":["// import { resolveDestinationsAsync } from './appleDestinations';\nimport { promptDeviceAsync } from './promptDevice';\nimport * as Log from '../../../log';\nimport {\n AppleDeviceManager,\n ensureSimulatorOpenAsync,\n} from '../../../start/platforms/ios/AppleDeviceManager';\nimport { sortDefaultDeviceToBeginningAsync } from '../../../start/platforms/ios/promptAppleDevice';\nimport { OSType } from '../../../start/platforms/ios/simctl';\nimport * as SimControl from '../../../start/platforms/ios/simctl';\nimport { uniqBy } from '../../../utils/array';\nimport { CommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { logDeviceArgument } from '../../hints';\nimport { BuildProps } from '../XcodeBuild.types';\nimport * as AppleDevice from '../appleDevice/AppleDevice';\n\ntype AnyDevice = {\n name: string;\n osType: OSType;\n osVersion: string;\n udid: string;\n deviceType?: string;\n};\n// type 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({\n osType,\n // ...buildProps\n}: { osType?: OSType } & Pick<BuildProps, 'xcodeProject' | 'scheme' | 'configuration'>): Promise<\n AnyDevice[]\n> {\n const devices = await sortDefaultDeviceToBeginningAsync(\n uniqBy(\n (\n await Promise.all([\n AppleDevice.getConnectedDevicesAsync(),\n await profile(SimControl.getDevicesAsync)(),\n // resolveDestinationsAsync(buildProps),\n ])\n ).flat(),\n (item) => item.udid\n ),\n osType\n );\n\n // Sort devices to top of front of the list\n\n const physical: AnyDevice[] = [];\n\n const simulators = devices.filter((device) => {\n if ('isAvailable' in device) {\n return true;\n } else {\n physical.push(device);\n return false;\n }\n });\n\n const isPhone = (a: any) => a.osType === 'iOS';\n const sorted = [\n ...physical.sort((a, b) => {\n const aPhone = isPhone(a);\n const bPhone = isPhone(b);\n if (aPhone && !bPhone) return -1;\n if (!aPhone && bPhone) return 1;\n\n return 0;\n }),\n ...simulators,\n ];\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(sorted, osType) : sorted;\n}\n\n/** @returns a list of devices, filtered by the provided `osType`. */\nfunction filterDevicesForOsType<TDevice extends { osType: OSType }>(\n devices: TDevice[],\n osType: OSType\n): TDevice[] {\n return devices.filter((device) => {\n if (osType === 'iOS') {\n // Compatible devices for iOS builds\n return ['iOS', 'macOS', 'xrOS'].includes(device.osType);\n }\n return device.osType === osType;\n });\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 | undefined,\n buildProps: { osType?: OSType } & Pick<BuildProps, 'xcodeProject' | 'scheme' | 'configuration'>\n): Promise<AnyDevice> {\n await AppleDeviceManager.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: buildProps.osType,\n },\n });\n Log.debug(\n `Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${buildProps.osType})`\n );\n return manager.device;\n }\n\n const devices = await getDevicesAsync(buildProps);\n\n const resolved =\n device === true\n ? // `--device` (no props after)\n // @ts-expect-error\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","getDevicesAsync","osType","devices","sortDefaultDeviceToBeginningAsync","uniqBy","Promise","all","AppleDevice","getConnectedDevicesAsync","profile","SimControl","flat","item","udid","physical","simulators","filter","device","push","isPhone","a","sorted","sort","b","aPhone","bPhone","filterDevicesForOsType","includes","buildProps","AppleDeviceManager","assertSystemRequirementsAsync","manager","resolveAsync","Log","debug","name","resolved","promptDeviceAsync","findDeviceFromSearchValue","toLowerCase","ensureBootedAsync","deviceType","startsWith","searchValue","find","CommandError","logDeviceArgument","ensureSimulatorOpenAsync"],"mappings":"AAAA,kEAAkE;AAClE;;;;;;;;;;;IA4FsBA,kBAAkB,MAAlBA,kBAAkB;IAiCxBC,iBAAiB,MAAjBA,iBAAiB;;8BA7HC,gBAAgB;2DAC7B,cAAc;oCAI5B,iDAAiD;mCACN,gDAAgD;8DAEtE,qCAAqC;uBAC1C,sBAAsB;wBAChB,uBAAuB;yBAC5B,wBAAwB;uBACd,aAAa;mEAElB,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASzD,oEAAoE;AAEpE,uHAAuH,GACvH,eAAeC,eAAe,CAAC,EAC7BC,MAAM,CAAA,EAE8E,EAEpF;IACA,MAAMC,OAAO,GAAG,MAAMC,IAAAA,kBAAiC,kCAAA,EACrDC,IAAAA,MAAM,OAAA,EACJ,CACE,MAAMC,OAAO,CAACC,GAAG,CAAC;QAChBC,YAAW,CAACC,wBAAwB,EAA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A,MAAM,CAAC,IACzB,CAAC,EAACA,CAAAA,GAAiB,GAAjBA,MAAM,CAACwB,UAAU,SAAY,GAA7BxB,KAAAA,CAA6B,GAA7BA,GAAiB,CAAEyB,UAAU,QAA4C,GAAzEzB,KAAAA,CAAyE,GAAzEA,GAAiB,CAAEyB,UAAU,CAAG,wCAAwC,CAAC,CAAA,CAC3E;AACJ,CAAC;AAED,qEAAqE,GACrE,SAASJ,yBAAyB,CAACpC,OAAoB,EAAEyC,WAAmB,EAAa;IACvF,MAAM1B,MAAM,GAAGf,OAAO,CAAC0C,IAAI,CACzB,CAAC3B,MAAM,GACLA,MAAM,CAACJ,IAAI,CAAC0B,WAAW,EAAE,KAAKI,WAAW,IAAI1B,MAAM,CAACkB,IAAI,CAACI,WAAW,EAAE,KAAKI,WAAW,CACzF,AAAC;IACF,IAAI,CAAC1B,MAAM,EAAE;QACX,MAAM,IAAI4B,OAAY,aAAA,CAAC,UAAU,EAAE,CAAC,iCAAiC,EAAEF,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,OAAO1B,MAAM,CAAC;AAChB,CAAC;AAED,sDAAsD,GACtD,eAAeuB,iBAAiB,CAACvB,MAAiB,EAAsB;IACtE,+BAA+B;IAC/B6B,IAAAA,MAAiB,kBAAA,EAAC7B,MAAM,CAACJ,IAAI,CAAC,CAAC;IAC/B,IAAId,iBAAiB,CAACkB,MAAM,CAAC,EAAE;QAC7B,OAAO8B,IAAAA,mBAAwB,yBAAA,EAAC;YAAElC,IAAI,EAAEI,MAAM,CAACJ,IAAI;SAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAOI,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +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\nconst debug = require('debug')('expo:run:ios:options:resolveNativeScheme') as typeof console.log;\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: Pick<ProjectInfo, 'name'>\n): NativeSchemeProps {\n // If the resolution failed then we should just use the first runnable scheme that\n // matches the provided configuration.\n const resolvedSchemes = profile(IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj)(\n projectRoot,\n {\n configuration: options.configuration,\n }\n );\n\n // If there are multiple schemes, then the default should be the application.\n if (resolvedSchemes.length > 1) {\n const scheme =\n resolvedSchemes.find(({ type }) => type === IOSConfig.Target.TargetType.APPLICATION) ??\n resolvedSchemes[0];\n debug(`Using default scheme: ${scheme.name}`);\n return scheme;\n }\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 (resolvedSchemes[0]) {\n return resolvedSchemes[0];\n }\n return {\n name: path.basename(xcodeProject.name, path.extname(xcodeProject.name)),\n };\n}\n"],"names":["resolveNativeSchemePropsAsync","promptOrQueryNativeSchemeAsync","getDefaultNativeScheme","debug","require","projectRoot","options","xcodeProject","scheme","configuration","schemes","IOSConfig","BuildScheme","getRunnableSchemesFromXcodeproj","length","CommandError","Log","log","name","resolvedSchemeName","selectAsync","map","value","isApp","type","Target","TargetType","APPLICATION","osType","title","chalk","bold","gray","nonInteractiveHelp","join","find","resolvedSchemes","profile","path","basename","extname"],"mappings":"AAAA;;;;;;;;;;;IAiBsBA,6BAA6B,MAA7BA,6BAA6B;IAY7BC,8BAA8B,MAA9BA,8BAA8B;
|
|
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\nconst debug = require('debug')('expo:run:ios:options:resolveNativeScheme') as typeof console.log;\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\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: Pick<ProjectInfo, 'name'>\n): NativeSchemeProps {\n // If the resolution failed then we should just use the first runnable scheme that\n // matches the provided configuration.\n const resolvedSchemes = profile(IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj)(\n projectRoot,\n {\n configuration: options.configuration,\n }\n );\n\n // If there are multiple schemes, then the default should be the application.\n if (resolvedSchemes.length > 1) {\n const scheme =\n resolvedSchemes.find(({ type }) => type === IOSConfig.Target.TargetType.APPLICATION) ??\n resolvedSchemes[0];\n debug(`Using default scheme: ${scheme.name}`);\n return scheme;\n }\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 (resolvedSchemes[0]) {\n return resolvedSchemes[0];\n }\n return {\n name: path.basename(xcodeProject.name, path.extname(xcodeProject.name)),\n };\n}\n"],"names":["resolveNativeSchemePropsAsync","promptOrQueryNativeSchemeAsync","getDefaultNativeScheme","debug","require","projectRoot","options","xcodeProject","scheme","configuration","schemes","IOSConfig","BuildScheme","getRunnableSchemesFromXcodeproj","length","CommandError","Log","log","name","resolvedSchemeName","selectAsync","map","value","isApp","type","Target","TargetType","APPLICATION","osType","title","chalk","bold","gray","nonInteractiveHelp","join","find","resolvedSchemes","profile","path","basename","extname"],"mappings":"AAAA;;;;;;;;;;;IAiBsBA,6BAA6B,MAA7BA,6BAA6B;IAY7BC,8BAA8B,MAA9BA,8BAA8B;IAuCpCC,sBAAsB,MAAtBA,sBAAsB;;;yBApEZ,sBAAsB;;;;;;;8DAC9B,OAAO;;;;;;;8DACR,MAAM;;;;;;2DAEF,cAAc;wBACN,uBAAuB;yBAC5B,wBAAwB;yBACpB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,0CAA0C,CAAC,AAAsB,AAAC;AAO1F,eAAeJ,6BAA6B,CACjDK,WAAmB,EACnBC,OAAkD,EAClDC,YAAyB,EACG;QAE1B,GAA4D;IAD9D,OACE,CAAA,GAA4D,GAA3D,MAAMN,8BAA8B,CAACI,WAAW,EAAEC,OAAO,CAAC,YAA3D,GAA4D,GAC5DJ,sBAAsB,CAACG,WAAW,EAAEC,OAAO,EAAEC,YAAY,CAAC,CAC1D;AACJ,CAAC;AAGM,eAAeN,8BAA8B,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;QACLlB,IAAI,EAAEoB,KAAI,EAAA,QAAA,CAACC,QAAQ,CAAChC,YAAY,CAACW,IAAI,EAAEoB,KAAI,EAAA,QAAA,CAACE,OAAO,CAACjC,YAAY,CAACW,IAAI,CAAC,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -17,15 +17,18 @@ async function resolveOptionsAsync(projectRoot, options) {
|
|
|
17
17
|
// Resolve the scheme before the device so we can filter devices based on
|
|
18
18
|
// whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).
|
|
19
19
|
const { osType , name: scheme } = await (0, _resolveNativeScheme.resolveNativeSchemePropsAsync)(projectRoot, options, xcodeProject);
|
|
20
|
+
// Use the configuration or `Debug` if none is provided.
|
|
21
|
+
const configuration = options.configuration || "Debug";
|
|
20
22
|
// Resolve the device based on the provided device id or prompt
|
|
21
23
|
// from a list of devices (connected or simulated) that are filtered by the scheme.
|
|
22
24
|
const device = await (0, _resolveDevice.resolveDeviceAsync)(options.device, {
|
|
23
25
|
// It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.
|
|
24
|
-
osType: (0, _simctl.isOSType)(osType) ? osType : undefined
|
|
26
|
+
osType: (0, _simctl.isOSType)(osType) ? osType : undefined,
|
|
27
|
+
xcodeProject,
|
|
28
|
+
scheme,
|
|
29
|
+
configuration
|
|
25
30
|
});
|
|
26
31
|
const isSimulator = (0, _resolveDevice.isSimulatorDevice)(device);
|
|
27
|
-
// Use the configuration or `Debug` if none is provided.
|
|
28
|
-
const configuration = options.configuration || "Debug";
|
|
29
32
|
// This optimization skips resetting the Metro cache needlessly.
|
|
30
33
|
// The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the
|
|
31
34
|
// project is running in Debug and built onto a physical device. It seems that this is done because
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/run/ios/options/resolveOptions.ts"],"sourcesContent":["import { isSimulatorDevice, resolveDeviceAsync } from './resolveDevice';\nimport { resolveNativeSchemePropsAsync } from './resolveNativeScheme';\nimport { resolveXcodeProject } from './resolveXcodeProject';\nimport { isOSType } from '../../../start/platforms/ios/simctl';\nimport { resolveBundlerPropsAsync } from '../../resolveBundlerProps';\nimport { BuildProps, Options } from '../XcodeBuild.types';\n\n/** Resolve arguments for the `run:ios` command. */\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<BuildProps> {\n const xcodeProject = resolveXcodeProject(projectRoot);\n\n const bundlerProps = await resolveBundlerPropsAsync(projectRoot, options);\n\n // Resolve the scheme before the device so we can filter devices based on\n // whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).\n const { osType, name: scheme } = await resolveNativeSchemePropsAsync(\n projectRoot,\n options,\n xcodeProject\n );\n\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n const device = await resolveDeviceAsync(options.device, {\n // It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.\n osType: isOSType(osType) ? osType : undefined,\n });\n\n const isSimulator = isSimulatorDevice(device);\n\n //
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/options/resolveOptions.ts"],"sourcesContent":["import { isSimulatorDevice, resolveDeviceAsync } from './resolveDevice';\nimport { resolveNativeSchemePropsAsync } from './resolveNativeScheme';\nimport { resolveXcodeProject } from './resolveXcodeProject';\nimport { isOSType } from '../../../start/platforms/ios/simctl';\nimport { resolveBundlerPropsAsync } from '../../resolveBundlerProps';\nimport { BuildProps, Options } from '../XcodeBuild.types';\n\n/** Resolve arguments for the `run:ios` command. */\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<BuildProps> {\n const xcodeProject = resolveXcodeProject(projectRoot);\n\n const bundlerProps = await resolveBundlerPropsAsync(projectRoot, options);\n\n // Resolve the scheme before the device so we can filter devices based on\n // whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).\n const { osType, name: scheme } = await resolveNativeSchemePropsAsync(\n projectRoot,\n options,\n xcodeProject\n );\n\n // Use the configuration or `Debug` if none is provided.\n const configuration = options.configuration || 'Debug';\n\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n const device = await resolveDeviceAsync(options.device, {\n // It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.\n osType: isOSType(osType) ? osType : undefined,\n xcodeProject,\n scheme,\n configuration,\n });\n\n const isSimulator = isSimulatorDevice(device);\n\n // This optimization skips resetting the Metro cache needlessly.\n // The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the\n // project is running in Debug and built onto a physical device. It seems that this is done because\n // the script is run from Xcode and unaware of the CLI instance.\n const shouldSkipInitialBundling = configuration === 'Debug' && !isSimulator;\n\n return {\n ...bundlerProps,\n projectRoot,\n isSimulator,\n xcodeProject,\n device,\n configuration,\n shouldSkipInitialBundling,\n buildCache: options.buildCache !== false,\n scheme,\n };\n}\n"],"names":["resolveOptionsAsync","projectRoot","options","xcodeProject","resolveXcodeProject","bundlerProps","resolveBundlerPropsAsync","osType","name","scheme","resolveNativeSchemePropsAsync","configuration","device","resolveDeviceAsync","isOSType","undefined","isSimulator","isSimulatorDevice","shouldSkipInitialBundling","buildCache"],"mappings":"AAAA;;;;+BAQsBA,qBAAmB;;aAAnBA,mBAAmB;;+BARa,iBAAiB;qCACzB,uBAAuB;qCACjC,uBAAuB;wBAClC,qCAAqC;qCACrB,2BAA2B;AAI7D,eAAeA,mBAAmB,CACvCC,WAAmB,EACnBC,OAAgB,EACK;IACrB,MAAMC,YAAY,GAAGC,IAAAA,oBAAmB,oBAAA,EAACH,WAAW,CAAC,AAAC;IAEtD,MAAMI,YAAY,GAAG,MAAMC,IAAAA,oBAAwB,yBAAA,EAACL,WAAW,EAAEC,OAAO,CAAC,AAAC;IAE1E,yEAAyE;IACzE,oGAAoG;IACpG,MAAM,EAAEK,MAAM,CAAA,EAAEC,IAAI,EAAEC,MAAM,CAAA,EAAE,GAAG,MAAMC,IAAAA,oBAA6B,8BAAA,EAClET,WAAW,EACXC,OAAO,EACPC,YAAY,CACb,AAAC;IAEF,wDAAwD;IACxD,MAAMQ,aAAa,GAAGT,OAAO,CAACS,aAAa,IAAI,OAAO,AAAC;IAEvD,+DAA+D;IAC/D,mFAAmF;IACnF,MAAMC,MAAM,GAAG,MAAMC,IAAAA,cAAkB,mBAAA,EAACX,OAAO,CAACU,MAAM,EAAE;QACtD,mGAAmG;QACnGL,MAAM,EAAEO,IAAAA,OAAQ,SAAA,EAACP,MAAM,CAAC,GAAGA,MAAM,GAAGQ,SAAS;QAC7CZ,YAAY;QACZM,MAAM;QACNE,aAAa;KACd,CAAC,AAAC;IAEH,MAAMK,WAAW,GAAGC,IAAAA,cAAiB,kBAAA,EAACL,MAAM,CAAC,AAAC;IAE9C,gEAAgE;IAChE,8FAA8F;IAC9F,mGAAmG;IACnG,gEAAgE;IAChE,MAAMM,yBAAyB,GAAGP,aAAa,KAAK,OAAO,IAAI,CAACK,WAAW,AAAC;IAE5E,OAAO;QACL,GAAGX,YAAY;QACfJ,WAAW;QACXe,WAAW;QACXb,YAAY;QACZS,MAAM;QACND,aAAa;QACbO,yBAAyB;QACzBC,UAAU,EAAEjB,OAAO,CAACiB,UAAU,KAAK,KAAK;QACxCV,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/run/startBundler.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { startInterfaceAsync } from '../start/interface/startInterface';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { isInteractive } from '../utils/interactive';\n\nexport async function startBundlerAsync(\n projectRoot: string,\n {\n port,\n headless,\n scheme,\n }: {\n port: number;\n headless?: boolean;\n scheme?: string;\n }\n): Promise<DevServerManager> {\n const options = {\n port,\n headless,\n devClient: true,\n\n location: {\n scheme,\n },\n };\n\n const devServerManager = new DevServerManager(projectRoot, options);\n\n await devServerManager.startAsync([\n {\n // TODO: Allow swapping this value for another bundler.\n type: 'metro',\n options,\n },\n ]);\n\n // Present the Terminal UI.\n if (!headless && isInteractive()) {\n // Only read the config if we are going to use the results.\n const { exp } = getConfig(projectRoot, {\n // We don't need very many fields here, just use the lightest possible read.\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n await startInterfaceAsync(devServerManager, {\n platforms: exp.platforms ?? [],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n\n if (!options.headless) {\n await devServerManager.watchEnvironmentVariables();\n await devServerManager.bootstrapTypeScriptAsync();\n }\n\n return devServerManager;\n}\n"],"names":["startBundlerAsync","projectRoot","port","headless","scheme","options","devClient","location","devServerManager","DevServerManager","startAsync","type","isInteractive","exp","getConfig","skipSDKVersionRequirement","skipPlugins","startInterfaceAsync","platforms","url","getDefaultDevServer","getDevServerUrl","Log","log","chalk","watchEnvironmentVariables","bootstrapTypeScriptAsync"],"mappings":"AAAA;;;;+
|
|
1
|
+
{"version":3,"sources":["../../../src/run/startBundler.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { startInterfaceAsync } from '../start/interface/startInterface';\nimport { BundlerStartOptions } from '../start/server/BundlerDevServer';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { isInteractive } from '../utils/interactive';\n\nexport async function startBundlerAsync(\n projectRoot: string,\n {\n port,\n headless,\n scheme,\n }: {\n port: number;\n headless?: boolean;\n scheme?: string;\n }\n): Promise<DevServerManager> {\n const options: BundlerStartOptions = {\n port,\n headless,\n devClient: true,\n minify: false,\n\n location: {\n scheme,\n },\n };\n\n const devServerManager = new DevServerManager(projectRoot, options);\n\n await devServerManager.startAsync([\n {\n // TODO: Allow swapping this value for another bundler.\n type: 'metro',\n options,\n },\n ]);\n\n // Present the Terminal UI.\n if (!headless && isInteractive()) {\n // Only read the config if we are going to use the results.\n const { exp } = getConfig(projectRoot, {\n // We don't need very many fields here, just use the lightest possible read.\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n await startInterfaceAsync(devServerManager, {\n platforms: exp.platforms ?? [],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n\n if (!options.headless) {\n await devServerManager.watchEnvironmentVariables();\n await devServerManager.bootstrapTypeScriptAsync();\n }\n\n return devServerManager;\n}\n"],"names":["startBundlerAsync","projectRoot","port","headless","scheme","options","devClient","minify","location","devServerManager","DevServerManager","startAsync","type","isInteractive","exp","getConfig","skipSDKVersionRequirement","skipPlugins","startInterfaceAsync","platforms","url","getDefaultDevServer","getDevServerUrl","Log","log","chalk","watchEnvironmentVariables","bootstrapTypeScriptAsync"],"mappings":"AAAA;;;;+BASsBA,mBAAiB;;aAAjBA,iBAAiB;;;yBATb,cAAc;;;;;;;8DACtB,OAAO;;;;;;2DAEJ,QAAQ;gCACO,mCAAmC;kCAEtC,kCAAkC;6BACrC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,eAAeA,iBAAiB,CACrCC,WAAmB,EACnB,EACEC,IAAI,CAAA,EACJC,QAAQ,CAAA,EACRC,MAAM,CAAA,EAKP,EAC0B;IAC3B,MAAMC,OAAO,GAAwB;QACnCH,IAAI;QACJC,QAAQ;QACRG,SAAS,EAAE,IAAI;QACfC,MAAM,EAAE,KAAK;QAEbC,QAAQ,EAAE;YACRJ,MAAM;SACP;KACF,AAAC;IAEF,MAAMK,gBAAgB,GAAG,IAAIC,iBAAgB,iBAAA,CAACT,WAAW,EAAEI,OAAO,CAAC,AAAC;IAEpE,MAAMI,gBAAgB,CAACE,UAAU,CAAC;QAChC;YACE,uDAAuD;YACvDC,IAAI,EAAE,OAAO;YACbP,OAAO;SACR;KACF,CAAC,CAAC;IAEH,2BAA2B;IAC3B,IAAI,CAACF,QAAQ,IAAIU,IAAAA,YAAa,cAAA,GAAE,EAAE;QAChC,2DAA2D;QAC3D,MAAM,EAAEC,GAAG,CAAA,EAAE,GAAGC,IAAAA,OAAS,EAAA,UAAA,EAACd,WAAW,EAAE;YACrC,4EAA4E;YAC5Ee,yBAAyB,EAAE,IAAI;YAC/BC,WAAW,EAAE,IAAI;SAClB,CAAC,AAAC;YAEUH,UAAa;QAD1B,MAAMI,IAAAA,eAAmB,oBAAA,EAACT,gBAAgB,EAAE;YAC1CU,SAAS,EAAEL,CAAAA,UAAa,GAAbA,GAAG,CAACK,SAAS,YAAbL,UAAa,GAAI,EAAE;SAC/B,CAAC,CAAC;IACL,OAAO;YAEOL,GAAsC;QADlD,uCAAuC;QACvC,MAAMW,GAAG,GAAGX,CAAAA,GAAsC,GAAtCA,gBAAgB,CAACY,mBAAmB,EAAE,SAAiB,GAAvDZ,KAAAA,CAAuD,GAAvDA,GAAsC,CAAEa,eAAe,EAAE,AAAC;QACtE,IAAIF,GAAG,EAAE;YACPG,IAAG,CAACC,GAAG,CAACC,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,sBAAsB,EAAEL,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,IAAI,CAACf,OAAO,CAACF,QAAQ,EAAE;QACrB,MAAMM,gBAAgB,CAACiB,yBAAyB,EAAE,CAAC;QACnD,MAAMjB,gBAAgB,CAACkB,wBAAwB,EAAE,CAAC;IACpD,CAAC;IAED,OAAOlB,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -16,6 +16,7 @@ function _export(target, all) {
|
|
|
16
16
|
_export(exports, {
|
|
17
17
|
devicectlAsync: ()=>devicectlAsync,
|
|
18
18
|
getConnectedAppleDevicesAsync: ()=>getConnectedAppleDevicesAsync,
|
|
19
|
+
launchBinaryOnMacAsync: ()=>launchBinaryOnMacAsync,
|
|
19
20
|
launchAppWithDeviceCtl: ()=>launchAppWithDeviceCtl,
|
|
20
21
|
hasDevicectlEverBeenInstalled: ()=>hasDevicectlEverBeenInstalled,
|
|
21
22
|
installAndLaunchAppAsync: ()=>installAndLaunchAppAsync
|
|
@@ -34,6 +35,13 @@ function _jsonFile() {
|
|
|
34
35
|
};
|
|
35
36
|
return data;
|
|
36
37
|
}
|
|
38
|
+
function _spawnAsync() {
|
|
39
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/spawn-async"));
|
|
40
|
+
_spawnAsync = function() {
|
|
41
|
+
return data;
|
|
42
|
+
};
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
37
45
|
function _chalk() {
|
|
38
46
|
const data = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
39
47
|
_chalk = function() {
|
|
@@ -183,6 +191,23 @@ function assertDevicesJson(results) {
|
|
|
183
191
|
var ref;
|
|
184
192
|
(0, _nodeAssert().default)(results != null && "result" in results && Array.isArray(results == null ? void 0 : (ref = results.result) == null ? void 0 : ref.devices), "Malformed JSON output from devicectl: " + JSON.stringify(results, null, 2));
|
|
185
193
|
}
|
|
194
|
+
async function launchBinaryOnMacAsync(bundleId, appBinaryPath) {
|
|
195
|
+
const args = [
|
|
196
|
+
"-b",
|
|
197
|
+
bundleId,
|
|
198
|
+
appBinaryPath
|
|
199
|
+
];
|
|
200
|
+
try {
|
|
201
|
+
await (0, _spawnAsync().default)("open", args);
|
|
202
|
+
} catch (error) {
|
|
203
|
+
if ("code" in error) {
|
|
204
|
+
if (error.code === 1) {
|
|
205
|
+
throw new _errors.CommandError("MACOS_LAUNCH", "Failed to launch the compatible binary on macOS: open " + args.join(" ") + "\n\n" + error.message);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
186
211
|
async function installAppWithDeviceCtlAsync(uuid, bundleIdOrAppPath, onProgress) {
|
|
187
212
|
// 𝝠 xcrun devicectl device install app --device 00001110-001111110110101A /Users/evanbacon/Library/Developer/Xcode/DerivedData/Router-hgbqaxzhrhkiftfweydvhgttadvn/Build/Products/Debug-iphoneos/Router.app --verbose
|
|
188
213
|
return new Promise((resolve, reject)=>{
|
|
@@ -255,21 +280,14 @@ async function installAppWithDeviceCtlAsync(uuid, bundleIdOrAppPath, onProgress)
|
|
|
255
280
|
});
|
|
256
281
|
}
|
|
257
282
|
async function launchAppWithDeviceCtl(deviceId, bundleId) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
]);
|
|
267
|
-
} catch (error) {
|
|
268
|
-
if (error instanceof _errors.CommandError) {
|
|
269
|
-
throw error;
|
|
270
|
-
}
|
|
271
|
-
throw new _errors.CommandError(`There was an error launching app: ${error}`);
|
|
272
|
-
}
|
|
283
|
+
await devicectlAsync([
|
|
284
|
+
"device",
|
|
285
|
+
"process",
|
|
286
|
+
"launch",
|
|
287
|
+
"--device",
|
|
288
|
+
deviceId,
|
|
289
|
+
bundleId
|
|
290
|
+
]);
|
|
273
291
|
}
|
|
274
292
|
/** Find all error codes from the output log */ function getDeviceCtlErrorCodes(log) {
|
|
275
293
|
return [
|