@expo/cli 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +2 -2
- package/build/src/api/getExpoGoIntermediateCertificate.js +1 -1
- package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
- package/build/src/api/getExpoSchema.js +1 -1
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/getNativeModuleVersions.js +1 -1
- package/build/src/api/getNativeModuleVersions.js.map +1 -1
- package/build/src/api/getProjectDevelopmentCertificate.js +1 -1
- package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
- package/build/src/api/getVersions.js +1 -1
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +5 -5
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +1 -1
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/actions.js +2 -2
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/otp.js +1 -1
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +2 -2
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +17 -1
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/customize/customizeAsync.js +1 -1
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +29 -2
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/templates.js +8 -0
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js +54 -0
- package/build/src/customize/typescript.js.map +1 -0
- package/build/src/export/createBundles.js +1 -31
- package/build/src/export/createBundles.js.map +1 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +52 -4
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +1 -3
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +6 -10
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +73 -46
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +4 -4
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +204 -0
- package/build/src/export/exportHermes.js.map +1 -0
- package/build/src/export/exportStaticAsync.js +48 -14
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +7 -7
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +35 -12
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js +1 -1
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +118 -0
- package/build/src/export/persistMetroAssets.js.map +1 -0
- package/build/src/export/printBundleSizes.js.map +1 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/writeContents.js +5 -1
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +1 -1
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +2 -1
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/resolveOptions.js +7 -4
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +5 -9
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/index.js +2 -0
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +7 -6
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +4 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +8 -5
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/register/registerAsync.js +0 -1
- package/build/src/register/registerAsync.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveOptions.js +1 -1
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +7 -2
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +2 -2
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +4 -4
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +2 -2
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +3 -0
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +2 -2
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +1 -1
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +2 -2
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +8 -3
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +43 -2
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -3
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +7 -7
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +11 -10
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/index.js +0 -2
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +4 -4
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +3 -3
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +1 -1
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js +5 -5
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +1 -1
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +2 -2
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +1 -1
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/getDevices.js +1 -1
- package/build/src/start/platforms/android/getDevices.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +5 -5
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +1 -1
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/resolveOptions.js +0 -5
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +4 -3
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +4 -11
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +3 -2
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +2 -1
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +3 -12
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +57 -36
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +15 -4
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- 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/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +1 -1
- package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +74 -13
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/resolveFromProject.js +13 -4
- package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +1 -1
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +43 -5
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +3 -3
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +3 -3
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +8 -5
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +69 -0
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +57 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +13 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +79 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +78 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +121 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -0
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +64 -0
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +19 -0
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -0
- package/build/src/start/server/middleware/mutations.js +19 -0
- package/build/src/start/server/middleware/mutations.js.map +1 -0
- package/build/src/start/server/middleware/remoteDevtoolsCorsMiddleware.js +31 -0
- package/build/src/start/server/middleware/remoteDevtoolsCorsMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/remoteDevtoolsSecurityHeadersMiddleware.js +17 -0
- package/build/src/start/server/middleware/remoteDevtoolsSecurityHeadersMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/middleware/server.types.js.map +1 -1
- package/build/src/start/server/middleware/suppressErrorMiddleware.js +16 -0
- package/build/src/start/server/middleware/suppressErrorMiddleware.js.map +1 -0
- package/build/src/start/server/openPlatforms.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -6
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +3 -3
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +19 -87
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +1 -1
- package/build/src/start/server/webpack/compile.js.map +1 -1
- package/build/src/start/startAsync.js +10 -32
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +1 -1
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/analytics/metroDebuggerMiddleware.js +1 -1
- package/build/src/utils/analytics/metroDebuggerMiddleware.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/array.js.map +1 -1
- package/build/src/utils/cocoapods.js +2 -2
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +2 -2
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +1 -1
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +2 -2
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +1 -1
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +1 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -2
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/git.js +1 -1
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +1 -1
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/modifyConfigPlugins.js +1 -1
- package/build/src/utils/modifyConfigPlugins.js.map +1 -1
- package/build/src/utils/npm.js +1 -1
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/plist.js +1 -1
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +46 -18
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/profile.js +1 -1
- package/build/src/utils/profile.js.map +1 -1
- package/build/src/utils/scheme.js +1 -1
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +85 -5
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/package.json +19 -13
- package/build/src/api/signManifest.js +0 -26
- package/build/src/api/signManifest.js.map +0 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +0 -155
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +0 -1
- package/build/src/start/server/middleware/createDevServerMiddleware.js +0 -24
- package/build/src/start/server/middleware/createDevServerMiddleware.js.map +0 -1
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
var _promises = _interopRequireDefault(require("fs/promises"));
|
|
6
6
|
var _path = _interopRequireDefault(require("path"));
|
|
7
|
+
var _updateTSConfig = require("./updateTSConfig");
|
|
7
8
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
8
9
|
var _dir = require("../../../utils/dir");
|
|
9
10
|
var _env = require("../../../utils/env");
|
|
@@ -11,7 +12,6 @@ var _fn = require("../../../utils/fn");
|
|
|
11
12
|
var _glob = require("../../../utils/glob");
|
|
12
13
|
var _prerequisite = require("../Prerequisite");
|
|
13
14
|
var _ensureDependenciesAsync = require("../dependencies/ensureDependenciesAsync");
|
|
14
|
-
var _updateTSConfig = require("./updateTSConfig");
|
|
15
15
|
function _interopRequireDefault(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : {
|
|
17
17
|
default: obj
|
|
@@ -63,8 +63,7 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
63
63
|
await this._ensureDependenciesInstalledAsync();
|
|
64
64
|
// Update the config
|
|
65
65
|
await (0, _updateTSConfig).updateTSConfigAsync({
|
|
66
|
-
tsConfigPath
|
|
67
|
-
isBootstrapping: intent.isBootstrapping
|
|
66
|
+
tsConfigPath
|
|
68
67
|
});
|
|
69
68
|
return true;
|
|
70
69
|
}
|
|
@@ -75,13 +74,13 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
75
74
|
}
|
|
76
75
|
// Ensure TypeScript packages are installed
|
|
77
76
|
await this._ensureDependenciesInstalledAsync({
|
|
78
|
-
skipPrompt: true
|
|
77
|
+
skipPrompt: true,
|
|
78
|
+
isProjectMutable: true
|
|
79
79
|
});
|
|
80
80
|
const tsConfigPath = _path.default.join(this.projectRoot, "tsconfig.json");
|
|
81
81
|
// Update the config
|
|
82
82
|
await (0, _updateTSConfig).updateTSConfigAsync({
|
|
83
|
-
tsConfigPath
|
|
84
|
-
isBootstrapping: true
|
|
83
|
+
tsConfigPath
|
|
85
84
|
});
|
|
86
85
|
}
|
|
87
86
|
/** Exposed for testing. */ async _getSetupRequirements() {
|
|
@@ -109,11 +108,12 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
109
108
|
}
|
|
110
109
|
return null;
|
|
111
110
|
}
|
|
112
|
-
/** Exposed for testing. */ async _ensureDependenciesInstalledAsync({ exp , skipPrompt } = {}) {
|
|
111
|
+
/** Exposed for testing. */ async _ensureDependenciesInstalledAsync({ exp , skipPrompt , isProjectMutable } = {}) {
|
|
113
112
|
try {
|
|
114
113
|
return await (0, _ensureDependenciesAsync).ensureDependenciesAsync(this.projectRoot, {
|
|
115
114
|
exp,
|
|
116
115
|
skipPrompt,
|
|
116
|
+
isProjectMutable,
|
|
117
117
|
installMessage: `It looks like you're trying to use TypeScript but don't have the required dependencies installed.`,
|
|
118
118
|
warningMessage: "If you're not using TypeScript, please remove the TypeScript files from your project",
|
|
119
119
|
requiredPackages: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/typescript/TypeScriptProjectPrerequisite.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { env } from '../../../utils/env';\nimport { memoize } from '../../../utils/fn';\nimport { everyMatchAsync, wrapGlobWithTimeout } from '../../../utils/glob';\nimport { ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/typescript/TypeScriptProjectPrerequisite.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { updateTSConfigAsync } from './updateTSConfig';\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { env } from '../../../utils/env';\nimport { memoize } from '../../../utils/fn';\nimport { everyMatchAsync, wrapGlobWithTimeout } from '../../../utils/glob';\nimport { ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\n\nconst debug = require('debug')('expo:doctor:typescriptSupport') as typeof console.log;\n\nconst warnDisabled = memoize(() => {\n Log.warn('Skipping TypeScript setup: EXPO_NO_TYPESCRIPT_SETUP is enabled.');\n});\n\n/** Ensure the project has the required TypeScript support settings. */\nexport class TypeScriptProjectPrerequisite extends ProjectPrerequisite<boolean> {\n /**\n * Ensure a project that hasn't explicitly disabled typescript support has all the required packages for running in the browser.\n *\n * @returns `true` if the setup finished and no longer needs to be run again.\n */\n async assertImplementation(): Promise<boolean> {\n if (env.EXPO_NO_TYPESCRIPT_SETUP) {\n warnDisabled();\n return true;\n }\n debug('Ensuring TypeScript support is setup');\n\n const tsConfigPath = path.join(this.projectRoot, 'tsconfig.json');\n\n // Ensure the project is TypeScript before continuing.\n const intent = await this._getSetupRequirements();\n if (!intent) {\n return false;\n }\n\n // Ensure TypeScript packages are installed\n await this._ensureDependenciesInstalledAsync();\n\n // Update the config\n await updateTSConfigAsync({ tsConfigPath });\n\n return true;\n }\n\n async bootstrapAsync(): Promise<void> {\n if (env.EXPO_NO_TYPESCRIPT_SETUP) {\n warnDisabled();\n return;\n }\n // Ensure TypeScript packages are installed\n await this._ensureDependenciesInstalledAsync({\n skipPrompt: true,\n isProjectMutable: true,\n });\n\n const tsConfigPath = path.join(this.projectRoot, 'tsconfig.json');\n\n // Update the config\n await updateTSConfigAsync({ tsConfigPath });\n }\n\n /** Exposed for testing. */\n async _getSetupRequirements(): Promise<{\n /** Indicates that TypeScript support is being bootstrapped. */\n isBootstrapping: boolean;\n } | null> {\n const tsConfigPath = await this._hasTSConfig();\n\n // Enable TS setup if the project has a `tsconfig.json`\n if (tsConfigPath) {\n const content = await fs.readFile(tsConfigPath, { encoding: 'utf8' }).then(\n (txt) => txt.trim(),\n // null when the file doesn't exist.\n () => null\n );\n const isBlankConfig = content === '' || content === '{}';\n return { isBootstrapping: isBlankConfig };\n }\n // This is a somewhat heavy check in larger projects.\n // Test that this is reasonably paced by running expo start in `expo/apps/native-component-list`\n const typescriptFile = await this._queryFirstTypeScriptFileAsync();\n if (typescriptFile) {\n return { isBootstrapping: true };\n }\n\n return null;\n }\n\n /** Exposed for testing. */\n async _ensureDependenciesInstalledAsync({\n exp,\n skipPrompt,\n isProjectMutable,\n }: {\n exp?: ExpoConfig;\n skipPrompt?: boolean;\n isProjectMutable?: boolean;\n } = {}): Promise<boolean> {\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n exp,\n skipPrompt,\n isProjectMutable,\n installMessage: `It looks like you're trying to use TypeScript but don't have the required dependencies installed.`,\n warningMessage:\n \"If you're not using TypeScript, please remove the TypeScript files from your project\",\n requiredPackages: [\n // use typescript/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n { file: 'typescript/package.json', pkg: 'typescript' },\n { file: '@types/react/package.json', pkg: '@types/react' },\n ],\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n\n /** Return the first TypeScript file in the project. */\n async _queryFirstTypeScriptFileAsync(): Promise<null | string> {\n const results = await wrapGlobWithTimeout(\n () =>\n // TODO(Bacon): Use `everyMatch` since a bug causes `anyMatch` to return inaccurate results when used multiple times.\n everyMatchAsync('**/*.@(ts|tsx)', {\n cwd: this.projectRoot,\n ignore: [\n '**/@(Carthage|Pods|node_modules)/**',\n '**/*.d.ts',\n '@(ios|android|web|web-build|dist)/**',\n ],\n }),\n 5000\n );\n\n if (results === false) {\n return null;\n }\n return results[0] ?? null;\n }\n\n async _hasTSConfig(): Promise<string | null> {\n const tsConfigPath = path.join(this.projectRoot, 'tsconfig.json');\n if (await fileExistsAsync(tsConfigPath)) {\n return tsConfigPath;\n }\n return null;\n }\n}\n"],"names":["Log","debug","require","warnDisabled","memoize","warn","TypeScriptProjectPrerequisite","ProjectPrerequisite","assertImplementation","env","EXPO_NO_TYPESCRIPT_SETUP","tsConfigPath","path","join","projectRoot","intent","_getSetupRequirements","_ensureDependenciesInstalledAsync","updateTSConfigAsync","bootstrapAsync","skipPrompt","isProjectMutable","_hasTSConfig","content","fs","readFile","encoding","then","txt","trim","isBlankConfig","isBootstrapping","typescriptFile","_queryFirstTypeScriptFileAsync","exp","ensureDependenciesAsync","installMessage","warningMessage","requiredPackages","file","pkg","error","resetAssertion","results","wrapGlobWithTimeout","everyMatchAsync","cwd","ignore","fileExistsAsync"],"mappings":"AAAA;;;;AACe,IAAA,SAAa,kCAAb,aAAa,EAAA;AAC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YAAY,GAAGC,KAAI,QAAA,CAACC,IAAI,CAAC,IAAI,CAACC,WAAW,EAAE,eAAe,CAAC,AAAC;QAClE,IAAI,MAAMkC,CAAAA,GAAAA,IAAe,AAAc,CAAA,gBAAd,CAACrC,YAAY,CAAC,EAAE;YACvC,OAAOA,YAAY,CAAC;SACrB;QACD,OAAO,IAAI,CAAC;KACb;CACF;QAvIYL,6BAA6B,GAA7BA,6BAA6B"}
|
|
@@ -34,21 +34,22 @@ function _interopRequireWildcard(obj) {
|
|
|
34
34
|
return newObj;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
var _projectTSConfig;
|
|
37
38
|
const baseTSConfigName = "expo/tsconfig.base";
|
|
38
39
|
exports.baseTSConfigName = baseTSConfigName;
|
|
39
|
-
async function updateTSConfigAsync({ tsConfigPath
|
|
40
|
-
const shouldGenerate = !_fs.default.existsSync(tsConfigPath);
|
|
41
|
-
if (
|
|
42
|
-
await _jsonFile.default.writeAsync(tsConfigPath, {
|
|
40
|
+
async function updateTSConfigAsync({ tsConfigPath }) {
|
|
41
|
+
const shouldGenerate = !_fs.default.existsSync(tsConfigPath) || _fs.default.statSync(tsConfigPath).size === 0;
|
|
42
|
+
if (shouldGenerate) {
|
|
43
|
+
await _jsonFile.default.writeAsync(tsConfigPath, {
|
|
44
|
+
compilerOptions: {}
|
|
45
|
+
});
|
|
43
46
|
}
|
|
44
47
|
const projectTSConfig = _jsonFile.default.read(tsConfigPath, {
|
|
45
48
|
// Some tsconfig.json files have a generated comment in the file.
|
|
46
49
|
json5: true
|
|
47
50
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
isBootstrapping = true;
|
|
51
|
-
}
|
|
51
|
+
var _compilerOptions;
|
|
52
|
+
(_compilerOptions = (_projectTSConfig = projectTSConfig).compilerOptions) != null ? _compilerOptions : _projectTSConfig.compilerOptions = {};
|
|
52
53
|
const modifications = [];
|
|
53
54
|
// If the extends field isn't defined, set it to the expo default
|
|
54
55
|
if (!projectTSConfig.extends) {
|
|
@@ -66,11 +67,11 @@ async function updateTSConfigAsync({ tsConfigPath , isBootstrapping }) {
|
|
|
66
67
|
// Write changes and log out a summary of what changed
|
|
67
68
|
await _jsonFile.default.writeAsync(tsConfigPath, projectTSConfig);
|
|
68
69
|
// If no changes, then quietly bail out
|
|
69
|
-
if (
|
|
70
|
+
if (modifications.length === 0) {
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
73
|
Log.log();
|
|
73
|
-
if (
|
|
74
|
+
if (shouldGenerate) {
|
|
74
75
|
Log.log(_chalk.default`{bold TypeScript}: A {cyan tsconfig.json} has been auto-generated`);
|
|
75
76
|
} else {
|
|
76
77
|
Log.log(_chalk.default`{bold TypeScript}: The {cyan tsconfig.json} has been updated {dim (Use EXPO_NO_TYPESCRIPT_SETUP to skip)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/typescript/updateTSConfig.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport fs from 'fs';\n\nimport * as Log from '../../../log';\n\nexport const baseTSConfigName = 'expo/tsconfig.base';\n\nexport async function updateTSConfigAsync({\n tsConfigPath,\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/typescript/updateTSConfig.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport fs from 'fs';\n\nimport * as Log from '../../../log';\n\nexport const baseTSConfigName = 'expo/tsconfig.base';\n\nexport async function updateTSConfigAsync({\n tsConfigPath,\n}: {\n tsConfigPath: string;\n}): Promise<void> {\n const shouldGenerate = !fs.existsSync(tsConfigPath) || fs.statSync(tsConfigPath).size === 0;\n if (shouldGenerate) {\n await JsonFile.writeAsync(tsConfigPath, { compilerOptions: {} });\n }\n\n const projectTSConfig = JsonFile.read(tsConfigPath, {\n // Some tsconfig.json files have a generated comment in the file.\n json5: true,\n });\n\n projectTSConfig.compilerOptions ??= {};\n\n const modifications: [string, string][] = [];\n\n // If the extends field isn't defined, set it to the expo default\n if (!projectTSConfig.extends) {\n // if (projectTSConfig.extends !== baseTSConfigName) {\n projectTSConfig.extends = baseTSConfigName;\n modifications.push(['extends', baseTSConfigName]);\n }\n\n // If no changes, then quietly bail out\n if (!modifications.length) {\n return;\n }\n\n // Write changes and log out a summary of what changed\n await JsonFile.writeAsync(tsConfigPath, projectTSConfig);\n\n // If no changes, then quietly bail out\n if (modifications.length === 0) {\n return;\n }\n\n Log.log();\n\n if (shouldGenerate) {\n Log.log(chalk`{bold TypeScript}: A {cyan tsconfig.json} has been auto-generated`);\n } else {\n Log.log(\n chalk`{bold TypeScript}: The {cyan tsconfig.json} has been updated {dim (Use EXPO_NO_TYPESCRIPT_SETUP to skip)}`\n );\n logModifications(modifications);\n }\n Log.log();\n}\n\nfunction logModifications(modifications: string[][]) {\n Log.log();\n\n Log.log(chalk`\\u203A {bold Required} modifications made to the {cyan tsconfig.json}:`);\n\n Log.log();\n\n // Sort the items based on key name length\n printTable(modifications.sort((a, b) => a[0].length - b[0].length));\n\n Log.log();\n}\n\nfunction printTable(items: string[][]) {\n const tableFormat = (name: string, msg: string) =>\n ` ${chalk.bold`${name}`} is now ${chalk.cyan(msg)}`;\n for (const [key, value] of items) {\n Log.log(tableFormat(key, value));\n }\n}\n"],"names":["updateTSConfigAsync","Log","projectTSConfig","baseTSConfigName","tsConfigPath","shouldGenerate","fs","existsSync","statSync","size","JsonFile","writeAsync","compilerOptions","read","json5","modifications","extends","push","length","log","chalk","logModifications","printTable","sort","a","b","items","tableFormat","name","msg","bold","cyan","key","value"],"mappings":"AAAA;;;;QAQsBA,mBAAmB,GAAnBA,mBAAmB;;AARpB,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEPC,IAAAA,GAAG,mCAAM,cAAc,EAApB;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmBbC,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B,GAAG,CAACC,MAAK,QAAA,CAAC,iEAAiE,CAAC,CAAC,CAAC;KACnF,MAAM;QACLnB,GAAG,CAACkB,GAAG,CACLC,MAAK,QAAA,CAAC,yGAAyG,CAAC,CACjH,CAAC;QACFC,gBAAgB,CAACN,aAAa,CAAC,CAAC;KACjC;IACDd,GAAG,CAACkB,GAAG,EAAE,CAAC;CACX;AAED,SAASE,gBAAgB,CAACN,aAAyB,EAAE;IACnDd,GAAG,CAACkB,GAAG,EAAE,CAAC;IAEVlB,GAAG,CAACkB,GAAG,CAACC,MAAK,QAAA,CAAC,sEAAsE,CAAC,CAAC,CAAC;IAEvFnB,GAAG,CAACkB,GAAG,EAAE,CAAC;IAEV,0CAA0C;IAC1CG,UAAU,CAACP,aAAa,CAACQ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,GAAKD,CAAC,CAAC,CAAC,CAAC,CAACN,MAAM,GAAGO,CAAC,CAAC,CAAC,CAAC,CAACP,MAAM;IAAA,CAAC,CAAC,CAAC;IAEpEjB,GAAG,CAACkB,GAAG,EAAE,CAAC;CACX;AAED,SAASG,UAAU,CAACI,KAAiB,EAAE;IACrC,MAAMC,WAAW,GAAG,CAACC,IAAY,EAAEC,GAAW,GAC5C,CAAC,EAAE,EAAET,MAAK,QAAA,CAACU,IAAI,CAAC,EAAEF,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAER,MAAK,QAAA,CAACW,IAAI,CAACF,GAAG,CAAC,CAAC,CAAC;IAAC;IACvD,KAAK,MAAM,CAACG,GAAG,EAAEC,KAAK,CAAC,IAAIP,KAAK,CAAE;QAChCzB,GAAG,CAACkB,GAAG,CAACQ,WAAW,CAACK,GAAG,EAAEC,KAAK,CAAC,CAAC,CAAC;KAClC;CACF"}
|
package/build/src/start/index.js
CHANGED
|
@@ -42,7 +42,6 @@ const expoStart = async (argv)=>{
|
|
|
42
42
|
"--no-dev": Boolean,
|
|
43
43
|
"--minify": Boolean,
|
|
44
44
|
"--https": Boolean,
|
|
45
|
-
"--force-manifest-type": String,
|
|
46
45
|
"--private-key-path": String,
|
|
47
46
|
"--port": Number,
|
|
48
47
|
"--dev-client": Boolean,
|
|
@@ -97,7 +96,6 @@ const expoStart = async (argv)=>{
|
|
|
97
96
|
`--scheme <scheme> Custom URI protocol to use when launching an app`,
|
|
98
97
|
_chalk.default`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,
|
|
99
98
|
``,
|
|
100
|
-
_chalk.default`--force-manifest-type <string> Override auto detection of manifest type. {dim Options: expo-updates, classic}`,
|
|
101
99
|
_chalk.default`--private-key-path <path> Path to private key for code signing. {dim Default: "private-key.pem" in the same directory as the certificate specified by the expo-updates configuration in app.json.}`,
|
|
102
100
|
`-h, --help Usage info`,
|
|
103
101
|
].join("\n"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/start/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--
|
|
1
|
+
{"version":3,"sources":["../../../src/start/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--private-key-path': String,\n '--port': Number,\n '--dev-client': Boolean,\n '--scheme': String,\n '--android': Boolean,\n '--ios': Boolean,\n '--web': Boolean,\n '--host': String,\n '--tunnel': Boolean,\n '--lan': Boolean,\n '--localhost': Boolean,\n '--offline': Boolean,\n '--go': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n '-p': '--port',\n '-a': '--android',\n '-i': '--ios',\n '-w': '--web',\n '-m': '--host',\n '-d': '--dev-client',\n '-g': '--go',\n // Alias for adding interop with the Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Start a local dev server for the app`,\n chalk`npx expo start {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `-a, --android Open on a connected Android device`,\n `-i, --ios Open in an iOS simulator`,\n `-w, --web Open in a web browser`,\n ``,\n chalk`-d, --dev-client Launch in a custom native app`,\n chalk`-g, --go Launch in Expo Go`,\n ``,\n `-c, --clear Clear the bundler cache`,\n `--max-workers <number> Maximum number of tasks to allow Metro to spawn`,\n `--no-dev Bundle in production mode`,\n `--minify Minify JavaScript`,\n ``,\n chalk`-m, --host <string> Dev server hosting type. {dim Default: lan}`,\n chalk` {bold lan}: Use the local network`,\n chalk` {bold tunnel}: Use any network by tunnel through ngrok`,\n chalk` {bold localhost}: Connect to the dev server over localhost`,\n `--tunnel Same as --host tunnel`,\n `--lan Same as --host lan`,\n `--localhost Same as --host localhost`,\n ``,\n `--offline Skip network requests and use anonymous manifest signatures`,\n `--https Start the dev server with https protocol`,\n `--scheme <scheme> Custom URI protocol to use when launching an app`,\n chalk`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,\n ``,\n chalk`--private-key-path <path> Path to private key for code signing. {dim Default: \"private-key.pem\" in the same directory as the certificate specified by the expo-updates configuration in app.json.}`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n if (options.offline) {\n const { disableNetwork } = await import('../api/settings');\n disableNetwork();\n }\n\n const { startAsync } = await import('./startAsync');\n return startAsync(projectRoot, options, { webOnly: false }).catch(logCmdError);\n};\n"],"names":["expoStart","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","offline","disableNetwork","startAsync","webOnly"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;AACzC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,MAAMA,SAAS,GAAY,OAAOC,IAAI,GAAK;IAChD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAoCtB,CAAA,WApCsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,eAAe,EAAEC,MAAM;QACvB,UAAU,EAAED,OAAO;QACnB,UAAU,EAAEA,OAAO;QACnB,SAAS,EAAEA,OAAO;QAClB,oBAAoB,EAAEE,MAAM;QAC5B,QAAQ,EAAED,MAAM;QAChB,cAAc,EAAED,OAAO;QACvB,UAAU,EAAEE,MAAM;QAClB,WAAW,EAAEF,OAAO;QACpB,OAAO,EAAEA,OAAO;QAChB,OAAO,EAAEA,OAAO;QAChB,QAAQ,EAAEE,MAAM;QAChB,UAAU,EAAEF,OAAO;QACnB,OAAO,EAAEA,OAAO;QAChB,aAAa,EAAEA,OAAO;QACtB,WAAW,EAAEA,OAAO;QACpB,MAAM,EAAEA,OAAO;QACf,UAAU;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,MAAM;QACZ,kEAAkE;QAClE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AO,kBAAkB;MAAC,AAAC;IACjE,MAAMC,OAAO,GAAG,MAAMD,mBAAmB,CAACF,WAAW,EAAER,IAAI,CAAC,CAACY,KAAK,CAACC,OAAW,YAAA,CAAC,AAAC;IAEhF,IAAIF,OAAO,CAACG,OAAO,EAAE;QACnB,MAAM,EAAEC,cAAc,CAAA,EAAE,GAAG,MAAM;mDAAO,iBAAiB;UAAC,AAAC;QAC3DA,cAAc,EAAE,CAAC;KAClB;IAED,MAAM,EAAEC,UAAU,CAAA,EAAE,GAAG,MAAM;+CAAO,cAAc;MAAC,AAAC;IACpD,OAAOA,UAAU,CAACR,WAAW,EAAEG,OAAO,EAAE;QAAEM,OAAO,EAAE,KAAK;KAAE,CAAC,CAACL,KAAK,CAACC,OAAW,YAAA,CAAC,CAAC;CAChF,AAAC;QAvFWf,SAAS,GAATA,SAAS"}
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
var _devServer = require("@expo/dev-server");
|
|
6
5
|
var _assert = _interopRequireDefault(require("assert"));
|
|
7
6
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
7
|
+
var _commandsTable = require("./commandsTable");
|
|
8
8
|
var Log = _interopRequireWildcard(require("../../log"));
|
|
9
9
|
var _delay = require("../../utils/delay");
|
|
10
10
|
var _link = require("../../utils/link");
|
|
11
11
|
var _open = require("../../utils/open");
|
|
12
12
|
var _prompts = require("../../utils/prompts");
|
|
13
13
|
var _reactDevToolsProxy = require("../server/ReactDevToolsProxy");
|
|
14
|
-
var
|
|
14
|
+
var _jsInspector = require("../server/middleware/inspector/JsInspector");
|
|
15
15
|
function _interopRequireDefault(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : {
|
|
17
17
|
default: obj
|
|
@@ -91,14 +91,14 @@ class DevServerManagerActions {
|
|
|
91
91
|
Log.log("Opening JavaScript inspector in the browser...");
|
|
92
92
|
const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();
|
|
93
93
|
(0, _assert).default(metroServerOrigin, "Metro dev server is not running");
|
|
94
|
-
const apps = await (0,
|
|
94
|
+
const apps = await (0, _jsInspector).queryAllInspectorAppsAsync(metroServerOrigin);
|
|
95
95
|
if (!apps.length) {
|
|
96
96
|
Log.warn(`No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${(0, _link).learnMore("https://docs.expo.dev/guides/using-hermes/")}`);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
try {
|
|
100
100
|
for (const app of apps){
|
|
101
|
-
await (0,
|
|
101
|
+
await (0, _jsInspector).openJsInspector(app);
|
|
102
102
|
}
|
|
103
103
|
} catch (error) {
|
|
104
104
|
Log.error("Failed to open JavaScript inspector. This is often an issue with Google Chrome.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import { openJsInspector, queryAllInspectorAppsAsync } from '@expo/dev-server';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n Log.log('Opening JavaScript inspector in the browser...');\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n assert(metroServerOrigin, 'Metro dev server is not running');\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n Log.warn(\n `No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n return;\n }\n try {\n for (const app of apps) {\n await openJsInspector(app);\n }\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n try {\n // Options match: Chrome > View > Developer\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n { title: 'Start React devtools', value: 'startReactDevTools' },\n // TODO: Maybe a \"View Source\" option to open code.\n // Toggling Remote JS Debugging is pretty rough, so leaving it disabled.\n // { title: 'Toggle Remote Debugging', value: 'toggleRemoteDebugging' },\n ]);\n if (value === 'startReactDevTools') {\n this.startReactDevToolsAsync();\n } else {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async startReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","assert","apps","queryAllInspectorAppsAsync","length","warn","app","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","value","selectAsync","title","startReactDevToolsAsync","name","startReactDevToolsProxyAsync","url","getReactDevToolsUrl","openBrowserAsync","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAA4D,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AAC3D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACY,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACvB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAK1C,IAAA,mBAA8B,WAA9B,8BAA8B,CAAA;AAC4C,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElG,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yCAAyC,CAAC,AAAsB,AAAC;AAGzF,MAAMC,uBAAuB;IAClCC,YAAoBC,gBAAkC,CAAE;aAApCA,gBAAkC,GAAlCA,gBAAkC;KAAI;IAE1DC,kBAAkB,CAChBC,OAA8E,EAC9E;QACA,kDAAkD;QAClD,IAAI,IAAI,CAACF,gBAAgB,CAACG,sBAAsB,EAAE,EAAE;YAClD,MAAMC,SAAS,GAAG,IAAI,CAACJ,gBAAgB,CAACK,mBAAmB,EAAE,AAAC;YAC9D,IAAI;gBACF,MAAMC,gBAAgB,GAAGF,SAAS,CAACG,mBAAmB,EAAE,AAAC,AAAC;gBAC1D,MAAMC,mBAAmB,GAAGJ,SAAS,CAACK,cAAc,EAAE,AAAC;gBAEvDC,CAAAA,GAAAA,cAAW,AAAyC,CAAA,YAAzC,CAACF,mBAAmB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C,gBAAgB,CAACyC,gBAAgB,CAAC,gBAAgB,EAAE;oBAAEM,IAAI,EAAEJ,KAAK;iBAAE,CAAC,CAAC;aAC3E;SACF,CAAC,OAAO3B,KAAK,EAAO;YACnBpB,KAAK,CAACoB,KAAK,CAAC,CAAC;QACb,aAAa;SACd,QAAS;YACRW,CAAAA,GAAAA,cAAS,AAAE,CAAA,UAAF,EAAE,CAAC;SACb;KACF;IAED,MAAMmB,uBAAuB,GAAG;QAC9B,MAAME,CAAAA,GAAAA,mBAA4B,AAAE,CAAA,6BAAF,EAAE,CAAC;QACrC,MAAMC,GAAG,GAAG,IAAI,CAACjD,gBAAgB,CAACK,mBAAmB,EAAE,CAAC6C,mBAAmB,EAAE,AAAC;QAC9E,MAAMC,CAAAA,GAAAA,KAAgB,AAAK,CAAA,iBAAL,CAACF,GAAG,CAAC,CAAC;QAC5BG,CAAAA,GAAAA,mBAA8B,AAE5B,CAAA,+BAF4B,CAAC,IAAM;YACnC,IAAI,CAACC,sBAAsB,EAAE,CAAC;SAC/B,CAAC,CAAC;QACH,IAAI,CAACA,sBAAsB,EAAE,CAAC;KAC/B;IAED,MAAMA,sBAAsB,GAAG;QAC7B,qEAAqE;QACrE,MAAMC,CAAAA,GAAAA,MAAU,AAAM,CAAA,WAAN,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAACtD,gBAAgB,CAACyC,gBAAgB,CAAC,gBAAgB,EAAE;YAAEM,IAAI,EAAE,wBAAwB;SAAE,CAAC,CAAC;KAC9F;IAEDQ,aAAa,GAAG;QACd5D,GAAG,CAACgB,GAAG,CAAC,CAAC,EAAE6B,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACxC,gBAAgB,CAACyC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAxIY3C,uBAAuB,GAAvBA,uBAAuB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n openJsInspector,\n queryAllInspectorAppsAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n Log.log('Opening JavaScript inspector in the browser...');\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n assert(metroServerOrigin, 'Metro dev server is not running');\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n Log.warn(\n `No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n return;\n }\n try {\n for (const app of apps) {\n await openJsInspector(app);\n }\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n try {\n // Options match: Chrome > View > Developer\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n { title: 'Start React devtools', value: 'startReactDevTools' },\n // TODO: Maybe a \"View Source\" option to open code.\n // Toggling Remote JS Debugging is pretty rough, so leaving it disabled.\n // { title: 'Toggle Remote Debugging', value: 'toggleRemoteDebugging' },\n ]);\n if (value === 'startReactDevTools') {\n this.startReactDevToolsAsync();\n } else {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async startReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","assert","apps","queryAllInspectorAppsAsync","length","warn","app","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","value","selectAsync","title","startReactDevToolsAsync","name","startReactDevToolsProxyAsync","url","getReactDevToolsUrl","openBrowserAsync","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAAmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEwD,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACtFA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACY,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACvB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAK1C,IAAA,mBAA8B,WAA9B,8BAA8B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,CAAC,IAAM;YACnC,IAAI,CAACC,sBAAsB,EAAE,CAAC;SAC/B,CAAC,CAAC;QACH,IAAI,CAACA,sBAAsB,EAAE,CAAC;KAC/B;IAED,MAAMA,sBAAsB,GAAG;QAC7B,qEAAqE;QACrE,MAAMC,CAAAA,GAAAA,MAAU,AAAM,CAAA,WAAN,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAACtD,gBAAgB,CAACyC,gBAAgB,CAAC,gBAAgB,EAAE;YAAEM,IAAI,EAAE,wBAAwB;SAAE,CAAC,CAAC;KAC9F;IAEDQ,aAAa,GAAG;QACd5D,GAAG,CAACgB,GAAG,CAAC,CAAC,EAAE6B,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACxC,gBAAgB,CAACyC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAxIY3C,uBAAuB,GAAvBA,uBAAuB"}
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.startInterfaceAsync = startInterfaceAsync;
|
|
6
6
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
7
|
+
var _keyPressHandler = require("./KeyPressHandler");
|
|
8
|
+
var _commandsTable = require("./commandsTable");
|
|
9
|
+
var _interactiveActions = require("./interactiveActions");
|
|
7
10
|
var Log = _interopRequireWildcard(require("../../log"));
|
|
8
11
|
var _editor = require("../../utils/editor");
|
|
9
12
|
var _errors = require("../../utils/errors");
|
|
@@ -11,9 +14,6 @@ var _ora = require("../../utils/ora");
|
|
|
11
14
|
var _progress = require("../../utils/progress");
|
|
12
15
|
var _prompts = require("../../utils/prompts");
|
|
13
16
|
var _webSupportProjectPrerequisite = require("../doctor/web/WebSupportProjectPrerequisite");
|
|
14
|
-
var _keyPressHandler = require("./KeyPressHandler");
|
|
15
|
-
var _commandsTable = require("./commandsTable");
|
|
16
|
-
var _interactiveActions = require("./interactiveActions");
|
|
17
17
|
function _interopRequireDefault(obj) {
|
|
18
18
|
return obj && obj.__esModule ? obj : {
|
|
19
19
|
default: obj
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/startInterface.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { openInEditorAsync } from '../../utils/editor';\nimport { AbortCommandError } from '../../utils/errors';\nimport { getAllSpinners, ora } from '../../utils/ora';\nimport { getProgressBar, setProgressBar } from '../../utils/progress';\nimport { addInteractionListener, pauseInteractions } from '../../utils/prompts';\nimport { WebSupportProjectPrerequisite } from '../doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../server/DevServerManager';\nimport { KeyPressHandler } from './KeyPressHandler';\nimport { BLT, printHelp, printUsage, StartOptions } from './commandsTable';\nimport { DevServerManagerActions } from './interactiveActions';\n\nconst debug = require('debug')('expo:start:interface:startInterface') as typeof console.log;\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\nconst CTRL_L = '\\u000C';\n\nconst PLATFORM_SETTINGS: Record<\n string,\n { name: string; key: 'android' | 'ios'; launchTarget: 'emulator' | 'simulator' }\n> = {\n android: {\n name: 'Android',\n key: 'android',\n launchTarget: 'emulator',\n },\n ios: {\n name: 'iOS',\n key: 'ios',\n launchTarget: 'simulator',\n },\n};\n\nexport async function startInterfaceAsync(\n devServerManager: DevServerManager,\n options: Pick<StartOptions, 'devClient' | 'platforms'>\n) {\n const actions = new DevServerManagerActions(devServerManager);\n\n const isWebSocketsEnabled = devServerManager.getDefaultDevServer()?.isTargetingNative();\n\n const usageOptions = {\n isWebSocketsEnabled,\n devClient: devServerManager.options.devClient,\n ...options,\n };\n\n actions.printDevServerInfo(usageOptions);\n\n const onPressAsync = async (key: string) => {\n // Auxillary commands all escape.\n switch (key) {\n case CTRL_C:\n case CTRL_D: {\n // Prevent terminal UI from accepting commands while the process is closing.\n // Without this, fast typers will close the server then start typing their\n // next command and have a bunch of unrelated things pop up.\n pauseInteractions();\n\n const spinners = getAllSpinners();\n spinners.forEach((spinner) => {\n spinner.fail();\n });\n\n const currentProgress = getProgressBar();\n if (currentProgress) {\n currentProgress.terminate();\n setProgressBar(null);\n }\n const spinner = ora({ text: 'Stopping server', color: 'white' }).start();\n try {\n await devServerManager.stopAsync();\n spinner.stopAndPersist({ text: 'Stopped server', symbol: `\\u203A` });\n // @ts-ignore: Argument of type '\"SIGINT\"' is not assignable to parameter of type '\"disconnect\"'.\n process.emit('SIGINT');\n\n // TODO: Is this the right place to do this?\n process.exit();\n } catch (error) {\n spinner.fail('Failed to stop server');\n throw error;\n }\n break;\n }\n case CTRL_L:\n return Log.clear();\n case '?':\n return printUsage(usageOptions, { verbose: true });\n }\n\n // Optionally enabled\n\n if (isWebSocketsEnabled) {\n switch (key) {\n case 'm':\n return actions.toggleDevMenu();\n case 'M':\n return actions.openMoreToolsAsync();\n }\n }\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n if (['i', 'a'].includes(key.toLowerCase())) {\n const platform = key.toLowerCase() === 'i' ? 'ios' : 'android';\n\n const shouldPrompt = ['I', 'A'].includes(key);\n if (shouldPrompt) {\n Log.clear();\n }\n\n const server = devServerManager.getDefaultDevServer();\n const settings = PLATFORM_SETTINGS[platform];\n\n Log.log(`${BLT} Opening on ${settings.name}...`);\n\n if (server.isTargetingNative() && !platforms.includes(settings.key)) {\n Log.warn(\n chalk`${settings.name} is disabled, enable it by adding {bold ${settings.key}} to the platforms array in your app.json or app.config.js`\n );\n } else {\n try {\n await server.openPlatformAsync(settings.launchTarget, { shouldPrompt });\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n }\n // Break out early.\n return;\n }\n\n switch (key) {\n case 's': {\n Log.clear();\n if (await devServerManager.toggleRuntimeMode()) {\n usageOptions.devClient = devServerManager.options.devClient;\n return actions.printDevServerInfo(usageOptions);\n }\n break;\n }\n case 'w': {\n try {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n if (!platforms.includes('web')) {\n platforms.push('web');\n options.platforms?.push('web');\n }\n } catch (e: any) {\n Log.warn(e.message);\n break;\n }\n\n const isDisabled = !platforms.includes('web');\n if (isDisabled) {\n debug('Web is disabled');\n // Use warnings from the web support setup.\n break;\n }\n\n // Ensure the Webpack dev server is running first\n if (!devServerManager.getWebDevServer()) {\n debug('Starting up webpack dev server');\n await devServerManager.ensureWebDevServerRunningAsync();\n // When this is the first time webpack is started, reprint the connection info.\n actions.printDevServerInfo(usageOptions);\n }\n\n Log.log(`${BLT} Open in the web browser...`);\n try {\n await devServerManager.getWebDevServer()?.openPlatformAsync('desktop');\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n break;\n }\n case 'c':\n Log.clear();\n return actions.printDevServerInfo(usageOptions);\n case 'j':\n return actions.openJsInspectorAsync();\n case 'r':\n return actions.reloadApp();\n case 'o':\n Log.log(`${BLT} Opening the editor...`);\n return openInEditorAsync(devServerManager.projectRoot);\n }\n };\n\n const keyPressHandler = new KeyPressHandler(onPressAsync);\n\n const listener = keyPressHandler.createInteractionListener();\n\n addInteractionListener(listener);\n\n // Start observing...\n keyPressHandler.startInterceptingKeyStrokes();\n}\n"],"names":["startInterfaceAsync","Log","debug","require","CTRL_C","CTRL_D","CTRL_L","PLATFORM_SETTINGS","android","name","key","launchTarget","ios","devServerManager","options","actions","DevServerManagerActions","isWebSocketsEnabled","getDefaultDevServer","isTargetingNative","usageOptions","devClient","printDevServerInfo","onPressAsync","pauseInteractions","spinners","getAllSpinners","forEach","spinner","fail","currentProgress","getProgressBar","terminate","setProgressBar","ora","text","color","start","stopAsync","stopAndPersist","symbol","process","emit","exit","error","clear","printUsage","verbose","toggleDevMenu","openMoreToolsAsync","platforms","includes","toLowerCase","platform","shouldPrompt","server","settings","log","BLT","warn","chalk","openPlatformAsync","printHelp","AbortCommandError","exception","toggleRuntimeMode","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","push","e","message","isDisabled","getWebDevServer","ensureWebDevServerRunningAsync","openJsInspectorAsync","reloadApp","openInEditorAsync","projectRoot","keyPressHandler","KeyPressHandler","listener","createInteractionListener","addInteractionListener","startInterceptingKeyStrokes"],"mappings":"AAAA;;;;QAoCsBA,mBAAmB,GAAnBA,mBAAmB;AApCvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACmB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACpB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAClB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACN,IAAA,SAAsB,WAAtB,sBAAsB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACjC,IAAA,8BAA6C,WAA7C,6CAA6C,CAAA;AAE3D,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACM,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,AAAsB,AAAC;AAE5F,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,IAAQ,AAAC;AAExB,MAAMC,iBAAiB,GAGnB;IACFC,OAAO,EAAE;QACPC,IAAI,EAAE,SAAS;QACfC,GAAG,EAAE,SAAS;QACdC,YAAY,EAAE,UAAU;KACzB;IACDC,GAAG,EAAE;QACHH,IAAI,EAAE,KAAK;QACXC,GAAG,EAAE,KAAK;QACVC,YAAY,EAAE,WAAW;KAC1B;CACF,AAAC;AAEK,eAAeX,mBAAmB,CACvCa,gBAAkC,EAClCC,OAAsD,EACtD;QAG4BD,IAAsC;IAFlE,MAAME,OAAO,GAAG,IAAIC,m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AAS,CAAC,CAAA,CAAC;wBACvEC,CAAAA,GAAAA,cAAS,AAAE,CAAA,UAAF,EAAE,CAAC;qBACb,CAAC,OAAOlB,KAAK,EAAO;wBACnB,IAAI,CAAC,CAACA,KAAK,YAAYmB,OAAiB,kBAAA,CAAC,EAAE;4BACzC9D,GAAG,CAAC+D,SAAS,CAACpB,KAAK,CAAC,CAAC;yBACtB;qBACF;oBACD,MAAM;iBACP;YACD,KAAK,GAAG;gBACN3C,GAAG,CAAC4C,KAAK,EAAE,CAAC;gBACZ,OAAO9B,OAAO,CAACO,kBAAkB,CAACF,YAAY,CAAC,CAAC;YAClD,KAAK,GAAG;gBACN,OAAOL,OAAO,CAAC2D,oBAAoB,EAAE,CAAC;YACxC,KAAK,GAAG;gBACN,OAAO3D,OAAO,CAAC4D,SAAS,EAAE,CAAC;YAC7B,KAAK,GAAG;gBACN1E,GAAG,CAACwD,GAAG,CAAC,CAAC,EAAEC,cAAG,IAAA,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBACxC,OAAOkB,CAAAA,GAAAA,OAAiB,AAA8B,CAAA,kBAA9B,CAAC/D,gBAAgB,CAACgE,WAAW,CAAC,CAAC;SAC1D;KACF,AAAC;IAEF,MAAMC,eAAe,GAAG,IAAIC,gBAAe,gBAAA,CAACxD,YAAY,CAAC,AAAC;IAE1D,MAAMyD,QAAQ,GAAGF,eAAe,CAACG,yBAAyB,EAAE,AAAC;IAE7DC,CAAAA,GAAAA,QAAsB,AAAU,CAAA,uBAAV,CAACF,QAAQ,CAAC,CAAC;IAEjC,qBAAqB;IACrBF,eAAe,CAACK,2BAA2B,EAAE,CAAC;CAC/C"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/startInterface.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { KeyPressHandler } from './KeyPressHandler';\nimport { BLT, printHelp, printUsage, StartOptions } from './commandsTable';\nimport { DevServerManagerActions } from './interactiveActions';\nimport * as Log from '../../log';\nimport { openInEditorAsync } from '../../utils/editor';\nimport { AbortCommandError } from '../../utils/errors';\nimport { getAllSpinners, ora } from '../../utils/ora';\nimport { getProgressBar, setProgressBar } from '../../utils/progress';\nimport { addInteractionListener, pauseInteractions } from '../../utils/prompts';\nimport { WebSupportProjectPrerequisite } from '../doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../server/DevServerManager';\n\nconst debug = require('debug')('expo:start:interface:startInterface') as typeof console.log;\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\nconst CTRL_L = '\\u000C';\n\nconst PLATFORM_SETTINGS: Record<\n string,\n { name: string; key: 'android' | 'ios'; launchTarget: 'emulator' | 'simulator' }\n> = {\n android: {\n name: 'Android',\n key: 'android',\n launchTarget: 'emulator',\n },\n ios: {\n name: 'iOS',\n key: 'ios',\n launchTarget: 'simulator',\n },\n};\n\nexport async function startInterfaceAsync(\n devServerManager: DevServerManager,\n options: Pick<StartOptions, 'devClient' | 'platforms'>\n) {\n const actions = new DevServerManagerActions(devServerManager);\n\n const isWebSocketsEnabled = devServerManager.getDefaultDevServer()?.isTargetingNative();\n\n const usageOptions = {\n isWebSocketsEnabled,\n devClient: devServerManager.options.devClient,\n ...options,\n };\n\n actions.printDevServerInfo(usageOptions);\n\n const onPressAsync = async (key: string) => {\n // Auxillary commands all escape.\n switch (key) {\n case CTRL_C:\n case CTRL_D: {\n // Prevent terminal UI from accepting commands while the process is closing.\n // Without this, fast typers will close the server then start typing their\n // next command and have a bunch of unrelated things pop up.\n pauseInteractions();\n\n const spinners = getAllSpinners();\n spinners.forEach((spinner) => {\n spinner.fail();\n });\n\n const currentProgress = getProgressBar();\n if (currentProgress) {\n currentProgress.terminate();\n setProgressBar(null);\n }\n const spinner = ora({ text: 'Stopping server', color: 'white' }).start();\n try {\n await devServerManager.stopAsync();\n spinner.stopAndPersist({ text: 'Stopped server', symbol: `\\u203A` });\n // @ts-ignore: Argument of type '\"SIGINT\"' is not assignable to parameter of type '\"disconnect\"'.\n process.emit('SIGINT');\n\n // TODO: Is this the right place to do this?\n process.exit();\n } catch (error) {\n spinner.fail('Failed to stop server');\n throw error;\n }\n break;\n }\n case CTRL_L:\n return Log.clear();\n case '?':\n return printUsage(usageOptions, { verbose: true });\n }\n\n // Optionally enabled\n\n if (isWebSocketsEnabled) {\n switch (key) {\n case 'm':\n return actions.toggleDevMenu();\n case 'M':\n return actions.openMoreToolsAsync();\n }\n }\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n if (['i', 'a'].includes(key.toLowerCase())) {\n const platform = key.toLowerCase() === 'i' ? 'ios' : 'android';\n\n const shouldPrompt = ['I', 'A'].includes(key);\n if (shouldPrompt) {\n Log.clear();\n }\n\n const server = devServerManager.getDefaultDevServer();\n const settings = PLATFORM_SETTINGS[platform];\n\n Log.log(`${BLT} Opening on ${settings.name}...`);\n\n if (server.isTargetingNative() && !platforms.includes(settings.key)) {\n Log.warn(\n chalk`${settings.name} is disabled, enable it by adding {bold ${settings.key}} to the platforms array in your app.json or app.config.js`\n );\n } else {\n try {\n await server.openPlatformAsync(settings.launchTarget, { shouldPrompt });\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n }\n // Break out early.\n return;\n }\n\n switch (key) {\n case 's': {\n Log.clear();\n if (await devServerManager.toggleRuntimeMode()) {\n usageOptions.devClient = devServerManager.options.devClient;\n return actions.printDevServerInfo(usageOptions);\n }\n break;\n }\n case 'w': {\n try {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n if (!platforms.includes('web')) {\n platforms.push('web');\n options.platforms?.push('web');\n }\n } catch (e: any) {\n Log.warn(e.message);\n break;\n }\n\n const isDisabled = !platforms.includes('web');\n if (isDisabled) {\n debug('Web is disabled');\n // Use warnings from the web support setup.\n break;\n }\n\n // Ensure the Webpack dev server is running first\n if (!devServerManager.getWebDevServer()) {\n debug('Starting up webpack dev server');\n await devServerManager.ensureWebDevServerRunningAsync();\n // When this is the first time webpack is started, reprint the connection info.\n actions.printDevServerInfo(usageOptions);\n }\n\n Log.log(`${BLT} Open in the web browser...`);\n try {\n await devServerManager.getWebDevServer()?.openPlatformAsync('desktop');\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n break;\n }\n case 'c':\n Log.clear();\n return actions.printDevServerInfo(usageOptions);\n case 'j':\n return actions.openJsInspectorAsync();\n case 'r':\n return actions.reloadApp();\n case 'o':\n Log.log(`${BLT} Opening the editor...`);\n return openInEditorAsync(devServerManager.projectRoot);\n }\n };\n\n const keyPressHandler = new KeyPressHandler(onPressAsync);\n\n const listener = keyPressHandler.createInteractionListener();\n\n addInteractionListener(listener);\n\n // Start observing...\n keyPressHandler.startInterceptingKeyStrokes();\n}\n"],"names":["startInterfaceAsync","Log","debug","require","CTRL_C","CTRL_D","CTRL_L","PLATFORM_SETTINGS","android","name","key","launchTarget","ios","devServerManager","options","actions","DevServerManagerActions","isWebSocketsEnabled","getDefaultDevServer","isTargetingNative","usageOptions","devClient","printDevServerInfo","onPressAsync","pauseInteractions","spinners","getAllSpinners","forEach","spinner","fail","currentProgress","getProgressBar","terminate","setProgressBar","ora","text","color","start","stopAsync","stopAndPersist","symbol","process","emit","exit","error","clear","printUsage","verbose","toggleDevMenu","openMoreToolsAsync","platforms","includes","toLowerCase","platform","shouldPrompt","server","settings","log","BLT","warn","chalk","openPlatformAsync","printHelp","AbortCommandError","exception","toggleRuntimeMode","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","push","e","message","isDisabled","getWebDevServer","ensureWebDevServerRunningAsync","openJsInspectorAsync","reloadApp","openInEditorAsync","projectRoot","keyPressHandler","KeyPressHandler","listener","createInteractionListener","addInteractionListener","startInterceptingKeyStrokes"],"mappings":"AAAA;;;;QAoCsBA,mBAAmB,GAAnBA,mBAAmB;AApCvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEO,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACM,IAA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4C,KAAK,EAAE,CAAC;gBACZ,OAAO9B,OAAO,CAACO,kBAAkB,CAACF,YAAY,CAAC,CAAC;YAClD,KAAK,GAAG;gBACN,OAAOL,OAAO,CAAC2D,oBAAoB,EAAE,CAAC;YACxC,KAAK,GAAG;gBACN,OAAO3D,OAAO,CAAC4D,SAAS,EAAE,CAAC;YAC7B,KAAK,GAAG;gBACN1E,GAAG,CAACwD,GAAG,CAAC,CAAC,EAAEC,cAAG,IAAA,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBACxC,OAAOkB,CAAAA,GAAAA,OAAiB,AAA8B,CAAA,kBAA9B,CAAC/D,gBAAgB,CAACgE,WAAW,CAAC,CAAC;SAC1D;KACF,AAAC;IAEF,MAAMC,eAAe,GAAG,IAAIC,gBAAe,gBAAA,CAACxD,YAAY,CAAC,AAAC;IAE1D,MAAMyD,QAAQ,GAAGF,eAAe,CAACG,yBAAyB,EAAE,AAAC;IAE7DC,CAAAA,GAAAA,QAAsB,AAAU,CAAA,uBAAV,CAACF,QAAQ,CAAC,CAAC;IAEjC,qBAAqB;IACrBF,eAAe,CAACK,2BAA2B,EAAE,CAAC;CAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/platforms/ExpoGoInstaller.ts"],"sourcesContent":["import semver from 'semver';\n\nimport { getVersionsAsync } from '../../api/getVersions';\nimport * as Log from '../../log';\nimport { downloadExpoGoAsync } from '../../utils/downloadExpoGoAsync';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { logNewSection } from '../../utils/ora';\nimport { confirmAsync } from '../../utils/prompts';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/platforms/ExpoGoInstaller.ts"],"sourcesContent":["import semver from 'semver';\n\nimport type { DeviceManager } from './DeviceManager';\nimport { getVersionsAsync } from '../../api/getVersions';\nimport * as Log from '../../log';\nimport { downloadExpoGoAsync } from '../../utils/downloadExpoGoAsync';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { logNewSection } from '../../utils/ora';\nimport { confirmAsync } from '../../utils/prompts';\n\nconst debug = require('debug')('expo:utils:ExpoGoInstaller') as typeof console.log;\n\n/** Given a platform, appId, and sdkVersion, this module will ensure that Expo Go is up-to-date on the provided device. */\nexport class ExpoGoInstaller<IDevice> {\n // Keep a list of [platform-deviceId] so we can prevent asking multiple times if a user wants to upgrade.\n // This can prevent annoying interactions when they don't want to upgrade for whatever reason.\n static cache: Record<string, boolean> = {};\n\n constructor(\n private platform: 'ios' | 'android',\n // Ultimately this should be inlined since we know the platform.\n private appId: string,\n private sdkVersion?: string\n ) {}\n\n /** Returns true if the installed app matching the previously provided `appId` is outdated. */\n async isClientOutdatedAsync(device: DeviceManager<IDevice>): Promise<boolean> {\n const installedVersion = await device.getAppVersionAsync(this.appId);\n if (!installedVersion) {\n return true;\n }\n const version = await this._getExpectedClientVersionAsync();\n debug(`Expected Expo Go version: ${version}, installed version: ${installedVersion}`);\n return version ? !semver.eq(installedVersion, version) : true;\n }\n\n /** Returns the expected version of Expo Go given the project SDK Version. Exposed for testing. */\n async _getExpectedClientVersionAsync(): Promise<string | null> {\n const versions = await getVersionsAsync();\n // Like `sdkVersions['44.0.0']['androidClientVersion'] = '1.0.0'`\n const specificVersion =\n versions?.sdkVersions?.[this.sdkVersion!]?.[`${this.platform}ClientVersion`];\n const latestVersion = versions[`${this.platform}Version`];\n return specificVersion ?? latestVersion ?? null;\n }\n\n /** Returns a boolean indicating if Expo Go should be installed. Returns `true` if the app was uninstalled. */\n async uninstallExpoGoIfOutdatedAsync(deviceManager: DeviceManager<IDevice>): Promise<boolean> {\n const cacheId = `${this.platform}-${deviceManager.identifier}`;\n\n if (ExpoGoInstaller.cache[cacheId]) {\n debug('skipping subsequent upgrade check');\n return false;\n }\n ExpoGoInstaller.cache[cacheId] = true;\n\n if (await this.isClientOutdatedAsync(deviceManager)) {\n if (this.sdkVersion === 'UNVERSIONED') {\n // This should only happen in the expo/expo repo, e.g. `apps/test-suite`\n Log.log(\n `Skipping Expo Go upgrade check for UNVERSIONED project. Manually ensure the Expo Go app is built from source.`\n );\n return false;\n }\n\n // Only prompt once per device, per run.\n const confirm = await confirmAsync({\n initial: true,\n message: `Expo Go on ${deviceManager.name} is outdated, would you like to upgrade?`,\n });\n if (confirm) {\n // Don't need to uninstall to update on iOS.\n if (this.platform !== 'ios') {\n Log.log(`Uninstalling Expo Go from ${this.platform} device ${deviceManager.name}.`);\n await deviceManager.uninstallAppAsync(this.appId);\n }\n return true;\n }\n }\n return false;\n }\n\n /** Check if a given device has Expo Go installed, if not then download and install it. */\n async ensureAsync(deviceManager: DeviceManager<IDevice>): Promise<boolean> {\n let shouldInstall = !(await deviceManager.isAppInstalledAsync(this.appId));\n\n if (env.EXPO_OFFLINE) {\n if (!shouldInstall) {\n Log.warn(`Skipping Expo Go version validation in offline mode`);\n return false;\n }\n throw new CommandError(\n 'NO_EXPO_GO',\n `Expo Go is not installed on device \"${deviceManager.name}\", while running in offline mode. Manually install Expo Go or run without --offline flag (or EXPO_OFFLINE environment variable).`\n );\n }\n\n if (!shouldInstall) {\n shouldInstall = await this.uninstallExpoGoIfOutdatedAsync(deviceManager);\n }\n\n if (shouldInstall) {\n // Download the Expo Go app from the Expo servers.\n const binaryPath = await downloadExpoGoAsync(this.platform, { sdkVersion: this.sdkVersion });\n // Install the app on the device.\n const ora = logNewSection(`Installing Expo Go on ${deviceManager.name}`);\n try {\n await deviceManager.installAppAsync(binaryPath);\n } finally {\n ora.stop();\n }\n return true;\n }\n return false;\n }\n}\n"],"names":["Log","debug","require","ExpoGoInstaller","cache","constructor","platform","appId","sdkVersion","isClientOutdatedAsync","device","installedVersion","getAppVersionAsync","version","_getExpectedClientVersionAsync","semver","eq","versions","getVersionsAsync","specificVersion","sdkVersions","latestVersion","uninstallExpoGoIfOutdatedAsync","deviceManager","cacheId","identifier","log","confirm","confirmAsync","initial","message","name","uninstallAppAsync","ensureAsync","shouldInstall","isAppInstalledAsync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C;SAC1E;QAED,IAAIW,aAAa,EAAE;YACjB,kDAAkD;YAClD,MAAMM,UAAU,GAAG,MAAMC,CAAAA,GAAAA,oBAAmB,AAAgD,CAAA,oBAAhD,CAAC,IAAI,CAACnC,QAAQ,EAAE;gBAAEE,UAAU,EAAE,IAAI,CAACA,UAAU;aAAE,CAAC,AAAC;YAC7F,iCAAiC;YACjC,MAAMkC,GAAG,GAAGC,CAAAA,GAAAA,IAAa,AAA+C,CAAA,cAA/C,CAAC,CAAC,sBAAsB,EAAEpB,aAAa,CAACQ,IAAI,CAAC,CAAC,CAAC,AAAC;YACzE,IAAI;gBACF,MAAMR,aAAa,CAACqB,eAAe,CAACJ,UAAU,CAAC,CAAC;aACjD,QAAS;gBACRE,GAAG,CAACG,IAAI,EAAE,CAAC;aACZ;YACD,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;KACd;CACF;QAtGY1C,eAAe,GAAfA,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/platforms/PlatformManager.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport { Log } from '../../log';\nimport { logEventAsync } from '../../utils/analytics/rudderstackClient';\nimport { CommandError, UnimplementedError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport { AppIdResolver } from './AppIdResolver';\nimport { DeviceManager } from './DeviceManager';\n\nconst debug = require('debug')('expo:start:platforms:platformManager') as typeof console.log;\n\nexport interface BaseOpenInCustomProps {\n scheme?: string;\n applicationId?: string | null;\n}\n\nexport interface BaseResolveDeviceProps<IDevice> {\n /** Should prompt the user to select a device. */\n shouldPrompt?: boolean;\n /** The target device to use. */\n device?: IDevice;\n}\n\n/** An abstract class for launching a URL on a device. */\nexport class PlatformManager<\n IDevice,\n IOpenInCustomProps extends BaseOpenInCustomProps = BaseOpenInCustomProps,\n IResolveDeviceProps extends BaseResolveDeviceProps<IDevice> = BaseResolveDeviceProps<IDevice>\n> {\n constructor(\n protected projectRoot: string,\n protected props: {\n platform: 'ios' | 'android';\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /**\n * Get redirect URL for native disambiguation.\n * @returns a URL like `http://localhost:8081/_expo/loading`\n */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n /** Resolve a device, this function should automatically handle opening the device and asserting any system validations. */\n resolveDeviceAsync: (\n resolver?: Partial<IResolveDeviceProps>\n ) => Promise<DeviceManager<IDevice>>;\n }\n ) {}\n\n /** Returns the project application identifier or asserts that one is not defined. Exposed for testing. */\n _getAppIdResolver(): AppIdResolver {\n throw new UnimplementedError();\n }\n\n /**\n * Get the URL for users intending to launch the project in Expo Go.\n * The CLI will check if the project has a custom dev client and if the redirect page feature is enabled.\n * If both are true, the CLI will return the redirect page URL.\n */\n protected async getExpoGoOrCustomRuntimeUrlAsync(\n deviceManager: DeviceManager<IDevice>\n ): Promise<string> {\n // Determine if the redirect page feature is enabled first since it's the cheapest to check.\n const redirectUrl = this.props.getRedirectUrl();\n if (redirectUrl) {\n // If the redirect page feature is enabled, check if the project has a resolvable native identifier.\n let applicationId;\n try {\n applicationId = await this._getAppIdResolver().getAppIdAsync();\n } catch {\n Log.warn(\n chalk`\\u203A Launching in Expo Go. If you want to use a ` +\n `development build, you need to create and install one first, or, if you already ` +\n chalk`have a build, add {bold ios.bundleIdentifier} and {bold android.package} to ` +\n `this project's app config.\\n${learnMore('https://docs.expo.dev/development/build/')}`\n );\n }\n if (applicationId) {\n debug(`Resolving launch URL: (appId: ${applicationId}, redirect URL: ${redirectUrl})`);\n // NOTE(EvanBacon): This adds considerable amount of time to the command, we should consider removing or memoizing it.\n // Finally determine if the target device has a custom dev client installed.\n if (await deviceManager.isAppInstalledAsync(applicationId)) {\n return redirectUrl;\n } else {\n // Log a warning if no development build is available on the device, but the\n // interstitial page would otherwise be opened.\n Log.warn(\n chalk`\\u203A The {bold expo-dev-client} package is installed, but a development build is not ` +\n chalk`installed on {bold ${deviceManager.name}}.\\nLaunching in Expo Go. If you want to use a ` +\n `development build, you need to create and install one first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n }\n }\n\n return this.props.getExpoGoUrl();\n }\n\n protected async openProjectInExpoGoAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n const url = await this.getExpoGoOrCustomRuntimeUrlAsync(deviceManager);\n\n deviceManager.logOpeningUrl(url);\n\n // TODO: Expensive, we should only do this once.\n const { exp } = getConfig(this.projectRoot);\n const installedExpo = await deviceManager.ensureExpoGoAsync(exp.sdkVersion);\n\n deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo,\n });\n\n return { url };\n }\n\n private async openProjectInCustomRuntimeAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {},\n props: Partial<IOpenInCustomProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open custom (${Object.entries(props)\n .map(([k, v]) => `${k}: ${v}`)\n .join(', ')})`\n );\n\n let url = this.props.getCustomRuntimeUrl({ scheme: props.scheme });\n debug(`Opening project in custom runtime: ${url} -- %O`, props);\n // TODO: It's unclear why we do application id validation when opening with a URL\n const applicationId = props.applicationId ?? (await this._getAppIdResolver().getAppIdAsync());\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n\n if (!(await deviceManager.isAppInstalledAsync(applicationId))) {\n throw new CommandError(\n `No development build (${applicationId}) for this project is installed. ` +\n `Please make and install a development build on the device first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n // TODO: Rethink analytics\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo: false,\n });\n\n if (!url) {\n url = this._resolveAlternativeLaunchUrl(applicationId, props);\n }\n\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return {\n url,\n };\n }\n\n /** Launch the project on a device given the input runtime. */\n async openAsync(\n options:\n | {\n runtime: 'expo' | 'web';\n }\n | {\n runtime: 'custom';\n props?: Partial<IOpenInCustomProps>;\n },\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open (runtime: ${options.runtime}, platform: ${this.props.platform}, device: %O, shouldPrompt: ${resolveSettings.shouldPrompt})`,\n resolveSettings.device\n );\n if (options.runtime === 'expo') {\n return this.openProjectInExpoGoAsync(resolveSettings);\n } else if (options.runtime === 'web') {\n return this.openWebProjectAsync(resolveSettings);\n } else if (options.runtime === 'custom') {\n return this.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n } else {\n throw new CommandError(`Invalid runtime target: ${options.runtime}`);\n }\n }\n\n /** Open the current web project (Webpack) in a device . */\n private async openWebProjectAsync(resolveSettings: Partial<IResolveDeviceProps> = {}): Promise<{\n url: string;\n }> {\n const url = this.props.getDevServerUrl();\n assert(url, 'Dev server is not running.');\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return { url };\n }\n\n /** If the launch URL cannot be determined (`custom` runtimes) then an alternative string can be provided to open the device. Often a device ID or activity to launch. Exposed for testing. */\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props: Partial<IOpenInCustomProps> = {}\n ): string {\n throw new UnimplementedError();\n }\n}\n"],"names":["debug","require","PlatformManager","constructor","projectRoot","props","_getAppIdResolver","UnimplementedError","getExpoGoOrCustomRuntimeUrlAsync","deviceManager","redirectUrl","getRedirectUrl","applicationId","getAppIdAsync","Log","warn","chalk","learnMore","isAppInstalledAsync","name","getExpoGoUrl","openProjectInExpoGoAsync","resolveSettings","resolveDeviceAsync","url","logOpeningUrl","exp","getConfig","installedExpo","ensureExpoGoAsync","sdkVersion","activateWindowAsync","openUrlAsync","logEventAsync","platform","openProjectInCustomRuntimeAsync","Object","entries","map","k","v","join","getCustomRuntimeUrl","scheme","CommandError","_resolveAlternativeLaunchUrl","openAsync","options","runtime","shouldPrompt","device","openWebProjectAsync","getDevServerUrl","assert"],"mappings":"AAAA;;;;AAA0B,IAAA,OAAc,WAAd,cAAc,CAAA;AACrB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEL,IAAA,IAAW,WAAX,WAAW,CAAA;AACD,IAAA,kBAAyC,WAAzC,yCAAyC,CAAA;AACtB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAC3C,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;;;;;;AAI5C,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,AAAsB,AAAC;AAetF,MAAMC,eAAe;IAK1BC,YACYC,WAAmB,EACnBC,KAiBT,CACD;aAnBUD,WAAmB,GAAnBA,WAAmB;aACnBC,KAiBT,GAjBSA,KAiBT;KACC;IAEJ,0GAA0G,CAC1GC,iBAAiB,GAAkB;QACjC,MAAM,IAAIC,OAAkB,mBAAA,EAAE,CAAC;KAChC;IAED;;;;KAIG,CACH,MAAgBC,gCAAgC,CAC9CC,aAAqC,EACpB;QACjB,4FAA4F;QAC5F,MAAMC,WAAW,GAAG,IAAI,CAACL,KAAK,CAACM,cAAc,EAAE,AAAC;QAChD,IAAID,WAAW,EAAE;YACf,oGAAoG;YACpG,IAAIE,aAAa,AAAC;YAClB,IAAI;gBACFA,aAAa,GAAG,MAAM,IAAI,CAACN,iBAAiB,EAAE,CAACO,aAAa,EAAE,CAAC;aAChE,CAAC,OAAM;gBACNC,IAAG,IAAA,CAACC,IAAI,CACNC,MAAK,QAAA,CAAC,kDAAkD,CAAC,GACvD,CAAC,gFAAgF,CAAC,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AO,KAAK,KAAK,EAAE;YACpC,OAAO,IAAI,CAACG,mBAAmB,CAAC7B,eAAe,CAAC,CAAC;SAClD,MAAM,IAAIyB,OAAO,CAACC,OAAO,KAAK,QAAQ,EAAE;YACvC,OAAO,IAAI,CAACb,+BAA+B,CAACb,eAAe,EAAEyB,OAAO,CAAC1C,KAAK,CAAC,CAAC;SAC7E,MAAM;YACL,MAAM,IAAIuC,OAAY,aAAA,CAAC,CAAC,wBAAwB,EAAEG,OAAO,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC;SACtE;KACF;IAED,2DAA2D,CAC3D,MAAcG,mBAAmB,CAAC7B,eAA6C,GAAG,EAAE,EAEjF;QACD,MAAME,GAAG,GAAG,IAAI,CAACnB,KAAK,CAAC+C,eAAe,EAAE,AAAC;QACzCC,CAAAA,GAAAA,OAAM,AAAmC,CAAA,QAAnC,CAAC7B,GAAG,EAAE,4BAA4B,CAAC,CAAC;QAE1C,MAAMf,aAAa,GAAG,MAAM,IAAI,CAACJ,KAAK,CAACkB,kBAAkB,CAACD,eAAe,CAAC,AAAC;QAC3Eb,aAAa,CAACgB,aAAa,CAACD,GAAG,CAAC,CAAC;QACjC,MAAMf,aAAa,CAACsB,mBAAmB,EAAE,CAAC;QAC1C,MAAMtB,aAAa,CAACuB,YAAY,CAACR,GAAG,CAAC,CAAC;QAEtC,OAAO;YAAEA,GAAG;SAAE,CAAC;KAChB;IAED,8LAA8L,CAC9LqB,4BAA4B,CAC1BjC,aAAqB,EACrBP,KAAkC,GAAG,EAAE,EAC/B;QACR,MAAM,IAAIE,OAAkB,mBAAA,EAAE,CAAC;KAChC;CACF;QAnMYL,eAAe,GAAfA,eAAe"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/platforms/PlatformManager.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport { AppIdResolver } from './AppIdResolver';\nimport { DeviceManager } from './DeviceManager';\nimport { Log } from '../../log';\nimport { logEventAsync } from '../../utils/analytics/rudderstackClient';\nimport { CommandError, UnimplementedError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:platformManager') as typeof console.log;\n\nexport interface BaseOpenInCustomProps {\n scheme?: string;\n applicationId?: string | null;\n}\n\nexport interface BaseResolveDeviceProps<IDevice> {\n /** Should prompt the user to select a device. */\n shouldPrompt?: boolean;\n /** The target device to use. */\n device?: IDevice;\n}\n\n/** An abstract class for launching a URL on a device. */\nexport class PlatformManager<\n IDevice,\n IOpenInCustomProps extends BaseOpenInCustomProps = BaseOpenInCustomProps,\n IResolveDeviceProps extends BaseResolveDeviceProps<IDevice> = BaseResolveDeviceProps<IDevice>,\n> {\n constructor(\n protected projectRoot: string,\n protected props: {\n platform: 'ios' | 'android';\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /**\n * Get redirect URL for native disambiguation.\n * @returns a URL like `http://localhost:8081/_expo/loading`\n */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n /** Resolve a device, this function should automatically handle opening the device and asserting any system validations. */\n resolveDeviceAsync: (\n resolver?: Partial<IResolveDeviceProps>\n ) => Promise<DeviceManager<IDevice>>;\n }\n ) {}\n\n /** Returns the project application identifier or asserts that one is not defined. Exposed for testing. */\n _getAppIdResolver(): AppIdResolver {\n throw new UnimplementedError();\n }\n\n /**\n * Get the URL for users intending to launch the project in Expo Go.\n * The CLI will check if the project has a custom dev client and if the redirect page feature is enabled.\n * If both are true, the CLI will return the redirect page URL.\n */\n protected async getExpoGoOrCustomRuntimeUrlAsync(\n deviceManager: DeviceManager<IDevice>\n ): Promise<string> {\n // Determine if the redirect page feature is enabled first since it's the cheapest to check.\n const redirectUrl = this.props.getRedirectUrl();\n if (redirectUrl) {\n // If the redirect page feature is enabled, check if the project has a resolvable native identifier.\n let applicationId;\n try {\n applicationId = await this._getAppIdResolver().getAppIdAsync();\n } catch {\n Log.warn(\n chalk`\\u203A Launching in Expo Go. If you want to use a ` +\n `development build, you need to create and install one first, or, if you already ` +\n chalk`have a build, add {bold ios.bundleIdentifier} and {bold android.package} to ` +\n `this project's app config.\\n${learnMore('https://docs.expo.dev/development/build/')}`\n );\n }\n if (applicationId) {\n debug(`Resolving launch URL: (appId: ${applicationId}, redirect URL: ${redirectUrl})`);\n // NOTE(EvanBacon): This adds considerable amount of time to the command, we should consider removing or memoizing it.\n // Finally determine if the target device has a custom dev client installed.\n if (await deviceManager.isAppInstalledAsync(applicationId)) {\n return redirectUrl;\n } else {\n // Log a warning if no development build is available on the device, but the\n // interstitial page would otherwise be opened.\n Log.warn(\n chalk`\\u203A The {bold expo-dev-client} package is installed, but a development build is not ` +\n chalk`installed on {bold ${deviceManager.name}}.\\nLaunching in Expo Go. If you want to use a ` +\n `development build, you need to create and install one first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n }\n }\n\n return this.props.getExpoGoUrl();\n }\n\n protected async openProjectInExpoGoAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n const url = await this.getExpoGoOrCustomRuntimeUrlAsync(deviceManager);\n\n deviceManager.logOpeningUrl(url);\n\n // TODO: Expensive, we should only do this once.\n const { exp } = getConfig(this.projectRoot);\n const installedExpo = await deviceManager.ensureExpoGoAsync(exp.sdkVersion);\n\n deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo,\n });\n\n return { url };\n }\n\n private async openProjectInCustomRuntimeAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {},\n props: Partial<IOpenInCustomProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open custom (${Object.entries(props)\n .map(([k, v]) => `${k}: ${v}`)\n .join(', ')})`\n );\n\n let url = this.props.getCustomRuntimeUrl({ scheme: props.scheme });\n debug(`Opening project in custom runtime: ${url} -- %O`, props);\n // TODO: It's unclear why we do application id validation when opening with a URL\n const applicationId = props.applicationId ?? (await this._getAppIdResolver().getAppIdAsync());\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n\n if (!(await deviceManager.isAppInstalledAsync(applicationId))) {\n throw new CommandError(\n `No development build (${applicationId}) for this project is installed. ` +\n `Please make and install a development build on the device first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n // TODO: Rethink analytics\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo: false,\n });\n\n if (!url) {\n url = this._resolveAlternativeLaunchUrl(applicationId, props);\n }\n\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return {\n url,\n };\n }\n\n /** Launch the project on a device given the input runtime. */\n async openAsync(\n options:\n | {\n runtime: 'expo' | 'web';\n }\n | {\n runtime: 'custom';\n props?: Partial<IOpenInCustomProps>;\n },\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open (runtime: ${options.runtime}, platform: ${this.props.platform}, device: %O, shouldPrompt: ${resolveSettings.shouldPrompt})`,\n resolveSettings.device\n );\n if (options.runtime === 'expo') {\n return this.openProjectInExpoGoAsync(resolveSettings);\n } else if (options.runtime === 'web') {\n return this.openWebProjectAsync(resolveSettings);\n } else if (options.runtime === 'custom') {\n return this.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n } else {\n throw new CommandError(`Invalid runtime target: ${options.runtime}`);\n }\n }\n\n /** Open the current web project (Webpack) in a device . */\n private async openWebProjectAsync(resolveSettings: Partial<IResolveDeviceProps> = {}): Promise<{\n url: string;\n }> {\n const url = this.props.getDevServerUrl();\n assert(url, 'Dev server is not running.');\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return { url };\n }\n\n /** If the launch URL cannot be determined (`custom` runtimes) then an alternative string can be provided to open the device. Often a device ID or activity to launch. Exposed for testing. */\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props: Partial<IOpenInCustomProps> = {}\n ): string {\n throw new UnimplementedError();\n }\n}\n"],"names":["debug","require","PlatformManager","constructor","projectRoot","props","_getAppIdResolver","UnimplementedError","getExpoGoOrCustomRuntimeUrlAsync","deviceManager","redirectUrl","getRedirectUrl","applicationId","getAppIdAsync","Log","warn","chalk","learnMore","isAppInstalledAsync","name","getExpoGoUrl","openProjectInExpoGoAsync","resolveSettings","resolveDeviceAsync","url","logOpeningUrl","exp","getConfig","installedExpo","ensureExpoGoAsync","sdkVersion","activateWindowAsync","openUrlAsync","logEventAsync","platform","openProjectInCustomRuntimeAsync","Object","entries","map","k","v","join","getCustomRuntimeUrl","scheme","CommandError","_resolveAlternativeLaunchUrl","openAsync","options","runtime","shouldPrompt","device","openWebProjectAsync","getDevServerUrl","assert"],"mappings":"AAAA;;;;AAA0B,IAAA,OAAc,WAAd,cAAc,CAAA;AACrB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAIL,IAAA,IAAW,WAAX,WAAW,CAAA;AACD,IAAA,kBAAyC,WAAzC,yCAAyC,CAAA;AACtB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAC3C,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;;;;;;AAE5C,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,AAAsB,AAAC;AAetF,MAAMC,eAAe;IAK1BC,YACYC,WAAmB,EACnBC,KAiBT,CACD;aAnBUD,WAAmB,GAAnBA,WAAmB;aACnBC,KAiBT,GAjBSA,KAiBT;KACC;IAEJ,0GAA0G,CAC1GC,iBAAiB,GAAkB;QACjC,MAAM,IAAIC,OAAkB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AY,CAACR,GAAG,CAAC,CAAC;QAEtC,OAAO;YAAEA,GAAG;SAAE,CAAC;KAChB;IAED,8LAA8L,CAC9LqB,4BAA4B,CAC1BjC,aAAqB,EACrBP,KAAkC,GAAG,EAAE,EAC/B;QACR,MAAM,IAAIE,OAAkB,mBAAA,EAAE,CAAC;KAChC;CACF;QAnMYL,eAAe,GAAfA,eAAe"}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
var _spawnAsync = _interopRequireDefault(require("@expo/spawn-async"));
|
|
6
6
|
var _childProcess = require("child_process");
|
|
7
|
+
var _androidSdk = require("./AndroidSdk");
|
|
7
8
|
var _log = require("../../../log");
|
|
8
9
|
var _errors = require("../../../utils/errors");
|
|
9
10
|
var _exit = require("../../../utils/exit");
|
|
10
|
-
var _androidSdk = require("./AndroidSdk");
|
|
11
11
|
function _interopRequireDefault(obj) {
|
|
12
12
|
return obj && obj.__esModule ? obj : {
|
|
13
13
|
default: obj
|