@depup/expo__cli 55.0.23-depup.0 → 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 -15
- 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 +4 -4
- 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 +45 -20
- 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.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 +32 -28
- 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 +5 -5
- 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 +3 -3
- 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 +239 -108
- 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.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 +16 -12
- 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 +15 -6
- 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/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 +18 -26
- package/main.js +3 -0
- package/package.json +88 -80
- 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/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
|
@@ -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
|
-
getDirectoryOfProcessById
|
|
12
|
+
get getDirectoryOfProcessById () {
|
|
13
13
|
return getDirectoryOfProcessById;
|
|
14
14
|
},
|
|
15
|
-
getPID
|
|
15
|
+
get getPID () {
|
|
16
16
|
return getPID;
|
|
17
17
|
},
|
|
18
|
-
getProcessCommand
|
|
18
|
+
get getProcessCommand () {
|
|
19
19
|
return getProcessCommand;
|
|
20
20
|
},
|
|
21
|
-
getRunningProcess
|
|
21
|
+
get getRunningProcess () {
|
|
22
22
|
return getRunningProcess;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/getRunningProcess.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport * as path from 'path';\n\nconst debug = require('debug')('expo:utils:getRunningProcess') as typeof console.log;\n\n/** Timeout applied to shell commands */\nconst timeout = 350;\n\n/** Returns a pid value for a running port like `63828` or null if nothing is running on the given port. */\nexport async function getPID(port: number): Promise<number | null> {\n try {\n const { stdout } = await spawnAsync('lsof', [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'], {\n timeout,\n });\n const pid = Number(stdout.split('\\n', 1)[0]
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getRunningProcess.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport * as path from 'path';\n\nconst debug = require('debug')('expo:utils:getRunningProcess') as typeof console.log;\n\n/** Timeout applied to shell commands */\nconst timeout = 350;\n\n/** Returns a pid value for a running port like `63828` or null if nothing is running on the given port. */\nexport async function getPID(port: number): Promise<number | null> {\n try {\n const { stdout } = await spawnAsync('lsof', [`-i:${port}`, '-P', '-t', '-sTCP:LISTEN'], {\n timeout,\n });\n const pid = Number(stdout.split('\\n', 1)[0]!.trim());\n debug(`pid: ${pid} for port: ${port}`);\n return Number.isSafeInteger(pid) ? pid : null;\n } catch (error: any) {\n debug(`No pid found for port: ${port}. Error: ${error}`);\n return null;\n }\n}\n\n/** Get `package.json` `name` field for a given directory. Returns `null` if none exist. */\nfunction getPackageName(packageRoot: string): string | null {\n try {\n const packageJson = path.resolve(packageRoot, 'package.json');\n return require(packageJson).name || null;\n } catch (error) {\n return null;\n }\n}\n\n/** Returns a command like `node /Users/evanbacon/.../bin/expo start` or the package.json name. */\nexport async function getProcessCommand(\n pid: number,\n procDirectory: string\n): Promise<string | null> {\n let name = getPackageName(procDirectory);\n if (!name) {\n // ps\n // -o args=: Output argv without header\n // -p [pid]: For process of PID\n const { stdout } = await spawnAsync('ps', ['-o', 'args=', '-p', `${pid}`], {\n timeout,\n });\n name = stdout.trim();\n }\n return name || null;\n}\n\n/** Get directory for a given process ID. */\nexport async function getDirectoryOfProcessById(pid: number): Promise<string | null> {\n try {\n // lsof\n // -F n: ask for machine readable output\n // -a: apply conditions as logical AND\n // -d cwd: Filter by cwd fd\n // -p [pid]: Filter by input process id\n const { stdout } = await spawnAsync('lsof', ['-F', 'n', '-a', '-d', 'cwd', '-p', `${pid}`], {\n timeout,\n });\n const processCWD = stdout\n .split('\\n')\n .find((output) => output.startsWith('n'))\n ?.slice(1);\n return processCWD && path.isAbsolute(processCWD) ? path.normalize(processCWD) : null;\n } catch {\n return null;\n }\n}\n\ninterface RunningProcess {\n /** The PID value for the port. */\n pid: number;\n /** Get the directory for the running process. */\n directory: string;\n /** The command running the process like `node /Users/evanbacon/.../bin/expo start` or the `package.json` name like `my-app`. */\n command: string;\n}\n\n/** Get information about a running process given a port. Returns null if no process is running on the given port. */\nexport async function getRunningProcess(port: number): Promise<RunningProcess | null> {\n // Don't even try on Windows, since `lsof` and `ps` are not available there\n if (process.platform === 'win32') {\n return null;\n }\n\n const pid = await getPID(port);\n if (!pid) {\n return null;\n }\n try {\n const directory = await getDirectoryOfProcessById(pid);\n if (directory) {\n const command = await getProcessCommand(pid, directory);\n if (command) {\n return { pid, directory, command };\n }\n }\n } catch {}\n return null;\n}\n"],"names":["getDirectoryOfProcessById","getPID","getProcessCommand","getRunningProcess","debug","require","timeout","port","stdout","spawnAsync","pid","Number","split","trim","isSafeInteger","error","getPackageName","packageRoot","packageJson","path","resolve","name","procDirectory","processCWD","find","output","startsWith","slice","isAbsolute","normalize","process","platform","directory","command"],"mappings":";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eAAerB,0BAA0BU,GAAW;IACzD,IAAI;YASiBF;QARnB,OAAO;QACP,wCAAwC;QACxC,sCAAsC;QACtC,2BAA2B;QAC3B,uCAAuC;QACvC,MAAM,EAAEA,MAAM,EAAE,GAAG,MAAMC,IAAAA,qBAAU,EAAC,QAAQ;YAAC;YAAM;YAAK;YAAM;YAAM;YAAO;YAAM,GAAGC,KAAK;SAAC,EAAE;YAC1FJ;QACF;QACA,MAAMiB,cAAaf,qBAAAA,OAChBI,KAAK,CAAC,MACNY,IAAI,CAAC,CAACC,SAAWA,OAAOC,UAAU,CAAC,0BAFnBlB,mBAGfmB,KAAK,CAAC;QACV,OAAOJ,cAAcJ,QAAKS,UAAU,CAACL,cAAcJ,QAAKU,SAAS,CAACN,cAAc;IAClF,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAYO,eAAepB,kBAAkBI,IAAY;IAClD,2EAA2E;IAC3E,IAAIuB,QAAQC,QAAQ,KAAK,SAAS;QAChC,OAAO;IACT;IAEA,MAAMrB,MAAM,MAAMT,OAAOM;IACzB,IAAI,CAACG,KAAK;QACR,OAAO;IACT;IACA,IAAI;QACF,MAAMsB,YAAY,MAAMhC,0BAA0BU;QAClD,IAAIsB,WAAW;YACb,MAAMC,UAAU,MAAM/B,kBAAkBQ,KAAKsB;YAC7C,IAAIC,SAAS;gBACX,OAAO;oBAAEvB;oBAAKsB;oBAAWC;gBAAQ;YACnC;QACF;IACF,EAAE,OAAM,CAAC;IACT,OAAO;AACT"}
|
package/build/src/utils/git.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
|
-
maybeBailOnGitStatusAsync
|
|
12
|
+
get maybeBailOnGitStatusAsync () {
|
|
13
13
|
return maybeBailOnGitStatusAsync;
|
|
14
14
|
},
|
|
15
|
-
validateGitStatusAsync
|
|
15
|
+
get validateGitStatusAsync () {
|
|
16
16
|
return validateGitStatusAsync;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/git.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport { env } from './env';\nimport { isInteractive } from './interactive';\nimport { confirmAsync } from './prompts';\nimport * as Log from '../log';\n\nexport async function maybeBailOnGitStatusAsync(): Promise<boolean> {\n if (env.EXPO_NO_GIT_STATUS) {\n return false;\n }\n Log.warn(\n 'Git status is dirty are you sure you want to continue (Set EXPO_NO_GIT_STATUS=0 to disable)'\n );\n const isGitStatusClean = await validateGitStatusAsync();\n\n // Give people a chance to bail out if git working tree is dirty\n if (!isGitStatusClean) {\n if (!isInteractive()) {\n Log.warn(\n `Git status is dirty but the command will continue because the terminal is not interactive.`\n );\n return false;\n }\n\n Log.log();\n const answer = await confirmAsync({\n message: `Continue with uncommitted changes?`,\n });\n\n if (!answer) {\n return true;\n }\n\n Log.log();\n }\n return false;\n}\n\nexport async function validateGitStatusAsync(): Promise<boolean> {\n let workingTreeStatus = 'unknown';\n try {\n const result = await spawnAsync('git', ['status', '--porcelain']);\n workingTreeStatus = result.stdout === '' ? 'clean' : 'dirty';\n } catch {\n // Maybe git is not installed?\n // Maybe this project is not using git?\n }\n\n if (workingTreeStatus === 'clean') {\n return true;\n } else if (workingTreeStatus === 'dirty') {\n logWarning(\n 'Git branch has uncommitted file changes',\n `It's recommended to commit all changes before proceeding in case you want to revert generated changes.`\n );\n } else {\n logWarning(\n 'No git repo found in current directory',\n `Use git to track file changes before running commands that modify project files.`\n );\n }\n\n return false;\n}\n\nfunction logWarning(warning: string, hint: string) {\n Log.warn(chalk.bold`! ` + warning);\n Log.log(chalk.gray`\\u203A ` + chalk.gray(hint));\n}\n"],"names":["maybeBailOnGitStatusAsync","validateGitStatusAsync","env","EXPO_NO_GIT_STATUS","Log","warn","isGitStatusClean","isInteractive","log","answer","confirmAsync","message","workingTreeStatus","result","spawnAsync","stdout","logWarning","warning","hint","chalk","bold","gray"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/git.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport { env } from './env';\nimport { isInteractive } from './interactive';\nimport { confirmAsync } from './prompts';\nimport * as Log from '../log';\n\nexport async function maybeBailOnGitStatusAsync(): Promise<boolean> {\n if (env.EXPO_NO_GIT_STATUS) {\n return false;\n }\n Log.warn(\n 'Git status is dirty are you sure you want to continue (Set EXPO_NO_GIT_STATUS=0 to disable)'\n );\n const isGitStatusClean = await validateGitStatusAsync();\n\n // Give people a chance to bail out if git working tree is dirty\n if (!isGitStatusClean) {\n if (!isInteractive()) {\n Log.warn(\n `Git status is dirty but the command will continue because the terminal is not interactive.`\n );\n return false;\n }\n\n Log.log();\n const answer = await confirmAsync({\n message: `Continue with uncommitted changes?`,\n });\n\n if (!answer) {\n return true;\n }\n\n Log.log();\n }\n return false;\n}\n\nexport async function validateGitStatusAsync(): Promise<boolean> {\n let workingTreeStatus = 'unknown';\n try {\n const result = await spawnAsync('git', ['status', '--porcelain']);\n workingTreeStatus = result.stdout === '' ? 'clean' : 'dirty';\n } catch {\n // Maybe git is not installed?\n // Maybe this project is not using git?\n }\n\n if (workingTreeStatus === 'clean') {\n return true;\n } else if (workingTreeStatus === 'dirty') {\n logWarning(\n 'Git branch has uncommitted file changes',\n `It's recommended to commit all changes before proceeding in case you want to revert generated changes.`\n );\n } else {\n logWarning(\n 'No git repo found in current directory',\n `Use git to track file changes before running commands that modify project files.`\n );\n }\n\n return false;\n}\n\nfunction logWarning(warning: string, hint: string) {\n Log.warn(chalk.bold`! ` + warning);\n Log.log(chalk.gray`\\u203A ` + chalk.gray(hint));\n}\n"],"names":["maybeBailOnGitStatusAsync","validateGitStatusAsync","env","EXPO_NO_GIT_STATUS","Log","warn","isGitStatusClean","isInteractive","log","answer","confirmAsync","message","workingTreeStatus","result","spawnAsync","stdout","logWarning","warning","hint","chalk","bold","gray"],"mappings":";;;;;;;;;;;QAQsBA;eAAAA;;QAgCAC;eAAAA;;;;gEAxCC;;;;;;;gEACL;;;;;;qBAEE;6BACU;yBACD;6DACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,eAAeD;IACpB,IAAIE,QAAG,CAACC,kBAAkB,EAAE;QAC1B,OAAO;IACT;IACAC,KAAIC,IAAI,CACN;IAEF,MAAMC,mBAAmB,MAAML;IAE/B,gEAAgE;IAChE,IAAI,CAACK,kBAAkB;QACrB,IAAI,CAACC,IAAAA,0BAAa,KAAI;YACpBH,KAAIC,IAAI,CACN,CAAC,0FAA0F,CAAC;YAE9F,OAAO;QACT;QAEAD,KAAII,GAAG;QACP,MAAMC,SAAS,MAAMC,IAAAA,qBAAY,EAAC;YAChCC,SAAS,CAAC,kCAAkC,CAAC;QAC/C;QAEA,IAAI,CAACF,QAAQ;YACX,OAAO;QACT;QAEAL,KAAII,GAAG;IACT;IACA,OAAO;AACT;AAEO,eAAeP;IACpB,IAAIW,oBAAoB;IACxB,IAAI;QACF,MAAMC,SAAS,MAAMC,IAAAA,qBAAU,EAAC,OAAO;YAAC;YAAU;SAAc;QAChEF,oBAAoBC,OAAOE,MAAM,KAAK,KAAK,UAAU;IACvD,EAAE,OAAM;IACN,8BAA8B;IAC9B,uCAAuC;IACzC;IAEA,IAAIH,sBAAsB,SAAS;QACjC,OAAO;IACT,OAAO,IAAIA,sBAAsB,SAAS;QACxCI,WACE,2CACA,CAAC,sGAAsG,CAAC;IAE5G,OAAO;QACLA,WACE,0CACA,CAAC,gFAAgF,CAAC;IAEtF;IAEA,OAAO;AACT;AAEA,SAASA,WAAWC,OAAe,EAAEC,IAAY;IAC/Cd,KAAIC,IAAI,CAACc,gBAAK,CAACC,IAAI,CAAC,EAAE,CAAC,GAAGH;IAC1Bb,KAAII,GAAG,CAACW,gBAAK,CAACE,IAAI,CAAC,OAAO,CAAC,GAAGF,gBAAK,CAACE,IAAI,CAACH;AAC3C"}
|
package/build/src/utils/glob.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
|
-
anyMatchAsync
|
|
12
|
+
get anyMatchAsync () {
|
|
13
13
|
return anyMatchAsync;
|
|
14
14
|
},
|
|
15
|
-
everyMatchAsync
|
|
15
|
+
get everyMatchAsync () {
|
|
16
16
|
return everyMatchAsync;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/glob.ts"],"sourcesContent":["import { glob, globStream, type GlobOptions } from 'glob';\n\n/**\n * Finds all matching files.\n * @deprecated Use `glob` directly instead.\n */\nexport const everyMatchAsync: typeof glob = glob;\n\n/** Bails out early after finding the first matching file. */\nexport function anyMatchAsync(\n pattern: string,\n options: Omit<GlobOptions, 'withFileTypes' | 'signal'>\n) {\n return new Promise<string[]>((resolve, reject) => {\n const controller = new AbortController();\n\n globStream(pattern, { ...options, signal: controller.signal })\n .on('error', (error) => {\n if (!controller.signal.aborted) {\n reject(error);\n }\n })\n .once('end', () => resolve([]))\n .once('data', (file) => {\n controller.abort();\n resolve([file]);\n });\n });\n}\n"],"names":["anyMatchAsync","everyMatchAsync","glob","pattern","options","Promise","resolve","reject","controller","AbortController","globStream","signal","on","error","aborted","once","file","abort"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/glob.ts"],"sourcesContent":["import { glob, globStream, type GlobOptions } from 'glob';\n\n/**\n * Finds all matching files.\n * @deprecated Use `glob` directly instead.\n */\nexport const everyMatchAsync: typeof glob = glob;\n\n/** Bails out early after finding the first matching file. */\nexport function anyMatchAsync(\n pattern: string,\n options: Omit<GlobOptions, 'withFileTypes' | 'signal'>\n) {\n return new Promise<string[]>((resolve, reject) => {\n const controller = new AbortController();\n\n globStream(pattern, { ...options, signal: controller.signal })\n .on('error', (error) => {\n if (!controller.signal.aborted) {\n reject(error);\n }\n })\n .once('end', () => resolve([]))\n .once('data', (file) => {\n controller.abort();\n resolve([file]);\n });\n });\n}\n"],"names":["anyMatchAsync","everyMatchAsync","glob","pattern","options","Promise","resolve","reject","controller","AbortController","globStream","signal","on","error","aborted","once","file","abort"],"mappings":";;;;;;;;;;;QASgBA;eAAAA;;QAHHC;eAAAA;;;;yBANsC;;;;;;AAM5C,MAAMA,kBAA+BC,YAAI;AAGzC,SAASF,cACdG,OAAe,EACfC,OAAsD;IAEtD,OAAO,IAAIC,QAAkB,CAACC,SAASC;QACrC,MAAMC,aAAa,IAAIC;QAEvBC,IAAAA,kBAAU,EAACP,SAAS;YAAE,GAAGC,OAAO;YAAEO,QAAQH,WAAWG,MAAM;QAAC,GACzDC,EAAE,CAAC,SAAS,CAACC;YACZ,IAAI,CAACL,WAAWG,MAAM,CAACG,OAAO,EAAE;gBAC9BP,OAAOM;YACT;QACF,GACCE,IAAI,CAAC,OAAO,IAAMT,QAAQ,EAAE,GAC5BS,IAAI,CAAC,QAAQ,CAACC;YACbR,WAAWS,KAAK;YAChBX,QAAQ;gBAACU;aAAK;QAChB;IACJ;AACF"}
|
package/build/src/utils/ip.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
|
-
getGateway
|
|
12
|
+
get getGateway () {
|
|
13
13
|
return getGateway;
|
|
14
14
|
},
|
|
15
|
-
getGatewayAsync
|
|
15
|
+
get getGatewayAsync () {
|
|
16
16
|
return getGatewayAsync;
|
|
17
17
|
},
|
|
18
|
-
getIpAddressAsync
|
|
18
|
+
get getIpAddressAsync () {
|
|
19
19
|
return getIpAddressAsync;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/ip.ts"],"sourcesContent":["import { lanNetworkSync, lanNetwork } from 'lan-network';\n\nimport { envIsHeadless } from './env';\n\n// NOTE(@kitten): In headless mode, there's no point in trying to run DHCP, since\n// we assume we're online and probing is going to be enough\nconst options = {\n noDhcp: envIsHeadless(),\n};\n\nexport interface GatewayInfo {\n iname: string | null;\n address: string;\n gateway: string | null;\n internal: boolean;\n}\n\nexport function getGateway(): GatewayInfo {\n try {\n return lanNetworkSync(options);\n } catch {\n return {\n iname: null,\n address: '127.0.0.1',\n gateway: null,\n internal: true,\n };\n }\n}\n\nexport async function getGatewayAsync(): Promise<GatewayInfo> {\n try {\n return await lanNetwork(options);\n } catch {\n return {\n iname: null,\n address: '127.0.0.1',\n gateway: null,\n internal: true,\n };\n }\n}\n\nexport async function getIpAddressAsync(): Promise<string> {\n return (await getGatewayAsync()).address;\n}\n"],"names":["getGateway","getGatewayAsync","getIpAddressAsync","options","noDhcp","envIsHeadless","lanNetworkSync","iname","address","gateway","internal","lanNetwork"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/ip.ts"],"sourcesContent":["import { lanNetworkSync, lanNetwork } from 'lan-network';\n\nimport { envIsHeadless } from './env';\n\n// NOTE(@kitten): In headless mode, there's no point in trying to run DHCP, since\n// we assume we're online and probing is going to be enough\nconst options = {\n noDhcp: envIsHeadless(),\n};\n\nexport interface GatewayInfo {\n iname: string | null;\n address: string;\n gateway: string | null;\n internal: boolean;\n}\n\nexport function getGateway(): GatewayInfo {\n try {\n return lanNetworkSync(options);\n } catch {\n return {\n iname: null,\n address: '127.0.0.1',\n gateway: null,\n internal: true,\n };\n }\n}\n\nexport async function getGatewayAsync(): Promise<GatewayInfo> {\n try {\n return await lanNetwork(options);\n } catch {\n return {\n iname: null,\n address: '127.0.0.1',\n gateway: null,\n internal: true,\n };\n }\n}\n\nexport async function getIpAddressAsync(): Promise<string> {\n return (await getGatewayAsync()).address;\n}\n"],"names":["getGateway","getGatewayAsync","getIpAddressAsync","options","noDhcp","envIsHeadless","lanNetworkSync","iname","address","gateway","internal","lanNetwork"],"mappings":";;;;;;;;;;;QAiBgBA;eAAAA;;QAaMC;eAAAA;;QAaAC;eAAAA;;;;yBA3CqB;;;;;;qBAEb;AAE9B,iFAAiF;AACjF,2DAA2D;AAC3D,MAAMC,UAAU;IACdC,QAAQC,IAAAA,kBAAa;AACvB;AASO,SAASL;IACd,IAAI;QACF,OAAOM,IAAAA,4BAAc,EAACH;IACxB,EAAE,OAAM;QACN,OAAO;YACLI,OAAO;YACPC,SAAS;YACTC,SAAS;YACTC,UAAU;QACZ;IACF;AACF;AAEO,eAAeT;IACpB,IAAI;QACF,OAAO,MAAMU,IAAAA,wBAAU,EAACR;IAC1B,EAAE,OAAM;QACN,OAAO;YACLI,OAAO;YACPC,SAAS;YACTC,SAAS;YACTC,UAAU;QACZ;IACF;AACF;AAEO,eAAeR;IACpB,OAAO,AAAC,CAAA,MAAMD,iBAAgB,EAAGO,OAAO;AAC1C"}
|
package/build/src/utils/link.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
|
-
learnMore
|
|
12
|
+
get learnMore () {
|
|
13
13
|
return learnMore;
|
|
14
14
|
},
|
|
15
|
-
link
|
|
15
|
+
get link () {
|
|
16
16
|
return link;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/link.ts"],"sourcesContent":["import chalk from 'chalk';\nimport terminalLink from 'terminal-link';\n\n/**\n * Prints a link for given URL, using text if provided, otherwise text is just the URL.\n * Format links as dim (unless disabled) and with an underline.\n *\n * @example https://expo.dev\n */\nexport function link(\n url: string,\n { text = url, dim = true }: { text?: string; dim?: boolean } = {}\n): string {\n let output: string;\n // Links can be disabled via env variables https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js\n if (terminalLink.isSupported) {\n output = terminalLink(text, url);\n } else {\n output = `${text === url ? '' : text + ': '}${chalk.underline(url)}`;\n }\n return dim ? chalk.dim(output) : output;\n}\n\n/**\n * Provide a consistent \"Learn more\" link experience.\n * Format links as dim (unless disabled) with an underline.\n *\n * @example [Learn more](https://expo.dev)\n * @example Learn more: https://expo.dev\n */\nexport function learnMore(\n url: string,\n {\n learnMoreMessage: maybeLearnMoreMessage,\n dim = true,\n }: { learnMoreMessage?: string; dim?: boolean } = {}\n): string {\n return link(url, { text: maybeLearnMoreMessage ?? 'Learn more', dim });\n}\n"],"names":["learnMore","link","url","text","dim","output","terminalLink","isSupported","chalk","underline","learnMoreMessage","maybeLearnMoreMessage"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/link.ts"],"sourcesContent":["import chalk from 'chalk';\nimport terminalLink from 'terminal-link';\n\n/**\n * Prints a link for given URL, using text if provided, otherwise text is just the URL.\n * Format links as dim (unless disabled) and with an underline.\n *\n * @example https://expo.dev\n */\nexport function link(\n url: string,\n { text = url, dim = true }: { text?: string; dim?: boolean } = {}\n): string {\n let output: string;\n // Links can be disabled via env variables https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js\n if (terminalLink.isSupported) {\n output = terminalLink(text, url);\n } else {\n output = `${text === url ? '' : text + ': '}${chalk.underline(url)}`;\n }\n return dim ? chalk.dim(output) : output;\n}\n\n/**\n * Provide a consistent \"Learn more\" link experience.\n * Format links as dim (unless disabled) with an underline.\n *\n * @example [Learn more](https://expo.dev)\n * @example Learn more: https://expo.dev\n */\nexport function learnMore(\n url: string,\n {\n learnMoreMessage: maybeLearnMoreMessage,\n dim = true,\n }: { learnMoreMessage?: string; dim?: boolean } = {}\n): string {\n return link(url, { text: maybeLearnMoreMessage ?? 'Learn more', dim });\n}\n"],"names":["learnMore","link","url","text","dim","output","terminalLink","isSupported","chalk","underline","learnMoreMessage","maybeLearnMoreMessage"],"mappings":";;;;;;;;;;;QA8BgBA;eAAAA;;QArBAC;eAAAA;;;;gEATE;;;;;;;gEACO;;;;;;;;;;;AAQlB,SAASA,KACdC,GAAW,EACX,EAAEC,OAAOD,GAAG,EAAEE,MAAM,IAAI,EAAoC,GAAG,CAAC,CAAC;IAEjE,IAAIC;IACJ,mHAAmH;IACnH,IAAIC,uBAAY,CAACC,WAAW,EAAE;QAC5BF,SAASC,IAAAA,uBAAY,EAACH,MAAMD;IAC9B,OAAO;QACLG,SAAS,GAAGF,SAASD,MAAM,KAAKC,OAAO,OAAOK,gBAAK,CAACC,SAAS,CAACP,MAAM;IACtE;IACA,OAAOE,MAAMI,gBAAK,CAACJ,GAAG,CAACC,UAAUA;AACnC;AASO,SAASL,UACdE,GAAW,EACX,EACEQ,kBAAkBC,qBAAqB,EACvCP,MAAM,IAAI,EACmC,GAAG,CAAC,CAAC;IAEpD,OAAOH,KAAKC,KAAK;QAAEC,MAAMQ,yBAAyB;QAAcP;IAAI;AACtE"}
|
|
@@ -5,35 +5,35 @@ 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
|
-
createGeneratedHeaderComment
|
|
12
|
+
get createGeneratedHeaderComment () {
|
|
13
13
|
return createGeneratedHeaderComment;
|
|
14
14
|
},
|
|
15
|
-
createGitIgnoreHash
|
|
15
|
+
get createGitIgnoreHash () {
|
|
16
16
|
return createGitIgnoreHash;
|
|
17
17
|
},
|
|
18
|
-
generatedFooterComment
|
|
18
|
+
get generatedFooterComment () {
|
|
19
19
|
return generatedFooterComment;
|
|
20
20
|
},
|
|
21
|
-
getSanitizedGitIgnoreLines
|
|
21
|
+
get getSanitizedGitIgnoreLines () {
|
|
22
22
|
return getSanitizedGitIgnoreLines;
|
|
23
23
|
},
|
|
24
|
-
mergeGitIgnoreContents
|
|
24
|
+
get mergeGitIgnoreContents () {
|
|
25
25
|
return mergeGitIgnoreContents;
|
|
26
26
|
},
|
|
27
|
-
mergeGitIgnorePaths
|
|
27
|
+
get mergeGitIgnorePaths () {
|
|
28
28
|
return mergeGitIgnorePaths;
|
|
29
29
|
},
|
|
30
|
-
removeFromGitIgnore
|
|
30
|
+
get removeFromGitIgnore () {
|
|
31
31
|
return removeFromGitIgnore;
|
|
32
32
|
},
|
|
33
|
-
removeGeneratedGitIgnoreContents
|
|
33
|
+
get removeGeneratedGitIgnoreContents () {
|
|
34
34
|
return removeGeneratedGitIgnoreContents;
|
|
35
35
|
},
|
|
36
|
-
upsertGitIgnoreContents
|
|
36
|
+
get upsertGitIgnoreContents () {
|
|
37
37
|
return upsertGitIgnoreContents;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/mergeGitIgnorePaths.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\n\nimport { Log } from '../log';\n\ntype MergeResults = {\n contents: string;\n didClear: boolean;\n didMerge: boolean;\n};\n\nconst generatedHeaderPrefix = `# @generated expo-cli`;\nexport const generatedFooterComment = `# @end expo-cli`;\n\n/**\n * Merge two gitignore files together and add a generated header.\n *\n * @param targetGitIgnorePath\n * @param sourceGitIgnorePath\n *\n * @returns `null` if one of the gitignore files doesn't exist. Otherwise, returns the merged contents.\n */\nexport function mergeGitIgnorePaths(\n targetGitIgnorePath: string,\n sourceGitIgnorePath: string\n): null | MergeResults {\n if (!fs.existsSync(targetGitIgnorePath)) {\n // No gitignore in the project already, no need to merge anything into anything. I guess they\n // are not using git :O\n return null;\n }\n\n if (!fs.existsSync(sourceGitIgnorePath)) {\n // Maybe we don't have a gitignore in the template project\n return null;\n }\n\n const targetGitIgnore = fs.readFileSync(targetGitIgnorePath).toString();\n const sourceGitIgnore = fs.readFileSync(sourceGitIgnorePath).toString();\n const merged = mergeGitIgnoreContents(targetGitIgnore, sourceGitIgnore);\n // Only rewrite the file if it was modified.\n if (merged.contents) {\n fs.writeFileSync(targetGitIgnorePath, merged.contents);\n }\n\n return merged;\n}\n\n/**\n * Get line indexes for the generated section of a gitignore.\n *\n * @param gitIgnore\n */\nfunction getGeneratedSectionIndexes(gitIgnore: string): {\n contents: string[];\n start: number;\n end: number;\n} {\n const contents = gitIgnore.split('\\n');\n const start = contents.findIndex((line) => line.startsWith(generatedHeaderPrefix));\n const end = contents.findIndex((line) => line.startsWith(generatedFooterComment));\n\n return { contents, start, end };\n}\n\n/**\n * Removes the generated section from a gitignore, returns null when nothing can be removed.\n * This sways heavily towards not removing lines unless it's certain that modifications were not made to the gitignore manually.\n *\n * @param gitIgnore\n */\nexport function removeGeneratedGitIgnoreContents(gitIgnore: string): string | null {\n const { contents, start, end } = getGeneratedSectionIndexes(gitIgnore);\n if (start > -1 && end > -1 && start < end) {\n contents.splice(start, end - start + 1);\n // TODO: We could in theory check that the contents we're removing match the hash used in the header,\n // this would ensure that we don't accidentally remove lines that someone added or removed from the generated section.\n return contents.join('\\n');\n }\n return null;\n}\n\n/**\n * Merge the contents of two gitignores together and add a generated header.\n *\n * @param targetGitIgnore contents of the existing gitignore\n * @param sourceGitIgnore contents of the extra gitignore\n */\nexport function mergeGitIgnoreContents(\n targetGitIgnore: string,\n sourceGitIgnore: string\n): MergeResults {\n const header = createGeneratedHeaderComment(sourceGitIgnore);\n if (!targetGitIgnore.includes(header)) {\n // Ensure the old generated gitignore contents are removed.\n const sanitizedTarget = removeGeneratedGitIgnoreContents(targetGitIgnore);\n return {\n contents: [\n sanitizedTarget ?? targetGitIgnore,\n header,\n `# The following patterns were generated by expo-cli`,\n ``,\n sourceGitIgnore,\n generatedFooterComment,\n ].join('\\n'),\n didMerge: true,\n didClear: !!sanitizedTarget,\n };\n }\n return { contents: targetGitIgnore, didClear: false, didMerge: false };\n}\n\n/**\n * Adds the contents into an existing gitignore \"generated by expo-cli section\"\n * If no section exists, it will be created (hence the name upsert)\n */\nexport function upsertGitIgnoreContents(\n targetGitIgnorePath: string,\n contents: string\n): MergeResults | null {\n const targetGitIgnore = fs.readFileSync(targetGitIgnorePath, {\n encoding: 'utf-8',\n flag: 'a+',\n });\n\n if (targetGitIgnore.match(new RegExp(`^${contents}[\\\\n\\\\r\\\\s]*$`, 'm'))) {\n return null;\n }\n\n // If there is an existing section, update it with the new content\n if (targetGitIgnore.includes(generatedHeaderPrefix)) {\n const indexes = getGeneratedSectionIndexes(targetGitIgnore);\n\n contents = `${indexes.contents.slice(indexes.start + 3, indexes.end).join('\\n')}\\n${contents}`;\n }\n\n const merged = mergeGitIgnoreContents(targetGitIgnore, contents);\n\n if (merged.contents) {\n fs.writeFileSync(targetGitIgnorePath, merged.contents);\n }\n return merged;\n}\n\nexport function createGeneratedHeaderComment(gitIgnore: string): string {\n const hashKey = createGitIgnoreHash(getSanitizedGitIgnoreLines(gitIgnore).join('\\n'));\n\n return `${generatedHeaderPrefix} ${hashKey}`;\n}\n\n/**\n * Normalize the contents of a gitignore to ensure that minor changes like new lines or sort order don't cause a regeneration.\n */\nexport function getSanitizedGitIgnoreLines(gitIgnore: string): string[] {\n // filter, trim, and sort the lines.\n return gitIgnore\n .split('\\n')\n .filter((v) => {\n const line = v.trim();\n // Strip comments\n if (line.startsWith('#')) {\n return false;\n }\n return !!line;\n })\n .sort();\n}\n\nexport function createGitIgnoreHash(gitIgnore: string): string {\n // this doesn't need to be secure, the shorter the better.\n const hash = crypto.createHash('sha1').update(gitIgnore).digest('hex');\n return `sync-${hash}`;\n}\n\nexport function removeFromGitIgnore(targetGitIgnorePath: string, contents: string) {\n try {\n if (!fs.existsSync(targetGitIgnorePath)) {\n return;\n }\n\n let targetGitIgnore = fs.readFileSync(targetGitIgnorePath, 'utf-8');\n\n if (!targetGitIgnore.includes(contents)) {\n return null;\n }\n\n targetGitIgnore = targetGitIgnore.replace(`${contents}\\n`, '');\n\n const indexes = getGeneratedSectionIndexes(targetGitIgnore);\n\n if (indexes.start === indexes.end - 3) {\n targetGitIgnore = targetGitIgnore.replace(\n new RegExp(`^${generatedHeaderPrefix}((.|\\n)*)${generatedFooterComment}$`, 'm'),\n ''\n );\n }\n\n return fs.writeFileSync(targetGitIgnorePath, targetGitIgnore);\n } catch (error) {\n Log.error(`Failed to read/write to .gitignore path: ${targetGitIgnorePath}`);\n throw error;\n }\n}\n"],"names":["createGeneratedHeaderComment","createGitIgnoreHash","generatedFooterComment","getSanitizedGitIgnoreLines","mergeGitIgnoreContents","mergeGitIgnorePaths","removeFromGitIgnore","removeGeneratedGitIgnoreContents","upsertGitIgnoreContents","generatedHeaderPrefix","targetGitIgnorePath","sourceGitIgnorePath","fs","existsSync","targetGitIgnore","readFileSync","toString","sourceGitIgnore","merged","contents","writeFileSync","getGeneratedSectionIndexes","gitIgnore","split","start","findIndex","line","startsWith","end","splice","join","header","includes","sanitizedTarget","didMerge","didClear","encoding","flag","match","RegExp","indexes","slice","hashKey","filter","v","trim","sort","hash","crypto","createHash","update","digest","replace","error","Log"],"mappings":";;;;;;;;;;;IAg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,aAAa,CAACV,qBAAqBI;IAC/C,EAAE,OAAOuC,OAAO;QACdC,QAAG,CAACD,KAAK,CAAC,CAAC,yCAAyC,EAAE3C,qBAAqB;QAC3E,MAAM2C;IACR;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/mergeGitIgnorePaths.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\n\nimport { Log } from '../log';\n\ntype MergeResults = {\n contents: string;\n didClear: boolean;\n didMerge: boolean;\n};\n\nconst generatedHeaderPrefix = `# @generated expo-cli`;\nexport const generatedFooterComment = `# @end expo-cli`;\n\n/**\n * Merge two gitignore files together and add a generated header.\n *\n * @param targetGitIgnorePath\n * @param sourceGitIgnorePath\n *\n * @returns `null` if one of the gitignore files doesn't exist. Otherwise, returns the merged contents.\n */\nexport function mergeGitIgnorePaths(\n targetGitIgnorePath: string,\n sourceGitIgnorePath: string\n): null | MergeResults {\n if (!fs.existsSync(targetGitIgnorePath)) {\n // No gitignore in the project already, no need to merge anything into anything. I guess they\n // are not using git :O\n return null;\n }\n\n if (!fs.existsSync(sourceGitIgnorePath)) {\n // Maybe we don't have a gitignore in the template project\n return null;\n }\n\n const targetGitIgnore = fs.readFileSync(targetGitIgnorePath).toString();\n const sourceGitIgnore = fs.readFileSync(sourceGitIgnorePath).toString();\n const merged = mergeGitIgnoreContents(targetGitIgnore, sourceGitIgnore);\n // Only rewrite the file if it was modified.\n if (merged.contents) {\n fs.writeFileSync(targetGitIgnorePath, merged.contents);\n }\n\n return merged;\n}\n\n/**\n * Get line indexes for the generated section of a gitignore.\n *\n * @param gitIgnore\n */\nfunction getGeneratedSectionIndexes(gitIgnore: string): {\n contents: string[];\n start: number;\n end: number;\n} {\n const contents = gitIgnore.split('\\n');\n const start = contents.findIndex((line) => line.startsWith(generatedHeaderPrefix));\n const end = contents.findIndex((line) => line.startsWith(generatedFooterComment));\n\n return { contents, start, end };\n}\n\n/**\n * Removes the generated section from a gitignore, returns null when nothing can be removed.\n * This sways heavily towards not removing lines unless it's certain that modifications were not made to the gitignore manually.\n *\n * @param gitIgnore\n */\nexport function removeGeneratedGitIgnoreContents(gitIgnore: string): string | null {\n const { contents, start, end } = getGeneratedSectionIndexes(gitIgnore);\n if (start > -1 && end > -1 && start < end) {\n contents.splice(start, end - start + 1);\n // TODO: We could in theory check that the contents we're removing match the hash used in the header,\n // this would ensure that we don't accidentally remove lines that someone added or removed from the generated section.\n return contents.join('\\n');\n }\n return null;\n}\n\n/**\n * Merge the contents of two gitignores together and add a generated header.\n *\n * @param targetGitIgnore contents of the existing gitignore\n * @param sourceGitIgnore contents of the extra gitignore\n */\nexport function mergeGitIgnoreContents(\n targetGitIgnore: string,\n sourceGitIgnore: string\n): MergeResults {\n const header = createGeneratedHeaderComment(sourceGitIgnore);\n if (!targetGitIgnore.includes(header)) {\n // Ensure the old generated gitignore contents are removed.\n const sanitizedTarget = removeGeneratedGitIgnoreContents(targetGitIgnore);\n return {\n contents: [\n sanitizedTarget ?? targetGitIgnore,\n header,\n `# The following patterns were generated by expo-cli`,\n ``,\n sourceGitIgnore,\n generatedFooterComment,\n ].join('\\n'),\n didMerge: true,\n didClear: !!sanitizedTarget,\n };\n }\n return { contents: targetGitIgnore, didClear: false, didMerge: false };\n}\n\n/**\n * Adds the contents into an existing gitignore \"generated by expo-cli section\"\n * If no section exists, it will be created (hence the name upsert)\n */\nexport function upsertGitIgnoreContents(\n targetGitIgnorePath: string,\n contents: string\n): MergeResults | null {\n const targetGitIgnore = fs.readFileSync(targetGitIgnorePath, {\n encoding: 'utf-8',\n flag: 'a+',\n });\n\n if (targetGitIgnore.match(new RegExp(`^${contents}[\\\\n\\\\r\\\\s]*$`, 'm'))) {\n return null;\n }\n\n // If there is an existing section, update it with the new content\n if (targetGitIgnore.includes(generatedHeaderPrefix)) {\n const indexes = getGeneratedSectionIndexes(targetGitIgnore);\n\n contents = `${indexes.contents.slice(indexes.start + 3, indexes.end).join('\\n')}\\n${contents}`;\n }\n\n const merged = mergeGitIgnoreContents(targetGitIgnore, contents);\n\n if (merged.contents) {\n fs.writeFileSync(targetGitIgnorePath, merged.contents);\n }\n return merged;\n}\n\nexport function createGeneratedHeaderComment(gitIgnore: string): string {\n const hashKey = createGitIgnoreHash(getSanitizedGitIgnoreLines(gitIgnore).join('\\n'));\n\n return `${generatedHeaderPrefix} ${hashKey}`;\n}\n\n/**\n * Normalize the contents of a gitignore to ensure that minor changes like new lines or sort order don't cause a regeneration.\n */\nexport function getSanitizedGitIgnoreLines(gitIgnore: string): string[] {\n // filter, trim, and sort the lines.\n return gitIgnore\n .split('\\n')\n .filter((v) => {\n const line = v.trim();\n // Strip comments\n if (line.startsWith('#')) {\n return false;\n }\n return !!line;\n })\n .sort();\n}\n\nexport function createGitIgnoreHash(gitIgnore: string): string {\n // this doesn't need to be secure, the shorter the better.\n const hash = crypto.createHash('sha1').update(gitIgnore).digest('hex');\n return `sync-${hash}`;\n}\n\nexport function removeFromGitIgnore(targetGitIgnorePath: string, contents: string) {\n try {\n if (!fs.existsSync(targetGitIgnorePath)) {\n return;\n }\n\n let targetGitIgnore = fs.readFileSync(targetGitIgnorePath, 'utf-8');\n\n if (!targetGitIgnore.includes(contents)) {\n return null;\n }\n\n targetGitIgnore = targetGitIgnore.replace(`${contents}\\n`, '');\n\n const indexes = getGeneratedSectionIndexes(targetGitIgnore);\n\n if (indexes.start === indexes.end - 3) {\n targetGitIgnore = targetGitIgnore.replace(\n new RegExp(`^${generatedHeaderPrefix}((.|\\n)*)${generatedFooterComment}$`, 'm'),\n ''\n );\n }\n\n return fs.writeFileSync(targetGitIgnorePath, targetGitIgnore);\n } catch (error) {\n Log.error(`Failed to read/write to .gitignore path: ${targetGitIgnorePath}`);\n throw error;\n }\n}\n"],"names":["createGeneratedHeaderComment","createGitIgnoreHash","generatedFooterComment","getSanitizedGitIgnoreLines","mergeGitIgnoreContents","mergeGitIgnorePaths","removeFromGitIgnore","removeGeneratedGitIgnoreContents","upsertGitIgnoreContents","generatedHeaderPrefix","targetGitIgnorePath","sourceGitIgnorePath","fs","existsSync","targetGitIgnore","readFileSync","toString","sourceGitIgnore","merged","contents","writeFileSync","getGeneratedSectionIndexes","gitIgnore","split","start","findIndex","line","startsWith","end","splice","join","header","includes","sanitizedTarget","didMerge","didClear","encoding","flag","match","RegExp","indexes","slice","hashKey","filter","v","trim","sort","hash","crypto","createHash","update","digest","replace","error","Log"],"mappings":";;;;;;;;;;;QAgJgBA;eAAAA;;QAwBAC;eAAAA;;QA5JHC;eAAAA;;QA6IGC;eAAAA;;QAjEAC;eAAAA;;QAlEAC;eAAAA;;QAwJAC;eAAAA;;QAvGAC;eAAAA;;QA6CAC;eAAAA;;;;gEApHG;;;;;;;gEACJ;;;;;;qBAEK;;;;;;AAQpB,MAAMC,wBAAwB,CAAC,qBAAqB,CAAC;AAC9C,MAAMP,yBAAyB,CAAC,eAAe,CAAC;AAUhD,SAASG,oBACdK,mBAA2B,EAC3BC,mBAA2B;IAE3B,IAAI,CAACC,aAAE,CAACC,UAAU,CAACH,sBAAsB;QACvC,6FAA6F;QAC7F,uBAAuB;QACvB,OAAO;IACT;IAEA,IAAI,CAACE,aAAE,CAACC,UAAU,CAACF,sBAAsB;QACvC,0DAA0D;QAC1D,OAAO;IACT;IAEA,MAAMG,kBAAkBF,aAAE,CAACG,YAAY,CAACL,qBAAqBM,QAAQ;IACrE,MAAMC,kBAAkBL,aAAE,CAACG,YAAY,CAACJ,qBAAqBK,QAAQ;IACrE,MAAME,SAASd,uBAAuBU,iBAAiBG;IACvD,4CAA4C;IAC5C,IAAIC,OAAOC,QAAQ,EAAE;QACnBP,aAAE,CAACQ,aAAa,CAACV,qBAAqBQ,OAAOC,QAAQ;IACvD;IAEA,OAAOD;AACT;AAEA;;;;CAIC,GACD,SAASG,2BAA2BC,SAAiB;IAKnD,MAAMH,WAAWG,UAAUC,KAAK,CAAC;IACjC,MAAMC,QAAQL,SAASM,SAAS,CAAC,CAACC,OAASA,KAAKC,UAAU,CAAClB;IAC3D,MAAM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AG,GAAG,GAAG;YACrCd,kBAAkBA,gBAAgBsC,OAAO,CACvC,IAAIb,OAAO,CAAC,CAAC,EAAE9B,sBAAsB,SAAS,EAAEP,uBAAuB,CAAC,CAAC,EAAE,MAC3E;QAEJ;QAEA,OAAOU,aAAE,CAACQ,aAAa,CAACV,qBAAqBI;IAC/C,EAAE,OAAOuC,OAAO;QACdC,QAAG,CAACD,KAAK,CAAC,CAAC,yCAAyC,EAAE3C,qBAAqB;QAC3E,MAAM2C;IACR;AACF"}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
attemptModification
|
|
12
|
+
get attemptModification () {
|
|
13
13
|
return attemptModification;
|
|
14
14
|
},
|
|
15
|
-
warnAboutConfigAndThrow
|
|
15
|
+
get warnAboutConfigAndThrow () {
|
|
16
16
|
return warnAboutConfigAndThrow;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/modifyConfigAsync.ts"],"sourcesContent":["import { ExpoConfig
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/modifyConfigAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { modifyConfigAsync } from '@expo/config';\nimport chalk from 'chalk';\n\nimport { SilentError } from './errors';\nimport * as Log from '../log';\n\n/** Wraps `[@expo/config] modifyConfigAsync()` and adds additional logging. */\nexport async function attemptModification(\n projectRoot: string,\n edits: Partial<ExpoConfig>,\n exactEdits: Partial<ExpoConfig>\n): Promise<boolean> {\n const modification = await modifyConfigAsync(projectRoot, edits, {\n skipSDKVersionRequirement: true,\n });\n if (modification.type !== 'success') {\n warnAboutConfigAndThrow(modification.type, modification.message!, exactEdits);\n }\n return modification.type === 'success';\n}\n\nexport function warnAboutConfigAndThrow(type: string, message: string, edits: Partial<ExpoConfig>) {\n Log.log();\n if (type === 'warn') {\n // The project is using a dynamic config, give the user a helpful log and bail out.\n Log.log(chalk.yellow(message));\n }\n notifyAboutManualConfigEdits(edits);\n throw new SilentError();\n}\n\nfunction notifyAboutManualConfigEdits(edits: Partial<ExpoConfig>) {\n Log.log(chalk.cyan(`Add the following to your Expo config`));\n Log.log();\n Log.log(JSON.stringify(edits, null, 2));\n Log.log();\n}\n"],"names":["attemptModification","warnAboutConfigAndThrow","projectRoot","edits","exactEdits","modification","modifyConfigAsync","skipSDKVersionRequirement","type","message","Log","log","chalk","yellow","notifyAboutManualConfigEdits","SilentError","cyan","JSON","stringify"],"mappings":";;;;;;;;;;;QAQsBA;eAAAA;;QAcNC;eAAAA;;;;yBArBkB;;;;;;;gEAChB;;;;;;wBAEU;6DACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGd,eAAeD,oBACpBE,WAAmB,EACnBC,KAA0B,EAC1BC,UAA+B;IAE/B,MAAMC,eAAe,MAAMC,IAAAA,2BAAiB,EAACJ,aAAaC,OAAO;QAC/DI,2BAA2B;IAC7B;IACA,IAAIF,aAAaG,IAAI,KAAK,WAAW;QACnCP,wBAAwBI,aAAaG,IAAI,EAAEH,aAAaI,OAAO,EAAGL;IACpE;IACA,OAAOC,aAAaG,IAAI,KAAK;AAC/B;AAEO,SAASP,wBAAwBO,IAAY,EAAEC,OAAe,EAAEN,KAA0B;IAC/FO,KAAIC,GAAG;IACP,IAAIH,SAAS,QAAQ;QACnB,mFAAmF;QACnFE,KAAIC,GAAG,CAACC,gBAAK,CAACC,MAAM,CAACJ;IACvB;IACAK,6BAA6BX;IAC7B,MAAM,IAAIY,mBAAW;AACvB;AAEA,SAASD,6BAA6BX,KAA0B;IAC9DO,KAAIC,GAAG,CAACC,gBAAK,CAACI,IAAI,CAAC,CAAC,qCAAqC,CAAC;IAC1DN,KAAIC,GAAG;IACPD,KAAIC,GAAG,CAACM,KAAKC,SAAS,CAACf,OAAO,MAAM;IACpCO,KAAIC,GAAG;AACT"}
|
package/build/src/utils/net.js
CHANGED
|
@@ -5,15 +5,18 @@ 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
|
-
isLocalSocket
|
|
12
|
+
get isLocalSocket () {
|
|
13
13
|
return isLocalSocket;
|
|
14
14
|
},
|
|
15
|
-
isMatchingOrigin
|
|
15
|
+
get isMatchingOrigin () {
|
|
16
16
|
return isMatchingOrigin;
|
|
17
|
+
},
|
|
18
|
+
get shouldThrottleRemoteDevCall () {
|
|
19
|
+
return shouldThrottleRemoteDevCall;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
22
|
const ipv6To4Prefix = '::ffff:';
|
|
@@ -35,9 +38,25 @@ const isMatchingOrigin = (request, serverBaseUrl)=>{
|
|
|
35
38
|
if (!request.headers.origin) {
|
|
36
39
|
return true;
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
let actualHost;
|
|
42
|
+
try {
|
|
43
|
+
actualHost = new URL(`${request.headers.origin}`).host;
|
|
44
|
+
} catch {
|
|
45
|
+
// Malformed Origin — treat as untrusted.
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
39
48
|
const expectedHost = new URL(serverBaseUrl).host;
|
|
40
49
|
return actualHost === expectedHost;
|
|
41
50
|
};
|
|
51
|
+
const DEV_CALL_THROTTLE_MS = 2000;
|
|
52
|
+
let lastRemoteDevCallAt = 0;
|
|
53
|
+
const shouldThrottleRemoteDevCall = ()=>{
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
if (now - lastRemoteDevCallAt < DEV_CALL_THROTTLE_MS) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
lastRemoteDevCallAt = now;
|
|
59
|
+
return false;
|
|
60
|
+
};
|
|
42
61
|
|
|
43
62
|
//# sourceMappingURL=net.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/net.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http';\nimport type { Socket } from 'node:net';\n\nconst ipv6To4Prefix = '::ffff:';\n\nexport const isLocalSocket = (socket: Socket): boolean => {\n let { localAddress, remoteAddress, remoteFamily } = socket;\n\n const isLoopbackRequest = localAddress && localAddress === remoteAddress;\n if (isLoopbackRequest) {\n return true;\n } else if (!remoteAddress || !remoteFamily) {\n return false;\n }\n\n if (remoteFamily === 'IPv6' && remoteAddress.startsWith(ipv6To4Prefix)) {\n remoteAddress = remoteAddress.slice(ipv6To4Prefix.length);\n }\n\n return remoteAddress === '::1' || remoteAddress.startsWith('127.');\n};\n\ninterface AbstractIncomingMessage {\n headers: IncomingHttpHeaders | Record<string, string | string[]>;\n}\n\nexport const isMatchingOrigin = (\n request: AbstractIncomingMessage,\n serverBaseUrl: string\n): boolean => {\n // NOTE(@kitten): The browser will always send an origin header for websocket upgrade connections\n if (!request.headers.origin) {\n return true;\n }\n
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/net.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http';\nimport type { Socket } from 'node:net';\n\nconst ipv6To4Prefix = '::ffff:';\n\nexport const isLocalSocket = (socket: Socket): boolean => {\n let { localAddress, remoteAddress, remoteFamily } = socket;\n\n const isLoopbackRequest = localAddress && localAddress === remoteAddress;\n if (isLoopbackRequest) {\n return true;\n } else if (!remoteAddress || !remoteFamily) {\n return false;\n }\n\n if (remoteFamily === 'IPv6' && remoteAddress.startsWith(ipv6To4Prefix)) {\n remoteAddress = remoteAddress.slice(ipv6To4Prefix.length);\n }\n\n return remoteAddress === '::1' || remoteAddress.startsWith('127.');\n};\n\ninterface AbstractIncomingMessage {\n headers: IncomingHttpHeaders | Record<string, string | string[]>;\n}\n\nexport const isMatchingOrigin = (\n request: AbstractIncomingMessage,\n serverBaseUrl: string\n): boolean => {\n // NOTE(@kitten): The browser will always send an origin header for websocket upgrade connections\n if (!request.headers.origin) {\n return true;\n }\n let actualHost: string;\n try {\n actualHost = new URL(`${request.headers.origin}`).host;\n } catch {\n // Malformed Origin — treat as untrusted.\n return false;\n }\n const expectedHost = new URL(serverBaseUrl).host;\n return actualHost === expectedHost;\n};\n\nconst DEV_CALL_THROTTLE_MS = 2_000;\nlet lastRemoteDevCallAt = 0;\n\n/** Process-wide throttle. Returns `true` if another call fired within the cooldown window. */\nexport const shouldThrottleRemoteDevCall = (): boolean => {\n const now = Date.now();\n if (now - lastRemoteDevCallAt < DEV_CALL_THROTTLE_MS) {\n return true;\n }\n lastRemoteDevCallAt = now;\n return false;\n};\n"],"names":["isLocalSocket","isMatchingOrigin","shouldThrottleRemoteDevCall","ipv6To4Prefix","socket","localAddress","remoteAddress","remoteFamily","isLoopbackRequest","startsWith","slice","length","request","serverBaseUrl","headers","origin","actualHost","URL","host","expectedHost","DEV_CALL_THROTTLE_MS","lastRemoteDevCallAt","now","Date"],"mappings":";;;;;;;;;;;QAKaA;eAAAA;;QAqBAC;eAAAA;;QAuBAC;eAAAA;;;AA9Cb,MAAMC,gBAAgB;AAEf,MAAMH,gBAAgB,CAACI;IAC5B,IAAI,EAAEC,YAAY,EAAEC,aAAa,EAAEC,YAAY,EAAE,GAAGH;IAEpD,MAAMI,oBAAoBH,gBAAgBA,iBAAiBC;IAC3D,IAAIE,mBAAmB;QACrB,OAAO;IACT,OAAO,IAAI,CAACF,iBAAiB,CAACC,cAAc;QAC1C,OAAO;IACT;IAEA,IAAIA,iBAAiB,UAAUD,cAAcG,UAAU,CAACN,gBAAgB;QACtEG,gBAAgBA,cAAcI,KAAK,CAACP,cAAcQ,MAAM;IAC1D;IAEA,OAAOL,kBAAkB,SAASA,cAAcG,UAAU,CAAC;AAC7D;AAMO,MAAMR,mBAAmB,CAC9BW,SACAC;IAEA,iGAAiG;IACjG,IAAI,CAACD,QAAQE,OAAO,CAACC,MAAM,EAAE;QAC3B,OAAO;IACT;IACA,IAAIC;IACJ,IAAI;QACFA,aAAa,IAAIC,IAAI,GAAGL,QAAQE,OAAO,CAACC,MAAM,EAAE,EAAEG,IAAI;IACxD,EAAE,OAAM;QACN,yCAAyC;QACzC,OAAO;IACT;IACA,MAAMC,eAAe,IAAIF,IAAIJ,eAAeK,IAAI;IAChD,OAAOF,eAAeG;AACxB;AAEA,MAAMC,uBAAuB;AAC7B,IAAIC,sBAAsB;AAGnB,MAAMnB,8BAA8B;IACzC,MAAMoB,MAAMC,KAAKD,GAAG;IACpB,IAAIA,MAAMD,sBAAsBD,sBAAsB;QACpD,OAAO;IACT;IACAC,sBAAsBC;IACtB,OAAO;AACT"}
|
|
@@ -5,23 +5,23 @@ 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
|
-
event
|
|
12
|
+
get event () {
|
|
13
13
|
return event;
|
|
14
14
|
},
|
|
15
|
-
getEnvFiles
|
|
15
|
+
get getEnvFiles () {
|
|
16
16
|
return getEnvFiles;
|
|
17
17
|
},
|
|
18
|
-
loadEnvFiles
|
|
18
|
+
get loadEnvFiles () {
|
|
19
19
|
return loadEnvFiles;
|
|
20
20
|
},
|
|
21
|
-
reloadEnvFiles
|
|
21
|
+
get reloadEnvFiles () {
|
|
22
22
|
return reloadEnvFiles;
|
|
23
23
|
},
|
|
24
|
-
setNodeEnv
|
|
24
|
+
get setNodeEnv () {
|
|
25
25
|
return setNodeEnv;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/nodeEnv.ts"],"sourcesContent":["import * as env from '@expo/env';\nimport path from 'node:path';\n\nimport { events, shouldReduceLogs } from '../events';\n\ntype EnvOutput = Record<string, string | undefined>;\n\n// TODO(@kitten): We assign this here to run server-side code bundled by metro\n// It's not isolated into a worker thread yet\ndeclare namespace globalThis {\n let __DEV__: boolean | undefined;\n}\n\n// prettier-ignore\nexport const event = events('env', (t) => [\n t.event<'mode', {\n nodeEnv: string;\n babelEnv: string;\n mode: 'development' | 'production';\n }>(),\n t.event<'load', {\n mode: string | undefined;\n files: string[];\n env: Record<string, string | undefined>;\n }>(),\n]);\n\n/**\n * Set the environment to production or development\n * lots of tools use this to determine if they should run in a dev mode.\n */\nexport function setNodeEnv(mode: 'development' | 'production') {\n process.env.NODE_ENV = process.env.NODE_ENV || mode;\n process.env.BABEL_ENV = process.env.BABEL_ENV || process.env.NODE_ENV;\n globalThis.__DEV__ = process.env.NODE_ENV !== 'production';\n\n event('mode', {\n nodeEnv: process.env.NODE_ENV,\n babelEnv: process.env.BABEL_ENV,\n mode,\n });\n}\n\ninterface LoadEnvFilesOptions {\n force?: boolean;\n silent?: boolean;\n mode?: string;\n}\n\nlet prevEnvKeys: Set<string> | undefined;\n\n/**\n * Load the dotenv files into the current `process.env` scope.\n * Note, this requires `NODE_ENV` being set through `setNodeEnv`.\n */\nexport function loadEnvFiles(projectRoot: string, options?: LoadEnvFilesOptions) {\n const params = {\n ...options,\n silent: !!options?.silent || shouldReduceLogs(),\n force: !!options?.force,\n mode: process.env.NODE_ENV,\n systemEnv: process.env,\n };\n\n const envInfo = env.loadProjectEnv(projectRoot, params);\n const envOutput: EnvOutput = {};\n if (envInfo.result === 'loaded') {\n prevEnvKeys = new Set();\n for (const key of envInfo.loaded) {\n envOutput[key] = envInfo.env[key] ?? undefined;\n prevEnvKeys.add(key);\n }\n }\n\n if (envInfo.result === 'loaded') {\n event('load', {\n mode: params.mode,\n files: envInfo.files.map((file) => event.path(file)),\n env: envOutput,\n });\n }\n\n if (!params.silent) {\n env.logLoadedEnv(envInfo, params);\n }\n return process.env;\n}\n\nexport function getEnvFiles(projectRoot: string) {\n return env\n .getEnvFiles({ mode: process.env.NODE_ENV })\n .map((fileName) => path.join(projectRoot, fileName));\n}\n\nexport function reloadEnvFiles(projectRoot: string) {\n const isEnabled = env.isEnabled();\n if (isEnabled) {\n const params = {\n force: true,\n silent: true,\n mode: process.env.NODE_ENV,\n systemEnv: process.env,\n };\n\n // We use a global tracker to allow overwrites of env vars we set ourselves\n const envInfo = env.parseProjectEnv(projectRoot, params);\n const envOutput: EnvOutput = {};\n for (const key in envInfo.env) {\n const value = envInfo.env[key];\n if (process.env[key] !== value) {\n if (\n typeof process.env[key] === 'undefined' ||\n ((!prevEnvKeys || prevEnvKeys.has(key)) && process.env[key] !== value)\n ) {\n (prevEnvKeys ||= new Set()).add(key);\n process.env[key] = envInfo.env[key];\n envOutput[key] = value ?? undefined;\n }\n }\n }\n\n event('load', {\n mode: params.mode,\n files: envInfo.files.map((file) => event.path(file)),\n env: envOutput,\n });\n }\n}\n"],"names":["event","getEnvFiles","loadEnvFiles","reloadEnvFiles","setNodeEnv","events","t","mode","process","env","NODE_ENV","BABEL_ENV","globalThis","__DEV__","nodeEnv","babelEnv","prevEnvKeys","projectRoot","options","params","silent","shouldReduceLogs","force","systemEnv","envInfo","loadProjectEnv","envOutput","result","Set","key","loaded","undefined","add","files","map","file","path","logLoadedEnv","fileName","join","isEnabled","parseProjectEnv","value","has"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/nodeEnv.ts"],"sourcesContent":["import * as env from '@expo/env';\nimport path from 'node:path';\n\nimport { events, shouldReduceLogs } from '../events';\n\ntype EnvOutput = Record<string, string | undefined>;\n\n// TODO(@kitten): We assign this here to run server-side code bundled by metro\n// It's not isolated into a worker thread yet\ndeclare namespace globalThis {\n let __DEV__: boolean | undefined;\n}\n\n// prettier-ignore\nexport const event = events('env', (t) => [\n t.event<'mode', {\n nodeEnv: string;\n babelEnv: string;\n mode: 'development' | 'production';\n }>(),\n t.event<'load', {\n mode: string | undefined;\n files: string[];\n env: Record<string, string | undefined>;\n }>(),\n]);\n\n/**\n * Set the environment to production or development\n * lots of tools use this to determine if they should run in a dev mode.\n */\nexport function setNodeEnv(mode: 'development' | 'production') {\n process.env.NODE_ENV = process.env.NODE_ENV || mode;\n process.env.BABEL_ENV = process.env.BABEL_ENV || process.env.NODE_ENV;\n globalThis.__DEV__ = process.env.NODE_ENV !== 'production';\n\n event('mode', {\n nodeEnv: process.env.NODE_ENV,\n babelEnv: process.env.BABEL_ENV,\n mode,\n });\n}\n\ninterface LoadEnvFilesOptions {\n force?: boolean;\n silent?: boolean;\n mode?: string;\n}\n\nlet prevEnvKeys: Set<string> | undefined;\n\n/**\n * Load the dotenv files into the current `process.env` scope.\n * Note, this requires `NODE_ENV` being set through `setNodeEnv`.\n */\nexport function loadEnvFiles(projectRoot: string, options?: LoadEnvFilesOptions) {\n const params = {\n ...options,\n silent: !!options?.silent || shouldReduceLogs(),\n force: !!options?.force,\n mode: process.env.NODE_ENV,\n systemEnv: process.env,\n };\n\n const envInfo = env.loadProjectEnv(projectRoot, params);\n const envOutput: EnvOutput = {};\n if (envInfo.result === 'loaded') {\n prevEnvKeys = new Set();\n for (const key of envInfo.loaded) {\n envOutput[key] = envInfo.env[key] ?? undefined;\n prevEnvKeys.add(key);\n }\n }\n\n if (envInfo.result === 'loaded') {\n event('load', {\n mode: params.mode,\n files: envInfo.files.map((file) => event.path(file)),\n env: envOutput,\n });\n }\n\n if (!params.silent) {\n env.logLoadedEnv(envInfo, params);\n }\n return process.env;\n}\n\nexport function getEnvFiles(projectRoot: string) {\n return env\n .getEnvFiles({ mode: process.env.NODE_ENV })\n .map((fileName) => path.join(projectRoot, fileName));\n}\n\nexport function reloadEnvFiles(projectRoot: string) {\n const isEnabled = env.isEnabled();\n if (isEnabled) {\n const params = {\n force: true,\n silent: true,\n mode: process.env.NODE_ENV,\n systemEnv: process.env,\n };\n\n // We use a global tracker to allow overwrites of env vars we set ourselves\n const envInfo = env.parseProjectEnv(projectRoot, params);\n const envOutput: EnvOutput = {};\n for (const key in envInfo.env) {\n const value = envInfo.env[key];\n if (process.env[key] !== value) {\n if (\n typeof process.env[key] === 'undefined' ||\n ((!prevEnvKeys || prevEnvKeys.has(key)) && process.env[key] !== value)\n ) {\n (prevEnvKeys ||= new Set()).add(key);\n process.env[key] = envInfo.env[key];\n envOutput[key] = value ?? undefined;\n }\n }\n }\n\n event('load', {\n mode: params.mode,\n files: envInfo.files.map((file) => event.path(file)),\n env: envOutput,\n });\n }\n}\n"],"names":["event","getEnvFiles","loadEnvFiles","reloadEnvFiles","setNodeEnv","events","t","mode","process","env","NODE_ENV","BABEL_ENV","globalThis","__DEV__","nodeEnv","babelEnv","prevEnvKeys","projectRoot","options","params","silent","shouldReduceLogs","force","systemEnv","envInfo","loadProjectEnv","envOutput","result","Set","key","loaded","undefined","add","files","map","file","path","logLoadedEnv","fileName","join","isEnabled","parseProjectEnv","value","has"],"mappings":";;;;;;;;;;;QAcaA;eAAAA;;QA0EGC;eAAAA;;QAjCAC;eAAAA;;QAuCAC;eAAAA;;QA/DAC;eAAAA;;;;iEA/BK;;;;;;;gEACJ;;;;;;wBAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWlC,MAAMJ,QAAQK,IAAAA,cAAM,EAAC,OAAO,CAACC,IAAM;QACxCA,EAAEN,KAAK;QAKPM,EAAEN,KAAK;KAKR;AAMM,SAASI,WAAWG,IAAkC;IAC3DC,QAAQC,GAAG,CAACC,QAAQ,GAAGF,QAAQC,GAAG,CAACC,QAAQ,IAAIH;IAC/CC,QAAQC,GAAG,CAACE,SAAS,GAAGH,QAAQC,GAAG,CAACE,SAAS,IAAIH,QAAQC,G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IAAI,CAACtB,aAAaqB;AAC9C;AAEO,SAASnC,eAAec,WAAmB;IAChD,MAAMuB,YAAY/B,OAAI+B,SAAS;IAC/B,IAAIA,WAAW;QACb,MAAMrB,SAAS;YACbG,OAAO;YACPF,QAAQ;YACRb,MAAMC,QAAQC,GAAG,CAACC,QAAQ;YAC1Ba,WAAWf,QAAQC,GAAG;QACxB;QAEA,2EAA2E;QAC3E,MAAMe,UAAUf,OAAIgC,eAAe,CAACxB,aAAaE;QACjD,MAAMO,YAAuB,CAAC;QAC9B,IAAK,MAAMG,OAAOL,QAAQf,GAAG,CAAE;YAC7B,MAAMiC,QAAQlB,QAAQf,GAAG,CAACoB,IAAI;YAC9B,IAAIrB,QAAQC,GAAG,CAACoB,IAAI,KAAKa,OAAO;gBAC9B,IACE,OAAOlC,QAAQC,GAAG,CAACoB,IAAI,KAAK,eAC3B,AAAC,CAAA,CAACb,eAAeA,YAAY2B,GAAG,CAACd,IAAG,KAAMrB,QAAQC,GAAG,CAACoB,IAAI,KAAKa,OAChE;oBACC1B,CAAAA,gBAAgB,IAAIY,KAAI,EAAGI,GAAG,CAACH;oBAChCrB,QAAQC,GAAG,CAACoB,IAAI,GAAGL,QAAQf,GAAG,CAACoB,IAAI;oBACnCH,SAAS,CAACG,IAAI,GAAGa,SAASX;gBAC5B;YACF;QACF;QAEA/B,MAAM,QAAQ;YACZO,MAAMY,OAAOZ,IAAI;YACjB0B,OAAOT,QAAQS,KAAK,CAACC,GAAG,CAAC,CAACC,OAASnC,MAAMoC,IAAI,CAACD;YAC9C1B,KAAKiB;QACP;IACF;AACF"}
|
package/build/src/utils/npm.js
CHANGED
|
@@ -5,32 +5,32 @@ 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
|
-
downloadAndExtractNpmModuleAsync
|
|
12
|
+
get downloadAndExtractNpmModuleAsync () {
|
|
13
13
|
return downloadAndExtractNpmModuleAsync;
|
|
14
14
|
},
|
|
15
|
-
extractLocalNpmTarballAsync
|
|
15
|
+
get extractLocalNpmTarballAsync () {
|
|
16
16
|
return extractLocalNpmTarballAsync;
|
|
17
17
|
},
|
|
18
|
-
extractNpmTarballAsync
|
|
18
|
+
get extractNpmTarballAsync () {
|
|
19
19
|
return extractNpmTarballAsync;
|
|
20
20
|
},
|
|
21
|
-
extractNpmTarballFromUrlAsync
|
|
21
|
+
get extractNpmTarballFromUrlAsync () {
|
|
22
22
|
return extractNpmTarballFromUrlAsync;
|
|
23
23
|
},
|
|
24
|
-
getNpmUrlAsync
|
|
24
|
+
get getNpmUrlAsync () {
|
|
25
25
|
return getNpmUrlAsync;
|
|
26
26
|
},
|
|
27
|
-
npmViewAsync
|
|
27
|
+
get npmViewAsync () {
|
|
28
28
|
return npmViewAsync;
|
|
29
29
|
},
|
|
30
|
-
packNpmTarballAsync
|
|
30
|
+
get packNpmTarballAsync () {
|
|
31
31
|
return packNpmTarballAsync;
|
|
32
32
|
},
|
|
33
|
-
sanitizeNpmPackageName
|
|
33
|
+
get sanitizeNpmPackageName () {
|
|
34
34
|
return sanitizeNpmPackageName;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -212,6 +212,7 @@ async function packNpmTarballAsync(packageDir) {
|
|
|
212
212
|
})).stdout) == null ? void 0 : _stdout.trim();
|
|
213
213
|
try {
|
|
214
214
|
const [json] = JSON.parse(results);
|
|
215
|
+
(0, _nodeassert().default)(typeof (json == null ? void 0 : json.filename) === 'string', 'Expected filename property on JSON array of type "string"');
|
|
215
216
|
return _nodepath().default.resolve(packageDir, json.filename);
|
|
216
217
|
} catch (error) {
|
|
217
218
|
const cmdString = `npm ${cmdArgs.join(' ')}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/npm.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport { JSONValue } from '@expo/json-file';\nimport spawnAsync from '@expo/spawn-async';\nimport { TarTypeFlag } from 'multitars';\nimport assert from 'node:assert';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport slugify from 'slugify';\nimport { Readable } from 'stream';\n\nimport { CommandError } from './errors';\nimport { extractStream } from './tar';\n\nconst debug = require('debug')('expo:utils:npm') as typeof console.log;\n\nexport function sanitizeNpmPackageName(name: string): string {\n // https://github.com/npm/validate-npm-package-name/#naming-rules\n return (\n applyKnownNpmPackageNameRules(name) ||\n applyKnownNpmPackageNameRules(slugify(name)) ||\n // If nothing is left use 'app' like we do in Xcode projects.\n 'app'\n );\n}\n\nfunction applyKnownNpmPackageNameRules(name: string): string | null {\n // https://github.com/npm/validate-npm-package-name/#naming-rules\n\n // package name cannot start with '.' or '_'.\n while (/^(\\.|_)/.test(name)) {\n name = name.substring(1);\n }\n\n name = name.toLowerCase().replace(/[^a-zA-Z._\\-/@]/g, '');\n\n return (\n name\n // .replace(/![a-z0-9-._~]+/g, '')\n // Remove special characters\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '') || null\n );\n}\n\nexport async function npmViewAsync(...props: string[]): Promise<JSONValue> {\n const cmd = ['view', ...props, '--json'];\n const results = (await spawnAsync('npm', cmd)).stdout?.trim();\n const cmdString = `npm ${cmd.join(' ')}`;\n debug('Run:', cmdString);\n if (!results) {\n return null;\n }\n try {\n return JSON.parse(results);\n } catch (error: any) {\n throw new Error(\n `Could not parse JSON returned from \"${cmdString}\".\\n\\n${results}\\n\\nError: ${error.message}`\n );\n }\n}\n\n/** Given a package name like `expo` or `expo@beta`, return the registry URL if it exists. */\nexport async function getNpmUrlAsync(packageName: string): Promise<string> {\n const results = await npmViewAsync(packageName, 'dist');\n\n assert(results, `Could not get npm url for package \"${packageName}\"`);\n\n // Fully qualified url returns an object.\n // Example:\n // 𝝠 npm view expo-template-bare-minimum@sdk-33 dist --json\n if (typeof results === 'object' && !Array.isArray(results)) {\n return results.tarball as string;\n }\n\n // When the tag is arbitrary, the tarball is an array, return the last value as it's the most recent.\n // Example:\n // 𝝠 npm view expo-template-bare-minimum@33 dist --json\n if (Array.isArray(results)) {\n const lastResult = results[results.length - 1];\n\n if (lastResult && typeof lastResult === 'object' && !Array.isArray(lastResult)) {\n return lastResult.tarball as string;\n }\n }\n\n throw new CommandError(\n 'Expected results of `npm view ...` to be an array or string. Instead found: ' + results\n );\n}\n\nexport interface ExtractProps {\n expName?: string;\n filter?(path: string): boolean | undefined | null;\n strip?: number;\n}\n\nfunction renameNpmTarballEntries(expName: string | undefined) {\n const renameConfigs = (input: string, typeflag: TarTypeFlag): string | null => {\n if (typeflag === TarTypeFlag.FILE && path.basename(input) === 'gitignore') {\n // Rename `gitignore` because npm ignores files named `.gitignore` when publishing.\n // See: https://github.com/npm/npm/issues/1862\n return input.replace(/gitignore$/, '.gitignore');\n } else {\n return input;\n }\n };\n if (expName) {\n const androidName = IOSConfig.XcodeUtils.sanitizedName(expName.toLowerCase());\n const iosName = IOSConfig.XcodeUtils.sanitizedName(expName);\n const lowerCaseName = iosName.toLowerCase();\n return (input: string, typeflag: TarTypeFlag) => {\n input = input\n .replace(/HelloWorld/g, input.includes('android') ? androidName : iosName)\n .replace(/helloworld/g, lowerCaseName);\n return renameConfigs(input, typeflag);\n };\n } else {\n return renameConfigs;\n }\n}\n\n/**\n * Extracts a tarball stream to a directory and returns the checksum of the tarball.\n */\nexport async function extractNpmTarballAsync(\n stream: ReadableStream,\n output: string,\n props: ExtractProps\n): Promise<string> {\n return await extractStream(stream, output, {\n filter: props.filter,\n rename: renameNpmTarballEntries(props.expName),\n strip: props.strip ?? 1,\n });\n}\n\nexport async function extractNpmTarballFromUrlAsync(\n url: string,\n output: string,\n props: ExtractProps\n): Promise<string> {\n const response = await fetch(url);\n if (!response.ok || !response.body) {\n throw new Error(`Unexpected response: ${response.statusText}. From url: ${url}`);\n }\n return await extractNpmTarballAsync(response.body, output, props);\n}\n\nexport async function downloadAndExtractNpmModuleAsync(\n npmName: string,\n output: string,\n props: ExtractProps\n): Promise<string> {\n const url = await getNpmUrlAsync(npmName);\n debug('Fetch from URL:', url);\n return await extractNpmTarballFromUrlAsync(url, output, props);\n}\n\nexport async function extractLocalNpmTarballAsync(\n tarFilePath: string,\n output: string,\n props: ExtractProps\n): Promise<string> {\n return await extractNpmTarballAsync(\n Readable.toWeb(fs.createReadStream(tarFilePath)) as ReadableStream,\n output,\n props\n );\n}\n\nexport async function packNpmTarballAsync(packageDir: string): Promise<string> {\n const cmdArgs = ['pack', '--json', '--foreground-scripts=false'];\n const results = (\n await spawnAsync('npm', cmdArgs, {\n env: { ...process.env },\n cwd: packageDir,\n })\n ).stdout?.trim();\n try {\n const [json] = JSON.parse(results) as { filename: string }[];\n return path.resolve(packageDir, json.filename);\n } catch (error: any) {\n const cmdString = `npm ${cmdArgs.join(' ')}`;\n throw new Error(\n `Could not parse JSON returned from \"${cmdString}\".\\n\\n${results}\\n\\nError: ${error.message}`\n );\n }\n}\n"],"names":["downloadAndExtractNpmModuleAsync","extractLocalNpmTarballAsync","extractNpmTarballAsync","extractNpmTarballFromUrlAsync","getNpmUrlAsync","npmViewAsync","packNpmTarballAsync","sanitizeNpmPackageName","debug","require","name","applyKnownNpmPackageNameRules","slugify","test","substring","toLowerCase","replace","normalize","props","cmd","results","spawnAsync","stdout","trim","cmdString","join","JSON","parse","error","Error","message","packageName","assert","Array","isArray","tarball","lastResult","length","CommandError","renameNpmTarballEntries","expName","renameConfigs","input","typeflag","TarTypeFlag","FILE","path","basename","androidName","IOSConfig","XcodeUtils","sanitizedName","iosName","lowerCaseName","includes","stream","output","extractStream","filter","rename","strip","url","response","fetch","ok","body","statusText","npmName","tarFilePath","Readable","toWeb","fs","createReadStream","packageDir","cmdArgs","env","process","cwd","json","resolve","filename"],"mappings":";;;;;;;;;;;IAoJsBA,gCAAgC;eAAhCA;;IAU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GAAGpD,KAAKC,KAAK,CAACP;QAC1B,OAAO0B,mBAAI,CAACiC,OAAO,CAACN,YAAYK,KAAKE,QAAQ;IAC/C,EAAE,OAAOpD,OAAY;QACnB,MAAMJ,YAAY,CAAC,IAAI,EAAEkD,QAAQjD,IAAI,CAAC,MAAM;QAC5C,MAAM,IAAII,MACR,CAAC,oCAAoC,EAAEL,UAAU,MAAM,EAAEJ,QAAQ,WAAW,EAAEQ,MAAME,OAAO,EAAE;IAEjG;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/npm.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport type { JSONValue } from '@expo/json-file';\nimport spawnAsync from '@expo/spawn-async';\nimport { TarTypeFlag } from 'multitars';\nimport assert from 'node:assert';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport slugify from 'slugify';\nimport { Readable } from 'stream';\n\nimport { CommandError } from './errors';\nimport { extractStream } from './tar';\n\nconst debug = require('debug')('expo:utils:npm') as typeof console.log;\n\nexport function sanitizeNpmPackageName(name: string): string {\n // https://github.com/npm/validate-npm-package-name/#naming-rules\n return (\n applyKnownNpmPackageNameRules(name) ||\n applyKnownNpmPackageNameRules(slugify(name)) ||\n // If nothing is left use 'app' like we do in Xcode projects.\n 'app'\n );\n}\n\nfunction applyKnownNpmPackageNameRules(name: string): string | null {\n // https://github.com/npm/validate-npm-package-name/#naming-rules\n\n // package name cannot start with '.' or '_'.\n while (/^(\\.|_)/.test(name)) {\n name = name.substring(1);\n }\n\n name = name.toLowerCase().replace(/[^a-zA-Z._\\-/@]/g, '');\n\n return (\n name\n // .replace(/![a-z0-9-._~]+/g, '')\n // Remove special characters\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '') || null\n );\n}\n\nexport async function npmViewAsync(...props: string[]): Promise<JSONValue> {\n const cmd = ['view', ...props, '--json'];\n const results = (await spawnAsync('npm', cmd)).stdout?.trim();\n const cmdString = `npm ${cmd.join(' ')}`;\n debug('Run:', cmdString);\n if (!results) {\n return null;\n }\n try {\n return JSON.parse(results);\n } catch (error: any) {\n throw new Error(\n `Could not parse JSON returned from \"${cmdString}\".\\n\\n${results}\\n\\nError: ${error.message}`\n );\n }\n}\n\n/** Given a package name like `expo` or `expo@beta`, return the registry URL if it exists. */\nexport async function getNpmUrlAsync(packageName: string): Promise<string> {\n const results = await npmViewAsync(packageName, 'dist');\n\n assert(results, `Could not get npm url for package \"${packageName}\"`);\n\n // Fully qualified url returns an object.\n // Example:\n // 𝝠 npm view expo-template-bare-minimum@sdk-33 dist --json\n if (typeof results === 'object' && !Array.isArray(results)) {\n return results.tarball as string;\n }\n\n // When the tag is arbitrary, the tarball is an array, return the last value as it's the most recent.\n // Example:\n // 𝝠 npm view expo-template-bare-minimum@33 dist --json\n if (Array.isArray(results)) {\n const lastResult = results[results.length - 1];\n\n if (lastResult && typeof lastResult === 'object' && !Array.isArray(lastResult)) {\n return lastResult.tarball as string;\n }\n }\n\n throw new CommandError(\n 'Expected results of `npm view ...` to be an array or string. Instead found: ' + results\n );\n}\n\nexport interface ExtractProps {\n expName?: string;\n filter?(path: string): boolean | undefined | null;\n strip?: number;\n}\n\nfunction renameNpmTarballEntries(expName: string | undefined) {\n const renameConfigs = (input: string, typeflag: TarTypeFlag): string | null => {\n if (typeflag === TarTypeFlag.FILE && path.basename(input) === 'gitignore') {\n // Rename `gitignore` because npm ignores files named `.gitignore` when publishing.\n // See: https://github.com/npm/npm/issues/1862\n return input.replace(/gitignore$/, '.gitignore');\n } else {\n return input;\n }\n };\n if (expName) {\n const androidName = IOSConfig.XcodeUtils.sanitizedName(expName.toLowerCase());\n const iosName = IOSConfig.XcodeUtils.sanitizedName(expName);\n const lowerCaseName = iosName.toLowerCase();\n return (input: string, typeflag: TarTypeFlag) => {\n input = input\n .replace(/HelloWorld/g, input.includes('android') ? androidName : iosName)\n .replace(/helloworld/g, lowerCaseName);\n return renameConfigs(input, typeflag);\n };\n } else {\n return renameConfigs;\n }\n}\n\n/**\n * Extracts a tarball stream to a directory and returns the checksum of the tarball.\n */\nexport async function extractNpmTarballAsync(\n stream: ReadableStream,\n output: string,\n props: ExtractProps\n): Promise<string> {\n return await extractStream(stream, output, {\n filter: props.filter,\n rename: renameNpmTarballEntries(props.expName),\n strip: props.strip ?? 1,\n });\n}\n\nexport async function extractNpmTarballFromUrlAsync(\n url: string,\n output: string,\n props: ExtractProps\n): Promise<string> {\n const response = await fetch(url);\n if (!response.ok || !response.body) {\n throw new Error(`Unexpected response: ${response.statusText}. From url: ${url}`);\n }\n return await extractNpmTarballAsync(response.body, output, props);\n}\n\nexport async function downloadAndExtractNpmModuleAsync(\n npmName: string,\n output: string,\n props: ExtractProps\n): Promise<string> {\n const url = await getNpmUrlAsync(npmName);\n debug('Fetch from URL:', url);\n return await extractNpmTarballFromUrlAsync(url, output, props);\n}\n\nexport async function extractLocalNpmTarballAsync(\n tarFilePath: string,\n output: string,\n props: ExtractProps\n): Promise<string> {\n return await extractNpmTarballAsync(\n Readable.toWeb(fs.createReadStream(tarFilePath)) as ReadableStream,\n output,\n props\n );\n}\n\nexport async function packNpmTarballAsync(packageDir: string): Promise<string> {\n const cmdArgs = ['pack', '--json', '--foreground-scripts=false'];\n const results = (\n await spawnAsync('npm', cmdArgs, {\n env: { ...process.env },\n cwd: packageDir,\n })\n ).stdout?.trim();\n try {\n const [json] = JSON.parse(results) as { filename: string }[];\n assert(\n typeof json?.filename === 'string',\n 'Expected filename property on JSON array of type \"string\"'\n );\n return path.resolve(packageDir, json.filename);\n } catch (error: any) {\n const cmdString = `npm ${cmdArgs.join(' ')}`;\n throw new Error(\n `Could not parse JSON returned from \"${cmdString}\".\\n\\n${results}\\n\\nError: ${error.message}`\n );\n }\n}\n"],"names":["downloadAndExtractNpmModuleAsync","extractLocalNpmTarballAsync","extractNpmTarballAsync","extractNpmTarballFromUrlAsync","getNpmUrlAsync","npmViewAsync","packNpmTarballAsync","sanitizeNpmPackageName","debug","require","name","applyKnownNpmPackageNameRules","slugify","test","substring","toLowerCase","replace","normalize","props","cmd","results","spawnAsync","stdout","trim","cmdString","join","JSON","parse","error","Error","message","packageName","assert","Array","isArray","tarball","lastResult","length","CommandError","renameNpmTarballEntries","expName","renameConfigs","input","typeflag","TarTypeFlag","FILE","path","basename","androidName","IOSConfig","XcodeUtils","sanitizedName","iosName","lowerCaseName","includes","stream","output","extractStream","filter","rename","strip","url","response","fetch","ok","body","statusText","npmName","tarFilePath","Readable","toWeb","fs","createReadStream","packageDir","cmdArgs","env","process","cwd","json","filename","resolve"],"mappings":";;;;;;;;;;;QAoJsBA;eAAAA;;QAUAC;eAAAA;;QAlCAC;eAAAA;;QAYAC;eAAAA;;QA1EAC;eAAAA;;QAlBAC;eAAAA;;QA8HAC;eAAAA;;QA3JNC;eAAAA;;;;yBAfU;;;;;;;gEAEH;;;;;;;yBACK;;;;;;;gEACT;;;;;;;gEACJ;;;;;;;gEACE;;;;;;;gEACG;;;;;;;yBACK;;;;;;wBAEI;qBACC;;;;;;AAE9B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,SAASF,uBAAuBG,IAAY;IACjD,iEAAiE;IACjE,OACEC,8BAA8BD,SAC9BC,8BAA8BC,IAAAA,kBAAO,EAACF,UACtC,6DAA6D;IAC7D;AAEJ;AAEA,SAASC,8BAA8BD,IAAY;IACjD,iEAAiE;IAEjE,6CAA6C;IAC7C,MAAO,UAAUG,IAAI,CAACH,MAAO;QAC3BA,OAAOA,KAAKI,SAAS,CAAC;IACxB;IAEAJ,OAAOA,KAAKK,WAAW,GAAGC,OAAO,CAAC,oBAAoB;IAEtD,OACEN,IACE,kCAAkC;IAClC,4BAA4B;KAC3BO,SAAS,CAAC,OACVD,OAAO,CAAC,oBAAoB,OAAO;AAE1C;AAEO,eAAeX,aAAa,GAAGa,KAAe;QAEnC;IADhB,MAAMC,MAAM;QAAC;WAAWD;QAAO;KAAS;IACxC,MAAME,WAAU,UAAA,AAAC,CAAA,MAAMC,IAAAA,qBAAU,EAAC,OAAOF,IAAG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;AAEO,eAAeZ,oBAAoBmE,UAAkB;QAE1C;IADhB,MAAMC,UAAU;QAAC;QAAQ;QAAU;KAA6B;IAChE,MAAMtD,WAAU,UAAA,AACd,CAAA,MAAMC,IAAAA,qBAAU,EAAC,OAAOqD,SAAS;QAC/BC,KAAK;YAAE,GAAGC,QAAQD,GAAG;QAAC;QACtBE,KAAKJ;IACP,EAAC,EACDnD,MAAM,qBALQ,QAKNC,IAAI;IACd,IAAI;QACF,MAAM,CAACuD,KAAK,GAAGpD,KAAKC,KAAK,CAACP;QAC1BY,IAAAA,qBAAM,EACJ,QAAO8C,wBAAAA,KAAMC,QAAQ,MAAK,UAC1B;QAEF,OAAOjC,mBAAI,CAACkC,OAAO,CAACP,YAAYK,KAAKC,QAAQ;IAC/C,EAAE,OAAOnD,OAAY;QACnB,MAAMJ,YAAY,CAAC,IAAI,EAAEkD,QAAQjD,IAAI,CAAC,MAAM;QAC5C,MAAM,IAAII,MACR,CAAC,oCAAoC,EAAEL,UAAU,MAAM,EAAEJ,QAAQ,WAAW,EAAEQ,MAAME,OAAO,EAAE;IAEjG;AACF"}
|
package/build/src/utils/obj.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
|
-
get
|
|
12
|
+
get get () {
|
|
13
13
|
return get;
|
|
14
14
|
},
|
|
15
|
-
pickBy
|
|
15
|
+
get pickBy () {
|
|
16
16
|
return pickBy;
|
|
17
17
|
},
|
|
18
|
-
set
|
|
18
|
+
get set () {
|
|
19
19
|
return set;
|
|
20
20
|
}
|
|
21
21
|
});
|