@depup/expo__cli 55.0.22-depup.1 → 57.0.9-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -18
- package/build/bin/cli +4 -4
- package/build/bin/cli.map +1 -1
- package/build/src/api/endpoint.js +4 -4
- package/build/src/api/endpoint.js.map +1 -1
- package/build/src/api/getExpoSchema.js +3 -3
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/graphql/client.js +26 -14
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/mutations/TunnelMutation.js +31 -0
- package/build/src/api/graphql/mutations/TunnelMutation.js.map +1 -0
- package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/ResponseCache.js +5 -5
- package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
- package/build/src/api/rest/client.js +35 -20
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +6 -5
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +28 -15
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +10 -3
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +76 -24
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +4 -4
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +19 -7
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +3 -3
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +7 -4
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/templates.js +4 -6
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/events/index.js +19 -15
- package/build/src/events/index.js.map +1 -1
- package/build/src/events/stream.js +94 -24
- package/build/src/events/stream.js.map +1 -1
- package/build/src/expoUpdatesExports.js +50 -7
- package/build/src/expoUpdatesExports.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +58 -24
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +1 -1
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/index.js +1 -1
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +7 -6
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +7 -7
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +40 -30
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +5 -5
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportDomComponents.js +16 -9
- package/build/src/export/exportDomComponents.js.map +1 -1
- package/build/src/export/exportHermes.js +23 -13
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +30 -21
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +26 -34
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/html.js +3 -3
- package/build/src/export/html.js.map +1 -1
- package/build/src/export/index.js +2 -0
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +4 -4
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +6 -6
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +16 -4
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +12 -13
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +3 -3
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/static.js +6 -0
- package/build/src/export/static.js.map +1 -0
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +1 -28
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +3 -3
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +3 -3
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/install/utils/checkPackagesCompatibility.js +32 -16
- package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
- package/build/src/lint/ESlintPrerequisite.js.map +1 -1
- package/build/src/log.js +32 -14
- package/build/src/log.js.map +1 -1
- package/build/src/login/index.js +25 -5
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +49 -14
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +3 -3
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +3 -2
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +31 -6
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +8 -5
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +7 -7
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +10 -5
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +3 -3
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +7 -7
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js.map +1 -1
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +3 -4
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +48 -1
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +4 -1
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +4 -4
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +163 -23
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +6 -5
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +10 -16
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +2 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/ServiceClient.js +3 -3
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +3 -3
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +16 -13
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +6 -6
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +5 -5
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +7 -7
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +5 -5
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +8 -8
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +5 -3
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +7 -5
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/settings.js +3 -3
- package/build/src/run/ios/codeSigning/settings.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +4 -4
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +8 -1
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +3 -3
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/appleDestinations.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +3 -3
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +8 -3
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +4 -4
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +9 -4
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +39 -0
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/ios/validateExternalBinary.js.map +1 -1
- package/build/src/run/startBundler.js +4 -0
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/serve/index.js +4 -1
- package/build/src/serve/index.js.map +1 -1
- package/build/src/serve/serveAsync.js +23 -11
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/serve/static.js +69 -0
- package/build/src/serve/static.js.map +1 -0
- package/build/src/start/checkDependenciesOnStart.js +131 -0
- package/build/src/start/checkDependenciesOnStart.js.map +1 -0
- package/build/src/start/detectDevClient.js +3 -3
- package/build/src/start/detectDevClient.js.map +1 -1
- package/build/src/start/doctor/Prerequisite.js +4 -4
- package/build/src/start/doctor/Prerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +53 -91
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +3 -3
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +3 -3
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +5 -5
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -5
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/reactNativeTv.js +149 -0
- package/build/src/start/doctor/dependencies/reactNativeTv.js.map +1 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js +4 -4
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +33 -8
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +14 -9
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/ngrok/NgrokResolver.js +3 -3
- package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +3 -3
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +5 -12
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +2 -0
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +6 -6
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +49 -6
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +13 -4
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +4 -0
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +13 -4
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +36 -34
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +4 -4
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +5 -5
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/getDevices.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +5 -5
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +3 -3
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +20 -6
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js +11 -0
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +7 -7
- package/build/src/start/platforms/ios/devicectl.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +26 -11
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +5 -5
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +5 -4
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +25 -19
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +3 -3
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +3 -3
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +6 -6
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/project/dotExpo.js +4 -3
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/resolveOptions.js +7 -7
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +1 -1
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/AsyncWsTunnel.js +120 -35
- package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
- package/build/src/start/server/Bonjour.js +8 -3
- package/build/src/start/server/Bonjour.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +23 -9
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPlugin.js +63 -3
- package/build/src/start/server/DevToolsPlugin.js.map +1 -1
- package/build/src/start/server/DevToolsPlugin.schema.js +8 -3
- package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -1
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +58 -23
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -1
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js +29 -0
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +20 -6
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginServerHelpers.js +83 -0
- package/build/src/start/server/DevToolsPluginServerHelpers.js.map +1 -0
- package/build/src/start/server/DevelopmentSession.js +41 -24
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/MCP.js +10 -3
- package/build/src/start/server/MCP.js.map +1 -1
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js +15 -5
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +14 -1
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js +18 -4
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +13 -24
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +245 -114
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +67 -16
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +22 -4
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js +25 -12
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
- package/build/src/start/server/metro/createExpoFallbackResolver.js +39 -0
- package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
- package/build/src/start/server/metro/createFileMap-fork.js +196 -0
- package/build/src/start/server/metro/createFileMap-fork.js.map +1 -0
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +22 -22
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createTypescriptResolver.js +410 -0
- package/build/src/start/server/metro/createTypescriptResolver.js.map +1 -0
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
- package/build/src/start/server/metro/debugging/attachAtlas.js +3 -3
- package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +6 -5
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +20 -4
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
- package/build/src/start/server/metro/dev-server/compression.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMessageSocket.js +13 -2
- package/build/src/start/server/metro/dev-server/createMessageSocket.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +9 -2
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js +3 -3
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
- package/build/src/start/server/metro/errors/FailedToResolveNativeOnlyModuleError.js.map +1 -1
- package/build/src/start/server/metro/externals.js +4 -4
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +3 -3
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +3 -3
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +141 -57
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +4 -4
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js +3 -3
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +16 -13
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroErrors.js +3 -3
- package/build/src/start/server/metro/metroErrors.js.map +1 -1
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +48 -16
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/resolveLoader.js +3 -3
- package/build/src/start/server/metro/resolveLoader.js.map +1 -1
- package/build/src/start/server/metro/router.js +23 -14
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +13 -10
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +29 -13
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +36 -34
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js +53 -30
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +187 -126
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +4 -4
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CorsMiddleware.js +3 -3
- package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +60 -9
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js +30 -17
- package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +6 -4
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +3 -3
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +13 -8
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +19 -47
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/OpenMiddleware.js +150 -0
- package/build/src/start/server/middleware/OpenMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +13 -4
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +2 -9
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/domPolyfills.js +60 -0
- package/build/src/start/server/middleware/domPolyfills.js.map +1 -0
- package/build/src/start/server/middleware/inspector/JsInspector.js +6 -31
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +14 -24
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +3 -3
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +15 -14
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/mutations.js +3 -3
- package/build/src/start/server/middleware/mutations.js.map +1 -1
- package/build/src/start/server/middleware/openHandlers.js +157 -0
- package/build/src/start/server/middleware/openHandlers.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js +4 -4
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +9 -7
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
- package/build/src/start/server/openPlatforms.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +3 -1
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +13 -36
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +3 -3
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +14 -55
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +5 -5
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +12 -10
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -3
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +4 -4
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +3 -3
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +21 -11
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/types.d.ts +2 -0
- package/build/src/utils/FileNotifier.js +1 -1
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/args.js +5 -5
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/array.js +8 -8
- package/build/src/utils/array.js.map +1 -1
- package/build/src/utils/build-cache-providers/helpers.js +4 -4
- package/build/src/utils/build-cache-providers/helpers.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js +5 -5
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/cocoapods.js +5 -5
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +12 -6
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/composeMetroIgnorePatterns.js +69 -0
- package/build/src/utils/composeMetroIgnorePatterns.js.map +1 -0
- package/build/src/utils/createTempPath.js +3 -3
- package/build/src/utils/createTempPath.js.map +1 -1
- package/build/src/utils/delay.js +4 -4
- package/build/src/utils/delay.js.map +1 -1
- package/build/src/utils/dir.js +21 -11
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +4 -4
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +4 -4
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +39 -13
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +6 -6
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/exit.js +15 -19
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/expoUpdatesCli.js +5 -5
- package/build/src/utils/expoUpdatesCli.js.map +1 -1
- package/build/src/utils/fetch.js +4 -4
- package/build/src/utils/fetch.js.map +1 -1
- package/build/src/utils/filePath.js +3 -29
- package/build/src/utils/filePath.js.map +1 -1
- package/build/src/utils/findUp.js +3 -3
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/fn.js +3 -3
- package/build/src/utils/fn.js.map +1 -1
- package/build/src/utils/freeport.js +3 -3
- package/build/src/utils/freeport.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +3 -5
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +5 -5
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +3 -3
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +3 -3
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/ip.js +4 -4
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/link.js +3 -3
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +10 -10
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +3 -3
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/net.js +23 -4
- package/build/src/utils/net.js.map +1 -1
- package/build/src/utils/nodeEnv.js +6 -6
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/npm.js +10 -9
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/obj.js +4 -4
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/open.js +240 -11
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +4 -4
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +5 -4
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +12 -5
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/progress.js +4 -4
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +11 -11
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/qr.js +5 -4
- package/build/src/utils/qr.js.map +1 -1
- package/build/src/utils/resolveArgs.js +10 -9
- package/build/src/utils/resolveArgs.js.map +1 -1
- package/build/src/utils/scheme.js +4 -4
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/strings.js.map +1 -1
- package/build/src/utils/tar.js +8 -7
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/Telemetry.js +5 -0
- package/build/src/utils/telemetry/Telemetry.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js +5 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
- package/build/src/utils/telemetry/index.js +4 -4
- package/build/src/utils/telemetry/index.js.map +1 -1
- package/build/src/utils/telemetry/utils/agent.js +42 -0
- package/build/src/utils/telemetry/utils/agent.js.map +1 -0
- package/build/src/utils/telemetry/utils/constants.js +3 -3
- package/build/src/utils/telemetry/utils/constants.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +3 -2
- package/build/src/utils/telemetry/utils/context.js.map +1 -1
- package/build/src/utils/url.js +5 -17
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +12 -12
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +4 -4
- package/build/src/utils/variadic.js.map +1 -1
- package/build/src/whoami/index.js.map +1 -1
- package/changes.json +16 -36
- package/main.js +3 -0
- package/package.json +86 -90
- package/static/loading-page/index.html +45 -3
- package/static/template/+html.tsx +14 -5
- package/add-module.js +0 -8
- package/build/src/start/server/middleware/inspector/CdpClient.js +0 -81
- package/build/src/start/server/middleware/inspector/CdpClient.js.map +0 -1
- package/build/src/utils/resolveGlobal.js +0 -195
- package/build/src/utils/resolveGlobal.js.map +0 -1
- package/build/src/utils/resolveWatchFolders.js +0 -67
- package/build/src/utils/resolveWatchFolders.js.map +0 -1
- package/build/src/utils/tsconfig/evaluateTsConfig.js +0 -87
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +0 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +0 -84
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +0 -1
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +0 -94
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +0 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +0 -62
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/editor.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport process from 'node:process';\n\nimport { env } from './env';\nimport * as Log from '../log';\n\nconst debug = require('debug')('expo:utils:editor') as typeof console.log;\n\ninterface Editor {\n id: string;\n name: string;\n binary: string;\n isTerminalEditor: boolean;\n isOSXOnly?: boolean;\n paths: string[];\n keywords: string[];\n}\n\n// See: https://github.com/sindresorhus/env-editor/blob/3f6aea10ff53910c877b1bf73a8e0c954a5fbf11/index.js\n// MIT License, Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\nfunction getEditor(input: string | undefined, allowAnyEditor = false): Editor | null {\n const needle = input?.trim().toLowerCase();\n if (!needle) {\n return null;\n }\n const id = needle.split(/[/\\\\]/).pop()?.replace(/\\s/g, '-');\n const binary = id?.split('-')[0];\n const editor =\n EDITORS.find((editor) => {\n switch (needle) {\n case editor.id:\n case editor.name.toLowerCase():\n case editor.binary:\n return true;\n default:\n for (const editorPath of editor.paths) {\n if (path.normalize(needle) === path.normalize(editorPath.toLowerCase())) return true;\n }\n for (const keyword of editor.keywords) {\n if (needle === keyword) return true;\n }\n return false;\n }\n }) ?? (binary ? EDITORS.find((editor) => editor.binary === binary) : null);\n if (allowAnyEditor && id && binary && !editor) {\n return {\n id,\n name: needle,\n binary,\n isTerminalEditor: false,\n paths: [],\n keywords: [],\n };\n }\n return editor || null;\n}\n\n/** Guess what the default editor is and default to VSCode. */\nexport function guessEditor(): Editor | null {\n let editor: Editor | null = null;\n if (env.EXPO_EDITOR) {\n editor = getEditor(env.EXPO_EDITOR);\n if (editor) {\n debug('Using $EXPO_EDITOR:', editor.name);\n }\n }\n\n if (!editor && process.env.VISUAL) {\n editor = getEditor(process.env.VISUAL);\n if (editor) {\n debug('Using $VISUAL:', editor.name);\n }\n }\n\n if (!editor && process.env.EDITOR) {\n editor = getEditor(process.env.EDITOR);\n if (editor) {\n debug('Using $EDITOR:', editor.name);\n }\n }\n\n return editor;\n}\n\nexport async function guessFallbackVisualEditor(): Promise<Editor | null> {\n // We search for editors at known `editor.paths`\n for (const editor of VISUAL_EDITORS) {\n const target = await editorExistsAtPaths(editor);\n if (target) {\n debug('Found visual editor fallback:', editor.name);\n return { ...editor, binary: target };\n }\n }\n // We search again for a visual editor against `editor.binary` in `$PATH`\n for (const editor of VISUAL_EDITORS) {\n const target = await editorExistsInPath(editor);\n if (target) {\n debug('Found visual editor fallback in $PATH:', editor.name);\n return { ...editor, binary: target };\n }\n }\n return null;\n}\n\nlet _cachedEditor: Editor | null | undefined;\n\nasync function determineEditorAsync(): Promise<Editor | null> {\n if (_cachedEditor !== undefined) {\n return _cachedEditor;\n }\n\n // First: Try to get a known editor\n let editor = guessEditor();\n\n // Second: If we don't have a known editor, fall back to EXPO_EDITOR / VISUAL resolution\n // We check if the binary in these environment variables exists in the $PATH\n const forceEditorName = env.EXPO_EDITOR ?? process.env.VISUAL;\n if (!editor && forceEditorName) {\n const forceEditor = getEditor(forceEditorName, true);\n if (forceEditor && (await editorExistsInPath(forceEditor))) {\n editor = forceEditor;\n }\n }\n\n // Third: Try to find a fallback visual editor, but keep the found one if we can't find a fallback\n if (editor?.isTerminalEditor) {\n const fallback = await guessFallbackVisualEditor();\n if (fallback) {\n editor = fallback;\n }\n }\n\n return (_cachedEditor = editor);\n}\n\n/** Open a file path in a given editor. */\nexport async function openInEditorAsync(path: string, lineNumber?: number): Promise<boolean> {\n const editor = await determineEditorAsync();\n\n if (editor && !editor.isTerminalEditor) {\n const fileReference = lineNumber ? `${path}:${lineNumber}` : path;\n debug(\n `Opening ${fileReference} in ${editor?.name} (bin: ${editor?.binary}, id: ${editor?.id})`\n );\n\n if (editor) {\n try {\n await spawnAsync(editor.binary, getEditorArguments(editor, path, lineNumber), {\n timeout: 1_000,\n });\n return true;\n } catch (error: any) {\n // NOTE(@kitten): The process might explicitly request to be terminated, which is fine\n if (error?.signal === 'SIGTERM') {\n return true;\n }\n debug(\n `Failed to open ${fileReference} in editor (path: ${path}, binary: ${editor.binary}):`,\n error\n );\n }\n }\n }\n\n Log.error(\n (editor?.isTerminalEditor\n ? `Could not open ${editor.name} as it's a terminal editor.`\n : 'Could not open editor.') +\n `\\nYou can set an editor for Expo to open by defining the $EXPO_EDITOR or $VISUAL environment variable (e.g. \"vscode\" or \"atom\")`\n );\n return false;\n}\n\nfunction getEditorArguments(editor: Editor, path: string, lineNumber?: number): string[] {\n switch (editor.id) {\n case 'atom':\n case 'sublime':\n return lineNumber ? [`${path}:${lineNumber}`] : [path];\n\n case 'emacs':\n case 'emacsforosx':\n case 'nano':\n case 'neovim':\n case 'vim':\n return lineNumber ? [`+${lineNumber}`, path] : [path];\n\n case 'android-studio':\n case 'intellij':\n case 'textmate':\n case 'webstorm':\n case 'xcode':\n return lineNumber ? [`--line=${lineNumber}`, path] : [path];\n\n case 'vscode':\n case 'vscodium':\n case 'cursor':\n return lineNumber ? ['-g', `${path}:${lineNumber}`] : ['-g', path];\n\n case 'zed':\n // '-r': Stands for \"--reuse\" and ensures we don't use the `zed` GUI binary, since the Zed CLI\n // is linked as `zed` into `$PATH` when it's actually the CLI\n return lineNumber ? ['-r', `${path}:${lineNumber}`] : ['-r', path];\n\n default:\n return [path];\n }\n}\n\n/** Attempt to resolve an editor against $PATH */\nasync function editorExistsInPath(editor: Editor) {\n if (process.platform !== 'darwin' && editor.isOSXOnly) {\n return null;\n }\n const binary = editor.binary;\n const paths = (process.env.PATH || process.env.Path || '')\n .split(path.delimiter)\n .map((target) => target.trim())\n .filter((target) => !!target);\n const exts =\n process.platform === 'win32'\n ? (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM').split(path.delimiter).filter(Boolean)\n : [''];\n const targets = paths.flatMap((dir) => exts.map((ext) => path.join(dir, `${binary}${ext}`)));\n for (const target of targets) {\n try {\n const mode = process.platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK;\n await fs.promises.access(target, mode);\n return target;\n } catch {\n // ignore not found and continue\n }\n }\n return null;\n}\n\n/** Attempt to resolve an editor against known `paths` */\nasync function editorExistsAtPaths(editor: Editor) {\n // We can skip the path if it's not for our platform (win32 vs posix paths)\n const targets = editor.paths.filter((target) => target.includes(path.sep));\n for (const target of targets) {\n try {\n const mode = process.platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK;\n await fs.promises.access(target, mode);\n return target;\n } catch {\n // ignore not found and continue\n }\n }\n return null;\n}\n\nconst TERMINAL_EDITORS: (Editor & { isTerminalEditor: true })[] = [\n {\n id: 'vim',\n name: 'Vim',\n binary: 'vim',\n isTerminalEditor: true,\n paths: [],\n keywords: ['vi'],\n },\n {\n id: 'neovim',\n name: 'NeoVim',\n binary: 'nvim',\n isTerminalEditor: true,\n paths: [],\n keywords: ['vim'],\n },\n {\n id: 'nano',\n name: 'GNU nano',\n binary: 'nano',\n isTerminalEditor: true,\n paths: [],\n keywords: [],\n },\n {\n id: 'emacs',\n name: 'GNU Emacs',\n binary: 'emacs',\n isTerminalEditor: true,\n paths: [],\n keywords: [],\n },\n];\n\nconst VISUAL_EDITORS: (Editor & { isTerminalEditor: false })[] = [\n {\n id: 'vscode',\n name: 'Visual Studio Code',\n binary: 'code',\n isTerminalEditor: false,\n paths: ['/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code'],\n keywords: ['vs code'],\n },\n {\n id: 'vscode-insiders',\n name: 'Visual Studio Code - Insiders',\n binary: 'code-insiders',\n isTerminalEditor: false,\n paths: [\n '/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders',\n ],\n keywords: ['vs code insiders', 'code insiders', 'insiders'],\n },\n {\n id: 'vscodium',\n name: 'VSCodium',\n binary: 'codium',\n isTerminalEditor: false,\n paths: ['/Applications/VSCodium.app/Contents/Resources/app/bin/codium'],\n keywords: [],\n },\n {\n id: 'cursor',\n name: 'Cursor',\n binary: 'cursor',\n isTerminalEditor: false,\n paths: ['/Applications/Cursor.app/Contents/Resources/app/bin/codium'],\n keywords: [],\n },\n {\n id: 'sublime',\n name: 'Sublime Text',\n binary: 'subl',\n isTerminalEditor: false,\n paths: [\n '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',\n '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',\n ],\n keywords: [],\n },\n {\n id: 'atom',\n name: 'Atom',\n binary: 'atom',\n isTerminalEditor: false,\n paths: ['/Applications/Atom.app/Contents/Resources/app/atom.sh'],\n keywords: [],\n },\n {\n id: 'webstorm',\n name: 'WebStorm',\n binary: 'webstorm',\n isTerminalEditor: false,\n paths: [],\n keywords: ['wstorm'],\n },\n {\n id: 'phpstorm',\n name: 'PhpStorm',\n binary: 'pstorm',\n isTerminalEditor: false,\n paths: [],\n keywords: ['php'],\n },\n {\n id: 'zed',\n name: 'Zed',\n binary: 'zed',\n isTerminalEditor: false,\n paths: ['/Applications/Zed.app/Contents/MacOS/cli'],\n keywords: [],\n },\n {\n id: 'textmate',\n name: 'TextMate',\n binary: 'mate',\n isTerminalEditor: false,\n paths: [],\n keywords: [],\n },\n {\n id: 'intellij',\n name: 'IntelliJ IDEA',\n binary: 'idea',\n isTerminalEditor: false,\n paths: [],\n keywords: ['idea', 'java', 'jetbrains', 'ide'],\n },\n {\n id: 'emacsforosx',\n name: 'GNU Emacs for Mac OS X',\n binary: 'Emacs',\n isTerminalEditor: false,\n isOSXOnly: true,\n paths: ['/Applications/Emacs.app/Contents/MacOS/Emacs'],\n keywords: [],\n },\n {\n id: 'xcode',\n name: 'Xcode',\n binary: 'xed',\n isTerminalEditor: false,\n isOSXOnly: true,\n paths: [\n '/Applications/Xcode.app/Contents/MacOS/Xcode',\n '/Applications/Xcode-beta.app/Contents/MacOS/Xcode',\n ],\n keywords: ['xed'],\n },\n {\n id: 'android-studio',\n name: 'Android Studio',\n binary: 'studio',\n isTerminalEditor: false,\n paths: [\n '/Applications/Android Studio.app/Contents/MacOS/studio',\n '/usr/local/Android/android-studio/bin/studio.sh',\n 'C:\\\\Program Files (x86)\\\\Android\\\\android-studio\\\\bin\\\\studio.exe',\n 'C:\\\\Program Files\\\\Android\\\\android-studio\\\\bin\\\\studio64.exe',\n ],\n keywords: ['studio'],\n },\n];\n\nconst EDITORS: Editor[] = [...VISUAL_EDITORS, ...TERMINAL_EDITORS];\n"],"names":["guessEditor","guessFallbackVisualEditor","openInEditorAsync","debug","require","getEditor","input","allowAnyEditor","needle","trim","toLowerCase","id","split","pop","replace","binary","editor","EDITORS","find","name","editorPath","paths","path","normalize","keyword","keywords","isTerminalEditor","env","EXPO_EDITOR","process","VISUAL","EDITOR","VISUAL_EDITORS","target","editorExistsAtPaths","editorExistsInPath","_cachedEditor","determineEditorAsync","undefined","forceEditorName","forceEditor","fallback","lineNumber","fileReference","spawnAsync","getEditorArguments","timeout","error","signal","Log","platform","isOSXOnly","PATH","Path","delimiter","map","filter","exts","PATHEXT","Boolean","targets","flatMap","dir","ext","join","mode","fs","constants","F_OK","X_OK","promises","access","includes","sep","TERMINAL_EDITORS"],"mappings":";;;;;;;;;;;IA4DgBA,WAAW;eAAXA;;IA0BMC,yBAAyB;eAAzBA;;IAoDAC,iBAAiB;eAAjBA;;;;gEA1IC;;;;;;;gEACR;;;;;;;gEACE;;;;;;;gEACG;;;;;;qBAEA;6DACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMC,QAAQC,QAAQ,SAAS;AAY/B,yGAAyG;AACzG,+FAA+F;AAC/F,SAASC,UAAUC,KAAyB,EAAEC,iBAAiB,KAAK;QAKvDC;IAJX,MAAMA,SAASF,yBAAAA,MAAOG,IAAI,GAAGC,WAAW;IACxC,IAAI,CAACF,QAAQ;QACX,OAAO;IACT;IACA,MAAMG,MAAKH,oBAAAA,OAAOI,KAAK,CAAC,SAASC,GAAG,uBAAzBL,kBAA6BM,OAAO,CAAC,OAAO;IACvD,MAAMC,SAASJ,sBAAAA,GAAIC,KAAK,CAAC,IAAI,CAAC,EAAE;IAChC,MAAMI,SACJC,QAAQC,IAAI,CAAC,CAACF;QACZ,OAAQR;YACN,KAAKQ,OAAOL,EAAE;YACd,KAAKK,OAAOG,IAAI,CAACT,WAAW;YAC5B,KAAKM,OAAOD,MAAM;gBAChB,OAAO;YACT;gBACE,KAAK,MA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;QACRW,kBAAkB;QAClBL,OAAO;YACL;YACA;YACA;YACA;SACD;QACDI,UAAU;YAAC;SAAS;IACtB;CACD;AAED,MAAMR,UAAoB;OAAIe;OAAmB0C;CAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/editor.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport process from 'node:process';\n\nimport { env } from './env';\nimport * as Log from '../log';\n\nconst debug = require('debug')('expo:utils:editor') as typeof console.log;\n\ninterface Editor {\n id: string;\n name: string;\n binary: string;\n isTerminalEditor: boolean;\n isOSXOnly?: boolean;\n paths: string[];\n keywords: string[];\n}\n\n// See: https://github.com/sindresorhus/env-editor/blob/3f6aea10ff53910c877b1bf73a8e0c954a5fbf11/index.js\n// MIT License, Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\nfunction getEditor(input: string | undefined, allowAnyEditor = false): Editor | null {\n const needle = input?.trim().toLowerCase();\n if (!needle) {\n return null;\n }\n const id = needle.split(/[/\\\\]/).pop()?.replace(/\\s/g, '-');\n const binary = id?.split('-')[0];\n const editor =\n EDITORS.find((editor) => {\n switch (needle) {\n case editor.id:\n case editor.name.toLowerCase():\n case editor.binary:\n return true;\n default:\n for (const editorPath of editor.paths) {\n if (path.normalize(needle) === path.normalize(editorPath.toLowerCase())) return true;\n }\n for (const keyword of editor.keywords) {\n if (needle === keyword) return true;\n }\n return false;\n }\n }) ?? (binary ? EDITORS.find((editor) => editor.binary === binary) : null);\n if (allowAnyEditor && id && binary && !editor) {\n return {\n id,\n name: needle,\n binary,\n isTerminalEditor: false,\n paths: [],\n keywords: [],\n };\n }\n return editor || null;\n}\n\n/** Guess what the default editor is and default to VSCode. */\nexport function guessEditor(): Editor | null {\n let editor: Editor | null = null;\n if (env.EXPO_EDITOR) {\n editor = getEditor(env.EXPO_EDITOR);\n if (editor) {\n debug('Using $EXPO_EDITOR:', editor.name);\n }\n }\n\n if (!editor && process.env.VISUAL) {\n editor = getEditor(process.env.VISUAL);\n if (editor) {\n debug('Using $VISUAL:', editor.name);\n }\n }\n\n if (!editor && process.env.EDITOR) {\n editor = getEditor(process.env.EDITOR);\n if (editor) {\n debug('Using $EDITOR:', editor.name);\n }\n }\n\n return editor;\n}\n\nexport async function guessFallbackVisualEditor(): Promise<Editor | null> {\n // We search for editors at known `editor.paths`\n for (const editor of VISUAL_EDITORS) {\n const target = await editorExistsAtPaths(editor);\n if (target) {\n debug('Found visual editor fallback:', editor.name);\n return { ...editor, binary: target };\n }\n }\n // We search again for a visual editor against `editor.binary` in `$PATH`\n for (const editor of VISUAL_EDITORS) {\n const target = await editorExistsInPath(editor);\n if (target) {\n debug('Found visual editor fallback in $PATH:', editor.name);\n return { ...editor, binary: target };\n }\n }\n return null;\n}\n\nlet _cachedEditor: Editor | null | undefined;\n\nasync function determineEditorAsync(): Promise<Editor | null> {\n if (_cachedEditor !== undefined) {\n return _cachedEditor;\n }\n\n // First: Try to get a known editor\n let editor = guessEditor();\n\n // Second: If we don't have a known editor, fall back to EXPO_EDITOR / VISUAL resolution\n // We check if the binary in these environment variables exists in the $PATH\n const forceEditorName = env.EXPO_EDITOR ?? process.env.VISUAL;\n if (!editor && forceEditorName) {\n const forceEditor = getEditor(forceEditorName, true);\n if (forceEditor && (await editorExistsInPath(forceEditor))) {\n editor = forceEditor;\n }\n }\n\n // Third: Try to find a fallback visual editor, but keep the found one if we can't find a fallback\n if (editor?.isTerminalEditor) {\n const fallback = await guessFallbackVisualEditor();\n if (fallback) {\n editor = fallback;\n }\n }\n\n return (_cachedEditor = editor);\n}\n\n/** Open a file path in a given editor. */\nexport async function openInEditorAsync(path: string, lineNumber?: number): Promise<boolean> {\n const editor = await determineEditorAsync();\n\n if (editor && !editor.isTerminalEditor) {\n const fileReference = lineNumber ? `${path}:${lineNumber}` : path;\n debug(\n `Opening ${fileReference} in ${editor?.name} (bin: ${editor?.binary}, id: ${editor?.id})`\n );\n\n if (editor) {\n try {\n await spawnAsync(editor.binary, getEditorArguments(editor, path, lineNumber), {\n timeout: 1_000,\n });\n return true;\n } catch (error: any) {\n // NOTE(@kitten): The process might explicitly request to be terminated, which is fine\n if (error?.signal === 'SIGTERM') {\n return true;\n }\n debug(\n `Failed to open ${fileReference} in editor (path: ${path}, binary: ${editor.binary}):`,\n error\n );\n }\n }\n }\n\n Log.error(\n (editor?.isTerminalEditor\n ? `Could not open ${editor.name} as it's a terminal editor.`\n : 'Could not open editor.') +\n `\\nYou can set an editor for Expo to open by defining the $EXPO_EDITOR or $VISUAL environment variable (e.g. \"vscode\" or \"atom\")`\n );\n return false;\n}\n\nfunction getEditorArguments(editor: Editor, path: string, lineNumber?: number): string[] {\n switch (editor.id) {\n case 'atom':\n case 'sublime':\n return lineNumber ? [`${path}:${lineNumber}`] : [path];\n\n case 'emacs':\n case 'emacsforosx':\n case 'nano':\n case 'neovim':\n case 'vim':\n return lineNumber ? [`+${lineNumber}`, path] : [path];\n\n case 'android-studio':\n case 'intellij':\n case 'textmate':\n case 'webstorm':\n case 'xcode':\n return lineNumber ? [`--line=${lineNumber}`, path] : [path];\n\n case 'vscode':\n case 'vscodium':\n case 'cursor':\n return lineNumber ? ['-g', `${path}:${lineNumber}`] : ['-g', path];\n\n case 'zed':\n // '-r': Stands for \"--reuse\" and ensures we don't use the `zed` GUI binary, since the Zed CLI\n // is linked as `zed` into `$PATH` when it's actually the CLI\n return lineNumber ? ['-r', `${path}:${lineNumber}`] : ['-r', path];\n\n default:\n return [path];\n }\n}\n\n/** Attempt to resolve an editor against $PATH */\nasync function editorExistsInPath(editor: Editor) {\n if (process.platform !== 'darwin' && editor.isOSXOnly) {\n return null;\n }\n const binary = editor.binary;\n const paths = (process.env.PATH || process.env.Path || '')\n .split(path.delimiter)\n .map((target) => target.trim())\n .filter((target) => !!target);\n const exts =\n process.platform === 'win32'\n ? (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM').split(path.delimiter).filter(Boolean)\n : [''];\n const targets = paths.flatMap((dir) => exts.map((ext) => path.join(dir, `${binary}${ext}`)));\n for (const target of targets) {\n try {\n const mode = process.platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK;\n await fs.promises.access(target, mode);\n return target;\n } catch {\n // ignore not found and continue\n }\n }\n return null;\n}\n\n/** Attempt to resolve an editor against known `paths` */\nasync function editorExistsAtPaths(editor: Editor) {\n // We can skip the path if it's not for our platform (win32 vs posix paths)\n const targets = editor.paths.filter((target) => target.includes(path.sep));\n for (const target of targets) {\n try {\n const mode = process.platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK;\n await fs.promises.access(target, mode);\n return target;\n } catch {\n // ignore not found and continue\n }\n }\n return null;\n}\n\nconst TERMINAL_EDITORS: (Editor & { isTerminalEditor: true })[] = [\n {\n id: 'vim',\n name: 'Vim',\n binary: 'vim',\n isTerminalEditor: true,\n paths: [],\n keywords: ['vi'],\n },\n {\n id: 'neovim',\n name: 'NeoVim',\n binary: 'nvim',\n isTerminalEditor: true,\n paths: [],\n keywords: ['vim'],\n },\n {\n id: 'nano',\n name: 'GNU nano',\n binary: 'nano',\n isTerminalEditor: true,\n paths: [],\n keywords: [],\n },\n {\n id: 'emacs',\n name: 'GNU Emacs',\n binary: 'emacs',\n isTerminalEditor: true,\n paths: [],\n keywords: [],\n },\n];\n\nconst VISUAL_EDITORS: (Editor & { isTerminalEditor: false })[] = [\n {\n id: 'vscode',\n name: 'Visual Studio Code',\n binary: 'code',\n isTerminalEditor: false,\n paths: ['/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code'],\n keywords: ['vs code'],\n },\n {\n id: 'vscode-insiders',\n name: 'Visual Studio Code - Insiders',\n binary: 'code-insiders',\n isTerminalEditor: false,\n paths: [\n '/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders',\n ],\n keywords: ['vs code insiders', 'code insiders', 'insiders'],\n },\n {\n id: 'vscodium',\n name: 'VSCodium',\n binary: 'codium',\n isTerminalEditor: false,\n paths: ['/Applications/VSCodium.app/Contents/Resources/app/bin/codium'],\n keywords: [],\n },\n {\n id: 'cursor',\n name: 'Cursor',\n binary: 'cursor',\n isTerminalEditor: false,\n paths: ['/Applications/Cursor.app/Contents/Resources/app/bin/codium'],\n keywords: [],\n },\n {\n id: 'sublime',\n name: 'Sublime Text',\n binary: 'subl',\n isTerminalEditor: false,\n paths: [\n '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',\n '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',\n ],\n keywords: [],\n },\n {\n id: 'atom',\n name: 'Atom',\n binary: 'atom',\n isTerminalEditor: false,\n paths: ['/Applications/Atom.app/Contents/Resources/app/atom.sh'],\n keywords: [],\n },\n {\n id: 'webstorm',\n name: 'WebStorm',\n binary: 'webstorm',\n isTerminalEditor: false,\n paths: [],\n keywords: ['wstorm'],\n },\n {\n id: 'phpstorm',\n name: 'PhpStorm',\n binary: 'pstorm',\n isTerminalEditor: false,\n paths: [],\n keywords: ['php'],\n },\n {\n id: 'zed',\n name: 'Zed',\n binary: 'zed',\n isTerminalEditor: false,\n paths: ['/Applications/Zed.app/Contents/MacOS/cli'],\n keywords: [],\n },\n {\n id: 'textmate',\n name: 'TextMate',\n binary: 'mate',\n isTerminalEditor: false,\n paths: [],\n keywords: [],\n },\n {\n id: 'intellij',\n name: 'IntelliJ IDEA',\n binary: 'idea',\n isTerminalEditor: false,\n paths: [],\n keywords: ['idea', 'java', 'jetbrains', 'ide'],\n },\n {\n id: 'emacsforosx',\n name: 'GNU Emacs for Mac OS X',\n binary: 'Emacs',\n isTerminalEditor: false,\n isOSXOnly: true,\n paths: ['/Applications/Emacs.app/Contents/MacOS/Emacs'],\n keywords: [],\n },\n {\n id: 'xcode',\n name: 'Xcode',\n binary: 'xed',\n isTerminalEditor: false,\n isOSXOnly: true,\n paths: [\n '/Applications/Xcode.app/Contents/MacOS/Xcode',\n '/Applications/Xcode-beta.app/Contents/MacOS/Xcode',\n ],\n keywords: ['xed'],\n },\n {\n id: 'android-studio',\n name: 'Android Studio',\n binary: 'studio',\n isTerminalEditor: false,\n paths: [\n '/Applications/Android Studio.app/Contents/MacOS/studio',\n '/usr/local/Android/android-studio/bin/studio.sh',\n 'C:\\\\Program Files (x86)\\\\Android\\\\android-studio\\\\bin\\\\studio.exe',\n 'C:\\\\Program Files\\\\Android\\\\android-studio\\\\bin\\\\studio64.exe',\n ],\n keywords: ['studio'],\n },\n];\n\nconst EDITORS: Editor[] = [...VISUAL_EDITORS, ...TERMINAL_EDITORS];\n"],"names":["guessEditor","guessFallbackVisualEditor","openInEditorAsync","debug","require","getEditor","input","allowAnyEditor","needle","trim","toLowerCase","id","split","pop","replace","binary","editor","EDITORS","find","name","editorPath","paths","path","normalize","keyword","keywords","isTerminalEditor","env","EXPO_EDITOR","process","VISUAL","EDITOR","VISUAL_EDITORS","target","editorExistsAtPaths","editorExistsInPath","_cachedEditor","determineEditorAsync","undefined","forceEditorName","forceEditor","fallback","lineNumber","fileReference","spawnAsync","getEditorArguments","timeout","error","signal","Log","platform","isOSXOnly","PATH","Path","delimiter","map","filter","exts","PATHEXT","Boolean","targets","flatMap","dir","ext","join","mode","fs","constants","F_OK","X_OK","promises","access","includes","sep","TERMINAL_EDITORS"],"mappings":";;;;;;;;;;;QA4DgBA;eAAAA;;QA0BMC;eAAAA;;QAoDAC;eAAAA;;;;gEA1IC;;;;;;;gEACR;;;;;;;gEACE;;;;;;;gEACG;;;;;;qBAEA;6DACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMC,QAAQC,QAAQ,SAAS;AAY/B,yGAAyG;AACzG,+FAA+F;AAC/F,SAASC,UAAUC,KAAyB,EAAEC,iBAAiB,KAAK;QAKvDC;IAJX,MAAMA,SAASF,yBAAAA,MAAOG,IAAI,GAAGC,WAAW;IACxC,IAAI,CAACF,QAAQ;QACX,OAAO;IACT;IACA,MAAMG,MAAKH,oBAAAA,OAAOI,KAAK,CAAC,SAASC,GA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Ed,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClByB,WAAW;QACX9B,OAAO;YAAC;SAA+C;QACvDI,UAAU,EAAE;IACd;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClByB,WAAW;QACX9B,OAAO;YACL;YACA;SACD;QACDI,UAAU;YAAC;SAAM;IACnB;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClBL,OAAO;YACL;YACA;YACA;YACA;SACD;QACDI,UAAU;YAAC;SAAS;IACtB;CACD;AAED,MAAMR,UAAoB;OAAIe;OAAmB0C;CAAiB"}
|
package/build/src/utils/env.js
CHANGED
|
@@ -5,20 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
env
|
|
12
|
+
get env () {
|
|
13
13
|
return env;
|
|
14
14
|
},
|
|
15
|
-
envIsHeadless
|
|
15
|
+
get envIsHeadless () {
|
|
16
16
|
return envIsHeadless;
|
|
17
17
|
},
|
|
18
|
-
envIsWebcontainer
|
|
18
|
+
get envIsWebcontainer () {
|
|
19
19
|
return envIsWebcontainer;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
function _env() {
|
|
23
|
+
const data = require("@expo/env");
|
|
24
|
+
_env = function() {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
22
29
|
function _getenv() {
|
|
23
30
|
const data = require("getenv");
|
|
24
31
|
_getenv = function() {
|
|
@@ -69,7 +76,9 @@ class Env {
|
|
|
69
76
|
return (0, _getenv().boolish)('EXPO_NO_TELEMETRY_DETACH', false);
|
|
70
77
|
}
|
|
71
78
|
/** local directory to the universe repo for testing locally */ get EXPO_UNIVERSE_DIR() {
|
|
72
|
-
|
|
79
|
+
// Read from the pre-dotenv env — this is a filesystem path used by internal
|
|
80
|
+
// tooling; a project `.env` overriding it could redirect file access.
|
|
81
|
+
return (0, _env().getOriginalEnvValue)('EXPO_UNIVERSE_DIR') || '';
|
|
73
82
|
}
|
|
74
83
|
/** @deprecated Default Webpack host string */ get WEB_HOST() {
|
|
75
84
|
return (0, _getenv().string)('WEB_HOST', '0.0.0.0');
|
|
@@ -92,6 +101,9 @@ class Env {
|
|
|
92
101
|
/** Disable printing the QR code in the interactive Terminal UI. */ get EXPO_NO_QR_CODE() {
|
|
93
102
|
return (0, _getenv().boolish)('EXPO_NO_QR_CODE', false);
|
|
94
103
|
}
|
|
104
|
+
/** Resolve application IDs from Expo app config before native files in `expo start`. */ get EXPO_RUN_PREFER_APP_CONFIG_ID() {
|
|
105
|
+
return (0, _getenv().boolish)('EXPO_RUN_PREFER_APP_CONFIG_ID', false);
|
|
106
|
+
}
|
|
95
107
|
/** The React Metro port that's baked into react-native scripts and tools. */ get RCT_METRO_PORT() {
|
|
96
108
|
return (0, _getenv().int)('RCT_METRO_PORT', 0);
|
|
97
109
|
}
|
|
@@ -108,7 +120,11 @@ class Env {
|
|
|
108
120
|
* Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.
|
|
109
121
|
* This is useful for browser editors that require custom proxy URLs.
|
|
110
122
|
*/ get EXPO_PACKAGER_PROXY_URL() {
|
|
111
|
-
|
|
123
|
+
// Read from the pre-dotenv env — overrides dev server URL served to clients.
|
|
124
|
+
return (0, _env().getOriginalEnvValue)('EXPO_PACKAGER_PROXY_URL') || '';
|
|
125
|
+
}
|
|
126
|
+
get EXPO_UNSTABLE_TUNNEL_V2() {
|
|
127
|
+
return (0, _getenv().boolish)('EXPO_UNSTABLE_TUNNEL_V2', false);
|
|
112
128
|
}
|
|
113
129
|
/**
|
|
114
130
|
* **Experimental** - Disable using `exp.direct` as the hostname for
|
|
@@ -152,8 +168,10 @@ class Env {
|
|
|
152
168
|
* This flag is internal and was added for external tools.
|
|
153
169
|
* @internal
|
|
154
170
|
*/ get EXPO_OVERRIDE_METRO_CONFIG() {
|
|
155
|
-
var
|
|
156
|
-
|
|
171
|
+
var _getOriginalEnvValue;
|
|
172
|
+
// Read from the pre-dotenv env — this path is `require()`d as Metro config,
|
|
173
|
+
// so a project `.env` overriding it would execute attacker code in-process.
|
|
174
|
+
return ((_getOriginalEnvValue = (0, _env().getOriginalEnvValue)('EXPO_OVERRIDE_METRO_CONFIG')) == null ? void 0 : _getOriginalEnvValue.trim()) || undefined;
|
|
157
175
|
}
|
|
158
176
|
/**
|
|
159
177
|
* Use the network inspector by overriding the metro inspector proxy with a custom version.
|
|
@@ -198,7 +216,7 @@ class Env {
|
|
|
198
216
|
return (0, _getenv().boolish)('EXPO_USE_METRO_REQUIRE', false);
|
|
199
217
|
}
|
|
200
218
|
/** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */ get __EXPO_EAGER_BUNDLE_OPTIONS() {
|
|
201
|
-
return (0,
|
|
219
|
+
return (0, _env().getOriginalEnvValue)('__EXPO_EAGER_BUNDLE_OPTIONS') || '';
|
|
202
220
|
}
|
|
203
221
|
/** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */ get EXPO_NO_DEPLOY() {
|
|
204
222
|
return (0, _getenv().boolish)('EXPO_NO_DEPLOY', false);
|
|
@@ -209,9 +227,6 @@ class Env {
|
|
|
209
227
|
/** Enable experimental React Server Functions support. */ get EXPO_UNSTABLE_SERVER_FUNCTIONS() {
|
|
210
228
|
return (0, _getenv().boolish)('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);
|
|
211
229
|
}
|
|
212
|
-
/** Enable unstable/experimental mode where React Native Web isn't required to run Expo apps on web. */ get EXPO_NO_REACT_NATIVE_WEB() {
|
|
213
|
-
return (0, _getenv().boolish)('EXPO_NO_REACT_NATIVE_WEB', false);
|
|
214
|
-
}
|
|
215
230
|
/** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */ get EXPO_UNSTABLE_DEPLOY_SERVER() {
|
|
216
231
|
return (0, _getenv().boolish)('EXPO_UNSTABLE_DEPLOY_SERVER', false);
|
|
217
232
|
}
|
|
@@ -230,6 +245,16 @@ class Env {
|
|
|
230
245
|
/** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */ get EXPO_UNSTABLE_WEB_MODAL() {
|
|
231
246
|
return (0, _getenv().boolish)('EXPO_UNSTABLE_WEB_MODAL', false);
|
|
232
247
|
}
|
|
248
|
+
/** Disable @react-navigation checks for expo-router projects */ get EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK() {
|
|
249
|
+
return (0, _getenv().boolish)('EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK', false);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Disable Material Symbols (`md`) icon support in expo-router's NativeTabs on Android.
|
|
253
|
+
* When enabled, the Metro resolver swaps the Android-specific md icon converter for a no-op
|
|
254
|
+
* stub, so the `expo-symbols` dependency is tree-shaken out of the Android bundle.
|
|
255
|
+
*/ get EXPO_ROUTER_DISABLE_NATIVE_TABS_MD() {
|
|
256
|
+
return (0, _getenv().boolish)('EXPO_ROUTER_DISABLE_NATIVE_TABS_MD', false);
|
|
257
|
+
}
|
|
233
258
|
/** Disable by falsy value live binding in experimental import export support. Enabled by default. */ get EXPO_UNSTABLE_LIVE_BINDINGS() {
|
|
234
259
|
return (0, _getenv().boolish)('EXPO_UNSTABLE_LIVE_BINDINGS', true);
|
|
235
260
|
}
|
|
@@ -240,7 +265,8 @@ class Env {
|
|
|
240
265
|
if (value === '1' || value.toLowerCase() === 'true') {
|
|
241
266
|
return this.EXPO_STAGING ? 'staging-mcp.expo.dev' : 'mcp.expo.dev';
|
|
242
267
|
}
|
|
243
|
-
|
|
268
|
+
// Re-read from the pre-dotenv env — overrides dev server URL served to clients.
|
|
269
|
+
return (0, _env().getOriginalEnvValue)('EXPO_UNSTABLE_MCP_SERVER') || '';
|
|
244
270
|
}
|
|
245
271
|
/** Enable Expo Log Box for iOS and Android (Web is enabled by default) */ get EXPO_UNSTABLE_LOG_BOX() {
|
|
246
272
|
return (0, _getenv().boolish)('EXPO_UNSTABLE_LOG_BOX', false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\nimport process from 'node:process';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', true);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', envIsHeadless());\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** Disable printing the QR code in the interactive Terminal UI. */\n get EXPO_NO_QR_CODE(): boolean {\n return boolish('EXPO_NO_QR_CODE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Instructs a different Metro config to be loaded.\n * The path, according to metro-config, should be a path relative to the current working directory.\n * This flag is internal and was added for external tools.\n * @internal\n */\n get EXPO_OVERRIDE_METRO_CONFIG(): string | undefined {\n return process.env.EXPO_OVERRIDE_METRO_CONFIG?.trim() || undefined;\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /**\n * Enable the unstable inverse dependency stack trace for Metro bundling errors.\n * @deprecated This will be removed in the future.\n */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', true);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /**\n * Enable Atlas to gather bundle information during development or export.\n * Note, because this used to be an experimental feature, both `EXPO_ATLAS` and `EXPO_UNSTABLE_ATLAS` are supported.\n */\n get EXPO_ATLAS() {\n return boolish('EXPO_ATLAS', boolish('EXPO_UNSTABLE_ATLAS', false));\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Functions support. */\n get EXPO_UNSTABLE_SERVER_FUNCTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);\n }\n\n /** Enable unstable/experimental mode where React Native Web isn't required to run Expo apps on web. */\n get EXPO_NO_REACT_NATIVE_WEB(): boolean {\n return boolish('EXPO_NO_REACT_NATIVE_WEB', false);\n }\n\n /** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */\n get EXPO_UNSTABLE_DEPLOY_SERVER(): boolean {\n return boolish('EXPO_UNSTABLE_DEPLOY_SERVER', false);\n }\n\n /** Is running in EAS Build. This is set by EAS: https://docs.expo.dev/eas/environment-variables/ */\n get EAS_BUILD(): boolean {\n return boolish('EAS_BUILD', false);\n }\n\n /** Disable the React Native Directory compatibility check for new architecture when installing packages */\n get EXPO_NO_NEW_ARCH_COMPAT_CHECK(): boolean {\n return boolish('EXPO_NO_NEW_ARCH_COMPAT_CHECK', envIsHeadless());\n }\n\n /** Disable the dependency validation when installing other dependencies and starting the project */\n get EXPO_NO_DEPENDENCY_VALIDATION(): boolean {\n return boolish('EXPO_NO_DEPENDENCY_VALIDATION', envIsHeadless());\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_FORCE_WEBCONTAINER_ENV(): boolean {\n return boolish('EXPO_FORCE_WEBCONTAINER_ENV', false);\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_UNSTABLE_WEB_MODAL(): boolean {\n return boolish('EXPO_UNSTABLE_WEB_MODAL', false);\n }\n\n /** Disable by falsy value live binding in experimental import export support. Enabled by default. */\n get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean {\n return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true);\n }\n\n /**\n * Enable the experimental MCP integration or further specify the MCP server URL.\n */\n get EXPO_UNSTABLE_MCP_SERVER(): string {\n const value = string('EXPO_UNSTABLE_MCP_SERVER', '');\n if (value === '1' || value.toLowerCase() === 'true') {\n return this.EXPO_STAGING ? 'staging-mcp.expo.dev' : 'mcp.expo.dev';\n }\n return value;\n }\n\n /** Enable Expo Log Box for iOS and Android (Web is enabled by default) */\n get EXPO_UNSTABLE_LOG_BOX(): boolean {\n return boolish('EXPO_UNSTABLE_LOG_BOX', false);\n }\n\n /**\n * Enable Bonjour advertising of the Expo CLI on local networks\n */\n get EXPO_UNSTABLE_BONJOUR(): boolean {\n return boolish('EXPO_UNSTABLE_BONJOUR', !envIsHeadless());\n }\n\n /** @internal Configure other environment variables for headless operations */\n get EXPO_UNSTABLE_HEADLESS() {\n return boolish('EXPO_UNSTABLE_HEADLESS', envIsWebcontainer());\n }\n}\n\nexport const env = new Env();\n\nexport function envIsWebcontainer() {\n // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143\n return (\n env.EXPO_FORCE_WEBCONTAINER_ENV ||\n (process.env.SHELL === '/bin/jsh' && !!process.versions.webcontainer)\n );\n}\n\nexport function envIsHeadless() {\n return env.EXPO_UNSTABLE_HEADLESS;\n}\n"],"names":["env","envIsHeadless","envIsWebcontainer","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","EXPO_NO_QR_CODE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_OVERRIDE_METRO_CONFIG","trim","undefined","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_FUNCTIONS","EXPO_NO_REACT_NATIVE_WEB","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","EXPO_NO_NEW_ARCH_COMPAT_CHECK","EXPO_NO_DEPENDENCY_VALIDATION","EXPO_FORCE_WEBCONTAINER_ENV","EXPO_UNSTABLE_WEB_MODAL","EXPO_UNSTABLE_LIVE_BINDINGS","EXPO_UNSTABLE_MCP_SERVER","value","toLowerCase","EXPO_UNSTABLE_LOG_BOX","EXPO_UNSTABLE_BONJOUR","EXPO_UNSTABLE_HEADLESS","SHELL","versions","webcontainer"],"mappings":";;;;;;;;;;;IAwTaA,GAAG;eAAHA;;IAUGC,aAAa;eAAbA;;IARAC,iBAAiB;eAAjBA;;;;yBA1TqB;;;;;;;gEACjB;;;;;;;;;;;AAEpB,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC;IACJ,6BAA6B,GAC7B,IAAIC,eAAe;QACjB,OAAOC,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,yBAAyB,GACzB,IAAIC,aAAa;QACf,OAAOD,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,iCAAiC,GACjC,IAAIE,eAAe;QACjB,OAAOF,IAAAA,iB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c,CAAC,CAAClC,sBAAO,CAACmC,QAAQ,CAACC,YAAY;AAExE;AAEO,SAASrE;IACd,OAAOD,IAAImE,sBAAsB;AACnC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { getOriginalEnvValue } from '@expo/env';\nimport { boolish, int, string } from 'getenv';\nimport process from 'node:process';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n // Read from the pre-dotenv env — this is a filesystem path used by internal\n // tooling; a project `.env` overriding it could redirect file access.\n return getOriginalEnvValue('EXPO_UNIVERSE_DIR') || '';\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', true);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', envIsHeadless());\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** Disable printing the QR code in the interactive Terminal UI. */\n get EXPO_NO_QR_CODE(): boolean {\n return boolish('EXPO_NO_QR_CODE', false);\n }\n /** Resolve application IDs from Expo app config before native files in `expo start`. */\n get EXPO_RUN_PREFER_APP_CONFIG_ID(): boolean {\n return boolish('EXPO_RUN_PREFER_APP_CONFIG_ID', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n // Read from the pre-dotenv env — overrides dev server URL served to clients.\n return getOriginalEnvValue('EXPO_PACKAGER_PROXY_URL') || '';\n }\n\n get EXPO_UNSTABLE_TUNNEL_V2(): boolean {\n return boolish('EXPO_UNSTABLE_TUNNEL_V2', false);\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Instructs a different Metro config to be loaded.\n * The path, according to metro-config, should be a path relative to the current working directory.\n * This flag is internal and was added for external tools.\n * @internal\n */\n get EXPO_OVERRIDE_METRO_CONFIG(): string | undefined {\n // Read from the pre-dotenv env — this path is `require()`d as Metro config,\n // so a project `.env` overriding it would execute attacker code in-process.\n return getOriginalEnvValue('EXPO_OVERRIDE_METRO_CONFIG')?.trim() || undefined;\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /**\n * Enable the unstable inverse dependency stack trace for Metro bundling errors.\n * @deprecated This will be removed in the future.\n */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', true);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /**\n * Enable Atlas to gather bundle information during development or export.\n * Note, because this used to be an experimental feature, both `EXPO_ATLAS` and `EXPO_UNSTABLE_ATLAS` are supported.\n */\n get EXPO_ATLAS() {\n return boolish('EXPO_ATLAS', boolish('EXPO_UNSTABLE_ATLAS', false));\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return getOriginalEnvValue('__EXPO_EAGER_BUNDLE_OPTIONS') || '';\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Functions support. */\n get EXPO_UNSTABLE_SERVER_FUNCTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);\n }\n\n /** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */\n get EXPO_UNSTABLE_DEPLOY_SERVER(): boolean {\n return boolish('EXPO_UNSTABLE_DEPLOY_SERVER', false);\n }\n\n /** Is running in EAS Build. This is set by EAS: https://docs.expo.dev/eas/environment-variables/ */\n get EAS_BUILD(): boolean {\n return boolish('EAS_BUILD', false);\n }\n\n /** Disable the React Native Directory compatibility check for new architecture when installing packages */\n get EXPO_NO_NEW_ARCH_COMPAT_CHECK(): boolean {\n return boolish('EXPO_NO_NEW_ARCH_COMPAT_CHECK', envIsHeadless());\n }\n\n /** Disable the dependency validation when installing other dependencies and starting the project */\n get EXPO_NO_DEPENDENCY_VALIDATION(): boolean {\n return boolish('EXPO_NO_DEPENDENCY_VALIDATION', envIsHeadless());\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_FORCE_WEBCONTAINER_ENV(): boolean {\n return boolish('EXPO_FORCE_WEBCONTAINER_ENV', false);\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_UNSTABLE_WEB_MODAL(): boolean {\n return boolish('EXPO_UNSTABLE_WEB_MODAL', false);\n }\n\n /** Disable @react-navigation checks for expo-router projects */\n get EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK(): boolean {\n return boolish('EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK', false);\n }\n\n /**\n * Disable Material Symbols (`md`) icon support in expo-router's NativeTabs on Android.\n * When enabled, the Metro resolver swaps the Android-specific md icon converter for a no-op\n * stub, so the `expo-symbols` dependency is tree-shaken out of the Android bundle.\n */\n get EXPO_ROUTER_DISABLE_NATIVE_TABS_MD(): boolean {\n return boolish('EXPO_ROUTER_DISABLE_NATIVE_TABS_MD', false);\n }\n\n /** Disable by falsy value live binding in experimental import export support. Enabled by default. */\n get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean {\n return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true);\n }\n\n /**\n * Enable the experimental MCP integration or further specify the MCP server URL.\n */\n get EXPO_UNSTABLE_MCP_SERVER(): string {\n const value = string('EXPO_UNSTABLE_MCP_SERVER', '');\n if (value === '1' || value.toLowerCase() === 'true') {\n return this.EXPO_STAGING ? 'staging-mcp.expo.dev' : 'mcp.expo.dev';\n }\n // Re-read from the pre-dotenv env — overrides dev server URL served to clients.\n return getOriginalEnvValue('EXPO_UNSTABLE_MCP_SERVER') || '';\n }\n\n /** Enable Expo Log Box for iOS and Android (Web is enabled by default) */\n get EXPO_UNSTABLE_LOG_BOX(): boolean {\n return boolish('EXPO_UNSTABLE_LOG_BOX', false);\n }\n\n /**\n * Enable Bonjour advertising of the Expo CLI on local networks\n */\n get EXPO_UNSTABLE_BONJOUR(): boolean {\n return boolish('EXPO_UNSTABLE_BONJOUR', !envIsHeadless());\n }\n\n /** @internal Configure other environment variables for headless operations */\n get EXPO_UNSTABLE_HEADLESS() {\n return boolish('EXPO_UNSTABLE_HEADLESS', envIsWebcontainer());\n }\n}\n\nexport const env = new Env();\n\nexport function envIsWebcontainer() {\n // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143\n return (\n env.EXPO_FORCE_WEBCONTAINER_ENV ||\n (process.env.SHELL === '/bin/jsh' && !!process.versions.webcontainer)\n );\n}\n\nexport function envIsHeadless() {\n return env.EXPO_UNSTABLE_HEADLESS;\n}\n"],"names":["env","envIsHeadless","envIsWebcontainer","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","getOriginalEnvValue","WEB_HOST","string","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","EXPO_NO_QR_CODE","EXPO_RUN_PREFER_APP_CONFIG_ID","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_UNSTABLE_TUNNEL_V2","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_OVERRIDE_METRO_CONFIG","trim","undefined","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_FUNCTIONS","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","EXPO_NO_NEW_ARCH_COMPAT_CHECK","EXPO_NO_DEPENDENCY_VALIDATION","EXPO_FORCE_WEBCONTAINER_ENV","EXPO_UNSTABLE_WEB_MODAL","EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK","EXPO_ROUTER_DISABLE_NATIVE_TABS_MD","EXPO_UNSTABLE_LIVE_BINDINGS","EXPO_UNSTABLE_MCP_SERVER","value","toLowerCase","EXPO_UNSTABLE_LOG_BOX","EXPO_UNSTABLE_BONJOUR","EXPO_UNSTABLE_HEADLESS","SHELL","versions","webcontainer"],"mappings":";;;;;;;;;;;QAgVaA;eAAAA;;QAUGC;eAAAA;;QARAC;eAAAA;;;;yBAlVoB;;;;;;;yBACC;;;;;;;gEACjB;;;;;;;;;;;AAEpB,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC;IACJ,6BAA6B,GAC7B,IAAIC,eAAe;QACjB,OAAOC,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,yBAAyB,GACzB,IAAIC,aAAa;QACf,OAAOD,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,iCAAiC,GACjC,IAAIE,eAAe;QACjB,OAAOF,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,sGAAsG,GACtG,IAAIG,YAAY;QACd,OAAOH,IAAAA,iBAAO,EAAC,aAAa;IAC9B;IAEA,mCAAmC,GACnC,IAAII,eAAe;QACjB,OAAOJ,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,iCAAiC,GACjC,IAAIK,aAAa;QACf,OAAOL,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,0CAA0C,GAC1C,IAAIM,KAAK;QACP,OAAON,IAAAA,iBAAO,EAAC,MAAM;IACvB;IAEA,kCAAkC,GAClC,IAAIO,oBAAoB;QACtB,OAAOP,IAAAA,iBAAO,EAAC,qBAAqB;IACtC;IAEA,oDAAoD,GACpD,IAAIQ,2BAA2B;QAC7B,OAAOR,IAAAA,iBAAO,EAAC,4BAA4B;IAC7C;IAEA,6DA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5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
AbortCommandError
|
|
12
|
+
get AbortCommandError () {
|
|
13
13
|
return AbortCommandError;
|
|
14
14
|
},
|
|
15
|
-
CommandError
|
|
15
|
+
get CommandError () {
|
|
16
16
|
return CommandError;
|
|
17
17
|
},
|
|
18
|
-
SilentError
|
|
18
|
+
get SilentError () {
|
|
19
19
|
return SilentError;
|
|
20
20
|
},
|
|
21
|
-
UnimplementedError
|
|
21
|
+
get UnimplementedError () {
|
|
22
22
|
return UnimplementedError;
|
|
23
23
|
},
|
|
24
|
-
logCmdError
|
|
24
|
+
get logCmdError () {
|
|
25
25
|
return logCmdError;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { AssertionError } from 'assert';\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\n\nimport { exit, exception, warn } from '../log';\n\nconst ERROR_PREFIX = 'Error: ';\n\n/**\n * General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.\n */\nexport class CommandError extends Error {\n name = 'CommandError';\n readonly isCommandError = true;\n [prop: string]: unknown;\n\n constructor(\n public code: string,\n message: string = ''\n ) {\n super('');\n // If e.toString() was called to get `message` we don't want it to look\n // like \"Error: Error:\".\n if (message.startsWith(ERROR_PREFIX)) {\n message = message.substring(ERROR_PREFIX.length);\n }\n\n this.message = message || code;\n }\n}\n\nexport class AbortCommandError extends CommandError {\n constructor() {\n super('ABORTED', 'Interactive prompt was cancelled.');\n }\n}\n\n/**\n * Used to end a CLI process without printing a stack trace in the Expo CLI. Should be used in favor of `process.exit`.\n */\nexport class SilentError extends CommandError {\n constructor(messageOrError?: string | Error) {\n const message =\n (typeof messageOrError === 'string' ? messageOrError : messageOrError?.message) ??\n 'This error should fail silently in the CLI';\n super('SILENT', message);\n if (typeof messageOrError !== 'string') {\n // forward the props of the incoming error for tests or processes outside of expo-cli that use expo cli internals.\n this.stack = messageOrError?.stack ?? this.stack;\n this.name = messageOrError?.name ?? this.name;\n }\n }\n}\n\nexport function logCmdError(error: any): never {\n if (!(error instanceof Error)) {\n throw error;\n }\n if (error instanceof AbortCommandError || error instanceof SilentError) {\n // Do nothing, this is used for prompts or other cases that were custom logged.\n process.exit(1);\n } else if (\n error instanceof CommandError ||\n error instanceof AssertionError ||\n error.name === 'ApiV2Error' ||\n error.name === 'ConfigError'\n ) {\n // Print the stack trace in debug mode only.\n exit(error);\n }\n\n const errorDetails = error.stack ? '\\n' + chalk.gray(error.stack) : '';\n\n exit(chalk.red(error.toString()) + errorDetails);\n}\n\n/** This should never be thrown in production. */\nexport class UnimplementedError extends Error {\n constructor() {\n super('Unimplemented');\n this.name = 'UnimplementedError';\n }\n}\n\n/**\n * Add additional information when EMFILE errors are encountered.\n * These errors originate from Metro's FSEventsWatcher due to `fsevents` going over MacOS system limit.\n * Unfortunately, these limits in macOS are relatively low compared to an average React Native project.\n *\n * @see https://github.com/expo/expo/issues/29083\n * @see https://github.com/facebook/metro/issues/834\n * @see https://github.com/fsevents/fsevents/issues/42#issuecomment-62632234\n */\nfunction handleTooManyOpenFileErrors(error: any) {\n // Only enable special logging when running on macOS and are running into the `EMFILE` error\n if ('code' in error && error.code === 'EMFILE' && process.platform === 'darwin') {\n try {\n // Try to recover watchman, if it's not installed this will throw\n execSync('watchman shutdown-server', { stdio: 'ignore' });\n // NOTE(cedric): this both starts the watchman server and resets all watchers\n execSync('watchman watch-del-all', { stdio: 'ignore' });\n\n warn(\n 'Watchman is installed but was likely not enabled when starting Metro, try starting your project again.\\nIf this problem persists, follow the troubleshooting guide of Watchman: https://facebook.github.io/watchman/docs/troubleshooting'\n );\n } catch {\n warn(\n `Your macOS system limit does not allow enough watchers for Metro, install Watchman instead. Learn more: https://facebook.github.io/watchman/docs/install`\n );\n }\n\n exception(error);\n process.exit(1);\n }\n\n throw error;\n}\n\nprocess.on('uncaughtException', handleTooManyOpenFileErrors);\n"],"names":["AbortCommandError","CommandError","SilentError","UnimplementedError","logCmdError","ERROR_PREFIX","Error","
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { AssertionError } from 'assert';\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\n\nimport { exit, exception, warn } from '../log';\n\nconst ERROR_PREFIX = 'Error: ';\n\n/**\n * General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.\n */\nexport class CommandError extends Error {\n name = 'CommandError';\n readonly isCommandError = true;\n [prop: string]: unknown;\n\n constructor(\n public code: string,\n message: string = ''\n ) {\n super('');\n // If e.toString() was called to get `message` we don't want it to look\n // like \"Error: Error:\".\n if (message.startsWith(ERROR_PREFIX)) {\n message = message.substring(ERROR_PREFIX.length);\n }\n\n this.message = message || code;\n }\n}\n\nexport class AbortCommandError extends CommandError {\n constructor() {\n super('ABORTED', 'Interactive prompt was cancelled.');\n }\n}\n\n/**\n * Used to end a CLI process without printing a stack trace in the Expo CLI. Should be used in favor of `process.exit`.\n */\nexport class SilentError extends CommandError {\n constructor(messageOrError?: string | Error) {\n const message =\n (typeof messageOrError === 'string' ? messageOrError : messageOrError?.message) ??\n 'This error should fail silently in the CLI';\n super('SILENT', message);\n if (typeof messageOrError !== 'string') {\n // forward the props of the incoming error for tests or processes outside of expo-cli that use expo cli internals.\n this.stack = messageOrError?.stack ?? this.stack;\n this.name = messageOrError?.name ?? this.name;\n }\n }\n}\n\nexport function logCmdError(error: any): never {\n if (!(error instanceof Error)) {\n throw error;\n }\n if (error instanceof AbortCommandError || error instanceof SilentError) {\n // Do nothing, this is used for prompts or other cases that were custom logged.\n process.exit(1);\n } else if (\n error instanceof CommandError ||\n error instanceof AssertionError ||\n error.name === 'ApiV2Error' ||\n error.name === 'ConfigError'\n ) {\n // Print the stack trace in debug mode only.\n exit(error);\n }\n\n const errorDetails = error.stack ? '\\n' + chalk.gray(error.stack) : '';\n\n exit(chalk.red(error.toString()) + errorDetails);\n}\n\n/** This should never be thrown in production. */\nexport class UnimplementedError extends Error {\n constructor() {\n super('Unimplemented');\n this.name = 'UnimplementedError';\n }\n}\n\n/**\n * Add additional information when EMFILE errors are encountered.\n * These errors originate from Metro's FSEventsWatcher due to `fsevents` going over MacOS system limit.\n * Unfortunately, these limits in macOS are relatively low compared to an average React Native project.\n *\n * @see https://github.com/expo/expo/issues/29083\n * @see https://github.com/facebook/metro/issues/834\n * @see https://github.com/fsevents/fsevents/issues/42#issuecomment-62632234\n */\nfunction handleTooManyOpenFileErrors(error: any) {\n // Only enable special logging when running on macOS and are running into the `EMFILE` error\n if ('code' in error && error.code === 'EMFILE' && process.platform === 'darwin') {\n try {\n // Try to recover watchman, if it's not installed this will throw\n execSync('watchman shutdown-server', { stdio: 'ignore' });\n // NOTE(cedric): this both starts the watchman server and resets all watchers\n execSync('watchman watch-del-all', { stdio: 'ignore' });\n\n warn(\n 'Watchman is installed but was likely not enabled when starting Metro, try starting your project again.\\nIf this problem persists, follow the troubleshooting guide of Watchman: https://facebook.github.io/watchman/docs/troubleshooting'\n );\n } catch {\n warn(\n `Your macOS system limit does not allow enough watchers for Metro, install Watchman instead. Learn more: https://facebook.github.io/watchman/docs/install`\n );\n }\n\n exception(error);\n process.exit(1);\n }\n\n throw error;\n}\n\nprocess.on('uncaughtException', handleTooManyOpenFileErrors);\n"],"names":["AbortCommandError","CommandError","SilentError","UnimplementedError","logCmdError","ERROR_PREFIX","Error","code","message","name","isCommandError","startsWith","substring","length","messageOrError","stack","error","process","exit","AssertionError","errorDetails","chalk","gray","red","toString","handleTooManyOpenFileErrors","platform","execSync","stdio","warn","exception","on"],"mappings":";;;;;;;;;;;QA+BaA;eAAAA;;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,4CAA4C;QAC5CS,IAAAA,SAAI,EAACF;IACP;IAEA,MAAMI,eAAeJ,MAAMD,KAAK,GAAG,OAAOM,gBAAK,CAACC,IAAI,CAACN,MAAMD,KAAK,IAAI;IAEpEG,IAAAA,SAAI,EAACG,gBAAK,CAACE,GAAG,CAACP,MAAMQ,QAAQ,MAAMJ;AACrC;AAGO,MAAMjB,2BAA2BG;IACtC,aAAc;QACZ,KAAK,CAAC;QACN,IAAI,CAACG,IAAI,GAAG;IACd;AACF;AAEA;;;;;;;;CAQC,GACD,SAASgB,4BAA4BT,KAAU;IAC7C,4FAA4F;IAC5F,IAAI,UAAUA,SAASA,MAAMT,IAAI,KAAK,YAAYU,QAAQS,QAAQ,KAAK,UAAU;QAC/E,IAAI;YACF,iEAAiE;YACjEC,IAAAA,yBAAQ,EAAC,4BAA4B;gBAAEC,OAAO;YAAS;YACvD,6EAA6E;YAC7ED,IAAAA,yBAAQ,EAAC,0BAA0B;gBAAEC,OAAO;YAAS;YAErDC,IAAAA,SAAI,EACF;QAEJ,EAAE,OAAM;YACNA,IAAAA,SAAI,EACF,CAAC,wJAAwJ,CAAC;QAE9J;QAEAC,IAAAA,cAAS,EAACd;QACVC,QAAQC,IAAI,CAAC;IACf;IAEA,MAAMF;AACR;AAEAC,QAAQc,EAAE,CAAC,qBAAqBN"}
|
package/build/src/utils/exit.js
CHANGED
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ensureProcessExitsAfterDelay
|
|
12
|
+
get ensureProcessExitsAfterDelay () {
|
|
13
13
|
return ensureProcessExitsAfterDelay;
|
|
14
14
|
},
|
|
15
|
-
installExitHooks
|
|
15
|
+
get installExitHooks () {
|
|
16
16
|
return installExitHooks;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -97,7 +97,7 @@ function attachMasterListener() {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function ensureProcessExitsAfterDelay(waitUntilExitMs =
|
|
100
|
+
function ensureProcessExitsAfterDelay(waitUntilExitMs = 4000, startedAtMs = Date.now()) {
|
|
101
101
|
// Create a list of the expected active resources before exiting.
|
|
102
102
|
// Note, the order is undeterministic
|
|
103
103
|
const expectedResources = [
|
|
@@ -116,19 +116,16 @@ function ensureProcessExitsAfterDelay(waitUntilExitMs = 10000, startedAtMs = Dat
|
|
|
116
116
|
}
|
|
117
117
|
return true;
|
|
118
118
|
});
|
|
119
|
-
// Check if
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
debug('no active resources detected, process can safely exit');
|
|
127
|
-
}
|
|
119
|
+
// Check if there are any resources that block the process from exiting.
|
|
120
|
+
// CloseReq is always transient and completes on its own.
|
|
121
|
+
// NOTE: Timeout is NOT excluded — getActiveResourcesInfo() only reports ref'd timers,
|
|
122
|
+
// so any Timeout in this list will keep the event loop alive indefinitely.
|
|
123
|
+
const hasBlockingResources = unexpectedActiveResources.some((resource)=>resource !== 'CloseReq');
|
|
124
|
+
if (!hasBlockingResources) {
|
|
125
|
+
debug(unexpectedActiveResources.length ? 'only transient resources remain (CloseReq), process can safely exit' : 'no active resources detected, process can safely exit');
|
|
128
126
|
return;
|
|
129
|
-
} else {
|
|
130
|
-
debug(`process is trying to exit, but is stuck on unexpected active resources:`, unexpectedActiveResources);
|
|
131
127
|
}
|
|
128
|
+
debug(`process is trying to exit, but is stuck on unexpected active resources:`, unexpectedActiveResources);
|
|
132
129
|
// Check if the process needs to be force-closed
|
|
133
130
|
const elapsedTime = Date.now() - startedAtMs;
|
|
134
131
|
if (elapsedTime > waitUntilExitMs) {
|
|
@@ -137,10 +134,9 @@ function ensureProcessExitsAfterDelay(waitUntilExitMs = 10000, startedAtMs = Dat
|
|
|
137
134
|
return _nodeprocess().default.exit(0);
|
|
138
135
|
}
|
|
139
136
|
const timeoutId = setTimeout(()=>{
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
ensureProcessExitsAfterDelay(waitUntilExitMs, startedAtMs);
|
|
137
|
+
// Delay the next check by one tick so the current timer is fully cleaned up
|
|
138
|
+
// and doesn't appear in the active resources list.
|
|
139
|
+
_nodeprocess().default.nextTick(()=>ensureProcessExitsAfterDelay(waitUntilExitMs, startedAtMs));
|
|
144
140
|
// setTimeout is using the global definitions from React Native which is missing the unref method in Node.js.
|
|
145
141
|
}, 100);
|
|
146
142
|
// Unref the timeout so it doesn't prevent the process from exiting naturally
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/exit.ts"],"sourcesContent":["import { ChildProcess } from 'node:child_process';\nimport process from 'node:process';\n\nimport { guardAsync } from './fn';\nimport { warn } from '../log';\n\nconst debug = require('debug')('expo:utils:exit') as typeof console.log;\n\n// NOTE: This is an internal method, not designed to be exposed. It's also our only way to get this info\ndeclare global {\n namespace NodeJS {\n interface Process {\n _getActiveHandles(): readonly any[];\n }\n }\n}\n\ntype AsyncExitHook = (signal: NodeJS.Signals) => void | Promise<void>;\n\nconst PRE_EXIT_SIGNALS: NodeJS.Signals[] = ['SIGHUP', 'SIGINT', 'SIGTERM', 'SIGBREAK'];\n\n// We create a queue since Node.js throws an error if we try to append too many listeners:\n// (node:4405) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit\nconst queue: AsyncExitHook[] = [];\n\nlet unsubscribe: (() => void) | null = null;\n\n/** Add functions that run before the process exits. Returns a function for removing the listeners. */\nexport function installExitHooks(asyncExitHook: AsyncExitHook): () => void {\n // We need to instantiate the master listener the first time the queue is used.\n if (!queue.length) {\n // Track the master listener so we can remove it later.\n unsubscribe = attachMasterListener();\n }\n\n queue.push(asyncExitHook);\n\n return () => {\n const index = queue.indexOf(asyncExitHook);\n if (index >= 0) {\n queue.splice(index, 1);\n }\n // Clean up the master listener if we don't need it anymore.\n if (!queue.length) {\n unsubscribe?.();\n }\n };\n}\n\n// Create a function that runs before the process exits and guards against running multiple times.\nfunction createExitHook(signal: NodeJS.Signals) {\n return guardAsync(async () => {\n debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);\n\n for (const [index, hookAsync] of Object.entries(queue)) {\n try {\n await hookAsync(signal);\n } catch (error: any) {\n debug(`Error in exit hook: %O (queue: ${index})`, error);\n }\n }\n\n debug(`post-exit (code: ${process.exitCode ?? 0})`);\n\n process.exit();\n });\n}\n\nfunction attachMasterListener() {\n const hooks: [NodeJS.Signals, () => any][] = [];\n for (const signal of PRE_EXIT_SIGNALS) {\n const hook = createExitHook(signal);\n hooks.push([signal, hook]);\n process.on(signal, hook);\n }\n return () => {\n for (const [signal, hook] of hooks) {\n process.removeListener(signal, hook);\n }\n };\n}\n\n/**\n * Monitor if the current process is exiting before the delay is reached.\n * If there are active resources, the process will be forced to exit after the delay is reached.\n *\n * @see https://nodejs.org/docs/latest-v18.x/api/process.html#processgetactiveresourcesinfo\n */\nexport function ensureProcessExitsAfterDelay(waitUntilExitMs = 10000, startedAtMs = Date.now()) {\n // Create a list of the expected active resources before exiting.\n // Note, the order is undeterministic\n const expectedResources = [\n process.stdout.isTTY ? 'TTYWrap' : 'PipeWrap',\n process.stderr.isTTY ? 'TTYWrap' : 'PipeWrap',\n process.stdin.isTTY ? 'TTYWrap' : 'PipeWrap',\n ];\n // Check active resources, besides the TTYWrap/PipeWrap (process.stdin, process.stdout, process.stderr)\n const activeResources = process.getActiveResourcesInfo() as string[];\n // Filter the active resource list by subtracting the expected resources, in undeterministic order\n const unexpectedActiveResources = activeResources.filter((activeResource) => {\n const index = expectedResources.indexOf(activeResource);\n if (index >= 0) {\n expectedResources.splice(index, 1);\n return false;\n }\n\n return true;\n });\n\n // Check if only Timeouts remain (no blocking resources like ProcessWrap/PipeWrap)\n const hasBlockingResources = unexpectedActiveResources.some(\n (resource) => resource !== 'Timeout' && resource !== 'CloseReq'\n );\n\n const canExitProcess = !unexpectedActiveResources.length || !hasBlockingResources;\n if (canExitProcess) {\n if (unexpectedActiveResources.length && !hasBlockingResources) {\n debug('only non-blocking resources remain (Timeout/CloseReq), process can safely exit');\n } else {\n debug('no active resources detected, process can safely exit');\n }\n return;\n } else {\n debug(\n `process is trying to exit, but is stuck on unexpected active resources:`,\n unexpectedActiveResources\n );\n }\n\n // Check if the process needs to be force-closed\n const elapsedTime = Date.now() - startedAtMs;\n if (elapsedTime > waitUntilExitMs) {\n debug('active handles detected past the exit delay, forcefully exiting:', activeResources);\n tryWarnActiveProcesses();\n return process.exit(0);\n }\n\n const timeoutId = setTimeout(() => {\n // Ensure the timeout is cleared before checking the active resources\n clearTimeout(timeoutId);\n // Check if the process can exit\n ensureProcessExitsAfterDelay(waitUntilExitMs, startedAtMs);\n\n // setTimeout is using the global definitions from React Native which is missing the unref method in Node.js.\n }, 100) as unknown as NodeJS.Timeout;\n\n // Unref the timeout so it doesn't prevent the process from exiting naturally\n // when this timeout is the only remaining active resource\n timeoutId.unref();\n}\n\n/**\n * Try to warn the user about unexpected active processes running in the background.\n * This uses the internal `process._getActiveHandles` method, within a try-catch block.\n * If active child processes are detected, the commands of these processes are logged.\n *\n * @example ```bash\n * Done writing bundle output\n * Detected 2 processes preventing Expo from exiting, forcefully exiting now.\n * - node /Users/cedric/../node_modules/nativewind/dist/metro/tailwind/v3/child.js\n * - node /Users/cedric/../node_modules/nativewind/dist/metro/tailwind/v3/child.js\n * ```\n */\nfunction tryWarnActiveProcesses() {\n const activeProcesses: string[] = [];\n const handleSummary: Record<string, number> = {};\n const timeoutDetails: string[] = [];\n\n try {\n const handles = process._getActiveHandles();\n\n // Categorize handles by their constructor name\n for (const handle of handles) {\n const name = handle?.constructor?.name ?? 'Unknown';\n handleSummary[name] = (handleSummary[name] ?? 0) + 1;\n\n // Collect ChildProcess command info\n if (handle instanceof ChildProcess) {\n activeProcesses.push(handle.spawnargs.join(' '));\n }\n\n // Try to get more info about Timeout handles\n if (name === 'Timeout') {\n try {\n // Attempt to get callback name or source info\n const callback = handle._onTimeout ?? handle._repeat;\n const callbackName = callback?.name || '<anonymous>';\n const delay = handle._idleTimeout ?? 'unknown';\n timeoutDetails.push(`Timeout(${delay}ms, fn: ${callbackName})`);\n } catch {\n timeoutDetails.push('Timeout(details unavailable)');\n }\n }\n }\n\n // Log detailed handle info when debug is enabled\n debug('active handles by type:', handleSummary);\n if (timeoutDetails.length) {\n debug('timeout details:', timeoutDetails);\n }\n } catch (error) {\n debug('failed to get active process information:', error);\n }\n\n if (!activeProcesses.length) {\n warn('Something prevented Expo from exiting, forcefully exiting now.');\n // Log handle summary when no specific processes are identified\n if (Object.keys(handleSummary).length > 0) {\n debug('handle summary (use DEBUG=expo:utils:exit for details):', handleSummary);\n }\n } else {\n const singularOrPlural =\n activeProcesses.length === 1 ? '1 process' : `${activeProcesses.length} processes`;\n\n warn(`Detected ${singularOrPlural} preventing Expo from exiting, forcefully exiting now.`);\n warn(' - ' + activeProcesses.join('\\n - '));\n }\n}\n"],"names":["ensureProcessExitsAfterDelay","installExitHooks","debug","require","PRE_EXIT_SIGNALS","queue","unsubscribe","asyncExitHook","length","attachMasterListener","push","index","indexOf","splice","createExitHook","signal","guardAsync","hookAsync","Object","entries","error","process","exitCode","exit","hooks","hook","on","removeListener","waitUntilExitMs","startedAtMs","Date","now","expectedResources","stdout","isTTY","stderr","stdin","activeResources","getActiveResourcesInfo","unexpectedActiveResources","filter","activeResource","hasBlockingResources","some","resource","canExitProcess","elapsedTime","tryWarnActiveProcesses","timeoutId","setTimeout","clearTimeout","unref","activeProcesses","handleSummary","timeoutDetails","handles","_getActiveHandles","handle","name","constructor","ChildProcess","spawnargs","join","callback","_onTimeout","_repeat","callbackName","delay","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IACF,EAAE,OAAOlC,OAAO;QACdlB,MAAM,6CAA6CkB;IACrD;IAEA,IAAI,CAACgC,gBAAgB5C,MAAM,EAAE;QAC3B6D,IAAAA,SAAI,EAAC;QACL,+DAA+D;QAC/D,IAAInD,OAAOoD,IAAI,CAACjB,eAAe7C,MAAM,GAAG,GAAG;YACzCN,MAAM,2DAA2DmD;QACnE;IACF,OAAO;QACL,MAAMkB,mBACJnB,gBAAgB5C,MAAM,KAAK,IAAI,cAAc,GAAG4C,gBAAgB5C,MAAM,CAAC,UAAU,CAAC;QAEpF6D,IAAAA,SAAI,EAAC,CAAC,SAAS,EAAEE,iBAAiB,sDAAsD,CAAC;QACzFF,IAAAA,SAAI,EAAC,SAASjB,gBAAgBU,IAAI,CAAC;IACrC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/exit.ts"],"sourcesContent":["import { ChildProcess } from 'node:child_process';\nimport process from 'node:process';\n\nimport { guardAsync } from './fn';\nimport { warn } from '../log';\n\nconst debug = require('debug')('expo:utils:exit') as typeof console.log;\n\n// NOTE: This is an internal method, not designed to be exposed. It's also our only way to get this info\ndeclare global {\n namespace NodeJS {\n interface Process {\n _getActiveHandles(): readonly any[];\n }\n }\n}\n\ntype AsyncExitHook = (signal: NodeJS.Signals) => void | Promise<void>;\n\nconst PRE_EXIT_SIGNALS: NodeJS.Signals[] = ['SIGHUP', 'SIGINT', 'SIGTERM', 'SIGBREAK'];\n\n// We create a queue since Node.js throws an error if we try to append too many listeners:\n// (node:4405) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit\nconst queue: AsyncExitHook[] = [];\n\nlet unsubscribe: (() => void) | null = null;\n\n/** Add functions that run before the process exits. Returns a function for removing the listeners. */\nexport function installExitHooks(asyncExitHook: AsyncExitHook): () => void {\n // We need to instantiate the master listener the first time the queue is used.\n if (!queue.length) {\n // Track the master listener so we can remove it later.\n unsubscribe = attachMasterListener();\n }\n\n queue.push(asyncExitHook);\n\n return () => {\n const index = queue.indexOf(asyncExitHook);\n if (index >= 0) {\n queue.splice(index, 1);\n }\n // Clean up the master listener if we don't need it anymore.\n if (!queue.length) {\n unsubscribe?.();\n }\n };\n}\n\n// Create a function that runs before the process exits and guards against running multiple times.\nfunction createExitHook(signal: NodeJS.Signals) {\n return guardAsync(async () => {\n debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);\n\n for (const [index, hookAsync] of Object.entries(queue)) {\n try {\n await hookAsync(signal);\n } catch (error: any) {\n debug(`Error in exit hook: %O (queue: ${index})`, error);\n }\n }\n\n debug(`post-exit (code: ${process.exitCode ?? 0})`);\n\n process.exit();\n });\n}\n\nfunction attachMasterListener() {\n const hooks: [NodeJS.Signals, () => any][] = [];\n for (const signal of PRE_EXIT_SIGNALS) {\n const hook = createExitHook(signal);\n hooks.push([signal, hook]);\n process.on(signal, hook);\n }\n return () => {\n for (const [signal, hook] of hooks) {\n process.removeListener(signal, hook);\n }\n };\n}\n\n/**\n * Monitor if the current process is exiting before the delay is reached.\n * If there are active resources, the process will be forced to exit after the delay is reached.\n *\n * @see https://nodejs.org/docs/latest-v18.x/api/process.html#processgetactiveresourcesinfo\n */\nexport function ensureProcessExitsAfterDelay(waitUntilExitMs = 4_000, startedAtMs = Date.now()) {\n // Create a list of the expected active resources before exiting.\n // Note, the order is undeterministic\n const expectedResources = [\n process.stdout.isTTY ? 'TTYWrap' : 'PipeWrap',\n process.stderr.isTTY ? 'TTYWrap' : 'PipeWrap',\n process.stdin.isTTY ? 'TTYWrap' : 'PipeWrap',\n ];\n // Check active resources, besides the TTYWrap/PipeWrap (process.stdin, process.stdout, process.stderr)\n const activeResources = process.getActiveResourcesInfo() as string[];\n // Filter the active resource list by subtracting the expected resources, in undeterministic order\n const unexpectedActiveResources = activeResources.filter((activeResource) => {\n const index = expectedResources.indexOf(activeResource);\n if (index >= 0) {\n expectedResources.splice(index, 1);\n return false;\n }\n\n return true;\n });\n\n // Check if there are any resources that block the process from exiting.\n // CloseReq is always transient and completes on its own.\n // NOTE: Timeout is NOT excluded — getActiveResourcesInfo() only reports ref'd timers,\n // so any Timeout in this list will keep the event loop alive indefinitely.\n const hasBlockingResources = unexpectedActiveResources.some(\n (resource) => resource !== 'CloseReq'\n );\n\n if (!hasBlockingResources) {\n debug(\n unexpectedActiveResources.length\n ? 'only transient resources remain (CloseReq), process can safely exit'\n : 'no active resources detected, process can safely exit'\n );\n return;\n }\n\n debug(\n `process is trying to exit, but is stuck on unexpected active resources:`,\n unexpectedActiveResources\n );\n\n // Check if the process needs to be force-closed\n const elapsedTime = Date.now() - startedAtMs;\n if (elapsedTime > waitUntilExitMs) {\n debug('active handles detected past the exit delay, forcefully exiting:', activeResources);\n tryWarnActiveProcesses();\n return process.exit(0);\n }\n\n const timeoutId = setTimeout(() => {\n // Delay the next check by one tick so the current timer is fully cleaned up\n // and doesn't appear in the active resources list.\n process.nextTick(() => ensureProcessExitsAfterDelay(waitUntilExitMs, startedAtMs));\n\n // setTimeout is using the global definitions from React Native which is missing the unref method in Node.js.\n }, 100) as unknown as NodeJS.Timeout;\n\n // Unref the timeout so it doesn't prevent the process from exiting naturally\n // when this timeout is the only remaining active resource\n timeoutId.unref();\n}\n\n/**\n * Try to warn the user about unexpected active processes running in the background.\n * This uses the internal `process._getActiveHandles` method, within a try-catch block.\n * If active child processes are detected, the commands of these processes are logged.\n *\n * @example ```bash\n * Done writing bundle output\n * Detected 2 processes preventing Expo from exiting, forcefully exiting now.\n * - node /Users/cedric/../node_modules/nativewind/dist/metro/tailwind/v3/child.js\n * - node /Users/cedric/../node_modules/nativewind/dist/metro/tailwind/v3/child.js\n * ```\n */\nfunction tryWarnActiveProcesses() {\n const activeProcesses: string[] = [];\n const handleSummary: Record<string, number> = {};\n const timeoutDetails: string[] = [];\n\n try {\n const handles = process._getActiveHandles();\n\n // Categorize handles by their constructor name\n for (const handle of handles) {\n const name = handle?.constructor?.name ?? 'Unknown';\n handleSummary[name] = (handleSummary[name] ?? 0) + 1;\n\n // Collect ChildProcess command info\n if (handle instanceof ChildProcess) {\n activeProcesses.push(handle.spawnargs.join(' '));\n }\n\n // Try to get more info about Timeout handles\n if (name === 'Timeout') {\n try {\n // Attempt to get callback name or source info\n const callback = handle._onTimeout ?? handle._repeat;\n const callbackName = callback?.name || '<anonymous>';\n const delay = handle._idleTimeout ?? 'unknown';\n timeoutDetails.push(`Timeout(${delay}ms, fn: ${callbackName})`);\n } catch {\n timeoutDetails.push('Timeout(details unavailable)');\n }\n }\n }\n\n // Log detailed handle info when debug is enabled\n debug('active handles by type:', handleSummary);\n if (timeoutDetails.length) {\n debug('timeout details:', timeoutDetails);\n }\n } catch (error) {\n debug('failed to get active process information:', error);\n }\n\n if (!activeProcesses.length) {\n warn('Something prevented Expo from exiting, forcefully exiting now.');\n // Log handle summary when no specific processes are identified\n if (Object.keys(handleSummary).length > 0) {\n debug('handle summary (use DEBUG=expo:utils:exit for details):', handleSummary);\n }\n } else {\n const singularOrPlural =\n activeProcesses.length === 1 ? '1 process' : `${activeProcesses.length} processes`;\n\n warn(`Detected ${singularOrPlural} preventing Expo from exiting, forcefully exiting now.`);\n warn(' - ' + activeProcesses.join('\\n - '));\n }\n}\n"],"names":["ensureProcessExitsAfterDelay","installExitHooks","debug","require","PRE_EXIT_SIGNALS","queue","unsubscribe","asyncExitHook","length","attachMasterListener","push","index","indexOf","splice","createExitHook","signal","guardAsync","hookAsync","Object","entries","error","process","exitCode","exit","hooks","hook","on","removeListener","waitUntilExitMs","startedAtMs","Date","now","expectedResources","stdout","isTTY","stderr","stdin","activeResources","getActiveResourcesInfo","unexpectedActiveResources","filter","activeResource","hasBlockingResources","some","resource","elapsedTime","tryWarnActiveProcesses","timeoutId","setTimeout","nextTick","unref","activeProcesses","handleSummary","timeoutDetails","handles","_getActiveHandles","handle","name","ChildProcess","spawnargs","join","callback","_onTimeout","_repeat","callbackName","delay","_idleTimeout","warn","keys","singularOrPlural"],"mappings":";;;;;;;;;;;QAwF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ACL,+DAA+D;QAC/D,IAAIjD,OAAOkD,IAAI,CAAChB,eAAe5C,MAAM,GAAG,GAAG;YACzCN,MAAM,2DAA2DkD;QACnE;IACF,OAAO;QACL,MAAMiB,mBACJlB,gBAAgB3C,MAAM,KAAK,IAAI,cAAc,GAAG2C,gBAAgB3C,MAAM,CAAC,UAAU,CAAC;QAEpF2D,IAAAA,SAAI,EAAC,CAAC,SAAS,EAAEE,iBAAiB,sDAAsD,CAAC;QACzFF,IAAAA,SAAI,EAAC,SAAShB,gBAAgBS,IAAI,CAAC;IACrC;AACF"}
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ExpoUpdatesCLICommandFailedError
|
|
12
|
+
get ExpoUpdatesCLICommandFailedError () {
|
|
13
13
|
return ExpoUpdatesCLICommandFailedError;
|
|
14
14
|
},
|
|
15
|
-
ExpoUpdatesCLIInvalidCommandError
|
|
15
|
+
get ExpoUpdatesCLIInvalidCommandError () {
|
|
16
16
|
return ExpoUpdatesCLIInvalidCommandError;
|
|
17
17
|
},
|
|
18
|
-
ExpoUpdatesCLIModuleNotFoundError
|
|
18
|
+
get ExpoUpdatesCLIModuleNotFoundError () {
|
|
19
19
|
return ExpoUpdatesCLIModuleNotFoundError;
|
|
20
20
|
},
|
|
21
|
-
expoUpdatesCommandAsync
|
|
21
|
+
get expoUpdatesCommandAsync () {
|
|
22
22
|
return expoUpdatesCommandAsync;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/expoUpdatesCli.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport resolveFrom, { silent as silentResolveFrom } from 'resolve-from';\n\nexport class ExpoUpdatesCLIModuleNotFoundError extends Error {}\nexport class ExpoUpdatesCLIInvalidCommandError extends Error {}\nexport class ExpoUpdatesCLICommandFailedError extends Error {}\n\nexport async function expoUpdatesCommandAsync(projectDir: string, args: string[]): Promise<string> {\n let expoUpdatesCli;\n try {\n expoUpdatesCli =\n silentResolveFrom(projectDir, 'expo-updates/bin/cli') ??\n resolveFrom(projectDir, 'expo-updates/bin/cli.js');\n } catch (e: any) {\n if (e.code === 'MODULE_NOT_FOUND') {\n throw new ExpoUpdatesCLIModuleNotFoundError(`The \\`expo-updates\\` package was not found. `);\n }\n throw e;\n }\n\n try {\n return (\n await spawnAsync(expoUpdatesCli, args, {\n stdio: 'pipe',\n env: { ...process.env },\n })\n ).stdout;\n } catch (e: any) {\n if (e.stderr && typeof e.stderr === 'string') {\n if (e.stderr.includes('Invalid command')) {\n throw new ExpoUpdatesCLIInvalidCommandError(\n `The command specified by ${args} was not valid in the \\`expo-updates\\` CLI.`\n );\n } else {\n throw new ExpoUpdatesCLICommandFailedError(e.stderr);\n }\n }\n\n throw e;\n }\n}\n"],"names":["ExpoUpdatesCLICommandFailedError","ExpoUpdatesCLIInvalidCommandError","ExpoUpdatesCLIModuleNotFoundError","expoUpdatesCommandAsync","Error","projectDir","args","expoUpdatesCli","silentResolveFrom","resolveFrom","e","code","spawnAsync","stdio","env","process","stdout","stderr","includes"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/expoUpdatesCli.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport resolveFrom, { silent as silentResolveFrom } from 'resolve-from';\n\nexport class ExpoUpdatesCLIModuleNotFoundError extends Error {}\nexport class ExpoUpdatesCLIInvalidCommandError extends Error {}\nexport class ExpoUpdatesCLICommandFailedError extends Error {}\n\nexport async function expoUpdatesCommandAsync(projectDir: string, args: string[]): Promise<string> {\n let expoUpdatesCli;\n try {\n expoUpdatesCli =\n silentResolveFrom(projectDir, 'expo-updates/bin/cli') ??\n resolveFrom(projectDir, 'expo-updates/bin/cli.js');\n } catch (e: any) {\n if (e.code === 'MODULE_NOT_FOUND') {\n throw new ExpoUpdatesCLIModuleNotFoundError(`The \\`expo-updates\\` package was not found. `);\n }\n throw e;\n }\n\n try {\n return (\n await spawnAsync(expoUpdatesCli, args, {\n stdio: 'pipe',\n env: { ...process.env },\n })\n ).stdout;\n } catch (e: any) {\n if (e.stderr && typeof e.stderr === 'string') {\n if (e.stderr.includes('Invalid command')) {\n throw new ExpoUpdatesCLIInvalidCommandError(\n `The command specified by ${args} was not valid in the \\`expo-updates\\` CLI.`\n );\n } else {\n throw new ExpoUpdatesCLICommandFailedError(e.stderr);\n }\n }\n\n throw e;\n }\n}\n"],"names":["ExpoUpdatesCLICommandFailedError","ExpoUpdatesCLIInvalidCommandError","ExpoUpdatesCLIModuleNotFoundError","expoUpdatesCommandAsync","Error","projectDir","args","expoUpdatesCli","silentResolveFrom","resolveFrom","e","code","spawnAsync","stdio","env","process","stdout","stderr","includes"],"mappings":";;;;;;;;;;;QAKaA;eAAAA;;QADAC;eAAAA;;QADAC;eAAAA;;QAISC;eAAAA;;;;gEAPC;;;;;;;iEACkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElD,MAAMD,0CAA0CE;AAAO;AACvD,MAAMH,0CAA0CG;AAAO;AACvD,MAAMJ,yCAAyCI;AAAO;AAEtD,eAAeD,wBAAwBE,UAAkB,EAAEC,IAAc;IAC9E,IAAIC;IACJ,IAAI;QACFA,iBACEC,IAAAA,qBAAiB,EAACH,YAAY,2BAC9BI,IAAAA,sBAAW,EAACJ,YAAY;IAC5B,EAAE,OAAOK,GAAQ;QACf,IAAIA,EAAEC,IAAI,KAAK,oBAAoB;YACjC,MAAM,IAAIT,kCAAkC,CAAC,4CAA4C,CAAC;QAC5F;QACA,MAAMQ;IACR;IAEA,IAAI;QACF,OAAO,AACL,CAAA,MAAME,IAAAA,qBAAU,EAACL,gBAAgBD,MAAM;YACrCO,OAAO;YACPC,KAAK;gBAAE,GAAGC,QAAQD,GAAG;YAAC;QACxB,EAAC,EACDE,MAAM;IACV,EAAE,OAAON,GAAQ;QACf,IAAIA,EAAEO,MAAM,IAAI,OAAOP,EAAEO,MAAM,KAAK,UAAU;YAC5C,IAAIP,EAAEO,MAAM,CAACC,QAAQ,CAAC,oBAAoB;gBACxC,MAAM,IAAIjB,kCACR,CAAC,yBAAyB,EAAEK,KAAK,2CAA2C,CAAC;YAEjF,OAAO;gBACL,MAAM,IAAIN,iCAAiCU,EAAEO,MAAM;YACrD;QACF;QAEA,MAAMP;IACR;AACF"}
|
package/build/src/utils/fetch.js
CHANGED
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
Headers
|
|
12
|
+
get Headers () {
|
|
13
13
|
return _fetchnodeshim().Headers;
|
|
14
14
|
},
|
|
15
|
-
Response
|
|
15
|
+
get Response () {
|
|
16
16
|
return _fetchnodeshim().Response;
|
|
17
17
|
},
|
|
18
|
-
fetch
|
|
18
|
+
get fetch () {
|
|
19
19
|
return _fetchnodeshim().fetch;
|
|
20
20
|
}
|
|
21
21
|
});
|