@expo/cli 0.18.3 → 0.18.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.
- package/build/bin/cli +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 +49 -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/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/utils/telemetry/getContext.js +1 -1
- package/package.json +2 -2
package/build/bin/cli
CHANGED
|
@@ -148,10 +148,10 @@ async function installPackagesAsync(projectRoot, { packages , packageManager , s
|
|
|
148
148
|
const alreadyExcluded = versioning.excludedNativeModules.filter((module)=>module.isExcludedFromValidation);
|
|
149
149
|
const specifiedExactVersion = versioning.excludedNativeModules.filter((module)=>!module.isExcludedFromValidation);
|
|
150
150
|
if (alreadyExcluded.length) {
|
|
151
|
-
_log.log((0, _chalk().default)`\u203A Using ${(0, _strings.joinWithCommasAnd)(alreadyExcluded.map(({ bundledNativeVersion , name , specifiedVersion })=>`${specifiedVersion || "latest"} instead of ${bundledNativeVersion} for ${name}`))} because ${alreadyExcluded.length > 1 ? "they are" : "it is"} listed in {bold expo.install.exclude} in package.json. ${(0, _link.learnMore)("https://expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
151
|
+
_log.log((0, _chalk().default)`\u203A Using ${(0, _strings.joinWithCommasAnd)(alreadyExcluded.map(({ bundledNativeVersion , name , specifiedVersion })=>`${specifiedVersion || "latest"} instead of ${bundledNativeVersion} for ${name}`))} because ${alreadyExcluded.length > 1 ? "they are" : "it is"} listed in {bold expo.install.exclude} in package.json. ${(0, _link.learnMore)("https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
152
152
|
}
|
|
153
153
|
if (specifiedExactVersion.length) {
|
|
154
|
-
_log.log((0, _chalk().default)`\u203A Using ${(0, _strings.joinWithCommasAnd)(specifiedExactVersion.map(({ bundledNativeVersion , name , specifiedVersion })=>`${specifiedVersion} instead of ${bundledNativeVersion} for ${name}`))} because ${specifiedExactVersion.length > 1 ? "these versions" : "this version"} was explicitly provided. Packages excluded from dependency validation should be listed in {bold expo.install.exclude} in package.json. ${(0, _link.learnMore)("https://expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
154
|
+
_log.log((0, _chalk().default)`\u203A Using ${(0, _strings.joinWithCommasAnd)(specifiedExactVersion.map(({ bundledNativeVersion , name , specifiedVersion })=>`${specifiedVersion} instead of ${bundledNativeVersion} for ${name}`))} because ${specifiedExactVersion.length > 1 ? "these versions" : "this version"} was explicitly provided. Packages excluded from dependency validation should be listed in {bold expo.install.exclude} in package.json. ${(0, _link.learnMore)("https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
// `expo` needs to be installed before installing other packages
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig, getPackageJson } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { applyPluginsAsync } from './applyPlugins';\nimport { checkPackagesAsync } from './checkPackages';\nimport { installExpoPackageAsync } from './installExpoPackage';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { getVersionedPackagesAsync } from '../start/doctor/dependencies/getVersionedPackages';\nimport { CommandError } from '../utils/errors';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\n\n/**\n * Installs versions of specified packages compatible with the current Expo SDK version, or\n * checks/ fixes dependencies in project if they don't match compatible versions specified in bundledNativeModules or versions endpoints.\n *\n * @param packages list of packages to install, if installing specific packages and not checking/ fixing\n * @param options options, including check or fix\n * @param packageManagerArguments arguments to forward to the package manager invoked while installing\n * @returns Promise<void>\n */\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n bun: options.bun,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n const expoVersion = findPackageByName(packages, 'expo');\n const otherPackages = packages.filter((pkg) => pkg !== expoVersion);\n\n // Abort early when installing `expo@<version>` and other packages with `--fix/--check`\n if (packageHasVersion(expoVersion) && otherPackages.length && (options.check || options.fix)) {\n throw new CommandError(\n 'BAD_ARGS',\n `Cannot install other packages with ${expoVersion} and --fix or --check`\n );\n }\n\n // Only check/fix packages if `expo@<version>` is not requested\n if (!packageHasVersion(expoVersion) && (options.check || options.fix)) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n ...options,\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n fix,\n check,\n dev,\n }: Options & {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const pkg = getPackageJson(projectRoot);\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n const alreadyExcluded = versioning.excludedNativeModules.filter(\n (module) => module.isExcludedFromValidation\n );\n const specifiedExactVersion = versioning.excludedNativeModules.filter(\n (module) => !module.isExcludedFromValidation\n );\n\n if (alreadyExcluded.length) {\n Log.log(\n chalk`\\u203A Using ${joinWithCommasAnd(\n alreadyExcluded.map(\n ({ bundledNativeVersion, name, specifiedVersion }) =>\n `${specifiedVersion || 'latest'} instead of ${bundledNativeVersion} for ${name}`\n )\n )} because ${\n alreadyExcluded.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n if (specifiedExactVersion.length) {\n Log.log(\n chalk`\\u203A Using ${joinWithCommasAnd(\n specifiedExactVersion.map(\n ({ bundledNativeVersion, name, specifiedVersion }) =>\n `${specifiedVersion} instead of ${bundledNativeVersion} for ${name}`\n )\n )} because ${\n specifiedExactVersion.length > 1 ? 'these versions' : 'this version'\n } was explicitly provided. Packages excluded from dependency validation should be listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n }\n\n // `expo` needs to be installed before installing other packages\n const expoPackage = findPackageByName(packages, 'expo');\n if (expoPackage) {\n const postInstallCommand = packages.filter((pkg) => pkg !== expoPackage);\n\n // Pipe options to the next command\n if (fix) postInstallCommand.push('--fix');\n if (check) postInstallCommand.push('--check');\n\n // Abort after installing `expo`, follow up command is spawn in a new process\n return await installExpoPackageAsync(projectRoot, {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall: versioning.packages.find((pkg) => pkg.startsWith('expo@'))!,\n followUpCommandArgs: postInstallCommand,\n });\n }\n\n if (dev) {\n await packageManager.addDevAsync([...packageManagerArguments, ...versioning.packages]);\n } else {\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n }\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\n/** Find a package, by name, in the requested packages list (`expo` -> `expo`/`expo@<version>`) */\nfunction findPackageByName(packages: string[], name: string) {\n return packages.find((pkg) => pkg === name || pkg.startsWith(`${name}@`));\n}\n\n/** Determine if a specific version is requested for a package */\nfunction packageHasVersion(name = '') {\n return name.includes('@');\n}\n"],"names":["installAsync","installPackagesAsync","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","PackageManager","createForProject","npm","yarn","bun","pnpm","silent","log","Log","expoVersion","findPackageByName","otherPackages","filter","pkg","packageHasVersion","length","check","fix","CommandError","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","dev","getPackageJson","versioning","getVersionedPackagesAsync","chalk","messages","join","name","excludedNativeModules","alreadyExcluded","module","isExcludedFromValidation","specifiedExactVersion","joinWithCommasAnd","map","bundledNativeVersion","specifiedVersion","learnMore","expoPackage","postInstallCommand","push","installExpoPackageAsync","expoPackageToInstall","find","startsWith","followUpCommandArgs","addDevAsync","addAsync","applyPluginsAsync","includes"],"mappings":"AAAA;;;;;;;;;;;IAyBsBA,YAAY,MAAZA,YAAY;IA4DZC,oBAAoB,MAApBA,oBAAoB;;;yBArFA,cAAc;;;;;;;+DACxB,uBAAuB;;;;;;;8DACrC,OAAO;;;;;;8BAES,gBAAgB;+BACf,iBAAiB;oCACZ,sBAAsB;2DAEzC,QAAQ;sCACa,mDAAmD;wBAChE,iBAAiB;wBACJ,iBAAiB;sBACjC,eAAe;yBACd,kBAAkB;yBACX,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAW7C,eAAeD,YAAY,CAChCE,QAAkB,EAClBC,OAA2C,EAC3CC,uBAAiC,GAAG,EAAE,EACtC;IACAC,IAAAA,QAAU,WAAA,EAAC,aAAa,CAAC,CAAC;QAGNF,YAAmB;IAFvC,0EAA0E;IAC1E,mFAAmF;IACnF,MAAMG,WAAW,GAAGH,CAAAA,YAAmB,GAAnBA,OAAO,CAACG,WAAW,YAAnBH,YAAmB,GAAII,IAAAA,OAAyB,0BAAA,EAACC,OAAO,CAACC,GAAG,EAAE,CAAC,AAAC;IACpFC,OAAO,CAAC,WAAW,CAAC,CAACC,IAAI,CAACL,WAAW,CAAC,CAAC;IAEvC,uFAAuF;IACvF,MAAMM,cAAc,GAAGC,eAAc,EAAA,CAACC,gBAAgB,CAACR,WAAW,EAAE;QAClES,GAAG,EAAEZ,OAAO,CAACY,GAAG;QAChBC,IAAI,EA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QAC1C,IAAI5B,KAAK,EAAE2B,kBAAkB,CAACC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE9C,6EAA6E;QAC7E,OAAO,MAAMC,IAAAA,mBAAuB,wBAAA,EAACpD,WAAW,EAAE;YAChDM,cAAc;YACdR,uBAAuB;YACvBuD,oBAAoB,EAAEpB,UAAU,CAACrC,QAAQ,CAAC0D,IAAI,CAAC,CAAClC,GAAG,GAAKA,GAAG,CAACmC,UAAU,CAAC,OAAO,CAAC,CAAC;YAChFC,mBAAmB,EAAEN,kBAAkB;SACxC,CAAC,CAAC;IACL,CAAC;IAED,IAAInB,GAAG,EAAE;QACP,MAAMzB,cAAc,CAACmD,WAAW,CAAC;eAAI3D,uBAAuB;eAAKmC,UAAU,CAACrC,QAAQ;SAAC,CAAC,CAAC;IACzF,OAAO;QACL,MAAMU,cAAc,CAACoD,QAAQ,CAAC;eAAI5D,uBAAuB;eAAKmC,UAAU,CAACrC,QAAQ;SAAC,CAAC,CAAC;IACtF,CAAC;IAED,MAAM+D,IAAAA,aAAiB,kBAAA,EAAC3D,WAAW,EAAEiC,UAAU,CAACrC,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED,gGAAgG,GAChG,SAASqB,iBAAiB,CAACrB,QAAkB,EAAE0C,IAAY,EAAE;IAC3D,OAAO1C,QAAQ,CAAC0D,IAAI,CAAC,CAAClC,GAAG,GAAKA,GAAG,KAAKkB,IAAI,IAAIlB,GAAG,CAACmC,UAAU,CAAC,CAAC,EAAEjB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,+DAA+D,GAC/D,SAASjB,iBAAiB,CAACiB,IAAI,GAAG,EAAE,EAAE;IACpC,OAAOA,IAAI,CAACsB,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig, getPackageJson } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { applyPluginsAsync } from './applyPlugins';\nimport { checkPackagesAsync } from './checkPackages';\nimport { installExpoPackageAsync } from './installExpoPackage';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { getVersionedPackagesAsync } from '../start/doctor/dependencies/getVersionedPackages';\nimport { CommandError } from '../utils/errors';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\n\n/**\n * Installs versions of specified packages compatible with the current Expo SDK version, or\n * checks/ fixes dependencies in project if they don't match compatible versions specified in bundledNativeModules or versions endpoints.\n *\n * @param packages list of packages to install, if installing specific packages and not checking/ fixing\n * @param options options, including check or fix\n * @param packageManagerArguments arguments to forward to the package manager invoked while installing\n * @returns Promise<void>\n */\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n bun: options.bun,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n const expoVersion = findPackageByName(packages, 'expo');\n const otherPackages = packages.filter((pkg) => pkg !== expoVersion);\n\n // Abort early when installing `expo@<version>` and other packages with `--fix/--check`\n if (packageHasVersion(expoVersion) && otherPackages.length && (options.check || options.fix)) {\n throw new CommandError(\n 'BAD_ARGS',\n `Cannot install other packages with ${expoVersion} and --fix or --check`\n );\n }\n\n // Only check/fix packages if `expo@<version>` is not requested\n if (!packageHasVersion(expoVersion) && (options.check || options.fix)) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n ...options,\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n fix,\n check,\n dev,\n }: Options & {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const pkg = getPackageJson(projectRoot);\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n const alreadyExcluded = versioning.excludedNativeModules.filter(\n (module) => module.isExcludedFromValidation\n );\n const specifiedExactVersion = versioning.excludedNativeModules.filter(\n (module) => !module.isExcludedFromValidation\n );\n\n if (alreadyExcluded.length) {\n Log.log(\n chalk`\\u203A Using ${joinWithCommasAnd(\n alreadyExcluded.map(\n ({ bundledNativeVersion, name, specifiedVersion }) =>\n `${specifiedVersion || 'latest'} instead of ${bundledNativeVersion} for ${name}`\n )\n )} because ${\n alreadyExcluded.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n if (specifiedExactVersion.length) {\n Log.log(\n chalk`\\u203A Using ${joinWithCommasAnd(\n specifiedExactVersion.map(\n ({ bundledNativeVersion, name, specifiedVersion }) =>\n `${specifiedVersion} instead of ${bundledNativeVersion} for ${name}`\n )\n )} because ${\n specifiedExactVersion.length > 1 ? 'these versions' : 'this version'\n } was explicitly provided. Packages excluded from dependency validation should be listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n }\n\n // `expo` needs to be installed before installing other packages\n const expoPackage = findPackageByName(packages, 'expo');\n if (expoPackage) {\n const postInstallCommand = packages.filter((pkg) => pkg !== expoPackage);\n\n // Pipe options to the next command\n if (fix) postInstallCommand.push('--fix');\n if (check) postInstallCommand.push('--check');\n\n // Abort after installing `expo`, follow up command is spawn in a new process\n return await installExpoPackageAsync(projectRoot, {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall: versioning.packages.find((pkg) => pkg.startsWith('expo@'))!,\n followUpCommandArgs: postInstallCommand,\n });\n }\n\n if (dev) {\n await packageManager.addDevAsync([...packageManagerArguments, ...versioning.packages]);\n } else {\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n }\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\n/** Find a package, by name, in the requested packages list (`expo` -> `expo`/`expo@<version>`) */\nfunction findPackageByName(packages: string[], name: string) {\n return packages.find((pkg) => pkg === name || pkg.startsWith(`${name}@`));\n}\n\n/** Determine if a specific version is requested for a package */\nfunction packageHasVersion(name = '') {\n return name.includes('@');\n}\n"],"names":["installAsync","installPackagesAsync","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","PackageManager","createForProject","npm","yarn","bun","pnpm","silent","log","Log","expoVersion","findPackageByName","otherPackages","filter","pkg","packageHasVersion","length","check","fix","CommandError","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","dev","getPackageJson","versioning","getVersionedPackagesAsync","chalk","messages","join","name","excludedNativeModules","alreadyExcluded","module","isExcludedFromValidation","specifiedExactVersion","joinWithCommasAnd","map","bundledNativeVersion","specifiedVersion","learnMore","expoPackage","postInstallCommand","push","installExpoPackageAsync","expoPackageToInstall","find","startsWith","followUpCommandArgs","addDevAsync","addAsync","applyPluginsAsync","includes"],"mappings":"AAAA;;;;;;;;;;;IAyBsBA,YAAY,MAAZA,YAAY;IA4DZC,oBAAoB,MAApBA,oBAAoB;;;yBArFA,cAAc;;;;;;;+DACxB,uBAAuB;;;;;;;8DACrC,OAAO;;;;;;8BAES,gBAAgB;+BACf,iBAAiB;oCACZ,sBAAsB;2DAEzC,QAAQ;sCACa,mDAAmD;wBAChE,iBAAiB;wBACJ,iBAAiB;sBACjC,eAAe;yBACd,kBAAkB;yBACX,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAW7C,eAAeD,YAAY,CAChCE,QAAkB,EAClBC,OAA2C,EAC3CC,uBAAiC,GAAG,EAAE,EACtC;IACAC,IAAAA,QAAU,WAAA,EAAC,aAAa,CAAC,CAAC;QAGNF,YAAmB;IAFvC,0EAA0E;IAC1E,mFAAmF;IACnF,MAAMG,WAAW,GAAGH,CAAAA,YAAmB,GAAnBA,OAAO,CAACG,WAAW,YAAnBH,YAAmB,GAAII,IAAAA,OAAyB,0BAAA,EAACC,OAAO,CAACC,GAAG,EAAE,CAAC,AAAC;IACpFC,OAAO,CAAC,WAAW,CAAC,CAACC,IAAI,CAACL,WAAW,CAAC,CAAC;IAEvC,uFAAuF;IACvF,MAAMM,cAAc,GAAGC,eAAc,EAAA,CAACC,gBAAgB,CAACR,WAAW,EAAE;QAClES,GAAG,EAAEZ,OAAO,CAACY,GAAG;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undlerProps } from '../resolveBundlerProps';\n\nexport type XcodeConfiguration = 'Debug' | 'Release';\n\nexport type Options = {\n /** iOS device to target. */\n device?: string | boolean;\n /** Dev server port to use, ignored if `bundler` is `false`. */\n port?: number;\n /** Xcode scheme to build. */\n scheme?: string | boolean;\n /** Xcode configuration to build. Default `Debug` */\n configuration?: XcodeConfiguration;\n /** Should start the bundler dev server. */\n bundler?: boolean;\n /** Should install missing dependencies before building. */\n install?: boolean;\n /** Should use derived data for builds. */\n buildCache?: boolean;\n};\n\nexport type ProjectInfo = {\n isWorkspace: boolean;\n name: string;\n};\n\nexport type BuildProps = {\n /** Root to the iOS native project. */\n projectRoot: string;\n /** Is the target a simulator. */\n isSimulator: boolean;\n xcodeProject: ProjectInfo;\n device: { name: string; udid: string };\n configuration: XcodeConfiguration;\n /** Disable the initial bundling from the native script. */\n shouldSkipInitialBundling: boolean;\n /** Should use derived data for builds. */\n buildCache: boolean;\n scheme: string;\n} & BundlerProps;\n"],"names":[],"mappings":"AAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/ios/XcodeBuild.types.ts"],"sourcesContent":["import { OSType } from '../../start/platforms/ios/simctl';\nimport { BundlerProps } from '../resolveBundlerProps';\n\nexport type XcodeConfiguration = 'Debug' | 'Release';\n\nexport type Options = {\n /** iOS device to target. */\n device?: string | boolean;\n /** Dev server port to use, ignored if `bundler` is `false`. */\n port?: number;\n /** Xcode scheme to build. */\n scheme?: string | boolean;\n /** Xcode configuration to build. Default `Debug` */\n configuration?: XcodeConfiguration;\n /** Should start the bundler dev server. */\n bundler?: boolean;\n /** Should install missing dependencies before building. */\n install?: boolean;\n /** Should use derived data for builds. */\n buildCache?: boolean;\n};\n\nexport type ProjectInfo = {\n isWorkspace: boolean;\n name: string;\n};\n\nexport type BuildProps = {\n /** Root to the iOS native project. */\n projectRoot: string;\n /** Is the target a simulator. */\n isSimulator: boolean;\n xcodeProject: ProjectInfo;\n device: { name: string; udid: string; osType: OSType };\n configuration: XcodeConfiguration;\n /** Disable the initial bundling from the native script. */\n shouldSkipInitialBundling: boolean;\n /** Should use derived data for builds. */\n buildCache: boolean;\n scheme: string;\n} & BundlerProps;\n"],"names":[],"mappings":"AAAA"}
|
|
@@ -100,10 +100,33 @@ async function getConnectedDevicesUsingNativeToolsAsync() {
|
|
|
100
100
|
osVersion: device.deviceProperties.osVersionNumber,
|
|
101
101
|
udid: device.hardwareProperties.udid,
|
|
102
102
|
deviceType: "device",
|
|
103
|
-
connectionType: device.connectionProperties.transportType === "localNetwork" ? "Network" : "USB"
|
|
103
|
+
connectionType: device.connectionProperties.transportType === "localNetwork" ? "Network" : "USB",
|
|
104
|
+
osType: coercePlatformToOsType(device.hardwareProperties.platform)
|
|
104
105
|
};
|
|
105
106
|
});
|
|
106
107
|
}
|
|
108
|
+
function coercePlatformToOsType(platform) {
|
|
109
|
+
// The only two devices I have to test against...
|
|
110
|
+
switch(platform){
|
|
111
|
+
case "iOS":
|
|
112
|
+
return "iOS";
|
|
113
|
+
case "xrOS":
|
|
114
|
+
return "xrOS";
|
|
115
|
+
default:
|
|
116
|
+
debug("Unknown devicectl platform (needs to be added to Expo CLI):", platform);
|
|
117
|
+
return platform;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function coerceUsbmuxdPlatformToOsType(platform) {
|
|
121
|
+
// The only connectable device I have to test against...
|
|
122
|
+
switch(platform){
|
|
123
|
+
case "iPhone OS":
|
|
124
|
+
return "iOS";
|
|
125
|
+
default:
|
|
126
|
+
debug("Unknown usbmuxd platform (needs to be added to Expo CLI):", platform);
|
|
127
|
+
return platform;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
107
130
|
async function getConnectedDevicesAsync() {
|
|
108
131
|
const devices = await Promise.all([
|
|
109
132
|
// Prioritize native tools since they can provide more accurate information.
|
|
@@ -134,7 +157,8 @@ async function getConnectedDevicesAsync() {
|
|
|
134
157
|
osVersion: deviceValues.ProductVersion,
|
|
135
158
|
deviceType: "device",
|
|
136
159
|
connectionType: device.Properties.ConnectionType,
|
|
137
|
-
udid: device.Properties.SerialNumber
|
|
160
|
+
udid: device.Properties.SerialNumber,
|
|
161
|
+
osType: coerceUsbmuxdPlatformToOsType(deviceValues.DeviceClass)
|
|
138
162
|
};
|
|
139
163
|
}));
|
|
140
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/run/ios/appleDevice/AppleDevice.ts"],"sourcesContent":["import Debug from 'debug';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { ClientManager } from './ClientManager';\nimport { IPLookupResult, OnInstallProgressCallback } from './client/InstallationProxyClient';\nimport { LockdowndClient } from './client/LockdowndClient';\nimport { UsbmuxdClient } from './client/UsbmuxdClient';\nimport { AFC_STATUS, AFCError } from './protocol/AFCProtocol';\nimport { Log } from '../../../log';\nimport { XcodeDeveloperDiskImagePrerequisite } from '../../../start/doctor/apple/XcodeDeveloperDiskImagePrerequisite';\nimport * as devicectl from '../../../start/platforms/ios/devicectl';\nimport { launchAppWithDeviceCtl } from '../../../start/platforms/ios/devicectl';\nimport { uniqBy } from '../../../utils/array';\nimport { delayAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { profile } from '../../../utils/profile';\n\nconst debug = Debug('expo:apple-device');\n\n// NOTE(EvanBacon): I have a feeling this shape will change with new iOS versions (tested against iOS 15).\nexport interface ConnectedDevice {\n /** @example `00008101-001964A22629003A` */\n udid: string;\n /** @example `Evan's phone` */\n name: string;\n /** @example `iPhone13,4` */\n model: string;\n /** @example `device` */\n deviceType: 'device' | 'catalyst';\n /** @example `USB` */\n connectionType: 'USB' | 'Network';\n /** @example `15.4.1` */\n osVersion: string;\n}\n\nasync function getConnectedDevicesUsingNativeToolsAsync(): Promise<ConnectedDevice[]> {\n return (\n (await devicectl.getConnectedAppleDevicesAsync())\n // Filter out unpaired devices.\n // TODO: We could improve this logic in the future to attempt pairing if specified.\n .filter((device) => device.connectionProperties.pairingState === 'paired')\n .map((device) => {\n return {\n name: device.deviceProperties.name,\n model: device.hardwareProperties.productType,\n osVersion: device.deviceProperties.osVersionNumber,\n udid: device.hardwareProperties.udid,\n deviceType: 'device',\n connectionType:\n device.connectionProperties.transportType === 'localNetwork' ? 'Network' : 'USB',\n };\n })\n );\n}\n\n/** @returns a list of connected Apple devices. */\nexport async function getConnectedDevicesAsync(): Promise<ConnectedDevice[]> {\n const devices = await Promise.all([\n // Prioritize native tools since they can provide more accurate information.\n // NOTE: xcrun is substantially slower than custom tooling. +1.5s vs 9ms.\n profile(getConnectedDevicesUsingNativeToolsAsync)(),\n profile(getConnectedDevicesUsingCustomToolingAsync)(),\n ]);\n\n return uniqBy(devices.flat(), (device) => device.udid);\n}\n\n/**\n * This supports devices that are running OS versions older than iOS 17.\n *\n * @returns a list of connected Apple devices.\n */\nasync function getConnectedDevicesUsingCustomToolingAsync(): Promise<ConnectedDevice[]> {\n const client = new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket());\n const devices = await client.getDevices();\n client.socket.end();\n\n return Promise.all(\n devices.map(async (device): Promise<ConnectedDevice> => {\n const socket = await new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket()).connect(\n device,\n 62078\n );\n const deviceValues = await new LockdowndClient(socket).getAllValues();\n socket.end();\n // TODO(EvanBacon): Add support for osType (ipad, watchos, etc)\n return {\n // TODO(EvanBacon): Better name\n name: deviceValues.DeviceName ?? deviceValues.ProductType ?? 'unknown iOS device',\n model: deviceValues.ProductType,\n osVersion: deviceValues.ProductVersion,\n deviceType: 'device',\n connectionType: device.Properties.ConnectionType,\n udid: device.Properties.SerialNumber,\n };\n })\n );\n}\n\n/** Install and run an Apple app binary on a connected Apple device. */\nexport async function runOnDevice({\n udid,\n appPath,\n bundleId,\n waitForApp,\n deltaPath,\n onProgress,\n}: {\n /** Apple device UDID */\n udid: string;\n /** File path to the app binary (ipa) */\n appPath: string;\n /** Bundle identifier for the app at `appPath` */\n bundleId: string;\n /** Wait for the app to launch before returning */\n waitForApp: boolean;\n /** File path to the app deltas folder to use for faster subsequent installs */\n deltaPath: string;\n /** Callback to be called with progress updates */\n onProgress: OnInstallProgressCallback;\n}) {\n debug('Running on device:', { udid, appPath, bundleId, waitForApp, deltaPath });\n\n const clientManager = await ClientManager.create(udid);\n\n try {\n await mountDeveloperDiskImage(clientManager);\n\n const packageName = path.basename(appPath);\n const destPackagePath = path.join('PublicStaging', packageName);\n\n await uploadApp(clientManager, { appBinaryPath: appPath, destinationPath: destPackagePath });\n\n const installer = await clientManager.getInstallationProxyClient();\n await installer.installApp(\n destPackagePath,\n bundleId,\n {\n // https://github.com/ios-control/ios-deploy/blob/0f2ffb1e564aa67a2dfca7cdf13de47ce489d835/src/ios-deploy/ios-deploy.m#L2491-L2508\n ApplicationsType: 'Any',\n\n CFBundleIdentifier: bundleId,\n CloseOnInvalidate: '1',\n InvalidateOnDetach: '1',\n IsUserInitiated: '1',\n // Disable checking for wifi devices, this is nominally faster.\n PreferWifi: '0',\n // Only info I could find on these:\n // https://github.com/wwxxyx/Quectel_BG96/blob/310876f90fc1093a59e45e381160eddcc31697d0/Apple_Homekit/homekit_certification_tools/ATS%206/ATS%206/ATS.app/Contents/Frameworks/CaptureKit.framework/Versions/A/Resources/MobileDevice/MobileInstallation.h#L112-L121\n PackageType: 'Developer',\n ShadowParentKey: deltaPath,\n // SkipUninstall: '1'\n },\n onProgress\n );\n\n const {\n // TODO(EvanBacon): This can be undefined when querying App Clips.\n [bundleId]: appInfo,\n } = await installer.lookupApp([bundleId]);\n\n if (appInfo) {\n // launch fails with EBusy or ENotFound if you try to launch immediately after install\n await delayAsync(200);\n const debugServerClient = await launchApp(clientManager, {\n bundleId,\n appInfo,\n detach: !waitForApp,\n });\n\n if (waitForApp && debugServerClient) {\n installExitHooks(async () => {\n // causes continue() to return\n debugServerClient.halt();\n // give continue() time to return response\n await delayAsync(64);\n });\n\n debug(`Waiting for app to close...\\n`);\n const result = await debugServerClient.continue();\n // TODO: I have no idea what this packet means yet (successful close?)\n // if not a close (ie, most likely due to halt from onBeforeExit), then kill the app\n if (result !== 'W00') {\n await debugServerClient.kill();\n }\n }\n } else {\n Log.warn(`App \"${bundleId}\" installed but couldn't be launched. Open on device manually.`);\n }\n } finally {\n clientManager.end();\n }\n}\n\n/** Mount the developer disk image for Xcode. */\nasync function mountDeveloperDiskImage(clientManager: ClientManager) {\n const imageMounter = await clientManager.getMobileImageMounterClient();\n // Check if already mounted. If not, mount.\n if (!(await imageMounter.lookupImage()).ImageSignature) {\n // verify DeveloperDiskImage exists (TODO: how does this work on Windows/Linux?)\n // TODO: if windows/linux, download?\n const version = await (await clientManager.getLockdowndClient()).getValue('ProductVersion');\n const developerDiskImagePath = await XcodeDeveloperDiskImagePrerequisite.instance.assertAsync({\n version,\n });\n const developerDiskImageSig = fs.readFileSync(`${developerDiskImagePath}.signature`);\n await imageMounter.uploadImage(developerDiskImagePath, developerDiskImageSig);\n await imageMounter.mountImage(developerDiskImagePath, developerDiskImageSig);\n }\n}\n\nasync function uploadApp(\n clientManager: ClientManager,\n { appBinaryPath, destinationPath }: { appBinaryPath: string; destinationPath: string }\n) {\n const afcClient = await clientManager.getAFCClient();\n try {\n await afcClient.getFileInfo('PublicStaging');\n } catch (err: any) {\n if (err instanceof AFCError && err.status === AFC_STATUS.OBJECT_NOT_FOUND) {\n await afcClient.makeDirectory('PublicStaging');\n } else {\n throw err;\n }\n }\n await afcClient.uploadDirectory(appBinaryPath, destinationPath);\n}\n\nasync function launchAppWithUsbmux(\n clientManager: ClientManager,\n { appInfo, detach }: { appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n let tries = 0;\n while (tries < 3) {\n const debugServerClient = await clientManager.getDebugserverClient();\n await debugServerClient.setMaxPacketSize(1024);\n await debugServerClient.setWorkingDir(appInfo.Container);\n await debugServerClient.launchApp(appInfo.Path, appInfo.CFBundleExecutable);\n\n const result = await debugServerClient.checkLaunchSuccess();\n if (result === 'OK') {\n if (detach) {\n // https://github.com/libimobiledevice/libimobiledevice/blob/25059d4c7d75e03aab516af2929d7c6e6d4c17de/tools/idevicedebug.c#L455-L464\n const res = await debugServerClient.sendCommand('D', []);\n debug('Disconnect from debug server request:', res);\n if (res !== 'OK') {\n console.warn(\n 'Something went wrong while attempting to disconnect from iOS debug server, you may need to reopen the app manually.'\n );\n }\n }\n\n return debugServerClient;\n } else if (result === 'EBusy' || result === 'ENotFound') {\n debug('Device busy or app not found, trying to launch again in .5s...');\n tries++;\n debugServerClient.socket.end();\n await delayAsync(500);\n } else {\n throw new CommandError(`There was an error launching app: ${result}`);\n }\n }\n throw new CommandError('Unable to launch app, number of tries exceeded');\n}\n\n/**\n * iOS 17 introduces a new protocol called RemoteXPC.\n * This is not yet implemented, so we fallback to devicectl.\n *\n * @see https://github.com/doronz88/pymobiledevice3/blob/master/misc/RemoteXPC.md#process-remoted\n */\nasync function launchApp(\n clientManager: ClientManager,\n {\n bundleId,\n appInfo,\n detach,\n }: { bundleId: string; appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n try {\n return await launchAppWithUsbmux(clientManager, { appInfo, detach });\n } catch (error) {\n debug('Failed to launch app with Usbmuxd, falling back to xcrun...', error);\n\n // Get the device UDID and close the connection, to allow `xcrun devicectl` to connect\n const deviceId = clientManager.device.Properties.SerialNumber;\n clientManager.end();\n\n // Fallback to devicectl for iOS 17 support\n return await launchAppWithDeviceCtl(deviceId, bundleId);\n }\n}\n"],"names":["getConnectedDevicesAsync","runOnDevice","debug","Debug","getConnectedDevicesUsingNativeToolsAsync","devicectl","getConnectedAppleDevicesAsync","filter","device","connectionProperties","pairingState","map","name","deviceProperties","model","hardwareProperties","productType","osVersion","osVersionNumber","udid","deviceType","connectionType","transportType","devices","Promise","all","profile","getConnectedDevicesUsingCustomToolingAsync","uniqBy","flat","client","UsbmuxdClient","connectUsbmuxdSocket","getDevices","socket","end","connect","deviceValues","LockdowndClient","getAllValues","DeviceName","ProductType","ProductVersion","Properties","ConnectionType","SerialNumber","appPath","bundleId","waitForApp","deltaPath","onProgress","clientManager","ClientManager","create","mountDeveloperDiskImage","packageName","path","basename","destPackagePath","join","uploadApp","appBinaryPath","destinationPath","installer","getInstallationProxyClient","installApp","ApplicationsType","CFBundleIdentifier","CloseOnInvalidate","InvalidateOnDetach","IsUserInitiated","PreferWifi","PackageType","ShadowParentKey","appInfo","lookupApp","delayAsync","debugServerClient","launchApp","detach","installExitHooks","halt","result","continue","kill","Log","warn","imageMounter","getMobileImageMounterClient","lookupImage","ImageSignature","version","getLockdowndClient","getValue","developerDiskImagePath","XcodeDeveloperDiskImagePrerequisite","instance","assertAsync","developerDiskImageSig","fs","readFileSync","uploadImage","mountImage","afcClient","getAFCClient","getFileInfo","err","AFCError","status","AFC_STATUS","OBJECT_NOT_FOUND","makeDirectory","uploadDirectory","launchAppWithUsbmux","tries","getDebugserverClient","setMaxPacketSize","setWorkingDir","Container","Path","CFBundleExecutable","checkLaunchSuccess","res","sendCommand","console","CommandError","error","deviceId","launchAppWithDeviceCtl"],"mappings":"AAAA;;;;;;;;;;;IA0DsBA,wBAAwB,MAAxBA,wBAAwB;IA4CxBC,WAAW,MAAXA,WAAW;;;8DAtGf,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;+BAEO,iBAAiB;iCAEf,0BAA0B;+BAC5B,wBAAwB;6BACjB,wBAAwB;qBACzC,cAAc;qDACkB,iEAAiE;iEAC1F,wCAAwC;uBAE5C,sBAAsB;uBAClB,sBAAsB;wBACpB,uBAAuB;sBACnB,qBAAqB;yBAC9B,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhD,MAAMC,KAAK,GAAGC,IAAAA,MAAK,EAAA,QAAA,EAAC,mBAAmB,CAAC,AAAC;AAkBzC,eAAeC,wCAAwC,GAA+B;IACpF,OACE,CAAC,MAAMC,UAAS,CAACC,6BAA6B,EAAE,CAAC,AAC/C,+BAA+B;IAC/B,mFAAmF;KAClFC,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;QAC3C,OAAO,MAAM6F,IAAAA,UAAsB,uBAAA,EAACD,QAAQ,EAAEhF,QAAQ,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/appleDevice/AppleDevice.ts"],"sourcesContent":["import Debug from 'debug';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { ClientManager } from './ClientManager';\nimport { IPLookupResult, OnInstallProgressCallback } from './client/InstallationProxyClient';\nimport { LockdowndClient } from './client/LockdowndClient';\nimport { UsbmuxdClient } from './client/UsbmuxdClient';\nimport { AFC_STATUS, AFCError } from './protocol/AFCProtocol';\nimport { Log } from '../../../log';\nimport { XcodeDeveloperDiskImagePrerequisite } from '../../../start/doctor/apple/XcodeDeveloperDiskImagePrerequisite';\nimport * as devicectl from '../../../start/platforms/ios/devicectl';\nimport { launchAppWithDeviceCtl } from '../../../start/platforms/ios/devicectl';\nimport { OSType } from '../../../start/platforms/ios/simctl';\nimport { uniqBy } from '../../../utils/array';\nimport { delayAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { profile } from '../../../utils/profile';\n\nconst debug = Debug('expo:apple-device');\n\n// NOTE(EvanBacon): I have a feeling this shape will change with new iOS versions (tested against iOS 15).\nexport interface ConnectedDevice {\n /** @example `00008101-001964A22629003A` */\n udid: string;\n /** @example `Evan's phone` */\n name: string;\n /** @example `iPhone13,4` */\n model: string;\n /** @example `device` */\n deviceType: 'device' | 'catalyst';\n /** @example `USB` */\n connectionType: 'USB' | 'Network';\n /** @example `15.4.1` */\n osVersion: string;\n\n osType: OSType;\n}\n\nasync function getConnectedDevicesUsingNativeToolsAsync(): Promise<ConnectedDevice[]> {\n return (\n (await devicectl.getConnectedAppleDevicesAsync())\n // Filter out unpaired devices.\n // TODO: We could improve this logic in the future to attempt pairing if specified.\n .filter((device) => device.connectionProperties.pairingState === 'paired')\n .map((device) => {\n return {\n name: device.deviceProperties.name,\n model: device.hardwareProperties.productType,\n osVersion: device.deviceProperties.osVersionNumber,\n udid: device.hardwareProperties.udid,\n deviceType: 'device',\n connectionType:\n device.connectionProperties.transportType === 'localNetwork' ? 'Network' : 'USB',\n osType: coercePlatformToOsType(device.hardwareProperties.platform),\n };\n })\n );\n}\n\nfunction coercePlatformToOsType(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 return 'xrOS';\n default:\n debug('Unknown devicectl platform (needs to be added to Expo CLI):', platform);\n return platform as OSType;\n }\n}\nfunction coerceUsbmuxdPlatformToOsType(platform: string): OSType {\n // The only connectable device I have to test against...\n switch (platform) {\n case 'iPhone OS':\n return 'iOS';\n default:\n debug('Unknown usbmuxd platform (needs to be added to Expo CLI):', platform);\n return platform as OSType;\n }\n}\n\n/** @returns a list of connected Apple devices. */\nexport async function getConnectedDevicesAsync(): Promise<ConnectedDevice[]> {\n const devices = await Promise.all([\n // Prioritize native tools since they can provide more accurate information.\n // NOTE: xcrun is substantially slower than custom tooling. +1.5s vs 9ms.\n profile(getConnectedDevicesUsingNativeToolsAsync)(),\n profile(getConnectedDevicesUsingCustomToolingAsync)(),\n ]);\n\n return uniqBy(devices.flat(), (device) => device.udid);\n}\n\n/**\n * This supports devices that are running OS versions older than iOS 17.\n *\n * @returns a list of connected Apple devices.\n */\nasync function getConnectedDevicesUsingCustomToolingAsync(): Promise<ConnectedDevice[]> {\n const client = new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket());\n const devices = await client.getDevices();\n client.socket.end();\n\n return Promise.all(\n devices.map(async (device): Promise<ConnectedDevice> => {\n const socket = await new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket()).connect(\n device,\n 62078\n );\n const deviceValues = await new LockdowndClient(socket).getAllValues();\n socket.end();\n // TODO(EvanBacon): Add support for osType (ipad, watchos, etc)\n return {\n // TODO(EvanBacon): Better name\n name: deviceValues.DeviceName ?? deviceValues.ProductType ?? 'unknown iOS device',\n model: deviceValues.ProductType,\n osVersion: deviceValues.ProductVersion,\n deviceType: 'device',\n connectionType: device.Properties.ConnectionType,\n udid: device.Properties.SerialNumber,\n osType: coerceUsbmuxdPlatformToOsType(deviceValues.DeviceClass),\n };\n })\n );\n}\n\n/** Install and run an Apple app binary on a connected Apple device. */\nexport async function runOnDevice({\n udid,\n appPath,\n bundleId,\n waitForApp,\n deltaPath,\n onProgress,\n}: {\n /** Apple device UDID */\n udid: string;\n /** File path to the app binary (ipa) */\n appPath: string;\n /** Bundle identifier for the app at `appPath` */\n bundleId: string;\n /** Wait for the app to launch before returning */\n waitForApp: boolean;\n /** File path to the app deltas folder to use for faster subsequent installs */\n deltaPath: string;\n /** Callback to be called with progress updates */\n onProgress: OnInstallProgressCallback;\n}) {\n debug('Running on device:', { udid, appPath, bundleId, waitForApp, deltaPath });\n\n const clientManager = await ClientManager.create(udid);\n\n try {\n await mountDeveloperDiskImage(clientManager);\n\n const packageName = path.basename(appPath);\n const destPackagePath = path.join('PublicStaging', packageName);\n\n await uploadApp(clientManager, { appBinaryPath: appPath, destinationPath: destPackagePath });\n\n const installer = await clientManager.getInstallationProxyClient();\n await installer.installApp(\n destPackagePath,\n bundleId,\n {\n // https://github.com/ios-control/ios-deploy/blob/0f2ffb1e564aa67a2dfca7cdf13de47ce489d835/src/ios-deploy/ios-deploy.m#L2491-L2508\n ApplicationsType: 'Any',\n\n CFBundleIdentifier: bundleId,\n CloseOnInvalidate: '1',\n InvalidateOnDetach: '1',\n IsUserInitiated: '1',\n // Disable checking for wifi devices, this is nominally faster.\n PreferWifi: '0',\n // Only info I could find on these:\n // https://github.com/wwxxyx/Quectel_BG96/blob/310876f90fc1093a59e45e381160eddcc31697d0/Apple_Homekit/homekit_certification_tools/ATS%206/ATS%206/ATS.app/Contents/Frameworks/CaptureKit.framework/Versions/A/Resources/MobileDevice/MobileInstallation.h#L112-L121\n PackageType: 'Developer',\n ShadowParentKey: deltaPath,\n // SkipUninstall: '1'\n },\n onProgress\n );\n\n const {\n // TODO(EvanBacon): This can be undefined when querying App Clips.\n [bundleId]: appInfo,\n } = await installer.lookupApp([bundleId]);\n\n if (appInfo) {\n // launch fails with EBusy or ENotFound if you try to launch immediately after install\n await delayAsync(200);\n const debugServerClient = await launchApp(clientManager, {\n bundleId,\n appInfo,\n detach: !waitForApp,\n });\n\n if (waitForApp && debugServerClient) {\n installExitHooks(async () => {\n // causes continue() to return\n debugServerClient.halt();\n // give continue() time to return response\n await delayAsync(64);\n });\n\n debug(`Waiting for app to close...\\n`);\n const result = await debugServerClient.continue();\n // TODO: I have no idea what this packet means yet (successful close?)\n // if not a close (ie, most likely due to halt from onBeforeExit), then kill the app\n if (result !== 'W00') {\n await debugServerClient.kill();\n }\n }\n } else {\n Log.warn(`App \"${bundleId}\" installed but couldn't be launched. Open on device manually.`);\n }\n } finally {\n clientManager.end();\n }\n}\n\n/** Mount the developer disk image for Xcode. */\nasync function mountDeveloperDiskImage(clientManager: ClientManager) {\n const imageMounter = await clientManager.getMobileImageMounterClient();\n // Check if already mounted. If not, mount.\n if (!(await imageMounter.lookupImage()).ImageSignature) {\n // verify DeveloperDiskImage exists (TODO: how does this work on Windows/Linux?)\n // TODO: if windows/linux, download?\n const version = await (await clientManager.getLockdowndClient()).getValue('ProductVersion');\n const developerDiskImagePath = await XcodeDeveloperDiskImagePrerequisite.instance.assertAsync({\n version,\n });\n const developerDiskImageSig = fs.readFileSync(`${developerDiskImagePath}.signature`);\n await imageMounter.uploadImage(developerDiskImagePath, developerDiskImageSig);\n await imageMounter.mountImage(developerDiskImagePath, developerDiskImageSig);\n }\n}\n\nasync function uploadApp(\n clientManager: ClientManager,\n { appBinaryPath, destinationPath }: { appBinaryPath: string; destinationPath: string }\n) {\n const afcClient = await clientManager.getAFCClient();\n try {\n await afcClient.getFileInfo('PublicStaging');\n } catch (err: any) {\n if (err instanceof AFCError && err.status === AFC_STATUS.OBJECT_NOT_FOUND) {\n await afcClient.makeDirectory('PublicStaging');\n } else {\n throw err;\n }\n }\n await afcClient.uploadDirectory(appBinaryPath, destinationPath);\n}\n\nasync function launchAppWithUsbmux(\n clientManager: ClientManager,\n { appInfo, detach }: { appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n let tries = 0;\n while (tries < 3) {\n const debugServerClient = await clientManager.getDebugserverClient();\n await debugServerClient.setMaxPacketSize(1024);\n await debugServerClient.setWorkingDir(appInfo.Container);\n await debugServerClient.launchApp(appInfo.Path, appInfo.CFBundleExecutable);\n\n const result = await debugServerClient.checkLaunchSuccess();\n if (result === 'OK') {\n if (detach) {\n // https://github.com/libimobiledevice/libimobiledevice/blob/25059d4c7d75e03aab516af2929d7c6e6d4c17de/tools/idevicedebug.c#L455-L464\n const res = await debugServerClient.sendCommand('D', []);\n debug('Disconnect from debug server request:', res);\n if (res !== 'OK') {\n console.warn(\n 'Something went wrong while attempting to disconnect from iOS debug server, you may need to reopen the app manually.'\n );\n }\n }\n\n return debugServerClient;\n } else if (result === 'EBusy' || result === 'ENotFound') {\n debug('Device busy or app not found, trying to launch again in .5s...');\n tries++;\n debugServerClient.socket.end();\n await delayAsync(500);\n } else {\n throw new CommandError(`There was an error launching app: ${result}`);\n }\n }\n throw new CommandError('Unable to launch app, number of tries exceeded');\n}\n\n/**\n * iOS 17 introduces a new protocol called RemoteXPC.\n * This is not yet implemented, so we fallback to devicectl.\n *\n * @see https://github.com/doronz88/pymobiledevice3/blob/master/misc/RemoteXPC.md#process-remoted\n */\nasync function launchApp(\n clientManager: ClientManager,\n {\n bundleId,\n appInfo,\n detach,\n }: { bundleId: string; appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n try {\n return await launchAppWithUsbmux(clientManager, { appInfo, detach });\n } catch (error) {\n debug('Failed to launch app with Usbmuxd, falling back to xcrun...', error);\n\n // Get the device UDID and close the connection, to allow `xcrun devicectl` to connect\n const deviceId = clientManager.device.Properties.SerialNumber;\n clientManager.end();\n\n // Fallback to devicectl for iOS 17 support\n return await launchAppWithDeviceCtl(deviceId, bundleId);\n }\n}\n"],"names":["getConnectedDevicesAsync","runOnDevice","debug","Debug","getConnectedDevicesUsingNativeToolsAsync","devicectl","getConnectedAppleDevicesAsync","filter","device","connectionProperties","pairingState","map","name","deviceProperties","model","hardwareProperties","productType","osVersion","osVersionNumber","udid","deviceType","connectionType","transportType","osType","coercePlatformToOsType","platform","coerceUsbmuxdPlatformToOsType","devices","Promise","all","profile","getConnectedDevicesUsingCustomToolingAsync","uniqBy","flat","client","UsbmuxdClient","connectUsbmuxdSocket","getDevices","socket","end","connect","deviceValues","LockdowndClient","getAllValues","DeviceName","ProductType","ProductVersion","Properties","ConnectionType","SerialNumber","DeviceClass","appPath","bundleId","waitForApp","deltaPath","onProgress","clientManager","ClientManager","create","mountDeveloperDiskImage","packageName","path","basename","destPackagePath","join","uploadApp","appBinaryPath","destinationPath","installer","getInstallationProxyClient","installApp","ApplicationsType","CFBundleIdentifier","CloseOnInvalidate","InvalidateOnDetach","IsUserInitiated","PreferWifi","PackageType","ShadowParentKey","appInfo","lookupApp","delayAsync","debugServerClient","launchApp","detach","installExitHooks","halt","result","continue","kill","Log","warn","imageMounter","getMobileImageMounterClient","lookupImage","ImageSignature","version","getLockdowndClient","getValue","developerDiskImagePath","XcodeDeveloperDiskImagePrerequisite","instance","assertAsync","developerDiskImageSig","fs","readFileSync","uploadImage","mountImage","afcClient","getAFCClient","getFileInfo","err","AFCError","status","AFC_STATUS","OBJECT_NOT_FOUND","makeDirectory","uploadDirectory","launchAppWithUsbmux","tries","getDebugserverClient","setMaxPacketSize","setWorkingDir","Container","Path","CFBundleExecutable","checkLaunchSuccess","res","sendCommand","console","CommandError","error","deviceId","launchAppWithDeviceCtl"],"mappings":"AAAA;;;;;;;;;;;IAqFsBA,wBAAwB,MAAxBA,wBAAwB;IA6CxBC,WAAW,MAAXA,WAAW;;;8DAlIf,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;+BAEO,iBAAiB;iCAEf,0BAA0B;+BA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Build"));
|
|
24
24
|
const _installOnDeviceAsync = require("./appleDevice/installOnDeviceAsync");
|
|
25
25
|
const _appleDeviceManager = require("../../start/platforms/ios/AppleDeviceManager");
|
|
26
|
+
const _devicectl = require("../../start/platforms/ios/devicectl");
|
|
26
27
|
const _simctlLogging = require("../../start/platforms/ios/simctlLogging");
|
|
27
28
|
const _plist = require("../../utils/plist");
|
|
28
29
|
const _profile = require("../../utils/profile");
|
|
@@ -73,13 +74,17 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
73
74
|
async function launchAppAsync(binaryPath, manager, props) {
|
|
74
75
|
const appId = await (0, _profile.profile)(getBundleIdentifierForBinaryAsync)(binaryPath);
|
|
75
76
|
if (!props.isSimulator) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
if (props.device.osType === "macOS") {
|
|
78
|
+
await (0, _devicectl.launchBinaryOnMacAsync)(appId, binaryPath);
|
|
79
|
+
} else {
|
|
80
|
+
await (0, _profile.profile)(_installOnDeviceAsync.installOnDeviceAsync)({
|
|
81
|
+
bundleIdentifier: appId,
|
|
82
|
+
bundle: binaryPath,
|
|
83
|
+
appDeltaDirectory: (0, _installOnDeviceAsync.getAppDeltaDirectory)(appId),
|
|
84
|
+
udid: props.device.udid,
|
|
85
|
+
deviceName: props.device.name
|
|
86
|
+
});
|
|
87
|
+
}
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
90
|
_xcodeBuild.logPrettyItem((0, _chalk().default)`{bold Installing} on ${props.device.name}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/ios/launchApp.ts"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { BuildProps } from './XcodeBuild.types';\nimport { getAppDeltaDirectory, installOnDeviceAsync } from './appleDevice/installOnDeviceAsync';\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';\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
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/ios/launchApp.ts"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { BuildProps } from './XcodeBuild.types';\nimport { getAppDeltaDirectory, installOnDeviceAsync } from './appleDevice/installOnDeviceAsync';\nimport { AppleDeviceManager } from '../../start/platforms/ios/AppleDeviceManager';\nimport { launchBinaryOnMacAsync } from '../../start/platforms/ios/devicectl';\nimport { SimulatorLogStreamer } from '../../start/platforms/ios/simctlLogging';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { parsePlistAsync } from '../../utils/plist';\nimport { profile } from '../../utils/profile';\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 if (props.device.osType === 'macOS') {\n await launchBinaryOnMacAsync(appId, binaryPath);\n } else {\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 }\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","binaryPath","manager","props","appId","profile","getBundleIdentifierForBinaryAsync","isSimulator","device","osType","launchBinaryOnMacAsync","installOnDeviceAsync","bundleIdentifier","bundle","appDeltaDirectory","getAppDeltaDirectory","udid","deviceName","name","XcodeBuild","logPrettyItem","chalk","AppleDeviceManager","resolveAsync","installAppAsync","shouldStartBundler","SimulatorLogStreamer","getStreamer","attachAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","builtInfoPlistPath","path","join","CFBundleIdentifier","parsePlistAsync"],"mappings":"AAAA;;;;+BAcsBA,gBAAc;;aAAdA,cAAc;;;8DAdlB,OAAO;;;;;;;8DACR,MAAM;;;;;;kEAEK,cAAc;sCAEiB,oCAAoC;oCAC5D,8CAA8C;2BAC1C,qCAAqC;+BACvC,yCAAyC;uBAE9C,mBAAmB;yBAC3B,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtC,eAAeA,cAAc,CAClCC,UAAkB,EAClBC,OAAyB,EACzBC,KAAwE,EACxE;IACA,MAAMC,KAAK,GAAG,MAAMC,IAAAA,QAAO,QAAA,EAACC,iCAAiC,CAAC,CAACL,UAAU,CAAC,AAAC;IAE3E,IAAI,CAACE,KAAK,CAACI,WAAW,EAAE;QACtB,IAAIJ,KAAK,CAACK,MAAM,CAACC,MAAM,K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,CACX,CAAC;AACJ,CAAC;AAED,eAAeF,iCAAiC,CAACL,UAAkB,EAAmB;IACpF,MAAM+B,kBAAkB,GAAGC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACjC,UAAU,EAAE,YAAY,CAAC,AAAC;IAC/D,MAAM,EAAEkC,kBAAkB,CAAA,EAAE,GAAG,MAAMC,IAAAA,MAAe,gBAAA,EAACJ,kBAAkB,CAAC,AAAC;IACzE,OAAOG,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -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,+D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AS,EAAEN,MAAM,CAACY,EAAE;QACpB,2BAA2B,GAC3BC,UAAU,EAAE,CAAC,EAAEb,MAAM,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,C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C;KACF,CAAC,AAAC;IACH,OAAOM,OAAO,CAACc,IAAI,CAAC,CAACC,MAAM,GAAKA,MAAM,CAAChB,IAAI,KAAKD,KAAK,CAAC,CAAE;AAC1D,CAAC"}
|
|
@@ -12,11 +12,13 @@ _export(exports, {
|
|
|
12
12
|
resolveDeviceAsync: ()=>resolveDeviceAsync,
|
|
13
13
|
isSimulatorDevice: ()=>isSimulatorDevice
|
|
14
14
|
});
|
|
15
|
+
const _appleDestinations = require("./appleDestinations");
|
|
15
16
|
const _promptDevice = require("./promptDevice");
|
|
16
17
|
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,70 @@ 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 , ...buildProps }) {
|
|
67
|
+
const devices = await (0, _promptAppleDevice.sortDefaultDeviceToBeginningAsync)((0, _array.uniqBy)((await Promise.all([
|
|
68
|
+
_appleDevice.getConnectedDevicesAsync(),
|
|
69
|
+
await (0, _profile.profile)(_simctl.getDevicesAsync)(),
|
|
70
|
+
(0, _appleDestinations.resolveDestinationsAsync)(buildProps),
|
|
71
|
+
])).flat(), (item)=>item.udid), osType);
|
|
72
|
+
// Sort devices to top of front of the list
|
|
73
|
+
const physical = [];
|
|
74
|
+
const simulators = devices.filter((device)=>{
|
|
75
|
+
if ("isAvailable" in device) {
|
|
76
|
+
return true;
|
|
77
|
+
} else {
|
|
78
|
+
physical.push(device);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const isPhone = (a)=>a.osType === "iOS";
|
|
83
|
+
const sorted = [
|
|
84
|
+
...physical.sort((a, b)=>{
|
|
85
|
+
const aPhone = isPhone(a);
|
|
86
|
+
const bPhone = isPhone(b);
|
|
87
|
+
if (aPhone && !bPhone) return -1;
|
|
88
|
+
if (!aPhone && bPhone) return 1;
|
|
89
|
+
return 0;
|
|
90
|
+
}),
|
|
91
|
+
...simulators,
|
|
69
92
|
];
|
|
70
93
|
// If osType is defined, then filter out ineligible simulators.
|
|
71
94
|
// 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(
|
|
95
|
+
return osType ? filterDevicesForOsType(sorted, osType) : sorted;
|
|
73
96
|
}
|
|
74
97
|
/** @returns a list of devices, filtered by the provided `osType`. */ function filterDevicesForOsType(devices, osType) {
|
|
75
|
-
return devices.filter((device)
|
|
98
|
+
return devices.filter((device)=>{
|
|
99
|
+
if (osType === "iOS") {
|
|
100
|
+
// Compatible devices for iOS builds
|
|
101
|
+
return [
|
|
102
|
+
"iOS",
|
|
103
|
+
"macOS",
|
|
104
|
+
"xrOS"
|
|
105
|
+
].includes(device.osType);
|
|
106
|
+
}
|
|
107
|
+
return device.osType === osType;
|
|
108
|
+
});
|
|
76
109
|
}
|
|
77
|
-
async function resolveDeviceAsync(device,
|
|
110
|
+
async function resolveDeviceAsync(device, buildProps) {
|
|
78
111
|
await _appleDeviceManager.AppleDeviceManager.assertSystemRequirementsAsync();
|
|
79
112
|
if (!device) {
|
|
80
113
|
/** Finds the first possible device and returns in a booted state. */ const manager = await _appleDeviceManager.AppleDeviceManager.resolveAsync({
|
|
81
114
|
device: {
|
|
82
|
-
osType
|
|
115
|
+
osType: buildProps.osType
|
|
83
116
|
}
|
|
84
117
|
});
|
|
85
|
-
_log.debug(`Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${osType})`);
|
|
118
|
+
_log.debug(`Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${buildProps.osType})`);
|
|
86
119
|
return manager.device;
|
|
87
120
|
}
|
|
88
|
-
const devices = await getDevicesAsync(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const resolved = device === true ? await (0, _promptDevice.promptDeviceAsync)(devices) : findDeviceFromSearchValue(devices, device.toLowerCase());
|
|
121
|
+
const devices = await getDevicesAsync(buildProps);
|
|
122
|
+
const resolved = device === true ? // @ts-expect-error
|
|
123
|
+
await (0, _promptDevice.promptDeviceAsync)(devices) : findDeviceFromSearchValue(devices, device.toLowerCase());
|
|
92
124
|
return ensureBootedAsync(resolved);
|
|
93
125
|
}
|
|
94
126
|
function isSimulatorDevice(device) {
|
|
95
|
-
|
|
127
|
+
var ref;
|
|
128
|
+
return !("deviceType" in device) || !!((ref = device.deviceType) == null ? void 0 : ref.startsWith == null ? void 0 : ref.startsWith("com.apple.CoreSimulator.SimDeviceType."));
|
|
96
129
|
}
|
|
97
130
|
/** @returns device matching the `searchValue` against name or UDID. */ function findDeviceFromSearchValue(devices, searchValue) {
|
|
98
131
|
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","buildProps","devices","sortDefaultDeviceToBeginningAsync","uniqBy","Promise","all","AppleDevice","getConnectedDevicesAsync","profile","SimControl","resolveDestinationsAsync","flat","item","udid","physical","simulators","filter","device","push","isPhone","a","sorted","sort","b","aPhone","bPhone","filterDevicesForOsType","includes","AppleDeviceManager","assertSystemRequirementsAsync","manager","resolveAsync","Log","debug","name","resolved","promptDeviceAsync","findDeviceFromSearchValue","toLowerCase","ensureBootedAsync","deviceType","startsWith","searchValue","find","CommandError","logDeviceArgument","ensureSimulatorOpenAsync"],"mappings":"AAAA;;;;;;;;;;;IA6FsBA,kBAAkB,MAAlBA,kBAAkB;IAiCxBC,iBAAiB,MAAjBA,iBAAiB;;mCA9HQ,qBAAqB;8BAC5B,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,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AAI;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,6BAA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QACrBjC,KAAK,CAAC,CAAC,sBAAsB,EAAEK,MAAM,CAACU,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9C,OAAOV,MAAM,CAAC;IAChB,CAAC;IAED,0DAA0D;IAC1D,4EAA4E;IAC5E,IAAI4B,eAAe,CAAC,CAAC,CAAC,EAAE;QACtB,OAAOA,eAAe,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO;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"}
|
|
@@ -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 [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/devicectl.ts"],"sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { getExpoHomeDirectory } from '@expo/config/build/getUserState';\nimport JsonFile from '@expo/json-file';\nimport { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn, execSync } from 'child_process';\nimport fs from 'fs';\nimport assert from 'node:assert';\nimport { Ora } from 'ora';\nimport { EOL } from 'os';\nimport path from 'path';\nimport tempy from 'tempy';\n\nimport { xcrunAsync } from './xcrun';\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { ora } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst DEVICE_CTL_EXISTS_PATH = path.join(getExpoHomeDirectory(), 'devicectl-exists');\n\nconst debug = require('debug')('expo:devicectl') as typeof console.log;\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype AnyEnum<T extends string = string> = T | (string & {});\n\ntype DeviceCtlDevice = {\n capabilities: DeviceCtlDeviceCapability[];\n connectionProperties: DeviceCtlConnectionProperties;\n deviceProperties: DeviceCtlDeviceProperties;\n hardwareProperties: DeviceCtlHardwareProperties;\n /** \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A\" */\n identifier: string;\n visibilityClass: AnyEnum<'default'>;\n};\n\ntype DeviceCtlHardwareProperties = {\n cpuType: DeviceCtlCpuType;\n deviceType: AnyEnum<'iPhone'>;\n /** 1114404411111111 */\n ecid: number;\n /** \"D74AP\" */\n hardwareModel: string;\n /** 512000000000 */\n internalStorageCapacity: number;\n /** true */\n isProductionFused: boolean;\n /** \"iPhone 14 Pro Max\" */\n marketingName: string;\n /** \"iOS\" */\n platform: string;\n /** \"iPhone15,3\" */\n productType: AnyEnum<'iPhone13,4' | 'iPhone15,3'>;\n reality: AnyEnum<'physical'>;\n /** \"X2X1CC1XXX\" */\n serialNumber: string;\n supportedCPUTypes: DeviceCtlCpuType[];\n /** [1] */\n supportedDeviceFamilies: number[];\n thinningProductType: AnyEnum<'iPhone15,3'>;\n /** \"00001110-001111110110101A\" */\n udid: string;\n};\n\ntype DeviceCtlDeviceProperties = {\n /** true */\n bootedFromSnapshot: boolean;\n /** \"com.apple.os.update-AD0CF111ACFF11A11111A76A3D1262AE42A3F56F305AF5AE1135393A7A14A7D1\" */\n bootedSnapshotName: string;\n /** false */\n ddiServicesAvailable: boolean;\n\n developerModeStatus: AnyEnum<'enabled'>;\n /** false */\n hasInternalOSBuild: boolean;\n /** \"Evan's phone\" */\n name: string;\n /** \"21E236\" */\n osBuildUpdate: string;\n /** \"17.4.1\" */\n osVersionNumber: string;\n /** false */\n rootFileSystemIsWritable: boolean;\n};\n\ntype DeviceCtlDeviceCapability =\n | {\n name: AnyEnum;\n featureIdentifier: AnyEnum;\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.connectdevice';\n name: 'Connect to Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.unpairdevice';\n name: 'Unpair Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.acquireusageassertion';\n name: 'Acquire Usage Assertion';\n };\n\ntype DeviceCtlConnectionProperties = {\n authenticationType: AnyEnum<'manualPairing'>;\n isMobileDeviceOnly: boolean;\n /** \"2024-04-20T22:50:04.244Z\" */\n lastConnectionDate: string;\n pairingState: AnyEnum<'paired'>;\n /** [\"00001111-001111110110101A.coredevice.local\", \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A.coredevice.local\"] */\n potentialHostnames: string[];\n transportType: AnyEnum<'localNetwork' | 'wired'>;\n tunnelState: AnyEnum<'disconnected'>;\n tunnelTransportProtocol: AnyEnum<'tcp'>;\n};\n\ntype DeviceCtlCpuType = {\n name: AnyEnum<'arm64e' | 'arm64' | 'arm64_32'>;\n subType: number;\n /** 16777228 */\n type: number;\n};\n\n/** Run a `devicectl` command. */\nexport async function devicectlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n try {\n return await xcrunAsync(['devicectl', ...args], options);\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n }\n if ('stderr' in error) {\n const errorCodes = getDeviceCtlErrorCodes(error.stderr);\n if (errorCodes.includes('Locked')) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is locked, unlock and try again.');\n }\n }\n throw error;\n }\n}\n\nexport async function getConnectedAppleDevicesAsync() {\n if (!hasDevicectlEverBeenInstalled()) {\n debug('devicectl not found, skipping remote Apple devices.');\n return [];\n }\n\n const tmpPath = tempy.file();\n const devices = await devicectlAsync([\n 'list',\n 'devices',\n '--json-output',\n tmpPath,\n // Give two seconds before timing out: between 5 and 9223372036854775807\n '--timeout',\n '5',\n ]);\n debug(devices.stdout);\n const devicesJson = await JsonFile.readAsync(tmpPath);\n\n if ((devicesJson as any)?.info?.jsonVersion !== 2) {\n Log.warn(\n 'Unexpected devicectl JSON version output from devicectl. Connecting to physical Apple devices may not work as expected.'\n );\n }\n\n assertDevicesJson(devicesJson);\n\n return devicesJson.result.devices as DeviceCtlDevice[];\n}\n\nfunction assertDevicesJson(\n results: any\n): asserts results is { result: { devices: DeviceCtlDevice[] } } {\n assert(\n results != null && 'result' in results && Array.isArray(results?.result?.devices),\n 'Malformed JSON output from devicectl: ' + JSON.stringify(results, null, 2)\n );\n}\n\nasync function installAppWithDeviceCtlAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void\n): Promise<void> {\n // 𝝠 xcrun devicectl device install app --device 00001110-001111110110101A /Users/evanbacon/Library/Developer/Xcode/DerivedData/Router-hgbqaxzhrhkiftfweydvhgttadvn/Build/Products/Debug-iphoneos/Router.app --verbose\n return new Promise((resolve, reject) => {\n const args: string[] = [\n 'devicectl',\n 'device',\n 'install',\n 'app',\n '--device',\n uuid,\n bundleIdOrAppPath,\n ];\n const childProcess = spawn('xcrun', args);\n debug('xcrun ' + args.join(' '));\n\n let currentProgress = 0;\n let hasStarted = false;\n\n function updateProgress(progress: number) {\n hasStarted = true;\n if (progress <= currentProgress) {\n return;\n }\n currentProgress = progress;\n onProgress({\n progress,\n isComplete: progress === 100,\n status: 'Installing',\n });\n }\n\n childProcess.stdout.on('data', (data: Buffer) => {\n // Sometimes more than one chunk comes at a time, here we split by system newline,\n // then trim and filter.\n const strings = data\n .toString()\n .split(EOL)\n .map((value) => value.trim());\n\n strings.forEach((str) => {\n // Match the progress percentage:\n // - '34%... 35%...' -> 34\n // - '31%...' -> 31\n // - 'Complete!' -> 100\n\n const match = str.match(/(\\d+)%\\.\\.\\./);\n if (match) {\n updateProgress(parseInt(match[1], 10));\n } else if (hasStarted) {\n updateProgress(100);\n }\n });\n\n debug('[stdout]:', strings);\n });\n\n childProcess.on('close', (code) => {\n debug('[close]: ' + code);\n if (code === 0) {\n resolve();\n } else {\n const stderr = childProcess.stderr.read();\n const err = new Error(stderr);\n (err as any).code = code;\n detach(err);\n }\n });\n\n const detach = async (err?: Error) => {\n off?.();\n if (childProcess) {\n return new Promise<void>((resolve) => {\n childProcess?.on('close', resolve);\n childProcess?.kill();\n // childProcess = null;\n reject(err ?? new CommandError('detached'));\n });\n }\n };\n\n const off = installExitHooks(() => detach());\n });\n}\n\nexport async function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n try {\n await devicectlAsync(['device', 'process', 'launch', '--device', deviceId, bundleId]);\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n }\n\n throw new CommandError(`There was an error launching app: ${error}`);\n }\n}\n\n/** Find all error codes from the output log */\nfunction getDeviceCtlErrorCodes(log: string): string[] {\n return [...log.matchAll(/BSErrorCodeDescription\\s+=\\s+(.*)$/gim)].map(([_line, code]) => code);\n}\n\nlet hasEverBeenInstalled: boolean | undefined;\n\nexport function hasDevicectlEverBeenInstalled() {\n if (hasEverBeenInstalled) return hasEverBeenInstalled;\n // It doesn't appear possible for devicectl to ever be uninstalled. We can just check once and store this result forever\n // to prevent cold boots of devicectl from slowing down all invocations of `expo run ios`\n if (fs.existsSync(DEVICE_CTL_EXISTS_PATH)) {\n hasEverBeenInstalled = true;\n return true;\n }\n\n const isInstalled = isDevicectlInstalled();\n\n if (isInstalled) {\n fs.writeFileSync(DEVICE_CTL_EXISTS_PATH, '1');\n }\n hasEverBeenInstalled = isInstalled;\n return isInstalled;\n}\n\nfunction isDevicectlInstalled() {\n try {\n execSync('xcrun devicectl --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Wraps the apple device method for installing and running an app,\n * adds indicator and retry loop for when the device is locked.\n */\nexport async function installAndLaunchAppAsync(props: {\n bundle: string;\n bundleIdentifier: string;\n udid: string;\n deviceName: string;\n}): Promise<void> {\n debug('Running on device:', props);\n const { bundle, bundleIdentifier, udid, deviceName } = props;\n let indicator: Ora | undefined;\n\n try {\n if (!indicator) {\n indicator = ora(`Connecting to: ${props.deviceName}`).start();\n }\n\n await installAppWithDeviceCtlAsync(\n udid,\n bundle,\n ({\n status,\n isComplete,\n progress,\n }: {\n status: string;\n isComplete: boolean;\n progress: number;\n }) => {\n if (!indicator) {\n indicator = ora(status).start();\n }\n indicator.text = `${chalk.bold(status)} ${progress}%`;\n if (isComplete) {\n indicator.succeed();\n }\n }\n );\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n throw error;\n }\n\n async function launchAppOptionally() {\n try {\n await launchAppWithDeviceCtl(udid, bundleIdentifier);\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n if (error.code === 'APPLE_DEVICE_LOCKED') {\n // Get the app name from the binary path.\n const appName = path.basename(bundle).split('.')[0] ?? 'app';\n if (\n isInteractive() &&\n (await confirmAsync({\n message: `Cannot launch ${appName} because the device is locked. Unlock ${deviceName} to continue...`,\n initial: true,\n }))\n ) {\n return launchAppOptionally();\n }\n throw new CommandError(\n `Cannot launch ${appName} on ${deviceName} because the device is locked.`\n );\n }\n throw error;\n }\n }\n\n await launchAppOptionally();\n}\n"],"names":["devicectlAsync","getConnectedAppleDevicesAsync","launchAppWithDeviceCtl","hasDevicectlEverBeenInstalled","installAndLaunchAppAsync","DEVICE_CTL_EXISTS_PATH","path","join","getExpoHomeDirectory","debug","require","args","options","xcrunAsync","error","CommandError","errorCodes","getDeviceCtlErrorCodes","stderr","includes","tmpPath","tempy","file","devices","stdout","devicesJson","JsonFile","readAsync","info","jsonVersion","Log","warn","assertDevicesJson","result","results","assert","Array","isArray","JSON","stringify","installAppWithDeviceCtlAsync","uuid","bundleIdOrAppPath","onProgress","Promise","resolve","reject","childProcess","spawn","currentProgress","hasStarted","updateProgress","progress","isComplete","status","on","data","strings","toString","split","EOL","map","value","trim","forEach","str","match","parseInt","code","read","err","Error","detach","off","kill","installExitHooks","deviceId","bundleId","log","matchAll","_line","hasEverBeenInstalled","fs","existsSync","isInstalled","isDevicectlInstalled","writeFileSync","execSync","stdio","props","bundle","bundleIdentifier","udid","deviceName","indicator","ora","start","text","chalk","bold","succeed","fail","launchAppOptionally","appName","basename","isInteractive","confirmAsync","message","initial"],"mappings":"AAAA;;;;;CAKC,GAED;;;;;;;;;;;IA6HsBA,cAAc,MAAdA,cAAc;IAoBdC,6BAA6B,MAA7BA,6BAA6B;IA+H7BC,sBAAsB,MAAtBA,sBAAsB;IAmB5BC,6BAA6B,MAA7BA,6BAA6B;IA+BvBC,wBAAwB,MAAxBA,wBAAwB;;;yBAlUT,iCAAiC;;;;;;;8DACjD,iBAAiB;;;;;;;8DAEpB,OAAO;;;;;;;yBACO,eAAe;;;;;;;8DAChC,IAAI;;;;;;;8DACA,aAAa;;;;;;;yBAEZ,IAAI;;;;;;;8DACP,MAAM;;;;;;;8DACL,OAAO;;;;;;uBAEE,SAAS;2DACf,cAAc;wBACN,uBAAuB;sBACnB,qBAAqB;6BACxB,4BAA4B;qBACtC,oBAAoB;yBACX,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,MAAMC,sBAAsB,GAAGC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACC,IAAAA,aAAoB,EAAA,qBAAA,GAAE,EAAE,kBAAkB,CAAC,AAAC;AAErF,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,AAAsB,AAAC;AAuGhE,eAAeV,cAAc,CAClCW,IAA4B,EAC5BC,OAAsB,EACA;IACtB,IAAI;QACF,OAAO,MAAMC,IAAAA,MAAU,WAA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A,YAAa,cAAA,GAAE,IACd,MAAMC,IAAAA,QAAY,aAAA,EAAC;oBAClBC,OAAO,EAAE,CAAC,cAAc,EAAEJ,OAAO,CAAC,sCAAsC,EAAEV,UAAU,CAAC,eAAe,CAAC;oBACrGe,OAAO,EAAE,IAAI;iBACd,CAAC,AAAC,EACH;oBACA,OAAON,mBAAmB,EAAE,CAAC;gBAC/B,CAAC;gBACD,MAAM,IAAIvF,OAAY,aAAA,CACpB,CAAC,cAAc,EAAEwF,OAAO,CAAC,IAAI,EAAEV,UAAU,CAAC,8BAA8B,CAAC,CAC1E,CAAC;YACJ,CAAC;YACD,MAAM/E,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAMwF,mBAAmB,EAAE,CAAC;AAC9B,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/devicectl.ts"],"sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { getExpoHomeDirectory } from '@expo/config/build/getUserState';\nimport JsonFile from '@expo/json-file';\nimport spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn, execSync } from 'child_process';\nimport fs from 'fs';\nimport assert from 'node:assert';\nimport { Ora } from 'ora';\nimport { EOL } from 'os';\nimport path from 'path';\nimport tempy from 'tempy';\n\nimport { xcrunAsync } from './xcrun';\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { ora } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst DEVICE_CTL_EXISTS_PATH = path.join(getExpoHomeDirectory(), 'devicectl-exists');\n\nconst debug = require('debug')('expo:devicectl') as typeof console.log;\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype AnyEnum<T extends string = string> = T | (string & {});\n\ntype DeviceCtlDevice = {\n capabilities: DeviceCtlDeviceCapability[];\n connectionProperties: DeviceCtlConnectionProperties;\n deviceProperties: DeviceCtlDeviceProperties;\n hardwareProperties: DeviceCtlHardwareProperties;\n /** \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A\" */\n identifier: string;\n visibilityClass: AnyEnum<'default'>;\n};\n\ntype DeviceCtlHardwareProperties = {\n cpuType: DeviceCtlCpuType;\n deviceType: AnyEnum<'iPhone'>;\n /** 1114404411111111 */\n ecid: number;\n /** \"D74AP\" */\n hardwareModel: string;\n /** 512000000000 */\n internalStorageCapacity: number;\n /** true */\n isProductionFused: boolean;\n /** \"iPhone 14 Pro Max\" */\n marketingName: string;\n /** \"iOS\" */\n platform: AnyEnum<'iOS' | 'xrOS'>;\n /** \"iPhone15,3\" */\n productType: AnyEnum<'iPhone13,4' | 'iPhone15,3'>;\n reality: AnyEnum<'physical'>;\n /** \"X2X1CC1XXX\" */\n serialNumber: string;\n supportedCPUTypes: DeviceCtlCpuType[];\n /** [1] */\n supportedDeviceFamilies: number[];\n thinningProductType: AnyEnum<'iPhone15,3'>;\n /** \"00001110-001111110110101A\" */\n udid: string;\n};\n\ntype DeviceCtlDeviceProperties = {\n /** true */\n bootedFromSnapshot: boolean;\n /** \"com.apple.os.update-AD0CF111ACFF11A11111A76A3D1262AE42A3F56F305AF5AE1135393A7A14A7D1\" */\n bootedSnapshotName: string;\n /** false */\n ddiServicesAvailable: boolean;\n\n developerModeStatus: AnyEnum<'enabled'>;\n /** false */\n hasInternalOSBuild: boolean;\n /** \"Evan's phone\" */\n name: string;\n /** \"21E236\" */\n osBuildUpdate: string;\n /** \"17.4.1\" */\n osVersionNumber: string;\n /** false */\n rootFileSystemIsWritable: boolean;\n};\n\ntype DeviceCtlDeviceCapability =\n | {\n name: AnyEnum;\n featureIdentifier: AnyEnum;\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.connectdevice';\n name: 'Connect to Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.unpairdevice';\n name: 'Unpair Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.acquireusageassertion';\n name: 'Acquire Usage Assertion';\n };\n\ntype DeviceCtlConnectionProperties = {\n authenticationType: AnyEnum<'manualPairing'>;\n isMobileDeviceOnly: boolean;\n /** \"2024-04-20T22:50:04.244Z\" */\n lastConnectionDate: string;\n pairingState: AnyEnum<'paired'>;\n /** [\"00001111-001111110110101A.coredevice.local\", \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A.coredevice.local\"] */\n potentialHostnames: string[];\n transportType: AnyEnum<'localNetwork' | 'wired'>;\n tunnelState: AnyEnum<'disconnected'>;\n tunnelTransportProtocol: AnyEnum<'tcp'>;\n};\n\ntype DeviceCtlCpuType = {\n name: AnyEnum<'arm64e' | 'arm64' | 'arm64_32'>;\n subType: number;\n /** 16777228 */\n type: number;\n};\n\n/** Run a `devicectl` command. */\nexport async function devicectlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n try {\n return await xcrunAsync(['devicectl', ...args], options);\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n }\n if ('stderr' in error) {\n const errorCodes = getDeviceCtlErrorCodes(error.stderr);\n if (errorCodes.includes('Locked')) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is locked, unlock and try again.');\n }\n }\n throw error;\n }\n}\n\nexport async function getConnectedAppleDevicesAsync() {\n if (!hasDevicectlEverBeenInstalled()) {\n debug('devicectl not found, skipping remote Apple devices.');\n return [];\n }\n\n const tmpPath = tempy.file();\n const devices = await devicectlAsync([\n 'list',\n 'devices',\n '--json-output',\n tmpPath,\n // Give two seconds before timing out: between 5 and 9223372036854775807\n '--timeout',\n '5',\n ]);\n debug(devices.stdout);\n const devicesJson = await JsonFile.readAsync(tmpPath);\n\n if ((devicesJson as any)?.info?.jsonVersion !== 2) {\n Log.warn(\n 'Unexpected devicectl JSON version output from devicectl. Connecting to physical Apple devices may not work as expected.'\n );\n }\n\n assertDevicesJson(devicesJson);\n\n return devicesJson.result.devices as DeviceCtlDevice[];\n}\n\nfunction assertDevicesJson(\n results: any\n): asserts results is { result: { devices: DeviceCtlDevice[] } } {\n assert(\n results != null && 'result' in results && Array.isArray(results?.result?.devices),\n 'Malformed JSON output from devicectl: ' + JSON.stringify(results, null, 2)\n );\n}\n\nexport async function launchBinaryOnMacAsync(\n bundleId: string,\n appBinaryPath: string\n): Promise<void> {\n const args = ['-b', bundleId, appBinaryPath];\n try {\n await spawnAsync('open', args);\n } catch (error: any) {\n if ('code' in error) {\n if (error.code === 1) {\n throw new CommandError(\n 'MACOS_LAUNCH',\n 'Failed to launch the compatible binary on macOS: open ' +\n args.join(' ') +\n '\\n\\n' +\n error.message\n );\n }\n }\n throw error;\n }\n}\n\nasync function installAppWithDeviceCtlAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void\n): Promise<void> {\n // 𝝠 xcrun devicectl device install app --device 00001110-001111110110101A /Users/evanbacon/Library/Developer/Xcode/DerivedData/Router-hgbqaxzhrhkiftfweydvhgttadvn/Build/Products/Debug-iphoneos/Router.app --verbose\n return new Promise((resolve, reject) => {\n const args: string[] = [\n 'devicectl',\n 'device',\n 'install',\n 'app',\n '--device',\n uuid,\n bundleIdOrAppPath,\n ];\n const childProcess = spawn('xcrun', args);\n debug('xcrun ' + args.join(' '));\n\n let currentProgress = 0;\n let hasStarted = false;\n\n function updateProgress(progress: number) {\n hasStarted = true;\n if (progress <= currentProgress) {\n return;\n }\n currentProgress = progress;\n onProgress({\n progress,\n isComplete: progress === 100,\n status: 'Installing',\n });\n }\n\n childProcess.stdout.on('data', (data: Buffer) => {\n // Sometimes more than one chunk comes at a time, here we split by system newline,\n // then trim and filter.\n const strings = data\n .toString()\n .split(EOL)\n .map((value) => value.trim());\n\n strings.forEach((str) => {\n // Match the progress percentage:\n // - '34%... 35%...' -> 34\n // - '31%...' -> 31\n // - 'Complete!' -> 100\n\n const match = str.match(/(\\d+)%\\.\\.\\./);\n if (match) {\n updateProgress(parseInt(match[1], 10));\n } else if (hasStarted) {\n updateProgress(100);\n }\n });\n\n debug('[stdout]:', strings);\n });\n\n childProcess.on('close', (code) => {\n debug('[close]: ' + code);\n if (code === 0) {\n resolve();\n } else {\n const stderr = childProcess.stderr.read();\n const err = new Error(stderr);\n (err as any).code = code;\n detach(err);\n }\n });\n\n const detach = async (err?: Error) => {\n off?.();\n if (childProcess) {\n return new Promise<void>((resolve) => {\n childProcess?.on('close', resolve);\n childProcess?.kill();\n // childProcess = null;\n reject(err ?? new CommandError('detached'));\n });\n }\n };\n\n const off = installExitHooks(() => detach());\n });\n}\n\nexport async function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n await devicectlAsync(['device', 'process', 'launch', '--device', deviceId, bundleId]);\n}\n\n/** Find all error codes from the output log */\nfunction getDeviceCtlErrorCodes(log: string): string[] {\n return [...log.matchAll(/BSErrorCodeDescription\\s+=\\s+(.*)$/gim)].map(([_line, code]) => code);\n}\n\nlet hasEverBeenInstalled: boolean | undefined;\n\nexport function hasDevicectlEverBeenInstalled() {\n if (hasEverBeenInstalled) return hasEverBeenInstalled;\n // It doesn't appear possible for devicectl to ever be uninstalled. We can just check once and store this result forever\n // to prevent cold boots of devicectl from slowing down all invocations of `expo run ios`\n if (fs.existsSync(DEVICE_CTL_EXISTS_PATH)) {\n hasEverBeenInstalled = true;\n return true;\n }\n\n const isInstalled = isDevicectlInstalled();\n\n if (isInstalled) {\n fs.writeFileSync(DEVICE_CTL_EXISTS_PATH, '1');\n }\n hasEverBeenInstalled = isInstalled;\n return isInstalled;\n}\n\nfunction isDevicectlInstalled() {\n try {\n execSync('xcrun devicectl --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Wraps the apple device method for installing and running an app,\n * adds indicator and retry loop for when the device is locked.\n */\nexport async function installAndLaunchAppAsync(props: {\n bundle: string;\n bundleIdentifier: string;\n udid: string;\n deviceName: string;\n}): Promise<void> {\n debug('Running on device:', props);\n const { bundle, bundleIdentifier, udid, deviceName } = props;\n let indicator: Ora | undefined;\n\n try {\n if (!indicator) {\n indicator = ora(`Connecting to: ${props.deviceName}`).start();\n }\n\n await installAppWithDeviceCtlAsync(\n udid,\n bundle,\n ({\n status,\n isComplete,\n progress,\n }: {\n status: string;\n isComplete: boolean;\n progress: number;\n }) => {\n if (!indicator) {\n indicator = ora(status).start();\n }\n indicator.text = `${chalk.bold(status)} ${progress}%`;\n if (isComplete) {\n indicator.succeed();\n }\n }\n );\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n throw error;\n }\n\n async function launchAppOptionally() {\n try {\n await launchAppWithDeviceCtl(udid, bundleIdentifier);\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n if (error.code === 'APPLE_DEVICE_LOCKED') {\n // Get the app name from the binary path.\n const appName = path.basename(bundle).split('.')[0] ?? 'app';\n if (\n isInteractive() &&\n (await confirmAsync({\n message: `Cannot launch ${appName} because the device is locked. Unlock ${deviceName} to continue...`,\n initial: true,\n }))\n ) {\n return launchAppOptionally();\n }\n throw new CommandError(\n `Cannot launch ${appName} on ${deviceName} because the device is locked.`\n );\n }\n throw error;\n }\n }\n\n await launchAppOptionally();\n}\n"],"names":["devicectlAsync","getConnectedAppleDevicesAsync","launchBinaryOnMacAsync","launchAppWithDeviceCtl","hasDevicectlEverBeenInstalled","installAndLaunchAppAsync","DEVICE_CTL_EXISTS_PATH","path","join","getExpoHomeDirectory","debug","require","args","options","xcrunAsync","error","CommandError","errorCodes","getDeviceCtlErrorCodes","stderr","includes","tmpPath","tempy","file","devices","stdout","devicesJson","JsonFile","readAsync","info","jsonVersion","Log","warn","assertDevicesJson","result","results","assert","Array","isArray","JSON","stringify","bundleId","appBinaryPath","spawnAsync","code","message","installAppWithDeviceCtlAsync","uuid","bundleIdOrAppPath","onProgress","Promise","resolve","reject","childProcess","spawn","currentProgress","hasStarted","updateProgress","progress","isComplete","status","on","data","strings","toString","split","EOL","map","value","trim","forEach","str","match","parseInt","read","err","Error","detach","off","kill","installExitHooks","deviceId","log","matchAll","_line","hasEverBeenInstalled","fs","existsSync","isInstalled","isDevicectlInstalled","writeFileSync","execSync","stdio","props","bundle","bundleIdentifier","udid","deviceName","indicator","ora","start","text","chalk","bold","succeed","fail","launchAppOptionally","appName","basename","isInteractive","confirmAsync","initial"],"mappings":"AAAA;;;;;CAKC,GAED;;;;;;;;;;;IA6HsBA,cAAc,MAAdA,cAAc;IAoBdC,6BAA6B,MAA7BA,6BAA6B;IAuC7BC,sBAAsB,MAAtBA,sBAAsB;IA+GtBC,sBAAsB,MAAtBA,sBAAsB;IAW5BC,6BAA6B,MAA7BA,6BAA6B;IA+BvBC,wBAAwB,MAAxBA,wBAAwB;;;yBAjVT,iCAAiC;;;;;;;8DACjD,iBAAiB;;;;;;;8DACgB,mBAAmB;;;;;;;8DACvD,OAAO;;;;;;;yBACO,eAAe;;;;;;;8DAChC,IAAI;;;;;;;8DACA,aAAa;;;;;;;yBAEZ,IAAI;;;;;;;8DACP,MAAM;;;;;;;8DACL,OAAO;;;;;;uBAEE,SAAS;2DACf,cAAc;wBACN,uBAAuB;sBACnB,qBAAqB;6BACxB,4BAA4B;qBACtC,oBAAoB;yBACX,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,MAAMC,sBAAsB,GAAGC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACC,IAAAA,aAAoB,EAAA,qBAAA,GAAE,EAAE,kBAAkB,CAAC,AAAC;AAErF,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,AAAsB,AAAC;AAuGhE,eAAeX,cAAc,CAClCY,IAA4B,EAC5BC,OAAsB,EACA;IACtB,IAAI;QACF,OAAO,MAAMC,IAAAA,MAAU,WAAA,EAAC;YAAC,WAAW;eAAKF,IAAI;SAAC,EAAEC,OAAO,CAAC,CAAC;IAC3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AC6B,IAAI,KAAK,qBAAqB,EAAE;oBAExBrC,GAAmC;gBADnD,yCAAyC;gBACzC,MAAMoG,OAAO,GAAGpG,CAAAA,GAAmC,GAAnCA,KAAI,EAAA,QAAA,CAACqG,QAAQ,CAACd,MAAM,CAAC,CAAC7B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAnC1D,GAAmC,GAAI,KAAK,AAAC;gBAC7D,IACEsG,IAAAA,YAAa,cAAA,GAAE,IACd,MAAMC,IAAAA,QAAY,aAAA,EAAC;oBAClBjE,OAAO,EAAE,CAAC,cAAc,EAAE8D,OAAO,CAAC,sCAAsC,EAAEV,UAAU,CAAC,eAAe,CAAC;oBACrGc,OAAO,EAAE,IAAI;iBACd,CAAC,AAAC,EACH;oBACA,OAAOL,mBAAmB,EAAE,CAAC;gBAC/B,CAAC;gBACD,MAAM,IAAI1F,OAAY,aAAA,CACpB,CAAC,cAAc,EAAE2F,OAAO,CAAC,IAAI,EAAEV,UAAU,CAAC,8BAA8B,CAAC,CAC1E,CAAC;YACJ,CAAC;YACD,MAAMlF,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAM2F,mBAAmB,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/promptAppleDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { getBestSimulatorAsync } from './getBestSimulator';\nimport { Device } from './simctl';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\n/**\n * Sort the devices so the last simulator that was opened (user's default) is the first suggested.\n *\n * @param devices list of devices to sort.\n * @param osType optional sort by operating system.\n */\nexport async function sortDefaultDeviceToBeginningAsync(\n devices:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/promptAppleDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { getBestSimulatorAsync } from './getBestSimulator';\nimport { Device } from './simctl';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\n/**\n * Sort the devices so the last simulator that was opened (user's default) is the first suggested.\n *\n * @param devices list of devices to sort.\n * @param osType optional sort by operating system.\n */\nexport async function sortDefaultDeviceToBeginningAsync<T extends { udid: string }>(\n devices: T[],\n osType?: Device['osType']\n): Promise<T[]> {\n const defaultId = await getBestSimulatorAsync({ osType });\n if (defaultId) {\n let iterations = 0;\n while (devices[0].udid !== defaultId && iterations < devices.length) {\n devices.push(devices.shift()!);\n iterations++;\n }\n }\n return devices;\n}\n\n/** Prompt the user to select an Apple device, sorting the most likely option to the beginning. */\nexport async function promptAppleDeviceAsync(\n devices: Device[],\n osType?: Device['osType']\n): Promise<Device> {\n devices = await sortDefaultDeviceToBeginningAsync(devices, osType);\n const results = await promptAppleDeviceInternalAsync(devices);\n return devices.find(({ udid }) => results === udid)!;\n}\n\nasync function promptAppleDeviceInternalAsync(devices: Device[]): Promise<string> {\n // TODO: provide an option to add or download more simulators\n // TODO: Add support for physical devices too.\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a simulator',\n choices: devices.map((item) => {\n const isActive = item.state === 'Booted';\n const format = isActive ? chalk.bold : (text: string) => text;\n return {\n title: `${format(item.name)} ${chalk.dim(`(${item.osVersion})`)}`,\n value: item.udid,\n };\n }),\n suggest: createSelectionFilter(),\n });\n\n return value;\n}\n"],"names":["sortDefaultDeviceToBeginningAsync","promptAppleDeviceAsync","devices","osType","defaultId","getBestSimulatorAsync","iterations","udid","length","push","shift","results","promptAppleDeviceInternalAsync","find","value","promptAsync","type","name","limit","message","choices","map","item","isActive","state","format","chalk","bold","text","title","dim","osVersion","suggest","createSelectionFilter"],"mappings":"AAAA;;;;;;;;;;;IAYsBA,iCAAiC,MAAjCA,iCAAiC;IAgBjCC,sBAAsB,MAAtBA,sBAAsB;;;8DA5B1B,OAAO;;;;;;kCAEa,oBAAoB;yBAEP,wBAAwB;;;;;;AAQpE,eAAeD,iCAAiC,CACrDE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AKA,IAAI,AAAC;YAC9D,OAAO;gBACLC,KAAK,EAAE,CAAC,EAAEJ,MAAM,CAACH,IAAI,CAACL,IAAI,CAAC,CAAC,CAAC,EAAES,MAAK,EAAA,QAAA,CAACI,GAAG,CAAC,CAAC,CAAC,EAAER,IAAI,CAACS,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjEjB,KAAK,EAAEQ,IAAI,CAACf,IAAI;aACjB,CAAC;QACJ,CAAC,CAAC;QACFyB,OAAO,EAAEC,IAAAA,QAAqB,sBAAA,GAAE;KACjC,CAAC,AAAC;IAEH,OAAOnB,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/simctl.ts"],"sourcesContent":["import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\n\nimport { xcrunAsync } from './xcrun';\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\n\ntype DeviceState = 'Shutdown' | 'Booted';\n\nexport type OSType = 'iOS' | 'tvOS' | 'watchOS' | 'macOS';\n\nexport type Device = {\n availabilityError?: 'runtime profile not found';\n /** '/Users/name/Library/Developer/CoreSimulator/Devices/00E55DC0-0364-49DF-9EC6-77BE587137D4/data' */\n dataPath: string;\n /** @example `2811236352` */\n dataPathSize?: number;\n /** '/Users/name/Library/Logs/CoreSimulator/00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n logPath: string;\n /** @example `479232` */\n logPathSize?: number;\n /** '00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n udid: string;\n /** 'com.apple.CoreSimulator.SimRuntime.iOS-15-1' */\n runtime: string;\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: boolean;\n /** 'com.apple.CoreSimulator.SimDeviceType.iPhone-13-Pro' */\n deviceTypeIdentifier: string;\n state: DeviceState;\n /** 'iPhone 13 Pro' */\n name: string;\n /** Type of OS the device uses. */\n osType: OSType;\n /** '15.1' */\n osVersion: string;\n /** 'iPhone 13 Pro (15.1)' */\n windowName: string;\n};\n\ntype SimulatorDeviceList = {\n devices: {\n [runtime: string]: Device[];\n };\n};\n\ntype DeviceContext = Pick<Device, 'udid'>;\n\n/** Returns true if the given value is an `OSType`, if we don't recognize the value we continue anyways but warn. */\nexport function isOSType(value: any): value is OSType {\n if (!value || typeof value !== 'string') return false;\n\n const knownTypes = ['iOS', 'tvOS', 'watchOS', 'macOS'];\n if (!knownTypes.includes(value)) {\n Log.warn(`Unknown OS type: ${value}. Expected one of: ${knownTypes.join(', ')}`);\n }\n return true;\n}\n\n/**\n * Returns the local path for the installed tar.app. Returns null when the app isn't installed.\n *\n * @param device context for selecting a device.\n * @param props.appId bundle identifier for app.\n * @returns local file path to installed app binary, e.g. '/Users/evanbacon/Library/Developer/CoreSimulator/Devices/EFEEA6EF-E3F5-4EDE-9B72-29EAFA7514AE/data/Containers/Bundle/Application/FA43A0C6-C2AD-442D-B8B1-EAF3E88CF3BF/Exponent-2.21.3.tar.app'\n */\nexport async function getContainerPathAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n }: {\n appId: string;\n }\n): Promise<string | null> {\n try {\n const { stdout } = await simctlAsync(['get_app_container', resolveId(device), appId]);\n return stdout.trim();\n } catch (error: any) {\n if (error.stderr?.match(/No such file or directory/)) {\n return null;\n }\n throw error;\n }\n}\n\n/** Return a value from an installed app's Info.plist. */\nexport async function getInfoPlistValueAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n key,\n containerPath,\n }: {\n appId: string;\n key: string;\n containerPath?: string;\n }\n): Promise<string | null> {\n const ensuredContainerPath = containerPath ?? (await getContainerPathAsync(device, { appId }));\n if (ensuredContainerPath) {\n try {\n const { output } = await spawnAsync(\n 'defaults',\n ['read', `${ensuredContainerPath}/Info`, key],\n {\n stdio: 'pipe',\n }\n );\n return output.join('\\n').trim();\n } catch {\n return null;\n }\n }\n return null;\n}\n\n/** Open a URL on a device. The url can have any protocol. */\nexport async function openUrlAsync(\n device: Partial<DeviceContext>,\n options: { url: string }\n): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['openurl', resolveId(device), options.url]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to lookup in current state: Shut/)) {\n throw error;\n }\n\n // If the device was in a weird in-between state (\"Shutting Down\" or \"Shutdown\"), then attempt to reboot it and try again.\n // This can happen when quitting the Simulator app, and immediately pressing `i` to reopen the project.\n\n // First boot the simulator\n await bootDeviceAsync({ udid: resolveId(device) });\n\n // Finally, try again...\n return await openUrlAsync(device, options);\n }\n}\n\n/** Open a simulator using a bundle identifier. If no app with a matching bundle identifier is installed then an error will be thrown. */\nexport async function openAppIdAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n const results = await openAppIdInternalAsync(device, options);\n // Similar to 194, this is a conformance issue which indicates that the given device has no app that can handle our launch request.\n if (results.status === 4) {\n throw new CommandError('APP_NOT_INSTALLED', results.stderr);\n }\n return results;\n}\nasync function openAppIdInternalAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n try {\n return await simctlAsync(['launch', resolveId(device), options.appId]);\n } catch (error: any) {\n if ('status' in error) {\n return error;\n }\n throw error;\n }\n}\n\n// This will only boot in headless mode if the Simulator app is not running.\nexport async function bootAsync(device: DeviceContext): Promise<Device | null> {\n await bootDeviceAsync(device);\n return isDeviceBootedAsync(device);\n}\n\n/** Returns a list of devices whose current state is 'Booted' as an array. */\nexport async function getBootedSimulatorsAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flatMap((runtime) =>\n runtime.filter((device) => device.state === 'Booted')\n );\n}\n\n/** Returns the current device if its state is 'Booted'. */\nexport async function isDeviceBootedAsync(device: Partial<DeviceContext>): Promise<Device | null> {\n // Simulators can be booted even if the app isn't running :(\n const devices = await getBootedSimulatorsAsync();\n if (device.udid) {\n return devices.find((bootedDevice) => bootedDevice.udid === device.udid) ?? null;\n }\n\n return devices[0] ?? null;\n}\n\n/** Boot a device. */\nexport async function bootDeviceAsync(device: DeviceContext): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['boot', device.udid]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to boot device in current state: Booted/)) {\n throw error;\n }\n }\n}\n\n/** Install a binary file on the device. */\nexport async function installAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Local absolute file path to an app binary that is built and provisioned for iOS simulators. */\n filePath: string;\n }\n): Promise<any> {\n return simctlAsync(['install', resolveId(device), options.filePath]);\n}\n\n/** Uninstall an app from the provided device. */\nexport async function uninstallAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Bundle identifier */\n appId: string;\n }\n): Promise<any> {\n return simctlAsync(['uninstall', resolveId(device), options.appId]);\n}\n\nfunction parseSimControlJSONResults(input: string): any {\n try {\n return JSON.parse(input);\n } catch (error: any) {\n // Nov 15, 2020: Observed this can happen when opening the simulator and the simulator prompts the user to update the xcode command line tools.\n // Unexpected token I in JSON at position 0\n if (error.message.includes('Unexpected token')) {\n Log.error(`Apple's simctl returned malformed JSON:\\n${input}`);\n }\n throw error;\n }\n}\n\n/** Get all runtime devices given a certain type. */\nasync function getRuntimesAsync(\n type: 'devices' | 'devicetypes' | 'runtimes' | 'pairs',\n query?: string | 'available'\n): Promise<SimulatorDeviceList> {\n const result = await simctlAsync(['list', type, '--json', query]);\n const info = parseSimControlJSONResults(result.stdout) as SimulatorDeviceList;\n\n for (const runtime of Object.keys(info.devices)) {\n // Given a string like 'com.apple.CoreSimulator.SimRuntime.tvOS-13-4'\n const runtimeSuffix = runtime.split('com.apple.CoreSimulator.SimRuntime.').pop()!;\n // Create an array [tvOS, 13, 4]\n const [osType, ...osVersionComponents] = runtimeSuffix.split('-');\n // Join the end components [13, 4] -> '13.4'\n const osVersion = osVersionComponents.join('.');\n const sims = info.devices[runtime];\n for (const device of sims) {\n device.runtime = runtime;\n device.osVersion = osVersion;\n device.windowName = `${device.name} (${osVersion})`;\n device.osType = osType as OSType;\n }\n }\n return info;\n}\n\n/** Return a list of iOS simulators. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flat();\n}\n\n/** Run a `simctl` command. */\nexport async function simctlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n return xcrunAsync(['simctl', ...args], options);\n}\n\nfunction resolveId(device: Partial<DeviceContext>): string {\n return device.udid ?? 'booted';\n}\n"],"names":["isOSType","getContainerPathAsync","getInfoPlistValueAsync","openUrlAsync","openAppIdAsync","bootAsync","getBootedSimulatorsAsync","isDeviceBootedAsync","bootDeviceAsync","installAsync","uninstallAsync","getDevicesAsync","simctlAsync","value","knownTypes","includes","Log","warn","join","device","appId","stdout","resolveId","trim","error","stderr","match","key","containerPath","ensuredContainerPath","output","spawnAsync","stdio","options","url","udid","results","openAppIdInternalAsync","status","CommandError","simulatorDeviceInfo","getRuntimesAsync","Object","values","devices","flatMap","runtime","filter","state","find","bootedDevice","filePath","parseSimControlJSONResults","input","JSON","parse","message","type","query","result","info","keys","runtimeSuffix","split","pop","osType","osVersionComponents","osVersion","sims","windowName","name","flat","args","xcrunAsync"],"mappings":"AAAA;;;;;;;;;;;IAgDgBA,QAAQ,MAARA,QAAQ;IAiBFC,qBAAqB,MAArBA,qBAAqB;IAoBrBC,sBAAsB,MAAtBA,sBAAsB;IA+BtBC,YAAY,MAAZA,YAAY;IAwBZC,cAAc,MAAdA,cAAc;IA8BdC,SAAS,MAATA,SAAS;IAMTC,wBAAwB,MAAxBA,wBAAwB;IAQxBC,mBAAmB,MAAnBA,mBAAmB;IAWnBC,eAAe,MAAfA,eAAe;IAYfC,YAAY,MAAZA,YAAY;IAWZC,cAAc,MAAdA,cAAc;IAkDdC,eAAe,MAAfA,eAAe;IAMfC,WAAW,MAAX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AAM,CAAC8C,MAAM,GAAGA,MAAM,AAAU,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAOL,IAAI,CAAC;AACd,CAAC;AAGM,eAAejD,eAAe,GAAsB;IACzD,MAAM6B,mBAAmB,GAAG,MAAMC,gBAAgB,CAAC,SAAS,CAAC,AAAC;IAC9D,OAAOC,MAAM,CAACC,MAAM,CAACH,mBAAmB,CAACI,OAAO,CAAC,CAAC2B,IAAI,EAAE,CAAC;AAC3D,CAAC;AAGM,eAAe3D,WAAW,CAC/B4D,IAA4B,EAC5BvC,OAAsB,EACA;IACtB,OAAOwC,IAAAA,MAAU,WAAA,EAAC;QAAC,QAAQ;WAAKD,IAAI;KAAC,EAAEvC,OAAO,CAAC,CAAC;AAClD,CAAC;AAED,SAASX,SAAS,CAACH,MAA8B,EAAU;QAClDA,KAAW;IAAlB,OAAOA,CAAAA,KAAW,GAAXA,MAAM,CAACgB,IAAI,YAAXhB,KAAW,GAAI,QAAQ,CAAC;AACjC,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/simctl.ts"],"sourcesContent":["import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\n\nimport { xcrunAsync } from './xcrun';\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\n\ntype DeviceState = 'Shutdown' | 'Booted';\n\nexport type OSType = 'iOS' | 'tvOS' | 'watchOS' | 'macOS' | 'xrOS';\n\nexport type Device = {\n availabilityError?: 'runtime profile not found';\n /** '/Users/name/Library/Developer/CoreSimulator/Devices/00E55DC0-0364-49DF-9EC6-77BE587137D4/data' */\n dataPath: string;\n /** @example `2811236352` */\n dataPathSize?: number;\n /** '/Users/name/Library/Logs/CoreSimulator/00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n logPath: string;\n /** @example `479232` */\n logPathSize?: number;\n /** '00E55DC0-0364-49DF-9EC6-77BE587137D4' */\n udid: string;\n /** 'com.apple.CoreSimulator.SimRuntime.iOS-15-1' */\n runtime: string;\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: boolean;\n /** 'com.apple.CoreSimulator.SimDeviceType.iPhone-13-Pro' */\n deviceTypeIdentifier: string;\n state: DeviceState;\n /** 'iPhone 13 Pro' */\n name: string;\n /** Type of OS the device uses. */\n osType: OSType;\n /** '15.1' */\n osVersion: string;\n /** 'iPhone 13 Pro (15.1)' */\n windowName: string;\n};\n\ntype SimulatorDeviceList = {\n devices: {\n [runtime: string]: Device[];\n };\n};\n\ntype DeviceContext = Pick<Device, 'udid'>;\n\n/** Returns true if the given value is an `OSType`, if we don't recognize the value we continue anyways but warn. */\nexport function isOSType(value: any): value is OSType {\n if (!value || typeof value !== 'string') return false;\n\n const knownTypes = ['iOS', 'tvOS', 'watchOS', 'macOS'];\n if (!knownTypes.includes(value)) {\n Log.warn(`Unknown OS type: ${value}. Expected one of: ${knownTypes.join(', ')}`);\n }\n return true;\n}\n\n/**\n * Returns the local path for the installed tar.app. Returns null when the app isn't installed.\n *\n * @param device context for selecting a device.\n * @param props.appId bundle identifier for app.\n * @returns local file path to installed app binary, e.g. '/Users/evanbacon/Library/Developer/CoreSimulator/Devices/EFEEA6EF-E3F5-4EDE-9B72-29EAFA7514AE/data/Containers/Bundle/Application/FA43A0C6-C2AD-442D-B8B1-EAF3E88CF3BF/Exponent-2.21.3.tar.app'\n */\nexport async function getContainerPathAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n }: {\n appId: string;\n }\n): Promise<string | null> {\n try {\n const { stdout } = await simctlAsync(['get_app_container', resolveId(device), appId]);\n return stdout.trim();\n } catch (error: any) {\n if (error.stderr?.match(/No such file or directory/)) {\n return null;\n }\n throw error;\n }\n}\n\n/** Return a value from an installed app's Info.plist. */\nexport async function getInfoPlistValueAsync(\n device: Partial<DeviceContext>,\n {\n appId,\n key,\n containerPath,\n }: {\n appId: string;\n key: string;\n containerPath?: string;\n }\n): Promise<string | null> {\n const ensuredContainerPath = containerPath ?? (await getContainerPathAsync(device, { appId }));\n if (ensuredContainerPath) {\n try {\n const { output } = await spawnAsync(\n 'defaults',\n ['read', `${ensuredContainerPath}/Info`, key],\n {\n stdio: 'pipe',\n }\n );\n return output.join('\\n').trim();\n } catch {\n return null;\n }\n }\n return null;\n}\n\n/** Open a URL on a device. The url can have any protocol. */\nexport async function openUrlAsync(\n device: Partial<DeviceContext>,\n options: { url: string }\n): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['openurl', resolveId(device), options.url]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to lookup in current state: Shut/)) {\n throw error;\n }\n\n // If the device was in a weird in-between state (\"Shutting Down\" or \"Shutdown\"), then attempt to reboot it and try again.\n // This can happen when quitting the Simulator app, and immediately pressing `i` to reopen the project.\n\n // First boot the simulator\n await bootDeviceAsync({ udid: resolveId(device) });\n\n // Finally, try again...\n return await openUrlAsync(device, options);\n }\n}\n\n/** Open a simulator using a bundle identifier. If no app with a matching bundle identifier is installed then an error will be thrown. */\nexport async function openAppIdAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n const results = await openAppIdInternalAsync(device, options);\n // Similar to 194, this is a conformance issue which indicates that the given device has no app that can handle our launch request.\n if (results.status === 4) {\n throw new CommandError('APP_NOT_INSTALLED', results.stderr);\n }\n return results;\n}\nasync function openAppIdInternalAsync(\n device: Partial<DeviceContext>,\n options: {\n appId: string;\n }\n): Promise<SpawnResult> {\n try {\n return await simctlAsync(['launch', resolveId(device), options.appId]);\n } catch (error: any) {\n if ('status' in error) {\n return error;\n }\n throw error;\n }\n}\n\n// This will only boot in headless mode if the Simulator app is not running.\nexport async function bootAsync(device: DeviceContext): Promise<Device | null> {\n await bootDeviceAsync(device);\n return isDeviceBootedAsync(device);\n}\n\n/** Returns a list of devices whose current state is 'Booted' as an array. */\nexport async function getBootedSimulatorsAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flatMap((runtime) =>\n runtime.filter((device) => device.state === 'Booted')\n );\n}\n\n/** Returns the current device if its state is 'Booted'. */\nexport async function isDeviceBootedAsync(device: Partial<DeviceContext>): Promise<Device | null> {\n // Simulators can be booted even if the app isn't running :(\n const devices = await getBootedSimulatorsAsync();\n if (device.udid) {\n return devices.find((bootedDevice) => bootedDevice.udid === device.udid) ?? null;\n }\n\n return devices[0] ?? null;\n}\n\n/** Boot a device. */\nexport async function bootDeviceAsync(device: DeviceContext): Promise<void> {\n try {\n // Skip logging since this is likely to fail.\n await simctlAsync(['boot', device.udid]);\n } catch (error: any) {\n if (!error.stderr?.match(/Unable to boot device in current state: Booted/)) {\n throw error;\n }\n }\n}\n\n/** Install a binary file on the device. */\nexport async function installAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Local absolute file path to an app binary that is built and provisioned for iOS simulators. */\n filePath: string;\n }\n): Promise<any> {\n return simctlAsync(['install', resolveId(device), options.filePath]);\n}\n\n/** Uninstall an app from the provided device. */\nexport async function uninstallAsync(\n device: Partial<DeviceContext>,\n options: {\n /** Bundle identifier */\n appId: string;\n }\n): Promise<any> {\n return simctlAsync(['uninstall', resolveId(device), options.appId]);\n}\n\nfunction parseSimControlJSONResults(input: string): any {\n try {\n return JSON.parse(input);\n } catch (error: any) {\n // Nov 15, 2020: Observed this can happen when opening the simulator and the simulator prompts the user to update the xcode command line tools.\n // Unexpected token I in JSON at position 0\n if (error.message.includes('Unexpected token')) {\n Log.error(`Apple's simctl returned malformed JSON:\\n${input}`);\n }\n throw error;\n }\n}\n\n/** Get all runtime devices given a certain type. */\nasync function getRuntimesAsync(\n type: 'devices' | 'devicetypes' | 'runtimes' | 'pairs',\n query?: string | 'available'\n): Promise<SimulatorDeviceList> {\n const result = await simctlAsync(['list', type, '--json', query]);\n const info = parseSimControlJSONResults(result.stdout) as SimulatorDeviceList;\n\n for (const runtime of Object.keys(info.devices)) {\n // Given a string like 'com.apple.CoreSimulator.SimRuntime.tvOS-13-4'\n const runtimeSuffix = runtime.split('com.apple.CoreSimulator.SimRuntime.').pop()!;\n // Create an array [tvOS, 13, 4]\n const [osType, ...osVersionComponents] = runtimeSuffix.split('-');\n // Join the end components [13, 4] -> '13.4'\n const osVersion = osVersionComponents.join('.');\n const sims = info.devices[runtime];\n for (const device of sims) {\n device.runtime = runtime;\n device.osVersion = osVersion;\n device.windowName = `${device.name} (${osVersion})`;\n device.osType = osType as OSType;\n }\n }\n return info;\n}\n\n/** Return a list of iOS simulators. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const simulatorDeviceInfo = await getRuntimesAsync('devices');\n return Object.values(simulatorDeviceInfo.devices).flat();\n}\n\n/** Run a `simctl` command. */\nexport async function simctlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n return xcrunAsync(['simctl', ...args], options);\n}\n\nfunction resolveId(device: Partial<DeviceContext>): string {\n return device.udid ?? 'booted';\n}\n"],"names":["isOSType","getContainerPathAsync","getInfoPlistValueAsync","openUrlAsync","openAppIdAsync","bootAsync","getBootedSimulatorsAsync","isDeviceBootedAsync","bootDeviceAsync","installAsync","uninstallAsync","getDevicesAsync","simctlAsync","value","knownTypes","includes","Log","warn","join","device","appId","stdout","resolveId","trim","error","stderr","match","key","containerPath","ensuredContainerPath","output","spawnAsync","stdio","options","url","udid","results","openAppIdInternalAsync","status","CommandError","simulatorDeviceInfo","getRuntimesAsync","Object","values","devices","flatMap","runtime","filter","state","find","bootedDevice","filePath","parseSimControlJSONResults","input","JSON","parse","message","type","query","result","info","keys","runtimeSuffix","split","pop","osType","osVersionComponents","osVersion","sims","windowName","name","flat","args","xcrunAsync"],"mappings":"AAAA;;;;;;;;;;;IAgDgBA,QAAQ,MAARA,QAAQ;IAiBFC,qBAAqB,MAArBA,qBAAqB;IAoBrBC,sBAAsB,MAAtBA,sBAAsB;IA+BtBC,YAAY,MAAZA,YAAY;IAwBZC,cAAc,MAAdA,cAAc;IA8BdC,SAA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CAAC2B,OAAO,GAAGA,OAAO,CAAC;YACzB3B,MAAM,CAACgD,SAAS,GAAGA,SAAS,CAAC;YAC7BhD,MAAM,CAACkD,UAAU,GAAG,CAAC,EAAElD,MAAM,CAACmD,IAAI,CAAC,EAAE,EAAEH,SAAS,CAAC,CAAC,CAAC,CAAC;YACpDhD,MAAM,CAAC8C,MAAM,GAAGA,MAAM,AAAU,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAOL,IAAI,CAAC;AACd,CAAC;AAGM,eAAejD,eAAe,GAAsB;IACzD,MAAM6B,mBAAmB,GAAG,MAAMC,gBAAgB,CAAC,SAAS,CAAC,AAAC;IAC9D,OAAOC,MAAM,CAACC,MAAM,CAACH,mBAAmB,CAACI,OAAO,CAAC,CAAC2B,IAAI,EAAE,CAAC;AAC3D,CAAC;AAGM,eAAe3D,WAAW,CAC/B4D,IAA4B,EAC5BvC,OAAsB,EACA;IACtB,OAAOwC,IAAAA,MAAU,WAAA,EAAC;QAAC,QAAQ;WAAKD,IAAI;KAAC,EAAEvC,OAAO,CAAC,CAAC;AAClD,CAAC;AAED,SAASX,SAAS,CAACH,MAA8B,EAAU;QAClDA,KAAW;IAAlB,OAAOA,CAAAA,KAAW,GAAXA,MAAM,CAACgB,IAAI,YAAXhB,KAAW,GAAI,QAAQ,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"tree-kill": "^1.2.2",
|
|
169
169
|
"tsd": "^0.28.1"
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "8b4cb45563b85c2ec91b1b249d136661bf6e8981"
|
|
172
172
|
}
|