@expo/cli 0.18.2 → 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 +103 -31
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +14 -0
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.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/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +371 -0
- package/build/src/start/platforms/ios/devicectl.js.map +1 -0
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/server/metro/debugging/AtlasPrerequisite.js +47 -0
- package/build/src/start/server/metro/debugging/AtlasPrerequisite.js.map +1 -0
- package/build/src/start/server/metro/debugging/attachAtlas.js +69 -0
- package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -0
- package/build/src/start/server/metro/instantiateMetro.js +11 -0
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/router.js +4 -2
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +4 -3
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,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qB,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,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AAgG,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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/ios/XcodeBuild.types.ts"],"sourcesContent":["import { 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 };\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"}
|
|
@@ -10,8 +10,7 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
getConnectedDevicesAsync: ()=>getConnectedDevicesAsync,
|
|
13
|
-
runOnDevice: ()=>runOnDevice
|
|
14
|
-
launchAppWithDeviceCtl: ()=>launchAppWithDeviceCtl
|
|
13
|
+
runOnDevice: ()=>runOnDevice
|
|
15
14
|
});
|
|
16
15
|
function _debug() {
|
|
17
16
|
const data = /*#__PURE__*/ _interopRequireDefault(require("debug"));
|
|
@@ -40,17 +39,108 @@ const _usbmuxdClient = require("./client/UsbmuxdClient");
|
|
|
40
39
|
const _afcprotocol = require("./protocol/AFCProtocol");
|
|
41
40
|
const _log = require("../../../log");
|
|
42
41
|
const _xcodeDeveloperDiskImagePrerequisite = require("../../../start/doctor/apple/XcodeDeveloperDiskImagePrerequisite");
|
|
43
|
-
const
|
|
42
|
+
const _devicectl = /*#__PURE__*/ _interopRequireWildcard(require("../../../start/platforms/ios/devicectl"));
|
|
43
|
+
const _array = require("../../../utils/array");
|
|
44
44
|
const _delay = require("../../../utils/delay");
|
|
45
45
|
const _errors = require("../../../utils/errors");
|
|
46
46
|
const _exit = require("../../../utils/exit");
|
|
47
|
+
const _profile = require("../../../utils/profile");
|
|
47
48
|
function _interopRequireDefault(obj) {
|
|
48
49
|
return obj && obj.__esModule ? obj : {
|
|
49
50
|
default: obj
|
|
50
51
|
};
|
|
51
52
|
}
|
|
53
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
54
|
+
if (typeof WeakMap !== "function") return null;
|
|
55
|
+
var cacheBabelInterop = new WeakMap();
|
|
56
|
+
var cacheNodeInterop = new WeakMap();
|
|
57
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
58
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
59
|
+
})(nodeInterop);
|
|
60
|
+
}
|
|
61
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
62
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
66
|
+
return {
|
|
67
|
+
default: obj
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
71
|
+
if (cache && cache.has(obj)) {
|
|
72
|
+
return cache.get(obj);
|
|
73
|
+
}
|
|
74
|
+
var newObj = {};
|
|
75
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
76
|
+
for(var key in obj){
|
|
77
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
78
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
79
|
+
if (desc && (desc.get || desc.set)) {
|
|
80
|
+
Object.defineProperty(newObj, key, desc);
|
|
81
|
+
} else {
|
|
82
|
+
newObj[key] = obj[key];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
newObj.default = obj;
|
|
87
|
+
if (cache) {
|
|
88
|
+
cache.set(obj, newObj);
|
|
89
|
+
}
|
|
90
|
+
return newObj;
|
|
91
|
+
}
|
|
52
92
|
const debug = (0, _debug().default)("expo:apple-device");
|
|
93
|
+
async function getConnectedDevicesUsingNativeToolsAsync() {
|
|
94
|
+
return (await _devicectl.getConnectedAppleDevicesAsync())// Filter out unpaired devices.
|
|
95
|
+
// TODO: We could improve this logic in the future to attempt pairing if specified.
|
|
96
|
+
.filter((device)=>device.connectionProperties.pairingState === "paired").map((device)=>{
|
|
97
|
+
return {
|
|
98
|
+
name: device.deviceProperties.name,
|
|
99
|
+
model: device.hardwareProperties.productType,
|
|
100
|
+
osVersion: device.deviceProperties.osVersionNumber,
|
|
101
|
+
udid: device.hardwareProperties.udid,
|
|
102
|
+
deviceType: "device",
|
|
103
|
+
connectionType: device.connectionProperties.transportType === "localNetwork" ? "Network" : "USB",
|
|
104
|
+
osType: coercePlatformToOsType(device.hardwareProperties.platform)
|
|
105
|
+
};
|
|
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
|
+
}
|
|
53
130
|
async function getConnectedDevicesAsync() {
|
|
131
|
+
const devices = await Promise.all([
|
|
132
|
+
// Prioritize native tools since they can provide more accurate information.
|
|
133
|
+
// NOTE: xcrun is substantially slower than custom tooling. +1.5s vs 9ms.
|
|
134
|
+
(0, _profile.profile)(getConnectedDevicesUsingNativeToolsAsync)(),
|
|
135
|
+
(0, _profile.profile)(getConnectedDevicesUsingCustomToolingAsync)(),
|
|
136
|
+
]);
|
|
137
|
+
return (0, _array.uniqBy)(devices.flat(), (device)=>device.udid);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* This supports devices that are running OS versions older than iOS 17.
|
|
141
|
+
*
|
|
142
|
+
* @returns a list of connected Apple devices.
|
|
143
|
+
*/ async function getConnectedDevicesUsingCustomToolingAsync() {
|
|
54
144
|
const client = new _usbmuxdClient.UsbmuxdClient(_usbmuxdClient.UsbmuxdClient.connectUsbmuxdSocket());
|
|
55
145
|
const devices = await client.getDevices();
|
|
56
146
|
client.socket.end();
|
|
@@ -67,11 +157,19 @@ async function getConnectedDevicesAsync() {
|
|
|
67
157
|
osVersion: deviceValues.ProductVersion,
|
|
68
158
|
deviceType: "device",
|
|
69
159
|
connectionType: device.Properties.ConnectionType,
|
|
70
|
-
udid: device.Properties.SerialNumber
|
|
160
|
+
udid: device.Properties.SerialNumber,
|
|
161
|
+
osType: coerceUsbmuxdPlatformToOsType(deviceValues.DeviceClass)
|
|
71
162
|
};
|
|
72
163
|
}));
|
|
73
164
|
}
|
|
74
165
|
async function runOnDevice({ udid , appPath , bundleId , waitForApp , deltaPath , onProgress }) {
|
|
166
|
+
debug("Running on device:", {
|
|
167
|
+
udid,
|
|
168
|
+
appPath,
|
|
169
|
+
bundleId,
|
|
170
|
+
waitForApp,
|
|
171
|
+
deltaPath
|
|
172
|
+
});
|
|
75
173
|
const clientManager = await _clientManager.ClientManager.create(udid);
|
|
76
174
|
try {
|
|
77
175
|
await mountDeveloperDiskImage(clientManager);
|
|
@@ -187,32 +285,6 @@ async function launchAppWithUsbmux(clientManager, { appInfo , detach }) {
|
|
|
187
285
|
}
|
|
188
286
|
throw new _errors.CommandError("Unable to launch app, number of tries exceeded");
|
|
189
287
|
}
|
|
190
|
-
async function launchAppWithDeviceCtl(deviceId, bundleId) {
|
|
191
|
-
try {
|
|
192
|
-
await (0, _xcrun.xcrunAsync)([
|
|
193
|
-
"devicectl",
|
|
194
|
-
"device",
|
|
195
|
-
"process",
|
|
196
|
-
"launch",
|
|
197
|
-
"--device",
|
|
198
|
-
deviceId,
|
|
199
|
-
bundleId
|
|
200
|
-
]);
|
|
201
|
-
} catch (error) {
|
|
202
|
-
if ("stderr" in error) {
|
|
203
|
-
const errorCodes = getDeviceCtlErrorCodes(error.stderr);
|
|
204
|
-
if (errorCodes.includes("Locked")) {
|
|
205
|
-
throw new _errors.CommandError("APPLE_DEVICE_LOCKED", "Device is locked, unlock and try again.");
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
throw new _errors.CommandError(`There was an error launching app: ${error}`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
/** Find all error codes from the output log */ function getDeviceCtlErrorCodes(log) {
|
|
212
|
-
return [
|
|
213
|
-
...log.matchAll(/BSErrorCodeDescription\s+=\s+(.*)$/gim)
|
|
214
|
-
].map(([_line, code])=>code);
|
|
215
|
-
}
|
|
216
288
|
/**
|
|
217
289
|
* iOS 17 introduces a new protocol called RemoteXPC.
|
|
218
290
|
* This is not yet implemented, so we fallback to devicectl.
|
|
@@ -230,7 +302,7 @@ async function launchAppWithDeviceCtl(deviceId, bundleId) {
|
|
|
230
302
|
const deviceId = clientManager.device.Properties.SerialNumber;
|
|
231
303
|
clientManager.end();
|
|
232
304
|
// Fallback to devicectl for iOS 17 support
|
|
233
|
-
return await launchAppWithDeviceCtl(deviceId, bundleId);
|
|
305
|
+
return await (0, _devicectl.launchAppWithDeviceCtl)(deviceId, bundleId);
|
|
234
306
|
}
|
|
235
307
|
}
|
|
236
308
|
|
|
@@ -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 { xcrunAsync } from '../../../start/platforms/ios/xcrun';\nimport { delayAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\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\n/** @returns a list of connected Apple devices. */\nexport async function getConnectedDevicesAsync(): 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 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/** @internal Exposed for testing */\nexport async function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n try {\n await xcrunAsync(['devicectl', 'device', 'process', 'launch', '--device', deviceId, bundleId]);\n } catch (error: any) {\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\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\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","launchAppWithDeviceCtl","debug","Debug","client","UsbmuxdClient","connectUsbmuxdSocket","devices","getDevices","socket","end","Promise","all","map","device","connect","deviceValues","LockdowndClient","getAllValues","name","DeviceName","ProductType","model","osVersion","ProductVersion","deviceType","connectionType","Properties","ConnectionType","udid","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","deviceId","xcrunAsync","error","errorCodes","getDeviceCtlErrorCodes","stderr","includes","log","matchAll","_line","code"],"mappings":"AAAA;;;;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AAE;QACd/G,KAAK,CAAC,6DAA6D,EAAE+G,KAAK,CAAC,CAAC;QAE5E,sFAAsF;QACtF,MAAMF,QAAQ,GAAG3E,aAAa,CAACtB,MAAM,CAACa,UAAU,CAACG,YAAY,AAAC;QAC9DM,aAAa,CAAC1B,GAAG,EAAE,CAAC;QAEpB,2CAA2C;QAC3C,OAAO,MAAMT,sBAAsB,CAAC8G,QAAQ,EAAE/E,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","launchAppWith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OAAO,MAAM8F,IAAAA,UAAsB,uBAAA,EAACD,QAAQ,EAAEhF,QAAQ,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -34,6 +34,7 @@ function _path() {
|
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
36
|
const _appleDevice = /*#__PURE__*/ _interopRequireWildcard(require("./AppleDevice"));
|
|
37
|
+
const _devicectl = /*#__PURE__*/ _interopRequireWildcard(require("../../../start/platforms/ios/devicectl"));
|
|
37
38
|
const _dir = require("../../../utils/dir");
|
|
38
39
|
const _errors = require("../../../utils/errors");
|
|
39
40
|
const _interactive = require("../../../utils/interactive");
|
|
@@ -112,6 +113,19 @@ async function installOnDeviceAsync(props) {
|
|
|
112
113
|
}
|
|
113
114
|
});
|
|
114
115
|
} catch (error) {
|
|
116
|
+
if (error instanceof _errors.CommandError) {
|
|
117
|
+
if (error.code === "APPLE_DEVICE_USBMUXD") {
|
|
118
|
+
// Couldn't find device, could be OTA...
|
|
119
|
+
// Fallback on much slower devicectl method which supports OTA installs.
|
|
120
|
+
if (_devicectl.hasDevicectlEverBeenInstalled()) {
|
|
121
|
+
// This should never happen.
|
|
122
|
+
if (indicator) {
|
|
123
|
+
indicator.clear();
|
|
124
|
+
}
|
|
125
|
+
return await _devicectl.installAndLaunchAppAsync(props);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
115
129
|
if (indicator) {
|
|
116
130
|
indicator.fail();
|
|
117
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/run/ios/appleDevice/installOnDeviceAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Ora } from 'ora';\nimport os from 'os';\nimport path from 'path';\n\nimport * as AppleDevice from './AppleDevice';\nimport { ensureDirectory } from '../../../utils/dir';\nimport { CommandError } from '../../../utils/errors';\nimport { isInteractive } from '../../../utils/interactive';\nimport { ora } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\n\n/** Get the app_delta folder for faster subsequent rebuilds on devices. */\nexport function getAppDeltaDirectory(bundleId: string): string {\n // TODO: Maybe use .expo folder instead for debugging\n // TODO: Reuse existing folder from xcode?\n const deltaFolder = path.join(os.tmpdir(), 'ios', 'app-delta', bundleId);\n ensureDirectory(deltaFolder);\n return deltaFolder;\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 installOnDeviceAsync(props: {\n bundle: string;\n bundleIdentifier: string;\n appDeltaDirectory: string;\n udid: string;\n deviceName: string;\n}): Promise<void> {\n const { bundle, bundleIdentifier, appDeltaDirectory, udid, deviceName } = props;\n let indicator: Ora | undefined;\n\n try {\n // TODO: Connect for logs\n await AppleDevice.runOnDevice({\n udid,\n appPath: bundle,\n bundleId: bundleIdentifier,\n waitForApp: false,\n deltaPath: appDeltaDirectory,\n onProgress({\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 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 installOnDeviceAsync(props);\n }\n throw new CommandError(\n `Cannot launch ${appName} on ${deviceName} because the device is locked.`\n );\n }\n throw error;\n }\n}\n"],"names":["getAppDeltaDirectory","installOnDeviceAsync","bundleId","deltaFolder","path","join","os","tmpdir","ensureDirectory","props","bundle","bundleIdentifier","appDeltaDirectory","udid","deviceName","indicator","AppleDevice","runOnDevice","appPath","waitForApp","deltaPath","onProgress","status","isComplete","progress","ora","start","text","chalk","bold","succeed","error","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/appleDevice/installOnDeviceAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Ora } from 'ora';\nimport os from 'os';\nimport path from 'path';\n\nimport * as AppleDevice from './AppleDevice';\nimport * as devicectl from '../../../start/platforms/ios/devicectl';\nimport { ensureDirectory } from '../../../utils/dir';\nimport { CommandError } from '../../../utils/errors';\nimport { isInteractive } from '../../../utils/interactive';\nimport { ora } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\n\n/** Get the app_delta folder for faster subsequent rebuilds on devices. */\nexport function getAppDeltaDirectory(bundleId: string): string {\n // TODO: Maybe use .expo folder instead for debugging\n // TODO: Reuse existing folder from xcode?\n const deltaFolder = path.join(os.tmpdir(), 'ios', 'app-delta', bundleId);\n ensureDirectory(deltaFolder);\n return deltaFolder;\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 installOnDeviceAsync(props: {\n bundle: string;\n bundleIdentifier: string;\n appDeltaDirectory: string;\n udid: string;\n deviceName: string;\n}): Promise<void> {\n const { bundle, bundleIdentifier, appDeltaDirectory, udid, deviceName } = props;\n let indicator: Ora | undefined;\n\n try {\n // TODO: Connect for logs\n await AppleDevice.runOnDevice({\n udid,\n appPath: bundle,\n bundleId: bundleIdentifier,\n waitForApp: false,\n deltaPath: appDeltaDirectory,\n onProgress({\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 (error instanceof CommandError) {\n if (error.code === 'APPLE_DEVICE_USBMUXD') {\n // Couldn't find device, could be OTA...\n // Fallback on much slower devicectl method which supports OTA installs.\n if (devicectl.hasDevicectlEverBeenInstalled()) {\n // This should never happen.\n if (indicator) {\n indicator.clear();\n }\n return await devicectl.installAndLaunchAppAsync(props);\n }\n }\n }\n\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 installOnDeviceAsync(props);\n }\n throw new CommandError(\n `Cannot launch ${appName} on ${deviceName} because the device is locked.`\n );\n }\n throw error;\n }\n}\n"],"names":["getAppDeltaDirectory","installOnDeviceAsync","bundleId","deltaFolder","path","join","os","tmpdir","ensureDirectory","props","bundle","bundleIdentifier","appDeltaDirectory","udid","deviceName","indicator","AppleDevice","runOnDevice","appPath","waitForApp","deltaPath","onProgress","status","isComplete","progress","ora","start","text","chalk","bold","succeed","error","CommandError","code","devicectl","hasDevicectlEverBeenInstalled","clear","installAndLaunchAppAsync","fail","appName","basename","split","isInteractive","confirmAsync","message","initial"],"mappings":"AAAA;;;;;;;;;;;IAcgBA,oBAAoB,MAApBA,oBAAoB;IAYdC,oBAAoB,MAApBA,oBAAoB;;;8DA1BxB,OAAO;;;;;;;8DAEV,IAAI;;;;;;;8DACF,MAAM;;;;;;mEAEM,eAAe;iEACjB,wCAAwC;qBACnC,oBAAoB;wBACvB,uBAAuB;6BACtB,4BAA4B;qBACtC,oBAAoB;yBACX,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9C,SAASD,oBAAoB,CAACE,QAAgB,EAAU;IAC7D,qDAAqD;IACrD,0CAA0C;IAC1C,MAAMC,WAAW,GAAGC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACC,GAAE,EAAA,QAAA,CAACC,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,EAAEL,QAAQ,CAAC,AAAC;IACzEM,IAAAA,IAAe,gBAAA,EAACL,WAAW,CAAC,CAAC;IAC7B,OAAOA,WAAW,CAAC;AACr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AC;gBACzD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAIM,SAAS,EAAE;YACbA,SAAS,CAACuB,IAAI,EAAE,CAAC;QACnB,CAAC;QACD,IAAIP,KAAK,CAACE,IAAI,KAAK,qBAAqB,EAAE;gBAExB7B,GAAmC;YADnD,yCAAyC;YACzC,MAAMmC,OAAO,GAAGnC,CAAAA,GAAmC,GAAnCA,KAAI,EAAA,QAAA,CAACoC,QAAQ,CAAC9B,MAAM,CAAC,CAAC+B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAnCrC,GAAmC,GAAI,KAAK,AAAC;YAC7D,IACEsC,IAAAA,YAAa,cAAA,GAAE,IACd,MAAMC,IAAAA,QAAY,aAAA,EAAC;gBAClBC,OAAO,EAAE,CAAC,cAAc,EAAEL,OAAO,CAAC,sCAAsC,EAAEzB,UAAU,CAAC,eAAe,CAAC;gBACrG+B,OAAO,EAAE,IAAI;aACd,CAAC,AAAC,EACH;gBACA,OAAO5C,oBAAoB,CAACQ,KAAK,CAAC,CAAC;YACrC,CAAC;YACD,MAAM,IAAIuB,OAAY,aAAA,CACpB,CAAC,cAAc,EAAEO,OAAO,CAAC,IAAI,EAAEzB,UAAU,CAAC,8BAA8B,CAAC,CAC1E,CAAC;QACJ,CAAC;QACD,MAAMiB,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -23,6 +23,7 @@ function _path() {
|
|
|
23
23
|
const _xcodeBuild = /*#__PURE__*/ _interopRequireWildcard(require("./XcodeBuild"));
|
|
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,KAAK,OAAO,EAAE;YACnC,MAAMC,IAAAA,UAAsB,uBAAA,EAACN,KAAK,EAAEH,UAAU,CAAC,CAAC;QAClD,OAAO;YACL,MAAMI,IAAAA,QAAO,QAAA,EAACM,qBAAoB,qBAAA,CAAC,CAAC;gBAClCC,gBAAgB,EAAER,KAAK;gBACvBS,MAAM,EAAEZ,UAAU;gBAClBa,iBAAiB,EAAEC,IAAAA,qBAAoB,qBAAA,EAACX,KAAK,CAAC;gBA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