@depup/expo__cli 55.0.23-depup.0 → 57.0.9-depup.0
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/LICENSE +21 -0
- package/README.md +13 -15
- package/build/bin/cli +4 -4
- package/build/bin/cli.map +1 -1
- package/build/src/api/endpoint.js +4 -4
- package/build/src/api/endpoint.js.map +1 -1
- package/build/src/api/getExpoSchema.js +3 -3
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/graphql/client.js +26 -14
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/mutations/TunnelMutation.js +31 -0
- package/build/src/api/graphql/mutations/TunnelMutation.js.map +1 -0
- package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/ResponseCache.js +5 -5
- package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
- package/build/src/api/rest/client.js +35 -20
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +6 -5
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +28 -15
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +10 -3
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +76 -24
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +4 -4
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +19 -7
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +3 -3
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +7 -4
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/templates.js +4 -6
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/events/index.js +19 -15
- package/build/src/events/index.js.map +1 -1
- package/build/src/events/stream.js +94 -24
- package/build/src/events/stream.js.map +1 -1
- package/build/src/expoUpdatesExports.js +4 -4
- package/build/src/expoUpdatesExports.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +45 -20
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +1 -1
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +7 -6
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +7 -7
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +32 -28
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +5 -5
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportDomComponents.js +5 -5
- package/build/src/export/exportDomComponents.js.map +1 -1
- package/build/src/export/exportHermes.js +23 -13
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +30 -21
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +26 -34
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/html.js +3 -3
- package/build/src/export/html.js.map +1 -1
- package/build/src/export/index.js +2 -0
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +4 -4
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +6 -6
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +16 -4
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +12 -13
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +3 -3
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/static.js +6 -0
- package/build/src/export/static.js.map +1 -0
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +1 -28
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +3 -3
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +3 -3
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/install/utils/checkPackagesCompatibility.js +32 -16
- package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
- package/build/src/lint/ESlintPrerequisite.js.map +1 -1
- package/build/src/log.js +32 -14
- package/build/src/log.js.map +1 -1
- package/build/src/login/index.js +25 -5
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +49 -14
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +3 -3
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +3 -2
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +31 -6
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +8 -5
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +7 -7
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +10 -5
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +3 -3
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +7 -7
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js.map +1 -1
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +3 -4
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +48 -1
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +4 -1
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +4 -4
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +163 -23
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +6 -5
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +10 -16
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +2 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/ServiceClient.js +3 -3
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +3 -3
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +16 -13
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +6 -6
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +5 -5
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +7 -7
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +5 -5
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +8 -8
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +5 -3
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +7 -5
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/settings.js +3 -3
- package/build/src/run/ios/codeSigning/settings.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +4 -4
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +8 -1
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +3 -3
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/appleDestinations.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +3 -3
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +8 -3
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +4 -4
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +9 -4
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +39 -0
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/ios/validateExternalBinary.js.map +1 -1
- package/build/src/run/startBundler.js +4 -0
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/serve/index.js +4 -1
- package/build/src/serve/index.js.map +1 -1
- package/build/src/serve/serveAsync.js +23 -11
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/serve/static.js +69 -0
- package/build/src/serve/static.js.map +1 -0
- package/build/src/start/checkDependenciesOnStart.js +131 -0
- package/build/src/start/checkDependenciesOnStart.js.map +1 -0
- package/build/src/start/detectDevClient.js +3 -3
- package/build/src/start/detectDevClient.js.map +1 -1
- package/build/src/start/doctor/Prerequisite.js +4 -4
- package/build/src/start/doctor/Prerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +53 -91
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +3 -3
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +3 -3
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +5 -5
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -5
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/reactNativeTv.js +149 -0
- package/build/src/start/doctor/dependencies/reactNativeTv.js.map +1 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js +4 -4
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +33 -8
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +3 -3
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/ngrok/NgrokResolver.js +3 -3
- package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +3 -3
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +5 -12
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +2 -0
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +6 -6
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +49 -6
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +13 -4
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +4 -0
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +13 -4
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +36 -34
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +4 -4
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +5 -5
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/getDevices.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +5 -5
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +3 -3
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +20 -6
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js +11 -0
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +7 -7
- package/build/src/start/platforms/ios/devicectl.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +26 -11
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +5 -5
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +5 -4
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +25 -19
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +3 -3
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +3 -3
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +6 -6
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/project/dotExpo.js +4 -3
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/resolveOptions.js +7 -7
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +1 -1
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/AsyncWsTunnel.js +120 -35
- package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
- package/build/src/start/server/Bonjour.js +8 -3
- package/build/src/start/server/Bonjour.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +23 -9
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPlugin.js +63 -3
- package/build/src/start/server/DevToolsPlugin.js.map +1 -1
- package/build/src/start/server/DevToolsPlugin.schema.js +8 -3
- package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -1
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +58 -23
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -1
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js +29 -0
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +20 -6
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginServerHelpers.js +83 -0
- package/build/src/start/server/DevToolsPluginServerHelpers.js.map +1 -0
- package/build/src/start/server/DevelopmentSession.js +41 -24
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/MCP.js +10 -3
- package/build/src/start/server/MCP.js.map +1 -1
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js +15 -5
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +14 -1
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js +18 -4
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +13 -24
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +239 -108
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +67 -16
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +22 -4
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js +25 -12
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
- package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
- package/build/src/start/server/metro/createFileMap-fork.js +196 -0
- package/build/src/start/server/metro/createFileMap-fork.js.map +1 -0
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +22 -22
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createTypescriptResolver.js +410 -0
- package/build/src/start/server/metro/createTypescriptResolver.js.map +1 -0
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
- package/build/src/start/server/metro/debugging/attachAtlas.js +3 -3
- package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +6 -5
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +20 -4
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
- package/build/src/start/server/metro/dev-server/compression.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMessageSocket.js +13 -2
- package/build/src/start/server/metro/dev-server/createMessageSocket.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +9 -2
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js +3 -3
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
- package/build/src/start/server/metro/errors/FailedToResolveNativeOnlyModuleError.js.map +1 -1
- package/build/src/start/server/metro/externals.js +4 -4
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +3 -3
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +3 -3
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +141 -57
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +4 -4
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js +3 -3
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +16 -13
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroErrors.js +3 -3
- package/build/src/start/server/metro/metroErrors.js.map +1 -1
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +48 -16
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/resolveLoader.js +3 -3
- package/build/src/start/server/metro/resolveLoader.js.map +1 -1
- package/build/src/start/server/metro/router.js +23 -14
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +13 -10
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +29 -13
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +36 -34
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js +53 -30
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +187 -126
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +4 -4
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CorsMiddleware.js +3 -3
- package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +60 -9
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js +16 -12
- package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +6 -4
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +3 -3
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +13 -8
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +15 -6
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/OpenMiddleware.js +150 -0
- package/build/src/start/server/middleware/OpenMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +13 -4
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +2 -9
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/domPolyfills.js +60 -0
- package/build/src/start/server/middleware/domPolyfills.js.map +1 -0
- package/build/src/start/server/middleware/inspector/JsInspector.js +6 -31
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +14 -24
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +3 -3
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +15 -14
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/mutations.js +3 -3
- package/build/src/start/server/middleware/mutations.js.map +1 -1
- package/build/src/start/server/middleware/openHandlers.js +157 -0
- package/build/src/start/server/middleware/openHandlers.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js +4 -4
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +9 -7
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
- package/build/src/start/server/openPlatforms.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +3 -1
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +13 -36
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +3 -3
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +14 -55
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +5 -5
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +12 -10
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -3
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +4 -4
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +3 -3
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +21 -11
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/types.d.ts +2 -0
- package/build/src/utils/FileNotifier.js +1 -1
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/args.js +5 -5
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/array.js +8 -8
- package/build/src/utils/array.js.map +1 -1
- package/build/src/utils/build-cache-providers/helpers.js +4 -4
- package/build/src/utils/build-cache-providers/helpers.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js +5 -5
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/cocoapods.js +5 -5
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +12 -6
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/composeMetroIgnorePatterns.js +69 -0
- package/build/src/utils/composeMetroIgnorePatterns.js.map +1 -0
- package/build/src/utils/createTempPath.js +3 -3
- package/build/src/utils/createTempPath.js.map +1 -1
- package/build/src/utils/delay.js +4 -4
- package/build/src/utils/delay.js.map +1 -1
- package/build/src/utils/dir.js +21 -11
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +4 -4
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +4 -4
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +39 -13
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +6 -6
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/exit.js +15 -19
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/expoUpdatesCli.js +5 -5
- package/build/src/utils/expoUpdatesCli.js.map +1 -1
- package/build/src/utils/fetch.js +4 -4
- package/build/src/utils/fetch.js.map +1 -1
- package/build/src/utils/findUp.js +3 -3
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/fn.js +3 -3
- package/build/src/utils/fn.js.map +1 -1
- package/build/src/utils/freeport.js +3 -3
- package/build/src/utils/freeport.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +3 -5
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +5 -5
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +3 -3
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +3 -3
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/ip.js +4 -4
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/link.js +3 -3
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +10 -10
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +3 -3
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/net.js +23 -4
- package/build/src/utils/net.js.map +1 -1
- package/build/src/utils/nodeEnv.js +6 -6
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/npm.js +10 -9
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/obj.js +4 -4
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/open.js +240 -11
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +4 -4
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +5 -4
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +12 -5
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/progress.js +4 -4
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +11 -11
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/qr.js +5 -4
- package/build/src/utils/qr.js.map +1 -1
- package/build/src/utils/resolveArgs.js +10 -9
- package/build/src/utils/resolveArgs.js.map +1 -1
- package/build/src/utils/scheme.js +4 -4
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/strings.js.map +1 -1
- package/build/src/utils/tar.js +8 -7
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/Telemetry.js +5 -0
- package/build/src/utils/telemetry/Telemetry.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js +5 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
- package/build/src/utils/telemetry/index.js +4 -4
- package/build/src/utils/telemetry/index.js.map +1 -1
- package/build/src/utils/telemetry/utils/agent.js +42 -0
- package/build/src/utils/telemetry/utils/agent.js.map +1 -0
- package/build/src/utils/telemetry/utils/constants.js +3 -3
- package/build/src/utils/telemetry/utils/constants.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +3 -2
- package/build/src/utils/telemetry/utils/context.js.map +1 -1
- package/build/src/utils/url.js +5 -17
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +12 -12
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +4 -4
- package/build/src/utils/variadic.js.map +1 -1
- package/build/src/whoami/index.js.map +1 -1
- package/changes.json +18 -26
- package/main.js +3 -0
- package/package.json +88 -80
- package/static/loading-page/index.html +45 -3
- package/static/template/+html.tsx +14 -5
- package/add-module.js +0 -8
- package/build/src/start/server/middleware/inspector/CdpClient.js +0 -81
- package/build/src/start/server/middleware/inspector/CdpClient.js.map +0 -1
- package/build/src/utils/resolveWatchFolders.js +0 -67
- package/build/src/utils/resolveWatchFolders.js.map +0 -1
- package/build/src/utils/tsconfig/evaluateTsConfig.js +0 -87
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +0 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +0 -84
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +0 -1
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +0 -94
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +0 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +0 -62
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +0 -1
|
@@ -5,19 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
AppleDeviceManager
|
|
12
|
+
get AppleDeviceManager () {
|
|
13
13
|
return AppleDeviceManager;
|
|
14
14
|
},
|
|
15
|
-
ensureSimulatorOpenAsync
|
|
15
|
+
get ensureSimulatorOpenAsync () {
|
|
16
16
|
return ensureSimulatorOpenAsync;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function _osascript() {
|
|
20
|
-
const data =
|
|
20
|
+
const data = require("@expo/osascript");
|
|
21
21
|
_osascript = function() {
|
|
22
22
|
return data;
|
|
23
23
|
};
|
|
@@ -58,6 +58,7 @@ const _promptAppleDevice = require("./promptAppleDevice");
|
|
|
58
58
|
const _simctl = /*#__PURE__*/ _interop_require_wildcard(require("./simctl"));
|
|
59
59
|
const _delay = require("../../../utils/delay");
|
|
60
60
|
const _errors = require("../../../utils/errors");
|
|
61
|
+
const _interactive = require("../../../utils/interactive");
|
|
61
62
|
const _plist = require("../../../utils/plist");
|
|
62
63
|
const _url = require("../../../utils/url");
|
|
63
64
|
const _DeviceManager = require("../DeviceManager");
|
|
@@ -268,13 +269,26 @@ class AppleDeviceManager extends _DeviceManager.DeviceManager {
|
|
|
268
269
|
}
|
|
269
270
|
async activateWindowAsync() {
|
|
270
271
|
await (0, _ensureSimulatorAppRunning.ensureSimulatorAppRunningAsync)(this.device);
|
|
271
|
-
//
|
|
272
|
-
|
|
272
|
+
// If we're in interactive mode, we can attempt to focus the Simulator app.
|
|
273
|
+
// In non-interactive mode, we should assume this is an agent and not attempt to focus the Simulator app since it doesn't need focus.
|
|
274
|
+
if ((0, _interactive.isInteractive)()) {
|
|
275
|
+
// TODO: Focus the individual window
|
|
276
|
+
await (0, _osascript().spawnAsync)([
|
|
277
|
+
`if application "Simulator" is running then`,
|
|
278
|
+
`tell application "Simulator" to activate`,
|
|
279
|
+
`else if application "DeviceHub" is running then`,
|
|
280
|
+
`tell application "DeviceHub" to activate`,
|
|
281
|
+
`end if`
|
|
282
|
+
]);
|
|
283
|
+
}
|
|
273
284
|
}
|
|
274
285
|
getExpoGoAppId() {
|
|
275
286
|
return EXPO_GO_BUNDLE_IDENTIFIER;
|
|
276
287
|
}
|
|
277
288
|
async ensureExpoGoAsync(sdkVersion) {
|
|
289
|
+
if (this.device.osType === 'watchOS') {
|
|
290
|
+
throw new _errors.CommandError('UNSUPPORTED_DEVICE', `Expo Go is not supported on Apple Watch. Please select an iPhone or iPad simulator instead.`);
|
|
291
|
+
}
|
|
278
292
|
const installer = new _ExpoGoInstaller.ExpoGoInstaller('ios', EXPO_GO_BUNDLE_IDENTIFIER, sdkVersion);
|
|
279
293
|
return installer.ensureAsync(this);
|
|
280
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/AppleDeviceManager.ts"],"sourcesContent":["import * as osascript from '@expo/osascript';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { assertSystemRequirementsAsync } from './assertSystemRequirements';\nimport { ensureSimulatorAppRunningAsync } from './ensureSimulatorAppRunning';\nimport {\n getBestBootedSimulatorAsync,\n getBestUnbootedSimulatorAsync,\n getSelectableSimulatorsAsync,\n} from './getBestSimulator';\nimport { promptAppleDeviceAsync } from './promptAppleDevice';\nimport * as SimControl from './simctl';\nimport { delayAsync, waitForActionAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { parsePlistAsync } from '../../../utils/plist';\nimport { validateUrl } from '../../../utils/url';\nimport { DeviceManager } from '../DeviceManager';\nimport { ExpoGoInstaller } from '../ExpoGoInstaller';\nimport { BaseResolveDeviceProps } from '../PlatformManager';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleDeviceManager') as typeof console.log;\n\nconst EXPO_GO_BUNDLE_IDENTIFIER = 'host.exp.Exponent';\n\n/**\n * Ensure a simulator is booted and the Simulator app is opened.\n * This is where any timeout related error handling should live.\n */\nexport async function ensureSimulatorOpenAsync(\n { udid, osType }: Partial<Pick<SimControl.Device, 'udid' | 'osType'>> = {},\n tryAgain: boolean = true\n): Promise<SimControl.Device> {\n // Use a default simulator if none was specified\n if (!udid) {\n // If a simulator is open, side step the entire booting sequence.\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp;\n }\n\n // Otherwise, find the best possible simulator from user defaults and continue\n const bestUdid = await getBestUnbootedSimulatorAsync({ osType });\n if (!bestUdid) {\n throw new CommandError('No simulators found.');\n }\n udid = bestUdid;\n }\n\n const bootedDevice = await waitForActionAsync({\n action: () => {\n // Just for the type check.\n assert(udid);\n return SimControl.bootAsync({ udid });\n },\n });\n\n if (!bootedDevice) {\n // Give it a second chance, this might not be needed but it could potentially lead to a better UX on slower devices.\n if (tryAgain) {\n return await ensureSimulatorOpenAsync({ udid, osType }, false);\n }\n // TODO: We should eliminate all needs for a timeout error, it's bad UX to get an error about the simulator not starting while the user can clearly see it starting on their slow computer.\n throw new CommandError(\n 'SIMULATOR_TIMEOUT',\n `Simulator didn't boot fast enough. Try opening Simulator first, then running your app.`\n );\n }\n return bootedDevice;\n}\nexport class AppleDeviceManager extends DeviceManager<SimControl.Device> {\n static assertSystemRequirementsAsync = assertSystemRequirementsAsync;\n\n static async resolveAsync({\n device,\n shouldPrompt,\n }: BaseResolveDeviceProps<\n Partial<Pick<SimControl.Device, 'udid' | 'osType'>>\n > = {}): Promise<AppleDeviceManager> {\n if (shouldPrompt) {\n const devices = await getSelectableSimulatorsAsync(device);\n device = await promptAppleDeviceAsync(devices, device?.osType);\n }\n\n const booted = await ensureSimulatorOpenAsync(device);\n return new AppleDeviceManager(booted);\n }\n\n get name() {\n return this.device.name;\n }\n\n get identifier(): string {\n return this.device.udid;\n }\n\n async getAppVersionAsync(\n appId: string,\n { containerPath }: { containerPath?: string } = {}\n ): Promise<string | null> {\n return await SimControl.getInfoPlistValueAsync(this.device, {\n appId,\n key: 'CFBundleShortVersionString',\n containerPath,\n });\n }\n\n async startAsync(): Promise<SimControl.Device> {\n return ensureSimulatorOpenAsync({ osType: this.device.osType, udid: this.device.udid });\n }\n\n async launchApplicationIdAsync(appId: string) {\n try {\n const result = await SimControl.openAppIdAsync(this.device, {\n appId,\n });\n if (result.status === 0) {\n await this.activateWindowAsync();\n } else {\n throw new CommandError(result.stderr);\n }\n } catch (error: any) {\n let errorMessage = `Couldn't open iOS app with ID \"${appId}\" on device \"${this.name}\".`;\n if (error instanceof CommandError && error.code === 'APP_NOT_INSTALLED') {\n if (appId === EXPO_GO_BUNDLE_IDENTIFIER) {\n errorMessage = `Couldn't open Expo Go app on device \"${this.name}\". Install it: https://expo.dev/go.`;\n } else {\n errorMessage += `\\nThe app might not be installed, try installing it with: ${chalk.bold(\n `npx expo run:ios -d ${this.device.udid}`\n )}`;\n }\n }\n if (error.stderr) {\n errorMessage += chalk.gray(`\\n${error.stderr}`);\n } else if (error.message) {\n errorMessage += chalk.gray(`\\n${error.message}`);\n }\n throw new CommandError(errorMessage);\n }\n }\n\n async installAppAsync(filePath: string) {\n await SimControl.installAsync(this.device, {\n filePath,\n });\n\n await this.waitForAppInstalledAsync(await this.getApplicationIdFromBundle(filePath));\n }\n\n private async getApplicationIdFromBundle(filePath: string): Promise<string> {\n debug('getApplicationIdFromBundle:', filePath);\n const builtInfoPlistPath = path.join(filePath, 'Info.plist');\n if (fs.existsSync(builtInfoPlistPath)) {\n const { CFBundleIdentifier } = await parsePlistAsync(builtInfoPlistPath);\n debug('getApplicationIdFromBundle: using built Info.plist', CFBundleIdentifier);\n return CFBundleIdentifier;\n }\n debug('getApplicationIdFromBundle: no Info.plist found');\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n private async waitForAppInstalledAsync(applicationId: string): Promise<boolean> {\n while (true) {\n if (await this.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(applicationId)) {\n return true;\n }\n await delayAsync(100);\n }\n }\n\n async uninstallAppAsync(appId: string) {\n await SimControl.uninstallAsync(this.device, {\n appId,\n });\n }\n\n async isAppInstalledAndIfSoReturnContainerPathForIOSAsync(appId: string) {\n return (\n (await SimControl.getContainerPathAsync(this.device, {\n appId,\n })) ?? false\n );\n }\n\n async openUrlAsync(url: string, options: { appId?: string } = {}) {\n // Non-compliant URLs will be treated as application identifiers.\n if (!validateUrl(url, { requireProtocol: true })) {\n return await this.launchApplicationIdAsync(url);\n }\n\n try {\n await SimControl.openUrlAsync(this.device, { url, appId: options.appId });\n } catch (error: any) {\n // 194 means the device does not conform to a given URL, in this case we'll assume that the desired app is not installed.\n if (error.status === 194) {\n // An error was encountered processing the command (domain=NSOSStatusErrorDomain, code=-10814):\n // The operation couldn’t be completed. (OSStatus error -10814.)\n //\n // This can be thrown when no app conforms to the URI scheme that we attempted to open.\n throw new CommandError(\n 'APP_NOT_INSTALLED',\n `Device ${this.device.name} (${this.device.udid}) has no app to handle the URI: ${url}`\n );\n }\n throw error;\n }\n }\n\n async activateWindowAsync() {\n await ensureSimulatorAppRunningAsync(this.device);\n // TODO: Focus the individual window\n await osascript.execAsync(`tell application \"Simulator\" to activate`);\n }\n\n getExpoGoAppId(): string {\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n async ensureExpoGoAsync(sdkVersion: string): Promise<boolean> {\n const installer = new ExpoGoInstaller('ios', EXPO_GO_BUNDLE_IDENTIFIER, sdkVersion);\n return installer.ensureAsync(this);\n }\n}\n"],"names":["AppleDeviceManager","ensureSimulatorOpenAsync","debug","require","EXPO_GO_BUNDLE_IDENTIFIER","udid","osType","tryAgain","simulatorOpenedByApp","getBestBootedSimulatorAsync","bestUdid","getBestUnbootedSimulatorAsync","CommandError","bootedDevice","waitForActionAsync","action","assert","SimControl","bootAsync","DeviceManager","assertSystemRequirementsAsync","resolveAsync","device","shouldPrompt","devices","getSelectableSimulatorsAsync","promptAppleDeviceAsync","booted","name","identifier","getAppVersionAsync","appId","containerPath","getInfoPlistValueAsync","key","startAsync","launchApplicationIdAsync","result","openAppIdAsync","status","activateWindowAsync","stderr","error","errorMessage","code","chalk","bold","gray","message","installAppAsync","filePath","installAsync","waitForAppInstalledAsync","getApplicationIdFromBundle","builtInfoPlistPath","path","join","fs","existsSync","CFBundleIdentifier","parsePlistAsync","applicationId","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","delayAsync","uninstallAppAsync","uninstallAsync","getContainerPathAsync","openUrlAsync","url","options","validateUrl","requireProtocol","ensureSimulatorAppRunningAsync","osascript","execAsync","getExpoGoAppId","ensureExpoGoAsync","sdkVersion","installer","ExpoGoInstaller","ensureAsync"],"mappings":";;;;;;;;;;;IAwEaA,kBAAkB;eAAlBA;;IAzCSC,wBAAwB;eAAxBA;;;;iEA/BK;;;;;;;gEACR;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;0CAE6B;2CACC;kCAKxC;mCACgC;gEACX;uBACmB;wBAClB;uBACG;qBACJ;+BACE;iCACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGhC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,4BAA4B;AAM3B,eAAeH,yBACpB,EAAEI,IAAI,EAAEC,MAAM,EAAuD,GAAG,CAAC,CAAC,EAC1EC,WAAoB,IAAI;IAExB,gDAAgD;IAChD,IAAI,CAACF,MAAM;QACT,iEAAiE;QACjE,MAAMG,uBAAuB,MAAMC,IAAAA,6CAA2B,EAAC;YAAEH;QAAO;QACxE,IAAIE,sBAAsB;YACxB,OAAOA;QACT;QAEA,8EAA8E;QAC9E,MAAME,WAAW,MAAMC,IAAAA,+CAA6B,EAAC;YAAEL;QAAO;QAC9D,IAAI,CAACI,UAAU;YACb,MAAM,IAAIE,oBAAY,CAAC;QACzB;QACAP,OAAOK;IACT;IAEA,MAAMG,eAAe,MAAMC,IAAAA,yBAAkB,EAAC;QAC5CC,QAAQ;YACN,2BAA2B;YAC3BC,IAAAA,iBAAM,EAACX;YACP,OAAOY,QAAWC,SAAS,CAAC;gBAAEb;YAAK;QACrC;IACF;IAEA,IAAI,CAACQ,cAAc;QACjB,oHAAoH;QACpH,IAAIN,UAAU;YACZ,OAAO,MAAMN,yBAAyB;gBAAEI;gBAAMC;YAAO,GAAG;QAC1D;QACA,2LAA2L;QAC3L,MAAM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AC5D,MAAMC,YAAY,IAAIC,gCAAe,CAAC,OAAO3E,2BAA2ByE;QACxE,OAAOC,UAAUE,WAAW,CAAC,IAAI;IACnC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/AppleDeviceManager.ts"],"sourcesContent":["import { spawnAsync as spawnAppleScriptAsync } from '@expo/osascript';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { assertSystemRequirementsAsync } from './assertSystemRequirements';\nimport { ensureSimulatorAppRunningAsync } from './ensureSimulatorAppRunning';\nimport {\n getBestBootedSimulatorAsync,\n getBestUnbootedSimulatorAsync,\n getSelectableSimulatorsAsync,\n} from './getBestSimulator';\nimport { promptAppleDeviceAsync } from './promptAppleDevice';\nimport * as SimControl from './simctl';\nimport { delayAsync, waitForActionAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { isInteractive } from '../../../utils/interactive';\nimport { parsePlistAsync } from '../../../utils/plist';\nimport { validateUrl } from '../../../utils/url';\nimport { DeviceManager } from '../DeviceManager';\nimport { ExpoGoInstaller } from '../ExpoGoInstaller';\nimport type { BaseResolveDeviceProps } from '../PlatformManager';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleDeviceManager') as typeof console.log;\n\nconst EXPO_GO_BUNDLE_IDENTIFIER = 'host.exp.Exponent';\n\n/**\n * Ensure a simulator is booted and the Simulator app is opened.\n * This is where any timeout related error handling should live.\n */\nexport async function ensureSimulatorOpenAsync(\n { udid, osType }: Partial<Pick<SimControl.Device, 'udid' | 'osType'>> = {},\n tryAgain: boolean = true\n): Promise<SimControl.Device> {\n // Use a default simulator if none was specified\n if (!udid) {\n // If a simulator is open, side step the entire booting sequence.\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp;\n }\n\n // Otherwise, find the best possible simulator from user defaults and continue\n const bestUdid = await getBestUnbootedSimulatorAsync({ osType });\n if (!bestUdid) {\n throw new CommandError('No simulators found.');\n }\n udid = bestUdid;\n }\n\n const bootedDevice = await waitForActionAsync({\n action: () => {\n // Just for the type check.\n assert(udid);\n return SimControl.bootAsync({ udid });\n },\n });\n\n if (!bootedDevice) {\n // Give it a second chance, this might not be needed but it could potentially lead to a better UX on slower devices.\n if (tryAgain) {\n return await ensureSimulatorOpenAsync({ udid, osType }, false);\n }\n // TODO: We should eliminate all needs for a timeout error, it's bad UX to get an error about the simulator not starting while the user can clearly see it starting on their slow computer.\n throw new CommandError(\n 'SIMULATOR_TIMEOUT',\n `Simulator didn't boot fast enough. Try opening Simulator first, then running your app.`\n );\n }\n return bootedDevice;\n}\nexport class AppleDeviceManager extends DeviceManager<SimControl.Device> {\n static assertSystemRequirementsAsync = assertSystemRequirementsAsync;\n\n static async resolveAsync({\n device,\n shouldPrompt,\n }: BaseResolveDeviceProps<\n Partial<Pick<SimControl.Device, 'udid' | 'osType'>>\n > = {}): Promise<AppleDeviceManager> {\n if (shouldPrompt) {\n const devices = await getSelectableSimulatorsAsync(device);\n device = await promptAppleDeviceAsync(devices, device?.osType);\n }\n\n const booted = await ensureSimulatorOpenAsync(device);\n return new AppleDeviceManager(booted);\n }\n\n get name() {\n return this.device.name;\n }\n\n get identifier(): string {\n return this.device.udid;\n }\n\n async getAppVersionAsync(\n appId: string,\n { containerPath }: { containerPath?: string } = {}\n ): Promise<string | null> {\n return await SimControl.getInfoPlistValueAsync(this.device, {\n appId,\n key: 'CFBundleShortVersionString',\n containerPath,\n });\n }\n\n async startAsync(): Promise<SimControl.Device> {\n return ensureSimulatorOpenAsync({ osType: this.device.osType, udid: this.device.udid });\n }\n\n async launchApplicationIdAsync(appId: string) {\n try {\n const result = await SimControl.openAppIdAsync(this.device, {\n appId,\n });\n if (result.status === 0) {\n await this.activateWindowAsync();\n } else {\n throw new CommandError(result.stderr);\n }\n } catch (error: any) {\n let errorMessage = `Couldn't open iOS app with ID \"${appId}\" on device \"${this.name}\".`;\n if (error instanceof CommandError && error.code === 'APP_NOT_INSTALLED') {\n if (appId === EXPO_GO_BUNDLE_IDENTIFIER) {\n errorMessage = `Couldn't open Expo Go app on device \"${this.name}\". Install it: https://expo.dev/go.`;\n } else {\n errorMessage += `\\nThe app might not be installed, try installing it with: ${chalk.bold(\n `npx expo run:ios -d ${this.device.udid}`\n )}`;\n }\n }\n if (error.stderr) {\n errorMessage += chalk.gray(`\\n${error.stderr}`);\n } else if (error.message) {\n errorMessage += chalk.gray(`\\n${error.message}`);\n }\n throw new CommandError(errorMessage);\n }\n }\n\n async installAppAsync(filePath: string) {\n await SimControl.installAsync(this.device, {\n filePath,\n });\n\n await this.waitForAppInstalledAsync(await this.getApplicationIdFromBundle(filePath));\n }\n\n private async getApplicationIdFromBundle(filePath: string): Promise<string> {\n debug('getApplicationIdFromBundle:', filePath);\n const builtInfoPlistPath = path.join(filePath, 'Info.plist');\n if (fs.existsSync(builtInfoPlistPath)) {\n const { CFBundleIdentifier } = await parsePlistAsync(builtInfoPlistPath);\n debug('getApplicationIdFromBundle: using built Info.plist', CFBundleIdentifier);\n return CFBundleIdentifier;\n }\n debug('getApplicationIdFromBundle: no Info.plist found');\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n private async waitForAppInstalledAsync(applicationId: string): Promise<boolean> {\n while (true) {\n if (await this.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(applicationId)) {\n return true;\n }\n await delayAsync(100);\n }\n }\n\n async uninstallAppAsync(appId: string) {\n await SimControl.uninstallAsync(this.device, {\n appId,\n });\n }\n\n async isAppInstalledAndIfSoReturnContainerPathForIOSAsync(appId: string) {\n return (\n (await SimControl.getContainerPathAsync(this.device, {\n appId,\n })) ?? false\n );\n }\n\n async openUrlAsync(url: string, options: { appId?: string } = {}) {\n // Non-compliant URLs will be treated as application identifiers.\n if (!validateUrl(url, { requireProtocol: true })) {\n return await this.launchApplicationIdAsync(url);\n }\n\n try {\n await SimControl.openUrlAsync(this.device, { url, appId: options.appId });\n } catch (error: any) {\n // 194 means the device does not conform to a given URL, in this case we'll assume that the desired app is not installed.\n if (error.status === 194) {\n // An error was encountered processing the command (domain=NSOSStatusErrorDomain, code=-10814):\n // The operation couldn’t be completed. (OSStatus error -10814.)\n //\n // This can be thrown when no app conforms to the URI scheme that we attempted to open.\n throw new CommandError(\n 'APP_NOT_INSTALLED',\n `Device ${this.device.name} (${this.device.udid}) has no app to handle the URI: ${url}`\n );\n }\n throw error;\n }\n }\n\n async activateWindowAsync() {\n await ensureSimulatorAppRunningAsync(this.device);\n\n // If we're in interactive mode, we can attempt to focus the Simulator app.\n // In non-interactive mode, we should assume this is an agent and not attempt to focus the Simulator app since it doesn't need focus.\n if (isInteractive()) {\n // TODO: Focus the individual window\n await spawnAppleScriptAsync([\n `if application \"Simulator\" is running then`,\n `tell application \"Simulator\" to activate`,\n `else if application \"DeviceHub\" is running then`,\n `tell application \"DeviceHub\" to activate`,\n `end if`,\n ]);\n }\n }\n\n getExpoGoAppId(): string {\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n async ensureExpoGoAsync(sdkVersion: string): Promise<boolean> {\n if (this.device.osType === 'watchOS') {\n throw new CommandError(\n 'UNSUPPORTED_DEVICE',\n `Expo Go is not supported on Apple Watch. Please select an iPhone or iPad simulator instead.`\n );\n }\n const installer = new ExpoGoInstaller('ios', EXPO_GO_BUNDLE_IDENTIFIER, sdkVersion);\n return installer.ensureAsync(this);\n }\n}\n"],"names":["AppleDeviceManager","ensureSimulatorOpenAsync","debug","require","EXPO_GO_BUNDLE_IDENTIFIER","udid","osType","tryAgain","simulatorOpenedByApp","getBestBootedSimulatorAsync","bestUdid","getBestUnbootedSimulatorAsync","CommandError","bootedDevice","waitForActionAsync","action","assert","SimControl","bootAsync","DeviceManager","assertSystemRequirementsAsync","resolveAsync","device","shouldPrompt","devices","getSelectableSimulatorsAsync","promptAppleDeviceAsync","booted","name","identifier","getAppVersionAsync","appId","containerPath","getInfoPlistValueAsync","key","startAsync","launchApplicationIdAsync","result","openAppIdAsync","status","activateWindowAsync","stderr","error","errorMessage","code","chalk","bold","gray","message","installAppAsync","filePath","installAsync","waitForAppInstalledAsync","getApplicationIdFromBundle","builtInfoPlistPath","path","join","fs","existsSync","CFBundleIdentifier","parsePlistAsync","applicationId","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","delayAsync","uninstallAppAsync","uninstallAsync","getContainerPathAsync","openUrlAsync","url","options","validateUrl","requireProtocol","ensureSimulatorAppRunningAsync","isInteractive","spawnAppleScriptAsync","getExpoGoAppId","ensureExpoGoAsync","sdkVersion","installer","ExpoGoInstaller","ensureAsync"],"mappings":";;;;;;;;;;;QAyEaA;eAAAA;;QAzCSC;eAAAA;;;;yBAhC8B;;;;;;;gEACjC;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;0CAE6B;2CACC;kCAKxC;mCACgC;gEACX;uBACmB;wBAClB;6BACC;uBACE;qBACJ;+BACE;iCACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGhC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,4BAA4B;AAM3B,eAAeH,yBACpB,EAAEI,IAAI,EAAEC,MAAM,EAAuD,GAAG,CAAC,CAAC,EAC1EC,WAAoB,IAAI;IAExB,gDAAgD;IAChD,IAAI,CAACF,MAAM;QACT,iEAAiE;QACjE,MAAMG,uBAAuB,MAAMC,IAAAA,6CAA2B,EAAC;YAAEH;QAAO;QACxE,IAAIE,sBAAsB;YACxB,OAAOA;QACT;QAEA,8EAA8E;QAC9E,MAAME,WAAW,MAAMC,IAAAA,+CAA6B,EAAC;YAAEL;QAAO;QAC9D,IAAI,CAACI,UAAU;YACb,MAAM,IAAIE,oBAAY,CAAC;QACzB;QACAP,OAAOK;IACT;IAEA,MAAMG,eAAe,MAAMC,IAAAA,yBAAkB,EAAC;QAC5CC,QAAQ;YACN,2BAA2B;YAC3BC,IAAAA,iBAAM,EAACX;YACP,OAAOY,Q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,IAAAA,yDAA8B,EAAC,IAAI,CAAClD,MAAM;QAEhD,2EAA2E;QAC3E,qIAAqI;QACrI,IAAImD,IAAAA,0BAAa,KAAI;YACnB,oCAAoC;YACpC,MAAMC,IAAAA,uBAAqB,EAAC;gBAC1B,CAAC,0CAA0C,CAAC;gBAC5C,CAAC,wCAAwC,CAAC;gBAC1C,CAAC,+CAA+C,CAAC;gBACjD,CAAC,wCAAwC,CAAC;gBAC1C,CAAC,MAAM,CAAC;aACT;QACH;IACF;IAEAC,iBAAyB;QACvB,OAAOvE;IACT;IAEA,MAAMwE,kBAAkBC,UAAkB,EAAoB;QAC5D,IAAI,IAAI,CAACvD,MAAM,CAAChB,MAAM,KAAK,WAAW;YACpC,MAAM,IAAIM,oBAAY,CACpB,sBACA,CAAC,2FAA2F,CAAC;QAEjG;QACA,MAAMkE,YAAY,IAAIC,gCAAe,CAAC,OAAO3E,2BAA2ByE;QACxE,OAAOC,UAAUE,WAAW,CAAC,IAAI;IACnC;AACF"}
|
|
@@ -21,6 +21,17 @@ class ApplePlatformManager extends _PlatformManager.PlatformManager {
|
|
|
21
21
|
}
|
|
22
22
|
async openAsync(options, resolveSettings) {
|
|
23
23
|
await _AppleDeviceManager.AppleDeviceManager.assertSystemRequirementsAsync();
|
|
24
|
+
// Expo Go only supports iOS (iPhone/iPad), not watchOS or tvOS.
|
|
25
|
+
// Ensure device selection filters to iOS when launching Expo Go.
|
|
26
|
+
if (options.runtime === 'expo') {
|
|
27
|
+
resolveSettings = {
|
|
28
|
+
...resolveSettings,
|
|
29
|
+
device: {
|
|
30
|
+
...resolveSettings == null ? void 0 : resolveSettings.device,
|
|
31
|
+
osType: 'iOS'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
24
35
|
return super.openAsync(options, resolveSettings);
|
|
25
36
|
}
|
|
26
37
|
_getAppIdResolver() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/ApplePlatformManager.ts"],"sourcesContent":["import { AppleAppIdResolver } from './AppleAppIdResolver';\nimport { AppleDeviceManager } from './AppleDeviceManager';\nimport { Device } from './simctl';\nimport { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/ApplePlatformManager.ts"],"sourcesContent":["import { AppleAppIdResolver } from './AppleAppIdResolver';\nimport { AppleDeviceManager } from './AppleDeviceManager';\nimport type { Device } from './simctl';\nimport type { AppIdResolver } from '../AppIdResolver';\nimport type { BaseOpenInCustomProps, BaseResolveDeviceProps } from '../PlatformManager';\nimport { PlatformManager } from '../PlatformManager';\n\n/** Manages launching apps on Apple simulators. */\nexport class ApplePlatformManager extends PlatformManager<Device> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'ios',\n ...options,\n resolveDeviceAsync: AppleDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> },\n resolveSettings?: BaseResolveDeviceProps<Device>\n ): Promise<{ url: string }> {\n await AppleDeviceManager.assertSystemRequirementsAsync();\n\n // Expo Go only supports iOS (iPhone/iPad), not watchOS or tvOS.\n // Ensure device selection filters to iOS when launching Expo Go.\n if (options.runtime === 'expo') {\n resolveSettings = {\n ...resolveSettings,\n device: { ...resolveSettings?.device, osType: 'iOS' } as Device,\n };\n }\n\n return super.openAsync(options, resolveSettings);\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AppleAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<BaseOpenInCustomProps>\n ): string {\n return applicationId;\n }\n}\n"],"names":["ApplePlatformManager","PlatformManager","projectRoot","port","options","platform","resolveDeviceAsync","AppleDeviceManager","resolveAsync","openAsync","resolveSettings","assertSystemRequirementsAsync","runtime","device","osType","_getAppIdResolver","AppleAppIdResolver","_resolveAlternativeLaunchUrl","applicationId","props"],"mappings":";;;;+BAQaA;;;eAAAA;;;oCARsB;oCACA;iCAIH;AAGzB,MAAMA,6BAA6BC,gCAAe;IACvD,YACE,AAAUC,WAAmB,EAC7B,AAAUC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,aAAa;YACjBG,UAAU;YACV,GAAGD,OAAO;YACVE,oBAAoBC,sCAAkB,CAACC,YAAY;QACrD,SAjBUN,cAAAA,kBACAC,OAAAA;IAiBZ;IAEA,MAAMM,UACJL,OAEiE,EACjEM,eAAgD,EACtB;QAC1B,MAAMH,sCAAkB,CAACI,6BAA6B;QAEtD,gEAAgE;QAChE,iEAAiE;QACjE,IAAIP,QAAQQ,OAAO,KAAK,QAAQ;YAC9BF,kBAAkB;gBAChB,GAAGA,eAAe;gBAClBG,QAAQ;uBAAKH,mCAAAA,gBAAiBG,MAAM,AAA1B;oBAA4BC,QAAQ;gBAAM;YACtD;QACF;QAEA,OAAO,KAAK,CAACL,UAAUL,SAASM;IAClC;IAEAK,oBAAmC;QACjC,OAAO,IAAIC,sCAAkB,CAAC,IAAI,CAACd,WAAW;IAChD;IAEAe,6BACEC,aAAqB,EACrBC,KAAsC,EAC9B;QACR,OAAOD;IACT;AACF"}
|
|
@@ -10,26 +10,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
function _export(target, all) {
|
|
11
11
|
for(var name in all)Object.defineProperty(target, name, {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: all
|
|
13
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
|
-
devicectlAsync
|
|
17
|
+
get devicectlAsync () {
|
|
18
18
|
return devicectlAsync;
|
|
19
19
|
},
|
|
20
|
-
getConnectedAppleDevicesAsync
|
|
20
|
+
get getConnectedAppleDevicesAsync () {
|
|
21
21
|
return getConnectedAppleDevicesAsync;
|
|
22
22
|
},
|
|
23
|
-
hasDevicectlEverBeenInstalled
|
|
23
|
+
get hasDevicectlEverBeenInstalled () {
|
|
24
24
|
return hasDevicectlEverBeenInstalled;
|
|
25
25
|
},
|
|
26
|
-
installAndLaunchAppAsync
|
|
26
|
+
get installAndLaunchAppAsync () {
|
|
27
27
|
return installAndLaunchAppAsync;
|
|
28
28
|
},
|
|
29
|
-
launchAppWithDeviceCtl
|
|
29
|
+
get launchAppWithDeviceCtl () {
|
|
30
30
|
return launchAppWithDeviceCtl;
|
|
31
31
|
},
|
|
32
|
-
launchBinaryOnMacAsync
|
|
32
|
+
get launchBinaryOnMacAsync () {
|
|
33
33
|
return launchBinaryOnMacAsync;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -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 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';\n\nimport { xcrunAsync } from './xcrun';\nimport { getExpoHomeDirectory } from '../../../api/user/UserSettings';\nimport * as Log from '../../../log';\nimport { createTempFilePath } from '../../../utils/createTempPath';\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\ntype AnyEnum<T extends string = string> = T | (string & object);\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' | 'unavailable'>;\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 = createTempFilePath();\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 (![2, 3].includes((devicesJson as any)?.info?.jsonVersion)) {\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 const maxAttempts = 3;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n await installAppWithDeviceCtlInternalAsync(uuid, bundleIdOrAppPath, onProgress, attempt);\n return;\n } catch (error: any) {\n if (error.code === 'detached') {\n throw error;\n }\n const isTransientDisconnect =\n error.message &&\n (error.message.includes('CoreDeviceError') || error.message.includes('0xFA0'));\n\n if (!isTransientDisconnect || attempt === maxAttempts) {\n throw error;\n }\n const backoffDelay = 500 + Math.pow(2, attempt - 1) * 500;\n await new Promise((resolve) => setTimeout(resolve, backoffDelay));\n }\n }\n}\n\nasync function installAppWithDeviceCtlInternalAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void,\n attempt: number\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 const statusPrefix = attempt > 1 ? `Installing (attempt ${attempt})` : 'Installing';\n onProgress({\n progress,\n isComplete: progress === 100,\n status: statusPrefix,\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 let stderrBuffer = '';\n childProcess.stderr.on('data', (data: Buffer) => {\n stderrBuffer += data.toString();\n });\n\n childProcess.on('close', (code) => {\n debug('[close]: ' + code);\n if (code === 0) {\n resolve();\n } else {\n const err = new Error(stderrBuffer || `Command failed with exit code ${code}`);\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 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([\n 'device',\n 'process',\n 'launch',\n '--terminate-existing',\n '--device',\n deviceId,\n bundleId,\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","hasDevicectlEverBeenInstalled","installAndLaunchAppAsync","launchAppWithDeviceCtl","launchBinaryOnMacAsync","DEVICE_CTL_EXISTS_PATH","path","join","getExpoHomeDirectory","debug","require","args","options","xcrunAsync","error","CommandError","errorCodes","getDeviceCtlErrorCodes","stderr","includes","tmpPath","createTempFilePath","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","maxAttempts","attempt","installAppWithDeviceCtlInternalAsync","isTransientDisconnect","backoffDelay","Math","pow","Promise","resolve","setTimeout","reject","childProcess","spawn","currentProgress","hasStarted","updateProgress","progress","statusPrefix","isComplete","status","on","data","strings","toString","split","EOL","map","value","trim","forEach","str","match","parseInt","stderrBuffer","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;;;;;;;;;;;IA8HqBA,cAAc;eAAdA;;IAoBAC,6BAA6B;eAA7BA;;I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YACA,MAAM1F;QACR;IACF;IAEA,MAAMmG;AACR"}
|
|
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 JsonFile from '@expo/json-file';\nimport type { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn, execSync } from 'child_process';\nimport fs from 'fs';\nimport assert from 'node:assert';\nimport type { Ora } from 'ora';\nimport { EOL } from 'os';\nimport path from 'path';\n\nimport { xcrunAsync } from './xcrun';\nimport { getExpoHomeDirectory } from '../../../api/user/UserSettings';\nimport * as Log from '../../../log';\nimport { createTempFilePath } from '../../../utils/createTempPath';\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\ntype AnyEnum<T extends string = string> = T | (string & object);\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' | 'unavailable'>;\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 = createTempFilePath();\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 (![2, 3].includes((devicesJson as any)?.info?.jsonVersion)) {\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 const maxAttempts = 3;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n await installAppWithDeviceCtlInternalAsync(uuid, bundleIdOrAppPath, onProgress, attempt);\n return;\n } catch (error: any) {\n if (error.code === 'detached') {\n throw error;\n }\n const isTransientDisconnect =\n error.message &&\n (error.message.includes('CoreDeviceError') || error.message.includes('0xFA0'));\n\n if (!isTransientDisconnect || attempt === maxAttempts) {\n throw error;\n }\n const backoffDelay = 500 + Math.pow(2, attempt - 1) * 500;\n await new Promise((resolve) => setTimeout(resolve, backoffDelay));\n }\n }\n}\n\nasync function installAppWithDeviceCtlInternalAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void,\n attempt: number\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 const statusPrefix = attempt > 1 ? `Installing (attempt ${attempt})` : 'Installing';\n onProgress({\n progress,\n isComplete: progress === 100,\n status: statusPrefix,\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 let stderrBuffer = '';\n childProcess.stderr.on('data', (data: Buffer) => {\n stderrBuffer += data.toString();\n });\n\n childProcess.on('close', (code) => {\n debug('[close]: ' + code);\n if (code === 0) {\n resolve();\n } else {\n const err = new Error(stderrBuffer || `Command failed with exit code ${code}`);\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 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([\n 'device',\n 'process',\n 'launch',\n '--terminate-existing',\n '--device',\n deviceId,\n bundleId,\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","hasDevicectlEverBeenInstalled","installAndLaunchAppAsync","launchAppWithDeviceCtl","launchBinaryOnMacAsync","DEVICE_CTL_EXISTS_PATH","path","join","getExpoHomeDirectory","debug","require","args","options","xcrunAsync","error","CommandError","errorCodes","getDeviceCtlErrorCodes","stderr","includes","tmpPath","createTempFilePath","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","maxAttempts","attempt","installAppWithDeviceCtlInternalAsync","isTransientDisconnect","backoffDelay","Math","pow","Promise","resolve","setTimeout","reject","childProcess","spawn","currentProgress","hasStarted","updateProgress","progress","statusPrefix","isComplete","status","on","data","strings","toString","split","EOL","map","value","trim","forEach","str","match","parseInt","stderrBuffer","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;;;;;;;;;;;QA+HqBA;eAAAA;;QAoBAC;eAAAA;;QAyMNC;eAAAA;;QA+BMC;eAAAA;;QAlDAC;eAAAA;;QA/IAC;eAAAA;;;;gEAxLD;;;;;;;gEAEE;;;;;;;gEACL;;;;;;;yBACc;;;;;;;gEACjB;;;;;;;gEACI;;;;;;;yBAEC;;;;;;;gEACH;;;;;;uBAEU;8BACU;6DAChB;gCACc;wBACN;sBACI;6BACH;qBACV;yBACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,yBAAyBC,eAAI,CAACC,IAAI,CAACC,IAAAA,kCAAoB,KAAI;AAEjE,MAAMC,QAAQC,QAAQ,SAAS;AAsGxB,eAAeX,eACpBY,IAA4B,EAC5BC,OAAsB;IAEtB,IAAI;QACF,OAAO,MAAMC,IAAAA,iBAAU,EAAC;YAAC;eAAgBF;SAAK,EAAEC;IAClD,EAAE,OAAOE,OAAY;QACnB,IAAIA,iBAAiBC,oBAAY,EAAE;YACjC,MAAMD;QACR;QACA,IAAI,YA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lG;IACR;IAEA,eAAemG;QACb,IAAI;YACF,MAAM9G,uBAAuBoG,MAAMD;QACrC,EAAE,OAAOxF,OAAY;YACnB,IAAI2F,WAAW;gBACbA,UAAUO,IAAI;YAChB;YACA,IAAIlG,MAAM4B,IAAI,KAAK,uBAAuB;gBACxC,yCAAyC;gBACzC,MAAMwE,UAAU5G,eAAI,CAAC6G,QAAQ,CAACd,QAAQ7B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI;gBACvD,IACE4C,IAAAA,0BAAa,OACZ,MAAMC,IAAAA,qBAAY,EAAC;oBAClB1E,SAAS,CAAC,cAAc,EAAEuE,QAAQ,sCAAsC,EAAEV,WAAW,eAAe,CAAC;oBACrGc,SAAS;gBACX,IACA;oBACA,OAAOL;gBACT;gBACA,MAAM,IAAIlG,oBAAY,CACpB,CAAC,cAAc,EAAEmG,QAAQ,IAAI,EAAEV,WAAW,8BAA8B,CAAC;YAE7E;YACA,MAAM1F;QACR;IACF;IAEA,MAAMmG;AACR"}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "ensureSimulatorAppRunningAsync", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
function _osascript() {
|
|
12
|
-
const data =
|
|
12
|
+
const data = require("@expo/osascript");
|
|
13
13
|
_osascript = function() {
|
|
14
14
|
return data;
|
|
15
15
|
};
|
|
@@ -95,8 +95,8 @@ async function waitForSimulatorAppToStart({ maxWaitTime } = {}) {
|
|
|
95
95
|
// I think the app can be open while no simulators are booted.
|
|
96
96
|
async function isSimulatorAppRunningAsync() {
|
|
97
97
|
try {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
98
|
+
const result = await (0, _osascript().spawnAsync)('tell app "System Events" to count processes whose name is "Simulator" or name is "DeviceHub"');
|
|
99
|
+
if (result.stdout.trim() === '0') {
|
|
100
100
|
return false;
|
|
101
101
|
}
|
|
102
102
|
} catch (error) {
|
|
@@ -108,15 +108,30 @@ async function isSimulatorAppRunningAsync() {
|
|
|
108
108
|
return true;
|
|
109
109
|
}
|
|
110
110
|
async function openSimulatorAppAsync(device) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
try {
|
|
112
|
+
const args = [
|
|
113
|
+
'-a',
|
|
114
|
+
'Simulator'
|
|
115
|
+
];
|
|
116
|
+
if (device.udid) {
|
|
117
|
+
// This has no effect if the app is already running.
|
|
118
|
+
args.push('--args', '-CurrentDeviceUDID', device.udid);
|
|
119
|
+
}
|
|
120
|
+
await (0, _spawnasync().default)('open', args);
|
|
121
|
+
} catch {
|
|
122
|
+
// Xcode 27+ replaces Simulator.app with DeviceHub, so `open -a Simulator` fails.
|
|
123
|
+
// DeviceHub registers the `devices://` URL scheme, which lets us focus the right
|
|
124
|
+
// device by its UDID — `open -a DeviceHub` can only bring the app forward.
|
|
125
|
+
const deviceHubArgs = device.udid ? [
|
|
126
|
+
`devices://device/open?id=${device.udid}`
|
|
127
|
+
] : [
|
|
128
|
+
'-a',
|
|
129
|
+
'DeviceHub'
|
|
130
|
+
];
|
|
131
|
+
await (0, _spawnasync().default)('open', deviceHubArgs).catch(()=>{
|
|
132
|
+
// Noop - we can't do much more here
|
|
133
|
+
});
|
|
118
134
|
}
|
|
119
|
-
await (0, _spawnasync().default)('open', args);
|
|
120
135
|
}
|
|
121
136
|
|
|
122
137
|
//# sourceMappingURL=ensureSimulatorAppRunning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/ensureSimulatorAppRunning.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/ensureSimulatorAppRunning.ts"],"sourcesContent":["import { spawnAsync as spawnAppleScriptAsync } from '@expo/osascript';\nimport spawnAsync from '@expo/spawn-async';\n\nimport type { Device } from './simctl';\nimport * as Log from '../../../log';\nimport { waitForActionAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\n\n/** Open the Simulator.app and return when the system registers it as 'open'. */\nexport async function ensureSimulatorAppRunningAsync(\n device: Partial<Pick<Device, 'udid'>>,\n {\n maxWaitTime,\n }: {\n maxWaitTime?: number;\n } = {}\n): Promise<void> {\n if (await isSimulatorAppRunningAsync()) {\n return;\n }\n\n Log.log(`\\u203A Opening the iOS simulator, this might take a moment.`);\n\n // In theory this would ensure the correct simulator is booted as well.\n // This isn't theory though, this is Xcode.\n await openSimulatorAppAsync(device);\n\n if (!(await waitForSimulatorAppToStart({ maxWaitTime }))) {\n throw new CommandError(\n 'SIMULATOR_TIMEOUT',\n `Simulator app did not open fast enough. Try opening Simulator first, then running your app.`\n );\n }\n}\n\nasync function waitForSimulatorAppToStart({\n maxWaitTime,\n}: { maxWaitTime?: number } = {}): Promise<boolean> {\n return waitForActionAsync<boolean>({\n interval: 50,\n maxWaitTime,\n action: isSimulatorAppRunningAsync,\n });\n}\n\n// I think the app can be open while no simulators are booted.\nasync function isSimulatorAppRunningAsync(): Promise<boolean> {\n try {\n const result = await spawnAppleScriptAsync(\n 'tell app \"System Events\" to count processes whose name is \"Simulator\" or name is \"DeviceHub\"'\n );\n if (result.stdout.trim() === '0') {\n return false;\n }\n } catch (error: any) {\n if (error.message.includes('Application isn’t running')) {\n return false;\n }\n throw error;\n }\n\n return true;\n}\n\nasync function openSimulatorAppAsync(device: { udid?: string }) {\n try {\n const args = ['-a', 'Simulator'];\n if (device.udid) {\n // This has no effect if the app is already running.\n args.push('--args', '-CurrentDeviceUDID', device.udid);\n }\n await spawnAsync('open', args);\n } catch {\n // Xcode 27+ replaces Simulator.app with DeviceHub, so `open -a Simulator` fails.\n // DeviceHub registers the `devices://` URL scheme, which lets us focus the right\n // device by its UDID — `open -a DeviceHub` can only bring the app forward.\n const deviceHubArgs = device.udid\n ? [`devices://device/open?id=${device.udid}`]\n : ['-a', 'DeviceHub'];\n await spawnAsync('open', deviceHubArgs).catch(() => {\n // Noop - we can't do much more here\n });\n }\n}\n"],"names":["ensureSimulatorAppRunningAsync","device","maxWaitTime","isSimulatorAppRunningAsync","Log","log","openSimulatorAppAsync","waitForSimulatorAppToStart","CommandError","waitForActionAsync","interval","action","result","spawnAppleScriptAsync","stdout","trim","error","message","includes","args","udid","push","spawnAsync","deviceHubArgs","catch"],"mappings":";;;;+BASsBA;;;eAAAA;;;;yBAT8B;;;;;;;gEAC7B;;;;;;6DAGF;uBACc;wBACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtB,eAAeA,+BACpBC,MAAqC,EACrC,EACEC,WAAW,EAGZ,GAAG,CAAC,CAAC;IAEN,IAAI,MAAMC,8BAA8B;QACtC;IACF;IAEAC,KAAIC,GAAG,CAAC,CAAC,2DAA2D,CAAC;IAErE,uEAAuE;IACvE,2CAA2C;IAC3C,MAAMC,sBAAsBL;IAE5B,IAAI,CAAE,MAAMM,2BAA2B;QAAEL;IAAY,IAAK;QACxD,MAAM,IAAIM,oBAAY,CACpB,qBACA,CAAC,2FAA2F,CAAC;IAEjG;AACF;AAEA,eAAeD,2BAA2B,EACxCL,WAAW,EACc,GAAG,CAAC,CAAC;IAC9B,OAAOO,IAAAA,yBAAkB,EAAU;QACjCC,UAAU;QACVR;QACAS,QAAQR;IACV;AACF;AAEA,8DAA8D;AAC9D,eAAeA;IACb,IAAI;QACF,MAAMS,SAAS,MAAMC,IAAAA,uBAAqB,EACxC;QAEF,IAAID,OAAOE,MAAM,CAACC,IAAI,OAAO,KAAK;YAChC,OAAO;QACT;IACF,EAAE,OAAOC,OAAY;QACnB,IAAIA,MAAMC,OAAO,CAACC,QAAQ,CAAC,8BAA8B;YACvD,OAAO;QACT;QACA,MAAMF;IACR;IAEA,OAAO;AACT;AAEA,eAAeV,sBAAsBL,MAAyB;IAC5D,IAAI;QACF,MAAMkB,OAAO;YAAC;YAAM;SAAY;QAChC,IAAIlB,OAAOmB,IAAI,EAAE;YACf,oDAAoD;YACpDD,KAAKE,IAAI,CAAC,UAAU,sBAAsBpB,OAAOmB,IAAI;QACvD;QACA,MAAME,IAAAA,qBAAU,EAAC,QAAQH;IAC3B,EAAE,OAAM;QACN,iFAAiF;QACjF,iFAAiF;QACjF,2EAA2E;QAC3E,MAAMI,gBAAgBtB,OAAOmB,IAAI,GAC7B;YAAC,CAAC,yBAAyB,EAAEnB,OAAOmB,IAAI,EAAE;SAAC,GAC3C;YAAC;YAAM;SAAY;QACvB,MAAME,IAAAA,qBAAU,EAAC,QAAQC,eAAeC,KAAK,CAAC;QAC5C,oCAAoC;QACtC;IACF;AACF"}
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getBestBootedSimulatorAsync
|
|
12
|
+
get getBestBootedSimulatorAsync () {
|
|
13
13
|
return getBestBootedSimulatorAsync;
|
|
14
14
|
},
|
|
15
|
-
getBestSimulatorAsync
|
|
15
|
+
get getBestSimulatorAsync () {
|
|
16
16
|
return getBestSimulatorAsync;
|
|
17
17
|
},
|
|
18
|
-
getBestUnbootedSimulatorAsync
|
|
18
|
+
get getBestUnbootedSimulatorAsync () {
|
|
19
19
|
return getBestUnbootedSimulatorAsync;
|
|
20
20
|
},
|
|
21
|
-
getSelectableSimulatorsAsync
|
|
21
|
+
get getSelectableSimulatorsAsync () {
|
|
22
22
|
return getSelectableSimulatorsAsync;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/getBestSimulator.ts"],"sourcesContent":["import { execSync } from 'child_process';\n\nimport * as SimControl from './simctl';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:platforms:ios:getBestSimulator') as typeof console.log;\n\ntype DeviceContext = Partial<Pick<SimControl.Device, 'osType'>>;\n\n/**\n * Returns the default device stored in the Simulator.app settings.\n * This helps us to get the device that the user opened most recently regardless of which tool they used.\n */\nfunction getDefaultSimulatorDeviceUDID() {\n try {\n const defaultDeviceUDID = execSync(\n `defaults read com.apple.iphonesimulator CurrentDeviceUDID`,\n { stdio: 'pipe' }\n ).toString();\n return defaultDeviceUDID.trim();\n } catch {\n return null;\n }\n}\n\nexport async function getBestBootedSimulatorAsync({\n osType,\n}: DeviceContext = {}): Promise<SimControl.Device | null> {\n const [simulatorOpenedByApp] = await SimControl.getBootedSimulatorsAsync();\n // This should prevent opening a second simulator in the chance that default\n // simulator doesn't match what the Simulator app would open by default.\n if (\n simulatorOpenedByApp?.udid &&\n (!osType || (osType && simulatorOpenedByApp.osType === osType))\n ) {\n debug(`First booted simulator: ${simulatorOpenedByApp?.windowName}`);\n return simulatorOpenedByApp;\n }\n\n debug(`No booted simulator matching requirements (osType: ${osType}).`);\n return null;\n}\n\n/**\n * Returns the most preferred simulator UDID without booting anything.\n *\n * 1. If the simulator app defines a default simulator and the osType is not defined.\n * 2. If the osType is defined, then check if the default udid matches the osType.\n * 3. If all else fails, return the first found simulator.\n */\nexport async function getBestUnbootedSimulatorAsync({ osType }: DeviceContext = {}): Promise<\n string | null\n> {\n const defaultId = getDefaultSimulatorDeviceUDID();\n debug(`Default simulator ID: ${defaultId}`);\n\n if (defaultId && !osType) {\n return defaultId;\n }\n\n const simulators = await getSelectableSimulatorsAsync({ osType });\n\n if (!simulators.length) {\n // TODO: Prompt to install the simulators\n throw new CommandError(\n 'UNSUPPORTED_OS_TYPE',\n `No ${osType || 'iOS'} devices available in Simulator.app`\n );\n }\n\n // If the default udid is defined, then check to ensure its osType matches the required os.\n if (defaultId) {\n const defaultSimulator = simulators.find((device) => device.udid === defaultId);\n if (defaultSimulator?.osType === osType) {\n return defaultId;\n }\n }\n\n // Return first selectable device.\n return simulators[0]?.udid ?? null;\n}\n\n/**\n * Get all simulators supported by Expo Go (iOS only).\n */\nexport async function getSelectableSimulatorsAsync({ osType = 'iOS' }: DeviceContext = {}): Promise<\n SimControl.Device[]\n> {\n const simulators = await SimControl.getDevicesAsync();\n return simulators.filter((device) => device.isAvailable && device.osType === osType);\n}\n\n/**\n * Get 'best' simulator for the user based on:\n * 1. Currently booted simulator.\n * 2. Last simulator that was opened.\n * 3. First simulator that was opened.\n */\nexport async function getBestSimulatorAsync({ osType }: DeviceContext): Promise<string | null> {\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp.udid;\n }\n\n try {\n return await getBestUnbootedSimulatorAsync({ osType });\n } catch (error) {\n // Instead of throwing, return null if no simulators are found\n if (error instanceof CommandError && error.code === 'UNSUPPORTED_OS_TYPE') {\n return null;\n }\n throw error;\n }\n}\n"],"names":["getBestBootedSimulatorAsync","getBestSimulatorAsync","getBestUnbootedSimulatorAsync","getSelectableSimulatorsAsync","debug","require","getDefaultSimulatorDeviceUDID","defaultDeviceUDID","execSync","stdio","toString","trim","osType","simulatorOpenedByApp","SimControl","getBootedSimulatorsAsync","udid","windowName","simulators","defaultId","length","CommandError","defaultSimulator","find","device","getDevicesAsync","filter","isAvailable","error","code"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/getBestSimulator.ts"],"sourcesContent":["import { execSync } from 'child_process';\n\nimport * as SimControl from './simctl';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:platforms:ios:getBestSimulator') as typeof console.log;\n\ntype DeviceContext = Partial<Pick<SimControl.Device, 'osType'>>;\n\n/**\n * Returns the default device stored in the Simulator.app settings.\n * This helps us to get the device that the user opened most recently regardless of which tool they used.\n */\nfunction getDefaultSimulatorDeviceUDID() {\n try {\n const defaultDeviceUDID = execSync(\n `defaults read com.apple.iphonesimulator CurrentDeviceUDID`,\n { stdio: 'pipe' }\n ).toString();\n return defaultDeviceUDID.trim();\n } catch {\n return null;\n }\n}\n\nexport async function getBestBootedSimulatorAsync({\n osType,\n}: DeviceContext = {}): Promise<SimControl.Device | null> {\n const [simulatorOpenedByApp] = await SimControl.getBootedSimulatorsAsync();\n // This should prevent opening a second simulator in the chance that default\n // simulator doesn't match what the Simulator app would open by default.\n if (\n simulatorOpenedByApp?.udid &&\n (!osType || (osType && simulatorOpenedByApp.osType === osType))\n ) {\n debug(`First booted simulator: ${simulatorOpenedByApp?.windowName}`);\n return simulatorOpenedByApp;\n }\n\n debug(`No booted simulator matching requirements (osType: ${osType}).`);\n return null;\n}\n\n/**\n * Returns the most preferred simulator UDID without booting anything.\n *\n * 1. If the simulator app defines a default simulator and the osType is not defined.\n * 2. If the osType is defined, then check if the default udid matches the osType.\n * 3. If all else fails, return the first found simulator.\n */\nexport async function getBestUnbootedSimulatorAsync({ osType }: DeviceContext = {}): Promise<\n string | null\n> {\n const defaultId = getDefaultSimulatorDeviceUDID();\n debug(`Default simulator ID: ${defaultId}`);\n\n if (defaultId && !osType) {\n return defaultId;\n }\n\n const simulators = await getSelectableSimulatorsAsync({ osType });\n\n if (!simulators.length) {\n // TODO: Prompt to install the simulators\n throw new CommandError(\n 'UNSUPPORTED_OS_TYPE',\n `No ${osType || 'iOS'} devices available in Simulator.app`\n );\n }\n\n // If the default udid is defined, then check to ensure its osType matches the required os.\n if (defaultId) {\n const defaultSimulator = simulators.find((device) => device.udid === defaultId);\n if (defaultSimulator?.osType === osType) {\n return defaultId;\n }\n }\n\n // Return first selectable device.\n return simulators[0]?.udid ?? null;\n}\n\n/**\n * Get all simulators supported by Expo Go (iOS only).\n */\nexport async function getSelectableSimulatorsAsync({ osType = 'iOS' }: DeviceContext = {}): Promise<\n SimControl.Device[]\n> {\n const simulators = await SimControl.getDevicesAsync();\n return simulators.filter((device) => device.isAvailable && device.osType === osType);\n}\n\n/**\n * Get 'best' simulator for the user based on:\n * 1. Currently booted simulator.\n * 2. Last simulator that was opened.\n * 3. First simulator that was opened.\n */\nexport async function getBestSimulatorAsync({ osType }: DeviceContext): Promise<string | null> {\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp.udid;\n }\n\n try {\n return await getBestUnbootedSimulatorAsync({ osType });\n } catch (error) {\n // Instead of throwing, return null if no simulators are found\n if (error instanceof CommandError && error.code === 'UNSUPPORTED_OS_TYPE') {\n return null;\n }\n throw error;\n }\n}\n"],"names":["getBestBootedSimulatorAsync","getBestSimulatorAsync","getBestUnbootedSimulatorAsync","getSelectableSimulatorsAsync","debug","require","getDefaultSimulatorDeviceUDID","defaultDeviceUDID","execSync","stdio","toString","trim","osType","simulatorOpenedByApp","SimControl","getBootedSimulatorsAsync","udid","windowName","simulators","defaultId","length","CommandError","defaultSimulator","find","device","getDevicesAsync","filter","isAvailable","error","code"],"mappings":";;;;;;;;;;;QAyBsBA;eAAAA;;QAyEAC;eAAAA;;QAhDAC;eAAAA;;QAmCAC;eAAAA;;;;yBArFG;;;;;;gEAEG;wBACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAI/B;;;CAGC,GACD,SAASC;IACP,IAAI;QACF,MAAMC,oBAAoBC,IAAAA,yBAAQ,EAChC,CAAC,yDAAyD,CAAC,EAC3D;YAAEC,OAAO;QAAO,GAChBC,QAAQ;QACV,OAAOH,kBAAkBI,IAAI;IAC/B,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEO,eAAeX,4BAA4B,EAChDY,MAAM,EACQ,GAAG,CAAC,CAAC;IACnB,MAAM,CAACC,qBAAqB,GAAG,MAAMC,QAAWC,wBAAwB;IACxE,4EAA4E;IAC5E,wEAAwE;IACxE,IACEF,CAAAA,wCAAAA,qBAAsBG,IAAI,KACzB,CAAA,CAACJ,UAAWA,UAAUC,qBAAqBD,MAAM,KAAKA,M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D,EAAE,OAAOgB,OAAO;QACd,8DAA8D;QAC9D,IAAIA,iBAAiBP,oBAAY,IAAIO,MAAMC,IAAI,KAAK,uBAAuB;YACzE,OAAO;QACT;QACA,MAAMD;IACR;AACF"}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
promptAppleDeviceAsync
|
|
12
|
+
get promptAppleDeviceAsync () {
|
|
13
13
|
return promptAppleDeviceAsync;
|
|
14
14
|
},
|
|
15
|
-
sortDefaultDeviceToBeginningAsync
|
|
15
|
+
get sortDefaultDeviceToBeginningAsync () {
|
|
16
16
|
return sortDefaultDeviceToBeginningAsync;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -35,8 +35,9 @@ async function sortDefaultDeviceToBeginningAsync(devices, osType) {
|
|
|
35
35
|
osType
|
|
36
36
|
});
|
|
37
37
|
if (defaultId) {
|
|
38
|
+
var _devices_;
|
|
38
39
|
let iterations = 0;
|
|
39
|
-
while(devices[0].udid !== defaultId && iterations < devices.length){
|
|
40
|
+
while(((_devices_ = devices[0]) == null ? void 0 : _devices_.udid) !== defaultId && iterations < devices.length){
|
|
40
41
|
devices.push(devices.shift());
|
|
41
42
|
iterations++;
|
|
42
43
|
}
|
|
@@ -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<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]
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/promptAppleDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { getBestSimulatorAsync } from './getBestSimulator';\nimport type { 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":["promptAppleDeviceAsync","sortDefaultDeviceToBeginningAsync","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":";;;;;;;;;;;QA4BsBA;eAAAA;;QAhBAC;eAAAA;;;;gEAZJ;;;;;;kCAEoB;yBAEa;;;;;;AAQ5C,eAAeA,kCACpBC,OAAY,EACZC,MAAyB;IAEzB,MAAMC,YAAY,MAAMC,IAAAA,uCAAqB,EAAC;QAAEF;IAAO;IACvD,IAAIC,WAAW;YAENF;QADP,IAAII,aAAa;QACjB,MAAOJ,EAAAA,YAAAA,OAAO,CAAC,EAAE,qBAAVA,UAAYK,IAAI,MAAKH,aAAaE,aAAaJ,QAAQM,MAAM,CAAE;YACpEN,QAAQO,IAAI,CAACP,QAAQQ,KAAK;YAC1BJ;QACF;IACF;IACA,OAAOJ;AACT;AAGO,eAAeF,uBACpBE,OAAiB,EACjBC,MAAyB;IAEzBD,UAAU,MAAMD,kCAAkCC,SAASC;IAC3D,MAAMQ,UAAU,MAAMC,+BAA+BV;IACrD,OAAOA,QAAQW,IAAI,CAAC,CAAC,EAAEN,IAAI,EAAE,GAAKI,YAAYJ;AAChD;AAEA,eAAeK,+BAA+BV,OAAiB;IAC7D,6DAA6D;IAC7D,8CAA8C;IAE9C,MAAM,EAAEY,KAAK,EAAE,GAAG,MAAMC,IAAAA,oBAAW,EAAC;QAClCC,MAAM;QACNC,MAAM;QACNC,OAAO;QACPC,SAAS;QACTC,SAASlB,QAAQmB,GAAG,CAAC,CAACC;YACpB,MAAMC,WAAWD,KAAKE,KAAK,KAAK;YAChC,MAAMC,SAASF,WAAWG,gBAAK,CAACC,IAAI,GAAG,CAACC,OAAiBA;YACzD,OAAO;gBACLC,OAAO,GAAGJ,OAAOH,KAAKL,IAAI,EAAE,CAAC,EAAES,gBAAK,CAACI,GAAG,CAAC,CAAC,CAAC,EAAER,KAAKS,SAAS,CAAC,CAAC,CAAC,GAAG;gBACjEjB,OAAOQ,KAAKf,IAAI;YAClB;QACF;QACAyB,SAASC,IAAAA,8BAAqB;IAChC;IAEA,OAAOnB;AACT"}
|
|
@@ -5,47 +5,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
bootAsync
|
|
12
|
+
get bootAsync () {
|
|
13
13
|
return bootAsync;
|
|
14
14
|
},
|
|
15
|
-
bootDeviceAsync
|
|
15
|
+
get bootDeviceAsync () {
|
|
16
16
|
return bootDeviceAsync;
|
|
17
17
|
},
|
|
18
|
-
getBootedSimulatorsAsync
|
|
18
|
+
get getBootedSimulatorsAsync () {
|
|
19
19
|
return getBootedSimulatorsAsync;
|
|
20
20
|
},
|
|
21
|
-
getContainerPathAsync
|
|
21
|
+
get getContainerPathAsync () {
|
|
22
22
|
return getContainerPathAsync;
|
|
23
23
|
},
|
|
24
|
-
getDevicesAsync
|
|
24
|
+
get getDevicesAsync () {
|
|
25
25
|
return getDevicesAsync;
|
|
26
26
|
},
|
|
27
|
-
getInfoPlistValueAsync
|
|
27
|
+
get getInfoPlistValueAsync () {
|
|
28
28
|
return getInfoPlistValueAsync;
|
|
29
29
|
},
|
|
30
|
-
installAsync
|
|
30
|
+
get installAsync () {
|
|
31
31
|
return installAsync;
|
|
32
32
|
},
|
|
33
|
-
isDeviceBootedAsync
|
|
33
|
+
get isDeviceBootedAsync () {
|
|
34
34
|
return isDeviceBootedAsync;
|
|
35
35
|
},
|
|
36
|
-
isOSType
|
|
36
|
+
get isOSType () {
|
|
37
37
|
return isOSType;
|
|
38
38
|
},
|
|
39
|
-
openAppIdAsync
|
|
39
|
+
get openAppIdAsync () {
|
|
40
40
|
return openAppIdAsync;
|
|
41
41
|
},
|
|
42
|
-
openUrlAsync
|
|
42
|
+
get openUrlAsync () {
|
|
43
43
|
return openUrlAsync;
|
|
44
44
|
},
|
|
45
|
-
simctlAsync
|
|
45
|
+
get simctlAsync () {
|
|
46
46
|
return simctlAsync;
|
|
47
47
|
},
|
|
48
|
-
uninstallAsync
|
|
48
|
+
get uninstallAsync () {
|
|
49
49
|
return uninstallAsync;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
@@ -88,6 +88,7 @@ const _xcrun = require("./xcrun");
|
|
|
88
88
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../../log"));
|
|
89
89
|
const _errors = require("../../../utils/errors");
|
|
90
90
|
const _fn = require("../../../utils/fn");
|
|
91
|
+
const _link = require("../../../utils/link");
|
|
91
92
|
const _plist = require("../../../utils/plist");
|
|
92
93
|
const _profile = require("../../../utils/profile");
|
|
93
94
|
function _interop_require_default(obj) {
|
|
@@ -305,6 +306,9 @@ async function bootDeviceAsync(device) {
|
|
|
305
306
|
} catch (error) {
|
|
306
307
|
var _error_stderr;
|
|
307
308
|
if (!((_error_stderr = error.stderr) == null ? void 0 : _error_stderr.match(/Unable to boot device in current state: Booted/))) {
|
|
309
|
+
error.message += `\n${(0, _link.learnMore)('https://docs.expo.dev/workflow/ios-simulator/#troubleshooting', {
|
|
310
|
+
learnMoreMessage: 'Troubleshooting guide'
|
|
311
|
+
})}`;
|
|
308
312
|
throw error;
|
|
309
313
|
}
|
|
310
314
|
}
|
|
@@ -351,11 +355,13 @@ function parseSimControlJSONResults(input) {
|
|
|
351
355
|
// Join the end components [13, 4] -> '13.4'
|
|
352
356
|
const osVersion = osVersionComponents.join('.');
|
|
353
357
|
const sims = info.devices[runtime];
|
|
354
|
-
|
|
355
|
-
device
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
358
|
+
if (sims) {
|
|
359
|
+
for (const device of sims){
|
|
360
|
+
device.runtime = runtime;
|
|
361
|
+
device.osVersion = osVersion;
|
|
362
|
+
device.windowName = `${device.name} (${osVersion})`;
|
|
363
|
+
device.osType = osType;
|
|
364
|
+
}
|
|
359
365
|
}
|
|
360
366
|
}
|
|
361
367
|
return info;
|