@expo/cli 0.22.25 → 0.22.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +91 -93
- package/build/bin/cli.map +1 -1
- package/build/metro-require/require.js +52 -53
- package/build/src/api/endpoint.js +2 -6
- package/build/src/api/endpoint.js.map +1 -1
- package/build/src/api/getExpoGoIntermediateCertificate.js +3 -5
- package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
- package/build/src/api/getExpoSchema.js +12 -16
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/getNativeModuleVersions.js +4 -6
- package/build/src/api/getNativeModuleVersions.js.map +1 -1
- package/build/src/api/getProjectDevelopmentCertificate.js +3 -5
- package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
- package/build/src/api/getVersions.js +5 -7
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/graphql/client.js +26 -32
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +4 -6
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +3 -5
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/graphql/types/App.js +1 -3
- package/build/src/api/graphql/types/App.js.map +1 -1
- package/build/src/api/rest/cache/FileSystemResponseCache.js +8 -10
- package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/ResponseCache.js +12 -20
- package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js +11 -13
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +35 -53
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/client.types.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js +3 -5
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js +3 -5
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js +7 -11
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProxy.js +3 -5
- package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithUserAgent.js +6 -8
- package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
- package/build/src/api/settings.js +5 -7
- package/build/src/api/settings.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +17 -23
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +21 -39
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +21 -27
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +26 -30
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +29 -35
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +30 -44
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +23 -29
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +21 -25
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js +6 -8
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +16 -20
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js +12 -14
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/resolveOptions.js +2 -4
- package/build/src/customize/resolveOptions.js.map +1 -1
- package/build/src/customize/templates.js +54 -58
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js +7 -11
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +9 -11
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEager.js +6 -8
- package/build/src/export/embed/exportEager.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +61 -71
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +55 -57
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/index.js +40 -44
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +36 -44
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +27 -39
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +63 -67
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +27 -35
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +9 -13
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportDomComponents.js +45 -53
- package/build/src/export/exportDomComponents.js.map +1 -1
- package/build/src/export/exportHermes.js +63 -85
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +62 -72
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +27 -33
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js +5 -7
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js +9 -11
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/html.js +6 -10
- package/build/src/export/html.js.map +1 -1
- package/build/src/export/index.js +28 -32
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +30 -36
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +34 -42
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +6 -10
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +24 -28
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +46 -50
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +11 -13
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +15 -19
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/web/resolveOptions.js +3 -5
- package/build/src/export/web/resolveOptions.js.map +1 -1
- package/build/src/export/writeContents.js +2 -4
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/graphql/generated.js +274 -400
- package/build/src/graphql/generated.js.map +1 -1
- package/build/src/install/applyPlugins.js +7 -11
- package/build/src/install/applyPlugins.js.map +1 -1
- package/build/src/install/checkPackages.js +22 -26
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +12 -16
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js +16 -18
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +26 -32
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +18 -22
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js +19 -21
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +14 -18
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/install/utils/checkPackagesCompatibility.js +11 -13
- package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
- package/build/src/lint/ESlintPrerequisite.js +44 -50
- package/build/src/lint/ESlintPrerequisite.js.map +1 -1
- package/build/src/lint/index.js +8 -12
- package/build/src/lint/index.js.map +1 -1
- package/build/src/lint/lintAsync.js +8 -10
- package/build/src/lint/lintAsync.js.map +1 -1
- package/build/src/log.js +16 -36
- package/build/src/log.js.map +1 -1
- package/build/src/login/index.js +20 -24
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js +7 -11
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +26 -38
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +14 -18
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +13 -17
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js +4 -6
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +32 -36
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +25 -29
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +40 -46
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +52 -66
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +32 -36
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +13 -19
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +39 -53
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +8 -12
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js +7 -11
- package/build/src/register/index.js.map +1 -1
- package/build/src/register/registerAsync.js +3 -5
- package/build/src/register/registerAsync.js.map +1 -1
- package/build/src/run/android/index.js +32 -36
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveDevice.js +8 -10
- package/build/src/run/android/resolveDevice.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +16 -18
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +15 -17
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +10 -12
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js +2 -4
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +21 -23
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js +5 -7
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +7 -13
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +23 -27
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +56 -74
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.types.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +63 -69
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js +26 -29
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +25 -28
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +26 -29
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +21 -22
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +29 -32
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +24 -28
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/ServiceClient.js +4 -7
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +27 -28
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +17 -23
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +132 -146
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +21 -29
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +21 -29
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +22 -34
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +17 -27
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +39 -53
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +9 -13
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +19 -27
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/settings.js +5 -9
- package/build/src/run/ios/codeSigning/settings.js.map +1 -1
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js +12 -14
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +21 -27
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +36 -40
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +17 -23
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/appleDestinations.js +36 -38
- package/build/src/run/ios/options/appleDestinations.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +16 -20
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +24 -30
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +23 -31
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +5 -7
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js +5 -7
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +44 -48
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/ios/validateExternalBinary.js +22 -24
- package/build/src/run/ios/validateExternalBinary.js.map +1 -1
- package/build/src/run/resolveBundlerProps.js +2 -4
- package/build/src/run/resolveBundlerProps.js.map +1 -1
- package/build/src/run/startBundler.js +12 -16
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/serve/index.js +16 -20
- package/build/src/serve/index.js.map +1 -1
- package/build/src/serve/serveAsync.js +32 -36
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/start/detectDevClient.js +9 -13
- package/build/src/start/detectDevClient.js.map +1 -1
- package/build/src/start/doctor/Prerequisite.js +7 -12
- package/build/src/start/doctor/Prerequisite.js.map +1 -1
- package/build/src/start/doctor/SecurityBinPrerequisite.js +11 -13
- package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +19 -23
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +19 -23
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +45 -51
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcrunPrerequisite.js +16 -18
- package/build/src/start/doctor/apple/XcrunPrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +19 -23
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +25 -31
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +17 -25
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +32 -40
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +26 -32
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +31 -41
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +29 -34
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/ngrok/NgrokResolver.js +8 -12
- package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +28 -32
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +17 -23
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +27 -33
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +42 -46
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js +14 -18
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +80 -94
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +40 -44
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +61 -65
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +4 -6
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js +6 -10
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +20 -25
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +15 -17
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +35 -39
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js +16 -18
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js +20 -24
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js +17 -17
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +9 -11
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js +22 -26
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +83 -121
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +12 -20
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +26 -36
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/getDevices.js +5 -7
- package/build/src/start/platforms/android/getDevices.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +28 -36
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +15 -19
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js +19 -21
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +31 -37
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js +12 -12
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/assertSystemRequirements.js +7 -9
- package/build/src/start/platforms/ios/assertSystemRequirements.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +73 -87
- package/build/src/start/platforms/ios/devicectl.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +18 -22
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +19 -29
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +10 -14
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +74 -102
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +52 -57
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +18 -22
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +9 -19
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/project/dotExpo.js +11 -15
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/project/settings.js +2 -4
- package/build/src/start/project/settings.js.map +1 -1
- package/build/src/start/resolveOptions.js +40 -48
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +51 -55
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/AsyncWsTunnel.js +36 -40
- package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +79 -81
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +38 -42
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +14 -18
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +14 -18
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/ReactDevToolsProxy.js +10 -16
- package/build/src/start/server/ReactDevToolsProxy.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +33 -36
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +21 -29
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js +4 -6
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +271 -269
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +56 -63
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +33 -39
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +40 -46
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +28 -32
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +92 -96
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +30 -32
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/AtlasPrerequisite.js +11 -13
- package/build/src/start/server/metro/debugging/AtlasPrerequisite.js.map +1 -1
- package/build/src/start/server/metro/debugging/MessageHandler.js +1 -3
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
- package/build/src/start/server/metro/debugging/attachAtlas.js +22 -26
- package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +17 -19
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js +31 -25
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/getDebuggerType.js +4 -6
- package/build/src/start/server/metro/debugging/getDebuggerType.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +8 -14
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js +5 -7
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js +6 -8
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js +5 -7
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeEvaluate.js +12 -14
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeEvaluate.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js +10 -14
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js.map +1 -1
- package/build/src/start/server/metro/debugging/pageIsSupported.js +4 -6
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
- package/build/src/start/server/metro/debugging/types.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createEventSocket.js +16 -18
- package/build/src/start/server/metro/dev-server/createEventSocket.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMessageSocket.js +21 -23
- package/build/src/start/server/metro/dev-server/createMessageSocket.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +21 -23
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/start/server/metro/dev-server/utils/createSocketBroadcaster.js +2 -4
- package/build/src/start/server/metro/dev-server/utils/createSocketBroadcaster.js.map +1 -1
- package/build/src/start/server/metro/dev-server/utils/createSocketMap.js +2 -4
- package/build/src/start/server/metro/dev-server/utils/createSocketMap.js.map +1 -1
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js +4 -8
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
- package/build/src/start/server/metro/externals.js +25 -33
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +12 -16
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +9 -11
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +18 -22
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +79 -85
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxLog.js +36 -40
- package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +14 -20
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js +6 -10
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +78 -88
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroErrors.js +4 -8
- package/build/src/start/server/metro/metroErrors.js.map +1 -1
- package/build/src/start/server/metro/metroPrivateServer.js +7 -9
- package/build/src/start/server/metro/metroPrivateServer.js.map +1 -1
- package/build/src/start/server/metro/metroVirtualModules.js +8 -10
- package/build/src/start/server/metro/metroVirtualModules.js.map +1 -1
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +22 -24
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/router.js +32 -48
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +22 -24
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +22 -24
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/symbolicate.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +29 -35
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +139 -149
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +39 -49
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js +6 -8
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CorsMiddleware.js +15 -17
- package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js +31 -32
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +19 -22
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js +27 -33
- package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +60 -64
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +9 -15
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js +14 -15
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +2 -4
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +31 -34
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +56 -64
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js +19 -23
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +19 -20
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +9 -11
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js +11 -17
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js.map +1 -1
- package/build/src/start/server/middleware/inspector/CdpClient.js +10 -12
- package/build/src/start/server/middleware/inspector/CdpClient.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +27 -35
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +19 -21
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +2 -6
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +96 -120
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/mutations.js +3 -7
- package/build/src/start/server/middleware/mutations.js.map +1 -1
- package/build/src/start/server/middleware/resolveAssets.js +18 -26
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +15 -23
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js +9 -11
- package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
- package/build/src/start/server/middleware/server.types.js.map +1 -1
- package/build/src/start/server/openPlatforms.js +8 -10
- package/build/src/start/server/openPlatforms.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +11 -13
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +50 -58
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +7 -11
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +54 -76
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +19 -21
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +28 -36
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +24 -28
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +46 -52
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +11 -15
- package/build/src/start/server/webpack/compile.js.map +1 -1
- package/build/src/start/server/webpack/formatWebpackMessages.js +26 -28
- package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +12 -18
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +12 -18
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +27 -31
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +17 -20
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/ansi.js +5 -7
- package/build/src/utils/ansi.js.map +1 -1
- package/build/src/utils/args.js +14 -24
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/array.js +6 -18
- package/build/src/utils/array.js.map +1 -1
- package/build/src/utils/cocoapods.js +46 -54
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +68 -78
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/createFileTransform.js +12 -16
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/build/src/utils/createTempPath.js +13 -17
- package/build/src/utils/createTempPath.js.map +1 -1
- package/build/src/utils/delay.js +6 -12
- package/build/src/utils/delay.js.map +1 -1
- package/build/src/utils/dir.js +28 -46
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +8 -10
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +21 -25
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +35 -41
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +59 -63
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +30 -37
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/exit.js +31 -35
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/expoUpdatesCli.js +22 -32
- package/build/src/utils/expoUpdatesCli.js.map +1 -1
- package/build/src/utils/fetch.js +4 -8
- package/build/src/utils/fetch.js.map +1 -1
- package/build/src/utils/filePath.js +6 -10
- package/build/src/utils/filePath.js.map +1 -1
- package/build/src/utils/findUp.js +9 -13
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/fn.js +2 -6
- package/build/src/utils/fn.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +26 -32
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +21 -29
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +20 -26
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +4 -8
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/interactive.js +1 -3
- package/build/src/utils/interactive.js.map +1 -1
- package/build/src/utils/ip.js +19 -21
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/isModuleSymlinked.js +9 -11
- package/build/src/utils/isModuleSymlinked.js.map +1 -1
- package/build/src/utils/jsonSchemaDeref.js +18 -20
- package/build/src/utils/jsonSchemaDeref.js.map +1 -1
- package/build/src/utils/link.js +13 -17
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +28 -46
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +10 -16
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/modifyConfigPlugins.js +6 -10
- package/build/src/utils/modifyConfigPlugins.js.map +1 -1
- package/build/src/utils/nodeEnv.js +6 -12
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/nodeModules.js +8 -10
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +36 -50
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/obj.js +5 -11
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/open.js +8 -10
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +7 -13
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +15 -21
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +33 -43
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/profile.js +7 -11
- package/build/src/utils/profile.js.map +1 -1
- package/build/src/utils/progress.js +5 -11
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +29 -47
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/resolveArgs.js +24 -36
- package/build/src/utils/resolveArgs.js.map +1 -1
- package/build/src/utils/scheme.js +32 -40
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/stream.js +3 -5
- package/build/src/utils/stream.js.map +1 -1
- package/build/src/utils/strings.js +4 -6
- package/build/src/utils/strings.js.map +1 -1
- package/build/src/utils/tar.js +15 -19
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/Telemetry.js +27 -29
- package/build/src/utils/telemetry/Telemetry.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +13 -15
- package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchDetachedClient.js +22 -26
- package/build/src/utils/telemetry/clients/FetchDetachedClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/RudderClient.js +8 -10
- package/build/src/utils/telemetry/clients/RudderClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js +22 -26
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js +10 -10
- package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
- package/build/src/utils/telemetry/clients/flushRudderDetached.js +10 -10
- package/build/src/utils/telemetry/clients/flushRudderDetached.js.map +1 -1
- package/build/src/utils/telemetry/events.js +2 -4
- package/build/src/utils/telemetry/events.js.map +1 -1
- package/build/src/utils/telemetry/flushDetached.js.map +1 -1
- package/build/src/utils/telemetry/index.js +29 -25
- package/build/src/utils/telemetry/index.js.map +1 -1
- package/build/src/utils/telemetry/types.js.map +1 -1
- package/build/src/utils/telemetry/utils/constants.js +4 -8
- package/build/src/utils/telemetry/utils/constants.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +14 -18
- package/build/src/utils/telemetry/utils/context.js.map +1 -1
- package/build/src/utils/template.js +4 -6
- package/build/src/utils/template.js.map +1 -1
- package/build/src/utils/terminal.js +2 -4
- package/build/src/utils/terminal.js.map +1 -1
- package/build/src/utils/tsconfig/evaluateTsConfig.js +17 -21
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +14 -18
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +5 -7
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +12 -14
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/build/src/utils/url.js +13 -23
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +86 -108
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +16 -22
- package/build/src/utils/variadic.js.map +1 -1
- package/build/src/whoami/index.js +7 -11
- package/build/src/whoami/index.js.map +1 -1
- package/build/src/whoami/whoamiAsync.js +7 -11
- package/build/src/whoami/whoamiAsync.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/AFCProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport type { ProtocolReaderCallback, ProtocolWriter } from './AbstractProtocol';\nimport { ProtocolClient, ProtocolReader, ProtocolReaderFactory } from './AbstractProtocol';\nimport { CommandError } from '../../../../utils/errors';\n\nconst debug = Debug('expo:apple-device:protocol:afc');\n\nexport const AFC_MAGIC = 'CFA6LPAA';\nexport const AFC_HEADER_SIZE = 40;\n\nexport interface AFCHeader {\n magic: typeof AFC_MAGIC;\n totalLength: number;\n headerLength: number;\n requestId: number;\n operation: AFC_OPS;\n}\n\nexport interface AFCMessage {\n operation: AFC_OPS;\n data?: any;\n payload?: any;\n}\n\nexport interface AFCResponse {\n operation: AFC_OPS;\n id: number;\n data: Buffer;\n}\n\nexport interface AFCStatusResponse {\n operation: AFC_OPS.STATUS;\n id: number;\n data: number;\n}\n\n/**\n * AFC Operations\n */\nexport enum AFC_OPS {\n /**\n * Invalid\n */\n INVALID = 0x00000000,\n\n /**\n * Status\n */\n STATUS = 0x00000001,\n\n /**\n * Data\n */\n DATA = 0x00000002,\n\n /**\n * ReadDir\n */\n READ_DIR = 0x00000003,\n\n /**\n * ReadFile\n */\n READ_FILE = 0x00000004,\n\n /**\n * WriteFile\n */\n WRITE_FILE = 0x00000005,\n\n /**\n * WritePart\n */\n WRITE_PART = 0x00000006,\n\n /**\n * TruncateFile\n */\n TRUNCATE = 0x00000007,\n\n /**\n * RemovePath\n */\n REMOVE_PATH = 0x00000008,\n\n /**\n * MakeDir\n */\n MAKE_DIR = 0x00000009,\n\n /**\n * GetFileInfo\n */\n GET_FILE_INFO = 0x0000000a,\n\n /**\n * GetDeviceInfo\n */\n GET_DEVINFO = 0x0000000b,\n\n /**\n * WriteFileAtomic (tmp file+rename)\n */\n WRITE_FILE_ATOM = 0x0000000c,\n\n /**\n * FileRefOpen\n */\n FILE_OPEN = 0x0000000d,\n\n /**\n * FileRefOpenResult\n */\n FILE_OPEN_RES = 0x0000000e,\n\n /**\n * FileRefRead\n */\n FILE_READ = 0x0000000f,\n\n /**\n * FileRefWrite\n */\n FILE_WRITE = 0x00000010,\n\n /**\n * FileRefSeek\n */\n FILE_SEEK = 0x00000011,\n\n /**\n * FileRefTell\n */\n FILE_TELL = 0x00000012,\n\n /**\n * FileRefTellResult\n */\n FILE_TELL_RES = 0x00000013,\n\n /**\n * FileRefClose\n */\n FILE_CLOSE = 0x00000014,\n\n /**\n * FileRefSetFileSize (ftruncate)\n */\n FILE_SET_SIZE = 0x00000015,\n\n /**\n * GetConnectionInfo\n */\n GET_CON_INFO = 0x00000016,\n\n /**\n * SetConnectionOptions\n */\n SET_CON_OPTIONS = 0x00000017,\n\n /**\n * RenamePath\n */\n RENAME_PATH = 0x00000018,\n\n /**\n * SetFSBlockSize (0x800000)\n */\n SET_FS_BS = 0x00000019,\n\n /**\n * SetSocketBlockSize (0x800000)\n */\n SET_SOCKET_BS = 0x0000001a,\n\n /**\n * FileRefLock\n */\n FILE_LOCK = 0x0000001b,\n\n /**\n * MakeLink\n */\n MAKE_LINK = 0x0000001c,\n\n /**\n * GetFileHash\n */\n GET_FILE_HASH = 0x0000001d,\n\n /**\n * SetModTime\n */\n SET_FILE_MOD_TIME = 0x0000001e,\n\n /**\n * GetFileHashWithRange\n */\n GET_FILE_HASH_RANGE = 0x0000001f,\n\n // iOS 6+\n\n /**\n * FileRefSetImmutableHint\n */\n FILE_SET_IMMUTABLE_HINT = 0x00000020,\n\n /**\n * GetSizeOfPathContents\n */\n GET_SIZE_OF_PATH_CONTENTS = 0x00000021,\n\n /**\n * RemovePathAndContents\n */\n REMOVE_PATH_AND_CONTENTS = 0x00000022,\n\n /**\n * DirectoryEnumeratorRefOpen\n */\n DIR_OPEN = 0x00000023,\n\n /**\n * DirectoryEnumeratorRefOpenResult\n */\n DIR_OPEN_RESULT = 0x00000024,\n\n /**\n * DirectoryEnumeratorRefRead\n */\n DIR_READ = 0x00000025,\n\n /**\n * DirectoryEnumeratorRefClose\n */\n DIR_CLOSE = 0x00000026,\n\n // iOS 7+\n\n /**\n * FileRefReadWithOffset\n */\n FILE_READ_OFFSET = 0x00000027,\n\n /**\n * FileRefWriteWithOffset\n */\n FILE_WRITE_OFFSET = 0x00000028,\n}\n\n/**\n * Error Codes\n */\nexport enum AFC_STATUS {\n SUCCESS = 0,\n UNKNOWN_ERROR = 1,\n OP_HEADER_INVALID = 2,\n NO_RESOURCES = 3,\n READ_ERROR = 4,\n WRITE_ERROR = 5,\n UNKNOWN_PACKET_TYPE = 6,\n INVALID_ARG = 7,\n OBJECT_NOT_FOUND = 8,\n OBJECT_IS_DIR = 9,\n PERM_DENIED = 10,\n SERVICE_NOT_CONNECTED = 11,\n OP_TIMEOUT = 12,\n TOO_MUCH_DATA = 13,\n END_OF_DATA = 14,\n OP_NOT_SUPPORTED = 15,\n OBJECT_EXISTS = 16,\n OBJECT_BUSY = 17,\n NO_SPACE_LEFT = 18,\n OP_WOULD_BLOCK = 19,\n IO_ERROR = 20,\n OP_INTERRUPTED = 21,\n OP_IN_PROGRESS = 22,\n INTERNAL_ERROR = 23,\n MUX_ERROR = 30,\n NO_MEM = 31,\n NOT_ENOUGH_DATA = 32,\n DIR_NOT_EMPTY = 33,\n FORCE_SIGNED_TYPE = -1,\n}\n\nexport enum AFC_FILE_OPEN_FLAGS {\n /**\n * r (O_RDONLY)\n */\n RDONLY = 0x00000001,\n\n /**\n * r+ (O_RDWR | O_CREAT)\n */\n RW = 0x00000002,\n\n /**\n * w (O_WRONLY | O_CREAT | O_TRUNC)\n */\n WRONLY = 0x00000003,\n\n /**\n * w+ (O_RDWR | O_CREAT | O_TRUNC)\n */\n WR = 0x00000004,\n\n /**\n * a (O_WRONLY | O_APPEND | O_CREAT)\n */\n APPEND = 0x00000005,\n\n /**\n * a+ (O_RDWR | O_APPEND | O_CREAT)\n */\n RDAPPEND = 0x00000006,\n}\n\nfunction isAFCResponse(resp: any): resp is AFCResponse {\n return AFC_OPS[resp.operation] !== undefined && resp.id !== undefined && resp.data !== undefined;\n}\n\nfunction isStatusResponse(resp: any): resp is AFCStatusResponse {\n return isAFCResponse(resp) && resp.operation === AFC_OPS.STATUS;\n}\n\nfunction isErrorStatusResponse(resp: AFCResponse): boolean {\n return isStatusResponse(resp) && resp.data !== AFC_STATUS.SUCCESS;\n}\n\nclass AFCInternalError extends Error {\n constructor(\n msg: string,\n public requestId: number\n ) {\n super(msg);\n }\n}\n\nexport class AFCError extends Error {\n constructor(\n msg: string,\n public status: AFC_STATUS\n ) {\n super(msg);\n }\n}\n\nexport class AFCProtocolClient extends ProtocolClient {\n private requestId = 0;\n private requestCallbacks: { [key: number]: ProtocolReaderCallback } = {};\n\n constructor(socket: Socket) {\n super(socket, new ProtocolReaderFactory(AFCProtocolReader), new AFCProtocolWriter());\n\n const reader = this.readerFactory.create((resp, err) => {\n if (err && err instanceof AFCInternalError) {\n this.requestCallbacks[err.requestId](resp, err);\n } else if (isErrorStatusResponse(resp)) {\n this.requestCallbacks[resp.id](resp, new AFCError(AFC_STATUS[resp.data], resp.data));\n } else {\n this.requestCallbacks[resp.id](resp);\n }\n });\n socket.on('data', reader.onData);\n }\n\n sendMessage(msg: AFCMessage): Promise<AFCResponse> {\n return new Promise<AFCResponse>((resolve, reject) => {\n const requestId = this.requestId++;\n this.requestCallbacks[requestId] = async (resp: any, err?: Error) => {\n if (err) {\n reject(err);\n return;\n }\n if (isAFCResponse(resp)) {\n resolve(resp);\n } else {\n reject(new CommandError('APPLE_DEVICE_AFC', 'Malformed AFC response'));\n }\n };\n this.writer.write(this.socket, { ...msg, requestId });\n });\n }\n}\n\nexport class AFCProtocolReader extends ProtocolReader {\n private header!: AFCHeader; // TODO: ! -> ?\n\n constructor(callback: ProtocolReaderCallback) {\n super(AFC_HEADER_SIZE, callback);\n }\n\n parseHeader(data: Buffer) {\n const magic = data.slice(0, 8).toString('ascii');\n if (magic !== AFC_MAGIC) {\n throw new AFCInternalError(\n `Invalid AFC packet received (magic != ${AFC_MAGIC})`,\n data.readUInt32LE(24)\n );\n }\n // technically these are uint64\n this.header = {\n magic,\n totalLength: data.readUInt32LE(8),\n headerLength: data.readUInt32LE(16),\n requestId: data.readUInt32LE(24),\n operation: data.readUInt32LE(32),\n };\n\n debug(`parse header: ${JSON.stringify(this.header)}`);\n if (this.header.headerLength < AFC_HEADER_SIZE) {\n throw new AFCInternalError('Invalid AFC header', this.header.requestId);\n }\n return this.header.totalLength - AFC_HEADER_SIZE;\n }\n\n parseBody(data: Buffer): AFCResponse | AFCStatusResponse {\n const body: any = {\n operation: this.header.operation,\n id: this.header.requestId,\n data,\n };\n if (isStatusResponse(body)) {\n const status = data.readUInt32LE(0);\n debug(`${AFC_OPS[this.header.operation]} response: ${AFC_STATUS[status]}`);\n body.data = status;\n } else if (data.length <= 8) {\n debug(`${AFC_OPS[this.header.operation]} response: ${Array.prototype.toString.call(body)}`);\n } else {\n debug(`${AFC_OPS[this.header.operation]} response length: ${data.length} bytes`);\n }\n return body;\n }\n}\n\nexport class AFCProtocolWriter implements ProtocolWriter {\n write(socket: Socket, msg: AFCMessage & { requestId: number }) {\n const { data, payload, operation, requestId } = msg;\n\n const dataLength = data ? data.length : 0;\n const payloadLength = payload ? payload.length : 0;\n\n const header = Buffer.alloc(AFC_HEADER_SIZE);\n const magic = Buffer.from(AFC_MAGIC);\n magic.copy(header);\n header.writeUInt32LE(AFC_HEADER_SIZE + dataLength + payloadLength, 8);\n header.writeUInt32LE(AFC_HEADER_SIZE + dataLength, 16);\n header.writeUInt32LE(requestId, 24);\n header.writeUInt32LE(operation, 32);\n socket.write(header);\n socket.write(data);\n if (data.length <= 8) {\n debug(\n `socket write, header: { requestId: ${requestId}, operation: ${\n AFC_OPS[operation]\n }}, body: ${Array.prototype.toString.call(data)}`\n );\n } else {\n debug(\n `socket write, header: { requestId: ${requestId}, operation: ${AFC_OPS[operation]}}, body: ${data.length} bytes`\n );\n }\n\n debug(`socket write, bytes written ${header.length} (header), ${data.length} (body)`);\n if (payload) {\n socket.write(payload);\n }\n }\n}\n"],"names":["AFCError","AFCProtocolClient","AFCProtocolReader","AFCProtocolWriter","AFC_FILE_OPEN_FLAGS","AFC_HEADER_SIZE","AFC_MAGIC","AFC_OPS","AFC_STATUS","debug","Debug","isAFCResponse","resp","operation","undefined","id","data","isStatusResponse","isErrorStatusResponse","AFCInternalError","Error","constructor","msg","requestId","status","ProtocolClient","socket","ProtocolReaderFactory","requestCallbacks","reader","readerFactory","create","err","on","onData","sendMessage","Promise","resolve","reject","CommandError","writer","write","ProtocolReader","callback","parseHeader","magic","slice","toString","readUInt32LE","header","totalLength","headerLength","JSON","stringify","parseBody","body","length","Array","prototype","call","payload","dataLength","payloadLength","Buffer","alloc","from","copy","writeUInt32LE"],"mappings":"AAAA;;;;;;CAMC;;;;;;;;;;;IAqVYA,QAAQ;eAARA;;IASAC,iBAAiB;eAAjBA;;IAsCAC,iBAAiB;eAAjBA;;IAkDAC,iBAAiB;eAAjBA;;IAtJDC,mBAAmB;eAAnBA;;IArRCC,eAAe;eAAfA;;IADAC,SAAS;eAATA;;IAgCDC,OAAO;eAAPA;;IAsNAC,UAAU;eAAVA;;;;gEA/PM;;;;;;kCAIoD;wBACzC;;;;;;AAE7B,MAAMC,QAAQC,IAAAA,gBAAK,EAAC;AAEb,MAAMJ,YAAY;AAClB,MAAMD,kBAAkB;AA+BxB,IAAA,AAAKE,iCAAAA;IACV;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD,SAAS;IAET;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD,SAAS;IAET;;GAEC;IAGD;;GAEC;WA/MSA;;AAsNL,IAAA,AAAKC,oCAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAAA;;AAgCL,IAAA,AAAKJ,6CAAAA;IACV;;GAEC;IAGD;;GAEC;IAGD;;GAEC;IAGD;;GAEC;I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AAa,CAACtD,WAAW;QAChCa,OAAOe,KAAK,CAACQ;QACbvB,OAAOe,KAAK,CAACzB;QACb,IAAIA,KAAKwC,MAAM,IAAI,GAAG;YACpB/C,MACE,CAAC,mCAAmC,EAAEc,UAAU,aAAa,EAC3DhB,OAAO,CAACM,UAAU,CACnB,SAAS,EAAE4C,MAAMC,SAAS,CAACX,QAAQ,CAACY,IAAI,CAAC3C,OAAO;QAErD,OAAO;YACLP,MACE,CAAC,mCAAmC,EAAEc,UAAU,aAAa,EAAEhB,OAAO,CAACM,UAAU,CAAC,SAAS,EAAEG,KAAKwC,MAAM,CAAC,MAAM,CAAC;QAEpH;QAEA/C,MAAM,CAAC,4BAA4B,EAAEwC,OAAOO,MAAM,CAAC,WAAW,EAAExC,KAAKwC,MAAM,CAAC,OAAO,CAAC;QACpF,IAAII,SAAS;YACXlC,OAAOe,KAAK,CAACmB;QACf;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/AFCProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport type { ProtocolReaderCallback, ProtocolWriter } from './AbstractProtocol';\nimport { ProtocolClient, ProtocolReader, ProtocolReaderFactory } from './AbstractProtocol';\nimport { CommandError } from '../../../../utils/errors';\n\nconst debug = Debug('expo:apple-device:protocol:afc');\n\nexport const AFC_MAGIC = 'CFA6LPAA';\nexport const AFC_HEADER_SIZE = 40;\n\nexport interface AFCHeader {\n magic: typeof AFC_MAGIC;\n totalLength: number;\n headerLength: number;\n requestId: number;\n operation: AFC_OPS;\n}\n\nexport interface AFCMessage {\n operation: AFC_OPS;\n data?: any;\n payload?: any;\n}\n\nexport interface AFCResponse {\n operation: AFC_OPS;\n id: number;\n data: Buffer;\n}\n\nexport interface AFCStatusResponse {\n operation: AFC_OPS.STATUS;\n id: number;\n data: number;\n}\n\n/**\n * AFC Operations\n */\nexport enum AFC_OPS {\n /**\n * Invalid\n */\n INVALID = 0x00000000,\n\n /**\n * Status\n */\n STATUS = 0x00000001,\n\n /**\n * Data\n */\n DATA = 0x00000002,\n\n /**\n * ReadDir\n */\n READ_DIR = 0x00000003,\n\n /**\n * ReadFile\n */\n READ_FILE = 0x00000004,\n\n /**\n * WriteFile\n */\n WRITE_FILE = 0x00000005,\n\n /**\n * WritePart\n */\n WRITE_PART = 0x00000006,\n\n /**\n * TruncateFile\n */\n TRUNCATE = 0x00000007,\n\n /**\n * RemovePath\n */\n REMOVE_PATH = 0x00000008,\n\n /**\n * MakeDir\n */\n MAKE_DIR = 0x00000009,\n\n /**\n * GetFileInfo\n */\n GET_FILE_INFO = 0x0000000a,\n\n /**\n * GetDeviceInfo\n */\n GET_DEVINFO = 0x0000000b,\n\n /**\n * WriteFileAtomic (tmp file+rename)\n */\n WRITE_FILE_ATOM = 0x0000000c,\n\n /**\n * FileRefOpen\n */\n FILE_OPEN = 0x0000000d,\n\n /**\n * FileRefOpenResult\n */\n FILE_OPEN_RES = 0x0000000e,\n\n /**\n * FileRefRead\n */\n FILE_READ = 0x0000000f,\n\n /**\n * FileRefWrite\n */\n FILE_WRITE = 0x00000010,\n\n /**\n * FileRefSeek\n */\n FILE_SEEK = 0x00000011,\n\n /**\n * FileRefTell\n */\n FILE_TELL = 0x00000012,\n\n /**\n * FileRefTellResult\n */\n FILE_TELL_RES = 0x00000013,\n\n /**\n * FileRefClose\n */\n FILE_CLOSE = 0x00000014,\n\n /**\n * FileRefSetFileSize (ftruncate)\n */\n FILE_SET_SIZE = 0x00000015,\n\n /**\n * GetConnectionInfo\n */\n GET_CON_INFO = 0x00000016,\n\n /**\n * SetConnectionOptions\n */\n SET_CON_OPTIONS = 0x00000017,\n\n /**\n * RenamePath\n */\n RENAME_PATH = 0x00000018,\n\n /**\n * SetFSBlockSize (0x800000)\n */\n SET_FS_BS = 0x00000019,\n\n /**\n * SetSocketBlockSize (0x800000)\n */\n SET_SOCKET_BS = 0x0000001a,\n\n /**\n * FileRefLock\n */\n FILE_LOCK = 0x0000001b,\n\n /**\n * MakeLink\n */\n MAKE_LINK = 0x0000001c,\n\n /**\n * GetFileHash\n */\n GET_FILE_HASH = 0x0000001d,\n\n /**\n * SetModTime\n */\n SET_FILE_MOD_TIME = 0x0000001e,\n\n /**\n * GetFileHashWithRange\n */\n GET_FILE_HASH_RANGE = 0x0000001f,\n\n // iOS 6+\n\n /**\n * FileRefSetImmutableHint\n */\n FILE_SET_IMMUTABLE_HINT = 0x00000020,\n\n /**\n * GetSizeOfPathContents\n */\n GET_SIZE_OF_PATH_CONTENTS = 0x00000021,\n\n /**\n * RemovePathAndContents\n */\n REMOVE_PATH_AND_CONTENTS = 0x00000022,\n\n /**\n * DirectoryEnumeratorRefOpen\n */\n DIR_OPEN = 0x00000023,\n\n /**\n * DirectoryEnumeratorRefOpenResult\n */\n DIR_OPEN_RESULT = 0x00000024,\n\n /**\n * DirectoryEnumeratorRefRead\n */\n DIR_READ = 0x00000025,\n\n /**\n * DirectoryEnumeratorRefClose\n */\n DIR_CLOSE = 0x00000026,\n\n // iOS 7+\n\n /**\n * FileRefReadWithOffset\n */\n FILE_READ_OFFSET = 0x00000027,\n\n /**\n * FileRefWriteWithOffset\n */\n FILE_WRITE_OFFSET = 0x00000028,\n}\n\n/**\n * Error Codes\n */\nexport enum AFC_STATUS {\n SUCCESS = 0,\n UNKNOWN_ERROR = 1,\n OP_HEADER_INVALID = 2,\n NO_RESOURCES = 3,\n READ_ERROR = 4,\n WRITE_ERROR = 5,\n UNKNOWN_PACKET_TYPE = 6,\n INVALID_ARG = 7,\n OBJECT_NOT_FOUND = 8,\n OBJECT_IS_DIR = 9,\n PERM_DENIED = 10,\n SERVICE_NOT_CONNECTED = 11,\n OP_TIMEOUT = 12,\n TOO_MUCH_DATA = 13,\n END_OF_DATA = 14,\n OP_NOT_SUPPORTED = 15,\n OBJECT_EXISTS = 16,\n OBJECT_BUSY = 17,\n NO_SPACE_LEFT = 18,\n OP_WOULD_BLOCK = 19,\n IO_ERROR = 20,\n OP_INTERRUPTED = 21,\n OP_IN_PROGRESS = 22,\n INTERNAL_ERROR = 23,\n MUX_ERROR = 30,\n NO_MEM = 31,\n NOT_ENOUGH_DATA = 32,\n DIR_NOT_EMPTY = 33,\n FORCE_SIGNED_TYPE = -1,\n}\n\nexport enum AFC_FILE_OPEN_FLAGS {\n /**\n * r (O_RDONLY)\n */\n RDONLY = 0x00000001,\n\n /**\n * r+ (O_RDWR | O_CREAT)\n */\n RW = 0x00000002,\n\n /**\n * w (O_WRONLY | O_CREAT | O_TRUNC)\n */\n WRONLY = 0x00000003,\n\n /**\n * w+ (O_RDWR | O_CREAT | O_TRUNC)\n */\n WR = 0x00000004,\n\n /**\n * a (O_WRONLY | O_APPEND | O_CREAT)\n */\n APPEND = 0x00000005,\n\n /**\n * a+ (O_RDWR | O_APPEND | O_CREAT)\n */\n RDAPPEND = 0x00000006,\n}\n\nfunction isAFCResponse(resp: any): resp is AFCResponse {\n return AFC_OPS[resp.operation] !== undefined && resp.id !== undefined && resp.data !== undefined;\n}\n\nfunction isStatusResponse(resp: any): resp is AFCStatusResponse {\n return isAFCResponse(resp) && resp.operation === AFC_OPS.STATUS;\n}\n\nfunction isErrorStatusResponse(resp: AFCResponse): boolean {\n return isStatusResponse(resp) && resp.data !== AFC_STATUS.SUCCESS;\n}\n\nclass AFCInternalError extends Error {\n constructor(\n msg: string,\n public requestId: number\n ) {\n super(msg);\n }\n}\n\nexport class AFCError extends Error {\n constructor(\n msg: string,\n public status: AFC_STATUS\n ) {\n super(msg);\n }\n}\n\nexport class AFCProtocolClient extends ProtocolClient {\n private requestId = 0;\n private requestCallbacks: { [key: number]: ProtocolReaderCallback } = {};\n\n constructor(socket: Socket) {\n super(socket, new ProtocolReaderFactory(AFCProtocolReader), new AFCProtocolWriter());\n\n const reader = this.readerFactory.create((resp, err) => {\n if (err && err instanceof AFCInternalError) {\n this.requestCallbacks[err.requestId](resp, err);\n } else if (isErrorStatusResponse(resp)) {\n this.requestCallbacks[resp.id](resp, new AFCError(AFC_STATUS[resp.data], resp.data));\n } else {\n this.requestCallbacks[resp.id](resp);\n }\n });\n socket.on('data', reader.onData);\n }\n\n sendMessage(msg: AFCMessage): Promise<AFCResponse> {\n return new Promise<AFCResponse>((resolve, reject) => {\n const requestId = this.requestId++;\n this.requestCallbacks[requestId] = async (resp: any, err?: Error) => {\n if (err) {\n reject(err);\n return;\n }\n if (isAFCResponse(resp)) {\n resolve(resp);\n } else {\n reject(new CommandError('APPLE_DEVICE_AFC', 'Malformed AFC response'));\n }\n };\n this.writer.write(this.socket, { ...msg, requestId });\n });\n }\n}\n\nexport class AFCProtocolReader extends ProtocolReader {\n private header!: AFCHeader; // TODO: ! -> ?\n\n constructor(callback: ProtocolReaderCallback) {\n super(AFC_HEADER_SIZE, callback);\n }\n\n parseHeader(data: Buffer) {\n const magic = data.slice(0, 8).toString('ascii');\n if (magic !== AFC_MAGIC) {\n throw new AFCInternalError(\n `Invalid AFC packet received (magic != ${AFC_MAGIC})`,\n data.readUInt32LE(24)\n );\n }\n // technically these are uint64\n this.header = {\n magic,\n totalLength: data.readUInt32LE(8),\n headerLength: data.readUInt32LE(16),\n requestId: data.readUInt32LE(24),\n operation: data.readUInt32LE(32),\n };\n\n debug(`parse header: ${JSON.stringify(this.header)}`);\n if (this.header.headerLength < AFC_HEADER_SIZE) {\n throw new AFCInternalError('Invalid AFC header', this.header.requestId);\n }\n return this.header.totalLength - AFC_HEADER_SIZE;\n }\n\n parseBody(data: Buffer): AFCResponse | AFCStatusResponse {\n const body: any = {\n operation: this.header.operation,\n id: this.header.requestId,\n data,\n };\n if (isStatusResponse(body)) {\n const status = data.readUInt32LE(0);\n debug(`${AFC_OPS[this.header.operation]} response: ${AFC_STATUS[status]}`);\n body.data = status;\n } else if (data.length <= 8) {\n debug(`${AFC_OPS[this.header.operation]} response: ${Array.prototype.toString.call(body)}`);\n } else {\n debug(`${AFC_OPS[this.header.operation]} response length: ${data.length} bytes`);\n }\n return body;\n }\n}\n\nexport class AFCProtocolWriter implements ProtocolWriter {\n write(socket: Socket, msg: AFCMessage & { requestId: number }) {\n const { data, payload, operation, requestId } = msg;\n\n const dataLength = data ? data.length : 0;\n const payloadLength = payload ? payload.length : 0;\n\n const header = Buffer.alloc(AFC_HEADER_SIZE);\n const magic = Buffer.from(AFC_MAGIC);\n magic.copy(header);\n header.writeUInt32LE(AFC_HEADER_SIZE + dataLength + payloadLength, 8);\n header.writeUInt32LE(AFC_HEADER_SIZE + dataLength, 16);\n header.writeUInt32LE(requestId, 24);\n header.writeUInt32LE(operation, 32);\n socket.write(header);\n socket.write(data);\n if (data.length <= 8) {\n debug(\n `socket write, header: { requestId: ${requestId}, operation: ${\n AFC_OPS[operation]\n }}, body: ${Array.prototype.toString.call(data)}`\n );\n } else {\n debug(\n `socket write, header: { requestId: ${requestId}, operation: ${AFC_OPS[operation]}}, body: ${data.length} bytes`\n );\n }\n\n debug(`socket write, bytes written ${header.length} (header), ${data.length} (body)`);\n if (payload) {\n socket.write(payload);\n }\n }\n}\n"],"names":["AFC_MAGIC","AFC_HEADER_SIZE","AFCError","AFCProtocolClient","AFCProtocolReader","AFCProtocolWriter","debug","Debug","AFC_OPS","INVALID","STATUS","DATA","READ_DIR","READ_FILE","WRITE_FILE","WRITE_PART","TRUNCATE","REMOVE_PATH","MAKE_DIR","GET_FILE_INFO","GET_DEVINFO","WRITE_FILE_ATOM","FILE_OPEN","FILE_OPEN_RES","FILE_READ","FILE_WRITE","FILE_SEEK","FILE_TELL","FILE_TELL_RES","FILE_CLOSE","FILE_SET_SIZE","GET_CON_INFO","SET_CON_OPTIONS","RENAME_PATH","SET_FS_BS","SET_SOCKET_BS","FILE_LOCK","MAKE_LINK","GET_FILE_HASH","SET_FILE_MOD_TIME","GET_FILE_HASH_RANGE","FILE_SET_IMMUTABLE_HINT","GET_SIZE_OF_PATH_CONTENTS","REMOVE_PATH_AND_CONTENTS","DIR_OPEN","DIR_OPEN_RESULT","DIR_READ","DIR_CLOSE","FILE_READ_OFFSET","FILE_WRITE_OFFSET","AFC_STATUS","SUCCESS","UNKNOWN_ERROR","OP_HEADER_INVALID","NO_RESOURCES","READ_ERROR","WRITE_ERROR","UNKNOWN_PACKET_TYPE","INVALID_ARG","OBJECT_NOT_FOUND","OBJECT_IS_DIR","PERM_DENIED","SERVICE_NOT_CONNECTED","OP_TIMEOUT","TOO_MUCH_DATA","END_OF_DATA","OP_NOT_SUPPORTED","OBJECT_EXISTS","OBJECT_BUSY","NO_SPACE_LEFT","OP_WOULD_BLOCK","IO_ERROR","OP_INTERRUPTED","OP_IN_PROGRESS","INTERNAL_ERROR","MUX_ERROR","NO_MEM","NOT_ENOUGH_DATA","DIR_NOT_EMPTY","FORCE_SIGNED_TYPE","AFC_FILE_OPEN_FLAGS","RDONLY","RW","WRONLY","WR","APPEND","RDAPPEND","isAFCResponse","resp","operation","undefined","id","data","isStatusResponse","isErrorStatusResponse","AFCInternalError","Error","constructor","msg","requestId","status","ProtocolClient","requestCallbacks","socket","ProtocolReaderFactory","reader","readerFactory","create","err","on","onData","sendMessage","Promise","resolve","reject","CommandError","writer","write","ProtocolReader","callback","parseHeader","magic","slice","toString","readUInt32LE","header","totalLength","headerLength","JSON","stringify","parseBody","body","length","Array","prototype","call","payload","dataLength","payloadLength","Buffer","alloc","from","copy","writeUInt32LE"],"mappings":"AAAA;;;;;;CAMC,GACD;;;;;;;;;;;;;;IASaA,SAAS,MAATA,SAAS;IACTC,eAAe,MAAfA,eAAe;IA0UfC,QAAQ,MAARA,QAAQ;IASRC,iBAAiB,MAAjBA,iBAAiB;IAsCjBC,iBAAiB,MAAjBA,iBAAiB;IAkDjBC,iBAAiB,MAAjBA,iBAAiB;;;8DArbZ,OAAO;;;;;;kCAI6C,oBAAoB;wBAC7D,0BAA0B;;;;;;AAEvD,MAAMC,KAAK,GAAGC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AAC,WAAW,EAAExC,IAAI,CAACwC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACtF,IAAII,OAAO,EAAE;YACXjC,MAAM,CAACc,KAAK,CAACmB,OAAO,CAAC,CAAC;QACxB,CAAC;IACH;CACD"}
|
|
@@ -15,31 +15,21 @@ function _export(target, all) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
_export(exports, {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
ProtocolClientError: function() {
|
|
25
|
-
return ProtocolClientError;
|
|
26
|
-
},
|
|
27
|
-
ProtocolReader: function() {
|
|
28
|
-
return ProtocolReader;
|
|
29
|
-
},
|
|
30
|
-
ProtocolReaderFactory: function() {
|
|
31
|
-
return ProtocolReaderFactory;
|
|
32
|
-
}
|
|
18
|
+
ProtocolClientError: ()=>ProtocolClientError,
|
|
19
|
+
ProtocolReaderFactory: ()=>ProtocolReaderFactory,
|
|
20
|
+
ProtocolReader: ()=>ProtocolReader,
|
|
21
|
+
PlistProtocolReader: ()=>PlistProtocolReader,
|
|
22
|
+
ProtocolClient: ()=>ProtocolClient
|
|
33
23
|
});
|
|
34
24
|
function _plist() {
|
|
35
|
-
const data = /*#__PURE__*/
|
|
25
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/plist"));
|
|
36
26
|
_plist = function() {
|
|
37
27
|
return data;
|
|
38
28
|
};
|
|
39
29
|
return data;
|
|
40
30
|
}
|
|
41
31
|
function _debug() {
|
|
42
|
-
const data = /*#__PURE__*/
|
|
32
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("debug"));
|
|
43
33
|
_debug = function() {
|
|
44
34
|
return data;
|
|
45
35
|
};
|
|
@@ -47,16 +37,18 @@ function _debug() {
|
|
|
47
37
|
}
|
|
48
38
|
const _errors = require("../../../../utils/errors");
|
|
49
39
|
const _plist1 = require("../../../../utils/plist");
|
|
50
|
-
function
|
|
40
|
+
function _interopRequireDefault(obj) {
|
|
51
41
|
return obj && obj.__esModule ? obj : {
|
|
52
42
|
default: obj
|
|
53
43
|
};
|
|
54
44
|
}
|
|
55
|
-
const BPLIST_MAGIC = Buffer.from(
|
|
56
|
-
const debug = (0, _debug().default)(
|
|
45
|
+
const BPLIST_MAGIC = Buffer.from("bplist00");
|
|
46
|
+
const debug = (0, _debug().default)("expo:apple-device:protocol");
|
|
57
47
|
class ProtocolClientError extends _errors.CommandError {
|
|
58
48
|
constructor(msg, error, protocolMessage){
|
|
59
|
-
super(msg)
|
|
49
|
+
super(msg);
|
|
50
|
+
this.error = error;
|
|
51
|
+
this.protocolMessage = protocolMessage;
|
|
60
52
|
}
|
|
61
53
|
}
|
|
62
54
|
class ProtocolReaderFactory {
|
|
@@ -124,7 +116,7 @@ class PlistProtocolReader extends ProtocolReader {
|
|
|
124
116
|
if (BPLIST_MAGIC.compare(body, 0, 8) === 0) {
|
|
125
117
|
return (0, _plist1.parsePlistBuffer)(body);
|
|
126
118
|
} else {
|
|
127
|
-
return _plist().default.parse(body.toString(
|
|
119
|
+
return _plist().default.parse(body.toString("utf8"));
|
|
128
120
|
}
|
|
129
121
|
}
|
|
130
122
|
}
|
|
@@ -136,7 +128,7 @@ class ProtocolClient {
|
|
|
136
128
|
}
|
|
137
129
|
sendMessage(msg, callback) {
|
|
138
130
|
const onError = (error)=>{
|
|
139
|
-
debug(
|
|
131
|
+
debug("Unexpected protocol socket error encountered: %s", error);
|
|
140
132
|
throw new ProtocolClientError(`Unexpected protocol error encountered: ${error.message}`, error, msg);
|
|
141
133
|
};
|
|
142
134
|
return new Promise((resolve, reject)=>{
|
|
@@ -147,18 +139,18 @@ class ProtocolClient {
|
|
|
147
139
|
}
|
|
148
140
|
if (callback) {
|
|
149
141
|
callback(response, (value)=>{
|
|
150
|
-
this.socket.removeListener(
|
|
151
|
-
this.socket.removeListener(
|
|
142
|
+
this.socket.removeListener("data", reader.onData);
|
|
143
|
+
this.socket.removeListener("error", onError);
|
|
152
144
|
resolve(value);
|
|
153
145
|
}, reject);
|
|
154
146
|
} else {
|
|
155
|
-
this.socket.removeListener(
|
|
156
|
-
this.socket.removeListener(
|
|
147
|
+
this.socket.removeListener("data", reader.onData);
|
|
148
|
+
this.socket.removeListener("error", onError);
|
|
157
149
|
resolve(response);
|
|
158
150
|
}
|
|
159
151
|
});
|
|
160
|
-
this.socket.on(
|
|
161
|
-
this.socket.on(
|
|
152
|
+
this.socket.on("data", reader.onData);
|
|
153
|
+
this.socket.on("error", onError);
|
|
162
154
|
this.writer.write(this.socket, msg);
|
|
163
155
|
});
|
|
164
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/AbstractProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport plist from '@expo/plist';\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport { CommandError } from '../../../../utils/errors';\nimport { parsePlistBuffer } from '../../../../utils/plist';\n\nconst BPLIST_MAGIC = Buffer.from('bplist00');\nconst debug = Debug('expo:apple-device:protocol');\n\nexport class ProtocolClientError extends CommandError {\n constructor(\n msg: string,\n public error: Error,\n public protocolMessage?: any\n ) {\n super(msg);\n }\n}\n\nexport type ProtocolReaderCallback = (resp: any, err?: Error) => void;\n\nexport class ProtocolReaderFactory<T> {\n constructor(private ProtocolReader: new (callback: ProtocolReaderCallback) => T) {}\n\n create(callback: (resp: any, err?: Error) => void): T {\n return new this.ProtocolReader(callback);\n }\n}\n\nexport abstract class ProtocolReader {\n protected body!: Buffer; // TODO: ! -> ?\n protected bodyLength!: number; // TODO: ! -> ?\n protected buffer = Buffer.alloc(0);\n constructor(\n protected headerSize: number,\n protected callback: ProtocolReaderCallback\n ) {\n this.onData = this.onData.bind(this);\n }\n\n /** Returns length of body, or -1 if header doesn't contain length */\n protected abstract parseHeader(data: Buffer): number;\n protected abstract parseBody(data: Buffer): any;\n\n onData(data?: Buffer) {\n try {\n // if there's data, add it on to existing buffer\n this.buffer = data ? Buffer.concat([this.buffer, data]) : this.buffer;\n // we haven't gotten the body length from the header yet\n if (!this.bodyLength) {\n if (this.buffer.length < this.headerSize) {\n // partial header, wait for rest\n return;\n }\n this.bodyLength = this.parseHeader(this.buffer);\n // move on to body\n this.buffer = this.buffer.slice(this.headerSize);\n if (!this.buffer.length) {\n // only got header, wait for body\n return;\n }\n }\n if (this.buffer.length < this.bodyLength) {\n // wait for rest of body\n return;\n }\n\n if (this.bodyLength === -1) {\n this.callback(this.parseBody(this.buffer));\n this.buffer = Buffer.alloc(0);\n } else {\n this.body = this.buffer.slice(0, this.bodyLength);\n this.bodyLength -= this.body.length;\n if (!this.bodyLength) {\n this.callback(this.parseBody(this.body));\n }\n this.buffer = this.buffer.slice(this.body.length);\n // There are multiple messages here, call parse again\n if (this.buffer.length) {\n this.onData();\n }\n }\n } catch (err: any) {\n this.callback(null, err);\n }\n }\n}\n\nexport abstract class PlistProtocolReader extends ProtocolReader {\n protected parseBody(body: Buffer) {\n if (BPLIST_MAGIC.compare(body, 0, 8) === 0) {\n return parsePlistBuffer(body);\n } else {\n return plist.parse(body.toString('utf8'));\n }\n }\n}\n\nexport interface ProtocolWriter {\n write(sock: Socket, msg: any): void;\n}\n\nexport abstract class ProtocolClient<MessageType = any> {\n constructor(\n public socket: Socket,\n protected readerFactory: ProtocolReaderFactory<ProtocolReader>,\n protected writer: ProtocolWriter\n ) {}\n\n sendMessage<ResponseType = any>(msg: MessageType): Promise<ResponseType>;\n sendMessage<CallbackType = void, ResponseType = any>(\n msg: MessageType,\n callback: (response: ResponseType, resolve: any, reject: any) => void\n ): Promise<CallbackType>;\n sendMessage<CallbackType = void, ResponseType = any>(\n msg: MessageType,\n callback?: (response: ResponseType, resolve: any, reject: any) => void\n ): Promise<CallbackType | ResponseType> {\n const onError = (error: Error) => {\n debug('Unexpected protocol socket error encountered: %s', error);\n throw new ProtocolClientError(\n `Unexpected protocol error encountered: ${error.message}`,\n error,\n msg\n );\n };\n\n return new Promise<ResponseType | CallbackType>((resolve, reject) => {\n const reader = this.readerFactory.create(async (response: ResponseType, error?: Error) => {\n if (error) {\n reject(error);\n return;\n }\n if (callback) {\n callback(\n response,\n (value: any) => {\n this.socket.removeListener('data', reader.onData);\n this.socket.removeListener('error', onError);\n resolve(value);\n },\n reject\n );\n } else {\n this.socket.removeListener('data', reader.onData);\n this.socket.removeListener('error', onError);\n resolve(response);\n }\n });\n this.socket.on('data', reader.onData);\n this.socket.on('error', onError);\n this.writer.write(this.socket, msg);\n });\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/AbstractProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport plist from '@expo/plist';\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport { CommandError } from '../../../../utils/errors';\nimport { parsePlistBuffer } from '../../../../utils/plist';\n\nconst BPLIST_MAGIC = Buffer.from('bplist00');\nconst debug = Debug('expo:apple-device:protocol');\n\nexport class ProtocolClientError extends CommandError {\n constructor(\n msg: string,\n public error: Error,\n public protocolMessage?: any\n ) {\n super(msg);\n }\n}\n\nexport type ProtocolReaderCallback = (resp: any, err?: Error) => void;\n\nexport class ProtocolReaderFactory<T> {\n constructor(private ProtocolReader: new (callback: ProtocolReaderCallback) => T) {}\n\n create(callback: (resp: any, err?: Error) => void): T {\n return new this.ProtocolReader(callback);\n }\n}\n\nexport abstract class ProtocolReader {\n protected body!: Buffer; // TODO: ! -> ?\n protected bodyLength!: number; // TODO: ! -> ?\n protected buffer = Buffer.alloc(0);\n constructor(\n protected headerSize: number,\n protected callback: ProtocolReaderCallback\n ) {\n this.onData = this.onData.bind(this);\n }\n\n /** Returns length of body, or -1 if header doesn't contain length */\n protected abstract parseHeader(data: Buffer): number;\n protected abstract parseBody(data: Buffer): any;\n\n onData(data?: Buffer) {\n try {\n // if there's data, add it on to existing buffer\n this.buffer = data ? Buffer.concat([this.buffer, data]) : this.buffer;\n // we haven't gotten the body length from the header yet\n if (!this.bodyLength) {\n if (this.buffer.length < this.headerSize) {\n // partial header, wait for rest\n return;\n }\n this.bodyLength = this.parseHeader(this.buffer);\n // move on to body\n this.buffer = this.buffer.slice(this.headerSize);\n if (!this.buffer.length) {\n // only got header, wait for body\n return;\n }\n }\n if (this.buffer.length < this.bodyLength) {\n // wait for rest of body\n return;\n }\n\n if (this.bodyLength === -1) {\n this.callback(this.parseBody(this.buffer));\n this.buffer = Buffer.alloc(0);\n } else {\n this.body = this.buffer.slice(0, this.bodyLength);\n this.bodyLength -= this.body.length;\n if (!this.bodyLength) {\n this.callback(this.parseBody(this.body));\n }\n this.buffer = this.buffer.slice(this.body.length);\n // There are multiple messages here, call parse again\n if (this.buffer.length) {\n this.onData();\n }\n }\n } catch (err: any) {\n this.callback(null, err);\n }\n }\n}\n\nexport abstract class PlistProtocolReader extends ProtocolReader {\n protected parseBody(body: Buffer) {\n if (BPLIST_MAGIC.compare(body, 0, 8) === 0) {\n return parsePlistBuffer(body);\n } else {\n return plist.parse(body.toString('utf8'));\n }\n }\n}\n\nexport interface ProtocolWriter {\n write(sock: Socket, msg: any): void;\n}\n\nexport abstract class ProtocolClient<MessageType = any> {\n constructor(\n public socket: Socket,\n protected readerFactory: ProtocolReaderFactory<ProtocolReader>,\n protected writer: ProtocolWriter\n ) {}\n\n sendMessage<ResponseType = any>(msg: MessageType): Promise<ResponseType>;\n sendMessage<CallbackType = void, ResponseType = any>(\n msg: MessageType,\n callback: (response: ResponseType, resolve: any, reject: any) => void\n ): Promise<CallbackType>;\n sendMessage<CallbackType = void, ResponseType = any>(\n msg: MessageType,\n callback?: (response: ResponseType, resolve: any, reject: any) => void\n ): Promise<CallbackType | ResponseType> {\n const onError = (error: Error) => {\n debug('Unexpected protocol socket error encountered: %s', error);\n throw new ProtocolClientError(\n `Unexpected protocol error encountered: ${error.message}`,\n error,\n msg\n );\n };\n\n return new Promise<ResponseType | CallbackType>((resolve, reject) => {\n const reader = this.readerFactory.create(async (response: ResponseType, error?: Error) => {\n if (error) {\n reject(error);\n return;\n }\n if (callback) {\n callback(\n response,\n (value: any) => {\n this.socket.removeListener('data', reader.onData);\n this.socket.removeListener('error', onError);\n resolve(value);\n },\n reject\n );\n } else {\n this.socket.removeListener('data', reader.onData);\n this.socket.removeListener('error', onError);\n resolve(response);\n }\n });\n this.socket.on('data', reader.onData);\n this.socket.on('error', onError);\n this.writer.write(this.socket, msg);\n });\n }\n}\n"],"names":["ProtocolClientError","ProtocolReaderFactory","ProtocolReader","PlistProtocolReader","ProtocolClient","BPLIST_MAGIC","Buffer","from","debug","Debug","CommandError","constructor","msg","error","protocolMessage","create","callback","headerSize","buffer","alloc","onData","bind","data","concat","bodyLength","length","parseHeader","slice","parseBody","body","err","compare","parsePlistBuffer","plist","parse","toString","socket","readerFactory","writer","sendMessage","onError","message","Promise","resolve","reject","reader","response","value","removeListener","on","write"],"mappings":"AAAA;;;;;;CAMC,GACD;;;;;;;;;;;IAUaA,mBAAmB,MAAnBA,mBAAmB;IAYnBC,qBAAqB,MAArBA,qBAAqB;IAQZC,cAAc,MAAdA,cAAc;IA2DdC,mBAAmB,MAAnBA,mBAAmB;IAcnBC,cAAc,MAAdA,cAAc;;;8DAvGlB,aAAa;;;;;;;8DACb,OAAO;;;;;;wBAGI,0BAA0B;wBACtB,yBAAyB;;;;;;AAE1D,MAAMC,YAAY,GAAGC,MAAM,CAACC,IAAI,CAAC,UAAU,CAAC,AAAC;AAC7C,MAAMC,KAAK,GAAGC,IAAAA,MAAK,EAAA,QAAA,EAAC,4BAA4B,CAAC,AAAC;AAE3C,MAAMT,mBAAmB,SAASU,OAAY,aAAA;IACnDC,YACEC,GAAW,EACJ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AO;oBACL,IAAI,CAACR,MAAM,CAACY,cAAc,CAAC,MAAM,EAAEH,MAAM,CAACzB,MAAM,CAAC,CAAC;oBAClD,IAAI,CAACgB,MAAM,CAACY,cAAc,CAAC,OAAO,EAAER,OAAO,CAAC,CAAC;oBAC7CG,OAAO,CAACG,QAAQ,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,AAAC;YACH,IAAI,CAACV,MAAM,CAACa,EAAE,CAAC,MAAM,EAAEJ,MAAM,CAACzB,MAAM,CAAC,CAAC;YACtC,IAAI,CAACgB,MAAM,CAACa,EAAE,CAAC,OAAO,EAAET,OAAO,CAAC,CAAC;YACjC,IAAI,CAACF,MAAM,CAACY,KAAK,CAAC,IAAI,CAACd,MAAM,EAAExB,GAAG,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL;CACD"}
|
|
@@ -15,41 +15,33 @@ function _export(target, all) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
_export(exports, {
|
|
18
|
-
GDBProtocolClient:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return GDBProtocolReader;
|
|
23
|
-
},
|
|
24
|
-
GDBProtocolWriter: function() {
|
|
25
|
-
return GDBProtocolWriter;
|
|
26
|
-
},
|
|
27
|
-
validateChecksum: function() {
|
|
28
|
-
return validateChecksum;
|
|
29
|
-
}
|
|
18
|
+
GDBProtocolClient: ()=>GDBProtocolClient,
|
|
19
|
+
GDBProtocolReader: ()=>GDBProtocolReader,
|
|
20
|
+
GDBProtocolWriter: ()=>GDBProtocolWriter,
|
|
21
|
+
validateChecksum: ()=>validateChecksum
|
|
30
22
|
});
|
|
31
23
|
function _debug() {
|
|
32
|
-
const data = /*#__PURE__*/
|
|
24
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("debug"));
|
|
33
25
|
_debug = function() {
|
|
34
26
|
return data;
|
|
35
27
|
};
|
|
36
28
|
return data;
|
|
37
29
|
}
|
|
38
|
-
const
|
|
30
|
+
const _abstractProtocol = require("./AbstractProtocol");
|
|
39
31
|
const _errors = require("../../../../utils/errors");
|
|
40
|
-
function
|
|
32
|
+
function _interopRequireDefault(obj) {
|
|
41
33
|
return obj && obj.__esModule ? obj : {
|
|
42
34
|
default: obj
|
|
43
35
|
};
|
|
44
36
|
}
|
|
45
|
-
const debug = (0, _debug().default)(
|
|
46
|
-
const ACK_SUCCESS =
|
|
47
|
-
class GDBProtocolClient extends
|
|
37
|
+
const debug = (0, _debug().default)("expo:apple-device:protocol:gdb");
|
|
38
|
+
const ACK_SUCCESS = "+".charCodeAt(0);
|
|
39
|
+
class GDBProtocolClient extends _abstractProtocol.ProtocolClient {
|
|
48
40
|
constructor(socket){
|
|
49
|
-
super(socket, new
|
|
41
|
+
super(socket, new _abstractProtocol.ProtocolReaderFactory(GDBProtocolReader), new GDBProtocolWriter());
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
|
-
class GDBProtocolReader extends
|
|
44
|
+
class GDBProtocolReader extends _abstractProtocol.ProtocolReader {
|
|
53
45
|
constructor(callback){
|
|
54
46
|
super(1 /* "Header" is '+' or '-' */ , callback);
|
|
55
47
|
}
|
|
@@ -71,7 +63,7 @@ class GDBProtocolReader extends _AbstractProtocol.ProtocolReader {
|
|
|
71
63
|
// we have a valid header so check the body. GDB packets will always be a leading '$', data bytes,
|
|
72
64
|
// a trailing '#', and a two digit checksum. minimum valid body is the empty response '$#00'
|
|
73
65
|
// https://developer.apple.com/library/archive/documentation/DeveloperTools/gdb/gdb/gdb_33.html
|
|
74
|
-
const packetData = this.buffer.toString().match(
|
|
66
|
+
const packetData = this.buffer.toString().match("\\$.*#[0-9a-f]{2}");
|
|
75
67
|
if (packetData == null) {
|
|
76
68
|
return; // incomplete body, wait for more
|
|
77
69
|
}
|
|
@@ -90,7 +82,7 @@ class GDBProtocolReader extends _AbstractProtocol.ProtocolReader {
|
|
|
90
82
|
}
|
|
91
83
|
parseHeader(data) {
|
|
92
84
|
if (data[0] !== ACK_SUCCESS) {
|
|
93
|
-
throw new _errors.CommandError(
|
|
85
|
+
throw new _errors.CommandError("APPLE_DEVICE_GDB", "Unsuccessful debugserver response");
|
|
94
86
|
} // TODO: retry?
|
|
95
87
|
return -1;
|
|
96
88
|
}
|
|
@@ -103,26 +95,26 @@ class GDBProtocolReader extends _AbstractProtocol.ProtocolReader {
|
|
|
103
95
|
const msg = buffer.slice(1, -3).toString();
|
|
104
96
|
if (validateChecksum(checksum, msg)) {
|
|
105
97
|
return msg;
|
|
106
|
-
} else if (msg.startsWith(
|
|
98
|
+
} else if (msg.startsWith("E")) {
|
|
107
99
|
if (msg.match(/the device was not, or could not be, unlocked/)) {
|
|
108
|
-
throw new _errors.CommandError(
|
|
100
|
+
throw new _errors.CommandError("APPLE_DEVICE_LOCKED", "Device is currently locked.");
|
|
109
101
|
}
|
|
110
102
|
// Error message from debugserver -- Drop the `E`
|
|
111
103
|
return msg.slice(1);
|
|
112
104
|
} else {
|
|
113
|
-
throw new _errors.CommandError(
|
|
105
|
+
throw new _errors.CommandError("APPLE_DEVICE_GDB", `Invalid checksum received from debugserver. (checksum: ${checksum}, msg: ${msg})`);
|
|
114
106
|
}
|
|
115
107
|
} else {
|
|
116
|
-
throw new _errors.CommandError(
|
|
108
|
+
throw new _errors.CommandError("APPLE_DEVICE_GDB", "Didn't receive checksum");
|
|
117
109
|
}
|
|
118
110
|
}
|
|
119
111
|
}
|
|
120
112
|
class GDBProtocolWriter {
|
|
121
113
|
write(socket, msg) {
|
|
122
|
-
const { cmd, args
|
|
114
|
+
const { cmd , args } = msg;
|
|
123
115
|
debug(`Socket write: ${cmd}, args: ${args}`);
|
|
124
116
|
// hex encode and concat all args
|
|
125
|
-
const encodedArgs = args.map((arg)=>Buffer.from(arg).toString(
|
|
117
|
+
const encodedArgs = args.map((arg)=>Buffer.from(arg).toString("hex")).join().toUpperCase();
|
|
126
118
|
const checksumStr = calculateChecksum(cmd + encodedArgs);
|
|
127
119
|
const formattedCmd = `$${cmd}${encodedArgs}#${checksumStr}`;
|
|
128
120
|
socket.write(formattedCmd);
|
|
@@ -143,7 +135,7 @@ function calculateChecksum(cmdStr) {
|
|
|
143
135
|
}
|
|
144
136
|
function validateChecksum(checksum, msg) {
|
|
145
137
|
// remove '#' from checksum
|
|
146
|
-
const checksumVal = checksum.startsWith(
|
|
138
|
+
const checksumVal = checksum.startsWith("#") ? checksum.slice(1) : checksum;
|
|
147
139
|
// remove '$' from msg and calculate its checksum
|
|
148
140
|
const computedChecksum = calculateChecksum(msg);
|
|
149
141
|
// debug(`Checksum: ${checksumVal}, computed checksum: ${computedChecksum}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/GDBProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport {\n ProtocolClient,\n ProtocolReader,\n ProtocolReaderCallback,\n ProtocolReaderFactory,\n ProtocolWriter,\n} from './AbstractProtocol';\nimport { CommandError } from '../../../../utils/errors';\n\nconst debug = Debug('expo:apple-device:protocol:gdb');\nconst ACK_SUCCESS = '+'.charCodeAt(0);\n\nexport interface GDBMessage {\n cmd: string;\n args: string[];\n}\n\nexport class GDBProtocolClient extends ProtocolClient<GDBMessage> {\n constructor(socket: Socket) {\n super(socket, new ProtocolReaderFactory(GDBProtocolReader), new GDBProtocolWriter());\n }\n}\n\nexport class GDBProtocolReader extends ProtocolReader {\n constructor(callback: ProtocolReaderCallback) {\n super(1 /* \"Header\" is '+' or '-' */, callback);\n }\n\n onData(data?: Buffer) {\n // the GDB protocol does not support body length in its header so we cannot rely on\n // the parent implementation to determine when a payload is complete\n try {\n // if there's data, add it to the existing buffer\n this.buffer = data ? Buffer.concat([this.buffer, data]) : this.buffer;\n\n // do we have enough bytes to proceed\n if (this.buffer.length < this.headerSize) {\n return; // incomplete header, wait for more\n }\n\n // first, check the header\n if (this.parseHeader(this.buffer) === -1) {\n // we have a valid header so check the body. GDB packets will always be a leading '$', data bytes,\n // a trailing '#', and a two digit checksum. minimum valid body is the empty response '$#00'\n // https://developer.apple.com/library/archive/documentation/DeveloperTools/gdb/gdb/gdb_33.html\n const packetData = this.buffer.toString().match('\\\\$.*#[0-9a-f]{2}');\n if (packetData == null) {\n return; // incomplete body, wait for more\n }\n // extract the body and update the buffer\n const body = Buffer.from(packetData[0]);\n this.buffer = this.buffer.slice(this.headerSize + body.length);\n // parse the payload and recurse if there is more data to process\n this.callback(this.parseBody(body));\n if (this.buffer.length) {\n this.onData();\n }\n }\n } catch (err: any) {\n this.callback(null, err);\n }\n }\n\n parseHeader(data: Buffer) {\n if (data[0] !== ACK_SUCCESS) {\n throw new CommandError('APPLE_DEVICE_GDB', 'Unsuccessful debugserver response');\n } // TODO: retry?\n return -1;\n }\n\n parseBody(buffer: Buffer) {\n debug(`Response body: ${buffer.toString()}`);\n // check for checksum\n const checksum = buffer.slice(-3).toString();\n if (checksum.match(/#[0-9a-f]{2}/)) {\n // remove '$' prefix and checksum\n const msg = buffer.slice(1, -3).toString();\n if (validateChecksum(checksum, msg)) {\n return msg;\n } else if (msg.startsWith('E')) {\n if (msg.match(/the device was not, or could not be, unlocked/)) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is currently locked.');\n }\n\n // Error message from debugserver -- Drop the `E`\n return msg.slice(1);\n } else {\n throw new CommandError(\n 'APPLE_DEVICE_GDB',\n `Invalid checksum received from debugserver. (checksum: ${checksum}, msg: ${msg})`\n );\n }\n } else {\n throw new CommandError('APPLE_DEVICE_GDB', \"Didn't receive checksum\");\n }\n }\n}\n\nexport class GDBProtocolWriter implements ProtocolWriter {\n write(socket: Socket, msg: GDBMessage) {\n const { cmd, args } = msg;\n debug(`Socket write: ${cmd}, args: ${args}`);\n // hex encode and concat all args\n const encodedArgs = args\n .map((arg) => Buffer.from(arg).toString('hex'))\n .join()\n .toUpperCase();\n const checksumStr = calculateChecksum(cmd + encodedArgs);\n const formattedCmd = `$${cmd}${encodedArgs}#${checksumStr}`;\n socket.write(formattedCmd);\n }\n}\n\n// hex value of (sum of cmd chars mod 256)\nfunction calculateChecksum(cmdStr: string) {\n let checksum = 0;\n for (let i = 0; i < cmdStr.length; i++) {\n checksum += cmdStr.charCodeAt(i);\n }\n let result = (checksum % 256).toString(16);\n // pad if necessary\n if (result.length === 1) {\n result = `0${result}`;\n }\n return result;\n}\n\nexport function validateChecksum(checksum: string, msg: string) {\n // remove '#' from checksum\n const checksumVal = checksum.startsWith('#') ? checksum.slice(1) : checksum;\n // remove '$' from msg and calculate its checksum\n const computedChecksum = calculateChecksum(msg);\n // debug(`Checksum: ${checksumVal}, computed checksum: ${computedChecksum}`);\n return checksumVal === computedChecksum;\n}\n"],"names":["GDBProtocolClient","GDBProtocolReader","GDBProtocolWriter","validateChecksum","debug","Debug","ACK_SUCCESS","charCodeAt","ProtocolClient","constructor","socket","ProtocolReaderFactory","ProtocolReader","callback","onData","data","buffer","Buffer","concat","length","headerSize","parseHeader","packetData","toString","match","body","from","slice","parseBody","err","CommandError","checksum","msg","startsWith","write","cmd","args","encodedArgs","map","arg","join","toUpperCase","checksumStr","calculateChecksum","formattedCmd","cmdStr","i","result","checksumVal","computedChecksum"],"mappings":"AAAA;;;;;;CAMC;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/GDBProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport {\n ProtocolClient,\n ProtocolReader,\n ProtocolReaderCallback,\n ProtocolReaderFactory,\n ProtocolWriter,\n} from './AbstractProtocol';\nimport { CommandError } from '../../../../utils/errors';\n\nconst debug = Debug('expo:apple-device:protocol:gdb');\nconst ACK_SUCCESS = '+'.charCodeAt(0);\n\nexport interface GDBMessage {\n cmd: string;\n args: string[];\n}\n\nexport class GDBProtocolClient extends ProtocolClient<GDBMessage> {\n constructor(socket: Socket) {\n super(socket, new ProtocolReaderFactory(GDBProtocolReader), new GDBProtocolWriter());\n }\n}\n\nexport class GDBProtocolReader extends ProtocolReader {\n constructor(callback: ProtocolReaderCallback) {\n super(1 /* \"Header\" is '+' or '-' */, callback);\n }\n\n onData(data?: Buffer) {\n // the GDB protocol does not support body length in its header so we cannot rely on\n // the parent implementation to determine when a payload is complete\n try {\n // if there's data, add it to the existing buffer\n this.buffer = data ? Buffer.concat([this.buffer, data]) : this.buffer;\n\n // do we have enough bytes to proceed\n if (this.buffer.length < this.headerSize) {\n return; // incomplete header, wait for more\n }\n\n // first, check the header\n if (this.parseHeader(this.buffer) === -1) {\n // we have a valid header so check the body. GDB packets will always be a leading '$', data bytes,\n // a trailing '#', and a two digit checksum. minimum valid body is the empty response '$#00'\n // https://developer.apple.com/library/archive/documentation/DeveloperTools/gdb/gdb/gdb_33.html\n const packetData = this.buffer.toString().match('\\\\$.*#[0-9a-f]{2}');\n if (packetData == null) {\n return; // incomplete body, wait for more\n }\n // extract the body and update the buffer\n const body = Buffer.from(packetData[0]);\n this.buffer = this.buffer.slice(this.headerSize + body.length);\n // parse the payload and recurse if there is more data to process\n this.callback(this.parseBody(body));\n if (this.buffer.length) {\n this.onData();\n }\n }\n } catch (err: any) {\n this.callback(null, err);\n }\n }\n\n parseHeader(data: Buffer) {\n if (data[0] !== ACK_SUCCESS) {\n throw new CommandError('APPLE_DEVICE_GDB', 'Unsuccessful debugserver response');\n } // TODO: retry?\n return -1;\n }\n\n parseBody(buffer: Buffer) {\n debug(`Response body: ${buffer.toString()}`);\n // check for checksum\n const checksum = buffer.slice(-3).toString();\n if (checksum.match(/#[0-9a-f]{2}/)) {\n // remove '$' prefix and checksum\n const msg = buffer.slice(1, -3).toString();\n if (validateChecksum(checksum, msg)) {\n return msg;\n } else if (msg.startsWith('E')) {\n if (msg.match(/the device was not, or could not be, unlocked/)) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is currently locked.');\n }\n\n // Error message from debugserver -- Drop the `E`\n return msg.slice(1);\n } else {\n throw new CommandError(\n 'APPLE_DEVICE_GDB',\n `Invalid checksum received from debugserver. (checksum: ${checksum}, msg: ${msg})`\n );\n }\n } else {\n throw new CommandError('APPLE_DEVICE_GDB', \"Didn't receive checksum\");\n }\n }\n}\n\nexport class GDBProtocolWriter implements ProtocolWriter {\n write(socket: Socket, msg: GDBMessage) {\n const { cmd, args } = msg;\n debug(`Socket write: ${cmd}, args: ${args}`);\n // hex encode and concat all args\n const encodedArgs = args\n .map((arg) => Buffer.from(arg).toString('hex'))\n .join()\n .toUpperCase();\n const checksumStr = calculateChecksum(cmd + encodedArgs);\n const formattedCmd = `$${cmd}${encodedArgs}#${checksumStr}`;\n socket.write(formattedCmd);\n }\n}\n\n// hex value of (sum of cmd chars mod 256)\nfunction calculateChecksum(cmdStr: string) {\n let checksum = 0;\n for (let i = 0; i < cmdStr.length; i++) {\n checksum += cmdStr.charCodeAt(i);\n }\n let result = (checksum % 256).toString(16);\n // pad if necessary\n if (result.length === 1) {\n result = `0${result}`;\n }\n return result;\n}\n\nexport function validateChecksum(checksum: string, msg: string) {\n // remove '#' from checksum\n const checksumVal = checksum.startsWith('#') ? checksum.slice(1) : checksum;\n // remove '$' from msg and calculate its checksum\n const computedChecksum = calculateChecksum(msg);\n // debug(`Checksum: ${checksumVal}, computed checksum: ${computedChecksum}`);\n return checksumVal === computedChecksum;\n}\n"],"names":["GDBProtocolClient","GDBProtocolReader","GDBProtocolWriter","validateChecksum","debug","Debug","ACK_SUCCESS","charCodeAt","ProtocolClient","constructor","socket","ProtocolReaderFactory","ProtocolReader","callback","onData","data","buffer","Buffer","concat","length","headerSize","parseHeader","packetData","toString","match","body","from","slice","parseBody","err","CommandError","checksum","msg","startsWith","write","cmd","args","encodedArgs","map","arg","join","toUpperCase","checksumStr","calculateChecksum","formattedCmd","cmdStr","i","result","checksumVal","computedChecksum"],"mappings":"AAAA;;;;;;CAMC,GACD;;;;;;;;;;;IAoBaA,iBAAiB,MAAjBA,iBAAiB;IAMjBC,iBAAiB,MAAjBA,iBAAiB;IA2EjBC,iBAAiB,MAAjBA,iBAAiB;IA6BdC,gBAAgB,MAAhBA,gBAAgB;;;8DAlId,OAAO;;;;;;kCASlB,oBAAoB;wBACE,0BAA0B;;;;;;AAEvD,MAAMC,KAAK,GAAGC,IAAAA,MAAK,EAAA,QAAA,EAAC,gCAAgC,CAAC,AAAC;AACtD,MAAMC,WAAW,GAAG,GAAG,CAACC,UAAU,CAAC,CAAC,CAAC,AAAC;AAO/B,MAAMP,iBAAiB,SAASQ,iBAAc,eAAA;IACnDC,YAAYC,MAAc,CAAE;QAC1B,KAAK,CAACA,MAAM,EAAE,IAAIC,iBAAqB,sBAAA,CAACV,iBAAiB,CAAC,EAAE,IAAIC,iBAAiB,EAAE,CAAC,CAAC;IACvF;CACD;AAEM,MAAMD,iBAAiB,SAASW,iBAAc,eAAA;IACnDH,YAAYI,QAAgC,CAAE;QAC5C,KAAK,CAAC,CAAC,CAAC,0BAA0B,KAAIA,QAAQ,CAAC,CAAC;IAClD;IAEAC,MAAM,CAACC,IAAa,EAAE;QACpB,mFAAmF;QACnF,oEAAoE;QACpE,IAAI;YACF,iDAAiD;YACjD,IAAI,CAACC,MAAM,GAAGD,IAAI,GAAGE,MAAM,CAACC,MAAM,CAAC;gBAAC,IAAI,CAACF,MAAM;gBAAED,IAAI;aAAC,CAAC,GAAG,IAAI,CAACC,MAAM,CAAC;YAEtE,qCAAqC;YACrC,IAAI,IAAI,CAACA,MAAM,CAACG,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;gBACxC,OAAO,CAAC,mCAAmC;YAC7C,CAAC;YAED,0BAA0B;YAC1B,IAAI,IAAI,CAACC,WAAW,CAAC,IAAI,CAACL,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,38 @@ function _export(target, all) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
_export(exports, {
|
|
18
|
-
LOCKDOWN_HEADER_SIZE:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
LockdownProtocolClient:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
LockdownProtocolReader: function() {
|
|
25
|
-
return LockdownProtocolReader;
|
|
26
|
-
},
|
|
27
|
-
LockdownProtocolWriter: function() {
|
|
28
|
-
return LockdownProtocolWriter;
|
|
29
|
-
},
|
|
30
|
-
isLockdownErrorResponse: function() {
|
|
31
|
-
return isLockdownErrorResponse;
|
|
32
|
-
},
|
|
33
|
-
isLockdownResponse: function() {
|
|
34
|
-
return isLockdownResponse;
|
|
35
|
-
}
|
|
18
|
+
LOCKDOWN_HEADER_SIZE: ()=>LOCKDOWN_HEADER_SIZE,
|
|
19
|
+
isLockdownResponse: ()=>isLockdownResponse,
|
|
20
|
+
isLockdownErrorResponse: ()=>isLockdownErrorResponse,
|
|
21
|
+
LockdownProtocolClient: ()=>LockdownProtocolClient,
|
|
22
|
+
LockdownProtocolReader: ()=>LockdownProtocolReader,
|
|
23
|
+
LockdownProtocolWriter: ()=>LockdownProtocolWriter
|
|
36
24
|
});
|
|
37
25
|
function _plist() {
|
|
38
|
-
const data = /*#__PURE__*/
|
|
26
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/plist"));
|
|
39
27
|
_plist = function() {
|
|
40
28
|
return data;
|
|
41
29
|
};
|
|
42
30
|
return data;
|
|
43
31
|
}
|
|
44
32
|
function _debug() {
|
|
45
|
-
const data = /*#__PURE__*/
|
|
33
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("debug"));
|
|
46
34
|
_debug = function() {
|
|
47
35
|
return data;
|
|
48
36
|
};
|
|
49
37
|
return data;
|
|
50
38
|
}
|
|
51
|
-
const
|
|
39
|
+
const _abstractProtocol = require("./AbstractProtocol");
|
|
52
40
|
const _errors = require("../../../../utils/errors");
|
|
53
|
-
function
|
|
41
|
+
function _interopRequireDefault(obj) {
|
|
54
42
|
return obj && obj.__esModule ? obj : {
|
|
55
43
|
default: obj
|
|
56
44
|
};
|
|
57
45
|
}
|
|
58
|
-
const debug = (0, _debug().default)(
|
|
46
|
+
const debug = (0, _debug().default)("expo:apple-device:protocol:lockdown");
|
|
59
47
|
const LOCKDOWN_HEADER_SIZE = 4;
|
|
60
48
|
function isDefined(val) {
|
|
61
|
-
return typeof val !==
|
|
49
|
+
return typeof val !== "undefined";
|
|
62
50
|
}
|
|
63
51
|
function isLockdownResponse(resp) {
|
|
64
52
|
return isDefined(resp.Status);
|
|
@@ -66,12 +54,12 @@ function isLockdownResponse(resp) {
|
|
|
66
54
|
function isLockdownErrorResponse(resp) {
|
|
67
55
|
return isDefined(resp.Error);
|
|
68
56
|
}
|
|
69
|
-
class LockdownProtocolClient extends
|
|
57
|
+
class LockdownProtocolClient extends _abstractProtocol.ProtocolClient {
|
|
70
58
|
constructor(socket){
|
|
71
|
-
super(socket, new
|
|
59
|
+
super(socket, new _abstractProtocol.ProtocolReaderFactory(LockdownProtocolReader), new LockdownProtocolWriter());
|
|
72
60
|
}
|
|
73
61
|
}
|
|
74
|
-
class LockdownProtocolReader extends
|
|
62
|
+
class LockdownProtocolReader extends _abstractProtocol.PlistProtocolReader {
|
|
75
63
|
constructor(callback){
|
|
76
64
|
super(LOCKDOWN_HEADER_SIZE, callback);
|
|
77
65
|
}
|
|
@@ -82,17 +70,17 @@ class LockdownProtocolReader extends _AbstractProtocol.PlistProtocolReader {
|
|
|
82
70
|
const resp = super.parseBody(data);
|
|
83
71
|
debug(`Response: ${JSON.stringify(resp)}`);
|
|
84
72
|
if (isLockdownErrorResponse(resp)) {
|
|
85
|
-
if (resp.Error ===
|
|
86
|
-
throw new _errors.CommandError(
|
|
73
|
+
if (resp.Error === "DeviceLocked") {
|
|
74
|
+
throw new _errors.CommandError("APPLE_DEVICE_LOCKED", "Device is currently locked.");
|
|
87
75
|
}
|
|
88
|
-
if (resp.Error ===
|
|
76
|
+
if (resp.Error === "InvalidService") {
|
|
89
77
|
let errorMessage = `${resp.Error}: ${resp.Service} (request: ${resp.Request})`;
|
|
90
|
-
if (resp.Service ===
|
|
91
|
-
errorMessage +=
|
|
78
|
+
if (resp.Service === "com.apple.debugserver") {
|
|
79
|
+
errorMessage += "\nTry reconnecting your device. You can also debug service logs with `export DEBUG=expo:xdl:ios:*`";
|
|
92
80
|
}
|
|
93
|
-
throw new _errors.CommandError(
|
|
81
|
+
throw new _errors.CommandError("APPLE_DEVICE_LOCKDOWN", errorMessage);
|
|
94
82
|
}
|
|
95
|
-
throw new _errors.CommandError(
|
|
83
|
+
throw new _errors.CommandError("APPLE_DEVICE_LOCKDOWN", resp.Error);
|
|
96
84
|
}
|
|
97
85
|
return resp;
|
|
98
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/LockdownProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport plist from '@expo/plist';\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport type { ProtocolWriter } from './AbstractProtocol';\nimport { PlistProtocolReader, ProtocolClient, ProtocolReaderFactory } from './AbstractProtocol';\nimport { CommandError } from '../../../../utils/errors';\n\nconst debug = Debug('expo:apple-device:protocol:lockdown');\nexport const LOCKDOWN_HEADER_SIZE = 4;\n\nexport interface LockdownCommand {\n Command: string;\n [key: string]: any;\n}\n\nexport interface LockdownResponse {\n Status: string;\n [key: string]: any;\n}\n\nexport interface LockdownErrorResponse {\n Error: string;\n Request?: string;\n Service?: string;\n}\n\nexport interface LockdownRequest {\n Request: string;\n [key: string]: any;\n}\n\nfunction isDefined(val: any) {\n return typeof val !== 'undefined';\n}\n\nexport function isLockdownResponse(resp: any): resp is LockdownResponse {\n return isDefined(resp.Status);\n}\n\nexport function isLockdownErrorResponse(resp: any): resp is LockdownErrorResponse {\n return isDefined(resp.Error);\n}\n\nexport class LockdownProtocolClient<\n MessageType extends LockdownRequest | LockdownCommand = LockdownRequest,\n> extends ProtocolClient<MessageType> {\n constructor(socket: Socket) {\n super(socket, new ProtocolReaderFactory(LockdownProtocolReader), new LockdownProtocolWriter());\n }\n}\n\nexport class LockdownProtocolReader extends PlistProtocolReader {\n constructor(callback: (data: any) => any) {\n super(LOCKDOWN_HEADER_SIZE, callback);\n }\n\n parseHeader(data: Buffer) {\n return data.readUInt32BE(0);\n }\n\n parseBody(data: Buffer) {\n const resp = super.parseBody(data);\n debug(`Response: ${JSON.stringify(resp)}`);\n if (isLockdownErrorResponse(resp)) {\n if (resp.Error === 'DeviceLocked') {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is currently locked.');\n }\n\n if (resp.Error === 'InvalidService') {\n let errorMessage = `${resp.Error}: ${resp.Service} (request: ${resp.Request})`;\n if (resp.Service === 'com.apple.debugserver') {\n errorMessage +=\n '\\nTry reconnecting your device. You can also debug service logs with `export DEBUG=expo:xdl:ios:*`';\n }\n throw new CommandError('APPLE_DEVICE_LOCKDOWN', errorMessage);\n }\n\n throw new CommandError('APPLE_DEVICE_LOCKDOWN', resp.Error);\n }\n return resp;\n }\n}\n\nexport class LockdownProtocolWriter implements ProtocolWriter {\n write(socket: Socket, plistData: any) {\n debug(`socket write: ${JSON.stringify(plistData)}`);\n const plistMessage = plist.build(plistData);\n const header = Buffer.alloc(LOCKDOWN_HEADER_SIZE);\n header.writeUInt32BE(plistMessage.length, 0);\n socket.write(header);\n socket.write(plistMessage);\n }\n}\n"],"names":["LOCKDOWN_HEADER_SIZE","
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/protocol/LockdownProtocol.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport plist from '@expo/plist';\nimport Debug from 'debug';\nimport { Socket } from 'net';\n\nimport type { ProtocolWriter } from './AbstractProtocol';\nimport { PlistProtocolReader, ProtocolClient, ProtocolReaderFactory } from './AbstractProtocol';\nimport { CommandError } from '../../../../utils/errors';\n\nconst debug = Debug('expo:apple-device:protocol:lockdown');\nexport const LOCKDOWN_HEADER_SIZE = 4;\n\nexport interface LockdownCommand {\n Command: string;\n [key: string]: any;\n}\n\nexport interface LockdownResponse {\n Status: string;\n [key: string]: any;\n}\n\nexport interface LockdownErrorResponse {\n Error: string;\n Request?: string;\n Service?: string;\n}\n\nexport interface LockdownRequest {\n Request: string;\n [key: string]: any;\n}\n\nfunction isDefined(val: any) {\n return typeof val !== 'undefined';\n}\n\nexport function isLockdownResponse(resp: any): resp is LockdownResponse {\n return isDefined(resp.Status);\n}\n\nexport function isLockdownErrorResponse(resp: any): resp is LockdownErrorResponse {\n return isDefined(resp.Error);\n}\n\nexport class LockdownProtocolClient<\n MessageType extends LockdownRequest | LockdownCommand = LockdownRequest,\n> extends ProtocolClient<MessageType> {\n constructor(socket: Socket) {\n super(socket, new ProtocolReaderFactory(LockdownProtocolReader), new LockdownProtocolWriter());\n }\n}\n\nexport class LockdownProtocolReader extends PlistProtocolReader {\n constructor(callback: (data: any) => any) {\n super(LOCKDOWN_HEADER_SIZE, callback);\n }\n\n parseHeader(data: Buffer) {\n return data.readUInt32BE(0);\n }\n\n parseBody(data: Buffer) {\n const resp = super.parseBody(data);\n debug(`Response: ${JSON.stringify(resp)}`);\n if (isLockdownErrorResponse(resp)) {\n if (resp.Error === 'DeviceLocked') {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is currently locked.');\n }\n\n if (resp.Error === 'InvalidService') {\n let errorMessage = `${resp.Error}: ${resp.Service} (request: ${resp.Request})`;\n if (resp.Service === 'com.apple.debugserver') {\n errorMessage +=\n '\\nTry reconnecting your device. You can also debug service logs with `export DEBUG=expo:xdl:ios:*`';\n }\n throw new CommandError('APPLE_DEVICE_LOCKDOWN', errorMessage);\n }\n\n throw new CommandError('APPLE_DEVICE_LOCKDOWN', resp.Error);\n }\n return resp;\n }\n}\n\nexport class LockdownProtocolWriter implements ProtocolWriter {\n write(socket: Socket, plistData: any) {\n debug(`socket write: ${JSON.stringify(plistData)}`);\n const plistMessage = plist.build(plistData);\n const header = Buffer.alloc(LOCKDOWN_HEADER_SIZE);\n header.writeUInt32BE(plistMessage.length, 0);\n socket.write(header);\n socket.write(plistMessage);\n }\n}\n"],"names":["LOCKDOWN_HEADER_SIZE","isLockdownResponse","isLockdownErrorResponse","LockdownProtocolClient","LockdownProtocolReader","LockdownProtocolWriter","debug","Debug","isDefined","val","resp","Status","Error","ProtocolClient","constructor","socket","ProtocolReaderFactory","PlistProtocolReader","callback","parseHeader","data","readUInt32BE","parseBody","JSON","stringify","CommandError","errorMessage","Service","Request","write","plistData","plistMessage","plist","build","header","Buffer","alloc","writeUInt32BE","length"],"mappings":"AAAA;;;;;;CAMC,GAED;;;;;;;;;;;IASaA,oBAAoB,MAApBA,oBAAoB;IA2BjBC,kBAAkB,MAAlBA,kBAAkB;IAIlBC,uBAAuB,MAAvBA,uBAAuB;IAI1BC,sBAAsB,MAAtBA,sBAAsB;IAQtBC,sBAAsB,MAAtBA,sBAAsB;IAgCtBC,sBAAsB,MAAtBA,sBAAsB;;;8DApFjB,aAAa;;;;;;;8DACb,OAAO;;;;;;kCAIkD,oBAAoB;wBAClE,0BAA0B;;;;;;AAEvD,MAAMC,KAAK,GAAGC,IAAAA,MAAK,EAAA,QAAA,EAAC,qCAAqC,CAAC,AAAC;AACpD,MAAMP,oBAAoB,GAAG,CAAC,AAAC;AAuBtC,SAASQ,SAAS,CAACC,GAAQ,EAAE;IAC3B,OAAO,OAAOA,GAAG,KAAK,WAAW,CAAC;AACpC,CAAC;AAEM,SAASR,kBAAkB,CAACS,IAAS,EAA4B;IACtE,OAAOF,SAAS,CAACE,IAAI,CAAC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