@expo/cli 0.17.10 → 0.18.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 +11 -7
- package/build/bin/cli.map +1 -1
- package/build/src/api/getExpoSchema.js +23 -5
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/graphql/client.js +28 -10
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +16 -4
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +8 -2
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/graphql/types/App.js +8 -2
- package/build/src/api/graphql/types/App.js.map +1 -1
- package/build/src/api/rest/cache/FileSystemCache.js +21 -9
- package/build/src/api/rest/cache/FileSystemCache.js.map +1 -1
- package/build/src/api/rest/cache/response.js +9 -3
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js +32 -8
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +23 -5
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js +9 -4
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProxy.js +8 -2
- package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
- package/build/src/api/settings.js +8 -2
- package/build/src/api/settings.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +18 -6
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +26 -8
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +17 -5
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +32 -8
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +17 -5
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +19 -12
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +25 -7
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +9 -3
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js +8 -2
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +16 -4
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js +10 -4
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/templates.js +33 -9
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js +8 -2
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +8 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +58 -18
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +17 -5
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +8 -2
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +16 -4
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +32 -12
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +27 -9
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +10 -2
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +29 -17
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +69 -37
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +33 -9
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +61 -16
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js +8 -2
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js +15 -3
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/index.js +11 -5
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +9 -3
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +27 -15
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +18 -6
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +8 -2
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +43 -19
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +16 -4
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +9 -3
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/install/applyPlugins.js +8 -2
- package/build/src/install/applyPlugins.js.map +1 -1
- package/build/src/install/checkPackages.js +18 -6
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +8 -2
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js +14 -8
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +27 -9
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +17 -5
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +17 -5
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/log.js +9 -3
- package/build/src/log.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +37 -13
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +16 -4
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +29 -11
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js +24 -6
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +14 -8
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +9 -3
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +119 -0
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -0
- package/build/src/prebuild/resolveOptions.js +32 -8
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +44 -14
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +18 -2
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -13
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +16 -4
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/run/android/index.js +20 -4
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +55 -0
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -0
- package/build/src/run/android/resolveInstallApkName.js +18 -6
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +10 -4
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js +5 -3
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +13 -4
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js +15 -3
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +10 -4
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +8 -2
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +57 -21
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +25 -7
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js +10 -4
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +34 -10
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +16 -4
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +8 -2
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +17 -5
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +17 -5
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +25 -7
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +24 -6
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +8 -2
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +16 -4
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +8 -2
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +16 -4
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +16 -4
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +17 -5
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +8 -2
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +9 -3
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js +25 -7
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +22 -10
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +19 -7
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +17 -5
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +9 -3
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +1 -2
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +27 -9
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js +8 -2
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +10 -2
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/startBundler.js +16 -4
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/detectDevClient.js +29 -0
- package/build/src/start/detectDevClient.js.map +1 -0
- package/build/src/start/doctor/SecurityBinPrerequisite.js +8 -2
- package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +16 -4
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +16 -4
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +79 -29
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcrunPrerequisite.js +24 -6
- package/build/src/start/doctor/apple/XcrunPrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +25 -7
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +27 -9
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +24 -6
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +8 -2
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +25 -7
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +32 -21
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +33 -9
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +18 -6
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +29 -11
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +18 -6
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +17 -11
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +27 -9
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +17 -11
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +8 -2
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +9 -3
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js +8 -2
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +30 -14
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +33 -13
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +17 -5
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js +13 -7
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js +19 -7
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +34 -10
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js +16 -4
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +21 -4
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +32 -8
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +23 -6
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +10 -4
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js +26 -8
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +50 -18
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/assertSystemRequirements.js +4 -3
- package/build/src/start/platforms/ios/assertSystemRequirements.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +16 -4
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +8 -2
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +9 -3
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +12 -6
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +40 -10
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +16 -4
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/dotExpo.js +27 -9
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/resolveOptions.js +33 -15
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +34 -10
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +16 -4
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +28 -10
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +16 -4
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +9 -3
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/ReactDevToolsProxy.js +26 -8
- package/build/src/start/server/ReactDevToolsProxy.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +19 -6
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +91 -55
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +231 -83
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +30 -15
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +26 -8
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +56 -20
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +90 -45
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +29 -28
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/MessageHandler.js +27 -0
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +11 -8
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js +63 -0
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers/utils.js → getDebuggerType.js} +1 -6
- package/build/src/start/server/metro/debugging/getDebuggerType.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/NetworkResponse.js +8 -5
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/PageReload.js +7 -6
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js +25 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js +22 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js +28 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/debugging/{inspectorHandlers → messageHandlers}/VscodeRuntimeGetProperties.js +10 -6
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/pageIsSupported.js +14 -0
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -0
- package/build/src/start/server/metro/debugging/types.js.map +1 -0
- package/build/src/start/server/metro/externals.js +51 -64
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +8 -2
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +8 -2
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +34 -10
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +96 -30
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +40 -21
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroVirtualModules.js +82 -0
- package/build/src/start/server/metro/metroVirtualModules.js.map +1 -0
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +8 -2
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/router.js +44 -17
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +56 -14
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +25 -12
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +8 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +148 -46
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +31 -13
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js +22 -10
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +16 -4
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +42 -12
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +8 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +41 -11
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +40 -10
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js +24 -6
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +8 -2
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +24 -6
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +25 -8
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +10 -4
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +24 -6
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +33 -9
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +27 -11
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +33 -9
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +12 -2
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/resolveAssets.js +17 -5
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +8 -2
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +8 -2
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +37 -13
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +16 -4
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +91 -37
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +27 -9
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +27 -9
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +26 -8
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +36 -12
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +17 -5
- package/build/src/start/server/webpack/compile.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +8 -2
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +35 -11
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +36 -11
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +32 -8
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/analytics/getDevClientProperties.js +26 -8
- package/build/src/utils/analytics/getDevClientProperties.js.map +1 -1
- package/build/src/utils/analytics/metroDebuggerMiddleware.js +2 -2
- package/build/src/utils/analytics/metroDebuggerMiddleware.js.map +1 -1
- package/build/src/utils/args.js +32 -8
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +64 -28
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +79 -29
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/createFileTransform.js +24 -69
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/build/src/utils/dir.js +33 -26
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +40 -10
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +26 -11
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +18 -6
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +40 -31
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +20 -5
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/findUp.js +18 -6
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +19 -7
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +18 -6
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +18 -6
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +9 -3
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/ip.js +8 -2
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/isModuleSymlinked.js +16 -4
- package/build/src/utils/isModuleSymlinked.js.map +1 -1
- package/build/src/utils/link.js +18 -6
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +25 -13
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +18 -6
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/modifyConfigPlugins.js +8 -2
- package/build/src/utils/modifyConfigPlugins.js.map +1 -1
- package/build/src/utils/nodeEnv.js +2 -0
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/nodeModules.js +23 -5
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +64 -17
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/open.js +9 -3
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +16 -4
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +24 -6
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +22 -10
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/profile.js +8 -2
- package/build/src/utils/profile.js.map +1 -1
- package/build/src/utils/progress.js +8 -2
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +16 -4
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/scheme.js +75 -23
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/tar.js +16 -4
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/DetachedClient.js +87 -0
- package/build/src/utils/telemetry/DetachedClient.js.map +1 -0
- package/build/src/utils/telemetry/RudderClient.js +98 -0
- package/build/src/utils/telemetry/RudderClient.js.map +1 -0
- package/build/src/utils/telemetry/flushDetached.js +43 -0
- package/build/src/utils/telemetry/flushDetached.js.map +1 -0
- package/build/src/utils/telemetry/getContext.js +92 -0
- package/build/src/utils/telemetry/getContext.js.map +1 -0
- package/build/src/utils/telemetry/index.js +32 -0
- package/build/src/utils/telemetry/index.js.map +1 -0
- package/build/src/utils/telemetry/types.js +6 -0
- package/build/src/utils/telemetry/types.js.map +1 -0
- package/build/src/utils/tsconfig/evaluateTsConfig.js +16 -4
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +18 -6
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +10 -4
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/build/src/utils/url.js +19 -10
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +18 -6
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/whoami/whoamiAsync.js +8 -2
- package/build/src/whoami/whoamiAsync.js.map +1 -1
- package/package.json +15 -16
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +27907 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +9494 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +10015 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +28375 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +9714 -0
- package/build/src/run/android/resolveGradleProps.js +0 -37
- package/build/src/run/android/resolveGradleProps.js.map +0 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +0 -52
- package/build/src/start/server/metro/bundleApiRoutes.js.map +0 -1
- package/build/src/start/server/metro/debugging/InspectorDevice.js +0 -80
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +0 -1
- package/build/src/start/server/metro/debugging/InspectorProxy.js +0 -116
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js +0 -21
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js +0 -56
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js +0 -18
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js +0 -24
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +0 -1
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +0 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js +0 -38
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +0 -1
- package/build/src/start/server/type-generation/__typetests__/generateFixtures.js +0 -38
- package/build/src/start/server/type-generation/__typetests__/generateFixtures.js.map +0 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +0 -184
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +0 -1
- package/build/src/utils/analytics/rudderstackClient.js +0 -147
- package/build/src/utils/analytics/rudderstackClient.js.map +0 -1
- /package/build/src/start/server/metro/debugging/{inspectorHandlers/types.js → types.js} +0 -0
|
@@ -2,10 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function PackageManager() {
|
|
6
|
+
const data = _interopRequireWildcard(require("@expo/package-manager"));
|
|
7
|
+
PackageManager = function() {
|
|
8
|
+
return data;
|
|
9
|
+
};
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
function _requireg() {
|
|
13
|
+
const data = _interopRequireDefault(require("requireg"));
|
|
14
|
+
_requireg = function() {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
function _resolveFrom() {
|
|
20
|
+
const data = _interopRequireDefault(require("resolve-from"));
|
|
21
|
+
_resolveFrom = function() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
function _semver() {
|
|
27
|
+
const data = _interopRequireDefault(require("semver"));
|
|
28
|
+
_semver = function() {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
9
33
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
10
34
|
var _delay = require("../../../utils/delay");
|
|
11
35
|
var _env = require("../../../utils/env");
|
|
@@ -89,11 +113,11 @@ class ExternalModule {
|
|
|
89
113
|
if (answer) {
|
|
90
114
|
Log.log(`Installing ${packageName}...`);
|
|
91
115
|
// Always use npm for global installs
|
|
92
|
-
const packageManager = shouldGloballyInstall ? new PackageManager.NpmPackageManager({
|
|
116
|
+
const packageManager = shouldGloballyInstall ? new (PackageManager()).NpmPackageManager({
|
|
93
117
|
cwd: this.projectRoot,
|
|
94
118
|
log: Log.log,
|
|
95
119
|
silent: !(_env.env.EXPO_DEBUG || _env.env.CI)
|
|
96
|
-
}) : PackageManager.createForProject(this.projectRoot, {
|
|
120
|
+
}) : PackageManager().createForProject(this.projectRoot, {
|
|
97
121
|
silent: !(_env.env.EXPO_DEBUG || _env.env.CI)
|
|
98
122
|
});
|
|
99
123
|
try {
|
|
@@ -133,10 +157,10 @@ class ExternalModule {
|
|
|
133
157
|
return require(moduleId);
|
|
134
158
|
}
|
|
135
159
|
/** Resolve a copy that's installed in the project. Exposed for testing. */ _resolveLocal(moduleId) {
|
|
136
|
-
return (
|
|
160
|
+
return _resolveFrom().default(this.projectRoot, moduleId);
|
|
137
161
|
}
|
|
138
162
|
/** Resolve a copy that's installed globally. Exposed for testing. */ _resolveGlobal(moduleId) {
|
|
139
|
-
return _requireg.default.resolve(moduleId);
|
|
163
|
+
return _requireg().default.resolve(moduleId);
|
|
140
164
|
}
|
|
141
165
|
/** Resolve the module and verify the version. Exposed for testing. */ _resolveModule(isLocal) {
|
|
142
166
|
const resolver = isLocal ? this._resolveLocal.bind(this) : this._resolveGlobal.bind(this);
|
|
@@ -144,7 +168,7 @@ class ExternalModule {
|
|
|
144
168
|
const packageJsonPath = resolver(`${this.pkg.name}/package.json`);
|
|
145
169
|
const packageJson = this._require(packageJsonPath);
|
|
146
170
|
if (packageJson) {
|
|
147
|
-
if (_semver.default.satisfies(packageJson.version, this.pkg.versionRange)) {
|
|
171
|
+
if (_semver().default.satisfies(packageJson.version, this.pkg.versionRange)) {
|
|
148
172
|
const modulePath = resolver(this.pkg.name);
|
|
149
173
|
const requiredModule = this._require(modulePath);
|
|
150
174
|
if (requiredModule == null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/ngrok/ExternalModule.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport requireGlobal from 'requireg';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport * as Log from '../../../log';\nimport { delayAsync } from '../../../utils/delay';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst debug = require('debug')('expo:doctor:externalModule') as typeof console.log;\n\n/** An error that is thrown when a package is installed but doesn't meet the version criteria. */\nexport class ExternalModuleVersionError extends CommandError {\n constructor(\n message: string,\n public readonly shouldGloballyInstall: boolean\n ) {\n super('EXTERNAL_MODULE_VERSION', message);\n }\n}\n\ninterface PromptOptions {\n /** Should prompt the user to install, when false the module will just assert on missing packages, default `true`. Ignored when `autoInstall` is true. */\n shouldPrompt?: boolean;\n /** Should automatically install the package without prompting, default `false` */\n autoInstall?: boolean;\n}\n\nexport interface InstallPromptOptions extends PromptOptions {\n /** Should install the package globally, default `false` */\n shouldGloballyInstall?: boolean;\n}\n\nexport interface ResolvePromptOptions extends PromptOptions {\n /**\n * Prefer to install the package globally, this can be overridden if the function\n * detects that a locally installed package simply needs an upgrade, default `false`\n */\n prefersGlobalInstall?: boolean;\n}\n\n/** Resolves a local or globally installed package, prompts to install if missing. */\nexport class ExternalModule<TModule> {\n private instance: TModule | null = null;\n\n constructor(\n /** Project root for checking if the package is installed locally. */\n private projectRoot: string,\n /** Info on the external package. */\n private pkg: {\n /** NPM package name. */\n name: string;\n /** Required semver range, ex: `^1.0.0`. */\n versionRange: string;\n },\n /** A function used to create the installation prompt message. */\n private promptMessage: (pkgName: string) => string\n ) {}\n\n /** Resolve the globally or locally installed instance, or prompt to install. */\n async resolveAsync({\n prefersGlobalInstall,\n ...options\n }: ResolvePromptOptions = {}): Promise<TModule> {\n try {\n return (\n this.getVersioned() ??\n this.installAsync({\n ...options,\n shouldGloballyInstall: prefersGlobalInstall,\n })\n );\n } catch (error: any) {\n if (error instanceof ExternalModuleVersionError) {\n // If the module version in not compliant with the version range,\n // we should prompt the user to install the package where it already exists.\n return this.installAsync({\n ...options,\n shouldGloballyInstall: error.shouldGloballyInstall ?? prefersGlobalInstall,\n });\n }\n throw error;\n }\n }\n\n /** Prompt the user to install the package and try again. */\n async installAsync({\n shouldPrompt = true,\n autoInstall,\n shouldGloballyInstall,\n }: InstallPromptOptions = {}): Promise<TModule> {\n const packageName = [this.pkg.name, this.pkg.versionRange].join('@');\n if (!autoInstall) {\n // Delay the prompt so it doesn't conflict with other dev tool logs\n await delayAsync(100);\n }\n const answer =\n autoInstall ||\n (shouldPrompt &&\n (await confirmAsync({\n message: this.promptMessage(packageName),\n initial: true,\n })));\n if (answer) {\n Log.log(`Installing ${packageName}...`);\n\n // Always use npm for global installs\n const packageManager = shouldGloballyInstall\n ? new PackageManager.NpmPackageManager({\n cwd: this.projectRoot,\n log: Log.log,\n silent: !(env.EXPO_DEBUG || env.CI),\n })\n : PackageManager.createForProject(this.projectRoot, {\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n\n try {\n if (shouldGloballyInstall) {\n await packageManager.addGlobalAsync([packageName]);\n } else {\n await packageManager.addDevAsync([packageName]);\n }\n Log.log(`Installed ${packageName}`);\n } catch (error: any) {\n error.message = `Failed to install ${packageName} ${\n shouldGloballyInstall ? 'globally' : 'locally'\n }: ${error.message}`;\n throw error;\n }\n return await this.resolveAsync({ shouldPrompt: false });\n }\n\n throw new CommandError(\n 'EXTERNAL_MODULE_AVAILABILITY',\n `Please install ${packageName} and try again`\n );\n }\n\n /** Get the module. */\n get(): TModule | null {\n try {\n return this.getVersioned();\n } catch {\n return null;\n }\n }\n\n /** Get the module, throws if the module is not versioned correctly. */\n getVersioned(): TModule | null {\n this.instance ??= this._resolveModule(true) ?? this._resolveModule(false);\n return this.instance;\n }\n\n /** Exposed for testing. */\n _require(moduleId: string): any {\n return require(moduleId);\n }\n\n /** Resolve a copy that's installed in the project. Exposed for testing. */\n _resolveLocal(moduleId: string): string {\n return resolveFrom(this.projectRoot, moduleId);\n }\n\n /** Resolve a copy that's installed globally. Exposed for testing. */\n _resolveGlobal(moduleId: string): string {\n return requireGlobal.resolve(moduleId);\n }\n\n /** Resolve the module and verify the version. Exposed for testing. */\n _resolveModule(isLocal: boolean): TModule | null {\n const resolver = isLocal ? this._resolveLocal.bind(this) : this._resolveGlobal.bind(this);\n try {\n const packageJsonPath = resolver(`${this.pkg.name}/package.json`);\n const packageJson = this._require(packageJsonPath);\n if (packageJson) {\n if (semver.satisfies(packageJson.version, this.pkg.versionRange)) {\n const modulePath = resolver(this.pkg.name);\n const requiredModule = this._require(modulePath);\n if (requiredModule == null) {\n throw new CommandError(\n 'EXTERNAL_MODULE_EXPORT',\n `${this.pkg.name} exports a nullish value, which is not allowed.`\n );\n }\n return requiredModule;\n }\n throw new ExternalModuleVersionError(\n `Required module '${this.pkg.name}@${packageJson.version}' does not satisfy ${this.pkg.versionRange}. Installed at: ${packageJsonPath}`,\n !isLocal\n );\n }\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n } else if (error.code !== 'MODULE_NOT_FOUND') {\n debug('Failed to resolve module', error.message);\n }\n }\n return null;\n }\n}\n"],"names":["PackageManager","Log","debug","require","ExternalModuleVersionError","CommandError","constructor","message","shouldGloballyInstall","ExternalModule","projectRoot","pkg","promptMessage","instance","resolveAsync","prefersGlobalInstall","options","getVersioned","installAsync","error","shouldPrompt","autoInstall","packageName","name","versionRange","join","delayAsync","answer","confirmAsync","initial","log","packageManager","NpmPackageManager","cwd","silent","env","EXPO_DEBUG","CI","createForProject","addGlobalAsync","addDevAsync","get","_resolveModule","_require","moduleId","_resolveLocal","resolveFrom","_resolveGlobal","requireGlobal","resolve","isLocal","resolver","bind","packageJsonPath","packageJson","semver","satisfies","version","modulePath","requiredModule","code"],"mappings":"AAAA;;;;AAAYA,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACA,IAAA,SAAU,kCAAV,UAAU,EAAA;AACZ,IAAA,YAAc,kCAAd,cAAc,EAAA;AACnB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEfC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACY,IAAA,MAAsB,WAAtB,sBAAsB,CAAA;AAC7B,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACvB,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+IjD,IAAI;AA7IR,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAG5E,MAAMC,0BAA0B,SAASC,OAAY,aAAA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AAIA,KAAK,YAAYd,OAAY,aAAA,EAAE;gBACjC,MAAMc,KAAK,CAAC;aACb,MAAM,IAAIA,KAAK,CAACyC,IAAI,KAAK,kBAAkB,EAAE;gBAC5C1D,KAAK,CAAC,0BAA0B,EAAEiB,KAAK,CAACZ,OAAO,CAAC,CAAC;aAClD;SACF;QACD,OAAO,IAAI,CAAC;KACb;CACF;QA/JYE,cAAc,GAAdA,cAAc"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/ngrok/ExternalModule.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport requireGlobal from 'requireg';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport * as Log from '../../../log';\nimport { delayAsync } from '../../../utils/delay';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst debug = require('debug')('expo:doctor:externalModule') as typeof console.log;\n\n/** An error that is thrown when a package is installed but doesn't meet the version criteria. */\nexport class ExternalModuleVersionError extends CommandError {\n constructor(\n message: string,\n public readonly shouldGloballyInstall: boolean\n ) {\n super('EXTERNAL_MODULE_VERSION', message);\n }\n}\n\ninterface PromptOptions {\n /** Should prompt the user to install, when false the module will just assert on missing packages, default `true`. Ignored when `autoInstall` is true. */\n shouldPrompt?: boolean;\n /** Should automatically install the package without prompting, default `false` */\n autoInstall?: boolean;\n}\n\nexport interface InstallPromptOptions extends PromptOptions {\n /** Should install the package globally, default `false` */\n shouldGloballyInstall?: boolean;\n}\n\nexport interface ResolvePromptOptions extends PromptOptions {\n /**\n * Prefer to install the package globally, this can be overridden if the function\n * detects that a locally installed package simply needs an upgrade, default `false`\n */\n prefersGlobalInstall?: boolean;\n}\n\n/** Resolves a local or globally installed package, prompts to install if missing. */\nexport class ExternalModule<TModule> {\n private instance: TModule | null = null;\n\n constructor(\n /** Project root for checking if the package is installed locally. */\n private projectRoot: string,\n /** Info on the external package. */\n private pkg: {\n /** NPM package name. */\n name: string;\n /** Required semver range, ex: `^1.0.0`. */\n versionRange: string;\n },\n /** A function used to create the installation prompt message. */\n private promptMessage: (pkgName: string) => string\n ) {}\n\n /** Resolve the globally or locally installed instance, or prompt to install. */\n async resolveAsync({\n prefersGlobalInstall,\n ...options\n }: ResolvePromptOptions = {}): Promise<TModule> {\n try {\n return (\n this.getVersioned() ??\n this.installAsync({\n ...options,\n shouldGloballyInstall: prefersGlobalInstall,\n })\n );\n } catch (error: any) {\n if (error instanceof ExternalModuleVersionError) {\n // If the module version in not compliant with the version range,\n // we should prompt the user to install the package where it already exists.\n return this.installAsync({\n ...options,\n shouldGloballyInstall: error.shouldGloballyInstall ?? prefersGlobalInstall,\n });\n }\n throw error;\n }\n }\n\n /** Prompt the user to install the package and try again. */\n async installAsync({\n shouldPrompt = true,\n autoInstall,\n shouldGloballyInstall,\n }: InstallPromptOptions = {}): Promise<TModule> {\n const packageName = [this.pkg.name, this.pkg.versionRange].join('@');\n if (!autoInstall) {\n // Delay the prompt so it doesn't conflict with other dev tool logs\n await delayAsync(100);\n }\n const answer =\n autoInstall ||\n (shouldPrompt &&\n (await confirmAsync({\n message: this.promptMessage(packageName),\n initial: true,\n })));\n if (answer) {\n Log.log(`Installing ${packageName}...`);\n\n // Always use npm for global installs\n const packageManager = shouldGloballyInstall\n ? new PackageManager.NpmPackageManager({\n cwd: this.projectRoot,\n log: Log.log,\n silent: !(env.EXPO_DEBUG || env.CI),\n })\n : PackageManager.createForProject(this.projectRoot, {\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n\n try {\n if (shouldGloballyInstall) {\n await packageManager.addGlobalAsync([packageName]);\n } else {\n await packageManager.addDevAsync([packageName]);\n }\n Log.log(`Installed ${packageName}`);\n } catch (error: any) {\n error.message = `Failed to install ${packageName} ${\n shouldGloballyInstall ? 'globally' : 'locally'\n }: ${error.message}`;\n throw error;\n }\n return await this.resolveAsync({ shouldPrompt: false });\n }\n\n throw new CommandError(\n 'EXTERNAL_MODULE_AVAILABILITY',\n `Please install ${packageName} and try again`\n );\n }\n\n /** Get the module. */\n get(): TModule | null {\n try {\n return this.getVersioned();\n } catch {\n return null;\n }\n }\n\n /** Get the module, throws if the module is not versioned correctly. */\n getVersioned(): TModule | null {\n this.instance ??= this._resolveModule(true) ?? this._resolveModule(false);\n return this.instance;\n }\n\n /** Exposed for testing. */\n _require(moduleId: string): any {\n return require(moduleId);\n }\n\n /** Resolve a copy that's installed in the project. Exposed for testing. */\n _resolveLocal(moduleId: string): string {\n return resolveFrom(this.projectRoot, moduleId);\n }\n\n /** Resolve a copy that's installed globally. Exposed for testing. */\n _resolveGlobal(moduleId: string): string {\n return requireGlobal.resolve(moduleId);\n }\n\n /** Resolve the module and verify the version. Exposed for testing. */\n _resolveModule(isLocal: boolean): TModule | null {\n const resolver = isLocal ? this._resolveLocal.bind(this) : this._resolveGlobal.bind(this);\n try {\n const packageJsonPath = resolver(`${this.pkg.name}/package.json`);\n const packageJson = this._require(packageJsonPath);\n if (packageJson) {\n if (semver.satisfies(packageJson.version, this.pkg.versionRange)) {\n const modulePath = resolver(this.pkg.name);\n const requiredModule = this._require(modulePath);\n if (requiredModule == null) {\n throw new CommandError(\n 'EXTERNAL_MODULE_EXPORT',\n `${this.pkg.name} exports a nullish value, which is not allowed.`\n );\n }\n return requiredModule;\n }\n throw new ExternalModuleVersionError(\n `Required module '${this.pkg.name}@${packageJson.version}' does not satisfy ${this.pkg.versionRange}. Installed at: ${packageJsonPath}`,\n !isLocal\n );\n }\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n } else if (error.code !== 'MODULE_NOT_FOUND') {\n debug('Failed to resolve module', error.message);\n }\n }\n return null;\n }\n}\n"],"names":["PackageManager","Log","debug","require","ExternalModuleVersionError","CommandError","constructor","message","shouldGloballyInstall","ExternalModule","projectRoot","pkg","promptMessage","instance","resolveAsync","prefersGlobalInstall","options","getVersioned","installAsync","error","shouldPrompt","autoInstall","packageName","name","versionRange","join","delayAsync","answer","confirmAsync","initial","log","packageManager","NpmPackageManager","cwd","silent","env","EXPO_DEBUG","CI","createForProject","addGlobalAsync","addDevAsync","get","_resolveModule","_require","moduleId","_resolveLocal","resolveFrom","_resolveGlobal","requireGlobal","resolve","isLocal","resolver","bind","packageJsonPath","packageJson","semver","satisfies","version","modulePath","requiredModule","code"],"mappings":"AAAA;;;;SAAYA,cAAc;iDAAM,uBAAuB;IAA3CA,cAAc;;;;;SACA,SAAU;gDAAV,UAAU;IAAV,SAAU;;;;;SACZ,YAAc;gDAAd,cAAc;IAAd,YAAc;;;;;SACnB,OAAQ;gDAAR,QAAQ;IAAR,OAAQ;;;;;AAEfC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACY,IAAA,MAAsB,WAAtB,sBAAsB,CAAA;AAC7B,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACvB,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+IjD,IAAI;AA7IR,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAG5E,MAAMC,0BAA0B,SAASC,OAAY,aAAA;IAC1DC,YACEC,OAAe,EACCC,qBAA8B,CAC9C;QACA,KAAK,CAAC,yBAAyB,EAAED,OAAO,CAAC,CAAC;aAF1BC,qBAA8B,GAA9BA,qBAA8B;KAG/C;CACF;QAPYJ,0BAA0B,GAA1BA,0BAA0B;AA8BhC,MAAMK,cAAc;IAGzBH,YAEUI,WAAmB,EAEnBC,GAKP,EAEOC,aAA0C,CAClD;aAVQF,WAAmB,GAAnBA,WAAmB;aAEnBC,GAKP,GALOA,GAKP;aAEOC,aAA0C,GAA1CA,aAA0C;aAb5CC,QAAQ,GAAmB,IAAI;KAcnC;IAEJ,gFAAgF,CAChF,MAAMC,YAAY,CAAC,EACjBC,oBAAoB,CAAA,EACpB,GAAGC,OAAO,EACW,GAAG,EAAE,EAAoB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,CAACF,WAAW,CAACG,OAAO,EAAE,IAAI,CAAC9C,GAAG,CAACa,YAAY,CAAC,EAAE;oBAChE,MAAMkC,UAAU,GAAGP,QAAQ,CAAC,IAAI,CAACxC,GAAG,CAACY,IAAI,CAAC,AAAC;oBAC3C,MAAMoC,cAAc,GAAG,IAAI,CAAChB,QAAQ,CAACe,UAAU,CAAC,AAAC;oBACjD,IAAIC,cAAc,IAAI,IAAI,EAAE;wBAC1B,MAAM,IAAItD,OAAY,aAAA,CACpB,wBAAwB,EACxB,CAAC,EAAE,IAAI,CAACM,GAAG,CAACY,IAAI,CAAC,+CAA+C,CAAC,CAClE,CAAC;qBACH;oBACD,OAAOoC,cAAc,CAAC;iBACvB;gBACD,MAAM,IAAIvD,0BAA0B,CAClC,CAAC,iBAAiB,EAAE,IAAI,CAACO,GAAG,CAACY,IAAI,CAAC,CAAC,EAAE+B,WAAW,CAACG,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC9C,GAAG,CAACa,YAAY,CAAC,gBAAgB,EAAE6B,eAAe,CAAC,CAAC,EACvI,CAACH,OAAO,CACT,CAAC;aACH;SACF,CAAC,OAAO/B,KAAK,EAAO;YACnB,IAAIA,KAAK,YAAYd,OAAY,aAAA,EAAE;gBACjC,MAAMc,KAAK,CAAC;aACb,MAAM,IAAIA,KAAK,CAACyC,IAAI,KAAK,kBAAkB,EAAE;gBAC5C1D,KAAK,CAAC,0BAA0B,EAAEiB,KAAK,CAACZ,OAAO,CAAC,CAAC;aAClD;SACF;QACD,OAAO,IAAI,CAAC;KACb;CACF;QA/JYE,cAAc,GAAdA,cAAc"}
|
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function _promises() {
|
|
6
|
+
const data = _interopRequireDefault(require("fs/promises"));
|
|
7
|
+
_promises = function() {
|
|
8
|
+
return data;
|
|
9
|
+
};
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
function _path() {
|
|
13
|
+
const data = _interopRequireDefault(require("path"));
|
|
14
|
+
_path = function() {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
7
19
|
var _updateTSConfig = require("./updateTSConfig");
|
|
8
20
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
9
21
|
var _dir = require("../../../utils/dir");
|
|
@@ -53,7 +65,7 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
53
65
|
return true;
|
|
54
66
|
}
|
|
55
67
|
debug("Ensuring TypeScript support is setup");
|
|
56
|
-
const tsConfigPath = _path.default.join(this.projectRoot, "tsconfig.json");
|
|
68
|
+
const tsConfigPath = _path().default.join(this.projectRoot, "tsconfig.json");
|
|
57
69
|
// Ensure the project is TypeScript before continuing.
|
|
58
70
|
const intent = await this._getSetupRequirements();
|
|
59
71
|
if (!intent) {
|
|
@@ -77,7 +89,7 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
77
89
|
skipPrompt: true,
|
|
78
90
|
isProjectMutable: true
|
|
79
91
|
});
|
|
80
|
-
const tsConfigPath = _path.default.join(this.projectRoot, "tsconfig.json");
|
|
92
|
+
const tsConfigPath = _path().default.join(this.projectRoot, "tsconfig.json");
|
|
81
93
|
// Update the config
|
|
82
94
|
await (0, _updateTSConfig).updateTSConfigAsync({
|
|
83
95
|
tsConfigPath
|
|
@@ -87,7 +99,7 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
87
99
|
const tsConfigPath = await this._hasTSConfig();
|
|
88
100
|
// Enable TS setup if the project has a `tsconfig.json`
|
|
89
101
|
if (tsConfigPath) {
|
|
90
|
-
const content = await _promises.default.readFile(tsConfigPath, {
|
|
102
|
+
const content = await _promises().default.readFile(tsConfigPath, {
|
|
91
103
|
encoding: "utf8"
|
|
92
104
|
}).then((txt)=>txt.trim()
|
|
93
105
|
, // null when the file doesn't exist.
|
|
@@ -153,7 +165,7 @@ class TypeScriptProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
153
165
|
return (ref = results[0]) != null ? ref : null;
|
|
154
166
|
}
|
|
155
167
|
async _hasTSConfig() {
|
|
156
|
-
const tsConfigPath = _path.default.join(this.projectRoot, "tsconfig.json");
|
|
168
|
+
const tsConfigPath = _path().default.join(this.projectRoot, "tsconfig.json");
|
|
157
169
|
if (await (0, _dir).fileExistsAsync(tsConfigPath)) {
|
|
158
170
|
return tsConfigPath;
|
|
159
171
|
}
|
|
@@ -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 { 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;;;;
|
|
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;;;;SACe,SAAa;gDAAb,aAAa;IAAb,SAAa;;;;;SACX,KAAM;gDAAN,MAAM;IAAN,KAAM;;;;;AAEa,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AAC1CA,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACiB,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAChC,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,GAAmB,WAAnB,mBAAmB,CAAA;AACU,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACtC,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;AACb,IAAA,wBAAyC,WAAzC,yCAAyC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjF,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,AAAsB,AAAC;AAEtF,MAAMC,YAAY,GAAGC,CAAAA,GAAAA,GAAO,AAE1B,CAAA,QAF0B,CAAC,IAAM;IACjCJ,GAAG,CAACK,IAAI,CAAC,iEAAiE,CAAC,CAAC;CAC7E,CAAC,AAAC;AAGI,MAAMC,6BAA6B,SAASC,aAAmB,oBAAA;IACpE;;;;KAIG,CACH,MAAMC,oBAAoB,GAAqB;QAC7C,IAAIC,IAAG,I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,CAAAA,GAAAA,KAAmB,AAYxC,CAAA,oBAZwC,CACvC,IACE,qHAAqH;YACrHC,CAAAA,GAAAA,KAAe,AAOb,CAAA,gBAPa,CAAC,gBAAgB,EAAE;gBAChCC,GAAG,EAAE,IAAI,CAAChC,WAAW;gBACrBiC,MAAM,EAAE;oBACN,qCAAqC;oBACrC,WAAW;oBACX,sCAAsC;iBACvC;aACF,CAAC;QAAA,EACJ,IAAI,CACL,AAAC;QAEF,IAAIJ,OAAO,KAAK,KAAK,EAAE;YACrB,OAAO,IAAI,CAAC;SACb;YACMA,GAAU;QAAjB,OAAOA,CAAAA,GAAU,GAAVA,OAAO,CAAC,CAAC,CAAC,YAAVA,GAAU,GAAI,IAAI,CAAC;KAC3B;IAED,MAAMrB,YAAY,GAA2B;QAC3C,MAAMX,YAAY,GAAGC,KAAI,UAAA,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"}
|
|
@@ -4,9 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.updateTSConfigAsync = updateTSConfigAsync;
|
|
6
6
|
exports.baseTSConfigName = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
function _jsonFile() {
|
|
8
|
+
const data = _interopRequireDefault(require("@expo/json-file"));
|
|
9
|
+
_jsonFile = function() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _chalk() {
|
|
15
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
16
|
+
_chalk = function() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _fs() {
|
|
22
|
+
const data = _interopRequireDefault(require("fs"));
|
|
23
|
+
_fs = function() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
10
28
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
11
29
|
function _interopRequireDefault(obj) {
|
|
12
30
|
return obj && obj.__esModule ? obj : {
|
|
@@ -38,13 +56,13 @@ var _projectTSConfig;
|
|
|
38
56
|
const baseTSConfigName = "expo/tsconfig.base";
|
|
39
57
|
exports.baseTSConfigName = baseTSConfigName;
|
|
40
58
|
async function updateTSConfigAsync({ tsConfigPath }) {
|
|
41
|
-
const shouldGenerate = !_fs.default.existsSync(tsConfigPath) || _fs.default.statSync(tsConfigPath).size === 0;
|
|
59
|
+
const shouldGenerate = !_fs().default.existsSync(tsConfigPath) || _fs().default.statSync(tsConfigPath).size === 0;
|
|
42
60
|
if (shouldGenerate) {
|
|
43
|
-
await _jsonFile.default.writeAsync(tsConfigPath, {
|
|
61
|
+
await _jsonFile().default.writeAsync(tsConfigPath, {
|
|
44
62
|
compilerOptions: {}
|
|
45
63
|
});
|
|
46
64
|
}
|
|
47
|
-
const projectTSConfig = _jsonFile.default.read(tsConfigPath, {
|
|
65
|
+
const projectTSConfig = _jsonFile().default.read(tsConfigPath, {
|
|
48
66
|
// Some tsconfig.json files have a generated comment in the file.
|
|
49
67
|
json5: true
|
|
50
68
|
});
|
|
@@ -65,23 +83,23 @@ async function updateTSConfigAsync({ tsConfigPath }) {
|
|
|
65
83
|
return;
|
|
66
84
|
}
|
|
67
85
|
// Write changes and log out a summary of what changed
|
|
68
|
-
await _jsonFile.default.writeAsync(tsConfigPath, projectTSConfig);
|
|
86
|
+
await _jsonFile().default.writeAsync(tsConfigPath, projectTSConfig);
|
|
69
87
|
// If no changes, then quietly bail out
|
|
70
88
|
if (modifications.length === 0) {
|
|
71
89
|
return;
|
|
72
90
|
}
|
|
73
91
|
Log.log();
|
|
74
92
|
if (shouldGenerate) {
|
|
75
|
-
Log.log(_chalk.default`{bold TypeScript}: A {cyan tsconfig.json} has been auto-generated`);
|
|
93
|
+
Log.log(_chalk().default`{bold TypeScript}: A {cyan tsconfig.json} has been auto-generated`);
|
|
76
94
|
} else {
|
|
77
|
-
Log.log(_chalk.default`{bold TypeScript}: The {cyan tsconfig.json} has been updated {dim (Use EXPO_NO_TYPESCRIPT_SETUP to skip)}`);
|
|
95
|
+
Log.log(_chalk().default`{bold TypeScript}: The {cyan tsconfig.json} has been updated {dim (Use EXPO_NO_TYPESCRIPT_SETUP to skip)}`);
|
|
78
96
|
logModifications(modifications);
|
|
79
97
|
}
|
|
80
98
|
Log.log();
|
|
81
99
|
}
|
|
82
100
|
function logModifications(modifications) {
|
|
83
101
|
Log.log();
|
|
84
|
-
Log.log(_chalk.default`\u203A {bold Required} modifications made to the {cyan tsconfig.json}:`);
|
|
102
|
+
Log.log(_chalk().default`\u203A {bold Required} modifications made to the {cyan tsconfig.json}:`);
|
|
85
103
|
Log.log();
|
|
86
104
|
// Sort the items based on key name length
|
|
87
105
|
printTable(modifications.sort((a, b)=>a[0].length - b[0].length
|
|
@@ -89,7 +107,7 @@ function logModifications(modifications) {
|
|
|
89
107
|
Log.log();
|
|
90
108
|
}
|
|
91
109
|
function printTable(items) {
|
|
92
|
-
const tableFormat = (name, msg)=>` ${_chalk.default.bold`${name}`} is now ${_chalk.default.cyan(msg)}`
|
|
110
|
+
const tableFormat = (name, msg)=>` ${_chalk().default.bold`${name}`} is now ${_chalk().default.cyan(msg)}`
|
|
93
111
|
;
|
|
94
112
|
for (const [key, value] of items){
|
|
95
113
|
Log.log(tableFormat(key, value));
|
|
@@ -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}: {\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;;
|
|
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;;SARpB,SAAiB;gDAAjB,iBAAiB;IAAjB,SAAiB;;;;;SACpB,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;SACV,GAAI;gDAAJ,IAAI;IAAJ,GAAI;;;;;AAEPC,IAAAA,GAAG,mCAAM,cAAc,EAApB;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmBbC,gBAAe;AAjBV,MAAMC,gBAAgB,GAAG,oBAAoB,AAAC;QAAxCA,gBAAgB,GAAhBA,gBAAgB;AAEtB,eAAeH,mBAAmB,CAAC,EACxCI,YAAY,CAAA,EAGb,EAAiB;IAChB,MAAMC,cAAc,GAAG,CAACC,GAAE,UAAA,CAACC,UAAU,CAACH,YAAY,CAAC,IAAIE,GAAE,UAAA,CAACE,QAAQ,CAACJ,YAAY,CAAC,CAACK,IAAI,KAAK,CAAC,AAAC;IAC5F,IAAIJ,cAAc,EAAE;QAClB,MAAMK,SAAQ,UAAA,CAACC,UAAU,CAACP,YAAY,EAAE;YAAEQ,eAAe,EAAE,EAAE;SAAE,CAAC,CAAC;KAClE;IAED,MAAMV,eAAe,GAAGQ,SAAQ,UAAA,CAACG,IAAI,CAACT,YAAY,EAAE;QAClD,iEAAiE;QACjEU,KAAK,EAAE,IAAI;KACZ,CAAC,AAAC;;IAEHZ,qBAAAA,gBAAe,GAAfA,eAAe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M;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,UAAA,CAACU,IAAI,CAAC,EAAEF,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAER,MAAK,UAAA,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"}
|
|
@@ -3,8 +3,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.isWebPlatformExcluded = isWebPlatformExcluded;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function _config() {
|
|
7
|
+
const data = require("@expo/config");
|
|
8
|
+
_config = function() {
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
function _chalk() {
|
|
14
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
15
|
+
_chalk = function() {
|
|
16
|
+
return data;
|
|
17
|
+
};
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
8
20
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
9
21
|
var _env = require("../../../utils/env");
|
|
10
22
|
var _platformBundlers = require("../../server/platformBundlers");
|
|
@@ -51,12 +63,12 @@ class WebSupportProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
51
63
|
});
|
|
52
64
|
}
|
|
53
65
|
/** Exposed for testing. */ async _shouldSetupWebSupportAsync() {
|
|
54
|
-
const config = (
|
|
66
|
+
const config = _config().getConfig(this.projectRoot);
|
|
55
67
|
// Detect if the 'web' string is purposefully missing from the platforms array.
|
|
56
68
|
if (isWebPlatformExcluded(config.rootConfig)) {
|
|
57
69
|
// Get exact config description with paths.
|
|
58
|
-
const configName = (
|
|
59
|
-
throw new _prerequisite.PrerequisiteCommandError("WEB_SUPPORT", _chalk.default`Skipping web setup: {bold "web"} is not included in the project ${configName} {bold "platforms"} array.`);
|
|
70
|
+
const configName = _config().getProjectConfigDescriptionWithPaths(this.projectRoot, config);
|
|
71
|
+
throw new _prerequisite.PrerequisiteCommandError("WEB_SUPPORT", _chalk().default`Skipping web setup: {bold "web"} is not included in the project ${configName} {bold "platforms"} array.`);
|
|
60
72
|
}
|
|
61
73
|
return config;
|
|
62
74
|
}
|
|
@@ -95,7 +107,7 @@ class WebSupportProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
95
107
|
isProjectMutable: false,
|
|
96
108
|
exp,
|
|
97
109
|
installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,
|
|
98
|
-
warningMessage: _chalk.default`If you're not using web, please ensure you remove the {bold "web"} string from the platforms array in the project Expo config.`,
|
|
110
|
+
warningMessage: _chalk().default`If you're not using web, please ensure you remove the {bold "web"} string from the platforms array in the project Expo config.`,
|
|
99
111
|
requiredPackages
|
|
100
112
|
});
|
|
101
113
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n // use react-native-web/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: 'react-native-web/package.json', pkg: 'react-native-web' },\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\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\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig?.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["isWebPlatformExcluded","Log","debug","require","WebSupportProjectPrerequisite","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","warn","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","requiredPackages","file","pkg","bundler","getPlatformBundlers","web","push","dev","ensureDependenciesAsync","skipPrompt","isProjectMutable","installMessage","warningMessage","error","resetAssertion","isWebExcluded","Array","isArray","expo","platforms","length","includes"],"mappings":"AAAA;;;;QAiGgBA,qBAAqB,GAArBA,qBAAqB;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n // use react-native-web/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: 'react-native-web/package.json', pkg: 'react-native-web' },\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\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\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig?.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["isWebPlatformExcluded","Log","debug","require","WebSupportProjectPrerequisite","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","warn","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","requiredPackages","file","pkg","bundler","getPlatformBundlers","web","push","dev","ensureDependenciesAsync","skipPrompt","isProjectMutable","installMessage","warningMessage","error","resetAssertion","isWebExcluded","Array","isArray","expo","platforms","length","includes"],"mappings":"AAAA;;;;QAiGgBA,qBAAqB,GAArBA,qBAAqB;SA3F9B,OAAc;yBAAd,cAAc;IAAd,OAAc;;;;;SACH,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;AAEbC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACJ,IAAA,iBAA+B,WAA/B,+BAA+B,CAAA;AACL,IAAA,aAAiB,WAAjB,iBAAiB,C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UAAU,QAAM,GAAhBA,KAAAA,CAAgB,GAAhBA,CAAAA,GAAgB,GAAhBA,UAAU,CAAEuB,IAAI,SAAA,GAAhBvB,KAAAA,CAAgB,GAAhBA,GAAgB,CAAEwB,SAAS,AAAX,CAAY,IAC1C,CAAC,EAACxB,CAAAA,IAAe,GAAfA,UAAU,CAACuB,IAAI,SAAW,GAA1BvB,KAAAA,CAA0B,GAA1BA,IAAe,CAAEwB,SAAS,CAACC,MAAM,CAAA,IACnC,CAACzB,CAAAA,CAAAA,IAAe,GAAfA,UAAU,CAACuB,IAAI,SAAW,GAA1BvB,KAAAA,CAA0B,GAA1BA,IAAe,CAAEwB,SAAS,CAACE,QAAQ,CAAC,KAAK,CAAC,CAAA,AAAC;IAC9C,OAAON,aAAa,CAAC;CACtB"}
|
package/build/src/start/index.js
CHANGED
|
@@ -4,7 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.expoStart = void 0;
|
|
7
|
-
|
|
7
|
+
function _chalk() {
|
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
9
|
+
_chalk = function() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
8
14
|
var _args = require("../utils/args");
|
|
9
15
|
var _errors = require("../utils/errors");
|
|
10
16
|
function _interopRequireDefault(obj) {
|
|
@@ -69,24 +75,24 @@ const expoStart = async (argv)=>{
|
|
|
69
75
|
"--reset-cache": "--clear"
|
|
70
76
|
}, argv);
|
|
71
77
|
if (args["--help"]) {
|
|
72
|
-
(0, _args).printHelp(`Start a local dev server for the app`, _chalk.default`npx expo start {dim <dir>}`, [
|
|
73
|
-
_chalk.default`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
|
|
78
|
+
(0, _args).printHelp(`Start a local dev server for the app`, _chalk().default`npx expo start {dim <dir>}`, [
|
|
79
|
+
_chalk().default`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
|
|
74
80
|
`-a, --android Open on a connected Android device`,
|
|
75
81
|
`-i, --ios Open in an iOS simulator`,
|
|
76
82
|
`-w, --web Open in a web browser`,
|
|
77
83
|
``,
|
|
78
|
-
_chalk.default`-d, --dev-client Launch in a custom native app`,
|
|
79
|
-
_chalk.default`-g, --go Launch in Expo Go`,
|
|
84
|
+
_chalk().default`-d, --dev-client Launch in a custom native app`,
|
|
85
|
+
_chalk().default`-g, --go Launch in Expo Go`,
|
|
80
86
|
``,
|
|
81
87
|
`-c, --clear Clear the bundler cache`,
|
|
82
88
|
`--max-workers <number> Maximum number of tasks to allow Metro to spawn`,
|
|
83
89
|
`--no-dev Bundle in production mode`,
|
|
84
90
|
`--minify Minify JavaScript`,
|
|
85
91
|
``,
|
|
86
|
-
_chalk.default`-m, --host <string> Dev server hosting type. {dim Default: lan}`,
|
|
87
|
-
_chalk.default` {bold lan}: Use the local network`,
|
|
88
|
-
_chalk.default` {bold tunnel}: Use any network by tunnel through ngrok`,
|
|
89
|
-
_chalk.default` {bold localhost}: Connect to the dev server over localhost`,
|
|
92
|
+
_chalk().default`-m, --host <string> Dev server hosting type. {dim Default: lan}`,
|
|
93
|
+
_chalk().default` {bold lan}: Use the local network`,
|
|
94
|
+
_chalk().default` {bold tunnel}: Use any network by tunnel through ngrok`,
|
|
95
|
+
_chalk().default` {bold localhost}: Connect to the dev server over localhost`,
|
|
90
96
|
`--tunnel Same as --host tunnel`,
|
|
91
97
|
`--lan Same as --host lan`,
|
|
92
98
|
`--localhost Same as --host localhost`,
|
|
@@ -94,9 +100,9 @@ const expoStart = async (argv)=>{
|
|
|
94
100
|
`--offline Skip network requests and use anonymous manifest signatures`,
|
|
95
101
|
`--https Start the dev server with https protocol`,
|
|
96
102
|
`--scheme <scheme> Custom URI protocol to use when launching an app`,
|
|
97
|
-
_chalk.default`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,
|
|
103
|
+
_chalk().default`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,
|
|
98
104
|
``,
|
|
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.}`,
|
|
105
|
+
_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.}`,
|
|
100
106
|
`-h, --help Usage info`,
|
|
101
107
|
].join("\n"));
|
|
102
108
|
}
|
|
@@ -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 '--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.js');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n if (options.offline) {\n const { disableNetwork } = await import('../api/settings.js');\n disableNetwork();\n }\n\n const { startAsync } = await import('./startAsync.js');\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;;;;;;
|
|
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.js');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n if (options.offline) {\n const { disableNetwork } = await import('../api/settings.js');\n disableNetwork();\n }\n\n const { startAsync } = await import('./startAsync.js');\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;;;;;;SACkB,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;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,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