@depup/expo__cli 55.0.22-depup.1 → 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 -18
- 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 +50 -7
- 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 +58 -24
- 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 +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 +40 -30
- 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 +16 -9
- 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 +14 -9
- 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 +245 -114
- 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 +39 -0
- 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 +30 -17
- 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 +19 -47
- 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/filePath.js +3 -29
- package/build/src/utils/filePath.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 +16 -36
- package/main.js +3 -0
- package/package.json +86 -90
- 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/resolveGlobal.js +0 -195
- package/build/src/utils/resolveGlobal.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'pm',\n 'list',\n 'packages',\n '--user',\n env.EXPO_ADB_USER,\n androidPackage\n )\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n * @param props.url Optional (dev client) URL to launch\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n url,\n }: {\n launchActivity: string;\n url?: string;\n }\n) {\n const args: string[] = [\n 'shell',\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity,\n ];\n\n if (url) {\n args.push('-d', url);\n }\n\n return openAsync(adbArgs(device.pid, ...args));\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'am',\n 'start',\n '-a',\n 'android.intent.action.VIEW',\n '-d',\n // ADB requires ampersands to be escaped.\n url.replace(/&/g, String.raw`\\&`)\n )\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbArgs(device.pid, 'shell', 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE].match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n // @ts-ignore\n const propCommand = adbArgs(...[device.pid, 'shell', 'getprop', prop].filter(Boolean));\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]] = match[2];\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["DeviceABI","adbArgs","getAdbNameForDeviceIdAsync","getAttachedDevicesAsync","getDeviceABIsAsync","getPackageInfoAsync","getPropertyDataForDeviceAsync","getServer","installAsync","isBootAnimationCompleteAsync","isDeviceBootedAsync","isPackageInstalledAsync","launchActivityAsync","logUnauthorized","openUrlAsync","sanitizeAdbDeviceName","uninstallAsync","debug","require","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","url","args","push","openAsync","replace","String","raw","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","concat","output","splitItems","os","EOL","filter","attachedDevices","slice","map","props","Boolean","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":";;;;;;;;;;;IAWYA,SAAS;eAATA;;IA+LIC,OAAO;eAAPA;;IAmGMC,0BAA0B;eAA1BA;;IAzFAC,uBAAuB;eAAvBA;;IAgIAC,kBAAkB;eAAlBA;;IA1JAC,mBAAmB;eAAnBA;;IA2KAC,6BAA6B;eAA7BA;;IAzSNC,SAAS;eAATA;;IAsIMC,YAAY;eAAZA;;IAwIAC,4BAA4B;eAA5BA;;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DAAgD;QAChD,MAAM,IAAInC,oBAAY,CAAC,CAAC,qCAAqC,EAAE/B,OAAOW,GAAG,CAAC,GAAG,EAAEuD,MAAMC,OAAO,EAAE;IAChG;AACF;AAEA,SAASF,yBAAyBG,sBAA8B;IAC9D,MAAMC,aAA+B,CAAC;IACtC,MAAMC,cAAc;IACpB,KAAK,MAAMxC,SAASsC,uBAAuBG,QAAQ,CAACD,aAAc;QAChED,UAAU,CAACvC,KAAK,CAAC,EAAE,CAAC,GAAGA,KAAK,CAAC,EAAE;IACjC;IACA,OAAOuC;AACT;AAMO,SAAS/E,sBAAsBkF,UAAkB;IACtD,OAAOA,WACJrD,IAAI,GACJJ,KAAK,CAAC,WACN0D,KAAK;AACV"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbShellArgs(device.pid, 'pm', 'list', 'packages', '--user', env.EXPO_ADB_USER, androidPackage)\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!.trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n * @param props.url Optional (dev client) URL to launch\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n url,\n }: {\n launchActivity: string;\n url?: string;\n }\n) {\n const command: string[] = [\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity,\n ];\n\n if (url) {\n command.push('-d', url);\n }\n\n return openAsync(adbShellArgs(device.pid, ...command));\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbShellArgs(device.pid, 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', url)\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbShellArgs(device.pid, 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n/**\n * `adb shell` concatenates trailing args and runs the result through `sh -c` on\n * the device, so unquoted metacharacters in tainted tokens execute on-device.\n */\nexport function adbShellArgs(pid: Device['pid'], ...command: string[]): string[] {\n return adbArgs(pid, 'shell', ...command.map(shellQuote));\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE]?.match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n const propCommand = prop\n ? adbShellArgs(device.pid, 'getprop', prop)\n : adbShellArgs(device.pid, 'getprop');\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]!] = match[2]!;\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["DeviceABI","adbArgs","adbShellArgs","getAdbNameForDeviceIdAsync","getAttachedDevicesAsync","getDeviceABIsAsync","getPackageInfoAsync","getPropertyDataForDeviceAsync","getServer","installAsync","isBootAnimationCompleteAsync","isDeviceBootedAsync","isPackageInstalledAsync","launchActivityAsync","logUnauthorized","openUrlAsync","sanitizeAdbDeviceName","uninstallAsync","debug","require","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","url","command","push","openAsync","args","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","concat","map","shellQuote","value","replace","output","splitItems","os","EOL","filter","attachedDevices","slice","props","Boolean","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":";;;;;;;;;;;QAWYA;eAAAA;;QA2KIC;eAAAA;;QAaAC;eAAAA;;QAkGMC;eAAAA;;QAzFAC;eAAAA;;QAgIAC;eAAAA;;QAtKAC;eAAAA;;QAuLAC;eAAAA;;QAjSNC;eAAAA;;QAkHMC;eAAAA;;QAoJAC;eAAAA;;QAlBAC;eAAAA;;QArOAC;eAAAA;;QAuBAC;eAAAA;;QAhCNC;eAAAA;;QAgEMC;eAAAA;;QAuQNC;eAAAA;;QA7OMC;eAAAA;;;;gEA5JJ;;;;;;;gEACH;;;;;;2BAEW;6DACL;qBACD;wBACS;sBACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,IAAA,AAAKnB,mCAAAA;IACV,kEAAkE;IAClE,mEAAmE;IACnE,qEAAqE;IACrE,qBAAqB;;;;;;;;;;WAJXA;;AAoCZ,MAAMoB,4BAA4B;AAClC,oDAAoD;AACpD,MAAMC,gBAAgB;AAEtB,MAAMC,yBAAyB;AAE/B,wBAAwB;AACxB,oDAAoD;AACpD,MAAMC,4BAA4B;AAElC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D,OAAOA,WACJtD,IAAI,GACJJ,KAAK,CAAC,WACN2D,KAAK;AACV"}
|
|
@@ -5,17 +5,17 @@ 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
|
-
hasAdbReverseAsync
|
|
12
|
+
get hasAdbReverseAsync () {
|
|
13
13
|
return hasAdbReverseAsync;
|
|
14
14
|
},
|
|
15
|
-
startAdbReverseAsync
|
|
15
|
+
get startAdbReverseAsync () {
|
|
16
16
|
return startAdbReverseAsync;
|
|
17
17
|
},
|
|
18
|
-
stopAdbReverseAsync
|
|
18
|
+
get stopAdbReverseAsync () {
|
|
19
19
|
return stopAdbReverseAsync;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/adbReverse.ts"],"sourcesContent":["import { assertSdkRoot } from './AndroidSdk';\nimport { adbArgs,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/adbReverse.ts"],"sourcesContent":["import { assertSdkRoot } from './AndroidSdk';\nimport type { Device } from './adb';\nimport { adbArgs, getAttachedDevicesAsync, getServer, logUnauthorized } from './adb';\nimport * as Log from '../../../log';\nimport { installExitHooks } from '../../../utils/exit';\n\nconst debug = require('debug')('expo:start:platforms:android:adbReverse') as typeof console.log;\n\nlet removeExitHook: (() => void) | null = null;\n\nexport function hasAdbReverseAsync(): boolean {\n try {\n return !!assertSdkRoot();\n } catch (error: any) {\n debug('Failed to resolve the Android SDK path, skipping ADB: %s', error.message);\n return false;\n }\n}\n\nexport async function startAdbReverseAsync(ports: number[]): Promise<boolean> {\n // Install cleanup automatically...\n removeExitHook = installExitHooks(() => {\n stopAdbReverseAsync(ports);\n });\n\n const devices = await getAttachedDevicesAsync();\n for (const device of devices) {\n for (const port of ports) {\n if (!(await adbReverseAsync(device, port))) {\n debug(`Failed to start reverse port ${port} on device \"${device.name}\"`);\n return false;\n }\n }\n }\n return true;\n}\n\nexport async function stopAdbReverseAsync(ports: number[]): Promise<void> {\n removeExitHook?.();\n\n const devices = await getAttachedDevicesAsync();\n for (const device of devices) {\n for (const port of ports) {\n await adbReverseRemoveAsync(device, port);\n }\n }\n}\n\nasync function adbReverseAsync(device: Device, port: number): Promise<boolean> {\n if (!device.isAuthorized) {\n logUnauthorized(device);\n return false;\n }\n\n try {\n await getServer().runAsync(adbArgs(device.pid, 'reverse', `tcp:${port}`, `tcp:${port}`));\n return true;\n } catch (error: any) {\n Log.warn(`[ADB] Couldn't reverse port ${port}: ${error.message}`);\n return false;\n }\n}\n\nasync function adbReverseRemoveAsync(device: Device, port: number): Promise<boolean> {\n if (!device.isAuthorized) {\n return false;\n }\n\n try {\n await getServer().runAsync(adbArgs(device.pid, 'reverse', '--remove', `tcp:${port}`));\n return true;\n } catch (error: any) {\n // Don't send this to warn because we call this preemptively sometimes\n debug(`Could not unforward port ${port}: ${error.message}`);\n return false;\n }\n}\n"],"names":["hasAdbReverseAsync","startAdbReverseAsync","stopAdbReverseAsync","debug","require","removeExitHook","assertSdkRoot","error","message","ports","installExitHooks","devices","getAttachedDevicesAsync","device","port","adbReverseAsync","name","adbReverseRemoveAsync","isAuthorized","logUnauthorized","getServer","runAsync","adbArgs","pid","Log","warn"],"mappings":";;;;;;;;;;;QAUgBA;eAAAA;;QASMC;eAAAA;;QAkBAC;eAAAA;;;4BArCQ;qBAE+C;6DACxD;sBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,IAAIC,iBAAsC;AAEnC,SAASL;IACd,IAAI;QACF,OAAO,CAAC,CAACM,IAAAA,yBAAa;IACxB,EAAE,OAAOC,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QAAQ,CAACC,IAAAA,YAAO,EAACT,OAAOU,GAAG,EAAE,WAAW,YAAY,CAAC,IAAI,EAAET,MAAM;QACnF,OAAO;IACT,EAAE,OAAOP,OAAY;QACnB,sEAAsE;QACtEJ,MAAM,CAAC,yBAAyB,EAAEW,KAAK,EAAE,EAAEP,MAAMC,OAAO,EAAE;QAC1D,OAAO;IACT;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
|
-
EMULATOR_MAX_WAIT_TIMEOUT
|
|
12
|
+
get EMULATOR_MAX_WAIT_TIMEOUT () {
|
|
13
13
|
return EMULATOR_MAX_WAIT_TIMEOUT;
|
|
14
14
|
},
|
|
15
|
-
listAvdsAsync
|
|
15
|
+
get listAvdsAsync () {
|
|
16
16
|
return listAvdsAsync;
|
|
17
17
|
},
|
|
18
|
-
startDeviceAsync
|
|
18
|
+
get startDeviceAsync () {
|
|
19
19
|
return startDeviceAsync;
|
|
20
20
|
},
|
|
21
|
-
whichEmulator
|
|
21
|
+
get whichEmulator () {
|
|
22
22
|
return whichEmulator;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/emulator.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn } from 'child_process';\nimport os from 'os';\n\nimport { Device
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/emulator.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn } from 'child_process';\nimport os from 'os';\n\nimport type { Device } from './adb';\nimport { getAttachedDevicesAsync, isBootAnimationCompleteAsync } from './adb';\nimport * as Log from '../../../log';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\n\nexport const EMULATOR_MAX_WAIT_TIMEOUT = 60 * 1000 * 3;\n\nexport function whichEmulator(): string {\n // https://developer.android.com/studio/command-line/variables\n // TODO: Add ANDROID_SDK_ROOT support as well https://github.com/expo/expo/pull/16516#discussion_r820037917\n if (process.env.ANDROID_HOME) {\n return `${process.env.ANDROID_HOME}/emulator/emulator`;\n }\n return 'emulator';\n}\n\n/** Returns a list of emulator names. */\nexport async function listAvdsAsync(): Promise<Device[]> {\n try {\n const { stdout } = await spawnAsync(whichEmulator(), ['-list-avds']);\n return (\n stdout\n .split(os.EOL)\n .filter(Boolean)\n /**\n * AVD IDs cannot contain spaces. This removes extra info lines from the output. e.g.\n * \"INFO | Storing crashdata in: /tmp/android-brent/emu-crash-34.1.18.db\n */\n .filter((name) => !name.trim().includes(' '))\n .map((name) => ({\n name,\n type: 'emulator',\n // unsure from this\n isBooted: false,\n isAuthorized: true,\n }))\n );\n } catch {\n return [];\n }\n}\n\n/** Start an Android device and wait until it is booted. */\nexport async function startDeviceAsync(\n device: Pick<Device, 'name'>,\n {\n timeout = EMULATOR_MAX_WAIT_TIMEOUT,\n interval = 1000,\n }: {\n /** Time in milliseconds to wait before asserting a timeout error. */\n timeout?: number;\n interval?: number;\n } = {}\n): Promise<Device> {\n Log.log(`\\u203A Opening emulator ${chalk.bold(device.name)}`);\n\n // Start a process to open an emulator\n const emulatorProcess = spawn(\n whichEmulator(),\n [\n `@${device.name}`,\n // disable animation for faster boot -- this might make it harder to detect if it mounted properly tho\n //'-no-boot-anim'\n ],\n {\n stdio: 'ignore',\n detached: true,\n }\n );\n\n emulatorProcess.unref();\n\n return new Promise<Device>((resolve, reject) => {\n const waitTimer = setInterval(async () => {\n try {\n const bootedDevices = await getAttachedDevicesAsync();\n const connected = bootedDevices.find(({ name }) => name === device.name);\n if (connected) {\n const isBooted = await isBootAnimationCompleteAsync(connected.pid);\n if (isBooted) {\n stopWaiting();\n resolve(connected);\n }\n }\n } catch (error) {\n stopWaiting();\n reject(error);\n }\n }, interval);\n\n // Reject command after timeout\n const maxTimer = setTimeout(() => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `It took too long to start the Android emulator: ${device.name}. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n }, timeout);\n\n const stopWaiting = () => {\n clearTimeout(maxTimer);\n clearInterval(waitTimer);\n removeExitHook();\n };\n\n const stopWaitingAndReject = (message: string) => {\n stopWaiting();\n reject(new Error(message));\n };\n\n const removeExitHook = installExitHooks((signal) => {\n stopWaiting();\n emulatorProcess.kill(signal);\n reject(new AbortCommandError());\n });\n\n emulatorProcess.on('error', ({ message }) => stopWaitingAndReject(message));\n\n emulatorProcess.on('exit', () => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `The emulator (${device.name}) quit before it finished opening. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n });\n });\n}\n"],"names":["EMULATOR_MAX_WAIT_TIMEOUT","listAvdsAsync","startDeviceAsync","whichEmulator","process","env","ANDROID_HOME","stdout","spawnAsync","split","os","EOL","filter","Boolean","name","trim","includes","map","type","isBooted","isAuthorized","device","timeout","interval","Log","log","chalk","bold","emulatorProcess","spawn","stdio","detached","unref","Promise","resolve","reject","waitTimer","setInterval","bootedDevices","getAttachedDevicesAsync","connected","find","isBootAnimationCompleteAsync","pid","stopWaiting","error","maxTimer","setTimeout","manualCommand","stopWaitingAndReject","clearTimeout","clearInterval","removeExitHook","message","Error","installExitHooks","signal","kill","AbortCommandError","on"],"mappings":";;;;;;;;;;;QAWaA;eAAAA;;QAYSC;eAAAA;;QA0BAC;eAAAA;;QApCNC;eAAAA;;;;gEAbO;;;;;;;gEACL;;;;;;;yBACI;;;;;;;gEACP;;;;;;qBAGuD;6DACjD;wBACa;sBACD;;;;;;;;;;;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AE,GAAKA,SAASO,OAAOP,IAAI;gBACvE,IAAI0B,WAAW;oBACb,MAAMrB,WAAW,MAAMuB,IAAAA,iCAA4B,EAACF,UAAUG,GAAG;oBACjE,IAAIxB,UAAU;wBACZyB;wBACAV,QAAQM;oBACV;gBACF;YACF,EAAE,OAAOK,OAAO;gBACdD;gBACAT,OAAOU;YACT;QACF,GAAGtB;QAEH,+BAA+B;QAC/B,MAAMuB,WAAWC,WAAW;YAC1B,MAAMC,gBAAgB,GAAG7C,gBAAgB,EAAE,EAAEkB,OAAOP,IAAI,EAAE;YAC1DmC,qBACE,CAAC,gDAAgD,EAAE5B,OAAOP,IAAI,CAAC,qEAAqE,EAAEkC,eAAe;QAEzJ,GAAG1B;QAEH,MAAMsB,cAAc;YAClBM,aAAaJ;YACbK,cAAcf;YACdgB;QACF;QAEA,MAAMH,uBAAuB,CAACI;YAC5BT;YACAT,OAAO,IAAImB,MAAMD;QACnB;QAEA,MAAMD,iBAAiBG,IAAAA,sBAAgB,EAAC,CAACC;YACvCZ;YACAhB,gBAAgB6B,IAAI,CAACD;YACrBrB,OAAO,IAAIuB,yBAAiB;QAC9B;QAEA9B,gBAAgB+B,EAAE,CAAC,SAAS,CAAC,EAAEN,OAAO,EAAE,GAAKJ,qBAAqBI;QAElEzB,gBAAgB+B,EAAE,CAAC,QAAQ;YACzB,MAAMX,gBAAgB,GAAG7C,gBAAgB,EAAE,EAAEkB,OAAOP,IAAI,EAAE;YAC1DmC,qBACE,CAAC,cAAc,EAAE5B,OAAOP,IAAI,CAAC,sGAAsG,EAAEkC,eAAe;QAExJ;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/getDevices.ts"],"sourcesContent":["import { Device
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/getDevices.ts"],"sourcesContent":["import type { Device } from './adb';\nimport { getAttachedDevicesAsync } from './adb';\nimport { listAvdsAsync } from './emulator';\nimport { CommandError } from '../../../utils/errors';\n\n/** Get a list of all devices including offline emulators. Asserts if no devices are available. */\nexport async function getDevicesAsync(): Promise<Device[]> {\n const bootedDevices = await getAttachedDevicesAsync();\n\n const data = await listAvdsAsync();\n const connectedNames = bootedDevices.map(({ name }) => name);\n\n const offlineEmulators = data\n .filter(({ name }) => !connectedNames.includes(name))\n .map(({ name, type }) => {\n return {\n name,\n type,\n isBooted: false,\n // TODO: Are emulators always authorized?\n isAuthorized: true,\n };\n });\n\n const allDevices = bootedDevices.concat(offlineEmulators);\n\n if (!allDevices.length) {\n throw new CommandError(\n [\n `No Android connected device found, and no emulators could be started automatically.`,\n `Connect a device or create an emulator (https://docs.expo.dev/workflow/android-studio-emulator).`,\n `Then follow the instructions here to enable USB debugging:`,\n `https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select \"Use custom Android SDK tools\", and point it at your Android SDK directory.`,\n ].join('\\n')\n );\n }\n\n return allDevices;\n}\n"],"names":["getDevicesAsync","bootedDevices","getAttachedDevicesAsync","data","listAvdsAsync","connectedNames","map","name","offlineEmulators","filter","includes","type","isBooted","isAuthorized","allDevices","concat","length","CommandError","join"],"mappings":";;;;+BAMsBA;;;eAAAA;;;qBALkB;0BACV;wBACD;AAGtB,eAAeA;IACpB,MAAMC,gBAAgB,MAAMC,IAAAA,4BAAuB;IAEnD,MAAMC,OAAO,MAAMC,IAAAA,uBAAa;IAChC,MAAMC,iBAAiBJ,cAAcK,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IAEvD,MAAMC,mBAAmBL,KACtBM,MAAM,CAAC,CAAC,EAAEF,IAAI,EAAE,GAAK,CAACF,eAAeK,QAAQ,CAACH,OAC9CD,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAEI,IAAI,EAAE;QAClB,OAAO;YACLJ;YACAI;YACAC,UAAU;YACV,yCAAyC;YACzCC,cAAc;QAChB;IACF;IAEF,MAAMC,aAAab,cAAcc,MAAM,CAACP;IAExC,IAAI,CAACM,WAAWE,MAAM,EAAE;QACtB,MAAM,IAAIC,oBAAY,CACpB;YACE,CAAC,mFAAmF,CAAC;YACrF,CAAC,gGAAgG,CAAC;YAClG,CAAC,0DAA0D,CAAC;YAC5D,CAAC,oNAAoN,CAAC;SACvN,CAACC,IAAI,CAAC;IAEX;IAEA,OAAOJ;AACT"}
|
|
@@ -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
|
-
assembleAsync
|
|
12
|
+
get assembleAsync () {
|
|
13
13
|
return assembleAsync;
|
|
14
14
|
},
|
|
15
|
-
formatGradleArguments
|
|
15
|
+
get formatGradleArguments () {
|
|
16
16
|
return formatGradleArguments;
|
|
17
17
|
},
|
|
18
|
-
installAsync
|
|
18
|
+
get installAsync () {
|
|
19
19
|
return installAsync;
|
|
20
20
|
},
|
|
21
|
-
spawnGradleAsync
|
|
21
|
+
get spawnGradleAsync () {
|
|
22
22
|
return spawnGradleAsync;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/gradle.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/gradle.ts"],"sourcesContent":["import type { SpawnResult } from '@expo/spawn-async';\nimport spawnAsync from '@expo/spawn-async';\nimport path from 'path';\n\nimport { env } from '../../../utils/env';\nimport { AbortCommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:platforms:android:gradle') as typeof console.log;\n\nfunction upperFirst(name: string) {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}\n\n/** Format gradle assemble arguments. Exposed for testing. */\nexport function formatGradleArguments(\n cmd: 'assemble' | 'install',\n {\n appName,\n variant,\n tasks = [cmd + upperFirst(variant)],\n }: { tasks?: string[]; variant: string; appName: string }\n): string[] {\n return appName ? tasks.map((task) => `${appName}:${task}`) : tasks;\n}\n\nfunction resolveGradleWPath(androidProjectPath: string): string {\n return path.join(androidProjectPath, process.platform === 'win32' ? 'gradlew.bat' : 'gradlew');\n}\n\nfunction getPortArg(port: number): string {\n return `-PreactNativeDevServerPort=${port}`;\n}\n\nfunction getActiveArchArg(architectures: string): string {\n return `-PreactNativeArchitectures=${architectures}`;\n}\n\n/**\n * Build the Android project using Gradle.\n *\n * @param androidProjectPath - Path to the Android project like `projectRoot/android`.\n * @param props.variant - Variant to install.\n * @param props.appName - Name of the 'app' folder, this appears to always be `app`.\n * @param props.port - Dev server port to pass to the install command.\n * @param props.buildCache - Should use the `--build-cache` flag, enabling the [Gradle build cache](https://docs.gradle.org/current/userguide/build_cache.html).\n * @param props.architectures - Architectures to build for.\n * @returns - A promise resolving to spawn results.\n */\nexport async function assembleAsync(\n androidProjectPath: string,\n {\n variant,\n port,\n appName,\n buildCache,\n architectures,\n eagerBundleOptions,\n }: {\n variant: string;\n port?: number;\n appName: string;\n buildCache?: boolean;\n architectures?: string;\n eagerBundleOptions?: string;\n }\n): Promise<SpawnResult> {\n const task = formatGradleArguments('assemble', { variant, appName });\n const args = [\n ...task,\n // ignore linting errors\n '-x',\n 'lint',\n // ignore tests\n '-x',\n 'test',\n '--configure-on-demand',\n ];\n\n if (buildCache) args.push('--build-cache');\n\n // Generate a profile under `/android/app/build/reports/profile`\n if (env.EXPO_PROFILE) args.push('--profile');\n\n return await spawnGradleAsync(androidProjectPath, {\n port,\n architectures,\n args,\n env: eagerBundleOptions\n ? {\n __EXPO_EAGER_BUNDLE_OPTIONS: eagerBundleOptions,\n }\n : {},\n });\n}\n\n/**\n * Install an app on device or emulator using `gradlew install`.\n *\n * @param androidProjectPath - Path to the Android project like `projectRoot/android`.\n * @param props.variant - Variant to install.\n * @param props.appName - Name of the 'app' folder, this appears to always be `app`.\n * @param props.port - Dev server port to pass to the install command.\n * @returns - A promise resolving to spawn results.\n */\nexport async function installAsync(\n androidProjectPath: string,\n {\n variant,\n appName,\n port,\n }: {\n variant: string;\n appName: string;\n port?: number;\n }\n): Promise<SpawnResult> {\n const args = formatGradleArguments('install', { variant, appName });\n return await spawnGradleAsync(androidProjectPath, { port, args });\n}\n\nexport async function spawnGradleAsync(\n projectRoot: string,\n {\n port,\n architectures,\n args,\n env,\n }: { port?: number; architectures?: string; args: string[]; env?: Record<string, string> }\n): Promise<SpawnResult> {\n const gradlew = resolveGradleWPath(projectRoot);\n if (port != null) args.push(getPortArg(port));\n if (architectures) args.push(getActiveArchArg(architectures));\n debug(` ${gradlew} ${args.join(' ')}`);\n try {\n return await spawnAsync(gradlew, args, {\n cwd: projectRoot,\n stdio: 'inherit',\n env: {\n ...process.env,\n ...(env ?? {}),\n },\n });\n } catch (error: any) {\n // User aborted the command with ctrl-c\n if (error.status === 130) {\n // Fail silently\n throw new AbortCommandError();\n }\n throw error;\n }\n}\n"],"names":["assembleAsync","formatGradleArguments","installAsync","spawnGradleAsync","debug","require","upperFirst","name","charAt","toUpperCase","slice","cmd","appName","variant","tasks","map","task","resolveGradleWPath","androidProjectPath","path","join","process","platform","getPortArg","port","getActiveArchArg","architectures","buildCache","eagerBundleOptions","args","push","env","EXPO_PROFILE","__EXPO_EAGER_BUNDLE_OPTIONS","projectRoot","gradlew","spawnAsync","cwd","stdio","error","status","AbortCommandError"],"mappings":";;;;;;;;;;;QAgDsBA;eAAAA;;QAlCNC;eAAAA;;QA0FMC;eAAAA;;QAgBAC;eAAAA;;;;gEAvHC;;;;;;;gEACN;;;;;;qBAEG;wBACc;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,WAAWC,IAAY;IAC9B,OAAOA,KAAKC,MAAM,CAAC,GAAGC,WAAW,KAAKF,KAAKG,KAAK,CAAC;AACnD;AAGO,SAAST,s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G,EACqF;IAE1F,MAAMI,UAAUlB,mBAAmBiB;IACnC,IAAIV,QAAQ,MAAMK,KAAKC,IAAI,CAACP,WAAWC;IACvC,IAAIE,eAAeG,KAAKC,IAAI,CAACL,iBAAiBC;IAC9CtB,MAAM,CAAC,EAAE,EAAE+B,QAAQ,CAAC,EAAEN,KAAKT,IAAI,CAAC,MAAM;IACtC,IAAI;QACF,OAAO,MAAMgB,IAAAA,qBAAU,EAACD,SAASN,MAAM;YACrCQ,KAAKH;YACLI,OAAO;YACPP,KAAK;gBACH,GAAGV,QAAQU,GAAG;gBACd,GAAIA,OAAO,CAAC,CAAC;YACf;QACF;IACF,EAAE,OAAOQ,OAAY;QACnB,uCAAuC;QACvC,IAAIA,MAAMC,MAAM,KAAK,KAAK;YACxB,gBAAgB;YAChB,MAAM,IAAIC,yBAAiB;QAC7B;QACA,MAAMF;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
|
-
formatDeviceChoice
|
|
12
|
+
get formatDeviceChoice () {
|
|
13
13
|
return formatDeviceChoice;
|
|
14
14
|
},
|
|
15
|
-
promptForDeviceAsync
|
|
15
|
+
get promptForDeviceAsync () {
|
|
16
16
|
return promptForDeviceAsync;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { Device
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport type { Device } from './adb';\nimport { logUnauthorized } from './adb';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\nexport async function promptForDeviceAsync(devices: Device[]): Promise<Device> {\n // TODO: provide an option to add or download more simulators\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device/emulator',\n choices: devices.map((item) => formatDeviceChoice(item)),\n suggest: createSelectionFilter(),\n });\n\n const device = devices.find(({ name }) => name === value);\n\n if (device?.isAuthorized === false) {\n logUnauthorized(device);\n throw new AbortCommandError();\n }\n\n return device!;\n}\n\n/**\n * Format the device for prompt list.\n * @internal - Exposed for testing.\n */\nexport function formatDeviceChoice(device: Device): { title: string; value: string } {\n const symbol = getDeviceChoiceSymbol(device);\n const name = getDeviceChoiceName(device);\n const type = chalk.dim(device.isAuthorized ? device.type : 'unauthorized');\n\n return {\n value: device.name,\n title: `${symbol}${name} (${type})`,\n };\n}\n\n/** Get the styled symbol of the device, based on ADB connection type (usb vs network) */\nfunction getDeviceChoiceSymbol(device: Device) {\n if (device.type === 'device' && device.connectionType === 'Network') {\n return '🌐 ';\n }\n\n if (device.type === 'device') {\n return '🔌 ';\n }\n\n return '';\n}\n\n/** Get the styled name of the device, based on device state */\nfunction getDeviceChoiceName(device: Device) {\n // Use no style changes for a disconnected device that is available to be opened.\n if (!device.isBooted) {\n return device.name;\n }\n\n // A device that is connected and ready to be used should be bolded to match iOS.\n if (device.isAuthorized) {\n return chalk.bold(device.name);\n }\n\n // Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.\n return chalk.bold(chalk.gray(device.name));\n}\n"],"names":["formatDeviceChoice","promptForDeviceAsync","devices","value","promptAsync","type","name","limit","message","choices","map","item","suggest","createSelectionFilter","device","find","isAuthorized","logUnauthorized","AbortCommandError","symbol","getDeviceChoiceSymbol","getDeviceChoiceName","chalk","dim","title","connectionType","isBooted","bold","gray"],"mappings":";;;;;;;;;;;QAiCgBA;eAAAA;;QA1BMC;eAAAA;;;;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AEA,uGAAuG;IACvG,OAAOgB,gBAAK,CAACK,IAAI,CAACL,gBAAK,CAACM,IAAI,CAACd,OAAOR,IAAI;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/AppleAppIdResolver.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport fs from 'fs';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleAppIdResolver') as typeof console.log;\n\n/** Resolves the iOS bundle identifier from the Expo config or native files. */\nexport class AppleAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'ios', 'ios.bundleIdentifier');\n }\n\n /** @return `true` if the app has valid `*.pbxproj` file */\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n // Never returns nullish values.\n return !!IOSConfig.Paths.getAllPBXProjectPaths(this.projectRoot).length;\n } catch (error: any) {\n debug('Expected error checking for native project:', error.message);\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n // Check xcode project\n try {\n const bundleId = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(this.projectRoot);\n if (bundleId) {\n return bundleId;\n }\n } catch (error: any) {\n debug('Expected error resolving the bundle identifier from the pbxproj:', error);\n }\n\n // Check Info.plist\n try {\n const infoPlistPath = IOSConfig.Paths.getInfoPlistPath(this.projectRoot);\n const data = await plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));\n if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith('$(')) {\n return data.CFBundleIdentifier;\n }\n } catch (error) {\n debug('Expected error resolving the bundle identifier from the project Info.plist:', error);\n }\n\n return null;\n }\n}\n"],"names":["AppleAppIdResolver","debug","require","AppIdResolver","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/AppleAppIdResolver.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport fs from 'fs';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleAppIdResolver') as typeof console.log;\n\n/** Resolves the iOS bundle identifier from the Expo config or native files. */\nexport class AppleAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'ios', 'ios.bundleIdentifier');\n }\n\n /** @return `true` if the app has valid `*.pbxproj` file */\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n // Never returns nullish values.\n return !!IOSConfig.Paths.getAllPBXProjectPaths(this.projectRoot).length;\n } catch (error: any) {\n debug('Expected error checking for native project:', error.message);\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n // Check xcode project\n try {\n const bundleId = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(this.projectRoot);\n if (bundleId) {\n return bundleId;\n }\n } catch (error: any) {\n debug('Expected error resolving the bundle identifier from the pbxproj:', error);\n }\n\n // Check Info.plist\n try {\n const infoPlistPath = IOSConfig.Paths.getInfoPlistPath(this.projectRoot);\n const data = await plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));\n if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith('$(')) {\n return data.CFBundleIdentifier;\n }\n } catch (error) {\n debug('Expected error resolving the bundle identifier from the project Info.plist:', error);\n }\n\n return null;\n }\n}\n"],"names":["AppleAppIdResolver","debug","require","AppIdResolver","projectRoot","hasNativeProjectAsync","IOSConfig","Paths","getAllPBXProjectPaths","length","error","message","resolveAppIdFromNativeAsync","bundleId","BundleIdentifier","getBundleIdentifierFromPbxproj","infoPlistPath","getInfoPlistPath","data","plist","parse","fs","readFileSync","CFBundleIdentifier","startsWith"],"mappings":";;;;+BASaA;;;eAAAA;;;;yBATa;;;;;;;gEACR;;;;;;;gEACH;;;;;;+BAEe;;;;;;AAE9B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,MAAMF,2BAA2BG,4BAAa;IACnD,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,aAAa,OAAO;IAC5B;IAEA,yDAAyD,GACzD,MAAMC,wBAA0C;QAC9C,IAAI;YACF,gCAAgC;YAChC,OAAO,CAAC,CAACC,0BAAS,CAACC,KAAK,CAACC,qBAAqB,CAAC,IAAI,CAACJ,WAAW,EAAEK,MAAM;QACzE,EAAE,OAAOC,OAAY;YACnBT,MAAM,+CAA+CS,MAAMC,OAAO;YAClE,OAAO;QACT;IACF;IAEA,MAAMC,8BAAsD;QAC1D,sBAAsB;QACtB,IAAI;YACF,MAAMC,WAAWP,0BAAS,CAACQ,gBAAgB,CAACC,8BAA8B,CAAC,IAAI,CAACX,WAAW;YAC3F,IAAIS,UAAU;gBACZ,OAAOA;YACT;QACF,EAAE,OAAOH,OAAY;YACnBT,MAAM,oEAAoES;QAC5E;QAEA,mBAAmB;QACnB,IAAI;YACF,MAAMM,gBAAgBV,0BAAS,CAACC,KAAK,CAACU,gBAAgB,CAAC,IAAI,CAACb,WAAW;YACvE,MAAMc,OAAO,MAAMC,gBAAK,CAACC,KAAK,CAACC,aAAE,CAACC,YAAY,CAACN,eAAe;YAC9D,IAAIE,KAAKK,kBAAkB,IAAI,CAACL,KAAKK,kBAAkB,CAACC,UAAU,CAAC,OAAO;gBACxE,OAAON,KAAKK,kBAAkB;YAChC;QACF,EAAE,OAAOb,OAAO;YACdT,MAAM,+EAA+ES;QACvF;QAEA,OAAO;IACT;AACF"}
|
|
@@ -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;gBAA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vE;IACT;IAEA,MAAMwE,kBAAkBC,UAAkB,EAAoB;QAC5D,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,2B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B;QACR;IACF;IAEA,MAAMF,sBAAsB;QAC1B,MAAMgC,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
|
});
|